EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4SectorConstructor.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4SectorConstructor.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 
12 #ifndef G4DETECTORS_PHG4SECTORCONSTRUCTOR_H
13 #define G4DETECTORS_PHG4SECTORCONSTRUCTOR_H
14 
15 #include <Geant4/G4PhysicalConstants.hh>
16 #include <Geant4/G4String.hh> // for G4String
17 #include <Geant4/G4SystemOfUnits.hh>
18 #include <Geant4/G4Types.hh> // for G4int
19 
20 
21 class G4LogicalVolume;
22 class G4PVPlacement;
23 class G4VSolid;
25 class PHG4Subsystem;
26 
27 #include <map>
28 #include <utility>
29 
30 #include <cassert>
31 #include <cmath>
32 #include <string>
33 #include <vector>
34 
35 namespace PHG4Sector
36 {
39 class Layer
40 {
41  public:
43  const std::string &_name,
44 
46  const std::string &_material,
47 
49  double _depth,
50 
52  double _percentage_filled,
53 
55  bool _active)
56  : name(_name)
57  , material(_material)
58  , depth(_depth)
60  _percentage_filled)
61  , active(_active)
62  {
63  }
64 
65  public:
67  std::string name;
68 
70  std::string material;
71 
73  double depth;
74 
77 
79  bool active;
80 };
81 
85 {
86  public:
88  {
89  SetDefault();
90  }
91 
92  void
93  SetDefault();
94 
95  int get_N_Sector() const
96  {
97  return N_Sector;
98  }
99 
100  std::vector<Layer> &
102  {
103  return layer_list;
104  }
105 
106  std::string
107  get_material() const
108  {
109  return material;
110  }
111 
112  double
114  {
115  return max_polar_angle;
116  }
117 
118  double
120  {
121  return min_polar_angle;
122  }
123 
124  double
126  {
127  return normal_polar_angle;
128  }
129 
130  double
132  {
133  return normal_start;
134  }
135 
136  void
137  set_N_Sector(int sector)
138  {
139  assert(sector >= 1);
140 
141  N_Sector = sector;
142  }
143 
144  void
145  set_layer_list(const std::vector<Layer> &layerList)
146  {
147  layer_list = layerList;
148  }
149 
150  void
151  set_material(const std::string &_material)
152  {
153  material = _material;
154  }
155 
156  void
157  set_max_polar_angle(double maxPolarAngle)
158  {
159  assert(maxPolarAngle >= 0);
160  assert(maxPolarAngle <= pi);
161 
162  max_polar_angle = maxPolarAngle;
163  }
164 
165  void
166  set_min_polar_angle(double minPolarAngle)
167  {
168  assert(minPolarAngle >= 0);
169  assert(minPolarAngle <= pi);
170 
171  min_polar_angle = minPolarAngle;
172  }
173 
174  void
175  set_normal_polar_angle(double normalPolarAngle)
176  {
177  assert(normalPolarAngle >= 0);
178  assert(normalPolarAngle <= pi);
179 
180  normal_polar_angle = normalPolarAngle;
181  }
182 
183  void
184  set_normal_start(double normalZStart)
185  {
186  normal_start = normalZStart;
187  }
188 
189  // derivative constants
190 
191  // ! max radius from IP
192  double
193  get_max_R() const;
194 
195  double
196  get_total_thickness() const;
197 
199  static double
201  {
202  return cm;
203  }
204 
206  void
207  set_normal_start(const double z_intercept, const double angle_intercept)
208  {
210  z_intercept / cos(angle_intercept) * cos(normal_polar_angle - angle_intercept));
211  }
212 
214  static double
215  eta_to_polar_angle(const double eta)
216  {
217  return 2. * atan(exp(-eta));
218  }
219 
220  // layer descriptions
221  public:
222 
223  typedef std::vector<Layer> t_layer_list;
225 
226  int GetNumActiveLayers() const
227  {
228  int n = 0;
229  for (t_layer_list::const_iterator it = layer_list.begin();
230  it != layer_list.end(); ++it)
231  if ((*it).active)
232  n++;
233  return n;
234  }
235 
236  void
238  std::string _name,
239  std::string _material,
240  double _depth,
241  bool _active = false,
242  double _percentage_filled = 100
243  )
244  {
245  layer_list.push_back(
246  Layer(_name, _material, _depth, _percentage_filled, _active));
247  }
248 
252  void
253  AddLayers_DriftVol_COMPASS(const double drift_vol_thickness = 3 * mm);
254 
259  void
260  AddLayers_HBD_GEM(const int n_GEM_layers = 3);
261 
266  void
268 
273  void
274  AddLayers_AeroGel_ePHENIX(const double radiator_length = 2 * cm,
275  const double expansion_length = 18 * cm, std::string radiator = "Default");
276 
277  public:
278  typedef enum
279  {
280 
283 
286 
287  } e_edge_typ;
288 
289  static e_edge_typ
291  {
292  return kConeEdge;
293  }
294 
295  static e_edge_typ
297  {
298  return kFlatEdge;
299  }
300 
301  e_edge_typ
303  {
304  return max_polar_edge;
305  }
306 
307  e_edge_typ
309  {
310  return min_polar_edge;
311  }
312 
313  void
315  {
316  max_polar_edge = maxPolarEdge;
317  }
318 
319  void
321  {
322  min_polar_edge = minPolarEdge;
323  }
324 
325  private:
327  int N_Sector;
328 
331 
334 
337 
340 
343 
345  double normal_start;
346 
348  std::string material;
349 };
350 
351 
354 {
355  public:
356  PHG4SectorConstructor(const std::string &name, PHG4Subsystem *subsys);
358 
359  void
360  Construct_Sectors(G4LogicalVolume *WorldLog);
361 
362  void
363  OverlapCheck(bool check)
364  {
365  overlapcheck_sector = check;
366  }
367 
368  void Verbosity(int v) {m_Verbosity = v;}
369  int Verbosity() const {return m_Verbosity;}
370 
371  protected:
373 
374  G4VSolid *
376  const std::string &name, //
377  const double start_z, //
378  const double thickness, //
379  G4VSolid *SecConeBoundary_Det //
380  );
381 
382  public:
383  // properties
384 
385  std::string name_base;
386 
388 
389  private:
392 
393  protected:
394  G4LogicalVolume *
395  RegisterLogicalVolume(G4LogicalVolume *);
396 
397  typedef std::map<G4String, G4LogicalVolume *> map_log_vol_t;
399 
400  G4PVPlacement *
401  RegisterPhysicalVolume(G4PVPlacement *v, const bool active = false);
402 
403  typedef std::pair<G4String, G4int> phy_vol_idx_t;
404  typedef std::map<phy_vol_idx_t, G4PVPlacement *> map_phy_vol_t;
407 };
408 
409 } // namespace PHG4Sector
410 #endif /* PHG4SectorConstructor_H_ */