[831] | 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 | // |
---|
[1228] | 27 | // $Id: G4PropagatorInField.icc,v 1.16 2009/11/13 17:34:26 japost Exp $ |
---|
| 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[831] | 29 | // |
---|
| 30 | // |
---|
| 31 | // ------------------------------------------------------------------------ |
---|
| 32 | // GEANT 4 inline implementation |
---|
| 33 | // |
---|
| 34 | // ------------------------------------------------------------------------ |
---|
| 35 | // |
---|
| 36 | // 25.10.96 John Apostolakis, design and implementation |
---|
| 37 | // 25.03.97 John Apostolakis, adaptation for G4Transportation and cleanup |
---|
| 38 | // |
---|
| 39 | // To create an object of this type, must have: |
---|
| 40 | // - an object that calculates the Curved paths |
---|
| 41 | // - the navigator to find (linear) intersections |
---|
| 42 | // - and ?? also must know the value of the maximum displacement allowed |
---|
| 43 | // ------------------------------------------------------------------------ |
---|
| 44 | |
---|
| 45 | inline |
---|
| 46 | G4ChordFinder* G4PropagatorInField::GetChordFinder() |
---|
| 47 | { |
---|
| 48 | // The "Chord Finder" of the current Field Mgr is used |
---|
| 49 | // -- this could be of the global field manager |
---|
| 50 | // or that of another, from the current volume |
---|
| 51 | return fCurrentFieldMgr->GetChordFinder(); |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | inline |
---|
| 55 | void G4PropagatorInField::SetChargeMomentumMass( |
---|
| 56 | G4double Charge, // in e+ units |
---|
| 57 | G4double Momentum, // in GeV/c |
---|
| 58 | G4double Mass) // in ? units |
---|
| 59 | { |
---|
| 60 | // GetChordFinder()->SetChargeMomentumMass(Charge, Momentum, Mass); |
---|
| 61 | // --> Not needed anymore, as it is done in ComputeStep for the |
---|
| 62 | // ChordFinder of the current step (which is known only then). |
---|
| 63 | fCharge = Charge; |
---|
| 64 | fInitialMomentumModulus = Momentum; |
---|
| 65 | fMass = Mass; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | // Obtain the final space-point and velocity (normal) at the end of the Step |
---|
| 69 | // |
---|
| 70 | inline |
---|
| 71 | G4ThreeVector G4PropagatorInField::EndPosition() const |
---|
| 72 | { |
---|
| 73 | return End_PointAndTangent.GetPosition(); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | inline |
---|
| 77 | G4ThreeVector G4PropagatorInField::EndMomentumDir() const |
---|
| 78 | { |
---|
| 79 | return End_PointAndTangent.GetMomentumDir(); |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | inline |
---|
| 83 | G4double G4PropagatorInField::GetEpsilonStep() const |
---|
| 84 | { |
---|
| 85 | return fEpsilonStep; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | inline |
---|
| 89 | void G4PropagatorInField::SetEpsilonStep( G4double newEps ) |
---|
| 90 | { |
---|
| 91 | fEpsilonStep=newEps; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | inline |
---|
| 95 | G4bool G4PropagatorInField::IsParticleLooping() const |
---|
| 96 | { |
---|
| 97 | return fParticleIsLooping; |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | inline |
---|
| 101 | G4int G4PropagatorInField::GetMaxLoopCount() const |
---|
| 102 | { |
---|
| 103 | return fMax_loop_count; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | inline |
---|
| 107 | void G4PropagatorInField::SetMaxLoopCount( G4int new_max ) |
---|
| 108 | { |
---|
| 109 | fMax_loop_count = new_max; |
---|
| 110 | } |
---|
| 111 | |
---|
[1228] | 112 | // #if 0 |
---|
[831] | 113 | inline |
---|
| 114 | G4double G4PropagatorInField::GetDeltaIntersection() const |
---|
| 115 | { |
---|
| 116 | return fCurrentFieldMgr->GetDeltaIntersection(); |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | inline |
---|
| 120 | G4double G4PropagatorInField::GetDeltaOneStep() const |
---|
| 121 | { |
---|
| 122 | return fCurrentFieldMgr->GetDeltaOneStep(); |
---|
| 123 | } |
---|
[1228] | 124 | // #endif |
---|
[831] | 125 | |
---|
| 126 | inline |
---|
| 127 | G4int G4PropagatorInField::GetVerboseLevel() const |
---|
| 128 | { |
---|
| 129 | return fVerboseLevel; |
---|
| 130 | } |
---|
| 131 | inline |
---|
| 132 | G4int G4PropagatorInField::Verbose() const // Obsolete |
---|
| 133 | { |
---|
| 134 | return GetVerboseLevel(); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | inline |
---|
| 138 | G4FieldTrack G4PropagatorInField::GetEndState() const |
---|
| 139 | { |
---|
| 140 | return End_PointAndTangent; |
---|
| 141 | } |
---|
| 142 | |
---|
| 143 | // Minimum for Relative accuracy of a Step in volumes of global field |
---|
| 144 | inline |
---|
| 145 | G4double G4PropagatorInField::GetMinimumEpsilonStep() const |
---|
| 146 | { |
---|
| 147 | return fDetectorFieldMgr->GetMinimumEpsilonStep(); |
---|
| 148 | } |
---|
| 149 | |
---|
| 150 | inline |
---|
| 151 | void G4PropagatorInField::SetMinimumEpsilonStep( G4double newEpsMin ) |
---|
| 152 | { |
---|
| 153 | fDetectorFieldMgr->SetMinimumEpsilonStep(newEpsMin); |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | // Maximum for Relative accuracy of any Step |
---|
| 157 | inline |
---|
| 158 | G4double G4PropagatorInField::GetMaximumEpsilonStep() const |
---|
| 159 | { |
---|
| 160 | return fDetectorFieldMgr->GetMaximumEpsilonStep(); |
---|
| 161 | } |
---|
| 162 | |
---|
| 163 | inline |
---|
| 164 | void G4PropagatorInField::SetMaximumEpsilonStep( G4double newEpsMax ) |
---|
| 165 | { |
---|
| 166 | fDetectorFieldMgr->SetMaximumEpsilonStep( newEpsMax ); |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | inline |
---|
| 170 | void G4PropagatorInField::SetLargestAcceptableStep( G4double newBigDist ) |
---|
| 171 | { |
---|
| 172 | if( fLargestAcceptableStep>0.0 ) |
---|
| 173 | { |
---|
| 174 | fLargestAcceptableStep = newBigDist; |
---|
| 175 | } |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | inline |
---|
| 179 | G4double G4PropagatorInField::GetLargestAcceptableStep() |
---|
| 180 | { |
---|
| 181 | return fLargestAcceptableStep; |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | inline |
---|
| 185 | G4FieldManager* G4PropagatorInField::GetCurrentFieldManager() |
---|
| 186 | { |
---|
| 187 | return fCurrentFieldMgr; |
---|
| 188 | } |
---|
| 189 | |
---|
| 190 | inline |
---|
| 191 | void G4PropagatorInField::SetThresholdNoZeroStep( G4int noAct, |
---|
| 192 | G4int noHarsh, |
---|
| 193 | G4int noAbandon ) |
---|
| 194 | { |
---|
| 195 | if( noAct>0 ) |
---|
| 196 | fActionThreshold_NoZeroSteps = noAct; |
---|
| 197 | |
---|
| 198 | if( noHarsh > fActionThreshold_NoZeroSteps ) |
---|
| 199 | fSevereActionThreshold_NoZeroSteps = noHarsh; |
---|
| 200 | else |
---|
| 201 | fSevereActionThreshold_NoZeroSteps = 2*(fActionThreshold_NoZeroSteps+1); |
---|
| 202 | |
---|
| 203 | if( noAbandon > fSevereActionThreshold_NoZeroSteps+5 ) |
---|
| 204 | fAbandonThreshold_NoZeroSteps = noAbandon; |
---|
| 205 | else |
---|
| 206 | fAbandonThreshold_NoZeroSteps = 2*(fSevereActionThreshold_NoZeroSteps+3); |
---|
| 207 | } |
---|
| 208 | |
---|
| 209 | inline |
---|
| 210 | G4int G4PropagatorInField::GetThresholdNoZeroSteps( G4int i ) |
---|
| 211 | { |
---|
| 212 | G4int t=0; |
---|
| 213 | if( i==0 ) { t = 3; } // No of parameters |
---|
| 214 | else if (i==1) { t = fActionThreshold_NoZeroSteps; } |
---|
| 215 | else if (i==2) { t = fSevereActionThreshold_NoZeroSteps; } |
---|
| 216 | else if (i==3) { t = fAbandonThreshold_NoZeroSteps; } |
---|
| 217 | |
---|
| 218 | return t; |
---|
| 219 | } |
---|
| 220 | |
---|
[1228] | 221 | inline G4double G4PropagatorInField::GetZeroStepThreshold(){ return fZeroStepThreshold; } |
---|
| 222 | inline void G4PropagatorInField::SetZeroStepThreshold( G4double newLength ) |
---|
| 223 | { |
---|
| 224 | fZeroStepThreshold= newLength; |
---|
| 225 | } |
---|
| 226 | |
---|
[831] | 227 | inline |
---|
| 228 | void G4PropagatorInField::SetDetectorFieldManager(G4FieldManager* newDetectorFieldManager) |
---|
| 229 | { |
---|
| 230 | fDetectorFieldMgr = newDetectorFieldManager; |
---|
| 231 | } |
---|
| 232 | |
---|
| 233 | |
---|
| 234 | inline |
---|
| 235 | void G4PropagatorInField:: SetUseSafetyForOptimization( G4bool value ) |
---|
| 236 | { |
---|
| 237 | fUseSafetyForOptimisation= value; |
---|
| 238 | } |
---|
| 239 | |
---|
| 240 | inline |
---|
| 241 | G4bool G4PropagatorInField::GetUseSafetyForOptimization() |
---|
| 242 | { |
---|
| 243 | return fUseSafetyForOptimisation; |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | inline |
---|
| 247 | void G4PropagatorInField:: |
---|
| 248 | SetNavigatorForPropagating( G4Navigator *SimpleOrMultiNavigator ) |
---|
| 249 | { |
---|
[1228] | 250 | if(SimpleOrMultiNavigator) { |
---|
| 251 | fNavigator= SimpleOrMultiNavigator; |
---|
| 252 | if( fIntersectionLocator ) { |
---|
| 253 | fIntersectionLocator->SetNavigatorFor( SimpleOrMultiNavigator ); |
---|
| 254 | } |
---|
| 255 | } |
---|
[831] | 256 | } |
---|
| 257 | |
---|
| 258 | inline |
---|
| 259 | G4Navigator* G4PropagatorInField::GetNavigatorForPropagating() |
---|
| 260 | { |
---|
| 261 | return fNavigator; |
---|
| 262 | } |
---|
[850] | 263 | |
---|
[921] | 264 | inline |
---|
| 265 | void G4PropagatorInField:: |
---|
| 266 | SetIntersectionLocator( G4VIntersectionLocator *pIntLoc ) |
---|
[850] | 267 | { |
---|
[921] | 268 | if(pIntLoc) { fIntersectionLocator= pIntLoc; } |
---|
[850] | 269 | } |
---|
[921] | 270 | |
---|
[850] | 271 | inline |
---|
[921] | 272 | G4VIntersectionLocator* G4PropagatorInField::GetIntersectionLocator() |
---|
[850] | 273 | { |
---|
[921] | 274 | return fIntersectionLocator; |
---|
| 275 | } |
---|
| 276 | |
---|
| 277 | inline |
---|
| 278 | G4bool G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA, |
---|
| 279 | G4ThreeVector EndPointB, |
---|
| 280 | G4double &NewSafety, |
---|
| 281 | G4double &LinearStepLength, |
---|
| 282 | G4ThreeVector &IntersectionPoint ) |
---|
| 283 | { |
---|
| 284 | // Calculate the direction and length of the chord AB |
---|
| 285 | // |
---|
| 286 | return fIntersectionLocator |
---|
| 287 | ->IntersectChord(StartPointA,EndPointB,NewSafety, |
---|
| 288 | fPreviousSafety,fPreviousSftOrigin, |
---|
| 289 | LinearStepLength,IntersectionPoint); |
---|
[850] | 290 | } |
---|
[1228] | 291 | |
---|