Geant4  10.02.p03
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 ()
 
void SetMaster (G4bool val=true)
 
G4bool IsMaster () const
 

Private Attributes

B5EventActionfEventAction
 

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::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  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
49  G4cout << "Using " << analysisManager->GetType() << G4endl;
50 
51  // Default settings
52  analysisManager->SetVerboseLevel(1);
53  analysisManager->SetFileName("B5");
54 
55  // Book histograms, ntuple
56  //
57 
58  // Creating 1D histograms
59  analysisManager
60  ->CreateH1("Chamber1","Drift Chamber 1 # Hits", 50, 0., 50); // h1 Id = 0
61  analysisManager
62  ->CreateH1("Chamber2","Drift Chamber 2 # Hits", 50, 0., 50); // h1 Id = 1
63 
64  // Creating 2D histograms
65  analysisManager
66  ->CreateH2("Chamber1 XY","Drift Chamber 1 X vs Y", // h2 Id = 0
67  50, -1000., 1000, 50, -300., 300.);
68  analysisManager
69  ->CreateH2("Chamber2 XY","Drift Chamber 2 X vs Y", // h2 Id = 1
70  50, -1500., 1500, 50, -300., 300.);
71 
72  // Creating ntuple
73  //
74  if ( fEventAction ) {
75  analysisManager->CreateNtuple("B5", "Hits");
76  analysisManager->CreateNtupleIColumn("Dc1Hits"); // column Id = 0
77  analysisManager->CreateNtupleIColumn("Dc2Hits"); // column Id = 1
78  analysisManager->CreateNtupleDColumn("ECEnergy"); // column Id = 2
79  analysisManager->CreateNtupleDColumn("HCEnergy"); // column Id = 3
80  analysisManager->CreateNtupleDColumn("Time1"); // column Id = 4
81  analysisManager->CreateNtupleDColumn("Time2"); // column Id = 5
82  analysisManager // column Id = 6
83  ->CreateNtupleDColumn("ECEnergyVector", fEventAction->GetEmCalEdep());
84  analysisManager // column Id = 7
85  ->CreateNtupleDColumn("HCEnergyVector", fEventAction->GetHadCalEdep());
86  analysisManager->FinishNtuple();
87  }
88 }
G4int CreateNtupleIColumn(const G4String &name)
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")
G4String GetType() const
void SetVerboseLevel(G4int verboseLevel)
G4int CreateNtuple(const G4String &name, const G4String &title)
G4bool SetFileName(const G4String &fileName)
B5EventAction * fEventAction
Definition: B5RunAction.hh:53
G4GLOB_DLL std::ostream G4cout
std::vector< G4double > & GetEmCalEdep()
#define G4endl
Definition: G4ios.hh:61
G4int CreateNtupleDColumn(const G4String &name)
std::vector< G4double > & GetHadCalEdep()
G4int CreateH2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")
Here is the call graph for this function:

◆ ~B5RunAction()

B5RunAction::~B5RunAction ( )
virtual

Definition at line 92 of file B5RunAction.cc.

93 {
94  delete G4AnalysisManager::Instance();
95 }

Member Function Documentation

◆ BeginOfRunAction()

void B5RunAction::BeginOfRunAction ( const G4Run )
virtual

Reimplemented from G4UserRunAction.

Definition at line 99 of file B5RunAction.cc.

100 {
101  //inform the runManager to save random number seed
102  //G4RunManager::GetRunManager()->SetRandomNumberStore(true);
103 
104  // Get analysis manager
105  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
106 
107  // Open an output file
108  // The default file name is set in B5RunAction::B5RunAction(),
109  // it can be overwritten in a macro
110  analysisManager->OpenFile();
111 }
G4bool OpenFile(const G4String &fileName="")
Here is the call graph for this function:

◆ EndOfRunAction()

void B5RunAction::EndOfRunAction ( const G4Run )
virtual

Reimplemented from G4UserRunAction.

Definition at line 115 of file B5RunAction.cc.

116 {
117  // save histograms & ntuple
118  //
119  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
120  analysisManager->Write();
121  analysisManager->CloseFile();
122 
123 }
Here is the call graph for this function:

Member Data Documentation

◆ fEventAction

B5EventAction* B5RunAction::fEventAction
private

Definition at line 53 of file B5RunAction.hh.


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