Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
B4dEventAction Class Reference

#include <B4dEventAction.hh>

Inheritance diagram for B4dEventAction:
G4UserEventAction

Public Member Functions

 B4dEventAction ()
 
virtual ~B4dEventAction ()
 
virtual void BeginOfEventAction (const G4Event *event)
 
virtual void EndOfEventAction (const G4Event *event)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
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 45 of file B4dEventAction.hh.

Constructor & Destructor Documentation

B4dEventAction::B4dEventAction ( )

Definition at line 45 of file B4dEventAction.cc.

47  fAbsoEdepHCID(-1),
48  fGapEdepHCID(-1),
49  fAbsoTrackLengthHCID(-1),
50  fGapTrackLengthHCID(-1)
51 {}
B4dEventAction::~B4dEventAction ( )
virtual

Definition at line 55 of file B4dEventAction.cc.

56 {}

Member Function Documentation

void B4dEventAction::BeginOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 113 of file B4dEventAction.cc.

114 {}
void B4dEventAction::EndOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 118 of file B4dEventAction.cc.

References G4cout, G4endl, G4SDManager::GetCollectionID(), G4RunManager::GetPrintProgress(), G4RunManager::GetRunManager(), and G4SDManager::GetSDMpointer().

119 {
120  // Get hist collections IDs
121  if ( fAbsoEdepHCID == -1 ) {
122  fAbsoEdepHCID
123  = G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/Edep");
124  fGapEdepHCID
126  fAbsoTrackLengthHCID
127  = G4SDManager::GetSDMpointer()->GetCollectionID("Absorber/TrackLength");
128  fGapTrackLengthHCID
129  = G4SDManager::GetSDMpointer()->GetCollectionID("Gap/TrackLength");
130  }
131 
132  // Get sum values from hits collections
133  //
134  G4double absoEdep = GetSum(GetHitsCollection(fAbsoEdepHCID, event));
135  G4double gapEdep = GetSum(GetHitsCollection(fGapEdepHCID, event));
136 
137  G4double absoTrackLength
138  = GetSum(GetHitsCollection(fAbsoTrackLengthHCID, event));
139  G4double gapTrackLength
140  = GetSum(GetHitsCollection(fGapTrackLengthHCID, event));
141 
142  // get analysis manager
143  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
144 
145  // fill histograms
146  //
147  analysisManager->FillH1(1, absoEdep);
148  analysisManager->FillH1(2, gapEdep);
149  analysisManager->FillH1(3, absoTrackLength);
150  analysisManager->FillH1(4, gapTrackLength);
151 
152  // fill ntuple
153  //
154  analysisManager->FillNtupleDColumn(0, absoEdep);
155  analysisManager->FillNtupleDColumn(1, gapEdep);
156  analysisManager->FillNtupleDColumn(2, absoTrackLength);
157  analysisManager->FillNtupleDColumn(3, gapTrackLength);
158  analysisManager->AddNtupleRow();
159 
160  //print per event (modulo n)
161  //
162  G4int eventID = event->GetEventID();
164  if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
165  G4cout << "---> End of event: " << eventID << G4endl;
166  PrintEventStatistics(absoEdep, absoTrackLength, gapEdep, gapTrackLength);
167  }
168 }
G4int GetPrintProgress()
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:46
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76

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