ATLAS Offline Software
NSWCalibTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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( m_idHelperSvc->hasMM() && m_idHelperSvc->hasSTGC() ));
59  ATH_CHECK(m_muDetMgrKey.initialize( m_idHelperSvc->hasMM() && m_idHelperSvc->hasSTGC() ));
60 
61  if ( m_idHelperSvc->hasMM() && m_idHelperSvc->hasSTGC() ) {
62  ATH_CHECK(initializeGasProperties());
63  } else {
64  ATH_MSG_INFO("MM or STGC not part of initialized detector layout, skipping initialization");
65  }
66  ATH_CHECK(initializeGasProperties());
67  return StatusCode::SUCCESS;
68 }
69 
71  if (!map_vDrift.count(m_gasMixture)) {
72  ATH_MSG_FATAL("Configured Micromegas with unkown gas mixture: " << m_gasMixture);
73  return StatusCode::FAILURE;
74  }
75 
76  m_vDrift = map_vDrift.find(m_gasMixture)->second;
77  m_transDiff = map_transDiff.find(m_gasMixture)->second;
78  m_longDiff = map_longDiff.find(m_gasMixture)->second;
79  m_interactionDensitySigma = map_interactionDensitySigma.find(m_gasMixture)->second;
80  m_interactionDensityMean = map_interactionDensityMean.find(m_gasMixture)->second;
81  m_lorentzAngleFunction = map_lorentzAngleFunctionPars.find(m_gasMixture)->second;
82  return StatusCode::SUCCESS;
83 }
84 
85 const NswCalibDbTimeChargeData* Muon::NSWCalibTool::getCalibData(const EventContext& ctx) const {
86  // set up pointer to conditions object
87  SG::ReadCondHandle<NswCalibDbTimeChargeData> readTdoPdo{m_condTdoPdoKey, ctx};
88  if(!readTdoPdo.isValid()){
89  ATH_MSG_ERROR("Cannot find conditions data container for TDOs and PDOs!");
90  return nullptr;
91  }
92  return readTdoPdo.cptr();
93 }
94 
95 StatusCode Muon::NSWCalibTool::calibrateClus(const EventContext& ctx, const Muon::MMPrepData* prepData, const Amg::Vector3D& globalPos, std::vector<NSWCalib::CalibratedStrip>& calibClus) const {
96 
97  double lorentzAngle {0.};
98  if(m_applyMmBFieldCalib){
100  MagField::AtlasFieldCache fieldCache;
101  if (!loadMagneticField(ctx, fieldCache)) return StatusCode::FAILURE;
102  Amg::Vector3D magneticField{Amg::Vector3D::Zero()};
103  fieldCache.getField(globalPos.data(), magneticField.data());
104 
106  double phi = globalPos.phi();
107  double bfield = (magneticField.x()*std::sin(phi)-magneticField.y()*std::cos(phi))*1000.;
108 
110  int gasGap = m_idHelperSvc->mmIdHelper().gasGap(prepData->identify());
111  bool changeSign = ( globalPos.z() < 0. ? (gasGap==1 || gasGap==3) : (gasGap==2 || gasGap==4) );
112  if (changeSign) bfield = -bfield;
113 
115  lorentzAngle = (bfield>0. ? 1. : -1.)*m_lorentzAngleFunction(std::abs(bfield)) * toRad;
116  }
117 
119  for (unsigned int i = 0; i < prepData->stripNumbers().size(); ++i){
120  Identifier id = prepData->rdoList().at(i);
121  double time = prepData->stripTimes().at(i);
122  double charge = prepData->stripCharges().at(i);
123  NSWCalib::CalibratedStrip calibStrip;
124  ATH_CHECK(calibrateStrip(id,time, charge, lorentzAngle, calibStrip));
125  calibClus.push_back(std::move(calibStrip));
126  }
127  return StatusCode::SUCCESS;
128 }
129 
130 StatusCode Muon::NSWCalibTool::calibrateStrip(const Identifier& id, const double time, const double charge, const double lorentzAngle, NSWCalib::CalibratedStrip& calibStrip) const {
131 
132  //get local positon
134  if(!localStripPosition(id,locPos)) {
135  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" Failed to retrieve local strip position "<<m_idHelperSvc->toString(id));
136  return StatusCode::FAILURE;
137  }
138 
139  calibStrip.identifier = id;
140  calibStrip.charge = charge;
141  calibStrip.time = time;
142 
143  double vDriftCorrected = m_vDrift * std::cos(lorentzAngle);
144  calibStrip.distDrift = vDriftCorrected * calibStrip.time;
145 
147  calibStrip.resTransDistDrift = pitchErr + std::pow(m_transDiff * calibStrip.distDrift, 2);
148  calibStrip.resLongDistDrift = std::pow(m_ionUncertainty * vDriftCorrected, 2)
149  + std::pow(m_longDiff * calibStrip.distDrift, 2);
150  calibStrip.dx = std::sin(lorentzAngle) * calibStrip.time * m_vDrift;
151  calibStrip.locPos = Amg::Vector2D(locPos.x() + calibStrip.dx, locPos.y());
152  return StatusCode::SUCCESS;
153 }
154 
155 
156 StatusCode Muon::NSWCalibTool::calibrateStrip(const EventContext& ctx, const Muon::MM_RawData* mmRawData, NSWCalib::CalibratedStrip& calibStrip) const {
157 
158  const Identifier rdoId = mmRawData->identify();
159  //get local postion
160  Amg::Vector2D locPos{0,0};
161  if(!localStripPosition(rdoId,locPos)) {
162  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" Failed to retrieve local strip position "<<m_idHelperSvc->toString(rdoId));
163  return StatusCode::FAILURE;
164  }
165 
166  // MuonDetectorManager from the conditions store
167  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey, ctx};
168  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
169 
170  //get globalPos
171  Amg::Vector3D globalPos{Amg::Vector3D::Zero()};
172  const MuonGM::MMReadoutElement* detEl = muDetMgr->getMMReadoutElement(rdoId);
173  detEl->stripGlobalPosition(rdoId,globalPos);
174 
175  // RDO has values in counts for both simulation and data
176  float time{-FLT_MAX}, charge{-FLT_MAX};
177  tdoToTime (ctx, mmRawData->timeAndChargeInCounts(), mmRawData->time (), rdoId, time , mmRawData->relBcid());
178  pdoToCharge(ctx, mmRawData->timeAndChargeInCounts(), mmRawData->charge(), rdoId, charge );
179 
180  calibStrip.charge = charge;
181  // historically the peak time is included in the time determined by the MM digitization and therefore added back in the tdoToTime function
182  // in order to not break the RDO to digit conversion needed for the trigger and the overlay
183  calibStrip.time = time - globalPos.norm() * reciprocalSpeedOfLight - mmPeakTime();
184  // applying T0 calibration, cannot be done inside the the tdo to time function since the tof correction was included when deriving the calibration constants
185  if(m_applyMmT0Calib){
186  calibStrip.time = applyT0Calibration(ctx, rdoId, calibStrip.time);
187  }
188 
189  calibStrip.identifier = rdoId;
190 
191  ATH_MSG_DEBUG("Calibrating RDO " << m_idHelperSvc->toString(rdoId) << "with pdo: " << mmRawData->charge() << " tdo: "<< mmRawData->time() << " relBCID "<< mmRawData->relBcid() << " charge and time in counts " <<
192  mmRawData->timeAndChargeInCounts() << " isData "<< m_isData << " to charge: " << calibStrip.charge << " electrons time after corrections " << calibStrip.time << " ns time before corrections "<< time << "ns");
193 
194 
195  //get stripWidth
196  detEl->getDesign(rdoId)->channelWidth(); // positon is not used for strip width
197 
198  calibStrip.distDrift = m_vDrift * calibStrip.time;
199  calibStrip.resTransDistDrift = pitchErr + std::pow(m_transDiff * calibStrip.distDrift, 2);
200  calibStrip.resLongDistDrift = std::pow(m_ionUncertainty * m_vDrift, 2)
201  + std::pow(m_longDiff * calibStrip.distDrift, 2);
202 
203  calibStrip.locPos = locPos;
204 
205  return StatusCode::SUCCESS;
206 }
207 
208 StatusCode Muon::NSWCalibTool::calibrateStrip(const EventContext& ctx, const Muon::STGC_RawData* sTGCRawData, NSWCalib::CalibratedStrip& calibStrip) const {
209 
210  Identifier rdoId = sTGCRawData->identify();
211  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey, ctx};
212  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
213 
214  //get globalPos
215  Amg::Vector3D globalPos{Amg::Vector3D::Zero()};
216  const MuonGM::sTgcReadoutElement* detEl = muDetMgr->getsTgcReadoutElement(rdoId);
217  detEl->stripGlobalPosition(rdoId,globalPos);
218 
219  //get local postion
221  if(!localStripPosition(rdoId,locPos)) {
222  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" Failed to retrieve local strip position "<<m_idHelperSvc->toString(rdoId));
223  return StatusCode::FAILURE;
224  }
225 
226  // RDO has values in counts for both simulation and data
227  float time{-FLT_MAX}, charge{-FLT_MAX};
228  tdoToTime (ctx, sTGCRawData->timeAndChargeInCounts(), sTGCRawData->time (), rdoId, time , sTGCRawData->bcTag());
229  pdoToCharge(ctx, sTGCRawData->timeAndChargeInCounts(), sTGCRawData->charge(), rdoId, charge );
230  if(sTGCRawData->timeAndChargeInCounts()){
231  calibStrip.charge = charge * sTGC_pCPerfC;
232  } else {
233  calibStrip.charge = charge;
234  }
235  calibStrip.time = time - stgcPeakTime();
236 
237  if(m_applysTgcT0Calib){
238  calibStrip.time = applyT0Calibration(ctx, rdoId, calibStrip.time);
239  }
240 
241  calibStrip.identifier = rdoId;
242  calibStrip.locPos = locPos;
243  return StatusCode::SUCCESS;
244 
245 }
246 bool Muon::NSWCalibTool::loadMagneticField(const EventContext& ctx, MagField::AtlasFieldCache& fieldCache) const {
247  SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCondObjInputKey, ctx};
248  if (!readHandle.isValid()) {
249  ATH_MSG_ERROR("doDigitization: Failed to retrieve AtlasFieldCacheCondObj with key " << m_fieldCondObjInputKey.key());
250  return false;
251  }
252  readHandle.cptr()->getInitializedCache(fieldCache);
253  return true;
254 }
255 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 {
257  MagField::AtlasFieldCache fieldCache;
258  if (!loadMagneticField(ctx, fieldCache)) return StatusCode::FAILURE;
259  Amg::Vector3D magneticField{Amg::Vector3D::Zero()};
260  fieldCache.getField(globalPos.data(), magneticField.data());
261 
263  const double phi = globalPos.phi();
264  double bfield = (magneticField.x()*std::sin(phi)-magneticField.y()*std::cos(phi))*1000.;
265 
267  int gasGap = m_idHelperSvc->mmIdHelper().gasGap(prepData->identify());
268  bool changeSign = ( globalPos.z() < 0. ? (gasGap==1 || gasGap==3) : (gasGap==2 || gasGap==4) );
269  if (changeSign) bfield = -bfield;
270  double cos2_lorentzAngle = std::pow(std::cos ( (bfield>0. ? 1. : -1.)*m_lorentzAngleFunction(std::abs(bfield)) * toRad), 2);
272  for (const double dist : driftDistances){
273  double time = dist / (m_vDrift*cos2_lorentzAngle);
274  driftTimes.push_back(time);
275  }
276  return StatusCode::SUCCESS;
277 
278 }
279 
280 bool
281 Muon::NSWCalibTool::chargeToPdo(const EventContext& ctx, const float charge, const Identifier& chnlId, int& pdo) const {
282  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
283  if (!tdoPdoData) {
284  pdo = 0;
285  return false;
286  }
287  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::PDO, chnlId);
288  if (!calib_ptr) {
289  pdo = 0;
290  return false;
291  }
292  const TimeCalibConst& calib{*calib_ptr};
293  float c = charge;
294  if (m_idHelperSvc->isMM (chnlId)) c /= MM_electronsPerfC;
295  else if(m_idHelperSvc->issTgc(chnlId)) c *= sTGC_pCPerfC;
296  else {
297  pdo = 0;
298  return false;
299  }
300  pdo = c * calib.slope + calib.intercept;
301  return true;
302 }
303 
304 bool
305 Muon::NSWCalibTool::pdoToCharge(const EventContext& ctx, const bool inCounts, const int pdo, const Identifier& chnlId, float& charge) const {
306  if(!inCounts){
307  charge = pdo;
308  return true;
309  }
310  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
311  if (!tdoPdoData) {
312  charge =0.;
313  return false;
314  }
315  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::PDO, chnlId);
316  if (!calib_ptr) {
317  charge = 0.;
318  return false;
319  }
320  const TimeCalibConst& calib{*calib_ptr};
321  charge = (pdo-calib.intercept)/calib.slope;
322  if (m_idHelperSvc->isMM (chnlId)) charge *= MM_electronsPerfC;
323  else if(m_idHelperSvc->issTgc(chnlId)) charge /= sTGC_pCPerfC;
324  else return false;
325  return true;
326 }
327 
328 bool
329 Muon::NSWCalibTool::timeToTdo(const EventContext& ctx, const float time, const Identifier& chnlId, int& tdo, int& relBCID) const {
330  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
331  if (!tdoPdoData) return false;
332  if (m_idHelperSvc->isMM (chnlId)) return timeToTdoMM (tdoPdoData, time, chnlId, tdo, relBCID);
333  else if(m_idHelperSvc->issTgc(chnlId)) return timeToTdoSTGC(tdoPdoData, time, chnlId, tdo, relBCID);
334  return false;
335 }
336 
337 bool
338 Muon::NSWCalibTool::timeToTdoMM(const NswCalibDbTimeChargeData* tdoPdoData, const float time, const Identifier& chnlId, int& tdo, int& relBCID) const {
339  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
340  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::TDO, chnlId);
341  if (!calib_ptr) {
342  tdo = relBCID = 0;
343  return false;
344  }
345  const TimeCalibConst& calib{*calib_ptr};
346  float tdoTime = -999.9;
347  constexpr float lowerBound = Muon::MM_RawData::s_lowerTimeBound;
348  for(int i_relBCID=0; i_relBCID<Muon::MM_RawData::s_BCWindow; i_relBCID++){
349  if(t >= lowerBound+i_relBCID*25 && t < (lowerBound+25)+i_relBCID*25){
350  tdoTime = i_relBCID*25 - t;
351  relBCID = i_relBCID;
352  break;
353  }
354  }
355  if(tdoTime < lowerBound) {
356  tdo = relBCID = 0;
357  return false;
358  }
359  tdo = tdoTime*calib.slope + calib.intercept;
360  return true;
361 }
362 
363 bool
364 Muon::NSWCalibTool::timeToTdoSTGC(const NswCalibDbTimeChargeData* tdoPdoData, const float time, const Identifier& chnlId, int& tdo, int& relBCID) const {
365  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
366  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::TDO, chnlId);
367  if (!calib_ptr){
368  tdo = relBCID = 0;
369  return false;
370  }
371  const TimeCalibConst& calib = {*calib_ptr};
372  float tdoTime = -999.9;
373  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
374  for(int i_relBCID=0; i_relBCID<Muon::STGC_RawData::s_BCWindow; ++i_relBCID){
375  if(t >= lowerBound+i_relBCID*25 && t < (lowerBound+25)+i_relBCID*25){
376  tdoTime = i_relBCID*25 - t;
377  relBCID = i_relBCID;
378  break;
379  }
380  }
381  if(tdoTime < lowerBound) {
382  tdo = relBCID = 0;
383  return false;
384  }
385  tdo = tdoTime*calib.slope + calib.intercept;
386  return true;
387 }
388 
389 float Muon::NSWCalibTool::applyT0Calibration(const EventContext& ctx, const Identifier& id, float time) const {
390  SG::ReadCondHandle<NswT0Data> readT0{m_condT0Key, ctx};
391  if(!readT0.isValid()){
392  ATH_MSG_ERROR("Cannot find conditions data container for T0s!");
393  }
394  float t0 {0};
395  bool isGood = readT0->getT0(id, t0);
396  if(!isGood || t0==0){
397  ATH_MSG_DEBUG("failed to retrieve good t0 from database, skipping t0 calibration");
398  return time;
399  } else {
400  float targetT0 = (m_idHelperSvc->isMM(id) ? m_mmT0TargetValue : m_stgcT0TargetValue);
401  float newTime = time + (targetT0 - t0);
402  ATH_MSG_DEBUG("doing T0 calibration for RDO " << m_idHelperSvc->toString(id) << " time " << time <<" t0 from database " << t0 << " t0 target " << targetT0 << " new time " << newTime);
403  return newTime;
404  }
405 }
406 
407 
408 bool
409 Muon::NSWCalibTool::tdoToTime(const EventContext& ctx, const bool inCounts, const int tdo, const Identifier& chnlId, float& time, const int relBCID) const {
410  if(!inCounts){
411  time = tdo;
412  return true;
413  }
414  const NswCalibDbTimeChargeData* tdoPdoData = getCalibData(ctx);
415  if (!tdoPdoData) {
416  time = 0.;
417  return false;
418  }
419  const TimeCalibConst* calib_ptr = tdoPdoData->getCalibForChannel(TimeCalibType::TDO, chnlId);
420  if (!calib_ptr){
421  time = 0.;
422  return false;
423  }
424  const TimeCalibConst& calib {*calib_ptr};
425  //this shift of 25ns is necessary to align the time of the signal with the way the VMM determines the time
426  //(relBCID 0 corresponds to -37.5 ns to - 12.5 ns)
427  //Eventually it should go into the conditions db since it is probably not the same for MC and Data
428  //but for now it is kept like it is. pscholer 8th of June 2022
429  float mmLatency = (m_isData? m_mmLatencyData : m_mmLatencyMC );
430  float stgcLatency = (m_isData? m_stgcLatencyData : m_stgcLatencyMC);
431 
432  const float peakTime = m_idHelperSvc->isMM(chnlId) ? mmPeakTime() + mmLatency : stgcPeakTime() + stgcLatency;
433  time = relBCID*25. - (tdo-calib.intercept)/calib.slope + peakTime;
434  return true;
435 }
436 
439  properties.driftVelocity = m_vDrift;
440  properties.longitudinalDiffusionSigma = m_longDiff;
441  properties.transverseDiffusionSigma = m_transDiff;
442  properties.interactionDensityMean = m_interactionDensityMean;
443  properties.interactionDensitySigma = m_interactionDensitySigma;
444  properties.lorentzAngleFunction = m_lorentzAngleFunction;
445  return properties;
446 }
447 
448 
450  // MuonDetectorManager from the conditions store
451  SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey};
452  const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr();
453  if(m_idHelperSvc->isMM(id)){
454  const MuonGM::MMReadoutElement* detEl = muDetMgr->getMMReadoutElement(id);
455  return detEl->stripPosition(id,locPos);
456 
457  } else if(m_idHelperSvc->issTgc(id)){
458  const MuonGM::sTgcReadoutElement* detEl = muDetMgr->getsTgcReadoutElement(id);
459  return detEl->stripPosition(id,locPos);
460 
461  } else {
462  return false;
463  }
464 }
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:209
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:65
Muon::MM_RawData::s_lowerTimeBound
static constexpr double s_lowerTimeBound
Definition: MM_RawData.h:74
NswCalibDbTimeChargeData::CalibConstants
Helper struct to cache all calibration constants in a common place of the memory.
Definition: NswCalibDbTimeChargeData.h:28
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
NSWCalib::CalibratedStrip::charge
double charge
Definition: INSWCalibTool.h:21
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
Muon::NSWCalibTool::initializeGasProperties
StatusCode initializeGasProperties()
Definition: NSWCalibTool.cxx:70
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
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:305
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:67
Muon::MM_RawData::identify
const Identifier & identify() const
Definition: MM_RawData.h:60
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:193
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
Muon::MM_RawData::time
int time() const
Definition: MM_RawData.h:64
Muon::NSWCalibTool::timeToTdo
bool timeToTdo(const EventContext &ctx, const float time, const Identifier &chnlId, int &tdo, int &relBCID) const override
Definition: NSWCalibTool.cxx:329
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:409
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:77
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:246
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:323
Muon::NSWCalibTool::mmGasProperties
NSWCalib::MicroMegaGas mmGasProperties() const override
Definition: NSWCalibTool.cxx:437
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
MMReadoutElement.h
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:255
Muon::NSWCalibTool::timeToTdoSTGC
bool timeToTdoSTGC(const NswCalibDbTimeChargeData *tdoPdoData, const float time, const Identifier &chnlId, int &tdo, int &relBCID) const
Definition: NSWCalibTool.cxx:364
Muon::STGC_RawData
Definition: STGC_RawData.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:92
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:389
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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:282
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:28
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
python.JsonUtils.properties
properties
Definition: JsonUtils.py:96
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:66
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
Muon::NSWCalibTool::getCalibData
const NswCalibDbTimeChargeData * getCalibData(const EventContext &ctx) const
Definition: NSWCalibTool.cxx:85
MuonGM::sTgcReadoutElement::stripGlobalPosition
bool stripGlobalPosition(const Identifier &id, Amg::Vector3D &gpos) const
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h:334
Muon::STGC_RawData::time
float time() const
Definition: STGC_RawData.h:55
charge
double charge(const T &p)
Definition: AtlasPID.h:494
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:95
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:449
Muon::NSWCalibTool::timeToTdoMM
bool timeToTdoMM(const NswCalibDbTimeChargeData *tdoPdoData, const float time, const Identifier &chnlId, int &tdo, int &relBCID) const
Definition: NSWCalibTool.cxx:338
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
MuonGM::MuonDetectorManager
The MuonDetectorManager stores the transient representation of the Muon Spectrometer geometry and pro...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MuonDetectorManager.h:49
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:569
MuonGM::MMReadoutElement
An MMReadoutElement corresponds to a single STGC module; therefore typicaly a barrel muon station con...
Definition: MMReadoutElement.h:23
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:130
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:281
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:113
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