Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:19:21

0001 #ifndef PHHEPMC_PHHEPMCGENEVENT_H
0002 #define PHHEPMC_PHHEPMCGENEVENT_H
0003 
0004 #include <phool/PHObject.h>
0005 #include <phool/phool.h>
0006 
0007 #include <HepMC/SimpleVector.h>
0008 
0009 #include <CLHEP/Vector/LorentzRotation.h>
0010 
0011 #include <iostream>  // for cout, ostream
0012 #include <map>
0013 
0014 namespace HepMC
0015 {
0016   class GenEvent;
0017 }
0018 
0019 class PHHepMCGenEvent : public PHObject
0020 {
0021  public:
0022   PHHepMCGenEvent();
0023 
0024   PHHepMCGenEvent(const PHHepMCGenEvent& event);
0025   PHHepMCGenEvent& operator=(const PHHepMCGenEvent& event);
0026   ~PHHepMCGenEvent() override;
0027 
0028   //! \brief reaction plane angles thrown by hijing flowAfterburner
0029   // ! only will be filled if the flowAfterburner enabled and input HepMC is from hijing
0030   // ! it is a map of n to psi_n[n]
0031   typedef std::map<unsigned int, float> FlowAfterburner_PsiMap;
0032 
0033   void identify(std::ostream& os = std::cout) const override;
0034   void Reset() override;
0035   int isValid() const override
0036   {
0037     return (getEvent() != nullptr) ? 1 : 0;
0038   }
0039   PHObject* CloneMe() const override { return new PHHepMCGenEvent(*this); }
0040 
0041   HepMC::GenEvent* getEvent();
0042   const HepMC::GenEvent* getEvent() const;
0043 
0044   //! embedding ID for the event
0045   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0046   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0047   //! Usually, ID = 0 means the primary Au+Au collision background
0048   int get_embedding_id() const { return _embedding_id; }
0049 
0050   //! embedding ID for the event
0051   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0052   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0053   //! Usually, ID = 0 means the primary Au+Au collision background
0054   void set_embedding_id(int id) { _embedding_id = id; }
0055 
0056   //! whether this event has been processed in Geant4 simulation
0057   bool is_simulated() const { return _isSimulated; }
0058 
0059   //! whether this event has been processed in Geant4 simulation
0060   void is_simulated(bool v) { _isSimulated = v; }
0061 
0062   //! collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0063   const HepMC::FourVector& get_collision_vertex() const { return _collisionVertex; }
0064 
0065   //! collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0066   void set_collision_vertex(const HepMC::FourVector& v) { _collisionVertex = v; }
0067 
0068   //! boost beta vector for Lorentz Transform, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0069   virtual const HepMC::ThreeVector& get_boost_beta_vector() const
0070   {
0071     PHOOL_VIRTUAL_WARNING;
0072     static HepMC::ThreeVector dummy_vec(0, 0, 0);
0073     return dummy_vec;
0074   }
0075 
0076   //! boost beta vector for Lorentz Transform, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0077   virtual void set_boost_beta_vector(const HepMC::ThreeVector&) { PHOOL_VIRTUAL_WARNING; }
0078 
0079   //! rotation axis vector, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0080   virtual const HepMC::ThreeVector& get_rotation_vector() const
0081   {
0082     PHOOL_VIRTUAL_WARNING;
0083     static HepMC::ThreeVector dummy_vec(0, 0, 1);
0084     return dummy_vec;
0085   }
0086 
0087   //! rotation axis vector, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0088   virtual void set_rotation_vector(const HepMC::ThreeVector&) { PHOOL_VIRTUAL_WARNING; }
0089 
0090   //! rotation angle, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0091   virtual double get_rotation_angle() const
0092   {
0093     PHOOL_VIRTUAL_WARNING;
0094     return 0;
0095   }
0096 
0097   //! rotation angle, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0098   virtual void set_rotation_angle(const double) { PHOOL_VIRTUAL_WARNING; }
0099 
0100   //! LorentzRotation to translate from hepmc event frame to lab frame
0101   virtual CLHEP::HepLorentzRotation get_LorentzRotation_EvtGen2Lab() const { return CLHEP::HepLorentzRotation::IDENTITY; }
0102 
0103   //! LorentzRotation to translate from lab frame to hepmc event frame
0104   virtual CLHEP::HepLorentzRotation get_LorentzRotation_Lab2EvtGen() const { return CLHEP::HepLorentzRotation::IDENTITY; }
0105 
0106   //! reaction plane angles thrown by hijing flowAfterburner
0107   virtual float get_flow_psi(unsigned int /* n */) const
0108   {
0109     PHOOL_VIRTUAL_WARNING;
0110     return 0.0f;
0111   }
0112 
0113   // ! get the reaction plane angle psi_n[n]
0114   virtual const FlowAfterburner_PsiMap& get_flow_psi_map() const
0115   {
0116     PHOOL_VIRTUAL_WARNING;
0117     static FlowAfterburner_PsiMap dummy_map;
0118     return dummy_map;
0119   }
0120 
0121   //! set the reaction plane angle psi_n[n]
0122   virtual void set_flow_psi(unsigned int /*n*/, float /*psi*/) { PHOOL_VIRTUAL_WARNING; }
0123 
0124   virtual void set_flow_psi_map(const FlowAfterburner_PsiMap& /*psi_map*/)
0125   {
0126     PHOOL_VIRTUAL_WARNING;
0127   }
0128 
0129   //! host an HepMC event
0130   bool addEvent(HepMC::GenEvent* evt);
0131   bool addEvent(HepMC::GenEvent& evt);
0132   bool swapEvent(HepMC::GenEvent*& evt);
0133   void clearEvent();
0134 
0135   //! move the collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0136   virtual void moveVertex(double x, double y, double z, double t = 0);
0137 
0138   // the number of entries in the array of particles
0139   virtual int size(void) const;
0140   virtual int vertexSize(void) const;
0141 
0142   void print(std::ostream& out = std::cout) const;
0143 
0144   void PrintEvent();
0145 
0146  protected:
0147   //! \brief Embedding ID for this generated event
0148   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0149   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0150   //! Usually, ID = 0 means the primary Au+Au collision background
0151   int _embedding_id;
0152 
0153   //! whether this event has been processed in Geant4 simulation
0154   bool _isSimulated;
0155 
0156   //! collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0157   HepMC::FourVector _collisionVertex;
0158 
0159   //! The HEP MC record from event generator. Note the units are recorded in GenEvent
0160   HepMC::GenEvent* _theEvt{nullptr};
0161 
0162   ClassDefOverride(PHHepMCGenEvent, 5)
0163 };
0164 
0165 #endif  // PHHEPMC_PHHEPMCEVENT_H