42 #include "G4HCofThisEvent.hh"
43 #include "G4VHitsCollection.hh"
77 fHodHC1ID = sdManager->GetCollectionID(
"hodoscope1/hodoscopeColl");
78 fHodHC2ID = sdManager->GetCollectionID(
"hodoscope2/hodoscopeColl");
79 fDriftHC1ID = sdManager->GetCollectionID(
"chamber1/driftChamberColl");
80 fDriftHC2ID = sdManager->GetCollectionID(
"chamber2/driftChamberColl");
81 fEmCalHCID = sdManager->GetCollectionID(
"EMcalorimeter/EMcalorimeterColl");
82 fHadCalHCID = sdManager->GetCollectionID(
"HadCalorimeter/HadCalorimeterColl");
90 auto hce =
event->GetHCofThisEvent();
93 msg <<
"No hits collection of this event found." <<
G4endl;
118 if ( (!hHC1) || (!hHC2) || (!dHC1) || (!dHC2) || (!ecHC) || (!hcHC) ) {
120 msg <<
"Some of hits collections of this event not found." <<
G4endl;
131 auto analysisManager = G4AnalysisManager::Instance();
135 auto nhit = dHC1->entries();
136 analysisManager->FillH1(0, nhit );
138 for (
auto i=0;i<nhit ;i++) {
139 auto hit = (*dHC1)[i];
140 auto localPos = hit->GetLocalPos();
141 analysisManager->FillH2(0, localPos.x(), localPos.y());
144 nhit = dHC2->entries();
145 analysisManager->FillH1(1, nhit );
147 for (
auto i=0;i<nhit ;i++) {
148 auto hit = (*dHC2)[i];
149 auto localPos = hit->GetLocalPos();
150 analysisManager->FillH2(1, localPos.x(), localPos.y());
156 analysisManager->FillNtupleIColumn(0, dHC1->entries());
158 analysisManager->FillNtupleIColumn(1, dHC1->entries());
161 G4int totalEmHit = 0;
164 auto hit = (*ecHC)[i];
165 auto edep = hit->GetEdep();
170 fEmCalEdep[i] = edep;
172 analysisManager->FillNtupleDColumn(2, totalEmE);
175 G4int totalHadHit = 0;
178 auto hit = (*hcHC)[i];
179 auto edep = hit->GetEdep();
184 fHadCalEdep[i] = edep;
186 analysisManager->FillNtupleDColumn(3, totalHadE);
189 for (
auto i=0;i<hHC1->entries();i++) {
190 analysisManager->FillNtupleDColumn(4,(*hHC1)[i]->GetTime());
194 for (
auto i=0;i<hHC2->entries();i++) {
195 analysisManager->FillNtupleDColumn(5,(*hHC2)[i]->GetTime());
198 analysisManager->AddNtupleRow();
205 if ( printModulo==0 || event->
GetEventID() % printModulo != 0)
return;
207 auto primary =
event->GetPrimaryVertex(0)->GetPrimary(0);
210 <<
">>> Event " <<
event->GetEventID() <<
" >>> Simulation truth : "
211 << primary->GetG4code()->GetParticleName()
212 <<
" " << primary->GetMomentum() <<
G4endl;
215 nhit = hHC1->entries();
216 G4cout <<
"Hodoscope 1 has " << nhit <<
" hits." <<
G4endl;
217 for (
auto i=0;i<nhit ;i++) {
218 auto hit = (*hHC1)[i];
223 nhit = hHC2->entries();
224 G4cout <<
"Hodoscope 2 has " << nhit <<
" hits." <<
G4endl;
225 for (
auto i=0;i<nhit ;i++) {
226 auto hit = (*hHC2)[i];
231 nhit = dHC1->entries();
232 G4cout <<
"Drift Chamber 1 has " << nhit <<
" hits." <<
G4endl;
234 for (
auto i=0;i<nhit ;i++) {
235 auto hit = (*dHC1)[i];
236 if (hit->GetLayerID()==layer) hit->Print();
241 nhit = dHC2->entries();
242 G4cout <<
"Drift Chamber 2 has " << nhit <<
" hits." <<
G4endl;
244 for (
auto i=0;i<nhit ;i++) {
245 auto hit = (*dHC2)[i];
246 if (hit->GetLayerID()==layer) hit->Print();
251 G4cout <<
"EM Calorimeter has " << totalEmHit <<
" hits. Total Edep is "
255 G4cout <<
"Hadron Calorimeter has " << totalHadHit <<
" hits. Total Edep is "
Definition of the B5EventAction class.
std::ostringstream G4ExceptionDescription
void SetPrintProgress(G4int i)
constexpr G4int kNofChambers
constexpr G4int kNofHadCells
Definition of the B5EmCalorimeterHit class.
G4GLOB_DLL std::ostream G4cout
Definition of the B5HodoscopeHit class.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Selection of the analysis technology.
static G4RunManager * GetRunManager()
static G4SDManager * GetSDMpointer()
virtual void BeginOfEventAction(const G4Event *)
static constexpr double MeV
constexpr G4int kNofEmCells
virtual void EndOfEventAction(const G4Event *)
Definition of the B5DriftChamberHit class.
Definition of the B5HadCalorimeterHit class.