Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mmCTPClusterCalibData.cxx
Go to the documentation of this file.
2 
3 #include "GaudiKernel/SystemOfUnits.h"
4 
5 
6 
7 namespace Muon{
8 
10  AthMessaging{"mmCTPClusterCalibData"},
11  m_idHelperSvc{idHelperSvc} {}
12 
13 mmCTPClusterCalibData::CTPParameters::CTPParameters(std::array<double, 2>&& pars): m_pars (std::move(pars)){}
14 
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 
41 double 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( "Retriving 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
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
Muon::mmCTPClusterCalibData::storeConstants
StatusCode storeConstants(const Identifier &gasGapId, CTPParameters &&newConstants)
Definition: mmCTPClusterCalibData.cxx:15
mmCTPClusterCalibData.h
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonIdHelper::stationName
int stationName(const Identifier &id) const
Definition: MuonIdHelper.cxx:800
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::IMuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
Muon::mmCTPClusterCalibData::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: mmCTPClusterCalibData.h:42
MmIdHelper::multilayer
int multilayer(const Identifier &id) const
Definition: MmIdHelper.cxx:796
Muon::mmCTPClusterCalibData::CTPParameters::CTPParameters
CTPParameters()=default
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::IMuonIdHelperSvc::toStringGasGap
virtual std::string toStringGasGap(const Identifier &id) const =0
print all fields up to gas gap to string
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Muon::mmCTPClusterCalibData::CTPParameters
Definition: mmCTPClusterCalibData.h:21
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:810
Muon::mmCTPClusterCalibData::getCTPCorrectedDriftVelocity
double getCTPCorrectedDriftVelocity(const Identifier &identifier, const double theta) const
Definition: mmCTPClusterCalibData.cxx:41
MuonIdHelper::stationEta
int stationEta(const Identifier &id) const
Definition: MuonIdHelper.cxx:805
MmIdHelper::gasGap
int gasGap(const Identifier &id) const override
get the hashes
Definition: MmIdHelper.cxx:798
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
Muon::mmCTPClusterCalibData::m_database
parameterMap m_database
Definition: mmCTPClusterCalibData.h:44
Muon::mmCTPClusterCalibData::mmCTPClusterCalibData
mmCTPClusterCalibData(const Muon::IMuonIdHelperSvc *idHelperSvc)
Definition: mmCTPClusterCalibData.cxx:9
Identifier
Definition: IdentifierFieldParser.cxx:14