File indexing completed on 2025-01-31 09:22:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef GRRunAction_h
0045 #define GRRunAction_h 1
0046
0047 #include "G4UserRunAction.hh"
0048 #include "globals.hh"
0049
0050 class G4Run;
0051 class GRRunActionMessenger;
0052 class GRRunAction;
0053 #include "GRRun.hh"
0054
0055 #include <map>
0056 class G4VPrimitivePlotter;
0057
0058 class GRHistoType
0059 {
0060 friend class GRRunAction;
0061 friend class GRRun;
0062 private:
0063 GRHistoType()
0064 {;}
0065 private:
0066 G4int histID = -1;
0067 G4int histType = -1;
0068 G4int histDup = 1;
0069
0070 G4int collID = -1;
0071 G4String meshName = "dummy";
0072 G4String primName = "dummy";
0073 G4int idx = -1;
0074
0075 G4int collID2 = -1;
0076 G4String meshName2 = "dummy";
0077 G4String primName2 = "dummy";
0078 G4int idx2 = -1;
0079
0080 G4int biasf = 0;
0081 G4double fuct = 1.;
0082 G4VPrimitivePlotter* pplotter = nullptr;
0083 };
0084
0085 class GRRunAction : public G4UserRunAction
0086 {
0087 friend class GRRun;
0088 public:
0089 GRRunAction();
0090 virtual ~GRRunAction();
0091
0092 virtual G4Run* GenerateRun()
0093 { return new GRRun(this); }
0094 virtual void BeginOfRunAction(const G4Run*);
0095 virtual void EndOfRunAction(const G4Run*);
0096
0097 private:
0098 GRRunActionMessenger* messenger;
0099
0100 public:
0101 void SetVerbose(G4int);
0102 void ListHistograms();
0103 G4bool Open(G4int);
0104 G4bool SetAllPlotting(G4bool val=true);
0105 G4bool SetPlotting(G4int,G4bool val=true);
0106 void Flush();
0107 void Reset();
0108
0109 G4int Create1D(G4String&,G4String&,G4int);
0110 G4int Create1DForPrimary(G4String&,G4bool);
0111 G4int Create1DForPlotter(G4String&,G4String&,G4bool);
0112 G4bool Set1D(G4int,G4int,G4double,G4double,G4String&,G4String&,G4bool);
0113 G4bool Set1DTitle(G4int,G4String&,G4String&,G4String&);
0114 G4bool Set1DYAxisLog(G4int,G4bool);
0115
0116 G4int Create1P(G4String&,G4String&,G4int);
0117 G4bool Set1P(G4int,G4double,G4double,G4String&,G4String&,G4String&,G4String&);
0118 G4bool Set1PTitle(G4int,G4String&,G4String&,G4String&);
0119
0120 G4int NtupleColumn(G4String&,G4String&,G4String&,G4int);
0121
0122 private:
0123 void OpenFile();
0124 void DefineNTColumn();
0125 void MergeNtuple();
0126
0127 public:
0128 inline void SetFileName(G4String& fn)
0129 { fileName = fn; }
0130 inline const G4String& GetFileName() const
0131 { return fileName; }
0132 inline G4int GetVerbose() const
0133 { return verbose; }
0134 inline void SetCarry(G4bool val = true)
0135 { ifCarry = val; }
0136 inline G4bool GetCarry() const
0137 { return ifCarry; }
0138 inline void SetOffset(G4int offset,G4int factor)
0139 {
0140 id_offset = offset;
0141 id_factor = factor;
0142 }
0143 inline void GetOffset(G4int& offset,G4int& factor) const
0144 {
0145 offset = id_offset;
0146 factor = id_factor;
0147 }
0148
0149 private:
0150 G4String fileName;
0151 G4bool fileOpen;
0152 G4int verbose;
0153 G4bool ifCarry;
0154 G4int id_offset;
0155 G4int id_factor;
0156
0157 private:
0158 std::map<G4int,GRHistoType*> IDMap;
0159 std::map<G4int,GRHistoType*> NTMap;
0160 };
0161
0162 #endif