36 declareInterface<Muon::IMuonTGMeasTool>(
this);
45 ATH_CHECK(m_DetectorManagerKey.initialize(!m_useDSManager));
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();
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();
67 if (!m_trackingGeometryReadKey.empty()) {
68 ATH_CHECK(m_trackingGeometryReadKey.initialize());
70 ATH_CHECK(m_trackingGeometrySvc.retrieve());
72 return StatusCode::SUCCESS;
77 if (!m_useDSManager) {
79 MuonDetMgr = DetectorManagerHandle.cptr();
80 if (MuonDetMgr ==
nullptr) {
81 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
91 if (!lay || !parm || !
id.get_identifier32().get_compact())
return projPar;
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;
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;
111 if (layType != hitType)
return projPar;
120 ATH_MSG_DEBUG(
"extrapolated covariance:" << parm->covariance());
129 int tube = m_idHelperSvc->mdtIdHelper().tube(
id);
131 if (fabs(lay->
getRef()) > 10e6) {
134 double ref0 = dec / 1.e5;
135 double ref1 = lay->
getRef() - dec * 1e5 - 0.5 * (
sign + 1) * 1e5;
138 int tube = m_idHelperSvc->mdtIdHelper().tube(
id);
139 int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(
id);
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");
154 double DL =
locDir.dot(wireDir);
155 double A = sqrt(1. - DL * DL);
157 mdtProj.setIdentity();
162 mdtProj(0, 1) = ND / A;
164 mdtProj(1, 1) = DL / A * sqrt(A * A - ND * ND) / A;
174 locPar[0] -= locWire[0];
175 locPar[1] -= locWire[1];
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);
192 if (!rpcROE)
return projPar;
194 if (!stripSurf)
return projPar;
199 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
200 pMx = m_rpcProjPhi.get();
202 pMx = m_rpcProjEta.get();
205 double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(
id) && m_idHelperSvc->rpcIdHelper().doubletPhi(
id) == 2) ? -1. : 1.;
206 double zswap = (lay->
getRef() > 10000.) ? -1. : 1.;
210 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
214 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
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);
226 projPar =
new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *stripSurf);
227 projEM = std::nullopt;
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));
238 bool onSurface = stripSurf->
globalToLocal(globPos, globPos, locPos);
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);
262 if (!stripSurf)
return projPar;
264 double diff = m_idHelperSvc->cscIdHelper().measuresPhi(
id) ? 1.55 : -1.55;
267 double DN = parm->
momentum().dot(layNormal);
268 double t =
diff / DN;
284 parProj[2] = parm->parameters()[
Trk::phi];
289 if (m_idHelperSvc->cscIdHelper().measuresPhi(
id))
290 pMx = m_tgcProjPhi.get();
292 pMx = m_tgcProjEta.get();
294 ATH_MSG_DEBUG(
"projected parameters (layer->CSC):" << m_idHelperSvc->cscIdHelper().measuresPhi(
id) <<
"," << locPar);
296 if (parm->covariance()) {
297 std::optional<
AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(*pMx);
299 ATH_MSG_DEBUG(
"projected covariance (layer->CSC):" << *projEM);
301 projPar =
new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf, projEM);
304 projPar =
new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf);
317 if (!stripSurf)
return projPar;
320 if (m_idHelperSvc->tgcIdHelper().isStrip(
id))
321 pMx = m_tgcProjPhi.get();
323 pMx = m_tgcProjEta.get();
325 ATH_MSG_DEBUG(
"projected parameters (layer->TGC):" << m_idHelperSvc->tgcIdHelper().isStrip(
id) <<
"," << locPar <<
","
328 std::optional<
AmgMatrix(5, 5)> projEM = std::nullopt;
331 if (parm->covariance()) {
332 projEM = parm->covariance()->similarity(*pMx);
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);
338 projPar =
new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *stripSurf);
342 if (m_alignedMode && (parm->
position() - projPar->
position()).mag() > 0.001) {
344 << m_idHelperSvc->tgcIdHelper().stationName(
id) <<
"," << m_idHelperSvc->tgcIdHelper().stationEta(
id) <<
","
345 << m_idHelperSvc->tgcIdHelper().stationPhi(
id) <<
"," << m_idHelperSvc->tgcIdHelper().isStrip(
id));
348 bool onSurface = stripSurf->
globalToLocal(globPos, globPos, locPos);
350 locPar[0] = locPos[0];
351 locPar[1] = locPos[1];
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);
373 if (!lay || !parm || !(
id.get_identifier32().get_compact() > 0))
return projPar;
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;
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;
393 if (layType != hitType)
return projPar;
402 int tube = m_idHelperSvc->mdtIdHelper().tube(
id);
404 if (fabs(lay->
getRef()) > 10e6) {
407 double ref0 = dec / 1.e5;
408 double ref1 = lay->
getRef() - dec * 1e5 - 0.5 * (
sign + 1) * 1e5;
411 int tube = m_idHelperSvc->mdtIdHelper().tube(
id);
412 int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(
id);
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");
429 if (!laySurf)
return projPar;
431 double ND =
dir.dot(normal);
432 double DL =
locDir.dot(wireDir);
433 double A = sqrt(1. - DL * DL);
435 mdtProj.setIdentity();
439 mdtProj(0, 1) = ND / A;
441 mdtProj(1, 1) = DL / A * sqrt(A * A - ND * ND) / A;
450 AmgMatrix(5, 5) mdtProjInv = mdtProj.inverse();
452 pPar[0] += locWire[0];
453 pPar[1] += locWire[1];
454 ATH_MSG_DEBUG(
"back projected parameters(MDT->layer):" << pPar);
456 std::optional<
AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(mdtProjInv);
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);
467 if (!laySurf)
return projPar;
471 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
472 pMx = m_rpcProjPhi.get();
474 pMx = m_rpcProjEta.get();
477 double sign = (m_idHelperSvc->rpcIdHelper().measuresPhi(
id) && m_idHelperSvc->rpcIdHelper().doubletPhi(
id) == 2) ? -1. : 1.;
480 double zswap = (lay->
getRef() > 10000.) ? -1. : 1.;
482 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
486 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
495 ATH_MSG_DEBUG(
"back projected parameters(RPC->layer):" << m_idHelperSvc->rpcIdHelper().measuresPhi(
id) <<
"," << pPar);
497 std::optional<
AmgMatrix(5, 5)> projEM = parm->covariance()->similarityT(*pMx);
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);
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));
511 bool onSurface = laySurf->
globalToLocal(globPos, globPos, locPos);
516 projPar =
new Trk::AtaPlane(pPar[0], pPar[1], pPar[2], pPar[3], pPar[4], *laySurf, projEM);
529 if (!laySurf)
return projPar;
531 double diff = m_idHelperSvc->cscIdHelper().measuresPhi(
id) ? 1.55 : -1.55;
534 double DN = parm->
momentum().dot(layNormal);
535 double t =
diff / DN;
540 if (m_idHelperSvc->cscIdHelper().measuresPhi(
id))
541 pMx = m_tgcProjPhi.get();
543 pMx = m_tgcProjEta.get();
549 if (onSurface && locCorrLay.size() > 0) {
552 ATH_MSG_DEBUG(
"back projected parameters(CSC->layer):" << m_idHelperSvc->cscIdHelper().measuresPhi(
id) <<
"," << parProj);
554 std::optional<
AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(pMxInv);
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);
564 if (!laySurf) {
return projPar; }
567 if (m_idHelperSvc->tgcIdHelper().isStrip(
id))
568 pMx = m_tgcProjPhi.get();
570 pMx = m_tgcProjEta.get();
573 ATH_MSG_DEBUG(
"back projected parameters(TGC->layer):" << m_idHelperSvc->tgcIdHelper().isStrip(
id) <<
"," << locPar);
575 std::optional<
AmgMatrix(5, 5)> projEM = parm->covariance()->similarity(pMxInv);
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);
581 if (m_alignedMode && (parm->
position() - projPar->
position()).mag() > 0.001) {
583 << m_idHelperSvc->tgcIdHelper().stationName(
id) <<
"," << m_idHelperSvc->tgcIdHelper().stationEta(
id) <<
","
584 << m_idHelperSvc->tgcIdHelper().stationPhi(
id) <<
"," << m_idHelperSvc->tgcIdHelper().isStrip(
id));
587 bool onSurface = laySurf->
globalToLocal(globPos, globPos, locPos);
589 locPar[0] = locPos[0];
590 locPar[1] = locPos[1];
593 projPar =
new Trk::AtaPlane(locPar[0], locPar[1], locPar[2], locPar[3], locPar[4], *laySurf, projEM);
606 if (!m_useDSManager) {
608 MuonDetMgr = DetectorManagerHandle.cptr();
609 if (MuonDetMgr ==
nullptr) {
610 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
619 if (!lay || !parm || !rio)
return projRIO;
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;
634 int tube = m_idHelperSvc->mdtIdHelper().tube(
id);
636 if (fabs(lay->
getRef()) > 10e6) {
639 double ref0 = dec / 1.e5;
640 double ref1 = lay->
getRef() - dec * 1e5 - 0.5 * (
sign + 1) * 1e5;
643 int tube = m_idHelperSvc->mdtIdHelper().tube(
id);
644 int tubeMax = m_idHelperSvc->mdtIdHelper().tubeMax(
id);
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;
683 else if (hitType == 2) {
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.;
690 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id)) locPos *=
eta;
693 double zswap = (lay->
getRef() > 10000.) ? -1. : 1.;
695 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
702 std::vector<Identifier> rdoList;
703 rdoList.push_back(
id);
707 if (m_idHelperSvc->rpcIdHelper().measuresPhi(
id))
716 else if (hitType == 3) {
718 double diff = m_idHelperSvc->cscIdHelper().measuresPhi(
id) ? 1.55 : -1.55;
721 double DN = parm->
momentum().dot(layNormal);
722 double t =
diff / DN;
730 if (!onSurface) {
return projRIO; }
732 if (m_idHelperSvc->cscIdHelper().measuresPhi(
id)) {
740 std::vector<Identifier> rdoList;
741 rdoList.push_back(
id);
754 if (m_idHelperSvc->cscIdHelper().measuresPhi(
id))
763 else if (hitType == 4) {
769 std::vector<Identifier> rdoList;
770 rdoList.push_back(
id);
779 if (m_idHelperSvc->tgcIdHelper().isStrip(
id)) {
795 double& pitch)
const {
797 if (!m_useDSManager) {
799 MuonDetMgr = DetectorManagerHandle.cptr();
800 if (MuonDetMgr ==
nullptr) {
ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object"); }
806 if (!lay || !parm || !lay->
layerType())
return nid;
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;
824 if (!mdtROE)
return nid;
830 if (!onSurface || measPhi) {
return nid; }
832 double refL = lay->
getRef();
833 if (fabs(refL) > 10e6) {
836 refL = lay->
getRef() - dec * 1e5 - 0.5 * (
sign + 1) * 1e5;
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; }
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);
851 if (m_idHelperSvc->mdtIdHelper().valid(nearId))
862 bool foundDoubletPhi =
false;
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);
870 if (!rpcROE)
return nid;
871 if (!m_idHelperSvc->rpcIdHelper().valid(refPhi1))
return nid;
872 int nStripPhi = rpcROE->
Nstrips(1);
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);
890 if (onSurface1 && onSurfaceN && onSurface) {
893 strip = dstrip >= 0. ?
int(dstrip) + 1 : 0;
895 if (strip > 0 && strip <= nStripPhi) {
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;
910 if (!foundDoubletPhi)
return nid;
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);
921 if (!rpcROE)
return nid;
922 if (!m_idHelperSvc->rpcIdHelper().valid(refEta1))
return nid;
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);
942 if (onSurface && onSurface1 && onSurfaceN) {
946 strip = dstrip >= 0. ?
int(dstrip) + 1 : 0;
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);
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;
974 if (!refPar)
return nid;
982 int nStrips = m_idHelperSvc->cscIdHelper().stripMax(refId);
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);
997 pitch = (locN[0] -
loc1[0]) / fmax(1,
nStrips - 1);
1002 if (strip > 0 && strip <=
nStrips) {
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)
1015 if (measPhi && m_idHelperSvc->tgcIdHelper().gasGap(layId) == 2 && m_idHelperSvc->tgcIdHelper().gasGapMax(layId) == 3)
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;
1026 if (!refPar)
return nid;
1033 int nStrips = m_idHelperSvc->tgcIdHelper().channelMax(refId);
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);
1052 if (onSurface1 && onSurfaceN) {
1056 ATH_MSG_DEBUG(
"local position of boundary elements not retrieved, return 0 ");
1061 if (strip > 0 && strip <=
nStrips) {
1064 tgcROE->
gangCentralWidth(m_idHelperSvc->tgcIdHelper().gasGap(layId), strip)) {
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);
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]);
1078 while (fabs(stripposition[0] - localhit[0]) > 0.5 * pitch) {
1079 if (stripposition[0] < localhit[0]) {
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);
1098 if (m_idHelperSvc->tgcIdHelper().isStrip(nearId))
1099 pitch = tgcROE->
stripPitch(plane, m_idHelperSvc->tgcIdHelper().channel(nearId), localhit[1]);
1102 if (strip < 1 || strip >
nStrips)
return nid;
1103 if (m_idHelperSvc->tgcIdHelper().valid(nearId))
1118 if (!
id.get_identifier32().get_compact())
return lay;
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)) {
1139 if (station) lay = associatedLayer(
id, station->
trackingVolume());
1147 if (!vol)
return lay;
1152 while (!lay && iter != subVols.end()) {
1153 lay = associatedLayer(
id, *iter);
1157 if (lay)
return lay;
1163 while (!lay && iter != ordLay.end()) {
1164 lay =
match(
id, *iter);
1168 if (lay)
return lay;
1174 while (!lay && iter != unOrdLay.end()) {
1175 lay =
match(
id, *iter);
1179 if (lay)
return lay;
1187 if (!
id.get_identifier32().get_compact() || !lay || !lay->
layerType())
return mLay;
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))
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))
1204 if (m_idHelperSvc->isTgc(
id) && m_idHelperSvc->isTgc(layId)) {
1205 if (m_idHelperSvc->tgcIdHelper().gasGap(layId) == m_idHelperSvc->tgcIdHelper().gasGap(
id))
return lay;
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))
1218 double res = 10000.;
1219 if (!layPar || !rio)
return res;
1229 double res = 10000.;
1230 if (!layPar || !
id.get_identifier32().get_compact())
return res;
1241 double res = 10000.;
1242 if (!
layer || !layPar || !rio)
return res;
1245 if (!detElPar)
return res;
1246 if (m_idHelperSvc->isMdt(rio->
identify())) {
1257 if (!m_useDSManager) {
1259 MuonDetMgr = DetectorManagerHandle.cptr();
1260 if (MuonDetMgr ==
nullptr) {
1261 ATH_MSG_ERROR(
"Null pointer to the read MuonDetectorManager conditions object");
1266 double res = 10000.;
1267 if (!
layer || !layPar || !
id.get_identifier32().get_compact())
return res;
1270 if (!detElPar)
return res;
1271 if (m_idHelperSvc->isMdt(
id)) {
1273 }
else if (m_idHelperSvc->isRpc(
id)) {
1278 }
else if (m_idHelperSvc->isCsc(
id)) {
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) {