3 #include <calobase/RawTower.h>
4 #include <calobase/RawTowerv1.h>
5 #include <calobase/RawTowerContainer.h>
6 #include <calobase/RawTowerDefs.h>
7 #include <calobase/RawTowerGeomContainer.h>
8 #include <calobase/RawTowerGeomContainer_Cylinderv1.h>
9 #include <calobase/RawTowerGeom.h>
10 #include <calobase/RawTowerGeomv1.h>
32 #include <boost/io/ios_state.hpp>
46 , m_TowerContainer(nullptr)
47 , m_RawTowerGeomContainer(nullptr)
49 , m_TowerEnergySrcEnum(kLightYield)
51 , m_ChkEnergyConservationFlag(0)
65 std::string geonodename =
"CYLINDERCELLGEOM_" +
m_Detector;
70 cout <<
PHWHERE <<
" " << geonodename
71 <<
" Node missing, doing nothing." << std::endl;
72 throw std::runtime_error(
73 "Failed to find " + geonodename +
" node in RawTowerBuilder::CreateNodes");
86 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
94 catch (std::exception &
e)
96 std::cout << e.what() << std::endl;
102 cout <<
"RawTowerBuilder::InitRun :";
105 cout <<
"save Geant4 energy deposition as the weight of the cells"
110 cout <<
"save light yield as the weight of the cells" << endl;
121 std::cout <<
PHWHERE <<
"Process event entered" << std::endl;
125 std::string cellnodename =
"G4CELL_" +
m_Detector;
126 PHG4CellContainer *cells = findNode::getClass<PHG4CellContainer>(topNode, cellnodename);
129 cout <<
PHWHERE <<
" " << cellnodename
130 <<
" Node missing, doing nothing." << std::endl;
137 for (cell_iter = cell_range.first; cell_iter != cell_range.second; ++cell_iter)
143 std::cout <<
PHWHERE <<
" print out the cell:" << std::endl;
163 boost::io::ios_flags_saver ifs(cout);
174 float cell_weight = 0;
188 shower_iter != range.second;
191 tower->
add_eshower(shower_iter->first, shower_iter->second);
207 if (fabs(cellE - towerE) / cellE > 1
e-5)
209 cout <<
"towerE: " << towerE <<
", cellE: " << cellE <<
", delta: "
210 << cellE - towerE << endl;
221 cout <<
"Energy lost by dropping towers with less than " <<
m_Emin
227 for (iter = begin_end.first; iter != begin_end.second; ++iter)
229 iter->second->identify();
242 cout <<
PHWHERE <<
"Run Node missing, doing nothing." << std::endl;
243 throw std::runtime_error(
"Failed to find Run node in RawTowerBuilder::CreateNodes");
257 std::string geonodename =
"CYLINDERCELLGEOM_" +
m_Detector;
261 cout <<
PHWHERE <<
" " << geonodename
262 <<
" Node missing, doing nothing." << std::endl;
263 throw std::runtime_error(
264 "Failed to find " + geonodename +
" node in RawTowerBuilder::CreateNodes");
282 int first_layer = -1;
286 for (miter = begin_end.first; miter != begin_end.second; ++miter)
297 first_cellgeo = miter->second;
319 cout <<
"RawTowerBuilder::CreateNodes::" <<
Name()
320 <<
" - Fatal Error - unsupported cell binning method "
332 <<
" layer " << cellgeo->
get_layer() <<
": "
338 cout <<
"radius of layer " << cellgeo->
get_layer() <<
" is "
339 << cellgeo->
get_radius() <<
" which smaller than radius "
340 << inner_radius <<
" of first layer in list " << first_layer
345 cout <<
"mixing number of phibins, fisrt layer: " <<
m_NumPhiBins
346 <<
" layer " << cellgeo->
get_layer() <<
": "
352 cout <<
"mixing number of phimin, fisrt layer: " <<
m_PhiMin
353 <<
" layer " << cellgeo->
get_layer() <<
": "
359 cout <<
"mixing phisteps first layer: " <<
m_PhiStep <<
" layer "
368 cout <<
"mixing number of EtaBins , first layer: "
375 cout <<
"mixing etamin, fisrt layer: " <<
m_EtaMin <<
" layer "
382 cout <<
"mixing eta steps first layer: " <<
m_EtaStep
383 <<
" layer " << cellgeo->
get_layer() <<
": "
394 cout <<
"mixing number of z bins , first layer: " <<
m_NumEtaBins
395 <<
" layer " << cellgeo->
get_layer() <<
": "
411 cout <<
"RawTowerBuilder::CreateNodes - ERROR - can not find first layer of cells "
417 for (
int ibin = 0; ibin < first_cellgeo->
get_phibins(); ibin++)
419 const pair<double, double> range = first_cellgeo->
get_phibounds(ibin);
428 for (
int ibin = 0; ibin < first_cellgeo->
get_etabins(); ibin++)
430 const pair<double, double> range = first_cellgeo->
get_etabounds(ibin);
452 cout <<
"RawTowerBuilder::CreateNodes - Tower geometry " << key <<
" already exists" << endl;
455 if (fabs(tg->get_center_x() -
x) > 1
e-4)
457 cout <<
"RawTowerBuilder::CreateNodes - Fatal Error - duplicated Tower geometry " << key <<
" with existing x = " << tg->
get_center_x() <<
" and expected x = " << x
462 if (fabs(tg->get_center_y() -
y) > 1
e-4)
464 cout <<
"RawTowerBuilder::CreateNodes - Fatal Error - duplicated Tower geometry " << key <<
" with existing y = " << tg->get_center_y() <<
" and expected y = " << y
468 if (fabs(tg->get_center_z() -
z) > 1
e-4)
470 cout <<
"RawTowerBuilder::CreateNodes - Fatal Error - duplicated Tower geometry " << key <<
" with existing z= " << tg->get_center_z() <<
" and expected z = " <<
z
479 cout <<
"RawTowerBuilder::CreateNodes - building tower geometry " << key <<
"" << endl;
496 for (
int ibin = 0; ibin < first_cellgeo->
get_zbins(); ibin++)
498 const pair<double, double> z_range = first_cellgeo->
get_zbounds(ibin);
500 const double eta1 = -log(tan(atan2(r, z_range.first) / 2.));
501 const double eta2 = -log(tan(atan2(r, z_range.second) / 2.));
508 for (
int ibin = 0; ibin < first_cellgeo->
get_zbins(); ibin++)
521 cout <<
"RawTowerBuilder::CreateNodes - Tower geometry " << key <<
" already exists" << endl;
524 if (fabs(tg->get_center_x() -
x) > 1
e-4)
526 cout <<
"RawTowerBuilder::CreateNodes - Fatal Error - duplicated Tower geometry " << key <<
" with existing x = " << tg->
get_center_x() <<
" and expected x = " << x
531 if (fabs(tg->get_center_y() -
y) > 1
e-4)
533 cout <<
"RawTowerBuilder::CreateNodes - Fatal Error - duplicated Tower geometry " << key <<
" with existing y = " << tg->get_center_y() <<
" and expected y = " << y
537 if (fabs(tg->get_center_z() -
z) > 1
e-4)
539 cout <<
"RawTowerBuilder::CreateNodes - Fatal Error - duplicated Tower geometry " << key <<
" with existing z= " << tg->get_center_z() <<
" and expected z = " <<
z
548 cout <<
"RawTowerBuilder::CreateNodes - building tower geometry " << key <<
"" << endl;
563 cout <<
"RawTowerBuilder::CreateNodes - ERROR - unsupported cell geometry "
576 cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
577 throw std::runtime_error(
578 "Failed to find DST node in RawTowerBuilder::CreateNodes");
605 DetNode->addNode(towerNode);