Skip to content

Commit 6e4ad4f

Browse files
committed
Add the align_lower_edges_of_plate_and_SiPMs_ feature to the APEX class
1 parent 3426e71 commit 6e4ad4f

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

macros/APEX.config.mac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/Geometry/APEX/SiPM_code 4
2626
/Geometry/APEX/num_phsensors 26
2727
/Geometry/APEX/board_position_code 3
28+
/Geometry/APEX/align_lower_edges_of_plate_and_SiPMs false
2829
/Geometry/APEX/gap 0.0 cm
2930
/Geometry/APEX/ref_phsensors_supports true
3031
/Geometry/APEX/with_dimples false

source/geometries/APEX.cc

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ namespace nexus{
7373
SiPM_code_ (1 ),
7474
num_phsensors_ (30 ), /// This is seemingly the APEX baseline
7575
board_position_code_ (1 ),
76+
align_lower_edges_of_plate_and_SiPMs_ (false ),
7677
gap_ (0.5 *mm ),
7778
ref_phsensors_supports_ (true ),
7879
with_dimples_ (false ),
@@ -216,6 +217,10 @@ namespace nexus{
216217
bpc_cmd.SetParameterName("board_position_code", false);
217218
bpc_cmd.SetRange("board_position_code>=1");
218219

220+
G4GenericMessenger::Command& aleopas_cmd =
221+
msg_->DeclareProperty("align_lower_edges_of_plate_and_SiPMs", align_lower_edges_of_plate_and_SiPMs_,
222+
"It only makes a difference if board_position_code_ is set to 2 or 3. If set to true, the lower edges of the WLS plate and the SiPMs are aligned.");
223+
219224
G4GenericMessenger::Command& g_cmd =
220225
msg_->DeclareProperty("gap", gap_,
221226
"Gap between the photosensors and the WLS plate. A negative gap can help modelate the immersion of the SiPMs into the dimples. Be careful not to collide the SiPMs into the plate.");
@@ -512,9 +517,16 @@ namespace nexus{
512517
}
513518
else // board_position_code_ is 2 or 3
514519
{
520+
G4double sipms_y_pos = 0.;
521+
if(align_lower_edges_of_plate_and_SiPMs_)
522+
{
523+
// Assuming that the WLS plate is placed at the origin of coordinates
524+
sipms_y_pos = (-1.*plate_thickn_/2.)+(sipm->GetTransverseDim()/2.);
525+
}
526+
515527
sipm_rot->rotateX(-90.*deg);
516528
base_pos.set( (-1.*board_length_/2.) + (0.5*board_length_/num_phsensors_),
517-
0.,
529+
sipms_y_pos,
518530
-1.*(plate_width_/2.)-1.*(sipm_thickn/2.)-gap_);
519531

520532
G4int phsensor_id = 0;
@@ -532,7 +544,7 @@ namespace nexus{
532544

533545
sipm_rot_2->rotateX(+90.*deg);
534546
base_pos_2.set( (-1.*board_length_/2.) + (0.5*board_length_/num_phsensors_),
535-
0.,
547+
sipms_y_pos,
536548
(plate_width_/2.)+(sipm_thickn/2.)+gap_);
537549

538550
phsensor_id = 0;
@@ -590,9 +602,16 @@ namespace nexus{
590602
}
591603
else // board_position_code_ is 2 or 3
592604
{
605+
G4double board_y_pos = 0.;
606+
if(align_lower_edges_of_plate_and_SiPMs_)
607+
{
608+
// Assuming that the WLS plate is placed at the origin of coordinates
609+
board_y_pos = (-1.*plate_thickn_/2.)+(sipm->GetTransverseDim()/2.);
610+
}
611+
593612
board_rot->rotateX(0.0*deg);
594613
board_pos.set(0.,
595-
0.,
614+
board_y_pos,
596615
-1.*(plate_width_/2.)-gap_
597616
-sipm_thickn-1.*(board_thickn/2.));
598617
//Place it
@@ -608,7 +627,7 @@ namespace nexus{
608627

609628
board_rot_2->rotateX(0.0*deg);
610629
board_pos_2.set(0.,
611-
0.,
630+
board_y_pos,
612631
(plate_width_/2.)+gap_
613632
+sipm_thickn+(board_thickn/2.));
614633
//Place it
@@ -699,10 +718,24 @@ namespace nexus{
699718
-1.*plate_thickn_/2., // Minus half the thickness of AUX_OUTER_BOX
700719
// plus half the reflective-foil thickness
701720
0.);
702-
if(board_position_code_!=1){
703721

722+
G4double sipms_y_pos = 0.;
723+
if(align_lower_edges_of_plate_and_SiPMs_)
724+
{
725+
// I was expecting an error in this case, due to matching surfaces in the boolean subtraction
726+
// of ref_foil_solid minus reflective_foil_holes. Particularly, since the dummy_sipm which
727+
// creates the holes is slightly thicker than the reflective foil (there is an explanation why
728+
// this is done in the comments of the dummy_sipm definition), I was expecting that for the
729+
// the case where align_lower_edges_of_plate_and_SiPMs_ is true, the lower face of the
730+
// dummy_sipm geometry would partially match the upper face of the bottom of the reflective foil.
731+
// However, I saw no warning while Geant4 builds the geomeotry, and no error while running for
732+
// a million photons.
733+
sipms_y_pos = (-1.*plate_thickn_/2.)+(sipm_transverse_dim/2.);
734+
}
735+
736+
if(board_position_code_!=1){
704737
vec = G4ThreeVector(0.,
705-
0.,
738+
sipms_y_pos,
706739
-1.*(plate_width_/2.)-1.*(reflective_foil_thickn_/2.)); // Minus half the width of the plate
707740
// minus half the reflective-foil thickness
708741
}
@@ -713,7 +746,7 @@ namespace nexus{
713746
if(board_position_code_>=3){
714747
// If board_position_code_ is 3, then also carve the holes for a second strip of SiPMs
715748
G4ThreeVector vec_2 = G4ThreeVector(0.,
716-
0.,
749+
sipms_y_pos,
717750
(plate_width_/2.)+(reflective_foil_thickn_/2.)); // Minus half the width of the plate
718751
// minus half the reflective-foil thickness
719752
ref_foil_solid = new G4SubtractionSolid(ref_foil_name,

source/geometries/APEX.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ namespace nexus {
9292
///< 1 -> One board facing the middle of one of the two largest WLS plate faces.
9393
///< 2 -> One board facing one of the smallest WLS plate faces.
9494
///< Any other integer -> One board facing each one of the smallest WLS plate faces (two boards in total).
95+
G4bool align_lower_edges_of_plate_and_SiPMs_; ///< This parameter only makes a difference if board_position_code_ is set to 2 or 3. If set to true, the lower edges of the WLS plate and the SiPMs are aligned.
96+
///< If set to false, then the center (along the plate_thickn_ dimension) of the SiPMs is aligned with the center of the WLS plate
9597
G4double gap_; ///< Gap between the photosensors and the WLS plate. A negative gap can help modelate the immersion of the SiPMs into the dimples. Be careful not to collide the SiPMs into the plate.
9698
G4bool ref_phsensors_supports_; ///< Whether photosensors supports are reflective (the FR4 box that supports the SiPM)
9799
/// Dimples may be used in the future, but not for now ----------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)