From 61f03b75394250c2192a069251d3d68ee894b84b Mon Sep 17 00:00:00 2001 From: Daniel Battistini Date: Tue, 28 Jan 2025 10:28:12 +0100 Subject: [PATCH 01/11] Improve modularity --- .../include/TRKSimulation/TRKLayer.h | 3 + .../ALICE3/TRK/simulation/src/TRKLayer.cxx | 111 ++++++++++++------ 2 files changed, 81 insertions(+), 33 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h index 2ddf38352ae8c..080e1a01416ec 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h @@ -39,6 +39,9 @@ class TRKLayer auto getNumber() const { return mLayerNumber; } auto getName() const { return mLayerName; } + TGeoVolume* createSensor(std::string type); + TGeoVolume* createChip(std::string type); + TGeoVolume* createStave(std::string type); void createLayer(TGeoVolume* motherVolume); private: diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index 0d7930c77bb49..3ffa30c59bf38 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -41,6 +41,82 @@ TRKLayer::TRKLayer(int layerNumber, std::string layerName, float rInn, float zLe LOGP(info, "Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius, mZ, mX2X0); } +TGeoVolume* TRKLayer::createSensor(std::string type) +{ + TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$"); + std::string sensName = Form("%s%d", GeometryTGeo::getTRKSensorPattern(), this->mLayerNumber); + + TGeoShape* sensor; + + if (type == "cylinder") { + sensor = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); + } else if (type == "flat") { + double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + sensor = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); + } else { + LOGP(fatal, "Sensor of type '{}' is not implemented", type); + } + + TGeoVolume* sensVol = new TGeoVolume(sensName.c_str(), sensor, medSi); + sensVol->SetLineColor(kYellow); + + return sensVol; +}; + +TGeoVolume* TRKLayer::createChip(std::string type) +{ + TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$"); + std::string chipName = o2::trk::GeometryTGeo::getTRKChipPattern() + std::to_string(mLayerNumber); + + TGeoShape* chip; + TGeoVolume* sensVol; + + if (type == "cylinder") { + chip = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); + sensVol = createSensor("cylinder"); + } else if (type == "flat") { + double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + chip = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); + sensVol = createSensor("flat"); + } else { + LOGP(fatal, "Sensor of type '{}' is not implemented", type); + } + + TGeoVolume* chipVol = new TGeoVolume(chipName.c_str(), chip, medSi); + LOGP(info, "Inserting {} in {} ", sensVol->GetName(), chipVol->GetName()); + chipVol->AddNode(sensVol, 1, nullptr); + chipVol->SetLineColor(kYellow); + + return chipVol; +} + +TGeoVolume* TRKLayer::createStave(std::string type) +{ + TGeoMedium* medAir = gGeoManager->GetMedium("TRK_AIR$"); + std::string staveName = o2::trk::GeometryTGeo::getTRKStavePattern() + std::to_string(mLayerNumber); + + TGeoShape* stave; + TGeoVolume* chipVol; + + if (type == "cylinder") { + stave = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); + chipVol = createChip("cylinder"); + } else if (type == "flat") { + double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); + chipVol = createChip("flat"); + } else { + LOGP(fatal, "Chip of type '{}' is not implemented", type); + } + + TGeoVolume* staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); + LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); + staveVol->AddNode(chipVol, 1, nullptr); + staveVol->SetLineColor(kYellow); + + return staveVol; +} + void TRKLayer::createLayer(TGeoVolume* motherVolume) { TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$"); @@ -56,23 +132,7 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) layerVol->SetLineColor(kYellow); if (mLayout == eLayout::kCylinder) { - TGeoTube* stave = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); - TGeoTube* chip = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); - TGeoTube* sensor = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); - - TGeoVolume* sensVol = new TGeoVolume(sensName.c_str(), sensor, medSi); - sensVol->SetLineColor(kYellow); - TGeoVolume* chipVol = new TGeoVolume(chipName.c_str(), chip, medSi); - chipVol->SetLineColor(kYellow); - TGeoVolume* staveVol = new TGeoVolume(staveName.c_str(), stave, medSi); - staveVol->SetLineColor(kYellow); - - LOGP(info, "Inserting {} in {} ", sensVol->GetName(), chipVol->GetName()); - chipVol->AddNode(sensVol, 1, nullptr); - - LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); - staveVol->AddNode(chipVol, 1, nullptr); - + auto staveVol = createStave("cylinder"); LOGP(info, "Inserting {} in {} ", staveVol->GetName(), layerVol->GetName()); layerVol->AddNode(staveVol, 1, nullptr); } else if (mLayout == eLayout::kTurboStaves) { @@ -91,16 +151,7 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) LOGP(info, "Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10); for (int iStave = 0; iStave < nStaves; iStave++) { - TGeoBBox* sensor = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); - TGeoBBox* chip = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); - TGeoBBox* stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); - - TGeoVolume* sensVol = new TGeoVolume(sensName.c_str(), sensor, medSi); - sensVol->SetLineColor(kYellow); - TGeoVolume* chipVol = new TGeoVolume(chipName.c_str(), chip, medSi); - chipVol->SetLineColor(kYellow); - TGeoVolume* staveVol = new TGeoVolume(staveName.c_str(), stave, medSi); - staveVol->SetLineColor(kYellow); + TGeoVolume* staveVol = createStave("flat"); // Put the staves in the correct position and orientation TGeoCombiTrans* trans = new TGeoCombiTrans(); @@ -109,12 +160,6 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) trans->SetRotation(rot); trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0); - LOGP(info, "Inserting {} in {} ", sensVol->GetName(), chipVol->GetName()); - chipVol->AddNode(sensVol, 1, nullptr); - - LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); - staveVol->AddNode(chipVol, 1, nullptr); - LOGP(info, "Inserting {} in {} ", staveVol->GetName(), layerVol->GetName()); layerVol->AddNode(staveVol, iStave, trans); } From 2b3e31d73509ee49c7ec78332b7d58fee7f98949 Mon Sep 17 00:00:00 2001 From: Daniel Battistini Date: Tue, 28 Jan 2025 15:21:34 +0100 Subject: [PATCH 02/11] Add Staggered layers --- .../TRK/base/include/TRKBase/TRKBaseParam.h | 1 + .../include/TRKSimulation/TRKLayer.h | 4 +- .../ALICE3/TRK/simulation/src/TRKLayer.cxx | 66 ++++++++++++++++--- 3 files changed, 60 insertions(+), 11 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h index 6c655571b3e4e..a22848ad96309 100644 --- a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h +++ b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h @@ -23,6 +23,7 @@ namespace trk enum eLayout { kCylinder = 0, kTurboStaves, + kStaggered, }; struct TRKBaseParam : public o2::conf::ConfigurableParamHelper { diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h index 080e1a01416ec..04ba13ec96a76 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h @@ -39,8 +39,8 @@ class TRKLayer auto getNumber() const { return mLayerNumber; } auto getName() const { return mLayerName; } - TGeoVolume* createSensor(std::string type); - TGeoVolume* createChip(std::string type); + TGeoVolume* createSensor(std::string type, double width=-1); + TGeoVolume* createChip(std::string type, double width=-1); TGeoVolume* createStave(std::string type); void createLayer(TGeoVolume* motherVolume); diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index 3ffa30c59bf38..9cfa8dc351436 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -41,7 +41,7 @@ TRKLayer::TRKLayer(int layerNumber, std::string layerName, float rInn, float zLe LOGP(info, "Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius, mZ, mX2X0); } -TGeoVolume* TRKLayer::createSensor(std::string type) +TGeoVolume* TRKLayer::createSensor(std::string type, double width) { TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$"); std::string sensName = Form("%s%d", GeometryTGeo::getTRKSensorPattern(), this->mLayerNumber); @@ -51,7 +51,7 @@ TGeoVolume* TRKLayer::createSensor(std::string type) if (type == "cylinder") { sensor = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); } else if (type == "flat") { - double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + if (width < 0) LOGP(fatal, "Attempting to create sensor with invalid width"); sensor = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); } else { LOGP(fatal, "Sensor of type '{}' is not implemented", type); @@ -63,7 +63,7 @@ TGeoVolume* TRKLayer::createSensor(std::string type) return sensVol; }; -TGeoVolume* TRKLayer::createChip(std::string type) +TGeoVolume* TRKLayer::createChip(std::string type, double width) { TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$"); std::string chipName = o2::trk::GeometryTGeo::getTRKChipPattern() + std::to_string(mLayerNumber); @@ -75,9 +75,9 @@ TGeoVolume* TRKLayer::createChip(std::string type) chip = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); sensVol = createSensor("cylinder"); } else if (type == "flat") { - double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + if (width < 0) LOGP(fatal, "Attempting to create chip with invalid width"); chip = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); - sensVol = createSensor("flat"); + sensVol = createSensor("flat", width); } else { LOGP(fatal, "Sensor of type '{}' is not implemented", type); } @@ -96,22 +96,42 @@ TGeoVolume* TRKLayer::createStave(std::string type) std::string staveName = o2::trk::GeometryTGeo::getTRKStavePattern() + std::to_string(mLayerNumber); TGeoShape* stave; + TGeoVolume* staveVol; TGeoVolume* chipVol; if (type == "cylinder") { stave = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); chipVol = createChip("cylinder"); + staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); + LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); + staveVol->AddNode(chipVol, 1, nullptr); } else if (type == "flat") { double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); - chipVol = createChip("flat"); + chipVol = createChip("flat", width); + staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); + LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); + staveVol->AddNode(chipVol, 1, nullptr); + } else if (type == "staggered") { + double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); + TGeoVolume *chipVolLeft = createChip("flat", mModuleWidth); + TGeoVolume *chipVolRight = createChip("flat", mModuleWidth); + staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); + + TGeoCombiTrans* transLeft = new TGeoCombiTrans(); + transLeft->SetTranslation(-mModuleWidth/2, 0, 0); + LOGP(info, "Inserting {} in {} ", chipVolLeft->GetName(), staveVol->GetName()); + staveVol->AddNode(chipVolLeft, 0, transLeft); + + TGeoCombiTrans* transRight = new TGeoCombiTrans(); + transRight->SetTranslation(mModuleWidth/2, 0.2, 0); + LOGP(info, "Inserting {} in {} ", chipVolRight->GetName(), staveVol->GetName()); + staveVol->AddNode(chipVolRight, 1, transRight); } else { LOGP(fatal, "Chip of type '{}' is not implemented", type); } - TGeoVolume* staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); - LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); - staveVol->AddNode(chipVol, 1, nullptr); staveVol->SetLineColor(kYellow); return staveVol; @@ -160,6 +180,34 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) trans->SetRotation(rot); trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0); + LOGP(info, "Inserting {} in {} ", staveVol->GetName(), layerVol->GetName()); + layerVol->AddNode(staveVol, iStave, trans); + } + } else if (mLayout == kStaggered) { + // Compute the number of staves + double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + int nStaves = (int)std::ceil(mInnerRadius * 2 * TMath::Pi() / width); + nStaves += nStaves % 2; // Require an even number of staves + + // Compute the size of the overlap region + double theta = 2 * TMath::Pi() / nStaves; + double theta1 = std::atan(width / 2 / mInnerRadius); + double st = std::sin(theta); + double ct = std::cos(theta); + double theta2 = std::atan((mInnerRadius * st - width / 2 * ct) / (mInnerRadius * ct + width / 2 * st)); + double overlap = (theta1 - theta2) * mInnerRadius; + LOGP(info, "Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10); + + for (int iStave = 0; iStave < nStaves; iStave++) { + TGeoVolume* staveVol = createStave("staggered"); + + // Put the staves in the correct position and orientation + TGeoCombiTrans* trans = new TGeoCombiTrans(); + double theta = 360. * iStave / nStaves; + TGeoRotation* rot = new TGeoRotation("rot", theta + 90, 0, 0); + trans->SetRotation(rot); + trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0); + LOGP(info, "Inserting {} in {} ", staveVol->GetName(), layerVol->GetName()); layerVol->AddNode(staveVol, iStave, trans); } From 5710258ad96e4689951e0d9d3039b6f5b603a050 Mon Sep 17 00:00:00 2001 From: Daniel Battistini Date: Tue, 28 Jan 2025 15:34:15 +0100 Subject: [PATCH 03/11] Configure middle and outer layers separately --- .../TRK/base/include/TRKBase/TRKBaseParam.h | 3 ++- .../ALICE3/TRK/simulation/src/Detector.cxx | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h index a22848ad96309..ce100f2d0447c 100644 --- a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h +++ b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h @@ -29,7 +29,8 @@ enum eLayout { struct TRKBaseParam : public o2::conf::ConfigurableParamHelper { std::string configFile = ""; float serviceTubeX0 = 0.02f; // X0 Al2O3 - eLayout layout = kCylinder; // Type of segmentation of the layers into staves + eLayout layoutML = kCylinder; // Type of segmentation for the Middle Layers + eLayout layoutOT = kCylinder; // Type of segmentation for the Outer Tracker O2ParamDef(TRKBaseParam, "TRKBase"); }; diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx index 9e69a3bd8a88f..afff7a528447e 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx @@ -116,9 +116,18 @@ void Detector::buildTRKNewVacuumVessel() mLayers.emplace_back(10, std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(10)}, 80.f, 258.f, 100.e-3); auto& trkPars = TRKBaseParam::Instance(); - mLayers[8].setLayout(trkPars.layout); - mLayers[9].setLayout(trkPars.layout); - mLayers[10].setLayout(trkPars.layout); + + // Middle layers + mLayers[3].setLayout(trkPars.layoutML); + mLayers[4].setLayout(trkPars.layoutML); + mLayers[5].setLayout(trkPars.layoutML); + mLayers[6].setLayout(trkPars.layoutML); + + // Outer tracker + mLayers[7].setLayout(trkPars.layoutOT); + mLayers[8].setLayout(trkPars.layoutOT); + mLayers[9].setLayout(trkPars.layoutOT); + mLayers[10].setLayout(trkPars.layoutOT); } void Detector::configFromFile(std::string fileName) From d2d1a44c48af4859050ae165de83bd3ac1f78ecd Mon Sep 17 00:00:00 2001 From: Daniel Battistini Date: Tue, 28 Jan 2025 16:02:49 +0100 Subject: [PATCH 04/11] [Fix] Correct double-width staves for middle layers --- .../TRK/simulation/include/TRKSimulation/TRKLayer.h | 2 +- .../Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h index 04ba13ec96a76..8a23f5efb8530 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h @@ -41,7 +41,7 @@ class TRKLayer TGeoVolume* createSensor(std::string type, double width=-1); TGeoVolume* createChip(std::string type, double width=-1); - TGeoVolume* createStave(std::string type); + TGeoVolume* createStave(std::string type, double width=-1); void createLayer(TGeoVolume* motherVolume); private: diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index 9cfa8dc351436..7c9af10bf5f53 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -90,7 +90,7 @@ TGeoVolume* TRKLayer::createChip(std::string type, double width) return chipVol; } -TGeoVolume* TRKLayer::createStave(std::string type) +TGeoVolume* TRKLayer::createStave(std::string type, double width) { TGeoMedium* medAir = gGeoManager->GetMedium("TRK_AIR$"); std::string staveName = o2::trk::GeometryTGeo::getTRKStavePattern() + std::to_string(mLayerNumber); @@ -106,7 +106,7 @@ TGeoVolume* TRKLayer::createStave(std::string type) LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); staveVol->AddNode(chipVol, 1, nullptr); } else if (type == "flat") { - double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + if (width < 0) LOGP(fatal, "Attempting to create stave with invalid width"); stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); chipVol = createChip("flat", width); staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); @@ -157,7 +157,9 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) layerVol->AddNode(staveVol, 1, nullptr); } else if (mLayout == eLayout::kTurboStaves) { // Compute the number of staves - double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) + double width = mModuleWidth; // Each stave has two modules (based on the LOI design) + if (mInnerRadius > 25) width *= 2; // Outer layers have two modules per stave + int nStaves = (int)std::ceil(mInnerRadius * 2 * TMath::Pi() / width); nStaves += nStaves % 2; // Require an even number of staves @@ -171,12 +173,12 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) LOGP(info, "Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10); for (int iStave = 0; iStave < nStaves; iStave++) { - TGeoVolume* staveVol = createStave("flat"); + TGeoVolume* staveVol = createStave("flat", width); // Put the staves in the correct position and orientation TGeoCombiTrans* trans = new TGeoCombiTrans(); double theta = 360. * iStave / nStaves; - TGeoRotation* rot = new TGeoRotation("rot", theta + 90 + 2, 0, 0); + TGeoRotation* rot = new TGeoRotation("rot", theta + 90 + 3, 0, 0); trans->SetRotation(rot); trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0); From 0709e2226196bd44e45b345013d2ddcfea014139 Mon Sep 17 00:00:00 2001 From: Daniel Battistini Date: Tue, 28 Jan 2025 16:38:22 +0100 Subject: [PATCH 05/11] Add overlap between the modules --- Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index 7c9af10bf5f53..f10ee7ecb4c40 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -120,12 +120,12 @@ TGeoVolume* TRKLayer::createStave(std::string type, double width) staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); TGeoCombiTrans* transLeft = new TGeoCombiTrans(); - transLeft->SetTranslation(-mModuleWidth/2, 0, 0); + transLeft->SetTranslation(-mModuleWidth/2 + 0.05, 0, 0); // 1mm overlap between the modules LOGP(info, "Inserting {} in {} ", chipVolLeft->GetName(), staveVol->GetName()); staveVol->AddNode(chipVolLeft, 0, transLeft); TGeoCombiTrans* transRight = new TGeoCombiTrans(); - transRight->SetTranslation(mModuleWidth/2, 0.2, 0); + transRight->SetTranslation(mModuleWidth/2 - 0.05, 0.2, 0); LOGP(info, "Inserting {} in {} ", chipVolRight->GetName(), staveVol->GetName()); staveVol->AddNode(chipVolRight, 1, transRight); } else { From f44c5e51e4c95dcaed1e5400820a3afe82c5d179 Mon Sep 17 00:00:00 2001 From: Daniel Battistini Date: Tue, 28 Jan 2025 16:50:59 +0100 Subject: [PATCH 06/11] rename config variable --- .../ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h | 4 ++-- Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h index ce100f2d0447c..81356b86fbb79 100644 --- a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h +++ b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h @@ -29,8 +29,8 @@ enum eLayout { struct TRKBaseParam : public o2::conf::ConfigurableParamHelper { std::string configFile = ""; float serviceTubeX0 = 0.02f; // X0 Al2O3 - eLayout layoutML = kCylinder; // Type of segmentation for the Middle Layers - eLayout layoutOT = kCylinder; // Type of segmentation for the Outer Tracker + eLayout layoutML = kCylinder; // Type of segmentation for the middle layers + eLayout layoutOL = kCylinder; // Type of segmentation for the outer layers O2ParamDef(TRKBaseParam, "TRKBase"); }; diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx index afff7a528447e..b9015ce578caf 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/Detector.cxx @@ -124,10 +124,10 @@ void Detector::buildTRKNewVacuumVessel() mLayers[6].setLayout(trkPars.layoutML); // Outer tracker - mLayers[7].setLayout(trkPars.layoutOT); - mLayers[8].setLayout(trkPars.layoutOT); - mLayers[9].setLayout(trkPars.layoutOT); - mLayers[10].setLayout(trkPars.layoutOT); + mLayers[7].setLayout(trkPars.layoutOL); + mLayers[8].setLayout(trkPars.layoutOL); + mLayers[9].setLayout(trkPars.layoutOL); + mLayers[10].setLayout(trkPars.layoutOL); } void Detector::configFromFile(std::string fileName) From 419e6e0044b412957a8cbd92b586fcbd3e349d6c Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 28 Jan 2025 16:02:00 +0000 Subject: [PATCH 07/11] Please consider the following formatting changes --- .../TRK/base/include/TRKBase/TRKBaseParam.h | 4 ++-- .../include/TRKSimulation/TRKLayer.h | 6 ++--- .../ALICE3/TRK/simulation/src/TRKLayer.cxx | 22 +++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h index 81356b86fbb79..9ea4bd1072d91 100644 --- a/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h +++ b/Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/TRKBaseParam.h @@ -29,8 +29,8 @@ enum eLayout { struct TRKBaseParam : public o2::conf::ConfigurableParamHelper { std::string configFile = ""; float serviceTubeX0 = 0.02f; // X0 Al2O3 - eLayout layoutML = kCylinder; // Type of segmentation for the middle layers - eLayout layoutOL = kCylinder; // Type of segmentation for the outer layers + eLayout layoutML = kCylinder; // Type of segmentation for the middle layers + eLayout layoutOL = kCylinder; // Type of segmentation for the outer layers O2ParamDef(TRKBaseParam, "TRKBase"); }; diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h index 8a23f5efb8530..ef355ec36ce2f 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/TRKLayer.h @@ -39,9 +39,9 @@ class TRKLayer auto getNumber() const { return mLayerNumber; } auto getName() const { return mLayerName; } - TGeoVolume* createSensor(std::string type, double width=-1); - TGeoVolume* createChip(std::string type, double width=-1); - TGeoVolume* createStave(std::string type, double width=-1); + TGeoVolume* createSensor(std::string type, double width = -1); + TGeoVolume* createChip(std::string type, double width = -1); + TGeoVolume* createStave(std::string type, double width = -1); void createLayer(TGeoVolume* motherVolume); private: diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index f10ee7ecb4c40..f4b940ce5dd0a 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -51,7 +51,8 @@ TGeoVolume* TRKLayer::createSensor(std::string type, double width) if (type == "cylinder") { sensor = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); } else if (type == "flat") { - if (width < 0) LOGP(fatal, "Attempting to create sensor with invalid width"); + if (width < 0) + LOGP(fatal, "Attempting to create sensor with invalid width"); sensor = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); } else { LOGP(fatal, "Sensor of type '{}' is not implemented", type); @@ -75,7 +76,8 @@ TGeoVolume* TRKLayer::createChip(std::string type, double width) chip = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); sensVol = createSensor("cylinder"); } else if (type == "flat") { - if (width < 0) LOGP(fatal, "Attempting to create chip with invalid width"); + if (width < 0) + LOGP(fatal, "Attempting to create chip with invalid width"); chip = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); sensVol = createSensor("flat", width); } else { @@ -94,7 +96,7 @@ TGeoVolume* TRKLayer::createStave(std::string type, double width) { TGeoMedium* medAir = gGeoManager->GetMedium("TRK_AIR$"); std::string staveName = o2::trk::GeometryTGeo::getTRKStavePattern() + std::to_string(mLayerNumber); - + TGeoShape* stave; TGeoVolume* staveVol; TGeoVolume* chipVol; @@ -106,7 +108,8 @@ TGeoVolume* TRKLayer::createStave(std::string type, double width) LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); staveVol->AddNode(chipVol, 1, nullptr); } else if (type == "flat") { - if (width < 0) LOGP(fatal, "Attempting to create stave with invalid width"); + if (width < 0) + LOGP(fatal, "Attempting to create stave with invalid width"); stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); chipVol = createChip("flat", width); staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); @@ -115,17 +118,17 @@ TGeoVolume* TRKLayer::createStave(std::string type, double width) } else if (type == "staggered") { double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design) stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); - TGeoVolume *chipVolLeft = createChip("flat", mModuleWidth); - TGeoVolume *chipVolRight = createChip("flat", mModuleWidth); + TGeoVolume* chipVolLeft = createChip("flat", mModuleWidth); + TGeoVolume* chipVolRight = createChip("flat", mModuleWidth); staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); TGeoCombiTrans* transLeft = new TGeoCombiTrans(); - transLeft->SetTranslation(-mModuleWidth/2 + 0.05, 0, 0); // 1mm overlap between the modules + transLeft->SetTranslation(-mModuleWidth / 2 + 0.05, 0, 0); // 1mm overlap between the modules LOGP(info, "Inserting {} in {} ", chipVolLeft->GetName(), staveVol->GetName()); staveVol->AddNode(chipVolLeft, 0, transLeft); TGeoCombiTrans* transRight = new TGeoCombiTrans(); - transRight->SetTranslation(mModuleWidth/2 - 0.05, 0.2, 0); + transRight->SetTranslation(mModuleWidth / 2 - 0.05, 0.2, 0); LOGP(info, "Inserting {} in {} ", chipVolRight->GetName(), staveVol->GetName()); staveVol->AddNode(chipVolRight, 1, transRight); } else { @@ -158,7 +161,8 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) } else if (mLayout == eLayout::kTurboStaves) { // Compute the number of staves double width = mModuleWidth; // Each stave has two modules (based on the LOI design) - if (mInnerRadius > 25) width *= 2; // Outer layers have two modules per stave + if (mInnerRadius > 25) + width *= 2; // Outer layers have two modules per stave int nStaves = (int)std::ceil(mInnerRadius * 2 * TMath::Pi() / width); nStaves += nStaves % 2; // Require an even number of staves From 6c073b2b6f17b6d422f2392595ab2984b75eda5a Mon Sep 17 00:00:00 2001 From: Matteo Concas Date: Thu, 30 Jan 2025 10:15:26 +0100 Subject: [PATCH 08/11] Update Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx --- Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index f4b940ce5dd0a..66d44bea6a290 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -108,8 +108,9 @@ TGeoVolume* TRKLayer::createStave(std::string type, double width) LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName()); staveVol->AddNode(chipVol, 1, nullptr); } else if (type == "flat") { - if (width < 0) + if (width < 0) { LOGP(fatal, "Attempting to create stave with invalid width"); + } stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); chipVol = createChip("flat", width); staveVol = new TGeoVolume(staveName.c_str(), stave, medAir); From 59943f9c490c4355022139ef5b64b84bc97e5159 Mon Sep 17 00:00:00 2001 From: Matteo Concas Date: Thu, 30 Jan 2025 10:15:31 +0100 Subject: [PATCH 09/11] Update Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx --- Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index 66d44bea6a290..00ab42bf9bc53 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -51,8 +51,9 @@ TGeoVolume* TRKLayer::createSensor(std::string type, double width) if (type == "cylinder") { sensor = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); } else if (type == "flat") { - if (width < 0) + if (width < 0) { LOGP(fatal, "Attempting to create sensor with invalid width"); + } sensor = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); } else { LOGP(fatal, "Sensor of type '{}' is not implemented", type); From e5a797be5ec2a940bfc424b0b992620bcede9635 Mon Sep 17 00:00:00 2001 From: Matteo Concas Date: Thu, 30 Jan 2025 10:15:36 +0100 Subject: [PATCH 10/11] Update Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx --- Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index 00ab42bf9bc53..d2d68785d9f37 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -163,8 +163,9 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume) } else if (mLayout == eLayout::kTurboStaves) { // Compute the number of staves double width = mModuleWidth; // Each stave has two modules (based on the LOI design) - if (mInnerRadius > 25) + if (mInnerRadius > 25) { width *= 2; // Outer layers have two modules per stave + } int nStaves = (int)std::ceil(mInnerRadius * 2 * TMath::Pi() / width); nStaves += nStaves % 2; // Require an even number of staves From 457652a05fb088a29bb07920931250afe4092886 Mon Sep 17 00:00:00 2001 From: Matteo Concas Date: Thu, 30 Jan 2025 10:15:40 +0100 Subject: [PATCH 11/11] Update Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx --- Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx index d2d68785d9f37..e6b00f6e96425 100644 --- a/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx +++ b/Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKLayer.cxx @@ -77,8 +77,9 @@ TGeoVolume* TRKLayer::createChip(std::string type, double width) chip = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); sensVol = createSensor("cylinder"); } else if (type == "flat") { - if (width < 0) + if (width < 0) { LOGP(fatal, "Attempting to create chip with invalid width"); + } chip = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); sensVol = createSensor("flat", width); } else {