Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MbdGeomV1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MbdGeomV1.cc
1 #include "MbdGeomV1.h"
2 
3 #include <cmath>
4 
5 // kludge where we have the hardcoded positions of the tubes
6 // Should really be put in a database
7 // These are the x,y for the south MBD (in cm).
8 // The north inverts the x coordinate (x -> -x)
9 static const float PmtLoc[64][2] = {
10  {-12.2976, 4.26},
11  {-12.2976, 1.42},
12  {-9.83805, 8.52},
13  {-9.83805, 5.68},
14  {-9.83805, 2.84},
15  {-7.37854, 9.94},
16  {-7.37854, 7.1},
17  {-7.37854, 4.26},
18  {-7.37854, 1.42},
19  {-4.91902, 11.36},
20  {-4.91902, 8.52},
21  {-4.91902, 5.68},
22  {-2.45951, 12.78},
23  {-2.45951, 9.94},
24  {-2.45951, 7.1},
25  {0, 11.36},
26  {0, 8.52},
27  {2.45951, 12.78},
28  {2.45951, 9.94},
29  {2.45951, 7.1},
30  {4.91902, 11.36},
31  {4.91902, 8.52},
32  {4.91902, 5.68},
33  {7.37854, 9.94},
34  {7.37854, 7.1},
35  {7.37854, 4.26},
36  {7.37854, 1.42},
37  {9.83805, 8.52},
38  {9.83805, 5.68},
39  {9.83805, 2.84},
40  {12.2976, 4.26},
41  {12.2976, 1.42},
42  {12.2976, -4.26},
43  {12.2976, -1.42},
44  {9.83805, -8.52},
45  {9.83805, -5.68},
46  {9.83805, -2.84},
47  {7.37854, -9.94},
48  {7.37854, -7.1},
49  {7.37854, -4.26},
50  {7.37854, -1.42},
51  {4.91902, -11.36},
52  {4.91902, -8.52},
53  {4.91902, -5.68},
54  {2.45951, -12.78},
55  {2.45951, -9.94},
56  {2.45951, -7.1},
57  {0, -11.36},
58  {0, -8.52},
59  {-2.45951, -12.78},
60  {-2.45951, -9.94},
61  {-2.45951, -7.1},
62  {-4.91902, -11.36},
63  {-4.91902, -8.52},
64  {-4.91902, -5.68},
65  {-7.37854, -9.94},
66  {-7.37854, -7.1},
67  {-7.37854, -4.26},
68  {-7.37854, -1.42},
69  {-9.83805, -8.52},
70  {-9.83805, -5.68},
71  {-9.83805, -2.84},
72  {-12.2976, -4.26},
73  {-12.2976, -1.42}};
74 
76 {
77  // Set the pmt locations
78  for (unsigned int ipmt = 0; ipmt < 128; ipmt++)
79  {
80  int arm = ipmt / 64;
81 
82  float xsign = 1.;
83  float zsign = -1.;
84  if (arm == 1) // north
85  {
86  xsign = -1.;
87  zsign = 1.;
88  }
89 
90  float tube_x = xsign * PmtLoc[ipmt % 64][0];
91  float tube_y = PmtLoc[ipmt % 64][1];
92  float tube_z = zsign * 253.;
93 
94  MbdGeomV1::set_xyz(ipmt, tube_x, tube_y, tube_z);
95  }
96 }
97 
98 void MbdGeomV1::set_xyz(const unsigned int ipmt, const float x, const float y, const float z)
99 {
100  pmt_x[ipmt] = x;
101  pmt_y[ipmt] = y;
102  pmt_z[ipmt] = z;
103  pmt_r[ipmt] = std::sqrt(x * x + y * y);
104  pmt_phi[ipmt] = std::atan2(y, x);
105 }