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

Run action class. More...

#include <B5RunAction.hh>

Inheritance diagram for B5RunAction:
Collaboration diagram for B5RunAction:

Public Member Functions

 B5RunAction (B5EventAction *eventAction)
 
virtual ~B5RunAction ()
 
virtual void BeginOfRunAction (const G4Run *)
 
virtual void EndOfRunAction (const G4Run *)
 
- 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

Run action class.

Definition at line 43 of file B5RunAction.hh.

Constructor & Destructor Documentation

B5RunAction::B5RunAction ( B5EventAction eventAction)

Definition at line 41 of file B5RunAction.cc.

42  : G4UserRunAction(),
43  fEventAction(eventAction)
44 {
45  // Create analysis manager
46  // The choice of analysis technology is done via selectin of a namespace
47  // in B5Analysis.hh
48  auto analysisManager = G4AnalysisManager::Instance();
49  G4cout << "Using " << analysisManager->GetType() << G4endl;
50 
51  // Default settings
52  analysisManager->SetNtupleMerging(true);
53  // Note: merging ntuples is available only with Root output
54  analysisManager->SetVerboseLevel(1);
55  analysisManager->SetFileName("B5");
56 
57  // Book histograms, ntuple
58  //
59 
60  // Creating 1D histograms
61  analysisManager
62  ->CreateH1("Chamber1","Drift Chamber 1 # Hits", 50, 0., 50); // h1 Id = 0
63  analysisManager
64  ->CreateH1("Chamber2","Drift Chamber 2 # Hits", 50, 0., 50); // h1 Id = 1
65 
66  // Creating 2D histograms
67  analysisManager
68  ->CreateH2("Chamber1 XY","Drift Chamber 1 X vs Y", // h2 Id = 0
69  50, -1000., 1000, 50, -300., 300.);
70  analysisManager
71  ->CreateH2("Chamber2 XY","Drift Chamber 2 X vs Y", // h2 Id = 1
72  50, -1500., 1500, 50, -300., 300.);
73 
74  // Creating ntuple
75  //
76  if ( fEventAction ) {
77  analysisManager->CreateNtuple("B5", "Hits");
78  analysisManager->CreateNtupleIColumn("Dc1Hits"); // column Id = 0
79  analysisManager->CreateNtupleIColumn("Dc2Hits"); // column Id = 1
80  analysisManager->CreateNtupleDColumn("ECEnergy"); // column Id = 2
81  analysisManager->CreateNtupleDColumn("HCEnergy"); // column Id = 3
82  analysisManager->CreateNtupleDColumn("Time1"); // column Id = 4
83  analysisManager->CreateNtupleDColumn("Time2"); // column Id = 5
84  analysisManager // column Id = 6
85  ->CreateNtupleDColumn("ECEnergyVector", fEventAction->GetEmCalEdep());
86  analysisManager // column Id = 7
87  ->CreateNtupleDColumn("HCEnergyVector", fEventAction->GetHadCalEdep());
88  analysisManager->FinishNtuple();
89  }
90 }
G4GLOB_DLL std::ostream G4cout
std::vector< G4double > & GetEmCalEdep()
#define G4endl
Definition: G4ios.hh:61
std::vector< G4double > & GetHadCalEdep()

Here is the call graph for this function:

B5RunAction::~B5RunAction ( )
virtual

Definition at line 94 of file B5RunAction.cc.

95 {
96  delete G4AnalysisManager::Instance();
97 }

Member Function Documentation

void B5RunAction::BeginOfRunAction ( const G4Run )
virtual

Reimplemented from G4UserRunAction.

Definition at line 101 of file B5RunAction.cc.

102 {
103  //inform the runManager to save random number seed
104  //G4RunManager::GetRunManager()->SetRandomNumberStore(true);
105 
106  // Get analysis manager
107  auto analysisManager = G4AnalysisManager::Instance();
108 
109  // Open an output file
110  // The default file name is set in B5RunAction::B5RunAction(),
111  // it can be overwritten in a macro
112  analysisManager->OpenFile();
113 }
void B5RunAction::EndOfRunAction ( const G4Run )
virtual

Reimplemented from G4UserRunAction.

Definition at line 117 of file B5RunAction.cc.

118 {
119  // save histograms & ntuple
120  //
121  auto analysisManager = G4AnalysisManager::Instance();
122  analysisManager->Write();
123  analysisManager->CloseFile();
124 
125 }

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