00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4Transportation.hh 69887 2013-05-17 08:17:02Z gcosmo $ 00028 // 00029 // 00030 // ------------------------------------------------------------ 00031 // GEANT 4 include file implementation 00032 // ------------------------------------------------------------ 00033 // 00034 // Class description: 00035 // 00036 // G4Transportation is a process responsible for the transportation of 00037 // a particle, i.e. the geometrical propagation encountering the 00038 // geometrical sub-volumes of the detectors. 00039 // It is also tasked with part of updating the "safety". 00040 00041 // ======================================================================= 00042 // Created: 19 March 1997, J. Apostolakis 00043 // ======================================================================= 00044 #ifndef G4Transportation_hh 00045 #define G4Transportation_hh 1 00046 00047 #include "G4VProcess.hh" 00048 #include "G4FieldManager.hh" 00049 00050 #include "G4Navigator.hh" 00051 #include "G4TransportationManager.hh" 00052 #include "G4PropagatorInField.hh" 00053 #include "G4Track.hh" 00054 #include "G4Step.hh" 00055 #include "G4ParticleChangeForTransport.hh" 00056 class G4SafetyHelper; 00057 00058 class G4Transportation : public G4VProcess 00059 { 00060 // Concrete class that does the geometrical transport 00061 00062 public: // with description 00063 00064 G4Transportation( G4int verbosityLevel= 1); 00065 ~G4Transportation(); 00066 00067 G4double AlongStepGetPhysicalInteractionLength( 00068 const G4Track& track, 00069 G4double previousStepSize, 00070 G4double currentMinimumStep, 00071 G4double& currentSafety, 00072 G4GPILSelection* selection 00073 ); 00074 00075 G4VParticleChange* AlongStepDoIt( 00076 const G4Track& track, 00077 const G4Step& stepData 00078 ); 00079 00080 G4VParticleChange* PostStepDoIt( 00081 const G4Track& track, 00082 const G4Step& stepData 00083 ); 00084 // Responsible for the relocation. 00085 00086 G4double PostStepGetPhysicalInteractionLength( 00087 const G4Track& , 00088 G4double previousStepSize, 00089 G4ForceCondition* pForceCond 00090 ); 00091 // Forces the PostStepDoIt action to be called, 00092 // but does not limit the step. 00093 00094 G4PropagatorInField* GetPropagatorInField(); 00095 void SetPropagatorInField( G4PropagatorInField* pFieldPropagator); 00096 // Access/set the assistant class that Propagate in a Field. 00097 00098 inline void SetVerboseLevel( G4int verboseLevel ); 00099 inline G4int GetVerboseLevel() const; 00100 // Level of warnings regarding eg energy conservation 00101 // in field integration. 00102 00103 inline G4double GetThresholdWarningEnergy() const; 00104 inline G4double GetThresholdImportantEnergy() const; 00105 inline G4int GetThresholdTrials() const; 00106 00107 inline void SetThresholdWarningEnergy( G4double newEnWarn ); 00108 inline void SetThresholdImportantEnergy( G4double newEnImp ); 00109 inline void SetThresholdTrials(G4int newMaxTrials ); 00110 00111 // Get/Set parameters for killing loopers: 00112 // Above 'important' energy a 'looping' particle in field will 00113 // *NOT* be abandoned, except after fThresholdTrials attempts. 00114 // Below Warning energy, no verbosity for looping particles is issued 00115 00116 inline G4double GetMaxEnergyKilled() const; 00117 inline G4double GetSumEnergyKilled() const; 00118 inline void ResetKilledStatistics( G4int report = 1); 00119 // Statistics for tracks killed (currently due to looping in field) 00120 00121 inline void EnableShortStepOptimisation(G4bool optimise=true); 00122 // Whether short steps < safety will avoid to call Navigator (if field=0) 00123 00124 inline G4bool EnableUseMagneticMoment(G4bool useMoment=true); 00125 // Whether to deflect particles with force due to magnetic moment 00126 00127 public: // without description 00128 00129 G4double AtRestGetPhysicalInteractionLength( 00130 const G4Track& , 00131 G4ForceCondition* 00132 ) { return -1.0; }; 00133 // No operation in AtRestDoIt. 00134 00135 G4VParticleChange* AtRestDoIt( 00136 const G4Track& , 00137 const G4Step& 00138 ) {return 0;}; 00139 // No operation in AtRestDoIt. 00140 00141 void StartTracking(G4Track* aTrack); 00142 // Reset state for new (potentially resumed) track 00143 00144 protected: 00145 00146 G4bool DoesGlobalFieldExist(); 00147 // Checks whether a field exists for the "global" field manager. 00148 00149 private: 00150 00151 G4Navigator* fLinearNavigator; 00152 G4PropagatorInField* fFieldPropagator; 00153 // The Propagators used to transport the particle 00154 00155 // G4FieldManager* fGlobalFieldMgr; // Used MagneticField CC 00156 // Field Manager for the whole Detector 00157 00158 G4ThreeVector fTransportEndPosition; 00159 G4ThreeVector fTransportEndMomentumDir; 00160 G4double fTransportEndKineticEnergy; 00161 G4ThreeVector fTransportEndSpin; 00162 G4bool fMomentumChanged; 00163 G4bool fEndGlobalTimeComputed; 00164 G4double fCandidateEndGlobalTime; 00165 // The particle's state after this Step, Store for DoIt 00166 00167 G4bool fParticleIsLooping; 00168 00169 G4TouchableHandle fCurrentTouchableHandle; 00170 00171 // G4bool fFieldExists; 00172 // Whether a magnetic field exists ... 00173 // A data member for this is problematic: it is useful only if it 00174 // can be initialised and updated -- and a scheme is not yet possible. 00175 00176 G4bool fGeometryLimitedStep; 00177 // Flag to determine whether a boundary was reached. 00178 00179 G4ThreeVector fPreviousSftOrigin; 00180 G4double fPreviousSafety; 00181 // Remember last safety origin & value. 00182 00183 G4ParticleChangeForTransport fParticleChange; 00184 // New ParticleChange 00185 00186 G4double fEndPointDistance; 00187 00188 // Thresholds for looping particles: 00189 // 00190 G4double fThreshold_Warning_Energy; // Warn above this energy 00191 G4double fThreshold_Important_Energy; // Hesitate above this 00192 G4int fThresholdTrials; // for this no of trials 00193 // Above 'important' energy a 'looping' particle in field will 00194 // *NOT* be abandoned, except after fThresholdTrials attempts. 00195 00196 // Counter for steps in which particle reports 'looping', 00197 // if it is above 'Important' Energy 00198 G4int fNoLooperTrials; 00199 // Statistics for tracks abandoned 00200 G4double fSumEnergyKilled; 00201 G4double fMaxEnergyKilled; 00202 00203 // Whether to avoid calling G4Navigator for short step ( < safety) 00204 // If using it, the safety estimate for endpoint will likely be smaller. 00205 G4bool fShortStepOptimisation; 00206 00207 // Whether to track state change from magnetic moment in a B-field 00208 G4bool fUseMagneticMoment; 00209 00210 G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained 00211 00212 // Verbosity 00213 G4int fVerboseLevel; 00214 // Verbosity level for warnings 00215 // eg about energy non-conservation in magnetic field. 00216 }; 00217 00218 #include "G4Transportation.icc" 00219 00220 #endif