Skip to content

Commit 2871e5f

Browse files
committed
wip(iris): import stash-pre-rebase changes
(cherry picked from commit d291e57a2f121c4f19f1fb7ccd8031328abc9ce8)
1 parent f72e1a2 commit 2871e5f

File tree

13 files changed

+1460
-34
lines changed

13 files changed

+1460
-34
lines changed

Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/GeometryTGeo.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
4242
};
4343
static const char* getTRKVolPattern() { return sVolumeName.c_str(); }
4444
static const char* getTRKLayerPattern() { return sLayerName.c_str(); }
45+
static const char* getVDLayerPattern() { return sVDLayerName.c_str(); }
46+
static const char* getVDDiskPattern() { return sVDDiskName.c_str(); }
4547
static const char* getTRKPetalPattern() { return sPetalName.c_str(); }
4648
static const char* getTRKPetalDiskPattern() { return sPetalDiskName.c_str(); }
4749
static const char* getTRKPetalLayerPattern() { return sPetalLayerName.c_str(); }
4850
static const char* getTRKStavePattern() { return sStaveName.c_str(); }
4951
static const char* getTRKChipPattern() { return sChipName.c_str(); }
5052
static const char* getTRKSensorPattern() { return sSensorName.c_str(); }
53+
static const char* getVDSensorPattern() { return sVDSensorName.c_str(); }
5154
static const char* getTRKWrapVolPattern() { return sWrapperVolumeName.c_str(); }
5255

5356
int getNumberOfChips() const { return mSize; }
@@ -141,6 +144,9 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
141144

142145
static std::string sVolumeName;
143146
static std::string sLayerName;
147+
static std::string sVDLayerName;
148+
static std::string sVDDiskName;
149+
static std::string sVDSensorName;
144150
static std::string sPetalName;
145151
static std::string sPetalDiskName;
146152
static std::string sPetalLayerName;

Detectors/Upgrades/ALICE3/TRK/base/src/GeometryTGeo.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ std::unique_ptr<o2::trk::GeometryTGeo> GeometryTGeo::sInstance;
2424
// Names
2525
std::string GeometryTGeo::sVolumeName = "TRKV";
2626
std::string GeometryTGeo::sLayerName = "TRKLayer";
27-
std::string GeometryTGeo::sPetalName = "PETALCASE";
2827
std::string GeometryTGeo::sPetalDiskName = "DISK";
2928
std::string GeometryTGeo::sPetalLayerName = "LAYER";
3029
std::string GeometryTGeo::sStaveName = "TRKStave";
3130
std::string GeometryTGeo::sChipName = "TRKChip";
3231
std::string GeometryTGeo::sSensorName = "TRKSensor";
32+
33+
std::string GeometryTGeo::sPetalName = "Petal";
34+
std::string GeometryTGeo::sVDLayerName = "Layer";
35+
std::string GeometryTGeo::sVDDiskName = "Disk";
36+
std::string GeometryTGeo::sVDSensorName = "VDSensor";
3337
std::string GeometryTGeo::sWrapperVolumeName = "TRKUWrapVol"; ///< Wrapper volume name, not implemented at the moment
3438

3539
o2::trk::GeometryTGeo::~GeometryTGeo()

Detectors/Upgrades/ALICE3/TRK/simulation/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ o2_add_library(TRKSimulation
2121
src/TRKPetalCase.cxx
2222
src/TRKPetalLayer.cxx
2323
src/TRKPetalDisk.cxx
24+
src/VDLayer.cxx
25+
src/VDGeometryBuilder.cxx
2426
PUBLIC_LINK_LIBRARIES O2::TRKBase
2527
O2::FT3Simulation
2628
O2::ITSMFTSimulation
@@ -38,4 +40,6 @@ o2_target_root_dictionary(TRKSimulation
3840
include/TRKSimulation/TRKPetalCase.h
3941
include/TRKSimulation/TRKPetalLayer.h
4042
include/TRKSimulation/TRKPetalDisk.h
43+
include/TRKSimulation/VDLayer.h
44+
include/TRKSimulation/VDGeometryBuilder.h
4145
include/TRKSimulation/DPLDigitizerParam.h)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Detector : public o2::base::DetImpl<Detector>
7171
}
7272

