32 #include "B4Analysis.hh"
37 #include "G4HCofThisEvent.hh"
58 "Print events modulo n");
72 B4dEventAction::GetHitsCollection(
const G4String& hcName,
79 event->GetHCofThisEvent()->GetHC(hcID));
81 if ( ! hitsCollection ) {
82 G4cerr <<
"Cannot access hitsCollection " << hcName <<
G4endl;
86 return hitsCollection;
92 std::map<G4int, G4double*>::iterator it;
93 for ( it = hitsMap->
GetMap()->begin(); it != hitsMap->
GetMap()->end(); it++) {
94 sumValue += *(it->second);
101 void B4dEventAction::PrintEventStatistics(
108 <<
" Absorber: total energy: "
109 << std::setw(7) <<
G4BestUnit(absoEdep,
"Energy")
110 <<
" total track length: "
111 << std::setw(7) <<
G4BestUnit(absoTrackLength,
"Length")
113 <<
" Gap: total energy: "
114 << std::setw(7) <<
G4BestUnit(gapEdep,
"Energy")
115 <<
" total track length: "
116 << std::setw(7) <<
G4BestUnit(gapTrackLength,
"Length")
125 G4int eventID =
event->GetEventID();
126 if ( eventID % fPrintModulo == 0 ) {
127 G4cout <<
"\n---> Begin of event: " << eventID <<
G4endl;
139 = GetSum(GetHitsCollection(
"Absorber/Edep", event));
142 = GetSum(GetHitsCollection(
"Gap/Edep", event));
145 = GetSum(GetHitsCollection(
"Absorber/TrackLength", event));
148 = GetSum(GetHitsCollection(
"Gap/TrackLength", event));
155 analysisManager->FillH1(1, absoEdep);
156 analysisManager->FillH1(2, gapEdep);
157 analysisManager->FillH1(3, absoTrackLength);
158 analysisManager->FillH1(4, gapTrackLength);
162 analysisManager->FillNtupleDColumn(0, absoEdep);
163 analysisManager->FillNtupleDColumn(1, gapEdep);
164 analysisManager->FillNtupleDColumn(2, absoTrackLength);
165 analysisManager->FillNtupleDColumn(3, gapTrackLength);
166 analysisManager->AddNtupleRow();
170 G4int eventID =
event->GetEventID();
171 if ( eventID % fPrintModulo == 0) {
174 PrintEventStatistics(absoEdep, absoTrackLength, gapEdep, gapTrackLength);