Skip to content

Commit a39d966

Browse files
committed
Fixed dimensions with bottom up approach
1 parent ed677e5 commit a39d966

File tree

3 files changed

+78
-60
lines changed

3 files changed

+78
-60
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// Each TGeoShape has the following properties
2323
// length: dimension in z-axis
2424
// width: dimension in xy-axes
25-
// color: for visulisation
25+
// color: for visualisation
2626
namespace o2::trk::constants
2727
{
2828
// Default unit of TGeo = cm

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,29 @@ class TRKLayer
3939
auto getNumber() const { return mLayerNumber; }
4040
auto getName() const { return mLayerName; }
4141

42-
TGeoVolume* createSensor(std::string type, double width = -1);
43-
TGeoVolume* createDeadzone(std::string type, double width = -1);
44-
TGeoVolume* createChip(std::string type, double width = -1);
45-
TGeoVolume* createModule(std::string type, double width = -1);
46-
TGeoVolume* createStave(std::string type, double width = -1);
42+
TGeoVolume* createSensor(std::string type);
43+
TGeoVolume* createDeadzone(std::string type);
44+
TGeoVolume* createChip(std::string type);
45+
TGeoVolume* createModule(std::string type);
46+
TGeoVolume* createStave(std::string type);
4747
void createLayer(TGeoVolume* motherVolume);
4848

4949
private:
5050
// TGeo objects outside logical volumes can cause errors. Only used in case of kStaggered and kTurboStaves layouts
5151
static constexpr float mLogicalVolumeThickness = 1;
5252

5353
int mLayerNumber;
54+
eLayout mLayout;
5455
std::string mLayerName;
5556
float mInnerRadius;
5657
float mOuterRadius;
5758
float mZ;
5859
float mX2X0;
59-
float mChipThickness;
6060
float mModuleWidth; // u.m. = cm
61-
eLayout mLayout;
61+
float mChipWidth;
62+
float mChipLength;
63+
float mChipThickness;
64+
float mDeadzoneWidth;
6265

6366
ClassDef(TRKLayer, 1);
6467
};

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

Lines changed: 67 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include "TRKSimulation/TRKLayer.h"
1313
#include "TRKBase/GeometryTGeo.h"
14+
#include "TRKBase/Specs.h"
1415

1516
#include "Framework/Logger.h"
1617

@@ -25,23 +26,23 @@ namespace o2
2526
namespace trk
2627
{
2728
TRKLayer::TRKLayer(int layerNumber, std::string layerName, float rInn, float rOut, float zLength, float layerX2X0)
28-
: mLayerNumber(layerNumber), mLayerName(layerName), mInnerRadius(rInn), mOuterRadius(rOut), mZ(zLength), mX2X0(layerX2X0), mModuleWidth(4.54), mLayout(kCylinder)
29+
: mLayerNumber(layerNumber), mLayout(kCylinder), mLayerName(layerName), mInnerRadius(rInn), mOuterRadius(rOut), mZ(zLength), mX2X0(layerX2X0), mModuleWidth(4.54), mChipWidth(constants::moduleMLOT::chip::width), mChipLength(constants::moduleMLOT::chip::length), mDeadzoneWidth(1.5 * 1e-1)
2930
{
3031
float Si_X0 = 9.5f;
3132
mChipThickness = mX2X0 * Si_X0;
3233
LOGP(info, "Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius, mZ, mX2X0);
3334
}
3435

3536
TRKLayer::TRKLayer(int layerNumber, std::string layerName, float rInn, float zLength, float thick)
36-
: mLayerNumber(layerNumber), mLayerName(layerName), mInnerRadius(rInn), mZ(zLength), mChipThickness(thick), mModuleWidth(4.54), mLayout(kCylinder)
37+
: mLayerNumber(layerNumber), mLayout(kCylinder), mLayerName(layerName), mInnerRadius(rInn), mZ(zLength), mChipThickness(thick), mModuleWidth(4.54), mChipWidth(constants::moduleMLOT::chip::width), mChipLength(constants::moduleMLOT::chip::length), mDeadzoneWidth(1.5 * 1e-1)
3738
{
3839
float Si_X0 = 9.5f;
3940
mOuterRadius = rInn + thick;
4041
mX2X0 = mChipThickness / Si_X0;
4142
LOGP(info, "Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius, mZ, mX2X0);
4243
}
4344

44-
TGeoVolume* TRKLayer::createSensor(std::string type, double width)
45+
TGeoVolume* TRKLayer::createSensor(std::string type)
4546
{
4647
TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$");
4748
std::string sensName = GeometryTGeo::getTRKSensorPattern() + std::to_string(mLayerNumber);
@@ -51,10 +52,7 @@ TGeoVolume* TRKLayer::createSensor(std::string type, double width)
5152
if (type == "cylinder") {
5253
sensor = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); // TO BE CHECKED !!!
5354
} else if (type == "flat") {
54-
if (width < 0) {
55-
LOGP(fatal, "Attempting to create sensor with invalid width");
56-
}
57-
sensor = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); // TO BE CHECKED !!!
55+
sensor = new TGeoBBox((mChipWidth - mDeadzoneWidth) / 2, mChipThickness / 2, mChipLength / 2); // TO BE CHECKED !!!
5856
} else {
5957
LOGP(fatal, "Sensor of type '{}' is not implemented", type);
6058
}
@@ -65,7 +63,7 @@ TGeoVolume* TRKLayer::createSensor(std::string type, double width)
6563
return sensVol;
6664
};
6765

68-
TGeoVolume* TRKLayer::createDeadzone(std::string type, double width)
66+
TGeoVolume* TRKLayer::createDeadzone(std::string type)
6967
{
7068
TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$");
7169
std::string deadName = GeometryTGeo::getTRKDeadzonePattern() + std::to_string(mLayerNumber);
@@ -75,10 +73,7 @@ TGeoVolume* TRKLayer::createDeadzone(std::string type, double width)
7573
if (type == "cylinder") {
7674
deadzone = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2); // TO BE CHECKED !!!
7775
} else if (type == "flat") {
78-
if (width < 0) {
79-
LOGP(fatal, "Attempting to create deadzone with invalid width");
80-
}
81-
deadzone = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); // TO BE CHECKED !!!
76+
deadzone = new TGeoBBox(mDeadzoneWidth / 2, mChipThickness / 2, mChipLength / 2); // TO BE CHECKED !!!
8277
} else {
8378
LOGP(fatal, "Deadzone of type '{}' is not implemented", type);
8479
}
@@ -89,45 +84,52 @@ TGeoVolume* TRKLayer::createDeadzone(std::string type, double width)
8984
return deadVol;
9085
};
9186

