Analysis Software
Documentation for sPHENIX simulation 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 = "PHG4TpcCentralMembrane");
24 
26  ~PHG4TpcCentralMembrane() override;
27 
29  int InitRun(PHCompositeNode*) override;
30 
32  int process_event(PHCompositeNode*) override;
33 
35  void SetDefaultParameters() override;
36 
38  void Detector(const std::string& d)
39  {
40  detector = d;
41  hitnodename = "G4HIT_" + d;
42  }
43 
45  int getSearchResult(double xcheck, double ycheck) const;
46 
47  int getStripeID(double xcheck, double ycheck) const;
48 
51 
53  void setCentralMembraneEventModulo(int mod) { m_eventModulo = mod; };
54 
55  private:
58 
60  std::string hitnodename = "G4HIT_TPC";
61  std::vector<PHG4Hit*> PHG4Hits;
62 
63  int m_eventModulo = 10;
64  int m_eventNum = 0;
65 
66  static constexpr double mm = 1.0;
67  static constexpr double cm = 10.0;
68 
70  static constexpr double begin_CM = 221.4019814 * mm;
71 
73  static constexpr double end_CM = 759.2138 * mm;
74 
75  static constexpr int nRadii = 8;
76  static constexpr int nStripes_R1 = 6;
77  static constexpr int nStripes_R2 = 8;
78  static constexpr int nStripes_R3 = 12;
79 
80  static constexpr int nPads_R1 = 6 * 16;
81  static constexpr int nPads_R2 = 8 * 16;
82  static constexpr int nPads_R3 = 12 * 16;
83 
84  //
85  static constexpr double padfrac_R1 = 0.5 * 5.59106385 * mm;
86  static constexpr double padfrac_R2 = 0.5 * 10.13836283 * mm;
87  static constexpr double padfrac_R3 = 0.5 * 10.90189537 * mm;
88 
90  static constexpr double arc_r = 0.5 * mm;
91 
93  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}};
94  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}};
95  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}};
96  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}};
97 
102 
103  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}};
104  static constexpr std::array<double, nRadii> widthmod_R1 = {{1.129, 1.109, 1.091, 1.076, 1.062, 1.050, 1.040, 1.030}};
105  static constexpr std::array<double, nRadii> widthmod_R2 = {{1.015, 1.007, 1.002, 1.000, 1.001, 1.006, 1.013, 1.023}};
106  static constexpr std::array<double, nRadii> widthmod_R3 = {{1.044, 1.064, 1.087, 1.115, 1.147, 1.186, 1.232, 1.288}};
107 
108  std::array<double, nRadii> spacing_R1_e = {};
109  std::array<double, nRadii> spacing_R1 = {};
110  std::array<double, nRadii> spacing_R2 = {};
111  std::array<double, nRadii> spacing_R3 = {};
112 
113  //bottom left - 1a
118 
119  //bottom right - 1b
124 
125  //top left - 2a
130 
131  //top right - 2b
136 
137  //left midpoint - 3a
142 
143  //right midpoint - 3b
148 
149  //Check which stripes get removed
150  std::array<int, nRadii> nGoodStripes_R1_e = {};
151  std::array<int, nRadii> nGoodStripes_R1 = {};
152  std::array<int, nRadii> nGoodStripes_R2 = {};
153  std::array<int, nRadii> nGoodStripes_R3 = {};
154 
156  static constexpr std::array<int, nRadii> keepThisAndAfter = {{1, 0, 1, 0, 1, 0, 1, 0}};
157 
159  static constexpr std::array<int, nRadii> keepUntil_R1_e = {{4, 4, 5, 4, 5, 5, 5, 5}};
160  static constexpr std::array<int, nRadii> keepUntil_R1 = {{5, 5, 6, 5, 6, 5, 6, 5}};
161  static constexpr std::array<int, nRadii> keepUntil_R2 = {{7, 7, 8, 7, 8, 8, 8, 8}};
162  static constexpr std::array<int, nRadii> keepUntil_R3 = {{11, 10, 11, 11, 11, 11, 12, 11}};
163 
164  std::array<int, nRadii> nStripesIn_R1_e = {};
165  std::array<int, nRadii> nStripesIn_R1 = {};
166  std::array<int, nRadii> nStripesIn_R2 = {};
167  std::array<int, nRadii> nStripesIn_R3 = {};
168  std::array<int, nRadii> nStripesBefore_R1_e = {};
169  std::array<int, nRadii> nStripesBefore_R1 = {};
170  std::array<int, nRadii> nStripesBefore_R2 = {};
171  std::array<int, nRadii> nStripesBefore_R3 = {};
172 
173  static constexpr int nStripesPerPetal = 213;
174  static constexpr int nPetals = 18;
175  static constexpr int nTotStripes = nStripesPerPetal * nPetals;
176 
179 
180  // number of electrons per deposited GeV in TPC gas
186  double electrons_per_gev = NAN;
187 
190 
191  void CalculateVertices(
192  int nStripes, int nPads,
193  const std::array<double, nRadii>& R,
194  std::array<double, nRadii>& spacing,
195  double x1a[][nRadii], double y1a[][nRadii],
196  double x1b[][nRadii], double y1b[][nRadii],
197  double x2a[][nRadii], double y2a[][nRadii],
198  double x2b[][nRadii], double y2b[][nRadii],
199  double x3a[][nRadii], double y3a[][nRadii],
200  double x3b[][nRadii], double y3b[][nRadii],
201  double padfrac,
202  double str_width[][nRadii],
203  const std::array<double, nRadii>& widthmod,
204  std::array<int, nRadii>& nGoodStripes,
205  const std::array<int, nRadii>& keepUntil,
206  std::array<int, nRadii>& nStripesIn,
207  std::array<int, nRadii>& nStripesBefore);
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