3 #include <calobase/TowerInfo.h>
4 #include <calobase/TowerInfoContainer.h>
5 #include <calobase/RawTowerDeadMap.h>
6 #include <calobase/RawTowerDefs.h>
7 #include <calobase/RawTowerGeom.h>
8 #include <calobase/RawTowerGeomContainer.h>
44 std::cout <<
Name() <<
"::" <<
m_detector <<
"::" << __PRETTY_FUNCTION__
45 <<
"DST Node missing, doing nothing." << std::endl;
53 catch (std::exception &
e)
55 std::cout << e.what() << std::endl;
67 <<
"Process event entered" << std::endl;
70 double recovery_energy = 0;
91 <<
" - processing tower " << key;
96 if (towerGeom ==
nullptr)
100 <<
" - invalid dead tower ID " << key << std::endl;
110 std::cout <<
" bin " << bineta <<
"-" << binphi;
111 std::cout <<
". Add neighbors: ";
115 assert(bineta <= eta_bins);
117 assert(binphi <= phi_bins);
120 static const std::vector<std::pair<int, int>> neighborIndexs =
121 {{+1, 0}, {+1, +1}, {0, +1}, {-1, +1}, {-1, 0}, {-1, -1}, {0, -1}, {+1, -1}};
124 double E_SumNeighbor = 0;
125 for (
const std::pair<int, int> &neighborIndex : neighborIndexs)
127 int ieta = bineta + neighborIndex.first;
128 int iphi = binphi + neighborIndex.second;
130 if (ieta >= eta_bins)
139 if (iphi >= phi_bins)
161 unsigned int towerkey = (ieta << 16U) + iphi;
164 if (neighTower ==
nullptr)
171 std::cout << neighTower->
get_energy() <<
" (" << ieta <<
"-" << iphi <<
"), ";
178 if (n_neighbor > 0 and E_SumNeighbor != 0)
181 unsigned int deadtowerkey = (bineta << 16U) + binphi;
191 deadTower->
set_energy(E_SumNeighbor / n_neighbor);
199 std::cout <<
" -> " << deadTower->
get_energy() <<
" GeV @ etabin: " << bineta <<
" , phi bin: " << binphi ;
207 std::cout <<
"No neighbor towers found.";
214 std::cout << std::endl;
221 static bool once =
true;
229 <<
" - missing dead map node. Do nothing ..."
238 <<
"recovery_energy = " << recovery_energy
239 <<
" GeV from " << recoverTower <<
" towers out of total " << deadTowerCnt <<
" dead towers"
254 "PHCompositeNode",
"RUN"));
259 <<
"Run Node missing, doing nothing." << std::endl;
260 throw std::runtime_error(
261 "Failed to find Run node in RawTowerDeadTowerInterp::CreateNodes");
265 m_deadTowerMap = findNode::getClass<RawTowerDeadMap>(topNode, deadMapName);
270 <<
" use dead map: ";
275 m_geometry = findNode::getClass<RawTowerGeomContainer>(topNode, geometry_node);
280 <<
" " << geometry_node <<
" Node missing, doing bail out!"
282 throw std::runtime_error(
283 "Failed to find " + geometry_node +
" node in RawTowerDeadTowerInterp::CreateNodes");
292 "PHCompositeNode",
"DST"));
297 <<
"DST Node missing, doing nothing." << std::endl;
298 throw std::runtime_error(
299 "Failed to find DST node in RawTowerDeadTowerInterp::CreateNodes");
303 m_calibTowers = findNode::getClass<TowerInfoContainer>(dstNode, rawTowerNodeName);
306 std::cout <<
Name() <<
"::" << m_detector <<
"::" << __PRETTY_FUNCTION__
307 <<
" " << rawTowerNodeName <<
" Node missing, doing bail out!"
309 throw std::runtime_error(
310 "Failed to find " + rawTowerNodeName +
" node in RawTowerDeadTowerInterp::CreateNodes");