CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
MonopoleTransportation Class Reference

#include <MonopoleTransportation.h>

Inheritance diagram for MonopoleTransportation:

Public Member Functions

G4VParticleChange * AlongStepDoIt (const G4Track &track, const G4Step &stepData) override
 
G4double AlongStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &currentSafety, G4GPILSelection *selection) override
 
G4VParticleChange * AtRestDoIt (const G4Track &, const G4Step &) override
 
G4double AtRestGetPhysicalInteractionLength (const G4Track &, G4ForceCondition *) override
 
void EnableShortStepOptimisation (G4bool optimise=true)
 
G4double GetMaxEnergyKilled () const
 
G4PropagatorInField * GetPropagatorInField ()
 
G4double GetSumEnergyKilled () const
 
G4double GetThresholdImportantEnergy () const
 
G4int GetThresholdTrials () const
 
G4double GetThresholdWarningEnergy () const
 
 MonopoleTransportation (const Monopole *p, G4int verbosityLevel=1)
 
G4VParticleChange * PostStepDoIt (const G4Track &track, const G4Step &stepData) override
 
G4double PostStepGetPhysicalInteractionLength (const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond) override
 
void ResetKilledStatistics (G4int report=1)
 
void SetPropagatorInField (G4PropagatorInField *pFieldPropagator)
 
void SetThresholdImportantEnergy (G4double newEnImp)
 
void SetThresholdTrials (G4int newMaxTrials)
 
void SetThresholdWarningEnergy (G4double newEnWarn)
 
void StartTracking (G4Track *aTrack) override
 
 ~MonopoleTransportation () override
 

Protected Member Functions

G4bool DoesGlobalFieldExist ()
 

Private Attributes

G4double endpointDistance
 
G4double fCandidateEndGlobalTime
 
G4TouchableHandle fCurrentTouchableHandle
 
G4bool fEndGlobalTimeComputed
 
G4PropagatorInField * fFieldPropagator
 
G4bool fGeometryLimitedStep
 
CMSFieldManagerfieldMgrCMS
 
G4Navigator * fLinearNavigator
 
G4double fMaxEnergyKilled
 
G4bool fMomentumChanged
 
G4int fNoLooperTrials
 
G4ParticleChangeForTransport fParticleChange
 
const MonopolefParticleDef
 
G4bool fParticleIsLooping
 
G4double fPreviousSafety
 
G4ThreeVector fPreviousSftOrigin
 
G4SafetyHelper * fpSafetyHelper
 
G4bool fShortStepOptimisation
 
G4double fSumEnergyKilled
 
G4double fThreshold_Important_Energy
 
G4double fThreshold_Warning_Energy
 
G4int fThresholdTrials
 
G4double fTransportEndKineticEnergy
 
G4ThreeVector fTransportEndMomentumDir
 
G4ThreeVector fTransportEndPosition
 
G4ThreeVector fTransportEndSpin
 

Detailed Description

Definition at line 45 of file MonopoleTransportation.h.

Constructor & Destructor Documentation

MonopoleTransportation::MonopoleTransportation ( const Monopole p,
G4int  verbosityLevel = 1 
)

Definition at line 33 of file MonopoleTransportation.cc.

References fCandidateEndGlobalTime, fCurrentTouchableHandle, fEndGlobalTimeComputed, fFieldPropagator, fLinearNavigator, and fpSafetyHelper.

34  : G4VProcess( G4String("MonopoleTransportation"), fTransportation ),
35  fParticleDef(mpl),
36  fieldMgrCMS(nullptr),
37  fLinearNavigator(nullptr),
38  fFieldPropagator(nullptr),
39  fParticleIsLooping( false ),
40  fPreviousSftOrigin (0.,0.,0.),
41  fPreviousSafety ( 0.0 ),
44  fThresholdTrials( 10 ),
45  fNoLooperTrials(0),
46  fSumEnergyKilled( 0.0 ), fMaxEnergyKilled( 0.0 ),
47  fShortStepOptimisation(false), // Old default: true (=fast short steps)
48  fpSafetyHelper(nullptr)
49 {
50  verboseLevel = verb;
51 
52  // set Process Sub Type
53  SetProcessSubType(TRANSPORTATION);
54 
55 #ifdef G4MULTITHREADED
56  // Do not finalize the MonopoleTransportation class
57  if (G4Threading::IsMasterThread())
58  {
59  return;
60  }
61 #endif
62 
63  G4TransportationManager* transportMgr =
64  G4TransportationManager::GetTransportationManager();
65 
66  fLinearNavigator = transportMgr->GetNavigatorForTracking() ;
67 
68  fFieldPropagator = transportMgr->GetPropagatorInField() ;
69  fpSafetyHelper = transportMgr->GetSafetyHelper();
70 
71  // Cannot determine whether a field exists here,
72  // because it would only work if the field manager has informed
73  // about the detector's field before this transportation process
74  // is constructed.
75  // Instead later the method DoesGlobalFieldExist() is called
76 
77  fCurrentTouchableHandle = nullptr;
78 
79  fEndGlobalTimeComputed = false;
81 }
const double MeV
G4PropagatorInField * fFieldPropagator
G4TouchableHandle fCurrentTouchableHandle
MonopoleTransportation::~MonopoleTransportation ( )
override

