CMS 3D CMS Logo

MonopoleTransportation.h
Go to the documentation of this file.
1 //
2 // =======================================================================
3 //
4 // Class MonopoleTransportation
5 //
6 // Created: 3 May 2010, J. Apostolakis, B. Bozsogi
7 // G4MonopoleTransportation class for
8 // Geant4 extended example "monopole"
9 //
10 // Adopted for CMSSW by V.Ivanchenko 30 April 2018
11 // from Geant4 global tag geant4-10-04-ref-03
12 //
13 // =======================================================================
14 //
15 // Class description:
16 //
17 // G4MonopoleTransportation is a process responsible for the transportation of
18 // magnetic monopoles, i.e. the geometrical propagation encountering the
19 // geometrical sub-volumes of the detectors.
20 // It is also tasked with part of updating the "safety".
21 // For monopoles, uses a different equation of motion and ignores energy
22 // conservation.
23 //
24 
25 #ifndef SimG4Core_PhysicsLists_MonopoleTransportation_h
26 #define SimG4Core_PhysicsLists_MonopoleTransportation_h 1
27 
28 #include "G4VProcess.hh"
29 #include "G4FieldManager.hh"
30 
31 #include "G4Navigator.hh"
32 #include "G4TransportationManager.hh"
33 #include "G4PropagatorInField.hh"
34 #include "G4Track.hh"
35 #include "G4Step.hh"
36 #include "G4ParticleChangeForTransport.hh"
37 #include "CLHEP/Units/SystemOfUnits.h"
38 
39 #include <memory>
40 
41 class G4SafetyHelper;
42 class Monopole;
43 class CMSFieldManager;
44 
45 class MonopoleTransportation : public G4VProcess {
46 public:
48  ~MonopoleTransportation() override;
49 
50  G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
51  G4double previousStepSize,
52  G4double currentMinimumStep,
53  G4double& currentSafety,
54  G4GPILSelection* selection) override;
55 
56  G4VParticleChange* AlongStepDoIt(const G4Track& track, const G4Step& stepData) override;
57 
58  G4VParticleChange* PostStepDoIt(const G4Track& track, const G4Step& stepData) override;
59  // Responsible for the relocation.
60 
61  G4double PostStepGetPhysicalInteractionLength(const G4Track&,
62  G4double previousStepSize,
63  G4ForceCondition* pForceCond) override;
64  // Forces the PostStepDoIt action to be called,
65  // but does not limit the step.
66 
67  G4PropagatorInField* GetPropagatorInField();
68  void SetPropagatorInField(G4PropagatorInField* pFieldPropagator);
69  // Access/set the assistant class that Propagate in a Field.
70 
71  inline G4double GetThresholdWarningEnergy() const;
72  inline G4double GetThresholdImportantEnergy() const;
73  inline G4int GetThresholdTrials() const;
74 
75  inline void SetThresholdWarningEnergy(G4double newEnWarn);
76  inline void SetThresholdImportantEnergy(G4double newEnImp);
77  inline void SetThresholdTrials(G4int newMaxTrials);
78 
79  // Get/Set parameters for killing loopers:
80  // Above 'important' energy a 'looping' particle in field will
81  // *NOT* be abandoned, except after fThresholdTrials attempts.
82  // Below Warning energy, no verbosity for looping particles is issued
83 
84  inline G4double GetMaxEnergyKilled() const;
85  inline G4double GetSumEnergyKilled() const;
86  void ResetKilledStatistics(G4int report = 1);
87  // Statistics for tracks killed (currently due to looping in field)
88 
89  inline void EnableShortStepOptimisation(G4bool optimise = true);
90  // Whether short steps < safety will avoid to call Navigator (if field=0)
91 
92  G4double AtRestGetPhysicalInteractionLength(const G4Track&, G4ForceCondition*) override;
93 
94  G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override;
95  // No operation in AtRestDoIt.
96 
97  void StartTracking(G4Track* aTrack) override;
98  // Reset state for new (potentially resumed) track
99 
100 protected:
101  G4bool DoesGlobalFieldExist();
102  // Checks whether a field exists for the "global" field manager.
103 
104 private:
106 
108 
109  G4Navigator* fLinearNavigator;
110  G4PropagatorInField* fFieldPropagator;
111  // The Propagators used to transport the particle
112 
113  G4ThreeVector fTransportEndPosition;
116  G4ThreeVector fTransportEndSpin;
118 
121  // The particle's state after this Step, Store for DoIt
122 
124 
125  G4TouchableHandle fCurrentTouchableHandle;
126 
128  // Flag to determine whether a boundary was reached.
129 
130  G4ThreeVector fPreviousSftOrigin;
131  G4double fPreviousSafety;
132  // Remember last safety origin & value.
133 
134  G4ParticleChangeForTransport fParticleChange;
135  // New ParticleChange
136 
138 
139  // Thresholds for looping particles:
140  //
141  G4double fThreshold_Warning_Energy; // Warn above this energy
142  G4double fThreshold_Important_Energy; // Hesitate above this
143  G4int fThresholdTrials; // for this no of trials
144  // Above 'important' energy a 'looping' particle in field will
145  // *NOT* be abandoned, except after fThresholdTrials attempts.
146 
147  // Counter for steps in which particle reports 'looping',
148  // if it is above 'Important' Energy
150  // Statistics for tracks abandoned
153 
154  // Whether to avoid calling G4Navigator for short step ( < safety)
155  // If using it, the safety estimate for endpoint will likely be smaller.
157 
158  G4SafetyHelper* fpSafetyHelper; // To pass it the safety value obtained
159 };
160 
161 inline void MonopoleTransportation::SetPropagatorInField(G4PropagatorInField* pFieldPropagator) {
162  fFieldPropagator = pFieldPropagator;
163 }
164 
165 inline G4PropagatorInField* MonopoleTransportation::GetPropagatorInField() { return fFieldPropagator; }
166 
168  G4TransportationManager* transportMgr = G4TransportationManager::GetTransportationManager();
169  return transportMgr->GetFieldManager()->DoesFieldExist();
170 }
171 
173 
175 
177 
178 inline void MonopoleTransportation::SetThresholdWarningEnergy(G4double newEnWarn) {
179  fThreshold_Warning_Energy = newEnWarn;
180 }
181 
183  fThreshold_Important_Energy = newEnImp;
184 }
185 
186 inline void MonopoleTransportation::SetThresholdTrials(G4int newMaxTrials) { fThresholdTrials = newMaxTrials; }
187 
188 // Get parameters for killing loopers:
189 // Above 'important' energy a 'looping' particle in field will
190 // *NOT* be abandoned, except after fThresholdTrials attempts.
191 // Below Warning energy, no verbosity for looping particles is issued
192 
194 
196 
197 inline void MonopoleTransportation::EnableShortStepOptimisation(G4bool optimiseShortStep) {
198  fShortStepOptimisation = optimiseShortStep;
199 }
200 
201 #endif
MonopoleTransportation::AlongStepDoIt
G4VParticleChange * AlongStepDoIt(const G4Track &track, const G4Step &stepData) override
Definition: MonopoleTransportation.cc:332
MonopoleTransportation::fpSafetyHelper
G4SafetyHelper * fpSafetyHelper
Definition: MonopoleTransportation.h:158
MonopoleTransportation::SetThresholdTrials
void SetThresholdTrials(G4int newMaxTrials)
Definition: MonopoleTransportation.h:186
MonopoleTransportation::fTransportEndSpin
G4ThreeVector fTransportEndSpin
Definition: MonopoleTransportation.h:116
MonopoleTransportation::fPreviousSftOrigin
G4ThreeVector fPreviousSftOrigin
Definition: MonopoleTransportation.h:130
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
MonopoleTransportation::fGeometryLimitedStep
G4bool fGeometryLimitedStep
Definition: MonopoleTransportation.h:127
MonopoleTransportation::fMaxEnergyKilled
G4double fMaxEnergyKilled
Definition: MonopoleTransportation.h:152
CMSFieldManager
Definition: CMSFieldManager.h:24
MonopoleTransportation::fFieldPropagator
G4PropagatorInField * fFieldPropagator
Definition: MonopoleTransportation.h:110
MonopoleTransportation::fieldMgrCMS
CMSFieldManager * fieldMgrCMS
Definition: MonopoleTransportation.h:107
MonopoleTransportation::fCandidateEndGlobalTime
G4double fCandidateEndGlobalTime
Definition: MonopoleTransportation.h:120
MonopoleTransportation::fTransportEndPosition
G4ThreeVector fTransportEndPosition
Definition: MonopoleTransportation.h:113
MonopoleTransportation::GetPropagatorInField
G4PropagatorInField * GetPropagatorInField()
Definition: MonopoleTransportation.h:165
MonopoleTransportation::GetThresholdWarningEnergy
G4double GetThresholdWarningEnergy() const
Definition: MonopoleTransportation.h:172
MonopoleTransportation::fTransportEndMomentumDir
G4ThreeVector fTransportEndMomentumDir
Definition: MonopoleTransportation.h:114
MonopoleTransportation::fSumEnergyKilled
G4double fSumEnergyKilled
Definition: MonopoleTransportation.h:151
MonopoleTransportation::fShortStepOptimisation
G4bool fShortStepOptimisation
Definition: MonopoleTransportation.h:156
MonopoleTransportation::fLinearNavigator
G4Navigator * fLinearNavigator
Definition: MonopoleTransportation.h:109
HLTSiStripMonitoring_cff.verbosityLevel
verbosityLevel
L1 selection andOrL1 = cms.bool( True ), l1Algorithms = cms.vstring("L1_ZeroBias_FirstCollidingBunch"...
Definition: HLTSiStripMonitoring_cff.py:261
MonopoleTransportation::ResetKilledStatistics
void ResetKilledStatistics(G4int report=1)
Definition: MonopoleTransportation.cc:581
MonopoleTransportation::fParticleChange
G4ParticleChangeForTransport fParticleChange
Definition: MonopoleTransportation.h:134
MonopoleTransportation::PostStepDoIt
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &stepData) override
Definition: MonopoleTransportation.cc:444
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
MonopoleTransportation::SetThresholdWarningEnergy
void SetThresholdWarningEnergy(G4double newEnWarn)
Definition: MonopoleTransportation.h:178
MonopoleTransportation::DoesGlobalFieldExist
G4bool DoesGlobalFieldExist()
Definition: MonopoleTransportation.h:167
MonopoleTransportation::AtRestDoIt
G4VParticleChange * AtRestDoIt(const G4Track &, const G4Step &) override
Definition: MonopoleTransportation.cc:577
MonopoleTransportation::SetThresholdImportantEnergy
void SetThresholdImportantEnergy(G4double newEnImp)
Definition: MonopoleTransportation.h:182
MonopoleTransportation::GetThresholdTrials
G4int GetThresholdTrials() const
Definition: MonopoleTransportation.h:176
MonopoleTransportation::AlongStepGetPhysicalInteractionLength
G4double AlongStepGetPhysicalInteractionLength(const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &currentSafety, G4GPILSelection *selection) override
Definition: MonopoleTransportation.cc:101
MonopoleTransportation::fCurrentTouchableHandle
G4TouchableHandle fCurrentTouchableHandle
Definition: MonopoleTransportation.h:125
MonopoleTransportation::PostStepGetPhysicalInteractionLength
G4double PostStepGetPhysicalInteractionLength(const G4Track &, G4double previousStepSize, G4ForceCondition *pForceCond) override
Definition: MonopoleTransportation.cc:435
MonopoleTransportation::fPreviousSafety
G4double fPreviousSafety
Definition: MonopoleTransportation.h:131
MonopoleTransportation::fParticleDef
const Monopole * fParticleDef
Definition: MonopoleTransportation.h:105
Monopole
Definition: Monopole.h:12
MonopoleTransportation::StartTracking
void StartTracking(G4Track *aTrack) override
Definition: MonopoleTransportation.cc:529
MonopoleTransportation::fThreshold_Important_Energy
G4double fThreshold_Important_Energy
Definition: MonopoleTransportation.h:142
MonopoleTransportation::AtRestGetPhysicalInteractionLength
G4double AtRestGetPhysicalInteractionLength(const G4Track &, G4ForceCondition *) override
Definition: MonopoleTransportation.cc:573
MonopoleTransportation::GetMaxEnergyKilled
G4double GetMaxEnergyKilled() const
Definition: MonopoleTransportation.h:193
MonopoleTransportation::EnableShortStepOptimisation
void EnableShortStepOptimisation(G4bool optimise=true)
Definition: MonopoleTransportation.h:197
MonopoleTransportation::fParticleIsLooping
G4bool fParticleIsLooping
Definition: MonopoleTransportation.h:123
MonopoleTransportation::fThresholdTrials
G4int fThresholdTrials
Definition: MonopoleTransportation.h:143
MonopoleTransportation::GetSumEnergyKilled
G4double GetSumEnergyKilled() const
Definition: MonopoleTransportation.h:195
edmIntegrityCheck.report
report
Definition: edmIntegrityCheck.py:349
MonopoleTransportation::fNoLooperTrials
G4int fNoLooperTrials
Definition: MonopoleTransportation.h:149
MonopoleTransportation::fThreshold_Warning_Energy
G4double fThreshold_Warning_Energy
Definition: MonopoleTransportation.h:141
MonopoleTransportation::SetPropagatorInField
void SetPropagatorInField(G4PropagatorInField *pFieldPropagator)
Definition: MonopoleTransportation.h:161
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
MonopoleTransportation
Definition: MonopoleTransportation.h:45
MonopoleTransportation::MonopoleTransportation
MonopoleTransportation(const Monopole *p, G4int verbosityLevel=1)
Definition: MonopoleTransportation.cc:33
MonopoleTransportation::GetThresholdImportantEnergy
G4double GetThresholdImportantEnergy() const
Definition: MonopoleTransportation.h:174
MonopoleTransportation::endpointDistance
G4double endpointDistance
Definition: MonopoleTransportation.h:137
MonopoleTransportation::fTransportEndKineticEnergy
G4double fTransportEndKineticEnergy
Definition: MonopoleTransportation.h:115
MonopoleTransportation::fMomentumChanged
G4bool fMomentumChanged
Definition: MonopoleTransportation.h:117
MonopoleTransportation::~MonopoleTransportation
~MonopoleTransportation() override
Definition: MonopoleTransportation.cc:83
MonopoleTransportation::fEndGlobalTimeComputed
G4bool fEndGlobalTimeComputed
Definition: MonopoleTransportation.h:119