Skip to content

Commit 53c3479

Browse files
committed
build otof stave in a loop
1 parent 893a2ae commit 53c3479

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • Detectors/Upgrades/ALICE3/IOTOF/simulation/src

Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Layer.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,12 @@ void OTOFLayer::createLayer(TGeoVolume* motherVolume)
417417
}
418418

419419
// Now we build a stave from two substave
420-
LOGP(info, "oTOF: Creating substave {}/{} for stave {}/{}", 1, 2, 1, 1);
421-
auto* translation1 = new TGeoTranslation(-0.5 * (subStaveSizeX) + 0.5 * subStavesOverlapX, -0.5 * subStavesDistanceY, 0);
422-
staveVol->AddNode(subStaveVol, 1, translation1);
423-
LOGP(info, "oTOF: Creating substave {}/{} for stave {}/{}", 2, 2, 1, 1);
424-
auto* translation2 = new TGeoTranslation(0.5 * (subStaveSizeX) - 0.5 * subStavesOverlapX, 0.5 * subStavesDistanceY, 0);
425-
staveVol->AddNode(subStaveVol, 2, translation2);
420+
for (int i = 0; i < 2; ++i) {
421+
LOGP(info, "oTOF: Creating substave {}/{} for stave {}/{}", i + 1, 2, 1, 1);
422+
int sign = i > 0 ? 1 : -1;
423+
auto* translation2 = new TGeoTranslation(sign * 0.5 * (subStaveSizeX) - sign * 0.5 * subStavesOverlapX, sign * 0.5 * subStavesDistanceY, 0);
424+
staveVol->AddNode(subStaveVol, i + 1, translation2);
425+
}
426426

427427
// We finally put all the staves in the layer
428428
for (int i = 0; i < mStaves.first; ++i) {

0 commit comments

Comments
 (0)