92-
TGeoVolume* TRKLayer::createChip(std::string type, double width)
87+
TGeoVolume* TRKLayer::createChip(std::string type)
9388
{
9489
TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$");
9590
std::string chipName = GeometryTGeo::getTRKChipPattern() + std::to_string(mLayerNumber);
9691

9792
TGeoShape* chip;
93+
TGeoVolume* chipVol;
9894

9995
TGeoVolume* sensVol;
10096
TGeoVolume* deadVol;
10197

10298
if (type == "cylinder") {
10399
chip = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
100+
chipVol = new TGeoVolume(chipName.c_str(), chip, medSi);
101+
104102
sensVol = createSensor("cylinder");
105-
deadVol = createDeadzone("cylinder");
103+
LOGP(info, "Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
104+
chipVol->AddNode(sensVol, 1, nullptr);
105+
106+
// deadVol = createDeadzone("cylinder");
106107
} else if (type == "flat") {
107-
if (width < 0) {
108-
LOGP(fatal, "Attempting to create chip with invalid width");
109-
}
110-
chip = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); // TO BE CHECKED !!!
111-
sensVol = createSensor("flat", width);
112-
deadVol = createDeadzone("flat", width);
113-
} else {
114-
LOGP(fatal, "Sensor of type '{}' is not implemented", type);
115-
}
108+
chip = new TGeoBBox(mChipWidth / 2, mChipThickness / 2, mChipLength / 2); // TO BE CHECKED !!!
109+
chipVol = new TGeoVolume(chipName.c_str(), chip, medSi);
116110

117-
TGeoVolume* chipVol = new TGeoVolume(chipName.c_str(), chip, medSi);
111+
sensVol = createSensor("flat");
112+
deadVol = createDeadzone("flat");
118113

119-
LOGP(info, "Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
120-
chipVol->AddNode(sensVol, 1, nullptr);
114+
TGeoCombiTrans* transSens = new TGeoCombiTrans();
115+
transSens->SetTranslation(-mDeadzoneWidth / 2, 0, 0); // TO BE CHECKED !!!
116+
LOGP(info, "Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
117+
chipVol->AddNode(sensVol, 1, transSens);
121118

122-
LOGP(info, "Inserting {} in {} ", deadVol->GetName(), chipVol->GetName());
123-
chipVol->AddNode(deadVol, 1, nullptr);
119+
TGeoCombiTrans* transDead = new TGeoCombiTrans();
120+
transDead->SetTranslation((mChipWidth - mDeadzoneWidth) / 2, 0, 0); // TO BE CHECKED !!!
121+
LOGP(info, "Inserting {} in {} ", deadVol->GetName(), chipVol->GetName());
122+
chipVol->AddNode(deadVol, 1, transDead);
123+
} else {
124+
LOGP(fatal, "Sensor of type '{}' is not implemented", type);
125+
}
124126

125127
chipVol->SetLineColor(kYellow);
126128

127129
return chipVol;
128130
}
129131

130-
TGeoVolume* TRKLayer::createModule(std::string type, double width)
132+
TGeoVolume* TRKLayer::createModule(std::string type)
131133
{
132134
TGeoMedium* medAir = gGeoManager->GetMedium("TRK_AIR$");
133135
std::string moduleName = GeometryTGeo::getTRKModulePattern() + std::to_string(mLayerNumber);
@@ -143,27 +145,32 @@ TGeoVolume* TRKLayer::createModule(std::string type, double width)
143145
LOGP(info, "Inserting {} in {} ", chipVol->GetName(), moduleVol->GetName());
144146
moduleVol->AddNode(chipVol, 1, nullptr);
145147
} else if (type == "flat") {
146-
if (width < 0) {
147-
LOGP(fatal, "Attempting to create module with invalid width");
148-
}
148+
double moduleWidth = constants::moduleMLOT::width;
149+
double moduleLength = constants::moduleMLOT::length;
149150

150-
module = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2); // TO BE CHECKED !!!
151+
module = new TGeoBBox(moduleWidth / 2, mChipThickness / 2, moduleLength / 2); // TO BE CHECKED !!!
151152
moduleVol = new TGeoVolume(moduleName.c_str(), module, medAir);
152153

153154
int nChips = 4;
154155

155156
for (int iChip = 0; iChip < nChips; iChip++) {
156-
TGeoVolume* chipVolLeft = createChip("flat", mModuleWidth / 2);
157-
TGeoVolume* chipVolRight = createChip("flat", mModuleWidth / 2); // TO BE CHECKED !!!
157+
TGeoVolume* chipVolLeft = createChip("flat");
158+
TGeoVolume* chipVolRight = createChip("flat");
158159

159160
// Put the chips in the correct position
161+
double xLeft = -moduleWidth / 2 + constants::moduleMLOT::gaps::outerEdgeLongSide + constants::moduleMLOT::chip::width / 2;
162+
double zLeft = -moduleLength / 2 + constants::moduleMLOT::gaps::outerEdgeShortSide + iChip * (constants::moduleMLOT::chip::length + constants::moduleMLOT::gaps::interChips) + constants::moduleMLOT::chip::length / 2;
163+
160164
TGeoCombiTrans* transLeft = new TGeoCombiTrans();
161-
transLeft->SetTranslation(-mModuleWidth / 2 + 0.05, 0, iChip * (mModuleWidth + 0.1)); // TO BE CHECKED !!!
165+
transLeft->SetTranslation(xLeft, 0, zLeft); // TO BE CHECKED !!!
162166
LOGP(info, "Inserting {} in {} ", chipVolLeft->GetName(), moduleVol->GetName());
163167
moduleVol->AddNode(chipVolLeft, iChip * 2, transLeft);
164168

169+
double xRight = +moduleWidth / 2 - constants::moduleMLOT::gaps::outerEdgeLongSide - constants::moduleMLOT::chip::width / 2;
170+
double zRight = -moduleLength / 2 + constants::moduleMLOT::gaps::outerEdgeShortSide + iChip * (constants::moduleMLOT::chip::length + constants::moduleMLOT::gaps::interChips) + constants::moduleMLOT::chip::length / 2;
171+
165172
TGeoCombiTrans* transRight = new TGeoCombiTrans();
166-
transRight->SetTranslation(mModuleWidth / 2 - 0.05, 0, iChip * (mModuleWidth + 0.1)); // TO BE CHECKED !!!
173+
transRight->SetTranslation(xRight, 0, zRight); // TO BE CHECKED !!!
167174
LOGP(info, "Inserting {} in {} ", chipVolRight->GetName(), moduleVol->GetName());
168175
moduleVol->AddNode(chipVolRight, iChip * 2 + 1, transRight);
169176
}
@@ -176,7 +183,7 @@ TGeoVolume* TRKLayer::createModule(std::string type, double width)
176183
return moduleVol;
177184
}
178185

