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

#include <B4cEventAction.hh>

Inheritance diagram for B4cEventAction:
G4UserEventAction

Public Member Functions

 B4cEventAction ()
 
virtual ~B4cEventAction ()
 
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 46 of file B4cEventAction.hh.

Constructor & Destructor Documentation

B4cEventAction::B4cEventAction ( )

Definition at line 47 of file B4cEventAction.cc.

49  fAbsHCID(-1),
50  fGapHCID(-1)
51 {}
B4cEventAction::~B4cEventAction ( )
virtual

Definition at line 55 of file B4cEventAction.cc.

56 {}

Member Function Documentation

void B4cEventAction::BeginOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 100 of file B4cEventAction.cc.

101 {}
void B4cEventAction::EndOfEventAction ( const G4Event event)
virtual

Reimplemented from G4UserEventAction.

Definition at line 105 of file B4cEventAction.cc.

References G4THitsCollection< T >::entries(), G4cout, G4endl, G4SDManager::GetCollectionID(), B4cCalorHit::GetEdep(), G4RunManager::GetPrintProgress(), G4RunManager::GetRunManager(), G4SDManager::GetSDMpointer(), and B4cCalorHit::GetTrackLength().

106 {
107  // Get hits collections IDs (only once)
108  if ( fAbsHCID == -1 ) {
109  fAbsHCID
110  = G4SDManager::GetSDMpointer()->GetCollectionID("AbsorberHitsCollection");
111  fGapHCID
112  = G4SDManager::GetSDMpointer()->GetCollectionID("GapHitsCollection");
113  }
114 
115  // Get hits collections
116  B4cCalorHitsCollection* absoHC = GetHitsCollection(fAbsHCID, event);
117  B4cCalorHitsCollection* gapHC = GetHitsCollection(fGapHCID, event);
118 
119  // Get hit with total values
120  B4cCalorHit* absoHit = (*absoHC)[absoHC->entries()-1];
121  B4cCalorHit* gapHit = (*gapHC)[absoHC->entries()-1];
122 
123  // Print per event (modulo n)
124  //
125  G4int eventID = event->GetEventID();
127  if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
128  G4cout << "---> End of event: " << eventID << G4endl;
129 
130  PrintEventStatistics(
131  absoHit->GetEdep(), absoHit->GetTrackLength(),
132  gapHit->GetEdep(), gapHit->GetTrackLength());
133  }
134 
135  // Fill histograms, ntuple
136  //
137 
138  // get analysis manager
139  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
140 
141  // fill histograms
142  analysisManager->FillH1(1, absoHit->GetEdep());
143  analysisManager->FillH1(2, gapHit->GetEdep());
144  analysisManager->FillH1(3, absoHit->GetTrackLength());
145  analysisManager->FillH1(4, gapHit->GetTrackLength());
146 
147  // fill ntuple
148  analysisManager->FillNtupleDColumn(0, absoHit->GetEdep());
149  analysisManager->FillNtupleDColumn(1, gapHit->GetEdep());
150  analysisManager->FillNtupleDColumn(2, absoHit->GetTrackLength());
151  analysisManager->FillNtupleDColumn(3, gapHit->GetTrackLength());
152  analysisManager->AddNtupleRow();
153 }
G4int GetPrintProgress()
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:131
G4double GetTrackLength() const
Definition: B4cCalorHit.hh:109
int G4int
Definition: G4Types.hh:78
G4double GetEdep() const
Definition: B4cCalorHit.hh:105
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

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