Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Detectors/EMCAL/base/include/EMCALBase/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class Geometry
Int_t GetNCells() const { return mNCells; }
Float_t GetLongModuleSize() const { return mLongModuleSize; }
Float_t GetTrd1Angle() const { return mTrd1Angle; }
Float_t Get2Trd1Dx2() const { return m2Trd1Dx2; }
Double_t Get2Trd1Dx2() const { return m2Trd1Dx2; }
Float_t GetTrd1AlFrontThick() const { return mTrd1AlFrontThick; }
Float_t GetTrd1BondPaperThick() const { return mTrd1BondPaperThick; }
// --
Expand Down Expand Up @@ -699,7 +699,7 @@ class Geometry

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

// Oct 26,2010
Expand Down
4 changes: 2 additions & 2 deletions Detectors/EMCAL/base/src/ShishKebabTrd1Module.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void ShishKebabTrd1Module::DefineFirstModule(const Int_t key)
mTheta = 89.25 * TMath::DegToRad();
Double_t al1 = sangle / 2.;
Double_t x = 0.5 * (sa * TMath::Cos(al1) + sb * TMath::Sin(al1));
Double_t y = 0.5 * (sb + sa * TMath::Sin(al1)) * TMath::Cos(al1);
Double_t y = 0.5 * (sb * TMath::Cos(al1) + sa * TMath::Sin(al1)); // inner right corner on r = sr, as in Init()
mOK.Set(x, sr + y);
// parameters of right line : y = A*z + B in system where zero point is IP.
mThetaA = mTheta - sangle / 2.;
Expand Down Expand Up @@ -223,7 +223,7 @@ Bool_t ShishKebabTrd1Module::SetParameters()

sr += mGeometry->GetSteelFrontThickness();

sa2 = Double_t(mGeometry->Get2Trd1Dx2());
sa2 = mGeometry->Get2Trd1Dx2();
// PH PrintShish(0);
return kTRUE;
}
Expand Down
38 changes: 37 additions & 1 deletion Detectors/EMCAL/base/test/testGeometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <boost/test/unit_test.hpp>
#include <fmt/format.h>
#include "EMCALBase/Geometry.h"
#include "EMCALBase/ShishKebabTrd1Module.h"
#include <array>
#include <cmath>
#include <iostream>
#include <fstream>

Expand Down Expand Up @@ -63,4 +66,37 @@ std::tuple<int, int, int, int> GetRefCellIndex(int CellId)
}

return std::make_tuple(smod, mod, iphi, ieta);
}
}

/// \macro Test that neighbouring EMCAL modules touch exactly
///
/// Test coverage:
/// - the eta side faces of adjacent ShishKebabTrd1Modules coincide
/// - the first module's inner face starts on the inner radius and its left face lies on z = 0
BOOST_AUTO_TEST_CASE(ModuleFaces_test)
{
auto geo = o2::emcal::Geometry::GetInstanceFromRunNumber(300000);
const auto& modules = geo->GetShishKebabTrd1Modules();
const double dx1 = geo->GetEtaModuleSize() / 2., dx2 = geo->Get2Trd1Dx2() / 2., dz = geo->GetLongModuleSize() / 2.;
const double r0 = geo->GetIPDistance() + geo->GetSteelFrontThickness();
// corner of a module in (z, r): s = -1 inner / +1 outer end, t = -1 small z / +1 large z side
auto corner = [&](const o2::emcal::ShishKebabTrd1Module& m, int s, int t) {
const double th = m.GetTheta(), dx = s < 0 ? dx1 : dx2;
const auto& c = m.GetCenterOfModule();
return std::array<double, 2>{c.X() + s * dz * std::cos(th) + t * dx * std::sin(th),
c.Y() + s * dz * std::sin(th) - t * dx * std::cos(th)};
};
const double tolerance = 1e-10; // cm
BOOST_CHECK_SMALL(corner(modules[0], -1, +1)[1] - r0, tolerance);
BOOST_CHECK_SMALL(corner(modules[0], -1, -1)[0], tolerance);
BOOST_CHECK_SMALL(corner(modules[0], +1, -1)[0], tolerance);
for (std::size_t i = 0; i + 1 < modules.size(); ++i) {
// distance of the next module's small-z face corners from this module's large-z face
const auto a = corner(modules[i], -1, +1), b = corner(modules[i], +1, +1);
const double nz = b[1] - a[1], nr = -(b[0] - a[0]), norm = std::hypot(nz, nr);
for (int s : {-1, +1}) {
const auto p = corner(modules[i + 1], s, -1);
BOOST_CHECK_SMALL(((p[0] - a[0]) * nz + (p[1] - a[1]) * nr) / norm, tolerance);
}
}
}
Loading