Skip to content

Commit 53690be

Browse files
author
Berkin Ulukutlu
committed
ALICE3/FT3: fix magnetic field silently disabled when FT3 is active
FT3Module::initialize_materials() registered its six support materials via raw `new TGeoMedium(name, id, mat), bypassing o2::base::MaterialManager. That 3-argument TGeoMedium constructor leaves all tracking parameters, including ifield, at 0, and since these ids were never coordinated with MaterialManager's auto-assigned global ids, they collided with other detectors' media -notably the CAVE air medium that fills the gaps between TRK's barrel layers. Route these six materials/media through MaterialManager instead.
1 parent aa2e101 commit 53690be

1 file changed

Lines changed: 69 additions & 32 deletions

File tree

‎Detectors/Upgrades/ALICE3/TRKFT3/FT3/simulation/src/FT3Module.cxx‎

Lines changed: 69 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
#include "FT3Simulation/FT3Module.h"
1616
#include "FT3Base/FT3BaseParam.h"
17+
#include "DetectorsBase/MaterialManager.h"
18+
#include "DetectorsBase/Detector.h"
1719
#include <TGeoManager.h>
1820
#include <TGeoMaterial.h>
1921
#include <TGeoMedium.h>
@@ -54,42 +56,77 @@ void FT3Module::initialize_materials()
5456
return;
5557
}
5658

57-
TGeoManager* geoManager = gGeoManager;
58-
59-
auto* itsH = new TGeoElement("FT3_H", "Hydrogen", 1, 1.00794);
60-
auto* itsC = new TGeoElement("FT3_C", "Carbon", 6, 12.0107);
61-
auto* itsO = new TGeoElement("FT3_O", "Oxygen", 8, 15.994);
62-
63-
siliconMat = new TGeoMaterial("FT3_Silicon", 28.0855, 14, 2.33);
64-
siliconMed = new TGeoMedium("FT3_Silicon", 1, siliconMat);
65-
66-
copperMat = new TGeoMaterial("FT3_Copper", 63.546, 29, 8.96);
67-
copperMed = new TGeoMedium("FT3_Copper", 2, copperMat);
68-
69-
TGeoMixture* kaptonMat = new TGeoMixture("FT3_Kapton", 4, 1.346); // C22 H10 N2 O5
70-
71-
kaptonMat->DefineElement(0, 12.0107, 6, 0.5641); // Carbon
72-
kaptonMat->DefineElement(1, 1.00794, 1, 0.2564); // Hydrogen
73-
kaptonMat->DefineElement(2, 14.0067, 7, 0.0513); // Nitrogen
74-
kaptonMat->DefineElement(3, 15.999, 8, 0.1282); // Oxygen
75-
kaptonMed = new TGeoMedium("FT3_Kapton", 3, kaptonMat);
59+
// NOTE: these materials/media used to be registered directly via
60+
// `new TGeoMaterial(...)` / `new TGeoMedium(name, rawId, ...)` with small
61+
// hand-picked ids (1-6). That bypasses o2::base::MaterialManager, whose job
62+
// is to hand out globally-unique medium ids across all detectors. Since the
63+
// 3-argument TGeoMedium constructor also leaves all tracking parameters
64+
// (including ifield) at 0, and Geant4VMC's TG4GeometryManager::
65+
// FillMediumMapFromRoot() maps ALL TGeoMedium objects into one global table
66+
// keyed purely by that raw numeric id (last one processed wins), these raw
67+
// ids collided with other detectors' properly-assigned medium ids (e.g. the
68+
// CAVE air medium that fills the gaps between TRK layers) and silently
69+
// switched the magnetic field off for them. Route through MaterialManager
70+
// instead, like every other detector (incl. FT3's own Detector.cxx) does,
71+
// so ids are safely auto-assigned and never collide.
72+
auto& matmgr = o2::base::MaterialManager::Instance();
73+
74+
int ifield = 2;
75+
float fieldm = 10.0;
76+
o2::base::Detector::initFieldTrackingParams(ifield, fieldm);
77+
78+
float tmaxfdSi = 0.1;
79+
float stemaxSi = 0.0075;
80+
float deemaxSi = 0.1;
81+
float epsilSi = 1.0E-4;
82+
float stminSi = 0.0;
83+
84+
float tmaxfdPas = 0.1;
85+
float stemaxPas = 1.0;
86+
float deemaxPas = 0.1;
87+
float epsilPas = 1.0E-4;
88+
float stminPas = 0.0;
89+
90+
// local ids 10-15: chosen to not clash with FT3's own createMaterials() (1, 3)
91+
matmgr.Material("FT3", 10, "Silicon", 28.0855, 14, 2.33, 0, 0);
92+
matmgr.Medium("FT3", 10, "Silicon", 10, 0, ifield, fieldm, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi);
93+
siliconMed = matmgr.getTGeoMedium("FT3", 10);
94+
siliconMat = siliconMed->GetMaterial();
95+
96+
matmgr.Material("FT3", 11, "Copper", 63.546, 29, 8.96, 0, 0);
97+
matmgr.Medium("FT3", 11, "Copper", 11, 0, ifield, fieldm, tmaxfdPas, stemaxPas, deemaxPas, epsilPas, stminPas);
98+
copperMed = matmgr.getTGeoMedium("FT3", 11);
99+
copperMat = copperMed->GetMaterial();
100+
101+
// Kapton: C22 H10 N2 O5, by weight fraction
102+
float aKapton[4] = {12.0107, 1.00794, 14.0067, 15.999};
103+
float zKapton[4] = {6., 1., 7., 8.};
104+
float wKapton[4] = {0.5641, 0.2564, 0.0513, 0.1282};
105+
matmgr.Mixture("FT3", 12, "Kapton", aKapton, zKapton, 1.346, 4, wKapton);
106+
matmgr.Medium("FT3", 12, "Kapton", 12, 0, ifield, fieldm, tmaxfdPas, stemaxPas, deemaxPas, epsilPas, stminPas);
107+
kaptonMed = matmgr.getTGeoMedium("FT3", 12);
108+
kaptonMat = dynamic_cast<TGeoMixture*>(kaptonMed->GetMaterial());
76109

77110
// TODO: Check with Rene the exact type of carbon fiber
78-
carbonFiberMat = new TGeoMaterial("FT3_Carbon", 12.0107, 6, 1.8);
79-
carbonFiberMed = new TGeoMedium("FT3_Carbon", 6, carbonFiberMat);
80-
81-
// Epoxy: C18 H19 O3
82-
auto* itsEpoxy = new TGeoMixture("FT3_Epoxy", 3);
83-
itsEpoxy->AddElement(itsC, 18);
84-
itsEpoxy->AddElement(itsH, 19);
85-
itsEpoxy->AddElement(itsO, 3);
86-
itsEpoxy->SetDensity(2.186);
87-
88-
epoxyMed = new TGeoMedium("FT3_Epoxy", 4, itsEpoxy);
111+
matmgr.Material("FT3", 13, "Carbon", 12.0107, 6, 1.8, 0, 0);
112+
matmgr.Medium("FT3", 13, "Carbon", 13, 0, ifield, fieldm, tmaxfdPas, stemaxPas, deemaxPas, epsilPas, stminPas);
113+
carbonFiberMed = matmgr.getTGeoMedium("FT3", 13);
114+
carbonFiberMat = carbonFiberMed->GetMaterial();
115+
116+
// Epoxy: C18 H19 O3, by atom count (negative nlmat)
117+
float aEpoxy[3] = {12.0107, 1.00794, 15.999};
118+
float zEpoxy[3] = {6., 1., 8.};
119+
float wEpoxy[3] = {18., 19., 3.};
120+
matmgr.Mixture("FT3", 14, "Epoxy", aEpoxy, zEpoxy, 2.186, -3, wEpoxy);
121+
matmgr.Medium("FT3", 14, "Epoxy", 14, 0, ifield, fieldm, tmaxfdPas, stemaxPas, deemaxPas, epsilPas, stminPas);
122+
epoxyMed = matmgr.getTGeoMedium("FT3", 14);
89123
epoxyMat = epoxyMed->GetMaterial();
90124

91-
AluminumMat = new TGeoMaterial("Aluminum", 26.98, 13, 2.7);
92-
AluminumMed = new TGeoMedium("Aluminum", 5, AluminumMat);
125+
matmgr.Material("FT3", 15, "Aluminum", 26.98, 13, 2.7, 0, 0);
126+
matmgr.Medium("FT3", 15, "Aluminum", 15, 0, ifield, fieldm, tmaxfdPas, stemaxPas, deemaxPas, epsilPas, stminPas);
127+
AluminumMed = matmgr.getTGeoMedium("FT3", 15);
128+
AluminumMat = AluminumMed->GetMaterial();
129+
93130
LOG(debug) << "FT3Module: done initialize_materials";
94131
}
95132

0 commit comments

Comments
 (0)