File indexing completed on 2025-08-03 08:20:26
0001 #ifndef MACRO_NOBKGDSUBJETRECO_C
0002 #define MACRO_NOBKGDSUBJETRECO_C
0003
0004 #include <GlobalVariables.C>
0005
0006 #include <fun4all/Fun4AllServer.h>
0007 #include <g4jets/TruthJetInput.h>
0008 #include <globalvertex/GlobalVertex.h>
0009 #include <globalvertex/GlobalVertex.h>
0010 #include <jetbackground/FastJetAlgoSub.h>
0011 #include <jetbackground/RetowerCEMC.h>
0012 #include <jetbase/FastJetOptions.h>
0013 #include <jetbase/JetReco.h>
0014 #include <jetbase/TowerJetInput.h>
0015 #include <jetbase/TrackJetInput.h>
0016 #include <particleflowreco/ParticleFlowJetInput.h>
0017
0018 R__LOAD_LIBRARY(libg4jets.so)
0019 R__LOAD_LIBRARY(libjetbackground.so)
0020 R__LOAD_LIBRARY(libjetbase.so)
0021 R__LOAD_LIBRARY(libparticleflow.so)
0022
0023
0024
0025
0026
0027 namespace Enable
0028 {
0029 int NSJETS_VERBOSITY = 0;
0030 bool NSJETS = false;
0031 bool NSJETS_MC = false;
0032 bool NSJETS_TRUTH = false;
0033 bool NSJETS_TOWER = false;
0034 bool NSJETS_TRACK = true;
0035 bool NSJETS_PFLOW = false;
0036 }
0037
0038
0039
0040
0041
0042 namespace NSJETS
0043 {
0044
0045
0046 bool is_pp = false;
0047
0048
0049
0050 std::string tower_prefix = "TOWERINFO_CALIB";
0051
0052
0053
0054 bool do_vertex_type = true;
0055
0056
0057 GlobalVertex::VTXTYPE vertex_type = GlobalVertex::MBD;
0058
0059
0060
0061
0062 FastJetOptions fj_opts({Jet::ANTIKT, JET_R, 0.4, VERBOSITY, static_cast<float>(Enable::NSJETS_VERBOSITY)});
0063
0064
0065 std::string jet_node = "ANTIKT";
0066
0067
0068 std::string algo_prefix = "AntiKt";
0069
0070
0071
0072 enum Res {
0073 R02 = 0,
0074 R03 = 1,
0075 R04 = 2,
0076 R05 = 3
0077 };
0078
0079
0080
0081
0082 FastJetAlgoSub* GetFJAlgo(const float reso)
0083 {
0084
0085
0086
0087 FastJetOptions opts = fj_opts;
0088 opts.jet_R = reso;
0089
0090
0091 return new FastJetAlgoSub(opts);
0092
0093 }
0094 }
0095
0096
0097
0098
0099
0100 void MakeNSTruthJets()
0101 {
0102
0103
0104 int verbosity = std::max(Enable::VERBOSITY, Enable::NSJETS_VERBOSITY);
0105
0106
0107
0108
0109 Fun4AllServer *se = Fun4AllServer::instance();
0110
0111
0112 if (Enable::NSJETS_TRACK)
0113 {
0114
0115 JetReco* chrgTruthJets = new JetReco();
0116 chrgTruthJets->add_input(new TruthJetInput(Jet::SRC::CHARGED_PARTICLE));
0117 chrgTruthJets->add_algo(NSJETS::GetFJAlgo(0.2), NSJETS::algo_prefix + "_ChargedTruth_r02");
0118 chrgTruthJets->add_algo(NSJETS::GetFJAlgo(0.3), NSJETS::algo_prefix + "_ChargedTruth_r03");
0119 chrgTruthJets->add_algo(NSJETS::GetFJAlgo(0.4), NSJETS::algo_prefix + "_ChargedTruth_r04");
0120 chrgTruthJets->add_algo(NSJETS::GetFJAlgo(0.5), NSJETS::algo_prefix + "_ChargedTruth_r05");
0121 chrgTruthJets->set_algo_node(NSJETS::jet_node);
0122 chrgTruthJets->set_input_node("TRUTH");
0123 chrgTruthJets->Verbosity(verbosity);
0124 se->registerSubsystem(chrgTruthJets);
0125 }
0126
0127
0128 if (Enable::NSJETS_TOWER || Enable::NSJETS_PFLOW)
0129 {
0130
0131 JetReco* fullTruthJets = new JetReco();
0132 fullTruthJets->add_input(new TruthJetInput(Jet::PARTICLE));
0133 fullTruthJets->add_algo(NSJETS::GetFJAlgo(0.2), NSJETS::algo_prefix + "_Truth_r02");
0134 fullTruthJets->add_algo(NSJETS::GetFJAlgo(0.3), NSJETS::algo_prefix + "_Truth_r03");
0135 fullTruthJets->add_algo(NSJETS::GetFJAlgo(0.4), NSJETS::algo_prefix + "_Truth_r04");
0136 fullTruthJets->add_algo(NSJETS::GetFJAlgo(0.5), NSJETS::algo_prefix + "_Truth_r05");
0137 fullTruthJets->set_algo_node(NSJETS::jet_node);
0138 fullTruthJets->set_input_node("TRUTH");
0139 fullTruthJets->Verbosity(verbosity);
0140 se->registerSubsystem(fullTruthJets);
0141 }
0142
0143
0144 return;
0145
0146 }
0147
0148
0149
0150
0151
0152 void MakeNSTowerJets()
0153 {
0154
0155
0156 int verbosity = std::max(Enable::VERBOSITY, Enable::NSJETS_VERBOSITY);
0157
0158
0159
0160
0161 Fun4AllServer *se = Fun4AllServer::instance();
0162
0163
0164 RetowerCEMC* rcemc = new RetowerCEMC();
0165 rcemc->Verbosity(verbosity);
0166 rcemc->set_towerinfo(true);
0167 rcemc->set_frac_cut(0.5);
0168 rcemc->set_towerNodePrefix(NSJETS::tower_prefix);
0169 se->registerSubsystem(rcemc);
0170
0171
0172 TowerJetInput* emTwrInput = new TowerJetInput(Jet::CEMC_TOWERINFO_RETOWER, NSJETS::tower_prefix);
0173 TowerJetInput* ihTwrInput = new TowerJetInput(Jet::HCALIN_TOWERINFO, NSJETS::tower_prefix);
0174 TowerJetInput* ohTwrInput = new TowerJetInput(Jet::HCALOUT_TOWERINFO, NSJETS::tower_prefix);
0175 if (NSJETS::do_vertex_type)
0176 {
0177 emTwrInput->set_GlobalVertexType(NSJETS::vertex_type);
0178 ihTwrInput->set_GlobalVertexType(NSJETS::vertex_type);
0179 ohTwrInput->set_GlobalVertexType(NSJETS::vertex_type);
0180 }
0181
0182
0183 JetReco* twrRecoJets = new JetReco();
0184 twrRecoJets->add_input(emTwrInput);
0185 twrRecoJets->add_input(ihTwrInput);
0186 twrRecoJets->add_input(ohTwrInput);
0187 twrRecoJets->add_algo(NSJETS::GetFJAlgo(0.2), NSJETS::algo_prefix + "_Tower_r02");
0188 twrRecoJets->add_algo(NSJETS::GetFJAlgo(0.3), NSJETS::algo_prefix + "_Tower_r03");
0189 twrRecoJets->add_algo(NSJETS::GetFJAlgo(0.4), NSJETS::algo_prefix + "_Tower_r04");
0190 twrRecoJets->add_algo(NSJETS::GetFJAlgo(0.5), NSJETS::algo_prefix + "_Tower_r05");
0191 twrRecoJets->set_algo_node(NSJETS::jet_node);
0192 twrRecoJets->set_input_node("TOWER");
0193 twrRecoJets->Verbosity(verbosity);
0194 se->registerSubsystem(twrRecoJets);
0195
0196
0197 return;
0198
0199 }
0200
0201
0202
0203
0204
0205 void MakeNSTrackJets()
0206 {
0207
0208
0209 int verbosity = std::max(Enable::VERBOSITY, Enable::NSJETS_VERBOSITY);
0210
0211
0212
0213
0214 Fun4AllServer *se = Fun4AllServer::instance();
0215
0216
0217 JetReco* trkRecoJets = new JetReco();
0218 trkRecoJets->add_input(new TrackJetInput(Jet::SRC::TRACK));
0219 trkRecoJets->add_algo(NSJETS::GetFJAlgo(0.2), NSJETS::algo_prefix + "_Track_r02");
0220 trkRecoJets->add_algo(NSJETS::GetFJAlgo(0.3), NSJETS::algo_prefix + "_Track_r03");
0221 trkRecoJets->add_algo(NSJETS::GetFJAlgo(0.4), NSJETS::algo_prefix + "_Track_r04");
0222 trkRecoJets->add_algo(NSJETS::GetFJAlgo(0.5), NSJETS::algo_prefix + "_Track_r05");
0223 trkRecoJets->set_algo_node(NSJETS::jet_node);
0224 trkRecoJets->set_input_node("TRACK");
0225 trkRecoJets->Verbosity(verbosity);
0226 se->registerSubsystem(trkRecoJets);
0227
0228
0229 return;
0230
0231 }
0232
0233
0234
0235
0236
0237 void MakeNSPFlowJets()
0238 {
0239
0240
0241 int verbosity = std::max(Enable::VERBOSITY, Enable::NSJETS_VERBOSITY);
0242
0243
0244
0245
0246 Fun4AllServer *se = Fun4AllServer::instance();
0247
0248
0249 JetReco* pfRecoJets = new JetReco();
0250 pfRecoJets->add_input(new ParticleFlowJetInput());
0251 pfRecoJets->add_algo(NSJETS::GetFJAlgo(0.2), NSJETS::algo_prefix + "_ParticleFlow_r02");
0252 pfRecoJets->add_algo(NSJETS::GetFJAlgo(0.3), NSJETS::algo_prefix + "_ParticleFlow_r03");
0253 pfRecoJets->add_algo(NSJETS::GetFJAlgo(0.4), NSJETS::algo_prefix + "_ParticleFlow_r04");
0254 pfRecoJets->add_algo(NSJETS::GetFJAlgo(0.5), NSJETS::algo_prefix + "_ParticleFlow_r05");
0255 pfRecoJets->set_algo_node(NSJETS::jet_node);
0256 pfRecoJets->set_input_node("ELEMENT");
0257 pfRecoJets->Verbosity(verbosity);
0258 se->registerSubsystem(pfRecoJets);
0259
0260
0261 return;
0262
0263 }
0264
0265
0266
0267
0268
0269 void NoBkgdSubJetReco()
0270 {
0271
0272
0273 if (Enable::NSJETS_MC && Enable::NSJETS_TRUTH) MakeNSTruthJets();
0274
0275
0276 if (Enable::NSJETS_TOWER) MakeNSTowerJets();
0277 if (Enable::NSJETS_TRACK) MakeNSTrackJets();
0278 if (Enable::NSJETS_PFLOW) MakeNSPFlowJets();
0279
0280 }
0281
0282 #endif