ATLAS Offline Software
MuonTGMeasurementTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
27 #include "TrkGeometry/Layer.h"
32 
33 // Constructor with parameters:
34 Muon::MuonTGMeasurementTool::MuonTGMeasurementTool(const std::string& type, const std::string& name, const IInterface* parent) :
35  AthAlgTool(type, name, parent), m_muonDetMgr(nullptr) {
36  declareInterface<Muon::IMuonTGMeasTool>(this);
37 }
38 
39 // Initialize method:
41  // Get the messaging service, print where you are
42  ATH_MSG_INFO("MuonTGMeasurementTool::initialize()");
43 
44  ATH_CHECK(m_idHelperSvc.retrieve());
45  ATH_CHECK(m_DetectorManagerKey.initialize(!m_useDSManager));
46  if (m_useDSManager) { ATH_CHECK(detStore()->retrieve(m_muonDetMgr)); }
47 
48  // define projection matrices
49  m_tgcProjEta = std::make_unique<AmgMatrix(5, 5)>();
50  m_tgcProjEta->setIdentity();
51  (*m_tgcProjEta)(0, 0) = 0.;
52  (*m_tgcProjEta)(1, 1) = 0.;
53  (*m_tgcProjEta)(0, 1) = 1.;
54  (*m_tgcProjEta)(1, 0) = -1.;
55  m_tgcProjPhi = std::make_unique<AmgMatrix(5, 5)>();
56  m_tgcProjPhi->setIdentity();
57 
58  m_rpcProjEta = std::make_unique<AmgMatrix(5, 5)>();
59  m_rpcProjEta->setIdentity();
60  (*m_rpcProjEta)(0, 0) = 0.;
61  (*m_rpcProjEta)(1, 1) = 0.;
62  (*m_rpcProjEta)(0, 1) = 1.;
63  (*m_rpcProjEta)(1, 0) = 1.;
64  m_rpcProjPhi = std::make_unique<AmgMatrix(5, 5)>();
65  m_rpcProjPhi->setIdentity();
66 
67  if (!m_trackingGeometryReadKey.empty()) {
68  ATH_CHECK(m_trackingGeometryReadKey.initialize());
69  } else {
70  ATH_CHECK(m_trackingGeometrySvc.retrieve());
71  }
72  return StatusCode::SUCCESS;
73 }
75  Identifier id) const {
76  const MuonGM::MuonDetectorManager* MuonDetMgr = m_muonDetMgr;
77  if (!m_useDSManager) {
78  SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
79  MuonDetMgr = DetectorManagerHandle.cptr();
80  if (MuonDetMgr == nullptr) {
81  ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
82  // return StatusCode::FAILURE;
83  }
84  }
85 
86  // Get the messaging service, print where you are
87  ATH_MSG_DEBUG("MuonTGMeasurementTool::layerToDetEl");
88  const Trk::TrackParameters* projPar = nullptr;
89  // const Amg::Vector2D* locPos = 0;
90  // check input
91  if (!lay || !parm || !id.get_identifier32().get_compact()) return projPar;
92 
93  // get tracking geometry
94 
95  // check compatibility of layer info and required id ? this was already done when associating !
96  if (!lay->layerType()) return projPar;
97  Identifier layId(lay->layerType());
98 
99  unsigned int hitType = 0;
100  if (m_idHelperSvc->isMdt(id)) hitType = 1;
101  if (m_idHelperSvc->isRpc(id)) hitType = 2;
102  if (m_idHelperSvc->isCsc(id)) hitType = 3;
103  if (m_idHelperSvc->isTgc(id)) hitType = 4;
104 
105  unsigned int layType = 0;
106  if (m_idHelperSvc->isMdt(layId)) layType = 1;
107  if (m_idHelperSvc->isRpc(layId)) layType = 2;
108  if (m_idHelperSvc->isCsc(layId)) layType = 3;
109  if (m_idHelperSvc->isTgc(layId)) layType = 4;
110 
111  if (layType != hitType) return projPar;
112 
113  if (hitType == 0) {
114  ATH_MSG_ERROR("unknown hit technology");
115  return projPar;
116  } else {
117  ATH_MSG_DEBUG("hit technology:" << hitType);
118  }
119 
120  ATH_MSG_DEBUG("extrapolated covariance:" << parm->covariance());
121 
122  if (hitType == 1) {
123  const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(id);
124  if (!mdtROE) {
125  ATH_MSG_WARNING(name() << "MDT readout element not found");
126  return projPar;
127  }
128  // local position of tube
129  int tube = m_idHelperSvc->mdtIdHelper().tube(id);
130  Amg::Vector2D locWire(0., lay->getRef() + (tube - 1) * 30.035);
131  if (fabs(lay->getRef()) > 10e6) {
132  double sign = (lay->getRef() > 0) ? 1. : -1.;
133  int dec = int(lay->getRef() / 1.e5);
134  double ref0 = dec / 1.e5;
135  double ref1 = lay->getRef() - dec * 1e5 - 0.5 * (sign + 1) * 1e5;
136  locWire[0] = ref0;
137  locWire[1] = ref1;
138  int tube = m_idHelperSvc->mdtIdHelper().tube(id);
139  int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(id);
140  if (tube > 6 && tubeMax - tube > 5) locWire[0] = 0.;
141  }
142  if (sqrt(locWire[0] * locWire[0] + locWire[1] * locWire[1]) > 2000.) {
143  ATH_MSG_WARNING(name() << " wire shift out bounds for MDT tube :" << m_idHelperSvc->mdtIdHelper().stationName(id) << ","
144  << m_idHelperSvc->mdtIdHelper().stationEta(id) << "," << m_idHelperSvc->mdtIdHelper().stationPhi(id)
145  << ": abandon projection");
146  return projPar;
147  }
148  // direction at the layer
149  Amg::Vector3D dir = parm->momentum().unit();
150  Amg::Vector3D locDir = (lay->surfaceRepresentation().transform().inverse()) * dir;
151  Amg::Vector3D wireDir(1., 0., 0.);
152  //
153  double ND = dir.dot(lay->surfaceRepresentation().normal());
154  double DL = locDir.dot(wireDir);
155  double A = sqrt(1. - DL * DL);
156  AmgMatrix(5, 5) mdtProj;
157  mdtProj.setIdentity();
158  //
159  const Trk::StraightLineSurface* tubeSurf = dynamic_cast<const Trk::StraightLineSurface*>(&(mdtROE->surface(id)));
160  double ori = (lay->surfaceRepresentation().transform().inverse() * tubeSurf->transform()).rotation()(1, 1) > 0. ? -1. : 1.;
161  if (A > 10e-6) {
162  mdtProj(0, 1) = ND / A;
163  mdtProj(1, 0) = ori;
164  mdtProj(1, 1) = DL / A * sqrt(A * A - ND * ND) / A;
165  mdtProj(0, 0) = 0.;
166  } else {
167  mdtProj(0, 1) = 1.;
168  mdtProj(1, 0) = ori;
169  mdtProj(1, 1) = 0.;
170  mdtProj(0, 0) = 0.;
171  }
172  //
173  Amg::VectorX locPar = parm->parameters();
174  locPar[0] -= locWire[0];
175  locPar[1] -= locWire[1];
176  Amg::VectorX pPar = mdtProj * locPar;
177  ATH_MSG_DEBUG("projected parameters(layer->MDT):" << pPar);
178 
179  if (parm->covariance()) {
180  std::optional<AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(mdtProj);
181  ATH_MSG_DEBUG("projected covariance(layer->MDT):" << (*projEM));
182  projPar = new Trk::AtaStraightLine(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *tubeSurf, projEM);
183 
184  } else {
185  projPar = new Trk::AtaStraightLine(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *tubeSurf);
186  }
187  }
188 
189  if (hitType == 2) {
190  //
191  const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id);
192  if (!rpcROE) return projPar;
193  const Trk::PlaneSurface* stripSurf = dynamic_cast<const Trk::PlaneSurface*>(&(rpcROE->surface(id)));
194  if (!stripSurf) return projPar;
195  // decode ref position
196  Amg::VectorX locPar = parm->parameters();
197  // projection matrix
198  AmgMatrix(5, 5)* pMx = nullptr;
199  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
200  pMx = m_rpcProjPhi.get();
201  else
202  pMx = m_rpcProjEta.get();
203  // projected parameters
204  double eta = 1.;
205  double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(id) && m_idHelperSvc->rpcIdHelper().doubletPhi(id) == 2) ? -1. : 1.;
206  double zswap = (lay->getRef() > 10000.) ? -1. : 1.;
207  double ref = (zswap < 0.) ? lay->getRef() - 20000. : lay->getRef();
208  locPar[0] -= sign * ref;
209  Amg::VectorX pPar = (*pMx) * locPar;
210  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
211  pPar[0] *= eta;
212  else
213  pPar[1] *= -eta;
214  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
215  pPar[1] *= zswap;
216  else
217  pPar[0] *= zswap;
218 
219  std::optional<AmgMatrix(5, 5)> projEM;
220  projEM.emplace();
221  if (parm->covariance()) {
222  projEM = parm->covariance()->similarity(*pMx);
223  projPar = new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *stripSurf, projEM);
224 
225  } else {
226  projPar = new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *stripSurf);
227  projEM = std::nullopt;
228  }
229 
230  if (m_alignedMode && (parm->position() - projPar->position()).mag() > 0.001) {
231  ATH_MSG_DEBUG("geometrical RPC projection (layerToDetEl) for hit : "
232  << m_idHelperSvc->rpcIdHelper().measuresPhi(id) << "," << m_idHelperSvc->rpcIdHelper().stationName(id) << ","
233  << m_idHelperSvc->rpcIdHelper().stationEta(id) << "," << m_idHelperSvc->rpcIdHelper().stationPhi(id) << ","
234  << m_idHelperSvc->rpcIdHelper().doubletPhi(id) << "," << m_idHelperSvc->rpcIdHelper().doubletR(id) << ","
235  << m_idHelperSvc->rpcIdHelper().doubletZ(id));
236  Amg::Vector2D locPos;
237  const Amg::Vector3D& globPos = parm->position();
238  bool onSurface = stripSurf->globalToLocal(globPos, globPos, locPos);
239  if (onSurface) {
240  pPar[0] = locPos[0];
241  pPar[1] = locPos[1];
242  delete projPar;
243  projPar = nullptr;
244  projPar = projEM ? new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *stripSurf, projEM)
245  : new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *stripSurf);
246  } else {
247  delete projPar;
248  return nullptr;
249  }
250  }
251  }
252 
253  if (hitType == 3) {
254  // local position of detEl
255  const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id);
256  if (!cscROE) {
257  ATH_MSG_WARNING(name() << "CSC readout element not found");
258  return projPar;
259  }
260 
261  const Trk::PlaneSurface* stripSurf = dynamic_cast<const Trk::PlaneSurface*>(&(cscROE->surface(id)));
262  if (!stripSurf) return projPar;
263  // dealing with displaced planes, possibly sligthly displaced
264  double diff = m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55;
265  // distance between planes (assuming parallel planes)
266  Amg::Vector3D layNormal = lay->surfaceRepresentation().normal();
267  double DN = parm->momentum().dot(layNormal);
268  double t = diff / DN;
269  // displacement ( as projection of strip surface center on the layer )
270  const Amg::Vector2D csc_shift(0., lay->getRef());
271  // correct local position due to plane distance : use method independent on misalignment
272  Amg::Vector3D corrLocPos = parm->position() - t * parm->momentum() + t * DN * layNormal;
273  Amg::Vector2D locCorrLay;
274  bool onSurface = lay->surfaceRepresentation().globalToLocal(corrLocPos, corrLocPos, locCorrLay);
275 
276  if (!onSurface) {
277  ATH_MSG_WARNING(name() << ": misplaced CSC " << id);
278  return projPar;
279  }
280 
281  Amg::VectorX parProj(5);
282  parProj[0] = locCorrLay[Trk::locX] - csc_shift[Trk::locX];
283  parProj[1] = locCorrLay[Trk::locY] - csc_shift[Trk::locY];
284  parProj[2] = parm->parameters()[Trk::phi];
285  parProj[3] = parm->parameters()[Trk::theta];
286  parProj[4] = parm->parameters()[Trk::qOverP];
287  //
288  AmgMatrix(5, 5)* pMx = nullptr;
289  if (m_idHelperSvc->cscIdHelper().measuresPhi(id))
290  pMx = m_tgcProjPhi.get();
291  else
292  pMx = m_tgcProjEta.get();
293  Amg::VectorX locPar = (*pMx) * parProj;
294  ATH_MSG_DEBUG("projected parameters (layer->CSC):" << m_idHelperSvc->cscIdHelper().measuresPhi(id) << "," << locPar);
295 
296  if (parm->covariance()) {
297  std::optional<AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(*pMx);
298 
299  ATH_MSG_DEBUG("projected covariance (layer->CSC):" << *projEM);
300 
301  projPar = new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf, projEM);
302 
303  } else
304  projPar = new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf);
305 
306  ATH_MSG_DEBUG("test CSC projection:layerToDetEl:" << parm->position() << "," << projPar->position());
307  }
308 
309  if (hitType == 4) {
310  // local position at layer
311  const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id);
312  if (!tgcROE) {
313  ATH_MSG_WARNING(name() << "TGC readout element not found");
314  return projPar;
315  }
316  const Trk::PlaneSurface* stripSurf = dynamic_cast<const Trk::PlaneSurface*>(&(tgcROE->surface(id)));
317  if (!stripSurf) return projPar;
318  //
319  AmgMatrix(5, 5)* pMx = nullptr;
320  if (m_idHelperSvc->tgcIdHelper().isStrip(id))
321  pMx = m_tgcProjPhi.get();
322  else
323  pMx = m_tgcProjEta.get();
324  Amg::VectorX locPar = (*pMx) * parm->parameters();
325  ATH_MSG_DEBUG("projected parameters (layer->TGC):" << m_idHelperSvc->tgcIdHelper().isStrip(id) << "," << locPar << ","
326  << stripSurf);
327 
328  std::optional<AmgMatrix(5, 5)> projEM = std::nullopt;
329  bool bcov = false;
330 
331  if (parm->covariance()) {
332  projEM = parm->covariance()->similarity(*pMx);
333  bcov = true;
334  ATH_MSG_DEBUG("projected covariance (layer->TGC):" << (*projEM));
335  projPar = new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf, projEM);
336 
337  } else {
338  projPar = new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf);
339  }
340 
341  // verify
342  if (m_alignedMode && (parm->position() - projPar->position()).mag() > 0.001) {
343  ATH_MSG_DEBUG("geometrical TGC projection ( layer2detEl ):"
344  << m_idHelperSvc->tgcIdHelper().stationName(id) << "," << m_idHelperSvc->tgcIdHelper().stationEta(id) << ","
345  << m_idHelperSvc->tgcIdHelper().stationPhi(id) << "," << m_idHelperSvc->tgcIdHelper().isStrip(id));
346  Amg::Vector2D locPos;
347  const Amg::Vector3D& globPos = parm->position();
348  bool onSurface = stripSurf->globalToLocal(globPos, globPos, locPos);
349  if (onSurface) {
350  locPar[0] = locPos[0];
351  locPar[1] = locPos[1];
352  delete projPar;
353  projPar = nullptr;
354  projPar = bcov ? new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf, projEM)
355  : new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf);
356  } else {
357  delete projPar;
358  return nullptr;
359  }
360  }
361  }
362 
363  return projPar;
364 }
365 
367  Identifier id) const {
368  // Get the messaging service, print where you are
369  ATH_MSG_DEBUG("MuonTGMeasurementTool::detElToLayer");
370  const Trk::TrackParameters* projPar = nullptr;
371 
372  // check input
373  if (!lay || !parm || !(id.get_identifier32().get_compact() > 0)) return projPar;
374 
375  // check compatibility of layer info and required id ? this was already done when associating !
376  if (!lay->layerType()) return projPar;
377  Identifier layId(lay->layerType());
378 
379  ATH_MSG_DEBUG("MuonTGMeasurementTool::input ok");
380 
381  unsigned int hitType = 0;
382  if (m_idHelperSvc->isMdt(id)) hitType = 1;
383  if (m_idHelperSvc->isRpc(id)) hitType = 2;
384  if (m_idHelperSvc->isCsc(id)) hitType = 3;
385  if (m_idHelperSvc->isTgc(id)) hitType = 4;
386 
387  unsigned int layType = 0;
388  if (m_idHelperSvc->isMdt(layId)) layType = 1;
389  if (m_idHelperSvc->isRpc(layId)) layType = 2;
390  if (m_idHelperSvc->isCsc(layId)) layType = 3;
391  if (m_idHelperSvc->isTgc(layId)) layType = 4;
392 
393  if (layType != hitType) return projPar;
394 
395  if (hitType == 0) {
396  ATH_MSG_DEBUG("unknown hit technology");
397  return projPar;
398  }
399 
400  if (hitType == 1) {
401  // local position of the tube
402  int tube = m_idHelperSvc->mdtIdHelper().tube(id);
403  Amg::Vector2D locWire(0., lay->getRef() + (tube - 1) * 30.035);
404  if (fabs(lay->getRef()) > 10e6) {
405  double sign = (lay->getRef() > 0) ? 1. : -1.;
406  int dec = int(lay->getRef() / 1.e5);
407  double ref0 = dec / 1.e5;
408  double ref1 = lay->getRef() - dec * 1e5 - 0.5 * (sign + 1) * 1e5;
409  locWire[0] = ref0;
410  locWire[1] = ref1;
411  int tube = m_idHelperSvc->mdtIdHelper().tube(id);
412  int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(id);
413  if (tube > 6 && tubeMax - tube > 5) locWire[0] = 0.;
414  }
415  if (sqrt(locWire[0] * locWire[0] + locWire[1] * locWire[1]) > 2000.) {
416  ATH_MSG_WARNING(name() << " wire shift out bounds for MDT tube :" << m_idHelperSvc->mdtIdHelper().stationName(id) << ","
417  << m_idHelperSvc->mdtIdHelper().stationEta(id) << "," << m_idHelperSvc->mdtIdHelper().stationPhi(id)
418  << ": abandon projection");
419  return projPar;
420  }
421  // local position (tube)
422  // const Amg::Vector2D locPos = parm->localPosition();
423  // direction at the layer
424  Amg::Vector3D dir = parm->momentum().unit();
425  Amg::Vector3D locDir = (lay->surfaceRepresentation().transform().inverse()) * dir;
426  Amg::Vector3D normal = lay->surfaceRepresentation().normal();
427  Amg::Vector3D wireDir(1., 0., 0.);
428  const Trk::PlaneSurface* laySurf = dynamic_cast<const Trk::PlaneSurface*>(&(lay->surfaceRepresentation()));
429  if (!laySurf) return projPar;
430  //
431  double ND = dir.dot(normal);
432  double DL = locDir.dot(wireDir);
433  double A = sqrt(1. - DL * DL);
434  AmgMatrix(5, 5) mdtProj;
435  mdtProj.setIdentity();
436  //
437  double ori = (laySurf->transform().inverse() * parm->associatedSurface().transform()).rotation()(1, 1) > 0. ? -1. : 1.;
438  if (A > 10e-6) {
439  mdtProj(0, 1) = ND / A;
440  mdtProj(1, 0) = ori;
441  mdtProj(1, 1) = DL / A * sqrt(A * A - ND * ND) / A;
442  mdtProj(0, 0) = 0.;
443  } else {
444  mdtProj(0, 1) = 1.;
445  mdtProj(1, 0) = ori;
446  mdtProj(1, 1) = 0.;
447  mdtProj(0, 0) = 0.;
448  }
449  Amg::VectorX locPar = parm->parameters();
450  AmgMatrix(5, 5) mdtProjInv = mdtProj.inverse();
451  Amg::VectorX pPar = mdtProjInv * locPar;
452  pPar[0] += locWire[0];
453  pPar[1] += locWire[1];
454  ATH_MSG_DEBUG("back projected parameters(MDT->layer):" << pPar);
455 
456  std::optional<AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(mdtProjInv);
457 
458  ATH_MSG_DEBUG("back projected covariance(MDT->layer):" << (*projEM));
459  projPar = new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *laySurf, projEM);
460  // delete projEM;
461  }
462 
463  if (hitType == 2) {
464  // local position at detEl
465  // const Amg::Vector2D locPos = parm->localPosition();
466  const Trk::PlaneSurface* laySurf = dynamic_cast<const Trk::PlaneSurface*>(&(lay->surfaceRepresentation()));
467  if (!laySurf) return projPar;
468  //
469  Amg::VectorX locPar = parm->parameters();
470  AmgMatrix(5, 5)* pMx = nullptr;
471  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
472  pMx = m_rpcProjPhi.get();
473  else
474  pMx = m_rpcProjEta.get();
475 
476  double eta = 1.;
477  double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(id) && m_idHelperSvc->rpcIdHelper().doubletPhi(id) == 2) ? -1. : 1.;
478 
479  double ref = (lay->getRef() > 10000.) ? lay->getRef() - 20000. : lay->getRef();
480  double zswap = (lay->getRef() > 10000.) ? -1. : 1.;
481 
482  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
483  locPar[0] *= eta;
484  else
485  locPar[1] *= -eta;
486  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
487  locPar[1] *= zswap;
488  else
489  locPar[0] *= zswap;
490 
491  Amg::VectorX pPar = (*pMx) * locPar;
492  pPar[0] += sign * ref;
493 
494  //
495  ATH_MSG_DEBUG("back projected parameters(RPC->layer):" << m_idHelperSvc->rpcIdHelper().measuresPhi(id) << "," << pPar);
496 
497  std::optional<AmgMatrix(5, 5)> projEM = parm->covariance()->similarityT(*pMx);
498 
499  ATH_MSG_DEBUG("back projected covariance(RPC->layer):" << (*projEM));
500  projPar = new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *laySurf, projEM);
501  // delete projEM;
502 
503  if ((parm->position() - projPar->position()).mag() > 0.001) {
504  ATH_MSG_DEBUG("geometrical RPC projection (detElToLayer) for hit : "
505  << m_idHelperSvc->rpcIdHelper().measuresPhi(id) << "," << m_idHelperSvc->rpcIdHelper().stationName(id) << ","
506  << m_idHelperSvc->rpcIdHelper().stationEta(id) << "," << m_idHelperSvc->rpcIdHelper().stationPhi(id) << ","
507  << m_idHelperSvc->rpcIdHelper().doubletPhi(id) << "," << m_idHelperSvc->rpcIdHelper().doubletR(id) << ","
508  << m_idHelperSvc->rpcIdHelper().doubletZ(id));
509  Amg::Vector2D locPos;
510  const Amg::Vector3D& globPos = parm->position();
511  bool onSurface = laySurf->globalToLocal(globPos, globPos, locPos);
512  if (onSurface) {
513  pPar[0] = locPos[0];
514  pPar[1] = locPos[1];
515  delete projPar;
516  projPar = new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *laySurf, projEM);
517  // delete projEM;
518  } else {
519  delete projPar;
520  return nullptr;
521  }
522  }
523  }
524 
525  if (hitType == 3) {
526  // local position of detEl
527  // const Amg::Vector2D locPos = parm->localPosition();
528  const Trk::PlaneSurface* laySurf = dynamic_cast<const Trk::PlaneSurface*>(&(lay->surfaceRepresentation()));
529  if (!laySurf) return projPar;
530  // dealing with parallel displaced planes
531  double diff = m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55;
532  //
533  Amg::Vector3D layNormal = lay->surfaceRepresentation().normal();
534  double DN = parm->momentum().dot(layNormal);
535  double t = diff / DN;
536  // displacement of planes
537  const Amg::Vector2D csc_shift(0., lay->getRef());
538  // projection : take into account possible misalignment ;
539  AmgMatrix(5, 5)* pMx = nullptr;
540  if (m_idHelperSvc->cscIdHelper().measuresPhi(id))
541  pMx = m_tgcProjPhi.get();
542  else
543  pMx = m_tgcProjEta.get();
544  AmgMatrix(5, 5) pMxInv = pMx->inverse();
545  Amg::VectorX parProj = pMxInv * parm->parameters();
546  Amg::Vector3D corrLocPos = lay->surfaceRepresentation().center() - t * parm->momentum() + t * DN * layNormal;
547  Amg::Vector2D locCorrLay;
548  bool onSurface = lay->surfaceRepresentation().globalToLocal(corrLocPos, corrLocPos, locCorrLay);
549  if (onSurface && locCorrLay.size() > 0) {
550  parProj[0] += locCorrLay[Trk::locX] + csc_shift[Trk::locX];
551  parProj[1] += locCorrLay[Trk::locY] + csc_shift[Trk::locY];
552  ATH_MSG_DEBUG("back projected parameters(CSC->layer):" << m_idHelperSvc->cscIdHelper().measuresPhi(id) << "," << parProj);
553  }
554  std::optional<AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(pMxInv);
555 
556  ATH_MSG_DEBUG("back projected covariance(CSC->layer):" << (*projEM));
557  projPar = new Trk::AtaPlane(parProj[0], parProj[1], parProj[2], parProj[3], parProj[4], *laySurf, projEM);
558 
559  ATH_MSG_DEBUG("test CSC projection:detElToLayer:" << parm->position() << "," << projPar->position());
560  }
561 
562  if (hitType == 4) {
563  const Trk::PlaneSurface* laySurf = dynamic_cast<const Trk::PlaneSurface*>(&(lay->surfaceRepresentation()));
564  if (!laySurf) { return projPar; }
565 
566  AmgMatrix(5, 5)* pMx = nullptr;
567  if (m_idHelperSvc->tgcIdHelper().isStrip(id))
568  pMx = m_tgcProjPhi.get();
569  else
570  pMx = m_tgcProjEta.get();
571  AmgMatrix(5, 5) pMxInv = pMx->inverse();
572  Amg::VectorX locPar = pMxInv * parm->parameters();
573  ATH_MSG_DEBUG("back projected parameters(TGC->layer):" << m_idHelperSvc->tgcIdHelper().isStrip(id) << "," << locPar);
574 
575  std::optional<AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(pMxInv);
576 
577  ATH_MSG_DEBUG("back projected covariance(TGC->layer):" << (*projEM));
578  projPar = new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *laySurf, projEM);
579 
580  // verify
581  if (m_alignedMode && (parm->position() - projPar->position()).mag() > 0.001) {
582  ATH_MSG_DEBUG("geometrical TGC projection ( detEl2Layer ):"
583  << m_idHelperSvc->tgcIdHelper().stationName(id) << "," << m_idHelperSvc->tgcIdHelper().stationEta(id) << ","
584  << m_idHelperSvc->tgcIdHelper().stationPhi(id) << "," << m_idHelperSvc->tgcIdHelper().isStrip(id));
585  Amg::Vector2D locPos;
586  const Amg::Vector3D& globPos = parm->position();
587  bool onSurface = laySurf->globalToLocal(globPos, globPos, locPos);
588  if (onSurface) {
589  locPar[0] = locPos[0];
590  locPar[1] = locPos[1];
591  delete projPar;
592  projPar = nullptr;
593  projPar = new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *laySurf, projEM);
594  } else {
595  delete projPar;
596  return nullptr;
597  }
598  }
599  }
600  return projPar;
601 }
602 
604  const Trk::RIO_OnTrack* rio) const {
605  const MuonGM::MuonDetectorManager* MuonDetMgr = m_muonDetMgr;
606  if (!m_useDSManager) {
607  SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
608  MuonDetMgr = DetectorManagerHandle.cptr();
609  if (MuonDetMgr == nullptr) {
610  ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
611  // return StatusCode::FAILURE;
612  }
613  }
614  // Get the messaging service, print where you are
615  ATH_MSG_DEBUG("MuonTGMeasurementTool::measToLayer");
616  const Trk::RIO_OnTrack* projRIO = nullptr;
617 
618  // check input
619  if (!lay || !parm || !rio) return projRIO;
620 
621  // check compatibility of layer info and required id ? this was already done when associating !
622  Identifier id = rio->identify();
623 
624  ATH_MSG_DEBUG("MuonTGMeasurementTool::input ok");
625 
626  unsigned int hitType = 0;
627  if (m_idHelperSvc->isMdt(id)) hitType = 1;
628  if (m_idHelperSvc->isRpc(id)) hitType = 2;
629  if (m_idHelperSvc->isCsc(id)) hitType = 3;
630  if (m_idHelperSvc->isTgc(id)) hitType = 4;
631 
632  if (hitType == 1) {
633  // local position of the tube
634  int tube = m_idHelperSvc->mdtIdHelper().tube(id);
635  Amg::Vector2D locWire(0., lay->getRef() + (tube - 1) * 30.035);
636  if (fabs(lay->getRef()) > 10e6) {
637  double sign = (lay->getRef() > 0) ? 1. : -1.;
638  int dec = int(lay->getRef() / 1.e5);
639  double ref0 = dec / 1.e5;
640  double ref1 = lay->getRef() - dec * 1e5 - 0.5 * (sign + 1) * 1e5;
641  locWire[0] = ref0;
642  locWire[1] = ref1;
643  int tube = m_idHelperSvc->mdtIdHelper().tube(id);
644  int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(id);
645  if (tube > 6 && tubeMax - tube > 5) locWire[0] = 0.;
646  }
647  // direction at the layer
648  Amg::Vector3D dir = parm->momentum().unit();
649  Amg::Vector3D locDir = (lay->surfaceRepresentation().transform().inverse()) * dir;
650  Amg::Vector3D normal = lay->surfaceRepresentation().normal();
651  Amg::Vector3D wireDir(1., 0., 0.);
652  //
653  double ND = dir.dot(normal);
654  double DL = locDir.dot(wireDir);
655  double A = sqrt(1. - DL * DL);
656  double A_ND = A / ND;
657  //
658  double locLay = A_ND * rio->localParameters()[Trk::locR] + locWire[1];
659  // create (fake!) rio ( rio image on TG layer )
660  IdentifierHash idHash(0);
661  const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(id);
662  auto cov = Amg::MatrixX();
663  cov = A_ND * A_ND * rio->localCovariance();
665  const Muon::MdtPrepData* mdtPrd =
666  new Muon::MdtPrepData(id,
667  idHash,
668  Amg::Vector2D(locLay, 0.),
669  cov,
670  mdtROE,
671  0,
672  0,
673  status);
676  Muon::MuonDriftCircleErrorStrategy strat(stratbits);
677  const Muon::MdtDriftCircleOnTrack* mdtRio =
679  Amg::MatrixX(mdtPrd->localCovariance()), 0., Trk::DECIDED, 0.0, strat);
680  return mdtRio;
681  }
682 
683  else if (hitType == 2) {
684  //
685  double eta = (m_idHelperSvc->rpcIdHelper().stationEta(id) < 0) ? -1. : 1.;
686  double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(id) && m_idHelperSvc->rpcIdHelper().doubletPhi(id) == 2) ? -1. : 1.;
687 
688  double locPos = rio->localParameters()[Trk::locX];
689 
690  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id)) locPos *= eta;
691 
692  double ref = (lay->getRef() > 10000.) ? lay->getRef() - 20000. : lay->getRef();
693  double zswap = (lay->getRef() > 10000.) ? -1. : 1.;
694 
695  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
696  locPos += sign * ref;
697  else
698  locPos *= zswap;
699  //
700  const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id);
701  const IdentifierHash idHash(0);
702  std::vector<Identifier> rdoList;
703  rdoList.push_back(id);
704  const Muon::RpcPrepData* rpcPrd = new Muon::RpcPrepData(id, idHash, Amg::Vector2D(locPos, 0.), rdoList,
705  Amg::MatrixX(rio->localCovariance()), rpcROE, float(0.), 0, 0);
706  const Muon::RpcClusterOnTrack* rpcRio = nullptr;
707  if (m_idHelperSvc->rpcIdHelper().measuresPhi(id))
709  Amg::MatrixX(rpcPrd->localCovariance()), parm->localPosition()[Trk::locY]);
710  else
712  Amg::MatrixX(rpcPrd->localCovariance()), parm->localPosition()[Trk::locX]);
713  return rpcRio;
714  }
715 
716  else if (hitType == 3) {
717  // dealing with parallel displaced planes
718  double diff = m_idHelperSvc->cscIdHelper().measuresPhi(id) ? 1.55 : -1.55;
719  //
720  Amg::Vector3D layNormal = lay->surfaceRepresentation().normal();
721  double DN = parm->momentum().dot(layNormal);
722  double t = diff / DN;
723  // displacement of planes
724  const Amg::Vector2D csc_shift(0., lay->getRef());
725  Amg::Vector3D corrLocPos = lay->surfaceRepresentation().center() - t * parm->momentum() + t * DN * layNormal;
726  Amg::Vector2D locCorrLay;
727  bool onSurface = lay->surfaceRepresentation().globalToLocal(corrLocPos, corrLocPos, locCorrLay);
728  //
729  // if( !locCorrLay.size()==2) { ??
730  if (!onSurface) { return projRIO; }
731  double locPos;
732  if (m_idHelperSvc->cscIdHelper().measuresPhi(id)) {
733  locPos = rio->localParameters()[Trk::locX] + locCorrLay[Trk::locX] + csc_shift[Trk::locX];
734  } else {
735  locPos = rio->localParameters()[Trk::locX] + locCorrLay[Trk::locY] + csc_shift[Trk::locY];
736  }
737  //
738  const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id);
739  IdentifierHash idHash(0);
740  std::vector<Identifier> rdoList;
741  rdoList.push_back(id);
743  const Muon::CscPrepData* cscPrd =
744  new Muon::CscPrepData(id,
745  idHash,
746  Amg::Vector2D(locPos, 0.),
747  rdoList,
749  cscROE,
750  0,
751  0.,
752  status);
753  const Muon::CscClusterOnTrack* cscRio = nullptr;
754  if (m_idHelperSvc->cscIdHelper().measuresPhi(id))
756  Amg::MatrixX(cscPrd->localCovariance()), parm->localPosition()[Trk::locY], cscPrd->status());
757  else
759  Amg::MatrixX(cscPrd->localCovariance()), parm->localPosition()[Trk::locX], cscPrd->status());
760  return cscRio;
761  }
762 
763  else if (hitType == 4) {
764  //
765  double locPos = rio->localParameters()[Trk::locX];
766  //
767  const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id);
768  IdentifierHash idHash(0);
769  std::vector<Identifier> rdoList;
770  rdoList.push_back(id);
771  const Muon::TgcPrepData* tgcPrd =
772  new Muon::TgcPrepData(id,
773  idHash,
774  Amg::Vector2D(locPos, 0.),
775  rdoList,
777  tgcROE);
778  const Muon::TgcClusterOnTrack* tgcRio = nullptr;
779  if (m_idHelperSvc->tgcIdHelper().isStrip(id)) {
780  Amg::Vector2D loc(locPos, parm->localPosition()[Trk::locY]);
782  Amg::MatrixX(tgcPrd->localCovariance()), parm->localPosition()[Trk::locY]);
783  } else {
785  Amg::MatrixX(tgcPrd->localCovariance()), parm->localPosition()[Trk::locX]);
786  }
787  return tgcRio;
788  }
789 
790  ATH_MSG_DEBUG("unknown hit technology");
791  return projRIO;
792 }
793 
795  double& pitch) const {
796  const MuonGM::MuonDetectorManager* MuonDetMgr = m_muonDetMgr;
797  if (!m_useDSManager) {
798  SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
799  MuonDetMgr = DetectorManagerHandle.cptr();
800  if (MuonDetMgr == nullptr) { ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); }
801  }
802  // Get the messaging service, print where you are
803  ATH_MSG_DEBUG("MuonTGMeasurementTool::nearestDetEl");
804  Identifier nid(0);
805  // check input
806  if (!lay || !parm || !lay->layerType()) return nid;
807 
808  // check compatibility of layer info and required id ? this was already done when associating !
809  Identifier layId(lay->layerType());
810 
811  unsigned int hitType = 0;
812  if (m_idHelperSvc->isMdt(layId)) hitType = 1;
813  if (m_idHelperSvc->isRpc(layId)) hitType = 2;
814  if (m_idHelperSvc->isCsc(layId)) hitType = 3;
815  if (m_idHelperSvc->isTgc(layId)) hitType = 4;
816 
817  if (hitType == 0) {
818  ATH_MSG_DEBUG("unknown hit technology");
819  return nid;
820  }
821 
822  if (hitType == 1) {
823  const MuonGM::MdtReadoutElement* mdtROE = MuonDetMgr->getMdtReadoutElement(layId);
824  if (!mdtROE) return nid;
825  int tMax = mdtROE->getNtubesperlayer();
826  // local position at layer
827  Amg::Vector2D locLay;
828  const Amg::Vector3D& globPos = parm->position();
829  bool onSurface = lay->surfaceRepresentation().globalToLocal(globPos, globPos, locLay);
830  if (!onSurface || measPhi) { return nid; }
831  // nearest tube index
832  double refL = lay->getRef();
833  if (fabs(refL) > 10e6) {
834  double sign = (lay->getRef() > 0) ? 1. : -1.;
835  int dec = int(lay->getRef() / 1.e5);
836  refL = lay->getRef() - dec * 1e5 - 0.5 * (sign + 1) * 1e5;
837  }
838  double dloc = locLay[Trk::locY] - refL + 15.0175;
839  int itube = int(dloc / 30.035) + 1;
840  if (itube < 1 || itube > tMax || dloc < 0.) { return nid; }
841  // tube id
842  Identifier nearId = m_idHelperSvc->mdtIdHelper().channelID(
843  m_idHelperSvc->mdtIdHelper().stationName(layId), m_idHelperSvc->mdtIdHelper().stationEta(layId),
844  m_idHelperSvc->mdtIdHelper().stationPhi(layId), m_idHelperSvc->mdtIdHelper().multilayer(layId),
845  m_idHelperSvc->mdtIdHelper().tubeLayer(layId), itube);
846  // check if position within active volume
847  if (fabs(locLay[Trk::locX]) > 0.5 * mdtROE->getActiveTubeLength(m_idHelperSvc->mdtIdHelper().tubeLayer(layId), itube)) {
848  return nid;
849  }
850  //
851  if (m_idHelperSvc->mdtIdHelper().valid(nearId))
852  return nearId;
853  else
854  return nid;
855  }
856 
857  if (hitType == 2) {
858  // identify phi doublet first
859  Identifier phiId(0);
860  // both phi and eta needs to be within bounds !!!
861  int doubletPhi = 1;
862  bool foundDoubletPhi = false;
863  const MuonGM::RpcReadoutElement* rpcROE = nullptr;
864  while (!foundDoubletPhi && doubletPhi < 3) {
865  Identifier refPhi1 = m_idHelperSvc->rpcIdHelper().channelID(
866  m_idHelperSvc->rpcIdHelper().stationName(layId), m_idHelperSvc->rpcIdHelper().stationEta(layId),
867  m_idHelperSvc->rpcIdHelper().stationPhi(layId), m_idHelperSvc->rpcIdHelper().doubletR(layId),
868  m_idHelperSvc->rpcIdHelper().doubletZ(layId), doubletPhi, m_idHelperSvc->rpcIdHelper().gasGap(layId), 1, 1);
869  rpcROE = MuonDetMgr->getRpcReadoutElement(refPhi1);
870  if (!rpcROE) return nid;
871  if (!m_idHelperSvc->rpcIdHelper().valid(refPhi1)) return nid;
872  int nStripPhi = rpcROE->Nstrips(1);
873 
874  Identifier refPhiN = m_idHelperSvc->rpcIdHelper().channelID(
875  m_idHelperSvc->rpcIdHelper().stationName(layId), m_idHelperSvc->rpcIdHelper().stationEta(layId),
876  m_idHelperSvc->rpcIdHelper().stationPhi(layId), m_idHelperSvc->rpcIdHelper().doubletR(layId),
877  m_idHelperSvc->rpcIdHelper().doubletZ(layId), doubletPhi, m_idHelperSvc->rpcIdHelper().gasGap(layId), 1, nStripPhi);
878  //
880  const Amg::Vector3D globPos1 = rpcROE->stripPos(refPhi1);
881  bool onSurface1 = rpcROE->surface(refPhi1).globalToLocal(globPos1, globPos1, loc1);
882  Amg::Vector2D locN;
883  const Amg::Vector3D globPosN = rpcROE->stripPos(refPhiN);
884  bool onSurfaceN = rpcROE->surface(refPhiN).globalToLocal(globPosN, globPosN, locN);
885  Amg::Vector2D loc;
886  const Amg::Vector3D& glob = parm->position();
887  bool onSurface = rpcROE->surface(refPhiN).globalToLocal(glob, glob, loc);
888 
889  int strip = 0;
890  if (onSurface1 && onSurfaceN && onSurface) {
891  pitch = (locN[Trk::locX] - loc1[Trk::locX]) / fmax(1, nStripPhi - 1);
892  double dstrip = (loc[Trk::locX] - loc1[Trk::locX]) / pitch + 0.5;
893  strip = dstrip >= 0. ? int(dstrip) + 1 : 0;
894 
895  if (strip > 0 && strip <= nStripPhi) {
896  // correct doublet
897  phiId = m_idHelperSvc->rpcIdHelper().channelID(
898  m_idHelperSvc->rpcIdHelper().stationName(layId), m_idHelperSvc->rpcIdHelper().stationEta(layId),
899  m_idHelperSvc->rpcIdHelper().stationPhi(layId), m_idHelperSvc->rpcIdHelper().doubletR(layId),
900  m_idHelperSvc->rpcIdHelper().doubletZ(layId), doubletPhi, m_idHelperSvc->rpcIdHelper().gasGap(layId), 1, strip);
901  foundDoubletPhi = true;
902 
903  } else {
904  doubletPhi += 1;
905  }
906  } else
907  doubletPhi += 1;
908  }
909  // no valid phi strip - skip search
910  if (!foundDoubletPhi) return nid;
911 
912  // eta strip
913  Identifier etaId(0);
914  int doubletZ = 1;
915  while (doubletZ < 4) {
916  Identifier refEta1 = m_idHelperSvc->rpcIdHelper().channelID(
917  m_idHelperSvc->rpcIdHelper().stationName(layId), m_idHelperSvc->rpcIdHelper().stationEta(layId),
918  m_idHelperSvc->rpcIdHelper().stationPhi(layId), m_idHelperSvc->rpcIdHelper().doubletR(layId), doubletZ, doubletPhi,
919  m_idHelperSvc->rpcIdHelper().gasGap(layId), 0, 1);
920  rpcROE = MuonDetMgr->getRpcReadoutElement(refEta1);
921  if (!rpcROE) return nid;
922  if (!m_idHelperSvc->rpcIdHelper().valid(refEta1)) return nid;
923  int nStrips = rpcROE->Nstrips(0);
924 
925  Identifier refEtaN = m_idHelperSvc->rpcIdHelper().channelID(
926  m_idHelperSvc->rpcIdHelper().stationName(layId), m_idHelperSvc->rpcIdHelper().stationEta(layId),
927  m_idHelperSvc->rpcIdHelper().stationPhi(layId), m_idHelperSvc->rpcIdHelper().doubletR(layId), doubletZ, doubletPhi,
928  m_idHelperSvc->rpcIdHelper().gasGap(layId), 0, nStrips);
929  //
930 
932  const Amg::Vector3D globPos1 = rpcROE->stripPos(refEta1);
933  bool onSurface1 = rpcROE->surface(refEta1).globalToLocal(globPos1, globPos1, loc1);
934  Amg::Vector2D locN;
935  const Amg::Vector3D globPosN = rpcROE->stripPos(refEtaN);
936  bool onSurfaceN = rpcROE->surface(refEtaN).globalToLocal(globPosN, globPosN, locN);
937  Amg::Vector2D loc;
938  const Amg::Vector3D& glob = parm->position();
939  bool onSurface = rpcROE->surface(refEtaN).globalToLocal(glob, glob, loc);
940 
941  int strip = 0;
942  if (onSurface && onSurface1 && onSurfaceN) {
943  pitch = (locN[Trk::locX] - loc1[Trk::locX]) / fmax(1, nStrips - 1);
944  // strip = int( (refPar->localPosition()[Trk::locX]-loc1[Trk::locX])/pitch+0.5 )+1;
945  double dstrip = (loc[Trk::locX] - loc1[Trk::locX]) / pitch + 0.5;
946  strip = dstrip >= 0. ? int(dstrip) + 1 : 0;
947 
948  if (strip > 0 && strip <= nStrips) {
949  etaId = m_idHelperSvc->rpcIdHelper().channelID(
950  m_idHelperSvc->rpcIdHelper().stationName(layId), m_idHelperSvc->rpcIdHelper().stationEta(layId),
951  m_idHelperSvc->rpcIdHelper().stationPhi(layId), m_idHelperSvc->rpcIdHelper().doubletR(layId), doubletZ, doubletPhi,
952  m_idHelperSvc->rpcIdHelper().gasGap(layId), 0, strip);
953  if (measPhi)
954  return phiId;
955  else
956  return etaId;
957  }
958  }
959  doubletZ += 1;
960  }
961 
962  return nid;
963  }
964 
965  if (hitType == 3) {
966  // ref id
967  Identifier refId = m_idHelperSvc->cscIdHelper().channelID(
968  m_idHelperSvc->cscIdHelper().stationName(layId), m_idHelperSvc->cscIdHelper().stationEta(layId),
969  m_idHelperSvc->cscIdHelper().stationPhi(layId), m_idHelperSvc->cscIdHelper().chamberLayer(layId),
970  m_idHelperSvc->cscIdHelper().wireLayer(layId), measPhi, 1);
971  if (!m_idHelperSvc->cscIdHelper().valid(refId)) return nid;
972  // residual in ref frame
973  const Trk::TrackParameters* refPar = layerToDetEl(lay, parm, refId);
974  if (!refPar) return nid;
975  //
976  const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(refId);
977  if (!cscROE) {
978  delete refPar;
979  return nid;
980  }
981  pitch = cscROE->StripPitch(measPhi);
982  int nStrips = m_idHelperSvc->cscIdHelper().stripMax(refId);
983  if (nStrips < 1) {
984  delete refPar;
985  return nid;
986  }
987 
988  Identifier refIdN = m_idHelperSvc->cscIdHelper().channelID(
989  m_idHelperSvc->cscIdHelper().stationName(refId), m_idHelperSvc->cscIdHelper().stationEta(refId),
990  m_idHelperSvc->cscIdHelper().stationPhi(refId), m_idHelperSvc->cscIdHelper().chamberLayer(refId),
991  m_idHelperSvc->cscIdHelper().wireLayer(refId), measPhi, nStrips);
992  //
993  Amg::Vector3D loc1 = cscROE->surface(refId).transform().inverse() * cscROE->stripPos(refId);
994  Amg::Vector3D locN = cscROE->surface(refIdN).transform().inverse() * cscROE->stripPos(refIdN);
995  int strip = 0;
996 
997  pitch = (locN[0] - loc1[0]) / fmax(1, nStrips - 1);
998  strip = int((refPar->localPosition()[Trk::locX] - loc1[0]) / pitch + 0.5) + 1;
999 
1000  delete refPar;
1001  refPar = nullptr;
1002  if (strip > 0 && strip <= nStrips) {
1003  // strip id
1004  Identifier nearId = m_idHelperSvc->cscIdHelper().channelID(
1005  m_idHelperSvc->cscIdHelper().stationName(layId), m_idHelperSvc->cscIdHelper().stationEta(layId),
1006  m_idHelperSvc->cscIdHelper().stationPhi(layId), m_idHelperSvc->cscIdHelper().chamberLayer(layId),
1007  m_idHelperSvc->cscIdHelper().wireLayer(layId), measPhi, strip);
1008  if (fabs(residual(parm, nearId)) > 0.5 * pitch)
1009  ATH_MSG_DEBUG("nearest CSC channel residual too large: " << residual(parm, nearId));
1010  return nearId;
1011  }
1012  }
1013 
1014  if (hitType == 4) { // ref id
1015  if (measPhi && m_idHelperSvc->tgcIdHelper().gasGap(layId) == 2 && m_idHelperSvc->tgcIdHelper().gasGapMax(layId) == 3)
1016  return nid; // no phi strips here
1017  // ref id
1018  Identifier refId = layId;
1019  if (measPhi)
1020  refId = m_idHelperSvc->tgcIdHelper().channelID(
1021  m_idHelperSvc->tgcIdHelper().stationName(layId), m_idHelperSvc->tgcIdHelper().stationEta(layId),
1022  m_idHelperSvc->tgcIdHelper().stationPhi(layId), m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi, 1);
1023  if (!m_idHelperSvc->tgcIdHelper().valid(refId)) return nid;
1024  // residual in ref frame
1025  const Trk::TrackParameters* refPar = layerToDetEl(lay, parm, refId);
1026  if (!refPar) return nid;
1027  //
1028  const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(layId);
1029  if (!tgcROE) {
1030  delete refPar;
1031  return nid;
1032  }
1033  int nStrips = m_idHelperSvc->tgcIdHelper().channelMax(refId);
1034 
1035  if (nStrips < 1) {
1036  delete refPar;
1037  return nid;
1038  }
1039 
1040  Identifier refIdN = m_idHelperSvc->tgcIdHelper().channelID(
1041  m_idHelperSvc->tgcIdHelper().stationName(layId), m_idHelperSvc->tgcIdHelper().stationEta(layId),
1042  m_idHelperSvc->tgcIdHelper().stationPhi(layId), m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi, nStrips);
1043  //
1045  const Amg::Vector3D glob1 = tgcROE->channelPos(refId);
1046  bool onSurface1 = tgcROE->surface(refId).globalToLocal(glob1, glob1, loc1);
1047  Amg::Vector2D locN;
1048  const Amg::Vector3D globN = tgcROE->channelPos(refIdN);
1049  bool onSurfaceN = tgcROE->surface(refIdN).globalToLocal(globN, globN, locN);
1050 
1051  int strip = 0;
1052  if (onSurface1 && onSurfaceN) {
1053  pitch = (locN[Trk::locX] - loc1[Trk::locX]) / fmax(1, nStrips - 1);
1054  strip = int((refPar->localPosition()[Trk::locX] - loc1[Trk::locX]) / pitch + 0.5) + 1;
1055  } else {
1056  ATH_MSG_DEBUG("local position of boundary elements not retrieved, return 0 ");
1057  delete refPar;
1058  return nid;
1059  }
1060 
1061  if (strip > 0 && strip <= nStrips) {
1062  // check second coordinate for active volume
1063  if (!measPhi && fabs(refPar->localPosition()[Trk::locY]) >
1064  tgcROE->gangCentralWidth(m_idHelperSvc->tgcIdHelper().gasGap(layId), strip)) {
1065  delete refPar;
1066  return nid;
1067  }
1068  Identifier nearId = m_idHelperSvc->tgcIdHelper().channelID(
1069  m_idHelperSvc->tgcIdHelper().stationName(layId), m_idHelperSvc->tgcIdHelper().stationEta(layId),
1070  m_idHelperSvc->tgcIdHelper().stationPhi(layId), m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi, strip);
1071  Amg::Vector3D stripposition = tgcROE->surface(nearId).transform().inverse() * tgcROE->channelPos(nearId);
1072  Amg::Vector3D localhit = tgcROE->surface(nearId).transform().inverse() * parm->position();
1073 
1074  int plane = m_idHelperSvc->tgcIdHelper().gasGap(nearId);
1075  if (m_idHelperSvc->tgcIdHelper().isStrip(nearId))
1076  pitch = tgcROE->stripPitch(plane, m_idHelperSvc->tgcIdHelper().channel(nearId), localhit[1]);
1077  int last = 0;
1078  while (fabs(stripposition[0] - localhit[0]) > 0.5 * pitch) {
1079  if (stripposition[0] < localhit[0]) {
1080  if (last != -1) {
1081  strip += 1;
1082  last = 1;
1083  } else
1084  break;
1085  } else {
1086  if (last != 1) {
1087  strip -= 1;
1088  last = -1;
1089  } else
1090  break;
1091  }
1092  if (strip < 1 || strip > nStrips) break;
1093  nearId = m_idHelperSvc->tgcIdHelper().channelID(
1094  m_idHelperSvc->tgcIdHelper().stationName(layId), m_idHelperSvc->tgcIdHelper().stationEta(layId),
1095  m_idHelperSvc->tgcIdHelper().stationPhi(layId), m_idHelperSvc->tgcIdHelper().gasGap(layId), measPhi, strip);
1096  stripposition = tgcROE->surface(nearId).transform().inverse() * tgcROE->channelPos(nearId);
1097  localhit = tgcROE->surface(nearId).transform().inverse() * parm->position();
1098  if (m_idHelperSvc->tgcIdHelper().isStrip(nearId))
1099  pitch = tgcROE->stripPitch(plane, m_idHelperSvc->tgcIdHelper().channel(nearId), localhit[1]);
1100  }
1101  delete refPar;
1102  if (strip < 1 || strip > nStrips) return nid;
1103  if (m_idHelperSvc->tgcIdHelper().valid(nearId))
1104  return nearId;
1105  else
1106  return nid;
1107  }
1108  delete refPar;
1109  }
1110  return nid;
1111 }
1112 
1114  // Get the messaging service, print where you are
1115  ATH_MSG_DEBUG("MuonTGMeasurementTool::associatedLayer");
1116  const Trk::Layer* lay = nullptr;
1117  // check input
1118  if (!id.get_identifier32().get_compact()) return lay;
1119 
1120  // rely on having misalignment uncertainty covered by span safety marge ( don't loose station from static volume
1121  // when misaligned
1122  const Trk::TrackingVolume* staticVol = getGeometry()->lowestStaticTrackingVolume(gp);
1123  const Trk::DetachedTrackingVolume* station = nullptr;
1124  if (staticVol && !staticVol->confinedDetachedVolumes().empty()) {
1126  for (const auto *i : detTV) {
1127  if (i->layerRepresentation() && i->layerRepresentation()->layerType() > 0) {
1128  Identifier stId(i->layerRepresentation()->layerType());
1129  if (m_idHelperSvc->mdtIdHelper().stationName(stId) == m_idHelperSvc->mdtIdHelper().stationName(id) &&
1130  m_idHelperSvc->mdtIdHelper().stationEta(stId) == m_idHelperSvc->mdtIdHelper().stationEta(id) &&
1131  m_idHelperSvc->mdtIdHelper().stationPhi(stId) == m_idHelperSvc->mdtIdHelper().stationPhi(id)) {
1132  station = i;
1133  break;
1134  }
1135  }
1136  }
1137  }
1138 
1139  if (station) lay = associatedLayer(id, station->trackingVolume());
1140 
1141  return lay;
1142 }
1143 
1145  const Trk::Layer* lay = nullptr;
1146  // check input
1147  if (!vol) return lay;
1148 
1149  if (vol->confinedVolumes()) {
1152  while (!lay && iter != subVols.end()) {
1153  lay = associatedLayer(id, *iter);
1154  if (lay) break;
1155  ++iter;
1156  }
1157  if (lay) return lay;
1158  }
1159 
1160  if (vol->confinedLayers()) {
1163  while (!lay && iter != ordLay.end()) {
1164  lay = match(id, *iter);
1165  if (lay) break;
1166  ++iter;
1167  }
1168  if (lay) return lay;
1169  }
1170 
1171  if (!vol->confinedArbitraryLayers().empty()) {
1173  Trk::ArraySpan<const Trk::Layer* const>::iterator iter = unOrdLay.begin();
1174  while (!lay && iter != unOrdLay.end()) {
1175  lay = match(id, *iter);
1176  if (lay) break;
1177  ++iter;
1178  }
1179  if (lay) return lay;
1180  }
1181 
1182  return lay;
1183 }
1184 
1186  const Trk::Layer* mLay = nullptr;
1187  if (!id.get_identifier32().get_compact() || !lay || !lay->layerType()) return mLay;
1188 
1189  Identifier layId(lay->layerType());
1190 
1191  if (m_idHelperSvc->isMdt(id) && m_idHelperSvc->isMdt(layId)) {
1192  if (m_idHelperSvc->mdtIdHelper().multilayer(layId) == m_idHelperSvc->mdtIdHelper().multilayer(id) &&
1193  m_idHelperSvc->mdtIdHelper().tubeLayer(layId) == m_idHelperSvc->mdtIdHelper().tubeLayer(id))
1194  return lay;
1195  }
1196 
1197  if (m_idHelperSvc->isRpc(id) && m_idHelperSvc->isRpc(layId)) {
1198  if (m_idHelperSvc->rpcIdHelper().doubletR(layId) == m_idHelperSvc->rpcIdHelper().doubletR(id) &&
1199  m_idHelperSvc->rpcIdHelper().doubletZ(layId) == m_idHelperSvc->rpcIdHelper().doubletZ(id) &&
1200  m_idHelperSvc->rpcIdHelper().gasGap(layId) == m_idHelperSvc->rpcIdHelper().gasGap(id))
1201  return lay;
1202  }
1203 
1204  if (m_idHelperSvc->isTgc(id) && m_idHelperSvc->isTgc(layId)) {
1205  if (m_idHelperSvc->tgcIdHelper().gasGap(layId) == m_idHelperSvc->tgcIdHelper().gasGap(id)) return lay;
1206  }
1207 
1208  if (m_idHelperSvc->isCsc(id) && m_idHelperSvc->isCsc(layId)) {
1209  if (m_idHelperSvc->cscIdHelper().chamberLayer(layId) == m_idHelperSvc->cscIdHelper().chamberLayer(id) &&
1210  m_idHelperSvc->cscIdHelper().wireLayer(layId) == m_idHelperSvc->cscIdHelper().wireLayer(id))
1211  return lay;
1212  }
1213 
1214  return mLay;
1215 }
1216 
1218  double res = 10000.;
1219  if (!layPar || !rio) return res;
1220 
1221  Amg::Vector3D gp = layPar->position();
1222  const Trk::Layer* layer = associatedLayer(rio->identify(), gp);
1223  if (!layer) return res;
1224 
1225  return residual(layer, layPar, rio);
1226 }
1227 
1229  double res = 10000.;
1230  if (!layPar || !id.get_identifier32().get_compact()) return res;
1231 
1232  Amg::Vector3D gp = layPar->position();
1233  const Trk::Layer* layer = associatedLayer(id, gp);
1234  if (!layer) return res;
1235 
1236  return residual(layer, layPar, id);
1237 }
1238 
1240  const Trk::RIO_OnTrack* rio) const {
1241  double res = 10000.;
1242  if (!layer || !layPar || !rio) return res;
1243 
1244  const Trk::TrackParameters* detElPar = layerToDetEl(layer, layPar, rio->identify());
1245  if (!detElPar) return res;
1246  if (m_idHelperSvc->isMdt(rio->identify())) {
1247  res = fabs(detElPar->localPosition()[Trk::locR] - rio->localParameters()[Trk::locR]);
1248  } else {
1249  res = fabs(detElPar->localPosition()[Trk::locX] - rio->localParameters()[Trk::locX]);
1250  }
1251  delete detElPar;
1252  return res;
1253 }
1254 
1256  const MuonGM::MuonDetectorManager* MuonDetMgr = m_muonDetMgr;
1257  if (!m_useDSManager) {
1258  SG::ReadCondHandle<MuonGM::MuonDetectorManager> DetectorManagerHandle{m_DetectorManagerKey};
1259  MuonDetMgr = DetectorManagerHandle.cptr();
1260  if (MuonDetMgr == nullptr) {
1261  ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object");
1262  // return StatusCode::FAILURE;
1263  }
1264  }
1265 
1266  double res = 10000.;
1267  if (!layer || !layPar || !id.get_identifier32().get_compact()) return res;
1268 
1269  const Trk::TrackParameters* detElPar = layerToDetEl(layer, layPar, id);
1270  if (!detElPar) return res;
1271  if (m_idHelperSvc->isMdt(id)) {
1272  res = detElPar->localPosition()[Trk::locR];
1273  } else if (m_idHelperSvc->isRpc(id)) {
1274  const MuonGM::RpcReadoutElement* rpcROE = MuonDetMgr->getRpcReadoutElement(id);
1275  if (rpcROE)
1276  res = detElPar->localPosition()[Trk::locX] -
1277  (detElPar->associatedSurface().transform().inverse() * (rpcROE->stripPos(id)))[Trk::locX];
1278  } else if (m_idHelperSvc->isCsc(id)) {
1279  const MuonGM::CscReadoutElement* cscROE = MuonDetMgr->getCscReadoutElement(id);
1280  if (cscROE)
1281  res = detElPar->localPosition()[Trk::locX] - (detElPar->associatedSurface().transform().inverse() * (cscROE->stripPos(id)))[0];
1282  } else if (m_idHelperSvc->isTgc(id)) {
1283  if (m_idHelperSvc->tgcIdHelper().isStrip(id) && m_idHelperSvc->tgcIdHelper().gasGap(id) == 2 &&
1284  m_idHelperSvc->tgcIdHelper().gasGapMax(id) == 3) {
1285  delete detElPar;
1286  return res; // no phi strips here
1287  }
1288  const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id);
1289  if (tgcROE) {
1290  Amg::Vector2D locPos;
1291  const Amg::Vector3D globPos = tgcROE->channelPos(id);
1292  bool onSurface = detElPar->associatedSurface().globalToLocal(globPos, globPos, locPos);
1293  if (onSurface) res = detElPar->localPosition()[Trk::locX] - locPos[Trk::locX];
1294  }
1295  }
1296  delete detElPar;
1297  return res;
1298 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
MuonGM::MuonDetectorManager::getRpcReadoutElement
const RpcReadoutElement * getRpcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:168
Trk::LocalParameters
Definition: LocalParameters.h:98
Trk::PlaneSurface::globalToLocal
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const override final
Specified for PlaneSurface: GlobalToLocal method without dynamic memory allocation - boolean checks i...
Definition: PlaneSurface.cxx:213
Muon::MuonDriftCircleErrorStrategy
Definition: MuonDriftCircleErrorStrategy.h:15
MdtReadoutElement.h
MuonDriftCircleErrorStrategy.h
Amg::VectorX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Definition: EventPrimitives.h:32
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition: EventPrimitives.h:29
Muon::MuonTGMeasurementTool::initialize
virtual StatusCode initialize() override
Definition: MuonTGMeasurementTool.cxx:40
TrackParameters.h
MeasurementBase.h
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::locX
@ locX
Definition: ParamDefs.h:43
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:44
DistanceSolution.h
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
ClusterSeg::residual
@ residual
Definition: ClusterNtuple.h:20
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
Trk::ParametersBase::position
const Amg::Vector3D & position() const
Access method for the position.
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::DetachedTrackingVolume::trackingVolume
const TrackingVolume * trackingVolume() const
returns the TrackingVolume
Definition: DetachedTrackingVolume.h:125
Trk::ParametersBase::associatedSurface
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
RpcDigitContainer.h
Trk::Layer::getRef
double getRef() const
get the reference measure
Trk::PrepRawData::localCovariance
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
Muon::MuonTGMeasurementTool::measToLayer
const Trk::RIO_OnTrack * measToLayer(const Trk::Layer *, const Trk::TrackParameters *, const Trk::RIO_OnTrack *) const override
Definition: MuonTGMeasurementTool.cxx:603
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
Muon::TgcClusterOnTrack
Class to represent calibrated clusters formed from TGC strips.
Definition: TgcClusterOnTrack.h:46
Muon::MdtDriftCircleStatus
MdtDriftCircleStatus
Enum to represent the 'status' of Mdt measurements e.g.
Definition: MdtDriftCircleStatus.h:25
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
Trk::TrackingVolume::confinedDetachedVolumes
ArraySpan< DetachedTrackingVolume const *const > confinedDetachedVolumes() const
Return detached subVolumes - not the ownership.
MuonGM::RpcReadoutElement
An RpcReadoutElement corresponds to a single RPC module; therefore typicaly a barrel muon station con...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/RpcReadoutElement.h:54
Layer.h
FitQualityOnSurface.h
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
Muon::RpcClusterOnTrack
Class to represent calibrated clusters formed from RPC strips.
Definition: RpcClusterOnTrack.h:35
MdtPrepData.h
Trk::locR
@ locR
Definition: ParamDefs.h:50
MuonGM::CscReadoutElement
Definition: CscReadoutElement.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
MuonPrepDataContainer.h
MdtDriftCircleOnTrack.h
Trk::Surface::center
const Amg::Vector3D & center() const
Returns the center position of the Surface.
ParamDefs.h
Muon::MuonTGMeasurementTool::detElToLayer
const Trk::TrackParameters * detElToLayer(const Trk::Layer *, const Trk::TrackParameters *, Identifier) const override
Definition: MuonTGMeasurementTool.cxx:366
TgcPrepData.h
MuonGM::MuonClusterReadoutElement::surface
virtual const Trk::PlaneSurface & surface() const override
access to chamber surface (phi orientation), uses the first gas gap
Definition: MuonClusterReadoutElement.h:123
Muon::MdtStatusDriftTime
@ MdtStatusDriftTime
The tube produced a vaild measurement.
Definition: MdtDriftCircleStatus.h:34
AmgMatrix
#define AmgMatrix(rows, cols)
Definition: EventPrimitives.h:51
Trk::Layer::layerType
int layerType() const
get the Layer coding
Trk::DefinedParameter
std::pair< double, ParamDefs > DefinedParameter
Definition: DefinedParameter.h:27
MuonGM::TgcReadoutElement::channelPos
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
Trk::TrackingVolume::confinedLayers
const LayerArray * confinedLayers() const
Return the subLayer array.
MuonGM::MuonDetectorManager::getTgcReadoutElement
const TgcReadoutElement * getTgcReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:247
TgcClusterOnTrack.h
tubeMax
double tubeMax
Definition: MDT_ResponseTest.cxx:31
RpcClusterOnTrack.h
Muon::MuonTGMeasurementTool::match
const Trk::Layer * match(Identifier id, const Trk::Layer *lay) const override
Definition: MuonTGMeasurementTool.cxx:1185
Muon::MuonTGMeasurementTool::associatedLayer
const Trk::Layer * associatedLayer(Identifier id, Amg::Vector3D &gp) const override
Definition: MuonTGMeasurementTool.cxx:1113
Muon::MuonDriftCircleErrorStrategyInput
std::bitset< 23 > MuonDriftCircleErrorStrategyInput
Definition: MuonDriftCircleErrorStrategy.h:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Trk::Layer::surfaceRepresentation
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
MuonGM::MuonDetectorManager::getMdtReadoutElement
const MdtReadoutElement * getMdtReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:204
CscPrepData.h
MuonGM::MdtReadoutElement
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MdtReadoutElement.h:50
lumiFormat.i
int i
Definition: lumiFormat.py:92
Muon::RpcPrepData
Class to represent RPC measurements.
Definition: RpcPrepData.h:35
Trk::ArraySpan
std::span< T > ArraySpan
Definition: DetachedTrackingVolume.h:34
MuonGM::MuonDetectorManager::getCscReadoutElement
const CscReadoutElement * getCscReadoutElement(const Identifier &id) const
access via extended identifier (requires unpacking)
Definition: MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx:225
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Muon::CscPrepData
Class representing clusters from the CSC.
Definition: CscPrepData.h:39
Trk::TrackingVolume::confinedArbitraryLayers
ArraySpan< Layer const *const > confinedArbitraryLayers() const
Return the confined subLayer array.
Trk::theta
@ theta
Definition: ParamDefs.h:72
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
xAOD::rotation
rotation
Definition: TrackSurface_v1.cxx:15
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Muon::CscStatusSimple
@ CscStatusSimple
Cluster with non-precision fit.
Definition: CscClusterStatus.h:29
MuonGM::MdtReadoutElement::getActiveTubeLength
double getActiveTubeLength(const int tubeLayer, const int tube) const
Muon::CscPrepData::status
CscClusterStatus status() const
Returns the Csc status (position measurement) flag.
Definition: CscPrepData.h:163
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
CscClusterOnTrack.h
Muon::MuonTGMeasurementTool::residual
double residual(const Trk::Layer *, const Trk::TrackParameters *, const Trk::RIO_OnTrack *) const override
Definition: MuonTGMeasurementTool.cxx:1239
Muon::MuonDriftCircleErrorStrategy::UnknownStrategy
@ UnknownStrategy
Definition: MuonDriftCircleErrorStrategy.h:17
CscReadoutElement.h
MuonGM::CscReadoutElement::StripPitch
double StripPitch(int chlayer, int measphi) const
Definition: CscReadoutElement.cxx:265
MuonGM::TgcReadoutElement
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Definition: MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/TgcReadoutElement.h:42
test_pyathena.parent
parent
Definition: test_pyathena.py:15
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:127
MuonTGMeasurementTool.h
Trk::Surface::normal
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::ParametersBase
Definition: ParametersBase.h:55
Muon::MuonTGMeasurementTool::nearestDetEl
const Identifier nearestDetEl(const Trk::Layer *, const Trk::TrackParameters *, bool measPhi, double &pitch) const override
Definition: MuonTGMeasurementTool.cxx:794
MuonGM::TgcReadoutElement::gangCentralWidth
double gangCentralWidth(int gasGap, int gang) const
Returns the length of the central wire in the gang.
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:92
Muon::MuonTGMeasurementTool::MuonTGMeasurementTool
MuonTGMeasurementTool(const std::string &type, const std::string &name, const IInterface *)
Constructor with AlgTool parameters.
Definition: MuonTGMeasurementTool.cxx:34
ParticleHypothesis.h
Trk::MeasurementBase::localCovariance
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Definition: MeasurementBase.h:138
beamspotman.dir
string dir
Definition: beamspotman.py:623
Trk::DECIDED
@ DECIDED
sign of drift radius has been determined
Definition: DriftCircleStatus.h:18
MuonGM::nStrips
int nStrips(const MuonGM::TgcReadoutElement &readoutEle, int layer)
Definition: MuonDetDescr/MuonGeoModelTest/src/GeoModelTgcTest.cxx:46
Trk::ParametersCommon::localPosition
Amg::Vector2D localPosition() const
Access method for the local coordinates, local parameter definitions differ for each surface type.
TrackRecord.h
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
RIO_OnTrack.h
MuonGM::RpcReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
Definition: MuonDetDescr/MuonReadoutGeometry/src/RpcReadoutElement.cxx:177
Trk::BinnedArray::arrayObjects
virtual BinnedArraySpan< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
Muon::MdtDriftCircleOnTrack
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
Definition: MdtDriftCircleOnTrack.h:37
Muon::MdtPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtPrepData.h:37
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonDetectorManager.h
python.copyTCTOutput.locDir
locDir
Definition: copyTCTOutput.py:113
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
MuonGM::TgcReadoutElement::stripPitch
double stripPitch(int gasGap, int strip) const
Returns the pitch of the given strip in gasGap i.
Definition: MuonDetDescr/MuonReadoutGeometry/src/TgcReadoutElement.cxx:176
Trk::AtaPlane
ParametersT< 5, Charged, PlaneSurface > AtaPlane
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:30
Trk::ParametersBase::momentum
const Amg::Vector3D & momentum() const
Access method for the momentum.
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
Muon::CscClusterOnTrack
Class to represent the calibrated clusters created from CSC strips.
Definition: CscClusterOnTrack.h:47
Trk::Surface::globalToLocal
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
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
ref
const boost::regex ref(r_ef)
Trk::PlaneSurface
Definition: PlaneSurface.h:64
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Trk::TrackingVolume::confinedVolumes
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
Trk::qOverP
@ qOverP
perigee
Definition: ParamDefs.h:73
Muon::TgcPrepData
Class to represent TGC measurements.
Definition: TgcPrepData.h:32
MuonGM::MdtReadoutElement::surface
virtual const Trk::Surface & surface() const override final
Return surface associated with this detector element.
Definition: MuonDetDescr/MuonReadoutGeometry/src/MdtReadoutElement.cxx:875
Trk::RIO_OnTrack::identify
virtual Identifier identify() const final
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:155
MuonGM::RpcReadoutElement::Nstrips
int Nstrips(bool measphi) const
returns the number of strips for the phi or eta plane
createCablingJSON.doubletPhi
int doubletPhi
Definition: createCablingJSON.py:11
TgcReadoutElement.h
Trk::phi
@ phi
Definition: ParamDefs.h:81
merge.status
status
Definition: merge.py:17
MuonGM::CscReadoutElement::stripPos
Amg::Vector3D stripPos(const Identifier &id) const
takes into account internal alignment parameters, hence gives accurate answer
Definition: CscReadoutElement.cxx:227
Muon::CscClusterStatus
CscClusterStatus
Enum to represent the cluster status - see the specific enum values for more details.
Definition: CscClusterStatus.h:23
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MuonTGMeasurementTool::layerToDetEl
const Trk::TrackParameters * layerToDetEl(const Trk::Layer *, const Trk::TrackParameters *, Identifier) const override
Definition: MuonTGMeasurementTool.cxx:74
RpcPrepData.h
IdentifierHash
Definition: IdentifierHash.h:38
MuonGM::MdtReadoutElement::getNtubesperlayer
int getNtubesperlayer() const
Returns the number of tubes in each tube layer.
Trk::DetachedTrackingVolume
Definition: DetachedTrackingVolume.h:46
Trk::loc1
@ loc1
Definition: ParamDefs.h:40
Trk::TrackingVolume
Definition: TrackingVolume.h:121
Trk::Surface::transform
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
Trk::BinnedArraySpan
std::span< T > BinnedArraySpan
Definition: BinnedArray.h:34
calibdata.tube
tube
Definition: calibdata.py:31
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356
Trk::StraightLineSurface
Definition: StraightLineSurface.h:51
Trk::Layer
Definition: Layer.h:73
RpcReadoutElement.h
Trk::AtaStraightLine
ParametersT< 5, Charged, StraightLineSurface > AtaStraightLine
Definition: Tracking/TrkEvent/TrkParameters/TrkParameters/TrackParameters.h:31