Skip to content

Commit cbb481e

Browse files
committed
Fixing inconsistency in Frame medium treatment
fixes a bug where we where accessing a medium from the TGeoManager by inconsistent name, hence returning a nullptr (thanks to F. Noferini)
1 parent e09e8d2 commit cbb481e

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Detectors/Passive/src/FrameStructure.cxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ void FrameStructure::ConstructGeometry()
276276
trB77A->RegisterYourself();
277277
trB77B->RegisterYourself();
278278
TGeoCompositeShape* shB77 = new TGeoCompositeShape("shB77", "shB77A+shB77B:trB77A+shB77B:trB77B");
279-
TGeoVolume* voB77 = new TGeoVolume("B077", shB77, gGeoManager->GetMedium("FRAME_Air"));
279+
TGeoVolume* voB77 = new TGeoVolume("B077", shB77, gGeoManager->GetMedium(mAirMedID));
280280
voB77->SetName("B077"); // just to avoid a warning
281281

282282
if (mCaveIsAvailable) {
@@ -290,7 +290,7 @@ void FrameStructure::ConstructGeometry()
290290
shBREFA->DefineSection(1, 376., 280., 280.1);
291291
shBREFA->SetName("shBREFA");
292292
TGeoCompositeShape* shBREF1 = new TGeoCompositeShape("shBREF1", "shBREFA-(shB77B:trB77A+shB77B:trB77B)");
293-
TGeoVolume* voBREF = new TGeoVolume("BREF1", shBREF1, gGeoManager->GetMedium("FRAME_Air"));
293+
TGeoVolume* voBREF = new TGeoVolume("BREF1", shBREF1, gGeoManager->GetMedium(mAirMedID));
294294
voBREF->SetVisibility(0);
295295
TVirtualMC::GetMC()->Gspos("BREF1", 1, "B077", 0., 0., 0., 0, "ONLY");
296296
//
@@ -940,7 +940,7 @@ void FrameStructure::ConstructGeometry()
940940
snprintf(nameCh, 16, "BTOF%d", i);
941941
char nameMo[16];
942942
snprintf(nameMo, 16, "BSEGMO%d", i);
943-
TGeoVolume* btf = new TGeoVolume(nameCh, btofcs, gGeoManager->GetMedium("FRAME_Air"));
943+
TGeoVolume* btf = new TGeoVolume(nameCh, btofcs, gGeoManager->GetMedium(mAirMedID));
944944
btf->SetName(nameCh);
945945
gGeoManager->GetVolume(nameCh)->SetVisibility(kFALSE);
946946
TVirtualMC::GetMC()->Gspos(nameCh, 1, nameMo, 0., 0., 43.525, 0, "ONLY");
@@ -1393,14 +1393,14 @@ void FrameStructure::CreateMaterials()
13931393
auto kAirMatId = Mixture(5, "AIR$ ", aAir, zAir, dAir, 4, wAir);
13941394
auto kAluMatId = Material(9, "ALU ", 26.98, 13., 2.7, 8.9, 37.2);
13951395

1396-
mSteelMedID = Medium(65, "Stainless Steel", kSteelMatId, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1397-
mAirMedID = Medium(5, "Air", kAirMatId, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1398-
mAluMedID = Medium(9, "Aluminum", kAluMatId, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1396+
mSteelMedID = Medium(65, "FRAME_Stainless Steel", kSteelMatId, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1397+
mAirMedID = Medium(5, "FRAME_Air", kAirMatId, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
1398+
mAluMedID = Medium(9, "FRAME_Aluminum", kAluMatId, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
13991399

14001400
// do a cross check
1401-
assert(gGeoManager->GetMedium("Air")->GetId() == mAirMedID);
1402-
assert(gGeoManager->GetMedium("Aluminum")->GetId() == mAluMedID);
1403-
assert(gGeoManager->GetMedium("Stainless Steel")->GetId() == mSteelMedID);
1401+
assert(gGeoManager->GetMedium("FRAME_Air")->GetId() == mAirMedID);
1402+
assert(gGeoManager->GetMedium("FRAME_Aluminum")->GetId() == mAluMedID);
1403+
assert(gGeoManager->GetMedium("FRAME_Stainless Steel")->GetId() == mSteelMedID);
14041404
}
14051405
}
14061406
}

0 commit comments

Comments
 (0)