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

#include <B4aEventAction.hh>

Inheritance diagram for B4aEventAction:
Collaboration diagram for B4aEventAction:

Public Member Functions

 B4aEventAction ()
 
virtual ~B4aEventAction ()
 
virtual void BeginOfEventAction (const G4Event *event)
 
virtual void EndOfEventAction (const G4Event *event)
 
void AddAbs (G4double de, G4double dl)
 
void AddGap (G4double de, G4double dl)
 
- 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

It defines data members to hold the energy deposit and track lengths of charged particles in Absober and Gap layers:

  • fEnergyAbs, fEnergyGap, fTrackLAbs, fTrackLGap which are collected step by step via the functions
  • AddAbs(), AddGap()

Definition at line 45 of file B4aEventAction.hh.

Constructor & Destructor Documentation

B4aEventAction::B4aEventAction ( )

Definition at line 44 of file B4aEventAction.cc.

46  fEnergyAbs(0.),
47  fEnergyGap(0.),
48  fTrackLAbs(0.),
49  fTrackLGap(0.)
50 {}
B4aEventAction::~B4aEventAction ( )
virtual

Definition at line 54 of file B4aEventAction.cc.

55 {}

Member Function Documentation

void B4aEventAction::AddAbs ( G4double  de,
G4double  dl 
)
inline

Definition at line 66 of file B4aEventAction.hh.

66  {
67  fEnergyAbs += de;
68  fTrackLAbs += dl;
69 }

Here is the caller graph for this function:

void B4aEventAction::AddGap ( G4double  de,
G4double  dl 
)
inline

Definition at line 71 of file B4aEventAction.hh.

71  {
72  fEnergyGap += de;
73  fTrackLGap += dl;
74 }

Here is the caller graph for this function:

void B4aEventAction::BeginOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 59 of file B4aEventAction.cc.

60 {
61  // initialisation per event
62  fEnergyAbs = 0.;
63  fEnergyGap = 0.;
64  fTrackLAbs = 0.;
65  fTrackLGap = 0.;
66 }
void B4aEventAction::EndOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 70 of file B4aEventAction.cc.

71 {
72  // Accumulate statistics
73  //
74 
75  // get analysis manager
76  auto analysisManager = G4AnalysisManager::Instance();
77 
78  // fill histograms
79  analysisManager->FillH1(0, fEnergyAbs);
80  analysisManager->FillH1(1, fEnergyGap);
81  analysisManager->FillH1(2, fTrackLAbs);
82  analysisManager->FillH1(3, fTrackLGap);
83 
84  // fill ntuple
85  analysisManager->FillNtupleDColumn(0, fEnergyAbs);
86  analysisManager->FillNtupleDColumn(1, fEnergyGap);
87  analysisManager->FillNtupleDColumn(2, fTrackLAbs);
88  analysisManager->FillNtupleDColumn(3, fTrackLGap);
89  analysisManager->AddNtupleRow();
90 
91  // Print per event (modulo n)
92  //
93  auto eventID = event->GetEventID();
94  auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
95  if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
96  G4cout << "---> End of event: " << eventID << G4endl;
97 
98  G4cout
99  << " Absorber: total energy: " << std::setw(7)
100  << G4BestUnit(fEnergyAbs,"Energy")
101  << " total track length: " << std::setw(7)
102  << G4BestUnit(fTrackLAbs,"Length")
103  << G4endl
104  << " Gap: total energy: " << std::setw(7)
105  << G4BestUnit(fEnergyGap,"Energy")
106  << " total track length: " << std::setw(7)
107  << G4BestUnit(fTrackLGap,"Length")
108  << G4endl;
109  }
110 }
G4int GetPrintProgress()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
#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: