ATLAS Offline Software
MuonDriftCircleErrorStrategy.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUON_MUONRIOONTRACK_MUONDRIFTCIRCLEERRORSTRATEGY_H
6 #define MUON_MUONRIOONTRACK_MUONDRIFTCIRCLEERRORSTRATEGY_H
7 
8 #include <bitset>
9 #include "GaudiKernel/MsgStream.h"
10 #include <iostream>
11 
12 namespace Muon {
13 typedef std::bitset<23> MuonDriftCircleErrorStrategyInput;
14 
16 public:
17  enum Strategy {Moore=0, Muon=1, UnknownStrategy=0x7}; // FIXME - better names
18  enum CreationParameter{ BroadError=3,// Bit 3. Create with broad errors.
19  ScaledError, // Error scaling is turned on (this is applied after eveyrthing else)
35  };
36  static constexpr std::size_t nCalibWindowBits = 4;
39  void setStrategy(Strategy);
41  void setCalibWindow(unsigned long);
42 
44  unsigned long calibWindow() const;
45  Strategy strategy() const;
46 
48 
49 private:
51 };
52 }
53 
54 inline
55 void
57  unsigned int holder = static_cast<unsigned int>(st);
58  m_bits[0] = holder&0x1;
59  m_bits[1] = holder&0x2;
60  m_bits[2] = holder&0x4;
61 }
62 
63 inline
64 void
66  m_bits[static_cast<unsigned int>(cp)] = value;
67 }
68 
69 inline
70 void
72  std::bitset<nCalibWindowBits> tmpconfig(config);
73 
74  // Copy temporary bitset into m_bits
75  // Should do this with std::copy
76  for (std::size_t itmp=0,i=FirstCalibWindowBit; itmp<nCalibWindowBits; ++itmp,++i) {
77  m_bits[i] = tmpconfig[itmp];
78  }
79 
80 }
81 
82 inline
83 bool
85  return m_bits[static_cast<unsigned int>(cp)];
86 }
87 
88 inline
89 unsigned long
91  std::bitset<nCalibWindowBits> tmpconfig;
92 
93  // Copy relevant part of m_bits into temporary bitset
94  // Should do this with std::copy
95  for (std::size_t itmp=0,i=FirstCalibWindowBit; itmp<nCalibWindowBits; ++itmp,++i) {
96  tmpconfig[itmp] = m_bits[i];
97  }
98 
99  return tmpconfig.to_ulong();
100 }
101 
102 inline
105  switch (m_bits.to_ulong()&0x7){
106  case 0:
107  return Moore;
108  case 1:
109  return Muon;
110  default:
111  return UnknownStrategy;
112  }
113  return UnknownStrategy;
114 }
115 
116 inline std::ostream& operator << ( std::ostream& sl, const Muon::MuonDriftCircleErrorStrategy& mdces)
117 {
118  sl << "MuonDriftCircleErrorStrategy with strategy ";
119  const Muon::MuonDriftCircleErrorStrategyInput myBits = mdces.getBits();
120  switch (mdces.strategy()){
121  case 0:
122  sl << "Moore";
123  break;
124  case 1:
125  sl << "Muon";
126  break;
127  default:
128  sl << "Unknown Strategy";
129  }
130  sl << " and configuration bits " << myBits;
131  sl << " including CalibWindow " << mdces.calibWindow() << std::endl;
132  return sl;
133 }
134 
135 inline MsgStream& operator << ( MsgStream& sl, const Muon::MuonDriftCircleErrorStrategy& mdces)
136 {
137  sl << "MuonDriftCircleErrorStrategy with strategy ";
138  const Muon::MuonDriftCircleErrorStrategyInput myBits = mdces.getBits();
139  switch (mdces.strategy()){
140  case 0:
141  sl << "Moore";
142  break;
143  case 1:
144  sl << "Muon";
145  break;
146  default:
147  sl << "Unknown Strategy";
148  }
149  sl << " and configuration bits " << myBits;
150  sl << " including CalibWindow " << mdces.calibWindow() << std::endl;
151  return sl;
152 }
153 
154 
155 #endif
Muon::MuonDriftCircleErrorStrategy
Definition: MuonDriftCircleErrorStrategy.h:15
Muon::MuonDriftCircleErrorStrategy::WireSagTimeCorrection
@ WireSagTimeCorrection
Wire sag correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:30
Muon::MuonDriftCircleErrorStrategy::MuonDriftCircleErrorStrategy
MuonDriftCircleErrorStrategy(const MuonDriftCircleErrorStrategyInput &bits)
first 3 bits are Strategy, then come CreationParameter, last four are calib window bits
Definition: MuonDriftCircleErrorStrategy.h:38
Muon::MuonDriftCircleErrorStrategy::setCalibWindow
void setCalibWindow(unsigned long)
Only the first nCalibWindowBits bits will be stored!
Definition: MuonDriftCircleErrorStrategy.h:71
Muon::MuonDriftCircleErrorStrategy::calibWindow
unsigned long calibWindow() const
Returns calibration configuration.
Definition: MuonDriftCircleErrorStrategy.h:90
athena.value
value
Definition: athena.py:124
Muon::MuonDriftCircleErrorStrategy::Moore
@ Moore
Definition: MuonDriftCircleErrorStrategy.h:17
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Muon::MuonDriftCircleErrorStrategy::PropCorrection
@ PropCorrection
Propagation correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:27
Muon::MuonDriftCircleErrorStrategy::TempCorrection
@ TempCorrection
Temperature correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:28
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
Muon::MuonDriftCircleErrorStrategy::T0Refit
@ T0Refit
A special error was applied to account for the T0 refit (user defined via jobProperties)
Definition: MuonDriftCircleErrorStrategy.h:24
Muon::MuonDriftCircleErrorStrategy::WireSagGeomCorrection
@ WireSagGeomCorrection
Wire sag was applied, and so will affect errors.
Definition: MuonDriftCircleErrorStrategy.h:25
Muon::MuonDriftCircleErrorStrategy::FirstCalibWindowBit
@ FirstCalibWindowBit
First bit recording the calibration configuration.
Definition: MuonDriftCircleErrorStrategy.h:34
Muon::MuonDriftCircleErrorStrategy::SlewCorrection
@ SlewCorrection
Slewing correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:31
Muon::MuonDriftCircleErrorStrategy::Strategy
Strategy
Definition: MuonDriftCircleErrorStrategy.h:17
Muon::MuonDriftCircleErrorStrategyInput
std::bitset< 23 > MuonDriftCircleErrorStrategyInput
Definition: MuonDriftCircleErrorStrategy.h:13
Muon::MuonDriftCircleErrorStrategy::FixedError
@ FixedError
A fixed error is given to this hit (user defined via jobProperties)
Definition: MuonDriftCircleErrorStrategy.h:20
lumiFormat.i
int i
Definition: lumiFormat.py:85
Muon::MuonDriftCircleErrorStrategy::TofCorrection
@ TofCorrection
Time of flight correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:26
Muon::MuonDriftCircleErrorStrategy::m_bits
MuonDriftCircleErrorStrategyInput m_bits
0,1,2 are reserved for Strategy, 3-16 are Creation parameters, 17-20 are calib window bits
Definition: MuonDriftCircleErrorStrategy.h:50
Muon::MuonDriftCircleErrorStrategy::UnknownStrategy
@ UnknownStrategy
Definition: MuonDriftCircleErrorStrategy.h:17
Muon::MuonDriftCircleErrorStrategy::BackgroundCorrection
@ BackgroundCorrection
Background correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:32
Muon::MuonDriftCircleErrorStrategy::Segment
@ Segment
Treating a segment or a track.
Definition: MuonDriftCircleErrorStrategy.h:33
Muon::MuonDriftCircleErrorStrategy::ErrorAtPredictedPosition
@ ErrorAtPredictedPosition
Definition: MuonDriftCircleErrorStrategy.h:23
Muon::MuonDriftCircleErrorStrategy::MagFieldCorrection
@ MagFieldCorrection
Magnetic field correction was applied in calibration.
Definition: MuonDriftCircleErrorStrategy.h:29
Muon::MuonDriftCircleErrorStrategy::StationError
@ StationError
A term is added to account for misaligned.
Definition: MuonDriftCircleErrorStrategy.h:22
Muon::MuonDriftCircleErrorStrategy::CreationParameter
CreationParameter
Definition: MuonDriftCircleErrorStrategy.h:18
LArNewCalib_PedestalAutoCorr.cp
cp
Definition: LArNewCalib_PedestalAutoCorr.py:185
Muon::operator<<
std::ostream & operator<<(std::ostream &ostr, const Muon::HedgehogBoard &board)
Definition: HedgehogBoard.cxx:11
Muon::MuonDriftCircleErrorStrategy::setParameter
void setParameter(CreationParameter, bool value)
Definition: MuonDriftCircleErrorStrategy.h:65
Muon::MuonDriftCircleErrorStrategy::setStrategy
void setStrategy(Strategy)
Select the strategy to be used - only one can be set at a time.
Definition: MuonDriftCircleErrorStrategy.h:56
Muon
struct TBPatternUnitContext Muon
Muon::MuonDriftCircleErrorStrategy::ParameterisedErrors
@ ParameterisedErrors
Use parameterised errors.
Definition: MuonDriftCircleErrorStrategy.h:21
xAOD::Moore
@ Moore
Moore (MoMu)
Definition: TrackingPrimitives.h:135
Muon::MuonDriftCircleErrorStrategy::nCalibWindowBits
static constexpr std::size_t nCalibWindowBits
Allows up to 16 configurations to be recorded.
Definition: MuonDriftCircleErrorStrategy.h:36
Muon::MuonDriftCircleErrorStrategy::BroadError
@ BroadError
Definition: MuonDriftCircleErrorStrategy.h:18
Muon::MuonDriftCircleErrorStrategy::MuonDriftCircleErrorStrategy
MuonDriftCircleErrorStrategy()=default
Muon::MuonDriftCircleErrorStrategy::ScaledError
@ ScaledError
Definition: MuonDriftCircleErrorStrategy.h:19
Muon::MuonDriftCircleErrorStrategy::creationParameter
bool creationParameter(CreationParameter) const
Definition: MuonDriftCircleErrorStrategy.h:84
Muon::MuonDriftCircleErrorStrategy::getBits
const MuonDriftCircleErrorStrategyInput & getBits() const
Definition: MuonDriftCircleErrorStrategy.h:47
Muon::MuonDriftCircleErrorStrategy::strategy
Strategy strategy() const
Definition: MuonDriftCircleErrorStrategy.h:104