Geant4 Cross Reference |
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 /// \file exoticphysics/monopole/include/G4MonopoleTransportation.hh 27 /// \brief Definition of the G4MonopoleTransportation class 28 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 // 33 // ------------------------------------------------------------ 34 // GEANT 4 include file implementation 35 // ------------------------------------------------------------ 36 // 37 // Class description: 38 // 39 // G4MonopoleTransportation is a process responsible for the transportation of 40 // magnetic monopoles, i.e. the geometrical propagation encountering the 41 // geometrical sub-volumes of the detectors. 42 // It is also tasked with part of updating the "safety". 43 44 // ======================================================================= 45 // Created: 3 May 2010, J. Apostolakis, B. Bozsogi 46 // ======================================================================= 47 48 #ifndef G4MonopoleTransportation_hh 49 #define G4MonopoleTransportation_hh 1 50 51 #include "G4FieldManager.hh" 52 #include "G4MonopoleFieldSetup.hh" 53 #include "G4Navigator.hh" 54 #include "G4ParticleChangeForTransport.hh" 55 #include "G4PropagatorInField.hh" 56 #include "G4Step.hh" 57 #include "G4Track.hh" 58 #include "G4TransportationManager.hh" 59 #include "G4VProcess.hh" 60 61 class G4SafetyHelper; 62 class G4Monopole; 63 64 class G4MonopoleTransportation : public G4VProcess 65 { 66 // Concrete class that does the geometrical transport 67 68 public: // with description 69 G4MonopoleTransportation(const G4Monopole* p, G4int verbosityLevel = 1); 70 ~G4MonopoleTransportation(); 71 72 virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track& track, 73 G4double previousStepSize, 74 G4double currentMinimumStep, 75 G4double& currentSafety, 76 G4GPILSelection* selection); 77 78 virtual G4VParticleChange* AlongStepDoIt(const G4Track& track, const G4Step& stepData); 79 80 virtual G4VParticleChange* PostStepDoIt(const G4Track& track, const G4Step& stepData); 81 // Responsible for the relocation. 82 83 virtual G4double PostStepGetPhysicalInteractionLength(const G4Track&, G4double previousStepSize, 84 G4ForceCondition* pForceCond); 85 // Forces the PostStepDoIt action to be called, 86 // but does not limit the step. 87 88 G4PropagatorInField* GetPropagatorInField(); 89 void SetPropagatorInField(G4PropagatorInField* pFieldPropagator); 90 // Access/set the assistant class that Propagate in a Field. 91 92 inline G4double GetThresholdWarningEnergy() const; 93 inline G4double GetThresholdImportantEnergy() const; 94 inline G4int GetThresholdTrials() const; 95 96 inline void SetThresholdWarningEnergy(G4double newEnWarn); 97 inline void SetThresholdImportantEnergy(G4double newEnImp); 98 inline void SetThresholdTrials(G4int newMaxTrials); 99 100 // Get/Set parameters for killing loopers: 101 // Above 'important' energy a 'looping' particle in field will 102 // *NOT* be abandoned, except after fThresholdTrials attempts. 103 // Below Warning energy, no verbosity for looping particles is issued 104 105 inline G4double GetMaxEnergyKilled() const; 106 inline G4double GetSumEnergyKilled() const; 107 inline void ResetKilledStatistics(G4int report = 1); 108 // Statistics for tracks killed (currently due to looping in field) 109 110 inline void EnableShortStepOptimisation(G4bool optimise = true); 111 // Whether short steps < safety will avoid to call Navigator (if field=0) 112 113 public: // without description 114 virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&, G4ForceCondition*) 115 { 116 return -1.0; 117 }; 118 // No operation in AtRestDoIt. 119 120 virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) { return 0; }; 121 // No operation in AtRestDoIt. 122 123 G4double GetZmagFieldValue() const { return fMagSetup->GetZmagFieldValue(); } 124 125 virtual void StartTracking(G4Track* aTrack); 126 // Reset state for new (potentially resumed) track 127 128 protected: 129 G4bool DoesGlobalFieldExist(); 130 // Checks whether a field exists for the "global" field manager. 131 132 private: 133 const G4Monopole* fParticleDef; 134 135 G4MonopoleFieldSetup* fMagSetup; 136 137 G4Navigator* fLinearNavigator; 138 G4PropagatorInField* fFieldPropagator; 139 // The Propagators used to transport the particle 140 141 G4ThreeVector fTransportEndPosition; 142 G4ThreeVector fTransportEndMomentumDir; 143 G4double fTransportEndKineticEnergy; 144 G4ThreeVector fTransportEndSpin; 145 G4bool fMomentumChanged; 146 // G4bool fEnergyChanged; 147 G4bool fEndGlobalTimeComputed; 148 G4double fCandidateEndGlobalTime; 149 // The particle's state after this Step, Store for DoIt 150 151 G4bool fParticleIsLooping; 152 153 G4TouchableHandle fCurrentTouchableHandle; 154 155 G4bool fGeometryLimitedStep; 156 // Flag to determine whether a boundary was reached. 157 158 G4ThreeVector fPreviousSftOrigin; 159 G4double fPreviousSafety; 160 // Remember last safety origin & value. 161 162 G4ParticleChangeForTransport fParticleChange; 163 // New ParticleChange 164 165 G4double endpointDistance; 166 167 // Thresholds for looping particles: 168 // 169 G4double fThreshold_Warning_Energy; // Warn above this energy 170 G4double fThreshold_Important_Energy; // Hesitate above this 171 G4int fThresholdTrials; // for this no of trials 172 // Above 'important' energy a 'looping' particle in field will 173 // *NOT* be abandoned, except after fThresholdTrials attempts. 174 // G4double fUnimportant_Energy; 175 // Below this energy, no verbosity for looping particles is issued 176 177 // Counter for steps in which particle reports 'looping', 178 // if it is above 'Important' Energy 179 G4int fNoLooperTrials; 180 // Statistics for tracks abandoned 181 G4double fSumEnergyKilled; 182 G4double fMaxEnergyKilled; 183 184 // Whether to avoid calling G4Navigator for short step ( < safety) 185 // If using it, the safety estimate for endpoint will likely be smaller. 186 G4bool fShortStepOptimisation; 187 188 G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained 189 G4int noCalls; 190 }; 191 192 #include "G4MonopoleTransportation.icc" 193 194 #endif 195