Skip to content

Commit e786dc0

Browse files
authored
[FOCAL-55] Open the detector in the middle in x (#14232)
* Open the detector in the middle in x * Formatting
1 parent 0938b35 commit e786dc0

File tree

4 files changed

+80
-16
lines changed

4 files changed

+80
-16
lines changed

Detectors/FOCAL/base/include/FOCALBase/Geometry.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ class Geometry
135135
bool getInsertFrontPadLayers() const { return mInsertFrontPadLayers; }
136136
bool getInsertHCalReadoutMaterial() const { return mInsertFrontHCalReadoutMaterial; }
137137

138+
float getDetectorOpeningRight() const { return mGlobal_DetectorOpening_Right; }
139+
float getDetectorOpeningLeft() const { return mGlobal_DetectorOpening_Left; }
140+
138141
std::vector<const Composition*> getFOCALMicroModule(int layer) const;
139142
const Composition* getComposition(int layer, int stack) const;
140143
std::string_view getTowerGapMaterial() const { return mGlobal_Gap_Material; }
@@ -175,6 +178,9 @@ class Geometry
175178
float mWaferSizeX = 0.0; // Wafer X size
176179
float mWaferSizeY = 0.0; // Wafer Y size
177180

181+
float mGlobal_DetectorOpening_Right = 0.0; // detector opening in X
182+
float mGlobal_DetectorOpening_Left = 0.0; // detector opening in Y
183+
178184
// PIX setup
179185
float mGlobal_Pixel_Size = 0.0; // pixel size
180186
float mGlobal_PIX_SizeX = 0.0; // sensor size X

Detectors/FOCAL/base/src/Geometry.cxx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,16 @@ void Geometry::setParameters(std::string geometryfile)
351351
LOG(debug) << "Z-Location of the FoCAL is set to : " << mGlobal_FOCAL_Z0;
352352
}
353353

354+
if (command.find("DetectorOpen_Right") != std::string::npos) {
355+
mGlobal_DetectorOpening_Right = std::stof(tokens[1]);
356+
LOG(debug) << "Detector opening on the right : " << mGlobal_DetectorOpening_Right;
357+
}
358+
359+
if (command.find("DetectorOpen_Left") != std::string::npos) {
360+
mGlobal_DetectorOpening_Left = std::stof(tokens[1]);
361+
LOG(debug) << "Detector opening on the left : " << mGlobal_DetectorOpening_Left;
362+
}
363+
354364
if (command.find("HCAL_TOWER_SIZE") != std::string::npos) {
355365
mGlobal_HCAL_Tower_Size = std::stof(tokens[1]);
356366
LOG(debug) << "The size of the HCAL readout tower will be : " << mGlobal_HCAL_Tower_Size;
@@ -578,8 +588,8 @@ void Geometry::setParameters(std::string geometryfile)
578588
}
579589
}
580590
} // end for itowerY
581-
} // end for itowerX
582-
} // end else
591+
} // end for itowerX
592+
} // end else
583593
center_z += tmpComp.getThickness();
584594
} // end loop over pad layer compositions
585595
LOG(debug) << "============ Created all pad layer compositions (" << mPadCompositionBase.size() << " volumes)";

Detectors/FOCAL/simulation/geometryFiles/geometry_Spaghetti.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ COMMAND_INSERT_PIX_AT_L9
5959
GLOBAL_TOWER_TOLX 0.02 Air
6060
GLOBAL_TOWER_TOLY 0.8 Al
6161
GLOBAL_FOCAL_Z 763.5
62+
# Open the detector on the right and left in cm,
63+
# can only work if the GLOBAL_HCAL_TOWER_NY is odd number and GLOBAL_HCAL_TOWER_NX is even number
64+
# GLOBAL_DetectorOpen_Right 5
65+
# GLOBAL_DetectorOpen_Left 5
6266
GLOBAL_Tower_NX 2
6367
GLOBAL_Tower_NY 11
6468
GLOBAL_MIDDLE_TOWER_OFFSET 5

Detectors/FOCAL/simulation/src/Detector.cxx

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ void Detector::CreateHCALSpaghetti()
539539
}
540540
}
541541

542+
bool splitDet = mGeometry->getDetectorOpeningRight() > 0.0 || mGeometry->getDetectorOpeningLeft() > 0.0;
543+
542544
double TowerSize = mGeometry->getHCALTowerSize();
543545
double CuBoxThickness = 0.3; // Thickness of the Cu box carrying capillary tubes
544546

