Skip to content

Commit 9171fb7

Browse files
lorber98claude
andcommitted
[ALICE3] TRK: rInnRow column for staggered ML layers in the config file
The TRK configuration file (TRKBase.configFile) accepts an optional 8th column, rInnRow, which chooses the staves of a staggered layer (layers 3 and 4) that sit at rInn: 0 = even staves (default, previous behaviour), 1 = odd staves, i.e. stave 0 in the shifted row. Existing files and the default layouts give the same geometry as before. A value other than 0 or 1 is fatal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent fe8ac9b commit 9171fb7

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎Detectors/Upgrades/ALICE3/TRKFT3/TRK/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ Both layouts use the same configuration-file syntax (only the OT geometry implem
6868

6969
**Middle Layers (ML) - Indices 0 to 4**
7070
The first 5 valid lines are parsed as `TRKMLLayer` objects. These layers **require** a 6th parameter for the staggering offset (`stagOffset`).
71-
* **Format:** `rInn` \t `thick` \t `tiltAngle` \t `nStaves` \t `nMods` \t `stagOffset` \t `[optional_mode]`
71+
* **Format:** `rInn` \t `thick` \t `tiltAngle` \t `nStaves` \t `nMods` \t `stagOffset` \t `[optional_mode]` \t `[optional_rInnRow]`
72+
* Layers 3 and 4 are staggered: one stave out of two sits at `rInn`, the others are shifted by `stagOffset`. By default the even staves (stave 0 at phi = 0) are at `rInn`; `rInnRow` = 1 puts the odd staves there instead, i.e. stave 0 in the shifted row. In the flipped layer 3 the `rInn` row is the outer one and the shift points inwards, so there `rInnRow` = 1 puts stave 0 in the inner row; in layer 4 in the outer row. To give `rInnRow`, the mode column must be written too.
7273

7374
**Outer Layers (OT) - Indices 5 and above**
7475
From the 6th valid line onwards, lines are parsed as OT layer objects (`TRKOTLayer` for `kSegmented`, `TRKOTLayerRealistic` for `kSimplifiedRealistic`). These layers do **not** have a staggering offset. The optional mode parameter shifts to the 6th column.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class TRKMLLayer : public TRKSegmentedLayer
111111
{
112112
public:
113113
TRKMLLayer() = default;
114-
TRKMLLayer(int layerNumber, std::string layerName, float rInn, float staggerOffset, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
114+
TRKMLLayer(int layerNumber, std::string layerName, float rInn, float staggerOffset, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode, int rInnRow = 0);
115115
~TRKMLLayer() override = default;
116116

117117
TGeoVolume* createStave() override;
@@ -121,6 +121,7 @@ class TRKMLLayer : public TRKSegmentedLayer
121121
TGeoVolume* createEndOfStaveCard(); // A-side (+z) end-of-stave card, in front of the conn disk
122122

123123
float mStaggerOffset;
124+
int mRInnRow = 0; // staggered layers: staves with iStave % 2 == mRInnRow sit at rInn, the others are shifted by the stagger offset
124125

125126
static constexpr double sStaveWidth = constants::ML::width;
126127
static constexpr int sFlippedLayerNumber = 3;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ void Detector::configFromFile(std::string fileName)
225225
// tmpBuff[4] = nMods
226226
// tmpBuff[5] = stagOffset (required ONLY for ML)
227227
// tmpBuff[6] = matBudgetMode (optional, default = Thickness)
228+
// tmpBuff[7] = rInnRow (optional, ML only, default = 0): which staves of a staggered layer sit at
229+
// rInn, 0 = even, 1 = odd (needs tmpBuff[6]); in the flipped layer the rInn row is the outer one
228230

229231
// Base parameters for all segmented layers (at least 5 needed)
230232
if (tmpBuff.size() < 5) {
@@ -250,8 +252,9 @@ void Detector::configFromFile(std::string fileName)
250252
if (tmpBuff.size() >= 7) {
251253
matBudgetMode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[6]));
252254
}
255+
const int rInnRow = (tmpBuff.size() >= 8) ? static_cast<int>(tmpBuff[7]) : 0;
253256

254-
mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, rInn, stagOffset, tiltAngle, nStaves, nMods, thick, matBudgetMode));
257+
mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, rInn, stagOffset, tiltAngle, nStaves, nMods, thick, matBudgetMode, rInnRow));
255258
} else {
256259
// OT layers do NOT have stagOffset. The optional mode is at index 5.
257260
if (tmpBuff.size() >= 6) {

‎Detectors/Upgrades/ALICE3/TRKFT3/TRK/simulation/src/TRKLayer.cxx‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ std::pair<float, float> TRKSegmentedLayer::getBoundingRadii(double staveWidth) c
233233

234234
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
235235

236-
TRKMLLayer::TRKMLLayer(int layerNumber, std::string layerName, float rInn, float staggerOffset, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode)
237-
: TRKSegmentedLayer(layerNumber, layerName, rInn, tiltAngle, numberOfStaves, numberOfModules, thickOrX2X0, mode), mStaggerOffset(staggerOffset)
236+
TRKMLLayer::TRKMLLayer(int layerNumber, std::string layerName, float rInn, float staggerOffset, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode, int rInnRow)
237+
: TRKSegmentedLayer(layerNumber, layerName, rInn, tiltAngle, numberOfStaves, numberOfModules, thickOrX2X0, mode), mStaggerOffset(staggerOffset), mRInnRow(rInnRow)
238238
{
239239
if (mLayerNumber == sFlippedLayerNumber) {
240240
mOuterRadius = rInn;
@@ -243,6 +243,18 @@ TRKMLLayer::TRKMLLayer(int layerNumber, std::string layerName, float rInn, float
243243
mStaggerOffset = -staggerOffset;
244244
LOGP(info, "Layer {} is flipped: sensor and metal stack positions are switched", mLayerNumber);
245245
}
246+
if (mRInnRow != 0 && mRInnRow != 1) {
247+
LOGP(fatal, "Layer {}: rInnRow = {}, use 0 (even staves at rInn) or 1 (odd staves at rInn)", mLayerNumber, mRInnRow);
248+
}
249+
if (mRInnRow != 0) {
250+
if (mLayerNumber == 3 || mLayerNumber == 4) {
251+
// even staves (stave 0) go to the shifted row: inside the rInn row in the flipped layer, outside
252+
// otherwise (stagOffset >= 0; a negative stagOffset is not handled by getBoundingRadii)
253+
LOGP(info, "Layer {} (staggered): even staves in the {} row (rInnRow = {})", mLayerNumber, mIsFlipped ? "inner" : "outer", mRInnRow);
254+
} else {
255+
LOGP(info, "Layer {} is not staggered: rInnRow = {} has no effect", mLayerNumber, mRInnRow);
256+
}
257+
}
246258
}
247259

248260
TGeoVolume* TRKMLLayer::createStave()
@@ -342,7 +354,7 @@ void TRKMLLayer::createLayer(TGeoVolume* motherVolume)
342354
TGeoRotation* rot = new TGeoRotation("rot", phiDeg + 90 + mTiltAngle, 0, 0);
343355
trans->SetRotation(rot);
344356
// float trueRadius = (mLayerNumber == 3 || mLayerNumber == 4) ? (iStave % 2 == 0 ? mInnerRadius : mInnerRadius + mStaggerOffset) : mInnerRadius;
345-
float trueRadius = (mLayerNumber == 3 || mLayerNumber == 4) ? (iStave % 2 == 0 ? avgRadiusInner : avgRadiusOuter) : avgRadiusInner;
357+
float trueRadius = (mLayerNumber == 3 || mLayerNumber == 4) ? (iStave % 2 == mRInnRow ? avgRadiusInner : avgRadiusOuter) : avgRadiusInner;
346358
trans->SetTranslation(trueRadius * std::cos(phi), trueRadius * std::sin(phi), 0);
347359
LOGP(debug, "Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
348360
layerVol->AddNode(staveVol, iStave, trans);

0 commit comments

Comments
 (0)