28TRKLayer::TRKLayer(
int layerNumber, std::string layerName,
float rInn,
float rOut,
int numberOfModules,
float layerX2X0)
29 : mLayerNumber(layerNumber), mLayout(
kCylinder), mLayerName(layerName), mInnerRadius(rInn), mOuterRadius(rOut), mNumberOfModules(numberOfModules), mX2X0(layerX2X0), mChipWidth(constants::moduleMLOT::chip::
width), mChipLength(constants::moduleMLOT::chip::
length), mDeadzoneWidth(constants::moduleMLOT::chip::passiveEdgeReadOut), mSensorThickness(constants::moduleMLOT::silicon::thickness), mHalfNumberOfChips(4)
32 mChipThickness = mX2X0 * Si_X0;
33 LOGP(info,
"Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius,
getZ(), mX2X0);
36TRKLayer::TRKLayer(
int layerNumber, std::string layerName,
float rInn,
int numberOfModules,
float thick)
37 : mLayerNumber(layerNumber), mLayout(
kCylinder), mLayerName(layerName), mInnerRadius(rInn), mNumberOfModules(numberOfModules), mChipThickness(thick), mChipWidth(constants::moduleMLOT::chip::
width), mChipLength(constants::moduleMLOT::chip::
length), mDeadzoneWidth(constants::moduleMLOT::chip::passiveEdgeReadOut), mSensorThickness(constants::moduleMLOT::silicon::thickness), mHalfNumberOfChips(4)
40 mOuterRadius = rInn + thick;
41 mX2X0 = mChipThickness / Si_X0;
42 LOGP(info,
"Creating layer: id: {} rInner: {} rOuter: {} zLength: {} x2X0: {}", mLayerNumber, mInnerRadius, mOuterRadius,
getZ(), mX2X0);
110 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
118 TGeoVolume* metalVol;
120 if (
type ==
"cylinder") {
122 chipVol =
new TGeoVolume(chipName.c_str(), chip, medSi);
125 LOGP(
debug,
"Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
126 chipVol->AddNode(sensVol, 1,
nullptr);
129 LOGP(
debug,
"Inserting {} in {} ", metalVol->GetName(), chipVol->GetName());
130 chipVol->AddNode(metalVol, 1,
nullptr);
133 }
else if (
type ==
"flat") {
134 chip =
new TGeoBBox(mChipWidth / 2, mChipThickness / 2, mChipLength / 2);
135 chipVol =
new TGeoVolume(chipName.c_str(), chip, medSi);
141 TGeoCombiTrans* transSens =
new TGeoCombiTrans();
142 transSens->SetTranslation(-mDeadzoneWidth / 2, -(mChipThickness - mSensorThickness) / 2, 0);
143 LOGP(
debug,
"Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
144 chipVol->AddNode(sensVol, 1, transSens);
146 TGeoCombiTrans* transDead =
new TGeoCombiTrans();
147 transDead->SetTranslation((mChipWidth - mDeadzoneWidth) / 2, -(mChipThickness - mSensorThickness) / 2, 0);
148 LOGP(
debug,
"Inserting {} in {} ", deadVol->GetName(), chipVol->GetName());
149 chipVol->AddNode(deadVol, 1, transDead);
151 TGeoCombiTrans* transMetal =
new TGeoCombiTrans();
152 transMetal->SetTranslation(0, mSensorThickness / 2, 0);
153 LOGP(
debug,
"Inserting {} in {} ", metalVol->GetName(), chipVol->GetName());
154 chipVol->AddNode(metalVol, 1, transMetal);
156 LOGP(fatal,
"Sensor of type '{}' is not implemented",
type);
159 chipVol->SetLineColor(kYellow);
166 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
170 TGeoVolume* moduleVol;
172 if (
type ==
"cylinder") {
175 module = new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, moduleLength / 2);
176 moduleVol =
new TGeoVolume(moduleName.c_str(), module, medSi);
179 LOGP(
debug,
"Inserting {} in {} ", chipVol->GetName(), moduleVol->GetName());
180 moduleVol->AddNode(chipVol, 1,
nullptr);
181 }
else if (
type ==
"flat") {
185 module = new TGeoBBox(moduleWidth / 2, mChipThickness / 2, moduleLength / 2);
186 moduleVol =
new TGeoVolume(moduleName.c_str(), module, medSi);
188 for (
int iChip = 0; iChip < mHalfNumberOfChips; iChip++) {
190 TGeoVolume* chipVolRight =
createChip(
"flat");
196 TGeoCombiTrans* transLeft =
new TGeoCombiTrans();
197 transLeft->SetTranslation(xLeft, 0, zLeft);
198 TGeoRotation* rot =
new TGeoRotation();
200 transLeft->SetRotation(rot);
201 LOGP(
debug,
"Inserting {} in {} ", chipVolLeft->GetName(), moduleVol->GetName());
202 moduleVol->AddNode(chipVolLeft, iChip * 2, transLeft);
207 TGeoCombiTrans* transRight =
new TGeoCombiTrans();
208 transRight->SetTranslation(xRight, 0, zRight);
209 LOGP(
debug,
"Inserting {} in {} ", chipVolRight->GetName(), moduleVol->GetName());
210 moduleVol->AddNode(chipVolRight, iChip * 2 + 1, transRight);
213 LOGP(fatal,
"Chip of type '{}' is not implemented",
type);
216 moduleVol->SetLineColor(kYellow);
223 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
226 TGeoShape* halfStave;
227 TGeoVolume* halfStaveVol;
231 if (
type ==
"cylinder") {
232 halfStave =
new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, halfStaveLength / 2);
233 halfStaveVol =
new TGeoVolume(halfStaveName.c_str(), halfStave, medSi);
236 LOGP(
debug,
"Inserting {} in {} ", moduleVol->GetName(), halfStaveVol->GetName());
237 halfStaveVol->AddNode(moduleVol, 1,
nullptr);
238 }
else if (
type ==
"flat") {
242 halfStave =
new TGeoBBox(halfStaveWidth / 2, mChipThickness / 2, halfStaveLength / 2);
243 halfStaveVol =
new TGeoVolume(halfStaveName.c_str(), halfStave, medSi);
245 for (
int iModule = 0; iModule < mNumberOfModules; iModule++) {
249 double zPos = -0.5 * mNumberOfModules * moduleLength + (iModule + 0.5) * moduleLength;
251 TGeoCombiTrans* trans =
new TGeoCombiTrans();
252 trans->SetTranslation(0, 0, zPos);
254 LOGP(
debug,
"Inserting {} in {} ", moduleVol->GetName(), halfStaveVol->GetName());
255 halfStaveVol->AddNode(moduleVol, iModule, trans);
259 halfStaveVol->SetLineColor(kYellow);
266 TGeoMedium* medAir = gGeoManager->GetMedium(
"TRK_AIR$");
270 TGeoVolume* staveVol;
274 if (
type ==
"cylinder") {
275 stave =
new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, staveLength / 2);
276 staveVol =
new TGeoVolume(staveName.c_str(), stave, medAir);
279 LOGP(
debug,
"Inserting {} in {} ", moduleVol->GetName(), staveVol->GetName());
280 staveVol->AddNode(moduleVol, 1,
nullptr);
281 }
else if (
type ==
"flat") {
285 stave =
new TGeoBBox(staveWidth / 2, mChipThickness / 2, staveLength / 2);
286 staveVol =
new TGeoVolume(staveName.c_str(), stave, medAir);
288 for (
int iModule = 0; iModule < mNumberOfModules; iModule++) {
292 double zPos = -0.5 * mNumberOfModules * moduleLength + (iModule + 0.5) * moduleLength;
294 TGeoCombiTrans* trans =
new TGeoCombiTrans();
295 trans->SetTranslation(0, 0, zPos);
297 LOGP(
debug,
"Inserting {} in {} ", moduleVol->GetName(), staveVol->GetName());
298 staveVol->AddNode(moduleVol, iModule, trans);
300 }
else if (
type ==
"staggered") {
302 double shift = overlap / 2;
307 stave =
new TGeoBBox(staveWidth / 2, mLogicalVolumeThickness / 2, staveLength / 2);
308 staveVol =
new TGeoVolume(staveName.c_str(), stave, medAir);
314 TGeoCombiTrans* transLeft =
new TGeoCombiTrans();
315 transLeft->SetTranslation(-halfstaveWidth / 2 + shift, 0, 0);
316 LOGP(
debug,
"Inserting {} in {} ", halfStaveVolLeft->GetName(), staveVol->GetName());
317 staveVol->AddNode(halfStaveVolLeft, 0, transLeft);
319 TGeoCombiTrans* transRight =
new TGeoCombiTrans();
320 transRight->SetTranslation(halfstaveWidth / 2 - shift, 0.2, 0);
321 LOGP(
debug,
"Inserting {} in {} ", halfStaveVolRight->GetName(), staveVol->GetName());
322 staveVol->AddNode(halfStaveVolRight, 1, transRight);
324 LOGP(fatal,
"Chip of type '{}' is not implemented",
type);
327 staveVol->SetLineColor(kYellow);
334 TGeoMedium* medAir = gGeoManager->GetMedium(
"TRK_AIR$");
336 double layerThickness = mChipThickness;
338 layerThickness = mLogicalVolumeThickness;
342 TGeoVolume* layerVol;
347 layer =
new TGeoTube(mInnerRadius, mInnerRadius + mChipThickness, layerLength / 2);
348 layerVol =
new TGeoVolume(mLayerName.c_str(),
layer, medAir);
351 LOGP(
debug,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
352 layerVol->AddNode(staveVol, 1,
nullptr);
356 if (mInnerRadius > 25) {
360 layer =
new TGeoTube(mInnerRadius - 0.333 * layerThickness, mInnerRadius + 0.667 * layerThickness, layerLength / 2);
361 layerVol =
new TGeoVolume(mLayerName.c_str(),
layer, medAir);
364 int nStaves = (
int)std::ceil(mInnerRadius * 2 * TMath::Pi() / staveWidth);
365 nStaves += nStaves % 2;
368 double theta = 2 * TMath::Pi() / nStaves;
369 double theta1 = std::atan(staveWidth / 2 / mInnerRadius);
370 double st = std::sin(theta);
371 double ct = std::cos(theta);
372 double theta2 = std::atan((mInnerRadius *
st - staveWidth / 2 * ct) / (mInnerRadius * ct + staveWidth / 2 *
st));
373 double overlap = (theta1 - theta2) * mInnerRadius;
374 LOGP(info,
"Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
376 for (
int iStave = 0; iStave < nStaves; iStave++) {
380 TGeoCombiTrans* trans =
new TGeoCombiTrans();
381 double theta = 360. * iStave / nStaves;
382 TGeoRotation* rot =
new TGeoRotation(
"rot", theta - 90 + 3, 0, 0);
383 trans->SetRotation(rot);
384 trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
386 LOGP(
debug,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
387 layerVol->AddNode(staveVol, iStave, trans);
394 layer =
new TGeoTube(mInnerRadius - 0.333 * layerThickness, mInnerRadius + 0.667 * layerThickness, layerLength / 2);
395 layerVol =
new TGeoVolume(mLayerName.c_str(),
layer, medAir);
398 int nStaves = (
int)std::ceil(mInnerRadius * 2 * TMath::Pi() / staveWidth);
399 nStaves += nStaves % 2;
402 double theta = 2 * TMath::Pi() / nStaves;
403 double theta1 = std::atan(staveWidth / 2 / mInnerRadius);
404 double st = std::sin(theta);
405 double ct = std::cos(theta);
406 double theta2 = std::atan((mInnerRadius *
st - staveWidth / 2 * ct) / (mInnerRadius * ct + staveWidth / 2 *
st));
407 double overlap = (theta1 - theta2) * mInnerRadius;
408 LOGP(info,
"Creating a layer with {} staves and {} mm overlap", nStaves, overlap * 10);
410 for (
int iStave = 0; iStave < nStaves; iStave++) {
414 TGeoCombiTrans* trans =
new TGeoCombiTrans();
415 double theta = 360. * iStave / nStaves;
416 TGeoRotation* rot =
new TGeoRotation(
"rot", theta - 90 + 3, 0, 0);
417 trans->SetRotation(rot);
418 trans->SetTranslation(mInnerRadius * std::cos(2. * TMath::Pi() * iStave / nStaves), mInnerRadius * std::sin(2 * TMath::Pi() * iStave / nStaves), 0);
420 LOGP(
debug,
"Inserting {} in {} ", staveVol->GetName(), layerVol->GetName());
421 layerVol->AddNode(staveVol, iStave, trans);
424 LOGP(fatal,
"Layout not implemented");
426 layerVol->SetLineColor(kYellow);
428 LOGP(
debug,
"Inserting {} in {} ", layerVol->GetName(), motherVolume->GetName());
429 motherVolume->AddNode(layerVol, 1,
nullptr);