Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:41

0001 #ifndef ANAUPC_H
0002 #define ANAUPC_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 RawClusterContainer;
0015 class RawCluster;
0016 class SvtxTrackMap;
0017 class JetMap;
0018 class GlobalVertex;
0019 class JetEvalStack;
0020 class JetRecoEval;
0021 class SvtxTrackEval;
0022 class PHG4TruthInfoContainer;
0023 class PHHepMCGenEventMap;
0024 class PHHepMCGenEvent;
0025 class CaloTriggerInfo;
0026 class JetTruthEval;
0027 class SvtxEvalStack;
0028 class EventHeader;
0029 
0030 /// Definition of this analysis module class
0031 class AnaUPC : public SubsysReco
0032 {
0033  public:
0034   /// Constructor
0035   AnaUPC(const std::string &name = "AnaUPC",
0036               const std::string &outputfname = "AnaUPC.root");
0037 
0038   // Destructor
0039   virtual ~AnaUPC();
0040 
0041   /// SubsysReco initialize processing method
0042   int Init(PHCompositeNode *) override;
0043 
0044   /// SubsysReco event processing method
0045   int process_event(PHCompositeNode *) override;
0046 
0047   /// SubsysReco end processing method
0048   int End(PHCompositeNode *) override;
0049 
0050   /// Set the minimum jet pT to cut on
0051   //void setMinJetPt(float minjetpt) { m_minjetpt = minjetpt; }
0052 
0053   /// Set the minimum cluster pT to cut on
0054   //void setMinClusPt(float mincluspt) { m_mincluspt = mincluspt; }
0055 
0056   /// Set things to analyze
0057   void analyzeTracks(bool analyzeTracks) { m_analyzeTracks = analyzeTracks; }
0058   //void analyzeClusters(bool analyzeClusters) { m_analyzeClusters = analyzeClusters; }
0059   //void analyzeJets(bool analyzeJets) { m_analyzeJets = analyzeJets; }
0060   void analyzeTruth(bool analyzeTruth) { m_analyzeTruth = analyzeTruth; }
0061 
0062   int Reset(PHCompositeNode * /*topNode*/) override;
0063 
0064  private:
0065   /// String to contain the outfile name containing the trees
0066   std::string m_outfilename;
0067 
0068   /// A float for cutting on jet pt
0069   //float m_minjetpt;
0070 
0071   /// A float for cutting on cluster pt
0072   //float m_mincluspt;
0073 
0074   /// A boolean for running over tracks
0075   bool m_analyzeTracks;
0076 
0077   /// A boolean for running over clusters
0078   //bool m_analyzeClusters;
0079 
0080   /// A boolean for running over jets
0081   //bool m_analyzeJets;
0082 
0083   /// A boolean for collecting hepmc information
0084   bool m_analyzeTruth;
0085 
0086   /// TFile to hold the following TTrees and histograms
0087   TFile *m_outfile{nullptr};
0088   //TTree *m_clustertree;
0089   TTree *m_tracktree{nullptr};
0090   TTree *m_hepmctree{nullptr};
0091   TTree *m_truthtree{nullptr};
0092   TTree *m_globaltree{nullptr};
0093 
0094   TTree *m_pairtree{nullptr};
0095  
0096   TH1 *h_phi[2]{nullptr,nullptr};       // [0]=opp. sign, [1]=like sign
0097   TH2 *h2_eta_phi[2]{nullptr,nullptr};
0098   TH1 *h_mass[2]{nullptr,nullptr};
0099   TH1 *h_pt[2]{nullptr,nullptr};
0100   TH1 *h_y[2]{nullptr,nullptr};
0101   TH1 *h_eta[2]{nullptr,nullptr};
0102 
0103   TH1 *h_trig{nullptr};
0104   TH1 *h_ntracks{nullptr};
0105   TH2 *h2_ntrksvsb{nullptr};
0106 
0107   TH1 *h_b_mb{nullptr};
0108   TH1 *h_npart_mb{nullptr};
0109   TH1 *h_ncoll_mb{nullptr};
0110   TH1 *h_b{nullptr};
0111   TH1 *h_npart{nullptr};
0112   TH1 *h_ncoll{nullptr};
0113 
0114   const double E_MASS = 0.000510998950;  // electron mass [Gev]
0115 
0116   SvtxEvalStack *m_svtxEvalStack{nullptr};
0117   //JetEvalStack *m_jetEvalStack{nullptr};
0118 
0119   /// Methods for grabbing the data
0120   int GetNodes(PHCompositeNode *topNode);
0121   int getTracks(PHCompositeNode *topNode);
0122   //void getTruthJets(PHCompositeNode *topNode);
0123   //void getReconstructedJets(PHCompositeNode *topNode);
0124   //void getEMCalClusters(PHCompositeNode *topNode);
0125   void getHEPMCTruth();
0126   void getPHG4Truth();
0127 
0128   /// Data
0129   EventHeader *_evthdr{nullptr};
0130   SvtxTrackMap *_trackmap{nullptr};
0131   PHG4TruthInfoContainer *_truthinfo{nullptr};
0132   PHHepMCGenEventMap *_genevent_map{nullptr};
0133 
0134   void initializeVariables();
0135   void initializeTrees();
0136 
0137   /**
0138    * Make variables for the relevant trees
0139    */
0140 
0141   // Global Info
0142   Int_t   m_run{ 0 };
0143   Int_t   m_evt{ 0 };
0144   Int_t   m_npart_targ{ 0 };
0145   Int_t   m_npart_proj{ 0 };
0146   Int_t   m_npart{ 0 };
0147   Int_t   m_ncoll{ 0 };
0148   Int_t   m_ncoll_hard{ 0 };
0149   Float_t m_bimpact{ -1. };
0150   Int_t   m_ntracks{ 0 };       // total reconstructed ntracks
0151   Int_t   m_ntrk_sphenix{ 0 };  // monte carlo tracks in sphenix acceptance (>0.4 pt, |eta|<1.1)
0152   Int_t   m_ntrk_mc{ 0 };       // total monte carlo charged tracks
0153 
0154   /// HEPMC Tree variables
0155   int m_partid1;
0156   int m_partid2;
0157   double m_x1;
0158   double m_x2;
0159   int m_mpi;
0160   int m_process_id;
0161   double m_truthenergy;
0162   double m_trutheta;
0163   double m_truthphi;
0164   double m_truthpx;
0165   double m_truthpy;
0166   double m_truthpz;
0167   double m_truthpt;
0168   double m_truthp;
0169   int m_numparticlesinevent;
0170   int m_truthpid;
0171   int m_truthcharge;
0172 
0173 
0174   /// Track variables
0175   double m_tr_px;
0176   double m_tr_py;
0177   double m_tr_pz;
0178   double m_tr_p;
0179   double m_tr_pt;
0180   double m_tr_phi;
0181   double m_tr_eta;
0182   int m_charge;
0183   double m_chisq;
0184   int m_ndf;
0185   double m_dca;
0186   double m_tr_x;
0187   double m_tr_y;
0188   double m_tr_z;
0189   int m_truth_is_primary;
0190   double m_truthtrackpx;
0191   double m_truthtrackpy;
0192   double m_truthtrackpz;
0193   double m_truthtrackp;
0194   double m_truthtracke;
0195   double m_truthtrackpt;
0196   double m_truthtrackphi;
0197   double m_truthtracketa;
0198   int m_truthtrackpid;
0199 
0200   /// Pair variables
0201   Double_t m_pm{ 0. };    // pair mass
0202   Double_t m_ppt{ 0. };
0203   Double_t m_pphi{ 0. };
0204   Double_t m_py{ 0. };
0205   Double_t m_peta{ 0. };
0206   Double_t m_pdphi{ 0. };
0207   Double_t m_ppt1{ 0. };
0208   Double_t m_ppz1{ 0. };
0209   Double_t m_pphi1{ 0. };
0210   Double_t m_peta1{ 0. };
0211   Double_t m_ppt2{ 0. };
0212   Double_t m_ppz2{ 0. };
0213   Double_t m_pphi2{ 0. };
0214   Double_t m_peta2{ 0. };
0215   Short_t  m_pq1{ 0 };
0216   Short_t  m_pq2{ 0 };
0217  
0218   /// Reconstructed jet variables
0219   /*
0220   double m_recojetpt;
0221   int m_recojetid;
0222   double m_recojetpx;
0223   double m_recojetpy;
0224   double m_recojetpz;
0225   double m_recojetphi;
0226   double m_recojetp;
0227   double m_recojetenergy;
0228   double m_recojeteta;
0229   int m_truthjetid;
0230   double m_truthjetp;
0231   double m_truthjetphi;
0232   double m_truthjeteta;
0233   double m_truthjetpt;
0234   double m_truthjetenergy;
0235   double m_truthjetpx;
0236   double m_truthjetpy;
0237   double m_truthjetpz;
0238   double m_dR;
0239   */
0240 
0241   /// Cluster variables
0242   /*
0243   double m_clusenergy;
0244   double m_cluseta;
0245   double m_clustheta;
0246   double m_cluspt;
0247   double m_clusphi;
0248   double m_cluspx;
0249   double m_cluspy;
0250   double m_cluspz;
0251   double m_E_4x4;
0252   */
0253 };
0254 
0255 #endif  // ANAUPC_H