Definition at line 85 of file MonopoleTransportation.cc.

References AlongStepGetPhysicalInteractionLength(), and fSumEnergyKilled.

86 {
87  if( (verboseLevel > 0) && (fSumEnergyKilled > 0.0 ) ){
88  /*
89  G4cout << " MonopoleTransportation: Statistics for looping particles "
90  << G4endl;
91  G4cout << " Sum of energy of loopers killed: " << fSumEnergyKilled << G4endl;
92  G4cout << " Max energy of loopers killed: " << fMaxEnergyKilled << G4endl;
93  */
94  }
95 }

Member Function Documentation

G4VParticleChange * MonopoleTransportation::AlongStepDoIt ( const G4Track &  track,
const G4Step &  stepData 
)
override

Definition at line 360 of file MonopoleTransportation.cc.

References fCandidateEndGlobalTime, fEndGlobalTimeComputed, fFieldPropagator, fMaxEnergyKilled, fMomentumChanged, fNoLooperTrials, fParticleChange, fParticleIsLooping, fSumEnergyKilled, fThreshold_Important_Energy, fThreshold_Warning_Energy, fThresholdTrials, fTransportEndKineticEnergy, fTransportEndMomentumDir, fTransportEndPosition, fTransportEndSpin, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, MeV, and PostStepGetPhysicalInteractionLength().

