Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
B4dEventAction Class Reference

#include <B4dEventAction.hh>

Inheritance diagram for B4dEventAction:
Collaboration diagram for B4dEventAction:

Public Member Functions

 B4dEventAction ()
 
virtual ~B4dEventAction ()
 
virtual void BeginOfEventAction (const G4Event *event)
 
virtual void EndOfEventAction (const G4Event *event)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
virtual void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Event action class

In EndOfEventAction(), it prints the accumulated quantities of the energy deposit and track lengths of charged particles in Absober and Gap layers stored in the hits collections.

Definition at line 45 of file B4dEventAction.hh.

Constructor & Destructor Documentation

B4dEventAction::B4dEventAction ( )

Definition at line 45 of file B4dEventAction.cc.

47  fAbsoEdepHCID(-1),
48  fGapEdepHCID(-1),
49  fAbsoTrackLengthHCID(-1),
50  fGapTrackLengthHCID(-1)
51 {}
B4dEventAction::~B4dEventAction ( )
virtual

Definition at line 55 of file B4dEventAction.cc.

56 {}

Member Function Documentation

void B4dEventAction::BeginOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 113 of file B4dEventAction.cc.

114 {}
void B4dEventAction::EndOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 118 of file B4dEventAction.cc.

119 {
120  // Get hist collections IDs
121  if ( fAbsoEdepHCID == -1 ) {
122  fAbsoEdepHCID
123  = G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/Edep");
124  fGapEdepHCID
126  fAbsoTrackLengthHCID
127  = G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/TrackLength");
128  fGapTrackLengthHCID
129  = G4SDManager::GetSDMpointer()->GetCollectionID("Gap/TrackLength");
130  }
131 
132  // Get sum values from hits collections
133  //
134  auto absoEdep = GetSum(GetHitsCollection(fAbsoEdepHCID, event));
135  auto gapEdep = GetSum(GetHitsCollection(fGapEdepHCID, event));
136 
137  auto absoTrackLength
138  = GetSum(GetHitsCollection(fAbsoTrackLengthHCID, event));
139  auto gapTrackLength
140  = GetSum(GetHitsCollection(fGapTrackLengthHCID, event));
141 
142  // get analysis manager
143  auto analysisManager = G4AnalysisManager::Instance();
144 
145  // fill histograms
146  //
147  analysisManager->FillH1(0, absoEdep);
148  analysisManager->FillH1(1, gapEdep);
149  analysisManager->FillH1(2, absoTrackLength);
150  analysisManager->FillH1(3, gapTrackLength);
151 
152  // fill ntuple
153  //
154  analysisManager->FillNtupleDColumn(0, absoEdep);
155  analysisManager->FillNtupleDColumn(1, gapEdep);
156  analysisManager->FillNtupleDColumn(2, absoTrackLength);
157  analysisManager->FillNtupleDColumn(3, gapTrackLength);
158  analysisManager->AddNtupleRow();
159 
160  //print per event (modulo n)
161  //
162  auto eventID = event->GetEventID();
163  auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
164  if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
165  G4cout << "---> End of event: " << eventID << G4endl;
166  PrintEventStatistics(absoEdep, absoTrackLength, gapEdep, gapTrackLength);
167  }
168 }
G4int GetPrintProgress()
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:


The documentation for this class was generated from the following files: