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

#include <HadrontherapyEventAction.hh>

Inheritance diagram for HadrontherapyEventAction:
G4UserEventAction

Public Member Functions

 HadrontherapyEventAction ()
 
 ~HadrontherapyEventAction ()
 
void BeginOfEventAction (const G4Event *)
 
void EndOfEventAction (const G4Event *)
 
void SetPrintModulo (G4int val)
 
void SetDrawFlag (G4String val)
 
- 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 44 of file HadrontherapyEventAction.hh.

Constructor & Destructor Documentation

HadrontherapyEventAction::HadrontherapyEventAction ( )

Definition at line 51 of file HadrontherapyEventAction.cc.

51  :
52  drawFlag("all" ),printModulo(1000), pointerEventMessenger(0)
53 {
54  hitsCollectionID = -1;
55  pointerEventMessenger = new HadrontherapyEventActionMessenger(this);
56 }
HadrontherapyEventAction::~HadrontherapyEventAction ( )

Definition at line 59 of file HadrontherapyEventAction.cc.

60 {
61  delete pointerEventMessenger;
62 }

Member Function Documentation

void HadrontherapyEventAction::BeginOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 65 of file HadrontherapyEventAction.cc.

References G4cout, G4endl, G4Event::GetEventID(), and G4SDManager::GetSDMpointer().

66 {
67  G4int evtNb = evt->GetEventID();
68 
69  //printing survey
70  if (evtNb%printModulo == 0)
71  G4cout << "\n---> Begin of Event: " << evtNb << G4endl;
72 
74  if(hitsCollectionID == -1)
75  hitsCollectionID = pSDManager -> GetCollectionID("HadrontherapyDetectorHitsCollection");
76 
77 }
int G4int
Definition: G4Types.hh:78
G4int GetEventID() const
Definition: G4Event.hh:140
G4GLOB_DLL std::ostream G4cout
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
#define G4endl
Definition: G4ios.hh:61
void HadrontherapyEventAction::EndOfEventAction ( const G4Event evt)
virtual

Reimplemented from G4UserEventAction.

Definition at line 80 of file HadrontherapyEventAction.cc.

References HadrontherapyMatrix::GetInstance(), and python.hepunit::MeV.

81 {
82  if(hitsCollectionID < 0)
83  return;
84  G4HCofThisEvent* HCE = evt -> GetHCofThisEvent();
85 
86  // Clear voxels hit list
88  if (matrix) matrix -> ClearHitTrack();
89 
90  if(HCE)
91  {
92  HadrontherapyDetectorHitsCollection* CHC = (HadrontherapyDetectorHitsCollection*)(HCE -> GetHC(hitsCollectionID));
93  if(CHC)
94  {
95  if(matrix)
96  {
97  // Fill the matrix with the information: voxel and associated energy deposit
98  // in the detector at the end of the event
99 
100  G4int HitCount = CHC -> entries();
101  for (G4int h=0; h<HitCount; h++)
102  {
103  G4int i = ((*CHC)[h]) -> GetXID();
104  G4int j = ((*CHC)[h]) -> GetYID();
105  G4int k = ((*CHC)[h]) -> GetZID();
106  G4double energyDeposit = ((*CHC)[h]) -> GetEdep();
107  matrix -> Fill(i, j, k, energyDeposit/MeV);
108  }
109  }
110  }
111  }
112 }
int G4int
Definition: G4Types.hh:78
static HadrontherapyMatrix * GetInstance()
double G4double
Definition: G4Types.hh:76
void HadrontherapyEventAction::SetDrawFlag ( G4String  val)
inline

Definition at line 59 of file HadrontherapyEventAction.hh.

Referenced by HadrontherapyEventActionMessenger::SetNewValue().

60  {
61  drawFlag = val;
62  };
void HadrontherapyEventAction::SetPrintModulo ( G4int  val)
inline

Definition at line 54 of file HadrontherapyEventAction.hh.

Referenced by HadrontherapyEventActionMessenger::SetNewValue().

55  {
56  printModulo = val;
57  };

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