3 #include <calobase/RawCluster.h>
4 #include <calobase/RawClusterContainer.h>
5 #include <calobase/RawTower.h>
6 #include <calobase/RawTowerContainer.h>
7 #include <calobase/RawTowerDeadMap.h>
8 #include <calobase/RawTowerGeomContainer.h>
35 , m_deadTowerMaskHalfWidth(1.6)
36 , m_rawClusters(nullptr)
38 , m_calibTowers(nullptr)
54 cout <<
Name() <<
"::" <<
m_detector <<
"::process_event - Entry" << endl;
67 for (iter = begin_end.first; iter != begin_end.second;)
72 std::vector<float> toweretas;
73 std::vector<float> towerphis;
74 std::vector<float> towerenergies;
80 for (toweriter = towers.first;
81 toweriter != towers.second;
92 toweretas.push_back(towereta);
93 towerphis.push_back(towerphi);
94 towerenergies.push_back(towerenergy);
97 int ntowers = toweretas.size();
108 for (
int j = 0; j < ntowers; j++)
110 float energymult = towerenergies.at(j) * toweretas.at(j);
111 etamult += energymult;
112 etasum += towerenergies.at(j);
114 int phibin = towerphis.at(j);
116 if (phibin - towerphis.at(0) < -phi_bins / 2.0)
118 else if (phibin - towerphis.at(0) > +phi_bins / 2.0)
120 assert(
abs(phibin - towerphis.at(0)) <= phi_bins / 2.0);
122 energymult = towerenergies.at(j) * phibin;
123 phimult += energymult;
124 phisum += towerenergies.at(j);
127 float avgphi = phimult / phisum;
128 float avgeta = etamult / etasum;
133 <<
"process cluster at average location " << avgeta <<
"," << avgphi <<
" : ";
138 bool rejecCluster =
false;
144 int ieta = search_eta;
145 int iphi = search_phi;
147 if (ieta >= eta_bins)
continue;
148 if (ieta < 0)
continue;
150 if (iphi >= phi_bins) iphi -= phi_bins;
151 if (iphi < 0) iphi += phi_bins;
161 << (isDead ?
": is dead." :
"OK")
172 if (rejecCluster)
break;
181 <<
"reject cluster " << cluster->
get_id() << endl;
193 <<
"keep cluster " << cluster->
get_id() << endl;
202 cout <<
Name() <<
"::" <<
m_detector <<
"::process_event - masked "
203 << nMasked <<
" clusters. Final cluster containers has "
220 std::cerr <<
"DST Node missing, quitting" << std::endl;
221 throw std::runtime_error(
"failed to find DST node in RawClusterDeadAreaMask::CreateNodeTree");
230 <<
m_detector <<
" Cluster Container found while in RawClusterDeadAreaMask, can't proceed!!!" << std::endl;
232 throw std::runtime_error(
"failed to find CLUSTER node in RawClusterDeadAreaMask::CreateNodeTree");
240 <<
"No calibrated " <<
m_detector <<
" tower info found while in RawClusterDeadAreaMask, can't proceed!!!" << std::endl;
241 throw std::runtime_error(
"failed to find TOWER_CALIB node in RawClusterDeadAreaMask::CreateNodeTree");
244 string towergeomnodename =
"TOWERGEOM_" +
m_detector;
245 m_geometry = findNode::getClass<RawTowerGeomContainer>(topNode, towergeomnodename);
250 <<
": Could not find node " << towergeomnodename << endl;
251 throw std::runtime_error(
"failed to find TOWERGEOM node in RawClusterDeadAreaMask::CreateNodeTree");
254 const string deadMapName =
"DEADMAP_" +
m_detector;
255 m_deadMap = findNode::getClass<RawTowerDeadMap>(topNode, deadMapName);
260 <<
" use dead map: ";