Belle II Software  release-05-01-25
G4MonopoleTransportation.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Dmitrii Neverov *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 // modified from GEANT4 exoticphysics/monopole/*
12 
13 #pragma once
14 
15 // inline include at the end of the file
16 
17 #include <G4VProcess.hh>
18 #include <G4FieldManager.hh>
19 #include <G4Navigator.hh>
20 #include <G4TransportationManager.hh>
21 #include <G4PropagatorInField.hh>
22 #include <G4Track.hh>
23 #include <G4Step.hh>
24 #include <G4ParticleChangeForTransport.hh>
25 
26 #include <simulation/monopoles/G4MonopoleFieldSetup.h>
27 
28 class G4SafetyHelper;
29 
30 namespace Belle2 {
36  namespace Monopoles {
37 
38  class G4Monopole;
39 
46  class G4MonopoleTransportation : public G4VProcess {
47 
48  public:
49 
55  explicit G4MonopoleTransportation(const G4Monopole* mpl, G4int verb = 1);
60 
77  const G4Track& track,
78  G4double previousStepSize,
79  G4double currentMinimumStep,
80  G4double& currentSafety,
81  G4GPILSelection* selection
82  );
83 
92  virtual G4VParticleChange* AlongStepDoIt(
93  const G4Track& track,
94  const G4Step& stepData
95  );
96 
106  virtual G4VParticleChange* PostStepDoIt(
107  const G4Track& track,
108  const G4Step& stepData
109  );
110 
122  virtual G4double PostStepGetPhysicalInteractionLength(
123  const G4Track& track,
124  G4double previousStepSize,
125  G4ForceCondition* pForceCond
126  );
127 
128  inline G4PropagatorInField* GetPropagatorInField();
129  inline void SetPropagatorInField(G4PropagatorInField*
130  pFieldPropagator);
132  inline G4double GetThresholdWarningEnergy() const;
133  inline G4double GetThresholdImportantEnergy() const;
134  inline G4int GetThresholdTrials() const;
136  inline void SetThresholdWarningEnergy(G4double newEnWarn);
137  inline void SetThresholdImportantEnergy(G4double newEnImp);
138  inline void SetThresholdTrials(G4int newMaxTrials);
140  // Get/Set parameters for killing loopers:
141  // Above 'important' energy a 'looping' particle in field will
142  // *NOT* be abandoned, except after fThresholdTrials attempts.
143  // Below Warning energy, no verbosity for looping particles is issued
144 
145  inline G4double GetMaxEnergyKilled() const;
146  inline G4double GetSumEnergyKilled() const;
147  inline void ResetKilledStatistics(G4int report = 1);
149  inline void EnableShortStepOptimisation(G4bool optimise =
150  true);
152  public:
153 
158  const G4Track&,
159  G4ForceCondition*
160  ) { return -1.0; };
161 
165  virtual G4VParticleChange* AtRestDoIt(
166  const G4Track&,
167  const G4Step&
168  ) {return 0;};
169 
170  virtual void StartTracking(G4Track* aTrack);
172  protected:
173 
174  G4bool DoesGlobalFieldExist();
176  private:
177 
182  G4Navigator* fLinearNavigator;
183  G4PropagatorInField* fFieldPropagator;
185  G4ThreeVector fTransportEndPosition;
186  G4ThreeVector fTransportEndMomentumDir;
188  G4ThreeVector fTransportEndSpin;
190  // G4bool fEnergyChanged; /**< The particle's state after this Step, Store for DoIt*/
196  G4TouchableHandle fCurrentTouchableHandle;
200  G4ThreeVector fPreviousSftOrigin;
201  G4double fPreviousSafety;
203  G4ParticleChangeForTransport fParticleChange;
205  G4double endpointDistance;
207  G4double fThreshold_Trap_Energy; //FIXME should be dependent on e.g. density
208 
209  // Thresholds for looping particles:
213  // Above 'important' energy a 'looping' particle in field will
214  // *NOT* be abandoned, except after fThresholdTrials attempts.
215  // G4double fUnimportant_Energy;
216  // Below this energy, no verbosity for looping particles is issued
217 
219  G4double fSumEnergyKilled;
220  G4double fMaxEnergyKilled;
227 
228  G4SafetyHelper* fpSafetyHelper;
230  };
231 
232  } //end Monopoles namespace
233 
235 } //end Belle2 namespace
236 
237 #include <simulation/monopoles/G4MonopoleTransportationInline.h>
Belle2::Monopoles::G4MonopoleTransportation::GetThresholdImportantEnergy
G4double GetThresholdImportantEnergy() const
Access fThreshold_Important_Energy.
Definition: G4MonopoleTransportationInline.h:60
Belle2::Monopoles::G4MonopoleTransportation::fMomentumChanged
G4bool fMomentumChanged
The particle's state after this Step, Store for DoIt.
Definition: G4MonopoleTransportation.h:189
Belle2::Monopoles::G4MonopoleTransportation::fShortStepOptimisation
G4bool fShortStepOptimisation
Whether to avoid calling G4Navigator for short step ( < safety) If using it, the safety estimate for ...
Definition: G4MonopoleTransportation.h:226
Belle2::Monopoles::G4MonopoleTransportation::fThreshold_Trap_Energy
G4double fThreshold_Trap_Energy
Assume monopoles below this can bound to material.
Definition: G4MonopoleTransportation.h:207
Belle2::Monopoles::G4MonopoleTransportation::fFieldPropagator
G4PropagatorInField * fFieldPropagator
Propagator used to transport the particle.
Definition: G4MonopoleTransportation.h:183
Belle2::Monopoles::G4MonopoleTransportation::SetThresholdWarningEnergy
void SetThresholdWarningEnergy(G4double newEnWarn)
Set fThreshold_Warning_Energy.
Definition: G4MonopoleTransportationInline.h:70
Belle2::Monopoles::G4MonopoleTransportation::EnableShortStepOptimisation
void EnableShortStepOptimisation(G4bool optimise=true)
Whether short steps < safety will avoid to call Navigator (if field=0)
Definition: G4MonopoleTransportationInline.h:113
Belle2::Monopoles::G4MonopoleTransportation::fThresholdTrials
G4int fThresholdTrials
Nubmer of trials for looping particles.
Definition: G4MonopoleTransportation.h:212
Belle2::Monopoles::G4MonopoleTransportation::fNoLooperTrials
G4int fNoLooperTrials
Counter for steps in which particle reports 'looping', if it is above 'Important' Energy.
Definition: G4MonopoleTransportation.h:218
Belle2::Monopoles::G4MonopoleTransportation::PostStepDoIt
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData)
G4VProcess::PostStepDoIt() implementation.
Definition: G4MonopoleTransportation.cc:484
Belle2::Monopoles::G4MonopoleTransportation::GetThresholdWarningEnergy
G4double GetThresholdWarningEnergy() const
Access fThreshold_Warning_Energy.
Definition: G4MonopoleTransportationInline.h:55
Belle2::Monopoles::G4MonopoleTransportation::fCurrentTouchableHandle
G4TouchableHandle fCurrentTouchableHandle
Current touchable handle.
Definition: G4MonopoleTransportation.h:196
Belle2::Monopoles::G4MonopoleTransportation::AlongStepDoIt
virtual G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData)
G4VProcess::AlongStepDoIt() implementation, Proposes changes during step to fParticleChange of this c...
Definition: G4MonopoleTransportation.cc:347
Belle2::Monopoles::G4MonopoleTransportation::fTransportEndSpin
G4ThreeVector fTransportEndSpin
The particle's state after this Step, Store for DoIt.
Definition: G4MonopoleTransportation.h:188
Belle2::Monopoles::G4MonopoleTransportation::fCandidateEndGlobalTime
G4double fCandidateEndGlobalTime
The particle's state after this Step, Store for DoIt.
Definition: G4MonopoleTransportation.h:192
Belle2::Monopoles::G4MonopoleTransportation::~G4MonopoleTransportation
~G4MonopoleTransportation()
Destructor.
Definition: G4MonopoleTransportation.cc:83
Belle2::Monopoles::G4MonopoleTransportation::fPreviousSafety
G4double fPreviousSafety
Remember last safety value.
Definition: G4MonopoleTransportation.h:201
Belle2::Monopoles::G4MonopoleTransportation::fGeometryLimitedStep
G4bool fGeometryLimitedStep
Flag to determine whether a boundary was reached.
Definition: G4MonopoleTransportation.h:198
Belle2::Monopoles::G4MonopoleTransportation::ResetKilledStatistics
void ResetKilledStatistics(G4int report=1)
Statistics for tracks killed (currently due to looping in field)
Definition: G4MonopoleTransportationInline.h:100
Belle2::Monopoles::G4MonopoleTransportation::fTransportEndMomentumDir
G4ThreeVector fTransportEndMomentumDir
The particle's state after this Step, Store for DoIt.
Definition: G4MonopoleTransportation.h:186
Belle2::Monopoles::G4MonopoleTransportation::SetPropagatorInField
void SetPropagatorInField(G4PropagatorInField *pFieldPropagator)
Set fFieldPropagator, the assistant class that Propagate in a Field.
Definition: G4MonopoleTransportationInline.h:35
Belle2::Monopoles::G4MonopoleTransportation::AtRestGetPhysicalInteractionLength
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *)
No operation in AtRestDoIt.
Definition: G4MonopoleTransportation.h:157
Belle2::Monopoles::G4MonopoleTransportation::fEndGlobalTimeComputed
G4bool fEndGlobalTimeComputed
The particle's state after this Step, Store for DoIt.
Definition: G4MonopoleTransportation.h:191
Belle2::Monopoles::G4MonopoleTransportation::GetMaxEnergyKilled
G4double GetMaxEnergyKilled() const
Access fMaxEnergyKilled.
Definition: G4MonopoleTransportationInline.h:90
Belle2::Monopoles::G4MonopoleTransportation::fPreviousSftOrigin
G4ThreeVector fPreviousSftOrigin
Remember last safety origin.
Definition: G4MonopoleTransportation.h:200
Belle2::Monopoles::G4MonopoleTransportation::GetPropagatorInField
G4PropagatorInField * GetPropagatorInField()
Access fFieldPropagator, the assistant class that Propagate in a Field.
Definition: G4MonopoleTransportationInline.h:40
Belle2::Monopoles::G4MonopoleTransportation::fTransportEndKineticEnergy
G4double fTransportEndKineticEnergy
The particle's state after this Step, Store for DoIt.
Definition: G4MonopoleTransportation.h:187
Belle2::Monopoles::G4MonopoleTransportation::AlongStepGetPhysicalInteractionLength
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &currentSafety, G4GPILSelection *selection)
G4VProcess::AlongStepGetPhysicalInteractionLength() implementation.
Definition: G4MonopoleTransportation.cc:98
Belle2::Monopoles::G4MonopoleTransportation::StartTracking
virtual void StartTracking(G4Track *aTrack)
Reset state for new (potentially resumed) track.
Definition: G4MonopoleTransportation.cc:577
Belle2::Monopoles::G4MonopoleFieldSetup
Monopole field setup singleton class, that takes care of switching between conventional particle tran...
Definition: G4MonopoleFieldSetup.h:35
Belle2::Monopoles::G4MonopoleTransportation::fMagSetup
G4MonopoleFieldSetup * fMagSetup
Monpole field setup.
Definition: G4MonopoleTransportation.h:180
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Monopoles::G4MonopoleTransportation::PostStepGetPhysicalInteractionLength
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4ForceCondition *pForceCond)
G4VProcess::PostStepGetPhysicalInteractionLength() implementation.
Definition: G4MonopoleTransportation.cc:476
Belle2::Monopoles::G4MonopoleTransportation::endpointDistance
G4double endpointDistance
Endpint distance.
Definition: G4MonopoleTransportation.h:205
Belle2::Monopoles::G4MonopoleTransportation::fParticleDef
const G4Monopole * fParticleDef
Monopole definition for charge and mass reference.
Definition: G4MonopoleTransportation.h:178
Belle2::Monopoles::G4MonopoleTransportation::fParticleChange
G4ParticleChangeForTransport fParticleChange
New ParticleChange.
Definition: G4MonopoleTransportation.h:203
Belle2::Monopoles::G4MonopoleTransportation::fTransportEndPosition
G4ThreeVector fTransportEndPosition
The particle's state after this Step, Store for DoIt.
Definition: G4MonopoleTransportation.h:185
Belle2::Monopoles::G4MonopoleTransportation::fSumEnergyKilled
G4double fSumEnergyKilled
Sum of abandoned looping tracks energies.
Definition: G4MonopoleTransportation.h:219
Belle2::Monopoles::G4MonopoleTransportation
Concrete class that does the geometrical transport.
Definition: G4MonopoleTransportation.h:46
Belle2::Monopoles::G4MonopoleTransportation::SetThresholdTrials
void SetThresholdTrials(G4int newMaxTrials)
Set fThresholdTrials.
Definition: G4MonopoleTransportationInline.h:80
Belle2::Monopoles::G4MonopoleTransportation::fThreshold_Warning_Energy
G4double fThreshold_Warning_Energy
Warn above this energy about looping particle.
Definition: G4MonopoleTransportation.h:210
Belle2::Monopoles::G4MonopoleTransportation::fLinearNavigator
G4Navigator * fLinearNavigator
Propagator used to transport the particle.
Definition: G4MonopoleTransportation.h:182
Belle2::Monopoles::G4MonopoleTransportation::fThreshold_Important_Energy
G4double fThreshold_Important_Energy
Hesitate above this about looping particle for a certain no of trials.
Definition: G4MonopoleTransportation.h:211
Belle2::Monopoles::G4MonopoleTransportation::DoesGlobalFieldExist
G4bool DoesGlobalFieldExist()
Checks whether a field exists for the "global" field manager.
Definition: G4MonopoleTransportationInline.h:45
Belle2::Monopoles::G4MonopoleTransportation::fpSafetyHelper
G4SafetyHelper * fpSafetyHelper
To pass it the safety value obtained.
Definition: G4MonopoleTransportation.h:228
Belle2::Monopoles::G4MonopoleTransportation::fParticleIsLooping
G4bool fParticleIsLooping
Is the monopole stuck in looping.
Definition: G4MonopoleTransportation.h:194
Belle2::Monopoles::G4MonopoleTransportation::AtRestDoIt
virtual G4VParticleChange * AtRestDoIt(const G4Track &, const G4Step &)
No operation in AtRestDoIt.
Definition: G4MonopoleTransportation.h:165
Belle2::Monopoles::G4Monopole
A class to hold monopole description as a particle.
Definition: G4Monopole.h:43
Belle2::Monopoles::G4MonopoleTransportation::SetThresholdImportantEnergy
void SetThresholdImportantEnergy(G4double newEnImp)
Set fThreshold_Important_Energy.
Definition: G4MonopoleTransportationInline.h:75
Belle2::Monopoles::G4MonopoleTransportation::fMaxEnergyKilled
G4double fMaxEnergyKilled
Max of abandoned looping tracks energies.
Definition: G4MonopoleTransportation.h:220
Belle2::Monopoles::G4MonopoleTransportation::GetThresholdTrials
G4int GetThresholdTrials() const
Access fThresholdTrials.
Definition: G4MonopoleTransportationInline.h:65
Belle2::Monopoles::G4MonopoleTransportation::GetSumEnergyKilled
G4double GetSumEnergyKilled() const
Access fSumEnergyKilled.
Definition: G4MonopoleTransportationInline.h:95
Belle2::Monopoles::G4MonopoleTransportation::G4MonopoleTransportation
G4MonopoleTransportation(const G4Monopole *mpl, G4int verb=1)
Constructor.
Definition: G4MonopoleTransportation.cc:32