Skip to content

Commit

Permalink
New b0 ecal geo (#788)
Browse files Browse the repository at this point in the history
### Briefly, what does this PR introduce?
This RP introduces fully configurable B0 ECAL geometry, allowing the
setup coordinates of every single crystal. During the iteration with the
designers, the B0 ECAL position was optimized and moved forward
(downstream from the IP) by 15 cm. As a consequence, the B0 tracker
position was rearranged, introducing a larger space between detector
layers.

In addition, a B0 exit window is added to the simulation to make a more
realistic detector response


![image](https://github.com/user-attachments/assets/accb4ac3-55f9-4026-865c-76838dd109d2)


### What kind of change does this PR introduce?
- [ ] Bug fix (issue #__)
- [ ] New feature (issue #__)
- [ ] Documentation update
- [X] Other: B0 ECAL geometry update

### Please check if this PR fulfills the following:
- [X] Tests for the changes have been added
- [ ] Documentation has been added / updated
- [X] Changes have been communicated to collaborators

https://indico.bnl.gov/event/24923/contributions/97007/attachments/57475/98683/2024_09_24_B0_Geometry_update.pdf

### Does this PR introduce breaking changes? What changes might users
need to make to their code?
no

### Does this PR change default behavior?
Slight change in B0 detector performance can be anticipated (better
resolution in reconstructed tracks, and improved acceptance of B0 ECAL.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Dmitry Kalinkin <[email protected]>
  • Loading branch information
3 people authored Nov 13, 2024
1 parent 0b12ea3 commit 48a5603
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 51 deletions.
5 changes: 3 additions & 2 deletions compact/definitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ The unused IDs below are saved for future use.

#### (10-24) Interaction region beamline

- Beampipe ID : 10
- Unused IDs: 11-24
- Beampipe ID : 10-11
- Unused IDs: 12-24

</documentation>
<constant name="BeamPipe_ID" value="10"/>
Expand Down Expand Up @@ -297,6 +297,7 @@ The unused IDs below are saved for future use.
<constant name="B2PF_ID" value="177"/>
<constant name="Q0EF_ID" value="180"/>
<constant name="Q1EF_ID" value="181"/>
<constant name="B0Window_ID" value="182"/>

<documentation>
#### (190-199) Far Backward Beamline Detectors
Expand Down
192 changes: 163 additions & 29 deletions compact/far_forward/B0_ECal.xml

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion compact/far_forward/beampipe_hadron_B0.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@
<detectors>

<detector id="BeamPipeB0_ID" name="BeamPipeB0" type="forwardBeamPipeBrazil" vis="BeamPipeVis">
<position x="-0.165*m" y="0*m" z="6.4*m" />
<position x="-0.165*m" y="0*m" z="B0PF_CenterPosition" />
<rotation x="0*rad" y="0*rad" z="0*rad" />
</detector>

<detector id="B0Window_ID" name="B0Window" type="B0Window" material="StainlessSteel" vis="AnlLightGray">
<dimensions r="B0PF_InnerRadius" z="B0Win_thickness" x="1.9*Q0EF_InnerRadius" y="Beampipe_rmax" />
<position x="B0PF_XPosition" y="0" z="B0PF_CenterPosition-B0PF_Length/2.0+B0Win_thickness" />
<rotation x="0*rad" y="0*rad" z="0*rad" />
</detector>
</detectors>


Expand Down
3 changes: 3 additions & 0 deletions compact/far_forward/definitions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
<constant name="B1PF_InnerRadius" value="13.5*cm"/>
<constant name="B1APF_InnerRadius" value="16.8*cm"/>
<constant name="B2PF_InnerRadius" value="20.0*cm"/>

<constant name="B0Win_thickness" value="4.0*mm"/>

<comment>
The inner radii are temporarily enlarged so the inner coils (UnionSolid) are not built with overlapping volumes
Overlapping boolean volumes may cause issues in DAWN view, even if they were good in simulation
Expand Down
5 changes: 0 additions & 5 deletions src/B0ECal_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) {
addModuleNumbers(sector, nmod);
}

for (xml_coll_t disk(plm, _Unicode(disk)); disk; ++disk) {
auto [sector, nmod] = ip6::geo::add_disk(build_module, desc, detVol, disk, sens, sector_id++);
addModuleNumbers(sector, nmod);
}

// position and rotation of parent volume
Volume motherVol = desc.pickMotherVolume(det);
Transform3D tr(RotationZYX(rot.z(), rot.y(), rot.x()), Position(pos.x(), pos.y(), pos.z()));
Expand Down
56 changes: 56 additions & 0 deletions src/B0Window_geo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (C) 2022 Dhevan Gangadharan

#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Printout.h"
#include "DD4hep/Shapes.h"
#include "DDRec/DetectorData.h"
#include "DDRec/Surface.h"
#include "XML/Layering.h"
#include <XML/Helper.h>

using namespace std;
using namespace dd4hep;

static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector /*sens*/) {

xml_det_t x_det = e;
xml_comp_t x_dim = x_det.dimensions();
xml_comp_t x_pos = x_det.position();
xml_comp_t x_rot = x_det.rotation();
//
string det_name = x_det.nameStr();
string mat_name = dd4hep::getAttrOrDefault<string>(x_det, _U(material), "StainlessSteel");
//
double sizeR = x_dim.r();
double sizeZ = x_dim.z();
double sizeR_el = x_dim.x();
double sizeR_had = x_dim.y();
double posX = x_pos.x();
double posY = x_pos.y();
double posZ = x_pos.z();
double rotX = x_rot.x();
double rotY = x_rot.y();
double rotZ = x_rot.z();

Tube tube(0.0, sizeR, sizeZ);
Tube tube_el(0.0, sizeR_el, sizeZ);
Tube tube_had(0.0, sizeR_had, sizeZ);
SubtractionSolid exit_window(tube, tube_had, Position(0.0, 0.0, 0.0));
exit_window = SubtractionSolid(exit_window, tube_el, Position(-posX, 0.0, 0.0));

Volume vol(det_name + "_vol_ExitWindow", exit_window, description.material(mat_name));
vol.setVisAttributes(description.visAttributes(x_det.visStr()));

Transform3D pos(RotationZYX(rotX, rotY, rotZ), Position(posX, posY, posZ));

DetElement det(det_name, x_det.id());
Volume motherVol = description.pickMotherVolume(det);
PlacedVolume phv = motherVol.placeVolume(vol, pos);

det.setPlacement(phv);

return det;
}

DECLARE_DETELEMENT(B0Window, create_detector)
20 changes: 13 additions & 7 deletions src/forwardBeamPipeBrazil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens *
string det_name = x_det.nameStr();
DetElement sdet(det_name, x_det.id());
Assembly assembly(det_name + "_assembly");
Material m_Al = det.material("Aluminum");
Material m_Be = det.material("Beryllium");
Material m_SS = det.material("StainlessSteel");
Material m_vac = det.material("Vacuum");
string vis_name = x_det.visStr();
Material m_Al = det.material("Aluminum");
Material m_Be = det.material("Beryllium");
Material m_SS = det.material("StainlessSteel");
Material m_vac = det.material("Vacuum");
string vis_name = x_det.visStr();
xml_comp_t x_pos = x_det.position();

PlacedVolume pv_assembly;

Expand Down Expand Up @@ -48,6 +49,10 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens *
-0.0454486856; //This is the angle of the proton orbit from the end of B1APF to the beginning of B2PF
double crossingAngle = -0.025; //relevant for the neutral cone

double b0PFCenter_z =
x_pos
.z(); // location of the center of B0 magnet, used to define the hadron beampipe inside the magnet

double b1APFEndPoint_z =
22062.3828 * dd4hep::mm; //location of proton orbit at b1APF exit -- in mm
double b1APFEndPoint_x = 654.3372 * dd4hep::mm; //location of proton orbit at b1APF exit -- in mm
Expand Down Expand Up @@ -467,8 +472,9 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens *
sdet.setAttributes(det, v_b0_hadron_tube, x_det.regionStr(), x_det.limitsStr(), vis_name);

auto pv_pipe_8 = assembly.placeVolume(
v_b0_hadron_tube,
Transform3D(RotationY(crossingAngle), Position(-16.5, 0.0, 640.0))); // 2353.06094)));
v_b0_hadron_tube, Transform3D(RotationY(crossingAngle),
Position(b0PFCenter_z * sin(crossingAngle), 0.0,
b0PFCenter_z * cos(crossingAngle)))); // 2353.06094)));
pv_pipe_8.addPhysVolID("sector", 1);
DetElement pipe_de_8(sdet, Form("sector_pipe_%d_de", pieceIdx), 1);
pipe_de_8.setPlacement(pv_pipe_6);
Expand Down
14 changes: 7 additions & 7 deletions src/magnetVacuumFF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens *
// that beam pipe geometry
//-------------------------------------------

radii_magnet[0] = 2.9; // cm
lengths_magnet[0] = 120.0; // cm
rotation_magnet[0] = -0.025; // radians
x_elem_magnet[0] = -16.5; // cm
y_elem_magnet[0] = 0.0; // cm
z_elem_magnet[0] = 640.0; // cm
radii_magnet[0] = 2.9; // cm
lengths_magnet[0] = 120.0; // cm
rotation_magnet[0] = -0.025; // radians
x_elem_magnet[0] = 640.0 * sin(-0.025); // cm
y_elem_magnet[0] = 0.0; // cm
z_elem_magnet[0] = 640.0 * cos(-0.025); // cm

//-------------------------------------------
//calculate entrance/exit points of magnets
Expand Down Expand Up @@ -176,7 +176,7 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens *
for (int gapIdx = 0; gapIdx < numGaps; gapIdx++) {

inRadius.push_back(0.0);
outRadius.push_back(radii_magnet[gapIdx + 1]);
outRadius.push_back(radii_magnet[gapIdx]);
phi_initial.push_back(0.0);
phi_final.push_back(2 * M_PI);
nxLow.push_back(-(length_gap[gapIdx] / 2.0) *
Expand Down

0 comments on commit 48a5603

Please sign in to comment.