Skip to content

Commit 2b3e31d

Browse files
Add Staggered layers
1 parent 61f03b7 commit 2b3e31d

File tree

3 files changed

+60
-11
lines changed

3 files changed

+60
-11
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace trk
2323
enum eLayout {
2424
kCylinder = 0,
2525
kTurboStaves,
26+
kStaggered,
2627
};
2728

2829
struct TRKBaseParam : public o2::conf::ConfigurableParamHelper<TRKBaseParam> {

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

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

42-
TGeoVolume* createSensor(std::string type);
43-
TGeoVolume* createChip(std::string type);
42+
TGeoVolume* createSensor(std::string type, double width=-1);
43+
TGeoVolume* createChip(std::string type, double width=-1);
4444
TGeoVolume* createStave(std::string type);
4545
void createLayer(TGeoVolume* motherVolume);
4646

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

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ TRKLayer::TRKLayer(int layerNumber, std::string layerName, float rInn, float zLe
4141
LOGP(info, "Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius, mZ, mX2X0);
4242
}
4343

44-
TGeoVolume* TRKLayer::createSensor(std::string type)
44+
TGeoVolume* TRKLayer::createSensor(std::string type, double width)
4545
{
4646
TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$");
4747
std::string sensName = Form("%s%d", GeometryTGeo::getTRKSensorPattern(), this->mLayerNumber);
@@ -51,7 +51,7 @@ TGeoVolume* TRKLayer::createSensor(std::string type)
5151
if (type == "cylinder") {
5252
sensor = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
5353
} else if (type == "flat") {
54-
double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design)
54+
if (width < 0) LOGP(fatal, "Attempting to create sensor with invalid width");
5555
sensor = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2);
5656
} else {
5757
LOGP(fatal, "Sensor of type '{}' is not implemented", type);
@@ -63,7 +63,7 @@ TGeoVolume* TRKLayer::createSensor(std::string type)
6363
return sensVol;
6464
};
6565

66-
TGeoVolume* TRKLayer::createChip(std::string type)
66+
TGeoVolume* TRKLayer::createChip(std::string type, double width)
6767
{
6868
TGeoMedium* medSi = gGeoManager->GetMedium("TRK_SILICON$");
6969
std::string chipName = o2::trk::GeometryTGeo::getTRKChipPattern() + std::to_string(mLayerNumber);
@@ -75,9 +75,9 @@ TGeoVolume* TRKLayer::createChip(std::string type)
7575
chip = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
7676
sensVol = createSensor("cylinder");
7777
} else if (type == "flat") {
78-
double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design)
78+
if (width < 0) LOGP(fatal, "Attempting to create chip with invalid width");
7979
chip = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2);
80-
sensVol = createSensor("flat");
80+
sensVol = createSensor("flat", width);
8181
} else {
8282
LOGP(fatal, "Sensor of type '{}' is not implemented", type);
8383
}
@@ -96,22 +96,42 @@ TGeoVolume* TRKLayer::createStave(std::string type)
9696
std::string staveName = o2::trk::GeometryTGeo::getTRKStavePattern() + std::to_string(mLayerNumber);
9797

9898
TGeoShape* stave;
99+
TGeoVolume* staveVol;
99100
TGeoVolume* chipVol;
100101

101102
if (type == "cylinder") {
102103
stave = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, mZ / 2);
103104
chipVol = createChip("cylinder");
105+
staveVol = new TGeoVolume(staveName.c_str(), stave, medAir);
106+
LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName());
107+
staveVol->AddNode(chipVol, 1, nullptr);
104108
} else if (type == "flat") {
105109
double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design)
106110
stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2);
107-
chipVol = createChip("flat");
111+
chipVol = createChip("flat", width);
112+
staveVol = new TGeoVolume(staveName.c_str(), stave, medAir);
113+
LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName());
114+
staveVol->AddNode(chipVol, 1, nullptr);
115+
} else if (type == "staggered") {
116+
double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design)
117+
stave = new TGeoBBox(width / 2, mChipThickness / 2, mZ / 2);
118+
TGeoVolume *chipVolLeft = createChip("flat", mModuleWidth);
119+
TGeoVolume *chipVolRight = createChip("flat", mModuleWidth);
120+
staveVol = new TGeoVolume(staveName.c_str(), stave, medAir);
121+
122+
TGeoCombiTrans* transLeft = new TGeoCombiTrans();
123+
transLeft->SetTranslation(-mModuleWidth/2, 0, 0);
124+
LOGP(info, "Inserting {} in {} ", chipVolLeft->GetName(), staveVol->GetName());
125+
staveVol->AddNode(chipVolLeft, 0, transLeft);
126+
127+
TGeoCombiTrans* transRight = new TGeoCombiTrans();
128+
transRight->SetTranslation(mModuleWidth/2, 0.2, 0);
129+
LOGP(info, "Inserting {} in {} ", chipVolRight->GetName(), staveVol->GetName());
130+
staveVol->AddNode(chipVolRight, 1, transRight);
108131
} else {
109132
LOGP(fatal, "Chip of type '{}' is not implemented", type);
110133
}
111134

112-
TGeoVolume* staveVol = new TGeoVolume(staveName.c_str(), stave, medAir);
113-
LOGP(info, "Inserting {} in {} ", chipVol->GetName(), staveVol->GetName());
114-
staveVol->AddNode(chipVol, 1, nullptr);
115135
staveVol->SetLineColor(kYellow);
116136

117137
return staveVol;
@@ -160,6 +180,34 @@ void TRKLayer::createLayer(TGeoVolume* motherVolume)
160180
trans->SetRotation(rot);
161181
trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
162182

183+
LOGP(info, "Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
184+
layerVol->AddNode(staveVol, iStave, trans);
185+
}
186+
} else if (mLayout == kStaggered) {
187+
// Compute the number of staves
188+
double width = mModuleWidth * 2; // Each stave has two modules (based on the LOI design)
189+
int nStaves = (int)std::ceil(mInnerRadius * 2 * TMath::Pi() / width);
190+
nStaves += nStaves % 2; // Require an even number of staves
191+
192+
// Compute the size of the overlap region
193+
double theta = 2 * TMath::Pi() / nStaves;
194+
double theta1 = std::atan(width / 2 / mInnerRadius);
195+
double st = std::sin(theta);
196+
double ct = std::cos(theta);
197+
double theta2 = std::atan((mInnerRadius * st - width / 2 * ct) / (mInnerRadius * ct + width / 2 * st));
198+
double overlap = (theta1 - theta2) * mInnerRadius;
199+
LOGP(info, "Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
200+
201+
for (int iStave = 0; iStave < nStaves; iStave++) {
202+
TGeoVolume* staveVol = createStave("staggered");
203+
204+
// Put the staves in the correct position and orientation
205+
TGeoCombiTrans* trans = new TGeoCombiTrans();
206+
double theta = 360. * iStave / nStaves;
207+
TGeoRotation* rot = new TGeoRotation("rot", theta + 90, 0, 0);
208+
trans->SetRotation(rot);
209+
trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
210+
163211
LOGP(info, "Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
164212
layerVol->AddNode(staveVol, iStave, trans);
165213
}

0 commit comments

Comments
 (0)