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 // 26 // >> 27 // $Id: G4Transportation.hh,v 1.17 2007-11-09 15:39:20 japost Exp $ >> 28 // GEANT4 tag $Name: not supported by cvs2svn $ 27 // 29 // 28 // 30 // 29 // ------------------------------------------- 31 // ------------------------------------------------------------ 30 // GEANT 4 include file implementation 32 // GEANT 4 include file implementation 31 // ------------------------------------------- 33 // ------------------------------------------------------------ 32 // 34 // 33 // Class description: 35 // Class description: 34 // 36 // 35 // G4Transportation is a process responsible f 37 // G4Transportation is a process responsible for the transportation of 36 // a particle, i.e. the geometrical propagatio 38 // a particle, i.e. the geometrical propagation encountering the 37 // geometrical sub-volumes of the detectors. 39 // geometrical sub-volumes of the detectors. 38 // It is also tasked with part of updating the 40 // It is also tasked with part of updating the "safety". 39 41 40 // =========================================== 42 // ======================================================================= 41 // Created: 19 March 1997, J. Apostolakis 43 // Created: 19 March 1997, J. Apostolakis 42 // =========================================== 44 // ======================================================================= 43 #ifndef G4Transportation_hh 45 #ifndef G4Transportation_hh 44 #define G4Transportation_hh 1 46 #define G4Transportation_hh 1 45 47 46 #include "G4VProcess.hh" 48 #include "G4VProcess.hh" >> 49 #include "G4FieldManager.hh" 47 50 >> 51 #include "G4Navigator.hh" >> 52 #include "G4TransportationManager.hh" >> 53 #include "G4PropagatorInField.hh" 48 #include "G4Track.hh" 54 #include "G4Track.hh" 49 #include "G4Step.hh" 55 #include "G4Step.hh" 50 #include "G4ParticleChangeForTransport.hh" 56 #include "G4ParticleChangeForTransport.hh" 51 << 52 class G4Navigator; << 53 class G4PropagatorInField; << 54 class G4SafetyHelper; 57 class G4SafetyHelper; 55 class G4TransportationLogger; << 56 58 57 class G4Transportation : public G4VProcess 59 class G4Transportation : public G4VProcess 58 { 60 { 59 // Concrete class that does the geometrical 61 // Concrete class that does the geometrical transport 60 62 61 public: // with description 63 public: // with description 62 64 63 G4Transportation( G4int verbosityLevel= 1 << 65 G4Transportation( G4int verbosityLevel= 1); 64 ~G4Transportation(); 66 ~G4Transportation(); 65 67 66 G4double AlongStepGetPhysicalInterac 68 G4double AlongStepGetPhysicalInteractionLength( 67 const G4Track& tr 69 const G4Track& track, 68 G4double p 70 G4double previousStepSize, 69 G4double c 71 G4double currentMinimumStep, 70 G4double& c 72 G4double& currentSafety, 71 G4GPILSelec 73 G4GPILSelection* selection 72 ); // override; << 74 ); 73 75 74 G4VParticleChange* AlongStepDoIt( 76 G4VParticleChange* AlongStepDoIt( 75 const G4Track& tr 77 const G4Track& track, 76 const G4Step& ste 78 const G4Step& stepData 77 ); // override; << 79 ); 78 80 79 G4VParticleChange* PostStepDoIt( 81 G4VParticleChange* PostStepDoIt( 80 const G4Track& tr 82 const G4Track& track, 81 const G4Step& st 83 const G4Step& stepData 82 ); // override; << 84 ); 83 // Responsible for the relocation << 85 // Responsible for the relocation. 84 86 85 G4double PostStepGetPhysicalInteractionLe 87 G4double PostStepGetPhysicalInteractionLength( 86 const G4Track& , 88 const G4Track& , 87 G4double previo 89 G4double previousStepSize, 88 G4ForceCondition* 90 G4ForceCondition* pForceCond 89 ); // override; << 91 ); 90 // Forces the PostStepDoIt action to be 92 // Forces the PostStepDoIt action to be called, 91 // but does not limit the step << 93 // but does not limit the step. 92 94 93 inline G4bool FieldExertedForce() { retur << 94 << 95 G4PropagatorInField* GetPropagatorInField 95 G4PropagatorInField* GetPropagatorInField(); 96 void SetPropagatorInField( G4PropagatorIn 96 void SetPropagatorInField( G4PropagatorInField* pFieldPropagator); 97 // Access/set the assistant class that << 97 // Access/set the assistant class that Propagate in a Field. >> 98 >> 99 inline void SetVerboseLevel( G4int verboseLevel ); >> 100 inline G4int GetVerboseLevel() const; >> 101 // Level of warnings regarding eg energy conservation >> 102 // in field integration. 98 103 99 inline G4double GetThresholdWarningEnergy 104 inline G4double GetThresholdWarningEnergy() const; 100 inline G4double GetThresholdImportantEner 105 inline G4double GetThresholdImportantEnergy() const; 101 inline G4int GetThresholdTrials() const; 106 inline G4int GetThresholdTrials() const; 102 107 103 inline void SetThresholdWarningEnergy( G4 108 inline void SetThresholdWarningEnergy( G4double newEnWarn ); 104 inline void SetThresholdImportantEnergy( 109 inline void SetThresholdImportantEnergy( G4double newEnImp ); 105 inline void SetThresholdTrials(G4int newM 110 inline void SetThresholdTrials(G4int newMaxTrials ); >> 111 106 // Get/Set parameters for killing loopers 112 // Get/Set parameters for killing loopers: 107 // Above 'important' energy a 'looping' 113 // Above 'important' energy a 'looping' particle in field will 108 // *NOT* be abandoned, except after fTh 114 // *NOT* be abandoned, except after fThresholdTrials attempts. 109 // Below Warning energy, no verbosity for 115 // Below Warning energy, no verbosity for looping particles is issued 110 116 111 void SetHighLooperThresholds(); // Shortc << 112 void SetLowLooperThresholds(); // Set low << 113 void PushThresholdsToLogger(); // Inform << 114 void ReportLooperThresholds(); // Print v << 115 << 116 inline G4double GetMaxEnergyKilled() cons 117 inline G4double GetMaxEnergyKilled() const; 117 inline G4double GetSumEnergyKilled() cons 118 inline G4double GetSumEnergyKilled() const; 118 inline void ResetKilledStatistics( G4int 119 inline void ResetKilledStatistics( G4int report = 1); 119 // Statistics for tracks killed (currentl 120 // Statistics for tracks killed (currently due to looping in field) 120 121 121 inline void EnableShortStepOptimisation(G 122 inline void EnableShortStepOptimisation(G4bool optimise=true); 122 // Whether short steps < safety will avoi 123 // Whether short steps < safety will avoid to call Navigator (if field=0) 123 124 124 static G4bool EnableMagneticMoment(G4bool << 125 inline G4bool EnableUseMagneticMoment(G4bool useMoment=true); 125 // Whether to enable particles to be defl << 126 // Whether to deflect particles with force due to magnetic moment 126 127 127 static G4bool EnableGravity(G4bool useGra << 128 // Whether to enable particles to be defl << 129 << 130 static void SetSilenceLooperWarnings( G << 131 // Do not warn (or throw exception) about << 132 static G4bool GetSilenceLooperWarnings(); << 133 << 134 public: // without description << 135 static G4bool EnableUseMagneticMoment(G4b << 136 { return EnableMagneticMoment(useMoment); << 137 << 138 public: // without description 128 public: // without description 139 129 140 G4double AtRestGetPhysicalInteractionLeng << 130 G4double AtRestGetPhysicalInteractionLength( 141 << 131 const G4Track& , 142 { return -1.0; } // No operation in At << 132 G4ForceCondition* >> 133 ) { return -1.0; }; >> 134 // No operation in AtRestDoIt. 143 135 144 G4VParticleChange* AtRestDoIt( const G4Tr << 136 G4VParticleChange* AtRestDoIt( 145 { return 0; } // No operation in At << 137 const G4Track& , >> 138 const G4Step& >> 139 ) {return 0;}; >> 140 // No operation in AtRestDoIt. 146 141 147 void StartTracking(G4Track* aTrack); << 142 void StartTracking(G4Track* aTrack); 148 // Reset state for new (potentially res 143 // Reset state for new (potentially resumed) track 149 144 150 virtual void ProcessDescription(std::ostr << 151 void PrintStatistics( std::ostream& outSt << 152 << 153 protected: 145 protected: 154 146 155 void SetTouchableInformation(const G4Touc << 147 G4bool DoesGlobalFieldExist(); >> 148 // Checks whether a field exists for the "global" field manager. 156 149 157 void ReportMissingLogger(const char * met << 150 private: 158 << 159 protected: << 160 151 161 G4Navigator* fLinearNavigator; << 152 G4Navigator* fLinearNavigator; 162 // The navigator for the 'mass' geometr << 163 // (the real one, that physics occurs i << 164 G4PropagatorInField* fFieldPropagator; 153 G4PropagatorInField* fFieldPropagator; 165 // The Propagators used to transport th 154 // The Propagators used to transport the particle 166 155 167 G4ThreeVector fTransportEndPosition= << 156 // G4FieldManager* fGlobalFieldMgr; // Used MagneticField CC 168 G4ThreeVector fTransportEndMomentumDir= << 157 // Field Manager for the whole Detector 169 G4double fTransportEndKineticEnergy= << 170 G4ThreeVector fTransportEndSpin= G4Three << 171 G4bool fMomentumChanged= true; << 172 G4bool fEndGlobalTimeComputed= fal << 173 G4double fCandidateEndGlobalTime= 0. << 174 // The particle's state after this Step << 175 158 176 G4bool fAnyFieldExists= false; << 159 G4ThreeVector fTransportEndPosition; 177 << 160 G4ThreeVector fTransportEndMomentumDir; 178 G4bool fParticleIsLooping = false; << 161 G4double fTransportEndKineticEnergy; 179 G4bool fNewTrack= true; // Flag << 162 G4ThreeVector fTransportEndSpin; 180 G4bool fFirstStepInVolume= true; << 163 G4bool fMomentumChanged; 181 G4bool fLastStepInVolume= false; // Last << 164 G4bool fEnergyChanged; 182 // (temporary << 165 G4bool fEndGlobalTimeComputed; 183 G4bool fGeometryLimitedStep= true; << 166 G4double fCandidateEndGlobalTime; 184 // Flag to determine whether a boundary << 167 // The particle's state after this Step, Store for DoIt 185 168 186 G4bool fFieldExertedForce= false; // Duri << 169 G4bool fParticleIsLooping; 187 170 188 G4TouchableHandle fCurrentTouchableHandle << 171 G4TouchableHandle fCurrentTouchableHandle; 189 172 190 G4ThreeVector fPreviousSftOrigin; << 173 // G4bool fFieldExists; 191 G4double fPreviousSafety; << 174 // Whether a magnetic field exists ... >> 175 // A data member for this is problematic: it is useful only if it >> 176 // can be initialised and updated -- and a scheme is not yet possible. >> 177 >> 178 G4bool fGeometryLimitedStep; >> 179 // Flag to determine whether a boundary was reached. >> 180 >> 181 G4ThreeVector fPreviousSftOrigin; >> 182 G4double fPreviousSafety; 192 // Remember last safety origin & value. 183 // Remember last safety origin & value. 193 184 194 G4ParticleChangeForTransport fParticleCha 185 G4ParticleChangeForTransport fParticleChange; 195 // New ParticleChange 186 // New ParticleChange 196 187 197 G4double fEndPointDistance; 188 G4double fEndPointDistance; 198 189 199 // Thresholds for looping particles: << 190 // Thresholds for looping particles: 200 // << 191 // 201 G4double fThreshold_Warning_Energy = 1. << 192 G4double fThreshold_Warning_Energy; // Warn above this energy 202 G4double fThreshold_Important_Energy = 1. << 193 G4double fThreshold_Important_Energy; // Hesitate above this 203 G4int fThresholdTrials = 10; // << 194 G4int fThresholdTrials; // for this no of trials 204 // Above 'important' energy a 'looping' 195 // Above 'important' energy a 'looping' particle in field will 205 // *NOT* be abandoned, except after fTh << 196 // *NOT* be abandoned, except after fThresholdTrials attempts. 206 G4int fAbandonUnstableTrials = 0; // << 197 G4double fUnimportant_Energy; 207 // << 198 // Below this energy, no verbosity for looping particles is issued 208 // Counter for steps in which particle re << 199 209 // ( Used if it is above 'Important' Ene << 200 // Counter for steps in which particle reports 'looping', 210 G4int fNoLooperTrials= 0; << 201 // if it is above 'Important' Energy 211 << 202 G4int fNoLooperTrials; 212 // Statistics for tracks abandoned due to << 203 // Statistics for tracks abandoned 213 // << 204 G4double fSumEnergyKilled; 214 G4double fSumEnergyKilled= 0.0; << 205 G4double fMaxEnergyKilled; 215 G4double fSumEnerSqKilled= 0.0; << 206 216 G4double fMaxEnergyKilled= -1.0; << 207 // Whether to avoid calling G4Navigator for short step ( < safety) 217 G4int fMaxEnergyKilledPDG= 0; << 208 // If using it, the safety estimate for endpoint will likely be smaller. 218 unsigned long fNumLoopersKilled= 0; << 219 G4double fSumEnergyKilled_NonElectron= 0. << 220 G4double fSumEnerSqKilled_NonElectron= 0. << 221 G4double fMaxEnergyKilled_NonElectron= -1 << 222 G4int fMaxEnergyKilled_NonElecPDG= 0; << 223 unsigned long fNumLoopersKilled_NonElectr << 224 G4double fSumEnergySaved= 0.0; << 225 G4double fMaxEnergySaved= -1.0; << 226 G4double fSumEnergyUnstableSaved = 0.0; << 227 // Whether to avoid calling G4Navigator f << 228 // If using it, the safety estimate for e << 229 // << 230 G4bool fShortStepOptimisation; 209 G4bool fShortStepOptimisation; 231 210 232 G4SafetyHelper* fpSafetyHelper; // To << 211 // Whether to track state change from magnetic moment in a B-field 233 G4TransportationLogger* fpLogger; // Rep << 212 G4bool fUseMagneticMoment; 234 213 235 protected: << 214 G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained 236 215 237 static G4bool fUseMagneticMoment; << 216 // Verbosity 238 static G4bool fUseGravity; << 217 G4int fVerboseLevel; 239 static G4bool fSilenceLooperWarnings; // << 218 // Verbosity level for warnings 240 << 219 // eg about energy non-conservation in magnetic field. 241 }; 220 }; 242 221 243 #include "G4Transportation.icc" 222 #include "G4Transportation.icc" 244 223 245 #endif 224 #endif 246 225