Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
GarfieldEventAction Class Reference

#include <GarfieldEventAction.hh>

+ Inheritance diagram for GarfieldEventAction:

Public Member Functions

 GarfieldEventAction ()
 
virtual ~GarfieldEventAction ()
 
virtual void BeginOfEventAction (const G4Event *event)
 
virtual void EndOfEventAction (const G4Event *event)
 
void AddAbs (G4double de, G4double dl)
 
void AddGas (G4double de)
 

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 GarfieldEventAction.hh.

Constructor & Destructor Documentation

◆ GarfieldEventAction()

GarfieldEventAction::GarfieldEventAction ( )

Definition at line 45 of file GarfieldEventAction.cc.

46 : G4UserEventAction(), fEnergyAbs(0.), fEnergyGas(0.), fTrackLAbs(0.) {}

◆ ~GarfieldEventAction()

GarfieldEventAction::~GarfieldEventAction ( )
virtual

Definition at line 50 of file GarfieldEventAction.cc.

50{}

Member Function Documentation

◆ AddAbs()

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

Definition at line 66 of file GarfieldEventAction.hh.

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

Referenced by GarfieldSteppingAction::UserSteppingAction().

◆ AddGas()

void GarfieldEventAction::AddGas ( G4double  de)
inline

Definition at line 71 of file GarfieldEventAction.hh.

71{ fEnergyGas += de; }

Referenced by GarfieldSteppingAction::UserSteppingAction().

◆ BeginOfEventAction()

void GarfieldEventAction::BeginOfEventAction ( const G4Event *  event)
virtual

Definition at line 54 of file GarfieldEventAction.cc.

54 {
55 // initialisation per event
56 fEnergyAbs = 0;
57 fEnergyGas = 0;
58 fTrackLAbs = 0;
59 fAvalancheSize = 0;
60 fGain = 0;
61
63 garfieldPhysics->Clear();
64}
static GarfieldPhysics * GetInstance()

◆ EndOfEventAction()

void GarfieldEventAction::EndOfEventAction ( const G4Event *  event)
virtual

Definition at line 68 of file GarfieldEventAction.cc.

68 {
69 // Accumulate statistics
70 //
72
73 // get analysis manager
74 G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
75 // fEnergyGas += garfieldPhysics->GetEnergyDeposit_MeV();
76 fAvalancheSize = garfieldPhysics->GetAvalancheSize();
77 fGain = garfieldPhysics->GetGain();
78
79 // fill histograms
80 analysisManager->FillH1(1, fEnergyAbs);
81 analysisManager->FillH1(2, fTrackLAbs);
82 analysisManager->FillH1(3, fEnergyGas);
83 analysisManager->FillH1(4, fAvalancheSize);
84 analysisManager->FillH1(5, fGain);
85
86 // fill ntuple
87 analysisManager->FillNtupleDColumn(0, fEnergyAbs);
88 analysisManager->FillNtupleDColumn(1, fTrackLAbs);
89 analysisManager->FillNtupleDColumn(2, fEnergyGas);
90 analysisManager->FillNtupleDColumn(3, fAvalancheSize);
91 analysisManager->FillNtupleDColumn(4, fGain);
92
93 // Print per event (modulo n)
94 //
95 G4int eventID = event->GetEventID();
96 G4int printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
97 if ((printModulo > 0) && (eventID % printModulo == 0)) {
98 G4cout << "---> End of event: " << eventID << G4endl;
99
100 G4cout << " Absorber: total energy: " << std::setw(7)
101 << G4BestUnit(fEnergyAbs, "Energy")
102 << " total track length: " << std::setw(7)
103 << G4BestUnit(fTrackLAbs, "Length") << G4endl;
104
105 G4cout << " Gas: total energy: " << std::setw(7)
106 << G4BestUnit(fEnergyGas, "Energy")
107 << " avalanche size: " << fAvalancheSize
108 << " gain: " << fGain << G4endl;
109 }
110}
double GetAvalancheSize()

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