Skip to content

Commit c2c75dc

Browse files
sawenzelclaude
andcommitted
Carry the MCH slat geometry in double
This removes the sub-nanometre gaps and overlaps between the layers of the MCH slats and adds a unit test. - The slat layers were placed from float sums, so neighbouring faces overlapped or were up to 2e-8 cm apart. - TGeo navigation wrote empty MCH hits at these faces, and VecGeom navigation took zero-length steps in the gaps. - The constants and placement coordinates of Station345Geometry are double now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent cc26941 commit c2c75dc

2 files changed

Lines changed: 142 additions & 76 deletions

File tree

‎Detectors/MUON/MCH/Geometry/Creator/src/Station345Geometry.cxx‎

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -43,69 +43,69 @@ namespace mch
4343
/// Constants
4444

4545
// gas
46-
const float kGasLength = 40.;
47-
const float kGasHalfHeight = 40. / 2;
48-
const float kGasHalfThickness = 0.25;
46+
const double kGasLength = 40.;
47+
const double kGasHalfHeight = 40. / 2;
48+
const double kGasHalfThickness = 0.25;
4949

5050
// PCB = gas + 2*(cathode + insulator)
51-
const float kPCBLength = kGasLength;
52-
const float kShortPCBLength = 35.;
53-
const float kRoundedPCBLength = 42.5;
54-
const float kR1PCBLength = 19.25;
55-
const float kPCBHalfHeight = 58. / 2;
51+
const double kPCBLength = kGasLength;
52+
const double kShortPCBLength = 35.;
53+
const double kRoundedPCBLength = 42.5;
54+
const double kR1PCBLength = 19.25;
55+
const double kPCBHalfHeight = 58. / 2;
5656

57-
const float kCathodeHalfThickness = 0.002 / 2;
58-
const float kInsuHalfThickness = 0.04 / 2;
57+
const double kCathodeHalfThickness = 0.002 / 2;
58+
const double kInsuHalfThickness = 0.04 / 2;
5959

60-
const float kPCBHalfThickness = kGasHalfThickness + 2 * (kCathodeHalfThickness + kInsuHalfThickness);
60+
const double kPCBHalfThickness = kGasHalfThickness + 2 * (kCathodeHalfThickness + kInsuHalfThickness);
6161

6262
// slat panel = honeycomb nomex + 2 carbon fiber skins
63-
const float kSlatPanelHalfHeight = 42.5 / 2;
63+
const double kSlatPanelHalfHeight = 42.5 / 2;
6464

65-
const float kGlueHalfThickness = 0.004 / 2;
66-
const float kNomexBulkHalfThickness = 0.025 / 2;
67-
const float kCarbonHalfThickness = 0.02 / 2;
68-
const float kNomexHalfThickness = 0.8 / 2;
65+
const double kGlueHalfThickness = 0.004 / 2;
66+
const double kNomexBulkHalfThickness = 0.025 / 2;
67+
const double kCarbonHalfThickness = 0.02 / 2;
68+
const double kNomexHalfThickness = 0.8 / 2;
6969

7070
// spacers (noryl)
71-
const float kSpacerHalfThickness = kGasHalfThickness;
72-
const float kHoriSpacerHalfHeight = 1.95 / 2;
73-
const float kVertSpacerHalfLength = 2.5 / 2;
74-
const float kRoundedSpacerHalfLength = 1.;
71+
const double kSpacerHalfThickness = kGasHalfThickness;
72+
const double kHoriSpacerHalfHeight = 1.95 / 2;
73+
const double kVertSpacerHalfLength = 2.5 / 2;
74+
const double kRoundedSpacerHalfLength = 1.;
7575

7676
// border (rohacell)
77-
const float kBorderHalfHeight = 2.5;
78-
const float kBorderHalfThickness = kGasHalfThickness;
77+
const double kBorderHalfHeight = 2.5;
78+
const double kBorderHalfThickness = kGasHalfThickness;
7979

8080
// DualSampas (parameters from the PRR)
81-
const float kDualSampaHalfLength = 3.2 / 2;
82-
const float kDualSampaHalfHeight = 2.5;
83-
const float kDualSampaHalfThickness = 0.027 / 2; // to be confirmed
84-
const float kDualSampaYPos = 0.45 + kSlatPanelHalfHeight + kDualSampaHalfHeight;
81+
const double kDualSampaHalfLength = 3.2 / 2;
82+
const double kDualSampaHalfHeight = 2.5;
83+
const double kDualSampaHalfThickness = 0.027 / 2; // to be confirmed
84+
const double kDualSampaYPos = 0.45 + kSlatPanelHalfHeight + kDualSampaHalfHeight;
8585

