20#include "TGeoVolume.h"
21#include "TGeoMatrix.h"
22#include "TGeoManager.h"
32 : mLayerNumber(layerNumber), mLayerName(layerName), mX2X0(layerX2X0), mModuleWidth(4.54)
34 constexpr double kSiX0_cm = 9.5;
42 double phiSpanDeg,
double lengthZ,
double lengthSensZ)
43 :
VDLayer(layerNumber, layerName, layerX2X0), mRadius(radius), mPhiSpanDeg(phiSpanDeg), mLengthZ(lengthZ), mLengthSensZ(lengthSensZ)
45 LOGP(info,
"Creating VD cylindrical layer: id: {} name: {} x2X0: {} radius: {} phiSpanDeg: {} lengthZ: {} lengthSensZ: {} chipThickness = {} cm",
51 double width,
double lengthZ,
double lengthSensZ)
52 :
VDLayer(layerNumber, layerName, layerX2X0), mWidth(
width), mLengthZ(lengthZ), mLengthSensZ(lengthSensZ)
55 if (mLengthSensZ <= 0 || mLengthSensZ > mLengthZ) {
56 LOGP(fatal,
"Invalid sensor length: sensZ={} layerZ={}", mLengthSensZ, mLengthZ);
58 LOGP(info,
"Creating VD rectangular layer: id: {} name: {} x2X0: {} width: {} lengthZ: {} lengthSensZ: {} chipThickness = {} cm",
64 double phiSpanDeg,
double zPos)
65 :
VDLayer(layerNumber, layerName, layerX2X0), mRMin(rMin), mRMax(rMax), mPhiSpanDeg(phiSpanDeg), mZPos(zPos)
68 LOGP(info,
"Creating VD disk layer: id: {} name: {} x2X0: {} rMin: {} rMax: {} phiSpanDeg: {} zPos: {} chipThickness = {} cm",
79 LOGP(error,
"gGeoManager is null");
82 auto* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
84 LOGP(error,
"Missing medium TRK_SILICON$");
88 const double rIn = mRadius;
90 const double halfZ = 0.5 * mLengthSensZ;
91 const double halfPhi = 0.5 * mPhiSpanDeg;
92 auto* shape =
new TGeoTubeSeg(rIn, rOut, halfZ, -halfPhi, +halfPhi);
93 auto* vol =
new TGeoVolume(sensName.c_str(), shape, medSi);
94 vol->SetLineColor(kYellow);
95 vol->SetTransparency(30);
102 LOGP(error,
"gGeoManager is null");
105 auto* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
107 LOGP(error,
"Missing medium TRK_SILICON$");
111 const double hx = 0.5 * mWidth;
113 const double hz = 0.5 * mLengthSensZ;
115 auto* shape =
new TGeoBBox(hx, hy, hz);
116 auto* vol =
new TGeoVolume(sensName.c_str(), shape, medSi);
117 vol->SetLineColor(kYellow);
118 vol->SetTransparency(30);
126 LOGP(error,
"gGeoManager is null");
129 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
131 LOGP(error,
"Missing medium TRK_SILICON$");
134 if (mRMin < 0 || mRMax <= mRMin ||
mChipThickness <= 0 || mPhiSpanDeg <= 0 || mPhiSpanDeg > 360.0) {
135 LOGP(error,
"Invalid disk sensor dims: rMin={}, rMax={}, t={}, phiSpanDeg={}",
141 const double halfPhi = 0.5 * mPhiSpanDeg;
144 auto* shape =
new TGeoTubeSeg(mRMin, mRMax, halfThickness, -halfPhi, +halfPhi);
146 auto* sensVol =
new TGeoVolume(sensName.c_str(), shape, medSi);
147 sensVol->SetLineColor(kYellow);
148 sensVol->SetTransparency(30);
160 LOGP(error,
"gGeoManager is null");
163 auto* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
165 LOGP(error,
"Missing medium TRK_SILICON$");
179 const double halfZ = 0.5 * mLengthSensZ;
180 const double halfPhi = 0.5 * mPhiSpanDeg;
182 auto* shape =
new TGeoTubeSeg(rIn, rOut, halfZ, -halfPhi, +halfPhi);
183 auto* vol =
new TGeoVolume(
name.c_str(), shape, medSi);
184 vol->SetLineColor(kGray);
185 vol->SetTransparency(30);
192 LOGP(error,
"gGeoManager is null");
195 auto* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
197 LOGP(error,
"Missing medium TRK_SILICON$");
209 const double hx = 0.5 * mWidth;
210 const double hy = 0.5 * metalT;
211 const double hz = 0.5 * mLengthSensZ;
213 auto* shape =
new TGeoBBox(hx, hy, hz);
214 auto* vol =
new TGeoVolume(
name.c_str(), shape, medSi);
215 vol->SetLineColor(kGray);
216 vol->SetTransparency(30);
223 LOGP(error,
"gGeoManager is null");
226 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
228 LOGP(error,
"Missing medium TRK_SILICON$");
237 if (mRMin < 0 || mRMax <= mRMin || mPhiSpanDeg <= 0 || mPhiSpanDeg > 360.0) {
238 LOGP(error,
"Invalid disk metal dims: rMin={}, rMax={}, metalT={}, phiSpanDeg={}",
239 mRMin, mRMax, metalT, mPhiSpanDeg);
246 const double halfThickness = 0.5 * metalT;
247 const double halfPhi = 0.5 * mPhiSpanDeg;
249 auto* shape =
new TGeoTubeSeg(mRMin, mRMax, halfThickness, -halfPhi, +halfPhi);
250 auto* vol =
new TGeoVolume(
name.c_str(), shape, medSi);
251 vol->SetLineColor(kGray);
252 vol->SetTransparency(30);
263 LOGP(error,
"gGeoManager is null");
266 auto* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
268 LOGP(error,
"Missing medium TRK_SILICON$");
272 std::string chipName = Form(
"%s_%s%d",
mLayerName.c_str(),
275 const double rIn = mRadius;
277 const double halfZ = 0.5 * mLengthSensZ;
278 const double halfPhi = 0.5 * mPhiSpanDeg;
280 auto* chipShape =
new TGeoTubeSeg(rIn, rOut, halfZ, -halfPhi, +halfPhi);
281 auto* chipVol =
new TGeoVolume(chipName.c_str(), chipShape, medSi);
285 LOGP(
debug,
"Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
286 chipVol->AddNode(sensVol, 1,
nullptr);
291 LOGP(
debug,
"Inserting {} in {} ", metalVol->GetName(), chipVol->GetName());
292 chipVol->AddNode(metalVol, 1,
nullptr);
295 chipVol->SetLineColor(kYellow);
296 chipVol->SetTransparency(30);
303 LOGP(error,
"gGeoManager is null");
306 auto* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
308 LOGP(error,
"Missing medium TRK_SILICON$");
312 std::string chipName = Form(
"%s_%s%d",
mLayerName.c_str(),
315 const double hx = 0.5 * mWidth;
317 const double hz = 0.5 * mLengthSensZ;
319 auto* chipShape =
new TGeoBBox(hx, hy, hz);
320 auto* chipVol =
new TGeoVolume(chipName.c_str(), chipShape, medSi);
325 LOGP(
debug,
"Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
326 chipVol->AddNode(sensVol, 1, transSens);
332 LOGP(
debug,
"Inserting {} in {} ", metalVol->GetName(), chipVol->GetName());
333 chipVol->AddNode(metalVol, 1, transMetal);
336 chipVol->SetLineColor(kYellow);
337 chipVol->SetTransparency(30);
344 LOGP(error,
"gGeoManager is null");
347 TGeoMedium* medSi = gGeoManager->GetMedium(
"TRK_SILICON$");
349 LOGP(error,
"Missing medium TRK_SILICON$");
354 mPhiSpanDeg <= 0 || mPhiSpanDeg > 360.0) {
355 LOGP(error,
"Invalid disk chip dims: rMin={}, rMax={}, t={}, phi={}",
360 std::string chipName = Form(
"%s_%s%d",
mLayerName.c_str(),
364 const double halfPhi = 0.5 * mPhiSpanDeg;
366 auto* chipShape =
new TGeoTubeSeg(mRMin, mRMax, halfThickness, -halfPhi, +halfPhi);
367 auto* chipVol =
new TGeoVolume(chipName.c_str(), chipShape, medSi);
368 chipVol->SetLineColor(kYellow);
369 chipVol->SetTransparency(30);
374 auto* tSens =
new TGeoTranslation(0.0, 0.0, zSens);
375 LOGP(
debug,
"Inserting {} in {} ", sensVol->GetName(), chipVol->GetName());
376 chipVol->AddNode(sensVol, 1, tSens);
382 auto* tMetal =
new TGeoTranslation(0.0, 0.0, zMetal);
383 LOGP(
debug,
"Inserting {} in {} ", metalVol->GetName(), chipVol->GetName());
384 chipVol->AddNode(metalVol, 1, tMetal);
397 if (!motherVolume || !gGeoManager) {
398 LOGP(error,
"Null motherVolume or gGeoManager");
401 TGeoMedium* medAir = gGeoManager->GetMedium(
"TRK_AIR$");
403 LOGP(error,
"Missing TRK_AIR$");
409 mPhiSpanDeg <= 0 || mPhiSpanDeg > 360.0 ||
410 mLengthSensZ <= 0 || mLengthSensZ > mLengthZ) {
411 LOGP(error,
"Invalid cylindrical dimensions: r={}, t={}, Z={}, phi={}, sensZ={}",
417 const double rIn = mRadius;
419 const double halfZ = 0.5 * mLengthZ;
420 const double halfPhi = 0.5 * mPhiSpanDeg;
422 auto* layerShape =
new TGeoTubeSeg(rIn, rOut, halfZ, -halfPhi, +halfPhi);
423 auto* layerVol =
new TGeoVolume(
mLayerName.c_str(), layerShape, medAir);
424 layerVol->SetLineColor(kYellow);
425 layerVol->SetTransparency(30);
430 LOGP(error,
"VDCylindricalLayer::createChip() returned null");
433 LOGP(
debug,
"Inserting {} in {} ", chipVol->GetName(), layerVol->GetName());
434 layerVol->AddNode(chipVol, 1,
nullptr);
447 motherVolume->AddNode(layerVol, 1, combiTrans);
453 if (!motherVolume || !gGeoManager) {
454 LOGP(error,
"Null motherVolume or gGeoManager");
457 TGeoMedium* medAir = gGeoManager->GetMedium(
"TRK_AIR$");
459 LOGP(error,
"Missing TRK_AIR$");
464 mLengthSensZ <= 0 || mLengthSensZ > mLengthZ) {
465 LOGP(error,
"Invalid rectangular dims: W={}, t={}, Z={}, sensZ={}",
471 const double hx = 0.5 * mWidth;
473 const double hz = 0.5 * mLengthZ;
475 auto* layerShape =
new TGeoBBox(hx, hy, hz);
476 auto* layerVol =
new TGeoVolume(
mLayerName.c_str(), layerShape, medAir);
477 layerVol->SetLineColor(kYellow);
478 layerVol->SetTransparency(30);
483 LOGP(error,
"VDRectangularLayer::chipVol() returned null");
487 LOGP(
debug,
"Inserting {} in {} ", chipVol->GetName(), layerVol->GetName());
488 layerVol->AddNode(chipVol, 1,
nullptr);
501 motherVolume->AddNode(layerVol, 1, combiTrans);
507 if (!motherVolume || !gGeoManager) {
508 LOGP(error,
"Null motherVolume or gGeoManager");
511 TGeoMedium* medAir = gGeoManager->GetMedium(
"TRK_AIR$");
513 LOGP(error,
"Missing TRK_AIR$");
518 mPhiSpanDeg <= 0 || mPhiSpanDeg > 360.0) {
519 LOGP(error,
"Invalid disk dims: rMin={}, rMax={}, t={}, phi={}",
526 const double halfPhi = 0.5 * mPhiSpanDeg;
529 auto* layerShape =
new TGeoTubeSeg(mRMin, mRMax, halfThickness, -halfPhi, +halfPhi);
530 auto* layerVol =
new TGeoVolume(
mLayerName.c_str(), layerShape, medAir);
531 layerVol->SetLineColor(kYellow);
532 layerVol->SetTransparency(30);
537 LOGP(error,
"VDDiskLayer::createChip() returned null");
542 layerVol->AddNode(chipVol, 1,
nullptr);
544 TGeoTranslation tz(0.0, 0.0, mZPos);
545 motherVolume->AddNode(layerVol, 1, combiTrans ? combiTrans : &tz);
static const char * getTRKChipPattern()
static const char * getTRKSensorPattern()
static const char * getTRKMetalStackPattern()
VDCylindricalLayer(int layerNumber, const std::string &layerName, double layerX2X0, double radius, double phiSpanDeg, double lengthZ, double lengthSensZ)
void createLayer(TGeoVolume *motherVolume, TGeoMatrix *combiTrans=nullptr) const override
TGeoVolume * createSensor() const
TGeoVolume * createChip() const
TGeoVolume * createMetalStack() const
TGeoVolume * createMetalStack() const
void createLayer(TGeoVolume *motherVolume, TGeoMatrix *combiTrans=nullptr) const override
TGeoVolume * createChip() const
VDDiskLayer(int layerNumber, const std::string &layerName, double layerX2X0, double rMin, double rMax, double phiSpanDeg, double zPos)
TGeoVolume * createSensor() const
TGeoVolume * createSensor() const
void createLayer(TGeoVolume *motherVolume, TGeoMatrix *combiTrans=nullptr) const override
TGeoVolume * createMetalStack() const
VDRectangularLayer(int layerNumber, const std::string &layerName, double layerX2X0, double width, double lengthZ, double lengthSensZ)
TGeoVolume * createChip() const
GLuint const GLchar * name
constexpr double thickness
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...