[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
[963] | 27 | // $Id: G4Transportation.hh,v 1.17 2007/11/09 15:39:20 japost Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[819] | 29 | // |
---|
| 30 | // |
---|
| 31 | // ------------------------------------------------------------ |
---|
| 32 | // GEANT 4 include file implementation |
---|
| 33 | // ------------------------------------------------------------ |
---|
| 34 | // |
---|
| 35 | // Class description: |
---|
| 36 | // |
---|
| 37 | // G4Transportation is a process responsible for the transportation of |
---|
| 38 | // a particle, i.e. the geometrical propagation encountering the |
---|
| 39 | // geometrical sub-volumes of the detectors. |
---|
| 40 | // It is also tasked with part of updating the "safety". |
---|
| 41 | |
---|
| 42 | // ======================================================================= |
---|
| 43 | // Created: 19 March 1997, J. Apostolakis |
---|
| 44 | // ======================================================================= |
---|
| 45 | #ifndef G4Transportation_hh |
---|
| 46 | #define G4Transportation_hh 1 |
---|
| 47 | |
---|
| 48 | #include "G4VProcess.hh" |
---|
| 49 | #include "G4FieldManager.hh" |
---|
| 50 | |
---|
| 51 | #include "G4Navigator.hh" |
---|
| 52 | #include "G4TransportationManager.hh" |
---|
| 53 | #include "G4PropagatorInField.hh" |
---|
| 54 | #include "G4Track.hh" |
---|
| 55 | #include "G4Step.hh" |
---|
| 56 | #include "G4ParticleChangeForTransport.hh" |
---|
[963] | 57 | class G4SafetyHelper; |
---|
[819] | 58 | |
---|
| 59 | class G4Transportation : public G4VProcess |
---|
| 60 | { |
---|
| 61 | // Concrete class that does the geometrical transport |
---|
| 62 | |
---|
| 63 | public: // with description |
---|
| 64 | |
---|
| 65 | G4Transportation( G4int verbosityLevel= 1); |
---|
| 66 | ~G4Transportation(); |
---|
| 67 | |
---|
| 68 | G4double AlongStepGetPhysicalInteractionLength( |
---|
| 69 | const G4Track& track, |
---|
| 70 | G4double previousStepSize, |
---|
| 71 | G4double currentMinimumStep, |
---|
| 72 | G4double& currentSafety, |
---|
| 73 | G4GPILSelection* selection |
---|
| 74 | ); |
---|
| 75 | |
---|
| 76 | G4VParticleChange* AlongStepDoIt( |
---|
| 77 | const G4Track& track, |
---|
| 78 | const G4Step& stepData |
---|
| 79 | ); |
---|
| 80 | |
---|
| 81 | G4VParticleChange* PostStepDoIt( |
---|
| 82 | const G4Track& track, |
---|
| 83 | const G4Step& stepData |
---|
| 84 | ); |
---|
| 85 | // Responsible for the relocation. |
---|
| 86 | |
---|
| 87 | G4double PostStepGetPhysicalInteractionLength( |
---|
| 88 | const G4Track& , |
---|
| 89 | G4double previousStepSize, |
---|
| 90 | G4ForceCondition* pForceCond |
---|
| 91 | ); |
---|
| 92 | // Forces the PostStepDoIt action to be called, |
---|
| 93 | // but does not limit the step. |
---|
| 94 | |
---|
| 95 | G4PropagatorInField* GetPropagatorInField(); |
---|
| 96 | void SetPropagatorInField( G4PropagatorInField* pFieldPropagator); |
---|
| 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. |
---|
| 103 | |
---|
| 104 | inline G4double GetThresholdWarningEnergy() const; |
---|
| 105 | inline G4double GetThresholdImportantEnergy() const; |
---|
| 106 | inline G4int GetThresholdTrials() const; |
---|
| 107 | |
---|
| 108 | inline void SetThresholdWarningEnergy( G4double newEnWarn ); |
---|
| 109 | inline void SetThresholdImportantEnergy( G4double newEnImp ); |
---|
| 110 | inline void SetThresholdTrials(G4int newMaxTrials ); |
---|
| 111 | |
---|
| 112 | // Get/Set parameters for killing loopers: |
---|
| 113 | // Above 'important' energy a 'looping' particle in field will |
---|
| 114 | // *NOT* be abandoned, except after fThresholdTrials attempts. |
---|
| 115 | // Below Warning energy, no verbosity for looping particles is issued |
---|
| 116 | |
---|
| 117 | inline G4double GetMaxEnergyKilled() const; |
---|
| 118 | inline G4double GetSumEnergyKilled() const; |
---|
| 119 | inline void ResetKilledStatistics( G4int report = 1); |
---|
| 120 | // Statistics for tracks killed (currently due to looping in field) |
---|
| 121 | |
---|
| 122 | inline void EnableShortStepOptimisation(G4bool optimise=true); |
---|
| 123 | // Whether short steps < safety will avoid to call Navigator (if field=0) |
---|
| 124 | |
---|
| 125 | public: // without description |
---|
| 126 | |
---|
| 127 | G4double AtRestGetPhysicalInteractionLength( |
---|
| 128 | const G4Track& , |
---|
| 129 | G4ForceCondition* |
---|
| 130 | ) { return -1.0; }; |
---|
| 131 | // No operation in AtRestDoIt. |
---|
| 132 | |
---|
| 133 | G4VParticleChange* AtRestDoIt( |
---|
| 134 | const G4Track& , |
---|
| 135 | const G4Step& |
---|
| 136 | ) {return 0;}; |
---|
| 137 | // No operation in AtRestDoIt. |
---|
| 138 | |
---|
| 139 | void StartTracking(G4Track* aTrack); |
---|
| 140 | // Reset state for new (potentially resumed) track |
---|
| 141 | |
---|
| 142 | protected: |
---|
| 143 | |
---|
| 144 | G4bool DoesGlobalFieldExist(); |
---|
| 145 | // Checks whether a field exists for the "global" field manager. |
---|
| 146 | |
---|
| 147 | private: |
---|
| 148 | |
---|
| 149 | G4Navigator* fLinearNavigator; |
---|
| 150 | G4PropagatorInField* fFieldPropagator; |
---|
| 151 | // The Propagators used to transport the particle |
---|
| 152 | |
---|
| 153 | // G4FieldManager* fGlobalFieldMgr; // Used MagneticField CC |
---|
| 154 | // Field Manager for the whole Detector |
---|
| 155 | |
---|
| 156 | G4ThreeVector fTransportEndPosition; |
---|
| 157 | G4ThreeVector fTransportEndMomentumDir; |
---|
| 158 | G4double fTransportEndKineticEnergy; |
---|
| 159 | G4ThreeVector fTransportEndSpin; |
---|
| 160 | G4bool fMomentumChanged; |
---|
| 161 | G4bool fEnergyChanged; |
---|
| 162 | G4bool fEndGlobalTimeComputed; |
---|
| 163 | G4double fCandidateEndGlobalTime; |
---|
| 164 | // The particle's state after this Step, Store for DoIt |
---|
| 165 | |
---|
| 166 | G4bool fParticleIsLooping; |
---|
| 167 | |
---|
| 168 | G4TouchableHandle fCurrentTouchableHandle; |
---|
| 169 | |
---|
| 170 | // G4bool fFieldExists; |
---|
| 171 | // Whether a magnetic field exists ... |
---|
| 172 | // A data member for this is problematic: it is useful only if it |
---|
| 173 | // can be initialised and updated -- and a scheme is not yet possible. |
---|
| 174 | |
---|
| 175 | G4bool fGeometryLimitedStep; |
---|
| 176 | // Flag to determine whether a boundary was reached. |
---|
| 177 | |
---|
| 178 | G4ThreeVector fPreviousSftOrigin; |
---|
| 179 | G4double fPreviousSafety; |
---|
| 180 | // Remember last safety origin & value. |
---|
| 181 | |
---|
| 182 | G4ParticleChangeForTransport fParticleChange; |
---|
| 183 | // New ParticleChange |
---|
| 184 | |
---|
| 185 | G4double endpointDistance; |
---|
| 186 | |
---|
| 187 | // Thresholds for looping particles: |
---|
| 188 | // |
---|
| 189 | G4double fThreshold_Warning_Energy; // Warn above this energy |
---|
| 190 | G4double fThreshold_Important_Energy; // Hesitate above this |
---|
| 191 | G4int fThresholdTrials; // for this no of trials |
---|
| 192 | // Above 'important' energy a 'looping' particle in field will |
---|
| 193 | // *NOT* be abandoned, except after fThresholdTrials attempts. |
---|
| 194 | G4double fUnimportant_Energy; |
---|
| 195 | // Below this energy, no verbosity for looping particles is issued |
---|
| 196 | |
---|
| 197 | // Counter for steps in which particle reports 'looping', |
---|
| 198 | // if it is above 'Important' Energy |
---|
| 199 | G4int fNoLooperTrials; |
---|
| 200 | // Statistics for tracks abandoned |
---|
| 201 | G4double fSumEnergyKilled; |
---|
| 202 | G4double fMaxEnergyKilled; |
---|
| 203 | |
---|
| 204 | // Whether to avoid calling G4Navigator for short step ( < safety) |
---|
| 205 | // If using it, the safety estimate for endpoint will likely be smaller. |
---|
| 206 | G4bool fShortStepOptimisation; |
---|
| 207 | |
---|
[963] | 208 | G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained |
---|
| 209 | |
---|
[819] | 210 | // Verbosity |
---|
| 211 | G4int fVerboseLevel; |
---|
| 212 | // Verbosity level for warnings |
---|
| 213 | // eg about energy non-conservation in magnetic field. |
---|
| 214 | }; |
---|
| 215 | |
---|
| 216 | #include "G4Transportation.icc" |
---|
| 217 | |
---|
| 218 | #endif |
---|