7373
void configDefault();
74-
void buildTRKNewVacuumVessel();
74+
void buildTRKMiddleOuterLayers();
7575
void configFromFile(std::string fileName = "alice3_TRK_layout.txt");
7676
void configToFile(std::string fileName = "alice3_TRK_layout.txt");
7777

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef O2_TRK_VDGEOMETRYBUILDER_H
13+
#define O2_TRK_VDGEOMETRYBUILDER_H
14+
15+
class TGeoVolume;
16+
17+
#include <string>
18+
#include <vector>
19+
20+
namespace o2::trk
21+
{
22+
23+
// Build full VD for each design.
24+
// Each function builds one local petal assembly (walls + layers + disks)
25+
// and then places/rotates the petal once into the mother volume.
26+
27+
void createIRIS4Geometry(TGeoVolume* motherVolume); // 4 petals, cylindrical L0
28+
void createIRIS4aGeometry(TGeoVolume* motherVolume); // 3 petals, cylindrical L0
29+
void createIRIS5Geometry(TGeoVolume* motherVolume); // 4 petals, rectangular L0
30+
31+
void createSinglePetalDebug(TGeoVolume* motherVolume, int petalID = 0, int nPetals = 4, bool rectangularL0 = false);
32+
33+
} // namespace o2::trk
34+
35+
#endif // O2_TRK_VDGEOMETRYBUILDER_H
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifndef ALICEO2_VD_LAYER_H
13+
#define ALICEO2_VD_LAYER_H
14+
15+
#include <string>
16+
#include <Rtypes.h>
17+
18+
class TGeoVolume;
19+
class TGeoMatrix;
20+
21+
namespace o2
22+
{
23+
namespace trk
24+
{
25+
26+
// Base class for a VD layer
27+
class VDLayer
28+
{
29+
public:
30+
VDLayer() = default;
31+
VDLayer(int layerNumber, const std::string& layerName, double layerX2X0);
32+
virtual ~VDLayer() = default;
33+
34+
// Create the layer (AIR container + sensors) and insert it into mother
35+
virtual void createLayer(TGeoVolume* motherVolume, TGeoMatrix* combiTrans = nullptr) const = 0;
36+
37+
double getChipThickness() const { return mChipThickness; }
38+
39+
protected:
40+
int mLayerNumber{0};
41+
std::string mLayerName;
42+
double mX2X0{0.f}; // Radiation length in units of X0
43+
double mChipThickness{0.f}; // thickness derived from X/X0
44+
double mModuleWidth{4.54f}; // cm
45+
46+
// ClassDef(VDLayer, 1)
47+
};
48+
49+
// Cylindrical segment layer
50+
class VDCylindricalLayer : public VDLayer
51+
{
52+
public:
53+
VDCylindricalLayer(int layerNumber, const std::string& layerName, double layerX2X0,
54+
double radius, double phiSpanDeg, double lengthZ, double lengthSensZ);
55+
56+
TGeoVolume* createSensor() const; // builds the sensor volume
57+
void createLayer(TGeoVolume* motherVolume, TGeoMatrix* combiTrans = nullptr) const override;
58+
59+
private:
60+
double mRadius{0.f};
61+
double mPhiSpanDeg{0.f}; // degrees
62+
double mLengthZ{0.f}; // layer container length in Z
63+
double mLengthSensZ{0.f}; // sensor length in Z
64+
65+
// ClassDef(VDCylindricalLayer, 1)
66+
};
67+
68+
// Rectangular segment layer
69+
class VDRectangularLayer : public VDLayer
70+
{
71+
public:
72+
VDRectangularLayer(int layerNumber, const std::string& layerName, double layerX2X0,
73+
double width, double lengthZ, double lengthSensZ);
74+
75+
TGeoVolume* createSensor() const;
76+
void createLayer(TGeoVolume* motherVolume, TGeoMatrix* combiTrans = nullptr) const override;
77+
78+
private:
79+
double mWidth{0.f};
80+
double mLengthZ{0.f};
81+
double mLengthSensZ{0.f};
82+
83+
// ClassDef(VDRectangularLayer, 1)
84+
};
85+
86+
// Disk segment layer
87+
class VDDiskLayer : public VDLayer
88+
{
89+
public:
90+
VDDiskLayer(int layerNumber, const std::string& layerName, double layerX2X0,
91+
double rMin, double rMax, double phiSpanDeg, double zPos);
92+
93+
TGeoVolume* createSensor() const;
94+
void createLayer(TGeoVolume* motherVolume, TGeoMatrix* combiTrans = nullptr) const override;
95+
96+
double getZPosition() const { return mZPos; }
97+
98+
private:
99+
double mRMin{0.f};
100+
double mRMax{0.f};
101+
double mPhiSpanDeg{0.f}; // degrees
102+
double mZPos{0.f}; // placement along Z
103+
104+
// ClassDef(VDDiskLayer, 1)
105+
};
106+
107+
} // namespace trk
108+
} // namespace o2
109+
110+
#endif // ALICEO2_VD_LAYER_H
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef O2_TRK_VDSENSORREGISTRY_H
2+
#define O2_TRK_VDSENSORREGISTRY_H
3+
4+
#include <string>
5+
#include <vector>
6+
7+
namespace o2::trk
8+
{
9+
10+
struct VDSensorDesc {
11+
enum class Kind { Barrel,
12+
Disk };
13+
std::string name; // sensor volume name
14+
int petal = -1;
15+
Kind kind = Kind::Barrel;
16+
int idx = -1; // layer or disk index
17+
};
18+
19+
// Accessor (defined in VDGeometryBuilder.cxx)
20+
std::vector<VDSensorDesc>& vdSensorRegistry();
21+
22+
// Utilities (defined in VDGeometryBuilder.cxx)
23+
void clearVDSensorRegistry();
24+
void registerSensor(const std::string& volName, int petal, VDSensorDesc::Kind kind, int idx);
25+
26+
} // namespace o2::trk
27+
#endif

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

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919
#include "ITSMFTSimulation/Hit.h"
2020
#include "TRKSimulation/Detector.h"
2121
#include "TRKBase/TRKBaseParam.h"
22+
#include "TRKSimulation/VDGeometryBuilder.h"
23+
#include "TRKSimulation/VDSensorRegistry.h"
2224

