CMS 3D CMS Logo

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

#include <GflashHadronWrapperProcess.h>

Inheritance diagram for GflashHadronWrapperProcess:

Public Member Functions

G4String GetName ()
 
 GflashHadronWrapperProcess (G4String processName)
 
G4VParticleChange * PostStepDoIt (const G4Track &track, const G4Step &step) override
 
void Print (const G4Step &astep)
 
 ~GflashHadronWrapperProcess () override
 

Private Attributes

G4VProcess * fProcess
 
G4ProcessVector * fProcessVector
 
G4VParticleChange * particleChange
 
G4ProcessManager * pmanager
 
G4String theProcessName
 

Detailed Description

Definition at line 14 of file GflashHadronWrapperProcess.h.

Constructor & Destructor Documentation

◆ GflashHadronWrapperProcess()

GflashHadronWrapperProcess::GflashHadronWrapperProcess ( G4String  processName)

Definition at line 15 of file GflashHadronWrapperProcess.cc.

16  : particleChange(nullptr), pmanager(nullptr), fProcessVector(nullptr), fProcess(nullptr) {
18 }

References SimL1EmulatorRepack_CalouGT_cff::processName, and theProcessName.

◆ ~GflashHadronWrapperProcess()

GflashHadronWrapperProcess::~GflashHadronWrapperProcess ( )
override

Definition at line 20 of file GflashHadronWrapperProcess.cc.

20 {}

Member Function Documentation

◆ GetName()

G4String GflashHadronWrapperProcess::GetName ( )
inline

Definition at line 24 of file GflashHadronWrapperProcess.h.

24 { return theProcessName; };

References theProcessName.

◆ PostStepDoIt()

G4VParticleChange * GflashHadronWrapperProcess::PostStepDoIt ( const G4Track &  track,
const G4Step &  step 
)
override

Definition at line 22 of file GflashHadronWrapperProcess.cc.

22  {
23  // process PostStepDoIt for the original process
24 
25  particleChange = pRegProcess->PostStepDoIt(track, step);
26 
27  // specific actions of the wrapper process
28 
29  // update step/track information after PostStep of the original process is
30  // done these steps will be repeated again without additional conflicts even
31  // if the parameterized physics process doesn't take over the original process
32 
33  particleChange->UpdateStepForPostStep(const_cast<G4Step *>(&step));
34 
35  // we may not want to update G4Track during this wrapper process if
36  // G4Track accessors are not used in the G4VFastSimulationModel model
37  // (const_cast<G4Step *> (&step))->UpdateTrack();
38 
39  // update safety after each invocation of PostStepDoIts
40  // G4double safety = std::max(endpointSafety - (endpointSafOrigin -
41  // fPostStepPoint->GetPosition()).mag(),0.);
42  // step.GetPostStepPoint()->SetSafety(safety);
43 
44  // the secondaries from the original process are also created at the wrapper
45  // process, but they must be deleted whether the parameterized physics is
46  // an 'ExclusivelyForced' process or not. Normally the secondaries will be
47  // created after this wrapper process in G4SteppingManager::InvokePSDIP
48 
49  // store the secondaries from ParticleChange to SecondaryList
50 
51  G4TrackVector *fSecondary = (const_cast<G4Step *>(&step))->GetfSecondary();
52  G4int nSecondarySave = fSecondary->size();
53 
54  G4int num2ndaries = particleChange->GetNumberOfSecondaries();
55  G4Track *tempSecondaryTrack;
56 
57  for (G4int DSecLoop = 0; DSecLoop < num2ndaries; DSecLoop++) {
58  tempSecondaryTrack = particleChange->GetSecondary(DSecLoop);
59 
60  // Set the process pointer which created this track
61  tempSecondaryTrack->SetCreatorProcess(pRegProcess);
62 
63  // add secondaries from this wrapper process to the existing list
64  fSecondary->push_back(tempSecondaryTrack);
65 
66  } // end of loop on secondary
67 
68  // Now we can still impose conditions on the secondaries from ModelTrigger,
69  // such as the number of secondaries produced by the original process as well
70  // as those by other continuous processes - for the hadronic inelastic
71  // interaction, it is always true that
72  // particleChange->GetNumberOfSecondaries() > 0
73 
74  // at this stage, updated step information after all processes involved
75  // should be available
76 
77  // Print(step);
78 
79  // call ModelTrigger for the second time - the primary loop of PostStepGPIL
80  // is inside G4SteppingManager::DefinePhysicalStepLength().
81 
82  pmanager = track.GetDefinition()->GetProcessManager();
83 
84  G4double testGPIL = DBL_MAX;
85  G4double fStepLength = 0.0;
86  G4ForceCondition fForceCondition = InActivated;
87 
88  fStepLength = step.GetStepLength();
89 
90  fProcessVector = pmanager->GetPostStepProcessVector(typeDoIt);
91 
92  // keep the current status of track, use fPostponeToNextEvent word for
93  // this particular PostStep GPIL and then restore G4TrackStatus if the
94  // paramterized physics doesn't meet trigger conditions in ModelTrigger
95 
96  const G4TrackStatus keepStatus = track.GetTrackStatus();
97 
98  (const_cast<G4Track *>(&track))->SetTrackStatus(fPostponeToNextEvent);
99  int fpv_entries = fProcessVector->entries();
100  for (G4int ipm = 0; ipm < fpv_entries; ipm++) {
101  fProcess = (*fProcessVector)(ipm);
102 
103  if (fProcess->GetProcessType() == fParameterisation) {
104  // test ModelTrigger via PostStepGPIL
105 
106  testGPIL = fProcess->PostStepGPIL(track, fStepLength, &fForceCondition);
107 
108  // if G4FastSimulationModel:: ModelTrigger is true, then the parameterized
109  // physics process takes over the current process
110 
111  if (fForceCondition == ExclusivelyForced) {
112  // clean up memory for changing the process - counter clean up for
113  // the secondaries created by new G4Track in
114  // G4HadronicProcess::FillTotalResult
115  G4int nsec = particleChange->GetNumberOfSecondaries();
116  for (G4int DSecLoop = 0; DSecLoop < nsec; DSecLoop++) {
117  G4Track *tempSecondaryTrack = particleChange->GetSecondary(DSecLoop);
118  delete tempSecondaryTrack;
119  }
120  particleChange->Clear();
121 
122  // updating G4Step between PostStepGPIL and PostStepDoIt for the
123  // parameterized process may not be necessary, but do it anyway
124 
125  (const_cast<G4Step *>(&step))->SetStepLength(testGPIL);
126  (const_cast<G4Track *>(&track))->SetStepLength(testGPIL);
127 
128  step.GetPostStepPoint()->SetStepStatus(fExclusivelyForcedProc);
129  ;
130  step.GetPostStepPoint()->SetProcessDefinedStep(fProcess);
131  step.GetPostStepPoint()->SetSafety(0.0);
132 
133  // invoke PostStepDoIt: equivalent steps for
134  // G4SteppingManager::InvokePSDIP
135  particleChange = fProcess->PostStepDoIt(track, step);
136 
137  // update PostStepPoint of Step according to ParticleChange
138  particleChange->UpdateStepForPostStep(const_cast<G4Step *>(&step));
139 
140  // update G4Track according to ParticleChange after each PostStepDoIt
141  (const_cast<G4Step *>(&step))->UpdateTrack();
142 
143  // update safety after each invocation of PostStepDoIts - acutally this
144  // is not necessary for the parameterized physics process, but do it
145  // anyway
146  step.GetPostStepPoint()->SetSafety(0.0);
147 
148  // additional nullification
149  (const_cast<G4Track *>(&track))->SetTrackStatus(particleChange->GetTrackStatus());
150  } else {
151  // restore TrackStatus if fForceCondition != ExclusivelyForced
152  (const_cast<G4Track *>(&track))->SetTrackStatus(keepStatus);
153  }
154  // assume that there is one and only one parameterized physics
155  break;
156  }
157  }
158 
159  // remove secondaries of this wrapper process that were added to the secondary
160  // list since they will be added in the normal stepping procedure after
161  // this->PostStepDoIt in G4SteppingManager::InvokePSDIP
162 
163  // move the iterator to the (nSecondarySave+1)th element in the secondary list
164  G4TrackVector::iterator itv = fSecondary->begin();
165  itv += nSecondarySave;
166 
167  // delete next num2ndaries tracks from the secondary list
168  fSecondary->erase(itv, itv + num2ndaries);
169 
170  // end of specific actions of this wrapper process
171 
172  return particleChange;
173 }

