5 #include <phparameter/PHParameters.h>
6 #include <phparameter/PHParametersContainer.h>
19 #include <Geant4/G4ParticleDefinition.hh>
20 #include <Geant4/G4ReferenceCountedHandle.hh>
21 #include <Geant4/G4Step.hh>
22 #include <Geant4/G4StepPoint.hh>
23 #include <Geant4/G4StepStatus.hh>
24 #include <Geant4/G4String.hh>
25 #include <Geant4/G4SystemOfUnits.hh>
26 #include <Geant4/G4ThreeVector.hh>
27 #include <Geant4/G4TouchableHandle.hh>
28 #include <Geant4/G4Track.hh>
29 #include <Geant4/G4TrackStatus.hh>
30 #include <Geant4/G4Types.hh>
31 #include <Geant4/G4VPhysicalVolume.hh>
32 #include <Geant4/G4VTouchable.hh>
33 #include <Geant4/G4VUserTrackInformation.hh>
48 , m_Detector(detector)
50 , m_AbsorberHits(nullptr)
52 , m_SaveHitContainer(nullptr)
53 , m_SaveShower(nullptr)
54 , m_ParamsContainer(parameters)
57 for (
auto layeriter = layer_begin_end.first; layeriter != layer_begin_end.second; ++layeriter)
59 int layer = layeriter->second;
90 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
92 G4VPhysicalVolume*
volume = touch->GetVolume();
93 const G4Track* aTrack = aStep->GetTrack();
94 G4StepPoint* prePoint = aStep->GetPreStepPoint();
95 G4StepPoint* postPoint = aStep->GetPostStepPoint();
107 <<
"PHG4SilicoTrackerSteppingAction::UserSteppingAction for volume name (pre) " << touch->GetVolume()->GetName()
108 <<
" volume name (1) " << touch->GetVolume(1)->GetName()
109 <<
" volume->GetTranslation " << touch->GetVolume()->GetTranslation()
126 tie(inttlayer, ladderz, ladderphi, zposneg) = iter->second;
128 cout <<
" inttlayer " << inttlayer <<
" ladderz_base " << ladderz <<
" ladderphi " << ladderphi <<
" zposneg " << zposneg << endl;
129 if (inttlayer < 0 || inttlayer > 7)
131 assert(!
"PHG4InttSteppingAction: check Intt ladder layer.");
134 map<int, int>::const_iterator activeiter =
m_IsActiveMap.find(inttlayer);
137 cout <<
"PHG4InttSteppingAction: could not find active flag for layer " << inttlayer << endl;
140 if (activeiter->second == 0)
148 tie(inttlayer, ladderz) = iter->second;
149 sphxlayer = inttlayer;
153 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
154 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
159 edep = aTrack->GetKineticEnergy() /
GeV;
160 G4Track* killtrack =
const_cast<G4Track*
>(aTrack);
161 killtrack->SetTrackStatus(fStopAndKill);
164 bool geantino =
false;
169 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 && aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != string::npos)
176 cout <<
" aTrack->GetTrackID " << aTrack->GetTrackID() <<
" aTrack->GetParentID " << aTrack->GetParentID()
177 <<
" Intt layer " << inttlayer
178 <<
" prePoint step status = " << prePoint->GetStepStatus() <<
" postPoint step status = " << postPoint->GetStepStatus()
181 switch (prePoint->GetStepStatus())
188 cout <<
" start new g4hit for: aTrack->GetParentID " << aTrack->GetParentID() <<
" aTrack->GetTrackID " << aTrack->GetTrackID() <<
" Intt layer " << inttlayer
189 <<
" prePoint step status = " << prePoint->GetStepStatus() <<
" postPoint->GetStepStatus = " << postPoint->GetStepStatus() << endl;
203 if(
Verbosity() > 0) cout <<
" ladderz = " << ladderz << endl;
226 cout <<
" prePoint hit position x,y,z = " << prePoint->GetPosition().x() /
cm
227 <<
" " << prePoint->GetPosition().y() /
cm
228 <<
" " << prePoint->GetPosition().z() /
cm
233 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
251 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
285 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
301 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
318 if (postPoint->GetStepStatus() == fGeomBoundary ||
319 postPoint->GetStepStatus() == fWorldBoundary ||
320 postPoint->GetStepStatus() == fAtRestDoItProc ||
321 aTrack->GetTrackStatus() == fStopAndKill)
325 cout <<
" postPoint step status changed to " << postPoint->GetStepStatus() <<
" or aTrack status changed to "
326 << aTrack->GetTrackStatus() << endl;
327 cout <<
" end g4hit for: aTrack->GetParentID " << aTrack->GetParentID() <<
" aTrack->GetTrackID " << aTrack->GetTrackID() <<
" eion = " << eion << endl;
328 cout <<
" end hit position x,y,z = " << postPoint->GetPosition().x() /
cm
329 <<
" " << postPoint->GetPosition().y() /
cm
330 <<
" " << postPoint->GetPosition().z() /
cm
365 const string hitnodename =
"G4HIT_" + detectorname;
366 const string absorbernodename =
"G4HIT_ABSORBER_" + detectorname;
369 m_Hits = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
370 m_AbsorberHits = findNode::getClass<PHG4HitContainer>(topNode, absorbernodename.c_str());
374 cout <<
"PHG4InttSteppingAction::SetTopNode - unable to find " << hitnodename << endl;
377 cout <<
"PHG4InttSteppingAction::SetTopNode - unable to find " << absorbernodename << endl;