Garfield++ v2r0
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 46 of file GarfieldEventAction.cc.

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

◆ ~GarfieldEventAction()

GarfieldEventAction::~GarfieldEventAction ( )
virtual

Definition at line 52 of file GarfieldEventAction.cc.

52 {
53}

Member Function Documentation

◆ AddAbs()

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

Definition at line 68 of file GarfieldEventAction.hh.

68 {
69 fEnergyAbs += de;
70 fTrackLAbs += dl;
71}

Referenced by GarfieldSteppingAction::UserSteppingAction().

◆ AddGas()

void GarfieldEventAction::AddGas ( G4double  de)
inline

Definition at line 73 of file GarfieldEventAction.hh.

73 {
74 fEnergyGas += de;
75
76}

Referenced by GarfieldSteppingAction::UserSteppingAction().

◆ BeginOfEventAction()

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

Definition at line 57 of file GarfieldEventAction.cc.

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

◆ EndOfEventAction()

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

Definition at line 71 of file GarfieldEventAction.cc.

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

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