5 #include <calobase/RawTower.h>
6 #include <calobase/RawTowerContainer.h>
7 #include <calobase/RawTowerGeom.h>
8 #include <calobase/RawTowerGeomContainer.h>
10 #include <calobase/TowerInfo.h>
11 #include <calobase/TowerInfoContainer.h>
39 , _use_flow_modulation(
false)
53 std::cout <<
"CopyAndSubtractJets::process_event: entering, with _use_flow_modulation = " <<
_use_flow_modulation << std::endl;
64 towerinfosEM3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC_RETOWER");
65 towerinfosIH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
66 towerinfosOH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT");
70 towersEM3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER");
71 towersIH3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN");
72 towersOH3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT");
76 RawTowerGeomContainer *geomIH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
77 RawTowerGeomContainer *geomOH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
85 unsub_jets = findNode::getClass<JetContainer>(topNode,
"AntiKt_TowerInfo_HIRecoSeedsRaw_r02");
86 sub_jets = findNode::getClass<JetContainer>(topNode,
"AntiKt_TowerInfo_HIRecoSeedsSub_r02");
87 background = findNode::getClass<TowerBackground>(topNode,
"TowerInfoBackground_Sub1");
91 unsub_jets = findNode::getClass<JetContainer>(topNode,
"AntiKt_Tower_HIRecoSeedsRaw_r02");
92 sub_jets = findNode::getClass<JetContainer>(topNode,
"AntiKt_Tower_HIRecoSeedsSub_r02");
93 background = findNode::getClass<TowerBackground>(topNode,
"TowerBackground_Sub1");
95 std::vector<float> background_UE_0 = background->
get_UE(0);
96 std::vector<float> background_UE_1 = background->
get_UE(1);
97 std::vector<float> background_UE_2 = background->
get_UE(2);
99 float background_v2 = background->
get_v2();
100 float background_Psi2 = background->
get_Psi2();
104 std::cout <<
"CopyAndSubtractJets::process_event: entering with # unsubtracted jets = " << unsub_jets->size() << std::endl;
105 std::cout <<
"CopyAndSubtractJets::process_event: entering with # subtracted jets = " << sub_jets->
size() << std::endl;
110 for (
auto this_jet : *unsub_jets)
112 float this_pt = this_jet->get_pt();
113 float this_phi = this_jet->get_phi();
114 float this_eta = this_jet->get_eta();
116 float new_total_px = 0;
117 float new_total_py = 0;
118 float new_total_pz = 0;
119 float new_total_e = 0;
123 if (
Verbosity() > 1 && this_jet->get_pt() > 5)
124 std::cout <<
"CopyAndSubtractJets::process_event: unsubtracted jet with pt / eta / phi = " << this_pt <<
" / " << this_eta <<
" / " << this_phi << std::endl;
126 for (
const auto&
comp : this_jet->get_comp_vec())
138 double comp_background = 0;
142 if (
comp.first == 5||
comp.first == 26)
151 comp_background = background_UE_1.at(comp_ieta);
153 else if (
comp.first == 7 ||
comp.first == 27)
160 tower_geom = geomOH->get_tower_geometry(key);
161 comp_background = background_UE_2.at(comp_ieta);
163 else if (
comp.first == 13 ||
comp.first == 28)
172 comp_background = background_UE_0.at(comp_ieta);
187 comp_background = background_UE_1.at(comp_ieta);
189 else if (
comp.first == 7)
192 tower_geom = geomOH->get_tower_geometry(tower->
get_key());
194 comp_ieta = geomOH->get_etabin(tower_geom->
get_eta());
195 comp_background = background_UE_2.at(comp_ieta);
197 else if (
comp.first == 13)
203 comp_background = background_UE_0.at(comp_ieta);
213 comp_eta = tower_geom->
get_eta();
214 comp_phi = tower_geom->
get_phi();
217 if (
Verbosity() > 4 && this_jet->get_pt() > 5)
219 std::cout <<
"CopyAndSubtractJets::process_event: --> constituent in layer " <<
comp.first <<
", has unsub E = " << comp_e <<
", is at ieta #" << comp_ieta <<
", and has UE = " << comp_background << std::endl;
225 comp_background = comp_background * (1 + 2 * background_v2 * cos(2 * (comp_phi - background_Psi2)));
226 if (
Verbosity() > 4 && this_jet->get_pt() > 5)
227 std::cout <<
"CopyAndSubtractJets::process_event: --> --> flow mod, at phi = " << comp_phi <<
", v2 and Psi2 are = " << background_v2 <<
" , " << background_Psi2 <<
", UE after modulation = " << comp_background << std::endl;
231 double comp_sub_e = comp_e - comp_background;
235 double comp_px = comp_sub_e / cosh(comp_eta) * cos(comp_phi);
236 double comp_py = comp_sub_e / cosh(comp_eta) * sin(comp_phi);
237 double comp_pz = comp_sub_e * tanh(comp_eta);
239 new_total_px += comp_px;
240 new_total_py += comp_py;
241 new_total_pz += comp_pz;
242 new_total_e += comp_sub_e;
245 auto new_jet = sub_jets->
add_jet();
248 new_jet->
set_px(new_total_px);
249 new_jet->set_py(new_total_py);
250 new_jet->set_pz(new_total_pz);
251 new_jet->set_e(new_total_e);
252 new_jet->set_id(ijet);
256 std::cout <<
"CopyAndSubtractJets::process_event: old jet #" << ijet <<
", old px / py / pz / e = " << this_jet->get_px() <<
" / " << this_jet->get_py() <<
" / " << this_jet->get_pz() <<
" / " << this_jet->get_e() << std::endl;
257 std::cout <<
"CopyAndSubtractJets::process_event: new jet #" << ijet <<
", new px / py / pz / e = " << new_jet->get_px() <<
" / " << new_jet->get_py() <<
" / " << new_jet->get_pz() <<
" / " << new_jet->get_e() << std::endl;
269 std::cout <<
"CopyAndSubtractJets::process_event: exiting with # subtracted jets = " << sub_jets->
size() << std::endl;
288 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
296 std::cout <<
PHWHERE <<
"ANTIKT node not found, doing nothing." << std::endl;
303 std::cout <<
PHWHERE <<
"TOWER node not found, doing nothing." << std::endl;
310 test_jets = findNode::getClass<JetContainer>(topNode,
"AntiKt_TowerInfo_HIRecoSeedsSub_r02");
314 test_jets = findNode::getClass<JetContainer>(topNode,
"AntiKt_Tower_HIRecoSeedsSub_r02");
322 if (
Verbosity() > 0) std::cout <<
"CopyAndSubtractJets::CreateNode : creating AntiKt_TowerInfo_HIRecoSeedsSub_r02 node " << std::endl;
328 if (
Verbosity() > 0) std::cout <<
"CopyAndSubtractJets::CreateNode : creating AntiKt_Tower_HIRecoSeedsSub_r02 node " << std::endl;
331 towerNode->
addNode(subjetNode);
335 std::cout <<
"CopyAndSubtractJets::CreateNode : AntiKt_Tower_HIRecoSeedsSub_r02 already exists! " << std::endl;