Geant4  10.02.p03
B4bRunAction Class Reference

#include <B4bRunAction.hh>

Inheritance diagram for B4bRunAction:
Collaboration diagram for B4bRunAction:

Public Member Functions

 B4bRunAction ()
 
virtual ~B4bRunAction ()
 
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

It accumulates statistic and computes dispersion of the energy deposit and track lengths of charged particles with use of analysis tools: H1D histograms are created in BeginOfRunAction() for the following physics quantities:

  • Edep in absorber
  • Edep in gap
  • Track length in absorber
  • Track length in gap The same values are also saved in the ntuple. The histograms and ntuple are saved in the output file in a format accoring to a selected technology in B4Analysis.hh.

In EndOfRunAction(), the accumulated statistic and computed dispersion is printed.

Definition at line 57 of file B4bRunAction.hh.

Constructor & Destructor Documentation

◆ B4bRunAction()

B4bRunAction::B4bRunAction ( )

Definition at line 42 of file B4bRunAction.cc.

43  : G4UserRunAction()
44 {
45  // set printing event number per each event
47 
48  // Create analysis manager
49  // The choice of analysis technology is done via selectin of a namespace
50  // in B4Analysis.hh
51  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
52  G4cout << "Using " << analysisManager->GetType() << G4endl;
53 
54  // Create directories
55  //analysisManager->SetHistoDirectoryName("histograms");
56  //analysisManager->SetNtupleDirectoryName("ntuple");
57  analysisManager->SetVerboseLevel(1);
58  analysisManager->SetFirstHistoId(1);
59 
60  // Book histograms, ntuple
61  //
62 
63  // Creating histograms
64  analysisManager->CreateH1("1","Edep in absorber", 100, 0., 800*MeV);
65  analysisManager->CreateH1("2","Edep in gap", 100, 0., 100*MeV);
66  analysisManager->CreateH1("3","trackL in absorber", 100, 0., 1*m);
67  analysisManager->CreateH1("4","trackL in gap", 100, 0., 50*cm);
68 
69  // Creating ntuple
70  //
71  analysisManager->CreateNtuple("B4", "Edep and TrackL");
72  analysisManager->CreateNtupleDColumn("Eabs");
73  analysisManager->CreateNtupleDColumn("Egap");
74  analysisManager->CreateNtupleDColumn("Labs");
75  analysisManager->CreateNtupleDColumn("Lgap");
76  analysisManager->FinishNtuple();
77 }
static const double cm
Definition: G4SIunits.hh:118
static const double MeV
Definition: G4SIunits.hh:211
void SetPrintProgress(G4int i)
G4GLOB_DLL std::ostream G4cout
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:66
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:79
#define G4endl
Definition: G4ios.hh:61
static const double m
Definition: G4SIunits.hh:128
Here is the call graph for this function:

◆ ~B4bRunAction()

B4bRunAction::~B4bRunAction ( )
virtual

Definition at line 81 of file B4bRunAction.cc.

82 {
83  delete G4AnalysisManager::Instance();
84 }

Member Function Documentation

◆ BeginOfRunAction()

void B4bRunAction::BeginOfRunAction ( const G4Run run)
virtual

Reimplemented from G4UserRunAction.

Definition at line 95 of file B4bRunAction.cc.

96 {
97  G4cout << "### Run " << run->GetRunID() << " start." << G4endl;
98 
99  //inform the runManager to save random number seed
100  //G4RunManager::GetRunManager()->SetRandomNumberStore(true);
101 
102  // Get analysis manager
103  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
104 
105  // Open an output file
106  //
107  G4String fileName = "B4";
108  analysisManager->OpenFile(fileName);
109 }
G4GLOB_DLL std::ostream G4cout
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:66
G4int GetRunID() const
Definition: G4Run.hh:76
#define G4endl
Definition: G4ios.hh:61
Here is the call graph for this function:

◆ EndOfRunAction()

void B4bRunAction::EndOfRunAction ( const G4Run )
virtual

Reimplemented from G4UserRunAction.

Definition at line 113 of file B4bRunAction.cc.

114 {
115  // print histogram statistics
116  //
117  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
118  if ( analysisManager->GetH1(1) ) {
119  G4cout << G4endl << " ----> print histograms statistic ";
120  if(isMaster) {
121  G4cout << "for the entire run " << G4endl << G4endl;
122  }
123  else {
124  G4cout << "for the local thread " << G4endl << G4endl;
125  }
126 
127  G4cout << " EAbs : mean = "
128  << G4BestUnit(analysisManager->GetH1(1)->mean(), "Energy")
129  << " rms = "
130  << G4BestUnit(analysisManager->GetH1(1)->rms(), "Energy") << G4endl;
131 
132  G4cout << " EGap : mean = "
133  << G4BestUnit(analysisManager->GetH1(2)->mean(), "Energy")
134  << " rms = "
135  << G4BestUnit(analysisManager->GetH1(2)->rms(), "Energy") << G4endl;
136 
137  G4cout << " LAbs : mean = "
138  << G4BestUnit(analysisManager->GetH1(3)->mean(), "Length")
139  << " rms = "
140  << G4BestUnit(analysisManager->GetH1(3)->rms(), "Length") << G4endl;
141 
142  G4cout << " LGap : mean = "
143  << G4BestUnit(analysisManager->GetH1(4)->mean(), "Length")
144  << " rms = "
145  << G4BestUnit(analysisManager->GetH1(4)->rms(), "Length") << G4endl;
146  }
147 
148  // save histograms & ntuple
149  //
150  analysisManager->Write();
151  analysisManager->CloseFile();
152 
153 }
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4GLOB_DLL std::ostream G4cout
ExG4HbookAnalysisManager G4AnalysisManager
Definition: g4hbook_defs.hh:66
#define G4endl
Definition: G4ios.hh:61

◆ GenerateRun()

G4Run * B4bRunAction::GenerateRun ( void  )
virtual

Reimplemented from G4UserRunAction.

Definition at line 88 of file B4bRunAction.cc.

89 {
90  return (new B4bRunData);
91 }

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