CMS 3D CMS Logo

Functions
reco::tau::qcuts Namespace Reference

Functions

bool AND (const TrackBaseRef &track, const RecoTauQualityCuts::TrackQCutFuncCollection &cuts)
 
bool AND_cand (const Candidate &cand, const RecoTauQualityCuts::CandQCutFuncCollection &cuts)
 
bool etMin_cand (const Candidate &cand, double cut)
 
bool mapAndCutByType (const Candidate &cand, const RecoTauQualityCuts::CandQCutFuncMap &funcMap)
 
bool minPackedCandVertexWeight (const pat::PackedCandidate &pCand, const reco::VertexRef *pv, double cut)
 
bool minTrackVertexWeight (const TrackBaseRef &track, const reco::VertexRef *pv, double cut)
 
bool minTrackVertexWeight (const TrackRef &track, const reco::VertexRef *pv, double cut)
 
bool minTrackVertexWeight_cand (const Candidate &cand, const reco::VertexRef *pv, double cut)
 
bool ptMin (const TrackBaseRef &track, double cut)
 
bool ptMin_cand (const Candidate &cand, double cut)
 
bool trkChi2 (const Track *track, double cut)
 
bool trkChi2_cand (const Candidate &cand, double cut)
 
bool trkLongitudinalImpactParameter (const TrackBase *track, const reco::VertexRef *pv, double cut)
 
bool trkLongitudinalImpactParameter_cand (const Candidate &cand, const reco::VertexRef *pv, double cut)
 
bool trkLongitudinalImpactParameterWrtTrack (const Track *track, const Track *leadTrack, const reco::VertexRef *pv, double cut)
 DZ cut, with respect to the current lead rack. More...
 
bool trkLongitudinalImpactParameterWrtTrack_cand (const Candidate &cand, const reco::Track *leadTrack, const reco::VertexRef *pv, double cut)
 
bool trkPixelHits (const Track *track, int cut)
 
bool trkPixelHits_cand (const Candidate &cand, int cut)
 
bool trkTrackerHits (const Track *track, int cut)
 
bool trkTrackerHits_cand (const Candidate &cand, int cut)
 
bool trkTransverseImpactParameter (const Track *track, const reco::VertexRef *pv, double cut)
 
bool trkTransverseImpactParameter_cand (const Candidate &cand, const reco::VertexRef *pv, double cut)
 

Function Documentation

bool reco::tau::qcuts::AND ( const TrackBaseRef track,
const RecoTauQualityCuts::TrackQCutFuncCollection cuts 
)

Definition at line 265 of file RecoTauQualityCuts.cc.

References patCandidates_cff::func.

Referenced by BinaryOP::evaluate(), egHLT::EgObjTrigCut< T >::pass(), and egHLT::EgEvtTrigCut< T >::pass().

266 {
267  for(auto const& func : cuts ) {
268  if ( !func(track) ) return false;
269  }
270  return true;
271 }
bool reco::tau::qcuts::AND_cand ( const Candidate cand,
const RecoTauQualityCuts::CandQCutFuncCollection cuts 
)

Definition at line 273 of file RecoTauQualityCuts.cc.

References patCandidates_cff::func.

Referenced by mapAndCutByType().

274 {
275  for(auto const& func : cuts ) {
276  if ( !func(cand) ) return false;
277  }
278  return true;
279 }
bool reco::tau::qcuts::etMin_cand ( const Candidate cand,
double  cut 
)

Definition at line 71 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, reco::Candidate::et(), and LogDebug.

72 {
73  LogDebug("TauQCuts") << "<etMin_cand>: Et = " << cand.et() << ", cut = " << cut ;
74  return (cand.et() > cut);
75 }
#define LogDebug(id)
bool reco::tau::qcuts::mapAndCutByType ( const Candidate cand,
const RecoTauQualityCuts::CandQCutFuncMap funcMap 
)

Definition at line 282 of file RecoTauQualityCuts.cc.

References funct::abs(), AND_cand(), egammaForCoreTracking_cff::cuts, and reco::Candidate::pdgId().

