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>
33 , _use_flow_modulation(
false)
47 std::cout <<
"SubtractTowers::process_event: entering, with _use_flow_modulation = " <<
_use_flow_modulation << std::endl;
50 RawTowerContainer *towersEM3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER");
51 RawTowerContainer *towersIH3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN");
52 RawTowerContainer *towersOH3 = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT");
54 RawTowerGeomContainer *geomIH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
55 RawTowerGeomContainer *geomOH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
59 std::cout <<
"SubtractTowers::process_event: " << towersEM3->
size() <<
" TOWER_CALIB_CEMC_RETOWER towers" << std::endl;
60 std::cout <<
"SubtractTowers::process_event: " << towersIH3->size() <<
" TOWER_CALIB_HCALIN towers" << std::endl;
61 std::cout <<
"SubtractTowers::process_event: " << towersOH3->size() <<
" TOWER_CALIB_HCALOUT towers" << std::endl;
65 RawTowerContainer *emcal_towers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER_SUB1");
66 RawTowerContainer *ihcal_towers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN_SUB1");
67 RawTowerContainer *ohcal_towers = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT_SUB1");
71 std::cout <<
"SubtractTowers::process_event: starting with " << emcal_towers->
size() <<
" TOWER_CALIB_CEMC_RETOWER_SUB1 towers" << std::endl;
72 std::cout <<
"SubtractTowers::process_event: starting with " << ihcal_towers->size() <<
" TOWER_CALIB_HCALIN_SUB1 towers" << std::endl;
73 std::cout <<
"SubtractTowers::process_event: starting with " << ohcal_towers->size() <<
" TOWER_CALIB_HCALOUT_SUB1 towers" << std::endl;
76 TowerBackground *towerbackground = findNode::getClass<TowerBackground>(topNode,
"TowerBackground_Sub2");
79 float background_v2 = towerbackground->
get_v2();
80 float background_Psi2 = towerbackground->
get_Psi2();
96 emcal_towers->
AddTower(this_etabin, this_phibin, new_tower);
101 for (
int eta = 0;
eta < geomIH->get_etabins();
eta++)
103 for (
int phi = 0;
phi < geomIH->get_phibins();
phi++)
122 float tower_phi = geomIH->get_tower_geometry(tower->
get_key())->get_phi();
123 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
125 float new_energy = raw_energy - UE;
128 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;
140 int this_etabin = geomIH->get_etabin(tower_geom->
get_eta());
141 int this_phibin = geomIH->get_phibin(tower_geom->
get_phi());
146 ihcal_towers->AddTower(this_etabin, this_phibin, new_tower);
150 for (
int eta = 0;
eta < geomIH->get_etabins();
eta++)
152 for (
int phi = 0;
phi < geomIH->get_phibins();
phi++)
154 if (!ihcal_towers->getTower(
eta,
phi))
158 ihcal_towers->AddTower(
eta,
phi, new_tower);
171 float tower_phi = geomIH->get_tower_geometry(tower->
get_key())->get_phi();
172 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
174 float new_energy = raw_energy - UE;
187 int this_etabin = geomOH->get_etabin(tower_geom->
get_eta());
188 int this_phibin = geomOH->get_phibin(tower_geom->
get_phi());
193 ohcal_towers->AddTower(this_etabin, this_phibin, new_tower);
197 for (
int eta = 0;
eta < geomOH->get_etabins();
eta++)
199 for (
int phi = 0;
phi < geomOH->get_phibins();
phi++)
201 if (!ohcal_towers->getTower(
eta,
phi))
205 ohcal_towers->AddTower(
eta,
phi, new_tower);
218 float tower_phi = geomOH->get_tower_geometry(tower->
get_key())->get_phi();
219 UE = UE * (1 + 2 * background_v2 * cos(2 * (tower_phi - background_Psi2)));
221 float new_energy = raw_energy - UE;
227 std::cout <<
"SubtractTowers::process_event: ending with " << emcal_towers->
size() <<
" TOWER_CALIB_CEMC_RETOWER_SUB1 towers" << std::endl;
228 std::cout <<
"SubtractTowers::process_event: ending with " << ihcal_towers->size() <<
" TOWER_CALIB_HCALIN_SUB1 towers" << std::endl;
229 std::cout <<
"SubtractTowers::process_event: ending with " << ohcal_towers->size() <<
" TOWER_CALIB_HCALOUT_SUB1 towers" << std::endl;
232 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::process_event: exiting" << std::endl;
245 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
253 std::cout <<
PHWHERE <<
"EMCal Node note found, doing nothing." << std::endl;
256 RawTowerContainer *test_emcal_tower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER_SUB1");
257 if (!test_emcal_tower)
259 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWER_CALIB_CEMC_RETOWER_SUB1 node " << std::endl;
263 emcalNode->
addNode(emcalTowerNode);
267 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_CEMC_RETOWER_SUB1 already exists! " << std::endl;
274 std::cout <<
PHWHERE <<
"IHCal Node note found, doing nothing." << std::endl;
277 RawTowerContainer *test_ihcal_tower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALIN_SUB1");
278 if (!test_ihcal_tower)
280 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWER_CALIB_HCALIN_SUB1 node " << std::endl;
284 ihcalNode->
addNode(ihcalTowerNode);
288 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_HCALIN_SUB1 already exists! " << std::endl;
295 std::cout <<
PHWHERE <<
"OHCal Node note found, doing nothing." << std::endl;
298 RawTowerContainer *test_ohcal_tower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_HCALOUT_SUB1");
299 if (!test_ohcal_tower)
301 if (
Verbosity() > 0) std::cout <<
"SubtractTowers::CreateNode : creating TOWER_CALIB_HCALOUT_SUB1 node " << std::endl;
305 ohcalNode->
addNode(ohcalTowerNode);
309 std::cout <<
"SubtractTowers::CreateNode : TOWER_CALIB_HCALOUT_SUB1 already exists! " << std::endl;