8686
/// Cables (copper)
8787
// Low voltage (values from AliRoot)
88-
const float kLVCableHalfHeight = 2.6 / 2;
89-
const float kLVCableHalfThickness = 0.026 / 2;
88+
const double kLVCableHalfHeight = 2.6 / 2;
89+
const double kLVCableHalfThickness = 0.026 / 2;
9090

9191
/// Support panels
92-
const float kCarbonSupportHalfThickness = 0.03 / 2;
93-
const float kGlueSupportHalfThickness = 0.02 / 2;
94-
const float kNomexSupportHalfThickness = 1.5 / 2;
95-
const float kSt3SupportHalfHeight = 361. / 2;
96-
const float kSt4SupportHalfHeight = 530. / 2;
97-
const float kSt5SupportHalfHeight = 570. / 2;
98-
const float kCh5SupportHalfLength = 162. / 2;
99-
const float kCh6SupportHalfLength = 167. / 2;
100-
const float kSt45SupportHalfLength = 260. / 2;
92+
const double kCarbonSupportHalfThickness = 0.03 / 2;
93+
const double kGlueSupportHalfThickness = 0.02 / 2;
94+
const double kNomexSupportHalfThickness = 1.5 / 2;
95+
const double kSt3SupportHalfHeight = 361. / 2;
96+
const double kSt4SupportHalfHeight = 530. / 2;
97+
const double kSt5SupportHalfHeight = 570. / 2;
98+
const double kCh5SupportHalfLength = 162. / 2;
99+
const double kCh6SupportHalfLength = 167. / 2;
100+
const double kSt45SupportHalfLength = 260. / 2;
101101

102102
// Inner radii
103-
const float kSt3Radius = 29.5;
104-
const float kSt45Radius = 37.5;
103+
const double kSt3Radius = 29.5;
104+
const double kSt45Radius = 37.5;
105105

106106
// Y position of the rounded slats
107-
const float kSt3RoundedSlatYPos = 37.8;
108-
const float kSt45RoundedSlatYPos = 38.2;
107+
const double kSt3RoundedSlatYPos = 37.8;
108+
const double kSt45RoundedSlatYPos = 38.2;
109109

110110
// PCB types {name, number of DualSampa array = (nUP bending, nDOWN bending, nUP non-bending, nDOWN non-bending)}
111111
const map<string, array<int, 4>> kPcbTypes = {{"B1N1", {10, 10, 7, 7}}, {"B2N2-", {5, 5, 4, 3}}, {"B2N2+", {5, 5, 3, 4}}, {"B3-N3", {3, 2, 2, 2}}, {"B3+N3", {2, 3, 2, 2}}, {"R1", {3, 4, 2, 3}}, {"R2", {13, 4, 9, 3}}, {"R3", {13, 1, 10, 0}}, {"S2-", {4, 5, 3, 3}}, {"S2+", {5, 4, 3, 3}}};
@@ -149,7 +149,7 @@ bool isShort(string name)
149149
return name.find('S') < name.size();
150150
}
151151

152-
TGeoCompositeShape* getRoundedShape(const char* name, float halfThickness, float xPos, float yPos, float radius)
152+
TGeoCompositeShape* getRoundedShape(const char* name, double halfThickness, double xPos, double yPos, double radius)
153153
{
154154
/// Function creating a rounded shape by creating a hole in a box (previously created !)
155155

@@ -200,7 +200,7 @@ void createPCBs()
200200

201201
// Define some necessary variables
202202
string bendName, nonbendName;
203-
float y = 0., shift = 0., length = 0.; // useful parameters for dimensions and positions
203+
double y = 0., shift = 0., length = 0.; // useful parameters for dimensions and positions
204204
int nDualSampas = 0;
205205

206206
// get the DualSampa volume
@@ -213,10 +213,10 @@ void createPCBs()
213213
auto pcb = new TGeoVolumeAssembly(name);
214214

215215
// Reset shift variables
216-
float gasShift = 0., pcbShift = 0.;
216+
double gasShift = 0., pcbShift = 0.;
217217

218-
float gasLength = kGasLength;
219-
float pcbLength = kPCBLength;
218+
double gasLength = kGasLength;
219+
double pcbLength = kPCBLength;
220220

221221
int numb = pcbName[1] - '0'; // char -> int conversion
222222

@@ -243,14 +243,14 @@ void createPCBs()
243243
nonbendName = (numb == 3) ? pcbName.substr(3) : pcbName.substr(2);
244244
}
245245

