Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Detectors/FOCAL/base/include/FOCALBase/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ class Geometry
bool getInsertFrontPadLayers() const { return mInsertFrontPadLayers; }
bool getInsertHCalReadoutMaterial() const { return mInsertFrontHCalReadoutMaterial; }

float getDetectorOpeningRight() const { return mGlobal_DetectorOpening_Right; }
float getDetectorOpeningLeft() const { return mGlobal_DetectorOpening_Left; }

std::vector<const Composition*> getFOCALMicroModule(int layer) const;
const Composition* getComposition(int layer, int stack) const;
std::string_view getTowerGapMaterial() const { return mGlobal_Gap_Material; }
Expand Down Expand Up @@ -175,6 +178,9 @@ class Geometry
float mWaferSizeX = 0.0; // Wafer X size
float mWaferSizeY = 0.0; // Wafer Y size

float mGlobal_DetectorOpening_Right = 0.0; // detector opening in X
float mGlobal_DetectorOpening_Left = 0.0; // detector opening in Y

// PIX setup
float mGlobal_Pixel_Size = 0.0; // pixel size
float mGlobal_PIX_SizeX = 0.0; // sensor size X
Expand Down
14 changes: 12 additions & 2 deletions Detectors/FOCAL/base/src/Geometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,16 @@ void Geometry::setParameters(std::string geometryfile)
LOG(debug) << "Z-Location of the FoCAL is set to : " << mGlobal_FOCAL_Z0;
}

if (command.find("DetectorOpen_Right") != std::string::npos) {
mGlobal_DetectorOpening_Right = std::stof(tokens[1]);
LOG(debug) << "Detector opening on the right : " << mGlobal_DetectorOpening_Right;
}

if (command.find("DetectorOpen_Left") != std::string::npos) {
mGlobal_DetectorOpening_Left = std::stof(tokens[1]);
LOG(debug) << "Detector opening on the left : " << mGlobal_DetectorOpening_Left;
}

if (command.find("HCAL_TOWER_SIZE") != std::string::npos) {
mGlobal_HCAL_Tower_Size = std::stof(tokens[1]);
LOG(debug) << "The size of the HCAL readout tower will be : " << mGlobal_HCAL_Tower_Size;
Expand Down Expand Up @@ -578,8 +588,8 @@ void Geometry::setParameters(std::string geometryfile)
}
}
} // end for itowerY
} // end for itowerX
} // end else
} // end for itowerX
} // end else
center_z += tmpComp.getThickness();
} // end loop over pad layer compositions
LOG(debug) << "============ Created all pad layer compositions (" << mPadCompositionBase.size() << " volumes)";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ COMMAND_INSERT_PIX_AT_L9
GLOBAL_TOWER_TOLX 0.02 Air
GLOBAL_TOWER_TOLY 0.8 Al
GLOBAL_FOCAL_Z 763.5
# Open the detector on the right and left in cm,
# can only work if the GLOBAL_HCAL_TOWER_NY is odd number and GLOBAL_HCAL_TOWER_NX is even number
# GLOBAL_DetectorOpen_Right 5
# GLOBAL_DetectorOpen_Left 5
GLOBAL_Tower_NX 2
GLOBAL_Tower_NY 11
GLOBAL_MIDDLE_TOWER_OFFSET 5
Expand Down
72 changes: 58 additions & 14 deletions Detectors/FOCAL/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ void Detector::CreateHCALSpaghetti()
}
}

bool splitDet = mGeometry->getDetectorOpeningRight() > 0.0 || mGeometry->getDetectorOpeningLeft() > 0.0;

double TowerSize = mGeometry->getHCALTowerSize();
double CuBoxThickness = 0.3; // Thickness of the Cu box carrying capillary tubes

