Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:49

0001 #include "BbcGeomV1.h"
0002 
0003 #include <cmath>
0004 
0005 // kludge where we have the hardcoded positions of the tubes
0006 // Should really be put in a database
0007 // These are the x,y for the south BBC (in cm).
0008 // The north inverts the x coordinate (x -> -x)
0009 static const float PmtLoc[64][2] = {
0010     {-12.2976, 4.26},
0011     {-12.2976, 1.42},
0012     {-9.83805, 8.52},
0013     {-9.83805, 5.68},
0014     {-9.83805, 2.84},
0015     {-7.37854, 9.94},
0016     {-7.37854, 7.1},
0017     {-7.37854, 4.26},
0018     {-7.37854, 1.42},
0019     {-4.91902, 11.36},
0020     {-4.91902, 8.52},
0021     {-4.91902, 5.68},
0022     {-2.45951, 12.78},
0023     {-2.45951, 9.94},
0024     {-2.45951, 7.1},
0025     {0, 11.36},
0026     {0, 8.52},
0027     {2.45951, 12.78},
0028     {2.45951, 9.94},
0029     {2.45951, 7.1},
0030     {4.91902, 11.36},
0031     {4.91902, 8.52},
0032     {4.91902, 5.68},
0033     {7.37854, 9.94},
0034     {7.37854, 7.1},
0035     {7.37854, 4.26},
0036     {7.37854, 1.42},
0037     {9.83805, 8.52},
0038     {9.83805, 5.68},
0039     {9.83805, 2.84},
0040     {12.2976, 4.26},
0041     {12.2976, 1.42},
0042     {12.2976, -4.26},
0043     {12.2976, -1.42},
0044     {9.83805, -8.52},
0045     {9.83805, -5.68},
0046     {9.83805, -2.84},
0047     {7.37854, -9.94},
0048     {7.37854, -7.1},
0049     {7.37854, -4.26},
0050     {7.37854, -1.42},
0051     {4.91902, -11.36},
0052     {4.91902, -8.52},
0053     {4.91902, -5.68},
0054     {2.45951, -12.78},
0055     {2.45951, -9.94},
0056     {2.45951, -7.1},
0057     {0, -11.36},
0058     {0, -8.52},
0059     {-2.45951, -12.78},
0060     {-2.45951, -9.94},
0061     {-2.45951, -7.1},
0062     {-4.91902, -11.36},
0063     {-4.91902, -8.52},
0064     {-4.91902, -5.68},
0065     {-7.37854, -9.94},
0066     {-7.37854, -7.1},
0067     {-7.37854, -4.26},
0068     {-7.37854, -1.42},
0069     {-9.83805, -8.52},
0070     {-9.83805, -5.68},
0071     {-9.83805, -2.84},
0072     {-12.2976, -4.26},
0073     {-12.2976, -1.42}};
0074 
0075 BbcGeomV1::BbcGeomV1()
0076 {
0077   // Set the pmt locations
0078   for (unsigned int ipmt = 0; ipmt < 128; ipmt++)
0079   {
0080     int arm = ipmt / 64;
0081 
0082     float xsign = 1.;
0083     float zsign = -1.;
0084     if (arm == 1)  // north
0085     {
0086       xsign = -1.;
0087       zsign = 1.;
0088     }
0089 
0090     float tube_x = xsign * PmtLoc[ipmt % 64][0];
0091     float tube_y = PmtLoc[ipmt % 64][1];
0092     float tube_z = zsign * 253.;
0093 
0094     BbcGeomV1::set_xyz(ipmt, tube_x, tube_y, tube_z);
0095   }
0096 }
0097 
0098 void BbcGeomV1::set_xyz(const unsigned int ipmt, const float x, const float y, const float z)
0099 {
0100   pmt_x[ipmt] = x;
0101   pmt_y[ipmt] = y;
0102   pmt_z[ipmt] = z;
0103   pmt_r[ipmt] = std::sqrt((x * x) + (y * y));
0104   pmt_phi[ipmt] = std::atan2(y, x);
0105 }