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::MonopoleTransportation ( const Monopole p,
G4int  verbosityLevel = 1 
)

Definition at line 33 of file MonopoleTransportation.cc.

References fCandidateEndGlobalTime, fCurrentTouchableHandle, fEndGlobalTimeComputed, fFieldPropagator, fLinearNavigator, fpSafetyHelper, and HLT_2024v10_cff::verboseLevel.

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),
42  fThreshold_Warning_Energy(100 * MeV),
43  fThreshold_Important_Energy(250 * MeV),
44  fThresholdTrials(10),
45  fNoLooperTrials(0),
46  fSumEnergyKilled(0.0),
47  fMaxEnergyKilled(0.0),
48  fShortStepOptimisation(false), // Old default: true (=fast short steps)
49  fpSafetyHelper(nullptr) {
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  return;
59  }
60 #endif
61 
62  G4TransportationManager* transportMgr = G4TransportationManager::GetTransportationManager();
63 
64  fLinearNavigator = transportMgr->GetNavigatorForTracking();
65 
66  fFieldPropagator = transportMgr->GetPropagatorInField();
67  fpSafetyHelper = transportMgr->GetSafetyHelper();
68 
69  // Cannot determine whether a field exists here,
70  // because it would only work if the field manager has informed
71  // about the detector's field before this transportation process
72  // is constructed.
73  // Instead later the method DoesGlobalFieldExist() is called
74 
75  fCurrentTouchableHandle = nullptr;
76 
77  fEndGlobalTimeComputed = false;
79 }
G4PropagatorInField * fFieldPropagator
G4TouchableHandle fCurrentTouchableHandle

◆ ~MonopoleTransportation()

MonopoleTransportation::~MonopoleTransportation ( )
override

Definition at line 83 of file MonopoleTransportation.cc.

References fSumEnergyKilled, and HLT_2024v10_cff::verboseLevel.

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

Member Function Documentation

◆ AlongStepDoIt()

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

Definition at line 332 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, beamSpotPI::startTime, HLT_2024v10_cff::track, and HLT_2024v10_cff::verboseLevel.

332  {
333  fParticleChange.Initialize(track);
334 
335  // Code for specific process
336  //
337  fParticleChange.ProposePosition(fTransportEndPosition);
338  fParticleChange.ProposeMomentumDirection(fTransportEndMomentumDir);
340  fParticleChange.SetMomentumChanged(fMomentumChanged);
341 
342  fParticleChange.ProposePolarization(fTransportEndSpin);
343 
344  G4double deltaTime = 0.0;
345 
346  // Calculate Lab Time of Flight (ONLY if field Equations used it!)
347  G4double startTime = track.GetGlobalTime();
348 
349  if (!fEndGlobalTimeComputed) {
350  // The time was not integrated .. make the best estimate possible
351  //
352  G4double finalVelocity = track.GetVelocity();
353  G4double initialVelocity = stepData.GetPreStepPoint()->GetVelocity();
354  G4double stepLength = track.GetStepLength();
355 
356  deltaTime = 0.0; // in case initialVelocity = 0
357  if (finalVelocity > 0.0) {
358  G4double meanInverseVelocity;
359  meanInverseVelocity = 0.5 * (1.0 / initialVelocity + 1.0 / finalVelocity);
360  deltaTime = stepLength * meanInverseVelocity;
361  } else if (initialVelocity > 0.0) {
362  deltaTime = stepLength / initialVelocity;
363  }
364  fCandidateEndGlobalTime = startTime + deltaTime;
365  } else {
366  deltaTime = fCandidateEndGlobalTime - startTime;
367  }
368 
369  fParticleChange.ProposeGlobalTime(fCandidateEndGlobalTime);
370 
371  // Now Correct by Lorentz factor to get "proper" deltaTime
372 
373  G4double restMass = track.GetDynamicParticle()->GetMass();
374  G4double deltaProperTime = deltaTime * (restMass / track.GetTotalEnergy());
375 
376  fParticleChange.ProposeProperTime(track.GetProperTime() + deltaProperTime);
377  //fParticleChange. ProposeTrueStepLength( track.GetStepLength() ) ;
378 
379  // If the particle is caught looping or is stuck (in very difficult
380  // boundaries) in a magnetic field (doing many steps)
381  // THEN this kills it ...
382  //
383  if (fParticleIsLooping) {
384  G4double endEnergy = fTransportEndKineticEnergy;
385 
387  // Kill the looping particle
388  //
389  fParticleChange.ProposeTrackStatus(fStopAndKill);
390 
391  // 'Bare' statistics
392  fSumEnergyKilled += endEnergy;
393  if (endEnergy > fMaxEnergyKilled) {
394  fMaxEnergyKilled = endEnergy;
395  }
396 
397 #ifdef G4VERBOSE
398  if ((verboseLevel > 1) || (endEnergy > fThreshold_Warning_Energy)) {
399  G4cout << " MonopoleTransportation is killing track that is looping or stuck " << G4endl << " This track has "
400  << track.GetKineticEnergy() / MeV << " MeV energy." << G4endl;
401  G4cout << " Number of trials = " << fNoLooperTrials << G4endl;
402  }
403 #endif
404  fNoLooperTrials = 0;
405  } else {
406  fNoLooperTrials++;
407 #ifdef G4VERBOSE
408  if ((verboseLevel > 2)) {
409  G4cout << " MonopoleTransportation::AlongStepDoIt(): Particle looping - "
410  << " Number of trials = " << fNoLooperTrials << G4endl;
411  }
412 #endif
413  }
414  } else {
415  fNoLooperTrials = 0;
416  }
417 
418  // Another (sometimes better way) is to use a user-limit maximum Step size
419  // to alleviate this problem ..
420 
421  // Introduce smooth curved trajectories to particle-change
422  //
423  fParticleChange.SetPointerToVectorOfAuxiliaryPoints(fFieldPropagator->GimmeTrajectoryVectorAndForgetIt());
424 
425  return &fParticleChange;
426 }
G4ParticleChangeForTransport fParticleChange
G4PropagatorInField * fFieldPropagator

