Skip to content

Commit

Permalink
Solving pre-shower overlap problems
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoudali2 committed Sep 30, 2024
1 parent 50af79a commit 3fc5699
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 39 deletions.
16 changes: 11 additions & 5 deletions FCCee/IDEA/compact/IDEA_o1_v03/DectDimensions_IDEA_o1_v03.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<constant name="DetID_FiberDRCalo" value=" 25"/>

<constant name="DetID_muonSystem" value=" 26"/>
<constant name="DetID_Preshower" value=" 27"/>

<!-- BPW: Beam Pipe Width -->
<constant name="BPWWall" value="0.35*mm" />
Expand Down Expand Up @@ -205,6 +206,16 @@
<constant name="tracker_region_zmax" value="DCH_half_length_total"/>
<constant name="tracker_region_rmax" value="DCH_outer_cyl_R_total"/>

<!-- Pre-shower Parameters-->
<constant name = "psNumSides" value = "32"/> <!-- The number of sides of the pre-shower -->
<!-- Barrel -->
<constant name = "psBarrelFirstLayerRadius" value = "2440*mm"/> <!-- 1st Barrel microRWELL detector inner radius-> its the start point of thicknesses of the microRWELL material. In our case the shape is Polygon, so the radius is in the middle of the polygon side. -->
<constant name = "psBarrelLength" value = "5100*mm"/> <!--Barrel detector length, in the description of the detctor we always use the half-length -->
<!-- Endcap -->
<constant name = "psEndcapFirstLayerZOffset" value = "2550*mm"/> <!-- 1st Endcap microRWELL detector inner ZOffset-> its the start point of thicknesses of the microRWELL volume -->
<constant name = "psEndcapLayersInnerRadius" value = "390*mm"/> <!--Endcap detector inner radius, its the start point of thicknesses of the detector material ** it applies for both detector layers and yoke-->
<constant name = "psEndcapLayersOuterRadius" value = "2430*mm"/> <!--Endcap detector outer radius, its the end point of thicknesses of the detector material ** it applies for both detector layers and yoke-->

<!-- Fiber dual-readout calorimeter tower dim-->
<constant name="FiberDRCalo_world_outer_radius" value="4525.*mm"/>
<constant name="FiberDRCalo_world_inner_radius" value="252.*mm"/>
Expand All @@ -220,20 +231,15 @@
<constant name="FiberDRCalo_endcap_nphi" value="144"/>

<!-- Muon System Parameters-->

<constant name = "numberOfSides" value = "8"/> <!-- The number of sides of the muon system e.g (Octagon, Hexagon, ...)-->

<!-- Barrel -->
<constant name = "BarrelFirstLayerRadius" value = "4500*mm"/> <!-- 1st Barrel microRWELL detector inner radius-> its the start point of thicknesses of the microRWELL material. In our case the shape is Polygon, so the radius is in the middle of the polygon side. -->
<constant name = "BarrelLength" value = "9000*mm"/> <!--Barrel detector length, in the description of the detctor we always use the half-length -->
<!-- Endcap -->
<constant name = "EndcapFirstLayerZOffset" value = "4500*mm"/> <!-- 1st Endcap microRWELL detector inner ZOffset-> its the start point of thicknesses of the microRWELL volume -->
<constant name = "EndcapLayersInnerRadius" value = "700*mm"/> <!--Endcap detector inner radius, its the start point of thicknesses of the detector material ** it applies for both detector layers and yoke-->
<constant name = "EndcapLayersOuterRadius" value = "5320*mm"/> <!--Endcap detector outer radius, its the end point of thicknesses of the detector material ** it applies for both detector layers and yoke-->

<!-- End of Muon system Parameters-->


</define>


Expand Down
14 changes: 6 additions & 8 deletions FCCee/IDEA/compact/IDEA_o1_v03/Preshower_o1_v01.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<info name="pre-shower"
title=" detailed version of IDEA pre-shower system for FCC-ee"
author="Nitika Nitika and Mahmoud Ali- [email protected]"
author="Nitika Nitika- [email protected], Mahmoud Ali- [email protected]"
url="no"
status="development"
version="2.0">
Expand All @@ -29,8 +29,6 @@
<constant name = "overlapingY" value = "5*mm"/> <!-- the common distance between mRWELL chambers in Y direction -->
<constant name = "overlapingZ" value = "5*mm"/> <!-- the common distance between mRWELL chambers in Z direction -->
<constant name = "clearance" value = "1*mm"/> <!-- it's a small distance to be used to avoid overlapping between the different volumes ~ 1 mm -->
<!-- %%%%%% Iron yoke thickness %%%%%% -->
<constant name = "YokeThickness" value = "300*mm"/>
</define>