283 {
284  // Find the cuts that for this particle type
285  RecoTauQualityCuts::CandQCutFuncMap::const_iterator cuts = funcMap.find(std::abs(cand.pdgId()));
286  // Return false if we dont' know how to deal with this particle type
287  if ( cuts == funcMap.end() ) return false;
288  return AND_cand(cand, cuts->second); // Otherwise AND all the cuts
289 }
bool AND_cand(const Candidate &cand, const RecoTauQualityCuts::CandQCutFuncCollection &cuts)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool reco::tau::qcuts::minPackedCandVertexWeight ( const pat::PackedCandidate pCand,
const reco::VertexRef pv,
double  cut 
)

Definition at line 207 of file RecoTauQualityCuts.cc.

References pat::PackedCandidate::eta(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), LogDebug, pat::PackedCandidate::phi(), pat::PackedCandidate::pt(), pat::PackedCandidate::pvAssociationQuality(), jets_cff::quality, pat::PackedCandidate::UsedInFitLoose, pat::PackedCandidate::UsedInFitTight, and pat::PackedCandidate::vertexRef().

Referenced by reco::tau::RecoTauQualityCuts::filterChargedCand(), and minTrackVertexWeight_cand().

207  {
208 
209  if ( pv->isNull() ) {
210  edm::LogError("QCutsNoPrimaryVertex") << "Primary vertex Ref in " <<
211  "RecoTauQualityCuts is invalid. - minPackedCandVertexWeight";
212  return false;
213  }
214  //there is some low granular information on track weight in the vertex available with packed cands
215  double weight = -9.9;
216  if( pCand.vertexRef().isNonnull() && pCand.vertexRef().key() == pv->key() ){
217  int quality = pCand.pvAssociationQuality();
218  if( quality == pat::PackedCandidate::UsedInFitTight ) weight = 0.6;//0.6 as proxy for weight above 0.5
219  else if( quality == pat::PackedCandidate::UsedInFitLoose ) weight = 0.1;//0.6 as proxy for weight below 0.5
220  }
221  LogDebug("TauQCuts") << " packedCand: Pt = " << pCand.pt() << ", eta = " << pCand.eta() << ", phi = " << pCand.phi() ;
222  LogDebug("TauQCuts") << " vertex: x = " << (*pv)->position().x() << ", y = " << (*pv)->position().y() << ", z = " << (*pv)->position().z() ;
223  LogDebug("TauQCuts") << "--> trackWeight from packedCand = " << weight << " (cut = " << cut << ")" ;
224  return (weight >= cut);
225 }
#define LogDebug(id)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
Definition: weight.py:1
key_type key() const
Accessor for product key.
Definition: Ref.h:263
const reco::VertexRef vertexRef() const
const PVAssociationQuality pvAssociationQuality() const
double pt() const override
transverse momentum
bool isNull() const
Checks for null.
Definition: Ref.h:248
double eta() const override
momentum pseudorapidity
double phi() const override
momentum azimuthal angle
bool reco::tau::qcuts::minTrackVertexWeight ( const TrackBaseRef track,
const reco::VertexRef pv,
double  cut 
)

Definition at line 181 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, reco::TrackBase::eta(), edm::Ref< C, T, F >::isNull(), LogDebug, reco::TrackBase::phi(), and reco::TrackBase::pt().

Referenced by minTrackVertexWeight_cand().

182 {
183  if ( pv->isNull() ) {
184  edm::LogError("QCutsNoPrimaryVertex") << "Primary vertex Ref in " <<
185  "RecoTauQualityCuts is invalid. - minTrackVertexWeight";
186  return false;
187  }
188  LogDebug("TauQCuts") << " track: Pt = " << track->pt() << ", eta = " << track->eta() << ", phi = " << track->phi() ;
189  LogDebug("TauQCuts") << " vertex: x = " << (*pv)->position().x() << ", y = " << (*pv)->position().y() << ", z = " << (*pv)->position().z() ;
190  LogDebug("TauQCuts") << "--> trackWeight = " << (*pv)->trackWeight(track) << " (cut = " << cut << ")" ;
191  return ((*pv)->trackWeight(track) >= cut);
192 }
#define LogDebug(id)
bool isNull() const
Checks for null.
Definition: Ref.h:248
bool reco::tau::qcuts::minTrackVertexWeight ( const TrackRef track,
const reco::VertexRef pv,
double  cut 
)

