15 if (pfCandPtr->trackRef().isNonnull())
16 return pfCandPtr->trackRef().get();
17 else if (pfCandPtr->gsfTrackRef().isNonnull())
18 return pfCandPtr->gsfTrackRef().get();
33 return pfCandPtr->trackRef();
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 <<
")";
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;
171 std::vector<std::string> inputNames =
input.getParameterNames();
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";
238 if (
cand.charge() == 0)
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");
bool filterTrack_(const reco::Track *track) const
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
RecoTauQualityCuts(const edm::ParameterSet &qcuts)
static void fillDescriptions(edm::ParameterSetDescription &descriptions)
Declare all parameters read from python config file.
bool filterCandByType(const reco::Candidate &cand) const
bool filterGammaCand(const reco::Candidate &cand) const
double minNeutralHadronEt_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
bool filterNeutralHadronCand(const reco::Candidate &cand) const
bool isNonnull() const
Checks for non-null.
Log< level::Error, false > LogError
const reco::VertexRef vertexRef() const
bool filterTrack(const reco::TrackBaseRef &track) const
Filter a single Track.
InputIterator leadCand(InputIterator begin, InputIterator end)
key_type key() const
Accessor for product key.
static std::string const input
std::vector< CandQCutFunc > CandQCutFuncCollection
const PVAssociationQuality pvAssociationQuality() const
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...
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
Abs< T >::type abs(const T &t)
std::pair< edm::ParameterSet, edm::ParameterSet > factorizePUQCuts(const edm::ParameterSet &inputSet)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool filterChargedCand(const reco::Candidate &cand) const
or a single charged candidate
bool isNull() const
Checks for null.
double minTrackVertexWeight_
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
double pt() const override
transverse momentum
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
double maxDeltaZToLeadTrack_
double maxTransverseImpactParameter_
bool filterCand(const reco::Candidate &cand) const
Filter a single Candidate.
virtual float dxy() const
dxy with respect to the PV ref
void setLeadTrack(const reco::Track &leadTrack)
Update the leading track.
virtual float dz(size_t ipv=0) const
dz with respect to the PV[ipv]
std::vector< std::string > getParameterNames() const
bool minPackedCandVertexWeight(const pat::PackedCandidate &pCand, const reco::VertexRef *pv, double cut)
double phi() const override
momentum azimuthal angle
virtual const reco::Track & pseudoTrack() const
const reco::Track * leadTrack_
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.