Skip to content

Commit 5a7dd05

Browse files
sebouh137pre-commit-ci[bot]rymilton
authored
Insert granularity (#771)
multisegmentation for the insert ### Briefly, what does this PR introduce? Updates the segmentation for the insert so that it has 3 different segmentations: ~12cm2 in layers 1-16 ~21 cm2 in layers 17-60 for the left side ~25 cm2 in layers 17-60 for the right side ### What kind of change does this PR introduce? - [ ] Bug fix (issue #__) - [ ] New feature (issue #__) - [ ] Documentation update - [X] Other: update on segmentation ### Please check if this PR fulfills the following: - [X] Tests for the changes have been added - [X] Documentation has been added / updated - [X] Changes have been communicated to collaborators ### Does this PR introduce breaking changes? What changes might users need to make to their code? no ### Does this PR change default behavior? yes. different cell sizes in the calorimeter insert. Also a few minor changes: removed thinner front layer from the insert. Added gap between left and right sides. Adjusted the width and heights of the insert slightly. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Ryan Milton <[email protected]>
1 parent e71ff5a commit 5a7dd05

File tree

4 files changed

+172
-108
lines changed

4 files changed

+172
-108
lines changed

compact/definitions.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,8 @@ Service gaps in FW direction (before endcapP ECAL) and BW direction (before endc
595595
<constant name="HcalEndcapPInsert_zmin" value="EcalEndcapP_zmin + EcalEndcapP_length"/>
596596
<constant name="HcalEndcapPInsert_length" value="134.75*cm"/>
597597
<constant name="HcalEndcapPInsert_zmax" value="HcalEndcapPInsert_zmin + HcalEndcapPInsert_length"/>
598-
<constant name="HcalEndcapPInsert_width" value="59.6*cm"/>
599-
<constant name="HcalEndcapPInsert_height" value="59.7485*cm"/>
598+
<constant name="HcalEndcapPInsert_width" value="59.26*cm"/>
599+
<constant name="HcalEndcapPInsert_height" value="59.29*cm"/>
600600
<constant name="HcalEndcapPInsert_xposition" value="EcalEndcapPInsert_xposition"/>
601601
<constant name="HcalEndcapPInsert_yposition" value="EcalEndcapPInsert_yposition"/>
602602

compact/ecal/forward_insert_homogeneous.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
final_hole_x="EcalEndcapPInsert_hole_xposition"
8686
initial_hole_y="EcalEndcapPInsert_hole_yposition"
8787
final_hole_y="EcalEndcapPInsert_hole_yposition"
88+
left_right_gap="0.38*cm"
8889
/>
8990
</detector>
9091
</detectors>
@@ -99,7 +100,7 @@
99100
grid_size_x="24.925*mm"
100101
grid_size_y="24.65*mm"
101102
/>
102-
<id>system:8,barrel:3,module:4,layer:8,slice:5,x:32:-16,y:-16</id>
103+
<id>system:8,barrel:3,module:4,layer:7,side:1,slice:5,x:32:-16,y:-16</id>
103104
</readout>
104105

105106
</readouts>

compact/hcal/forward_insert.xml

+70-23
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,24 @@
2323
<constant name="HcalEndcapPInsertESRFoilThickness" value="0.015*cm"/>
2424

2525
<constant name="LFHCAL_FrontWallThickness" value="1.50*cm"/>
26+
<documentation>
27+
#### Cell Sizes
28+
</documentation>
29+
<constant name="HcalEndcapPInsertCellSizeHG" value="2.16*cm"/>
30+
<constant name="HcalEndcapPInsertCellSizeLGLeft" value="2.84*cm"/>
31+
<constant name="HcalEndcapPInsertCellSizeLGRight" value="3.1*cm"/>
32+
<documentation>
33+
#### Transverse offsets of cells
34+
</documentation>
35+
<constant name="HcalEndcapPInsertCellToPCBEdge" value="0.04*cm"/>
36+
<constant name="HcalEndcapPInsertOffsetXHGRight" value="-HcalEndcapPInsert_width/2.+HcalEndcapPInsertCellToPCBEdge-HcalEndcapPInsertCellSizeHG*0.25"/>
37+
<constant name="HcalEndcapPInsertOffsetYHGRight" value="HcalEndcapPInsertCellSizeHG*sqrt(3)/2*0"/>
38+
<constant name="HcalEndcapPInsertOffsetXHGLeft" value="HcalEndcapPInsert_width/2.-HcalEndcapPInsertCellToPCBEdge-HcalEndcapPInsertCellSizeHG*0"/>
39+
<constant name="HcalEndcapPInsertOffsetYHGLeft" value="HcalEndcapPInsertCellSizeHG*sqrt(3)/2*0"/>
40+
<constant name="HcalEndcapPInsertOffsetXLGRight" value="-HcalEndcapPInsert_width/2.+HcalEndcapPInsertCellToPCBEdge-HcalEndcapPInsertCellSizeLGRight*0.5"/>
41+
<constant name="HcalEndcapPInsertOffsetYLGRight" value="HcalEndcapPInsertCellSizeLGRight*0*sqrt(3)/2"/>
42+
<constant name="HcalEndcapPInsertOffsetXLGLeft" value="HcalEndcapPInsert_width/2.-HcalEndcapPInsertCellToPCBEdge+HcalEndcapPInsertCellSizeLGLeft*0.5"/>
43+
<constant name="HcalEndcapPInsertOffsetYLGLeft" value="HcalEndcapPInsertCellSizeLGLeft*0*sqrt(3)/2"/>
2644

2745
<documentation>
2846
- Insert N Layers and computed Thickness
@@ -49,15 +67,15 @@
4967
HcalEndcapPInsertAirThickness "
5068
/>
5169
<constant name="HcalEndcapPInsertBackplateThickness" value="HcalEndcapPInsertAbsorberThickness"/>
52-
<constant name="HcalEndcapPInsertLayer_NSteelRepeat" value="64"/>
70+
<constant name="HcalEndcapPInsertLayer_NSteelRepeat" value="60"/>
5371
</define>
5472

5573
<detectors>
5674
<documentation>
5775
### Forward (Positive Z) Endcap Insert for Hadronic Calorimeter
5876
Insert goes in the middle of the forward endcap HCal -- around the beampipe
5977

60-
Insert is 1 front layer of Steel/Sc + 64 layers of Steel/Sc + 1 backplate of steel
78+
Insert is 60 layers of Steel/Sc + 1 backplate of steel
6179
Each of the layers (sans backplate) includes air gaps (front and back of each layer),
6280
ESR foil (front and back of scintillator), a PCB, and an aluminum scitnillator cover
6381

@@ -73,6 +91,7 @@
7391
vis="HcalEndcapInsertVis"
7492
readout="HcalEndcapPInsertHits"
7593
calorimeterType="HAD_ENDCAP"
94+
left_right_gap="0.38*cm"
7695
>
7796
<position x="HcalEndcapPInsert_xposition" y="HcalEndcapPInsert_yposition" z="HcalEndcapPInsert_zmin"/>
7897
<dimensions
@@ -81,18 +100,6 @@
81100
z="HcalEndcapPInsert_length"
82101
/>
83102
<backplate thickness="HcalEndcapPInsertBackplateThickness"/>
84-
<comment> Front layer to match front walls of LFHCAL modules </comment>
85-
<comment> Slices will be ordered according to the slice order listed here </comment>
86-
<layer repeat="1" thickness="HcalEndcapPInsertFrontLayerThickness" vis="InvisibleWithDaughters">
87-
<slice material="Steel235" thickness="LFHCAL_FrontWallThickness" vis="LFHCAL8MModVis" />
88-
<slice material="Air" thickness="HcalEndcapPInsertAirThickness"/>
89-
<slice material="Aluminum" thickness="HcalEndcapPInsertScintillatorCoverThickness" vis="AnlProcess_Blue"/>
90-
<slice material="Polystyrene" thickness="HcalEndcapPInsertESRFoilThickness" vis="AnlGray"/>
91-
<slice material="Polystyrene" thickness="HcalEndcapPInsertPolystyreneThickness" sensitive="true" limits="cal_limits" vis="AnlLightGray"/>
92-
<slice material="Polystyrene" thickness="HcalEndcapPInsertESRFoilThickness" vis="AnlGray"/>
93-
<slice material="Fr4" thickness="HcalEndcapPInsertPCBThickness"/>
94-
<slice material="Air" thickness="HcalEndcapPInsertAirThickness"/>
95-
</layer>
96103
<comment> Steel/Sc layers </comment>
97104
<layer repeat="HcalEndcapPInsertLayer_NSteelRepeat" thickness="HcalEndcapPInsertSingleLayerThickness" vis="InvisibleWithDaughters">
98105
<slice material="Steel235" thickness="HcalEndcapPInsertAbsorberThickness" vis="LFHCAL8MModVis"/>
@@ -128,21 +135,61 @@
128135

129136
<readouts>
130137
<documentation>
131-
Readout is segmented into hexagons with sides of 1.889 cm
132-
The hexagons positions cycle through four sets of layer configurations ("H4 staggering")
138+
Readout is segmented into hexagons with sides of 2.16 cm, 2.84 cm, and 3.10 cm in the high-granularity upstream section (layers 1-16, for both left and right sides),
139+
the left downstream section (layers 17-60), and the right downstream section (layers 17-60), respectively.
140+
The hexagons positions in the first 16 layers cycle through four sets of layer configurations ("H4 staggering")
133141
i.e. hexagons in layers 1-4 (5-8, ...) are all offset transversely from each other
134142
with the centers of the cells of one layer being at the midpoints of the edges of the cells in
135-
the other layers
143+
the other layers.
144+
136145
Staggering defined in https://github.com/AIDASoft/DD4hep/blob/1962f7d1ace4484efb8886d66a6759a83c5107a3/DDCore/include/DDSegmentation/HexGrid.h#L112-L114
137146
and https://github.com/AIDASoft/DD4hep/blob/1962f7d1ace4484efb8886d66a6759a83c5107a3/DDCore/src/segmentations/HexGrid.cpp#L102-L120
138147
</documentation>
139148
<readout name="HcalEndcapPInsertHits">
140-
<segmentation
141-
type="HexGrid"
142-
side_length="1.889*cm"
143-
stagger="2"
144-
/>
145-
<id>system:8,layer:8,slice:8,x:32:-16,y:-16</id>
149+
<segmentation type="MultiSegmentation" key="layer">
150+
<segmentation name="insert_hg" type="MultiSegmentation" key="side" key_min="1" key_max="16">
151+
<segmentation
152+
name="insert_hg_left"
153+
type="HexGrid"
154+
side_length="HcalEndcapPInsertCellSizeHG"
155+
stagger="2"
156+
key_value="1"
157+
offset_x="HcalEndcapPInsertOffsetXHGLeft"
158+
offset_y="HcalEndcapPInsertOffsetYHGLeft"
159+
/>
160+
<segmentation
161+
name="insert_hg_right"
162+
type="HexGrid"
163+
side_length="HcalEndcapPInsertCellSizeHG"
164+
stagger="2"
165+
key_value="0"
166+
offset_x="HcalEndcapPInsertOffsetXHGRight"
167+
offset_y="HcalEndcapPInsertOffsetYHGRight"
168+
/>
169+
</segmentation>
170+
<segmentation name="insert_lg" type="MultiSegmentation" key="side" key_min="17" key_max="60">
171+
<segmentation
172+
name="insert_lg_left"
173+
type="HexGrid"
174+
side_length="HcalEndcapPInsertCellSizeLGLeft"
175+
stagger="0"
176+
key_value="1"
177+
offset_x="HcalEndcapPInsertOffsetXLGLeft"
178+
offset_y="HcalEndcapPInsertOffsetYLGLeft"
179+
/>
180+
<segmentation
181+
name="insert_lg_right"
182+
type="HexGrid"
183+
side_length="HcalEndcapPInsertCellSizeLGRight"
184+
stagger="0"
185+
key_value="0"
186+
offset_x="HcalEndcapPInsertOffsetXLGRight"
187+
offset_y="HcalEndcapPInsertOffsetYLGRight"
188+
/>
189+
</segmentation>
190+
</segmentation>
191+
192+
<id>system:8,side:1,layer:8,slice:7,x:32:-16,y:-16</id>
146193
</readout>
147194

148195
</readouts>

src/InsertCalorimeter_geo.cpp

+98-82
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens
5454
pos.y();
5555
const std::pair<double, double> hole_y_parameters(hole_y_initial, hole_y_final);
5656

57+
const double left_right_gap =
58+
dd4hep::getAttrOrDefault<double>(detElem, _Unicode(left_right_gap), 0.38 * cm);
5759
// Getting thickness of backplate
5860
/*
5961
The hole radius & position is determined by liner interpolation
@@ -100,93 +102,107 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens
100102
// FIXME Workaround for https://github.com/eic/epic/issues/411
101103
assembly.setVisAttributes(desc.visAttributes("InvisibleWithDaughters"));
102104
PlacedVolume pv;
103-
104-
// Keeps track of the z location as we move longiduinally through the insert
105-
// Will use this tracking variable as input to get_hole_rxy
106-
double z_distance_traversed = 0.;
107-
108-
int layer_num = 1;
109-
110-
// Looping through all the different layer sections (W/Sc, Steel/Sc, backplate)
111-
for (xml_coll_t c(detElem, _U(layer)); c; c++) {
112-
xml_comp_t x_layer = c;
113-
int repeat = x_layer.repeat();
114-
double layer_thickness = x_layer.thickness();
115-
116-
// Looping through the number of repeated layers in each section
117-
for (int i = 0; i < repeat; i++) {
118-
std::string layer_name = detName + _toString(layer_num, "_layer%d");
119-
Box layer(width / 2., height / 2., layer_thickness / 2.);
120-
121-
// Hole radius and position for each layer is determined from z position at the front of the layer
122-
const auto hole_rxy = get_hole_rxy(z_distance_traversed);
123-
double hole_r = std::get<0>(hole_rxy);
124-
double hole_x = std::get<1>(hole_rxy);
125-
double hole_y = std::get<2>(hole_rxy);
126-
127-
// Removing beampipe shape from each layer
128-
Tube layer_hole(0., hole_r, layer_thickness / 2.);
129-
SubtractionSolid layer_with_hole(layer, layer_hole, Position(hole_x, hole_y, 0.));
130-
Volume layer_vol(layer_name, layer_with_hole, air);
131-
132-
int slice_num = 1;
133-
double slice_z = -layer_thickness / 2.; // Keeps track of slices' z locations in each layer
134-
135-
// Looping over each layer's slices
136-
for (xml_coll_t l(x_layer, _U(slice)); l; l++) {
137-
xml_comp_t x_slice = l;
138-
double slice_thickness = x_slice.thickness();
139-
std::string slice_name = layer_name + _toString(slice_num, "slice%d");
140-
Material slice_mat = desc.material(x_slice.materialStr());
141-
slice_z += slice_thickness / 2.; // Going to slice halfway point
142-
143-
// Each slice within a layer has the same hole radius and x-y position
144-
Box slice(width / 2., height / 2., slice_thickness / 2.);
145-
Tube slice_hole(0., hole_r, slice_thickness / 2.);
146-
SubtractionSolid slice_with_hole(slice, slice_hole, Position(hole_x, hole_y, 0.));
147-
Volume slice_vol(slice_name, slice_with_hole, slice_mat);
148-
149-
// Setting appropriate slices as sensitive
150-
if (x_slice.isSensitive()) {
151-
sens.setType("calorimeter");
152-
slice_vol.setSensitiveDetector(sens);
105+
for (int side_num = 0; side_num < 2; side_num++) { // 0 = right, 1 = left
106+
std::string side_name = side_num == 1 ? "L" : "R";
107+
// Keeps track of the z location as we move longiduinally through the insert
108+
// Will use this tracking variable as input to get_hole_rxy
109+
double z_distance_traversed = 0.;
110+
111+
int layer_num = 1;
112+
113+
// Looping through all the different layer sections (W/Sc, Steel/Sc, backplate)
114+
for (xml_coll_t c(detElem, _U(layer)); c; c++) {
115+
xml_comp_t x_layer = c;
116+
int repeat = x_layer.repeat();
117+
double layer_thickness = x_layer.thickness();
118+
119+
// Looping through the number of repeated layers in each section
120+
for (int i = 0; i < repeat; i++) {
121+
std::string layer_name = detName + _toString(layer_num, "_layer%d") + "_" + side_name;
122+
Box layer(width / 2., height / 2., layer_thickness / 2.);
123+
124+
// Hole radius and position for each layer is determined from z position at the front of the layer
125+
const auto hole_rxy = get_hole_rxy(z_distance_traversed);
126+
double hole_r = std::get<0>(hole_rxy);
127+
double hole_x = std::get<1>(hole_rxy);
128+
double hole_y = std::get<2>(hole_rxy);
129+
130+
// Removing beampipe shape from each layer
131+
Tube layer_hole(0., hole_r, layer_thickness / 2.);
132+
SubtractionSolid layer_with_hole(layer, layer_hole, Position(hole_x, hole_y, 0.));
133+
// Only select the left or right side of the layer
134+
Box side_cut(width / 2., height, layer_thickness);
135+
Position side_cut_position((width / 2 - left_right_gap / 2) * (1 - 2 * side_num) - pos.x(),
136+
0, 0);
137+
SubtractionSolid layer_side_with_hole(layer_with_hole, side_cut, side_cut_position);
138+
Volume layer_vol(layer_name, layer_side_with_hole, air);
139+
140+
int slice_num = 1;
141+
double slice_z = -layer_thickness / 2.; // Keeps track of slices' z locations in each layer
142+
143+
// Looping over each layer's slices
144+
for (xml_coll_t l(x_layer, _U(slice)); l; l++) {
145+
xml_comp_t x_slice = l;
146+
double slice_thickness = x_slice.thickness();
147+
std::string slice_name = layer_name + _toString(slice_num, "slice%d");
148+
Material slice_mat = desc.material(x_slice.materialStr());
149+
slice_z += slice_thickness / 2.; // Going to slice halfway point
150+
151+
// Each slice within a layer has the same hole radius and x-y position
152+
Box slice(width / 2., height / 2., slice_thickness / 2.);
153+
Tube slice_hole(0., hole_r, slice_thickness / 2.);
154+
SubtractionSolid slice_with_hole(slice, slice_hole, Position(hole_x, hole_y, 0.));
155+
Box side_cut_slice(width / 2., height, layer_thickness);
156+
Position side_cut_position_slice(
157+
(width / 2 - left_right_gap / 2) * (1 - 2 * side_num) - pos.x(), 0, 0);
158+
SubtractionSolid slice_side_with_hole(slice_with_hole, side_cut_slice,
159+
side_cut_position_slice);
160+
Volume slice_vol(slice_name, slice_side_with_hole, slice_mat);
161+
162+
// Setting appropriate slices as sensitive
163+
if (x_slice.isSensitive()) {
164+
sens.setType("calorimeter");
165+
slice_vol.setSensitiveDetector(sens);
166+
}
167+
168+
// Setting slice attributes
169+
slice_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr());
170+
171+
// Placing slice within layer
172+
pv = layer_vol.placeVolume(slice_vol,
173+
Transform3D(RotationZYX(0, 0, 0), Position(0., 0., slice_z)));
174+
pv.addPhysVolID("slice", slice_num);
175+
pv.addPhysVolID("side", side_num);
176+
slice_z += slice_thickness / 2.;
177+
z_distance_traversed += slice_thickness;
178+
slice_num++;
153179
}
154180

155-
// Setting slice attributes
156-
slice_vol.setAttributes(desc, x_slice.regionStr(), x_slice.limitsStr(), x_slice.visStr());
157-
158-
// Placing slice within layer
159-
pv = layer_vol.placeVolume(slice_vol,
160-
Transform3D(RotationZYX(0, 0, 0), Position(0., 0., slice_z)));
161-
pv.addPhysVolID("slice", slice_num);
162-
slice_z += slice_thickness / 2.;
163-
z_distance_traversed += slice_thickness;
164-
slice_num++;
181+
// Setting layer attributes
182+
layer_vol.setAttributes(desc, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr());
183+
/*
184+
Placing each layer inside assembly
185+
-length/2. is front of detector in global coordinate system
186+
+ (z_distance_traversed - layer_thickness) goes to the front of each layer
187+
+ layer_thickness/2. places layer in correct spot
188+
Example: After placement of slices in first layer, z_distance_traversed = layer_thickness
189+
Subtracting layer_thickness goes back to the front of the first slice (Now, z = -length/2)
190+
Adding layer_thickness / 2. goes to half the first layer thickness (proper place to put layer)
191+
Each loop over repeat will increases z_distance_traversed by layer_thickness
192+
*/
193+
pv = assembly.placeVolume(
194+
layer_vol,
195+
Transform3D(RotationZYX(0, 0, 0),
196+
Position(0., 0.,
197+
-length / 2. + (z_distance_traversed - layer_thickness) +
198+
layer_thickness / 2.)));
199+
200+
pv.addPhysVolID("layer", layer_num);
201+
pv.addPhysVolID("side", side_num);
202+
layer_num++;
165203
}
166-
167-
// Setting layer attributes
168-
layer_vol.setAttributes(desc, x_layer.regionStr(), x_layer.limitsStr(), x_layer.visStr());
169-
/*
170-
Placing each layer inside assembly
171-
-length/2. is front of detector in global coordinate system
172-
+ (z_distance_traversed - layer_thickness) goes to the front of each layer
173-
+ layer_thickness/2. places layer in correct spot
174-
Example: After placement of slices in first layer, z_distance_traversed = layer_thickness
175-
Subtracting layer_thickness goes back to the front of the first slice (Now, z = -length/2)
176-
Adding layer_thickness / 2. goes to half the first layer thickness (proper place to put layer)
177-
Each loop over repeat will increases z_distance_traversed by layer_thickness
178-
*/
179-
pv = assembly.placeVolume(
180-
layer_vol, Transform3D(RotationZYX(0, 0, 0),
181-
Position(0., 0.,
182-
-length / 2. + (z_distance_traversed - layer_thickness) +
183-
layer_thickness / 2.)));
184-
185-
pv.addPhysVolID("layer", layer_num);
186-
layer_num++;
187204
}
188205
}
189-
190206
DetElement det(detName, detID);
191207
Volume motherVol = desc.pickMotherVolume(det);
192208

0 commit comments

Comments
 (0)