22 #include <Geant4/G4IonisParamMat.hh>
23 #include <Geant4/G4Material.hh>
24 #include <Geant4/G4MaterialCutsCouple.hh>
25 #include <Geant4/G4ParticleDefinition.hh>
26 #include <Geant4/G4Step.hh>
27 #include <Geant4/G4StepPoint.hh>
28 #include <Geant4/G4StepStatus.hh>
29 #include <Geant4/G4String.hh>
30 #include <Geant4/G4SystemOfUnits.hh>
31 #include <Geant4/G4ThreeVector.hh>
32 #include <Geant4/G4TouchableHandle.hh>
33 #include <Geant4/G4Track.hh>
34 #include <Geant4/G4TrackStatus.hh>
35 #include <Geant4/G4Types.hh>
36 #include <Geant4/G4VTouchable.hh>
37 #include <Geant4/G4VUserTrackInformation.hh>
51 , absorberhits_(nullptr)
53 , savehitcontainer(nullptr)
63 aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
66 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
67 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
69 const G4Track* aTrack = aStep->GetTrack();
71 const int layer_id = 0;
78 bool geantino =
false;
82 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 && aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != string::npos)
86 G4StepPoint* prePoint = aStep->GetPreStepPoint();
87 G4StepPoint* postPoint = aStep->GetPostStepPoint();
97 fiber_ID = prePoint->GetTouchable()->GetReplicaNumber(1);
98 tower_ID = prePoint->GetTouchable()->GetReplicaNumber(2);
99 sector_ID = prePoint->GetTouchable()->GetReplicaNumber(3);
102 cout << __PRETTY_FUNCTION__ <<
" FIBER_CORE step with GetReplicaNumber[0-4] = "
103 << prePoint->GetTouchable()->GetReplicaNumber(0) <<
", "
104 << prePoint->GetTouchable()->GetReplicaNumber(1) <<
", "
105 << prePoint->GetTouchable()->GetReplicaNumber(2) <<
", "
106 << prePoint->GetTouchable()->GetReplicaNumber(3) <<
". edep = " << edep <<
", eion = " << eion << endl;
111 fiber_ID = prePoint->GetTouchable()->GetReplicaNumber(0);
112 tower_ID = prePoint->GetTouchable()->GetReplicaNumber(1);
113 sector_ID = prePoint->GetTouchable()->GetReplicaNumber(2);
118 tower_ID = prePoint->GetTouchable()->GetReplicaNumber(0);
119 sector_ID = prePoint->GetTouchable()->GetReplicaNumber(1);
128 switch (prePoint->GetStepStatus())
141 hit->
set_x(0, prePoint->GetPosition().x() /
cm);
142 hit->
set_y(0, prePoint->GetPosition().y() /
cm);
143 hit->
set_z(0, prePoint->GetPosition().z() /
cm);
146 hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
156 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
177 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
200 hit->
set_x(1, postPoint->GetPosition().x() /
cm);
201 hit->
set_y(1, postPoint->GetPosition().y() /
cm);
202 hit->
set_z(1, postPoint->GetPosition().z() /
cm);
204 hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
217 static bool once =
true;
218 if (once and edep > 0)
224 cout <<
"PHG4SpacalPrototype4SteppingAction::UserSteppingAction::"
227 <<
" use scintillating light model at each Geant4 steps. "
230 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetName()
232 <<
"Birk Constant = "
233 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetIonisation()->GetBirksConstant()
235 <<
"edep = " << edep <<
", "
238 <<
"light_yield = " << light_yield << endl;
259 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
274 if (postPoint->GetStepStatus() == fGeomBoundary ||
275 postPoint->GetStepStatus() == fWorldBoundary ||
276 aTrack->GetTrackStatus() == fStopAndKill)
312 string absorbernodename;
325 hits_ = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
326 absorberhits_ = findNode::getClass<PHG4HitContainer>(topNode,
327 absorbernodename.c_str());
331 std::cout <<
"PHG4SpacalPrototype4SteppingAction::SetTopNode - unable to find "
332 << hitnodename << std::endl;
338 std::cout <<
"PHG4SpacalPrototype4SteppingAction::SetTopNode - unable to find "
339 << absorbernodename << std::endl;