Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
B4b::EventAction Class Reference
basic » B4 » B4b

Event action class. More...

#include <Doxymodules_basic.h>

Inheritance diagram for B4b::EventAction:
G4UserEventAction

Public Member Functions

 EventAction ()=default
 
 ~EventAction () override=default
 
void BeginOfEventAction (const G4Event *event) override
 
void EndOfEventAction (const G4Event *event) override
 

Private Member Functions

void PrintEventStatistics (G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength) const
 

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 RunData object.

Definition at line 141 of file Doxymodules_basic.h.

Constructor & Destructor Documentation

◆ EventAction()

B4b::EventAction::EventAction ( )
default

◆ ~EventAction()

B4b::EventAction::~EventAction ( )
overridedefault

Member Function Documentation

◆ BeginOfEventAction()

void B4b::EventAction::BeginOfEventAction ( const G4Event event)
override

Definition at line 65 of file EventAction.cc.

66{
67 auto runData
68 = static_cast<RunData*>(
69 G4RunManager::GetRunManager()->GetNonConstCurrentRun());
70 runData->Reset();
71}

◆ EndOfEventAction()

void B4b::EventAction::EndOfEventAction ( const G4Event event)
override

Definition at line 75 of file EventAction.cc.

76{
77 auto runData
78 = static_cast<RunData*>(
79 G4RunManager::GetRunManager()->GetNonConstCurrentRun());
80 runData->FillPerEvent();
81
82 //print per event (modulo n)
83 //
84 auto eventID = event->GetEventID();
85 auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
86 if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
88 runData->GetEdep(kAbs),
89 runData->GetTrackLength(kAbs),
90 runData->GetEdep(kGap),
91 runData->GetTrackLength(kGap));
92 G4cout << "--> End of event " << eventID << "\n" << G4endl;
93 }
94}
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength) const
const G4int kGap
Definition RunData.hh:44
const G4int kAbs
Definition RunData.hh:43

◆ PrintEventStatistics()

void B4b::EventAction::PrintEventStatistics ( G4double  absoEdep,
G4double  absoTrackLength,
G4double  gapEdep,
G4double  gapTrackLength 
) const
private

Definition at line 45 of file EventAction.cc.

48{
49 // print event statistics
50 G4cout
51 << " Absorber: total energy: "
52 << std::setw(7) << G4BestUnit(absoEdep, "Energy")
53 << " total track length: "
54 << std::setw(7) << G4BestUnit(absoTrackLength, "Length")
55 << G4endl
56 << " Gap: total energy: "
57 << std::setw(7) << G4BestUnit(gapEdep, "Energy")
58 << " total track length: "
59 << std::setw(7) << G4BestUnit(gapTrackLength, "Length")
60 << G4endl;
61}

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

Applications | User Support | Publications | Collaboration