362 {
363  fParticleChange.Initialize(track) ;
364 
365  // Code for specific process
366  //
367  fParticleChange.ProposePosition(fTransportEndPosition) ;
368  fParticleChange.ProposeMomentumDirection(fTransportEndMomentumDir) ;
370  fParticleChange.SetMomentumChanged(fMomentumChanged) ;
371 
372  fParticleChange.ProposePolarization(fTransportEndSpin);
373 
374  G4double deltaTime = 0.0 ;
375 
376  // Calculate Lab Time of Flight (ONLY if field Equations used it!)
377  G4double startTime = track.GetGlobalTime() ;
378 
380  {
381  // The time was not integrated .. make the best estimate possible
382  //
383  G4double finalVelocity = track.GetVelocity() ;
384  G4double initialVelocity = stepData.GetPreStepPoint()->GetVelocity() ;
385  G4double stepLength = track.GetStepLength() ;
386 
387  deltaTime= 0.0; // in case initialVelocity = 0
388  if (finalVelocity > 0.0)
389  {
390  G4double meanInverseVelocity ;
391  meanInverseVelocity = 0.5
392  * ( 1.0 / initialVelocity + 1.0 / finalVelocity ) ;
393  deltaTime = stepLength * meanInverseVelocity ;
394  }
395  else if( initialVelocity > 0.0 )
396  {
397  deltaTime = stepLength/initialVelocity ;
398  }
399  fCandidateEndGlobalTime = startTime + deltaTime ;
400  }
401  else
402  {
403  deltaTime = fCandidateEndGlobalTime - startTime ;
404  }
405 
406  fParticleChange.ProposeGlobalTime( fCandidateEndGlobalTime ) ;
407 
408  // Now Correct by Lorentz factor to get "proper" deltaTime
409 
410  G4double restMass = track.GetDynamicParticle()->GetMass() ;
411  G4double deltaProperTime = deltaTime*( restMass/track.GetTotalEnergy() ) ;
412 
413  fParticleChange.ProposeProperTime(track.GetProperTime() + deltaProperTime) ;
414  //fParticleChange. ProposeTrueStepLength( track.GetStepLength() ) ;
415 
416  // If the particle is caught looping or is stuck (in very difficult
417  // boundaries) in a magnetic field (doing many steps)
418  // THEN this kills it ...
419  //
420  if ( fParticleIsLooping )
421  {
422  G4double endEnergy= fTransportEndKineticEnergy;
423 
424  if( (endEnergy < fThreshold_Important_Energy)
426  // Kill the looping particle
427  //
428  fParticleChange.ProposeTrackStatus( fStopAndKill ) ;
429 
430  // 'Bare' statistics
431  fSumEnergyKilled += endEnergy;
432  if( endEnergy > fMaxEnergyKilled) { fMaxEnergyKilled= endEnergy; }
433 
434 #ifdef G4VERBOSE
435  if( (verboseLevel > 1) ||
436  ( endEnergy > fThreshold_Warning_Energy ) ) {
437  G4cout << " MonopoleTransportation is killing track that is looping or stuck "
438  << G4endl
439  << " This track has " << track.GetKineticEnergy() / MeV
440  << " MeV energy." << G4endl;
441  G4cout << " Number of trials = " << fNoLooperTrials
442  << " No of calls to AlongStepDoIt = " << noCalls
443  << G4endl;
444  }
445 #endif
446  fNoLooperTrials=0;
447  }
448  else{
449  fNoLooperTrials ++;
450 #ifdef G4VERBOSE
451  if( (verboseLevel > 2) ){
452  G4cout << " MonopoleTransportation::AlongStepDoIt(): Particle looping - "
453  << " Number of trials = " << fNoLooperTrials
454  << " No of calls to = " << noCalls
455  << G4endl;
456  }
457 #endif
458  }
459  }else{
460  fNoLooperTrials=0;
461  }
462 
463  // Another (sometimes better way) is to use a user-limit maximum Step size
464  // to alleviate this problem ..
465 
466  // Introduce smooth curved trajectories to particle-change
467  //
468  fParticleChange.SetPointerToVectorOfAuxiliaryPoints
469  (fFieldPropagator->GimmeTrajectoryVectorAndForgetIt() );
470 
471  return &fParticleChange ;
472 }
const double MeV
G4ParticleChangeForTransport fParticleChange
G4PropagatorInField * fFieldPropagator
G4double MonopoleTransportation::AlongStepGetPhysicalInteractionLength ( const G4Track &  track,
G4double  previousStepSize,
G4double  currentMinimumStep,
G4double &  currentSafety,
G4GPILSelection *  selection 
)
override

Definition at line 105 of file MonopoleTransportation.cc.

References CMSFieldManager::ConfigureForTrack(), endpointDistance, funct::false, fCandidateEndGlobalTime, fEndGlobalTimeComputed, fFieldPropagator, fGeometryLimitedStep, fieldMgrCMS, fLinearNavigator, fMomentumChanged, fParticleChange, fParticleDef, fParticleIsLooping, fPreviousSafety, fPreviousSftOrigin, fpSafetyHelper, fShortStepOptimisation, fTransportEndKineticEnergy, fTransportEndMomentumDir, fTransportEndPosition, fTransportEndSpin, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, mag(), Monopole::MagneticCharge(), CMSFieldManager::SetMonopoleTracking(), spin(), funct::sqr(), mathSSE::sqrt(), and funct::true.

Referenced by ~MonopoleTransportation().

