ATLAS Offline Software
Loading...
Searching...
No Matches
OfflineObjectSelection.cxx
Go to the documentation of this file.
1
9
12
13
14#ifdef XAODTRACKING_TRACKPARTICLE_H
15
16// xAOD offline electron selection
17// selection: 0 take all; 1,4 tight; 2,5 medium; 3,6 loose; <4 cut based, >3 likelihood
18bool TIDA::isGoodOffline(const xAOD::Electron& elec, const unsigned int selection, double ETOffline ) {
19
20 double sintheta = std::sin( 2*std::atan(std::exp(-elec.eta())) );
21 double et = elec.e()*sintheta;
22 if ( std::fabs(et)<ETOffline ) return false;
23
24 // if ( std::fabs(elec.e())<ETOffline ) return false;
25 if (selection == 1) return elec.passSelection("Tight");
26 else if (selection == 2) return elec.passSelection("Medium");
27 else if (selection == 3) return elec.passSelection("Loose");
28 else if (selection == 4) return elec.passSelection("LHTight");
29 else if (selection == 5) return elec.passSelection("LHMedium");
30 else if (selection == 6) return elec.passSelection("LHLoose");
31 return true;
32}
33
34// Currently no xAOD offline muon selection implemented
35bool TIDA::isGoodOffline(const xAOD::Muon& muon, const unsigned int selection, double ) {
36
38 if ( muon.muonType() != xAOD::Muon::MuonType::Combined ) return false;
39
40 bool good_muon = false;
41
45
46 if ( selection == 1 ) good_muon = (muon.quality()<=xAOD::Muon::Quality::Tight);
47 else if ( selection == 2 ) good_muon = (muon.quality()<=xAOD::Muon::Quality::Medium);
48 else if ( selection == 3 ) good_muon = (muon.quality()<=xAOD::Muon::Quality::Loose);
49 else if ( selection == 4 ) good_muon = (muon.quality()<=xAOD::Muon::Quality::VeryLoose);
50 else good_muon = true;
51
52 return good_muon;
53}
54
55
56// xAOD offline tau selection
57// selection: 0 = take all, 1 = tight, 2 = medium, 3 = loose, any other unsigned int = no JetBDTSig requirement
58bool TIDA::isGoodOffline(const xAOD::TauJet& tau, const unsigned int selection, int requireNtracks, double EtCutOffline ) {
59
60 // still require the ET threshold and the track multiplicity
61 // if ( selection==0) return true;
62
64 TLorentzVector TauTLV = tau.p4();
65 double eta_Tau = TauTLV.Eta();
66 double et_Tau = TauTLV.Et();
67
68 if ( std::fabs(eta_Tau)>2.47 ) return false;
69 if ( std::fabs(et_Tau)<EtCutOffline ) return false;
70
71 // int ntrack_Tau = tau.nTracks();
72
73#ifdef XAODTRACKING_TRACKPARTICLE_H
74#ifndef XAODTAU_VERSIONS_TAUJET_V3_H
75 int Ntracks = tau.nTracks();
76 // std::cout << "SUTT no tau detail " << Ntracks << "\t(isGood)" << std::endl;
77#else
78 int Ntracks=0;
80 // std::cout << "SUTT tau detail: N " << Ntracks << "\t(isGood)" << std::endl;
81#endif
82#else
83 int Ntracks = tau.numTrack();
84#endif
85
86 // Could this selection just be replaced by a string that is passed in? Or an enumerate if the function is needed to be called when incrementing an int for the selection?
87 bool good_tau = false;
88
89#if 0
91 if ( selection == 1 ) good_tau = tau.isTau(xAOD::TauJetParameters::JetBDTSigTight);
92 else if ( selection == 2 ) good_tau = tau.isTau(xAOD::TauJetParameters::JetBDTSigMedium);
93 else if ( selection == 3 ) good_tau = tau.isTau(xAOD::TauJetParameters::JetBDTSigLoose);
94 else good_tau = true;
95#else
97 if ( selection == 1 ) good_tau = tau.isTau(xAOD::TauJetParameters::JetRNNSigTight);
98 else if ( selection == 2 ) good_tau = tau.isTau(xAOD::TauJetParameters::JetRNNSigMedium);
99 else if ( selection == 3 ) good_tau = tau.isTau(xAOD::TauJetParameters::JetRNNSigLoose);
100 else good_tau = true;
101#endif
102
103
106 // if ( doThreeProng==false && Ntracks!=1 ) return false;
107 // if ( doThreeProng==true && Ntracks!=3 ) return false;
108 if ( requireNtracks>0 && Ntracks!=requireNtracks ) return false;
109
110 //bool not_a_electron = !( tauisTau(xAOD::TauJetParameters::EleBDTMedium) );
111 //bool not_a_muon = !( tauisTau(xAOD::TauJetParameters::MuonVeto) );
112 //bool best_tau = good_tau && not_a_electron && not_a_muon;
113
114 return good_tau;
115}
116
117
118#else
119
120
121
123 if ( elec.trackParticle() && elec.isem(egammaPID::ElectronMediumPP)==0 ) {
124 //medium++ ID
125 if (elec.author() == 1 || elec.author() == 3) {
126 //Author = track or track+calo
127 return true;
128 }
129 }
130 return false;
131}
132
133
135 if (!muon.isLoose()) {
136 //Tight muon
137 return false;
138 }
139
140 //Based on https://svnweb.cern.ch/trac/atlasgrp/browser/Physics/Common/OSCAR/OSSelectors/trunk/src/OSSelectMuon.cxx
141 if (muon.hasInDetTrackParticle()) {
142 const Rec::TrackParticle* idTrack = muon.inDetTrackParticle();
143 const Trk::TrackSummary* summary = idTrack->trackSummary();
144 if (!summary) return false;
145
148
149 // Expect B-Layer hit info not available for Rec::TrackParticle
150
151 // Pix hits
152 int nPixelHits = summary->get(Trk::numberOfPixelHits);
153 int numberOfPixelDeadSensors = summary->get(Trk::numberOfPixelDeadSensors);
154 nPixelHits += numberOfPixelDeadSensors;
155 if (nPixelHits < 2) return false;
156
157 // SCT hits
158 int nSCTHits = summary->get(Trk::numberOfSCTHits);
159 int numberOfSCTDeadSensors = summary->get(Trk::numberOfSCTDeadSensors);
160 nSCTHits += numberOfSCTDeadSensors;
161 if (nSCTHits < 6) return false;
162
163 // Pix+ + SCT holes
164 int numberOfPixelHoles=muon.numberOfPixelHoles();
165 int numberOfSCTHoles=muon.numberOfSCTHoles();
166 if ( numberOfPixelHoles+numberOfSCTHoles > 2) return false;
167
168 float etaTrack = fabs(idTrack->eta()); // Need to extrapolate in principle
169 int nTrtHits = summary->get(Trk::numberOfTRTHits);
170 int nTrtOutliers = summary->get(Trk::numberOfTRTOutliers);
171
172 if (etaTrack < 1.9) {
173 if ((nTrtHits + nTrtOutliers) < 5 ) return false;
174 if (nTrtOutliers >= (0.9 * (nTrtHits + nTrtOutliers))) return false;
175 } else {
176 if ((nTrtHits + nTrtOutliers) > 5) {
177 if (nTrtOutliers >= (0.9 * (nTrtHits + nTrtOutliers))) return false;
178 }
179 }
180 return true;
181 }
182 return false;
183}
184
185
186
187bool TIDA::isGoodOffline(const Analysis::TauJet& tau, const bool doThreeProng, const double EtCutOffline) {
188 // std::cout << "have offline tau" << std::endl;
189 bool id_flag = false;
190 if (doThreeProng) {
191 bool threeprong = ( tau.numTrack() == 3 && tau.tauID()->isTau(TauJetParameters::JetBDTSigMedium) );
192 id_flag = threeprong;
193 }
194 else {
195 bool oneprong = ( tau.numTrack() == 1 && tau.tauID()->isTau(TauJetParameters::JetBDTSigMedium) );
196 id_flag = oneprong;
197 }
198
199 if (id_flag) {
200 if (tau.et() < EtCutOffline) return false;
201 if (tau.eta() > 2.47) return false;
202 if (tau.tauID()->isTau(TauJetParameters::EleBDTMedium) ) return false;
203 if (tau.tauID()->isTau(TauJetParameters::MuonVeto) ) return false;
204 if (fabs(tau.charge())!=1) return false;
205 return true;
206 }
207 return false;
208}
209
210#endif
The ATLAS Muon object - see doxygen, physics workbookd and the Muon Combined Performance WG's pages f...
virtual double eta() const =0
pseudo rapidity
const TrackSummary * trackSummary() const
accessor function for TrackSummary.
A summary of the information contained by a track.
unsigned int isem(unsigned int mask=egammaPIDObs::ALL, egammaPIDObs::PID pid=egammaPIDObs::IsEM) const
ID flag with cuts, 0:e, >1:jet.
Definition egamma.cxx:761
const Rec::TrackParticle * trackParticle(unsigned int index=0) const
pointer to TrackParticle
Definition egamma.cxx:389
unsigned int author() const
Reconstruction Author.
Definition egamma.h:245
virtual double e() const override
The total energy of the particle.
Definition Egamma_v1.cxx:86
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition Egamma_v1.cxx:71
bool passSelection(bool &value, const std::string &menu) const
Check if the egamma object pass a selection menu (using the name) If the menu decision is stored in t...
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition TauJet_v3.cxx:96
bool detail(TauJetParameters::Detail detail, int &value) const
Get and set values of common details variables via enum.
bool isTau(TauJetParameters::IsTauFlag flag) const
Get Flag for tau acceptance based on predefined arbitrary criteria.
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
const std::string selection
bool isGoodOffline(const Analysis::Electron &elec)
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfPixelDeadSensors
number of pixel hits with broad errors (width/sqrt(12))
const unsigned int ElectronMediumPP
Medium++ electron selecton.
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17
Muon_v1 Muon
Reference the current persistent version:
Electron_v1 Electron
Definition of the current "egamma version".
Extra patterns decribing particle interation process.