6 #include <calobase/RawTower.h>
7 #include <calobase/RawTowerContainer.h>
8 #include <calobase/RawTowerDefs.h>
9 #include <calobase/RawTowerGeom.h>
10 #include <calobase/RawTowerGeomContainer.h>
11 #include <calobase/RawTowerv1.h>
13 #include <calobase/TowerInfo.h>
14 #include <calobase/TowerInfoContainer.h>
15 #include <calobase/TowerInfov1.h>
16 #include <calobase/TowerInfoContainerv1.h>
38 , _use_flow_modulation(
false)
52 std::cout <<
"SubtractTowers::process_event: entering, with _use_flow_modulation = " <<
_use_flow_modulation << std::endl;
65 towerinfosEM3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC_RETOWER");
66 towerinfosIH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
67 towerinfosOH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT");
71 std::cout <<
"SubtractTowers::process_event: " << towerinfosEM3->
size() <<
" TOWER_CALIB_CEMC_RETOWER towers" << std::endl;
72 std::cout <<
"SubtractTowers::process_event: " << towerinfosIH3->size() <<
" TOWER_CALIB_HCALIN towers" << std::endl;
73 std::cout <<
"SubtractTowers::process_event: " << towerinfosOH3->size() <<
" TOWER_CALIB_HCALOUT towers" << std::endl;
78 towersEM3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER");
79 towersIH3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN");
80 towersOH3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT");
84 std::cout <<
"SubtractTowers::process_event: " << towersEM3->
size() <<
" TOWER_CALIB_CEMC_RETOWER towers" << std::endl;
85 std::cout <<
"SubtractTowers::process_event: " << towersIH3->size() <<
" TOWER_CALIB_HCALIN towers" << std::endl;
86 std::cout <<
"SubtractTowers::process_event: " << towersOH3->size() <<
" TOWER_CALIB_HCALOUT towers" << std::endl;
91 RawTowerGeomContainer *geomIH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
92 RawTowerGeomContainer *geomOH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
104 emcal_towerinfos = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC_RETOWER_SUB1");
105 ihcal_towerinfos = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN_SUB1");
106 ohcal_towerinfos = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT_SUB1");
110 std::cout <<
"SubtractTowers::process_event: starting with " << emcal_towerinfos->
size() <<
" TOWER_CALIB_CEMC_RETOWER_SUB1 towers" << std::endl;
111 std::cout <<
"SubtractTowers::process_event: starting with " << ihcal_towerinfos->
size() <<
" TOWER_CALIB_HCALIN_SUB1 towers" << std::endl;
112 std::cout <<
"SubtractTowers::process_event: starting with " << ohcal_towerinfos->
size() <<
" TOWER_CALIB_HCALOUT_SUB1 towers" << std::endl;
117 emcal_towers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER_SUB1");
118 ihcal_towers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN_SUB1");
119 ohcal_towers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT_SUB1");
122 std::cout <<
"SubtractTowers::process_event: starting with " << emcal_towers->
size() <<
" TOWER_CALIB_CEMC_RETOWER_SUB1 towers" << std::endl;
123 std::cout <<
"SubtractTowers::process_event: starting with " << ihcal_towers->size() <<
" TOWER_CALIB_HCALIN_SUB1 towers" << std::endl;
124 std::cout <<
"SubtractTowers::process_event: starting with " << ohcal_towers->size() <<
" TOWER_CALIB_HCALOUT_SUB1 towers" << std::endl;
131 towerbackground = findNode::getClass<TowerBackground>(topNode,
"TowerInfoBackground_Sub2");
135 towerbackground = findNode::getClass<TowerBackground>(topNode,
"TowerBackground_Sub2");
138 float background_v2 = towerbackground->
get_v2();
139 float background_Psi2 = towerbackground->
get_Psi2();
146 unsigned int nchannels_em = towerinfosEM3->
size();
154 float UE = towerbackground->
get_UE(0).at(ieta);
159 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
161 float new_energy = raw_energy - UE;
169 std::cout <<
" SubtractTowers::process_event : EMCal tower at ieta / iphi = " << ieta <<
" / " << iphi<<
", pre-sub / after-sub E = " << raw_energy <<
" / " << new_energy << std::endl;
185 emcal_towers->AddTower(this_etabin, this_phibin, new_tower);
194 if (!emcal_towers->getTower(
eta,
phi))
198 emcal_towers->AddTower(
eta,
phi, new_tower);
211 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
213 float new_energy = raw_energy - UE;
214 if( raw_energy == 0 ) new_energy = 0;
217 std::cout <<
"SubtractTowers::process_event : EMCal tower at eta / phi = " << tower->
get_bineta() <<
" / " << tower->
get_binphi() <<
", pre-sub / after-sub E = " << raw_energy <<
" / " << tower->
get_energy() << std::endl;
224 unsigned int nchannels_ih = towerinfosIH3->
size();
233 float UE = towerbackground->
get_UE(1).at(ieta);
238 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
240 float new_energy = raw_energy - UE;
247 std::cout <<
"SubtractTowers::process_event : IHCal tower at ieta / iphi = " << ieta <<
" / " << iphi<<
", pre-sub / after-sub E = " << raw_energy <<
" / " << new_energy << std::endl;
265 ihcal_towers->
AddTower(this_etabin, this_phibin, new_tower);
291 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
293 float new_energy = raw_energy - UE;
294 if( raw_energy == 0 ) new_energy = 0;
303 unsigned int nchannels_oh = towerinfosOH3->
size();
311 float UE = towerbackground->
get_UE(2).at(ieta);
315 float tower_phi = geomOH->get_tower_geometry(key)->get_phi();
316 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
318 float new_energy = raw_energy - UE;
325 std::cout <<
"SubtractTowers::process_event : OHCal tower at ieta / iphi = " << ieta <<
" / " << iphi<<
", pre-sub / after-sub E = " << raw_energy <<
" / " << new_energy << std::endl;
336 int this_etabin = geomOH->get_etabin(tower_geom->
get_eta());
337 int this_phibin = geomOH->get_phibin(tower_geom->
get_phi());
342 ohcal_towers->
AddTower(this_etabin, this_phibin, new_tower);
346 for (
int eta = 0;
eta < geomOH->get_etabins();
eta++)
348 for (
int phi = 0;
phi < geomOH->get_phibins();
phi++)
367 float tower_phi = geomOH->get_tower_geometry(tower->
get_key())->get_phi();
368 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
370 float new_energy = raw_energy - UE;
371 if( raw_energy == 0 ) new_energy = 0;
380 std::cout <<
"SubtractTowers::process_event: ending with " << emcal_towers->size() <<
" TOWER_CALIB_CEMC_RETOWER_SUB1 towers" << std::endl;
381 std::cout <<
"SubtractTowers::process_event: ending with " << ihcal_towers->
size() <<
" TOWER_CALIB_HCALIN_SUB1 towers" << std::endl;
382 std::cout <<
"SubtractTowers::process_event: ending with " << ohcal_towers->
size() <<
" TOWER_CALIB_HCALOUT_SUB1 towers" << std::endl;
386 std::cout <<
"SubtractTowers::process_event: ending with " << emcal_towerinfos->
size() <<
" TOWER_CALIB_CEMC_RETOWER_SUB1 towers" << std::endl;
387 std::cout <<
"SubtractTowers::process_event: ending with " << ihcal_towerinfos->
size() <<
" TOWER_CALIB_HCALIN_SUB1 towers" << std::endl;
388 std::cout <<
"SubtractTowers::process_event: ending with " << ohcal_towerinfos->
size() <<
" TOWER_CALIB_HCALOUT_SUB1 towers" << std::endl;
392 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::process_event: exiting" << std::endl;
405 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
409 TowerInfoContainer *hcal_towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
412 std::cout <<
PHWHERE <<
"Cannot find TOWERINFO_CALIB_HCALIN for creating new tower containers. Exiting" << std::endl;
421 std::cout <<
PHWHERE <<
"EMCal Node note found, doing nothing." << std::endl;
425 TowerInfoContainer *test_emcal_tower = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC_RETOWER_SUB1");
426 if (!test_emcal_tower)
428 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWERINFO_CALIB_CEMC_RETOWER_SUB1 node " << std::endl;
432 emcalNode->
addNode(emcalTowerNode);
436 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_CEMC_RETOWER_SUB1 already exists! " << std::endl;
441 RawTowerContainer *test_emcal_tower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER_SUB1");
442 if (!test_emcal_tower)
444 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWER_CALIB_CEMC_RETOWER_SUB1 node " << std::endl;
448 emcalNode->
addNode(emcalTowerNode);
452 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_CEMC_RETOWER_SUB1 already exists! " << std::endl;
461 std::cout <<
PHWHERE <<
"IHCal Node note found, doing nothing." << std::endl;
465 TowerInfoContainer *test_ihcal_tower = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN_SUB1");
466 if (!test_ihcal_tower)
468 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWERINFO_CALIB_HCALIN_SUB1 node " << std::endl;
472 ihcalNode->
addNode(ihcalTowerNode);
476 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_HCALIN_SUB1 already exists! " << std::endl;
482 RawTowerContainer *test_ihcal_tower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN_SUB1");
483 if (!test_ihcal_tower)
485 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWER_CALIB_HCALIN_SUB1 node " << std::endl;
489 ihcalNode->
addNode(ihcalTowerNode);
493 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_HCALIN_SUB1 already exists! " << std::endl;
502 std::cout <<
PHWHERE <<
"OHCal Node note found, doing nothing." << std::endl;
506 TowerInfoContainer *test_ohcal_tower = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT_SUB1");
507 if (!test_ohcal_tower)
509 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWERINFO_CALIB_HCALOUT_SUB1 node " << std::endl;
513 ohcalNode->
addNode(ohcalTowerNode);
517 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_HCALOUT_SUB1 already exists! " << std::endl;
522 RawTowerContainer *test_ohcal_tower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT_SUB1");
523 if (!test_ohcal_tower)
525 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWER_CALIB_HCALOUT_SUB1 node " << std::endl;
529 ohcalNode->
addNode(ohcalTowerNode);
533 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_HCALOUT_SUB1 already exists! " << std::endl;