EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eASTRunAction.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eASTRunAction.hh
1 // ********************************************************************
2 //
3 // eASTRunAction.hh
4 // Header file of eAST Run Action class that takes care of
5 // handling histograms and n-tuple.
6 //
7 // History
8 // May 8th, 2021 : first implementation
9 //
10 // ********************************************************************
11 
12 #ifndef eASTRunAction_h
13 #define eASTRunAction_h 1
14 
15 #include "G4UserRunAction.hh"
16 #include "globals.hh"
17 
18 class G4Run;
20 class eASTRunAction;
21 #include "eASTRun.hh"
22 
23 #include <map>
24 class G4VPrimitivePlotter;
25 
27 {
28  friend class eASTRunAction;
29  friend class eASTRun;
30  private:
32  {;}
33  private:
34  G4int histID = -1;
35  G4int histType = -1;
36  G4int histDup = 1;
37 
38  G4int collID = -1;
39  G4String meshName = "dummy";
40  G4String primName = "dummy";
41  G4int idx = -1;
42 
43  G4int collID2 = -1;
44  G4String meshName2 = "dummy";
45  G4String primName2 = "dummy";
46  G4int idx2 = -1;
47 
48  G4int biasf = 0;
49  G4double fuct = 1.;
50  G4VPrimitivePlotter* pplotter = nullptr;
51 };
52 
53 class eASTRunAction : public G4UserRunAction
54 {
55  friend class eASTRun;
56  public:
57  eASTRunAction();
58  virtual ~eASTRunAction();
59 
60  virtual G4Run* GenerateRun()
61  { return new eASTRun(this); }
62  virtual void BeginOfRunAction(const G4Run*);
63  virtual void EndOfRunAction(const G4Run*);
64 
65  private:
67 
68  public:
69  void SetVerbose(G4int);
70  void ListHistograms();
71  G4bool Open(G4int);
72  G4bool SetAllPlotting(G4bool val=true);
73  G4bool SetPlotting(G4int,G4bool val=true);
74  void Flush();
75  void Reset();
76 
77  G4int Create1D(G4String&,G4String&,G4int);
78  G4int Create1DForPlotter(G4String&,G4String&,G4bool);
79  G4bool Set1D(G4int,G4int,G4double,G4double,G4String&,G4String&,G4bool);
80  G4bool Set1DTitle(G4int,G4String&,G4String&,G4String&);
81  G4bool Set1DYAxisLog(G4int,G4bool);
82 
83  G4int Create1P(G4String&,G4String&,G4int);
84  G4bool Set1P(G4int,G4double,G4double,G4String&,G4String&,G4String&,G4String&);
85  G4bool Set1PTitle(G4int,G4String&,G4String&,G4String&);
86 
87  G4int NtupleColumn(G4String&,G4String&,G4String&,G4int);
88 
89  private:
90  void OpenFile();
91  void DefineNTColumn();
92  void MergeNtuple();
93 
94  public:
95  inline void SetFileName(G4String& fn)
96  { fileName = fn; }
97  inline const G4String& GetFileName() const
98  { return fileName; }
99  inline G4int GetVerbose() const
100  { return verbose; }
101  inline void SetCarry(G4bool val = true)
102  { ifCarry = val; }
103  inline G4bool GetCarry() const
104  { return ifCarry; }
105 
106  private:
107  G4String fileName = "eASTOut";
108  G4bool fileOpen = false;
109  G4int verbose = 0;
110  G4bool ifCarry = false;
111  G4int id_offset = 100;
112  G4int id_factor = 100;
113 
114  private:
115  std::map<G4int,eASTHistoType*> IDMap;
116  std::map<G4int,eASTHistoType*> NTMap;
117 };
118 
119 #endif