25 #include <TRotation.h>
45 , m_SubDetector(
"NONE")
46 , m_MappingTowerFile(
"default.txt")
47 , m_CaloId(RawTowerZDCDefs::
NONE)
50 , m_ThicknessAbsorber(0)
51 , m_ThicknessScintilator(0)
64 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
72 catch (std::exception &
e)
74 std::cout << e.what() << std::endl;
82 catch (std::exception &e)
84 std::cout << e.what() << std::endl;
95 PHG4HitContainer *g4hit = findNode::getClass<PHG4HitContainer>(topNode, NodeNameHits);
98 cout <<
"Could not locate g4 hit node " << NodeNameHits << endl;
106 for (hiter = hit_begin_end.first; hiter != hit_begin_end.second; hiter++)
108 PHG4Hit *g4hit_i = hiter->second;
119 if(layerid >=
it->second) towerid =
it->first;
122 if(layerid ==
it->second){
141 tower->set_energy(0);
145 cout<<
m_SubDetector<<
" : L = "<<layerid<<
" , T = "<<towerid<<endl;
147 std::cout <<
"in: " << g4hit_i->
get_index_i() <<
"\t" << g4hit_i->
get_index_j() <<
"\t" << towerid << std::endl;
148 std::cout <<
"decoded: " << tower->get_bineta() <<
"\t" << tower->get_binphi() <<
"\t" << tower->get_binl() << std::endl;
152 double hit_energy = 0;
154 else hit_energy = g4hit_i->
get_edep();
156 tower->add_ecell(layerid, hit_energy);
157 tower->set_energy(tower->get_energy() + hit_energy);
172 std::cout <<
"storing towers: "<<
m_Towers->
size() << std::endl;
173 cout <<
"Energy lost by dropping towers with less than " <<
m_Emin
179 for (iter = begin_end.first; iter != begin_end.second; ++iter)
181 iter->second->identify();
204 if(d ==
"ZDC_Crystal")
206 else if(d ==
"ZDC_SiPixel")
208 else if(d ==
"ZDC_SiPad")
210 else if(d ==
"ZDC_Sci")
214 std::cout<<
"Invalid ZDC subdetector name in EICG4ZDCRawTowerBuilderByHitIndex"
229 std::cerr <<
PHWHERE <<
"Run Node missing, doing nothing." << std::endl;
230 throw std::runtime_error(
"Failed to find Run node in EICG4ZDCRawTowerBuilderByHitIndex::CreateNodes");
236 std::cerr <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
237 throw std::runtime_error(
"Failed to find DST node in EICG4ZDCRawTowerBuilderByHitIndex::CreateNodes");
242 string NodeNameTowerGeometries =
"TOWERGEOM_" +
m_SubDetector;
259 string NodeNameTowers;
279 ifstream istream_mapping;
282 cerr<<
"ZDCTowerGeomManager::ReadGeometryFileFromTable - ERROR unmatched mapping file: SubDetector "<<
m_SubDetector<<
" : mapping file : "<<
m_MappingTowerFile<<endl;
286 if (!istream_mapping.is_open())
289 if (!istream_mapping)
291 cerr <<
"ZDCTowerGeomManager::ReadGeometryFromTable - ERROR Failed to open mapping file " <<
m_MappingTowerFile << endl;
298 double RotAroundX=0.;
299 double RotAroundY=0.;
300 double RotAroundZ=0.;
301 double GlobalPlaceInX=0.;
302 double GlobalPlaceInY=0.;
303 double GlobalPlaceInZ=0.;
307 while (getline(istream_mapping, line_mapping))
310 if (line_mapping.find(
"#") != string::npos)
314 cout <<
"EICG4ZDCRawTowerBuilderByHitIndex: SKIPPING line in mapping file: " << line_mapping << endl;
318 istringstream iss(line_mapping);
321 if (line_mapping.find(
"Tower ") != string::npos)
323 unsigned idx_T, idx_x, idx_y;
324 double pos_x, pos_y, pos_z;
325 double size_x, size_y,
size_z;
329 if (!(iss >> dummys >> idx_T >> idx_x >> idx_y >> pos_x >> pos_y >> pos_z >> size_x >> size_y >> size_z))
331 cerr <<
"ERROR in EICG4ZDCRawTowerBuilderByHitIndex: Failed to read line in mapping file " <<
m_MappingTowerFile << endl;
353 else if (line_mapping.find(
"iT_iL ")!=string::npos)
355 int towerid, layerid;
357 if(!(iss >> dummys >> towerid >> layerid))
359 cerr<<
"ERROR in EICG4ZDCRawTowerBuilderByHitIndex: Failed to read line in mapping file "<<
m_MappingTowerFile <<endl;
371 if (!(iss >> parname >> parval))
373 cerr <<
"ERROR in EICG4ZDCRawTowerBuilderByHitIndex: Failed to read line in mapping file " <<
m_MappingTowerFile << endl;
380 std::map<string, double>::iterator parit;
384 GlobalPlaceInX = parit->second;
388 GlobalPlaceInY = parit->second;
392 GlobalPlaceInZ = parit->second;
396 RotAroundX = parit->second;
400 RotAroundY = parit->second;
404 RotAroundZ = parit->second;
414 it != all_towers.second; ++
it)
416 double x_temp =
it->second->get_center_x();
417 double y_temp =
it->second->get_center_y();
418 double z_temp =
it->second->get_center_z();
420 TVector3 v_temp_r(x_temp, y_temp, z_temp);
423 v_temp_r.RotateX(RotAroundX);
424 v_temp_r.RotateY(RotAroundY);
425 v_temp_r.RotateZ(RotAroundZ);
428 double x_temp_rt = v_temp_r.X() + GlobalPlaceInX;
429 double y_temp_rt = v_temp_r.Y() + GlobalPlaceInY;
430 double z_temp_rt = v_temp_r.Z() + GlobalPlaceInZ;
433 it->second->set_center_x(x_temp_rt);
434 it->second->set_center_y(y_temp_rt);
435 it->second->set_center_z(z_temp_rt);
439 cout <<
"* Local tower x y z : " << x_temp <<
" " << y_temp <<
" " << z_temp << endl;
440 cout <<
"* Globl tower x y z : " << x_temp_rt <<
" " << y_temp_rt <<
" " << z_temp_rt << endl;