Analysis Software
Documentation for sPHENIX simulation 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 
24 {
25  SetDefault();
26 }
27 
28 void PHG4CylinderGeom_Spacalv2::identify(std::ostream& os) const
29 {
30  os << "PHG4CylinderGeom_Spacalv2: layer: " << layer //
31  << ", radius: " << radius //
32  << ", thickness: " << thickness //
33  << ", zmin: " << zmin //
34  << ", zmax: " << zmax << //
35  ", num scint: " << nscint
36 
37  << std::endl;
38  return;
39 }
40 
41 void PHG4CylinderGeom_Spacalv2::Print(Option_t* opt) const
42 {
44 
45  std::cout << "\t"
46  << "is_azimuthal_seg_visible() = " << is_azimuthal_seg_visible()
47  << std::endl;
48  std::cout << "\t"
49  << "azimuthal_tilt() = " << get_azimuthal_tilt() << std::endl;
50  std::cout << "\t"
51  << "get_polar_taper_ratio() = " << get_polar_taper_ratio()
52  << std::endl;
53  std::cout << "\t"
54  << "get_sec_azimuthal_width() = " << get_sec_azimuthal_width()
55  << std::endl;
56  std::cout << "\t"
57  << "get_sec_depth() = " << get_sec_depth() << std::endl;
58  std::cout << "\t"
59  << "get_block_width() = " << get_block_width() << std::endl;
60  std::cout << "\t"
61  << "get_block_depth() = " << get_block_depth() << std::endl;
62  std::cout << "\t"
63  << "get_assembly_spacing() = " << get_assembly_spacing() << std::endl;
64  std::cout << "\t"
65  << "get_reg_fiber_grid_distance_taper() = "
66  << get_reg_fiber_grid_distance_taper() << " = sqrt(3)*"
67  << get_reg_fiber_grid_distance_taper() / sqrt(3.) << std::endl;
68  std::cout << "\t"
69  << "get_reg_fiber_grid_distance_nontaper() = "
70  << get_reg_fiber_grid_distance_nontaper() << std::endl;
71 }
72 
74 {
76 
77  azimuthal_n_sec = 256;
78  azimuthal_tilt = 0;
79  azimuthal_seg_visible = false;
80  polar_taper_ratio = 1 + 1.1 / 42.;
81  assembly_spacing = 0.0001; // order ~1um clearance around all structures
82 
83  // init_default_sector_map();
84 }
85 
87 {
89 
90  if (param.exist_int_param("azimuthal_n_sec"))
91  azimuthal_n_sec = param.get_int_param("azimuthal_n_sec");
92  if (param.exist_double_param("azimuthal_tilt"))
93  azimuthal_tilt = param.get_double_param("azimuthal_tilt");
94  if (param.exist_int_param("azimuthal_seg_visible"))
95  azimuthal_seg_visible = static_cast<bool>(param.get_int_param(
96  "azimuthal_seg_visible"));
97  if (param.exist_double_param("polar_taper_ratio"))
98  polar_taper_ratio = param.get_double_param("polar_taper_ratio");
99  if (param.exist_double_param("assembly_spacing"))
100  assembly_spacing = param.get_double_param("assembly_spacing");
101 
102  return;
103 }
104 
105 double
107 {
108  const double azimuthal_width_base = get_radius() * twopi / (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 - get_azimuthal_tilt();
114 
115  return azimuthal_width_base * sin(theta2) / sin(theta1 + theta2);
116 }
117 
118 double
120 {
121  return atan2(get_block_width() * 0.5 * (get_polar_taper_ratio() - 1),
122  get_block_depth());
123 }
124 
126 {
127  // if (config == kNonProjective)
128  // //For kNonProjective geometry, azimuthal_n_sec is calculated, and can not be set externally
129  // return PHG4CylinderGeom_Spacalv1::get_azimuthal_n_sec();
130  // else
131  return azimuthal_n_sec;
132 }
133 
135 {
136  if (config == kNonProjective)
137  {
138  std::cout
139  << "PHG4CylinderGeom_Spacalv2::set_azimuthal_n_sec - Fatal Error - "
140  "Spacal is configured as NonProjective geometry. In this case azimuthal_n_sec is calculated, and can not be set externally."
141  << std::endl;
142  exit(10);
143  }
144 
145  azimuthal_n_sec = azimuthalNSec;
146  // init_default_sector_map();
147 }
148 
150 {
151  return azimuthal_seg_visible;
152 }
153 
155 {
156  if (config == kNonProjective)
157  {
158  std::cout
159  << "PHG4CylinderGeom_Spacalv2::set_azimuthal_seg_visible - Fatal Error - "
160  "Spacal is configured as NonProjective geometry. In this case azimuthal_seg_visible is false, and can not be set externally."
161  << std::endl;
162  exit(10);
163  }
164 
166  ;
167 }
168 
170 double
172 {
173  const double mid_plane_width = get_block_width() * ((get_polar_taper_ratio() - 1) * 0.5 + 1) - get_assembly_spacing();
174 
175  const int n_grid = floor(mid_plane_width / (get_fiber_distance() * sqrt(3.)));
176 
177  return mid_plane_width / n_grid;
178 }
179 
181 double
183 {
184  const double mid_plane_width = get_block_width() - get_assembly_spacing();
185  const int n_grid = floor(mid_plane_width / (get_fiber_distance()));
186  return mid_plane_width / n_grid;
187 }