3 #include <calobase/RawTowerContainer.h>
4 #include <calobase/RawTowerv1.h>
6 #include <calobase/RawTower.h>
7 #include <calobase/RawTowerDefs.h>
8 #include <calobase/RawTowerGeom.h>
9 #include <calobase/RawTowerGeomContainer.h>
10 #include <calobase/RawTowerGeomContainerv1.h>
11 #include <calobase/RawTowerGeomv3.h>
19 #include <pdbcalbase/PdbParameterMap.h>
27 #include <TRotation.h>
30 #include <Geant4/G4SystemOfUnits.hh>
31 #include <Geant4/G4ThreeVector.hh>
32 #include <Geant4/G4Transform3D.hh>
33 #include <Geant4/G4Types.hh>
34 #include <Geant4/G4UnionSolid.hh>
35 #include <Geant4/G4VPhysicalVolume.hh>
51 , m_MappingTowerFile(
"default.txt")
52 , m_CaloId(RawTowerDefs::
NONE)
72 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
80 catch (std::exception &
e)
82 std::cout << e.what() << std::endl;
90 catch (std::exception &e)
92 std::cout << e.what() << std::endl;
102 std::string NodeNameHits =
"G4HIT_" +
m_Detector;
103 PHG4HitContainer *g4hit = findNode::getClass<PHG4HitContainer>(topNode, NodeNameHits);
106 std::cout <<
"Could not locate g4 hit node " << NodeNameHits << std::endl;
114 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; hiter++)
116 PHG4Hit *g4hit_i = hiter->second;
132 tower->set_energy(0);
151 std::cout <<
"storing towers: " <<
m_Towers->
size() << std::endl;
152 std::cout <<
"Energy lost by dropping towers with less than " <<
m_Emin
157 for (iter = begin_end.first; iter != begin_end.second; ++iter)
159 iter->second->identify();
183 std::cerr <<
PHWHERE <<
"Run Node missing, doing nothing." << std::endl;
184 throw std::runtime_error(
"Failed to find Run node in B0RawTowerBuilderByHitIndex::CreateNodes");
190 std::cerr <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
191 throw std::runtime_error(
"Failed to find DST node in B0RawTowerBuilderByHitIndex::CreateNodes");
196 std::string NodeNameTowerGeometries =
"TOWERGEOM_" +
m_Detector;
213 std::string NodeNameTowers;
233 std::ifstream istream_mapping;
236 if (!istream_mapping.is_open())
239 if (!istream_mapping)
241 std::cerr <<
"CaloTowerGeomManager::ReadGeometryFromTable - ERROR Failed to open mapping file " <<
m_MappingTowerFile << std::endl;
246 std::string line_mapping;
248 while (getline(istream_mapping, line_mapping))
251 if (line_mapping.find(
"#") != std::string::npos)
255 std::cout <<
"B0RawTowerBuilderByHitIndex: SKIPPING line in mapping file: " << line_mapping << std::endl;
279 std::istringstream iss(line_mapping);
284 unsigned idx_j, idx_k, idx_l;
285 G4double pos_x, pos_y, pos_z, pos_z1;
293 if (line_mapping.find(
"B0 ") != std::string::npos)
295 if (!(iss >> dummys >> pos_x >> pos_y >> pos_z >> pos_z1))
297 std::cout <<
"ERROR in B0RawTowerBuilder: Failed to read global position from mapping file " <<
m_MappingTowerFile << std::endl;
304 else if (line_mapping.find(
"Tower ") != std::string::npos)
307 if (!(iss >> dummys >> idx_j >> idx_k >> idx_l >> pos_x >> pos_y >> pos_z >> size_x >> size_y >> size_z >> rot_x >> rot_y >> rot_z >> dummy))
310 std::cout <<
"ERROR in B0RawTowerBuilder: Failed to read line in mapping file " <<
m_MappingTowerFile << std::endl;
316 size_x = size_x *
cm;
317 size_y = size_y *
cm;
318 size_z = size_z *
cm;
336 std::cout <<
"ERROR in B0RawTowerBuilder: Unknown line in Mapping File " <<
m_MappingTowerFile << std::endl;
361 it != all_towers.second; ++
it)
363 double x_temp =
it->second->get_center_x();
364 double y_temp =
it->second->get_center_y();
365 double z_temp =
it->second->get_center_z();
373 TVector3 v_temp_r(x_temp, y_temp, z_temp);
374 v_temp_r.Transform(rot);
381 it->second->set_center_x(x_temp_rt);
382 it->second->set_center_y(y_temp_rt);
383 it->second->set_center_z(z_temp_rt);
387 std::cout <<
"* Local tower x y z : " << x_temp <<
" " << y_temp <<
" " << z_temp << std::endl;
388 std::cout <<
"* Tower size x y z : " <<
it->second->get_size_x() <<
" " <<
it->second->get_size_y() <<
" " <<
it->second->get_size_z() << std::endl;
389 std::cout <<
"* Globl tower x y z : " << x_temp_rt <<
" " << y_temp_rt <<
" " << z_temp_rt << std::endl;