<readouts>
Expand All @@ -42,14 +40,14 @@

<detectors>
<!-- mRWELL envelope -->
<detector name="Preshower" type="muonSystemMuRWELL_o1_v01" id="33" readout="PreshowerSystemCollection">
<detector name="Preshower" type="muonSystemMuRWELL_o1_v01" id="DetID_Preshower" readout="PreshowerSystemCollection">
<dimensions x="mRWELLTotalThickness/2.0" y="mRWELLYLength" z="mRWELLZLength" x_offset="0*mm" y_offset="0*mm" z_offset="0*mm" material="Air"/>
<sensitive type="tracker"/>

<!-- Specify the detector parameters and the overlap /// if you want exclude any component, e.g: endcap, just put endcapDetectorParameters=0 // radius is put in the middle, so its not the inner neither the outer -->
<generalParameters numSides="32" overlapY="overlapingY" overlapZ="overlapingZ" clearance="clearance"/>
<Barrel numDetectorLayers ="1" rmin="2440*mm" length="5100*mm" numYokes="0" yoke_Thickness="0*mm" yoke_Material="G4_Fe"/>
<Endcap numDetectorLayers="1" rmin="390*mm" rmax="2430*mm" z_offset="2550*mm" numYokes="0" yoke_Thickness="0*mm" yoke_Material="G4_Fe" />
<generalParameters numSides="psNumSides" overlapY="overlapingY" overlapZ="overlapingZ" clearance="clearance"/>
<Barrel numDetectorLayers ="1" rmin="psBarrelFirstLayerRadius" length="psBarrelLength" numYokes="0" yoke_Thickness="0*mm" yoke_Material="G4_Fe"/>
<Endcap numDetectorLayers="1" rmin="psEndcapLayersInnerRadius" rmax="psEndcapLayersOuterRadius" z_offset="psEndcapFirstLayerZOffset" numYokes="0" yoke_Thickness="0*mm" yoke_Material="G4_Fe" />

<!-- mRWELL chamber -->
<!-- note: all thicknesses are half-lengths -->
Expand All @@ -66,4 +64,4 @@
</detector>
</detectors>

