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

Run action class. More...

#include <B3RunAction.hh>

Inheritance diagram for B3RunAction:
G4UserRunAction

Public Member Functions

 B3RunAction ()
 
virtual ~B3RunAction ()
 
virtual G4RunGenerateRun ()
 
virtual void BeginOfRunAction (const G4Run *)
 
virtual void EndOfRunAction (const G4Run *)
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()
 
void SetMaster (G4bool val=true)
 
G4bool IsMaster () const
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster
 

Detailed Description

Run action class.

Definition at line 41 of file B3RunAction.hh.

Constructor & Destructor Documentation

B3RunAction::B3RunAction ( )

Definition at line 42 of file B3RunAction.cc.

References python.hepunit::gray.

43  : G4UserRunAction()
44 {
45  //add new units for dose
46  //
47  const G4double milligray = 1.e-3*gray;
48  const G4double microgray = 1.e-6*gray;
49  const G4double nanogray = 1.e-9*gray;
50  const G4double picogray = 1.e-12*gray;
51 
52  new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray);
53  new G4UnitDefinition("microgray", "microGy" , "Dose", microgray);
54  new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray);
55  new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray);
56 }
double G4double
Definition: G4Types.hh:76
B3RunAction::~B3RunAction ( )
virtual

Definition at line 60 of file B3RunAction.cc.

61 { }

Member Function Documentation

void B3RunAction::BeginOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 70 of file B3RunAction.cc.

References G4cout, G4endl, G4Run::GetRunID(), G4RunManager::GetRunManager(), and G4RunManager::SetRandomNumberStore().

71 {
72  G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
73 
74  //inform the runManager to save random number seed
76 }
void SetRandomNumberStore(G4bool flag)
G4GLOB_DLL std::ostream G4cout
G4int GetRunID() const
Definition: G4Run.hh:76
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
#define G4endl
Definition: G4ios.hh:61
void B3RunAction::EndOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 80 of file B3RunAction.cc.

References G4BestUnit, G4cout, G4endl, B3Run::GetNbGoodEvents(), G4Run::GetNumberOfEvent(), G4ParticleGun::GetParticleDefinition(), B3PrimaryGeneratorAction::GetParticleGun(), G4ParticleDefinition::GetParticleName(), G4RunManager::GetRunManager(), B3Run::GetSumDose(), G4RunManager::GetUserPrimaryGeneratorAction(), and G4UserRunAction::IsMaster().

81 {
82  G4int nofEvents = run->GetNumberOfEvent();
83  if (nofEvents == 0) return;
84 
85  // Run conditions
86  // note: There is no primary generator action object for "master"
87  // run manager for multi-threaded mode.
88  const B3PrimaryGeneratorAction* generatorAction
89  = static_cast<const B3PrimaryGeneratorAction*>(
91  G4String partName;
92  if (generatorAction)
93  {
94  G4ParticleDefinition* particle
95  = generatorAction->GetParticleGun()->GetParticleDefinition();
96  partName = particle->GetParticleName();
97  }
98 
99  //results
100  //
101  const B3Run* b3Run = static_cast<const B3Run*>(run);
102  G4int nbGoodEvents = b3Run->GetNbGoodEvents();
103  G4double sumDose = b3Run->GetSumDose();
104 
105  //print
106  //
107  if (IsMaster())
108  {
109  G4cout
110  << "\n--------------------End of Global Run-----------------------"
111  << " \n The run was " << nofEvents << " events ";
112  }
113  else
114  {
115  G4cout
116  << "\n--------------------End of Local Run------------------------"
117  << " \n The run was " << nofEvents << " "<< partName;
118  }
119  G4cout
120  << "; Nb of 'good' e+ annihilations: " << nbGoodEvents
121  << "\n Total dose in patient : " << G4BestUnit(sumDose,"Dose")
122  << "\n------------------------------------------------------------\n"
123  << G4endl;
124 }
const G4VUserPrimaryGeneratorAction * GetUserPrimaryGeneratorAction() const
const G4ParticleGun * GetParticleGun() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
Definition: G4Run.hh:79
G4bool IsMaster() const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
G4double GetSumDose() const
Definition: B3Run.hh:53
Definition: B3Run.hh:42
G4ParticleDefinition * GetParticleDefinition() const
G4int GetNbGoodEvents() const
Definition: B3Run.hh:52
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
G4Run * B3RunAction::GenerateRun ( void  )
virtual

Reimplemented from G4UserRunAction.

Definition at line 65 of file B3RunAction.cc.

66 { return new B3Run; }
Definition: B3Run.hh:42

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