Skip to content

Commit 210a2a7

Browse files
sawenzelclaude
andcommitted
Close the nanometre gaps between EMCAL modules
This fixes the placement of the tilted EMCAL modules and adds a unit test. - Neighbouring modules in eta were separated by nanometre gaps of supermodule air. - The TRD1 outer width m2Trd1Dx2 was a float, which tilted the module side faces. - The centre of the first module did not follow the corner convention of the other modules. - m2Trd1Dx2 is now a double. - The first module now uses the same convention as the others. - A new test checks that the faces of neighbouring modules coincide. https://its.cern.ch/jira/browse/O2-7334 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 2a9e915 commit 210a2a7

3 files changed

Lines changed: 41 additions & 5 deletions

File tree

‎Detectors/EMCAL/base/include/EMCALBase/Geometry.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class Geometry
222222
Int_t GetNCells() const { return mNCells; }
223223
Float_t GetLongModuleSize() const { return mLongModuleSize; }
224224
Float_t GetTrd1Angle() const { return mTrd1Angle; }
225-
Float_t Get2Trd1Dx2() const { return m2Trd1Dx2; }
225+
Double_t Get2Trd1Dx2() const { return m2Trd1Dx2; }
226226
Float_t GetTrd1AlFrontThick() const { return mTrd1AlFrontThick; }
227227
Float_t GetTrd1BondPaperThick() const { return mTrd1BondPaperThick; }
228228
// --
@@ -699,7 +699,7 @@ class Geometry
699699

700700
// TRD1 options - 30-sep-04
701701
Float_t mTrd1Angle = 0; ///< angle in x-z plane (in degree)
702-
Float_t m2Trd1Dx2 = 0; ///< 2*dx2 for TRD1
702+
Double_t m2Trd1Dx2 = 0; ///< 2*dx2 for TRD1
703703
Float_t mPhiGapForSM = 0; ///< Gap betweeen supermodules in phi direction
704704

705705
// Oct 26,2010

‎Detectors/EMCAL/base/src/ShishKebabTrd1Module.cxx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void ShishKebabTrd1Module::DefineFirstModule(const Int_t key)
189189
mTheta = 89.25 * TMath::DegToRad();
190190
Double_t al1 = sangle / 2.;
191191
Double_t x = 0.5 * (sa * TMath::Cos(al1) + sb * TMath::Sin(al1));
192-
Double_t y = 0.5 * (sb + sa * TMath::Sin(al1)) * TMath::Cos(al1);
192+
Double_t y = 0.5 * (sb * TMath::Cos(al1) + sa * TMath::Sin(al1)); // inner right corner on r = sr, as in Init()
193193
mOK.Set(x, sr + y);
194194
// parameters of right line : y = A*z + B in system where zero point is IP.
195195
mThetaA = mTheta - sangle / 2.;
@@ -223,7 +223,7 @@ Bool_t ShishKebabTrd1Module::SetParameters()
223223

224224
sr += mGeometry->GetSteelFrontThickness();
225225

226-
sa2 = Double_t(mGeometry->Get2Trd1Dx2());
226+
sa2 = mGeometry->Get2Trd1Dx2();
227227
// PH PrintShish(0);
228228
return kTRUE;
229229
}

‎Detectors/EMCAL/base/test/testGeometry.cxx‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include <boost/test/unit_test.hpp>
1515
#include <fmt/format.h>
1616
#include "EMCALBase/Geometry.h"
17+
#include "EMCALBase/ShishKebabTrd1Module.h"
18+
#include <array>
19+
#include <cmath>
1720
#include <iostream>
1821
#include <fstream>
1922

@@ -63,4 +66,37 @@ std::tuple<int, int, int, int> GetRefCellIndex(int CellId)
6366
}
6467

6568
return std::make_tuple(smod, mod, iphi, ieta);
66-
}
69+
}
70+
71+
/// \macro Test that neighbouring EMCAL modules touch exactly
72+
///
73+
/// Test coverage:
74+
/// - the eta side faces of adjacent ShishKebabTrd1Modules coincide
75+
/// - the first module's inner face starts on the inner radius and its left face lies on z = 0
76+
BOOST_AUTO_TEST_CASE(ModuleFaces_test)
77+
{
78+
auto geo = o2::emcal::Geometry::GetInstanceFromRunNumber(300000);
79+
const auto& modules = geo->GetShishKebabTrd1Modules();
80+
const double dx1 = geo->GetEtaModuleSize() / 2., dx2 = geo->Get2Trd1Dx2() / 2., dz = geo->GetLongModuleSize() / 2.;
81+
const double r0 = geo->GetIPDistance() + geo->GetSteelFrontThickness();
82+
// corner of a module in (z, r): s = -1 inner / +1 outer end, t = -1 small z / +1 large z side
83+
auto corner = [&](const o2::emcal::ShishKebabTrd1Module& m, int s, int t) {
84+
const double th = m.GetTheta(), dx = s < 0 ? dx1 : dx2;
85+
const auto& c = m.GetCenterOfModule();
86+
return std::array<double, 2>{c.X() + s * dz * std::cos(th) + t * dx * std::sin(th),
87+
c.Y() + s * dz * std::sin(th) - t * dx * std::cos(th)};
88+
};
89+
const double tolerance = 1e-10; // cm
90+
BOOST_CHECK_SMALL(corner(modules[0], -1, +1)[1] - r0, tolerance);
91+
BOOST_CHECK_SMALL(corner(modules[0], -1, -1)[0], tolerance);
92+
BOOST_CHECK_SMALL(corner(modules[0], +1, -1)[0], tolerance);
93+
for (std::size_t i = 0; i + 1 < modules.size(); ++i) {
94+
// distance of the next module's small-z face corners from this module's large-z face
95+
const auto a = corner(modules[i], -1, +1), b = corner(modules[i], +1, +1);
96+
const double nz = b[1] - a[1], nr = -(b[0] - a[0]), norm = std::hypot(nz, nr);
97+
for (int s : {-1, +1}) {
98+
const auto p = corner(modules[i + 1], s, -1);
99+
BOOST_CHECK_SMALL(((p[0] - a[0]) * nz + (p[1] - a[1]) * nr) / norm, tolerance);
100+
}
101+
}
102+
}

0 commit comments

Comments
 (0)