3 #include <calobase/RawTower.h>
4 #include <calobase/RawTowerContainer.h>
5 #include <calobase/RawTowerDefs.h>
6 #include <calobase/RawTowerGeom.h>
7 #include <calobase/RawTowerGeomContainer.h>
8 #include <calobase/RawTowerv1.h>
10 #include <calobase/TowerInfo.h>
11 #include <calobase/TowerInfoContainer.h>
32 , _WEIGHTED_ENERGY_DISTRIBUTION(1)
48 std::cout <<
"RetowerCEMC::process_event: entering" << std::endl;
55 towerinfosEM3= findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC");
60 towersEM3= findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC");
63 std::cout <<
"RetowerCEMC::process_event: " << towersEM3->
size() <<
" TOWER_CALIB_CEMC towers" << std::endl;
69 RawTowerGeomContainer *geomIH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
77 _NETA = geomIH->get_etabins();
78 _NPHI = geomIH->get_phibins();
98 std::cout <<
PHWHERE <<
"no emcal tower info object, doing nothing" << std::endl;
101 unsigned int nchannels = towerinfosEM3->
size();
110 int this_IHetabin = geomIH->get_etabin(tower_geom->
get_eta());
111 double fractionalcontribution[3] = {0};
116 for (
int etabin_iter = -1;etabin_iter <= 1;etabin_iter++)
118 if (this_IHetabin+etabin_iter < 0 || this_IHetabin+etabin_iter >= _NETA){
continue;}
119 std::pair<double, double> range_ihbin= geomIH->get_etabounds(this_IHetabin + etabin_iter);
120 if (range_ihbin.first <= range_embin.first && range_ihbin.second >= range_embin.second)
122 fractionalcontribution[etabin_iter+1] = 1;
124 else if ( range_ihbin.first <= range_embin.first && range_ihbin.second < range_embin.second && range_embin.first < range_ihbin.second)
126 fractionalcontribution[etabin_iter+1] = (range_ihbin.second - range_embin.first) / (range_embin.second- range_embin.first);
128 else if (range_ihbin.first > range_embin.first && range_ihbin.second >= range_embin.second && range_embin.second > range_ihbin.first)
130 fractionalcontribution[etabin_iter+1] = (range_embin.second - range_ihbin.first) / (range_embin.second- range_embin.first);
134 fractionalcontribution[etabin_iter+1] = 0;
140 fractionalcontribution[0] = 0;
141 fractionalcontribution[1] = 1;
142 fractionalcontribution[2] = 0;
145 int this_IHphibin = geomIH->get_phibin(tower_geom->
get_phi());
148 for (
int etabin_iter = -1 ; etabin_iter <= 1;etabin_iter++)
150 if (this_IHetabin+etabin_iter < 0 || this_IHetabin+etabin_iter >= _NETA){
continue;}
151 _EMCAL_RETOWER_E[this_IHetabin+etabin_iter][this_IHphibin] += this_E * fractionalcontribution[etabin_iter+1];
152 if(this_T == -10 || this_T == -11)
170 int this_IHetabin = geomIH->get_etabin(tower_geom->
get_eta());
171 double fractionalcontribution[3] = {0};
177 for (
int etabin_iter = -1;etabin_iter <= 1;etabin_iter++)
179 if (this_IHetabin+etabin_iter < 0 || this_IHetabin+etabin_iter >= _NETA){
continue;}
180 std::pair<double, double> range_ihbin= geomIH->get_etabounds(this_IHetabin + etabin_iter);
181 if (range_ihbin.first <= range_embin.first && range_ihbin.second >= range_embin.second)
183 fractionalcontribution[etabin_iter+1] = 1;
185 else if ( range_ihbin.first <= range_embin.first && range_ihbin.second < range_embin.second && range_embin.first < range_ihbin.second)
187 fractionalcontribution[etabin_iter+1] = (range_ihbin.second - range_embin.first) / (range_embin.second- range_embin.first);
189 else if (range_ihbin.first > range_embin.first && range_ihbin.second >= range_embin.second && range_embin.second > range_ihbin.first)
191 fractionalcontribution[etabin_iter+1] = (range_embin.second - range_ihbin.first) / (range_embin.second- range_embin.first);
195 fractionalcontribution[etabin_iter+1] = 0;
201 fractionalcontribution[0] = 0;
202 fractionalcontribution[1] = 1;
203 fractionalcontribution[2] = 0;
206 int this_IHphibin = geomIH->get_phibin(tower_geom->
get_phi());
209 for (
int etabin_iter = -1 ; etabin_iter <= 1;etabin_iter++)
211 if (this_IHetabin+etabin_iter < 0 || this_IHetabin+etabin_iter >= _NETA){
continue;}
212 _EMCAL_RETOWER_E[this_IHetabin+etabin_iter][this_IHphibin] += this_E * fractionalcontribution[etabin_iter+1];
222 TowerInfoContainer *emcal_retower = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC_RETOWER");
223 if (
Verbosity() > 0) std::cout <<
"RetowerCEMC::process_event: filling TOWERINFO_CALIB_CEMC_RETOWER node" << std::endl;
229 unsigned int towerkey = (
eta << 16U) +
phi;
230 unsigned int towerindex = emcal_retower->
decode_key(towerkey);
240 RawTowerContainer *emcal_retower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER");
241 if (
Verbosity() > 0) std::cout <<
"RetowerCEMC::process_event: filling TOWER_CALIB_CEMC_RETOWER node, with initial size = " << emcal_retower->
size() << std::endl;
254 if (
Verbosity() > 0) std::cout <<
"RetowerCEMC::process_event: finished filling TOWER_CALIB_CEMC_RETOWER node, with final size = " << emcal_retower->
size() << std::endl;
256 if (
Verbosity() > 0) std::cout <<
"RetowerCEMC::process_event: exiting" << std::endl;
268 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
276 std::cout <<
PHWHERE <<
"EMCal Node note found, doing nothing." << std::endl;
283 TowerInfoContainer *test_emcal_retower = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC_RETOWER");
284 TowerInfoContainer *hcal_towers = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
285 if (!test_emcal_retower)
287 if (
Verbosity() > 0) std::cout <<
"RetowerCEMC::CreateNode : creating TOWERINFO_CALIB_CEMC_RETOWER node " << std::endl;
291 emcalNode->
addNode(emcalTowerNode);
295 std::cout <<
"RetowerCEMC::CreateNode : TOWERINFO_CALIB_CEMC_RETOWER already exists! " << std::endl;
300 RawTowerContainer *test_emcal_retower = findNode::getClass<RawTowerContainer>(topNode,
"TOWER_CALIB_CEMC_RETOWER");
301 if (!test_emcal_retower)
303 if (
Verbosity() > 0) std::cout <<
"RetowerCEMC::CreateNode : creating TOWER_CALIB_CEMC_RETOWER node " << std::endl;
307 emcalNode->
addNode(emcalTowerNode);
311 std::cout <<
"RetowerCEMC::CreateNode : TOWER_CALIB_CEMC_RETOWER already exists! " << std::endl;