Definition at line 194 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, edm::Ref< C, T, F >::isNull(), and LogDebug.

195 {
196  if ( pv->isNull() ) {
197  edm::LogError("QCutsNoPrimaryVertex") << "Primary vertex Ref in " <<
198  "RecoTauQualityCuts is invalid. - minTrackVertexWeight";
199  return false;
200  }
201  LogDebug("TauQCuts") << " track: Pt = " << track->pt() << ", eta = " << track->eta() << ", phi = " << track->phi() ;
202  LogDebug("TauQCuts") << " vertex: x = " << (*pv)->position().x() << ", y = " << (*pv)->position().y() << ", z = " << (*pv)->position().z() ;
203  LogDebug("TauQCuts") << "--> trackWeight = " << (*pv)->trackWeight(track) << " (cut = " << cut << ")" ;
204  return ((*pv)->trackWeight(track) >= cut);
205 }
#define LogDebug(id)
bool isNull() const
Checks for null.
Definition: Ref.h:248
bool reco::tau::qcuts::minTrackVertexWeight_cand ( const Candidate cand,
const reco::VertexRef pv,
double  cut 
)

Definition at line 227 of file RecoTauQualityCuts.cc.

References reco::Candidate::charge(), TkAlMuonSelectors_cfi::cut, LogDebug, minPackedCandVertexWeight(), minTrackVertexWeight(), and HiIsolationCommonParameters_cff::track.

228 {
229  auto track = getTrackRef(cand);
230  if ( track.isNonnull() ) {
231  return minTrackVertexWeight(track, pv, cut);
232  }
233  auto gsfTrack = getGsfTrackRef(cand);
234  if ( gsfTrack.isNonnull() ) {
235  return minTrackVertexWeight(gsfTrack, pv, cut);
236  }
237 
238  const pat::PackedCandidate* pCand = dynamic_cast<const pat::PackedCandidate*>(&cand);
239  if( pCand != nullptr && cand.charge() != 0) {
240  return minPackedCandVertexWeight(*pCand, pv, cut);
241  }
242  LogDebug("TauQCuts") << "<minTrackVertexWeight_cand>: weight = N/A, cut = " << cut ;
243  return false;
244 }
#define LogDebug(id)
bool minTrackVertexWeight(const TrackRef &track, const reco::VertexRef *pv, double cut)
bool minPackedCandVertexWeight(const pat::PackedCandidate &pCand, const reco::VertexRef *pv, double cut)
bool reco::tau::qcuts::ptMin ( const TrackBaseRef track,
double  cut 
)

Definition at line 59 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, LogDebug, and reco::TrackBase::pt().

60 {
61  LogDebug("TauQCuts") << "<ptMin>: Pt = " << track->pt() << ", cut = " << cut ;
62  return (track->pt() > cut);
63 }
#define LogDebug(id)
bool reco::tau::qcuts::ptMin_cand ( const Candidate cand,
double  cut 
)

Definition at line 65 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, LogDebug, and reco::Candidate::pt().

66 {
67  LogDebug("TauQCuts") << "<ptMin_cand>: Pt = " << cand.pt() << ", cut = " << cut ;
68  return (cand.pt() > cut);
69 }
#define LogDebug(id)
bool reco::tau::qcuts::trkChi2 ( const Track track,
double  cut 
)

Definition at line 246 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, LogDebug, and reco::TrackBase::normalizedChi2().

Referenced by trkChi2_cand().

247 {
248  LogDebug("TauQCuts") << "<trkChi2>: chi^2 = " << track->normalizedChi2() << ", cut = " << cut ;
249  return (track->normalizedChi2() <= cut);
250 }
#define LogDebug(id)
bool reco::tau::qcuts::trkChi2_cand ( const Candidate cand,
double  cut 
)

Definition at line 252 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, getTrack(), LogDebug, HiIsolationCommonParameters_cff::track, and trkChi2().

253 {
254  auto track = getTrack(cand);
255  if ( track ) {
256  LogDebug("TauQCuts") << "<trkChi2_cand>: chi^2 = " << track->normalizedChi2() << ", cut = " << cut ;
257  return trkChi2(track, cut);
258  } else {
259  LogDebug("TauQCuts") << "<trkChi2_cand>: chi^2 = N/A, cut = " << cut ;
260  return false;
261  }
262 }
#define LogDebug(id)
bool trkChi2(const Track *track, double cut)
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
bool reco::tau::qcuts::trkLongitudinalImpactParameter ( const TrackBase track,
const reco::VertexRef pv,
double  cut 
)