◆ AlongStepGetPhysicalInteractionLength()

G4double MonopoleTransportation::AlongStepGetPhysicalInteractionLength ( const G4Track &  track,
G4double  previousStepSize,
G4double  currentMinimumStep,
G4double &  currentSafety,
G4GPILSelection *  selection 
)
override

Definition at line 101 of file MonopoleTransportation.cc.

References CMSFieldManager::ConfigureForTrack(), endpointDistance, 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(), corrVsCorr::selection, CMSFieldManager::setMonopoleTracking(), funct::sqr(), mathSSE::sqrt(), and HLT_2024v10_cff::track.

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

◆ AtRestDoIt()

G4VParticleChange * MonopoleTransportation::AtRestDoIt ( const G4Track &  ,
const G4Step &   
)
override

Definition at line 576 of file MonopoleTransportation.cc.

576 { return nullptr; }

◆ AtRestGetPhysicalInteractionLength()

G4double MonopoleTransportation::AtRestGetPhysicalInteractionLength ( const G4Track &  ,
G4ForceCondition *   
)
override

Definition at line 572 of file MonopoleTransportation.cc.

572 { return -1.0; }

◆ DoesGlobalFieldExist()

G4bool MonopoleTransportation::DoesGlobalFieldExist ( )
inlineprotected

Definition at line 167 of file MonopoleTransportation.h.

Referenced by StartTracking().

167  {
168  G4TransportationManager* transportMgr = G4TransportationManager::GetTransportationManager();
169  return transportMgr->GetFieldManager()->DoesFieldExist();
170 }

◆ EnableShortStepOptimisation()

void MonopoleTransportation::EnableShortStepOptimisation ( G4bool  optimise = true)
inline

Definition at line 197 of file MonopoleTransportation.h.

References fShortStepOptimisation.

197  {
198  fShortStepOptimisation = optimiseShortStep;
199 }

◆ GetMaxEnergyKilled()

G4double MonopoleTransportation::GetMaxEnergyKilled ( ) const
inline

Definition at line 193 of file MonopoleTransportation.h.

References fMaxEnergyKilled.

193 { return fMaxEnergyKilled; }

◆ GetPropagatorInField()

G4PropagatorInField * MonopoleTransportation::GetPropagatorInField ( )
inline

Definition at line 165 of file MonopoleTransportation.h.

References fFieldPropagator.

165 { return fFieldPropagator; }
G4PropagatorInField * fFieldPropagator

