@@ -49,17 +49,29 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
49
49
xml_comp_t pos = x_det.position ();
50
50
xml_comp_t rot = x_det.rotation ();
51
51
52
+ // function for module definition
52
53
auto [modVol, modSize] = build_specScFiCAL_module (description, x_mod, sens);
53
54
54
- // Position of first module, layer from center of CAL
55
- double mod_pos0 = -(detSizeXY / 2.0 ) + (modSize.x () / 2.0 );
56
- double layer_pos0 = -(detSizeZ / 2.0 ) + (modSize.y () / 2.0 );
55
+ // layer definition before rotation
56
+ xml_comp_t x_layer = x_det.child (_Unicode (layer));
57
+
58
+ double laySizeX = getAttrOrDefault (x_layer, _Unicode (sizeX), 1.0 * cm);
59
+ double laySizeY = getAttrOrDefault (x_layer, _Unicode (sizeY), 1.0 * cm);
60
+ double laySizeZ = getAttrOrDefault (x_layer, _Unicode (sizeZ), 1.0 * cm);
61
+ double layerCoatSizeX = getAttrOrDefault (x_layer, _Unicode (coatSizeX), 1.0 * cm);
62
+ double layerCoatSizeY = getAttrOrDefault (x_layer, _Unicode (coatSizeY), 1.0 * cm);
63
+
64
+ Material layMat = description.material (x_layer.attr <std::string>(_Unicode (material)));
57
65
58
- Box layerBox (detSizeXY / 2 , modSize. y () / 2 , detSizeXY / 2 );
59
- Volume layerVol (" layer" , layerBox, Air );
60
- layerVol.setVisAttributes (description.visAttributes (x_mod .attr <std::string>(_Unicode (vis))));
66
+ Box layerBox (laySizeX / 2.0 , laySizeY / 2.0 , laySizeZ / 2.0 );
67
+ Volume layerVol (" layer" , layerBox, layMat );
68
+ layerVol.setVisAttributes (description.visAttributes (x_det .attr <std::string>(_Unicode (vis))));
61
69
62
- // Fill layer with modules
70
+ // Position of first module, layer from center of CAL
71
+ double mod_pos0 = -(detSizeXY / 2.0 ) + (modSize.x () / 2.0 ) + layerCoatSizeX;
72
+ double layer_pos0 = -(detSizeZ / 2.0 ) + (modSize.y () / 2.0 ) + layerCoatSizeY;
73
+
74
+ // Fill uncoated layer with modules
63
75
for (int mod_id = 0 ; mod_id < nmod_perlayer; mod_id++) {
64
76
65
77
// Build // to z-axis, then rotate
@@ -71,26 +83,27 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s
71
83
modPV.addPhysVolID (" module" , mod_id);
72
84
} // imod-loop close
73
85
86
+ // sector definition
74
87
Box sectorBox (detSizeXY / 2 , detSizeXY / 2 , detSizeZ / 2 );
75
88
Volume sectorVol (det_name + " _sector" , sectorBox, Air);
76
89
sectorVol.setVisAttributes (description.visAttributes (x_mod.attr <std::string>(_Unicode (vis))));
77
90
78
- // Fill sector with layers
91
+ // Fill sector with layers (coated)
79
92
for (int layer_id = 0 ; layer_id < nlayer; layer_id++) {
80
93
81
- double lay_pos_z = -layer_id * modSize.y () - layer_pos0;
94
+ double lay_pos_z = -layer_id * ( modSize.y () + 2.0 * layerCoatSizeY ) - layer_pos0;
82
95
double lay_pos_y = 0.0 * cm;
83
96
double lay_pos_x = 0.0 * cm;
84
97
int orientation = layer_id % 2 == 0 ;
85
98
99
+ // rotation
86
100
RotationZYX lay_rot = RotationZYX (0 , 0 , -90.0 * degree);
87
101
if (orientation)
88
102
lay_rot *= RotationY (-90.0 * degree);
89
103
90
104
PlacedVolume layPV = sectorVol.placeVolume (
91
105
layerVol, Transform3D (lay_rot, Position (lay_pos_x, lay_pos_y, lay_pos_z)));
92
- layPV.addPhysVolID (" layer" , layer_id).addPhysVolID (" orientation" , orientation);
93
-
106
+ layPV.addPhysVolID (" layer" , layer_id);
94
107
} // layer_id-loop close
95
108
96
109
// loop over sectors(top, bottom)
@@ -134,30 +147,67 @@ static tuple<Volume, Position> build_specScFiCAL_module(const Detector& descript
134
147
Volume modVol (" module_vol" , modShape, modMat);
135
148
136
149
modVol.setVisAttributes (description.visAttributes (mod_x.attr <std::string>(_Unicode (vis))));
137
- // ----------------------------Scintillating fibers -----------------------------------------------------------
150
+
151
+ // --------------------------Block of fibers in a module------------------------------------------------------
152
+
153
+ // block fibers
154
+ auto fiber_block = mod_x.child (_Unicode (block));
155
+
156
+ auto fb_sx = fiber_block.attr <double >(_Unicode (sizeX));
157
+ auto fb_sy = fiber_block.attr <double >(_Unicode (sizeY));
158
+ auto fb_sz = fiber_block.attr <double >(_Unicode (sizeZ));
159
+ auto fb_SpaceXY = fiber_block.attr <double >(_Unicode (SpaceXY));
160
+
161
+ Position fbSize (fb_sx, fb_sy, fb_sz);
138
162
139
163
// fibers
140
164
auto fiber_tube = mod_x.child (_Unicode (fiber));
141
- auto fr = fiber_tube.attr <double >(_Unicode (radius));
142
- auto fsx = fiber_tube.attr <double >(_Unicode (spacex));
143
- auto fsy = fiber_tube.attr <double >(_Unicode (spacey));
144
- auto fiberMat = description.material (fiber_tube.attr <std::string>(_Unicode (material)));
145
- Tube fiberShape (0 ., fr, modSize.z () / 2.0 );
165
+
166
+ auto fr = fiber_tube.attr <double >(_Unicode (radius));
167
+ auto fsx = fiber_tube.attr <double >(_Unicode (spacex));
168
+ auto fsy = fiber_tube.attr <double >(_Unicode (spacey));
169
+
170
+ // fiber block description and placement in module
171
+ Box fbShape (fbSize.x () / 2.0 , fbSize.y () / 2.0 , fbSize.z () / 2.0 );
172
+ Volume fbVol (" fiberblock_volume" , fbShape, modMat);
173
+ fbVol.setVisAttributes (
174
+ description.visAttributes (mod_x.attr <std::string>(_Unicode (vis)))); // same as module
175
+
176
+ int num_fbX = int (modSize.x () / (fbSize.x () + 2.0 * fb_SpaceXY));
177
+ int num_fbY = int (modSize.y () / (fbSize.y () + 2.0 * fb_SpaceXY));
178
+
179
+ double fb_xpos0 = -(modSize.x () / 2.0 ) + (fbSize.x () / 2.0 ) + fb_SpaceXY;
180
+ double fb_ypos0 = -(modSize.y () / 2.0 ) + (fbSize.y () / 2.0 ) + fb_SpaceXY;
181
+ int nblock = 0 ;
182
+
183
+ for (int iy = 0 ; iy < num_fbY; iy++) {
184
+ for (int ix = 0 ; ix < num_fbX; ix++) {
185
+ double fb_pos_x = fb_xpos0 + ix * (fbSize.x () + 2.0 * fb_SpaceXY); // mm
186
+ double fb_pos_y = fb_ypos0 + iy * (fbSize.y () + 2.0 * fb_SpaceXY); // mm
187
+ double fb_pos_z = 0 * mm;
188
+
189
+ auto fbPV = modVol.placeVolume (fbVol, nblock, Position{fb_pos_x, fb_pos_y, fb_pos_z});
190
+ fbPV.addPhysVolID (" block" , nblock++);
191
+ }
192
+ }
193
+
194
+ // fiber placement and description in blocks
195
+ auto fiberMat = description.material (fiber_tube.attr <std::string>(_Unicode (material)));
196
+ Tube fiberShape (0 ., fr, fbSize.z () / 2.0 );
146
197
Volume fiberVol (" fiber_vol" , fiberShape, fiberMat);
147
198
fiberVol.setVisAttributes (description.visAttributes (fiber_tube.attr <std::string>(_Unicode (vis))));
148
199
fiberVol.setSensitiveDetector (sens);
149
200
150
- // double submod_sizexy = 2.0*fr; // size of square = diameter of tubes.
151
- int num_submodX = int (modSize.x () / (2 * fr + 2.0 * fsx));
152
- int num_submodY = int (modSize.y () / (2 * fr + 2.0 * fsy));
201
+ int num_fX = int (fbSize.x () / (2 * fr + 2.0 * fsx));
202
+ int num_fY = int (fbSize.y () / (2 * fr + 2.0 * fsy));
153
203
154
- double submod_xpos0 = -modSize .x () / 2.0 + fr + fsx;
155
- double submod_ypos0 = -modSize .y () / 2.0 + fr + fsy;
156
- int nfibers = 0 ;
204
+ double fiber_xpos0 = -(fbSize .x () / 2.0 ) + fr + fsx;
205
+ double fiber_ypos0 = -(fbSize .y () / 2.0 ) + fr + fsy;
206
+ int nfibers = 0 ;
157
207
158
208
// Fiber Holder
159
209
auto fiberholder_x = mod_x.child (_Unicode (fiberholder));
160
- double fh_dz = 0.6 * mm; // thickness of fiber holder
210
+ double fh_dz = 0.25 * mm; // thickness of fiber holder
161
211
162
212
double fh_outerbox_y = 2.0 * fr + 2.0 * fsy;
163
213
double fh_outerbox_x = 2.0 * fr + 2.0 * fsx;
@@ -176,26 +226,25 @@ static tuple<Volume, Position> build_specScFiCAL_module(const Detector& descript
176
226
int nfh = 0 ;
177
227
178
228
// placement of fibers and fiberholder
179
- for (int iy = 0 ; iy < num_submodY; iy++) {
180
-
181
- for (int ix = 0 ; ix < num_submodX; ix++) {
229
+ for (int iy = 0 ; iy < num_fY; iy++) {
230
+ for (int ix = 0 ; ix < num_fX; ix++) {
182
231
183
- double submod_pos_x = submod_xpos0 + ix * (2.0 * fr + 2.0 * fsx); // mm
184
- double submod_pos_y = submod_ypos0 + iy * (2.0 * fr + 2.0 * fsy); // mm
185
- double submod_pos_z = 0 * mm; // mm
232
+ double fiber_pos_x = fiber_xpos0 + ix * (2.0 * fr + 2.0 * fsx); // mm
233
+ double fiber_pos_y = fiber_ypos0 + iy * (2.0 * fr + 2.0 * fsy); // mm
234
+ double fiber_pos_z = 0 * mm; // mm
186
235
187
236
// placement of fiber
188
- auto fiberPV = modVol. placeVolume (fiberVol, nfibers++,
189
- Position{submod_pos_x, submod_pos_y, submod_pos_z });
237
+ auto fiberPV =
238
+ fbVol. placeVolume (fiberVol, nfibers++, Position{fiber_pos_x, fiber_pos_y, fiber_pos_z });
190
239
fiberPV.addPhysVolID (" fiber_x" , ix + 1 ).addPhysVolID (" fiber_y" , iy + 1 );
191
240
192
241
// placement of fiber holder 6.6*cm apart c-to-c
193
- int num_holders = 4 ; // which means 4 regions
194
- double fh_pos_z0 = -1 * (modSize .z () / 2.0 ) + (fh_dz / 2.0 );
242
+ int num_holders = 6 ; // which means 4 regions
243
+ double fh_pos_z0 = -1 * (fbSize .z () / 2.0 ) + (fh_dz / 2.0 );
195
244
196
245
for (int iz = 0 ; iz < num_holders; iz++) {
197
- double fh_pos_z = fh_pos_z0 + iz * ((modSize .z () - fh_dz) / (num_holders - 1 ));
198
- modVol .placeVolume (fiberholderVol, nfh++, Position{submod_pos_x, submod_pos_y , fh_pos_z});
246
+ double fh_pos_z = fh_pos_z0 + iz * ((fbSize .z () - fh_dz) / (num_holders - 1 ));
247
+ fbVol .placeVolume (fiberholderVol, nfh++, Position{fiber_pos_x, fiber_pos_y , fh_pos_z});
199
248
} // iz close
200
249
201
250
} // ix close
0 commit comments