Skip to content

Commit 8bd6abe

Browse files
committed
Update TRK
1 parent e2e7eb8 commit 8bd6abe

File tree

3 files changed

+247
-59
lines changed

3 files changed

+247
-59
lines changed

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
#ifndef ALICEO2_TRK_LAYER_H
1313
#define ALICEO2_TRK_LAYER_H
1414

15+
#include "TRKBase/Specs.h"
16+
#include "TRKBase/TRKBaseParam.h"
1517
#include <TGeoManager.h>
18+
1619
#include <Rtypes.h>
1720

18-
#include "TRKBase/TRKBaseParam.h"
19-
#include "TRKBase/Specs.h"
21+
#include <string>
22+
#include <utility>
2023

2124
namespace o2
2225
{
@@ -68,7 +71,7 @@ class TRKSegmentedLayer : public TRKCylindricalLayer
6871
{
6972
public:
7073
TRKSegmentedLayer() = default;
71-
TRKSegmentedLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
74+
TRKSegmentedLayer(int layerNumber, std::string layerName, float rInn, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
7275
~TRKSegmentedLayer() override = default;
7376

7477
TGeoVolume* createSensor() override;
@@ -80,7 +83,10 @@ class TRKSegmentedLayer : public TRKCylindricalLayer
8083
void createLayer(TGeoVolume* motherVolume) override = 0;
8184

8285
protected:
86+
float mTiltAngle;
87+
8388
int mNumberOfModules;
89+
int mNumberOfStaves;
8490

8591
// Fixed parameters for the layer, to be set based on the specifications of the chip and module
8692
static constexpr double sChipWidth = constants::moduleMLOT::chip::width;
@@ -93,30 +99,41 @@ class TRKSegmentedLayer : public TRKCylindricalLayer
9399
// TGeo objects outside logical volumes can cause errors
94100
static constexpr float sLogicalVolumeThickness = 1.3;
95101

102+
// For the segmented layers, because of tilting and staggering the bounding radii can be different
103+
// from the inner radius and inner radius + thickness.
104+
// This function calculates the bounding radii based on the geometry of the stave and the tilt angle,
105+
// to ensure that the layer volume is large enough to contain all the staves without overlaps.
106+
virtual std::pair<float, float> getBoundingRadii(double staveWidth) const;
107+
96108
ClassDefOverride(TRKSegmentedLayer, 0);
97109
};
98110

99111
class TRKMLLayer : public TRKSegmentedLayer
100112
{
101113
public:
102114
TRKMLLayer() = default;
103-
TRKMLLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
115+
TRKMLLayer(int layerNumber, std::string layerName, float rInn, float staggerOffset, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
104116
~TRKMLLayer() override = default;
105117

106118
TGeoVolume* createStave() override;
107119
void createLayer(TGeoVolume* motherVolume) override;
108120

109121
private:
122+
float mStaggerOffset;
123+
110124
static constexpr double sStaveWidth = constants::ML::width;
111125

126+
// Override to account for the staggering offset present in specific ML layers
127+
std::pair<float, float> getBoundingRadii(double staveWidth) const override;
128+
112129
ClassDefOverride(TRKMLLayer, 0);
113130
};
114131

115132
class TRKOTLayer : public TRKSegmentedLayer
116133
{
117134
public:
118135
TRKOTLayer() = default;
119-
TRKOTLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
136+
TRKOTLayer(int layerNumber, std::string layerName, float rInn, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
120137
~TRKOTLayer() override = default;
121138

122139
TGeoVolume* createStave() override;
@@ -133,4 +150,4 @@ class TRKOTLayer : public TRKSegmentedLayer
133150

134151
} // namespace trk
135152
} // namespace o2
136-
#endif // ALICEO2_TRK_LAYER_H
153+
#endif // ALICEO2_TRK_LAYER_H

Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx

Lines changed: 74 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,19 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#include <FairVolume.h>
13-
14-
#include <TVirtualMC.h>
15-
#include <TVirtualMCStack.h>
16-
#include <TGeoVolume.h>
12+
#include "TRKSimulation/Detector.h"
1713

1814
#include "DetectorsBase/Stack.h"
19-
#include "TRKSimulation/Hit.h"
20-
#include "TRKSimulation/Detector.h"
15+
2116
#include "TRKBase/TRKBaseParam.h"
17+
#include "TRKSimulation/Hit.h"
2218
#include "TRKSimulation/VDGeometryBuilder.h"
2319
#include "TRKSimulation/VDSensorRegistry.h"
20+
#include <TGeoVolume.h>
21+
#include <TVirtualMC.h>
22+
#include <TVirtualMCStack.h>
23+
24+
#include <FairVolume.h>
2425

2526
#include <string>
2627
#include <type_traits>
@@ -105,14 +106,21 @@ void Detector::configMLOT()
105106
break;
106107
}
107108
case kSegmented: {
109+
const std::vector<float> tiltAngles{11.2f, 11.9f, 11.4f, 0.f, 0.f, 0.f, 0.f, 0.f};
110+
// const std::vector<float> tiltAngles{10.f, 16.1f, 19.2f, 0.f, 0.f, 0.f, 0.f, 0.f};
111+
const std::vector<int> nStaves{10, 14, 18, 26, 38, 32, 42, 56};
112+
// const std::vector<int> nStaves{10, 16, 22, 26, 38, 32, 42, 56};
108113
const std::vector<int> nMods{10, 10, 10, 10, 10, 20, 20, 20};
114+
115+
const std::vector<float> stagOffsets{0.f, 0.f, 0.f, 1.17f, 0.89f};
116+
109117
LOGP(warning, "Loading segmented configuration for ALICE3 TRK");
110118
for (int i{0}; i < 8; ++i) {
111119
std::string name = GeometryTGeo::getTRKLayerPattern() + std::to_string(i);
112-
if (i < 4) {
113-
mLayers.push_back(std::make_unique<TRKMLLayer>(i, name, rInn[i], nMods[i], thick, MatBudgetParamMode::Thickness));
120+
if (i < 5) {
121+
mLayers.push_back(std::make_unique<TRKMLLayer>(i, name, rInn[i], stagOffsets[i], tiltAngles[i], nStaves[i], nMods[i], thick, MatBudgetParamMode::Thickness));
114122
} else {
115-
mLayers.push_back(std::make_unique<TRKOTLayer>(i, name, rInn[i], nMods[i], thick, MatBudgetParamMode::Thickness));
123+
mLayers.push_back(std::make_unique<TRKOTLayer>(i, name, rInn[i], tiltAngles[i], nStaves[i], nMods[i], thick, MatBudgetParamMode::Thickness));
116124
}
117125
}
118126
break;
@@ -153,16 +161,66 @@ void Detector::configFromFile(std::string fileName)
153161
}
154162

155163
std::string name = GeometryTGeo::getTRKLayerPattern() + std::to_string(layerCount);
164+
156165
switch (trkPars.layoutMLOT) {
157-
case kCylindrical:
158-
mLayers.push_back(std::make_unique<TRKCylindricalLayer>(layerCount, name, tmpBuff[0], tmpBuff[1], tmpBuff[2], MatBudgetParamMode::Thickness));
166+
case kCylindrical: {
167+
// Cylindrical requires at least 3 parameters
168+
if (tmpBuff.size() < 3) {
169+
LOGP(fatal, "Invalid configuration for cylindrical layer {}: insufficient parameters.", layerCount);
170+
}
171+
172+
// Default mode is Thickness
173+
MatBudgetParamMode mode = MatBudgetParamMode::Thickness;
174+
if (tmpBuff.size() >= 4) {
175+
mode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[3]));
176+
}
177+
178+
mLayers.push_back(std::make_unique<TRKCylindricalLayer>(layerCount, name, tmpBuff[0], tmpBuff[1], tmpBuff[2], mode));
159179
break;
180+
}
160181
case kSegmented: {
161-
int nMods = static_cast<int>(tmpBuff[1]);
162-
if (layerCount < 4) {
163-
mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2], MatBudgetParamMode::Thickness));
182+
// Expected column mapping in the text file (separated by \t):
183+
// tmpBuff[0] = rInn
184+
// tmpBuff[1] = thick
185+
// tmpBuff[2] = tiltAngle
186+
// tmpBuff[3] = nStaves
187+
// tmpBuff[4] = nMods
188+
// tmpBuff[5] = stagOffset (required ONLY for ML)
189+
// tmpBuff[6] = matBudgetMode (optional, default = Thickness)
190+
191+
// Base parameters for all segmented layers (at least 5 needed)
192+
if (tmpBuff.size() < 5) {
193+
LOGP(fatal, "Invalid configuration for segmented layer {}: missing base parameters.", layerCount);
194+
}
195+
196+
float rInn = tmpBuff[0];
197+
float thick = tmpBuff[1];
198+
float tiltAngle = tmpBuff[2];
199+
int nStaves = static_cast<int>(tmpBuff[3]);
200+
int nMods = static_cast<int>(tmpBuff[4]);
201+
202+
// Default mode is Thickness
203+
MatBudgetParamMode mode = MatBudgetParamMode::Thickness;
204+
205+
if (layerCount < 5) {
206+
// ML layers (0 to 4) require stagOffset (index 5)
207+
if (tmpBuff.size() < 6) {
208+
LOGP(fatal, "Invalid configuration for ML layer {}: stagOffset is missing.", layerCount);
209+
}
210+
float stagOffset = tmpBuff[5];
211+
212+
if (tmpBuff.size() >= 7) {
213+
mode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[6]));
214+
}
215+
216+
mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, rInn, stagOffset, tiltAngle, nStaves, nMods, thick, mode));
164217
} else {
165-
mLayers.push_back(std::make_unique<TRKOTLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2], MatBudgetParamMode::Thickness));
218+
// OT layers (5+) do NOT have stagOffset. The optional mode is at index 5.
219+
if (tmpBuff.size() >= 6) {
220+
mode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[5]));
221+
}
222+
223+
mLayers.push_back(std::make_unique<TRKOTLayer>(layerCount, name, rInn, tiltAngle, nStaves, nMods, thick, mode));
166224
}
167225
break;
168226
}

0 commit comments

Comments
 (0)