Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-06-26 07:05:25

0001 // ********************************************************************
0002 //
0003 // eASTRunAction.hh
0004 //   Header file of eAST Run Action class that takes care of
0005 //   handling histograms and n-tuple.
0006 //
0007 // History
0008 //   May 8th, 2021 : first implementation
0009 //
0010 // ********************************************************************
0011 
0012 #ifndef eASTRunAction_h
0013 #define eASTRunAction_h 1
0014 
0015 #include "G4UserRunAction.hh"
0016 #include "globals.hh"
0017 
0018 class G4Run;
0019 class eASTRunActionMessenger;
0020 class eASTRunAction;
0021 #include "eASTRun.hh"
0022 
0023 #include <map>
0024 class G4VPrimitivePlotter;
0025 
0026 class eASTHistoType
0027 {
0028   friend class eASTRunAction;
0029   friend class eASTRun;
0030   private:
0031     eASTHistoType()
0032     {;}
0033   private:
0034     G4int histID = -1;
0035     G4int histType = -1;
0036     G4int histDup = 1;
0037 
0038     G4int collID = -1;
0039     G4String meshName = "dummy";
0040     G4String primName = "dummy";
0041     G4int idx = -1;
0042 
0043     G4int collID2 = -1;
0044     G4String meshName2 = "dummy";
0045     G4String primName2 = "dummy";
0046     G4int idx2 = -1;
0047 
0048     G4int biasf = 0;
0049     G4double fuct = 1.;
0050     G4VPrimitivePlotter* pplotter = nullptr;
0051 };
0052     
0053 class eASTRunAction : public G4UserRunAction
0054 {
0055   friend class eASTRun;
0056   public:
0057     eASTRunAction();
0058     virtual ~eASTRunAction();
0059 
0060     virtual G4Run* GenerateRun()
0061     { return new eASTRun(this); }
0062     virtual void BeginOfRunAction(const G4Run*);
0063     virtual void   EndOfRunAction(const G4Run*);
0064 
0065   private:
0066     eASTRunActionMessenger* messenger;
0067 
0068   public:
0069     void SetVerbose(G4int);
0070     void ListHistograms();
0071     G4bool Open(G4int);
0072     G4bool SetAllPlotting(G4bool val=true);
0073     G4bool SetPlotting(G4int,G4bool val=true);
0074     void Flush();
0075     void Reset();
0076 
0077     G4int Create1D(G4String&,G4String&,G4int);
0078     G4int Create1DForPlotter(G4String&,G4String&,G4bool);
0079     G4bool Set1D(G4int,G4int,G4double,G4double,G4String&,G4String&,G4bool);
0080     G4bool Set1DTitle(G4int,G4String&,G4String&,G4String&);
0081     G4bool Set1DYAxisLog(G4int,G4bool);
0082 
0083     G4int Create1P(G4String&,G4String&,G4int);
0084     G4bool Set1P(G4int,G4double,G4double,G4String&,G4String&,G4String&,G4String&);
0085     G4bool Set1PTitle(G4int,G4String&,G4String&,G4String&);
0086 
0087     G4int NtupleColumn(G4String&,G4String&,G4String&,G4int);
0088 
0089   private:
0090     void OpenFile();
0091     void DefineNTColumn();
0092     void MergeNtuple();
0093 
0094   public:
0095     inline void SetFileName(G4String& fn)
0096     { fileName = fn; }
0097     inline const G4String& GetFileName() const
0098     { return fileName; }
0099     inline G4int GetVerbose() const
0100     { return verbose; }
0101     inline void SetCarry(G4bool val = true)
0102     { ifCarry = val; }
0103     inline G4bool GetCarry() const
0104     { return ifCarry; }
0105 
0106   private:
0107     G4String fileName = "eASTOut";
0108     G4bool fileOpen = false;
0109     G4int verbose = 0;
0110     G4bool ifCarry = false;
0111     G4int id_offset = 100;
0112     G4int id_factor = 100;
0113 
0114   private:
0115     std::map<G4int,eASTHistoType*> IDMap;
0116     std::map<G4int,eASTHistoType*> NTMap;
0117 };
0118 
0119 #endif