ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MmCTPClusterCalibData Class Reference

#include <MmCTPClusterCalibData.h>

Inheritance diagram for Muon::MmCTPClusterCalibData:
Collaboration diagram for Muon::MmCTPClusterCalibData:

Public Types

using CTPParameters = std::array<double, 2>

Public Member Functions

 MmCTPClusterCalibData (const Muon::IMuonIdHelperSvc *idHelperSvc)
 ~MmCTPClusterCalibData ()=default
StatusCode storeConstants (const Identifier &gasGapId, CTPParameters &&newConstants)
double getCTPCorrectedDriftVelocity (const Identifier &identifier, const double theta) const
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Private Types

using parameterMap_t = std::vector<std::unique_ptr<CTPParameters>>

Private Member Functions

std::uint32_t convertHash (const Identifier &gasGapId) const
 Converts the identifier to a continious hash used to access the stored parameters.
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

const Muon::IMuonIdHelperSvcm_idHelperSvc {nullptr}
parameterMap_t m_database {}
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Definition at line 16 of file MmCTPClusterCalibData.h.

Member Typedef Documentation

◆ CTPParameters

using Muon::MmCTPClusterCalibData::CTPParameters = std::array<double, 2>

Definition at line 19 of file MmCTPClusterCalibData.h.

◆ parameterMap_t

using Muon::MmCTPClusterCalibData::parameterMap_t = std::vector<std::unique_ptr<CTPParameters>>
private

Definition at line 33 of file MmCTPClusterCalibData.h.

Constructor & Destructor Documentation

◆ MmCTPClusterCalibData()

Muon::MmCTPClusterCalibData::MmCTPClusterCalibData ( const Muon::IMuonIdHelperSvc * idHelperSvc)

Definition at line 8 of file MmCTPClusterCalibData.cxx.

8 :
9 AthMessaging{"MmCTPClusterCalibData"},
10 m_idHelperSvc{idHelperSvc} {
11 m_database.resize(m_idHelperSvc->mmIdHelper().detectorElement_hash_max() * 4);
12}
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
const Muon::IMuonIdHelperSvc * m_idHelperSvc

◆ ~MmCTPClusterCalibData()

Muon::MmCTPClusterCalibData::~MmCTPClusterCalibData ( )
default

Member Function Documentation

◆ convertHash()

std::uint32_t Muon::MmCTPClusterCalibData::convertHash ( const Identifier & gasGapId) const
private

Converts the identifier to a continious hash used to access the stored parameters.

Parameters
gasgGapIdIdentifier to convert

Definition at line 16 of file MmCTPClusterCalibData.cxx.

16 {
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}
#define ATH_MSG_WARNING(x)
virtual int get_detectorElement_hash(const Identifier &id, IdentifierHash &hash_id) const override
int gasGap(const Identifier &id) const override
get the hashes

◆ getCTPCorrectedDriftVelocity()

double Muon::MmCTPClusterCalibData::getCTPCorrectedDriftVelocity ( const Identifier & identifier,
const double theta ) const

Definition at line 39 of file MmCTPClusterCalibData.cxx.

39 {
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}
Scalar theta() const
theta method
#define ATH_MSG_VERBOSE(x)
std::uint32_t convertHash(const Identifier &gasGapId) const
Converts the identifier to a continious hash used to access the stored parameters.

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }
MsgStream & msg() const
The standard message stream.

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ storeConstants()

StatusCode Muon::MmCTPClusterCalibData::storeConstants ( const Identifier & gasGapId,
CTPParameters && newConstants )

Definition at line 26 of file MmCTPClusterCalibData.cxx.

27 {
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}
#define ATH_MSG_ERROR(x)

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_database

parameterMap_t Muon::MmCTPClusterCalibData::m_database {}
private

Definition at line 34 of file MmCTPClusterCalibData.h.

34{};

◆ m_idHelperSvc

const Muon::IMuonIdHelperSvc* Muon::MmCTPClusterCalibData::m_idHelperSvc {nullptr}
private

Definition at line 32 of file MmCTPClusterCalibData.h.

32{nullptr};

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files: