ATLAS Offline Software
Loading...
Searching...
No Matches
MmCTPClusterCalibData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5#include "GaudiKernel/SystemOfUnits.h"
6namespace Muon{
7
9 AthMessaging{"MmCTPClusterCalibData"},
10 m_idHelperSvc{idHelperSvc} {
11 m_database.resize(m_idHelperSvc->mmIdHelper().detectorElement_hash_max() * 4);
12}
13
14
15
16std::uint32_t MmCTPClusterCalibData::convertHash(const Identifier& gasGapId) const {
17 IdentifierHash detHash{};
18 const MmIdHelper& idHelper{m_idHelperSvc->mmIdHelper()};
19 if(idHelper.get_detectorElement_hash(gasGapId, detHash)){
20 ATH_MSG_WARNING(__func__<<"() - "<<m_idHelperSvc->toString(gasGapId)<<" is not a valid Mm identifier");
21 return -1;
22 }
23 return static_cast<unsigned>(detHash)*4 + (idHelper.gasGap(gasGapId) -1);
24
25}
26StatusCode MmCTPClusterCalibData::storeConstants(const Identifier& gasGapIdentifier,
27 CTPParameters&& newConstants) {
28
29 auto& slot = m_database.at(convertHash(gasGapIdentifier));
30 if (slot) {
31 ATH_MSG_ERROR("The drift velocity calibration constants for gas gap "<<m_idHelperSvc->toStringGasGap(gasGapIdentifier)
32 <<" already exist. Overwriting is not allowed");
33 return StatusCode::FAILURE;
34 }
35 slot = std::make_unique<CTPParameters>(std::move(newConstants));
36 return StatusCode::SUCCESS;
37}
38
39double MmCTPClusterCalibData::getCTPCorrectedDriftVelocity(const Identifier& gasGapIdentifier, const double theta) const {
40 //Identifier: There is no pcb segmentation for these corrections, stored with pcb = 1 as default! Therefore expects pcb = 1
41 //Theta: Expected in degrees
42 //Drift velocity: will be fully taken from the parametrisation from calibration file
43
44 //If not present in the map return original value
45 const auto& calibPars = m_database.at(convertHash(gasGapIdentifier));
46 if(!calibPars) {
47 ATH_MSG_WARNING("There's no drift velocity calibration available for gasGap "
48 << m_idHelperSvc->toStringGasGap(gasGapIdentifier)<<".");
49 return std::numeric_limits<double>::max();
50 }
51
52 ATH_MSG_VERBOSE( "Retrieving drift velocity for stName" << m_idHelperSvc->toStringGasGap(gasGapIdentifier) );
53
54 //Conversions of incident angle
55 double trf_theta_in_degrees = (theta > 90.) ? (180. - theta) : theta;
56 double tan_theta = std::tan(trf_theta_in_degrees*Gaudi::Units::deg);
57
58 //Parametrisation was derived as delta_residual = x_true - x_charge_weighted = (time_true - time_charge_weighted) * v_drift * tan(theta)
59 //The fit used is a linear fit from data obtained for VMM 17 to VMM 95. Data outside this fit range were excluted due to problems with the magnetic field at the inner and outer PCBs, see figure 11.8 on page 135 of https://cds.cern.ch/record/2839930/files/CERN-THESIS-2021-354.pdf. Therefore, it is expected, that x^2 and x^3 are 0.
60 //Parametrisation from Stefanie Gotz and Fabian Vogel, for more details see:
61 //https://indico.cern.ch/event/1501492/contributions/6321472/attachments/3013528/5314031/SpatialResolution14.pdf#page=5
62 //https://indico.cern.ch/event/1458120/contributions/6138857/attachments/2942828/5170893/MuonWeekOctober24FV1.pdf
63 double vDrift = (*calibPars)[0] + (*calibPars)[1] * trf_theta_in_degrees;
64 //Remove tantheta and always return positive drift velocity!
65
66 vDrift = (tan_theta != 0 ) ? std::abs(vDrift/tan_theta) : std::abs(vDrift);
67
68
69 ATH_MSG_VERBOSE( "New drift velocity: " << vDrift << " for theta: " << trf_theta_in_degrees << " degrees" );
70
71 return vDrift;
72}
73
74}//end for Muon namespace
Scalar theta() const
theta method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
This is a "hash" representation of an Identifier.
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
int gasGap(const Identifier &id) const override
get the hashes
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
const Muon::IMuonIdHelperSvc * m_idHelperSvc
std::uint32_t convertHash(const Identifier &gasGapId) const
Converts the identifier to a continious hash used to access the stored parameters.
std::array< double, 2 > CTPParameters
StatusCode storeConstants(const Identifier &gasGapId, CTPParameters &&newConstants)
MmCTPClusterCalibData(const Muon::IMuonIdHelperSvc *idHelperSvc)
double getCTPCorrectedDriftVelocity(const Identifier &identifier, const double theta) const
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.