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