File indexing completed on 2025-12-17 09:21:23
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 = kDefaultFlag);
0040 ~QAG4SimulationJet() override = default;
0041
0042
0043
0044 int add_reco_jet(const std::string &reco_jet)
0045 {
0046 _reco_jets.insert(reco_jet);
0047 return _reco_jets.size();
0048 }
0049
0050 uint32_t
0051 get_flags() const
0052 {
0053 return _flags;
0054 }
0055
0056 void
0057 set_flags(enu_flags flags)
0058 {
0059 _flags = (uint32_t) flags;
0060 }
0061
0062 void
0063 set_flag(enu_flags flag)
0064 {
0065 _flags |= (uint32_t) flag;
0066 }
0067
0068 bool
0069 flag(enu_flags flag)
0070 {
0071 return _flags & flag;
0072 }
0073
0074 void
0075 reset_flag(enu_flags flag)
0076 {
0077 _flags &= ~(uint32_t) flag;
0078 }
0079
0080
0081 double
0082 get_jet_match_dE_Ratio() const
0083 {
0084 return _jet_match_dE_Ratio;
0085 }
0086
0087
0088 void
0089 set_jet_match_dE_Ratio(double jetMatchDERatio)
0090 {
0091 _jet_match_dE_Ratio = jetMatchDERatio;
0092 }
0093
0094
0095 double
0096 get_jet_match_dEta() const
0097 {
0098 return _jet_match_dEta;
0099 }
0100
0101
0102 void
0103 set_jet_match_dEta(double jetMatchDEta)
0104 {
0105 _jet_match_dEta = jetMatchDEta;
0106 }
0107
0108
0109 double
0110 get_jet_match_dPhi() const
0111 {
0112 return _jet_match_dPhi;
0113 }
0114
0115
0116 void
0117 set_jet_match_dPhi(double jetMatchDPhi)
0118 {
0119 _jet_match_dPhi = jetMatchDPhi;
0120 }
0121
0122
0123 void
0124 set_eta_range(double low, double high);
0125
0126 int Init(PHCompositeNode *topNode) override;
0127 int InitRun(PHCompositeNode *topNode) override;
0128 int process_event(PHCompositeNode *topNode) override;
0129
0130 private:
0131 int Init_Spectrum(PHCompositeNode *topNode, const std::string &jet_name);
0132 int process_Spectrum(PHCompositeNode *topNode, const std::string &jet_name, const bool is_reco_jet);
0133
0134 int Init_TruthMatching(PHCompositeNode *topNode, const std::string &reco_jet_name);
0135 int process_TruthMatching(PHCompositeNode *topNode,
0136 const std::string &reco_jet_name);
0137
0138
0139 std::string
0140 get_histo_prefix(const std::string &src_jet_name = "",
0141 const std::string &reco_jet_name = "");
0142
0143
0144 typedef std::map<std::string, std::shared_ptr<JetEvalStack>> jetevalstacks_map;
0145 jetevalstacks_map _jetevalstacks;
0146 std::shared_ptr<JetTruthEval> _jettrutheval;
0147
0148
0149 std::string _truth_jet;
0150
0151
0152 std::set<std::string> _reco_jets;
0153
0154 uint32_t _flags;
0155
0156
0157 std::pair<double, double> eta_range;
0158
0159
0160
0161 std::string get_eta_range_str(const std::string &eta_name = "#eta_{Jet}") const;
0162
0163
0164 bool jet_acceptance_cut(const Jet *jet) const;
0165
0166
0167 double _jet_match_dEta;
0168
0169
0170 double _jet_match_dPhi;
0171
0172
0173 double _jet_match_dE_Ratio;
0174 };
0175
0176 #endif