246-
float borderLength = pcbLength;
246+
double borderLength = pcbLength;
247247

248248
// create the volume of each material (a box by default)
249249
// sensitive gas
250250
auto gas = new TGeoVolume(Form("%s gas", name), new TGeoBBox(Form("%sGasBox", name), gasLength / 2., kGasHalfHeight, kGasHalfThickness), assertMedium(Medium::Gas));
251251

252-
float x = pcbLength / 2;
253-
float halfHeight = kPCBHalfHeight;
252+
double x = pcbLength / 2;
253+
double halfHeight = kPCBHalfHeight;
254254

255255
// bending cathode
256256
auto bend = new TGeoVolume(bendName.data(), new TGeoBBox(Form("%sBendBox", name), x, halfHeight, kCathodeHalfThickness), assertMedium(Medium::Copper));
@@ -267,7 +267,7 @@ void createPCBs()
267267
// change the volume shape if we are creating a rounded PCB
268268
if (isRounded(pcbName)) {
269269
// LHC beam pipe radius ("R3" -> it is a slat of a station 4 or 5)
270-
float radius = (numb == 3) ? kSt45Radius : kSt3Radius;
270+
double radius = (numb == 3) ? kSt45Radius : kSt3Radius;
271271
// y position of the PCB center w.r.t the beam pipe shape
272272
switch (numb) {
273273
case 1:
@@ -281,7 +281,7 @@ void createPCBs()
281281
break;
282282
}
283283
// compute the radius of curvature of the PCB we want to create
284-
float curvRad = radius + 2 * kRoundedSpacerHalfLength;
284+
double curvRad = radius + 2 * kRoundedSpacerHalfLength;
285285

286286
x = kRoundedPCBLength - gasLength / 2 - kVertSpacerHalfLength;
287287
gas->SetShape(getRoundedShape(Form("%sGas", name), kGasHalfThickness, x, -y, curvRad));
@@ -303,9 +303,9 @@ void createPCBs()
303303
}
304304

305305
/// place all the layers in the PCB
306-
float halfThickness = kGasHalfThickness;
306+
double halfThickness = kGasHalfThickness;
307307
pcb->AddNode(gas, 1, new TGeoTranslation(gasShift / 2, 0., 0.));
308-
float z = halfThickness;
308+
double z = halfThickness;
309309

310310
halfThickness = kCathodeHalfThickness;
311311
x = pcbShift / 2;
@@ -351,7 +351,7 @@ void createPCBs()
351351
y, z));
352352
}
353353
} // end of the MANUs loop
354-
} // end of the PCBs loop
354+
} // end of the PCBs loop
355355
}
356356

357357
//______________________________________________________________________________
@@ -375,17 +375,17 @@ void createSlats()
375375
auto slat = new TGeoVolumeAssembly(name);
376376

377377
// Reset slat variables
378-
float direction = TMath::Power(-1, isRounded(typeName)); // rounded and "normal" slats are built in opposite x-axis direction (mapping convention)
379-
float halfLength = 2 * 2 * kVertSpacerHalfLength; // vertical spacers
380-
float center = (pcbVector.size() - 1) * kGasLength / 2;
381-
float panelShift = 0.;
378+
double direction = TMath::Power(-1, isRounded(typeName)); // rounded and "normal" slats are built in opposite x-axis direction (mapping convention)
379+
double halfLength = 2 * 2 * kVertSpacerHalfLength; // vertical spacers
380+
double center = (pcbVector.size() - 1) * kGasLength / 2;
381+
double panelShift = 0.;
382382
int iVol = 0;
383383

