Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:27

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef INCLUSIVEJET_H
0004 #define INCLUSIVEJET_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 #include <jetbase/Jetv1.h>
0008 #include <jetbase/Jetv2.h>
0009 
0010 #include <string>
0011 #include <vector>
0012 
0013 #include <TFile.h>
0014 #include <TH1F.h>
0015 #include <TH2D.h>
0016 
0017 
0018 class PHCompositeNode;
0019 class TTree;
0020 class SvtxTrackState;
0021 
0022 class InclusiveJet : public SubsysReco
0023 {
0024  public:
0025 
0026   InclusiveJet(const std::string &recojetname = "AntiKt_Tower_r04",
0027         const std::string &truthjetname = "AntiKt_Truth_r04",
0028         const std::string &outputfilename = "myjetanalysis.root");
0029 
0030   ~InclusiveJet() override;
0031 
0032   void
0033     setEtaRange(double low, double high)
0034   {
0035     m_etaRange.first = low;
0036     m_etaRange.second = high;
0037   }
0038  void
0039    setPtRange(double low, double high)
0040  {
0041    m_ptRange.first = low;
0042    m_ptRange.second = high;
0043  }
0044  void
0045    doTruth(int flag)
0046  {
0047    m_doTruthJets = flag;
0048  }
0049  void
0050    doTruthParticles(int flag)
0051   {
0052     m_doTruth = flag;
0053   }
0054  void
0055    doSeeds(int flag)
0056  {
0057    m_doSeeds = flag;
0058  }
0059  void 
0060   doTowers(int flag)
0061   {
0062     m_doTowers = flag;
0063   }
0064   void
0065   doTopoclusters(int flag)
0066   {
0067     m_doTopoclusters = flag;
0068   }
0069   void
0070   doEmcalClusters(int flag)
0071   {
0072     m_doEmcalClusters = flag;
0073   }
0074   void
0075   doTracks(int flag) 
0076   {
0077     m_doTracks = flag;
0078   }
0079   void
0080   doJetTriggerCut(int flag)
0081   {
0082     m_doTriggerCut = flag;
0083   }
0084   void 
0085   doJetLeadPtCut(int flag)
0086   {
0087     m_doLeadPtCut = flag;
0088   }
0089   void
0090   setLeadPtCut(float leadpt)
0091   {
0092     m_doLeadPtCut = true;
0093     m_leadPtCut = leadpt;
0094   }
0095 
0096   float calculateProjectionEta(SvtxTrackState* projectedState);
0097   float calculateProjectionPhi(SvtxTrackState* projectedState);
0098 
0099   /** Called during initialization.
0100       Typically this is where you can book histograms, and e.g.
0101       register them to Fun4AllServer (so they can be output to file
0102       using Fun4AllServer::dumpHistos() method).
0103    */
0104   int Init(PHCompositeNode *topNode) override;
0105 
0106   /** Called for first event when run number is known.
0107       Typically this is where you may want to fetch data from
0108       database, because you know the run number. A place
0109       to book histograms which have to know the run number.
0110    */
0111   int InitRun(PHCompositeNode *topNode) override;
0112 
0113   /** Called for each event.
0114       This is where you do the real work.
0115    */
0116   int process_event(PHCompositeNode *topNode) override;
0117 
0118   /// Clean up internals after each event.
0119   int ResetEvent(PHCompositeNode *topNode) override;
0120 
0121   /// Called at the end of each run.
0122   int EndRun(const int runnumber) override;
0123 
0124   /// Called at the end of all processing.
0125   int End(PHCompositeNode *topNode) override;
0126 
0127   /// Reset
0128   int Reset(PHCompositeNode * /*topNode*/) override;
0129 
0130   void Print(const std::string &what = "ALL") const override;
0131 
0132  private:
0133   std::string m_recoJetName;
0134   std::string m_truthJetName;
0135   std::string m_outputFileName;
0136   std::pair<double, double> m_etaRange;
0137   std::pair<double, double> m_ptRange;
0138   int m_doTruthJets;
0139   int m_doTruth;
0140   int m_doTowers;
0141   int m_doEmcalClusters;
0142   int m_doTopoclusters;
0143   int m_doSeeds;
0144   int m_doTracks;
0145 
0146   //! Output Tree variables
0147   TTree *m_T;
0148 
0149   //! eventwise quantities
0150   int m_event;
0151   int m_nTruthJet;
0152   int m_nJet;
0153 
0154   //!trigger info
0155   std::vector<int> m_triggerVector;
0156 
0157   //! reconstructed jets
0158   std::vector<int> m_nComponent;
0159   std::vector<float> m_eta;
0160   std::vector<float> m_phi;
0161   std::vector<float> m_e;
0162   std::vector<float> m_pt;
0163   std::vector<float> m_jetEmcalE;
0164   std::vector<float> m_jetIhcalE;
0165   std::vector<float> m_jetOhcalE;
0166 
0167   //! truth jets
0168   std::vector<int> m_truthNComponent;
0169   std::vector<float> m_truthEta;
0170   std::vector<float> m_truthPhi;
0171   std::vector<float> m_truthE;
0172   std::vector<float> m_truthPt;
0173   std::vector<float> m_truthdR;
0174 
0175   //! seed jets
0176   std::vector<float> m_eta_rawseed;
0177   std::vector<float> m_phi_rawseed;
0178   std::vector<float> m_pt_rawseed;
0179   std::vector<float> m_e_rawseed;
0180   std::vector<int> m_rawseed_cut;
0181   std::vector<float> m_eta_subseed;
0182   std::vector<float> m_phi_subseed;
0183   std::vector<float> m_pt_subseed;
0184   std::vector<float> m_e_subseed;
0185   std::vector<int> m_subseed_cut;
0186 
0187   bool m_doTriggerCut = false;
0188   bool m_doLeadPtCut = true;
0189   
0190   float m_totalCalo;
0191   float m_zvtx;
0192 
0193   float m_leadPtCut = 10.0;
0194 
0195   int m_emcaln = 0;
0196   float m_emcale[24576] = {0}; 
0197   float m_emcalchi2[24576] = {0}; 
0198   float m_emcaleta[24576] = {0};
0199   float m_emcalphi[24576] = {0};
0200   int m_emcalieta[24576] = {0};
0201   int m_emcaliphi[24576] = {0};
0202   int m_emcalstatus[24576] = {0};
0203   float m_emcaltime[24576] = {0};
0204   int m_ihcaln = 0;
0205   float m_ihcale[1536] = {0};
0206   float m_ihcalchi2[1536] = {0};
0207   float m_ihcaleta[1536] = {0};
0208   float m_ihcalphi[1536] = {0};
0209   int m_ihcalieta[1536] = {0};
0210   int m_ihcaliphi[1536] = {0};
0211   int m_ihcalstatus[1536] = {0};
0212   float m_ihcaltime[1536] = {0};
0213   int m_ohcaln = 0;
0214   float m_ohcale[1536] = {0};
0215   float m_ohcalchi2[1536] = {0};
0216   float m_ohcaleta[1536] = {0};
0217   float m_ohcalphi[1536] = {0};
0218   int m_ohcalieta[1536] = {0};
0219   int m_ohcaliphi[1536] = {0};
0220   int m_ohcalstatus[1536] = {0};
0221   float m_ohcaltime[1536] = {0};
0222 
0223   int truthpar_n;
0224   float truthpar_pz[100000];
0225   float truthpar_pt[100000];
0226   float truthpar_e[100000];
0227   float truthpar_eta[100000];
0228   float truthpar_phi[100000];
0229   int truthpar_pid[100000];
0230 
0231   int m_emcal_clsmult;
0232   float m_emcal_cluster_e[2000];
0233   float m_emcal_cluster_eta[2000];
0234   float m_emcal_cluster_phi[2000];
0235 
0236   int m_clsmult;
0237   float m_cluster_e[2000];
0238   float m_cluster_eta[2000];
0239   float m_cluster_phi[2000];
0240   int m_cluster_ntowers[2000];
0241   int m_cluster_tower_calo[2000][500];
0242   int m_cluster_tower_ieta[2000][500];
0243   int m_cluster_tower_iphi[2000][500];
0244   float m_cluster_tower_e[2000][500];
0245 
0246   int m_trkmult;
0247   unsigned int _nlayers_maps = 3;
0248   unsigned int _nlayers_intt = 4;
0249   unsigned int _nlayers_tpc = 48;
0250   float m_tr_p[2000];
0251   float m_tr_pt[2000];
0252   float m_tr_eta[2000];
0253   float m_tr_phi[2000];
0254   int m_tr_charge[2000];
0255   float m_tr_chisq[2000];
0256   int m_tr_ndf[2000];
0257   int m_tr_nintt[2000];
0258   int m_tr_nmaps[2000];
0259   int m_tr_ntpc[2000];
0260   float m_tr_quality[2000];
0261   int m_tr_vertex_id[2000];
0262   float m_tr_cemc_eta[2000]; // Projection of track to calorimeters
0263   float m_tr_cemc_phi[2000];
0264   float m_tr_ihcal_eta[2000];
0265   float m_tr_ihcal_phi[2000];
0266   float m_tr_ohcal_eta[2000];
0267   float m_tr_ohcal_phi[2000];
0268   float m_tr_outer_cemc_eta[2000];
0269   float m_tr_outer_cemc_phi[2000];
0270   float m_tr_outer_ihcal_eta[2000];
0271   float m_tr_outer_ihcal_phi[2000];
0272   float m_tr_outer_ohcal_eta[2000];
0273   float m_tr_outer_ohcal_phi[2000];
0274 
0275   // Calorimeter radii
0276   double m_cemcRadius;
0277   double m_ihcalRadius;
0278   double m_ohcalRadius;
0279   double m_cemcOuterRadius;
0280   double m_ihcalOuterRadius;
0281   double m_ohcalOuterRadius;
0282 
0283   // Vertex ids and positions, also stored on track tree
0284   int m_vertex_id[100];
0285   float m_vx[100];
0286   float m_vy[100];
0287   float m_vz[100];
0288 
0289   // Matched truth track
0290   int m_tr_truth_is_primary[2000];
0291   int m_tr_truth_pid[2000];
0292   float m_tr_truth_e[2000];
0293   float m_tr_truth_pt[2000];
0294   float m_tr_truth_eta[2000];
0295   float m_tr_truth_phi[2000];
0296   int m_tr_truth_track_id[2000];
0297 
0298 
0299 };
0300 
0301 #endif // INCLUSIVEJET_H