3 #include <calobase/RawTower.h>
4 #include <calobase/RawTowerContainer.h>
5 #include <calobase/RawTowerDefs.h>
6 #include <calobase/RawTowerGeomContainer.h>
7 #include <calobase/RawTowerGeomv1.h>
8 #include <calobase/RawTowerv1.h>
36 _tower_node_prefix(
"SIM")
52 cout << __PRETTY_FUNCTION__ <<
" Fatal error _n_combine_eta==0" << endl;
59 cout << __PRETTY_FUNCTION__ <<
" Fatal error _n_combine_phi==0" << endl;
72 std::cout << __PRETTY_FUNCTION__ <<
"DST Node missing, doing nothing."
81 catch (std::exception &
e)
83 std::cout << e.what() << std::endl;
99 std::cout << __PRETTY_FUNCTION__ <<
"Process event entered" << std::endl;
102 typedef pair<int, int> tower_id_t;
103 typedef map<tower_id_t, RawTower *> new_tower_map_t;
104 new_tower_map_t new_tower_map;
108 it != all_towers.second; ++
it)
113 const int intput_eta = input_tower->
get_bineta();
114 const int intput_phi = input_tower->
get_binphi();
119 new_tower_map_t::iterator it_new = new_tower_map.find(
120 make_pair(output_eta, output_phi));
122 if (it_new == new_tower_map.end())
125 assert(output_tower);
126 new_tower_map[make_pair(output_eta, output_phi)] = output_tower;
130 std::cout << __PRETTY_FUNCTION__ <<
"::" <<
detector <<
"::"
131 <<
" new output tower (prior to tower ID assignment): ";
137 output_tower = it_new->second;
150 cell_iter != cell_range.second; ++cell_iter)
152 output_tower->
add_ecell(cell_iter->first, cell_iter->second);
159 shower_iter != shower_range.second; ++shower_iter)
162 shower_iter->second);
167 std::cout << __PRETTY_FUNCTION__ <<
"::" <<
detector <<
"::"
168 <<
" merget into output tower (prior to tower ID assignment) : ";
177 for (new_tower_map_t::iterator
it = new_tower_map.begin();
178 it != new_tower_map.end(); ++
it)
180 const int eta =
it->first.first;
181 const int phi =
it->first.second;
189 std::cout <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
190 <<
"input sum energy = " << input_e_sum <<
" from " << input_n_tower <<
" towers, merged sum energy = "
207 "PHCompositeNode",
"RUN"));
210 std::cerr << __PRETTY_FUNCTION__ <<
"Run Node missing, doing nothing."
212 throw std::runtime_error(
213 "Failed to find Run node in RawTowerCombiner::CreateNodes");
219 const string iTowerGeomNodeName =
"TOWERGEOM_" +
detector;
224 std::cerr << __PRETTY_FUNCTION__ <<
" - " << iTowerGeomNodeName
225 <<
" Node missing, doing nothing." << std::endl;
226 throw std::runtime_error(
227 "Failed to find input tower geometry node in RawTowerCombiner::CreateNodes");
233 const int new_phibins = ceil(
235 const int new_etabins = ceil(
238 typedef std::pair<double, double> bound_t;
239 typedef std::vector<bound_t> bound_map_t;
241 bound_map_t eta_bound_map;
242 bound_map_t phi_bound_map;
244 for (
int ibin = 0; ibin < new_phibins; ibin++)
247 assert(first_bin >= 0 && first_bin < towergeom->get_phibins());
249 int last_bin = (ibin + 1) * _n_combine_phi - 1;
253 const pair<double, double> range1 = towergeom->
get_phibounds(
255 const pair<double, double> range2 = towergeom->
get_phibounds(
258 phi_bound_map.push_back(make_pair(range1.first, range2.second));
261 for (
int ibin = 0; ibin < new_etabins; ibin++)
264 assert(first_bin >= 0 && first_bin < towergeom->get_etabins());
266 int last_bin = (ibin + 1) * _n_combine_eta - 1;
270 const pair<double, double> range1 = towergeom->
get_etabounds(
272 const pair<double, double> range2 = towergeom->
get_etabounds(
275 eta_bound_map.push_back(make_pair(range1.first, range2.second));
284 for (
int ibin = 0; ibin < new_phibins; ibin++)
288 for (
int ibin = 0; ibin < new_etabins; ibin++)
294 for (
int iphi = 0; iphi < towergeom->
get_phibins(); iphi++)
295 for (
int ieta = 0; ieta < towergeom->
get_etabins(); ieta++)
315 _towers = findNode::getClass<RawTowerContainer>(topNode,
316 input_TowerNodeName);
319 std::cerr <<
Name() <<
"::" << detector <<
"::" << __PRETTY_FUNCTION__
320 <<
" " << input_TowerNodeName <<
" Node missing, doing bail out!"
322 throw std::runtime_error(
323 "Failed to find " + input_TowerNodeName +
" node in RawTowerCombiner::CreateNodes");
327 "PHCompositeNode",
"DST"));
330 std::cerr << __PRETTY_FUNCTION__ <<
"DST Node missing, doing nothing."
332 throw std::runtime_error(
333 "Failed to find DST node in RawTowerCombiner::CreateNodes");