Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4Transportation.hh,v 1.10 2004/11/23 17:45:43 japost Exp $ >> 25 // GEANT4 tag $Name: geant4-07-00-patch-01 $ 27 // 26 // 28 // 27 // 29 // ------------------------------------------- 28 // ------------------------------------------------------------ 30 // GEANT 4 include file implementation 29 // GEANT 4 include file implementation 31 // ------------------------------------------- 30 // ------------------------------------------------------------ 32 // 31 // 33 // Class description: 32 // Class description: 34 // 33 // 35 // G4Transportation is a process responsible f 34 // G4Transportation is a process responsible for the transportation of 36 // a particle, i.e. the geometrical propagatio 35 // a particle, i.e. the geometrical propagation encountering the 37 // geometrical sub-volumes of the detectors. 36 // geometrical sub-volumes of the detectors. 38 // It is also tasked with part of updating the 37 // It is also tasked with part of updating the "safety". 39 38 40 // =========================================== 39 // ======================================================================= 41 // Created: 19 March 1997, J. Apostolakis 40 // Created: 19 March 1997, J. Apostolakis 42 // =========================================== 41 // ======================================================================= 43 #ifndef G4Transportation_hh 42 #ifndef G4Transportation_hh 44 #define G4Transportation_hh 1 43 #define G4Transportation_hh 1 45 44 46 #include "G4VProcess.hh" 45 #include "G4VProcess.hh" >> 46 #include "G4FieldManager.hh" 47 47 >> 48 #include "G4Navigator.hh" >> 49 #include "G4TransportationManager.hh" >> 50 #include "G4PropagatorInField.hh" 48 #include "G4Track.hh" 51 #include "G4Track.hh" 49 #include "G4Step.hh" 52 #include "G4Step.hh" 50 #include "G4ParticleChangeForTransport.hh" 53 #include "G4ParticleChangeForTransport.hh" 51 54 52 class G4Navigator; << 53 class G4PropagatorInField; << 54 class G4SafetyHelper; << 55 class G4TransportationLogger; << 56 << 57 class G4Transportation : public G4VProcess 55 class G4Transportation : public G4VProcess 58 { 56 { 59 // Concrete class that does the geometrical 57 // Concrete class that does the geometrical transport 60 58 61 public: // with description 59 public: // with description 62 60 63 G4Transportation( G4int verbosityLevel= 1 << 61 G4Transportation( G4int verbosityLevel= 1); 64 ~G4Transportation(); 62 ~G4Transportation(); 65 63 66 G4double AlongStepGetPhysicalInterac 64 G4double AlongStepGetPhysicalInteractionLength( 67 const G4Track& tr 65 const G4Track& track, 68 G4double p 66 G4double previousStepSize, 69 G4double c 67 G4double currentMinimumStep, 70 G4double& c 68 G4double& currentSafety, 71 G4GPILSelec 69 G4GPILSelection* selection 72 ); // override; << 70 ); 73 71 74 G4VParticleChange* AlongStepDoIt( 72 G4VParticleChange* AlongStepDoIt( 75 const G4Track& tr 73 const G4Track& track, 76 const G4Step& ste 74 const G4Step& stepData 77 ); // override; << 75 ); 78 76 79 G4VParticleChange* PostStepDoIt( 77 G4VParticleChange* PostStepDoIt( 80 const G4Track& tr 78 const G4Track& track, 81 const G4Step& st 79 const G4Step& stepData 82 ); // override; << 80 ); 83 // Responsible for the relocation << 81 // Responsible for the relocation. 84 82 85 G4double PostStepGetPhysicalInteractionLe 83 G4double PostStepGetPhysicalInteractionLength( 86 const G4Track& , 84 const G4Track& , 87 G4double previo 85 G4double previousStepSize, 88 G4ForceCondition* 86 G4ForceCondition* pForceCond 89 ); // override; << 87 ); 90 // Forces the PostStepDoIt action to be 88 // Forces the PostStepDoIt action to be called, 91 // but does not limit the step << 89 // but does not limit the step. 92 90 93 inline G4bool FieldExertedForce() { retur << 94 << 95 G4PropagatorInField* GetPropagatorInField 91 G4PropagatorInField* GetPropagatorInField(); 96 void SetPropagatorInField( G4PropagatorIn 92 void SetPropagatorInField( G4PropagatorInField* pFieldPropagator); 97 // Access/set the assistant class that << 93 // Access/set the assistant class that Propagate in a Field. >> 94 >> 95 inline void SetVerboseLevel( G4int verboseLevel ); >> 96 inline G4int GetVerboseLevel() const; >> 97 // Level of warnings regarding eg energy conservation >> 98 // in field integration. 98 99 99 inline G4double GetThresholdWarningEnergy 100 inline G4double GetThresholdWarningEnergy() const; 100 inline G4double GetThresholdImportantEner 101 inline G4double GetThresholdImportantEnergy() const; 101 inline G4int GetThresholdTrials() const; 102 inline G4int GetThresholdTrials() const; 102 103 103 inline void SetThresholdWarningEnergy( G4 104 inline void SetThresholdWarningEnergy( G4double newEnWarn ); 104 inline void SetThresholdImportantEnergy( 105 inline void SetThresholdImportantEnergy( G4double newEnImp ); 105 inline void SetThresholdTrials(G4int newM 106 inline void SetThresholdTrials(G4int newMaxTrials ); >> 107 106 // Get/Set parameters for killing loopers 108 // Get/Set parameters for killing loopers: 107 // Above 'important' energy a 'looping' 109 // Above 'important' energy a 'looping' particle in field will 108 // *NOT* be abandoned, except after fTh 110 // *NOT* be abandoned, except after fThresholdTrials attempts. 109 // Below Warning energy, no verbosity for 111 // Below Warning energy, no verbosity for looping particles is issued 110 112 111 void SetHighLooperThresholds(); // Shortc << 112 void SetLowLooperThresholds(); // Set low << 113 void PushThresholdsToLogger(); // Inform << 114 void ReportLooperThresholds(); // Print v << 115 << 116 inline G4double GetMaxEnergyKilled() cons 113 inline G4double GetMaxEnergyKilled() const; 117 inline G4double GetSumEnergyKilled() cons 114 inline G4double GetSumEnergyKilled() const; 118 inline void ResetKilledStatistics( G4int 115 inline void ResetKilledStatistics( G4int report = 1); 119 // Statistics for tracks killed (currentl 116 // Statistics for tracks killed (currently due to looping in field) 120 117 121 inline void EnableShortStepOptimisation(G << 118 public: // without description 122 // Whether short steps < safety will avoi << 123 << 124 static G4bool EnableMagneticMoment(G4bool << 125 // Whether to enable particles to be defl << 126 119 127 static G4bool EnableGravity(G4bool useGra << 120 G4double AtRestGetPhysicalInteractionLength( 128 // Whether to enable particles to be defl << 121 const G4Track& , >> 122 G4ForceCondition* >> 123 ) { return -1.0; }; >> 124 // No operation in AtRestDoIt. 129 125 130 static void SetSilenceLooperWarnings( G << 126 G4VParticleChange* AtRestDoIt( 131 // Do not warn (or throw exception) about << 127 const G4Track& , 132 static G4bool GetSilenceLooperWarnings(); << 128 const G4Step& 133 << 129 ) {return 0;}; 134 public: // without description << 130 // No operation in AtRestDoIt. 135 static G4bool EnableUseMagneticMoment(G4b << 136 { return EnableMagneticMoment(useMoment); << 137 << 138 public: // without description << 139 131 140 G4double AtRestGetPhysicalInteractionLeng << 141 << 142 { return -1.0; } // No operation in At << 143 << 144 G4VParticleChange* AtRestDoIt( const G4Tr << 145 { return 0; } // No operation in At << 146 << 147 void StartTracking(G4Track* aTrack); << 148 // Reset state for new (potentially res << 149 << 150 virtual void ProcessDescription(std::ostr << 151 void PrintStatistics( std::ostream& outSt << 152 << 153 protected: 132 protected: 154 133 155 void SetTouchableInformation(const G4Touc << 134 G4bool DoesGlobalFieldExist(); >> 135 // Checks whether a field exists for the "global" field manager. 156 136 157 void ReportMissingLogger(const char * met << 137 private: 158 << 159 protected: << 160 138 161 G4Navigator* fLinearNavigator; << 139 G4Navigator* fLinearNavigator; 162 // The navigator for the 'mass' geometr << 163 // (the real one, that physics occurs i << 164 G4PropagatorInField* fFieldPropagator; 140 G4PropagatorInField* fFieldPropagator; 165 // The Propagators used to transport th 141 // The Propagators used to transport the particle 166 142 167 G4ThreeVector fTransportEndPosition= << 143 // G4FieldManager* fGlobalFieldMgr; // Used MagneticField CC 168 G4ThreeVector fTransportEndMomentumDir= << 144 // 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 145 176 G4bool fAnyFieldExists= false; << 146 G4ThreeVector fTransportEndPosition; 177 << 147 G4ThreeVector fTransportEndMomentumDir; 178 G4bool fParticleIsLooping = false; << 148 G4double fTransportEndKineticEnergy; 179 G4bool fNewTrack= true; // Flag << 149 G4ThreeVector fTransportEndSpin; 180 G4bool fFirstStepInVolume= true; << 150 G4bool fMomentumChanged; 181 G4bool fLastStepInVolume= false; // Last << 151 G4bool fEnergyChanged; 182 // (temporary << 152 G4bool fEndGlobalTimeComputed; 183 G4bool fGeometryLimitedStep= true; << 153 G4double fCandidateEndGlobalTime; 184 // Flag to determine whether a boundary << 154 // The particle's state after this Step, Store for DoIt 185 155 186 G4bool fFieldExertedForce= false; // Duri << 156 G4bool fParticleIsLooping; 187 157 188 G4TouchableHandle fCurrentTouchableHandle << 158 G4TouchableHandle fCurrentTouchableHandle; 189 159 190 G4ThreeVector fPreviousSftOrigin; << 160 // G4bool fFieldExists; 191 G4double fPreviousSafety; << 161 // Whether a magnetic field exists ... >> 162 // A data member for this is problematic: it is useful only if it >> 163 // can be initialised and updated -- and a scheme is not yet possible. >> 164 >> 165 G4bool fGeometryLimitedStep; >> 166 // Flag to determine whether a boundary was reached. >> 167 >> 168 G4ThreeVector fPreviousSftOrigin; >> 169 G4double fPreviousSafety; 192 // Remember last safety origin & value. 170 // Remember last safety origin & value. 193 171 194 G4ParticleChangeForTransport fParticleCha 172 G4ParticleChangeForTransport fParticleChange; 195 // New ParticleChange 173 // New ParticleChange 196 174 197 G4double fEndPointDistance; << 175 G4double endpointDistance; 198 176 199 // Thresholds for looping particles: << 177 // Thresholds for looping particles: 200 // << 178 // 201 G4double fThreshold_Warning_Energy = 1. << 179 G4double fThreshold_Warning_Energy; // Warn above this energy 202 G4double fThreshold_Important_Energy = 1. << 180 G4double fThreshold_Important_Energy; // Hesitate above this 203 G4int fThresholdTrials = 10; // << 181 G4int fThresholdTrials; // for this no of trials 204 // Above 'important' energy a 'looping' 182 // Above 'important' energy a 'looping' particle in field will 205 // *NOT* be abandoned, except after fTh << 183 // *NOT* be abandoned, except after fThresholdTrials attempts. 206 G4int fAbandonUnstableTrials = 0; // << 184 G4double fUnimportant_Energy; 207 // << 185 // Below this energy, no verbosity for looping particles is issued 208 // Counter for steps in which particle re << 186 209 // ( Used if it is above 'Important' Ene << 187 // Counter for steps in which particle reports 'looping', 210 G4int fNoLooperTrials= 0; << 188 // if it is above 'Important' Energy 211 << 189 G4int fNoLooperTrials; 212 // Statistics for tracks abandoned due to << 190 // Statistics for tracks abandoned 213 // << 191 G4double fSumEnergyKilled; 214 G4double fSumEnergyKilled= 0.0; << 192 G4double fMaxEnergyKilled; 215 G4double fSumEnerSqKilled= 0.0; << 193 216 G4double fMaxEnergyKilled= -1.0; << 194 217 G4int fMaxEnergyKilledPDG= 0; << 195 // Verbosity 218 unsigned long fNumLoopersKilled= 0; << 196 G4int fVerboseLevel; 219 G4double fSumEnergyKilled_NonElectron= 0. << 197 // Verbosity level for warnings 220 G4double fSumEnerSqKilled_NonElectron= 0. << 198 // eg about energy non-conservation in magnetic field. 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; << 231 << 232 G4SafetyHelper* fpSafetyHelper; // To << 233 G4TransportationLogger* fpLogger; // Rep << 234 << 235 protected: << 236 << 237 static G4bool fUseMagneticMoment; << 238 static G4bool fUseGravity; << 239 static G4bool fSilenceLooperWarnings; // << 240 << 241 }; 199 }; 242 200 243 #include "G4Transportation.icc" 201 #include "G4Transportation.icc" 244 202 245 #endif 203 #endif 246 204