Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:16:34

0001 #ifndef PHHEPMC_PHHEPMCGENEVENT_H
0002 #define PHHEPMC_PHHEPMCGENEVENT_H
0003 
0004 #include <phool/PHObject.h>
0005 
0006 #include <phool/phool.h>
0007 
0008 #include <HepMC/SimpleVector.h>
0009 
0010 #include <CLHEP/Vector/LorentzRotation.h>
0011 
0012 #include <iostream>  // for cout, ostream
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   void identify(std::ostream& os = std::cout) const override;
0029   void Reset() override;
0030   int isValid() const override
0031   {
0032     return (getEvent() != nullptr) ? 1 : 0;
0033   }
0034   PHObject* CloneMe() const override { return new PHHepMCGenEvent(*this); }
0035 
0036   HepMC::GenEvent* getEvent();
0037   const HepMC::GenEvent* getEvent() const;
0038 
0039   //! embedding ID for the event
0040   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0041   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0042   //! Usually, ID = 0 means the primary Au+Au collision background
0043   int get_embedding_id() const { return _embedding_id; }
0044 
0045   //! embedding ID for the event
0046   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0047   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0048   //! Usually, ID = 0 means the primary Au+Au collision background
0049   void set_embedding_id(int id) { _embedding_id = id; }
0050 
0051   //! whether this event has been processed in Geant4 simulation
0052   bool is_simulated() const { return _isSimulated; }
0053 
0054   //! whether this event has been processed in Geant4 simulation
0055   void is_simulated(bool v) { _isSimulated = v; }
0056 
0057   //! collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0058   const HepMC::FourVector& get_collision_vertex() const { return _collisionVertex; }
0059 
0060   //! collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0061   void set_collision_vertex(const HepMC::FourVector& v) { _collisionVertex = v; }
0062 
0063   //! boost beta vector for Lorentz Transform, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0064   virtual const HepMC::ThreeVector& get_boost_beta_vector() const
0065   {
0066     PHOOL_VIRTUAL_WARNING;
0067     static HepMC::ThreeVector dummy_vec(0, 0, 0);
0068     return dummy_vec;
0069   }
0070 
0071   //! boost beta vector for Lorentz Transform, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0072   virtual void set_boost_beta_vector(const HepMC::ThreeVector&) { PHOOL_VIRTUAL_WARNING; }
0073 
0074   //! rotation axis vector, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0075   virtual const HepMC::ThreeVector& get_rotation_vector() const
0076   {
0077     PHOOL_VIRTUAL_WARNING;
0078     static HepMC::ThreeVector dummy_vec(0, 0, 1);
0079     return dummy_vec;
0080   }
0081 
0082   //! rotation axis vector, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0083   virtual void set_rotation_vector(const HepMC::ThreeVector&) { PHOOL_VIRTUAL_WARNING; }
0084 
0085   //! rotation angle, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0086   virtual double get_rotation_angle() const
0087   {
0088     PHOOL_VIRTUAL_WARNING;
0089     return 0;
0090   }
0091 
0092   //! rotation angle, part of composition of a LorentzRotation to translate from hepmc event frame to lab frame
0093   virtual void set_rotation_angle(const double) { PHOOL_VIRTUAL_WARNING; }
0094 
0095   //!LorentzRotation to translate from hepmc event frame to lab frame
0096   virtual CLHEP::HepLorentzRotation get_LorentzRotation_EvtGen2Lab() const { return CLHEP::HepLorentzRotation::IDENTITY; }
0097 
0098   //!LorentzRotation to translate from lab frame to hepmc event frame
0099   virtual CLHEP::HepLorentzRotation get_LorentzRotation_Lab2EvtGen() const { return CLHEP::HepLorentzRotation::IDENTITY; }
0100 
0101   //! host an HepMC event
0102   bool addEvent(HepMC::GenEvent* evt);
0103   bool addEvent(HepMC::GenEvent& evt);
0104   bool swapEvent(HepMC::GenEvent*& evt);
0105   void clearEvent();
0106 
0107   //! move the collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0108   virtual void moveVertex(double x, double y, double z, double t = 0);
0109 
0110   // the number of entries in the array of particles
0111   virtual int size(void) const;
0112   virtual int vertexSize(void) const;
0113 
0114   void print(std::ostream& os = std::cout) const;
0115 
0116   void PrintEvent();
0117 
0118  protected:
0119   //! \brief Embedding ID for this generated event
0120   //! positive ID is the embedded event of interest, e.g. jetty event from pythia
0121   //! negative IDs are backgrounds, .e.g out of time pile up collisions
0122   //! Usually, ID = 0 means the primary Au+Au collision background
0123   int _embedding_id;
0124 
0125   //! whether this event has been processed in Geant4 simulation
0126   bool _isSimulated;
0127 
0128   //! collision vertex position in the Hall coordinate system, use PHENIX units of cm, ns
0129   HepMC::FourVector _collisionVertex;
0130 
0131   //! The HEP MC record from event generator. Note the units are recorded in GenEvent
0132   HepMC::GenEvent* _theEvt;
0133 
0134   ClassDefOverride(PHHepMCGenEvent, 5)
0135 };
0136 
0137 #endif  // PHHEPMC_PHHEPMCEVENT_H