Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // Author: Alexei Sytov << 27 // Co-author: Gianfranco PaternĂ² (modificat << 28 // On the base of the CRYSTALRAD realization o << 29 // A. I. Sytov, V. V. Tikhomirov, and L. Bandi << 30 26 31 #ifndef G4ChannelingFastSimModel_h 27 #ifndef G4ChannelingFastSimModel_h 32 #define G4ChannelingFastSimModel_h 1 28 #define G4ChannelingFastSimModel_h 1 33 29 34 #include "G4VFastSimulationModel.hh" 30 #include "G4VFastSimulationModel.hh" 35 #include "G4Step.hh" 31 #include "G4Step.hh" 36 #include "G4TouchableHandle.hh" 32 #include "G4TouchableHandle.hh" 37 #include <vector> 33 #include <vector> 38 #include <CLHEP/Units/SystemOfUnits.h> 34 #include <CLHEP/Units/SystemOfUnits.h> 39 #include <CLHEP/Units/PhysicalConstants.h> 35 #include <CLHEP/Units/PhysicalConstants.h> 40 36 41 #include "G4ChannelingFastSimCrystalData.hh" 37 #include "G4ChannelingFastSimCrystalData.hh" 42 #include <unordered_map> 38 #include <unordered_map> 43 #include "G4BaierKatkov.hh" 39 #include "G4BaierKatkov.hh" 44 #include "G4LogicalVolume.hh" 40 #include "G4LogicalVolume.hh" 45 #include "G4ParticleTable.hh" 41 #include "G4ParticleTable.hh" 46 42 47 /** \file G4ChannelingFastSimModel.hh 43 /** \file G4ChannelingFastSimModel.hh 48 * \brief Definition of the G4ChannelingFastSim 44 * \brief Definition of the G4ChannelingFastSimModel class 49 * FastSimulation Channeling model: calculates 45 * FastSimulation Channeling model: calculates charge particle trajectories 50 * in oriented crystals in the field of crystal 46 * in oriented crystals in the field of crystal planes/axes either straight or bent. 51 * It is also possible to simulate radiation us 47 * It is also possible to simulate radiation using Baier-Katkov method. 52 */ 48 */ 53 49 54 class G4ChannelingFastSimModel : public G4VFas 50 class G4ChannelingFastSimModel : public G4VFastSimulationModel 55 { 51 { 56 public: 52 public: 57 // Constructor, destructor 53 // Constructor, destructor 58 G4ChannelingFastSimModel (const G4String&, G 54 G4ChannelingFastSimModel (const G4String&, G4Region*); 59 G4ChannelingFastSimModel (const G4String&); 55 G4ChannelingFastSimModel (const G4String&); 60 ~G4ChannelingFastSimModel (); 56 ~G4ChannelingFastSimModel (); 61 57 62 /// -- IsApplicable 58 /// -- IsApplicable 63 G4bool IsApplicable(const G4ParticleDefiniti 59 G4bool IsApplicable(const G4ParticleDefinition&) override; 64 /// -- ModelTrigger 60 /// -- ModelTrigger 65 G4bool ModelTrigger(const G4FastTrack &) ove 61 G4bool ModelTrigger(const G4FastTrack &) override; 66 /// -- User method DoIt 62 /// -- User method DoIt 67 void DoIt(const G4FastTrack&, G4FastStep&) o 63 void DoIt(const G4FastTrack&, G4FastStep&) override; 68 64 69 ///special functions 65 ///special functions 70 void Input(const G4Material* crystal, << 66 void Input(const G4Material* crystal, const G4String &lattice); 71 const G4String &lattice) << 72 {Input(crystal,lattice,"");} << 73 << 74 void Input(const G4Material* crystal, << 75 const G4String &lattice, << 76 const G4String &filePath); << 77 67 78 void RadiationModelActivate(); 68 void RadiationModelActivate(); 79 69 80 G4ChannelingFastSimCrystalData* GetCrystalDa 70 G4ChannelingFastSimCrystalData* GetCrystalData() {return fCrystalData;} 81 71 82 G4BaierKatkov* GetRadiationModel() {return f 72 G4BaierKatkov* GetRadiationModel() {return fBaierKatkov;} 83 73 84 G4bool GetIfRadiationModelActive(){return fR 74 G4bool GetIfRadiationModelActive(){return fRad;} 85 75 86 ///set cuts 76 ///set cuts 87 void SetLowKineticEnergyLimit(G4double ekine 77 void SetLowKineticEnergyLimit(G4double ekinetic, const G4String& particleName) 88 {fLowEnergyLimit[particleTable->FindParticl 78 {fLowEnergyLimit[particleTable->FindParticle(particleName)-> 89 GetParticleDefinitionID()] = eki 79 GetParticleDefinitionID()] = ekinetic;} 90 void SetLindhardAngleNumberHighLimit(G4doubl 80 void SetLindhardAngleNumberHighLimit(G4double angleNumber, const G4String& particleName) 91 {fLindhardAngleNumberHighLimit[particleTabl 81 {fLindhardAngleNumberHighLimit[particleTable->FindParticle(particleName)-> 92 GetParticleDefinitionID()]=angle 82 GetParticleDefinitionID()]=angleNumber;} 93 void SetHighAngleLimit(G4double anglemax, co << 94 {fHighAngleLimit[particleTable->FindParticl << 95 GetParticleDefinitionID << 96 83 97 void SetDefaultLowKineticEnergyLimit(G4doubl 84 void SetDefaultLowKineticEnergyLimit(G4double ekinetic) 98 {fDefaultLowEnergyLimit=ekinetic;} 85 {fDefaultLowEnergyLimit=ekinetic;} 99 void SetDefaultLindhardAngleNumberHighLimit( 86 void SetDefaultLindhardAngleNumberHighLimit(G4double angleNumber) 100 {fDefaultLindhardAngleNumberHighLim 87 {fDefaultLindhardAngleNumberHighLimit=angleNumber;} 101 void SetDefaultHighAngleLimit(G4double angle << 102 {fDefaultHighAngleLimit=anglemax;} << 103 88 104 89 105 /// get the maximal number of photons that c 90 /// get the maximal number of photons that can be produced per fastStep 106 /// Caution: is redundant, if the radiation 91 /// Caution: is redundant, if the radiation model is not activated 107 void SetMaxPhotonsProducedPerStep(G4double n 92 void SetMaxPhotonsProducedPerStep(G4double nPhotons) 108 {fMaxPhotonsProducedPerStep=nPhoton 93 {fMaxPhotonsProducedPerStep=nPhotons;} 109 94 110 ///get cuts 95 ///get cuts >> 96 G4double GetLowKineticEnergyLimit(const G4String& particleName) >> 97 {return GetLowKineticEnergyLimit(particleTable-> >> 98 FindParticle(particleName)-> >> 99 GetParticleDefinitionID());} >> 100 G4double GetLindhardAngleNumberHighLimit(const G4String& particleName) >> 101 {return GetLindhardAngleNumberHighLimit(particleTable-> >> 102 FindParticle(particleName)-> >> 103 GetParticleDefinitionID());} >> 104 //the same functions but using particleDefinitionID (needed for faster model execution) 111 G4double GetLowKineticEnergyLimit(G4int part 105 G4double GetLowKineticEnergyLimit(G4int particleDefinitionID) 112 {return (fLowEnergyLimit.count( 106 {return (fLowEnergyLimit.count(particleDefinitionID) == 1) 113 ? fLowEnergyLimit[part 107 ? fLowEnergyLimit[particleDefinitionID] 114 : fDefaultLowEnergyLim 108 : fDefaultLowEnergyLimit;} 115 G4double GetLindhardAngleNumberHighLimit(G4i 109 G4double GetLindhardAngleNumberHighLimit(G4int particleDefinitionID) 116 {return (fLindhardAngleNumberHi 110 {return (fLindhardAngleNumberHighLimit.count(particleDefinitionID) == 1) 117 ? fLindhardAngleNumber 111 ? fLindhardAngleNumberHighLimit[particleDefinitionID] 118 : fDefaultLindhardAngl 112 : fDefaultLindhardAngleNumberHighLimit;} 119 G4double GetHighAngleLimit(G4int particleDef << 120 {return (fHighAngleLimit.count( << 121 ? fHighAngleLimi << 122 : fDefaultHighAn << 123 113 124 /// get the maximal number of photons that c 114 /// get the maximal number of photons that can be produced per fastStep 125 G4int GetMaxPhotonsProducedPerStep(){return 115 G4int GetMaxPhotonsProducedPerStep(){return fMaxPhotonsProducedPerStep;} 126 116 127 private: 117 private: 128 118 129 G4ChannelingFastSimCrystalData* fCrystalData 119 G4ChannelingFastSimCrystalData* fCrystalData{nullptr}; 130 G4BaierKatkov* fBaierKatkov{nullptr}; 120 G4BaierKatkov* fBaierKatkov{nullptr}; 131 121 132 G4ParticleTable* particleTable = G4ParticleT 122 G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); 133 123 134 ///flag of radiation model 124 ///flag of radiation model 135 G4bool fRad = false; 125 G4bool fRad = false; 136 126 137 /// maps of cuts (angular cuts are chosen as << 127 /// maps of cuts 138 /// fHighAngleLimit and calculated Lindhard << 139 std::unordered_map<G4int, G4double> fLowEner 128 std::unordered_map<G4int, G4double> fLowEnergyLimit; 140 std::unordered_map<G4int, G4double> fLindhar 129 std::unordered_map<G4int, G4double> fLindhardAngleNumberHighLimit; 141 std::unordered_map<G4int, G4double> fHighAng << 142 130 143 G4double fDefaultLowEnergyLimit = 200*CLHEP: 131 G4double fDefaultLowEnergyLimit = 200*CLHEP::MeV; 144 G4double fDefaultLindhardAngleNumberHighLimi 132 G4double fDefaultLindhardAngleNumberHighLimit = 100.; 145 G4double fDefaultHighAngleLimit = 0.; << 146 133 147 /// the maximal number of photons that can b 134 /// the maximal number of photons that can be produced per fastStep 148 G4int fMaxPhotonsProducedPerStep=1000.; 135 G4int fMaxPhotonsProducedPerStep=1000.; 149 136 150 }; 137 }; 151 #endif 138 #endif 152 139 153 140 154 141 155 142 156 143