ATLAS Offline Software
MuonCalibSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
10 
11 namespace MuonCalib {
12 
14 
17  SegVec selectedSegments;
18 
19  // loop over segments and check whether they pass selection, if they do add to output vector
20  for (const EventHandler::ExtendedSegmentPtr& it : segments) {
21  if (select(*it, selection)) selectedSegments.emplace_back(it);
22  }
23  return selectedSegments;
24  }
25 
27  // select selection
29 
30  // perform tests
31  const MuonCalibTrackSummary& summary = segment.summary();
32  if (!select(summary, &sel)) { return false; }
33  double chi2Ndof = segment.chi2();
34  int ndof = 1;
35  // hack! could go wrong if: fit included trigger hits or 4D CSC segments
36  if (!segment.mdtHOT().empty()) ndof = segment.mdtHOT().size() - 2;
37  if (!segment.cscHOT().empty()) ndof = segment.cscHOT().size() - 2;
38  if (ndof != 0.) chi2Ndof /= ndof;
39  if (chi2Ndof > sel.maxChi2Ndof) { return false; }
40  const SegmentSelection* segmentSelection = dynamic_cast<const SegmentSelection*>(&sel);
41  if (segmentSelection) {
42  if (segmentSelection->hasFittedT0 && (!segment.hasFittedT0() || segment.fittedT0() == 0.)) { return false; }
43  // if (segmentSelection->hasAssociatedTrack && segment.associatedTracks().empty()) { return false; }
44 
45  if (segmentSelection->singleML && summary.nmdtHitsPerMl(1) > 0 && summary.nmdtHitsPerMl(2) > 0) return false;
46 
47  if (segmentSelection->twoML && (summary.nmdtHitsPerMl(1) == 0 || summary.nmdtHitsPerMl(2) == 0)) return false;
48 
49  float adcGoodHitFraction = (summary.nmdtHits - summary.nmdtHitsBelowADCCut) / summary.nmdtHits;
50  if (adcGoodHitFraction < segmentSelection->minAdcGoodFraction) return false;
51  }
52 
53  return true;
54  }
55 
57  // select selection
59 
60  if (summary.nmdtHits < sel.nminMdtHits) return false;
61 
62  if (summary.nphiTrigHits() < sel.nminPhiTrigHits) return false;
63 
64  if (summary.netaTrigHits() < sel.nminEtaTrigHits) return false;
65 
66  if (summary.noutliers > sel.nmaxOutliers) return false;
67 
68  if (summary.npseudo > sel.nmaxPseudo) return false;
69 
70  if (summary.nmdtHitsPerMl(1) < sel.nminMdtMl1) return false;
71  if (summary.nmdtHitsPerMl(2) < sel.nminMdtMl2) return false;
72  unsigned int nmdtCh = summary.nmdtCh();
73  if (nmdtCh < sel.nminMdtCh) return false;
74  if (nmdtCh > sel.nmaxMdtCh) return false;
75 
76  return true;
77  }
78 
81  TrackVec selectedTracks;
82 
83  // loop over segments and check whether they pass selection, if they do add to output vector
84  for (const EventHandler::ExtendedTrackPtr& it : tracks) {
85  if (select(*it, selection)) selectedTracks.emplace_back(it);
86  }
87  return selectedTracks;
88  }
89 
91  // select selection
93 
94  // perform tests
95  const MuonCalibTrackSummary& summary = track.summary();
96  if (!select(summary, &sel)) return false;
97 
98  double chi2Ndof = track.chi2();
99  int ndof = track.ndof();
100  if (ndof != 0.) chi2Ndof /= ndof;
101  if (chi2Ndof > sel.maxChi2Ndof) return false;
102 
103  const TrackSelection* trackSelection = dynamic_cast<const TrackSelection*>(&sel);
104  if (trackSelection) {
105  // select track with barrel hits
106  if (trackSelection->barrelTrack) {
107  if (!summary.hasBarrel) return false;
108 
109  // if not requiring endcap hits but track has endcap hits, reject
110  if (!trackSelection->endcapTrackA && summary.hasEndcapA) return false;
111  if (!trackSelection->endcapTrackC && summary.hasEndcapC) return false;
112  }
113 
114  // select track with endcap hits
115  if (trackSelection->endcapTrackA) {
116  if (!summary.hasEndcapA) return false;
117 
118  // if not requiring barrel hits but track has barrel hits, reject
119  if (!trackSelection->barrelTrack && summary.hasBarrel) return false;
120  if (!trackSelection->endcapTrackC && summary.hasEndcapC) return false;
121  }
122 
123  // select track with endcap hits
124  if (trackSelection->endcapTrackC) {
125  if (!summary.hasEndcapC) return false;
126 
127  // if not requiring barrel hits but track has barrel hits, reject
128  if (!trackSelection->barrelTrack && summary.hasBarrel) return false;
129  if (!trackSelection->endcapTrackA && summary.hasEndcapA) return false;
130  }
131 
132  if (std::abs(track.d0()) > trackSelection->maxr0) return false;
133  if (std::abs(track.z0ip()) > trackSelection->maxz0) return false;
134  }
135 
136  return true;
137  }
138 
139 } // namespace MuonCalib
IDTPM::ndof
float ndof(const U &p)
Definition: TrackParametersHelper.h:134
MuonCalib::MuonCalibTrackSummary
Definition: MuonCalibTrackSummary.h:17
MuonCalibExtendedTrack.h
skel.it
it
Definition: skel.GENtoEVGEN.py:396
MuonCalib::MuonCalibSelector::MuonCalibSelector
MuonCalibSelector()
MuonCalib::MuonCalibSelector::SegmentSelection::twoML
bool twoML
Definition: MuonCalibSelector.h:47
MuonCalib::EventHandler::ExtendedTrackPtr
MuonCalibExtendedRawHits::ExtendedTrkPtr ExtendedTrackPtr
Definition: EventHandler.h:32
MuonCalib::MuonCalibSelector::SegVec
EventHandler::SegmentVec SegVec
Definition: MuonCalibSelector.h:22
MuonCalib::MuonCalibSelector::SegmentSelection::hasFittedT0
bool hasFittedT0
Definition: MuonCalibSelector.h:44
MuonCalibExtendedSegment.h
sel
sel
Definition: SUSYToolsTester.cxx:97
MuonCalib::MuonCalibSelector::select
SegVec select(const SegVec &segments, const Selection *selection=nullptr) const
select segments satisfying selection.
Definition: MuonCalibSelector.cxx:15
MuonCalib::MuonCalibSelector::TrackSelection
Definition: MuonCalibSelector.h:51
MuonCalib
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.
Definition: CscCalcPed.cxx:22
MuonCalib::MuonCalibSelector::TrackSelection::endcapTrackC
bool endcapTrackC
Definition: MuonCalibSelector.h:55
MuonCalib::MuonCalibSelector::SegmentSelection
Definition: MuonCalibSelector.h:41
MuonCalibSelector.h
MuonCalibTrackSummary.h
MuonCalib::MuonCalibSelector::TrackSelection::barrelTrack
bool barrelTrack
Definition: MuonCalibSelector.h:53
selection
const std::string selection
Definition: fbtTestBasics.cxx:74
MuonCalib::MuonCalibSelector::SegmentSelection::singleML
bool singleML
Definition: MuonCalibSelector.h:46
MuonCalib::MuonCalibSelector::m_selection
Selection m_selection
Definition: MuonCalibSelector.h:80
MuonCalib::MuonCalibSelector::TrackSelection::maxz0
double maxz0
maximum longitudinal impact parameter at I.P.
Definition: MuonCalibSelector.h:57
MuonCalib::MuonCalibSelector::TrackSelection::maxr0
double maxr0
maximum transverse impact parameter wrt I.P.
Definition: MuonCalibSelector.h:56
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
MuonCalib::MuonCalibSelector::Selection
Definition: MuonCalibSelector.h:25
MuonCalib::MuonCalibSelector::TrackVec
EventHandler::TrackVec TrackVec
Definition: MuonCalibSelector.h:23
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
MuonCalib::MuonCalibSelector::TrackSelection::endcapTrackA
bool endcapTrackA
Definition: MuonCalibSelector.h:54
MuonCalib::MuonCalibExtendedTrack
Definition: MuonCalibExtendedTrack.h:32
MuonCalib::MuonCalibExtendedSegment
Definition: MuonCalibExtendedSegment.h:27
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
MuonCalib::EventHandler::ExtendedSegmentPtr
MuonCalibExtendedRawHits::ExtendedSegPtr ExtendedSegmentPtr
Definition: EventHandler.h:33
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65