179-
TGeoVolume* TRKLayer::createStave(std::string type, double width)
186+
TGeoVolume* TRKLayer::createStave(std::string type)
180187
{
181188
TGeoMedium* medAir = gGeoManager->GetMedium("TRK_AIR$");
182189
std::string staveName = GeometryTGeo::getTRKStavePattern() + std::to_string(mLayerNumber);
@@ -192,44 +199,52 @@ TGeoVolume* TRKLayer::createStave(std::string type, double width)
192199
LOGP(info, "Inserting {} in {} ", moduleVol->GetName(), staveVol->GetName());
193200
staveVol->AddNode(moduleVol, 1, nullptr);
194201
} else if (type == "flat") {
195-
if (width < 0) {
196-
LOGP(fatal, "Attempting to create stave with invalid width");
197-
}
202+
double moduleLength = constants::ML::length;
203+
double staveWidth = constants::ML::width;
198204

199-
stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2);
205+
stave = new TGeoBBox(staveWidth / 2, mChipThickness / 2, mZ / 2);
200206
staveVol = new TGeoVolume(staveName.c_str(), stave, medAir);
201207

202208
int nModules = 10;
203209

204210
for (int iModule = 0; iModule < nModules; iModule++) {
205-
TGeoVolume* moduleVol = createModule("flat", mModuleWidth);
211+
TGeoVolume* moduleVol = createModule("flat");
206212

207213
// Put the modules in the correct position
214+
double zPos = -0.5 * (nModules - 1) * moduleLength + iModule * moduleLength;
215+
208216
TGeoCombiTrans* trans = new TGeoCombiTrans();
209-
trans->SetTranslation(0, 0, iModule * (mModuleWidth + 0.1)); // TO BE CHECKED !!!
217+
trans->SetTranslation(0, 0, zPos); // TO BE CHECKED !!!
210218

211219
LOGP(info, "Inserting {} in {} ", moduleVol->GetName(), staveVol->GetName());
212220
staveVol->AddNode(moduleVol, iModule, trans);
213221
}
214222
} else if (type == "staggered") {
215-
double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design)
216-
stave = new TGeoBBox(width / 2, mLogicalVolumeThickness / 2, mZ / 2);
223+
double moduleWidth = constants::ML::width;
224+
double moduleLength = constants::ML::length;
225+
double staveWidth = constants::OT::width; // Each stave has two modules (based on the LOI design)
226+
227+
stave = new TGeoBBox(staveWidth / 2, mLogicalVolumeThickness / 2, mZ / 2);
217228
staveVol = new TGeoVolume(staveName.c_str(), stave, medAir);
218229

