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>
19 #include <CLHEP/Vector/ThreeVector.h>
33 , _tower_node_prefix(
"SIM")
45 std::cout << __PRETTY_FUNCTION__ <<
" Fatal error _n_combine_eta==0" << std::endl;
52 std::cout << __PRETTY_FUNCTION__ <<
" Fatal error _n_combine_phi==0" << std::endl;
65 std::cout << __PRETTY_FUNCTION__ <<
"DST Node missing, doing nothing."
74 catch (std::exception &
e)
76 std::cout << e.what() << std::endl;
92 std::cout << __PRETTY_FUNCTION__ <<
"Process event entered" << std::endl;
95 using tower_id_t = std::pair<int, int>;
96 using new_tower_map_t = std::map<tower_id_t, RawTower *>;
97 new_tower_map_t new_tower_map;
101 it != all_towers.second; ++
it)
106 const int intput_eta = input_tower->
get_bineta();
107 const int intput_phi = input_tower->
get_binphi();
112 new_tower_map_t::iterator it_new = new_tower_map.find(
113 std::make_pair(output_eta, output_phi));
115 if (it_new == new_tower_map.end())
119 new_tower_map[std::make_pair(output_eta, output_phi)] = output_tower;
123 std::cout << __PRETTY_FUNCTION__ <<
"::" <<
detector <<
"::"
124 <<
" new output tower (prior to tower ID assignment): ";
130 output_tower = it_new->second;
143 cell_iter != cell_range.second; ++cell_iter)
145 output_tower->
add_ecell(cell_iter->first, cell_iter->second);
152 shower_iter != shower_range.second; ++shower_iter)
155 shower_iter->second);
160 std::cout << __PRETTY_FUNCTION__ <<
"::" <<
detector <<
"::"
161 <<
" merget into output tower (prior to tower ID assignment) : ";
170 for (
auto &
it : new_tower_map)
172 const int eta =
it.first.first;
173 const int phi =
it.first.second;
181 std::cout <<
Name() <<
"::" <<
detector <<
"::" << __PRETTY_FUNCTION__
182 <<
"input sum energy = " << input_e_sum <<
" from " << input_n_tower <<
" towers, merged sum energy = "
199 "PHCompositeNode",
"RUN"));
202 std::cerr << __PRETTY_FUNCTION__ <<
"Run Node missing, doing nothing."
204 throw std::runtime_error(
205 "Failed to find Run node in RawTowerCombiner::CreateNodes");
216 std::cerr << __PRETTY_FUNCTION__ <<
" - " << iTowerGeomNodeName
217 <<
" Node missing, doing nothing." << std::endl;
218 throw std::runtime_error(
219 "Failed to find input tower geometry node in RawTowerCombiner::CreateNodes");
225 const int new_phibins = ceil(
227 const int new_etabins = ceil(
230 using bound_t = std::pair<double, double>;
231 using bound_map_t = std::vector<bound_t>;
233 bound_map_t eta_bound_map;
234 bound_map_t phi_bound_map;
239 assert(first_bin >= 0 && first_bin < towergeom->get_phibins());
241 int last_bin = (
ibin + 1) * _n_combine_phi - 1;
247 const std::pair<double, double> range1 = towergeom->
get_phibounds(
249 const std::pair<double, double> range2 = towergeom->
get_phibounds(
252 phi_bound_map.push_back(std::make_pair(range1.first, range2.second));
258 assert(first_bin >= 0 && first_bin < towergeom->get_etabins());
260 int last_bin = (
ibin + 1) * _n_combine_eta - 1;
266 const std::pair<double, double> range1 = towergeom->
get_etabounds(
268 const std::pair<double, double> range2 = towergeom->
get_etabounds(
271 eta_bound_map.push_back(std::make_pair(range1.first, range2.second));
290 for (
int iphi = 0; iphi < towergeom->
get_phibins(); iphi++)
292 for (
int ieta = 0; ieta < towergeom->
get_etabins(); ieta++)
297 CLHEP::Hep3Vector tower_pos;
313 _towers = findNode::getClass<RawTowerContainer>(topNode,
314 input_TowerNodeName);
317 std::cerr <<
Name() <<
"::" << detector <<
"::" << __PRETTY_FUNCTION__
318 <<
" " << input_TowerNodeName <<
" Node missing, doing bail out!"
320 throw std::runtime_error(
321 "Failed to find " + input_TowerNodeName +
" node in RawTowerCombiner::CreateNodes");
325 "PHCompositeNode",
"DST"));
328 std::cerr << __PRETTY_FUNCTION__ <<
"DST Node missing, doing nothing."
330 throw std::runtime_error(
331 "Failed to find DST node in RawTowerCombiner::CreateNodes");