Geant4  10.02.p03
B3bRun Class Reference

#include <B3bRun.hh>

Inheritance diagram for B3bRun:
Collaboration diagram for B3bRun:

Public Member Functions

 B3bRun ()
 
virtual ~B3bRun ()
 
virtual void RecordEvent (const G4Event *)
 
virtual void Merge (const G4Run *)
 
G4int GetNbGoodEvents () const
 
G4double GetSumDose () const
 
- Public Member Functions inherited from G4Run
 G4Run ()
 
virtual ~G4Run ()
 
G4int GetRunID () const
 
G4int GetNumberOfEvent () const
 
G4int GetNumberOfEventToBeProcessed () const
 
const G4HCtableGetHCtable () const
 
const G4DCtableGetDCtable () const
 
const G4StringGetRandomNumberStatus () const
 
void SetRunID (G4int id)
 
void SetNumberOfEventToBeProcessed (G4int n_ev)
 
void SetHCtable (G4HCtable *HCtbl)
 
void SetDCtable (G4DCtable *DCtbl)
 
void SetRandomNumberStatus (G4String &st)
 
void StoreEvent (G4Event *evt)
 
const std::vector< const G4Event * > * GetEventVector () const
 

Private Attributes

G4int fCollID_cryst
 
G4int fCollID_patient
 
G4int fPrintModulo
 
G4int fGoodEvents
 
G4double fSumDose
 

Additional Inherited Members

- Protected Attributes inherited from G4Run
G4int runID
 
G4int numberOfEvent
 
G4int numberOfEventToBeProcessed
 
G4HCtableHCtable
 
G4DCtableDCtable
 
G4String randomNumberStatus
 
std::vector< const G4Event * > * eventVector
 

Detailed Description

Run class

In RecordEvent() there is collected information event per event from Hits Collections, and accumulated statistic for the run

Definition at line 42 of file B3bRun.hh.

Constructor & Destructor Documentation

◆ B3bRun()

B3bRun::B3bRun ( )

Definition at line 43 of file B3bRun.cc.

44  : G4Run(),
45  fCollID_cryst(-1),
46  fCollID_patient(-1),
47  fPrintModulo(10000),
48  fGoodEvents(0),
49  fSumDose(0.)
50 { }
G4int fGoodEvents
Definition: B3bRun.hh:59
G4int fCollID_cryst
Definition: B3bRun.hh:56
G4int fPrintModulo
Definition: B3bRun.hh:58
G4Run()
Definition: G4Run.cc:34
G4double fSumDose
Definition: B3bRun.hh:60
G4int fCollID_patient
Definition: B3bRun.hh:57

◆ ~B3bRun()

B3bRun::~B3bRun ( )
virtual

Definition at line 54 of file B3bRun.cc.

55 { }

Member Function Documentation

◆ GetNbGoodEvents()

G4int B3bRun::GetNbGoodEvents ( ) const
inline

Definition at line 52 of file B3bRun.hh.

52 { return fGoodEvents; }
G4int fGoodEvents
Definition: B3bRun.hh:59
Here is the caller graph for this function:

◆ GetSumDose()

G4double B3bRun::GetSumDose ( ) const
inline

Definition at line 53 of file B3bRun.hh.

53 { return fSumDose; }
G4double fSumDose
Definition: B3bRun.hh:60
Here is the caller graph for this function:

◆ Merge()

void B3bRun::Merge ( const G4Run aRun)
virtual

Reimplemented from G4Run.

Definition at line 118 of file B3bRun.cc.

119 {
120  const B3bRun* localRun = static_cast<const B3bRun*>(aRun);
121  fGoodEvents += localRun->fGoodEvents;
122  fSumDose += localRun->fSumDose;
123 
124  G4Run::Merge(aRun);
125 }
G4int fGoodEvents
Definition: B3bRun.hh:59
virtual void Merge(const G4Run *)
Definition: G4Run.cc:54
Definition: B3bRun.hh:42
G4double fSumDose
Definition: B3bRun.hh:60
Here is the call graph for this function:

◆ RecordEvent()

void B3bRun::RecordEvent ( const G4Event event)
virtual

G4int copyNb = (itr->first); G4cout << G4endl << " cryst" << copyNb << ": " << edep/keV << " keV ";

G4int copyNb = (itr->first);

Reimplemented from G4Run.

Definition at line 59 of file B3bRun.cc.

60 {
61  if ( fCollID_cryst < 0 ) {
63  = G4SDManager::GetSDMpointer()->GetCollectionID("crystal/edep");
64  //G4cout << " fCollID_cryst: " << fCollID_cryst << G4endl;
65  }
66 
67  if ( fCollID_patient < 0 ) {
69  = G4SDManager::GetSDMpointer()->GetCollectionID("patient/dose");
70  //G4cout << " fCollID_patient: " << fCollID_patient << G4endl;
71  }
72 
73  G4int evtNb = event->GetEventID();
74 
75  if (evtNb%fPrintModulo == 0) {
76  G4cout << G4endl << "---> end of event: " << evtNb << G4endl;
77  }
78 
79  //Hits collections
80  //
81  G4HCofThisEvent* HCE = event->GetHCofThisEvent();
82  if(!HCE) return;
83 
84  //Energy in crystals : identify 'good events'
85  //
86  const G4double eThreshold = 500*keV;
87  G4int nbOfFired = 0;
88 
89  G4THitsMap<G4double>* evtMap =
90  static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_cryst));
91 
92  std::map<G4int,G4double*>::iterator itr;
93  for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
94  G4double edep = *(itr->second);
95  if (edep > eThreshold) nbOfFired++;
98  }
99  if (nbOfFired == 2) fGoodEvents++;
100 
101  //Dose deposit in patient
102  //
103  G4double dose = 0.;
104 
105  evtMap = static_cast<G4THitsMap<G4double>*>(HCE->GetHC(fCollID_patient));
106 
107  for (itr = evtMap->GetMap()->begin(); itr != evtMap->GetMap()->end(); itr++) {
109  dose = *(itr->second);
110  }
111  fSumDose += dose;
112 
113  G4Run::RecordEvent(event);
114 }
G4int fGoodEvents
Definition: B3bRun.hh:59
G4int fCollID_cryst
Definition: B3bRun.hh:56
G4int GetCollectionID(G4String colName)
Definition: G4SDManager.cc:135
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:68
G4int fPrintModulo
Definition: B3bRun.hh:58
Float_t dose
int G4int
Definition: G4Types.hh:78
Double_t edep
G4GLOB_DLL std::ostream G4cout
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
virtual void RecordEvent(const G4Event *)
Definition: G4Run.cc:51
#define G4endl
Definition: G4ios.hh:61
G4double fSumDose
Definition: B3bRun.hh:60
static const double keV
Definition: G4SIunits.hh:213
double G4double
Definition: G4Types.hh:76
G4int fCollID_patient
Definition: B3bRun.hh:57
Here is the call graph for this function:

Member Data Documentation

◆ fCollID_cryst

G4int B3bRun::fCollID_cryst
private

Definition at line 56 of file B3bRun.hh.

◆ fCollID_patient

G4int B3bRun::fCollID_patient
private

Definition at line 57 of file B3bRun.hh.

◆ fGoodEvents

G4int B3bRun::fGoodEvents
private

Definition at line 59 of file B3bRun.hh.

◆ fPrintModulo

G4int B3bRun::fPrintModulo
private

Definition at line 58 of file B3bRun.hh.

◆ fSumDose

G4double B3bRun::fSumDose
private

Definition at line 60 of file B3bRun.hh.


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