◆ GetSumEnergyKilled()

G4double MonopoleTransportation::GetSumEnergyKilled ( ) const
inline

Definition at line 195 of file MonopoleTransportation.h.

References fSumEnergyKilled.

195 { return fSumEnergyKilled; }

◆ GetThresholdImportantEnergy()

G4double MonopoleTransportation::GetThresholdImportantEnergy ( ) const
inline

Definition at line 174 of file MonopoleTransportation.h.

References fThreshold_Important_Energy.

◆ GetThresholdTrials()

G4int MonopoleTransportation::GetThresholdTrials ( ) const
inline

Definition at line 176 of file MonopoleTransportation.h.

References fThresholdTrials.

◆ GetThresholdWarningEnergy()

G4double MonopoleTransportation::GetThresholdWarningEnergy ( ) const
inline

Definition at line 172 of file MonopoleTransportation.h.

References fThreshold_Warning_Energy.

◆ PostStepDoIt()

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

Definition at line 443 of file MonopoleTransportation.cc.

References fCurrentTouchableHandle, fGeometryLimitedStep, fieldMgrCMS, fLinearNavigator, fParticleChange, CMSFieldManager::setMonopoleTracking(), and HLT_2024v10_cff::track.

443  {
444  G4TouchableHandle retCurrentTouchable; // The one to return
445 
446  fParticleChange.ProposeTrackStatus(track.GetTrackStatus());
447 
448  // If the Step was determined by the volume boundary,
449  // logically relocate the particle
450 
451  if (fGeometryLimitedStep) {
452  // fCurrentTouchable will now become the previous touchable,
453  // and what was the previous will be freed.
454  // (Needed because the preStepPoint can point to the previous touchable)
455 
456  fLinearNavigator->SetGeometricallyLimitedStep();
457  fLinearNavigator->LocateGlobalPointAndUpdateTouchableHandle(
458  track.GetPosition(), track.GetMomentumDirection(), fCurrentTouchableHandle, true);
459  // Check whether the particle is out of the world volume
460  // If so it has exited and must be killed.
461  //
462  if (fCurrentTouchableHandle->GetVolume() == nullptr) {
463  fParticleChange.ProposeTrackStatus(fStopAndKill);
464  }
465  retCurrentTouchable = fCurrentTouchableHandle;
466  fParticleChange.SetTouchableHandle(fCurrentTouchableHandle);
467  } else // fGeometryLimitedStep is false
468  {
469  // This serves only to move the Navigator's location
470  //
471  fLinearNavigator->LocateGlobalPointWithinVolume(track.GetPosition());
472 
473  // The value of the track's current Touchable is retained.
474  // (and it must be correct because we must use it below to
475  // overwrite the (unset) one in particle change)
476  // It must be fCurrentTouchable too ??
477  //
478  fParticleChange.SetTouchableHandle(track.GetTouchableHandle());
479  retCurrentTouchable = track.GetTouchableHandle();
480  } // endif ( fGeometryLimitedStep )
481 
482  const G4VPhysicalVolume* pNewVol = retCurrentTouchable->GetVolume();
483  const G4Material* pNewMaterial = nullptr;
484  G4VSensitiveDetector* pNewSensitiveDetector = nullptr;
485 
486  if (pNewVol != nullptr) {
487  pNewMaterial = pNewVol->GetLogicalVolume()->GetMaterial();
488  pNewSensitiveDetector = pNewVol->GetLogicalVolume()->GetSensitiveDetector();
489  }
490 
491  fParticleChange.SetMaterialInTouchable((G4Material*)pNewMaterial);
492  fParticleChange.SetSensitiveDetectorInTouchable((G4VSensitiveDetector*)pNewSensitiveDetector);
493 
494  const G4MaterialCutsCouple* pNewMaterialCutsCouple = nullptr;
495  if (pNewVol != nullptr) {
496  pNewMaterialCutsCouple = pNewVol->GetLogicalVolume()->GetMaterialCutsCouple();
497  }
498 
499  if (pNewVol != nullptr && pNewMaterialCutsCouple != nullptr &&
500  pNewMaterialCutsCouple->GetMaterial() != pNewMaterial) {
501  // for parametrized volume
502  //
503  pNewMaterialCutsCouple = G4ProductionCutsTable::GetProductionCutsTable()->GetMaterialCutsCouple(
504  pNewMaterial, pNewMaterialCutsCouple->GetProductionCuts());
505  }
506  fParticleChange.SetMaterialCutsCoupleInTouchable(pNewMaterialCutsCouple);
507 
508  // temporarily until Get/Set Material of ParticleChange,
509  // and StepPoint can be made const.
510  // Set the touchable in ParticleChange
511  // this must always be done because the particle change always
512  // uses this value to overwrite the current touchable pointer.
513  //
514  fParticleChange.SetTouchableHandle(retCurrentTouchable);
515 
516  // change to normal equation
518 
519  return &fParticleChange;
520 }
G4ParticleChangeForTransport fParticleChange
G4TouchableHandle fCurrentTouchableHandle
void setMonopoleTracking(G4bool)