2325
using o2::itsmft::Hit;
2426

2527
namespace o2
2628
{
2729
namespace trk
2830
{
31+
2932
float getDetLengthFromEta(const float eta, const float radius)
3033
{
3134
return 2. * (10. + radius * std::cos(2 * std::atan(std::exp(-eta))));
@@ -48,7 +51,7 @@ Detector::Detector(bool active)
4851
if (trkPars.configFile != "") {
4952
configFromFile(trkPars.configFile);
5053
} else {
51-
buildTRKNewVacuumVessel();
54+
buildTRKMiddleOuterLayers();
5255
configToFile();
5356
configServices();
5457
}
@@ -115,7 +118,7 @@ void Detector::configDefault()
115118
mLayers.emplace_back(7, std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(7)}, 80.f, 258.f, 100.e-3);
116119
}
117120

118-
void Detector::buildTRKNewVacuumVessel()
121+
void Detector::buildTRKMiddleOuterLayers()
119122
{
120123
// Build the TRK detector according to changes proposed during
121124
// https://indico.cern.ch/event/1407704/
@@ -125,9 +128,6 @@ void Detector::buildTRKNewVacuumVessel()
125128
mLayers.clear();
126129

127130
LOGP(warning, "Loading \"After Upgrade Days March 2024\" configuration for ALICE3 TRK");
128-
// mLayers.emplace_back(0, std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(0)}, 0.5f, 50.f, 100.e-4);
129-
// mLayers.emplace_back(1, std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(1)}, 1.2f, 50.f, 100.e-4);
130-
// mLayers.emplace_back(2, std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(2)}, 2.5f, 50.f, 100.e-4);
131131
mLayers.emplace_back(0, std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(0)}, 7.f, 124.f, 100.e-3);
132132
LOGP(info, "TRKLayer created. Name: {}", std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(0)});
133133
mLayers.emplace_back(1, std::string{GeometryTGeo::getTRKLayerPattern() + std::to_string(1)}, 9.f, 124.f, 100.e-3);
@@ -260,13 +260,16 @@ void Detector::createGeometry()
260260

