|
![CMS Logo](/cmsdoxygen/common/rightImage.jpg) |
Go to the documentation of this file.
16 if (pfCandPtr->trackRef().isNonnull())
17 return pfCandPtr->trackRef().get();
18 else if (pfCandPtr->gsfTrackRef().isNonnull())
19 return pfCandPtr->gsfTrackRef().get();
34 return pfCandPtr->trackRef();
58 LogDebug(
"TauQCuts") <<
"<ptMin>: Pt = " <<
track->pt() <<
", cut = " <<
cut;
63 LogDebug(
"TauQCuts") <<
"<ptMin_cand>: Pt = " <<
cand.pt() <<
", cut = " <<
cut;
68 LogDebug(
"TauQCuts") <<
"<etMin_cand>: Et = " <<
cand.et() <<
", cut = " <<
cut;
74 LogDebug(
"TauQCuts") <<
"<trkPixelHits>: #Pxl hits = " <<
track->hitPattern().numberOfValidPixelHits()
76 return (
track->hitPattern().numberOfValidPixelHits() >=
cut);
86 LogDebug(
"TauQCuts") <<
"<trkPixelHits_cand>: #Pxl hits = N/A, cut = " <<
cut;
92 LogDebug(
"TauQCuts") <<
"<trkTrackerHits>: #Trk hits = " <<
track->hitPattern().numberOfValidHits()
94 return (
track->hitPattern().numberOfValidHits() >=
cut);
100 LogDebug(
"TauQCuts") <<
"<trkTrackerHits>: #Trk hits = " <<
track->hitPattern().numberOfValidHits()
101 <<
", cut = " <<
cut;
104 LogDebug(
"TauQCuts") <<
"<trkTrackerHits>: #Trk hits = N/A, cut = " <<
cut;
111 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
112 <<
"RecoTauQualityCuts is invalid. - trkTransverseImpactParameter";
116 <<
", phi = " <<
track->phi();
117 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y()
118 <<
", z = " << (*pv)->position().z();
119 LogDebug(
"TauQCuts") <<
"--> dxy = " << std::fabs(
track->dxy((*pv)->position())) <<
" (cut = " <<
cut <<
")";
120 return (std::fabs(
track->dxy((*pv)->position())) <=
cut);
128 LogDebug(
"TauQCuts") <<
"<trkTransverseImpactParameter_cand>: dXY = N/A, cut = " <<
cut;
135 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
136 <<
"RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameter";
140 <<
", phi = " <<
track->phi();
141 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y()
142 <<
", z = " << (*pv)->position().z();
143 LogDebug(
"TauQCuts") <<
"--> dz = " << std::fabs(
track->dz((*pv)->position())) <<
" (cut = " <<
cut <<
")";
144 return (std::fabs(
track->dz((*pv)->position())) <=
cut);
152 LogDebug(
"TauQCuts") <<
"<trkLongitudinalImpactParameter_cand>: dZ = N/A, cut = " <<
cut;
164 <<
"Lead track Ref in "
165 <<
"RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameterWrtTrack";
168 return (std::fabs(
track->dz((*pv)->position()) -
leadTrack->dz((*pv)->position())) <=
cut);
184 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
185 <<
"RecoTauQualityCuts is invalid. - minTrackVertexWeight";
189 <<
", phi = " <<
track->phi();
190 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y()
191 <<
", z = " << (*pv)->position().z();
192 LogDebug(
"TauQCuts") <<
"--> trackWeight = " << (*pv)->trackWeight(
track) <<
" (cut = " <<
cut <<
")";
193 return ((*pv)->trackWeight(
track) >=
cut);
198 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
199 <<
"RecoTauQualityCuts is invalid. - minTrackVertexWeight";
203 <<
", phi = " <<
track->phi();
204 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y()
205 <<
", z = " << (*pv)->position().z();
206 LogDebug(
"TauQCuts") <<
"--> trackWeight = " << (*pv)->trackWeight(
track) <<
" (cut = " <<
cut <<
")";
207 return ((*pv)->trackWeight(
track) >=
cut);
212 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
213 <<
"RecoTauQualityCuts is invalid. - minPackedCandVertexWeight";
225 LogDebug(
"TauQCuts") <<
" packedCand: Pt = " << pCand.
pt() <<
", eta = " << pCand.
eta()
226 <<
", phi = " << pCand.
phi();
227 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y()
228 <<
", z = " << (*pv)->position().z();
229 LogDebug(
"TauQCuts") <<
"--> trackWeight from packedCand = " <<
weight <<
" (cut = " <<
cut <<
")";
235 if (
track.isNonnull()) {
238 auto gsfTrack = getGsfTrackRef(
cand);
239 if (gsfTrack.isNonnull()) {
244 if (pCand !=
nullptr &&
cand.charge() != 0) {
247 LogDebug(
"TauQCuts") <<
"<minTrackVertexWeight_cand>: weight = N/A, cut = " <<
cut;
252 LogDebug(
"TauQCuts") <<
"<trkChi2>: chi^2 = " <<
track->normalizedChi2() <<
", cut = " <<
cut;
253 return (
track->normalizedChi2() <=
cut);
259 LogDebug(
"TauQCuts") <<
"<trkChi2_cand>: chi^2 = " <<
track->normalizedChi2() <<
", cut = " <<
cut;
262 LogDebug(
"TauQCuts") <<
"<trkChi2_cand>: chi^2 = N/A, cut = " <<
cut;
287 RecoTauQualityCuts::CandQCutFuncMap::const_iterator
cuts = funcMap.find(
std::abs(
cand.pdgId()));
289 if (
cuts == funcMap.end())
303 std::set<std::string> passedOptionSet;
306 for (
auto const&
option : passedOptions) {
307 passedOptionSet.insert(
option);
310 unsigned int nCuts = 0;
311 auto getDouble = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) {
314 passedOptionSet.erase(
name);
319 auto getUint = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) ->
unsigned int {
322 passedOptionSet.erase(
name);
351 if (!passedOptionSet.empty()) {
353 bool thereIsABadParameter =
false;
354 for (
auto const&
option : passedOptionSet) {
356 if (
option ==
"useTracksInsteadOfPFHadrons") {
358 if (qcuts.
getParameter<
bool>(
"useTracksInsteadOfPFHadrons")) {
359 throw cms::Exception(
"DontUseTracksInQcuts") <<
"The obsolete exception useTracksInsteadOfPFHadrons "
360 <<
"is set to true in the quality cut config." << std::endl;
366 thereIsABadParameter =
true;
368 unParsedOptions +=
option;
369 unParsedOptions +=
"\n";
371 if (thereIsABadParameter) {
372 throw cms::Exception(
"BadQualityCutConfig") <<
" The PSet passed to the RecoTauQualityCuts class had"
373 <<
" the following unrecognized options: " << std::endl
380 throw cms::Exception(
"BadQualityCutConfig") <<
" No options were passed to the quality cut class!" << std::endl;
388 std::vector<std::string> inputNames =
input.getParameterNames();
389 for (
auto const&
cut : inputNames) {
390 if (
cut ==
"minTrackVertexWeight" ||
cut ==
"maxDeltaZ" ||
cut ==
"maxDeltaZToLeadTrack") {
396 return std::make_pair(puCuts, nonPUCuts);
430 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
431 <<
"RecoTauQualityCuts is invalid. - filterTrack";
442 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in "
443 <<
"RecoTauQualityCuts is invalid. - filterTrack";
455 if (
cand.charge() == 0)
458 if (pCand ==
nullptr)
464 if (
track !=
nullptr) {
471 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
472 <<
"RecoTauQualityCuts is invalid. - filterChargedCand";
483 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in "
484 <<
"RecoTauQualityCuts is invalid. - filterChargedCand";
530 auto trackRef = getTrackRef(
cand);
533 if (trackRef.isNonnull()) {
536 auto gsfTrackRef = getGsfTrackRef(
cand);
537 if (gsfTrackRef.isNonnull())
539 else if (
cand.charge() != 0) {
bool filterNeutralHadronCand(const reco::Candidate &cand) const
void copyFrom(ParameterSet const &from, std::string const &name)
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
const reco::VertexRef vertexRef() const
static const std::string input
double maxDeltaZToLeadTrack_
bool minPackedCandVertexWeight(const pat::PackedCandidate &pCand, const reco::VertexRef *pv, double cut)
bool filterTrack_(const reco::Track *track) const
bool trkLongitudinalImpactParameter(const TrackBase *track, const reco::VertexRef *pv, double cut)
bool isNull() const
Checks for null.
InputIterator leadCand(InputIterator begin, InputIterator end)
bool minTrackVertexWeight(const TrackBaseRef &track, const reco::VertexRef *pv, double cut)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
bool trkLongitudinalImpactParameterWrtTrack(const Track *track, const Track *leadTrack, const reco::VertexRef *pv, double cut)
DZ cut, with respect to the current lead rack.
const PVAssociationQuality pvAssociationQuality() const
std::vector< CandQCutFunc > CandQCutFuncCollection
bool filterCand(const reco::Candidate &cand) const
Filter a single Candidate.
const reco::Track * leadTrack_
std::vector< TrackQCutFunc > TrackQCutFuncCollection
bool trkLongitudinalImpactParameter_cand(const Candidate &cand, const reco::VertexRef *pv, double cut)
bool etMin_cand(const Candidate &cand, double cut)
bool trkChi2_cand(const Candidate &cand, double cut)
bool trkChi2(const Track *track, double cut)
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
bool ptMin(const TrackBaseRef &track, double cut)
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
bool mapAndCutByType(const Candidate &cand, const RecoTauQualityCuts::CandQCutFuncMap &funcMap)
bool trkPixelHits_cand(const Candidate &cand, int cut)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
bool filterChargedCand(const reco::Candidate &cand) const
or a single charged candidate
double pt() const override
transverse momentum
bool trkTransverseImpactParameter(const Track *track, const reco::VertexRef *pv, double cut)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
virtual const reco::Track & pseudoTrack() const
bool isNonnull() const
Checks for non-null.
std::vector< std::string > getParameterNames() const
bool trkTrackerHits(const Track *track, int cut)
double phi() const override
momentum azimuthal angle
bool trkTrackerHits_cand(const Candidate &cand, int cut)
bool AND(const TrackBaseRef &track, const RecoTauQualityCuts::TrackQCutFuncCollection &cuts)
bool filterTrack(const reco::TrackBaseRef &track) const
Filter a single Track.
bool ptMin_cand(const Candidate &cand, double cut)
std::pair< edm::ParameterSet, edm::ParameterSet > factorizePUQCuts(const edm::ParameterSet &inputSet)
double maxTransverseImpactParameter_
T getParameter(std::string const &) const
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
bool minTrackVertexWeight_cand(const Candidate &cand, const reco::VertexRef *pv, double cut)
virtual float dxy() const
dxy with respect to the PV ref
RecoTauQualityCuts(const edm::ParameterSet &qcuts)
void setLeadTrack(const reco::Track &leadTrack)
Update the leading track.
bool filterGammaCand(const reco::Candidate &cand) const
bool trkTransverseImpactParameter_cand(const Candidate &cand, const reco::VertexRef *pv, double cut)
int numberOfValidPixelHits() const
key_type key() const
Accessor for product key.
Abs< T >::type abs(const T &t)
bool filterCandByType(const reco::Candidate &cand) const
int numberOfValidHits() const
bool AND_cand(const Candidate &cand, const RecoTauQualityCuts::CandQCutFuncCollection &cuts)
std::map< int, CandQCutFuncCollection > CandQCutFuncMap
double minNeutralHadronEt_
bool trkPixelHits(const Track *track, int cut)
double minTrackVertexWeight_
double eta() const override
momentum pseudorapidity
bool trkLongitudinalImpactParameterWrtTrack_cand(const Candidate &cand, const reco::Track *leadTrack, const reco::VertexRef *pv, double cut)