WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimRunAction.hh
Go to the documentation of this file.
1 #ifndef WCSimRunAction_h
2 #define WCSimRunAction_h 1
3 
4 #include "G4UserRunAction.hh"
5 #include "globals.hh"
6 #include "G4String.hh"
7 
8 #include "TFile.h"
9 #include "TTree.h"
10 #include "TStopwatch.h"
11 #include "WCSimRootEvent.hh"
12 #include "WCSimRootGeom.hh"
13 #include "WCSimRootOptions.hh"
15 #include "WCSimRandomParameters.hh"
16 
17 class G4Run;
19 
20 class WCSimRunAction : public G4UserRunAction
21 {
22 public:
25 
26 public:
27  void BeginOfRunAction(const G4Run*);
28  void EndOfRunAction(const G4Run*);
29  void SetRootFileName(G4String fname) { RootFileName = fname; }
30  G4String GetRootFileName() { return RootFileName; }
31  void FillGeoTree();
32  TTree* GetTree(){return WCSimTree;}
33  TBranch* GetBranch(G4String detectorElement = "tank"){
34  if(detectorElement=="tank") return wcsimrooteventbranch;
35  else if(detectorElement=="OD") return wcsimrooteventbranch_OD;
36  else G4cout << "Unkown detector element" << G4endl;
37  }
38  TTree* GetGeoTree(){return geoTree;}
39  TTree* GetOptionsTree(){return optionsTree;}
41  // WCSimRootEvent* GetRootEvent(){return wcsimrootsuperevent;}
42  WCSimRootEvent* GetRootEvent(G4String detectorElement = "tank"){
43  if(detectorElement=="tank") return wcsimrootsuperevent;
44  if(detectorElement=="OD") return wcsimrootsuperevent_OD;
45  }
47 
48 
49  void SetTree(TTree* tree){WCSimTree=tree;}
50  void SetBranch(TBranch* branchin, G4String detectorElement = "tank"){
51  if(detectorElement=="tank") wcsimrooteventbranch=branchin;
52  if(detectorElement=="OD") wcsimrooteventbranch_OD=branchin;
53  }
54  void SetGeoTree(TTree* tree){geoTree=tree;}
55  void SetRootEvent(WCSimRootEvent* revent, G4String detectorElement = "tank"){
56  if(detectorElement=="tank") wcsimrootsuperevent=revent;
57  if(detectorElement=="OD") wcsimrootsuperevent_OD=revent;
58  }
60 
62  int GetNtuples(){return ntuples;}
63 
68  void SetNtuples(int ntup) {ntuples=ntup;}
69 
70  void SetUseTimer(bool use) { useTimer = use; }
71 
72 private:
73  // MFechner : set by the messenger
74  std::string RootFileName;
75  //
76  TTree* WCSimTree;
79  TTree* geoTree;
80  TTree* optionsTree;
87 
92 
94  int ntuples; // 1 for ntuples to be written
95 
96  bool useTimer;
97  TStopwatch timer;
98 };
99 
100 #endif
bool useTimer
Use the timer? Set by Messenger.
TBranch * wcsimrooteventbranch
WCSimRootOptions * wcsimrootoptions
TBranch * GetBranch(G4String detectorElement="tank")
void incrementFVWaterTubeHits()
void SetUseTimer(bool use)
int numberOfTimesFVWaterTubeHit
WCSimRootEvent * GetRootEvent(G4String detectorElement="tank")
WCSimRootEvent * wcsimrootsuperevent
WCSimRunAction(WCSimDetectorConstruction *, WCSimRandomParameters *)
WCSimDetectorConstruction * wcsimdetector
void SetBranch(TBranch *branchin, G4String detectorElement="tank")
WCSimRunActionMessenger * messenger
TTree * GetOptionsTree()
TBranch * wcsimrooteventbranch_OD
void SetRootFileName(G4String fname)
void incrementWaterTubeHits()
WCSimRootGeom * wcsimrootgeom
void SetGeoTree(TTree *tree)
int numberOfTimesWaterTubeHit
TStopwatch timer
A timer for runtime analysis.
std::string RootFileName
void SetNtuples(int ntup)
WCSimRandomParameters * wcsimrandomparameters
WCSimRootEvent * wcsimrootsuperevent_OD
void SetTree(TTree *tree)
TTree * GetTree()
void SetRootEvent(WCSimRootEvent *revent, G4String detectorElement="tank")
G4String GetRootFileName()
void SetRootGeom(WCSimRootGeom *rgeom)
void incrementCatcherHits()
void EndOfRunAction(const G4Run *)
WCSimRootOptions * GetRootOptions()
TTree * GetGeoTree()
WCSimRootGeom * GetRootGeom()
void BeginOfRunAction(const G4Run *)
void incrementEventsGenerated()
int GetNumberOfEventsGenerated()