21 bool goodGeometry=
true;
40 if (totalLayersIn !=
BCALMID-1) goodGeometry=
false;
41 if (totalLayersOut != 10-(
BCALMID-1)) goodGeometry=
false;
44 std::cout<<
"ERROR: Bad BCAL fADC groupings, do not evenly divide cells";
60 float my_BCALINNERRAD;
65 vector<float> bcal_fadc_radii;
67 if(bcal_fadc_radii.size()==5){
68 for(uint32_t i=0; i<bcal_fadc_radii.size(); i++){
73 jerr<<
"Did not retrieve 5 values for BCAL fADC radii!!!" << endl;
78 float my_GLOBAL_CENTER;
83 float my_BCALFIBERLENGTH;
88 float my_BCAL_PHI_SHIFT;
169 if (cell_layer <= tally) {
178 if (cell_layer <= tally) {
199 fADC_sector = 1 + (cell_sector-1);
202 fADC_sector = 1 + (cell_sector-1);
218 int SiPM_cell =
cellId(module, SiPM_layer, SiPM_sector);
223 return cellId(module, fADC_lay, fADC_sect);
233 int fadc_lay =
layer(fADCId);
254 int fADC_lay =
layer( fADC_cell );
263 for (
int i=0;i<fADC_lay;i++) {
266 innerIndex=innerIndex+NSUMLAYSIN[i];
275 innerIndex=innerIndex+NSUMLAYSOUT[i];
279 return 0.5 * ( innerRad + outerRad );
288 int fADC_lay =
layer( fADC_cell );
297 for (
int i=0;i<fADC_lay;i++) {
300 innerIndex=innerIndex+NSUMLAYSIN[i];
309 innerIndex=innerIndex+NSUMLAYSOUT[i];
313 return ( outerRad - innerRad );
341 float sectSize = 2. * M_PI / 48. / 4;
343 float my_phi = sectSize * (globsect-2.5);
344 if (my_phi < 0) my_phi += 2 * M_PI;
366 float sectSize = 2 * M_PI / 48 / 4;
383 float modulephiSize = (2 * M_PI) / 48;
384 float sectorphiSize = modulephiSize / 4;
385 float phi_nooffset = (phi + 2.0*sectorphiSize);
386 if (phi_nooffset < 0)
return 0;
387 else if (phi_nooffset > 2 * M_PI)
return 0;
389 if (r <
m_radius[1]) SiPM_layer = 1;
390 else if (r <
m_radius[2]) SiPM_layer = 2;
391 else if (r <
m_radius[3]) SiPM_layer = 3;
392 else if (r <
m_radius[4]) SiPM_layer = 4;
393 else if (r <
m_radius[5]) SiPM_layer = 5;
394 else if (r <
m_radius[6]) SiPM_layer = 6;
395 else if (r <
m_radius[7]) SiPM_layer = 7;
396 else if (r <
m_radius[8]) SiPM_layer = 8;
397 else if (r <
m_radius[9]) SiPM_layer = 9;
398 else SiPM_layer = 10;
400 float modulefloat = 1 + phi_nooffset / modulephiSize;
401 int module = (int)modulefloat;
402 float sectorfloat = 1 + ((phi_nooffset - (module-1)*modulephiSize) / sectorphiSize);
403 int sector = (int)sectorfloat;
410 if (module<=0 || layer<=0 || sector<=0)
return 0;
411 else return (module-1)*32 + (layer-1)*8 + (sector-1)*2 + end + 1;
415 if (module<=0 || layer<=0 || sector<=0)
return 0;
416 else return (module-1)*16 + (layer-1)*4 + sector;
420 if (module<=0 || sector<=0)
return 0;
421 else return (module-1)*4 +
sector;
425 if (globalsector<=0)
return 0;
426 int sector = globalsector%4;
427 if (sector==0) sector=4;
432 if (globalsector<=0)
return 0;
433 else return (globalsector-1)/4+1;
const int NBCALLAYSIN
number of readout layers in inner BCAL (first 6 SiPM layers)
int getmodule(int globalsector) const
int fADCcellId_rphi(float r, float phi) const
these are missing functions that fill in some previous gaps.
vector< int > NSUMLAYSIN
number of radial SiPM layers summed for digitization in each inner readout layer
float BCALINNERRAD
innner radius of BCAL in cm
float BCALOUTERRAD
outer radius of BCAL in cm
float rSize(int fADC_cellId) const
bool GetBCALRmin(float &bcal_rmin) const
minimum distance of BCAL module from beam line
float GetBCAL_phi_shift() const
int fADC_sector(int SiPM_cellId) const
void Initialize(int runnumber)
const int BCALMID
first outer layer (default 7)
float phi(int fADC_cellId) const
these functions are about the physical location and dimensions of a readout cell
float GetBCAL_length() const
int getglobalchannelnumber(int module, int layer, int sector, int end) const
Return a BCAL channel number, in order of significance (module, layer, sector, end).
float fADC_radius[5]
BCAL layer radii (4 layers total)
int fADCId(int module, int SiPM_layer, int SiPM_sector) const
bool GetBCALLength(float &bcal_length) const
length of BCAL module in cm
bool GetBCALCenterZ(float &bcal_center_z) const
z-location of center of BCAL module in cm
DGeometry * GetDGeometry(unsigned int run_number)
float GetBCAL_inner_rad() const
float phiSize(int fADC_cellId) const
float r(int fADC_cellId) const
int NSiPMs(int fADCId) const
int getglobalsector(int module, int sector) const
int layer(int cellId) const
This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way...
bool GetBCALPhiShift(float &bcal_phi_shift) const
phi angle in degrees that first BCAL module is shifted from being centered at ph=0.0
int sector(int cellId) const
This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way...
float GetBCAL_center() const
float BCAL_PHI_SHIFT
overall phi roation of BCAL in radians
const float * GetBCAL_radii() const
int cellId(int module, int layer, int sector) const
these functions are about encoding/decoding module/layer/sector info in a cellId
float BCALFIBERLENGTH
BCAL Scintilator fiber lenth in cm.
bool GetBCALfADCRadii(vector< float > &fADC_radii) const
fADC radii including the outer radius of the last layer
int getsector(int globalsector) const
float GLOBAL_CENTER
center of BCAL in gloobal coordinate system
int module(int cellId) const
This method can be used for the SiPM ID or for the fADC ID since they are defined in the same way...
int getendchannelnumber(int module, int layer, int sector) const
Return a channel number for either end, in order of significance (module, layer, sector).
const int NBCALLAYSOUT
number of readout layers in outer BCAL (outer 4 SiPM layers)
vector< int > NSUMLAYSOUT
number of radial SiPM layers summed for digitization in each outer readout layer
int fADC_layer(int SiPM_cellId) const
these functions are about finding which readout cell contains a specific SiPM cell ...