15 #include "LArReadoutGeometry/FCAL_ChannelMap.h"
25 const double cm = 10.;
31 static const double root3_2 = std::sqrt(3.)/2;
33 for(
int i=0;
i<3;
i++){
74 std::istringstream tileStream1(std::string(tileName,1,1));
75 std::istringstream tileStream2(std::string(tileName,3,2));
76 std::istringstream tileStream3(std::string(tileName,6,3));
78 if (tileStream1) tileStream1 >> a1;
79 if (tileStream2) tileStream2 >> a2;
80 if (tileStream3) tileStream3 >> a3;
84 TubePosition
tb(tilename,
x*
cm,
y*
cm,
"");
90 unsigned int ThisId = (j<<16) +
i;
100 std::istringstream tileStream1(std::string(tileName,1,1));
101 std::istringstream tileStream2(std::string(tileName,3,2));
102 std::istringstream tileStream3(std::string(tileName,6,3));
104 if (tileStream1) tileStream1 >> a1;
105 if (tileStream2) tileStream2 >> a2;
106 if (tileStream3) tileStream3 >> a3;
110 TubePosition
tb(tilename,
x*
cm,
y*
cm, hvFT);
116 unsigned int ThisId = (j<<16) +
i;
139 while (
first != last){
147 unsigned int ntubes = 1;
148 TilePosition
tp(
x,
y, ntubes);
154 unsigned int ntubes = (
tile->second).ntubes() + 1;
155 TilePosition
tp(
x,
y, ntubes);
177 while (tilefirst != tilelast) {
179 unsigned int ntubes = (tilefirst->second).ntubes();
180 float xtubes = (
float) ntubes;
181 float x = (tilefirst->second).
x() / xtubes;
182 float y = (tilefirst->second).
y() / xtubes;
183 TilePosition
tp(
x,
y, ntubes);
252 unsigned int firstId =
it->first;
255 int ix = ktx+((
int)((firstId&0xffff)-
it->second.x()/
m_tubeDx[isam-1]))+1;
256 int iy = kty+((
int)((firstId>>16)-
it->second.y()/
m_tubeDy[isam-1]))+1;
258 int isOddEven = (((firstId>>16)%2)+(firstId%2))%2;
261 if ( (iy%2) != ((ix+isOddEven)%2) ) {
262 double yc =
y/
m_tubeDy[isam-1] - kty - 0.5;
263 if ( fabs(yc) > 0.5/sqrt(3) ) {
268 double yn = 0.5-xk/3;
269 if ( fabs(yc) > fabs(yn) ) {
293 phi = tilename & 0xffff;
294 eta = tilename >> 16;
325 x = (
it->second).
x();
329 snprintf(l_str,
sizeof(l_str),
330 "Error in FCAL_ChannelMap::x, wrong tile,phi= %d ,eta=: %d ",
phi,
eta);
331 std::string errorMessage(l_str);
332 throw std::range_error(errorMessage.c_str());
370 y = (
it->second).
y();
374 snprintf(l_str,
sizeof(l_str),
375 "Error in FCAL_ChannelMap::x, wrong tile,phi= %d ,eta=: %d",
phi,
eta);
376 std::string errorMessage(l_str);
377 throw std::range_error(errorMessage.c_str());
392 if(sam == 1 || sam == 3) {
393 float scale =sqrt(ntubes);
398 float scale = sqrt(ntubes/1.5);
426 float&
dx,
float&
dy )
const
433 int ntubes = (
it->second).ntubes();
440 snprintf(l_str,
sizeof(l_str),
441 "Error in FCAL_ChannelMap::tilesize, wrong tile,phi= %d ,eta=: %d ",
phi,
eta);
442 std::string errorMessage(l_str);
443 throw std::range_error(errorMessage.c_str());
454 std::cout <<
"First 10 elements of the New FCAL tube map : " << imap << std::endl;
455 std::cout.precision(5);
456 for (
int i=0;
i<10; ++
i, ++
it)
457 std::cout << std::hex <<
it->first <<
"\t"
458 << (
it->second).get_tileName() << std::dec <<
"\t"
459 << (
it->second).
x() <<
"\t"
460 << (
it->second).
y() << std::endl;