| [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 | //
|
|---|
| [921] | 27 | // $Id: G4PropagatorInField.icc,v 1.13 2008/10/29 14:31:55 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-02-cand-01 $
|
|---|
| [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 |
|
|---|
| 112 | inline
|
|---|
| 113 | G4double G4PropagatorInField::GetDeltaIntersection() const
|
|---|
| 114 | {
|
|---|
| 115 | return fCurrentFieldMgr->GetDeltaIntersection();
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | inline
|
|---|
| 119 | G4double G4PropagatorInField::GetDeltaOneStep() const
|
|---|
| 120 | {
|
|---|
| 121 | return fCurrentFieldMgr->GetDeltaOneStep();
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | inline
|
|---|
| 125 | void
|
|---|
| 126 | G4PropagatorInField::SetAccuraciesWithDeltaOneStep( G4double valDeltaOneStep )
|
|---|
| 127 | {
|
|---|
| 128 | fDetectorFieldMgr->SetAccuraciesWithDeltaOneStep(valDeltaOneStep);
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | inline
|
|---|
| 132 | void G4PropagatorInField::SetDeltaOneStep( G4double valDeltaOneStep )
|
|---|
| 133 | {
|
|---|
| 134 | fDetectorFieldMgr->SetDeltaOneStep(valDeltaOneStep);
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | inline
|
|---|
| 138 | void G4PropagatorInField::SetDeltaIntersection( G4double valDeltaIntersection )
|
|---|
| 139 | {
|
|---|
| 140 | fDetectorFieldMgr->SetDeltaIntersection(valDeltaIntersection);
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | inline
|
|---|
| 144 | G4int G4PropagatorInField::GetVerboseLevel() const
|
|---|
| 145 | {
|
|---|
| 146 | return fVerboseLevel;
|
|---|
| 147 | }
|
|---|
| 148 | inline
|
|---|
| 149 | G4int G4PropagatorInField::Verbose() const // Obsolete
|
|---|
| 150 | {
|
|---|
| 151 | return GetVerboseLevel();
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | inline
|
|---|
| 155 | G4FieldTrack G4PropagatorInField::GetEndState() const
|
|---|
| 156 | {
|
|---|
| 157 | return End_PointAndTangent;
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | // Minimum for Relative accuracy of a Step in volumes of global field
|
|---|
| 161 | inline
|
|---|
| 162 | G4double G4PropagatorInField::GetMinimumEpsilonStep() const
|
|---|
| 163 | {
|
|---|
| 164 | return fDetectorFieldMgr->GetMinimumEpsilonStep();
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | inline
|
|---|
| 168 | void G4PropagatorInField::SetMinimumEpsilonStep( G4double newEpsMin )
|
|---|
| 169 | {
|
|---|
| 170 | fDetectorFieldMgr->SetMinimumEpsilonStep(newEpsMin);
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | // Maximum for Relative accuracy of any Step
|
|---|
| 174 | inline
|
|---|
| 175 | G4double G4PropagatorInField::GetMaximumEpsilonStep() const
|
|---|
| 176 | {
|
|---|
| 177 | return fDetectorFieldMgr->GetMaximumEpsilonStep();
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | inline
|
|---|
| 181 | void G4PropagatorInField::SetMaximumEpsilonStep( G4double newEpsMax )
|
|---|
| 182 | {
|
|---|
| 183 | fDetectorFieldMgr->SetMaximumEpsilonStep( newEpsMax );
|
|---|
| 184 | }
|
|---|
| 185 |
|
|---|
| 186 | inline
|
|---|
| 187 | void G4PropagatorInField::SetLargestAcceptableStep( G4double newBigDist )
|
|---|
| 188 | {
|
|---|
| 189 | if( fLargestAcceptableStep>0.0 )
|
|---|
| 190 | {
|
|---|
| 191 | fLargestAcceptableStep = newBigDist;
|
|---|
| 192 | }
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | inline
|
|---|
| 196 | G4double G4PropagatorInField::GetLargestAcceptableStep()
|
|---|
| 197 | {
|
|---|
| 198 | return fLargestAcceptableStep;
|
|---|
| 199 | }
|
|---|
| 200 |
|
|---|
| 201 | inline
|
|---|
| 202 | G4FieldManager* G4PropagatorInField::GetCurrentFieldManager()
|
|---|
| 203 | {
|
|---|
| 204 | return fCurrentFieldMgr;
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | inline
|
|---|
| 208 | void G4PropagatorInField::SetThresholdNoZeroStep( G4int noAct,
|
|---|
| 209 | G4int noHarsh,
|
|---|
| 210 | G4int noAbandon )
|
|---|
| 211 | {
|
|---|
| 212 | if( noAct>0 )
|
|---|
| 213 | fActionThreshold_NoZeroSteps = noAct;
|
|---|
| 214 |
|
|---|
| 215 | if( noHarsh > fActionThreshold_NoZeroSteps )
|
|---|
| 216 | fSevereActionThreshold_NoZeroSteps = noHarsh;
|
|---|
| 217 | else
|
|---|
| 218 | fSevereActionThreshold_NoZeroSteps = 2*(fActionThreshold_NoZeroSteps+1);
|
|---|
| 219 |
|
|---|
| 220 | if( noAbandon > fSevereActionThreshold_NoZeroSteps+5 )
|
|---|
| 221 | fAbandonThreshold_NoZeroSteps = noAbandon;
|
|---|
| 222 | else
|
|---|
| 223 | fAbandonThreshold_NoZeroSteps = 2*(fSevereActionThreshold_NoZeroSteps+3);
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 | inline
|
|---|
| 227 | G4int G4PropagatorInField::GetThresholdNoZeroSteps( G4int i )
|
|---|
| 228 | {
|
|---|
| 229 | G4int t=0;
|
|---|
| 230 | if( i==0 ) { t = 3; } // No of parameters
|
|---|
| 231 | else if (i==1) { t = fActionThreshold_NoZeroSteps; }
|
|---|
| 232 | else if (i==2) { t = fSevereActionThreshold_NoZeroSteps; }
|
|---|
| 233 | else if (i==3) { t = fAbandonThreshold_NoZeroSteps; }
|
|---|
| 234 |
|
|---|
| 235 | return t;
|
|---|
| 236 | }
|
|---|
| 237 |
|
|---|
| 238 | inline
|
|---|
| 239 | void G4PropagatorInField::SetDetectorFieldManager(G4FieldManager* newDetectorFieldManager)
|
|---|
| 240 | {
|
|---|
| 241 | fDetectorFieldMgr = newDetectorFieldManager;
|
|---|
| 242 | }
|
|---|
| 243 |
|
|---|
| 244 |
|
|---|
| 245 | inline
|
|---|
| 246 | void G4PropagatorInField:: SetUseSafetyForOptimization( G4bool value )
|
|---|
| 247 | {
|
|---|
| 248 | fUseSafetyForOptimisation= value;
|
|---|
| 249 | }
|
|---|
| 250 |
|
|---|
| 251 | inline
|
|---|
| 252 | G4bool G4PropagatorInField::GetUseSafetyForOptimization()
|
|---|
| 253 | {
|
|---|
| 254 | return fUseSafetyForOptimisation;
|
|---|
| 255 | }
|
|---|
| 256 |
|
|---|
| 257 | inline
|
|---|
| 258 | void G4PropagatorInField::
|
|---|
| 259 | SetNavigatorForPropagating( G4Navigator *SimpleOrMultiNavigator )
|
|---|
| 260 | {
|
|---|
| 261 | if(SimpleOrMultiNavigator) { fNavigator= SimpleOrMultiNavigator; }
|
|---|
| 262 | }
|
|---|
| 263 |
|
|---|
| 264 | inline
|
|---|
| 265 | G4Navigator* G4PropagatorInField::GetNavigatorForPropagating()
|
|---|
| 266 | {
|
|---|
| 267 | return fNavigator;
|
|---|
| 268 | }
|
|---|
| [850] | 269 |
|
|---|
| [921] | 270 | inline
|
|---|
| 271 | void G4PropagatorInField::
|
|---|
| 272 | SetIntersectionLocator( G4VIntersectionLocator *pIntLoc )
|
|---|
| [850] | 273 | {
|
|---|
| [921] | 274 | if(pIntLoc) { fIntersectionLocator= pIntLoc; }
|
|---|
| [850] | 275 | }
|
|---|
| [921] | 276 |
|
|---|
| [850] | 277 | inline
|
|---|
| [921] | 278 | G4VIntersectionLocator* G4PropagatorInField::GetIntersectionLocator()
|
|---|
| [850] | 279 | {
|
|---|
| [921] | 280 | return fIntersectionLocator;
|
|---|
| 281 | }
|
|---|
| 282 |
|
|---|
| 283 | inline
|
|---|
| 284 | G4bool G4PropagatorInField::IntersectChord( G4ThreeVector StartPointA,
|
|---|
| 285 | G4ThreeVector EndPointB,
|
|---|
| 286 | G4double &NewSafety,
|
|---|
| 287 | G4double &LinearStepLength,
|
|---|
| 288 | G4ThreeVector &IntersectionPoint )
|
|---|
| 289 | {
|
|---|
| 290 | // Calculate the direction and length of the chord AB
|
|---|
| 291 | //
|
|---|
| 292 | return fIntersectionLocator
|
|---|
| 293 | ->IntersectChord(StartPointA,EndPointB,NewSafety,
|
|---|
| 294 | fPreviousSafety,fPreviousSftOrigin,
|
|---|
| 295 | LinearStepLength,IntersectionPoint);
|
|---|
| [850] | 296 | }
|
|---|