110 {
111  // change to monopole equation
113 
114  G4double geometryStepLength, newSafety ;
116 
117  // Initial actions moved to StartTrack()
118  // --------------------------------------
119  // Note: in case another process changes touchable handle
120  // it will be necessary to add here (for all steps)
121  // fCurrentTouchableHandle = aTrack->GetTouchableHandle();
122 
123  // GPILSelection is set to defaule value of CandidateForSelection
124  // It is a return value
125  //
126  *selection = CandidateForSelection ;
127 
128  // Get initial Energy/Momentum of the track
129  //
130  const G4DynamicParticle* pParticle = track.GetDynamicParticle() ;
131  const G4ThreeVector& startMomentumDir = pParticle->GetMomentumDirection() ;
132  G4ThreeVector startPosition = track.GetPosition() ;
133 
134  // The Step Point safety can be limited by other geometries and/or the
135  // assumptions of any process - it's not always the geometrical safety.
136  // We calculate the starting point's isotropic safety here.
137  //
138  G4ThreeVector OriginShift = startPosition - fPreviousSftOrigin ;
139  G4double MagSqShift = OriginShift.mag2() ;
140  if( MagSqShift >= sqr(fPreviousSafety) )
141  {
142  currentSafety = 0.0 ;
143  }
144  else
145  {
146  currentSafety = fPreviousSafety - std::sqrt(MagSqShift) ;
147  }
148 
149  // Is the monopole charged ?
150  //
151  G4double particleMagneticCharge = fParticleDef->MagneticCharge() ;
152  G4double particleElectricCharge = pParticle->GetCharge();
153 
155 
156  // There is no need to locate the current volume. It is Done elsewhere:
157  // On track construction
158  // By the tracking, after all AlongStepDoIts, in "Relocation"
159 
160  // Check whether the particle have an (EM) field force exerting upon it
161  G4bool fieldExertsForce = false ;
162 
163  if(particleMagneticCharge != 0.0 && fieldMgrCMS) {
164  // Message the field Manager, to configure it for this track
166  // Moved here, in order to allow a transition
167  // from a zero-field status (with fieldMgr->(field)0
168  // to a finite field status
169 
170  // If the field manager has no field, there is no field !
171  fieldExertsForce = (fieldMgrCMS->GetDetectorField() != nullptr);
172  }
173 
174  // G4cout << " G4Transport: field exerts force= " << fieldExertsForce
175  // << " fieldMgr= " << fieldMgr << G4endl;
176 
177  // Choose the calculation of the transportation: Field or not
178  //
179  if( !fieldExertsForce )
180  {
181  G4double linearStepLength ;
182  if( fShortStepOptimisation && (currentMinimumStep <= currentSafety) )
183  {
184  // The Step is guaranteed to be taken
185  //
186  geometryStepLength = currentMinimumStep ;
188  }
189  else
190  {
191  // Find whether the straight path intersects a volume
192  //
193  linearStepLength = fLinearNavigator->ComputeStep( startPosition,
194  startMomentumDir,
195  currentMinimumStep,
196  newSafety) ;
197  // Remember last safety origin & value.
198  //
199  fPreviousSftOrigin = startPosition ;
200  fPreviousSafety = newSafety ;
201  // fpSafetyHelper->SetCurrentSafety( newSafety, startPosition);
202 
203  // The safety at the initial point has been re-calculated:
204  //
205  currentSafety = newSafety ;
206 
207  fGeometryLimitedStep= (linearStepLength <= currentMinimumStep);
209  {
210  // The geometry limits the Step size (an intersection was found.)
211  geometryStepLength = linearStepLength ;
212  }
213  else
214  {
215  // The full Step is taken.
216  geometryStepLength = currentMinimumStep ;
217  }
218  }
219  endpointDistance = geometryStepLength ;
220 
221  // Calculate final position
222  //
223  fTransportEndPosition = startPosition+geometryStepLength*startMomentumDir ;
224 
225  // Momentum direction, energy and polarisation are unchanged by transport
226  //
227  fTransportEndMomentumDir = startMomentumDir ;
228  fTransportEndKineticEnergy = track.GetKineticEnergy() ;
229  fTransportEndSpin = track.GetPolarization();
233  }
234  else // A field exerts force
235  {
236  G4double momentumMagnitude = pParticle->GetTotalMomentum() ;
237  G4ThreeVector EndUnitMomentum ;
238  G4double lengthAlongCurve ;
239  G4double restMass = fParticleDef->GetPDGMass() ;
240 
241  G4ChargeState chargeState(particleElectricCharge, // The charge can change (dynamic)
242  fParticleDef->GetPDGSpin(),
243  0, // Magnetic moment: pParticleDef->GetMagneticMoment(),
244  0, // Electric Dipole moment - not in Particle Definition
245  particleMagneticCharge ); // in Mev/c
246 
247  G4EquationOfMotion* equationOfMotion =
248  fFieldPropagator->GetChordFinder()->GetIntegrationDriver()->GetEquationOfMotion();
249 
250  equationOfMotion
251  ->SetChargeMomentumMass( chargeState, // Was particleMagneticCharge - in Mev/c
252  momentumMagnitude, // Was particleElectricCharge
253  restMass ) ;
254  // SetChargeMomentumMass now passes both the electric and magnetic charge - in chargeState
255 
256  G4ThreeVector spin = track.GetPolarization() ;
257  G4FieldTrack aFieldTrack = G4FieldTrack( startPosition,
258  track.GetMomentumDirection(),
259  0.0,
260  track.GetKineticEnergy(),
261  restMass,
262  track.GetVelocity(),
263  track.GetGlobalTime(), // Lab.
264  track.GetProperTime(), // Part.
265  &spin ) ;
266  if( currentMinimumStep > 0 )
267  {
268  // Do the Transport in the field (non recti-linear)
269  //
270  lengthAlongCurve = fFieldPropagator->ComputeStep( aFieldTrack,
271  currentMinimumStep,
272  currentSafety,
273  track.GetVolume() ) ;
274  fGeometryLimitedStep= lengthAlongCurve < currentMinimumStep;
275  if( fGeometryLimitedStep ) {
276  geometryStepLength = lengthAlongCurve ;
277  } else {
278  geometryStepLength = currentMinimumStep ;
279  }
280  }
281  else
282  {
283  geometryStepLength = lengthAlongCurve= 0.0 ;
285  }
286 
287  // Remember last safety origin & value.
288  //
289  fPreviousSftOrigin = startPosition ;
290  fPreviousSafety = currentSafety ;
291  // fpSafetyHelper->SetCurrentSafety( newSafety, startPosition);
292 
293  // Get the End-Position and End-Momentum (Dir-ection)
294  //
295  fTransportEndPosition = aFieldTrack.GetPosition() ;
296 
297  // Momentum: Magnitude and direction can be changed too now ...
298  //
300  fTransportEndMomentumDir = aFieldTrack.GetMomentumDir() ;
301 
302  fTransportEndKineticEnergy = aFieldTrack.GetKineticEnergy() ;
303 
304  fCandidateEndGlobalTime = aFieldTrack.GetLabTimeOfFlight();
305  fEndGlobalTimeComputed = true;
306 
307  fTransportEndSpin = aFieldTrack.GetSpin();
308  fParticleIsLooping = fFieldPropagator->IsParticleLooping() ;
309  endpointDistance = (fTransportEndPosition - startPosition).mag() ;
310  }
311 
312  // If we are asked to go a step length of 0, and we are on a boundary
313  // then a boundary will also limit the step -> we must flag this.
314  //
315  if( currentMinimumStep == 0.0 )
316  {
317  if( currentSafety == 0.0 ) fGeometryLimitedStep = true ;
318  }
319 
320  // Update the safety starting from the end-point,
321  // if it will become negative at the end-point.
322  //
323  if( currentSafety < endpointDistance )
324  {
325  if( particleMagneticCharge != 0.0 ) {
326 
327  G4double endSafety =
328  fLinearNavigator->ComputeSafety( fTransportEndPosition) ;
329  currentSafety = endSafety ;
330  fPreviousSftOrigin = fTransportEndPosition ;
331  fPreviousSafety = currentSafety ;
332  fpSafetyHelper->SetCurrentSafety( currentSafety, fTransportEndPosition);
333 
334  // Because the Stepping Manager assumes it is from the start point,
335  // add the StepLength
336  //
337  currentSafety += endpointDistance ;
338 
339 #ifdef G4DEBUG_TRANSPORT
340  G4cout.precision(12) ;
341  G4cout << "***MonopoleTransportation::AlongStepGPIL ** " << G4endl ;
342  G4cout << " Called Navigator->ComputeSafety at " << fTransportEndPosition
343  << " and it returned safety= " << endSafety << G4endl ;
344  G4cout << " Adding endpoint distance " << endpointDistance
345  << " to obtain pseudo-safety= " << currentSafety << G4endl ;
346 #endif
347  }
348  }
349 
350  fParticleChange.ProposeTrueStepLength(geometryStepLength) ;
351 
352  return geometryStepLength ;
353 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
selection
main part
Definition: corrVsCorr.py:99
T sqrt(T t)
Definition: SSEVec.h:18
void ConfigureForTrack(const G4Track *) override
G4ParticleChangeForTransport fParticleChange
G4PropagatorInField * fFieldPropagator
G4double MagneticCharge() const
Definition: Monopole.h:19
Square< F >::type sqr(const F &f)
Definition: Square.h:13
void SetMonopoleTracking(G4bool)
float spin(float ph)
G4VParticleChange * MonopoleTransportation::AtRestDoIt ( const G4Track &  ,
const G4Step &   
)
override

Definition at line 646 of file MonopoleTransportation.cc.

648 {
649  return nullptr;
650 }
G4double MonopoleTransportation::AtRestGetPhysicalInteractionLength ( const G4Track &  ,
G4ForceCondition *   
)
override

Definition at line 637 of file MonopoleTransportation.cc.

640 {
641  return -1.0;
642 }
G4bool MonopoleTransportation::DoesGlobalFieldExist ( )
inlineprotected

Definition at line 188 of file MonopoleTransportation.h.

Referenced by StartTracking().

189 {
190  G4TransportationManager* transportMgr =
191  G4TransportationManager::GetTransportationManager();
192  return transportMgr->GetFieldManager()->DoesFieldExist();
193 }
void MonopoleTransportation::EnableShortStepOptimisation ( G4bool  optimise = true)
inline

Definition at line 241 of file MonopoleTransportation.h.

References fShortStepOptimisation.

242 {
243  fShortStepOptimisation=optimiseShortStep;
244 }
G4double MonopoleTransportation::GetMaxEnergyKilled ( ) const
inline

Definition at line 230 of file MonopoleTransportation.h.

References fMaxEnergyKilled.

231 {
232  return fMaxEnergyKilled;
233 }
G4PropagatorInField * MonopoleTransportation::GetPropagatorInField ( )
inline

Definition at line 183 of file MonopoleTransportation.h.

References fFieldPropagator.

184 {
185  return fFieldPropagator;
186 }
G4PropagatorInField * fFieldPropagator
G4double MonopoleTransportation::GetSumEnergyKilled ( ) const
inline

Definition at line 235 of file MonopoleTransportation.h.

References fSumEnergyKilled.

236 {
237  return fSumEnergyKilled;
238 }
G4double MonopoleTransportation::GetThresholdImportantEnergy ( ) const
inline

Definition at line 200 of file MonopoleTransportation.h.

References fThreshold_Important_Energy.

201 {
203 }
G4int MonopoleTransportation::GetThresholdTrials ( ) const
inline

Definition at line 205 of file MonopoleTransportation.h.

References fThresholdTrials.

206 {
207  return fThresholdTrials;
208 }
G4double MonopoleTransportation::GetThresholdWarningEnergy ( ) const
inline

Definition at line 195 of file MonopoleTransportation.h.

References fThreshold_Warning_Energy.

196 {
198 }
G4VParticleChange * MonopoleTransportation::PostStepDoIt ( const G4Track &  track,
const G4Step &  stepData 
)
override

Definition at line 491 of file MonopoleTransportation.cc.

References fCurrentTouchableHandle, fGeometryLimitedStep, fieldMgrCMS, fLinearNavigator, fParticleChange, nullptr, CMSFieldManager::SetMonopoleTracking(), and funct::true.

493 {
494  G4TouchableHandle retCurrentTouchable ; // The one to return
495 
496  fParticleChange.ProposeTrackStatus(track.GetTrackStatus()) ;
497 
498  // If the Step was determined by the volume boundary,
499  // logically relocate the particle
500 
502  {
503  // fCurrentTouchable will now become the previous touchable,
504  // and what was the previous will be freed.
505  // (Needed because the preStepPoint can point to the previous touchable)
506 
507  fLinearNavigator->SetGeometricallyLimitedStep() ;
509  LocateGlobalPointAndUpdateTouchableHandle( track.GetPosition(),
510  track.GetMomentumDirection(),
512  true ) ;
513  // Check whether the particle is out of the world volume
514  // If so it has exited and must be killed.
515  //
516  if( fCurrentTouchableHandle->GetVolume() == nullptr )
517  {
518  fParticleChange.ProposeTrackStatus( fStopAndKill ) ;
519  }
520  retCurrentTouchable = fCurrentTouchableHandle ;
521  fParticleChange.SetTouchableHandle( fCurrentTouchableHandle ) ;
522  }
523  else // fGeometryLimitedStep is false
524  {
525  // This serves only to move the Navigator's location
526  //
527  fLinearNavigator->LocateGlobalPointWithinVolume( track.GetPosition() ) ;
528 
529  // The value of the track's current Touchable is retained.
530  // (and it must be correct because we must use it below to
531  // overwrite the (unset) one in particle change)
532  // It must be fCurrentTouchable too ??
533  //
534  fParticleChange.SetTouchableHandle( track.GetTouchableHandle() ) ;
535  retCurrentTouchable = track.GetTouchableHandle() ;
536  } // endif ( fGeometryLimitedStep )
537 
538  const G4VPhysicalVolume* pNewVol = retCurrentTouchable->GetVolume() ;
539  const G4Material* pNewMaterial = nullptr ;
540  const G4VSensitiveDetector* pNewSensitiveDetector = nullptr ;
541 
542  if( pNewVol != nullptr )
543  {
544  pNewMaterial= pNewVol->GetLogicalVolume()->GetMaterial();
545  pNewSensitiveDetector= pNewVol->GetLogicalVolume()->GetSensitiveDetector();
546  }
547 
548  fParticleChange.SetMaterialInTouchable(
549  (G4Material *) pNewMaterial ) ;
550  fParticleChange.SetSensitiveDetectorInTouchable(
551  (G4VSensitiveDetector *) pNewSensitiveDetector ) ;
552 
553  const G4MaterialCutsCouple* pNewMaterialCutsCouple = nullptr;
554  if( pNewVol != nullptr )
555  {
556  pNewMaterialCutsCouple=pNewVol->GetLogicalVolume()->GetMaterialCutsCouple();
557  }
558 
559  if( pNewVol!=nullptr && pNewMaterialCutsCouple!=nullptr &&
560  pNewMaterialCutsCouple->GetMaterial()!=pNewMaterial )
561  {
562  // for parametrized volume
563  //
564  pNewMaterialCutsCouple =
565  G4ProductionCutsTable::GetProductionCutsTable()
566  ->GetMaterialCutsCouple(pNewMaterial,
567  pNewMaterialCutsCouple->GetProductionCuts());
568  }
569  fParticleChange.SetMaterialCutsCoupleInTouchable( pNewMaterialCutsCouple );
570 
571  // temporarily until Get/Set Material of ParticleChange,
572  // and StepPoint can be made const.
573  // Set the touchable in ParticleChange
574  // this must always be done because the particle change always
575  // uses this value to overwrite the current touchable pointer.
576  //
577  fParticleChange.SetTouchableHandle(retCurrentTouchable) ;
578 
579  // change to normal equation
581 
582  return &fParticleChange ;
583 }
#define nullptr
G4ParticleChangeForTransport fParticleChange
G4TouchableHandle fCurrentTouchableHandle
void SetMonopoleTracking(G4bool)
G4double MonopoleTransportation::PostStepGetPhysicalInteractionLength ( const G4Track &  ,
G4double  previousStepSize,
G4ForceCondition *  pForceCond 
)
override

Definition at line 481 of file MonopoleTransportation.cc.

Referenced by AlongStepDoIt().

484 {
485  *pForceCond = Forced ;
486  return DBL_MAX ; // was kInfinity ; but convention now is DBL_MAX
487 }
void MonopoleTransportation::ResetKilledStatistics ( G4int  report = 1)

Definition at line 654 of file MonopoleTransportation.cc.

References fMaxEnergyKilled, fSumEnergyKilled, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, and GeV.

656 {
657  if( report ) {
658  G4cout << " MonopoleTransportation: Statistics for looping particles " << G4endl;
659  G4cout << " Sum of energy of loopers killed: " << fSumEnergyKilled << G4endl;
660  G4cout << " Max energy of loopers killed: " << fMaxEnergyKilled << G4endl;
661  }
662 
663  fSumEnergyKilled= 0;
665 }
const double GeV
Definition: MathUtil.h:16
void MonopoleTransportation::SetPropagatorInField ( G4PropagatorInField *  pFieldPropagator)
inline

Definition at line 178 of file MonopoleTransportation.h.

References fFieldPropagator.

179 {
180  fFieldPropagator= pFieldPropagator;
181 }
G4PropagatorInField * fFieldPropagator
void MonopoleTransportation::SetThresholdImportantEnergy ( G4double  newEnImp)
inline

Definition at line 215 of file MonopoleTransportation.h.

References fThreshold_Important_Energy.

216 {
217  fThreshold_Important_Energy = newEnImp;
218 }
void MonopoleTransportation::SetThresholdTrials ( G4int  newMaxTrials)
inline

Definition at line 220 of file MonopoleTransportation.h.

References fThresholdTrials.

221 {
222  fThresholdTrials = newMaxTrials;
223 }
void MonopoleTransportation::SetThresholdWarningEnergy ( G4double  newEnWarn)
inline

Definition at line 210 of file MonopoleTransportation.h.

References fThreshold_Warning_Energy.

211 {
212  fThreshold_Warning_Energy= newEnWarn;
213 }
void MonopoleTransportation::StartTracking ( G4Track *  aTrack)
override

Definition at line 592 of file MonopoleTransportation.cc.

References DoesGlobalFieldExist(), fCurrentTouchableHandle, fFieldPropagator, fieldMgrCMS, fNoLooperTrials, fPreviousSafety, and fPreviousSftOrigin.

593 {
594  // initialise pointer
595  if(!fieldMgrCMS) {
596  G4FieldManager* fieldMgr =
597  fFieldPropagator->FindAndSetFieldManager(aTrack->GetVolume());
598  fieldMgrCMS = static_cast<CMSFieldManager*>(fieldMgr);
599  }
600 
601  G4VProcess::StartTracking(aTrack);
602 
603  // The actions here are those that were taken in AlongStepGPIL
604  // when track.GetCurrentStepNumber()==1
605 
606  // reset safety value and center
607  //
608  fPreviousSafety = 0.0 ;
609  fPreviousSftOrigin = G4ThreeVector(0.,0.,0.) ;
610 
611  // reset looping counter -- for motion in field
612  fNoLooperTrials= 0;
613  // Must clear this state .. else it depends on last track's value
614 
615  // ChordFinder reset internal state
616  //
617  if( DoesGlobalFieldExist() ) {
618  fFieldPropagator->ClearPropagatorState();
619  // Resets all state of field propagator class (ONLY)
620  // including safety values (in case of overlaps and to wipe for first track).
621 
622  G4ChordFinder* chordF= fFieldPropagator->GetChordFinder();
623  if( chordF ) chordF->ResetStepEstimate();
624  }
625 
626  // Make sure to clear the chord finders of all fields (ie managers)
627  G4FieldManagerStore* fieldMgrStore= G4FieldManagerStore::GetInstance();
628  fieldMgrStore->ClearAllChordFindersState();
629 
630  // Update the current touchable handle (from the track's)
631  //
632  fCurrentTouchableHandle = aTrack->GetTouchableHandle();
633 }
G4PropagatorInField * fFieldPropagator
G4TouchableHandle fCurrentTouchableHandle

Member Data Documentation

G4double MonopoleTransportation::endpointDistance
private

Definition at line 152 of file MonopoleTransportation.h.

Referenced by AlongStepGetPhysicalInteractionLength().

G4double MonopoleTransportation::fCandidateEndGlobalTime
private
G4TouchableHandle MonopoleTransportation::fCurrentTouchableHandle
private

Definition at line 140 of file MonopoleTransportation.h.

Referenced by MonopoleTransportation(), PostStepDoIt(), and StartTracking().

G4bool MonopoleTransportation::fEndGlobalTimeComputed
private
G4PropagatorInField* MonopoleTransportation::fFieldPropagator
private
G4bool MonopoleTransportation::fGeometryLimitedStep
private
CMSFieldManager* MonopoleTransportation::fieldMgrCMS
private
G4Navigator* MonopoleTransportation::fLinearNavigator
private
G4double MonopoleTransportation::fMaxEnergyKilled
private
G4bool MonopoleTransportation::fMomentumChanged
private
G4int MonopoleTransportation::fNoLooperTrials
private

Definition at line 164 of file MonopoleTransportation.h.

Referenced by AlongStepDoIt(), and StartTracking().

G4ParticleChangeForTransport MonopoleTransportation::fParticleChange
private
const Monopole* MonopoleTransportation::fParticleDef
private

Definition at line 120 of file MonopoleTransportation.h.

Referenced by AlongStepGetPhysicalInteractionLength().

G4bool MonopoleTransportation::fParticleIsLooping
private
G4double MonopoleTransportation::fPreviousSafety
private
G4ThreeVector MonopoleTransportation::fPreviousSftOrigin
private
G4SafetyHelper* MonopoleTransportation::fpSafetyHelper
private
G4bool MonopoleTransportation::fShortStepOptimisation
private
G4double MonopoleTransportation::fSumEnergyKilled
private
G4double MonopoleTransportation::fThreshold_Important_Energy
private
G4double MonopoleTransportation::fThreshold_Warning_Energy
private
G4int MonopoleTransportation::fThresholdTrials
private

Definition at line 158 of file MonopoleTransportation.h.

Referenced by AlongStepDoIt(), GetThresholdTrials(), and SetThresholdTrials().

G4double MonopoleTransportation::fTransportEndKineticEnergy
private
G4ThreeVector MonopoleTransportation::fTransportEndMomentumDir
private
G4ThreeVector MonopoleTransportation::fTransportEndPosition
private
G4ThreeVector MonopoleTransportation::fTransportEndSpin
private