◆ PostStepGetPhysicalInteractionLength()

G4double MonopoleTransportation::PostStepGetPhysicalInteractionLength ( const G4Track &  ,
G4double  previousStepSize,
G4ForceCondition *  pForceCond 
)
override

Definition at line 434 of file MonopoleTransportation.cc.

436  {
437  *pForceCond = Forced;
438  return DBL_MAX; // was kInfinity ; but convention now is DBL_MAX
439 }

◆ ResetKilledStatistics()

void MonopoleTransportation::ResetKilledStatistics ( G4int  report = 1)

Definition at line 580 of file MonopoleTransportation.cc.

References fMaxEnergyKilled, fSumEnergyKilled, ecalTB2006H4_GenSimDigiReco_cfg::G4cout, and edmIntegrityCheck::report.

582 {
583  if (report) {
584  G4cout << " MonopoleTransportation: Statistics for looping particles " << G4endl;
585  G4cout << " Sum of energy of loopers killed: " << fSumEnergyKilled << G4endl;
586  G4cout << " Max energy of loopers killed: " << fMaxEnergyKilled << G4endl;
587  }
588 
589  fSumEnergyKilled = 0;
590  fMaxEnergyKilled = -1.0 * CLHEP::GeV;
591 }

◆ SetPropagatorInField()

void MonopoleTransportation::SetPropagatorInField ( G4PropagatorInField *  pFieldPropagator)
inline

Definition at line 161 of file MonopoleTransportation.h.

References fFieldPropagator.

161  {
162  fFieldPropagator = pFieldPropagator;
163 }
G4PropagatorInField * fFieldPropagator

◆ SetThresholdImportantEnergy()

void MonopoleTransportation::SetThresholdImportantEnergy ( G4double  newEnImp)
inline

Definition at line 182 of file MonopoleTransportation.h.

References fThreshold_Important_Energy.

182  {
183  fThreshold_Important_Energy = newEnImp;
184 }

◆ SetThresholdTrials()

void MonopoleTransportation::SetThresholdTrials ( G4int  newMaxTrials)
inline

Definition at line 186 of file MonopoleTransportation.h.

References fThresholdTrials.

186 { fThresholdTrials = newMaxTrials; }

◆ SetThresholdWarningEnergy()

void MonopoleTransportation::SetThresholdWarningEnergy ( G4double  newEnWarn)
inline

Definition at line 178 of file MonopoleTransportation.h.

References fThreshold_Warning_Energy.

178  {
179  fThreshold_Warning_Energy = newEnWarn;
180 }

◆ StartTracking()

void MonopoleTransportation::StartTracking ( G4Track *  aTrack)
override

Definition at line 528 of file MonopoleTransportation.cc.

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

