Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:13:23

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef EMJETVAL_H
0004 #define EMJETVAL_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 #include <jetbase/Jetv1.h>
0008 #include <jetbase/Jetv2.h>
0009 #include <fastjet/PseudoJet.hh>
0010 
0011 #include <string>
0012 #include <vector>
0013 
0014 #include <TFile.h>
0015 #include <TH1F.h>
0016 #include <TH2D.h>
0017 
0018 
0019 using namespace fastjet;
0020 
0021 class PHCompositeNode;
0022 class TTree;
0023 
0024 class EMJetVal : public SubsysReco
0025 {
0026  public:
0027 
0028   EMJetVal(const std::string &recojetname = "AntiKt_Tower_r04",
0029        const std::string &truthjetname = "AntiKt_Truth_r04",
0030        const std::string &outputfilename = "myjetanalysis.root");
0031  
0032  std::vector<fastjet::PseudoJet> eventVector;
0033     
0034   int retrieveEvent(const fastjet::PseudoJet& jet);
0035 
0036   //  int retrieveEvent(vector<PseudoJet>& event);
0037 
0038   ~EMJetVal() override;
0039 
0040   void
0041     setEtaRange(double low, double high)
0042   {
0043     m_etaRange.first = low;
0044     m_etaRange.second = high;
0045   }
0046   void
0047     setPtRange(double low, double high)
0048   {
0049     m_ptRange.first = low;
0050     m_ptRange.second = high;
0051   }
0052   void
0053     doTruth(int flag)
0054   {
0055     m_doTruthJets = flag;
0056   }
0057   void
0058     doSeeds(int flag)
0059   {
0060     m_doSeeds = flag;
0061   }
0062   void
0063     doUnsub(int flag)
0064   {
0065     m_doUnsubJet = flag;
0066   }
0067   /** Called during initialization.
0068       Typically this is where you can book histograms, and e.g.
0069       register them to Fun4AllServer (so they can be output to file
0070       using Fun4AllServer::dumpHistos() method).
0071   */
0072   int Init(PHCompositeNode *topNode) override;
0073 
0074   /** Called for first event when run number is known.
0075       Typically this is where you may want to fetch data from
0076       database, because you know the run number. A place
0077       to book histograms which have to know the run number.
0078   */
0079   int InitRun(PHCompositeNode *topNode) override;
0080 
0081   /** Called for each event.
0082       This is where you do the real work.
0083   */
0084   int process_event(PHCompositeNode *topNode) override;
0085 
0086   /// Clean up internals after each event.
0087   int ResetEvent(PHCompositeNode *topNode) override;
0088 
0089   /// Called at the end of each run.
0090   int EndRun(const int runnumber) override;
0091 
0092   /// Called at the end of all processing.
0093   int End(PHCompositeNode *topNode) override;
0094 
0095   /// Reset
0096   int Reset(PHCompositeNode * /*topNode*/) override;
0097 
0098   void Print(const std::string &what = "ALL") const override;
0099 
0100  private:
0101   std::string m_recoJetName;
0102   std::string m_truthJetName;
0103   std::string m_outputFileName;
0104   std::pair<double, double> m_etaRange;
0105   std::pair<double, double> m_ptRange;
0106   int m_doTruthJets;
0107   int m_doSeeds;
0108   int m_doUnsubJet;
0109 
0110   //! Output Tree variables
0111   TTree *m_T;
0112   TFile* outFile;
0113   TH1F *_h_R04_z_sj_10_20;
0114   TH1F *_h_R04_theta_sj_10_20;
0115   TH1F *_h_R04_z_g_10_20;
0116   TH1F *_h_R04_theta_g_10_20;
0117   TH1F *_hmult_R04;
0118   //softDrop multiplicity hists
0119   TH1F *_hmult_R04_pT_10_20GeV;
0120   TH1F *_hjetpT_R04;
0121   TH1F *_hjeteta_R04;
0122   //correlation figures
0123   TH2D *correlation_theta_10_20;
0124   TH2D *correlation_z_10_20;
0125 
0126 
0127   //! eventwise quantities
0128   int m_event;
0129   int m_nTruthJet;
0130   int m_nJet;
0131   float m_totalCalo;
0132   int m_centrality;
0133   float m_impactparam;
0134 
0135   //! reconstructed jets
0136   std::vector<int> m_id;
0137   std::vector<int> m_nComponent;
0138   std::vector<float> m_eta;
0139   std::vector<float> m_phi;
0140   std::vector<float> m_e;
0141   std::vector<float> m_pt;
0142 
0143   //! unsubtracted jets
0144   std::vector<float> m_unsub_pt;
0145   std::vector<float> m_sub_et;
0146 
0147   //! truth jets
0148   std::vector<int> m_truthID;
0149   std::vector<int> m_truthNComponent;
0150   std::vector<float> m_truthEta;
0151   std::vector<float> m_truthPhi;
0152   std::vector<float> m_truthE;
0153   std::vector<float> m_truthPt;
0154   std::vector<float> m_truthdR;
0155 
0156   //! seed jets
0157   std::vector<float> m_eta_rawseed;
0158   std::vector<float> m_phi_rawseed;
0159   std::vector<float> m_pt_rawseed;
0160   std::vector<float> m_e_rawseed;
0161   std::vector<int> m_rawseed_cut;
0162   std::vector<float> m_eta_subseed;
0163   std::vector<float> m_phi_subseed;
0164   std::vector<float> m_pt_subseed;
0165   std::vector<float> m_e_subseed;
0166   std::vector<int> m_subseed_cut;
0167 };
0168 
0169 #endif // EMJETVAL_H