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