Definition at line 139 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, reco::TrackBase::dz(), reco::TrackBase::eta(), edm::Ref< C, T, F >::isNull(), LogDebug, reco::TrackBase::phi(), and reco::TrackBase::pt().

Referenced by trkLongitudinalImpactParameter_cand().

140 {
141  if ( pv->isNull() ) {
142  edm::LogError("QCutsNoPrimaryVertex") << "Primary vertex Ref in " <<
143  "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameter";
144  return false;
145  }
146  LogDebug("TauQCuts") << " track: Pt = " << track->pt() << ", eta = " << track->eta() << ", phi = " << track->phi() ;
147  LogDebug("TauQCuts") << " vertex: x = " << (*pv)->position().x() << ", y = " << (*pv)->position().y() << ", z = " << (*pv)->position().z() ;
148  LogDebug("TauQCuts") << "--> dz = " << std::fabs(track->dz((*pv)->position())) << " (cut = " << cut << ")" ;
149  return (std::fabs(track->dz((*pv)->position())) <= cut);
150 }
#define LogDebug(id)
bool isNull() const
Checks for null.
Definition: Ref.h:248
bool reco::tau::qcuts::trkLongitudinalImpactParameter_cand ( const Candidate cand,
const reco::VertexRef pv,
double  cut 
)

Definition at line 152 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, getTrack(), LogDebug, HiIsolationCommonParameters_cff::track, and trkLongitudinalImpactParameter().

153 {
154  auto track = getTrack(cand);
155  if ( track ) {
157  } else {
158  LogDebug("TauQCuts") << "<trkLongitudinalImpactParameter_cand>: dZ = N/A, cut = " << cut ;
159  return false;
160  }
161 }
#define LogDebug(id)
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
bool trkLongitudinalImpactParameter(const TrackBase *track, const reco::VertexRef *pv, double cut)
bool reco::tau::qcuts::trkLongitudinalImpactParameterWrtTrack ( const Track track,
const Track leadTrack,
const reco::VertexRef pv,
double  cut 
)

DZ cut, with respect to the current lead rack.

Definition at line 164 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, and reco::TrackBase::dz().

Referenced by trkLongitudinalImpactParameterWrtTrack_cand().

165 {
166  if (!leadTrack) {
167  edm::LogError("QCutsNoValidLeadTrack") << "Lead track Ref in " <<
168  "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameterWrtTrack";
169  return false;
170  }
171  return (std::fabs(track->dz((*pv)->position()) - leadTrack->dz((*pv)->position())) <= cut);
172 }
bool reco::tau::qcuts::trkLongitudinalImpactParameterWrtTrack_cand ( const Candidate cand,
const reco::Track leadTrack,
const reco::VertexRef pv,
double  cut 
)

Definition at line 174 of file RecoTauQualityCuts.cc.

References getTrack(), HiIsolationCommonParameters_cff::track, and trkLongitudinalImpactParameterWrtTrack().

175 {
176  auto track = getTrack(cand);
177  if ( track ) return trkLongitudinalImpactParameterWrtTrack(track, leadTrack, pv, cut);
178  else return false;
179 }
bool trkLongitudinalImpactParameterWrtTrack(const Track *track, const Track *leadTrack, const reco::VertexRef *pv, double cut)
DZ cut, with respect to the current lead rack.
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
bool reco::tau::qcuts::trkPixelHits ( const Track track,
int  cut 
)

Definition at line 77 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, reco::TrackBase::hitPattern(), LogDebug, and reco::HitPattern::numberOfValidPixelHits().

Referenced by trkPixelHits_cand().

78 {
79  // For some reason, the number of hits is signed
80  LogDebug("TauQCuts") << "<trkPixelHits>: #Pxl hits = " << track->hitPattern().numberOfValidPixelHits() << ", cut = " << cut ;
81  return (track->hitPattern().numberOfValidPixelHits() >= cut);
82 }
#define LogDebug(id)
bool reco::tau::qcuts::trkPixelHits_cand ( const Candidate cand,
int  cut 
)

