ATLAS Offline Software
MuonTrackSegmentMatchResult.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /***************************************************************************
6  * Interface for matching tracks to muon segments
7  * ----------------------------------------------
8  * Author : Martin Woudstra
9  * Creation Date: 06 September 2010
10  ***************************************************************************/
11 
12 // std
13 
14 // other packages
15 
16 // this package
17 
19 
20 namespace Muon {
21 
24  resetCuts();
25  }
26 
28 
30  localPosXDiff = 0.0;
31  localPosYDiff = 0.0;
33  localAngleYDiff = 0.0;
34  posXMeasErr2 = 0.0;
35  posXPredErr2 = 0.0;
36  posXAlignErr2 = 0.0;
37  posXTotalErr2 = 0.0;
38  posYMeasErr2 = 0.0;
39  posYPredErr2 = 0.0;
40  posYAlignErr2 = 0.0;
41  posYTotalErr2 = 0.0;
42  angleXMeasErr2 = 0.0;
43  angleXPredErr2 = 0.0;
44  angleXAlignErr2 = 0.0;
45  angleXTotalErr2 = 0.0;
46  angleYMeasErr2 = 0.0;
47  angleYPredErr2 = 0.0;
48  angleYAlignErr2 = 0.0;
49  angleYTotalErr2 = 0.0;
50  matchChiSquared = 0.0;
53  predictionCovariance.setZero();
54  measuredCovariance.setZero();
55  totalCovariance.setZero();
56  diffVector.setZero();
57  track = nullptr;
58  segment = nullptr;
59  havePosX = false;
60  havePosY = false;
61  haveAngleX = false;
62  haveAngleY = false;
63  havePosXError = false;
64  havePosYError = false;
65  haveAngleXError = false;
66  haveAngleYError = false;
67  haveMatchChiSquared = false;
68  matchOK = true;
69  reason = Unknown;
70  }
71 
72  std::string TrackSegmentMatchResult::cutString(CutType cut) {
73  if (static_cast<int>(cut) < 0 || static_cast<int>(cut) >= static_cast<int>(NumberOfCutTypes)) { return "CutTypeOutOfRange"; }
74 
75  switch (cut) {
76  case PosXCut: return "PosXCut";
77  case PosYCut: return "PosYCut";
78  case AngXCut: return "AngleXCut";
79  case AngYCut: return "AngleYCut";
80  case PosXPullCut: return "PosXPullCut";
81  case PosYPullCut: return "PosYPullCut";
82  case AngXPullCut: return "AngleXPullCut";
83  case AngYPullCut: return "AngleYPullCut";
84  case MatchChiSquaredCut: return "ChiSquaredMatchCut";
85  default: return "CutTypeNotInList";
86  }
87 
88  return "";
89  }
90 
91  std::string TrackSegmentMatchResult::reasonString(Reason r) {
92  if (static_cast<int>(r) < 0 || static_cast<int>(r) >= static_cast<int>(NumberOfReasons)) { return "ReasonOutOfRange"; }
93  switch (r) {
94  case Unknown: return "Unknown";
95  case NoCutsApplied: return "NoCutsApplied";
96  case PassedAllCuts: return "PassedAllCuts";
97  case PassedMatchChiSquaredCut: return "PassedMatchChiSquaredCut";
98  case PassedPosAngleCuts: return "PassedPosAngleCuts";
99  case FailedCuts: return "FailedCuts";
100  case SegmentMatching: return "SegmentMatching";
101  case NoSegmentPointer: return "NoSegmentPointer";
102  case StereoAngleWithoutPhi: return "StereoAngleWithoutPhi";
103  case NoClosestPars: return "NoClosestPars";
104  case FieldNotOk: return "FieldNotOk";
105  case NoClosestSegment: return "NoClosestSegment";
106  case SegmentMatch: return "SegmentMatch";
107  case NoMomentumWithMagField: return "NoMomentumWithMagField";
108  case ExtrapolFailed: return "ExtrapolationFailed";
109  case ExtrapolNoErrors: return "ExtrapolationNoErrors";
110  case NoMeasErrors: return "NoMeasErrors";
111  case AngleMeasErrFailed: return "AngleMeasErrFailed";
112  case AnglePredErrFailed: return "AnglePredErrFailed";
113  case LocalDirFailed: return "LocalDirFailed";
114 
115  default: return "ReasonNotInList";
116  }
117  }
118 
120  std::string TrackSegmentMatchResult::failedCutsString() const {
121  std::string failedStr;
122  for (int i = 0; i < (int)NumberOfCutTypes; ++i) {
123  CutType cut = static_cast<CutType>(i);
124  if (appliedCut(cut) && failedCut(cut)) {
125  if (!failedStr.empty()) failedStr += ",";
127  }
128  }
129  return failedStr;
130  }
131 
133  std::string TrackSegmentMatchResult::passedCutsString() const {
134  std::string passedStr;
135  for (int i = 0; i < (int)NumberOfCutTypes; ++i) {
136  CutType cut = static_cast<CutType>(i);
137  if (appliedCut(cut) && passedCut(cut)) {
138  if (!passedStr.empty()) passedStr += ",";
139  passedStr += cutString(cut);
140  }
141  }
142  return passedStr;
143  }
144 
145  std::string TrackSegmentMatchResult::reasonString() const { return reasonString(reason); }
146 
148 
150 
152  posXCut = 0.0;
153  posYCut = 0.0;
154  posXPullCut = 0.0;
155  posYPullCut = 0.0;
156  angleXCut = 0.0;
157  angleYCut = 0.0;
158  angleXPullCut = 0.0;
159  angleYPullCut = 0.0;
160  matchChiSquaredCut = 0.0;
161  useTightCuts = false;
162  cutOnPosX = false;
163  cutOnPosY = false;
164  cutOnPosXPull = false;
165  cutOnPosYPull = false;
166  cutOnAngleX = false;
167  cutOnAngleY = false;
168  cutOnAngleXPull = false;
169  cutOnAngleYPull = false;
170  cutOnMatchChiSquared = false;
171  }
172 
173 } // namespace Muon
Muon::TrackSegmentMatchResult::posYMeasErr2
double posYMeasErr2
Definition: MuonTrackSegmentMatchResult.h:86
Muon::TrackSegmentMatchResult::LocalDirFailed
@ LocalDirFailed
Definition: MuonTrackSegmentMatchResult.h:71
Muon::TrackSegmentMatchResult::PassedPosAngleCuts
@ PassedPosAngleCuts
Definition: MuonTrackSegmentMatchResult.h:54
beamspotman.r
def r
Definition: beamspotman.py:676
Muon::TrackSegmentMatchResult::posXPredErr2
double posXPredErr2
Definition: MuonTrackSegmentMatchResult.h:87
Muon::TrackSegmentMatchResult::angleXMeasErr2
double angleXMeasErr2
Definition: MuonTrackSegmentMatchResult.h:93
Muon::TrackSegmentMatchResult::NumberOfReasons
@ NumberOfReasons
Definition: MuonTrackSegmentMatchResult.h:72
Muon::TrackSegmentMatchResult::SegmentMatching
@ SegmentMatching
Definition: MuonTrackSegmentMatchResult.h:56
Muon::TrackSegmentMatchCuts::cutOnPosXPull
bool cutOnPosXPull
Definition: MuonTrackSegmentMatchResult.h:187
Muon::TrackSegmentMatchResult::PassedAllCuts
@ PassedAllCuts
Definition: MuonTrackSegmentMatchResult.h:52
Muon::TrackSegmentMatchResult::NoClosestPars
@ NoClosestPars
Definition: MuonTrackSegmentMatchResult.h:59
Muon::TrackSegmentMatchResult::ExtrapolNoErrors
@ ExtrapolNoErrors
Definition: MuonTrackSegmentMatchResult.h:65
Muon::TrackSegmentMatchResult::angleYAlignErr2
double angleYAlignErr2
Definition: MuonTrackSegmentMatchResult.h:98
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Muon::TrackSegmentMatchCuts::angleYPullCut
double angleYPullCut
Definition: MuonTrackSegmentMatchResult.h:182
Muon::TrackSegmentMatchCuts::posXCut
double posXCut
Definition: MuonTrackSegmentMatchResult.h:175
Muon::TrackSegmentMatchResult::localAngleXDiff
double localAngleXDiff
Definition: MuonTrackSegmentMatchResult.h:83
Muon::TrackSegmentMatchResult::haveAngleX
bool haveAngleX
Definition: MuonTrackSegmentMatchResult.h:115
Muon::TrackSegmentMatchResult::havePosX
bool havePosX
Definition: MuonTrackSegmentMatchResult.h:111
Muon::TrackSegmentMatchResult::passedCut
bool passedCut(CutType cut) const
Did it pass the cut? Returns true if cut was not applied or passed.
Definition: MuonTrackSegmentMatchResult.h:143
Muon::TrackSegmentMatchResult::haveMatchChiSquared
bool haveMatchChiSquared
Definition: MuonTrackSegmentMatchResult.h:119
Muon::TrackSegmentMatchResult::AngXPullCut
@ AngXPullCut
Definition: MuonTrackSegmentMatchResult.h:40
Muon::TrackSegmentMatchResult::PosYCut
@ PosYCut
Definition: MuonTrackSegmentMatchResult.h:35
Muon::TrackSegmentMatchResult::track
const Trk::Track * track
Definition: MuonTrackSegmentMatchResult.h:108
Muon::TrackSegmentMatchResult::FailedCuts
@ FailedCuts
Definition: MuonTrackSegmentMatchResult.h:55
Muon::TrackSegmentMatchResult::angleXAlignErr2
double angleXAlignErr2
Definition: MuonTrackSegmentMatchResult.h:97
Muon::TrackSegmentMatchResult::NoCutsApplied
@ NoCutsApplied
Definition: MuonTrackSegmentMatchResult.h:51
Muon::TrackSegmentMatchCuts::cutOnAngleY
bool cutOnAngleY
Definition: MuonTrackSegmentMatchResult.h:190
Muon::TrackSegmentMatchResult::PassedMatchChiSquaredCut
@ PassedMatchChiSquaredCut
Definition: MuonTrackSegmentMatchResult.h:53
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::TrackSegmentMatchResult::AngleMeasErrFailed
@ AngleMeasErrFailed
Definition: MuonTrackSegmentMatchResult.h:68
Muon::TrackSegmentMatchResult::NoSegmentPointer
@ NoSegmentPointer
Definition: MuonTrackSegmentMatchResult.h:57
Muon::TrackSegmentMatchResult::angleYPredErr2
double angleYPredErr2
Definition: MuonTrackSegmentMatchResult.h:96
Muon::TrackSegmentMatchCuts::cutOnAngleYPull
bool cutOnAngleYPull
Definition: MuonTrackSegmentMatchResult.h:192
Muon::TrackSegmentMatchResult::posXAlignErr2
double posXAlignErr2
Definition: MuonTrackSegmentMatchResult.h:89
Muon::TrackSegmentMatchResult::angleYMeasErr2
double angleYMeasErr2
Definition: MuonTrackSegmentMatchResult.h:94
Muon::TrackSegmentMatchResult::posXMeasErr2
double posXMeasErr2
Definition: MuonTrackSegmentMatchResult.h:85
Muon::TrackSegmentMatchCuts::angleYCut
double angleYCut
Definition: MuonTrackSegmentMatchResult.h:180
Muon::TrackSegmentMatchCuts::cutOnMatchChiSquared
bool cutOnMatchChiSquared
Definition: MuonTrackSegmentMatchResult.h:193
Muon::TrackSegmentMatchResult::NoClosestSegment
@ NoClosestSegment
Definition: MuonTrackSegmentMatchResult.h:61
Muon::TrackSegmentMatchResult::resetCuts
void resetCuts()
Reset all cuts (applied & passed)
Definition: MuonTrackSegmentMatchResult.h:131
Muon::TrackSegmentMatchResult::localAngleYDiff
double localAngleYDiff
Definition: MuonTrackSegmentMatchResult.h:84
Muon::TrackSegmentMatchCuts::cutOnPosX
bool cutOnPosX
Definition: MuonTrackSegmentMatchResult.h:185
Muon::TrackSegmentMatchCuts::cutOnPosYPull
bool cutOnPosYPull
Definition: MuonTrackSegmentMatchResult.h:188
lumiFormat.i
int i
Definition: lumiFormat.py:85
Muon::TrackSegmentMatchResult::AngYCut
@ AngYCut
Definition: MuonTrackSegmentMatchResult.h:39
Muon::TrackSegmentMatchResult::localPosXDiff
double localPosXDiff
Definition: MuonTrackSegmentMatchResult.h:81
Muon::TrackSegmentMatchResult::Unknown
@ Unknown
Definition: MuonTrackSegmentMatchResult.h:50
Muon::TrackSegmentMatchResult::haveAngleYError
bool haveAngleYError
Definition: MuonTrackSegmentMatchResult.h:118
Muon::TrackSegmentMatchResult::havePosXError
bool havePosXError
Definition: MuonTrackSegmentMatchResult.h:113
Muon::TrackSegmentMatchResult::posYPredErr2
double posYPredErr2
Definition: MuonTrackSegmentMatchResult.h:88
Muon::TrackSegmentMatchCuts::useTightCuts
bool useTightCuts
Definition: MuonTrackSegmentMatchResult.h:184
Muon::TrackSegmentMatchResult::AngYPullCut
@ AngYPullCut
Definition: MuonTrackSegmentMatchResult.h:41
Muon::TrackSegmentMatchResult::havePosY
bool havePosY
Definition: MuonTrackSegmentMatchResult.h:112
Muon::TrackSegmentMatchResult::reason
Reason reason
Definition: MuonTrackSegmentMatchResult.h:110
Muon::TrackSegmentMatchResult::posXTotalErr2
double posXTotalErr2
Definition: MuonTrackSegmentMatchResult.h:91
Muon::TrackSegmentMatchResult::TrackSegmentMatchResult
TrackSegmentMatchResult()
Definition: MuonTrackSegmentMatchResult.cxx:27
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
Muon::TrackSegmentMatchCuts::posYPullCut
double posYPullCut
Definition: MuonTrackSegmentMatchResult.h:178
Muon::TrackSegmentMatchResult::CutType
CutType
Definition: MuonTrackSegmentMatchResult.h:33
Muon::TrackSegmentMatchCuts::angleXCut
double angleXCut
Definition: MuonTrackSegmentMatchResult.h:179
Muon::TrackSegmentMatchCuts::cutOnAngleX
bool cutOnAngleX
Definition: MuonTrackSegmentMatchResult.h:189
Muon::TrackSegmentMatchResult::cutString
static std::string cutString(CutType cut)
turn enum CutType into a string
Definition: MuonTrackSegmentMatchResult.cxx:77
Muon::TrackSegmentMatchResult::totalCovariance
Amg::MatrixX totalCovariance
Definition: MuonTrackSegmentMatchResult.h:104
Muon::TrackSegmentMatchCuts::cutOnPosY
bool cutOnPosY
Definition: MuonTrackSegmentMatchResult.h:186
Muon::TrackSegmentMatchResult::MatchChiSquaredCut
@ MatchChiSquaredCut
Definition: MuonTrackSegmentMatchResult.h:42
Muon::TrackSegmentMatchResult::measuredCovariance
Amg::MatrixX measuredCovariance
Definition: MuonTrackSegmentMatchResult.h:103
Muon::TrackSegmentMatchResult::failedCut
bool failedCut(CutType cut) const
Did it fail the cut? Returns true if cut was applied and failed.
Definition: MuonTrackSegmentMatchResult.h:146
Muon::TrackSegmentMatchResult::matchOK
bool matchOK
Definition: MuonTrackSegmentMatchResult.h:120
Muon::TrackSegmentMatchResult::haveAngleY
bool haveAngleY
Definition: MuonTrackSegmentMatchResult.h:116
Muon::TrackSegmentMatchResult::angleXTotalErr2
double angleXTotalErr2
Definition: MuonTrackSegmentMatchResult.h:99
Muon::TrackSegmentMatchResult::FieldNotOk
@ FieldNotOk
Definition: MuonTrackSegmentMatchResult.h:60
Muon::TrackSegmentMatchResult::PosXPullCut
@ PosXPullCut
Definition: MuonTrackSegmentMatchResult.h:36
MuonTrackSegmentMatchResult.h
Muon::TrackSegmentMatchResult::matchChiSquared
double matchChiSquared
Definition: MuonTrackSegmentMatchResult.h:101
Muon::TrackSegmentMatchResult::StereoAngleWithoutPhi
@ StereoAngleWithoutPhi
Definition: MuonTrackSegmentMatchResult.h:58
Muon::TrackSegmentMatchResult::SegmentMatch
@ SegmentMatch
Definition: MuonTrackSegmentMatchResult.h:62
Muon::TrackSegmentMatchResult::passedCutsString
std::string passedCutsString() const
String with all cuts that were applied and passed.
Definition: MuonTrackSegmentMatchResult.cxx:138
Muon::TrackSegmentMatchResult::NoMeasErrors
@ NoMeasErrors
Definition: MuonTrackSegmentMatchResult.h:66
Muon::TrackSegmentMatchResult::posYTotalErr2
double posYTotalErr2
Definition: MuonTrackSegmentMatchResult.h:92
Muon::TrackSegmentMatchResult::ExtrapolFailed
@ ExtrapolFailed
Definition: MuonTrackSegmentMatchResult.h:64
Muon::TrackSegmentMatchResult::appliedCut
bool appliedCut(CutType cut) const
Was the cut applied ?
Definition: MuonTrackSegmentMatchResult.h:149
Muon::TrackSegmentMatchCuts::angleXPullCut
double angleXPullCut
Definition: MuonTrackSegmentMatchResult.h:181
Muon::TrackSegmentMatchResult::~TrackSegmentMatchResult
virtual ~TrackSegmentMatchResult()
Definition: MuonTrackSegmentMatchResult.cxx:32
Muon::TrackSegmentMatchCuts::matchChiSquaredCut
double matchChiSquaredCut
Definition: MuonTrackSegmentMatchResult.h:183
Muon::TrackSegmentMatchCuts::posXPullCut
double posXPullCut
Definition: MuonTrackSegmentMatchResult.h:177
Muon::TrackSegmentMatchCuts::TrackSegmentMatchCuts
TrackSegmentMatchCuts()
Definition: MuonTrackSegmentMatchResult.cxx:152
Muon::TrackSegmentMatchResult::angleYTotalErr2
double angleYTotalErr2
Definition: MuonTrackSegmentMatchResult.h:100
Muon::TrackSegmentMatchResult::predictionCovariance
Amg::MatrixX predictionCovariance
Definition: MuonTrackSegmentMatchResult.h:102
Muon::TrackSegmentMatchResult::posYAlignErr2
double posYAlignErr2
Definition: MuonTrackSegmentMatchResult.h:90
Muon::TrackSegmentMatchResult::segmentChamberId
Identifier segmentChamberId
Definition: MuonTrackSegmentMatchResult.h:107
Muon::TrackSegmentMatchResult::PosXCut
@ PosXCut
Definition: MuonTrackSegmentMatchResult.h:34
Muon::TrackSegmentMatchResult::NoMomentumWithMagField
@ NoMomentumWithMagField
Definition: MuonTrackSegmentMatchResult.h:63
Muon::TrackSegmentMatchResult::trackChamberId
Identifier trackChamberId
Definition: MuonTrackSegmentMatchResult.h:106
Muon::TrackSegmentMatchResult::PosYPullCut
@ PosYPullCut
Definition: MuonTrackSegmentMatchResult.h:37
Muon::TrackSegmentMatchResult::localPosYDiff
double localPosYDiff
Definition: MuonTrackSegmentMatchResult.h:82
Muon::TrackSegmentMatchCuts::~TrackSegmentMatchCuts
virtual ~TrackSegmentMatchCuts()
Muon::TrackSegmentMatchResult::AnglePredErrFailed
@ AnglePredErrFailed
Definition: MuonTrackSegmentMatchResult.h:69
Muon::TrackSegmentMatchResult::NumberOfCutTypes
@ NumberOfCutTypes
Definition: MuonTrackSegmentMatchResult.h:43
Muon::TrackSegmentMatchResult::failedCutsString
std::string failedCutsString() const
String with all cuts that were applied and failed.
Definition: MuonTrackSegmentMatchResult.cxx:125
Muon::TrackSegmentMatchCuts::clear
virtual void clear()
Definition: MuonTrackSegmentMatchResult.cxx:156
Muon::TrackSegmentMatchResult::segment
const MuonSegment * segment
Definition: MuonTrackSegmentMatchResult.h:109
Muon::TrackSegmentMatchResult::AngXCut
@ AngXCut
Definition: MuonTrackSegmentMatchResult.h:38
Muon::TrackSegmentMatchCuts::posYCut
double posYCut
Definition: MuonTrackSegmentMatchResult.h:176
Muon::TrackSegmentMatchResult::havePosYError
bool havePosYError
Definition: MuonTrackSegmentMatchResult.h:114
Muon::TrackSegmentMatchCuts::cutOnAngleXPull
bool cutOnAngleXPull
Definition: MuonTrackSegmentMatchResult.h:191
Muon::TrackSegmentMatchResult::reasonString
std::string reasonString() const
Definition: MuonTrackSegmentMatchResult.cxx:150
Muon::TrackSegmentMatchResult::clear
virtual void clear()
Definition: MuonTrackSegmentMatchResult.cxx:34
Muon::TrackSegmentMatchResult::haveAngleXError
bool haveAngleXError
Definition: MuonTrackSegmentMatchResult.h:117
Muon::TrackSegmentMatchResult::angleXPredErr2
double angleXPredErr2
Definition: MuonTrackSegmentMatchResult.h:95
Muon::TrackSegmentMatchResult::diffVector
Amg::VectorX diffVector
Definition: MuonTrackSegmentMatchResult.h:105
Identifier
Definition: IdentifierFieldParser.cxx:14