16 #include<unordered_set>
18 #include "Geant4/G4HCofThisEvent.hh"
19 #include "Geant4/G4Step.hh"
20 #include "Geant4/G4ThreeVector.hh"
21 #include "Geant4/G4SDManager.hh"
22 #include "Geant4/G4ios.hh"
23 #include "Geant4/G4VVisManager.hh"
24 #include "Geant4/G4Event.hh"
25 #include "Geant4/G4EventManager.hh"
26 #include "Geant4/G4VSolid.hh"
27 #include "Geant4/G4UnitsTable.hh"
28 #include "Geant4/G4SystemOfUnits.hh"
34 : G4VSensitiveDetector(name)
51 G4double edep = step->GetTotalEnergyDeposit() /
CLHEP::MeV;
52 if (edep == 0.)
return false;
53 G4Track *
track = step->GetTrack();
54 const unsigned int trackID = track->GetTrackID();
55 unsigned int ID = step->GetPreStepPoint()->GetPhysicalVolume()->GetCopyNo();
60 step->IsFirstStepInVolume(),
61 step->IsLastStepInVolume(),
63 step->GetPreStepPoint()->GetPosition().getX() / CLHEP::cm,
64 step->GetPreStepPoint()->GetPosition().getY() / CLHEP::cm,
65 step->GetPreStepPoint()->GetPosition().getZ() / CLHEP::cm,
66 step->GetPreStepPoint()->GetGlobalTime() / CLHEP::ns,
67 step->GetPostStepPoint()->GetPosition().getX() / CLHEP::cm,
68 step->GetPostStepPoint()->GetPosition().getY() / CLHEP::cm,
69 step->GetPostStepPoint()->GetPosition().getZ() / CLHEP::cm,
70 step->GetPostStepPoint()->GetGlobalTime() / CLHEP::ns,
71 step->GetPostStepPoint()->GetMomentum().getX() /
CLHEP::GeV,
72 step->GetPostStepPoint()->GetMomentum().getY() /
CLHEP::GeV,
73 step->GetPostStepPoint()->GetMomentum().getZ() /
CLHEP::GeV
101 #if defined _verbose_
109 std::unordered_set<unsigned int> setofIDs;
112 #if defined _verbose_
113 std::cout <<
"geoID: " << it->GetID() <<
" track ID: " << it->GetTrackID() <<
" Edep: " << it->GetEnergyDeposited()
114 <<
" Parent Id: " << it->GetParentID() <<
" exit Time: " << it->GetExitT()
115 <<
" is first: " << it->IsIsfirstinVolume() <<
" is last: " << it->IsIslastinVolume();
117 if (it->GetID() == geoId && trackId == it->GetTrackID())
119 #if defined _verbose_
133 }
else if (setofIDs.find(it->GetParentID()) != setofIDs.end()) {
134 setofIDs.insert(it->GetTrackID());
135 #if defined _verbose_
139 }
else if (it->GetID() != geoId)
142 trackId = it->GetTrackID();
144 setofIDs.insert(it->GetTrackID());
145 #if defined _verbose_
151 it->GetEnergyDeposited(),
160 it->GetExitMomentumX(),
161 it->GetExitMomentumY(),
162 it->GetExitMomentumZ()
165 trackId = it->GetTrackID();
166 #if defined _verbose_
171 setofIDs.insert(it->GetTrackID());
174 it->GetEnergyDeposited(),
183 it->GetExitMomentumX(),
184 it->GetExitMomentumY(),
185 it->GetExitMomentumZ()
189 #if defined _verbose_
190 std::cout <<
"Number of AuxDetHits: " << counter << std::endl;
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
util::quantities::gigaelectronvolt GeV
sim::AuxDetHitCollection hitCollection
process_name use argoneut_mc_hitfinder track
util::quantities::megaelectronvolt MeV
auto counter(T begin, T end)
Returns an object to iterate values from begin to end in a range-for loop.
TempHitCollection temphitCollection
void EndOfEvent(G4HCofThisEvent *)
BEGIN_PROLOG could also be cout
void Initialize(G4HCofThisEvent *)