Expand Down Expand Up @@ -598,25 +600,57 @@ void Detector::CreateHCALSpaghetti()
Columns = 0;
RowPos = 0.;
Int_t NumTowers = 1;
for (Rows = 0; Rows < nTowersY; Rows++) {

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

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

if (RadialDistance < MinRadius * MinRadius || TMath::Abs(trans->GetTranslation()[0]) > SizeXHCAL / 2) {
continue;
for (Rows = 0; Rows < nTowersY; Rows++) {

float ColumnPos = 0.;
RowPos = Rows * TowerSize;
for (Columns = 0; Columns < nTowersX / 2; Columns++) {
ColumnPos = Columns * TowerSize;
TGeoTranslation* trans = new TGeoTranslation(ColumnPos - SizeXHCAL / 2 + TowerSize / 2, RowPos - SizeYHCAL / 2 + TowerSize / 2, 0.);

// Shit the beampipe towers by TowerSize/2
if (Rows == nTowersY / 2) {
trans->SetDx(trans->GetTranslation()[0] + TowerSize / 2);
}

// Adding the Tower to the HCAL
volHalfHCAL->AddNode(volTowerHCAL, NumTowers, trans);

NumTowers++;
}
volHCAL->AddNode(volHalfHCAL, 1, new TGeoTranslation(SizeXHCAL / 2 + mGeometry->getDetectorOpeningRight(), 0, 0));
TGeoRotation* rotFlipZ = new TGeoRotation();
rotFlipZ->RotateY(180); // Flip around Y to reverse Z
TGeoCombiTrans* combHalf = new TGeoCombiTrans(-SizeXHCAL / 2 - mGeometry->getDetectorOpeningLeft(), 0., 0., rotFlipZ);
volHCAL->AddNode(volHalfHCAL, 2, combHalf);
}
} else {
for (Rows = 0; Rows < nTowersY; Rows++) {

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

NumTowers++;
// Remove the Towers that overlaps with the beam pipe
Double_t RadialDistance = TMath::Power(trans->GetTranslation()[0], 2) + TMath::Power(trans->GetTranslation()[1], 2);

if (RadialDistance < MinRadius * MinRadius || TMath::Abs(trans->GetTranslation()[0]) > SizeXHCAL / 2) {
continue;
}

// Adding the Tower to the HCAL
volHCAL->AddNode(volTowerHCAL, NumTowers, trans);

NumTowers++;
}
}
}

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

bool splitDet = mGeometry->getDetectorOpeningRight() > 0.0 || mGeometry->getDetectorOpeningLeft() > 0.0;

float offset = pars[2];
// gMC->Gsvolu("EMSC1", "BOX", idtmed[3698], pars, 4);//Left towers (pixels shifted right)
// gMC->Gsvolu("EMSC2", "BOX", idtmed[3698], pars, 4);//Right towers (pixels shifted left)
Expand Down Expand Up @@ -977,9 +1013,13 @@ void Detector::CreateECALGeometry()
// const auto towerCenter = geom->getGeoTowerCenter(number); //only ECAL part, second parameter = -1 by default
// xp = std::get<0>towerCenter;
// std::tie(xp, yp, zp) = geom->getGeoTowerCenter(number);
const auto [xp, yp, zp] = geom->getGeoTowerCenter(number); // only ECAL part, second parameter = -1 by default
auto [xp, yp, zp] = geom->getGeoTowerCenter(number); // only ECAL part, second parameter = -1 by default

if (itowerx == 0) {
if (splitDet) {
xp -= geom->getDetectorOpeningLeft();
}

TVirtualMC::GetMC()->Gspos("EMSC1", number + 1, "ECAL", xp, yp, 0, 0, "ONLY");
// Add the SiPad front volumes directly under the FOCAL volume
if (geom->getInsertFrontPadLayers()) {
Expand All @@ -992,6 +1032,10 @@ void Detector::CreateECALGeometry()
}
}
if (itowerx == 1) {
if (splitDet) {
xp += geom->getDetectorOpeningRight();
}

TVirtualMC::GetMC()->Gspos("EMSC2", number + 1, "ECAL", xp, yp, 0, 0, "ONLY");
// Add the SiPad front volumes directly under the FOCAL volume
if (geom->getInsertFrontPadLayers()) {
Expand Down