Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-04-05 08:09:40

0001 #ifndef UPCMESON_H
0002 #define UPCMESON_H
0003 
0004 #include <Rtypes.h>
0005 #include <fun4all/SubsysReco.h>
0006 
0007 /// Class declarations for use in the analysis module
0008 class PHCompositeNode;
0009 class TFile;
0010 class TTree;
0011 class TH1;
0012 class TH2;
0013 class PHCompositeNode;
0014 class SvtxTrackMap;
0015 class GlobalVertex;
0016 class SvtxTrackEval;
0017 class PHG4TruthInfoContainer;
0018 class PHHepMCGenEventMap;
0019 class PHHepMCGenEvent;
0020 class CaloTriggerInfo;
0021 class SvtxEvalStack;
0022 class EventHeader;
0023 class Gl1Packet;
0024 //class TrackVertexCrossingAssoc;
0025 
0026 /// Definition of this analysis module class
0027 class UPCMeson : public SubsysReco
0028 {
0029  public:
0030   /// Constructor
0031   UPCMeson(const std::string &name = "UPCMeson",
0032               const std::string &outputfname = "UPCMeson.root");
0033 
0034   // Destructor
0035   virtual ~UPCMeson();
0036 
0037   /// SubsysReco initialize processing method
0038   int Init(PHCompositeNode *) override;
0039 
0040   /// SubsysReco event processing method
0041   int process_event(PHCompositeNode *) override;
0042 
0043   /// SubsysReco end processing method
0044   int End(PHCompositeNode *) override;
0045 
0046   void SetGuessMass(const double m) { _mguess = m; }
0047 
0048   /// Set things to analyze
0049   void analyzeTracks(bool analyzeTracks) { m_analyzeTracks = analyzeTracks; }
0050   void analyzeTruth(bool analyzeTruth) { m_analyzeTruth = analyzeTruth; }
0051 
0052   int Reset(PHCompositeNode * /*topNode*/) override;
0053 
0054  private:
0055   /// String to contain the outfile name containing the trees
0056   std::string m_outfilename;
0057 
0058   /// A boolean for running over tracks
0059   bool m_analyzeTracks;
0060 
0061   /// A boolean for collecting hepmc information
0062   bool m_analyzeTruth;
0063 
0064   /// TFile to hold the following TTrees and histograms
0065   TFile *m_outfile{nullptr};
0066   TTree *m_tracktree{nullptr};
0067   TTree *m_hepmctree{nullptr};
0068   TTree *m_truthtree{nullptr};
0069   TTree *m_globaltree{nullptr};
0070   TTree *m_pairtree{nullptr};
0071  
0072   TH1 *h_phi[2]{nullptr,nullptr};       // [0]=opp. sign, [1]=like sign
0073   TH2 *h2_eta_phi[2]{nullptr,nullptr};
0074   TH1 *h_mass[2]{nullptr,nullptr};
0075   TH1 *h_pt[2]{nullptr,nullptr};
0076   TH1 *h_y[2]{nullptr,nullptr};
0077   TH1 *h_eta[2]{nullptr,nullptr};
0078 
0079   TH1 *h_trig{nullptr};
0080   TH1 *h_ntracks{nullptr};
0081   TH2 *h2_ntrksvsb{nullptr};
0082   TH1 *h_cross{nullptr};      //crossings with low num tracks
0083   TH1 *h_cross_evt{nullptr};  //crossings sampled
0084   TH1 *h_bunch{nullptr};      //bunches from cross 0
0085 
0086   TH1 *h_b_mb{nullptr};
0087   TH1 *h_npart_mb{nullptr};
0088   TH1 *h_ncoll_mb{nullptr};
0089   TH1 *h_b{nullptr};
0090   TH1 *h_npart{nullptr};
0091   TH1 *h_ncoll{nullptr};
0092 
0093   const double E_MASS = 0.000510998950;  // electron mass [Gev]
0094   const double MU_MASS = 0.000510998950;  // muon mass [Gev]
0095   const double PI_MASS = 0.13957039;  // pion mass [Gev]
0096   double _mguess{E_MASS};
0097 
0098   static inline constexpr int CROSS_OFFSET = 150; // used to map cross to a pos. array index
0099 
0100   /// Methods for grabbing the data
0101   int GetNodes(PHCompositeNode *topNode);
0102   int getTracks(PHCompositeNode *topNode);
0103   void getHEPMCTruth();
0104   void getPHG4Truth();
0105 
0106   /// Data
0107   EventHeader *_evthdr{nullptr};
0108   Gl1Packet* _gl1raw{nullptr};
0109   SvtxTrackMap *_trackmap{nullptr};
0110   PHG4TruthInfoContainer *_truthinfo{nullptr};
0111   PHHepMCGenEventMap *_genevent_map{nullptr};
0112   //TrackVertexCrossingAssoc* _track_vertex_crossing_map{nullptr};
0113   SvtxEvalStack *m_svtxEvalStack{nullptr};
0114 
0115   void initializeVariables();
0116   void initializeTrees();
0117 
0118   /**
0119    * Variables for the trees
0120    */
0121 
0122   // Global Info
0123   Int_t    m_run{ 0 };
0124   Int_t    m_evt{ 0 };
0125   Short_t  m_cross{ -1 };  // Streaming cross number
0126   Short_t  m_bunch{ 0 };  // RHIC bunch number
0127   uint64_t m_strig{ 0 };  // Scaled Trigger
0128   Int_t    m_npart_targ{ 0 };
0129   Int_t    m_npart_proj{ 0 };
0130   Int_t    m_npart{ 0 };
0131   Int_t    m_ncoll{ 0 };
0132   Int_t    m_ncoll_hard{ 0 };
0133   Float_t  m_bimpact{ -1. };
0134   Int_t    m_ntrks{ 0 };         // total reconstructed ntracks
0135   Int_t    m_ntrks_cross{ 0 };   // total ntracks in a crossing
0136   Int_t    m_ntrk_sphenix{ 0 };  // monte carlo tracks in sphenix acceptance (>0.4 pt, |eta|<1.1)
0137   Int_t    m_ntrk_mc{ 0 };       // total monte carlo charged tracks
0138 
0139   /// HEPMC Tree variables
0140   int m_partid1;
0141   int m_partid2;
0142   double m_x1;
0143   double m_x2;
0144   int m_mpi;
0145   int m_process_id;
0146   double m_truthenergy;
0147   double m_trutheta;
0148   double m_truthphi;
0149   double m_truthpx;
0150   double m_truthpy;
0151   double m_truthpz;
0152   double m_truthpt;
0153   double m_truthp;
0154   int m_numparticlesinevent;
0155   int m_truthpid;
0156   int m_truthcharge;
0157 
0158 
0159   /// Track variables
0160   double m_tr_px;
0161   double m_tr_py;
0162   double m_tr_pz;
0163   double m_tr_p;
0164   double m_tr_pt;
0165   double m_tr_phi;
0166   double m_tr_eta;
0167   int m_charge;
0168   double m_chisq;
0169   int m_ndf;
0170   double m_dca;
0171   double m_tr_x;
0172   double m_tr_y;
0173   double m_tr_z;
0174   int m_truth_is_primary;
0175   double m_truthtrackpx;
0176   double m_truthtrackpy;
0177   double m_truthtrackpz;
0178   double m_truthtrackp;
0179   double m_truthtracke;
0180   double m_truthtrackpt;
0181   double m_truthtrackphi;
0182   double m_truthtracketa;
0183   int m_truthtrackpid;
0184 
0185   /// Pair variables
0186   Float_t m_pm{ 0. };    // pair mass
0187   Float_t m_ppt{ 0. };
0188   Float_t m_pphi{ 0. };
0189   Float_t m_py{ 0. };
0190   Float_t m_peta{ 0. };
0191   Float_t m_pdphi{ 0. };
0192   Float_t m_ppt1{ 0. };
0193   Float_t m_ppz1{ 0. };
0194   Float_t m_pphi1{ 0. };
0195   Float_t m_peta1{ 0. };
0196   Float_t m_ppt2{ 0. };
0197   Float_t m_ppz2{ 0. };
0198   Float_t m_pphi2{ 0. };
0199   Float_t m_peta2{ 0. };
0200   Short_t  m_pq1{ 0 };
0201   Short_t  m_pq2{ 0 };
0202 };
0203 
0204 #endif  // UPCMESON_H