Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Muon::mmCTPClusterCalibData Class Reference

#include <mmCTPClusterCalibData.h>

Inheritance diagram for Muon::mmCTPClusterCalibData:
Collaboration diagram for Muon::mmCTPClusterCalibData:

Classes

class  CTPParameters
 

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. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Types

using parameterMap = std::unordered_map< Identifier, CTPParameters >
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

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

Detailed Description

Definition at line 18 of file mmCTPClusterCalibData.h.

Member Typedef Documentation

◆ parameterMap

Definition at line 43 of file mmCTPClusterCalibData.h.

Constructor & Destructor Documentation

◆ mmCTPClusterCalibData()

Muon::mmCTPClusterCalibData::mmCTPClusterCalibData ( const Muon::IMuonIdHelperSvc idHelperSvc)

Definition at line 9 of file mmCTPClusterCalibData.cxx.

9  :
10  AthMessaging{"mmCTPClusterCalibData"},
11  m_idHelperSvc{idHelperSvc} {}

◆ ~mmCTPClusterCalibData()

Muon::mmCTPClusterCalibData::~mmCTPClusterCalibData ( )
default

Member Function Documentation

◆ getCTPCorrectedDriftVelocity()

double Muon::mmCTPClusterCalibData::getCTPCorrectedDriftVelocity ( const Identifier identifier,
const double  theta 
) const

Definition at line 41 of file mmCTPClusterCalibData.cxx.

41  {
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 }

◆ 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  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ 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 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ 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 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ 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 (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ 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 15 of file mmCTPClusterCalibData.cxx.

16  {
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 }

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 Muon::mmCTPClusterCalibData::m_database {}
private

Definition at line 44 of file mmCTPClusterCalibData.h.

◆ m_idHelperSvc

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

Definition at line 42 of file mmCTPClusterCalibData.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ 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:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
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::IMuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
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
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
jobOption.theta
theta
Definition: jobOption.ParticleGun_fwd_sequence.py:13
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
MuonIdHelper::stationPhi
int stationPhi(const Identifier &id) const
Definition: MuonIdHelper.cxx:810
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
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
Muon::mmCTPClusterCalibData::m_database
parameterMap m_database
Definition: mmCTPClusterCalibData.h:44
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132