3 #include <Geant4/G4SystemOfUnits.hh>
4 #include <Geant4/G4Types.hh>
6 #include <calobase/RawTowerContainer.h>
7 #include <calobase/RawTowerv1.h>
8 #include <calobase/RawTowerv2.h>
10 #include <calobase/RawTower.h>
11 #include <calobase/RawTowerDefs.h>
12 #include <calobase/RawTowerGeom.h>
13 #include <calobase/RawTowerGeomContainer.h>
14 #include <calobase/RawTowerGeomContainerv1.h>
15 #include <calobase/RawTowerGeomv3.h>
31 #include <TRotation.h>
50 , m_MappingTowerFile(
"default.txt")
51 , m_CaloId(RawTowerDefs::
NONE)
68 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
76 catch (std::exception &
e)
78 std::cout << e.what() << std::endl;
86 catch (std::exception &e)
88 std::cout << e.what() << std::endl;
99 PHG4HitContainer *g4hit = findNode::getClass<PHG4HitContainer>(topNode, NodeNameHits);
102 cout <<
"Could not locate g4 hit node " << NodeNameHits << endl;
110 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; hiter++)
112 PHG4Hit *g4hit_i = hiter->second;
126 tower->set_energy(0);
127 tower->set_scint_gammas(0.);
128 tower->set_cerenkov_gammas(0.);
136 if (dynamic_cast<RawTowerv2 *>(tower) ==
nullptr)
138 cout << __PRETTY_FUNCTION__ <<
" : Fatal Error! "
139 <<
"Expect RawTowerv2, but found this tower:";
148 tower->set_scint_gammas(tower->get_scint_gammas() + g4hit_i->
get_property_float(PHG4Hit::PROPERTY::scint_gammas));
149 tower->set_cerenkov_gammas(tower->get_cerenkov_gammas() + g4hit_i->
get_property_float(PHG4Hit::PROPERTY::cerenkov_gammas));
168 cout <<
"Energy lost by dropping towers with less than " <<
m_Emin
173 for (iter = begin_end.first; iter != begin_end.second; ++iter)
175 iter->second->identify();
199 std::cerr <<
PHWHERE <<
"Run Node missing, doing nothing." << std::endl;
200 throw std::runtime_error(
"Failed to find Run node in RawTowerBuilderDRCALO::CreateNodes");
206 std::cerr <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
207 throw std::runtime_error(
"Failed to find DST node in RawTowerBuilderDRCALO::CreateNodes");
212 string NodeNameTowerGeometries =
"TOWERGEOM_" +
m_Detector;
229 string NodeNameTowers;
249 ifstream istream_mapping;
252 if (!istream_mapping.is_open())
255 if (!istream_mapping)
257 cerr <<
"CaloTowerGeomManager::ReadGeometryFromTable - ERROR Failed to open mapping file " <<
m_MappingTowerFile << endl;
264 while (getline(istream_mapping, line_mapping))
267 if (line_mapping.find(
"#") != string::npos)
271 cout <<
"RawTowerBuilderDRCALO: SKIPPING line in mapping file: " << line_mapping << endl;
276 istringstream iss(line_mapping);
279 if (line_mapping.find(
"Tower ") != string::npos)
291 if (!(iss >> parname >> parval))
293 cerr <<
"ERROR in RawTowerBuilderDRCALO: Failed to read line in mapping file " <<
m_MappingTowerFile << endl;
302 std::map<string, double>::iterator parit;
335 twrsize = parit->second *
cm;
341 twrreadout = parit->second *
cm;
345 drsize = parit->second *
cm;
347 int maxsubtow = (
int) ( (twrsize) / (twrreadout));
348 twredge = (twrsize - (maxsubtow * twrreadout))/maxsubtow;
349 if(twrsize!=twrreadout){
350 twrsize = twrreadout + twredge;
354 for (
int idxj = 0; idxj < drsize * 2 / twrsize; idxj++)
356 pos_x = (idxj * twrsize - drsize);
358 for (
int idxk = 0; idxk < drsize * 2 / twrsize; idxk++)
360 pos_y = (idxk * twrsize - drsize);