Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:43

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef DIJETQA_H
0004 #define DIJETQA_H
0005 
0006 #include "jetqa/JetQADefs.h"
0007 
0008 #include <calobase/RawTower.h>
0009 #include <calobase/RawTowerContainer.h>
0010 #include <calobase/RawTowerGeom.h>
0011 #include <calobase/RawTowerGeomContainer.h>
0012 #include <calobase/TowerInfo.h>
0013 #include <calobase/TowerInfoContainer.h>
0014 
0015 #include <calotrigger/TriggerAnalyzer.h>
0016 
0017 #include <centrality/CentralityInfo.h>
0018 
0019 #include <fun4all/Fun4AllBase.h>
0020 #include <fun4all/Fun4AllHistoManager.h>
0021 #include <fun4all/Fun4AllReturnCodes.h>
0022 #include <fun4all/SubsysReco.h>
0023 
0024 #include <globalvertex/GlobalVertex.h>
0025 #include <globalvertex/GlobalVertexMap.h>
0026 
0027 #include <jetbase/JetContainer.h>
0028 #include <jetbase/JetMap.h>
0029 #include <jetbase/Jetv1.h>
0030 #include <jetbase/Jetv2.h>
0031 
0032 #include <phool/PHCompositeNode.h>
0033 #include <phool/getClass.h>
0034 
0035 #include <qautils/QAHistManagerDef.h>
0036 
0037 #include <TFile.h>
0038 #include <TH1.h>
0039 #include <TH2.h>
0040 #include <TTree.h>
0041 
0042 #include <cstdlib>
0043 #include <math.h>
0044 #include <string>
0045 #include <unordered_set>
0046 #include <utility>
0047 #include <vector>
0048 #include <boost/format.hpp>
0049 
0050 #define PI 3.1415926535
0051 
0052 class PHCompositeNode;
0053 
0054 class DijetQA : public SubsysReco
0055 {
0056  public:
0057   DijetQA(const std::string &name = "DijetQA", const std::string &recojetname="AntiKt_Tower_r04");
0058 
0059   ~DijetQA() override;
0060 
0061   /** Called during initialization.
0062       Typically this is where you can book histograms, and e.g.
0063       register them to Fun4AllServer (so they can be output to file
0064       using Fun4AllServer::dumpHistos() method).
0065    */
0066   int Init(PHCompositeNode *topNode) override;
0067 
0068   /** Called for first event when run number is known.
0069       Typically this is where you may want to fetch data from
0070       database, because you know the run number. A place
0071       to book histograms which have to know the run number.
0072    */
0073   int InitRun(PHCompositeNode *topNode) override;
0074 
0075   /** Called for each event.
0076       This is where you do the real work.
0077    */
0078   int process_event(PHCompositeNode *topNode) override;
0079   void FindPairs(JetContainer *);
0080 
0081   /// Clean up internals after each event.
0082   int ResetEvent(PHCompositeNode *topNode) override;
0083 
0084   /// Called at the end of each run.
0085   int EndRun(const int runnumber) override;
0086 
0087   /// Called at the end of all processing.
0088   int End(PHCompositeNode *topNode) override;
0089 
0090   /// Reset
0091   int Reset(PHCompositeNode * /*topNode*/) override;
0092 
0093   /// Print something
0094   void Print(const std::string &what = "ALL") const override;
0095 
0096   /// Set the eta range for reco jets
0097   void setEtaRange(double low, double high)
0098   {
0099     m_etaRange.first = low;
0100     m_etaRange.second = high;
0101   }
0102 
0103   /// Set the leading pt range for the reco jets
0104   void setPtLeadRange(double low, double high)
0105   {
0106     m_ptLeadRange.first = low;
0107     m_ptLeadRange.second = high;
0108   }
0109 
0110   /// Set the sub-leading pt range for the reco jets
0111   void setPtSubRange(double low, double high)
0112   {
0113     m_ptSubRange.first = low;
0114     m_ptSubRange.second = high;
0115   }
0116 
0117   /// Specifies a trigger to require
0118   void setTrgToSelect(const uint32_t trig = JetQADefs::GL1::MBDNSJet1)
0119   {
0120     m_doTrgSelect = true;
0121     m_trgToSelect = trig;
0122   }
0123 
0124   //////////////////////////////////////////////////////////////
0125   //                                //
0126   //        X_j = (p_(T, 1))/(p_(T,2))              //
0127   //        A_j = (p_(T, 1) -p_(T,2))/P_T               //
0128   //                                //
0129   //////////////////////////////////////////////////////////////
0130 
0131  private:
0132   std::string m_moduleName;
0133   std::pair<float, float> m_etaRange;
0134   std::pair<float, float> m_ptLeadRange;
0135   std::pair<float, float> m_ptSubRange;
0136   float DeltaPhiOne{3.141529694 / 32.};  // cut on the opening angle of phi for the identified jets
0137                                           // Should set to integer multilple of hcal phi tower size ->Pi/32
0138   int ntowers_opening{2};
0139   float DeltaPhi{ntowers_opening * DeltaPhiOne};
0140   int m_nJet, m_nJetPair;
0141   float /* m_centrality = 0.,*/ m_zvtx,/* m_impactparam = 0., */m_Ajj, m_xj, m_ptl, m_ptsl;
0142   float m_phil, m_phisl, m_dphil, m_dphi, m_etal, m_etasl, m_deltaeta;
0143   TH1F *h_Ajj{nullptr}, *h_xj{nullptr}, *h_pt{nullptr}, *h_dphi{nullptr};
0144   TH2F *h_Ajj_pt{nullptr}, *h_xj_pt{nullptr}, *h_dphi_pt{nullptr}, *h_dphi_Ajj{nullptr};
0145   TH1F *h_Ajj_l{nullptr}, *h_xj_l{nullptr}, *h_pt_l{nullptr}, *h_dphi_l{nullptr};
0146   TH2F *h_Ajj_pt_l{nullptr}, *h_xj_pt_l{nullptr}, *h_dphi_pt_l{nullptr}, *h_dphi_Ajj_l{nullptr};
0147   bool m_doTrgSelect;
0148   uint32_t m_trgToSelect;
0149   std::string m_recoJetName;
0150   Fun4AllHistoManager *m_manager{nullptr};
0151   TriggerAnalyzer *m_analyzer{nullptr};
0152 };
0153 
0154 #endif  // DIJETQA_H