16 #include "Geant4/G4Event.hh" 17 #include "Geant4/G4EventManager.hh" 18 #include "Geant4/G4HCofThisEvent.hh" 19 #include "Geant4/G4SDManager.hh" 20 #include "Geant4/G4Step.hh" 21 #include "Geant4/G4SystemOfUnits.hh" 22 #include "Geant4/G4ThreeVector.hh" 23 #include "Geant4/G4UnitsTable.hh" 24 #include "Geant4/G4VSolid.hh" 25 #include "Geant4/G4VVisManager.hh" 26 #include "Geant4/G4ios.hh" 28 #include <unordered_set> 50 G4double
edep = step->GetTotalEnergyDeposit() / CLHEP::MeV;
51 if (edep == 0.)
return false;
52 G4Track*
track = step->GetTrack();
53 const unsigned int trackID = track->GetTrackID();
54 unsigned int ID = step->GetPreStepPoint()->GetPhysicalVolume()->GetCopyNo();
58 step->IsFirstStepInVolume(),
59 step->IsLastStepInVolume(),
61 step->GetPreStepPoint()->GetPosition().getX() / CLHEP::cm,
62 step->GetPreStepPoint()->GetPosition().getY() / CLHEP::cm,
63 step->GetPreStepPoint()->GetPosition().getZ() / CLHEP::cm,
64 step->GetPreStepPoint()->GetGlobalTime() / CLHEP::ns,
65 step->GetPostStepPoint()->GetPosition().getX() / CLHEP::cm,
66 step->GetPostStepPoint()->GetPosition().getY() / CLHEP::cm,
67 step->GetPostStepPoint()->GetPosition().getZ() / CLHEP::cm,
68 step->GetPostStepPoint()->GetGlobalTime() / CLHEP::ns,
69 step->GetPostStepPoint()->GetMomentum().getX() / CLHEP::GeV,
70 step->GetPostStepPoint()->GetMomentum().getY() / CLHEP::GeV,
71 step->GetPostStepPoint()->GetMomentum().getZ() / CLHEP::GeV);
99 std::cout <<
" EndOfEvent number of temp hits: " <<
temphitCollection.size() << std::endl;
100 std::cout <<
" EndOfEvent number of aux hits: " <<
hitCollection.size() << std::endl;
106 std::unordered_set<unsigned int> setofIDs;
109 #if defined _verbose_ 110 std::cout <<
"geoID: " << it->GetID() <<
" track ID: " << it->GetTrackID()
111 <<
" Edep: " << it->GetEnergyDeposited() <<
" Parent Id: " << it->GetParentID()
112 <<
" exit Time: " << it->GetExitT() <<
" is first: " << it->IsIsfirstinVolume()
113 <<
" is last: " << it->IsIslastinVolume();
115 if (it->GetID() == geoId && trackId == it->GetTrackID())
117 #if defined _verbose_ 118 std::cout <<
" A" << std::endl;
123 hitCollection[counter - 1].GetEnergyDeposited() + it->GetEnergyDeposited());
132 hitCollection[counter - 1].GetEnergyDeposited() + it->GetEnergyDeposited());
135 else if (setofIDs.find(it->GetParentID()) != setofIDs.end()) {
136 setofIDs.insert(it->GetTrackID());
137 #if defined _verbose_ 138 std::cout <<
" A" << std::endl;
141 hitCollection[counter - 1].GetEnergyDeposited() + it->GetEnergyDeposited());
143 else if (it->GetID() != geoId)
146 trackId = it->GetTrackID();
148 setofIDs.insert(it->GetTrackID());
149 #if defined _verbose_ 150 std::cout <<
" N" << std::endl;
155 it->GetEnergyDeposited(),
164 it->GetExitMomentumX(),
165 it->GetExitMomentumY(),
166 it->GetExitMomentumZ()));
169 trackId = it->GetTrackID();
170 #if defined _verbose_ 171 std::cout <<
" N" << std::endl;
175 setofIDs.insert(it->GetTrackID());
178 it->GetEnergyDeposited(),
187 it->GetExitMomentumX(),
188 it->GetExitMomentumY(),
189 it->GetExitMomentumZ()));
192 #if defined _verbose_ 193 std::cout <<
"Number of AuxDetHits: " << counter << std::endl;
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
sim::AuxDetHitCollection hitCollection
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 *)
void Initialize(G4HCofThisEvent *)