References fProcess, fProcessVector, particleChange, pmanager, and HLT_FULL_cff::track.

◆ Print()

void GflashHadronWrapperProcess::Print ( const G4Step &  astep)

Definition at line 175 of file GflashHadronWrapperProcess.cc.

175  {
176  std::cout << " GflashHadronWrapperProcess ProcessName, PreStepPosition, "
177  "preStepPoint KE, PostStepPoint KE, DeltaEnergy Nsec \n "
178  << step.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName() << " "
179  << step.GetPostStepPoint()->GetPosition() << " " << step.GetPreStepPoint()->GetKineticEnergy() / GeV << " "
180  << step.GetPostStepPoint()->GetKineticEnergy() / GeV << " " << step.GetDeltaEnergy() / GeV << " "
181  << particleChange->GetNumberOfSecondaries() << std::endl;
182 }

References gather_cfg::cout, GeV, and particleChange.

Member Data Documentation

◆ fProcess

G4VProcess* GflashHadronWrapperProcess::fProcess
private

Definition at line 34 of file GflashHadronWrapperProcess.h.

Referenced by PostStepDoIt().

◆ fProcessVector

G4ProcessVector* GflashHadronWrapperProcess::fProcessVector
private

Definition at line 33 of file GflashHadronWrapperProcess.h.

Referenced by PostStepDoIt().

◆ particleChange

G4VParticleChange* GflashHadronWrapperProcess::particleChange
private

Definition at line 31 of file GflashHadronWrapperProcess.h.

Referenced by PostStepDoIt(), and Print().

◆ pmanager

G4ProcessManager* GflashHadronWrapperProcess::pmanager
private

Definition at line 32 of file GflashHadronWrapperProcess.h.

Referenced by PostStepDoIt().

◆ theProcessName

G4String GflashHadronWrapperProcess::theProcessName
private

Definition at line 29 of file GflashHadronWrapperProcess.h.

Referenced by GetName(), and GflashHadronWrapperProcess().

HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
step
step
Definition: StallMonitor.cc:94
GflashHadronWrapperProcess::fProcessVector
G4ProcessVector * fProcessVector
Definition: GflashHadronWrapperProcess.h:33
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GflashHadronWrapperProcess::fProcess
G4VProcess * fProcess
Definition: GflashHadronWrapperProcess.h:34
GflashHadronWrapperProcess::theProcessName
G4String theProcessName
Definition: GflashHadronWrapperProcess.h:29
GflashHadronWrapperProcess::particleChange
G4VParticleChange * particleChange
Definition: GflashHadronWrapperProcess.h:31
GflashHadronWrapperProcess::pmanager
G4ProcessManager * pmanager
Definition: GflashHadronWrapperProcess.h:32
GeV
const double GeV
Definition: MathUtil.h:16
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17