@@ -598,25 +600,57 @@ void Detector::CreateHCALSpaghetti()
598600
Columns = 0;
599601
RowPos = 0.;
600602
Int_t NumTowers = 1;
601-
for (Rows = 0; Rows < nTowersY; Rows++) {
602603

603-
float ColumnPos = 0.;
604-
RowPos = Rows * TowerSize;
605-
for (Columns = 0; Columns < nTowersX; Columns++) {
606-
ColumnPos = Columns * TowerSize;
607-
TGeoTranslation* trans = new TGeoTranslation(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, RowPos - SizeYHCAL / 2 + TowerSize / 2, 0.);
604+
if (splitDet) {
605+
SizeXHCAL = SizeXHCAL / 2;
608606

609-
// Remove the Towers that overlaps with the beam pipe
610-
Double_t RadialDistance = TMath::Power(trans->GetTranslation()[0], 2) + TMath::Power(trans->GetTranslation()[1], 2);
607+
TGeoVolumeAssembly* volHalfHCAL = new TGeoVolumeAssembly("HalfHCAL");
611608

612-
if (RadialDistance < MinRadius * MinRadius || TMath::Abs(trans->GetTranslation()[0]) > SizeXHCAL / 2) {
613-
continue;
609+
for (Rows = 0; Rows < nTowersY; Rows++) {
610+
611+
float ColumnPos = 0.;
612+
RowPos = Rows * TowerSize;
613+
for (Columns = 0; Columns < nTowersX / 2; Columns++) {
614+
ColumnPos = Columns * TowerSize;
615+
TGeoTranslation* trans = new TGeoTranslation(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, RowPos - SizeYHCAL / 2 + TowerSize / 2, 0.);
616+
617+
// Shit the beampipe towers by TowerSize/2
618+
if (Rows == nTowersY / 2) {
619+
trans->SetDx(trans->GetTranslation()[0] + TowerSize / 2);
620+
}
621+
622+
// Adding the Tower to the HCAL
623+
volHalfHCAL->AddNode(volTowerHCAL, NumTowers, trans);
624+
625+
NumTowers++;
614626
}
627+
volHCAL->AddNode(volHalfHCAL, 1, new TGeoTranslation(SizeXHCAL / 2 + mGeometry->getDetectorOpeningRight(), 0, 0));
628+
TGeoRotation* rotFlipZ = new TGeoRotation();
629+
rotFlipZ->RotateY(180); // Flip around Y to reverse Z
630+
TGeoCombiTrans* combHalf = new TGeoCombiTrans(-SizeXHCAL / 2 - mGeometry->getDetectorOpeningLeft(), 0., 0., rotFlipZ);
631+
volHCAL->AddNode(volHalfHCAL, 2, combHalf);
632+
}
633+
} else {
634+
for (Rows = 0; Rows < nTowersY; Rows++) {
615635

616-
// Adding the Tower to the HCAL
617-
volHCAL->AddNode(volTowerHCAL, NumTowers, trans);
636+
float ColumnPos = 0.;
637+
RowPos = Rows * TowerSize;
638+
for (Columns = 0; Columns < nTowersX; Columns++) {
639+
ColumnPos = Columns * TowerSize;
640+
TGeoTranslation* trans = new TGeoTranslation(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, RowPos - SizeYHCAL / 2 + TowerSize / 2, 0.);
618641

619-
NumTowers++;
642+
// Remove the Towers that overlaps with the beam pipe
643+
Double_t RadialDistance = TMath::Power(trans->GetTranslation()[0], 2) + TMath::Power(trans->GetTranslation()[1], 2);
644+
645+
if (RadialDistance < MinRadius * MinRadius || TMath::Abs(trans->GetTranslation()[0]) > SizeXHCAL / 2) {
646+
continue;
647+
}
648+
649+
// Adding the Tower to the HCAL
650+
volHCAL->AddNode(volTowerHCAL, NumTowers, trans);
651+
652+
NumTowers++;
653+
}
620654
}
621655
}
622656

@@ -791,6 +825,8 @@ void Detector::CreateECALGeometry()
791825
// this shifts all the pixel layers to the center near the beampipe
792826
double pixshift = geom->getTowerSizeX() - (geom->getGlobalPixelWaferSizeX() * geom->getNumberOfPIXsInX());
793827

828+
bool splitDet = mGeometry->getDetectorOpeningRight() > 0.0 || mGeometry->getDetectorOpeningLeft() > 0.0;
829+
794830
float offset = pars[2];
795831
// gMC->Gsvolu("EMSC1", "BOX", idtmed[3698], pars, 4);//Left towers (pixels shifted right)
796832
// gMC->Gsvolu("EMSC2", "BOX", idtmed[3698], pars, 4);//Right towers (pixels shifted left)
@@ -977,9 +1013,13 @@ void Detector::CreateECALGeometry()
9771013
// const auto towerCenter = geom->getGeoTowerCenter(number); //only ECAL part, second parameter = -1 by default
9781014
// xp = std::get<0>towerCenter;
9791015
// std::tie(xp, yp, zp) = geom->getGeoTowerCenter(number);
980-
const auto [xp, yp, zp] = geom->getGeoTowerCenter(number); // only ECAL part, second parameter = -1 by default
1016+
auto [xp, yp, zp] = geom->getGeoTowerCenter(number); // only ECAL part, second parameter = -1 by default
9811017

9821018
if (itowerx == 0) {
1019+
if (splitDet) {
1020+
xp -= geom->getDetectorOpeningLeft();
1021+
}
1022+
9831023
TVirtualMC::GetMC()->Gspos("EMSC1", number + 1, "ECAL", xp, yp, 0, 0, "ONLY");
9841024
// Add the SiPad front volumes directly under the FOCAL volume
9851025
if (geom->getInsertFrontPadLayers()) {
@@ -992,6 +1032,10 @@ void Detector::CreateECALGeometry()
9921032
}
9931033
}
9941034
if (itowerx == 1) {
1035+
if (splitDet) {
1036+
xp += geom->getDetectorOpeningRight();
1037+
}
1038+
9951039
TVirtualMC::GetMC()->Gspos("EMSC2", number + 1, "ECAL", xp, yp, 0, 0, "ONLY");
9961040
// Add the SiPad front volumes directly under the FOCAL volume
9971041
if (geom->getInsertFrontPadLayers()) {

0 commit comments

Comments
 (0)