File indexing completed on 2025-08-06 08:18:46
0001 #ifndef QA_QAG4SIMULATIONJET_H
0002 #define QA_QAG4SIMULATIONJET_H
0003
0004 #include <fun4all/SubsysReco.h>
0005
0006 #include <TString.h>
0007
0008 #include <cstdint>
0009 #include <map>
0010 #include <memory>
0011 #include <set>
0012 #include <string>
0013 #include <utility> // std::pair, std::make_pair
0014
0015 class JetEvalStack;
0016 class JetTruthEval;
0017 class Jet;
0018 class PHCompositeNode;
0019
0020
0021 class QAG4SimulationJet : public SubsysReco
0022 {
0023 public:
0024 enum enu_flags
0025 {
0026
0027 kProcessTruthSpectrum = 1 << 1,
0028
0029
0030 kProcessRecoSpectrum = 1 << 2,
0031
0032
0033 kProcessTruthMatching = 1 << 3,
0034
0035
0036 kDefaultFlag = kProcessTruthSpectrum | kProcessRecoSpectrum | kProcessTruthMatching
0037 };
0038
0039 QAG4SimulationJet(const std::string &truth_jet, enu_flags flags =
0040 kDefaultFlag);
0041 virtual ~QAG4SimulationJet() {}
0042
0043
0044
0045 int add_reco_jet(const std::string &reco_jet)
0046 {
0047 _reco_jets.insert(reco_jet);
0048 return _reco_jets.size();
0049 }
0050
0051 uint32_t
0052 get_flags() const
0053 {
0054 return _flags;
0055 }
0056
0057 void
0058 set_flags(enu_flags flags)
0059 {
0060 _flags = (uint32_t) flags;
0061 }
0062
0063 void
0064 set_flag(enu_flags flag)
0065 {
0066 _flags |= (uint32_t) flag;
0067 }
0068
0069 bool
0070 flag(enu_flags flag)
0071 {
0072 return _flags & flag;
0073 }
0074
0075 void
0076 reset_flag(enu_flags flag)
0077 {
0078 _flags &= ~(uint32_t) flag;
0079 }
0080
0081
0082 double
0083 get_jet_match_dE_Ratio() const
0084 {
0085 return _jet_match_dE_Ratio;
0086 }
0087
0088
0089 void
0090 set_jet_match_dE_Ratio(double jetMatchDERatio)
0091 {
0092 _jet_match_dE_Ratio = jetMatchDERatio;
0093 }
0094
0095
0096 double
0097 get_jet_match_dEta() const
0098 {
0099 return _jet_match_dEta;
0100 }
0101
0102
0103 void
0104 set_jet_match_dEta(double jetMatchDEta)
0105 {
0106 _jet_match_dEta = jetMatchDEta;
0107 }
0108
0109
0110 double
0111 get_jet_match_dPhi() const
0112 {
0113 return _jet_match_dPhi;
0114 }
0115
0116
0117 void
0118 set_jet_match_dPhi(double jetMatchDPhi)
0119 {
0120 _jet_match_dPhi = jetMatchDPhi;
0121 }
0122
0123
0124 void
0125 set_eta_range(double low, double high);
0126
0127 int Init(PHCompositeNode *topNode);
0128 int InitRun(PHCompositeNode *topNode);
0129 int process_event(PHCompositeNode *topNode);
0130
0131 private:
0132 int Init_Spectrum(PHCompositeNode *topNode, const std::string &jet_name);
0133 int process_Spectrum(PHCompositeNode *topNode, const std::string &jet_name, const bool is_reco_jet);
0134
0135 int Init_TruthMatching(PHCompositeNode *topNode, const std::string &reco_jet_name);
0136 int process_TruthMatching(PHCompositeNode *topNode,
0137 const std::string &reco_jet_name);
0138
0139
0140 std::string
0141 get_histo_prefix(const std::string &src_jet_name = "",
0142 const std::string &reco_jet_name = "");
0143
0144
0145 typedef std::map<std::string, std::shared_ptr<JetEvalStack>> jetevalstacks_map;
0146 jetevalstacks_map _jetevalstacks;
0147 std::shared_ptr<JetTruthEval> _jettrutheval;
0148
0149
0150 std::string _truth_jet;
0151
0152
0153 std::set<std::string> _reco_jets;
0154
0155 uint32_t _flags;
0156
0157
0158 std::pair<double, double> eta_range;
0159
0160
0161
0162 TString
0163 get_eta_range_str(const char *eta_name = "#eta_{Jet}") const;
0164
0165
0166 bool
0167 jet_acceptance_cut(const Jet *jet) const;
0168
0169
0170 double _jet_match_dEta;
0171
0172
0173 double _jet_match_dPhi;
0174
0175
0176 double _jet_match_dE_Ratio;
0177 };
0178
0179 #endif