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>
44 class G4VPhysicalVolume;
52 absorberhits_(nullptr),
54 savehitcontainer(nullptr),
57 savepoststepstatus(-1)
74 G4VPhysicalVolume*
volume =
75 aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
78 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
79 G4double eion = (aStep->GetTotalEnergyDeposit() - aStep->GetNonIonizingEnergyDeposit()) /
GeV;
81 const G4Track* aTrack = aStep->GetTrack();
90 bool geantino =
false;
94 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 && aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != string::npos)
98 G4StepPoint* prePoint = aStep->GetPreStepPoint();
99 G4StepPoint* postPoint = aStep->GetPostStepPoint();
119 fiber_ID = prePoint->GetTouchable()->GetReplicaNumber(1);
120 tower_ID = prePoint->GetTouchable()->GetReplicaNumber(2);
121 sector_ID = prePoint->GetTouchable()->GetReplicaNumber(3);
126 fiber_ID = prePoint->GetTouchable()->GetReplicaNumber(0);
127 tower_ID = prePoint->GetTouchable()->GetReplicaNumber(1);
128 sector_ID = prePoint->GetTouchable()->GetReplicaNumber(2);
133 tower_ID = prePoint->GetTouchable()->GetReplicaNumber(0);
134 sector_ID = prePoint->GetTouchable()->GetReplicaNumber(1);
139 tower_ID = prePoint->GetTouchable()->GetReplicaNumber(0);
140 sector_ID = prePoint->GetTouchable()->GetReplicaNumber(1);
153 scint_id = prePoint->GetTouchable()->GetReplicaNumber(2);
155 scint_id = prePoint->GetTouchable()->GetReplicaNumber(1);
157 scint_id = prePoint->GetTouchable()->GetReplicaNumber(0);
163 switch (prePoint->GetStepStatus())
176 hit->
set_x(0, prePoint->GetPosition().x() /
cm);
177 hit->
set_y(0, prePoint->GetPosition().y() /
cm);
178 hit->
set_z(0, prePoint->GetPosition().z() /
cm);
181 hit->
set_t(0, prePoint->GetGlobalTime() / nanosecond);
200 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
212 cout <<
"PHG4SpacalSteppingAction: hit outside acceptance, layer: "
224 cout <<
GetName() <<
": hit was not created" << endl;
225 cout <<
"prestep status: " << prePoint->GetStepStatus()
233 cout <<
GetName() <<
": hits do not belong to the same track" << endl;
235 <<
", current trackid: " << aTrack->GetTrackID()
242 hit->
set_x(1, postPoint->GetPosition().x() /
cm);
243 hit->
set_y(1, postPoint->GetPosition().y() /
cm);
244 hit->
set_z(1, postPoint->GetPosition().z() /
cm);
246 hit->
set_t(1, postPoint->GetGlobalTime() / nanosecond);
259 static bool once =
true;
260 if (once and edep > 0)
266 cout <<
"PHG4SpacalSteppingAction::UserSteppingAction::"
269 <<
" use scintillating light model at each Geant4 steps. "
272 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetName()
274 <<
"Birk Constant = "
275 << aTrack->GetMaterialCutsCouple()->GetMaterial()->GetIonisation()->GetBirksConstant()
277 <<
"edep = " << edep <<
", "
280 <<
"light_yield = " << light_yield << endl;
289 cout <<
"PHG4SpacalSteppingAction: hit outside acceptance get_zmin() "
301 if (G4VUserTrackInformation*
p = aTrack->GetUserInformation())
315 if (postPoint->GetStepStatus() == fGeomBoundary ||
316 postPoint->GetStepStatus() == fWorldBoundary ||
317 postPoint->GetStepStatus() == fAtRestDoItProc ||
318 aTrack->GetTrackStatus() == fStopAndKill)
353 string absorbernodename;
366 hits_ = findNode::getClass<PHG4HitContainer>(topNode, hitnodename.c_str());
367 absorberhits_ = findNode::getClass<PHG4HitContainer>(topNode,
368 absorbernodename.c_str());
372 std::cout <<
"PHG4SpacalSteppingAction::SetTopNode - unable to find "
373 << hitnodename << std::endl;
379 std::cout <<
"PHG4SpacalSteppingAction::SetTopNode - unable to find "
380 << absorbernodename << std::endl;