528  {
529  // initialise pointer
530  if (!fieldMgrCMS) {
531  G4FieldManager* fieldMgr = fFieldPropagator->FindAndSetFieldManager(aTrack->GetVolume());
532  fieldMgrCMS = static_cast<CMSFieldManager*>(fieldMgr);
533  }
534 
535  G4VProcess::StartTracking(aTrack);
536 
537  // The actions here are those that were taken in AlongStepGPIL
538  // when track.GetCurrentStepNumber()==1
539 
540  // reset safety value and center
541  //
542  fPreviousSafety = 0.0;
543  fPreviousSftOrigin = G4ThreeVector(0., 0., 0.);
544 
545  // reset looping counter -- for motion in field
546  fNoLooperTrials = 0;
547  // Must clear this state .. else it depends on last track's value
548 
549  // ChordFinder reset internal state
550  //
551  if (DoesGlobalFieldExist()) {
552  fFieldPropagator->ClearPropagatorState();
553  // Resets all state of field propagator class (ONLY)
554  // including safety values (in case of overlaps and to wipe for first track).
555 
556  G4ChordFinder* chordF = fFieldPropagator->GetChordFinder();
557  if (chordF)
558  chordF->ResetStepEstimate();
559  }
560 
561  // Make sure to clear the chord finders of all fields (ie managers)
562  G4FieldManagerStore* fieldMgrStore = G4FieldManagerStore::GetInstance();
563  fieldMgrStore->ClearAllChordFindersState();
564 
565  // Update the current touchable handle (from the track's)
566  //
567  fCurrentTouchableHandle = aTrack->GetTouchableHandle();
568 }
G4PropagatorInField * fFieldPropagator
G4TouchableHandle fCurrentTouchableHandle

Member Data Documentation

◆ endpointDistance

G4double MonopoleTransportation::endpointDistance
private

Definition at line 137 of file MonopoleTransportation.h.

Referenced by AlongStepGetPhysicalInteractionLength().

◆ fCandidateEndGlobalTime

G4double MonopoleTransportation::fCandidateEndGlobalTime
private

◆ fCurrentTouchableHandle

G4TouchableHandle MonopoleTransportation::fCurrentTouchableHandle
private

Definition at line 125 of file MonopoleTransportation.h.

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

◆ fEndGlobalTimeComputed

G4bool MonopoleTransportation::fEndGlobalTimeComputed
private

◆ fFieldPropagator

G4PropagatorInField* MonopoleTransportation::fFieldPropagator
private

◆ fGeometryLimitedStep

G4bool MonopoleTransportation::fGeometryLimitedStep
private

◆ fieldMgrCMS

CMSFieldManager* MonopoleTransportation::fieldMgrCMS
private

◆ fLinearNavigator

G4Navigator* MonopoleTransportation::fLinearNavigator
private

◆ fMaxEnergyKilled

G4double MonopoleTransportation::fMaxEnergyKilled
private

◆ fMomentumChanged

G4bool MonopoleTransportation::fMomentumChanged
private

◆ fNoLooperTrials

G4int MonopoleTransportation::fNoLooperTrials
private

Definition at line 149 of file MonopoleTransportation.h.

Referenced by AlongStepDoIt(), and StartTracking().

◆ fParticleChange

G4ParticleChangeForTransport MonopoleTransportation::fParticleChange
private

◆ fParticleDef

const Monopole* MonopoleTransportation::fParticleDef
private

Definition at line 105 of file MonopoleTransportation.h.

Referenced by AlongStepGetPhysicalInteractionLength().

◆ fParticleIsLooping

G4bool MonopoleTransportation::fParticleIsLooping
private

◆ fPreviousSafety

G4double MonopoleTransportation::fPreviousSafety
private

◆ fPreviousSftOrigin

G4ThreeVector MonopoleTransportation::fPreviousSftOrigin
private

◆ fpSafetyHelper

G4SafetyHelper* MonopoleTransportation::fpSafetyHelper
private

◆ fShortStepOptimisation

G4bool MonopoleTransportation::fShortStepOptimisation
private

◆ fSumEnergyKilled

G4double MonopoleTransportation::fSumEnergyKilled
private

◆ fThreshold_Important_Energy

G4double MonopoleTransportation::fThreshold_Important_Energy
private

◆ fThreshold_Warning_Energy

G4double MonopoleTransportation::fThreshold_Warning_Energy
private

◆ fThresholdTrials

G4int MonopoleTransportation::fThresholdTrials
private

Definition at line 143 of file MonopoleTransportation.h.

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

◆ fTransportEndKineticEnergy

G4double MonopoleTransportation::fTransportEndKineticEnergy
private

◆ fTransportEndMomentumDir

G4ThreeVector MonopoleTransportation::fTransportEndMomentumDir
private

◆ fTransportEndPosition

G4ThreeVector MonopoleTransportation::fTransportEndPosition
private

◆ fTransportEndSpin

G4ThreeVector MonopoleTransportation::fTransportEndSpin
private