ATLAS Offline Software
OfflineObjectSelection.cxx
Go to the documentation of this file.
1 
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
18 bool 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
35 bool TIDA::isGoodOffline(const xAOD::Muon& muon, const unsigned int selection, double ) {
36 
38  if ( muon.muonType() != xAOD::Muon::Combined ) return false;
39 
40  bool good_muon = false;
41 
45 
46  if ( selection == 1 ) good_muon = (muon.quality()<=xAOD::Muon::Tight);
47  else if ( selection == 2 ) good_muon = (muon.quality()<=xAOD::Muon::Medium);
48  else if ( selection == 3 ) good_muon = (muon.quality()<=xAOD::Muon::Loose);
49  else if ( selection == 4 ) good_muon = (muon.quality()<=xAOD::Muon::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
58 bool 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
90  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
96  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
155  if (nPixelHits < 2) return false;
156 
157  // SCT hits
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 
187 bool 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
egamma::trackParticle
const Rec::TrackParticle * trackParticle(unsigned int index=0) const
pointer to TrackParticle
Definition: egamma.cxx:391
TauJetParameters::MuonVeto
@ MuonVeto
Definition: TauJetParameters.h:109
Trk::numberOfPixelHits
@ numberOfPixelHits
number of pixel layers on track with absence of hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:57
xAOD::numberOfPixelHoles
@ numberOfPixelHoles
number of pixel layers on track with absence of hits [unit8_t].
Definition: TrackingPrimitives.h:261
LikeEnum::Loose
@ Loose
Definition: LikelihoodEnums.h:12
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
et
Extra patterns decribing particle interation process.
TIDA::isGoodOffline
bool isGoodOffline(const Analysis::Electron &elec)
Definition: OfflineObjectSelection.cxx:122
LikeEnum::VeryLoose
@ VeryLoose
Definition: LikelihoodEnums.h:11
Trk::numberOfSCTDeadSensors
@ numberOfSCTDeadSensors
number of TRT hits
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:76
xAOD::Egamma_v1::e
virtual double e() const override final
The total energy of the particle.
Definition: Egamma_v1.cxx:90
TauJetParameters::JetBDTSigMedium
@ JetBDTSigMedium
Definition: TauJetParameters.h:125
xAOD::TauJet_v3::nTracks
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
Definition: TauJet_v3.cxx:526
Analysis::Electron
Definition: Reconstruction/egamma/egammaEvent/egammaEvent/Electron.h:20
Trk::TrackParticleBase::trackSummary
const TrackSummary * trackSummary() const
accessor function for TrackSummary.
Definition: TrackParticleBase.h:247
TauJetParameters::EleBDTMedium
@ EleBDTMedium
Definition: TauJetParameters.h:128
xAOD::TauJetParameters::JetBDTSigMedium
@ JetBDTSigMedium
Definition: TauDefs.h:137
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
OfflineObjectSelection.h
IDTPM::nPixelHits
float nPixelHits(const U &p)
Definition: TrackParametersHelper.h:326
egamma::isem
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:769
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
drawFromPickle.atan
atan
Definition: drawFromPickle.py:36
Analysis::TauJet::tauID
const TauPID * tauID() const
Get TauPID object containing discriminant values.
xAOD::TauJetParameters::JetBDTSigLoose
@ JetBDTSigLoose
Definition: TauDefs.h:136
ParticleImpl::charge
virtual ChargeType charge() const
returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed...
Definition: ParticleImpl.h:718
Analysis::TauJet::numTrack
unsigned int numTrack() const
number of Tracks associated to Tau candidate, CAUTION not to be confused with numberOfTracks()!
Trk::numberOfTRTOutliers
@ numberOfTRTOutliers
number of TRT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:81
IDTPM::nSCTHits
float nSCTHits(const U &p)
Definition: TrackParametersHelper.h:365
Trk::numberOfSCTHits
@ numberOfSCTHits
number of SCT holes
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:71
xAOD::TauJet_v3
Class describing a tau jet.
Definition: TauJet_v3.h:41
xAOD::TauJetParameters::nChargedTracks
@ nChargedTracks
Definition: TauDefs.h:322
Analysis::TauPID::isTau
bool isTau(TauJetParameters::IsTauFlag flag) const
Get Flag for tau acceptance based on predefined arbitrary criteria.
Trk::numberOfPixelDeadSensors
@ numberOfPixelDeadSensors
number of pixel hits with broad errors (width/sqrt(12))
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:65
Analysis::TauJet
Object for taus common for ESD and AOD.
Definition: Reconstruction/tauEvent/tauEvent/TauJet.h:61
I4Momentum::eta
virtual double eta() const =0
pseudo rapidity
Analysis::Muon
The ATLAS Muon object - see doxygen, physics workbookd and the Muon Combined Performance WG's pages f...
Definition: Reconstruction/MuonIdentification/muonEvent/muonEvent/Muon.h:48
TrackSummary.h
ParticleImpl::eta
virtual double eta() const
pseudo rapidity
Definition: ParticleImpl.h:514
xAOD::numberOfSCTHoles
@ numberOfSCTHoles
number of SCT holes [unit8_t].
Definition: TrackingPrimitives.h:270
selection
std::string selection
Definition: fbtTestBasics.cxx:75
Trk::Combined
@ Combined
Definition: TrackSummaryTool.h:32
LikeEnum::Tight
@ Tight
Definition: LikelihoodEnums.h:15
egamma::author
unsigned int author() const
Reconstruction Author
Definition: egamma.h:244
Trk::numberOfTRTHits
@ numberOfTRTHits
number of TRT outliers
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:79
xAOD::TauJet_v3::detail
bool detail(TauJetParameters::Detail detail, int &value) const
Set veto flag.
Definition: TauJet_v3.cxx:292
xAOD::TauJetParameters::JetBDTSigTight
@ JetBDTSigTight
Definition: TauDefs.h:138
xAOD::TauJetParameters::JetRNNSigTight
@ JetRNNSigTight
Definition: TauDefs.h:148
Trk::TrackSummary
A summary of the information contained by a track.
Definition: Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h:287
xAOD::Electron_v1
Definition: Electron_v1.h:34
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
ParticleImpl::et
virtual double et() const
transverse energy defined to be e*sin(theta)
Definition: ParticleImpl.h:544
xAOD::TauJetParameters::JetRNNSigMedium
@ JetRNNSigMedium
Definition: TauDefs.h:147
xAOD::TauJet_v3::isTau
bool isTau(TauJetParameters::IsTauFlag flag) const
Get Flag for tau acceptance based on predefined arbitrary criteria.
Definition: TauJet_v3.cxx:273
LikeEnum::Medium
@ Medium
Definition: LikelihoodEnums.h:14
xAOD::numberOfSCTDeadSensors
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
Definition: TrackingPrimitives.h:273
xAOD::TauJet_v3::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: TauJet_v3.cxx:97
egammaPID::ElectronMediumPP
const unsigned int ElectronMediumPP
Medium++ electron selecton.
Definition: egammaPIDdefs.h:320
xAOD::Egamma_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: Egamma_v1.cxx:70
xAOD::numberOfPixelDeadSensors
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].
Definition: TrackingPrimitives.h:266
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
xAOD::TauJetParameters::JetRNNSigLoose
@ JetRNNSigLoose
Definition: TauDefs.h:146
xAOD::Egamma_v1::passSelection
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...
SCT_Monitoring::summary
@ summary
Definition: SCT_MonitoringNumbers.h:65