ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4CylinderGeom_Spacalv2.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4CylinderGeom_Spacalv2.cc
1 // $$Id: PHG4CylinderGeom_Spacalv2.cc,v 1.3 2014/08/28 22:18:35 jinhuang Exp $$
2 
12 
13 #include <phparameter/PHParameters.h>
14 
15 #include <Geant4/G4PhysicalConstants.hh>
16 
17 #include <CLHEP/Units/SystemOfUnits.h> // for twopi, halfpi, pi
18 
19 #include <cmath>
20 #include <cstdlib> // for exit
21 #include <iostream>
22 
23 
24 using namespace std;
25 
27 {
28  SetDefault();
29 }
30 
31 void
32 PHG4CylinderGeom_Spacalv2::identify(std::ostream& os) const
33 {
34  os << "PHG4CylinderGeom_Spacalv2: layer: " << layer //
35  << ", radius: " << radius //
36  << ", thickness: " << thickness //
37  << ", zmin: " << zmin //
38  << ", zmax: " << zmax << //
39  ", num scint: " << nscint
40 
41  << endl;
42  return;
43 }
44 
45 void
47 {
49 
50  cout << "\t" << "is_azimuthal_seg_visible() = " << is_azimuthal_seg_visible()
51  << endl;
52  cout << "\t" << "azimuthal_tilt() = " << get_azimuthal_tilt() << endl;
53  cout << "\t" << "get_polar_taper_ratio() = " << get_polar_taper_ratio()
54  << endl;
55  cout << "\t" << "get_sec_azimuthal_width() = " << get_sec_azimuthal_width()
56  << endl;
57  cout << "\t" << "get_sec_depth() = " << get_sec_depth() << endl;
58  cout << "\t" << "get_block_width() = " << get_block_width() << endl;
59  cout << "\t" << "get_block_depth() = " << get_block_depth() << endl;
60  cout << "\t" << "get_assembly_spacing() = " << get_assembly_spacing() << endl;
61  cout << "\t" << "get_reg_fiber_grid_distance_taper() = "
62  << get_reg_fiber_grid_distance_taper() << " = sqrt(3)*"
63  << get_reg_fiber_grid_distance_taper() / sqrt(3.) << endl;
64  cout << "\t" << "get_reg_fiber_grid_distance_nontaper() = "
65  << get_reg_fiber_grid_distance_nontaper() << endl;
66 
67 }
68 
69 void
71 {
73 
74  azimuthal_n_sec = 256;
75  azimuthal_tilt = 0;
76  azimuthal_seg_visible = false;
77  polar_taper_ratio = 1 + 1.1 / 42.;
78  assembly_spacing = 0.0001; // order ~1um clearance around all structures
79 
80 // init_default_sector_map();
81 
82 }
83 
84 void
86 {
88 
89  if (param.exist_int_param("azimuthal_n_sec"))
90  azimuthal_n_sec = param.get_int_param("azimuthal_n_sec");
91  if (param.exist_double_param("azimuthal_tilt"))
92  azimuthal_tilt = param.get_double_param("azimuthal_tilt");
93  if (param.exist_int_param("azimuthal_seg_visible"))
94  azimuthal_seg_visible = static_cast<bool>(param.get_int_param(
95  "azimuthal_seg_visible"));
96  if (param.exist_double_param("polar_taper_ratio"))
97  polar_taper_ratio = param.get_double_param("polar_taper_ratio");
98  if (param.exist_double_param("assembly_spacing"))
99  assembly_spacing = param.get_double_param("assembly_spacing");
100 
101  return;
102 }
103 
104 double
106 {
107  const double azimuthal_width_base = get_radius() * twopi
108  / (double) (get_azimuthal_n_sec()) - get_assembly_spacing();
109 
110  // triggernometry stuff to make a tight connection after tilting
111 
112  const double theta1 = get_azimuthal_tilt();
113  const double theta2 = pi + (twopi / get_azimuthal_n_sec()) - halfpi
114  - get_azimuthal_tilt();
115 
116  return azimuthal_width_base * sin(theta2) / sin(theta1 + theta2);
117 }
118 
119 double
121 {
122  return atan2(get_block_width() * 0.5 * (get_polar_taper_ratio() - 1),
123  get_block_depth());
124 }
125 
126 int
128 {
129 // if (config == kNonProjective)
130 // //For kNonProjective geometry, azimuthal_n_sec is calculated, and can not be set externally
131 // return PHG4CylinderGeom_Spacalv1::get_azimuthal_n_sec();
132 // else
133  return azimuthal_n_sec;
134 }
135 
136 void
138 {
139  if (config == kNonProjective)
140  {
141  cout
142  << "PHG4CylinderGeom_Spacalv2::set_azimuthal_n_sec - Fatal Error - "
143  "Spacal is configured as NonProjective geometry. In this case azimuthal_n_sec is calculated, and can not be set externally."
144  << endl;
145  exit(10);
146  }
147 
148  azimuthal_n_sec = azimuthalNSec;
149 // init_default_sector_map();
150 }
151 
152 bool
154 {
155  return azimuthal_seg_visible;
156 }
157 
158 void
160 {
161  if (config == kNonProjective)
162  {
163  cout
164  << "PHG4CylinderGeom_Spacalv2::set_azimuthal_seg_visible - Fatal Error - "
165  "Spacal is configured as NonProjective geometry. In this case azimuthal_seg_visible is false, and can not be set externally."
166  << endl;
167  exit(10);
168  }
169 
170  azimuthal_seg_visible = b;
171  ;
172 }
173 
175 double
177 {
178  const double mid_plane_width = get_block_width()
179  * ((get_polar_taper_ratio() - 1) * 0.5 + 1) - get_assembly_spacing();
180 
181  const int n_grid = floor(mid_plane_width / (get_fiber_distance() * sqrt(3.)));
182 
183  return mid_plane_width / n_grid;
184 }
185 
187 double
189 {
190  const double mid_plane_width = get_block_width() - get_assembly_spacing();
191  const int n_grid = floor(mid_plane_width / (get_fiber_distance()));
192  return mid_plane_width / n_grid;
193 }
194