Skip to content

Commit 4913f2c

Browse files
lorber98claude
andcommitted
[ALICE3] TRK: phiOffset column for the ML layers in the config file
The TRK configuration file (TRKBase.configFile) accepts an optional 9th column, phiOffset (degrees, counterclockwise as phi), which rotates all the staves of a ML layer about the beam axis, keeping their tilt. Existing files and the default layouts give the same geometry as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 9171fb7 commit 4913f2c

4 files changed

Lines changed: 16 additions & 7 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,8 +68,9 @@ 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]` \t `[optional_rInnRow]`
71+
* **Format:** `rInn` \t `thick` \t `tiltAngle` \t `nStaves` \t `nMods` \t `stagOffset` \t `[optional_mode]` \t `[optional_rInnRow]` \t `[optional_phiOffset]`
7272
* 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.
73+
* Stave `s` of a layer with `nStaves` = N is centred at phi = 360° · s / N (+ half a pitch if N is a multiple of 4), with stave 0 at phi = 0. `phiOffset` (degrees, counterclockwise as phi, default 0) rotates the whole layer about the beam axis: every stave is moved to phi + `phiOffset` and keeps its tilt with respect to its own radial direction. To give `phiOffset`, the mode and `rInnRow` columns must be written too.
7374

7475
**Outer Layers (OT) - Indices 5 and above**
7576
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, int rInnRow = 0);
114+
TRKMLLayer(int layerNumber, std::string layerName, float rInn, float staggerOffset, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode, int rInnRow = 0, float phiOffset = 0.f);
115115
~TRKMLLayer() override = default;
116116

117117
TGeoVolume* createStave() override;
@@ -122,6 +122,7 @@ class TRKMLLayer : public TRKSegmentedLayer
122122

123123
float mStaggerOffset;
124124
int mRInnRow = 0; // staggered layers: staves with iStave % 2 == mRInnRow sit at rInn, the others are shifted by the stagger offset
125+
float mPhiOffset = 0.f; // deg, rotation of all the staves of the layer about the beam axis (counterclockwise, as phi)
125126

126127
static constexpr double sStaveWidth = constants::ML::width;
127128
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
@@ -227,6 +227,8 @@ void Detector::configFromFile(std::string fileName)
227227
// tmpBuff[6] = matBudgetMode (optional, default = Thickness)
228228
// tmpBuff[7] = rInnRow (optional, ML only, default = 0): which staves of a staggered layer sit at
229229
// rInn, 0 = even, 1 = odd (needs tmpBuff[6]); in the flipped layer the rInn row is the outer one
230+
// tmpBuff[8] = phiOffset (optional, ML only, default = 0): rotation of all the staves of the layer about
231+
// the beam axis, in degrees, counterclockwise as phi (needs tmpBuff[6] and tmpBuff[7])
230232

231233
// Base parameters for all segmented layers (at least 5 needed)
232234
if (tmpBuff.size() < 5) {
@@ -253,8 +255,9 @@ void Detector::configFromFile(std::string fileName)
253255
matBudgetMode = static_cast<MatBudgetParamMode>(static_cast<int>(tmpBuff[6]));
254256
}
255257
const int rInnRow = (tmpBuff.size() >= 8) ? static_cast<int>(tmpBuff[7]) : 0;
258+
const float phiOffset = (tmpBuff.size() >= 9) ? tmpBuff[8] : 0.f;
256259

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

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,12 @@ 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, int rInnRow)
237-
: TRKSegmentedLayer(layerNumber, layerName, rInn, tiltAngle, numberOfStaves, numberOfModules, thickOrX2X0, mode), mStaggerOffset(staggerOffset), mRInnRow(rInnRow)
236+
TRKMLLayer::TRKMLLayer(int layerNumber, std::string layerName, float rInn, float staggerOffset, float tiltAngle, int numberOfStaves, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode, int rInnRow, float phiOffset)
237+
: TRKSegmentedLayer(layerNumber, layerName, rInn, tiltAngle, numberOfStaves, numberOfModules, thickOrX2X0, mode), mStaggerOffset(staggerOffset), mRInnRow(rInnRow), mPhiOffset(phiOffset)
238238
{
239+
if (mPhiOffset != 0.f) {
240+
LOGP(info, "Layer {}: staves rotated by {} deg about the beam axis (phiOffset)", mLayerNumber, mPhiOffset);
241+
}
239242
if (mLayerNumber == sFlippedLayerNumber) {
240243
mOuterRadius = rInn;
241244
mInnerRadius = rInn - mChipThickness;
@@ -348,8 +351,9 @@ void TRKMLLayer::createLayer(TGeoVolume* motherVolume)
348351
for (int iStave = 0; iStave < mNumberOfStaves; iStave++) {
349352
TGeoVolume* staveVol = createStave();
350353
TGeoCombiTrans* trans = new TGeoCombiTrans();
351-
// If the number of staves is a multiple of 4, rotate by half a stave to avoid having the first one exactly on the x
352-
double phi = (mNumberOfStaves % 4 == 0) ? theta * (iStave + 0.5) : theta * iStave;
354+
// If the number of staves is a multiple of 4, rotate by half a stave to avoid having the first one exactly on the x;
355+
// mPhiOffset rotates the whole layer (position and orientation of every stave) about the beam axis
356+
double phi = ((mNumberOfStaves % 4 == 0) ? theta * (iStave + 0.5) : theta * iStave) + mPhiOffset * TMath::DegToRad();
353357
double phiDeg = phi * TMath::RadToDeg();
354358
TGeoRotation* rot = new TGeoRotation("rot", phiDeg + 90 + mTiltAngle, 0, 0);
355359
trans->SetRotation(rot);

0 commit comments

Comments
 (0)