Definition at line 84 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, getTrack(), LogDebug, HiIsolationCommonParameters_cff::track, and trkPixelHits().

85 {
86  // For some reason, the number of hits is signed
87  auto track = getTrack(cand);
88  if ( track ) {
89  LogDebug("TauQCuts") << "<trkPixelHits_cand>: #Pxl hits = " << trkPixelHits(track, cut) << ", cut = " << cut ;
90  return trkPixelHits(track, cut);
91  } else {
92  LogDebug("TauQCuts") << "<trkPixelHits_cand>: #Pxl hits = N/A, cut = " << cut ;
93  return false;
94  }
95 }
#define LogDebug(id)
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
bool trkPixelHits(const Track *track, int cut)
bool reco::tau::qcuts::trkTrackerHits ( const Track track,
int  cut 
)

Definition at line 97 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, reco::TrackBase::hitPattern(), LogDebug, and reco::HitPattern::numberOfValidHits().

Referenced by trkTrackerHits_cand().

98 {
99  LogDebug("TauQCuts") << "<trkTrackerHits>: #Trk hits = " << track->hitPattern().numberOfValidHits() << ", cut = " << cut ;
100  return (track->hitPattern().numberOfValidHits() >= cut);
101 }
#define LogDebug(id)
bool reco::tau::qcuts::trkTrackerHits_cand ( const Candidate cand,
int  cut 
)

Definition at line 103 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, getTrack(), LogDebug, HiIsolationCommonParameters_cff::track, and trkTrackerHits().

104 {
105  auto track = getTrack(cand);
106  if ( track ) {
107  LogDebug("TauQCuts") << "<trkTrackerHits>: #Trk hits = " << track->hitPattern().numberOfValidHits() << ", cut = " << cut ;
108  return trkTrackerHits(track, cut);
109  } else {
110  LogDebug("TauQCuts") << "<trkTrackerHits>: #Trk hits = N/A, cut = " << cut ;
111  return false;
112  }
113 }
#define LogDebug(id)
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
bool trkTrackerHits(const Track *track, int cut)
bool reco::tau::qcuts::trkTransverseImpactParameter ( const Track track,
const reco::VertexRef pv,
double  cut 
)

Definition at line 115 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, reco::TrackBase::dxy(), reco::TrackBase::eta(), edm::Ref< C, T, F >::isNull(), LogDebug, reco::TrackBase::phi(), and reco::TrackBase::pt().

Referenced by trkTransverseImpactParameter_cand().

116 {
117  if ( pv->isNull() ) {
118  edm::LogError("QCutsNoPrimaryVertex") << "Primary vertex Ref in " <<
119  "RecoTauQualityCuts is invalid. - trkTransverseImpactParameter";
120  return false;
121  }
122  LogDebug("TauQCuts") << " track: Pt = " << track->pt() << ", eta = " << track->eta() << ", phi = " << track->phi() ;
123  LogDebug("TauQCuts") << " vertex: x = " << (*pv)->position().x() << ", y = " << (*pv)->position().y() << ", z = " << (*pv)->position().z() ;
124  LogDebug("TauQCuts") << "--> dxy = " << std::fabs(track->dxy((*pv)->position())) << " (cut = " << cut << ")" ;
125  return (std::fabs(track->dxy((*pv)->position())) <= cut);
126 }
#define LogDebug(id)
bool isNull() const
Checks for null.
Definition: Ref.h:248
bool reco::tau::qcuts::trkTransverseImpactParameter_cand ( const Candidate cand,
const reco::VertexRef pv,
double  cut 
)

Definition at line 128 of file RecoTauQualityCuts.cc.

References TkAlMuonSelectors_cfi::cut, getTrack(), LogDebug, HiIsolationCommonParameters_cff::track, and trkTransverseImpactParameter().

129 {
130  auto track = getTrack(cand);
131  if ( track ) {
133  } else {
134  LogDebug("TauQCuts") << "<trkTransverseImpactParameter_cand>: dXY = N/A, cut = " << cut ;
135  return false;
136  }
137 }
#define LogDebug(id)
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
bool trkTransverseImpactParameter(const Track *track, const reco::VertexRef *pv, double cut)