ATLAS Offline Software
NSWCalibTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "NSWCalibTool.h"
6 #include "GaudiKernel/SystemOfUnits.h"
7 #include "GaudiKernel/PhysicalConstants.h"
10 
11 namespace {
12  constexpr double toRad = M_PI/180;
13  constexpr double pitchErr = 0.425 * 0.425 / 12;
14  constexpr double reciprocalSpeedOfLight = 1. / Gaudi::Units::c_light; // mm/ns
15 
16  // since the final operation gas is not yet fixed different, different mixtures are added for studies
17  static const std::map<std::string, float> map_transDiff {{"ArCo2_937", 0.036},
18  {"ArCo2_8020", 0.019}, {"ArCo2iC4H10_9352", 0.035}};
19  static const std::map<std::string, float> map_longDiff {{"ArCo2_937", 0.019},
20  {"ArCo2_8020", 0.022 }, {"ArCo2iC4H10_9352", 0.0195}};
21  static const std::map<std::string, float> map_vDrift {{"ArCo2_937", 0.047},
22  {"ArCo2_8020", 0.040}, {"ArCo2iC4H10_9352", 0.045}};
23 
24 
25  // unit correction factors
26  constexpr double const MM_electronsPerfC = 6241.;
27  constexpr double const sTGC_pCPerfC = 1000.;
28 
29 
30  //Functional form fit to agree with Garfield simulations. Fit and parameters from G. Iakovidis
31  // For now only the parametrisation for 93:7 is available
32  using angleFunction = NSWCalib::MicroMegaGas::angleFunction;
33  static const std::map<std::string, angleFunction> map_lorentzAngleFunctionPars {
34  {"ArCo2_937", [](double x) {return 0.f + 58.87f*x -2.983f*x*x -10.62f*x*x*x + 2.818f*x*x*x*x;}},
35  {"ArCo2_8020", [](double x) {return 0.f + 58.87f*x -2.983f*x*x -10.62f*x*x*x + 2.818f*x*x*x*x;}},
36  {"ArCo2iC4H10_9352", [](double x) {return 0.f + 58.87f*x -2.983f*x*x -10.62f*x*x*x + 2.818f*x*x*x*x;}}};
37 
38  // For now only the parametrisation for 93:7 is available
39  static const std::map<std::string, float> map_interactionDensitySigma {{"ArCo2_937", 4.04 / 5.},
40  {"ArCo2_8020", 4.04 / 5.}, {"ArCo2iC4H10_9352", 4.04 / 5.}};
41  static const std::map<std::string, float> map_interactionDensityMean {{"ArCo2_937", 16.15 / 5.},
42  {"ArCo2_8020", 16.15 / 5.}, {"ArCo2iC4H10_9352", 16.15 / 5.}};
43 
44 }
45 
46 Muon::NSWCalibTool::NSWCalibTool(const std::string& t, const std::string& n, const IInterface* p) :
47  AthAlgTool(t,n,p) {
48  declareInterface<INSWCalibTool>(this);
49 }
50 
51 
53 {
54  ATH_MSG_DEBUG("In initialize()");
55  ATH_CHECK(m_idHelperSvc.retrieve());
56  ATH_CHECK(m_condTdoPdoKey.initialize());
57  ATH_CHECK(m_condT0Key.initialize(m_applyMmT0Calib || m_applysTgcT0Calib));
58  ATH_CHECK(m_fieldCondObjInputKey.initialize());
59  ATH_CHECK(m_muDetMgrKey.initialize());
60  ATH_CHECK(initializeGasProperties());
61 
62  ATH_CHECK(initializeGasProperties());
63  return StatusCode::SUCCESS;
64 }
65 
67  if (!map_vDrift.count(m_gasMixture)) {
68  ATH_MSG_FATAL("Configured Micromegas with unkown gas mixture: " << m_gasMixture);
69  return StatusCode::FAILURE;
70  }
71 
72  m_vDrift = map_vDrift.find(m_gasMixture)->second;
73  m_transDiff = map_transDiff.find(m_gasMixture)->second;
74  m_longDiff = map_longDiff.find(m_gasMixture)->second;
75  m_interactionDensitySigma = map_interactionDensitySigma.find(m_gasMixture)->second;
76  m_interactionDensityMean = map_interactionDensityMean.find(m_gasMixture)->second;
77  m_lorentzAngleFunction = map_lorentzAngleFunctionPars.find(m_gasMixture)->second;
78  return StatusCode::SUCCESS;
79 }
80 
81 const NswCalibDbTimeChargeData* Muon::NSWCalibTool::getCalibData(const EventContext& ctx) const {
82  // set up pointer to conditions object
83  SG::ReadCondHandle<NswCalibDbTimeChargeData> readTdoPdo{m_condTdoPdoKey, ctx};
84  if(!readTdoPdo.isValid()){
85  ATH_MSG_ERROR("Cannot find conditions data container for TDOs and PDOs!");
86  return nullptr;
87  }
88  return readTdoPdo.cptr();
89 }
90 
91 StatusCode Muon::NSWCalibTool::calibrateClus(const EventContext& ctx, const Muon::MMPrepData* prepData, const Amg::Vector3D& globalPos, std::vector<NSWCalib::CalibratedStrip>& calibClus) const {
92 
93  double lorentzAngle {0.};
94  if(m_applyMmBFieldCalib){
96  MagField::AtlasFieldCache fieldCache;
97  if (!loadMagneticField(ctx, fieldCache)) return StatusCode::FAILURE;
98  Amg::Vector3D magneticField{Amg::Vector3D::Zero()};
99  fieldCache.getField(globalPos.data(), magneticField.data());
100 
102  double phi = globalPos.phi();
103  double bfield = (magneticField.x()*std::sin(phi)-magneticField.y()*std::cos(phi))*1000.;
104 
106  int gasGap = m_idHelperSvc->mmIdHelper().gasGap(prepData->identify());
107  bool changeSign = ( globalPos.z() < 0. ? (gasGap==1 || gasGap==3) : (gasGap==2 || gasGap==4) );
108  if (changeSign) bfield = -bfield;
109 
111  lorentzAngle = (bfield>0. ? 1. : -1.)*m_lorentzAngleFunction(std::abs(bfield)) * toRad;
112  }
113 
115  for (unsigned int i = 0; i < prepData->stripNumbers().size(); ++i){
116  Identifier id = prepData->rdoList().at(i);
117  double time = prepData->stripTimes().at(i);
118  double charge = prepData->stripCharges().at(i);
119  NSWCalib::CalibratedStrip calibStrip;
120  ATH_CHECK(calibrateStrip(id,time, charge, lorentzAngle, calibStrip));
121  calibClus.push_back(std::move(calibStrip));
122  }
123  return StatusCode::SUCCESS;
124 }
125 
126 StatusCode Muon::NSWCalibTool::calibrateStrip(const Identifier& id, const double time, const double charge, const double lorentzAngle, NSWCalib::CalibratedStrip& calibStrip) const {
127 
128  //get local positon
130  if(!localStripPosition(id,locPos)) {
131  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" Failed to retrieve local strip position "<<m_idHelperSvc->toString(id));
132  return StatusCode::FAILURE;
133  }
134 
135  calibStrip.identifier = id;
136  calibStrip.charge = charge;
137  calibStrip.time = time;
138 
139  double vDriftCorrected = m_vDrift * std::cos(lorentzAngle);
140  calibStrip.distDrift = vDriftCorrected * calibStrip.time;
141 
143  calibStrip.resTransDistDrift = pitchErr + std::pow(m_transDiff * calibStrip.distDrift, 2);
144  calibStrip.resLongDistDrift = std::pow(m_ionUncertainty * vDriftCorrected, 2)
145  + std::pow(m_longDiff * calibStrip.distDrift, 2);
146  calibStrip.dx = std::sin(lorentzAngle) * calibStrip.time * m_vDrift;
147  calibStrip.locPos = Amg::Vector2D(locPos.x() + calibStrip.dx, locPos.y());
148  return StatusCode::SUCCESS;
149 }
150 
151 
152 StatusCode Muon::NSWCalibTool::calibrateStrip(const EventContext& ctx, const Muon::MM_RawData* mmRawData, NSWCalib::CalibratedStrip& calibStrip) const {
153 
154  const Identifier rdoId = mmRawData->identify();
155  //get local postion
156  Amg::Vector2D locPos{0,0};
157  if(!localStripPosition(rdoId,locPos)) {
158  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" Failed to retrieve local strip position "<<m_idHelperSvc->toString(rdoId));
159  return StatusCode::FAILURE;
160  }
161 
162  // MuonDetectorManager from the conditions store
163  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey, ctx};
164  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
165 
166  //get globalPos
167  Amg::Vector3D globalPos{Amg::Vector3D::Zero()};
168  const MuonGM::MMReadoutElement* detEl = muDetMgr->getMMReadoutElement(rdoId);
169  detEl->stripGlobalPosition(rdoId,globalPos);
170 
171  // RDO has values in counts for both simulation and data
172  float time{-FLT_MAX}, charge{-FLT_MAX};
173  tdoToTime (ctx, mmRawData->timeAndChargeInCounts(), mmRawData->time (), rdoId, time , mmRawData->relBcid());
174  pdoToCharge(ctx, mmRawData->timeAndChargeInCounts(), mmRawData->charge(), rdoId, charge );
175 
176  calibStrip.charge = charge;
177  // historically the peak time is included in the time determined by the MM digitization and therefore added back in the tdoToTime function
178  // in order to not break the RDO to digit conversion needed for the trigger and the overlay
179  calibStrip.time = time - globalPos.norm() * reciprocalSpeedOfLight - mmPeakTime();
180  // applying T0 calibration, cannot be done inside the the tdo to time function since the tof correction was included when deriving the calibration constants
181  if(m_applyMmT0Calib){
182  calibStrip.time = applyT0Calibration(ctx, rdoId, calibStrip.time);
183  }
184 
185  calibStrip.identifier = rdoId;
186 
187  ATH_MSG_DEBUG("Calibrating RDO " << m_idHelperSvc->toString(rdoId) << "with pdo: " << mmRawData->charge() << " tdo: "<< mmRawData->time() << " relBCID "<< mmRawData->relBcid() << " charge and time in counts " <<
188  mmRawData->timeAndChargeInCounts() << " isData "<< m_isData << " to charge: " << calibStrip.charge << " electrons time after corrections " << calibStrip.time << " ns time before corrections "<< time << "ns");
189 
190 
191  //get stripWidth
192  detEl->getDesign(rdoId)->channelWidth(); // positon is not used for strip width
193 
194  calibStrip.distDrift = m_vDrift * calibStrip.time;
195  calibStrip.resTransDistDrift = pitchErr + std::pow(m_transDiff * calibStrip.distDrift, 2);
196  calibStrip.resLongDistDrift = std::pow(m_ionUncertainty * m_vDrift, 2)
197  + std::pow(m_longDiff * calibStrip.distDrift, 2);
198 
199  calibStrip.locPos = locPos;
200 
201  return StatusCode::SUCCESS;
202 }
203 
204 StatusCode Muon::NSWCalibTool::calibrateStrip(const EventContext& ctx, const Muon::STGC_RawData* sTGCRawData, NSWCalib::CalibratedStrip& calibStrip) const {
205 
206  Identifier rdoId = sTGCRawData->identify();
207  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey, ctx};
208  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
209 
210  //get globalPos
211  Amg::Vector3D globalPos{Amg::Vector3D::Zero()};
212  const MuonGM::sTgcReadoutElement* detEl = muDetMgr->getsTgcReadoutElement(rdoId);
213  detEl->stripGlobalPosition(rdoId,globalPos);
214 
215  //get local postion
217  if(!localStripPosition(rdoId,locPos)) {
218  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" Failed to retrieve local strip position "<<m_idHelperSvc->toString(rdoId));
219  return StatusCode::FAILURE;
220  }
221 
222  // RDO has values in counts for both simulation and data
223  float time{-FLT_MAX}, charge{-FLT_MAX};
224  tdoToTime (ctx, sTGCRawData->timeAndChargeInCounts(), sTGCRawData->time (), rdoId, time , sTGCRawData->bcTag());
225  pdoToCharge(ctx, sTGCRawData->timeAndChargeInCounts(), sTGCRawData->charge(), rdoId, charge );
226  if(sTGCRawData->timeAndChargeInCounts()){
227  calibStrip.charge = charge * sTGC_pCPerfC;
228  } else {
229  calibStrip.charge = charge;
230  }
231  calibStrip.time = time - stgcPeakTime();
232 
233  if(m_applysTgcT0Calib){
234  calibStrip.time = applyT0Calibration(ctx, rdoId, calibStrip.time);
235  }
236 
237  calibStrip.identifier = rdoId;
238  calibStrip.locPos = locPos;
239  return StatusCode::SUCCESS;
240 
241 }
242 bool Muon::NSWCalibTool::loadMagneticField(const EventContext& ctx, MagField::AtlasFieldCache& fieldCache) const {
243  SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx};
244  if (!readHandle.isValid()) {
245  ATH_MSG_ERROR("doDigitization: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key());
246  return false;
247  }
248  readHandle.cptr()->getInitializedCache(fieldCache);
249  return true;
250 }
251 StatusCode Muon::NSWCalibTool::distToTime(const EventContext& ctx, const Muon::MMPrepData* prepData, const Amg::Vector3D& globalPos, const std::vector<double>& driftDistances, std::vector<double>& driftTimes) const {
253  MagField::AtlasFieldCache fieldCache;
254  if (!loadMagneticField(ctx, fieldCache)) return StatusCode::FAILURE;
255  Amg::Vector3D magneticField{Amg::Vector3D::Zero()};
256  fieldCache.getField(globalPos.data(), magneticField.data());
257 
259  const double phi = globalPos.phi();
260  double bfield = (magneticField.x()*std::sin(phi)-magneticField.y()*std::cos(phi))*1000.;
261 
263  int gasGap = m_idHelperSvc->mmIdHelper().gasGap(prepData->identify());
264  bool changeSign = ( globalPos.z() < 0. ? (gasGap==1 || gasGap==3) : (gasGap==2 || gasGap==4) );
265  if (changeSign) bfield = -bfield;
266  double cos2_lorentzAngle = std::pow(std::cos ( (bfield>0. ? 1. : -1.)*m_lorentzAngleFunction(std::abs(bfield)) * toRad), 2);
268  for (const double dist : driftDistances){
269  double time = dist / (m_vDrift*cos2_lorentzAngle);
270  driftTimes.push_back(time);
271  }
272  return StatusCode::SUCCESS;
273 
274 }
275 
276 bool
277 Muon::NSWCalibTool::chargeToPdo(const EventContext& ctx, const float charge, const Identifier& chnlId, int& pdo) const {
278  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
279  if (!tdoPdoData) {
280  pdo = 0;
281  return false;
282  }
283  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::PDO, chnlId);
284  if (!calib_ptr) {
285  pdo = 0;
286  return false;
287  }
288  const TimeCalibConst& calib{*calib_ptr};
289  float c = charge;
290  if (m_idHelperSvc->isMM (chnlId)) c /= MM_electronsPerfC;
291  else if(m_idHelperSvc->issTgc(chnlId)) c *= sTGC_pCPerfC;
292  else {
293  pdo = 0;
294  return false;
295  }
296  pdo = c * calib.slope + calib.intercept;
297  return true;
298 }
299 
300 bool
301 Muon::NSWCalibTool::pdoToCharge(const EventContext& ctx, const bool inCounts, const int pdo, const Identifier& chnlId, float& charge) const {
302  if(!inCounts){
303  charge = pdo;
304  return true;
305  }
306  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
307  if (!tdoPdoData) {
308  charge =0.;
309  return false;
310  }
311  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::PDO, chnlId);
312  if (!calib_ptr) {
313  charge = 0.;
314  return false;
315  }
316  const TimeCalibConst& calib{*calib_ptr};
317  charge = (pdo-calib.intercept)/calib.slope;
318  if (m_idHelperSvc->isMM (chnlId)) charge *= MM_electronsPerfC;
319  else if(m_idHelperSvc->issTgc(chnlId)) charge /= sTGC_pCPerfC;
320  else return false;
321  return true;
322 }
323 
324 bool
325 Muon::NSWCalibTool::timeToTdo(const EventContext& ctx, const float time, const Identifier& chnlId, int& tdo, int& relBCID) const {
326  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
327  if (!tdoPdoData) return false;
328  if (m_idHelperSvc->isMM (chnlId)) return timeToTdoMM (tdoPdoData, time, chnlId, tdo, relBCID);
329  else if(m_idHelperSvc->issTgc(chnlId)) return timeToTdoSTGC(tdoPdoData, time, chnlId, tdo, relBCID);
330  return false;
331 }
332 
333 bool
334 Muon::NSWCalibTool::timeToTdoMM(const NswCalibDbTimeChargeData* tdoPdoData, const float time, const Identifier& chnlId, int& tdo, int& relBCID) const {
335  const float t = time - m_mmPeakTime - m_mmLatencyMC; // subtract peaking time first! This is not supossed to run on data ever only needed for the RDO->Digit step
336  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::TDO, chnlId);
337  if (!calib_ptr) {
338  tdo = relBCID = 0;
339  return false;
340  }
341  const TimeCalibConst& calib{*calib_ptr};
342  float tdoTime = -999.9;
343  constexpr float lowerBound = Muon::MM_RawData::s_lowerTimeBound;
344  for(int i_relBCID=0; i_relBCID<Muon::MM_RawData::s_BCWindow; i_relBCID++){
345  if(t >= lowerBound+i_relBCID*25 && t < (lowerBound+25)+i_relBCID*25){
346  tdoTime = i_relBCID*25 - t;
347  relBCID = i_relBCID;
348  break;
349  }
350  }
351  if(tdoTime < lowerBound) {
352  tdo = relBCID = 0;
353  return false;
354  }
355  tdo = tdoTime*calib.slope + calib.intercept;
356  return true;
357 }
358 
359 bool
360 Muon::NSWCalibTool::timeToTdoSTGC(const NswCalibDbTimeChargeData* tdoPdoData, const float time, const Identifier& chnlId, int& tdo, int& relBCID) const {
361  const float t = time - m_stgcPeakTime - m_stgcLatencyMC; // subtract peaking time and latency first! This is not supossed to run on data ever only needed for the RDO->Digit step
362  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::TDO, chnlId);
363  if (!calib_ptr){
364  tdo = relBCID = 0;
365  return false;
366  }
367  const TimeCalibConst& calib = {*calib_ptr};
368  float tdoTime = -999.9;
369  const float lowerBound = Muon::STGC_RawData::s_lowerTimeBound - m_stgcLatencyMC; // this is not supossed to run on data ever, only needed for the RDO->Digit step
370  for(int i_relBCID=0; i_relBCID<Muon::STGC_RawData::s_BCWindow; ++i_relBCID){
371  if(t >= lowerBound+i_relBCID*25 && t < (lowerBound+25)+i_relBCID*25){
372  tdoTime = i_relBCID*25 - t;
373  relBCID = i_relBCID;
374  break;
375  }
376  }
377  if(tdoTime < lowerBound) {
378  tdo = relBCID = 0;
379  return false;
380  }
381  tdo = tdoTime*calib.slope + calib.intercept;
382  return true;
383 }
384 
385 float Muon::NSWCalibTool::applyT0Calibration(const EventContext& ctx, const Identifier& id, float time) const {
386  SG::ReadCondHandle<NswT0Data> readT0{m_condT0Key, ctx};
387  if(!readT0.isValid()){
388  ATH_MSG_ERROR("Cannot find conditions data container for T0s!");
389  }
390  float t0 {0};
391  bool isGood = readT0->getT0(id, t0);
392  if(!isGood || t0==0){
393  ATH_MSG_DEBUG("failed to retrieve good t0 from database, skipping t0 calibration");
394  return time;
395  } else {
396  float targetT0 = (m_idHelperSvc->isMM(id) ? m_mmT0TargetValue : m_stgcT0TargetValue);
397  float newTime = time + (targetT0 - t0);
398  ATH_MSG_DEBUG("doing T0 calibration for RDO " << m_idHelperSvc->toString(id) << " time " << time <<" t0 from database " << t0 << " t0 target " << targetT0 << " new time " << newTime);
399  return newTime;
400  }
401 }
402 
403 
404 bool
405 Muon::NSWCalibTool::tdoToTime(const EventContext& ctx, const bool inCounts, const int tdo, const Identifier& chnlId, float& time, const int relBCID) const {
406  if(!inCounts){
407  time = tdo;
408  return true;
409  }
410  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
411  if (!tdoPdoData) {
412  time = 0.;
413  return false;
414  }
415  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::TDO, chnlId);
416  if (!calib_ptr){
417  time = 0.;
418  return false;
419  }
420  const TimeCalibConst& calib {*calib_ptr};
421  //this shift of 25ns is necessary to align the time of the signal with the way the VMM determines the time
422  //(relBCID 0 corresponds to -37.5 ns to - 12.5 ns)
423  //Eventually it should go into the conditions db since it is probably not the same for MC and Data
424  //but for now it is kept like it is. pscholer 8th of June 2022
425  float mmLatency = (m_isData? m_mmLatencyData : m_mmLatencyMC );
426  float stgcLatency = (m_isData? m_stgcLatencyData : m_stgcLatencyMC);
427 
428  const float peakTime = m_idHelperSvc->isMM(chnlId) ? mmPeakTime() + mmLatency : stgcPeakTime() + stgcLatency;
429  time = relBCID*25. - (tdo-calib.intercept)/calib.slope + peakTime;
430  return true;
431 }
432 
435  properties.driftVelocity = m_vDrift;
436  properties.longitudinalDiffusionSigma = m_longDiff;
437  properties.transverseDiffusionSigma = m_transDiff;
438  properties.interactionDensityMean = m_interactionDensityMean;
439  properties.interactionDensitySigma = m_interactionDensitySigma;
440  properties.lorentzAngleFunction = m_lorentzAngleFunction;
441  return properties;
442 }
443 
444 
446  // MuonDetectorManager from the conditions store
447  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
448  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
449  if(m_idHelperSvc->isMM(id)){
450  const MuonGM::MMReadoutElement* detEl = muDetMgr->getMMReadoutElement(id);
451  return detEl->stripPosition(id,locPos);
452 
453  } else if(m_idHelperSvc->issTgc(id)){
454  const MuonGM::sTgcReadoutElement* detEl = muDetMgr->getsTgcReadoutElement(id);
455  return detEl->stripPosition(id,locPos);
456 
457  } else {
458  return false;
459  }
460 }
MuonGM::MMReadoutElement::stripPosition
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position – local or global If the strip number is outside the range of valid strips,...
Definition: MMReadoutElement.h:207
Muon::STGC_RawData::identify
const Identifier identify() const
Definition: STGC_RawData.h:52
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
NSWCalib::CalibratedStrip::time
double time
Definition: INSWCalibTool.h:22
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Muon::MMPrepData
Class to represent MM measurements.
Definition: MMPrepData.h:22
Muon::MM_RawData::relBcid
uint16_t relBcid() const
Definition: MM_RawData.h:63
Muon::MM_RawData::s_lowerTimeBound
static constexpr double s_lowerTimeBound
Definition: MM_RawData.h:72
NswCalibDbTimeChargeData::CalibConstants
Helper struct to cache all calibration constants in a common place of the memory.
Definition: NswCalibDbTimeChargeData.h:28
NSWCalib::CalibratedStrip::charge
double charge
Definition: INSWCalibTool.h:21
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Muon::NSWCalibTool::initializeGasProperties
StatusCode initializeGasProperties()
Definition: NSWCalibTool.cxx:66
python.TestDriveDummies.properties
dictionary properties
Definition: TestDriveDummies.py:14
NSWCalib::CalibratedStrip::distDrift
double distDrift
Definition: INSWCalibTool.h:24
Muon::NSWCalibTool::pdoToCharge
bool pdoToCharge(const EventContext &ctx, const bool inCounts, const int pdo, const Identifier &chnlId, float &charge) const override
Definition: NSWCalibTool.cxx:301
NSWCalib::CalibratedStrip::dx
double dx
Definition: INSWCalibTool.h:27
sTgcReadoutElement.h
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Muon::MM_RawData::timeAndChargeInCounts
bool timeAndChargeInCounts() const
Definition: MM_RawData.h:65
Muon::MM_RawData::identify
const Identifier & identify() const
Definition: MM_RawData.h:58
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
MuonGM::MMReadoutElement::getDesign
const MuonChannelDesign * getDesign(const Identifier &id) const
returns the MuonChannelDesign class for the given identifier
Definition: MMReadoutElement.h:191
Muon::MM_RawData::time
int time() const
Definition: MM_RawData.h:62
Muon::NSWCalibTool::timeToTdo
bool timeToTdo(const EventContext &ctx, const float time, const Identifier &chnlId, int &tdo, int &relBCID) const override
Definition: NSWCalibTool.cxx:325
NSWCalib::CalibratedStrip::resTransDistDrift
double resTransDistDrift
Definition: INSWCalibTool.h:25
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Trk::PrepRawData::rdoList
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Muon::NSWCalibTool::tdoToTime
bool tdoToTime(const EventContext &ctx, const bool inCounts, const int tdo, const Identifier &chnlId, float &time, const int relBCID) const override
Definition: NSWCalibTool.cxx:405
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
drawFromPickle.cos
cos
Definition: drawFromPickle.py:36
Muon::MM_RawData::s_BCWindow
static constexpr int s_BCWindow
Definition: MM_RawData.h:75
NSWCalib::CalibratedStrip::resLongDistDrift
double resLongDistDrift
Definition: INSWCalibTool.h:26
x
#define x
Muon::NSWCalibTool::loadMagneticField
bool loadMagneticField(const EventContext &ctx, MagField::AtlasFieldCache &fieldCache) const
Definition: NSWCalibTool.cxx:242
Muon::STGC_RawData::s_lowerTimeBound
static constexpr double s_lowerTimeBound
Definition: STGC_RawData.h:67
MuonGM::sTgcReadoutElement::stripPosition
virtual bool stripPosition(const Identifier &id, Amg::Vector2D &pos) const override final
strip position - should be renamed to channel position If the strip number is outside the range of va...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:321
Muon::NSWCalibTool::mmGasProperties
NSWCalib::MicroMegaGas mmGasProperties() const override
Definition: NSWCalibTool.cxx:433
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MMReadoutElement.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Muon::MMPrepData::stripCharges
const std::vector< int > & stripCharges() const
returns the list of charges
Definition: MMPrepData.h:257
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
NSWCalib::MicroMegaGas::angleFunction
std::function< double(double)> angleFunction
Definition: INSWCalibTool.h:40
Muon::NSWCalibTool::distToTime
StatusCode distToTime(const EventContext &ctx, const Muon::MMPrepData *prepData, const Amg::Vector3D &globalPos, const std::vector< double > &driftDistances, std::vector< double > &driftTimes) const override
Definition: NSWCalibTool.cxx:251
Muon::NSWCalibTool::timeToTdoSTGC
bool timeToTdoSTGC(const NswCalibDbTimeChargeData *tdoPdoData, const float time, const Identifier &chnlId, int &tdo, int &relBCID) const
Definition: NSWCalibTool.cxx:360
Muon::STGC_RawData
Definition: STGC_RawData.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:85
Muon::MM_RawData
Temporary class to hold the MM RDO.
Definition: MM_RawData.h:20
Muon::NSWCalibTool::applyT0Calibration
float applyT0Calibration(const EventContext &ctx, const Identifier &id, float time) const
Definition: NSWCalibTool.cxx:385
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
MuonGM::MMReadoutElement::stripGlobalPosition
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
Definition: MMReadoutElement.h:280
NSWCalib::CalibratedStrip::locPos
Amg::Vector2D locPos
Definition: INSWCalibTool.h:28
MuonGM::sTgcReadoutElement
An sTgcReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station c...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:30
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::MMPrepData::stripNumbers
const std::vector< uint16_t > & stripNumbers() const
returns the list of strip numbers
Definition: MMPrepData.h:247
NSWCalib::CalibratedStrip
Definition: INSWCalibTool.h:20
Muon::MMPrepData::stripTimes
const std::vector< short int > & stripTimes() const
returns the list of times
Definition: MMPrepData.h:252
Trk::PrepRawData::identify
Identifier identify() const
return the identifier
Muon::MM_RawData::charge
int charge() const
Definition: MM_RawData.h:64
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
Muon::NSWCalibTool::getCalibData
const NswCalibDbTimeChargeData * getCalibData(const EventContext &ctx) const
Definition: NSWCalibTool.cxx:81
MuonGM::sTgcReadoutElement::stripGlobalPosition
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:332
Muon::STGC_RawData::time
float time() const
Definition: STGC_RawData.h:55
charge
double charge(const T &p)
Definition: AtlasPID.h:538
Muon::NSWCalibTool::calibrateClus
StatusCode calibrateClus(const EventContext &ctx, const Muon::MMPrepData *prepData, const Amg::Vector3D &globalPos, std::vector< NSWCalib::CalibratedStrip > &calibClus) const override
Definition: NSWCalibTool.cxx:91
python.PhysicalConstants.c_light
float c_light
Definition: PhysicalConstants.py:63
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
NSWCalibTool.h
PlotSFuncertainty.calib
calib
Definition: PlotSFuncertainty.py:110
Muon::NSWCalibTool::localStripPosition
bool localStripPosition(const Identifier &id, Amg::Vector2D &locPos) const
Definition: NSWCalibTool.cxx:445
Muon::NSWCalibTool::timeToTdoMM
bool timeToTdoMM(const NswCalibDbTimeChargeData *tdoPdoData, const float time, const Identifier &chnlId, int &tdo, int &relBCID) const
Definition: NSWCalibTool.cxx:334
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:50
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonGM::MuonDetectorManager::getMMReadoutElement
const MMReadoutElement * getMMReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:255
MagField::AtlasFieldCache
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: AtlasFieldCache.h:43
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:25
Muon::NSWCalibTool::NSWCalibTool
NSWCalibTool(const std::string &, const std::string &, const IInterface *)
Definition: NSWCalibTool.cxx:46
MagField::AtlasFieldCache::getField
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
Definition: AtlasFieldCache.cxx:42
Muon::NSWCalibTool::initialize
virtual StatusCode initialize() override
Definition: NSWCalibTool.cxx:52
NswCalibDbTimeChargeData
Definition: NswCalibDbTimeChargeData.h:19
MuonGM::MuonDetectorManager::getsTgcReadoutElement
const sTgcReadoutElement * getsTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:259
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
Muon::STGC_RawData::charge
unsigned int charge() const
Definition: STGC_RawData.h:57
AthAlgTool
Definition: AthAlgTool.h:26
Muon::NSWCalibTool::calibrateStrip
StatusCode calibrateStrip(const Identifier &id, const double time, const double charge, const double lorentzAngle, NSWCalib::CalibratedStrip &calibStrip) const override
Definition: NSWCalibTool.cxx:126
Muon::STGC_RawData::bcTag
uint16_t bcTag() const
Definition: STGC_RawData.h:58
MuonGM::MuonChannelDesign::channelWidth
double channelWidth() const
calculate local channel width
Definition: MuonChannelDesign.h:399
Muon::NSWCalibTool::chargeToPdo
bool chargeToPdo(const EventContext &ctx, const float charge, const Identifier &chnlId, int &pdo) const override
Definition: NSWCalibTool.cxx:277
python.compressB64.c
def c
Definition: compressB64.py:93
Muon::STGC_RawData::timeAndChargeInCounts
bool timeAndChargeInCounts() const
Definition: STGC_RawData.h:61
NswCalibDbTimeChargeData::getCalibForChannel
const CalibConstants * getCalibForChannel(const CalibDataType type, const Identifier &channelId) const
Retrieves the calibration constant for a particular readout channel.
Definition: NswCalibDbTimeChargeData.cxx:121
NSWCalib::MicroMegaGas
Definition: INSWCalibTool.h:32
Muon::STGC_RawData::s_BCWindow
static constexpr int s_BCWindow
Definition: STGC_RawData.h:70
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
NSWCalib::CalibratedStrip::identifier
Identifier identifier
Definition: INSWCalibTool.h:29
Identifier
Definition: IdentifierFieldParser.cxx:14