Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // Class G4PropagatorInField 27 // 28 // class description: 29 // 30 // This class performs the navigation/propagat 31 // in a magnetic field. The field is in genera 32 // For the calculation of the path, it relies 33 34 // History: 35 // ------- 36 // 25.10.96 John Apostolakis, design and impl 37 // 25.03.97 John Apostolakis, adaptation for 38 // 8.11.02 John Apostolakis, changes to enab 39 // ------------------------------------------- 40 #ifndef G4PropagatorInField_hh 41 #define G4PropagatorInField_hh 1 42 43 #include "G4Types.hh" 44 45 #include <vector> 46 47 #include "G4FieldTrack.hh" 48 #include "G4FieldManager.hh" 49 #include "G4VIntersectionLocator.hh" 50 51 class G4ChordFinder; 52 53 class G4Navigator; 54 class G4VPhysicalVolume; 55 class G4VCurvedTrajectoryFilter; 56 57 class G4PropagatorInField 58 { 59 60 public: // with description 61 62 G4PropagatorInField( G4Navigator* theNaviga 63 G4FieldManager* detect 64 G4VIntersectionLocator 65 ~G4PropagatorInField(); 66 67 G4double ComputeStep( G4FieldTrack& pFieldT 68 G4double pCurrentProp 69 G4double& pNewSafety, 70 G4VPhysicalVolume* pP 71 G4bool canRelaxDeltaC 72 // Compute the next geometric Step 73 74 inline G4ThreeVector EndPosition() const; 75 inline G4ThreeVector EndMomentumDir() const 76 inline G4bool IsParticleLooping() co 77 // Return the state after the Step 78 79 inline G4double GetEpsilonStep() const; 80 // Relative accuracy for current Step (Ca 81 inline void SetEpsilonStep(G4double new 82 // The ratio DeltaOneStep()/h_current_ste 83 84 G4FieldManager* FindAndSetFieldManager(G4VP 85 // Set (and return) the correct field man 86 // if it exists. 87 // Should be called before ComputeStep is 88 // Currently, ComputeStep will call it, i 89 90 inline G4ChordFinder* GetChordFinder(); 91 92 G4int SetVerboseLevel( G4int verbose 93 inline G4int GetVerboseLevel() const; 94 inline G4int Verbose() const; 95 inline void CheckMode(G4bool mode); 96 97 inline void SetVerboseTrace( G4bool enabl 98 inline G4bool GetVerboseTrace(); 99 // Tracing key parts of Compute Step 100 101 inline G4int GetMaxLoopCount() const; 102 inline void SetMaxLoopCount( G4int new_max 103 // A maximum for the number of substeps t 104 // Above this number it is signaled as 105 106 void printStatus( const G4FieldTrack& 107 const G4FieldTrack& 108 G4double 109 G4double 110 G4int 111 G4VPhysicalVolume* 112 // Print Method - useful mostly for debug 113 114 inline G4FieldTrack GetEndState() const; 115 116 inline G4double GetMinimumEpsilonStep() con 117 inline void SetMinimumEpsilonStep( G4do 118 inline G4double GetMaximumEpsilonStep() con 119 inline void SetMaximumEpsilonStep( G4do 120 // The 4 above methods are now obsolescen 121 // They are being replaced by same-name m 122 // allowing the specialisation in differe 123 // Their new behaviour is to change the v 124 // manager 125 126 void SetLargestAcceptableStep( G4double 127 G4double GetLargestAcceptableStep(); 128 void ResetLargestAcceptableStep(); 129 // Obtain / change the size of the larges 130 // Reset method uses the world volume's 131 132 G4double GetMaxStepSizeMultiplier(); 133 void SetMaxStepSizeMultiplier(G4double 134 // Control extra Multiplier parameter for 135 G4double GetMinBigDistance(); 136 void SetMinBigDistance(G4double val); 137 // Control minimum 'directional' distance 138 139 void SetTrajectoryFilter(G4VCurvedTrajector 140 // Set the filter that examines & stores 141 // curved trajectory points. Currently o 142 143 std::vector<G4ThreeVector>* GimmeTrajectory 144 // Access the points which have passed by 145 // Responsibility for deleting the points 146 // This method MUST BE called exactly ONC 147 148 void ClearPropagatorState(); 149 // Clear all the State of this class and 150 // --> the current field manager & chord 151 152 inline void SetDetectorFieldManager( G4Fiel 153 // Update this (dangerous) state -- for t 154 155 inline void SetUseSafetyForOptimization( 156 inline G4bool GetUseSafetyForOptimization() 157 // Toggle & view parameter for using safe 158 // unneccesary calls to navigator (thus ' 159 inline G4bool IntersectChord( const G4Three 160 const G4Three 161 G4doubl 162 G4doubl 163 G4Three 164 // Intersect the chord from StartPointA t 165 // and return whether an intersection occ 166 // NOTE: Safety is changed! 167 168 inline G4bool IsFirstStepInVolume(); 169 inline G4bool IsLastStepInVolume(); 170 inline void PrepareNewTrack(); 171 172 inline G4VIntersectionLocator* GetIntersect 173 inline void SetIntersectionLocator(G4VInter 174 // Change or get the object which calcula 175 // intersection point with the next bound 176 177 inline G4int GetIterationsToIncreaseChordDi 178 inline void SetIterationsToIncreaseChordDi 179 // Control the parameter which enables th 180 // which ensures that chord segments ar 181 // their sagitta is small than delta-ch 182 // The Set method increases the value of 183 // doubling it once the number of itera 184 // value of 'IncreaseChordDistanceThres 185 // again every time the iteration count 186 // value. 187 // Note: delta-chord is reset to its orig 188 // each call to ComputeStep. 189 190 public: // without description 191 192 inline G4double GetDeltaIntersection() cons 193 inline G4double GetDeltaOneStep() const; 194 195 inline G4FieldManager* GetCurrentFieldManag 196 inline G4EquationOfMotion* GetCurrentEquati 197 // Auxiliary methods - their results can 198 199 inline void SetNavigatorForPropagating(G4Na 200 inline G4Navigator* GetNavigatorForPropagat 201 202 inline void SetThresholdNoZeroStep( G4int n 203 G4int n 204 G4int n 205 inline G4int GetThresholdNoZeroSteps( G4int 206 207 inline G4double GetZeroStepThreshold(); 208 inline void SetZeroStepThreshold( G4dou 209 210 void RefreshIntersectionLocator(); 211 // Update the Locator with parameters fro 212 // and from current field manager 213 214 protected: // without description 215 216 void PrintStepLengthDiagnostic( G4double 217 G4double 218 G4double 219 const G4FieldTrac 220 221 void ReportLoopingParticle( G4int count, G 222 G4double stepRe 223 const G4ThreeVe 224 G4VPhysicalVolu 225 void ReportStuckParticle(G4int noZeroSteps, 226 G4double lastTried 227 228 private: 229 230 // ---------------------------------------- 231 // DATA Members 232 // ---------------------------------------- 233 234 // ======================================= 235 // INVARIANTS - Must not change during tra 236 237 // ** PARAMETERS ----------- 238 G4int fMax_loop_count = 1000; 239 // Limit for the number of sub-steps take 240 G4int fIncreaseChordDistanceThreshold = 100 241 G4bool fUseSafetyForOptimisation = true; 242 // (false) is less sensitive to incorrect 243 244 // Thresholds for identifying "abnormal" c 245 // 246 G4int fActionThreshold_NoZeroSteps = 2; 247 G4int fSevereActionThreshold_NoZeroSteps = 248 G4int fAbandonThreshold_NoZeroSteps = 50; 249 G4double fZeroStepThreshold = 0.0; 250 // Threshold *length* for counting of tin 251 252 // Parameters related to handling of very l 253 // occur typically in large volumes with 254 G4double fLargestAcceptableStep; 255 // Maximum size of a step - for optimizat 256 G4double fMaxStepSizeMultiplier = 3; 257 // Multiplier for directional exit distan 258 G4double fMinBigDistance= 100. ; // * CLHEP 259 // Minimum distance added to directional 260 // ** End of PARAMETERS ----- 261 262 G4double kCarTolerance; 263 // Geometrical tolerance defining surfa 264 265 G4bool fAllocatedLocator; 266 267 // --------------------------------------- 268 // ** Dependent Objects - to which work is 269 270 G4FieldManager* fDetectorFieldMgr; 271 // The Field Manager of the whole Dete 272 273 G4VIntersectionLocator* fIntersectionLocato 274 // Refines candidate intersection 275 276 G4VCurvedTrajectoryFilter* fpTrajectoryFilt 277 // The filter encapsulates the algorithm 278 // intermediate points should be stored i 279 // When it is NULL, no intermediate point 280 // Else PIF::ComputeStep must submit (all 281 // points it calculates, to this filter. 282 283 G4Navigator* fNavigator; 284 // Set externally - only by tracking / ru 285 // 286 // ** End of Dependent Objects ----------- 287 288 // End of INVARIANTS 289 // ======================================= 290 291 // STATE information 292 // ----------------- 293 G4FieldManager* fCurrentFieldMgr; 294 // The Field Manager of the current volu 295 G4bool fSetFieldMgr = false; // Has it bee 296 297 // Parameters of current step 298 G4double fEpsilonStep; // Relati 299 G4FieldTrack End_PointAndTangent; // End po 300 G4bool fParticleIsLooping = false; 301 G4int fNoZeroStep = 0; // Count 302 303 // State used for Optimisation 304 G4double fFull_CurveLen_of_LastAttempt = -1 305 G4double fLast_ProposedStepLength = -1; 306 // Previous step information -- for use i 307 G4ThreeVector fPreviousSftOrigin; 308 G4double fPreviousSafety = 0.0; 309 // Last safety origin & value: for optimi 310 311 G4int fVerboseLevel = 0; 312 G4bool fVerbTracePiF = false; 313 G4bool fCheck = false; 314 // For debugging purposes 315 316 G4bool fFirstStepInVolume = true; 317 G4bool fLastStepInVolume = true; 318 G4bool fNewTrack = true; 319 }; 320 321 // Inline methods 322 // 323 #include "G4PropagatorInField.icc" 324 325 #endif 326