</lccdd>
</lccdd>
66 changes: 40 additions & 26 deletions detector/muonSystem/muonSystemMuRWELL_o1_v01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ static dd4hep::Ref_t createmuonSystemMuRWELL_o1_v01(dd4hep::Detector& lcdd,
double rectangleThickness = (2 * dimensions.y()) * std::sin(chamberAngle_rad) + (2 * dimensions.x()) * std::cos(chamberAngle_rad) + 1.2 * clearance;
double rectangleAngle_rad = std::atan(rectangleThickness/dimensions.z());
double detectorVolumeThickness;
double endcapDetectorEnvZ; // endcap detetcor layer thickness
if (sideLengthEstimate <= (2 * dimensions.y()) && numBarrelDetectorLayers == 1){ // putting this condtition to minimize the volume thickness in case of there is only one chamber per side(espicially for circular shape detector)
detectorVolumeThickness = rectangleThickness + 2 * clearance;
detectorVolumeThickness = rectangleThickness * 1.33; // multiplying by 1.33 fit the best thickness avoiding overlaps with smaller volumes insides (rectangles).
endcapDetectorEnvZ = 2 * detectorVolumeThickness;
} else {
detectorVolumeThickness = (2 * dimensions.z()) * std::sin(rectangleAngle_rad) + rectangleThickness * std::cos(rectangleAngle_rad);
endcapDetectorEnvZ = detectorVolumeThickness;
}

double endcapDetectorSideLength = (2 * (endcapDetectorLayerInnerRadius + 2 * dimensions.y()) * std::tan(shapeAngle_radians)) + 2 * clearance;
Expand All @@ -107,11 +110,9 @@ static dd4hep::Ref_t createmuonSystemMuRWELL_o1_v01(dd4hep::Detector& lcdd,

double endcapRemainderZ = std::fmod((endcapDetectorYLength - 2 * clearance), (2 * dimensions.z() - overlapZ)) / (2 * dimensions.z()) - (2 * clearance / dimensions.z());

double endcapDetectorEnvZ = detectorVolumeThickness; // layer thickness

double barrelRMax = radius + numBarrelDetectorLayers * (2 * detectorVolumeThickness) + numBarrelRadiators * barrelRadiatorThickness;
double barreltotalLength = barrelLength + (numEndcapDetectorLayers * 2) * (2 * detectorVolumeThickness) + (numEndcapRadiators * 2) * endcapRadiatorThickness; // This condition to make the last barrel layer encloses all the endcap layers inside it.
double EndcaptotalLength = numEndcapDetectorLayers * (2 * detectorVolumeThickness) + numEndcapRadiators * endcapRadiatorThickness;
double EndcaptotalLength = numEndcapDetectorLayers * (2 * endcapDetectorEnvZ) + numEndcapRadiators * endcapRadiatorThickness;
double endcapOffset = endcapZOffset + EndcaptotalLength/2.0;

int barrelIdCounter = 1;
Expand Down Expand Up @@ -673,9 +674,9 @@ static dd4hep::Ref_t createmuonSystemMuRWELL_o1_v01(dd4hep::Detector& lcdd,
std::string endcapDetectorEnvelopeName;
double endcapDetectorEnvZPos;

dd4hep::PolyhedraRegular endcapDetectorEnvelope(numSides, endcapDetectorLayerInnerRadius, endcapDetectorLayerOuterRadius, 2 * detectorVolumeThickness);
dd4hep::PolyhedraRegular endcapDetectorEnvelope(numSides, endcapDetectorLayerInnerRadius, endcapDetectorLayerOuterRadius, 2 * endcapDetectorEnvZ);

endcapLayerZOffset = - EndcaptotalLength/2.0 + detectorVolumeThickness + numEndcapLayer * (2 * detectorVolumeThickness) + numEndcapLayer * endcapRadiatorThickness; // Automation of inner Z-Offset of different layers, taking into account that every detector layer is followed by a yoke(radiator) layer
endcapLayerZOffset = - EndcaptotalLength/2.0 + endcapDetectorEnvZ + numEndcapLayer * (2 * endcapDetectorEnvZ) + numEndcapLayer * endcapRadiatorThickness; // Automation of inner Z-Offset of different layers, taking into account that every detector layer is followed by a yoke(radiator) layer
endcapDetectorEnvelopeName = name + "-EndcapDetectorLayer" + std::to_string(numEndcapLayer + 1);
endcapDetectorEnvZPos = endcapLayerZOffset;

Expand All @@ -698,8 +699,8 @@ static dd4hep::Ref_t createmuonSystemMuRWELL_o1_v01(dd4hep::Detector& lcdd,
for (int side = 0; side < numSides; ++side) {

int sideID = (numEndcapLayer + 1) * 100 + (side +1); // to differentiated with the same side in different layers.
dd4hep::Trapezoid endcapDetectorSideTrap(endcapDetectorEnvZ/2.0, endcapDetectorEnvZ/2.0, endcapDetectorSideLength/2.0, endcapDetectorSideTrapLength/2.0, endcapDetectorSideTrapYLength/2.0);
dd4hep::Box endcapDetectorSideBox(endcapDetectorEnvZ/2.0, endcapDetectorSideBoxLength/2.0, endcapDetectorSideBoxYLength/2.0);
dd4hep::Trapezoid endcapDetectorSideTrap(detectorVolumeThickness/2.0, detectorVolumeThickness/2.0, endcapDetectorSideLength/2.0, endcapDetectorSideTrapLength/2.0, endcapDetectorSideTrapYLength/2.0);
dd4hep::Box endcapDetectorSideBox(detectorVolumeThickness/2.0, endcapDetectorSideBoxLength/2.0, endcapDetectorSideBoxYLength/2.0);

double boxOffsetZ = endcapDetectorYLength/2.0;

Expand Down Expand Up @@ -727,31 +728,44 @@ static dd4hep::Ref_t createmuonSystemMuRWELL_o1_v01(dd4hep::Detector& lcdd,

double endcapDetectorSideEnvXPos = endcapDetectorXOffset ;
double endcapDetectorSideEnvYPos = endcapDetectorYOffset ;
double endcapDetectorSideEnvZPos = - endcapDetectorEnvZ/2.0 ;
double endcapDetectorSideEnvZPos2 = endcapDetectorEnvZ/2.0;

// --------- here I start to divide the two z-positions // by odd and even numbers
double endcapDetectorSideEnvZPos;
double endcapDetectorSideEnvZPos2;

dd4hep::Position endcapDetectorSideEnvTrans;
dd4hep::PlacedVolume endcapDetectorSideEnvPhys;
dd4hep::DetElement endcapDetectorSideEnvDE;

if (side % 2 == 0) {
if (sideLengthEstimate <= (2 * dimensions.y())){ // in case of small side's length, put the sides in 4 differnet positions, to avoid overlaps between different sides, and the probability increases for small sides
endcapDetectorSideEnvZPos = -endcapDetectorEnvZ/4.0;
endcapDetectorSideEnvZPos2 = -endcapDetectorEnvZ * 3.0/4.0;
double endcapDetectorSideEnvZPos3 = endcapDetectorEnvZ/4.0;
double endcapDetectorSideEnvZPos4 = endcapDetectorEnvZ * 3.0/4.0;

if (side % 4 == 0) {
endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos);
} else if (side % 4 == 1) {
endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos2);
} else if (side % 4 == 2) {
endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos3);
} else {
endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos4);
}

endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos);
endcapDetectorSideEnvPhys = endcapDetectorEnvVol.placeVolume(endcapDetectorSideEnvVol, dd4hep::Transform3D(endcapDetectorRotation * dd4hep::RotationY(90.0 * dd4hep::degree) , endcapDetectorSideEnvTrans));
endcapDetectorSideEnvDE = dd4hep::DetElement(endcapDetectorEnvelopeDE, endcapDetectorSideEnvName + "DE", sideID);
endcapDetectorSideEnvDE.setPlacement(endcapDetectorSideEnvPhys);
endcapDetectorSideEnvVol.setVisAttributes(lcdd, xmlDet.visStr());
} else { // else, put the sides in 2 differnet positions.
endcapDetectorSideEnvZPos = -endcapDetectorEnvZ/2.0;
endcapDetectorSideEnvZPos2 = endcapDetectorEnvZ/2.0;

} else {
if (side % 2 == 0) {
endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos);
} else {
endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos2);
}
}