219-
int nModules = 10;
230+
int nModules = 20;
220231

221232
for (int iModule = 0; iModule < nModules; iModule++) {
222-
TGeoVolume* moduleVolLeft = createModule("flat", mModuleWidth);
223-
TGeoVolume* moduleVolRight = createModule("flat", mModuleWidth);
233+
TGeoVolume* moduleVolLeft = createModule("flat");
234+
TGeoVolume* moduleVolRight = createModule("flat");
224235

225236
// Put the modules in the correct position
237+
double xLeft = -moduleWidth / 2 + 0.05;
238+
double xRight = moduleWidth / 2 - 0.05;
239+
double zPos = -0.5 * (nModules - 1) * moduleLength + iModule * moduleLength;
240+
226241
TGeoCombiTrans* transLeft = new TGeoCombiTrans();
227-
transLeft->SetTranslation(-mModuleWidth / 2 + 0.05, 0, iModule * (mModuleWidth + 0.1)); // TO BE CHECKED !!! 1mm overlap between the modules
242+
transLeft->SetTranslation(xLeft, 0, zPos); // TO BE CHECKED !!! 1mm overlap between the modules
228243
LOGP(info, "Inserting {} in {} ", moduleVolLeft->GetName(), staveVol->GetName());
229244
staveVol->AddNode(moduleVolLeft, iModule * 2, transLeft);
230245

231246
TGeoCombiTrans* transRight = new TGeoCombiTrans();
232-
transRight->SetTranslation(mModuleWidth / 2 - 0.05, 0, iModule * (mModuleWidth + 0.1)); // TO BE CHECKED !!! 1mm overlap between the modules
247+
transRight->SetTranslation(xRight, 0, zPos); // TO BE CHECKED !!! 1mm overlap between the modules
233248
LOGP(info, "Inserting {} in {} ", moduleVolRight->GetName(), staveVol->GetName());
234249
staveVol->AddNode(moduleVolRight, iModule * 2 + 1, transRight);
235250
}
@@ -283,7 +298,7 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume)
283298
LOGP(info, "Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
284299

285300
for (int iStave = 0; iStave < nStaves; iStave++) {
286-
TGeoVolume* staveVol = createStave("flat", width);
301+
TGeoVolume* staveVol = createStave("flat");
287302

288303
// Put the staves in the correct position and orientation
289304
TGeoCombiTrans* trans = new TGeoCombiTrans();

0 commit comments

Comments
 (0)