Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UltraRunAction Class Reference

#include <UltraRunAction.hh>

Inheritance diagram for UltraRunAction:
Collaboration diagram for UltraRunAction:

Public Member Functions

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

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster
 

Detailed Description

Definition at line 49 of file UltraRunAction.hh.

Constructor & Destructor Documentation

UltraRunAction::UltraRunAction ( )

Definition at line 51 of file UltraRunAction.cc.

52 {
53  seed = -1; // RANLUX seed
54  luxury = 3; // RANLUX luxury level (3 is default)
55  saveRndm = 1;
56 }
UltraRunAction::~UltraRunAction ( )

Definition at line 60 of file UltraRunAction.cc.

61 {;}

Member Function Documentation

void UltraRunAction::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 65 of file UltraRunAction.cc.

66 {
67  // Get/create analysis manager: need to do that in the master and in the workers
68  G4AnalysisManager* man = G4AnalysisManager::Instance();
69 
70  // Open an output file
71  man->OpenFile("ultra");
72  man->SetFirstHistoId(1);
73 
74  // Create histogram(s)
75  man->CreateH1("1","Optical photons energy (eV)", //histoID,histo name
76  500,0.,5.); //bins' number, xmin, xmax
77  man->CreateH1("2","Number of Detected Photons",
78  10,0.,10.); //bins' number, xmin, xmax
79 
80  if (!IsMaster()) //it is a slave, do nothing else
81  {
82  G4cout << "ooo Run " << aRun->GetRunID() << " starts on slave." << G4endl;
83  return;
84  }
85 
86  //Master or sequential
87  G4cout << "ooo Run " << aRun->GetRunID() << " starts (global)." << G4endl;
88  if (seed<0) //not initialized by anybody else
89  {
90  seed=time(0);
91  G4Random::setTheSeed(seed,luxury);
92  G4Random::showEngineStatus();
93  }
94 
95  // save Rndm status
96  if (saveRndm > 0)
97  G4Random::saveEngineStatus("beginOfRun.rndm");
98 
99  return;
100 }
G4bool SetFirstHistoId(G4int firstId)
G4int CreateH1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")
G4bool OpenFile(const G4String &fileName="")
G4GLOB_DLL std::ostream G4cout
G4bool IsMaster() const
G4int GetRunID() const
Definition: G4Run.hh:76
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

void UltraRunAction::EndOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 104 of file UltraRunAction.cc.

105 {
106  // Write histograms to file
107 
108 
109  // Save histograms
110  G4AnalysisManager* man = G4AnalysisManager::Instance();
111  man->Write();
112  man->CloseFile();
113  // Complete clean-up
114  delete G4AnalysisManager::Instance();
115 
116  if (!IsMaster())
117  {
118  G4cout << "### Run " << aRun->GetRunID() << " (slave) ended." << G4endl;
119  return;
120  }
121 
122  G4cout << "### Run " << aRun->GetRunID() << " (global) ended." << G4endl;
123  // save Rndm status
124  if (saveRndm == 1)
125  G4Random::saveEngineStatus("endOfRun.rndm");
126  return;
127 }
G4GLOB_DLL std::ostream G4cout
G4bool IsMaster() const
G4int GetRunID() const
Definition: G4Run.hh:76
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:


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