From d4e75af5583ca2c2ccecd44e96855a84b8cddb20 Mon Sep 17 00:00:00 2001 From: simonge Date: Thu, 3 Jul 2025 15:31:13 +0100 Subject: [PATCH 1/8] Fixes for stuck particles --- compact/far_backward/beamline_extension_hadron.xml | 4 ++-- src/BeamPipeChain_geo.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/compact/far_backward/beamline_extension_hadron.xml b/compact/far_backward/beamline_extension_hadron.xml index 4727479a50..ab3c51751a 100644 --- a/compact/far_backward/beamline_extension_hadron.xml +++ b/compact/far_backward/beamline_extension_hadron.xml @@ -58,8 +58,8 @@ type="BeamPipeChain" wall_thickness="2*mm"> Date: Thu, 3 Jul 2025 15:39:38 +0100 Subject: [PATCH 2/8] Remove debugging cout --- src/BeamPipeChain_geo.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/BeamPipeChain_geo.cpp b/src/BeamPipeChain_geo.cpp index 1595668186..1121b46d74 100644 --- a/src/BeamPipeChain_geo.cpp +++ b/src/BeamPipeChain_geo.cpp @@ -97,9 +97,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / for (uint i = 1; i < thetas.size(); i++) { - std::cout << "Pipe " << i<< ": " << names[i] << std::endl; - std::cout << "theta: " << thetas[i-1] << std::endl; - std::cout << "theta: " << thetas[i] << std::endl; // Start at the join between the first two pipes ending at the join between the last two pipes N-1 double bendAngle = thetas[i] - thetas[i - 1]; if (std::abs(bendAngle) < 0.00001) { @@ -108,8 +105,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / { double bendLength = abs(rOuters1[i] * tan(bendAngle / 2)); bendLengths.push_back(bendLength + bendRadius); - std::cout << "bendAngle: " << bendAngle << std::endl; - std::cout << "bendLength: " << bendLength << std::endl; } } From 60d94ae88a13515d21f5f24814c3979ee825c721 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:41:26 +0000 Subject: [PATCH 3/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/BeamPipeChain_geo.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/BeamPipeChain_geo.cpp b/src/BeamPipeChain_geo.cpp index 1121b46d74..be29a8ecb2 100644 --- a/src/BeamPipeChain_geo.cpp +++ b/src/BeamPipeChain_geo.cpp @@ -84,7 +84,6 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / double l = sqrt(deltaX * deltaX + deltaZ * deltaZ); double theta = atan2(deltaX, deltaZ); - xCenters[pipeN] = x; zCenters[pipeN] = z; lengths[pipeN] = l; @@ -96,9 +95,8 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / // If there is an bend in the pipe, calculate the length reduction of the pipe and joint length for (uint i = 1; i < thetas.size(); i++) { - // Start at the join between the first two pipes ending at the join between the last two pipes N-1 - double bendAngle = thetas[i] - thetas[i - 1]; + double bendAngle = thetas[i] - thetas[i - 1]; if (std::abs(bendAngle) < 0.00001) { bendLengths.push_back(0); } else // Correct for tubes, not yet cones so imperfect From 60820a50ac28bcea595dea209c528fc9c50c3c81 Mon Sep 17 00:00:00 2001 From: simonge Date: Fri, 4 Jul 2025 07:27:36 +0100 Subject: [PATCH 4/8] Add units to bend radius and angle limit --- src/BeamPipeChain_geo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BeamPipeChain_geo.cpp b/src/BeamPipeChain_geo.cpp index be29a8ecb2..560b392e4f 100644 --- a/src/BeamPipeChain_geo.cpp +++ b/src/BeamPipeChain_geo.cpp @@ -28,7 +28,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / Material m_Vacuum = description.material("Vacuum"); string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BeamPipeVis"); double thickness = getAttrOrDefault(x_det, _Unicode(wall_thickness), 0); - double bendRadius = 0.00001; //Small bend radius to allow the construction of toruses + double bendRadius = 0.00001*mm; //Small bend radius to allow the construction of toruses vector names; vector ids; @@ -97,7 +97,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / // Start at the join between the first two pipes ending at the join between the last two pipes N-1 double bendAngle = thetas[i] - thetas[i - 1]; - if (std::abs(bendAngle) < 0.00001) { + if (std::abs(bendAngle) < 0.01*mrad) { bendLengths.push_back(0); } else // Correct for tubes, not yet cones so imperfect { From d402392924604dbe03bd27fa5f9967717468222b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 4 Jul 2025 06:27:54 +0000 Subject: [PATCH 5/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/BeamPipeChain_geo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BeamPipeChain_geo.cpp b/src/BeamPipeChain_geo.cpp index 560b392e4f..066854199e 100644 --- a/src/BeamPipeChain_geo.cpp +++ b/src/BeamPipeChain_geo.cpp @@ -28,7 +28,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / Material m_Vacuum = description.material("Vacuum"); string vis_name = dd4hep::getAttrOrDefault(x_det, _Unicode(vis), "BeamPipeVis"); double thickness = getAttrOrDefault(x_det, _Unicode(wall_thickness), 0); - double bendRadius = 0.00001*mm; //Small bend radius to allow the construction of toruses + double bendRadius = 0.00001 * mm; //Small bend radius to allow the construction of toruses vector names; vector ids; @@ -97,7 +97,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector / // Start at the join between the first two pipes ending at the join between the last two pipes N-1 double bendAngle = thetas[i] - thetas[i - 1]; - if (std::abs(bendAngle) < 0.01*mrad) { + if (std::abs(bendAngle) < 0.01 * mrad) { bendLengths.push_back(0); } else // Correct for tubes, not yet cones so imperfect { From fb80de3256187b0bf5216a05ce68624ea7842b3c Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Tue, 8 Jul 2025 12:56:02 -0400 Subject: [PATCH 6/8] add checks for epic_ip6_extended --- .github/workflows/linux-eic-shell.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 97017d6a96..d7d8e8fe9d 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -293,7 +293,7 @@ jobs: strategy: matrix: option: ['m'] #, 's'] # FIXME - detector_config: [epic_craterlake] # FIXME + detector_config: [epic_craterlake, epic_ip6_extended] # FIXME fail-fast: false steps: - uses: actions/checkout@v4 @@ -346,7 +346,11 @@ jobs: - build strategy: matrix: - detector_config: [epic_craterlake] + include: + - detector_config: epic_craterlake + tolerance_mm: 0.1 + - detector_config: epic_ip6_extended + tolerance_mm: 0.01 fail-fast: false steps: - uses: actions/checkout@v4 @@ -362,7 +366,7 @@ jobs: setup: install/bin/thisepic.sh run: | mkdir -p doc - python scripts/checkOverlaps.py -c ${DETECTOR_PATH}/${{ matrix.detector_config }}.xml | tee doc/overlap_check_geant4.out + python scripts/checkOverlaps.py -t ${{ matrix.tolerance_mm }} -c ${DETECTOR_PATH}/${{ matrix.detector_config }}.xml | tee doc/overlap_check_geant4.out noverlaps="$(grep -c GeomVol1002 doc/overlap_check_geant4.out || true)" if [[ "${noverlaps}" -gt "0" ]] ; then echo "${noverlaps} overlaps found!" && false ; fi From a3a726ccc4c6c59a9fe66bf2f4709d096080030d Mon Sep 17 00:00:00 2001 From: simonge Date: Wed, 22 Oct 2025 10:31:57 +0100 Subject: [PATCH 7/8] Expand inner radius of manget yoke --- .github/workflows/linux-eic-shell.yml | 2 +- src/CylindricalMagnetChain_geo.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux-eic-shell.yml b/.github/workflows/linux-eic-shell.yml index 6091e892b8..abf9f16aaa 100644 --- a/.github/workflows/linux-eic-shell.yml +++ b/.github/workflows/linux-eic-shell.yml @@ -351,7 +351,7 @@ jobs: - detector_config: epic_craterlake tolerance_mm: 0.1 - detector_config: epic_ip6_extended - tolerance_mm: 0.01 + tolerance_mm: 0.1 fail-fast: false steps: - uses: actions/checkout@v5 diff --git a/src/CylindricalMagnetChain_geo.cpp b/src/CylindricalMagnetChain_geo.cpp index 607a575f96..484d0e7f34 100644 --- a/src/CylindricalMagnetChain_geo.cpp +++ b/src/CylindricalMagnetChain_geo.cpp @@ -42,7 +42,9 @@ static Ref_t create_magnet(Detector& description, xml_h e, SensitiveDetector /* double rout = getAttrOrDefault(magnet, _Unicode(rout), 0); // -- yoke - Tube yoke_tube(rin, rout, 0.5 * length); + // Factor of 1.01 is to avoid overlap with small bends before/after the main inner tube + // The magnets here are placeholders and may be replaced with more detailed geometries later + Tube yoke_tube(rin*1.01, rout, 0.5 * length); Volume v_yoke("v_yoke_" + name, yoke_tube, m_Iron); v_yoke.setVisAttributes(description.visAttributes(vis_name)); From 4eaaaf3a737b7246d4a919a73d0b1b5161eb7712 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 22 Oct 2025 09:32:33 +0000 Subject: [PATCH 8/8] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/CylindricalMagnetChain_geo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CylindricalMagnetChain_geo.cpp b/src/CylindricalMagnetChain_geo.cpp index 484d0e7f34..f423647cd0 100644 --- a/src/CylindricalMagnetChain_geo.cpp +++ b/src/CylindricalMagnetChain_geo.cpp @@ -44,7 +44,7 @@ static Ref_t create_magnet(Detector& description, xml_h e, SensitiveDetector /* // -- yoke // Factor of 1.01 is to avoid overlap with small bends before/after the main inner tube // The magnets here are placeholders and may be replaced with more detailed geometries later - Tube yoke_tube(rin*1.01, rout, 0.5 * length); + Tube yoke_tube(rin * 1.01, rout, 0.5 * length); Volume v_yoke("v_yoke_" + name, yoke_tube, m_Iron); v_yoke.setVisAttributes(description.visAttributes(vis_name));