32 #include "B4Analysis.hh"
37 #include "G4HCofThisEvent.hh"
49 fAbsoTrackLengthHCID(-1),
50 fGapTrackLengthHCID(-1)
61 B4dEventAction::GetHitsCollection(
G4int hcID,
66 event->GetHCofThisEvent()->GetHC(hcID));
68 if ( ! hitsCollection ) {
70 msg <<
"Cannot access hitsCollection ID " << hcID;
75 return hitsCollection;
83 std::map<G4int, G4double*>::iterator it;
84 for ( it = hitsMap->
GetMap()->begin(); it != hitsMap->
GetMap()->end(); it++) {
85 sumValue += *(it->second);
92 void B4dEventAction::PrintEventStatistics(
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")
121 if ( fAbsoEdepHCID == -1 ) {
134 G4double absoEdep = GetSum(GetHitsCollection(fAbsoEdepHCID, event));
135 G4double gapEdep = GetSum(GetHitsCollection(fGapEdepHCID, event));
138 = GetSum(GetHitsCollection(fAbsoTrackLengthHCID, event));
140 = GetSum(GetHitsCollection(fGapTrackLengthHCID, event));
147 analysisManager->FillH1(1, absoEdep);
148 analysisManager->FillH1(2, gapEdep);
149 analysisManager->FillH1(3, absoTrackLength);
150 analysisManager->FillH1(4, 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 G4int eventID =
event->GetEventID();
164 if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
166 PrintEventStatistics(absoEdep, absoTrackLength, gapEdep, gapTrackLength);
virtual void BeginOfEventAction(const G4Event *event)
G4int GetCollectionID(G4String colName)
std::ostringstream G4ExceptionDescription
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4GLOB_DLL std::ostream G4cout
ExG4HbookAnalysisManager G4AnalysisManager
virtual void EndOfEventAction(const G4Event *event)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static G4RunManager * GetRunManager()
static G4SDManager * GetSDMpointer()
Definition of the B4dEventAction class.
std::map< G4int, T * > * GetMap() const
virtual ~B4dEventAction()