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