EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eASTHepMC3Interface.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eASTHepMC3Interface.hh
1 // ********************************************************************
2 //
3 // eASTHepMC3Interface.hh
4 // Header file of HepMC3 interface
5 //
6 // History
7 // June 23rd, 2021 : first empty class definition - Makoto Asai (SLAC)
8 //
9 // ********************************************************************
10 
11 #ifndef eASTHepMC3Interface_h
12 #define eASTHepMC3Interface_h 1
13 
14 #include "G4VPrimaryGenerator.hh"
15 #include "G4PrimaryVertex.hh"
16 #include "globals.hh"
17 
18 #include <HepMC3/Reader.h>
19 #include <set>
20 #include <map>
21 
22 
23 class G4Event;
24 class G4GenericMessenger;
25 
26 class eASTHepMC3Interface : public G4VPrimaryGenerator
27 {
28 private:
30  static G4bool instantiated;
31 
32 public:
33  // Creat the singleton instance and return its pointer
34  // Maybe nullptr if it has already deleted.
36 
37 private:
39 
40 public:
41  virtual ~eASTHepMC3Interface();
42 
43 public:
44  // The method for filling primary vertex and
45  // primary particles.
46  virtual void GeneratePrimaryVertex(G4Event*);
47 
48 public:
49  // Open the input HepMC3 file
50  // return false if the file cannot be opened.
51  G4bool OpenFile(G4String);
52 
53  // Set/Get vertex position
54  void SetVertexPosition(G4ThreeVector vPos)
55  { vPosition = vPos; }
56  G4ThreeVector GetVertexPosition() const
57  { return vPosition; }
58 
59  // SetGet vertex time
60  void SetVertexTime(G4double t0)
61  { vTime = t0; }
62  G4double GetVertexTime() const
63  { return vTime; }
64 
65  // Verbose level
66  void SetVerbose(G4int vl)
67  { verboseLevel = vl; }
68 
69 private:
70  G4String fileName;
71  G4GenericMessenger* messenger;
72 
73  G4ThreeVector vPosition = G4ThreeVector(0.,0.,0.);
74  G4double vTime = 0.;
75  G4int verboseLevel = 1;
76 
77  std::shared_ptr<HepMC3::Reader> HepMC3Reader;
78  G4PrimaryParticle* MakeParticle ( const HepMC3::ConstGenParticlePtr hep_p,
79  const bool safetycheck, std::set<int>& used);
80 
81  std::map<int,G4PrimaryParticle*> created_daughters;
82 
83 };
84 
85 #endif