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

#include <ExN04EventAction.hh>

Inheritance diagram for ExN04EventAction:
G4UserEventAction G4UserEventAction

Public Member Functions

 ExN04EventAction ()
 
 ~ExN04EventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
 ExN04EventAction ()
 
 ~ExN04EventAction ()
 
void BeginOfEventAction (const G4Event *)
 
void EndOfEventAction (const G4Event *)
 
- Public Member Functions inherited from G4UserEventAction
 G4UserEventAction ()
 
virtual ~G4UserEventAction ()
 
void SetEventManager (G4EventManager *value)
 

Additional Inherited Members

- Protected Attributes inherited from G4UserEventAction
G4EventManagerfpEventManager
 

Detailed Description

Definition at line 38 of file eventgenerator/HepMC/HepMCEx01/include/ExN04EventAction.hh.

Constructor & Destructor Documentation

ExN04EventAction::ExN04EventAction ( )

Definition at line 46 of file eventgenerator/HepMC/HepMCEx01/src/ExN04EventAction.cc.

47 {
48  ftrackerCollID = -1;
49  fcalorimeterCollID = -1;
50  fmuonCollID = -1;
51 }
ExN04EventAction::~ExN04EventAction ( )

Definition at line 54 of file eventgenerator/HepMC/HepMCEx01/src/ExN04EventAction.cc.

55 {
56 }
ExN04EventAction::ExN04EventAction ( )
ExN04EventAction::~ExN04EventAction ( )

Member Function Documentation

void ExN04EventAction::BeginOfEventAction ( const G4Event )
virtual

Reimplemented from G4UserEventAction.

Definition at line 59 of file eventgenerator/HepMC/HepMCEx01/src/ExN04EventAction.cc.

References G4SDManager::GetSDMpointer().

60 {
62  if ( ftrackerCollID<0 || fcalorimeterCollID<0 || fmuonCollID<0) {
63  G4String colNam;
64  ftrackerCollID = SDman-> GetCollectionID(colNam="trackerCollection");
65  fcalorimeterCollID = SDman-> GetCollectionID(colNam="calCollection");
66  fmuonCollID = SDman-> GetCollectionID(colNam="muonCollection");
67  }
68 }
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
void ExN04EventAction::BeginOfEventAction ( const G4Event )
virtual

Reimplemented from G4UserEventAction.

void ExN04EventAction::EndOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 71 of file eventgenerator/HepMC/HepMCEx01/src/ExN04EventAction.cc.

References G4cout, G4endl, G4Event::GetEventID(), G4HCofThisEvent::GetHC(), and python.hepunit::GeV.

72 {
73  G4cout << ">>> Event " << evt->GetEventID() << G4endl;
74 
75  if( ftrackerCollID<0 || fcalorimeterCollID<0 || fmuonCollID<0) return;
76 
77  G4HCofThisEvent* HCE = evt-> GetHCofThisEvent();
78  ExN04TrackerHitsCollection* THC = NULL;
80  ExN04MuonHitsCollection* MHC = NULL;
81 
82  if( HCE ) {
83  THC = (ExN04TrackerHitsCollection*)(HCE->GetHC(ftrackerCollID));
84  CHC = (ExN04CalorimeterHitsCollection*)(HCE->GetHC(fcalorimeterCollID));
85  MHC = (ExN04MuonHitsCollection*)(HCE->GetHC(fmuonCollID));
86  }
87 
88  if( THC ) {
89  G4int n_hit = THC-> entries();
90  G4cout << " " << n_hit
91  << " hits are stored in ExN04TrackerHitsCollection." << G4endl;
92  }
93 
94  if( CHC ) {
95  G4int n_hit = CHC-> entries();
96  G4cout << " " << n_hit
97  << " hits are stored in ExN04CalorimeterHitsCollection." << G4endl;
98  G4double totE = 0;
99  for( int i = 0; i < n_hit; i++ ) {
100  totE += (*CHC)[i]-> GetEdep();
101  }
102  G4cout << " Total energy deposition in calorimeter : "
103  << totE / GeV << " (GeV)" << G4endl;
104  }
105 
106  if( MHC ) {
107  G4int n_hit = MHC-> entries();
108  G4cout << " " << n_hit
109  << " hits are stored in ExN04MuonHitsCollection." << G4endl;
110  }
111 }
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void ExN04EventAction::EndOfEventAction ( const G4Event )
virtual

Reimplemented from G4UserEventAction.


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