EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4TpcCentralMembrane.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4TpcCentralMembrane.h
1 #ifndef PHG4TPCCENTRALMEMBRANE_H
2 #define PHG4TPCCENTRALMEMBRANE_H
3 
4 #include <fun4all/SubsysReco.h>
5 #include <phparameter/PHParameterInterface.h>
6 
7 #include <array>
8 #include <cmath>
9 #include <string> // for string
10 #include <vector>
11 
12 class PHCompositeNode;
13 class PHG4Hit;
14 
15 // all distances in mm, all angles in rad
16 // class that generates stripes and dummy hit coordinates
17 // stripes have width of one mm, length of one pad width, and are centered in middle of sector gaps
18 
20 {
21  public:
23  PHG4TpcCentralMembrane(const std::string& name = "PHG4TpcDirectLaser");
24  ;
25 
27  ~PHG4TpcCentralMembrane() override;
28 
30  int InitRun(PHCompositeNode*) override;
31 
33  int process_event(PHCompositeNode*) override;
34 
36  void SetDefaultParameters() override;
37 
39  void Detector(const std::string& d)
40  {
41  detector = d;
42  }
43 
45  int getSearchResult(double xcheck, double ycheck) const;
46 
47  int getStripeID(double xcheck, double ycheck) const;
48 
51 
52  private:
54  std::string detector = "TPC";
55 
57  std::string hitnodename;
58 
59  std::vector<PHG4Hit*> PHG4Hits;
60  std::vector<PHG4Hit*> BotVertices;
61  std::vector<PHG4Hit*> TopVertices;
62 
63  static constexpr double mm = 1.0;
64  static constexpr double cm = 10.0;
65 
67  static constexpr double begin_CM = 221.4019814 * mm;
68 
70  static constexpr double end_CM = 759.2138 * mm;
71 
72  static constexpr int nRadii = 8;
73  static constexpr int nStripes_R1 = 6;
74  static constexpr int nStripes_R2 = 8;
75  static constexpr int nStripes_R3 = 12;
76 
77  static constexpr int nPads_R1 = 6 * 16;
78  static constexpr int nPads_R2 = 8 * 16;
79  static constexpr int nPads_R3 = 12 * 16;
80 
81  //
82  static constexpr double padfrac_R1 = 0.5 * 5.59106385 * mm;
83  static constexpr double padfrac_R2 = 0.5 * 10.13836283 * mm;
84  static constexpr double padfrac_R3 = 0.5 * 10.90189537 * mm;
85 
87  static constexpr double arc_r = 0.5 * mm;
88 
90  static constexpr std::array<double, nRadii> R1_e = {{227.0902789 * mm, 238.4100043 * mm, 249.7297296 * mm, 261.049455 * mm, 272.3691804 * mm, 283.6889058 * mm, 295.0086312 * mm, 306.3283566 * mm}};
91  static constexpr std::array<double, nRadii> R1 = {{317.648082 * mm, 328.9678074 * mm, 340.2875328 * mm, 351.6072582 * mm, 362.9269836 * mm, 374.246709 * mm, 385.5664344 * mm, 396.8861597 * mm}};
92  static constexpr std::array<double, nRadii> R2 = {{421.705532 * mm, 442.119258 * mm, 462.532984 * mm, 482.9467608 * mm, 503.36069 * mm, 523.774416 * mm, 544.188015 * mm, 564.601868 * mm}};
93  static constexpr std::array<double, nRadii> R3 = {{594.6048725 * mm, 616.545823 * mm, 638.4867738 * mm, 660.4277246 * mm, 682.3686754 * mm, 704.3096262 * mm, 726.250577 * mm, 748.1915277 * mm}};
94 
99 
100  static constexpr std::array<double, nRadii> widthmod_R1_e = {{1.493, 1.398, 1.334, 1.284, 1.243, 1.208, 1.178, 1.152}};
101  static constexpr std::array<double, nRadii> widthmod_R1 = {{1.129, 1.109, 1.091, 1.076, 1.062, 1.050, 1.040, 1.030}};
102  static constexpr std::array<double, nRadii> widthmod_R2 = {{1.015, 1.007, 1.002, 1.000, 1.001, 1.006, 1.013, 1.023}};
103  static constexpr std::array<double, nRadii> widthmod_R3 = {{1.044, 1.064, 1.087, 1.115, 1.147, 1.186, 1.232, 1.288}};
104 
105  std::array<double, nRadii> spacing_R1_e = {};
106  std::array<double, nRadii> spacing_R1 = {};
107  std::array<double, nRadii> spacing_R2 = {};
108  std::array<double, nRadii> spacing_R3 = {};
109 
110  //bottom left - 1a
115 
116  //bottom right - 1b
121 
122  //top left - 2a
127 
128  //top right - 2b
133 
134  //left midpoint - 3a
139 
140  //right midpoint - 3b
145 
146  //Check which stripes get removed
147  std::array<int, nRadii> nGoodStripes_R1_e = {};
148  std::array<int, nRadii> nGoodStripes_R1 = {};
149  std::array<int, nRadii> nGoodStripes_R2 = {};
150  std::array<int, nRadii> nGoodStripes_R3 = {};
151 
153  static constexpr std::array<int, nRadii> keepThisAndAfter = {{1, 0, 1, 0, 1, 0, 1, 0}};
154 
156  static constexpr std::array<int, nRadii> keepUntil_R1_e = {{4, 4, 5, 4, 5, 5, 5, 5}};
157  static constexpr std::array<int, nRadii> keepUntil_R1 = {{5, 5, 6, 5, 6, 5, 6, 5}};
158  static constexpr std::array<int, nRadii> keepUntil_R2 = {{7, 7, 8, 7, 8, 8, 8, 8}};
159  static constexpr std::array<int, nRadii> keepUntil_R3 = {{11, 10, 11, 11, 11, 11, 12, 11}};
160 
161  std::array<int, nRadii> nStripesIn_R1_e = {};
162  std::array<int, nRadii> nStripesIn_R1 = {};
163  std::array<int, nRadii> nStripesIn_R2 = {};
164  std::array<int, nRadii> nStripesIn_R3 = {};
165  std::array<int, nRadii> nStripesBefore_R1_e = {};
166  std::array<int, nRadii> nStripesBefore_R1 = {};
167  std::array<int, nRadii> nStripesBefore_R2 = {};
168  std::array<int, nRadii> nStripesBefore_R3 = {};
169 
170  static constexpr int nStripesPerPetal = 213;
171  static constexpr int nPetals = 18;
172  static constexpr int nTotStripes = nStripesPerPetal * nPetals;
173 
176 
177  // number of electrons per deposited GeV in TPC gas
183  double electrons_per_gev = NAN;
184 
187 
188  void CalculateVertices(
189  int nStripes, int nPads,
190  const std::array<double, nRadii>& R,
191  std::array<double, nRadii>& spacing,
192  double x1a[][nRadii], double y1a[][nRadii],
193  double x1b[][nRadii], double y1b[][nRadii],
194  double x2a[][nRadii], double y2a[][nRadii],
195  double x2b[][nRadii], double y2b[][nRadii],
196  double x3a[][nRadii], double y3a[][nRadii],
197  double x3b[][nRadii], double y3b[][nRadii],
198  double padfrac,
199  double str_width[][nRadii],
200  const std::array<double, nRadii>& widthmod,
201  std::array<int, nRadii>& nGoodStripes,
202  const std::array<int, nRadii>& keepUntil,
203  std::array<int, nRadii>& nStripesIn,
204  std::array<int, nRadii>& nStripesBefore);
205 
206  PHG4Hit* GetBotVerticesFromStripe(int moduleID, int radiusID, int stripeID) const;
207  PHG4Hit* GetTopVerticesFromStripe(int moduleID, int radiusID, int stripeID) const;
208 
209  int SearchModule(int nStripes,
210  const double x1a[][nRadii], const double x1b[][nRadii],
211  const double x2a[][nRadii], const double x2b[][nRadii],
212  const double y1a[][nRadii], const double y1b[][nRadii],
213  const double y2a[][nRadii], const double y2b[][nRadii],
214  const double x3a[][nRadii], const double y3a[][nRadii],
215  const double x3b[][nRadii], const double y3b[][nRadii],
216  double x, double y, const std::array<int, nRadii>& nGoodStripes) const;
217 
218  PHG4Hit* GetPHG4HitFromStripe(int petalID, int moduleID, int radiusID, int stripeID, int nElectrons) const;
219 };
220 
221 #endif