14 #include <phparameter/PHParameters.h>
16 #include <Geant4/G4PhysicalConstants.hh>
18 #include <CLHEP/Units/SystemOfUnits.h>
42 os <<
"PHG4CylinderGeom_Spacalv3: layer: " <<
layer
50 <<
", zmax: " <<
zmax <<
", num scint: " <<
nscint <<
", num sector: "
78 <<
"get_max_lightguide_height() = "
82 <<
" unique towers per sector." << std::endl;
136 for (
int i = 0;
i <
n;
i++)
139 prefix <<
"sector_tower_map";
140 prefix <<
"[" <<
i <<
"]"
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())
175 , LightguideHeight(0)
176 , LightguideTaperRatio(std::numeric_limits<
double>::quiet_NaN())
177 , LightguideMaterial(
"PMMA")
185 return NFiberY * index_x + index_y;
191 const int index_x = fiber_id / NFiberY;
192 assert(index_x < NFiberX);
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);
207 const int index_y = fiber_id % NFiberY;
209 const double sub_tower_width_y = (
double) NFiberY / NSubtowerY;
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);
222 const int index_x = fiber_id / NFiberY;
223 assert(index_x < NFiberX);
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);
231 return x_in_sub_tower;
238 const int index_y = fiber_id % NFiberY;
240 const double sub_tower_width_y = (
double) NFiberY / NSubtowerY;
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);
247 return y_in_sub_tower;
252 os <<
"PHG4CylinderGeom_Spacalv3::geom_super_tower"
254 <<
" @ <Azimuthal, R, z> = " << centralX <<
", " << centralY <<
", "
259 <<
"Half length = " << pDz <<
", " << pDy1 <<
", " << pDx1 <<
", " << pDx2
260 <<
", " << pDy2 <<
", " << pDx3 <<
", " << pDx4 <<
", "
262 <<
"Angles = " << pTheta <<
", " << pPhi <<
", " << pAlp1 <<
", " << pAlp2
264 <<
"Rotation = " << pRotationAngleX
292 param_prefix +
"ModuleSkinThickness");
295 NSubtowerX = param.
get_int_param(param_prefix +
"NSubtowerX");
296 NSubtowerY = param.
get_int_param(param_prefix +
"NSubtowerY");
298 LightguideHeight = param.
get_double_param(param_prefix +
"LightguideHeight");
300 param_prefix +
"LightguideTaperRatio");
302 param_prefix +
"LightguideMaterial");
314 int tower_id,
int fiber_id)
315 : sector_ID(sector_id)
328 const int sector_ID)
const
331 int z_bin = floor(tower_ID / 10);
333 int phi_bin_in_sec = -1;
339 phi_bin_in_sec = (tower_ID % 10);
341 if (!(phi_bin_in_sec < max_phi_bin_in_sec and phi_bin_in_sec >= 0))
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;
350 assert(phi_bin_in_sec < max_phi_bin_in_sec and phi_bin_in_sec >= 0);
354 return std::make_pair(z_bin, phi_bin);
366 assert(outter_wall_shift >= 0);
368 assert(tilted_radial_shift >= 0);
369 const double tower_radial =
377 <<
"PHG4CylinderGeom_Spacalv3::get_tower_radial_position - tower radial adjustment: "
379 << tower.
centralY <<
" to " << tower_radial
388 <<
"PHG4CylinderGeom_Spacalv3::get_tower_radial_position - ERROR - "
389 "unsupported configuration!"
412 <<
"PHG4CylinderGeom_Spacalv3::subtower_consistency_check - Passed with get_n_subtower_phi() = "
435 double max_height = 0;
439 const double h =
it.second.LightguideHeight;
440 max_height = std::max(max_height, h);
448 std::cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map1 - "
449 <<
"load four example central towers" << std::endl;
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;
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;
522 std::cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map2 - "
523 <<
"load one row of example forward towers" << std::endl;
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;
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;
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;
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;
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;
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;
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;
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;
738 std::cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map4 - "
739 <<
"FermiLab test beam 2014. Need to move to calibration database"
747 const double inch_to_cm = 2.54;
749 const double screen_size_y = 2.108 * inch_to_cm;
750 const double screen_size_x = 1.049 * inch_to_cm;
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);
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);
760 const double module_length = z_screen_6_7 - z_screen_1_2;
761 assert(module_length > 0);
764 const double tapering_ratio = (wide_width_x - nawrrow_width_x) / module_length;
765 assert(tapering_ratio < 1);
766 assert(tapering_ratio > 0);
773 radius = (nawrrow_width_x) / tapering_ratio;
783 std::cout <<
"PHG4CylinderGeom_Spacalv3::load_demo_sector_tower_map4 - "
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;
791 for (
int sec = 0; sec <
nx; ++sec)
805 for (
int y = 0;
y <
ny;
y++)
809 geom.
pDz = module_length / 2;
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;