15 #include "LArReadoutGeometry/FCAL_ChannelMap.h"
17 #include "GaudiKernel/SystemOfUnits.h"
31 for(
int i=0;
i<3;
i++){
72 std::istringstream tileStream1(std::string(tileName,1,1));
73 std::istringstream tileStream2(std::string(tileName,3,2));
74 std::istringstream tileStream3(std::string(tileName,6,3));
76 if (tileStream1) tileStream1 >> a1;
77 if (tileStream2) tileStream2 >> a2;
78 if (tileStream3) tileStream3 >> a3;
88 unsigned int ThisId = (j<<16) +
i;
98 std::istringstream tileStream1(std::string(tileName,1,1));
99 std::istringstream tileStream2(std::string(tileName,3,2));
100 std::istringstream tileStream3(std::string(tileName,6,3));
102 if (tileStream1) tileStream1 >> a1;
103 if (tileStream2) tileStream2 >> a2;
104 if (tileStream3) tileStream3 >> a3;
114 unsigned int ThisId = (j<<16) +
i;
137 while (
first != last){
145 unsigned int ntubes = 1;
152 unsigned int ntubes = (
tile->second).ntubes() + 1;
175 while (tilefirst != tilelast) {
181 unsigned int ntubes = (tilefirst->second).ntubes();
182 float xtubes = (
float) ntubes;
183 float x = (tilefirst->second).
x() / xtubes;
184 float y = (tilefirst->second).
y() / xtubes;
254 unsigned int firstId =
it->first;
257 int ix = ktx+((
int)((firstId&0xffff)-
it->second.x()/
m_tubeDx[isam-1]))+1;
258 int iy = kty+((
int)((firstId>>16)-
it->second.y()/
m_tubeDy[isam-1]))+1;
260 int isOddEven = (((firstId>>16)%2)+(firstId%2))%2;
263 if ( (iy%2) != ((ix+isOddEven)%2) ) {
264 double yc =
y/
m_tubeDy[isam-1] - kty - 0.5;
265 if ( fabs(yc) > 0.5/sqrt(3) ) {
270 double yn = 0.5-xk*(1./3);
271 if ( fabs(yc) > fabs(yn) ) {
295 phi = tilename & 0xffff;
296 eta = tilename >> 16;
329 x = (
it->second).
x();
333 snprintf(l_str,
sizeof(l_str),
334 "Error in FCAL_ChannelMap::x, wrong tile,phi= %d ,eta=: %d ",
phi,
eta);
335 std::string errorMessage(l_str);
336 throw std::range_error(errorMessage.c_str());
373 y = (
it->second).
y();
377 snprintf(l_str,
sizeof(l_str),
378 "Error in FCAL_ChannelMap::x, wrong tile,phi= %d ,eta=: %d",
phi,
eta);
379 std::string errorMessage(l_str);
380 throw std::range_error(errorMessage.c_str());
395 if(sam == 1 || sam == 3) {
396 float scale =sqrt(ntubes);
401 const float inv_1_5 = 1. / 1.5;
402 float scale = sqrt(ntubes * inv_1_5);
430 float&
dx,
float&
dy )
const
437 int ntubes = (
it->second).ntubes();
444 snprintf(l_str,
sizeof(l_str),
445 "Error in FCAL_ChannelMap::tilesize, wrong tile,phi= %d ,eta=: %d ",
phi,
eta);
446 std::string errorMessage(l_str);
447 throw std::range_error(errorMessage.c_str());
458 std::cout <<
"First 10 elements of the New FCAL tube map : " << imap << std::endl;
459 std::stringstream coutx;
461 for (
int i=0;
i<10; ++
i, ++
it)
462 coutx << std::hex <<
it->first <<
"\t"
463 << (
it->second).get_tileName() << std::dec <<
"\t"
464 << (
it->second).
x() <<
"\t"
465 << (
it->second).
y() << std::endl;
466 std::cout<<coutx.str();