Back to home page

sPhenix code displayed by LXR

 
 

    


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

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