ATLAS Offline Software
MuonSegmentMatchingTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <cmath>
8 #include <iostream>
9 
11 
12 namespace Muon {
13 
14 MuonSegmentMatchingTool::MuonSegmentMatchingTool(const std::string& ty, const std::string& na, const IInterface* pa)
15  : AthAlgTool(ty, na, pa) {
16  declareInterface<IMuonSegmentMatchingTool>(this);
17  declareProperty("UseCosmicsSettings", m_isCosmics = false, "Pick up settings for cosmics");
18  declareProperty("DoOverlapMatch", m_doOverlapMatch = true,
19  "Perform matching for segments in a small/large overlap");
20  declareProperty("DoStraightLineMatch", m_doStraightLineMatch = true,
21  "Perform matching for segments in regions without field");
22  declareProperty("DoCurvedMatch", m_doCurvedMatch = true, "Perform matching for segments in a field regions");
23  declareProperty("doThetaMatching", m_thetaMatch = false, "Pre-matching in theta");
24  declareProperty("doPhiMatching", m_phiMatch = false, "Pre-matching in phi");
25 
27  "OverlapMatchAngleDPhiCut", m_overlapMatchAngleDPhiCut = 0.15,
28  "Cut on the angular difference between the best phi and the one consistent with the chamber bounds");
30  "OverlapMatchAngleDYZCut", m_overlapMatchAngleDYZCut = 0.05,
31  "Cut on the angular difference between the best phi and the one consistent with the chamber bounds");
32  declareProperty("OverlapMatchPositionCut", m_overlapMatchPositionCut = 100.,
33  "Cut on the distance of recalculated position to the tube edge");
34  declareProperty("OverlapMatchPositionResidualCut", m_overlapMatchPositionResidualCut = 30.,
35  "Cut on the segment position residual after recalculation of the paramters");
36  declareProperty("OverlapMatchAveragePhiHitPullCut", m_overlapMatchPhiHitPullCut = 20.,
37  "Cut on the average pull of the phi hits with the new segment parameters");
38 
39  declareProperty("StraightLineMatchAngleCut", m_straightLineMatchAngleCut = 0.1,
40  "Cut on the angular difference between the extrapolated segment angle and reference");
41  declareProperty("StraightLineMatchPositionCut", m_straightLineMatchPositionCut = 200.,
42  "Cut on the distance of extrapolated segment position and reference");
43  declareProperty("MaxDistanceBetweenSegments", m_maxDistSegments = 5000.,
44  "If the two segments are further apart than this distance, they are considered to not match");
45 
46  declareProperty("OnlySameSectorIfTight", m_onlySameSectorIfTight = true,
47  "Accept only segments that are in the same sector for tight matching");
48  declareProperty("TightSegmentMatching", m_useTightCuts = false,
49  "Use tight selection for busy event to suppress combinatorics and improve CPU");
50 
51  declareProperty("DumpAngles", m_dumpAngles = false,
52  "Print matching angle information to screen. WARNING: always returns True for suppressNoise");
53  declareProperty("DoMatchingCutsBIBM_S", m_matchingbibm_sphisec = 0.015,
54  "Cut on sumDeltaYZ, segments in BI and BM, small phi sec");
55  declareProperty("DoMatchingCutsBIBO_S", m_matchingbibo_sphisec = 0.015,
56  "Cut on sumDeltaYZ, segments in BI and BO, small phi sec");
57  declareProperty("DoMatchingCutsBMBO_S", m_matchingbmbo_sphisec = 0.015,
58  "Cut on sumDeltaYZ, segments in BM and BO, small phi sec");
59  declareProperty("DoMatchingCutsEIEM_S", m_matchingeiem_sphisec = 0.010 * 2,
60  "Cut on sumDeltaYZ, segments in EI and EM, small phi sec");
61  declareProperty("DoMatchingCutsEIEO_S", m_matchingeieo_sphisec = 0.020 * 2,
62  "Cut on sumDeltaYZ, segments in EI and EO, small phi sec");
63  declareProperty("DoMatchingCutsEMEO_S", m_matchingemeo_sphisec = 0.002,
64  "Cut on sumDeltaYZ, segments in EM and EO, small phi sec");
65  declareProperty("DoMatchingCutsBIBM_L", m_matchingbibm_lphisec = 0.005,
66  "Cut on sumDeltaYZ, segments in BI and BM, large phi sec");
67  declareProperty("DoMatchingCutsBIBO_L", m_matchingbibo_lphisec = 0.015,
68  "Cut on sumDeltaYZ, segments in BI and BO, large phi sec");
69  declareProperty("DoMatchingCutsBMBO_L", m_matchingbmbo_lphisec = 0.010,
70  "Cut on sumDeltaYZ, segments in BM and BO, large phi sec");
71  declareProperty("DoMatchingCutsEIEM_L", m_matchingeiem_lphisec = 0.015 * 2,
72  "Cut on sumDeltaYZ, segments in EI and EM, large phi sec");
73  declareProperty("DoMatchingCutsEIEO_L", m_matchingeieo_lphisec = 0.025 * 2,
74  "Cut on sumDeltaYZ, segments in EI and EO, large phi sec");
75  declareProperty("DoMatchingCutsEMEO_L", m_matchingemeo_lphisec = 0.002,
76  "Cut on sumDeltaYZ, segments in EM and EO, large phi sec");
77  declareProperty("UseEndcapExtrapolationMatching", m_useEndcapExtrapolationMatching = true);
78  declareProperty("DrExtrapolationRMS", m_drExtrapRMS = 10);
79  declareProperty("DThetaExtrapolationRMS", m_dthetaExtrapRMS = 0.01 * 2);
80  declareProperty("DrExtrapolationAlignementOffset", m_drExtrapAlignmentOffset = 50);
81 }
82 
85 {
87  ATH_CHECK(m_edmHelperSvc.retrieve());
88  ATH_CHECK(m_printer.retrieve());
89  ATH_CHECK(m_idHelperSvc.retrieve());
90  ATH_CHECK(m_pairMatchingTool.retrieve());
92  return StatusCode::SUCCESS;
93 }
94 
97 {
98  double goodOverlapMatchFraction =
100  ATH_MSG_INFO("Overlap matches: total " << std::setw(7) << m_overlapMatches << " good " << std::setw(7)
101  << m_overlapMatchesGood << " fraction " << goodOverlapMatchFraction);
102 
103  double goodStraightLineMatchFraction =
105  ATH_MSG_INFO("StraightLine matches: total " << std::setw(7) << m_straightLineMatches << " good " << std::setw(7)
106  << m_straightLineMatchesGood << " fraction "
107  << goodStraightLineMatchFraction);
108 
109  double goodCurvedMatchFraction =
111  ATH_MSG_INFO("Curved matches: total " << std::setw(7) << m_curvedMatches << " good " << std::setw(7)
112  << m_curvedMatchesGood << " fraction " << goodCurvedMatchFraction);
113 
114  ATH_MSG_INFO("Segments sharing hits: total " << std::setw(7) << m_duplicateHitUses);
115 
116 
117  return StatusCode::SUCCESS;
118 }
119 bool
120 MuonSegmentMatchingTool::match(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const {
121 
122  ATH_MSG_VERBOSE(" match: segments " << std::endl << m_printer->print(seg1) << std::endl << m_printer->print(seg2));
123 
124  // get identifiers
125  Identifier chid1 = m_edmHelperSvc->chamberId(seg1);
126  Identifier chid2 = m_edmHelperSvc->chamberId(seg2);
127  if (chid1 == chid2) return false;
128 
129  MuonStationIndex::StIndex stIndex1 = m_idHelperSvc->stationIndex(chid1);
130  MuonStationIndex::StIndex stIndex2 = m_idHelperSvc->stationIndex(chid2);
131 
132  if (isSLMatch(chid1, chid2)) {
133  if (!m_idHelperSvc->isMdt(chid1) || !m_idHelperSvc->isMdt(chid2)) return false;
134  // if there is a stereo angle match using overlap matching tool
135 
136  if (stIndex1 == stIndex2) {
137 
138  if (hasStereoAngle(chid1, chid2)) {
139  if (!m_doOverlapMatch) return true;
140  const int eta1 = m_idHelperSvc->mdtIdHelper().stationEta(chid1);
141  const int eta2 = m_idHelperSvc->mdtIdHelper().stationEta(chid2);
142  const int phi1 = m_idHelperSvc->sector(chid1);
143  const int phi2 = m_idHelperSvc->sector(chid2);
144  // require that the two segments are close in eta AND are in adjecent sectors
145  if ( std::abs(eta1-eta2) <=1
146  && ( std::abs(phi1 - phi2) == 1 || (phi1 == 1 && phi2 == 16)
147  || (phi1 == 16 && phi2 == 1)))
148  {
149  return overlapMatch(ctx, seg1, seg2);
150  } else
151  return false;
152  }
153  }
154  if (!m_doStraightLineMatch) return true;
155 
156  if (stIndex1 == stIndex2) return false;
157 
158  return straightLineMatch(seg1, seg2);
159  }
160 
161  // if we get here perform a curved matching
162  if (!m_doCurvedMatch) return true;
163  if (stIndex1 == stIndex2) return false;
164 
165  return curvedMatch(seg1, seg2);
166 }
167 
168 
169 bool
171 {
173 
174  ATH_MSG_VERBOSE(" straight line match ");
175 
176  // Suppress cavern background noise and combinatorics using both theta and phi matching
177  if (m_thetaMatch)
178  if (!suppressNoise(seg1, seg2, m_useTightCuts)) {
179  return false;
180  }
181 
182  // Suppress cavern background noise and combinatorics using phi matching
183  if (m_phiMatch) {
184  if (!suppressNoisePhi(seg1, seg2, m_useTightCuts)) return false;
185  }
186 
188  return true;
189 }
190 
191 bool
193 {
194  ++m_curvedMatches;
195 
196  ATH_MSG_VERBOSE(" curved match ");
197 
198  // Suppress cavern background noise and combinatorics using both theta and phi matching
199  if (m_thetaMatch)
200  if (!suppressNoise(seg1, seg2, m_useTightCuts)) {
201  return false;
202  }
203 
204  // Suppress cavern background noise and combinatorics using phi matching
205  if (m_phiMatch) {
206  if (!suppressNoisePhi(seg1, seg2, m_useTightCuts)) return false;
207  }
208 
210  return true;
211 }
212 
213 bool
214 MuonSegmentMatchingTool::overlapMatch(const EventContext& ctx, const MuonSegment& seg1, const MuonSegment& seg2) const
215 {
217 
218  ATH_MSG_VERBOSE(" overlap match ");
219 
220  Identifier chid = m_edmHelperSvc->chamberId(seg1);
221 
222  // check the distance between the two segments
223  const float segDist = (seg1.globalPosition() - seg2.globalPosition()).mag();
224  ATH_MSG_VERBOSE(" Distance between segments " << segDist);
225  if (m_isCosmics && segDist > m_minDistSegmentsCosmics) {
226  ATH_MSG_DEBUG(" Too far appart, accepting ");
227  return true;
228  }
229  if (segDist > m_maxDistSegments) return false;
230 
231  if (!m_idHelperSvc->isMdt(chid)) {
232  ATH_MSG_DEBUG(" not a mdt segment " << m_idHelperSvc->toString(chid));
233  return true;
234  }
235 
237 
238  ATH_MSG_VERBOSE(result.toString());
239 
240  if (!result.goodMatch()) {
241  ATH_MSG_DEBUG(" bad match ");
242  return false;
243  }
244 
245  result.phiResult = m_overlapResolvingTool->bestPhiMatch(seg1, seg2);
246  if (std::abs(result.angularDifferencePhi) > m_overlapMatchAngleDPhiCut
247  || std::abs(result.phiResult.deltaYZ) > m_overlapMatchAngleDYZCut)
248  {
249  ATH_MSG_DEBUG(" failed angle cut: diff phi " << result.angularDifferencePhi << " deltaYZ "
250  << result.phiResult.deltaYZ);
251  return false;
252  }
253 
254  if (std::abs(result.averagePhiHitPullSegment1) > m_overlapMatchPhiHitPullCut
255  || std::abs(result.averagePhiHitPullSegment2) > m_overlapMatchPhiHitPullCut)
256  {
257  ATH_MSG_DEBUG(" failed phi hit pull cut: seg1 " << result.averagePhiHitPullSegment1 << " seg2 "
258  << result.averagePhiHitPullSegment2);
259  return false;
260  }
261 
262  if (!result.segmentResult1.inBounds(m_overlapMatchPositionCut)
263  || !result.segmentResult2.inBounds(m_overlapMatchPositionCut))
264  {
265  ATH_MSG_DEBUG(" failed position cut ");
266  return false;
267  }
268 
269  if (std::abs(result.segmentResult1.positionResidual) > m_overlapMatchPositionResidualCut
270  || std::abs(result.segmentResult2.positionResidual) > m_overlapMatchPositionResidualCut)
271  {
272  ATH_MSG_DEBUG(" failed position residual cut: seg1 " << result.segmentResult1.positionResidual << " seg2 "
273  << result.segmentResult2.positionResidual);
274  return false;
275  }
276 
278  return true;
279 }
280 
281 bool
283 {
284 
285  // check whether there is field
286  if (!m_toroidOn) return true;
287 
288  MuonStationIndex::StIndex stIndex1 = m_idHelperSvc->stationIndex(chid1);
289  MuonStationIndex::StIndex stIndex2 = m_idHelperSvc->stationIndex(chid2);
290 
291  // check whether segments in same station
292  if (stIndex1 == stIndex2) return true;
293 
294  // check whether segments in endcap EM/EO region
295  if ((stIndex1 == MuonStationIndex::EO && stIndex2 == MuonStationIndex::EM)
296  || (stIndex1 == MuonStationIndex::EM && stIndex2 == MuonStationIndex::EO))
297  return true;
298 
299  // all other cases should be treated with curvature
300  return false;
301 }
302 
303 bool
305 {
306 
307  // check whether same phi, else stereo angle (need correction for cosmic up-down tracks)
308  int phi1 = m_idHelperSvc->mdtIdHelper().stationPhi(id1);
309  int phi2 = m_idHelperSvc->mdtIdHelper().stationPhi(id2);
310 
311  if (phi1 != phi2) return true;
312 
313  // check whether there is a small/large overlap
314  bool isSmallChamber1 = m_idHelperSvc->isSmallChamber(id1);
315  bool isSmallChamber2 = m_idHelperSvc->isSmallChamber(id2);
316 
317  return isSmallChamber1 != isSmallChamber2;
318 }
319 
320 
321 // DOMINIQUE:
322 // Check that segment pairs is compatible with being produce within the calorimeter volume
323 // Keep it loose to retain long live particles decaying in calo
324 bool
325 MuonSegmentMatchingTool::suppressNoise(const MuonSegment& seg1, const MuonSegment& seg2, const bool& useTightCuts) const
326 {
327 
328  // calculate matching variables
330 
331  MuonStationIndex::StIndex station_a = m_idHelperSvc->stationIndex(result.chid_a);
332  MuonStationIndex::StIndex station_b = m_idHelperSvc->stationIndex(result.chid_b);
333 
334  bool isEndcap_a = m_idHelperSvc->isEndcap(result.chid_a);
335  bool isCSC_a = m_idHelperSvc->isCsc(result.chid_a);
336  bool isBEE_a = station_a == MuonStationIndex::BE;
337 
338  bool isEndcap_b = m_idHelperSvc->isEndcap(result.chid_b);
339  bool isCSC_b = m_idHelperSvc->isCsc(result.chid_b);
340  bool isBEE_b = station_b == MuonStationIndex::BE;
341 
342 
343  if (m_dumpAngles) {
344 
345  std::cout << "SegmentPositionChange "
346  << " " << m_idHelperSvc->chamberNameString(result.chid_a) << " "
347  << m_idHelperSvc->chamberNameString(result.chid_b) << " " << result.phiSector_a << " "
348  << result.phiSector_b << " " << result.deltaTheta_a << " " << result.deltaTheta_b << " "
349  << result.deltaTheta << " " << result.angleAC << " " << result.angleBC << " " << result.angleAB
350  << std::endl;
351  // return true; // to get the maximum statistics and not be hindered by current cuts
352  }
353 
354  ATH_MSG_VERBOSE("matching " << m_idHelperSvc->chamberNameString(result.chid_a) << " "
355  << m_idHelperSvc->chamberNameString(result.chid_b) << " phis " << result.phiSector_a
356  << " " << result.phiSector_b << " thetas " << result.deltaTheta_a << " "
357  << result.deltaTheta_b << " thetaSum " << result.deltaTheta << " tight cuts "
358  << useTightCuts);
359 
360  // The difference between the segment direction in the inner and outer stations ~< 60 degrees in all cases
361  if (result.angleAB > 1.0) return false;
362 
363 
364  // First: loose selection
365  if (!useTightCuts) {
366  if (isCSC_a || isCSC_b) {
367  ATH_MSG_VERBOSE(" check CSC result ");
368  if (result.phiSector_a != result.phiSector_b) {
369  return false;
370  }
371  if ((isCSC_a && !isEndcap_b) || (isCSC_b && !isEndcap_a)) return false;
372  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
373  }
374  // BEE
375  else if (isBEE_a || isBEE_b)
376  {
377  ATH_MSG_VERBOSE(" check BEE result ");
378  return result.deltaTheta <= 0.300;
379  }
380  // Barrel/endcap overlap
381  else if (isEndcap_a != isEndcap_b)
382  {
383  ATH_MSG_VERBOSE(" check B-E result ");
384  return result.deltaTheta <= 0.300;
385  }
386  // Phi-sector overlap
387  else if (result.phiSector_a != result.phiSector_b)
388  {
389  ATH_MSG_VERBOSE(" check phiSector result ");
390  if (result.deltaTheta > 0.300) {
391  ATH_MSG_VERBOSE(" check phiSector reject ");
392  return false;
393  } else {
394  return true;
395  }
396  }
397  // Barrel inner to middle station
398  else if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BM)
399  {
400  ATH_MSG_VERBOSE(" check BI BM result ");
401  if (result.phiSector_a % 2 == 0) {
402  return result.deltaTheta <= 6.67 * m_matchingbibm_sphisec;
403  } else if (result.phiSector_a % 2 == 1) {
404  return result.deltaTheta <= 6.67 * m_matchingbibm_lphisec;
405  }
406  }
407  // Barrel inner to outer station
408  else if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BO)
409  {
410  ATH_MSG_VERBOSE(" check BI BO result ");
411  if (result.phiSector_a % 2 == 0) {
412  return result.deltaTheta <= 6.67 * m_matchingbibo_sphisec;
413  } else if (result.phiSector_a % 2 == 1) {
414  return result.deltaTheta <= 6.67 * m_matchingbibo_lphisec;
415  }
416  }
417 
418  // Barrel middle to outer station
419  else if (station_a == MuonStationIndex::BM && station_b == MuonStationIndex::BO)
420  {
421  ATH_MSG_VERBOSE(" check BM BO result ");
422  if (result.phiSector_a % 2 == 0) {
423  return result.deltaTheta <= 6.67 * m_matchingbmbo_sphisec;
424  } else if (result.phiSector_a % 2 == 1) {
425  return result.deltaTheta <= 6.67 * m_matchingbmbo_lphisec;
426  }
427  }
428  // Endcap inner to middle station
429  else if (station_a == MuonStationIndex::EI && (station_b == MuonStationIndex::EM))
430  {
431  ATH_MSG_VERBOSE(" check EI EM result ");
432  if (result.phiSector_a % 2 == 0) {
433  if (result.deltaTheta > 6.67 * m_matchingeiem_sphisec) {
434  ATH_MSG_VERBOSE(" reject EI EM S result ");
435  return false;
436  } else {
437  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
438  }
439  } else if (result.phiSector_a % 2 == 1) {
440  if (result.deltaTheta > 6.67 * m_matchingeiem_lphisec) {
441  ATH_MSG_VERBOSE(" reject EI EM L result ");
442  return false;
443  } else {
444  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
445  }
446  }
447  }
448  // Endcap inner to outer station
449  else if (station_a == MuonStationIndex::EI && (station_b == MuonStationIndex::EO))
450  {
451  ATH_MSG_VERBOSE(" check EI EO result ");
452  if (result.phiSector_a % 2 == 0) {
453  if (result.deltaTheta > 6.67 * m_matchingeieo_sphisec) {
454  ATH_MSG_VERBOSE(" reject EI EO S result ");
455  return false;
456  } else {
457  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
458  }
459  } else if (result.phiSector_a % 2 == 1) {
460  if (result.deltaTheta > 6.67 * m_matchingeieo_lphisec) {
461  ATH_MSG_VERBOSE(" reject EI EO L result ");
462  return false;
463  } else {
464  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
465  }
466  }
467  }
468  // Endcap middle to outer station
469  else if (station_a == MuonStationIndex::EM && station_b == MuonStationIndex::EO)
470  {
471  // 5 mrad
472  ATH_MSG_VERBOSE(" check EM EO result ");
473  if (result.phiSector_a % 2 == 0) {
474  return result.deltaTheta <= 6.67 * m_matchingemeo_sphisec;
475  } else if (result.phiSector_a % 2 == 1) {
476  return result.deltaTheta <= 6.67 * m_matchingemeo_lphisec;
477  }
478  }
479 
480  return true;
481  }
482 
483  ATH_MSG_VERBOSE(" check further matching result ");
484 
485  // Second: tight selection if only if requested
486  if (m_onlySameSectorIfTight && result.phiSector_a != result.phiSector_b) {
487  ATH_MSG_VERBOSE(" rejection pair as in different sector and using tight cuts");
488  return false;
489  }
490  if (isCSC_a || isCSC_b) {
491  if (result.phiSector_a != result.phiSector_b) {
492  return false;
493  } else {
494  if (result.deltaTheta > 0.100) {
495  return false;
496  } else {
497  if ((isCSC_a && !isEndcap_b) || (isCSC_b && !isEndcap_a)) return false;
498  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
499  }
500  }
501 
502 
503  }
504  // BEE
505  else if (isBEE_a || isBEE_b)
506  {
507  return result.deltaTheta <= 0.200;
508  }
509  // Looser cut for segment in two different phi sectors
510  else if (result.phiSector_a != result.phiSector_b)
511  {
512  return result.deltaTheta <= 0.150;
513  }
514  // Barrel/endcap overlap
515  else if (isEndcap_a != isEndcap_b)
516  {
517  return result.deltaTheta <= 0.150;
518  }
519  // Phi-sector overlap
520  else if (result.phiSector_a != result.phiSector_b)
521  {
522  unsigned nChambers_a = m_edmHelperSvc->chamberIds(seg1).size();
523  unsigned nChambers_b = m_edmHelperSvc->chamberIds(seg2).size();
524  if (nChambers_a < 2 && nChambers_b < 2) {
525  return false;
526  } else if (result.deltaTheta > 0.150) {
527  return false;
528  } else {
529  return true;
530  }
531  }
532  // Barrel inner to middle station
533  else if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BM)
534  {
535  if (result.phiSector_a % 2 == 0) {
536  return result.deltaTheta <= m_matchingbibm_sphisec;
537  } else if (result.phiSector_a % 2 == 1) {
538  return result.deltaTheta <= m_matchingbibm_lphisec;
539  }
540  }
541  // Barrel inner to outer station
542  else if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BO)
543  {
544  if (result.phiSector_a % 2 == 0) {
545  return result.deltaTheta <= m_matchingbibo_sphisec;
546  } else if (result.phiSector_a % 2 == 1) {
547  return result.deltaTheta <= m_matchingbibo_lphisec;
548  }
549  }
550  // Barrel middle to outer station
551  else if (station_a == MuonStationIndex::BM && station_b == MuonStationIndex::BO)
552  {
553  if (result.phiSector_a % 2 == 0) {
554  return result.deltaTheta <= m_matchingbmbo_sphisec;
555  } else if (result.phiSector_a % 2 == 1) {
556  return result.deltaTheta <= m_matchingbmbo_lphisec;
557  }
558  }
559  // Endcap inner to middle station
560  else if ((station_a == MuonStationIndex::EI || station_a == MuonStationIndex::BI)
561  && station_b == MuonStationIndex::EM)
562  {
563  if (result.phiSector_a % 2 == 0) {
564  if (result.deltaTheta > m_matchingeiem_sphisec) {
565  return false;
566  } else {
567  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
568  }
569  } else if (result.phiSector_a % 2 == 1) {
570  if (result.deltaTheta > m_matchingeiem_lphisec) {
571  return false;
572  } else {
573  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
574  }
575  }
576  }
577  // Endcap inner to outer station
578  else if (station_a == MuonStationIndex::EI && (station_b == MuonStationIndex::EO))
579  {
580  if (result.phiSector_a % 2 == 0) {
581  if (result.deltaTheta > m_matchingeieo_sphisec) {
582  return false;
583  } else {
584  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
585  }
586  } else if (result.phiSector_a % 2 == 1) {
587  if (result.deltaTheta > m_matchingeieo_lphisec) {
588  return false;
589  } else {
590  return endcapExtrapolationMatch(seg1, seg2, useTightCuts);
591  }
592  }
593  }
594  // Endcap middle to outer station
595  else if (station_a == MuonStationIndex::EM && station_b == MuonStationIndex::EO)
596  {
597  if (result.phiSector_a % 2 == 0) {
598  return result.deltaTheta <= m_matchingemeo_sphisec;
599  } else if (result.phiSector_a % 2 == 1) {
600  return result.deltaTheta <= m_matchingemeo_lphisec;
601  }
602  }
603 
604  return true;
605 } // if m_useLocalAngles
606 
607 bool
609  const bool& useTightCuts) const
610 {
611  // calculate matching variables
613 
614  MuonStationIndex::StIndex station_a = m_idHelperSvc->stationIndex(result.chid_a);
615  MuonStationIndex::StIndex station_b = m_idHelperSvc->stationIndex(result.chid_b);
616 
617  bool isEndcap_a = m_idHelperSvc->isEndcap(result.chid_a);
618 
619  bool isEndcap_b = m_idHelperSvc->isEndcap(result.chid_b);
620 
621  if (m_dumpAngles) {
622  std::cout << "SegmentPositionChange Phi"
623  << " " << m_idHelperSvc->chamberNameString(result.chid_a) << " "
624  << m_idHelperSvc->chamberNameString(result.chid_b) << " deltaPhipos " << result.deltaPhipos
625  << " deltaPhidir " << result.deltaPhidir << " phiposerr_a " << result.phiposerr_a << " phiposerr_b "
626  << result.phiposerr_b << " phidirerr_a " << result.phidirerr_a << " phidirerr_b "
627  << result.phidirerr_b << " shorttube_a " << result.shorttube_a << " shorttube_b "
628  << result.shorttube_b << std::endl;
629  // return true; // to get the maximum statistics and not be hindered by current cuts
630  }
631 
632  // Keep segments only if they are in the same or adjacent phi sectors
633  if (result.phiSector_a != result.phiSector_b
634  && ((result.phiSector_a != 16 && result.phiSector_b != 1)
635  && (result.phiSector_a != 1 && result.phiSector_b != 16))
636  && (result.phiSector_a != (result.phiSector_b + 1) && result.phiSector_a != (result.phiSector_b - 1)))
637  return false;
638 
639  // First: loose selection
640  if (!useTightCuts) {
641  // cuts on second coordinate
642  if (result.phiSector_a == result.phiSector_b) {
643  if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
644 
645  if (!isEndcap_a && !isEndcap_b) {
646  return result.deltaPhipos <= 0.1;
647  }
648  if (isEndcap_a && isEndcap_b) {
649  // small sectors
650  if (result.phiSector_a % 2 == 0) {
651  return result.deltaPhipos <= 0.1;
652  }
653  // large sectors
654  if (result.phiSector_a % 2 == 1) {
655  return result.deltaPhipos <= 0.2;
656  }
657  }
658  }
659  }
660 
661  if (result.phiSector_a != result.phiSector_b) {
662  if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
663  if (!isEndcap_a && !isEndcap_b) {
664  return result.deltaPhipos <= 0.1;
665  }
666  if (isEndcap_a && isEndcap_b) {
667  return result.deltaPhipos <= 0.2;
668  }
669  }
670  }
671 
672  // cuts on distance to tube edge
673  // only if in a different phi sector
674  if (result.phiSector_a != result.phiSector_b) {
675  // measured inner segment
676  if (result.phiposerr_a < 10001.000) {
677  if (station_a == MuonStationIndex::BM && station_b == MuonStationIndex::BO) {
678  return result.shorttube_a <= 800;
679  }
680  if (station_a == MuonStationIndex::EI && station_b == MuonStationIndex::EM) {
681  // MM or STGC have result.shorttube = 99999.
682  return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
683  }
684  if (station_a == MuonStationIndex::EI && station_b == MuonStationIndex::EO) {
685  return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
686  }
687  if (station_a == MuonStationIndex::EM && station_b == MuonStationIndex::EO) {
688  return result.shorttube_a <= 800;
689  }
690  }
691  // measured outer segment
692  if (result.phiposerr_b < 10001.000) {
693  if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BM) {
694  return result.shorttube_b <= 800;
695  }
696  if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BO) {
697  return result.shorttube_b <= 800;
698  }
699  if (station_a == MuonStationIndex::BM && station_b == MuonStationIndex::BO) {
700  return result.shorttube_b <= 800;
701  }
702  if (station_a == MuonStationIndex::EI && station_b == MuonStationIndex::EM) {
703  return result.shorttube_b <= 1400;
704  }
705  }
706  }
707  return true;
708  }
709 
710 
711  // Second: tight selection if only if requested
712  // cuts on second coordinate
713  if (result.phiSector_a == result.phiSector_b) {
714  if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
715  if (!isEndcap_a && !isEndcap_b) {
716  return result.deltaPhipos <= 0.1;
717  }
718  if (isEndcap_a && isEndcap_b) {
719  // small sectors
720  if (result.phiSector_a % 2 == 0) {
721  return result.deltaPhipos <= 0.08;
722  }
723  // large sectors
724  if (result.phiSector_a % 2 == 1) {
725  return result.deltaPhipos <= 0.1;
726  }
727  }
728  }
729  }
730  // cuts on distance to tube edge
731  // only if in a different phi sector
732  if (result.phiSector_a != result.phiSector_b) {
733  if (result.phiposerr_a < 10001.000 && result.phiposerr_b < 10001.000) {
734  if (!isEndcap_a && !isEndcap_b) {
735  return result.deltaPhipos <= 0.05;
736  }
737  if (isEndcap_a && isEndcap_b) {
738  return result.deltaPhipos <= 0.1;
739  }
740  }
741 
742 
743  // measured inner segment
744  if (result.phiposerr_a < 10001.000) {
745  if (station_a == MuonStationIndex::BM && station_b == MuonStationIndex::BO) {
746  return result.shorttube_a <= 600;
747  }
748  if (station_a == MuonStationIndex::EI && station_b == MuonStationIndex::EM) {
749  return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
750  }
751  if (station_a == MuonStationIndex::EI && station_b == MuonStationIndex::EO) {
752  return result.shorttube_a <= 3500 || result.shorttube_a == 99999.;
753  }
754  if (station_a == MuonStationIndex::EM && station_b == MuonStationIndex::EO) {
755  return result.shorttube_a <= 500;
756  }
757  }
758  // measured outer segment
759  if (result.phiposerr_b < 10001.000) {
760  if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BM) {
761  return result.shorttube_b <= 600;
762  }
763  if (station_a == MuonStationIndex::BI && station_b == MuonStationIndex::BO) {
764  return result.shorttube_b <= 700;
765  }
766  if (station_a == MuonStationIndex::BM && station_b == MuonStationIndex::BO) {
767  return result.shorttube_b <= 700;
768  }
769  if (station_a == MuonStationIndex::EI && station_b == MuonStationIndex::EM) {
770  return result.shorttube_b <= 700;
771  }
772  }
773 
774  }
775  return true;
776 } // if m_useLocalAngles
777 
778 
779 bool
781  bool useTightCuts) const
782 {
783 
784  if (!m_useEndcapExtrapolationMatching) return true;
785 
786  Identifier chid1 = m_edmHelperSvc->chamberId(seg1);
787  Identifier chid2 = m_edmHelperSvc->chamberId(seg2);
788  if (chid1 == chid2) return false;
789 
790  MuonStationIndex::StIndex stIndex1 = m_idHelperSvc->stationIndex(chid1);
791  MuonStationIndex::StIndex stIndex2 = m_idHelperSvc->stationIndex(chid2);
792  if (stIndex1 == stIndex2) return false;
793 
794  const MuonSegment* segInner = nullptr;
795  if (stIndex1 == MuonStationIndex::EI) segInner = &seg1;
796  if (stIndex2 == MuonStationIndex::EI) segInner = &seg2;
797 
798  const MuonSegment* segOuter = nullptr;
799  if (stIndex1 == MuonStationIndex::EM || stIndex1 == MuonStationIndex::EO) segOuter = &seg1;
800  if (stIndex2 == MuonStationIndex::EM || stIndex2 == MuonStationIndex::EO) segOuter = &seg2;
801 
802  if (!segInner || !segOuter) {
803  return false;
804  }
805  const Amg::Vector3D& pos1 = segOuter->globalPosition();
806  const Amg::Vector3D& dir1 = segOuter->globalDirection();
807  const Amg::Vector3D& pos2 = segInner->globalPosition();
808  const Amg::Vector3D& dir2 = segInner->globalDirection();
809 
810  // extrapolate the first segment to the inner layer
811  double r_expected{0.}, theta_expected{0.}, rhoInv{0.};
812  simpleEndcapExtrapolate(pos1.x(), pos1.y(), pos1.z(), dir1.theta(), pos2.z(), r_expected, theta_expected, rhoInv);
813 
814  if (rhoInv < 0) rhoInv *= -1.;
815  double dr = pos2.perp() - r_expected;
816  double dtheta = dir2.theta() - theta_expected;
817 
818 
819  double drCut = m_drExtrapRMS + 5.e6 * rhoInv;
820  if (useTightCuts)
821  drCut *= 2;
822  else
823  drCut *= 4;
824 
825  if ((stIndex1 == MuonStationIndex::EM && stIndex2 == MuonStationIndex::BI)
826  || (stIndex1 == MuonStationIndex::BI && stIndex2 == MuonStationIndex::EM))
827  {
828  drCut += 3 * m_drExtrapAlignmentOffset;
829  } else {
830  drCut += m_drExtrapAlignmentOffset;
831  }
832 
833  double dthetaCut = m_dthetaExtrapRMS + 1.5e3 * rhoInv;
834  if (useTightCuts)
835  dthetaCut *= 2;
836  else
837  dthetaCut *= 4;
838 
839  ATH_MSG_VERBOSE(" simple match " << m_printer->print(seg1) << std::endl
840  << " " << m_printer->print(seg2) << std::endl
841  << " dr " << dr << " cut " << drCut << " dtheta " << dtheta << " cut " << dthetaCut
842  << " rhoInv " << 1e6 * rhoInv);
843 
844  if (std::abs(dr) > drCut) return false;
845  if (std::abs(dtheta) > dthetaCut) return false;
846  return true;
847 }
848 
849 
850 void
851 MuonSegmentMatchingTool::simpleEndcapExtrapolate(double x_segment, double y_segment, double z_segment,
852  double theta_segment, double z_extrapolated, double& r_expected,
853  double& theta_expected, double& rhoInv) const
854 {
855  //
856  // Endcap extrapolation with a parabolic track model
857  //
858  // In the region z = z start - z end of the Toroid one has:
859  // r_expected = z tan(theta) + (z - z start)*(z - z start)/ rho
860  //
861  // outside this region No field
862  //
863  // here z start = 6 000 z end = 10 000
864  // theta = direction at the vertex rho is the effective curvature
865  //
866  double z_start = 7000.;
867  double z_end = 12000.;
868 
869  if (z_extrapolated < 0) z_start = -z_start;
870  if (z_extrapolated < 0) z_end = -z_end;
871 
872  double r_segment = std::hypot(x_segment , y_segment);
873 
874  if (std::abs(z_extrapolated) > std::abs(z_segment)) {
875  ATH_MSG_WARNING(" extrapolate outwards is not implemented for z " << z_extrapolated);
876  r_expected = 0;
877  theta_expected = 0.;
878  return;
879  }
880  if (std::abs(z_segment) < std::abs(z_end)) {
881  ATH_MSG_WARNING(" segment before end of Toroid: SL extrapolation is used implemented " << z_segment);
882  }
883 
884  // use SL extrapolation to go to the z_end of the Toroid
885  const double tan_seg = std::tan(theta_segment);
886 
887  double r_end = r_segment + (z_end - z_segment) * tan_seg;
888 
889  double zgeo = (z_end - z_start) * (z_end - z_start) - 2 * z_end * (z_end - z_start);
890  rhoInv = (r_end - z_end * tan_seg) / zgeo;
891  double tantheta = tan_seg - 2 * (z_end - z_start) * rhoInv;
892  r_expected = z_extrapolated * tantheta + (z_extrapolated - z_start) * (z_extrapolated - z_start) * rhoInv;
893  //
894  // increase radius by 30% wrt straight line
895  //
896  double r_SL = r_segment + (z_extrapolated - z_segment) * tan_seg;
897  r_expected = r_expected + 0.3 * (r_expected - r_SL);
898  theta_expected = std::atan(tantheta + 2 * (z_extrapolated - z_start) * rhoInv);
899 
900  if (tan_seg < 0 && theta_expected < 0) theta_expected += M_PI;
901  if (tan_seg > 0 && theta_expected < 0) theta_expected = -theta_expected;
902 }
903 
904 
905 } // namespace Muon
Muon::MuonSegmentMatchingTool::m_doOverlapMatch
bool m_doOverlapMatch
Definition: MuonSegmentMatchingTool.h:125
Muon::MuonStationIndex::BE
@ BE
Definition: MuonStationIndex.h:25
Muon::MuonSegmentMatchingTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonSegmentMatchingTool.h:86
Muon::MuonSegmentMatchingTool::MuonSegmentMatchingTool
MuonSegmentMatchingTool(const std::string &, const std::string &, const IInterface *)
constructor
Definition: MuonSegmentMatchingTool.cxx:14
Muon::MuonSegmentMatchingTool::m_matchingbibo_lphisec
double m_matchingbibo_lphisec
Definition: MuonSegmentMatchingTool.h:151
Muon::MuonSegmentMatchingTool::suppressNoise
bool suppressNoise(const MuonSegment &seg1, const MuonSegment &seg2, const bool &useTightCuts) const
Suppress noise from cavern background/pile up using basic cuts
Definition: MuonSegmentMatchingTool.cxx:325
Muon::MuonSegmentMatchingTool::m_overlapMatchPositionCut
double m_overlapMatchPositionCut
cut on the distance of best position from the chamber bounds
Definition: MuonSegmentMatchingTool.h:141
Muon::MuonSegmentMatchingTool::m_matchingemeo_lphisec
double m_matchingemeo_lphisec
Definition: MuonSegmentMatchingTool.h:155
get_generator_info.result
result
Definition: get_generator_info.py:21
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
Muon::MuonSegmentMatchingTool::m_maxDistSegments
double m_maxDistSegments
cut on the maximum distance between the segments
Definition: MuonSegmentMatchingTool.h:147
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Muon::MuonSegmentMatchingTool::m_straightLineMatchPositionCut
double m_straightLineMatchPositionCut
Definition: MuonSegmentMatchingTool.h:134
Muon::MuonSegmentMatchingTool::hasStereoAngle
bool hasStereoAngle(const Identifier &id1, const Identifier &id2) const
check whether the two segments have a stereo angle
Definition: MuonSegmentMatchingTool.cxx:304
Muon::MuonStationIndex::EO
@ EO
Definition: MuonStationIndex.h:26
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Muon::MuonSegmentMatchingTool::m_matchingbmbo_lphisec
double m_matchingbmbo_lphisec
Definition: MuonSegmentMatchingTool.h:152
initialize
void initialize()
Definition: run_EoverP.cxx:894
Muon::MuonSegmentMatchingTool::m_duplicateHitUses
std::atomic_uint m_duplicateHitUses
Definition: MuonSegmentMatchingTool.h:122
M_PI
#define M_PI
Definition: ActiveFraction.h:11
xAOD::eta1
setEt setPhi setE277 setWeta2 eta1
Definition: TrigEMCluster_v1.cxx:41
Muon::MuonStationIndex::BI
@ BI
Definition: MuonStationIndex.h:25
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
Muon::MuonSegmentMatchingTool::m_overlapMatches
std::atomic_uint m_overlapMatches
Definition: MuonSegmentMatchingTool.h:118
MuonSegmentMatchingTool.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::MuonSegmentMatchingTool::m_matchingeiem_sphisec
double m_matchingeiem_sphisec
Definition: MuonSegmentMatchingTool.h:159
Muon::MuonSegmentMatchingTool::m_drExtrapRMS
double m_drExtrapRMS
Definition: MuonSegmentMatchingTool.h:170
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
Muon::MuonSegmentMatchingTool::m_doCurvedMatch
bool m_doCurvedMatch
Definition: MuonSegmentMatchingTool.h:127
Muon::MuonSegmentMatchingTool::m_phiMatch
bool m_phiMatch
Definition: MuonSegmentMatchingTool.h:129
Muon::MuonSegmentMatchingTool::m_isCosmics
bool m_isCosmics
Definition: MuonSegmentMatchingTool.h:124
Muon::MuonSegmentMatchingTool::m_matchingbibo_sphisec
double m_matchingbibo_sphisec
Definition: MuonSegmentMatchingTool.h:157
Muon::MuonSegmentMatchingTool::m_straightLineMatches
std::atomic_uint m_straightLineMatches
Definition: MuonSegmentMatchingTool.h:116
Muon::MuonSegmentMatchingTool::m_matchingemeo_sphisec
double m_matchingemeo_sphisec
Definition: MuonSegmentMatchingTool.h:161
Muon::MuonSegmentMatchingTool::m_curvedMatches
std::atomic_uint m_curvedMatches
Definition: MuonSegmentMatchingTool.h:120
Muon::MuonSegmentMatchingTool::isSLMatch
bool isSLMatch(const Identifier &chid1, const Identifier &chid2) const
check whether we should perform a straight line match
Definition: MuonSegmentMatchingTool.cxx:282
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:564
Muon::MuonStationIndex::BM
@ BM
Definition: MuonStationIndex.h:25
Muon::MuonSegmentMatchingTool::m_matchingbibm_lphisec
double m_matchingbibm_lphisec
Definition: MuonSegmentMatchingTool.h:150
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Muon::MuonSegmentMatchingTool::m_onlySameSectorIfTight
bool m_onlySameSectorIfTight
reject all segments in different sectors if in tight matching
Definition: MuonSegmentMatchingTool.h:165
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
Muon::MuonStationIndex::EI
@ EI
Definition: MuonStationIndex.h:26
MuonHough::z_end
constexpr double z_end
z value whereafter no magnetic field / curvature
Definition: MuonHoughMathUtils.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
Muon::MuonSegmentMatchingTool::m_printer
ToolHandle< Muon::MuonEDMPrinterTool > m_printer
EDM printer tool.
Definition: MuonSegmentMatchingTool.h:98
Muon::MuonSegmentMatchingTool::m_matchingeieo_sphisec
double m_matchingeieo_sphisec
Definition: MuonSegmentMatchingTool.h:160
Muon::MuonSegmentMatchingTool::m_useEndcapExtrapolationMatching
bool m_useEndcapExtrapolationMatching
Definition: MuonSegmentMatchingTool.h:169
Muon::MuonSegmentMatchingTool::m_drExtrapAlignmentOffset
double m_drExtrapAlignmentOffset
Definition: MuonSegmentMatchingTool.h:171
Muon::MuonSegmentMatchingTool::initialize
StatusCode initialize()
AlgTool initilize.
Definition: MuonSegmentMatchingTool.cxx:84
Muon::MuonSegmentMatchingTool::finalize
StatusCode finalize()
AlgTool finalize.
Definition: MuonSegmentMatchingTool.cxx:96
Muon::MuonSegmentMatchingTool::overlapMatch
bool overlapMatch(const EventContext &ctx, const MuonSegment &seg1, const MuonSegment &seg2) const
perform overlap matching
Definition: MuonSegmentMatchingTool.cxx:214
Muon::MuonSegmentMatchingTool::m_overlapResolvingTool
ToolHandle< Muon::IMuonSegmentInOverlapResolvingTool > m_overlapResolvingTool
matching tool to handle the overlaps
Definition: MuonSegmentMatchingTool.h:103
Muon::MuonSegmentMatchingTool::m_straightLineMatchesGood
std::atomic_uint m_straightLineMatchesGood
Definition: MuonSegmentMatchingTool.h:117
Muon::IMuonSegmentPairMatchingTool::SegmentMatchResult
Definition: IMuonSegmentPairMatchingTool.h:21
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Muon::MuonSegmentMatchingTool::m_matchingeiem_lphisec
double m_matchingeiem_lphisec
Definition: MuonSegmentMatchingTool.h:153
Muon::MuonSegmentMatchingTool::m_overlapMatchAngleDPhiCut
double m_overlapMatchAngleDPhiCut
cut of the angular difference between phi from phi match and phi from positions
Definition: MuonSegmentMatchingTool.h:137
Muon::MuonSegmentMatchingTool::m_matchingbmbo_sphisec
double m_matchingbmbo_sphisec
Definition: MuonSegmentMatchingTool.h:158
Muon::MuonSegmentMatchingTool::m_dthetaExtrapRMS
double m_dthetaExtrapRMS
Definition: MuonSegmentMatchingTool.h:172
Muon::MuonStationIndex::BO
@ BO
Definition: MuonStationIndex.h:25
Muon::MuonSegmentMatchingTool::m_toroidOn
Gaudi::Property< bool > m_toroidOn
Definition: MuonSegmentMatchingTool.h:114
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Muon::MuonSegmentMatchingTool::m_thetaMatch
bool m_thetaMatch
Definition: MuonSegmentMatchingTool.h:128
Muon::MuonSegmentMatchingTool::m_pairMatchingTool
ToolHandle< Muon::IMuonSegmentPairMatchingTool > m_pairMatchingTool
matching tool to handle the pairs of segments
Definition: MuonSegmentMatchingTool.h:108
Muon::IMuonSegmentInOverlapResolvingTool::SegmentMatchResult
Definition: IMuonSegmentInOverlapResolvingTool.h:133
Muon::MuonSegmentMatchingTool::m_overlapMatchPositionResidualCut
double m_overlapMatchPositionResidualCut
cut on the position residual for the best position match
Definition: MuonSegmentMatchingTool.h:142
Muon::MuonSegmentMatchingTool::endcapExtrapolationMatch
bool endcapExtrapolationMatch(const MuonSegment &seg1, const MuonSegment &seg2, bool useTightCuts) const
match an endcap middle or outer segment with an inner segment using a simple analytic extrapolation m...
Definition: MuonSegmentMatchingTool.cxx:780
Muon::MuonSegmentMatchingTool::m_doStraightLineMatch
bool m_doStraightLineMatch
Definition: MuonSegmentMatchingTool.h:126
Muon::MuonSegmentMatchingTool::m_straightLineMatchAngleCut
double m_straightLineMatchAngleCut
Definition: MuonSegmentMatchingTool.h:133
Muon::MuonSegmentMatchingTool::simpleEndcapExtrapolate
void simpleEndcapExtrapolate(double x_segment, double y_segment, double z_segment, double theta_segment, double z_extrapolated, double &r_expected, double &theta_expected, double &rhoInv) const
extrapolate segment in middle or outer endcap station to inner layer assuming the particle came from ...
Definition: MuonSegmentMatchingTool.cxx:851
Muon::MuonSegmentMatchingTool::m_overlapMatchAngleDYZCut
double m_overlapMatchAngleDYZCut
cut of the angular difference between phi from phi match and phi from positions
Definition: MuonSegmentMatchingTool.h:140
Muon::MuonSegmentMatchingTool::curvedMatch
bool curvedMatch(const MuonSegment &seg1, const MuonSegment &seg2) const
perform curved matching
Definition: MuonSegmentMatchingTool.cxx:192
MuonSegment.h
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
Muon::MuonSegment::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
global position
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:157
Muon::MuonSegmentMatchingTool::m_curvedMatchesGood
std::atomic_uint m_curvedMatchesGood
Definition: MuonSegmentMatchingTool.h:121
Muon::MuonSegment
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:45
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MuonSegmentMatchingTool::m_overlapMatchesGood
std::atomic_uint m_overlapMatchesGood
Definition: MuonSegmentMatchingTool.h:119
Muon::MuonSegmentMatchingTool::m_edmHelperSvc
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
EDM Helper tool.
Definition: MuonSegmentMatchingTool.h:91
Muon::MuonSegmentMatchingTool::suppressNoisePhi
bool suppressNoisePhi(const MuonSegment &seg1, const MuonSegment &seg2, const bool &useTightCuts) const
Suppress noise from cavern background/pile up using basic cuts in phi.
Definition: MuonSegmentMatchingTool.cxx:608
Muon::MuonSegmentMatchingTool::m_dumpAngles
bool m_dumpAngles
dump matching angle info to screen
Definition: MuonSegmentMatchingTool.h:167
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25
Muon::MuonSegmentMatchingTool::m_matchingeieo_lphisec
double m_matchingeieo_lphisec
Definition: MuonSegmentMatchingTool.h:154
Muon::MuonSegmentMatchingTool::m_useTightCuts
bool m_useTightCuts
only apply tight selection for busy combinations
Definition: MuonSegmentMatchingTool.h:166
Muon::MuonSegmentMatchingTool::straightLineMatch
bool straightLineMatch(const MuonSegment &seg1, const MuonSegment &seg2) const
perform straight line matching using SL extrapolation
Definition: MuonSegmentMatchingTool.cxx:170
Muon::MuonSegmentMatchingTool::m_minDistSegmentsCosmics
double m_minDistSegmentsCosmics
cut on the minimum distance between the segments, if the distance is larger
Definition: MuonSegmentMatchingTool.h:148
Muon::MuonStationIndex::EM
@ EM
Definition: MuonStationIndex.h:26
Muon::MuonSegment::globalDirection
const Amg::Vector3D & globalDirection() const
global direction
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h:163
Muon::MuonSegmentMatchingTool::m_overlapMatchPhiHitPullCut
double m_overlapMatchPhiHitPullCut
cut on the average pull of the phi hits with the new segment parameters
Definition: MuonSegmentMatchingTool.h:143
Muon::MuonSegmentMatchingTool::m_matchingbibm_sphisec
double m_matchingbibm_sphisec
Definition: MuonSegmentMatchingTool.h:156
Muon::MuonSegmentMatchingTool::match
bool match(const EventContext &ctx, const MuonSegment &seg1, const MuonSegment &seg2) const
match two segments
Definition: MuonSegmentMatchingTool.cxx:120