32 #include "B4Analysis.hh"
37 #include "G4HCofThisEvent.hh"
49 fAbsoTrackLengthHCID(-1),
50 fGapTrackLengthHCID(-1)
66 event->GetHCofThisEvent()->GetHC(hcID));
68 if ( ! hitsCollection ) {
70 msg <<
"Cannot access hitsCollection ID " << hcID;
75 return hitsCollection;
83 for (
auto it : *hitsMap->
GetMap() ) {
85 sumValue += *(it.second);
99 <<
" Absorber: total energy: "
100 << std::setw(7) <<
G4BestUnit(absoEdep,
"Energy")
101 <<
" total track length: "
102 << std::setw(7) <<
G4BestUnit(absoTrackLength,
"Length")
104 <<
" Gap: total energy: "
105 << std::setw(7) <<
G4BestUnit(gapEdep,
"Energy")
106 <<
" total track length: "
107 << std::setw(7) <<
G4BestUnit(gapTrackLength,
"Length")
143 auto analysisManager = G4AnalysisManager::Instance();
147 analysisManager->FillH1(0, absoEdep);
148 analysisManager->FillH1(1, gapEdep);
149 analysisManager->FillH1(2, absoTrackLength);
150 analysisManager->FillH1(3, gapTrackLength);
154 analysisManager->FillNtupleDColumn(0, absoEdep);
155 analysisManager->FillNtupleDColumn(1, gapEdep);
156 analysisManager->FillNtupleDColumn(2, absoTrackLength);
157 analysisManager->FillNtupleDColumn(3, gapTrackLength);
158 analysisManager->AddNtupleRow();
162 auto eventID =
event->GetEventID();
164 if ( ( printModulo > 0 ) && (
eventID % printModulo == 0 ) ) {
G4int GetCollectionID(G4String colName)
static G4RunManager * GetRunManager()
std::ostringstream G4ExceptionDescription
G4int fGapTrackLengthHCID
virtual ~B4dEventAction()
virtual void BeginOfEventAction(const G4Event *event)
virtual void EndOfEventAction(const G4Event *event)
Definition of the B4dEventAction class.
G4THitsMap< G4double > * GetHitsCollection(G4int hcID, const G4Event *event) const
G4int fAbsoTrackLengthHCID
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength) const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double GetSum(G4THitsMap< G4double > *hitsMap) const
static G4SDManager * GetSDMpointer()
G4GLOB_DLL std::ostream G4cout