5 #include <calobase/RawCluster.h>
6 #include <calobase/RawClusterContainer.h>
7 #include <calobase/RawClusterDefs.h>
8 #include <calobase/RawClusterv1.h>
9 #include <calobase/RawTower.h>
10 #include <calobase/RawTowerContainer.h>
11 #include <calobase/RawTowerDefs.h>
12 #include <calobase/RawTowerGeom.h>
13 #include <calobase/RawTowerGeomContainer.h>
43 void set_id(
const int i)
99 , chkenergyconservation(0)
110 catch (std::exception &
e)
112 std::cout <<
PHWHERE <<
": " << e.what() << std::endl;
121 string towernodename =
"TOWER_CALIB_" +
detector;
123 RawTowerContainer *towers = findNode::getClass<RawTowerContainer>(topNode, towernodename);
126 std::cout <<
PHWHERE <<
": Could not find node " << towernodename << std::endl;
129 string towergeomnodename =
"TOWERGEOM_" +
detector;
130 RawTowerGeomContainer *towergeom = findNode::getClass<RawTowerGeomContainer>(topNode, towergeomnodename);
133 cout <<
PHWHERE <<
": Could not find node " << towergeomnodename << endl;
137 std::vector<twrs_fwd> towerVector;
140 for (; itr != begin_end.second; ++itr)
148 towerVector.push_back(twr);
153 std::multimap<int, twrs_fwd> clusteredTowers;
158 std::multimap<int, twrs_fwd>::iterator ctitr = clusteredTowers.begin();
159 std::multimap<int, twrs_fwd>::iterator lastct = clusteredTowers.end();
160 for (; ctitr != lastct; ++ctitr)
162 int clusterid = ctitr->first;
164 if (last_id != clusterid)
174 const twrs_fwd &tmptower = ctitr->second;
187 assert(cluster->
get_id() == clusterid);
200 assert(rawtowergeom);
221 cluster->
set_r(sqrt(sum_y * sum_y + sum_x * sum_x));
222 cluster->
set_phi(atan2(sum_y, sum_x));
223 cluster->
set_z(sum_z);
228 cout <<
"RawClusterBuilder constucted ";
238 if (fabs(etower - ecluster) / ecluster > 1
e-9)
240 cout <<
"energy conservation violation: ETower: " << etower
241 <<
" ECluster: " << ecluster
242 <<
" diff: " << etower - ecluster << endl;
249 cout <<
"energy conservation violation: ETower: " << etower
250 <<
" ECluster: " << ecluster << endl;
261 double phimax = -999.;
264 for (iter = begin_end.first; iter != begin_end.second; ++iter)
270 if (phi >
M_PI) phi = phi - 2. *
M_PI;
281 if ((phimax - phimin) < 3.)
return false;
284 for (iter = begin_end.first; iter != begin_end.second; ++iter)
291 if (phi >
M_PI) phi = phi - 2. *
M_PI;
294 phi = phi + 2. *
M_PI;
301 mean = mean - 2. *
M_PI;
322 std::cerr <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
323 throw std::runtime_error(
"Failed to find DST node in EmcRawTowerBuilder::CreateNodes");