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

#include <B4cEventAction.hh>

Inheritance diagram for B4cEventAction:
Collaboration diagram for B4cEventAction:

Public Member Functions

 B4cEventAction ()
 
virtual ~B4cEventAction ()
 
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 46 of file B4cEventAction.hh.

Constructor & Destructor Documentation

B4cEventAction::B4cEventAction ( )

Definition at line 47 of file B4cEventAction.cc.

49  fAbsHCID(-1),
50  fGapHCID(-1)
51 {}
B4cEventAction::~B4cEventAction ( )
virtual

Definition at line 55 of file B4cEventAction.cc.

56 {}

Member Function Documentation

void B4cEventAction::BeginOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 100 of file B4cEventAction.cc.

101 {}
void B4cEventAction::EndOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 105 of file B4cEventAction.cc.

106 {
107  // Get hits collections IDs (only once)
108  if ( fAbsHCID == -1 ) {
109  fAbsHCID
110  = G4SDManager::GetSDMpointer()->GetCollectionID("AbsorberHitsCollection");
111  fGapHCID
112  = G4SDManager::GetSDMpointer()->GetCollectionID("GapHitsCollection");
113  }
114 
115  // Get hits collections
116  auto absoHC = GetHitsCollection(fAbsHCID, event);
117  auto gapHC = GetHitsCollection(fGapHCID, event);
118 
119  // Get hit with total values
120  auto absoHit = (*absoHC)[absoHC->entries()-1];
121  auto gapHit = (*gapHC)[gapHC->entries()-1];
122 
123  // Print per event (modulo n)
124  //
125  auto eventID = event->GetEventID();
126  auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
127  if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
128  G4cout << "---> End of event: " << eventID << G4endl;
129 
130  PrintEventStatistics(
131  absoHit->GetEdep(), absoHit->GetTrackLength(),
132  gapHit->GetEdep(), gapHit->GetTrackLength());
133  }
134 
135  // Fill histograms, ntuple
136  //
137 
138  // get analysis manager
139  auto analysisManager = G4AnalysisManager::Instance();
140 
141  // fill histograms
142  analysisManager->FillH1(0, absoHit->GetEdep());
143  analysisManager->FillH1(1, gapHit->GetEdep());
144  analysisManager->FillH1(2, absoHit->GetTrackLength());
145  analysisManager->FillH1(3, gapHit->GetTrackLength());
146 
147  // fill ntuple
148  analysisManager->FillNtupleDColumn(0, absoHit->GetEdep());
149  analysisManager->FillNtupleDColumn(1, gapHit->GetEdep());
150  analysisManager->FillNtupleDColumn(2, absoHit->GetTrackLength());
151  analysisManager->FillNtupleDColumn(3, gapHit->GetTrackLength());
152  analysisManager->AddNtupleRow();
153 }
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: