Skip to content

Commit 0f2407c

Browse files
committed
Fix constructors
1 parent 4b44f28 commit 0f2407c

File tree

5 files changed

+72
-84
lines changed

5 files changed

+72
-84
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class Detector : public o2::base::DetImpl<Detector>
3232
public:
3333
Detector(bool active);
3434
Detector();
35+
Detector(const Detector& other);
3536
~Detector();
3637

3738
// Factory method
@@ -87,7 +88,7 @@ class Detector : public o2::base::DetImpl<Detector>
8788
double mEnergyLoss; // energy loss
8889
} mTrackData; //! transient data
8990
GeometryTGeo* mGeometryTGeo; //!
90-
std::vector<o2::trk::Hit>* mHits; // ITSMFT ones for the moment
91+
std::vector<o2::trk::Hit>* mHits; // Derived from ITSMFT
9192
std::vector<std::unique_ptr<TRKCylindricalLayer>> mLayers;
9293
TRKServices mServices; // Houses the services of the TRK, but not the Iris tracker
9394

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,16 @@ namespace o2
2222
{
2323
namespace trk
2424
{
25+
enum class MatBudgetParamMode {
26+
Thickness,
27+
X2X0
28+
};
29+
2530
class TRKCylindricalLayer
2631
{
2732
public:
2833
TRKCylindricalLayer() = default;
29-
TRKCylindricalLayer(int layerNumber, std::string layerName, float rInn, float length, float layerX2X0);
30-
TRKCylindricalLayer(int layerNumber, std::string layerName, float rInn, float length, float thick);
34+
TRKCylindricalLayer(int layerNumber, std::string layerName, float rInn, float length, float thickOrX2X0, MatBudgetParamMode mode);
3135
virtual ~TRKCylindricalLayer() = default;
3236

3337
auto getInnerRadius() const { return mInnerRadius; }
@@ -64,19 +68,18 @@ class TRKSegmentedLayer : public TRKCylindricalLayer
6468
{
6569
public:
6670
TRKSegmentedLayer() = default;
67-
TRKSegmentedLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float layerX2X0);
68-
TRKSegmentedLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thick);
71+
TRKSegmentedLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
6972
~TRKSegmentedLayer() override = default;
7073

7174
TGeoVolume* createSensor() override;
7275
TGeoVolume* createDeadzone();
7376
TGeoVolume* createMetalStack() override;
7477
TGeoVolume* createChip();
7578
TGeoVolume* createModule();
76-
TGeoVolume* createStave() = 0;
79+
virtual TGeoVolume* createStave() = 0;
7780
void createLayer(TGeoVolume* motherVolume) override = 0;
7881

79-
private:
82+
protected:
8083
int mNumberOfModules;
8184

8285
// Fixed parameters for the layer, to be set based on the specifications of the chip and module
@@ -90,15 +93,14 @@ class TRKSegmentedLayer : public TRKCylindricalLayer
9093
// TGeo objects outside logical volumes can cause errors
9194
static constexpr float sLogicalVolumeThickness = 1.3;
9295

93-
ClassDef(TRKSegmentedLayer, 0);
96+
ClassDefOverride(TRKSegmentedLayer, 0);
9497
};
9598

9699
class TRKMLLayer : public TRKSegmentedLayer
97100
{
98101
public:
99102
TRKMLLayer() = default;
100-
TRKMLLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float layerX2X0);
101-
TRKMLLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thick);
103+
TRKMLLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
102104
~TRKMLLayer() override = default;
103105

104106
TGeoVolume* createStave() override;
@@ -107,15 +109,14 @@ class TRKMLLayer : public TRKSegmentedLayer
107109
private:
108110
static constexpr double sStaveWidth = constants::ML::width;
109111

110-
ClassDef(TRKMLLayer, 0);
112+
ClassDefOverride(TRKMLLayer, 0);
111113
};
112114

113115
class TRKOTLayer : public TRKSegmentedLayer
114116
{
115117
public:
116118
TRKOTLayer() = default;
117-
TRKOTLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float layerX2X0);
118-
TRKOTLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thick);
119+
TRKOTLayer(int layerNumber, std::string layerName, float rInn, int numberOfModules, float thickOrX2X0, MatBudgetParamMode mode);
119120
~TRKOTLayer() override = default;
120121

121122
TGeoVolume* createStave() override;
@@ -127,7 +128,7 @@ class TRKOTLayer : public TRKSegmentedLayer
127128
static constexpr double sInStaveOverlap = constants::moduleMLOT::gaps::outerEdgeLongSide + constants::moduleMLOT::chip::passiveEdgeReadOut + 0.1; // 1.5mm outer-edge + 1mm deadzone + 1mm (true) overlap
128129
static constexpr double sStaveWidth = constants::OT::width - sInStaveOverlap;
129130

130-
ClassDef(TRKOTLayer, 0)
131+
ClassDefOverride(TRKOTLayer, 0)
131132
};
132133

133134
} // namespace trk

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,17 @@ Detector::Detector(bool active)
6161

6262
LOGP(info, "Summary of TRK configuration:");
6363
for (auto& layer : mLayers) {
64-
LOGP(info, "Layer: {} name: {} r: {} cm | z: {} cm | thickness: {} cm", layer.getNumber(), layer.getName(), layer.getInnerRadius(), layer.getZ(), layer.getChipThickness());
64+
LOGP(info, "Layer: {} name: {} r: {} cm | z: {} cm | thickness: {} cm", layer->getNumber(), layer->getName(), layer->getInnerRadius(), layer->getZ(), layer->getChipThickness());
6565
}
6666
}
6767

68+
Detector::Detector(const Detector& other)
69+
: o2::base::DetImpl<Detector>(other),
70+
mTrackData(),
71+
mHits(o2::utils::createSimVector<o2::trk::Hit>())
72+
{
73+
}
74+
6875
Detector::~Detector()
6976
{
7077
if (mHits) {
@@ -88,26 +95,28 @@ void Detector::configMLOT()
8895
const float thick = 100.e-3;
8996

9097
switch (trkPars.layoutMLOT) {
91-
case kCylindrical:
98+
case kCylindrical: {
9299
const std::vector<float> length{128.35f, 128.35f, 128.35f, 128.35f, 128.35f, 256.7f, 256.7f, 256.7f};
93100
LOGP(warning, "Loading cylindrical configuration for ALICE3 TRK");
94101
for (int i{0}; i < 8; ++i) {
95102
std::string name = GeometryTGeo::getTRKLayerPattern() + std::to_string(i);
96-
mLayers.push_back(std::make_unique<TRKCylindricalLayer>(i, name, rInn[i], length[i], thick));
103+
mLayers.push_back(std::make_unique<TRKCylindricalLayer>(i, name, rInn[i], length[i], thick, MatBudgetParamMode::Thickness));
97104
}
98105
break;
99-
case kSegmented:
106+
}
107+
case kSegmented: {
100108
const std::vector<int> nMods{10, 10, 10, 10, 10, 20, 20, 20};
101109
LOGP(warning, "Loading segmented configuration for ALICE3 TRK");
102110
for (int i{0}; i < 8; ++i) {
103111
std::string name = GeometryTGeo::getTRKLayerPattern() + std::to_string(i);
104112
if (i < 4) {
105-
mLayers.push_back(std::make_unique<TRKMLLayer>(i, name, rInn[i], nMods[i], thick));
113+
mLayers.push_back(std::make_unique<TRKMLLayer>(i, name, rInn[i], nMods[i], thick, MatBudgetParamMode::Thickness));
106114
} else {
107-
mLayers.push_back(std::make_unique<TRKOTLayer>(i, name, rInn[i], nMods[i], thick));
115+
mLayers.push_back(std::make_unique<TRKOTLayer>(i, name, rInn[i], nMods[i], thick, MatBudgetParamMode::Thickness));
108116
}
109117
}
110118
break;
119+
}
111120
default:
112121
LOGP(fatal, "Unknown option {} for configMLOT", static_cast<int>(trkPars.layoutMLOT));
113122
break;
@@ -146,14 +155,14 @@ void Detector::configFromFile(std::string fileName)
146155
std::string name = GeometryTGeo::getTRKLayerPattern() + std::to_string(layerCount);
147156
switch (trkPars.layoutMLOT) {
148157
case kCylindrical:
149-
mLayers.push_back(std::make_unique<TRKCylindricalLayer>(layerCount, name, tmpBuff[0], tmpBuff[1], tmpBuff[2]));
158+
mLayers.push_back(std::make_unique<TRKCylindricalLayer>(layerCount, name, tmpBuff[0], tmpBuff[1], tmpBuff[2], MatBudgetParamMode::Thickness));
150159
break;
151160
case kSegmented: {
152161
int nMods = static_cast<int>(tmpBuff[1]);
153162
if (layerCount < 4) {
154-
mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2]));
163+
mLayers.push_back(std::make_unique<TRKMLLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2], MatBudgetParamMode::Thickness));
155164
} else {
156-
mLayers.push_back(std::make_unique<TRKOTLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2]));
165+
mLayers.push_back(std::make_unique<TRKOTLayer>(layerCount, name, tmpBuff[0], nMods, tmpBuff[2], MatBudgetParamMode::Thickness));
157166
}
158167
break;
159168
}
@@ -171,8 +180,8 @@ void Detector::configToFile(std::string fileName)
171180
LOGP(info, "Exporting TRK Detector layout to {}", fileName);
172181
std::ofstream conFile(fileName.c_str(), std::ios::out);
173182
conFile << "/// TRK configuration file: inn_radius z_length lay_thickness" << std::endl;
174-
for (auto layer : mLayers) {
175-
conFile << layer.getInnerRadius() << "\t" << layer.getZ() << "\t" << layer.getChipThickness() << std::endl;
183+
for (const auto& layer : mLayers) {
184+
conFile << layer->getInnerRadius() << "\t" << layer->getZ() << "\t" << layer->getChipThickness() << std::endl;
176185
}
177186
}
178187

@@ -237,7 +246,7 @@ void Detector::createGeometry()
237246
vTRK->SetTitle(vstrng);
238247

239248
for (auto& layer : mLayers) {
240-
layer.createLayer(vTRK);
249+
layer->createLayer(vTRK);
241250
}
242251

243252
// Add service for inner tracker

0 commit comments

Comments
 (0)