ATLAS Offline Software
Loading...
Searching...
No Matches
mmCTPClusterCalibData.cxx
Go to the documentation of this file.
2
3#include "GaudiKernel/SystemOfUnits.h"
4
5
6
7namespace Muon{
8
10 AthMessaging{"mmCTPClusterCalibData"},
11 m_idHelperSvc{idHelperSvc} {}
12
14
15StatusCode mmCTPClusterCalibData::storeConstants(const Identifier& gasGapIdentifier,
16 CTPParameters&& newConstants) {
17
18 if (m_database.find(gasGapIdentifier) != m_database.end()) {
19 ATH_MSG_ERROR("The drift velocity calibration constants for gas gap "<<m_idHelperSvc->toStringGasGap(gasGapIdentifier) <<" already exist. Overwriting is not allowed");
20 return StatusCode::FAILURE;
21 }
22
23 //Retrieve the calibration constants, need at least 2 parameters for currently implemented parametrisation
24 if (newConstants.pars().size() < 2) {
25 ATH_MSG_ERROR("The error calibration constants for stName:" << m_idHelperSvc->mmIdHelper().stationName(gasGapIdentifier) <<
26 " stEta: " << m_idHelperSvc->mmIdHelper().stationEta(gasGapIdentifier) <<
27 " stPhi: " << m_idHelperSvc->mmIdHelper().stationPhi(gasGapIdentifier) <<
28 " ml: " << m_idHelperSvc->mmIdHelper().multilayer(gasGapIdentifier) <<
29 " gg: " << m_idHelperSvc->mmIdHelper().gasGap(gasGapIdentifier) <<
30 " are incomplete. 2 parameters are required!");
31
32 return StatusCode::FAILURE;
33 }
34
35
36 m_database[gasGapIdentifier] = std::move(newConstants);
37
38 return StatusCode::SUCCESS;
39}
40
41double mmCTPClusterCalibData::getCTPCorrectedDriftVelocity(const Identifier& gasGapIdentifier, const double theta) const {
42 //Identifier: There is no pcb segmentation for these corrections, stored with pcb = 1 as default! Therefore expects pcb = 1
43 //Theta: Expected in degrees
44 //Drift velocity: will be fully taken from the parametrisation from calibration file
45
46 //If not present in the map return original value
47 if( m_database.find(gasGapIdentifier) == m_database.end()) {
48 ATH_MSG_ERROR("There's no drift velocity calibration available for gasGap " << m_idHelperSvc->toStringGasGap(gasGapIdentifier)<< " size of the calib map is: " << m_database.size() );
49 }
50
51 ATH_MSG_VERBOSE( "Retrieving drift velocity for stName" << m_idHelperSvc->toStringGasGap(gasGapIdentifier) );
52
53 //Conversions of incident angle
54 double trf_theta_in_degrees = (theta > 90) ? (180 - theta) : theta;
55 double trf_theta_in_radians = trf_theta_in_degrees * Gaudi::Units::deg;
56 double tan_theta = std::tan(trf_theta_in_radians);
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 = m_database.at(gasGapIdentifier).pars()[0] + ((m_database.at(gasGapIdentifier).pars()[1])*trf_theta_in_degrees);
64
65 //Remove tantheta and always return positive drift velocity!
66
67 vDrift = (tan_theta != 0 ) ? std::fabs(vDrift/tan_theta) : std::fabs(vDrift);
68
69
70 ATH_MSG_VERBOSE( "New drift velocity: " << vDrift << " for theta: " << trf_theta_in_degrees << " degrees" );
71
72 return vDrift;
73}
74
75}//end for Muon namespace
Scalar theta() const
theta method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
const std::array< double, 2 > & pars() const
double getCTPCorrectedDriftVelocity(const Identifier &identifier, const double theta) const
StatusCode storeConstants(const Identifier &gasGapId, CTPParameters &&newConstants)
const Muon::IMuonIdHelperSvc * m_idHelperSvc
mmCTPClusterCalibData(const Muon::IMuonIdHelperSvc *idHelperSvc)
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
STL namespace.