Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef __SoftLeptonTaggingTruth_H__
0002 #define __SoftLeptonTaggingTruth_H__
0003 
0004 #include <fun4all/SubsysReco.h>
0005 #include <phool/PHCompositeNode.h>
0006 
0007 #include <string>
0008 #include <set>
0009 #include <map>
0010 #include <utility>      // std::pair, std::make_pair
0011 #include <stdint.h>
0012 #ifndef __CINT__
0013 #include <memory>
0014 #endif
0015 
0016 #include <TString.h>
0017 
0018 class PHCompositeNode;
0019 class Fun4AllHistoManager;
0020 class TH1F;
0021 class JetEvalStack;
0022 class JetTruthEval;
0023 class Jet;
0024 class TAxis;
0025 class PHG4TruthInfoContainer;
0026 
0027 /// \class SoftLeptonTaggingTruth
0028 class SoftLeptonTaggingTruth : public SubsysReco
0029 {
0030 
0031 public:
0032 
0033   enum enu_flags
0034   {
0035     //! spectrum of truth jets
0036     kProcessTruthSpectrum = 1 << 1,
0037 
0038     kDefaultFlag = kProcessTruthSpectrum
0039   };
0040 
0041   SoftLeptonTaggingTruth(const std::string & truth_jet, enu_flags flags =
0042       kDefaultFlag);
0043   virtual
0044   ~SoftLeptonTaggingTruth();
0045 
0046   //! add reco jet to the process list
0047   //! @return number of reco jet on list
0048   int
0049   add_reco_jet(const std::string & reco_jet)
0050   {
0051     _reco_jets.insert(reco_jet);
0052     return _reco_jets.size();
0053   }
0054 
0055   uint32_t
0056   get_flags() const
0057   {
0058     return _flags;
0059   }
0060 
0061   void
0062   set_flags(enu_flags flags)
0063   {
0064     _flags = (uint32_t) flags;
0065   }
0066 
0067   void
0068   set_flag(enu_flags flag)
0069   {
0070     _flags |= (uint32_t) flag;
0071   }
0072 
0073   bool
0074   flag(enu_flags flag)
0075   {
0076     return _flags & flag;
0077   }
0078 
0079   void
0080   reset_flag(enu_flags flag)
0081   {
0082     _flags &= ~(uint32_t) flag;
0083   }
0084 
0085   //! Energy ratio difference cut from 1 for matched jets
0086   double
0087   get_jet_match_E_Ratio() const
0088   {
0089     return _jet_match_E_Ratio;
0090   }
0091 
0092   //! Energy ratio difference cut from 1 for matched jets
0093   void
0094   set_jet_match_E_Ratio(double jetMatchDERatio)
0095   {
0096     _jet_match_E_Ratio = jetMatchDERatio;
0097   }
0098 
0099   //! Eta difference cut for matched jets
0100   double
0101   get_jet_match_dR() const
0102   {
0103     return _jet_match_dR;
0104   }
0105 
0106   //! Eta difference cut for matched jets
0107   void
0108   set_jet_match_dR(double jetMatchDEta)
0109   {
0110     _jet_match_dR = jetMatchDEta;
0111   }
0112 
0113   //! Phi difference cut for matched jets
0114   double
0115   get_jet_match_dca() const
0116   {
0117     return _jet_match_dca;
0118   }
0119 
0120   //! Phi difference cut for matched jets
0121   void
0122   set_jet_match_dca(double jetMatchDPhi)
0123   {
0124     _jet_match_dca = jetMatchDPhi;
0125   }
0126 
0127   //! set eta range
0128   void
0129   set_eta_range(double low, double high);
0130 
0131   int
0132   Init(PHCompositeNode *topNode);
0133   int
0134   InitRun(PHCompositeNode *topNode);
0135   int
0136   process_event(PHCompositeNode *topNode);
0137   int
0138   End(PHCompositeNode *topNode);
0139 
0140   //! Get a pointer to the default hist manager for QA modules
0141   static Fun4AllHistoManager *
0142   getHistoManager();
0143 
0144 private:
0145 
0146   void
0147   useLogBins(TAxis * axis);
0148 
0149   int
0150   Init_Spectrum(PHCompositeNode *topNode, const std::string & jet_name);
0151   int
0152   process_Spectrum(PHCompositeNode *topNode, const std::string & jet_name,
0153       const bool is_reco_jet);
0154 
0155   //! common prefix for QA histograms
0156   std::string
0157   get_histo_prefix(const std::string & src_jet_name = "",
0158       const std::string & reco_jet_name = "");
0159 
0160 #ifndef __CINT__
0161   //! cache the jet evaluation modules
0162   typedef std::map<std::string, std::shared_ptr<JetEvalStack>> jetevalstacks_map;
0163   jetevalstacks_map _jetevalstacks;
0164   std::shared_ptr<JetTruthEval> _jettrutheval;
0165 #endif
0166 
0167   //! truth jet name
0168   std::string _truth_jet;
0169 
0170   //! list of reco jet
0171   std::set<std::string> _reco_jets;
0172 
0173   PHG4TruthInfoContainer* _truth_container;
0174 
0175   uint32_t _flags;
0176 
0177   //! eta range
0178   std::pair<double, double> eta_range;
0179 
0180   //! string description of eta range
0181   //! @return TString as ROOT likes
0182   TString
0183   get_eta_range_str(const char * eta_name = "#eta_{Jet}") const;
0184 
0185   //! acceptance cut on jet object
0186   bool
0187   jet_acceptance_cut(const Jet * jet) const;
0188 
0189   //! Eta difference cut for matched jets
0190   double _jet_match_dR;
0191 
0192   //! Phi difference cut for matched jets
0193   double _jet_match_dca;
0194 
0195   //! Energy ratio difference cut from 1 for matched jets
0196   double _jet_match_E_Ratio;
0197 };
0198 
0199 #endif // __CALOEVALUATOR_H__