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/RawTowerGeomv3.h>
10 #include <calobase/RawTowerGeomContainer.h>
11 #include <calobase/RawTowerGeomContainerv1.h>
25 #include <pdbcalbase/PdbParameterMap.h>
27 #include <TRotation.h>
29 #include <Geant4/G4SystemOfUnits.hh>
30 #include <Geant4/G4ThreeVector.hh>
31 #include <Geant4/G4Transform3D.hh>
32 #include <Geant4/G4Types.hh>
33 #include <Geant4/G4VPhysicalVolume.hh>
35 #include <Geant4/G4UnionSolid.hh>
53 , m_MappingTowerFile(
"default.txt")
54 , m_CaloId(RawTowerDefs::
NONE)
74 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
82 catch (std::exception &
e)
84 std::cout << e.what() << std::endl;
92 catch (std::exception &e)
94 std::cout << e.what() << std::endl;
105 PHG4HitContainer *g4hit = findNode::getClass<PHG4HitContainer>(topNode, NodeNameHits);
108 cout <<
"Could not locate g4 hit node " << NodeNameHits << endl;
116 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; hiter++)
118 PHG4Hit *g4hit_i = hiter->second;
134 tower->set_energy(0);
153 std::cout <<
"storing towers: "<<
m_Towers->
size() << std::endl;
154 cout <<
"Energy lost by dropping towers with less than " <<
m_Emin
159 for (iter = begin_end.first; iter != begin_end.second; ++iter)
161 iter->second->identify();
185 std::cerr <<
PHWHERE <<
"Run Node missing, doing nothing." << std::endl;
186 throw std::runtime_error(
"Failed to find Run node in BwdRawTowerBuilderByHitIndex::CreateNodes");
192 std::cerr <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
193 throw std::runtime_error(
"Failed to find DST node in BwdRawTowerBuilderByHitIndex::CreateNodes");
198 string NodeNameTowerGeometries =
"TOWERGEOM_" +
m_Detector;
215 string NodeNameTowers;
235 ifstream istream_mapping;
238 if (!istream_mapping.is_open())
241 if (!istream_mapping)
243 cerr <<
"CaloTowerGeomManager::ReadGeometryFromTable - ERROR Failed to open mapping file " <<
m_MappingTowerFile << endl;
250 while (getline(istream_mapping, line_mapping))
253 if (line_mapping.find(
"#") != string::npos)
257 cout <<
"BwdRawTowerBuilderByHitIndex: SKIPPING line in mapping file: " << line_mapping << endl;
281 std::istringstream iss(line_mapping);
286 unsigned idx_j, idx_k, idx_l;
287 G4double pos_x, pos_y, pos_z, pos_z1;
295 if (line_mapping.find(
"Bwd ") != std::string::npos)
297 if (!(iss >> dummys>> pos_x >> pos_y >> pos_z >> pos_z1 ))
299 std::cout <<
"ERROR in BwdRawTowerBuilder: Failed to read global position from mapping file " <<
m_MappingTowerFile << std::endl;
306 else if (line_mapping.find(
"Tower ") != std::string::npos){
308 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))
311 std::cout <<
"ERROR in BwdRawTowerBuilder: Failed to read line in mapping file " <<
m_MappingTowerFile << std::endl;
317 size_x = size_x *
cm;
318 size_y = size_y *
cm;
319 size_z = size_z *
cm;
336 else std::cout <<
"ERROR in BwdRawTowerBuilder: 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 cout <<
"* Local tower x y z : " << x_temp <<
" " << y_temp <<
" " << z_temp << endl;
388 cout <<
"* Tower size x y z : " <<
it->second->get_size_x() <<
" " <<
it->second->get_size_y() <<
" " <<
it->second->get_size_z() << endl;
389 cout <<
"* Globl tower x y z : " << x_temp_rt <<
" " << y_temp_rt <<
" " << z_temp_rt << endl;