endcapDetectorSideEnvTrans = dd4hep::Position(endcapDetectorSideEnvXPos, endcapDetectorSideEnvYPos, endcapDetectorSideEnvZPos2);
endcapDetectorSideEnvPhys = endcapDetectorEnvVol.placeVolume(endcapDetectorSideEnvVol, dd4hep::Transform3D(endcapDetectorRotation * dd4hep::RotationY(90.0 * dd4hep::degree) , endcapDetectorSideEnvTrans));
endcapDetectorSideEnvDE = dd4hep::DetElement(endcapDetectorEnvelopeDE, endcapDetectorSideEnvName + "DE", sideID);
endcapDetectorSideEnvDE.setPlacement(endcapDetectorSideEnvPhys);
endcapDetectorSideEnvVol.setVisAttributes(lcdd, xmlDet.visStr());
}
endcapDetectorSideEnvPhys = endcapDetectorEnvVol.placeVolume(endcapDetectorSideEnvVol, dd4hep::Transform3D(endcapDetectorRotation * dd4hep::RotationY(90.0 * dd4hep::degree) , endcapDetectorSideEnvTrans));
endcapDetectorSideEnvDE = dd4hep::DetElement(endcapDetectorEnvelopeDE, endcapDetectorSideEnvName + "DE", sideID);
endcapDetectorSideEnvDE.setPlacement(endcapDetectorSideEnvPhys);
endcapDetectorSideEnvVol.setVisAttributes(lcdd, xmlDet.visStr());

// ----- dividing the trapezoid envelope to smaller pieces (rectangles)

Expand Down Expand Up @@ -952,7 +966,7 @@ static dd4hep::Ref_t createmuonSystemMuRWELL_o1_v01(dd4hep::Detector& lcdd,

for (int numEndcapRadiatorLayer = 0; numEndcapRadiatorLayer < numEndcapRadiators; ++numEndcapRadiatorLayer){

double endcapRadiatorLayerZOffset = - EndcaptotalLength/2.0 + (endcapRadiatorThickness/2.0) + (numEndcapRadiatorLayer +1) * (2 * detectorVolumeThickness) + numEndcapRadiatorLayer * endcapRadiatorThickness; // Automation of inner Z-Offset of different layers, taking into account that every detector layer is followed by a yoke(radiator) layer
double endcapRadiatorLayerZOffset = - EndcaptotalLength/2.0 + (endcapRadiatorThickness/2.0) + (numEndcapRadiatorLayer +1) * (2 * endcapDetectorEnvZ) + numEndcapRadiatorLayer * endcapRadiatorThickness; // Automation of inner Z-Offset of different layers, taking into account that every detector layer is followed by a yoke(radiator) layer

dd4hep::PolyhedraRegular endcapRadiatorEnvelope(numSides, endcapRadiatorLayerInnerRadius, endcapRadiatorLayerOuterRadius, endcapRadiatorThickness);
std::string endcapRadiatorEnvelopeName = name + "-EndcapRadiatorLayer" + std::to_string(numEndcapRadiatorLayer + 1);
Expand Down

0 comments on commit 3fc5699

Please sign in to comment.