12 const PFCandidate* pfCandPtr =
dynamic_cast<const PFCandidate*
>(&cand);
15 if (pfCandPtr->trackRef().isNonnull())
16 return pfCandPtr->trackRef().get();
17 else if (pfCandPtr->gsfTrackRef().isNonnull())
18 return pfCandPtr->gsfTrackRef().get();
31 const PFCandidate* pfCandPtr =
dynamic_cast<const PFCandidate*
>(&cand);
33 return pfCandPtr->trackRef();
39 const PFCandidate* pfCandPtr =
dynamic_cast<const PFCandidate*
>(&cand);
57 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
58 <<
"RecoTauQualityCuts is invalid. - minPackedCandVertexWeight";
70 LogDebug(
"TauQCuts") <<
" packedCand: Pt = " << pCand.
pt() <<
", eta = " << pCand.
eta()
71 <<
", phi = " << pCand.
phi();
72 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y()
73 <<
", z = " << (*pv)->position().z();
74 LogDebug(
"TauQCuts") <<
"--> trackWeight from packedCand = " << weight <<
" (cut = " << cut <<
")";
75 return (weight >= cut);
86 std::set<std::string> passedOptionSet;
89 for (
auto const& option : passedOptions) {
90 passedOptionSet.insert(option);
93 unsigned int nCuts = 0;
94 auto getDouble = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) {
97 passedOptionSet.erase(
name);
102 auto getUint = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) ->
unsigned int {
105 passedOptionSet.erase(
name);
134 if (!passedOptionSet.empty()) {
136 bool thereIsABadParameter =
false;
137 for (
auto const& option : passedOptionSet) {
139 if (option ==
"useTracksInsteadOfPFHadrons") {
141 if (qcuts.
getParameter<
bool>(
"useTracksInsteadOfPFHadrons")) {
142 throw cms::Exception(
"DontUseTracksInQcuts") <<
"The obsolete exception useTracksInsteadOfPFHadrons "
143 <<
"is set to true in the quality cut config." << std::endl;
149 thereIsABadParameter =
true;
151 unParsedOptions += option;
152 unParsedOptions +=
"\n";
154 if (thereIsABadParameter) {
155 throw cms::Exception(
"BadQualityCutConfig") <<
" The PSet passed to the RecoTauQualityCuts class had"
156 <<
" the following unrecognized options: " << std::endl
163 throw cms::Exception(
"BadQualityCutConfig") <<
" No options were passed to the quality cut class!" << std::endl;
172 for (
auto const&
cut : inputNames) {
173 if (
cut ==
"minTrackVertexWeight" ||
cut ==
"maxDeltaZ" ||
cut ==
"maxDeltaZToLeadTrack") {
179 return std::make_pair(puCuts, nonPUCuts);
213 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
214 <<
"RecoTauQualityCuts is invalid. - filterTrack";
225 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in "
226 <<
"RecoTauQualityCuts is invalid. - filterTrack";
241 if (pCand ==
nullptr)
247 if (
track !=
nullptr) {
254 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in "
255 <<
"RecoTauQualityCuts is invalid. - filterChargedCand";
266 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in "
267 <<
"RecoTauQualityCuts is invalid. - filterChargedCand";
313 auto trackRef = getTrackRef(cand);
316 if (trackRef.isNonnull()) {
319 auto gsfTrackRef = getGsfTrackRef(cand);
320 if (gsfTrackRef.isNonnull())
322 else if (cand.
charge() != 0) {
348 desc_signalQualityCuts.
add<
double>(
"minTrackPt", 0.5);
349 desc_signalQualityCuts.
add<
double>(
"maxTrackChi2", 100.0);
350 desc_signalQualityCuts.
add<
double>(
"maxTransverseImpactParameter", 0.1);
351 desc_signalQualityCuts.
add<
double>(
"maxDeltaZ", 0.4);
352 desc_signalQualityCuts.
add<
double>(
"maxDeltaZToLeadTrack", -1.0);
353 desc_signalQualityCuts.
add<
double>(
"minTrackVertexWeight", -1.0);
354 desc_signalQualityCuts.
add<
unsigned int>(
"minTrackPixelHits", 0);
355 desc_signalQualityCuts.
add<
unsigned int>(
"minTrackHits", 3);
356 desc_signalQualityCuts.
add<
double>(
"minGammaEt", 1.0);
357 desc_signalQualityCuts.
addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
358 desc_signalQualityCuts.
add<
double>(
"minNeutralHadronEt", 30.0);
361 desc_isolationQualityCuts.
add<
double>(
"minTrackPt", 1.0);
362 desc_isolationQualityCuts.
add<
double>(
"maxTrackChi2", 100.0);
363 desc_isolationQualityCuts.
add<
double>(
"maxTransverseImpactParameter", 0.03);
364 desc_isolationQualityCuts.
add<
double>(
"maxDeltaZ", 0.2);
365 desc_isolationQualityCuts.
add<
double>(
"maxDeltaZToLeadTrack", -1.0);
366 desc_isolationQualityCuts.
add<
double>(
"minTrackVertexWeight", -1.0);
367 desc_isolationQualityCuts.
add<
unsigned int>(
"minTrackPixelHits", 0);
368 desc_isolationQualityCuts.
add<
unsigned int>(
"minTrackHits", 8);
369 desc_isolationQualityCuts.
add<
double>(
"minGammaEt", 1.5);
370 desc_isolationQualityCuts.
addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
373 desc_vxAssocQualityCuts.
add<
double>(
"minTrackPt", 0.5);
374 desc_vxAssocQualityCuts.add<
double>(
"maxTrackChi2", 100.0);
375 desc_vxAssocQualityCuts.add<
double>(
"maxTransverseImpactParameter", 0.1);
376 desc_vxAssocQualityCuts.add<
double>(
"minTrackVertexWeight", -1.0);
377 desc_vxAssocQualityCuts.add<
unsigned int>(
"minTrackPixelHits", 0);
378 desc_vxAssocQualityCuts.add<
unsigned int>(
"minTrackHits", 3);
379 desc_vxAssocQualityCuts.add<
double>(
"minGammaEt", 1.0);
380 desc_vxAssocQualityCuts.addOptional<
bool>(
"useTracksInsteadOfPFHadrons");
386 desc_qualityCuts.
add<
std::string>(
"pvFindingAlgo",
"closestInDeltaZ");
387 desc_qualityCuts.
add<
bool>(
"vertexTrackFiltering",
false);
388 desc_qualityCuts.
add<
bool>(
"recoverLeadingTrk",
false);
389 desc_qualityCuts.
add<
std::string>(
"leadingTrkOrPFCandOption",
"leadPFCand");
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
value_type const * get() const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
bool isNonnull() const
Checks for non-null.
RecoTauQualityCuts(const edm::ParameterSet &qcuts)
static void fillDescriptions(edm::ParameterSetDescription &descriptions)
Declare all parameters read from python config file.
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
virtual double et() const =0
transverse energy
double minNeutralHadronEt_
int numberOfValidHits() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
key_type key() const
Accessor for product key.
bool filterCand(const reco::Candidate &cand) const
Filter a single Candidate.
Log< level::Error, false > LogError
const reco::VertexRef vertexRef() const
InputIterator leadCand(InputIterator begin, InputIterator end)
static std::string const input
std::vector< CandQCutFunc > CandQCutFuncCollection
void copyFrom(ParameterSet const &from, std::string const &name)
double eta() const override
momentum pseudorapidity
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
const PVAssociationQuality pvAssociationQuality() const
bool filterCandByType(const reco::Candidate &cand) const
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
virtual const reco::Track & pseudoTrack() const
virtual int charge() const =0
electric charge
T const * get() const
Returns C++ pointer to the item.
std::pair< edm::ParameterSet, edm::ParameterSet > factorizePUQCuts(const edm::ParameterSet &inputSet)
std::vector< std::string > getParameterNames() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isNull() const
Checks for null.
bool filterTrack_(const reco::Track *track) const
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
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...
double minTrackVertexWeight_
virtual int pdgId() const =0
PDG identifier.
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
double pt() const override
transverse momentum
bool filterChargedCand(const reco::Candidate &cand) const
or a single charged candidate
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
double maxDeltaZToLeadTrack_
T getParameter(std::string const &) const
double maxTransverseImpactParameter_
bool filterNeutralHadronCand(const reco::Candidate &cand) const
int numberOfValidPixelHits() const
bool filterGammaCand(const reco::Candidate &cand) const
void setLeadTrack(const reco::Track &leadTrack)
Update the leading track.
virtual float dxy() const
dxy with respect to the PV ref
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
bool minPackedCandVertexWeight(const pat::PackedCandidate &pCand, const reco::VertexRef *pv, double cut)
bool filterTrack(const reco::TrackBaseRef &track) const
Filter a single Track.
double phi() const override
momentum azimuthal angle
const reco::Track * leadTrack_