diff --git a/compact/definitions.xml b/compact/definitions.xml index d290ddf37ad862f4c6520233f6809ab28354b74a..043265746228d0a37294d6e9bd6892b5ff59af72 100644 --- a/compact/definitions.xml +++ b/compact/definitions.xml @@ -659,14 +659,14 @@ -------------------------- will move later </comment> - <constant name="fi_B0_EMCAL_ID" value="500"/> + <constant name="fi_B0_EMCAL_ID" value="500"/> <constant name="fi_B0_EMCAL_y_length" value="4 * cm"/> <constant name="fi_B0_EMCAL_x_length" value="4 * cm"/> <constant name="fi_B0_EMCAL_sizez" value="40 * cm"/> <constant name="fi_B0_EMCAL_rmin" value="7 * cm"/> <constant name="fi_B0_EMCAL_rmax" value="10 * cm"/> <constant name="fi_B0_EMCAL_z" value="0 * cm"/> - <constant name="fi_B0_EMCAL_Gap" value="0.01 * mm"/> + <constant name="fi_B0_EMCAL_Gap" value="0.0001 * cm"/> <constant name="fi_B0_EMCAL_x_Shift" value="-35 * cm"/> <constant name="fi_B0_EMCAL_angle" value="0.05"/><comment> not used in .h file </comment> diff --git a/src/fi_B0_EMCAL.cpp b/src/fi_B0_EMCAL.cpp index add7217be3b6fdade69b9df0d7f7cd52593c58c7..36beb2dcf969c0a6237fd3d252f627aefeae0f31 100644 --- a/src/fi_B0_EMCAL.cpp +++ b/src/fi_B0_EMCAL.cpp @@ -16,18 +16,21 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens double ROut = dims.rmax(); double SizeZ = dims.z_length(); double X_Shift = dims.x_offset(); - double X_length = dims.width(); + double X_length = dims.width(); double Y_length = dims.length(); double Z = dims.z(); - double Angle = dims.angle(); + double Angle = dims.angle();//Created, but not used in the .h file double Gap = dims.gap(); Material pbw04 = desc.material("PbWO4"); Material vacuum = desc.material("Vacuum"); + double beampipe_rmax = 2.76 *dd4hep::cm; //Outer volume Box fi_B0_EMCAL_Solid(X_length / 2., Y_length / 2., SizeZ / 2.); - Volume envelopeVol("fi_B0_EMCAL_Logic", fi_B0_EMCAL_Solid, pbw04); - envelopeVol.setVisAttributes(desc.visAttributes(detElem.visStr())); + Box beam_pipe(beampipe_rmax / 2., beampipe_rmax / 2.0, SizeZ / 2.); + SubtractionSolid fi_B0_EMCAL_SolidSub(fi_B0_EMCAL_Solid, beam_pipe); + Volume envelopeVol("fi_B0_EMCAL_Logic", fi_B0_EMCAL_SolidSub, pbw04); + //envelopeVol.setVisAttributes(desc.visAttributes(detElem.visStr())); // Crystals double y_C = 0 * dd4hep::cm; @@ -45,7 +48,7 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens if (R < ROut - X_length + Gap && R > RIn) { k++; std::sprintf(abname, "fi_B0_EMCAL_%d", k); - Volume crystalVol1(abname, fi_B0_EMCAL_Solid, pbw04); + Volume crystalVol1(abname, fi_B0_EMCAL_SolidSub, pbw04); crystalVol1.setSensitiveDetector(sens); Transform3D tr1(RotationZYX(0,0,0), Position(x_C + X_Shift, y_C, Z)); PlacedVolume cry1 = envelopeVol.placeVolume(crystalVol1, tr1); @@ -53,7 +56,7 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens k++; std::sprintf(abname, "fi_B0_EMCAL_%d", k); - Volume crystalVol2(abname, fi_B0_EMCAL_Solid, pbw04); + Volume crystalVol2(abname, fi_B0_EMCAL_SolidSub, pbw04); crystalVol2.setSensitiveDetector(sens); Transform3D tr2(RotationZYX(0,0,0), Position(-x_C + X_Shift, y_C, Z)); PlacedVolume cry2 = envelopeVol.placeVolume(crystalVol2, tr2); @@ -61,7 +64,7 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens k++; std::sprintf(abname, "fi_B0_EMCAL_%d", k); - Volume crystalVol3(abname, fi_B0_EMCAL_Solid, pbw04); + Volume crystalVol3(abname, fi_B0_EMCAL_SolidSub, pbw04); crystalVol3.setSensitiveDetector(sens); Transform3D tr3(RotationZYX(0,0,0), Position(x_C + X_Shift, -y_C, Z)); PlacedVolume cry3 = envelopeVol.placeVolume(crystalVol3, tr3); @@ -69,7 +72,7 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens k++; std::sprintf(abname, "fi_B0_EMCAL_%d", k); - Volume crystalVol4(abname, fi_B0_EMCAL_Solid, pbw04); + Volume crystalVol4(abname, fi_B0_EMCAL_SolidSub, pbw04); crystalVol4.setSensitiveDetector(sens); Transform3D tr4(RotationZYX(0,0,0), Position(-x_C + X_Shift, -y_C, Z)); PlacedVolume cry4 = envelopeVol.placeVolume(crystalVol4, tr4);