384384
// loop over the number of PCBs in the current slat
385385
for (const auto& pcb : pcbVector) {
386386

387-
float gasLength = kGasLength;
388-
float pcbLength = kPCBLength;
387+
double gasLength = kGasLength;
388+
double pcbLength = kPCBLength;
389389

390390
switch (pcb.front()) {
391391
case 'R':
@@ -411,7 +411,7 @@ void createSlats()
411411
halfLength /= 2;
412412

413413
// compute the LV cable length
414-
float cableHalfLength = (typeName.find('3') < typeName.size()) ? kSt45SupportHalfLength : kCh5SupportHalfLength;
414+
double cableHalfLength = (typeName.find('3') < typeName.size()) ? kSt45SupportHalfLength : kCh5SupportHalfLength;
415415
if (typeName == "122200N") {
416416
cableHalfLength = kCh6SupportHalfLength;
417417
}
@@ -420,7 +420,7 @@ void createSlats()
420420
cableHalfLength -= kGasLength / 2;
421421
}
422422

423-
float rightSpacerHalfHeight = kSlatPanelHalfHeight;
423+
double rightSpacerHalfHeight = kSlatPanelHalfHeight;
424424
if (isRounded(typeName)) {
425425
halfLength -= kVertSpacerHalfLength; // don't count the vertical spacer length twice in the case of rounded slat
426426
rightSpacerHalfHeight = kGasHalfHeight; // to avoid overlaps with the horizontal spacers
@@ -433,8 +433,8 @@ void createSlats()
433433
// glue a slat panel on each side of the PCBs
434434
auto panel = new TGeoVolumeAssembly(Form("%s panel", name));
435435

436-
float x = halfLength;
437-
float halfHeight = kSlatPanelHalfHeight;
436+
double x = halfLength;
437+
double halfHeight = kSlatPanelHalfHeight;
438438

439439
// glue
440440
auto glue = new TGeoVolume(Form("%s panel glue", name), new TGeoBBox(Form("%sGlueBox", name), x, halfHeight, kGlueHalfThickness), assertMedium(Medium::Glue));
@@ -452,15 +452,15 @@ void createSlats()
452452
if (isRounded(typeName)) {
453453

454454
// LHC beam pipe radius ("NR3" -> it is a slat of a station 4 or 5)
455-
float radius = (typeName.back() == '3') ? kSt45Radius : kSt3Radius;
455+
double radius = (typeName.back() == '3') ? kSt45Radius : kSt3Radius;
456456

457457
// extreme angle values for the rounded spacer
458-
float angMin = 90., angMax = 180.;
458+
double angMin = 90., angMax = 180.;
459459

460460
// position of the slat center w.r.t the beam pipe center
461461
x = halfLength - kVertSpacerHalfLength;
462-
float y = 0.;
463-
float xRoundedPos = x + panelShift;
462+
double y = 0.;
463+
double xRoundedPos = x + panelShift;
464464

465465
// change the LV cable length for st.3 slats
466466
cableHalfLength = (isShort(typeName)) ? kCh5SupportHalfLength : kCh6SupportHalfLength;
@@ -506,8 +506,8 @@ void createSlats()
506506

507507
// place all the layers in the slat panel volume assembly (the panel origin is on the glue edge !)
508508

509-
float halfThickness = kGlueHalfThickness;
510-
float z = halfThickness;
509+
double halfThickness = kGlueHalfThickness;
510+
double z = halfThickness;
511511
panel->AddNode(glue, 1, new TGeoTranslation(0., 0., z));
512512
z += halfThickness;
513513

@@ -553,7 +553,7 @@ void createSlats()
553553
auto LVcable = gGeoManager->MakeBox(Form("%s LV cable", name), assertMedium(Medium::Copper), cableHalfLength + kVertSpacerHalfLength, kLVCableHalfHeight, kLVCableHalfThickness);
554554
x = direction * (x + cableHalfLength + direction * panelShift);
555555

556-
float y = kPCBHalfHeight - kLVCableHalfHeight;
556+
double y = kPCBHalfHeight - kLVCableHalfHeight;
557557
slat->AddNode(LVcable, 1, new TGeoTranslation(x, y, 0));
558558
slat->AddNode(LVcable, 2, new TGeoTranslation(x, -y, 0));
559559

@@ -566,7 +566,7 @@ void createSupportPanels()
566566
/// Function building the half-chamber support panels (one different per chamber)
567567

568568
// dimensions
569-
float halfLength = 0., halfHeight = 0.;
569+
double halfLength = 0., halfHeight = 0.;
570570

571571
for (int i = 5; i <= 10; i++) {
572572

@@ -582,12 +582,12 @@ void createSupportPanels()
582582
}
583583

584584
// LHC beam pipe radius at the given chamber z position
585-
float radius = (i <= 6) ? kSt3Radius : kSt45Radius;
585+
double radius = (i <= 6) ? kSt3Radius : kSt45Radius;
586586

587-
float x = -halfLength + kVertSpacerHalfLength;
587+
double x = -halfLength + kVertSpacerHalfLength;
588588

589-
float halfThickness = kNomexSupportHalfThickness;
590-
float z = 0.;
589+
double halfThickness = kNomexSupportHalfThickness;
590+
double z = 0.;
591591

592592
// create a box for the nomex volume
593593
const char* nomexName = Form("NomexSupportPanelCh%d", i);

0 commit comments

Comments
 (0)