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 // >> 27 // $Id: G4Cerenkov.hh,v 1.11 2009-07-29 23:45:02 gum Exp $ >> 28 // GEANT4 tag $Name: geant4-09-04-patch-02 $ >> 29 // >> 30 // 26 ////////////////////////////////////////////// 31 //////////////////////////////////////////////////////////////////////// 27 // Cerenkov Radiation Class Definition << 32 // Cerenkov Radiation Class Definition 28 ////////////////////////////////////////////// 33 //////////////////////////////////////////////////////////////////////// 29 // 34 // 30 // File: G4Cerenkov.hh << 35 // File: G4Cerenkov.hh 31 // Description: Discrete Process - Generation 36 // Description: Discrete Process - Generation of Cerenkov Photons 32 // Version: 2.0 37 // Version: 2.0 33 // Created: 1996-02-21 38 // Created: 1996-02-21 34 // Author: Juliet Armstrong 39 // Author: Juliet Armstrong 35 // Updated: 2007-09-30 change inheritance 40 // Updated: 2007-09-30 change inheritance to G4VDiscreteProcess 36 // 2005-07-28 add G4ProcessType t 41 // 2005-07-28 add G4ProcessType to constructor 37 // 1999-10-29 add method and clas 42 // 1999-10-29 add method and class descriptors 38 // 1997-04-09 by Peter Gumplinger 43 // 1997-04-09 by Peter Gumplinger 39 // > G4MaterialPropertiesTable; n 44 // > G4MaterialPropertiesTable; new physics/tracking scheme >> 45 // mail: gum@triumf.ca 40 // 46 // 41 ////////////////////////////////////////////// 47 //////////////////////////////////////////////////////////////////////// 42 48 43 #ifndef G4Cerenkov_h 49 #ifndef G4Cerenkov_h 44 #define G4Cerenkov_h 1 50 #define G4Cerenkov_h 1 45 51 >> 52 ///////////// >> 53 // Includes >> 54 ///////////// >> 55 46 #include "globals.hh" 56 #include "globals.hh" 47 #include "G4DynamicParticle.hh" << 57 #include "templates.hh" 48 #include "G4ForceCondition.hh" << 58 #include "Randomize.hh" 49 #include "G4GPILSelection.hh" << 59 #include "G4ThreeVector.hh" 50 #include "G4MaterialPropertyVector.hh" << 60 #include "G4ParticleMomentum.hh" >> 61 #include "G4Step.hh" 51 #include "G4VProcess.hh" 62 #include "G4VProcess.hh" 52 << 63 #include "G4OpticalPhoton.hh" 53 class G4Material; << 64 #include "G4DynamicParticle.hh" 54 class G4ParticleDefinition; << 65 #include "G4Material.hh" 55 class G4PhysicsTable; << 66 #include "G4PhysicsTable.hh" 56 class G4Step; << 67 #include "G4MaterialPropertiesTable.hh" 57 class G4Track; << 68 #include "G4PhysicsOrderedFreeVector.hh" 58 class G4VParticleChange; << 69 >> 70 // Class Description: >> 71 // Discrete Process -- Generation of Cerenkov Photons. >> 72 // Class inherits publicly from G4VDiscreteProcess. >> 73 // Class Description - End: >> 74 >> 75 ///////////////////// >> 76 // Class Definition >> 77 ///////////////////// 59 78 60 class G4Cerenkov : public G4VProcess 79 class G4Cerenkov : public G4VProcess 61 { 80 { 62 public: << 63 explicit G4Cerenkov(const G4String& processN << 64 G4ProcessType type << 65 ~G4Cerenkov(); << 66 << 67 explicit G4Cerenkov(const G4Cerenkov& right) << 68 << 69 G4Cerenkov& operator=(const G4Cerenkov& righ << 70 << 71 G4bool IsApplicable(const G4ParticleDefiniti << 72 // Returns true -> 'is applicable', for all << 73 // except short-lived particles. << 74 << 75 void BuildPhysicsTable(const G4ParticleDefin << 76 // Build table at a right time << 77 << 78 void PreparePhysicsTable(const G4ParticleDef << 79 void Initialise(); << 80 << 81 G4double GetMeanFreePath(const G4Track& aTra << 82 // Returns the discrete step limit and sets << 83 // condition for the DoIt to be invoked at e << 84 << 85 G4double PostStepGetPhysicalInteractionLengt << 86 << 87 // Returns the discrete step limit and sets << 88 // condition for the DoIt to be invoked at e << 89 << 90 G4VParticleChange* PostStepDoIt(const G4Trac << 91 const G4Step << 92 // This is the method implementing the Ceren << 93 << 94 // no operation in AtRestDoIt and AlongSt << 95 virtual G4double AlongStepGetPhysicalInterac << 96 const G4Track&, G4double, G4double, G4doub << 97 { << 98 return -1.0; << 99 }; << 100 << 101 virtual G4double AtRestGetPhysicalInteractio << 102 const G4Track&, G4ForceCondition*) overrid << 103 { << 104 return -1.0; << 105 }; << 106 << 107 // no operation in AtRestDoIt and AlongSt << 108 virtual G4VParticleChange* AtRestDoIt(const << 109 { << 110 return nullptr; << 111 }; << 112 << 113 virtual G4VParticleChange* AlongStepDoIt(con << 114 con << 115 { << 116 return nullptr; << 117 }; << 118 << 119 void SetTrackSecondariesFirst(const G4bool s << 120 // If set, the primary particle tracking is << 121 // produced Cerenkov photons are tracked nex << 122 // been tracked, the tracking of the primary << 123 << 124 G4bool GetTrackSecondariesFirst() const; << 125 // Returns the boolean flag for tracking sec << 126 << 127 void SetMaxBetaChangePerStep(const G4double << 128 // Set the maximum allowed change in beta = << 129 << 130 G4double GetMaxBetaChangePerStep() const; << 131 // Returns the maximum allowed change in bet << 132 << 133 void SetMaxNumPhotonsPerStep(const G4int Num << 134 // Set the maximum number of Cerenkov photon << 135 // a tracking step. This is an average ONLY; << 136 // around this average. If invoked, the maxi << 137 // of the size set. If not called, the step << 138 // photons generated. << 139 << 140 G4int GetMaxNumPhotonsPerStep() const; << 141 // Returns the maximum number of Cerenkov ph << 142 // generated during a tracking step. << 143 << 144 void SetStackPhotons(const G4bool); << 145 // Call by the user to set the flag for stac << 146 << 147 G4bool GetStackPhotons() const; << 148 // Return the boolean for whether or not the << 149 << 150 G4int GetNumPhotons() const; << 151 // Returns the current number of scint. phot << 152 << 153 G4PhysicsTable* GetPhysicsTable() const; << 154 // Returns the address of the physics table. << 155 << 156 void DumpPhysicsTable() const; << 157 // Prints the physics table. << 158 << 159 G4double GetAverageNumberOfPhotons(const G4d << 160 const G4M << 161 G4Materia << 162 << 163 void DumpInfo() const override {ProcessDescr << 164 void ProcessDescription(std::ostream& out) c << 165 << 166 void SetVerboseLevel(G4int); << 167 // sets verbosity << 168 << 169 protected: << 170 G4PhysicsTable* thePhysicsTable; << 171 << 172 private: << 173 G4double fMaxBetaChange; << 174 << 175 G4int fMaxPhotons; << 176 G4int fNumPhotons; << 177 << 178 G4bool fStackingFlag; << 179 G4bool fTrackSecondariesFirst; << 180 81 181 G4int secID = -1; // creator modelID << 82 private: 182 83 >> 84 ////////////// >> 85 // Operators >> 86 ////////////// >> 87 >> 88 // G4Cerenkov& operator=(const G4Cerenkov &right); >> 89 >> 90 public: // Without description >> 91 >> 92 //////////////////////////////// >> 93 // Constructors and Destructor >> 94 //////////////////////////////// >> 95 >> 96 G4Cerenkov(const G4String& processName = "Cerenkov", >> 97 G4ProcessType type = fElectromagnetic); >> 98 >> 99 // G4Cerenkov(const G4Cerenkov &right); >> 100 >> 101 ~G4Cerenkov(); >> 102 >> 103 //////////// >> 104 // Methods >> 105 //////////// >> 106 >> 107 public: // With description >> 108 >> 109 G4bool IsApplicable(const G4ParticleDefinition& aParticleType); >> 110 // Returns true -> 'is applicable', for all charged particles >> 111 // except short-lived particles. >> 112 >> 113 G4double GetMeanFreePath(const G4Track& aTrack, >> 114 G4double , >> 115 G4ForceCondition* ); >> 116 // Returns the discrete step limit and sets the 'StronglyForced' >> 117 // condition for the DoIt to be invoked at every step. >> 118 >> 119 G4double PostStepGetPhysicalInteractionLength(const G4Track& aTrack, >> 120 G4double , >> 121 G4ForceCondition* ); >> 122 // Returns the discrete step limit and sets the 'StronglyForced' >> 123 // condition for the DoIt to be invoked at every step. >> 124 >> 125 G4VParticleChange* PostStepDoIt(const G4Track& aTrack, >> 126 const G4Step& aStep); >> 127 // This is the method implementing the Cerenkov process. >> 128 >> 129 // no operation in AtRestDoIt and AlongStepDoIt >> 130 virtual G4double AlongStepGetPhysicalInteractionLength( >> 131 const G4Track&, >> 132 G4double , >> 133 G4double , >> 134 G4double& , >> 135 G4GPILSelection* >> 136 ) { return -1.0; }; >> 137 >> 138 virtual G4double AtRestGetPhysicalInteractionLength( >> 139 const G4Track& , >> 140 G4ForceCondition* >> 141 ) { return -1.0; }; >> 142 >> 143 // no operation in AtRestDoIt and AlongStepDoIt >> 144 virtual G4VParticleChange* AtRestDoIt( >> 145 const G4Track& , >> 146 const G4Step& >> 147 ) {return 0;}; >> 148 >> 149 virtual G4VParticleChange* AlongStepDoIt( >> 150 const G4Track& , >> 151 const G4Step& >> 152 ) {return 0;}; >> 153 >> 154 void SetTrackSecondariesFirst(const G4bool state); >> 155 // If set, the primary particle tracking is interrupted and any >> 156 // produced Cerenkov photons are tracked next. When all have >> 157 // been tracked, the tracking of the primary resumes. >> 158 >> 159 void SetMaxBetaChangePerStep(const G4double d); >> 160 // Set the maximum allowed change in beta = v/c in % (perCent) >> 161 // per step. >> 162 >> 163 void SetMaxNumPhotonsPerStep(const G4int NumPhotons); >> 164 // Set the maximum number of Cerenkov photons allowed to be >> 165 // generated during a tracking step. This is an average ONLY; >> 166 // the actual number will vary around this average. If invoked, >> 167 // the maximum photon stack will roughly be of the size set. >> 168 // If not called, the step is not limited by the number of >> 169 // photons generated. >> 170 >> 171 G4PhysicsTable* GetPhysicsTable() const; >> 172 // Returns the address of the physics table. >> 173 >> 174 void DumpPhysicsTable() const; >> 175 // Prints the physics table. >> 176 >> 177 private: >> 178 >> 179 void BuildThePhysicsTable(); >> 180 >> 181 ///////////////////// >> 182 // Helper Functions >> 183 ///////////////////// >> 184 >> 185 G4double GetAverageNumberOfPhotons(const G4double charge, >> 186 const G4double beta, >> 187 const G4Material *aMaterial, >> 188 const G4MaterialPropertyVector* Rindex) const; >> 189 >> 190 /////////////////////// >> 191 // Class Data Members >> 192 /////////////////////// >> 193 >> 194 protected: >> 195 >> 196 G4PhysicsTable* thePhysicsTable; >> 197 // A Physics Table can be either a cross-sections table or >> 198 // an energy table (or can be used for other specific >> 199 // purposes). >> 200 >> 201 private: >> 202 >> 203 G4bool fTrackSecondariesFirst; >> 204 G4double fMaxBetaChange; >> 205 G4int fMaxPhotons; 183 }; 206 }; 184 207 185 inline G4bool G4Cerenkov::GetTrackSecondariesF << 208 //////////////////// >> 209 // Inline methods >> 210 //////////////////// >> 211 >> 212 inline >> 213 G4bool G4Cerenkov::IsApplicable(const G4ParticleDefinition& aParticleType) 186 { 214 { 187 return fTrackSecondariesFirst; << 215 if (aParticleType.GetParticleName() == "chargedgeantino") return false; >> 216 if (aParticleType.IsShortLived()) return false; >> 217 >> 218 return (aParticleType.GetPDGCharge() != 0); >> 219 } >> 220 >> 221 inline >> 222 void G4Cerenkov::SetTrackSecondariesFirst(const G4bool state) >> 223 { >> 224 fTrackSecondariesFirst = state; 188 } 225 } 189 226 190 inline G4double G4Cerenkov::GetMaxBetaChangePe << 227 inline >> 228 void G4Cerenkov::SetMaxBetaChangePerStep(const G4double value) 191 { 229 { 192 return fMaxBetaChange; << 230 fMaxBetaChange = value*perCent; 193 } 231 } 194 232 195 inline G4int G4Cerenkov::GetMaxNumPhotonsPerSt << 233 inline >> 234 void G4Cerenkov::SetMaxNumPhotonsPerStep(const G4int NumPhotons) >> 235 { >> 236 fMaxPhotons = NumPhotons; >> 237 } 196 238 197 inline G4bool G4Cerenkov::GetStackPhotons() co << 239 inline >> 240 void G4Cerenkov::DumpPhysicsTable() const >> 241 { >> 242 G4int PhysicsTableSize = thePhysicsTable->entries(); >> 243 G4PhysicsOrderedFreeVector *v; 198 244 199 inline G4int G4Cerenkov::GetNumPhotons() const << 245 for (G4int i = 0 ; i < PhysicsTableSize ; i++ ) >> 246 { >> 247 v = (G4PhysicsOrderedFreeVector*)(*thePhysicsTable)[i]; >> 248 v->DumpValues(); >> 249 } >> 250 } 200 251 201 inline G4PhysicsTable* G4Cerenkov::GetPhysicsT << 252 inline >> 253 G4PhysicsTable* G4Cerenkov::GetPhysicsTable() const 202 { 254 { 203 return thePhysicsTable; 255 return thePhysicsTable; 204 } 256 } 205 257 206 #endif /* G4Cerenkov_h */ 258 #endif /* G4Cerenkov_h */ 207 259