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: G4CoupledTransportation.hh 86964 2014-11-21 11:47:44Z gcosmo $ 27 // 28 // 28 // 29 // 29 // ------------------------------------------- 30 // ------------------------------------------------------------ 30 // GEANT 4 include file implementation 31 // GEANT 4 include file implementation 31 // ------------------------------------------- 32 // ------------------------------------------------------------ 32 // 33 // 33 // Class description: 34 // Class description: 34 // 35 // 35 // G4CoupledTransportation is an optional proc 36 // G4CoupledTransportation is an optional process to transport 36 // a particle, in case of coupled navigation i 37 // a particle, in case of coupled navigation in parallel geometries 37 // i.e. the geometrical propagation will be d 38 // i.e. the geometrical propagation will be done 38 // encountering the geometrical volumes of t 39 // encountering the geometrical volumes of the detectors and 39 // those of parallel geometries (eg for bias 40 // those of parallel geometries (eg for biasing, scoring, fast simulation) 40 // It is tasked with updating the "safety" to 41 // It is tasked with updating the "safety" to reflect the geometrical 41 // distance to the nearest volume, and the t 42 // distance to the nearest volume, and the time of flight of the particle. 42 43 43 // =========================================== 44 // ======================================================================= 44 // Created: 17 May 2006, J. Apostolakis 45 // Created: 17 May 2006, J. Apostolakis 45 // =========================================== 46 // ======================================================================= 46 #ifndef G4CoupledTransportation_hh 47 #ifndef G4CoupledTransportation_hh 47 #define G4CoupledTransportation_hh 1 48 #define G4CoupledTransportation_hh 1 48 49 49 #include "G4Transportation.hh" << 50 #include "G4VProcess.hh" >> 51 >> 52 #include "G4FieldManager.hh" >> 53 >> 54 #include "G4Navigator.hh" >> 55 #include "G4TransportationManager.hh" >> 56 #include "G4PropagatorInField.hh" >> 57 #include "G4PathFinder.hh" 50 58 51 #include "G4Track.hh" 59 #include "G4Track.hh" 52 #include "G4Step.hh" 60 #include "G4Step.hh" >> 61 #include "G4ParticleChangeForTransport.hh" >> 62 class G4SafetyHelper; 53 63 54 class G4PathFinder; << 64 class G4CoupledTransportation : public G4VProcess 55 << 56 class G4CoupledTransportation : public G4Trans << 57 { 65 { >> 66 // Concrete class that does the geometrical transport 58 67 59 public: // with description 68 public: // with description 60 69 61 G4CoupledTransportation( G4int verbosityL 70 G4CoupledTransportation( G4int verbosityLevel= 0); 62 ~G4CoupledTransportation(); 71 ~G4CoupledTransportation(); 63 72 64 G4double AlongStepGetPhysicalInterac 73 G4double AlongStepGetPhysicalInteractionLength( 65 const G4Track& tr 74 const G4Track& track, 66 G4double p 75 G4double previousStepSize, 67 G4double c 76 G4double currentMinimumStep, 68 G4double& c 77 G4double& currentSafety, 69 G4GPILSelec 78 G4GPILSelection* selection 70 ); 79 ); 71 80 72 // AlongStepDoIt is implemented by G4Tran << 81 G4VParticleChange* AlongStepDoIt( >> 82 const G4Track& track, >> 83 const G4Step& stepData >> 84 ); 73 85 74 G4VParticleChange* PostStepDoIt( 86 G4VParticleChange* PostStepDoIt( 75 const G4Track& tr 87 const G4Track& track, 76 const G4Step& st 88 const G4Step& stepData 77 ); 89 ); 78 // Responsible for the relocation << 90 // Responsible for the relocation. >> 91 >> 92 G4double PostStepGetPhysicalInteractionLength( >> 93 const G4Track& , >> 94 G4double previousStepSize, >> 95 G4ForceCondition* pForceCond >> 96 ); >> 97 // Forces the PostStepDoIt action to be called, >> 98 // but does not limit the step. 79 99 80 // PostStepGetPhysicalInteractionLength i << 100 G4PropagatorInField* GetPropagatorInField(); 81 // G4Transportation to force PostStepDoIt << 101 void SetPropagatorInField( G4PropagatorInField* pFieldPropagator); >> 102 // Access/set the assistant class that Propagate in a Field. >> 103 >> 104 inline void SetVerboseLevel( G4int verboseLevel ); >> 105 inline G4int GetVerboseLevel() const; >> 106 // Level of warnings regarding eg energy conservation >> 107 // in field integration. >> 108 >> 109 inline G4double GetThresholdWarningEnergy() const; >> 110 inline G4double GetThresholdImportantEnergy() const; >> 111 inline G4int GetThresholdTrials() const; >> 112 >> 113 inline void SetThresholdWarningEnergy( G4double newEnWarn ); >> 114 inline void SetThresholdImportantEnergy( G4double newEnImp ); >> 115 inline void SetThresholdTrials(G4int newMaxTrials ); >> 116 >> 117 // Get/Set parameters for killing loopers: >> 118 // Above 'important' energy a 'looping' particle in field will >> 119 // *NOT* be abandoned, except after fThresholdTrials attempts. >> 120 // Below Warning energy, no verbosity for looping particles is issued >> 121 >> 122 inline G4double GetMaxEnergyKilled() const; >> 123 inline G4double GetSumEnergyKilled() const; >> 124 inline void ResetKilledStatistics( G4int report = 1); >> 125 // Statistics for tracks killed (currently due to looping in field) 82 126 83 static void SetSignifyStepsInAnyVolume( << 127 static G4bool EnableUseMagneticMoment(G4bool useMoment=true); 84 { fSignifyStepInAnyVolume = anyVol; } << 128 // Whether to deflect particles with force due to magnetic moment 85 static G4bool GetSignifyStepsInAnyVolume( << 86 { return fSignifyStepInAnyVolume; } << 87 // Flag in step corresponds to first/last << 88 // geometry (if this is true) or refers t << 89 // geometry only (if false) << 90 << 91 // The following methods give access to f << 92 // geometry *independent* of the choice o << 93 // << 94 G4bool IsFirstStepInAnyVolume() const { r << 95 G4bool IsLastStepInAnyVolume() const { re << 96 G4bool IsFirstStepInMassVolume() const { << 97 G4bool IsLastStepInMassVolume() const { r << 98 129 99 public: // without description 130 public: // without description 100 131 101 void StartTracking(G4Track* aTrack); 132 void StartTracking(G4Track* aTrack); 102 void EndTracking(); 133 void EndTracking(); 103 134 104 static G4bool EnableUseMagneticMoment(G4b << 135 G4double AtRestGetPhysicalInteractionLength( 105 { return EnableMagneticMoment(useMoment) << 136 const G4Track& , 106 // Old name ... obsolete << 137 G4ForceCondition* 107 << 138 ) { return -1.0; }; >> 139 // No operation in AtRestDoIt. >> 140 >> 141 G4VParticleChange* AtRestDoIt( >> 142 const G4Track& , >> 143 const G4Step& >> 144 ) {return 0;}; >> 145 // No operation in AtRestDoIt. >> 146 108 protected: 147 protected: 109 148 >> 149 G4bool DoesGlobalFieldExist(); >> 150 // Checks whether a field exists for the "global" field manager. >> 151 110 void ReportInexactEnergy(G4double startEn 152 void ReportInexactEnergy(G4double startEnergy, G4double endEnergy); 111 // Issue warning 153 // Issue warning 112 154 113 void ReportMove( G4ThreeVector OldVector, 155 void ReportMove( G4ThreeVector OldVector, G4ThreeVector NewVector, 114 const G4String& Quantity 156 const G4String& Quantity ); 115 << 157 116 private: 158 private: 117 159 >> 160 G4Navigator* fMassNavigator; >> 161 // The navigator for the 'mass' geometry (the real one, that physics occurs in) 118 G4PathFinder* fPathFinder; 162 G4PathFinder* fPathFinder; >> 163 G4int fNavigatorId; 119 // The PathFinder used to transport the 164 // The PathFinder used to transport the particle 120 165 >> 166 G4PropagatorInField* fFieldPropagator; >> 167 // Still required in order to find/set the fieldmanager >> 168 >> 169 G4bool fGlobalFieldExists; >> 170 // G4bool fStartedNewTrack; // True for first step or restarted tracking >> 171 // until first step's AlongStepGPIL >> 172 >> 173 G4ThreeVector fTransportEndPosition; >> 174 G4ThreeVector fTransportEndMomentumDir; >> 175 G4double fTransportEndKineticEnergy; >> 176 G4ThreeVector fTransportEndSpin; >> 177 G4bool fMomentumChanged; >> 178 // The particle's state after this Step, Store for DoIt >> 179 >> 180 G4bool fEndGlobalTimeComputed; >> 181 G4double fCandidateEndGlobalTime; >> 182 >> 183 G4bool fParticleIsLooping; >> 184 >> 185 G4ThreeVector fPreviousSftOrigin; 121 G4double fPreviousMassSafety; 186 G4double fPreviousMassSafety; 122 G4double fPreviousFullSafety; 187 G4double fPreviousFullSafety; 123 188 >> 189 G4TouchableHandle fCurrentTouchableHandle; >> 190 >> 191 // G4bool fFieldExists; >> 192 // Whether a magnetic field exists ... >> 193 // A data member for this is problematic: it is useful only if it >> 194 // can be initialised and updated -- and a scheme is not yet possible. >> 195 124 G4bool fMassGeometryLimitedStep; 196 G4bool fMassGeometryLimitedStep; 125 // Flag to determine whether a 'mass' b 197 // Flag to determine whether a 'mass' boundary was reached. >> 198 G4bool fAnyGeometryLimitedStep; >> 199 // Did any geometry limit the step ? 126 200 127 private: << 201 G4ParticleChangeForTransport fParticleChange; >> 202 // New ParticleChange 128 203 129 G4bool fFirstStepInMassVolume; << 204 G4double fEndpointDistance; 130 // G4bool fLastStepInMassVolume; => use f << 205 >> 206 >> 207 // Thresholds for looping particles: >> 208 // >> 209 G4double fThreshold_Warning_Energy; // Warn above this energy >> 210 G4double fThreshold_Important_Energy; // Hesitate above this >> 211 G4int fThresholdTrials; // for this no of trials >> 212 // Above 'important' energy a 'looping' particle in field will >> 213 // *NOT* be abandoned, except after fThresholdTrials attempts. >> 214 >> 215 // Counter for steps in which particle reports 'looping', >> 216 // if it is above 'Important' Energy >> 217 G4int fNoLooperTrials; >> 218 // Statistics for tracks abandoned >> 219 G4double fSumEnergyKilled; >> 220 G4double fMaxEnergyKilled; >> 221 >> 222 G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained >> 223 >> 224 // Verbosity >> 225 G4int fVerboseLevel; >> 226 // Verbosity level for warnings >> 227 // eg about energy non-conservation in magnetic field. >> 228 >> 229 // Whether to track state change from magnetic moment in a B-field >> 230 private: >> 231 friend class G4Transportation; >> 232 static G4bool fUseMagneticMoment; 131 233 132 static G4bool fSignifyStepInAnyVolume; << 133 // True: First/Last step in any one of << 134 // False: First/Last step in volume of << 135 }; 234 }; >> 235 >> 236 #include "G4CoupledTransportation.icc" 136 237 137 #endif 238 #endif 138 239