Skip to content

Commit 04fa78b

Browse files
sawenzelclaude
andcommitted
Place the L3 coil turns explicitly instead of dividing the polyhedra
This fixes a problem in navigation with multithreaded native Geant4 and leaves the material unchanged. - The 168 coil turns were made with TGeoPgon::Divide. Geant4's G4ParameterisationPolyhedraZ rebuilds the shared master solid while navigating and allocates the new sides' thread-split data on worker threads, so a multithreaded run segfaults in the G4PolyhedraSide constructor. - L3CM is the only divided polyhedra in ALICE. The other 24 divisions are box divisions in HMPID, ZDC and FIT and are not affected. https://its.cern.ch/jira/browse/O2-7153 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent ad892fe commit 04fa78b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

Detectors/Passive/src/Magnet.cxx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,19 @@ void Magnet::ConstructGeometry()
225225
// Coils
226226
TGeoVolume* voCoilMother = new TGeoVolume("L3CM", shCoilMother, medAir);
227227
voBMother->AddNode(voCoilMother, 1, new TGeoTranslation(0., 0., 0.));
228-
// Divide into the 168 turns
229-
TGeoVolume* voCoilTurn = voCoilMother->Divide("L3CD", 3, 168, 0., 0.);
228+
// The 168 turns, placed explicitly rather than as a TGeoPgon division.
229+
// Geant4's G4ParameterisationPolyhedraZ rebuilds the shared master solid while
230+
// navigating, so a divided polyhedra crashes a multithreaded native-Geant4 run.
231+
const Int_t kNCoilTurns = 168;
232+
const Float_t kDzCoilTurn = kLCoil / kNCoilTurns;
233+
TGeoPgon* shCoilTurn = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
234+
shCoilTurn->DefineSection(0, -kDzCoilTurn, kRCoilInner - 2. * kRCoolingOuter, kRCoilOuter + 2. * kRCoolingOuter);
235+
shCoilTurn->DefineSection(1, kDzCoilTurn, kRCoilInner - 2. * kRCoolingOuter, kRCoilOuter + 2. * kRCoolingOuter);
236+
TGeoVolume* voCoilTurn = new TGeoVolume("L3CD", shCoilTurn, medAir);
237+
for (Int_t iTurn = 0; iTurn < kNCoilTurns; ++iTurn) {
238+
voCoilMother->AddNode(voCoilTurn, iTurn + 1,
239+
new TGeoTranslation(0., 0., -kLCoil + (2 * iTurn + 1) * kDzCoilTurn));
240+
}
230241
TGeoPgon* shCoils = new TGeoPgon(kStartAngle, kFullAngle, kNSides, 2);
231242
shCoils->DefineSection(0, -3., kRCoilInner, kRCoilOuter);
232243
shCoils->DefineSection(1, 3., kRCoilInner, kRCoilOuter);

0 commit comments

Comments
 (0)