261261
// Add service for inner tracker
262262
mServices.createServices(vTRK);
263-
mPetalCases.clear();
264-
// Add petal cases (the sensitive layers inside the petal cases get constructed here too)
265-
auto& trkPars = TRKBaseParam::Instance();
266-
for (Int_t petalCaseNumber = 0; petalCaseNumber < sNumberVDPetalCases; ++petalCaseNumber) {
267-
mPetalCases.emplace_back(petalCaseNumber, vTRK, trkPars.irisOpen);
268-
mServices.excavateFromVacuum(mPetalCases[petalCaseNumber].getFullName());
269-
}
263+
264+
// Build the VD using the petal builder
265+
o2::trk::clearVDSensorRegistry();
266+
267+
// Choose the VD design (here: IRIS4 by default).
268+
// You can wire this to a parameter in TRKBaseParam if desired.
269+
// Alternatives: createIRIS5Geometry(vVD); createIRIS4aGeometry(vVD);
270+
o2::trk::createIRIS4Geometry(vTRK);
271+
272+
mServices.excavateFromVacuum("IRIS_CUTOUTsh");
270273
mServices.registerVacuum(vTRK);
271274
}
272275

@@ -291,26 +294,18 @@ void Detector::defineSensitiveVolumes()
291294
TString volumeName;
292295
LOGP(info, "Adding TRK Sensitive Volumes");
293296

294-
// Add petal case sensitive volumes
295-
for (int petalCase = 0; petalCase < sNumberVDPetalCases; ++petalCase) {
296-
// Petal layers
297-
for (int petalLayer = 0; petalLayer < mPetalCases[petalCase].mPetalLayers.size(); ++petalLayer) {
298-
volumeName = mPetalCases[petalCase].mPetalLayers[petalLayer].getSensorName();
299-
if (petalLayer == 0) {
300-
mFirstOrLastLayers.push_back(volumeName.Data());
301-
}
302-
LOGP(info, "Trying {}", volumeName.Data());
303-
v = geoManager->GetVolume(volumeName.Data());
304-
LOGP(info, "Adding TRK Sensitive Volume {}", v->GetName());
305-
AddSensitiveVolume(v);
297+
// Register VD sensors created by VDGeometryBuilder
298+
for (const auto& s : o2::trk::vdSensorRegistry()) {
299+
TGeoVolume* v = gGeoManager->GetVolume(s.name.c_str());
300+
if (!v) {
301+
LOGP(warning, "VD sensor volume '{}' not found", s.name);
302+
continue;
306303
}
307-
// Petal disks
308-
for (int petalDisk = 0; petalDisk < mPetalCases[petalCase].mPetalDisks.size(); ++petalDisk) {
309-
volumeName = mPetalCases[petalCase].mPetalDisks[petalDisk].getSensorName();
310-
LOGP(info, "Trying {}", volumeName.Data());
311-
v = geoManager->GetVolume(volumeName.Data());
312-
LOGP(info, "Adding TRK Sensitive Volume {}", v->GetName());
313-
AddSensitiveVolume(v);
304+
LOGP(info, "Adding VD Sensitive Volume {}", v->GetName());
305+
AddSensitiveVolume(v);
306+
// Optionally track first/last layers for TR references:
307+
if (s.kind == o2::trk::VDSensorDesc::Kind::Barrel && (s.idx == 0 /*innermost*/)) {
308+
mFirstOrLastLayers.push_back(s.name);
314309
}
315310
}
316311

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ void TRKServices::registerVacuum(TGeoVolume* motherVolume)
173173
TGeoVolume* vacuumVolume = new TGeoVolume("A3IP_VACUUM", vacuumComposite, kMedVac);
174174

175175
// Add the vacuum to the barrel
176-
vacuumVolume->SetLineColor(kGreen - 3);
176+
vacuumVolume->SetLineColor(kAzure + 7);
177+
vacuumVolume->SetTransparency(80);
178+
177179
motherVolume->AddNode(vacuumVolume, 1, new TGeoTranslation(0, 0, 0));
178180
}
179181

Detectors/Upgrades/ALICE3/TRK/simulation/src/TRKSimulationLinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#pragma link C++ class o2::trk::TRKLayer + ;
2020
#pragma link C++ class o2::trk::TRKPetalLayer + ;
2121
#pragma link C++ class o2::trk::TRKPetalDisk + ;
22+
#pragma link C++ class o2::trk::VDLayer + ;
2223
#pragma link C++ class o2::trk::TRKServices + ;
2324
#pragma link C++ class o2::trk::Detector + ;
2425
#pragma link C++ class o2::base::DetImpl < o2::trk::Detector> + ;

0 commit comments

Comments
 (0)