14 #include <Geant4/G4ParticleDefinition.hh>
15 #include <Geant4/G4ReferenceCountedHandle.hh>
16 #include <Geant4/G4Step.hh>
17 #include <Geant4/G4StepPoint.hh>
18 #include <Geant4/G4StepStatus.hh>
19 #include <Geant4/G4String.hh>
20 #include <Geant4/G4SystemOfUnits.hh>
21 #include <Geant4/G4ThreeVector.hh>
22 #include <Geant4/G4TouchableHandle.hh>
23 #include <Geant4/G4Track.hh>
24 #include <Geant4/G4TrackStatus.hh>
25 #include <Geant4/G4Types.hh>
26 #include <Geant4/G4VTouchable.hh>
27 #include <Geant4/G4VUserTrackInformation.hh>
32 class G4VPhysicalVolume;
39 detector_( detector ),
41 absorberhits_(nullptr),
49 G4TouchableHandle touch = aStep->GetPreStepPoint()->GetTouchableHandle();
51 G4VPhysicalVolume*
volume = touch->GetVolume();
61 G4double edep = aStep->GetTotalEnergyDeposit() /
GeV;
62 G4double eion = (aStep->GetTotalEnergyDeposit()-aStep->GetNonIonizingEnergyDeposit()) /
GeV;
64 const G4Track* aTrack = aStep->GetTrack();
69 edep = aTrack->GetKineticEnergy() /
GeV;
70 G4Track* killtrack =
const_cast<G4Track *
> (aTrack);
71 killtrack->SetTrackStatus(fStopAndKill);
74 int tower_id = touch->GetCopyNumber(2);
78 bool geantino =
false;
82 if (aTrack->GetParticleDefinition()->GetPDGEncoding() == 0 &&
83 aTrack->GetParticleDefinition()->GetParticleName().find(
"geantino") != string::npos)
87 G4StepPoint * prePoint = aStep->GetPreStepPoint();
88 G4StepPoint * postPoint = aStep->GetPostStepPoint();
92 switch (prePoint->GetStepStatus())
100 hit->
set_x( 0, prePoint->GetPosition().x() /
cm);
101 hit->
set_y( 0, prePoint->GetPosition().y() /
cm );
102 hit->
set_z( 0, prePoint->GetPosition().z() /
cm );
104 hit->
set_t( 0, prePoint->GetGlobalTime() / nanosecond );
108 if ( G4VUserTrackInformation*
p = aTrack->GetUserInformation() )
125 hitcontainer =
hits_;
133 if ( G4VUserTrackInformation*
p = aTrack->GetUserInformation() )
147 hit->
set_x( 1, postPoint->GetPosition().x() /
cm );
148 hit->
set_y( 1, postPoint->GetPosition().y() /
cm );
149 hit->
set_z( 1, postPoint->GetPosition().z() /
cm );
151 hit->
set_t( 1, postPoint->GetGlobalTime() / nanosecond );
162 if ( G4VUserTrackInformation*
p = aTrack->GetUserInformation() )
189 string absorbernodename;
202 hits_ = findNode::getClass<PHG4HitContainer>( topNode , hitnodename.c_str() );
203 absorberhits_ = findNode::getClass<PHG4HitContainer>( topNode , absorbernodename.c_str() );
208 std::cout <<
"PHG4CEmcTestBeamSteppingAction::SetTopNode - unable to find " << hitnodename << std::endl;
210 if ( ! absorberhits_)
214 cout <<
"PHG4HcalSteppingAction::SetTopNode - unable to find " << absorbernodename << endl;