Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4CylinderGeom_Spacalv3.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4CylinderGeom_Spacalv3.cc
1 // $$Id: PHG4CylinderGeom_Spacalv3.cc,v 1.3 2014/08/28 22:18:35 jinhuang Exp $$
2 
12 #include "PHG4CylinderGeom_Spacalv1.h" // for PHG4CylinderGeom_Spacalv1::...
13 
14 #include <phparameter/PHParameters.h>
15 
16 #include <Geant4/G4PhysicalConstants.hh>
17 
18 #include <CLHEP/Units/SystemOfUnits.h> // for twopi
19 
20 #include <algorithm>
21 #include <cassert>
22 #include <cmath>
23 #include <cstdlib> // for exit
24 #include <iostream>
25 #include <limits> // std::numeric_limits
26 #include <map>
27 #include <sstream>
28 
29 
31 {
32  SetDefault();
33 }
34 
36 {
38 }
39 
40 void PHG4CylinderGeom_Spacalv3::identify(std::ostream& os) const
41 {
42  os << "PHG4CylinderGeom_Spacalv3: layer: " << layer
43  //
44  << ", radius: " << radius
45  //
46  << ", thickness: " << thickness
47  //
48  << ", zmin: " << zmin
49  //
50  << ", zmax: " << zmax << ", num scint: " << nscint << ", num sector: "
51  << azimuthal_n_sec << ", unique tower: " << sector_tower_map.size()
52  << std::endl;
53 }
54 
55 void PHG4CylinderGeom_Spacalv3::Print(Option_t* opt) const
56 {
58 
59  std::cout << "\t"
60  << "get_sidewall_outer_torr() = " << get_sidewall_outer_torr()
61  << std::endl;
62  std::cout << "\t"
63  << "get_sidewall_thickness() = " << get_sidewall_thickness()
64  << std::endl;
65  std::cout << "\t"
66  << "get_sidewall_mat() = " << get_sidewall_mat() << std::endl;
67  std::cout << "\t"
68  << "get_max_phi_bin_in_sec() = " << get_max_phi_bin_in_sec()
69  << std::endl;
70 
72  std::cout << "\t"
73  << "get_n_subtower_eta() = " << get_n_subtower_eta() << std::endl;
74  std::cout << "\t"
75  << "get_n_subtower_phi() = " << get_n_subtower_phi() << std::endl;
76 
77  std::cout << "\t"
78  << "get_max_lightguide_height() = "
79  << get_max_lightguide_height() << std::endl;
80  std::cout << "\t"
81  << "Containing " << sector_tower_map.size()
82  << " unique towers per sector." << std::endl;
83 
84  if (get_construction_verbose() >= 2)
85  for (const auto& it : sector_tower_map)
86  {
87  std::cout << "\t";
88  std::cout << "\t";
89  it.second.identify(std::cout);
90  }
91 }
92 
94 {
96 
97  // radius = 90.000000;
98  // thickness = 26.130000;
99  // zmin = 149.470000;
100  // zmax = -zmin;
101  // azimuthal_n_sec = 32;
102  // polar_taper_ratio = 1.;
103  // assembly_spacing = 0.002500;
104  sidewall_thickness = 0.075000;
105  sidewall_outer_torr = 0.030000;
106  sidewall_mat = "SS310";
107  max_phi_bin_in_sec = 8;
108  divider_mat = "G4_AIR";
109  divider_width = 14.5;
110 }
111 
113 {
115 
116  if (param.exist_double_param("sidewall_thickness"))
117  sidewall_thickness = param.get_double_param("sidewall_thickness");
118  if (param.exist_double_param("sidewall_outer_torr"))
119  sidewall_outer_torr = param.get_double_param("sidewall_outer_torr");
120  if (param.exist_string_param("sidewall_mat"))
121  sidewall_mat = param.get_string_param("sidewall_mat");
122  if (param.exist_int_param("max_phi_bin_in_sec"))
123  max_phi_bin_in_sec = param.get_int_param("max_phi_bin_in_sec");
124  if (param.exist_string_param("divider_mat"))
125  divider_mat = param.get_string_param("divider_mat");
126  if (param.exist_double_param("divider_width"))
127  divider_width = param.get_double_param("divider_width");
128 
129  // load sector_tower_map
130  if (param.exist_int_param("sector_tower_map_size"))
131  {
132  sector_tower_map.clear();
133 
134  const int n = param.get_int_param("sector_tower_map_size");
135 
136  for (int i = 0; i < n; i++)
137  {
138  std::stringstream prefix;
139  prefix << "sector_tower_map";
140  prefix << "[" << i << "]"
141  << ".";
142 
143  geom_tower t;
144  t.ImportParameters(param, prefix.str());
145 
146  sector_tower_map[t.id] = t;
147  }
148  }
149 
150  return;
151 }
152 
154  : id(std::numeric_limits<int>::min())
155  , pDz(std::numeric_limits<double>::quiet_NaN())
156  , pDy1(std::numeric_limits<double>::quiet_NaN())
157  , pDx1(std::numeric_limits<double>::quiet_NaN())
158  , pDx2(std::numeric_limits<double>::quiet_NaN())
159  , pDy2(std::numeric_limits<double>::quiet_NaN())
160  , pDx3(std::numeric_limits<double>::quiet_NaN())
161  , pDx4(std::numeric_limits<double>::quiet_NaN())
162  , pTheta(std::numeric_limits<double>::quiet_NaN())
163  , pPhi(std::numeric_limits<double>::quiet_NaN())
164  , pAlp1(std::numeric_limits<double>::quiet_NaN())
165  , pAlp2(std::numeric_limits<double>::quiet_NaN())
166  , pRotationAngleX(std::numeric_limits<double>::quiet_NaN())
167  , centralX(std::numeric_limits<double>::quiet_NaN())
168  , centralY(std::numeric_limits<double>::quiet_NaN())
169  , centralZ(std::numeric_limits<double>::quiet_NaN())
170  , ModuleSkinThickness(std::numeric_limits<double>::quiet_NaN())
171  , NFiberX(std::numeric_limits<int>::min())
172  , NFiberY(std::numeric_limits<int>::min())
173  , NSubtowerX(1)
174  , NSubtowerY(1)
175  , LightguideHeight(0)
176  , LightguideTaperRatio(std::numeric_limits<double>::quiet_NaN())
177  , LightguideMaterial("PMMA")
178 {
179 }
180 
183  int index_y) const
184 {
185  return NFiberY * index_x + index_y;
186 }
187 
190 {
191  const int index_x = fiber_id / NFiberY;
192  assert(index_x < NFiberX);
193  assert(index_x >= 0);
194 
195  const double sub_tower_width_x = (double) NFiberX / NSubtowerX;
196  const int tower_ID_x = (NSubtowerX - 1) - floor(index_x / sub_tower_width_x);
197  assert(tower_ID_x < NSubtowerX);
198  assert(tower_ID_x >= 0);
199 
200  return tower_ID_x;
201 }
202 
205 {
206  assert(fiber_id >= 0);
207  const int index_y = fiber_id % NFiberY;
208 
209  const double sub_tower_width_y = (double) NFiberY / NSubtowerY;
210 
211  assert(pRotationAngleX < 0);
212  const int tower_ID_y = (NSubtowerY - 1) - floor(index_y / sub_tower_width_y);
213  assert(tower_ID_y < NSubtowerY);
214  assert(tower_ID_y >= 0);
215 
216  return tower_ID_y;
217 }
218 
219 double
221 {
222  const int index_x = fiber_id / NFiberY;
223  assert(index_x < NFiberX);
224  assert(index_x >= 0);
225 
226  const double sub_tower_width_x = (double) NFiberX / NSubtowerX;
227  const double x_in_sub_tower = (fmod(index_x, sub_tower_width_x) + 0.5) / sub_tower_width_x;
228  assert(x_in_sub_tower <= 1);
229  assert(x_in_sub_tower >= 0);
230 
231  return x_in_sub_tower;
232 }
233 
234 double
236 {
237  assert(fiber_id >= 0);
238  const int index_y = fiber_id % NFiberY;
239 
240  const double sub_tower_width_y = (double) NFiberY / NSubtowerY;
241 
242  assert(pRotationAngleX < 0);
243  const double y_in_sub_tower = (fmod(index_y, sub_tower_width_y) + 0.5) / sub_tower_width_y;
244  assert(y_in_sub_tower <= 1);
245  assert(y_in_sub_tower >= 0);
246 
247  return y_in_sub_tower;
248 }
249 
251 {
252  os << "PHG4CylinderGeom_Spacalv3::geom_super_tower"
253  << "[" << id << "]"
254  << " @ <Azimuthal, R, z> = " << centralX << ", " << centralY << ", "
255  << centralZ << " cm"
256  //
257  << " with "
258  //
259  << "Half length = " << pDz << ", " << pDy1 << ", " << pDx1 << ", " << pDx2
260  << ", " << pDy2 << ", " << pDx3 << ", " << pDx4 << ", "
261  //
262  << "Angles = " << pTheta << ", " << pPhi << ", " << pAlp1 << ", " << pAlp2
263  << ", " //
264  << "Rotation = " << pRotationAngleX //
265  << std::endl;
266 }
267 
269  const PHParameters& param, const std::string& param_prefix)
270 {
271  id = param.get_int_param(param_prefix + "id");
272  pDz = param.get_double_param(param_prefix + "pDz");
273 
274  pDy1 = param.get_double_param(param_prefix + "pDy1");
275  pDx1 = param.get_double_param(param_prefix + "pDx1");
276  pDx2 = param.get_double_param(param_prefix + "pDx2");
277  pDy2 = param.get_double_param(param_prefix + "pDy2");
278  pDx3 = param.get_double_param(param_prefix + "pDx3");
279  pDx4 = param.get_double_param(param_prefix + "pDx4");
280 
281  pTheta = param.get_double_param(param_prefix + "pTheta");
282  pPhi = param.get_double_param(param_prefix + "pPhi");
283  pAlp1 = param.get_double_param(param_prefix + "pAlp1");
284  pAlp2 = param.get_double_param(param_prefix + "pAlp2");
285 
286  pRotationAngleX = param.get_double_param(param_prefix + "pRotationAngleX");
287  centralX = param.get_double_param(param_prefix + "centralX");
288  centralY = param.get_double_param(param_prefix + "centralY");
289  centralZ = param.get_double_param(param_prefix + "centralZ");
290 
291  ModuleSkinThickness = param.get_double_param(
292  param_prefix + "ModuleSkinThickness");
293  NFiberX = param.get_int_param(param_prefix + "NFiberX");
294  NFiberY = param.get_int_param(param_prefix + "NFiberY");
295  NSubtowerX = param.get_int_param(param_prefix + "NSubtowerX");
296  NSubtowerY = param.get_int_param(param_prefix + "NSubtowerY");
297 
298  LightguideHeight = param.get_double_param(param_prefix + "LightguideHeight");
299  LightguideTaperRatio = param.get_double_param(
300  param_prefix + "LightguideTaperRatio");
301  LightguideMaterial = param.get_string_param(
302  param_prefix + "LightguideMaterial");
303 }
304 
306  : scint_ID(scint_id)
307 {
308  sector_ID = (scint_ID >> (kfiber_bit + ktower_bit)) & ((1 << ksector_bit) - 1);
309  tower_ID = (scint_ID >> kfiber_bit) & ((1 << ktower_bit) - 1);
310  fiber_ID = (scint_ID) & ((1 << kfiber_bit) - 1);
311 }
312 
314  int tower_id, int fiber_id)
315  : sector_ID(sector_id)
316  , tower_ID(tower_id)
317  , fiber_ID(fiber_id)
318 {
319  assert(fiber_ID < (1 << kfiber_bit) and fiber_ID >= 0);
320  assert(tower_ID < (1 << ktower_bit) and tower_ID >= 0);
321  assert(sector_ID < (1 << ksector_bit) and sector_ID >= 0);
322 
324 }
325 
326 std::pair<int, int>
328  const int sector_ID) const
329 {
330  // tower_ID to eta/z within a sector
331  int z_bin = floor(tower_ID / 10);
332 
333  int phi_bin_in_sec = -1;
334 
336  // colume ID is from -x to +x at the top of the detector, which is reverse of the phi bin direction.
337  phi_bin_in_sec = max_phi_bin_in_sec - (tower_ID % 10);
339  phi_bin_in_sec = (tower_ID % 10);
340 
341  if (!(phi_bin_in_sec < max_phi_bin_in_sec and phi_bin_in_sec >= 0))
342  {
343  std::cout
344  << "PHG4CylinderGeom_Spacalv3::get_tower_z_phi_ID - Fatal Error - invalid in put with "
345  << "tower_ID = " << tower_ID << ", sector_ID = " << sector_ID << ", phi_bin_in_sec = " << phi_bin_in_sec
346  << ". Dump object:" << std::endl;
347  Print();
348  }
349 
350  assert(phi_bin_in_sec < max_phi_bin_in_sec and phi_bin_in_sec >= 0);
351 
352  int phi_bin = sector_ID * max_phi_bin_in_sec + phi_bin_in_sec;
353 
354  return std::make_pair(z_bin, phi_bin);
355 }
356 
360 {
362  return tower.centralY;
364  {
365  const double outter_wall_shift = get_sidewall_thickness() + get_sidewall_outer_torr() + get_assembly_spacing();
366  assert(outter_wall_shift >= 0);
367  const double tilted_radial_shift = outter_wall_shift / sin(M_PI / get_azimuthal_n_sec());
368  assert(tilted_radial_shift >= 0);
369  const double tower_radial = //
370  tilted_radial_shift * cos(get_azimuthal_tilt()) +
372  tower.centralY * cos(get_azimuthal_tilt());
373 
374  if (get_construction_verbose() >= 2)
375  {
376  std::cout
377  << "PHG4CylinderGeom_Spacalv3::get_tower_radial_position - tower radial adjustment: "
378  "from "
379  << tower.centralY << " to " << tower_radial
380  << std::endl;
381  }
382 
383  return tower_radial;
384  }
385  else
386  {
387  std::cout
388  << "PHG4CylinderGeom_Spacalv3::get_tower_radial_position - ERROR - "
389  "unsupported configuration!"
390  << std::endl;
391  Print();
392  exit(10);
393  }
394  return NAN;
395 }
396 
399 {
400  if (sector_tower_map.begin() == sector_tower_map.end()) return;
401 
402  for (tower_map_t::const_iterator it = sector_tower_map.begin();
403  it != sector_tower_map.end(); ++it)
404  {
405  assert(get_n_subtower_eta() == it->second.NSubtowerY);
406  assert(get_n_subtower_phi() == it->second.NSubtowerX);
407  }
408 
410  {
411  std::cout
412  << "PHG4CylinderGeom_Spacalv3::subtower_consistency_check - Passed with get_n_subtower_phi() = "
413  << get_n_subtower_phi() << " and get_n_subtower_eta()"
414  << get_n_subtower_eta() << std::endl;
415  }
416 }
419 {
420  if (sector_tower_map.begin() == sector_tower_map.end()) return 0;
421  assert(sector_tower_map.begin() != sector_tower_map.end());
422  return sector_tower_map.begin()->second.NSubtowerY;
423 }
426 {
427  if (sector_tower_map.begin() == sector_tower_map.end()) return 0;
428  assert(sector_tower_map.begin() != sector_tower_map.end());
429  return sector_tower_map.begin()->second.NSubtowerX;
430 }
431 
432 double
434 {
435  double max_height = 0;
436 
437  for (const auto& it : sector_tower_map)
438  {
439  const double h = it.second.LightguideHeight;
440  max_height = std::max(max_height, h);
441  }
442 
443  return max_height;
444 }
445 
447 {
448  std::cout << "PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map1 - "
449  << "load four example central towers" << std::endl;
450 
451  // Chris Cullen 2D spacal design July 2015
452  radius = 90.000000;
453  thickness = 26.130000;
454  zmin = 149.470000;
455  zmax = -zmin;
456  azimuthal_n_sec = 32;
457  max_phi_bin_in_sec = 8;
458  sector_map.clear();
459  sector_map[0] = 0; // only install one sector
460 
461  azimuthal_tilt = 0;
462  azimuthal_seg_visible = false;
463  polar_taper_ratio = 1.;
464  assembly_spacing = 0.002500;
465  sidewall_thickness = 0.075000;
466  sidewall_outer_torr = 0.030000;
467  sector_tower_map.clear();
468 
469  {
470  // tower 1023 based Row/Col = 102/3
471  geom_tower geom;
472  geom.id = 1023;
473  geom.pDz = 6.751948;
474  geom.pTheta = 0.038660;
475  geom.pPhi = -2.829992;
476  geom.pAlp1 = -0.000872;
477  geom.pAlp2 = -0.000872;
478  geom.pDy1 = 1.121195;
479  geom.pDx1 = 1.191868;
480  geom.pDx2 = 1.192521;
481  geom.pDy2 = 1.281451;
482  geom.pDx3 = 1.357679;
483  geom.pDx4 = 1.358425;
484  geom.centralX = -3.829796;
485  geom.centralY = 105.060369;
486  geom.centralZ = 3.686651;
487  geom.pRotationAngleX = -1.547057;
488  geom.ModuleSkinThickness = 0.010000;
489  geom.NFiberX = 30;
490  geom.NFiberY = 48;
491  sector_tower_map[geom.id] = geom;
492  }
493 
494  {
495  // tower 1024 based Row/Col = 102/4
496  geom_tower geom;
497  geom.id = 1024;
498  geom.pDz = 6.751948;
499  geom.pTheta = 0.017060;
500  geom.pPhi = -2.373142;
501  geom.pAlp1 = -0.000290;
502  geom.pAlp2 = -0.000290;
503  geom.pDy1 = 1.121195;
504  geom.pDx1 = 1.190432;
505  geom.pDx2 = 1.191082;
506  geom.pDy2 = 1.281451;
507  geom.pDx3 = 1.356043;
508  geom.pDx4 = 1.356787;
509  geom.centralX = -1.276086;
510  geom.centralY = 105.060369;
511  geom.centralZ = 3.686651;
512  geom.pRotationAngleX = -1.547057;
513  geom.ModuleSkinThickness = 0.010000;
514  geom.NFiberX = 30;
515  geom.NFiberY = 48;
516  sector_tower_map[geom.id] = geom;
517  }
518 }
519 
521 {
522  std::cout << "PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map2 - "
523  << "load one row of example forward towers" << std::endl;
524 
525  // Chris Cullen 2D spacal design July 2015
526  radius = 90.000000;
527  thickness = 26.130000;
528  zmin = 149.470000;
529  zmax = -zmin;
530  azimuthal_n_sec = 32;
531  max_phi_bin_in_sec = 8;
532  sector_map.clear();
533  sector_map[0] = 0; // only install one sector
534  azimuthal_tilt = 0;
535  azimuthal_seg_visible = false;
536  polar_taper_ratio = 1.;
537  assembly_spacing = 0.002500;
538  sidewall_thickness = 0.075000;
539  sidewall_outer_torr = 0.030000;
540  sector_tower_map.clear();
541 
542  {
543  // tower 541 based Row/Col = 54/1
544  geom_tower geom;
545  geom.id = 541;
546  geom.pDz = 8.326697;
547  geom.pTheta = 0.053578;
548  geom.pPhi = -3.015910;
549  geom.pAlp1 = 0.068143;
550  geom.pAlp2 = 0.068127;
551  geom.pDy1 = 1.116997;
552  geom.pDx1 = 1.235953;
553  geom.pDx2 = 1.214052;
554  geom.pDy2 = 1.231781;
555  geom.pDx3 = 1.363889;
556  geom.pDx4 = 1.339743;
557  geom.centralX = -9.019696;
558  geom.centralY = 105.782078;
559  geom.centralZ = -134.504208;
560  geom.pRotationAngleX = -2.482741;
561  geom.ModuleSkinThickness = 0.010000;
562  geom.NFiberX = 30;
563  geom.NFiberY = 48;
564  sector_tower_map[geom.id] = geom;
565  }
566  {
567  // tower 542 based Row/Col = 54/2
568  geom_tower geom;
569  geom.id = 542;
570  geom.pDz = 8.326697;
571  geom.pTheta = 0.038558;
572  geom.pPhi = -2.966436;
573  geom.pAlp1 = 0.048643;
574  geom.pAlp2 = 0.048632;
575  geom.pDy1 = 1.116997;
576  geom.pDx1 = 1.234208;
577  geom.pDx2 = 1.212398;
578  geom.pDy2 = 1.231781;
579  geom.pDx3 = 1.361965;
580  geom.pDx4 = 1.337918;
581  geom.centralX = -6.439665;
582  geom.centralY = 105.782078;
583  geom.centralZ = -134.504208;
584  geom.pRotationAngleX = -2.482741;
585  geom.ModuleSkinThickness = 0.010000;
586  geom.NFiberX = 30;
587  geom.NFiberY = 48;
588  sector_tower_map[geom.id] = geom;
589  }
590  {
591  // tower 543 based Row/Col = 54/3
592  geom_tower geom;
593  geom.id = 543;
594  geom.pDz = 8.326697;
595  geom.pTheta = 0.023752;
596  geom.pPhi = -2.854692;
597  geom.pAlp1 = 0.029174;
598  geom.pAlp2 = 0.029167;
599  geom.pDy1 = 1.116997;
600  geom.pDx1 = 1.233047;
601  geom.pDx2 = 1.211297;
602  geom.pDy2 = 1.231781;
603  geom.pDx3 = 1.360684;
604  geom.pDx4 = 1.336703;
605  geom.centralX = -3.862610;
606  geom.centralY = 105.782078;
607  geom.centralZ = -134.504208;
608  geom.pRotationAngleX = -2.482741;
609  geom.ModuleSkinThickness = 0.010000;
610  geom.NFiberX = 30;
611  geom.NFiberY = 48;
612  sector_tower_map[geom.id] = geom;
613  }
614  {
615  // tower 544 based Row/Col = 54/4
616  geom_tower geom;
617  geom.id = 544;
618  geom.pDz = 8.326697;
619  geom.pTheta = 0.010142;
620  geom.pPhi = -2.416982;
621  geom.pAlp1 = 0.009723;
622  geom.pAlp2 = 0.009720;
623  geom.pDy1 = 1.116997;
624  geom.pDx1 = 1.232467;
625  geom.pDx2 = 1.210746;
626  geom.pDy2 = 1.231781;
627  geom.pDx3 = 1.360044;
628  geom.pDx4 = 1.336096;
629  geom.centralX = -1.287339;
630  geom.centralY = 105.782078;
631  geom.centralZ = -134.504208;
632  geom.pRotationAngleX = -2.482741;
633  geom.ModuleSkinThickness = 0.010000;
634  geom.NFiberX = 30;
635  geom.NFiberY = 48;
636  sector_tower_map[geom.id] = geom;
637  }
638  {
639  // tower 545 based Row/Col = 54/5
640  geom_tower geom;
641  geom.id = 545;
642  geom.pDz = 8.326697;
643  geom.pTheta = 0.010142;
644  geom.pPhi = -0.724610;
645  geom.pAlp1 = -0.009723;
646  geom.pAlp2 = -0.009720;
647  geom.pDy1 = 1.116997;
648  geom.pDx1 = 1.232467;
649  geom.pDx2 = 1.210746;
650  geom.pDy2 = 1.231781;
651  geom.pDx3 = 1.360044;
652  geom.pDx4 = 1.336096;
653  geom.centralX = 1.287339;
654  geom.centralY = 105.782078;
655  geom.centralZ = -134.504208;
656  geom.pRotationAngleX = -2.482741;
657  geom.ModuleSkinThickness = 0.010000;
658  geom.NFiberX = 30;
659  geom.NFiberY = 48;
660  sector_tower_map[geom.id] = geom;
661  }
662  {
663  // tower 546 based Row/Col = 54/6
664  geom_tower geom;
665  geom.id = 546;
666  geom.pDz = 8.326697;
667  geom.pTheta = 0.023752;
668  geom.pPhi = -0.286901;
669  geom.pAlp1 = -0.029174;
670  geom.pAlp2 = -0.029167;
671  geom.pDy1 = 1.116997;
672  geom.pDx1 = 1.233047;
673  geom.pDx2 = 1.211297;
674  geom.pDy2 = 1.231781;
675  geom.pDx3 = 1.360684;
676  geom.pDx4 = 1.336703;
677  geom.centralX = 3.862610;
678  geom.centralY = 105.782078;
679  geom.centralZ = -134.504208;
680  geom.pRotationAngleX = -2.482741;
681  geom.ModuleSkinThickness = 0.010000;
682  geom.NFiberX = 30;
683  geom.NFiberY = 48;
684  sector_tower_map[geom.id] = geom;
685  }
686  {
687  // tower 547 based Row/Col = 54/7
688  geom_tower geom;
689  geom.id = 547;
690  geom.pDz = 8.326697;
691  geom.pTheta = 0.038558;
692  geom.pPhi = -0.175156;
693  geom.pAlp1 = -0.048643;
694  geom.pAlp2 = -0.048632;
695  geom.pDy1 = 1.116997;
696  geom.pDx1 = 1.234208;
697  geom.pDx2 = 1.212398;
698  geom.pDy2 = 1.231781;
699  geom.pDx3 = 1.361965;
700  geom.pDx4 = 1.337918;
701  geom.centralX = 6.439665;
702  geom.centralY = 105.782078;
703  geom.centralZ = -134.504208;
704  geom.pRotationAngleX = -2.482741;
705  geom.ModuleSkinThickness = 0.010000;
706  geom.NFiberX = 30;
707  geom.NFiberY = 48;
708  sector_tower_map[geom.id] = geom;
709  }
710  {
711  // tower 548 based Row/Col = 54/8
712  geom_tower geom;
713  geom.id = 548;
714  geom.pDz = 8.326697;
715  geom.pTheta = 0.053578;
716  geom.pPhi = -0.125683;
717  geom.pAlp1 = -0.068143;
718  geom.pAlp2 = -0.068127;
719  geom.pDy1 = 1.116997;
720  geom.pDx1 = 1.235953;
721  geom.pDx2 = 1.214052;
722  geom.pDy2 = 1.231781;
723  geom.pDx3 = 1.363889;
724  geom.pDx4 = 1.339743;
725  geom.centralX = 9.019696;
726  geom.centralY = 105.782078;
727  geom.centralZ = -134.504208;
728  geom.pRotationAngleX = -2.482741;
729  geom.ModuleSkinThickness = 0.010000;
730  geom.NFiberX = 30;
731  geom.NFiberY = 48;
732  sector_tower_map[geom.id] = geom;
733  }
734 }
735 
737 {
738  std::cout << "PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map4 - "
739  << "FermiLab test beam 2014. Need to move to calibration database"
740  << std::endl;
741 
742  // From Oleg's documents
743 
744  const int ny = 3;
745  const int nx = 3;
746 
747  const double inch_to_cm = 2.54;
748 
749  const double screen_size_y = 2.108 * inch_to_cm;
750  const double screen_size_x = 1.049 * inch_to_cm;
751 
752  const double z_screen_6_7 = 0.5 * (6.6 + 6.75) * inch_to_cm;
753  const double angle_screen_6_7 = 64.78 / 180. * M_PI;
754  const double nawrrow_width_x = screen_size_x * sin(angle_screen_6_7);
755 
756  const double z_screen_1_2 = 0.5 * (1.35 + 1.6) * inch_to_cm;
757  const double angle_screen_1_2 = 90.56 / 180. * M_PI;
758  const double wide_width_x = screen_size_x * sin(angle_screen_1_2);
759 
760  const double module_length = z_screen_6_7 - z_screen_1_2;
761  assert(module_length > 0);
762 
763  // tapering, dxwidth/dlength
764  const double tapering_ratio = (wide_width_x - nawrrow_width_x) / module_length;
765  assert(tapering_ratio < 1);
766  assert(tapering_ratio > 0);
767 
768  fiber_clading_thickness = 0.003;
770 
771  assembly_spacing = 0.002500;
772 
773  radius = (nawrrow_width_x) / tapering_ratio;
774  thickness = module_length * 1.5; // keep a large torlerence space
775  zmin = -(0.5 * ny * screen_size_y + 2 * assembly_spacing * (ny + 1));
776  zmax = -zmin;
777  azimuthal_n_sec = floor(2 * M_PI / atan(tapering_ratio));
778  max_phi_bin_in_sec = 1;
779 
780  const double nawrrow_width_x_construction = radius * 2 * tan(M_PI / azimuthal_n_sec) - 2 * assembly_spacing;
781  const double wide_width_x_construction = (radius + module_length) * 2 * tan(M_PI / azimuthal_n_sec) - 2 * assembly_spacing;
782 
783  std::cout << "PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map4 - "
784 
785  << "Adjust wide end width by ratio of "
786  << wide_width_x_construction / wide_width_x
787  << " and narrow end by ratio of "
788  << nawrrow_width_x_construction / nawrrow_width_x << std::endl;
789 
790  sector_map.clear();
791  for (int sec = 0; sec < nx; ++sec)
792  {
793  const double rot = twopi / (double) (get_azimuthal_n_sec()) * ((double) (sec) -1);
794 
795  sector_map[sec] = rot;
796  }
797 
798  azimuthal_tilt = 0;
799  azimuthal_seg_visible = true;
800  polar_taper_ratio = 1.;
801  sidewall_thickness = 0;
803  sector_tower_map.clear();
804 
805  for (int y = 0; y < ny; y++)
806  {
807  geom_tower geom;
808  geom.id = y;
809  geom.pDz = module_length / 2;
810  geom.pTheta = 0.;
811  geom.pPhi = 0.;
812  geom.pAlp1 = 0.;
813  geom.pAlp2 = 0.;
814  geom.pDy1 = 0.5 * screen_size_y;
815  geom.pDx1 = 0.5 * nawrrow_width_x_construction;
816  geom.pDx2 = 0.5 * nawrrow_width_x_construction;
817  geom.pDy2 = 0.5 * screen_size_y;
818  geom.pDx3 = 0.5 * wide_width_x_construction;
819  geom.pDx4 = 0.5 * wide_width_x_construction;
820 
821  geom.centralX = 0.;
822  geom.centralY = module_length * 0.5 + radius + assembly_spacing;
823  geom.centralZ = screen_size_y * (y - 1);
824 
825  geom.pRotationAngleX = -M_PI / 2.;
826  geom.ModuleSkinThickness = 0.010000;
827  geom.NFiberX = 30;
828  geom.NFiberY = 26 * 2 * 2;
829  sector_tower_map[geom.id] = geom;
830  }
831 }