28 #include <phparameter/PHParameters.h>
43 #include <Geant4/G4ParticleDefinition.hh>
44 #include <Geant4/G4ReferenceCountedHandle.hh>
45 #include <Geant4/G4Step.hh>
46 #include <Geant4/G4StepPoint.hh>
47 #include <Geant4/G4StepStatus.hh>
48 #include <Geant4/G4String.hh>
49 #include <Geant4/G4SystemOfUnits.hh>
50 #include <Geant4/G4ThreeVector.hh>
51 #include <Geant4/G4TouchableHandle.hh>
52 #include <Geant4/G4Track.hh>
53 #include <Geant4/G4TrackStatus.hh>
54 #include <Geant4/G4Types.hh>
55 #include <Geant4/G4VPhysicalVolume.hh>
56 #include <Geant4/G4VTouchable.hh>
57 #include <Geant4/G4VUserTrackInformation.hh>
68 , m_Detector(detector)
69 , m_Params(parameters)
70 , m_HitContainer(nullptr)
72 , m_SaveHitContainer(nullptr)
73 , m_SaveVolPre(nullptr)
74 , m_SaveVolPost(nullptr)
75 , m_SaveShower(nullptr)
77 , m_SavePreStepStatus(-1)
78 , m_SavePostStepStatus(-1)
79 , m_ActiveFlag(m_Params->get_int_param(
"active"))
80 , m_BlackHoleFlag(m_Params->get_int_param(
"blackhole"))
102 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
103 G4TouchableHandle touchpost = aStep->GetPostStepPoint()->GetTouchableHandle();
105 G4VPhysicalVolume *
volume = touch->GetVolume();
119 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
120 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
121 G4double light_yield = 0;
123 const G4Track *aTrack = aStep->GetTrack();
127 edep = aTrack->GetKineticEnergy() /
GeV;
128 G4Track *killtrack =
const_cast<G4Track *
>(aTrack);
129 killtrack->SetTrackStatus(fStopAndKill);
143 int detector_id = detflag%100;
144 int detector_layer = (detflag%10000)/100;
145 int detector_nlyrbox =(detflag%1000000)/10000;
146 int detector_system= (detflag/1000000)*1000000;
148 int xid = touch->GetCopyNumber(1);
149 int yid = touch->GetCopyNumber();
155 int zid = touch->GetCopyNumber(2);
160 if(detector_id ==
ZDCID::SI_PIXEL) layer_id = detector_layer + touch->GetCopyNumber(3);
162 int boxid = touch->GetCopyNumber(4);
163 int zid =touch->GetCopyNumber(3);
164 int nlyr = detector_nlyrbox +1;
165 layer_id = detector_layer + zid + boxid * nlyr;
168 if(detector_id ==
ZDCID::SI_PAD) layer_id = detector_layer + touch->GetCopyNumber(3);
171 int boxid = touch->GetCopyNumber(4);
172 int zid = touch->GetCopyNumber(3);
173 int nlyr = detector_nlyrbox;
174 layer_id = detector_layer + zid + boxid *nlyr;
180 layer_id = detector_layer;
182 int boxid = touch->GetCopyNumber(2);
183 layer_id = detector_layer + boxid * detector_nlyrbox;
187 bool geantino =
false;
191 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
192 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") !=
197 G4StepPoint *prePoint = aStep->GetPreStepPoint();
198 G4StepPoint *postPoint = aStep->GetPostStepPoint();
212 switch (prePoint->GetStepStatus()){
213 case fPostStepDoItProc:
221 std::cout <<
GetName() <<
": New Hit for " << std::endl;
222 std::cout <<
"prestep status: "
224 <<
", poststep status: "
226 <<
", last pre step status: "
228 <<
", last post step status: "
231 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
232 std::cout <<
"phys pre vol: " << volume->GetName()
233 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
234 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
235 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
248 m_Hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
276 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation())
295 std::cout <<
GetName() <<
": hit was not created" << std::endl;
296 std::cout <<
"prestep status: "
298 <<
", poststep status: "
300 <<
", last pre step status: "
302 <<
", last post step status: "
305 <<
", current trackid: " << aTrack->GetTrackID() << std::endl;
306 std::cout <<
"phys pre vol: " << volume->GetName()
307 <<
" post vol : " << touchpost->GetVolume()->GetName() << std::endl;
308 std::cout <<
" previous phys pre vol: " <<
m_SaveVolPre->GetName()
309 <<
" previous phys post vol: " <<
m_SaveVolPost->GetName() << std::endl;
315 std::cout <<
GetName() <<
": hits do not belong to the same track" << std::endl;
317 <<
", current trackid: " << aTrack->GetTrackID()
318 <<
", prestep status: " << prePoint->GetStepStatus()
335 if (whichactive > 0) {
349 if (postPoint->GetStepStatus() == fGeomBoundary ||
350 postPoint->GetStepStatus() == fWorldBoundary ||
351 postPoint->GetStepStatus() == fAtRestDoItProc ||
352 aTrack->GetTrackStatus() == fStopAndKill){
360 m_Hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
361 if (G4VUserTrackInformation *
p = aTrack->GetUserInformation()){
372 if (whichactive > 0){
414 m_HitContainer = findNode::getClass<PHG4HitContainer>(topNode, hitnodename);
418 std::cout <<
"EICG4ZDCSteppingAction::SetTopNode - unable to find "
419 << hitnodename << std::endl;