14 #include <phparameter/PHParameters.h>
16 #include <Geant4/G4PhysicalConstants.hh>
39 sector_tower_map.erase(sector_tower_map.begin(), sector_tower_map.end());
45 os <<
"PHG4CylinderGeom_Spacalv3: layer: " <<
layer
53 <<
", zmax: " << zmax <<
", num scint: " << nscint <<
", num sector: "
54 << azimuthal_n_sec <<
", unique tower: " << sector_tower_map.size()
64 cout <<
"\t" <<
"get_sidewall_outer_torr() = " << get_sidewall_outer_torr()
66 cout <<
"\t" <<
"get_sidewall_thickness() = " << get_sidewall_thickness()
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()
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;
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;
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)
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;
123 max_phi_bin_in_sec = param.
get_int_param(
"max_phi_bin_in_sec");
132 sector_tower_map.clear();
136 for (
int i = 0; i <
n; i++)
139 prefix <<
"sector_tower_map";
140 prefix <<
"[" << i <<
"]" <<
".";
145 sector_tower_map[t.
id] =
t;
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()),
175 LightguideTaperRatio(numeric_limits<double>::signaling_NaN()),
176 LightguideMaterial(
"PMMA")
185 return NFiberY * index_x + index_y;
192 const int index_x = fiber_id / NFiberY;
193 assert(index_x < NFiberX);
194 assert(index_x >= 0);
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);
208 assert(fiber_id >= 0);
209 const int index_y = fiber_id % NFiberY;
211 const double sub_tower_width_y = (double) NFiberY / NSubtowerY;
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);
224 const int index_x = fiber_id / NFiberY;
225 assert(index_x < NFiberX);
226 assert(index_x >= 0);
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);
233 return x_in_sub_tower;
239 assert(fiber_id >= 0);
240 const int index_y = fiber_id % NFiberY;
242 const double sub_tower_width_y = (double) NFiberY / NSubtowerY;
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);
249 return y_in_sub_tower;
255 os <<
"PHG4CylinderGeom_Spacalv3::geom_super_tower" <<
"[" <<
id <<
"]"
256 <<
" @ <Azimuthal, R, z> = " << centralX <<
", " << centralY <<
", "
261 <<
"Half length = " << pDz <<
", " << pDy1 <<
", " << pDx1 <<
", " << pDx2
262 <<
", " << pDy2 <<
", " << pDx3 <<
", " << pDx4 <<
", "
264 <<
"Angles = " << pTheta <<
", " << pPhi <<
", " << pAlp1 <<
", " << pAlp2
266 <<
"Rotation = " << pRotationAngleX
272 const PHParameters & param,
const std::string & param_prefix)
296 param_prefix +
"ModuleSkinThickness");
299 NSubtowerX = param.
get_int_param(param_prefix +
"NSubtowerX");
300 NSubtowerY = param.
get_int_param(param_prefix +
"NSubtowerY");
302 LightguideHeight = param.
get_double_param(param_prefix +
"LightguideHeight");
304 param_prefix +
"LightguideTaperRatio");
306 param_prefix +
"LightguideMaterial");
319 int tower_id,
int fiber_id) :
320 sector_ID(sector_id), tower_ID(tower_id), fiber_ID(fiber_id)
331 const int sector_ID)
const
334 int z_bin = floor(tower_ID / 10);
336 int phi_bin_in_sec = -1;
342 phi_bin_in_sec = (tower_ID % 10);
344 if (!(phi_bin_in_sec < max_phi_bin_in_sec and phi_bin_in_sec >= 0))
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;
353 assert(phi_bin_in_sec < max_phi_bin_in_sec and phi_bin_in_sec >= 0);
357 return make_pair(z_bin, phi_bin);
369 assert(outter_wall_shift>=0);
371 assert(tilted_radial_shift>=0);
372 const double tower_radial =
381 <<
"PHG4CylinderGeom_Spacalv3::get_tower_radial_position - tower radial adjustment: "
382 "from "<<tower.
centralY<<
" to "<<tower_radial
391 <<
"PHG4CylinderGeom_Spacalv3::get_tower_radial_position - ERROR - "
392 "unsupported configuration!"
416 <<
"PHG4CylinderGeom_Spacalv3::subtower_consistency_check - Passed with get_n_subtower_phi() = "
441 double max_height = 0;
446 const double h =
it->second.LightguideHeight;
447 max_height =
max(max_height, h);
456 cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map1 - "
457 <<
"load four example central towers" << endl;
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;
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;
532 cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map2 - "
533 <<
"load one row of example forward towers" << endl;
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;
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;
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;
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;
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;
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;
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;
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;
750 cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map4 - "
751 <<
"FermiLab test beam 2014. Need to move to calibration database"
759 const double inch_to_cm = 2.54;
761 const double screen_size_y = 2.108 * inch_to_cm;
762 const double screen_size_x = 1.049 * inch_to_cm;
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);
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);
772 const double module_length = z_screen_6_7 - z_screen_1_2;
773 assert(module_length > 0);
776 const double tapering_ratio = (wide_width_x - nawrrow_width_x)
778 assert(tapering_ratio < 1);
779 assert(tapering_ratio > 0);
786 radius = (nawrrow_width_x) / tapering_ratio;
793 const double nawrrow_width_x_construction =
radius * 2
795 const double wide_width_x_construction = (
radius + module_length) * 2
798 cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map4 - "
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;
806 for (
int sec = 0; sec < nx; ++sec)
809 * ((
double) (sec) - 1);
821 for (
int y = 0;
y < ny;
y++)
826 geom.
pDz = module_length / 2;
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;