7 #include <boost/bind.hpp>
16 else if ( cand.gsfTrackRef().isNonnull() )
return reco::TrackBaseRef(cand.gsfTrackRef());
32 LogDebug(
"TauQCuts") <<
"<ptMin>: Pt = " << track->
pt() <<
", cut = " <<
cut ;
33 return (track->
pt() >
cut);
38 LogDebug(
"TauQCuts") <<
"<ptMin_cand>: Pt = " << cand.
pt() <<
", cut = " <<
cut ;
39 return (cand.
pt() >
cut);
44 LogDebug(
"TauQCuts") <<
"<etMin_cand>: Et = " << cand.
et() <<
", cut = " <<
cut ;
45 return (cand.
et() >
cut);
58 auto track = getTrackRef(cand);
59 if ( track.isNonnull() ) {
63 LogDebug(
"TauQCuts") <<
"<trkPixelHits_cand>: #Pxl hits = N/A, cut = " <<
cut ;
76 auto track = getTrackRef(cand);
77 if ( track.isNonnull() ) {
78 LogDebug(
"TauQCuts") <<
"<trkTrackerHits>: #Trk hits = " << track->hitPattern().numberOfValidHits() <<
", cut = " <<
cut ;
81 LogDebug(
"TauQCuts") <<
"<trkTrackerHits>: #Trk hits = N/A, cut = " <<
cut ;
89 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
90 "RecoTauQualityCuts is invalid. - trkTransverseImpactParameter";
93 LogDebug(
"TauQCuts") <<
" track: Pt = " << track->
pt() <<
", eta = " << track->
eta() <<
", phi = " << track->
phi() ;
94 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y() <<
", z = " << (*pv)->position().z() ;
95 LogDebug(
"TauQCuts") <<
"--> dxy = " << std::fabs(track->
dxy((*pv)->position())) <<
" (cut = " << cut <<
")" ;
96 return (std::fabs(track->
dxy((*pv)->position())) <=
cut);
101 auto track = getTrackRef(cand);
102 if ( track.isNonnull() ) {
105 LogDebug(
"TauQCuts") <<
"<trkTransverseImpactParameter_cand>: dXY = N/A, cut = " <<
cut ;
113 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
114 "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameter";
117 LogDebug(
"TauQCuts") <<
" track: Pt = " << track->
pt() <<
", eta = " << track->
eta() <<
", phi = " << track->
phi() ;
118 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y() <<
", z = " << (*pv)->position().z() ;
119 LogDebug(
"TauQCuts") <<
"--> dz = " << std::fabs(track->
dz((*pv)->position())) <<
" (cut = " << cut <<
")" ;
120 return (std::fabs(track->
dz((*pv)->position())) <=
cut);
125 auto track = getTrackRef(cand);
126 if ( track.isNonnull() ) {
129 LogDebug(
"TauQCuts") <<
"<trkLongitudinalImpactParameter_cand>: dZ = N/A, cut = " <<
cut ;
137 if ( leadTrack->isNull()) {
138 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in " <<
139 "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameterWrtTrack";
142 return (std::fabs(track->
dz((*pv)->position()) - (*leadTrack)->dz((*pv)->position())) <=
cut);
147 auto track = getTrackRef(cand);
155 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
156 "RecoTauQualityCuts is invalid. - minTrackVertexWeight";
159 LogDebug(
"TauQCuts") <<
" track: Pt = " << track->
pt() <<
", eta = " << track->
eta() <<
", phi = " << track->
phi() ;
160 LogDebug(
"TauQCuts") <<
" vertex: x = " << (*pv)->position().x() <<
", y = " << (*pv)->position().y() <<
", z = " << (*pv)->position().z() ;
161 LogDebug(
"TauQCuts") <<
"--> trackWeight = " << (*pv)->trackWeight(track) <<
" (cut = " << cut <<
")" ;
162 return ((*pv)->trackWeight(track) >=
cut);
167 auto track = getTrackRef(cand);
168 if ( track.isNonnull() ) {
171 LogDebug(
"TauQCuts") <<
"<minTrackVertexWeight_cand>: weight = N/A, cut = " <<
cut ;
184 auto track = getTrackRef(cand);
185 if ( track.isNonnull() ) {
186 LogDebug(
"TauQCuts") <<
"<trkChi2_cand>: chi^2 = " << track->normalizedChi2() <<
", cut = " <<
cut ;
189 LogDebug(
"TauQCuts") <<
"<trkChi2_cand>: chi^2 = N/A, cut = " <<
cut ;
198 if ( !func(track) )
return false;
206 if ( !func(cand) )
return false;
215 RecoTauQualityCuts::CandQCutFuncMap::const_iterator
cuts = funcMap.find(cand.
particleId());
217 if ( cuts == funcMap.end() )
return false;
218 return AND_cand(cand, cuts->second);
231 std::set<std::string> passedOptionSet;
234 BOOST_FOREACH(
const std::string& option, passedOptions) {
235 passedOptionSet.insert(option);
238 unsigned int nCuts = 0;
239 auto getDouble = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) {
242 passedOptionSet.erase(
name);
247 auto getUint = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) ->
unsigned int {
250 passedOptionSet.erase(
name);
281 if ( passedOptionSet.size() ) {
283 bool thereIsABadParameter =
false;
284 BOOST_FOREACH(
const std::string& option, passedOptionSet ) {
286 if ( option ==
"useTracksInsteadOfPFHadrons" ) {
288 if ( qcuts.
getParameter<
bool>(
"useTracksInsteadOfPFHadrons") ) {
290 <<
"The obsolete exception useTracksInsteadOfPFHadrons "
291 <<
"is set to true in the quality cut config." << std::endl;
297 thereIsABadParameter =
true;
299 unParsedOptions += option;
300 unParsedOptions +=
"\n";
302 if ( thereIsABadParameter ) {
304 <<
" The PSet passed to the RecoTauQualityCuts class had"
305 <<
" the following unrecognized options: " << std::endl
313 <<
" No options were passed to the quality cut class!" << std::endl;
324 if ( cut ==
"minTrackVertexWeight" ||
325 cut ==
"maxDeltaZ" ||
326 cut ==
"maxDeltaZToLeadTrack" ) {
332 return std::make_pair(puCuts, nonPUCuts);
345 template <
typename T>
348 const Track *track = trackRef.get();
357 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
358 "RecoTauQualityCuts is invalid. - filterTrack";
368 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in " <<
369 "RecoTauQualityCuts is invalid. - filterTrack";
414 if(trackRef.isNonnull()) {
419 if(gsfTrackRef.isNonnull()) {
T getParameter(std::string const &) const
virtual double et() const GCC11_FINAL
transverse energy
bool filterCandByType(const reco::PFCandidate &cand) const
bool trkLongitudinalImpactParameter_cand(const PFCandidate &cand, const reco::VertexRef *pv, double cut)
bool minTrackVertexWeight(const TrackBaseRef &track, const reco::VertexRef *pv, double cut)
bool trkTransverseImpactParameter_cand(const PFCandidate &cand, const reco::VertexRef *pv, double cut)
RecoTauQualityCuts(const edm::ParameterSet &qcuts)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
double minNeutralHadronEt_
reco::TrackBaseRef leadTrack_
bool minTrackVertexWeight_cand(const PFCandidate &cand, const reco::VertexRef *pv, double cut)
int numberOfValidHits() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
bool isNull() const
Checks for null.
bool etMin_cand(const PFCandidate &cand, double cut)
double phi() const
azimuthal angle of momentum vector
bool trkPixelHits(const TrackBaseRef &track, int cut)
bool filterTrack_(const T &trackRef) const
bool filterNeutralHadronCand(const reco::PFCandidate &cand) const
bool trkTransverseImpactParameter(const TrackBaseRef &track, const reco::VertexRef *pv, double cut)
static std::string const input
std::vector< CandQCutFunc > CandQCutFuncCollection
reco::TrackRef trackRef() const
bool isNonnull() const
Checks for non-null.
bool filterGammaCand(const reco::PFCandidate &cand) const
void copyFrom(ParameterSet const &from, std::string const &name)
bool isNull() const
Checks for null.
double eta() const
pseudorapidity of momentum vector
bool trkLongitudinalImpactParameterWrtTrack_cand(const PFCandidate &cand, const reco::TrackBaseRef *leadTrack, const reco::VertexRef *pv, double cut)
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
std::map< PFCandidate::ParticleType, CandQCutFuncCollection > CandQCutFuncMap
double pt() const
track transverse momentum
std::pair< edm::ParameterSet, edm::ParameterSet > factorizePUQCuts(const edm::ParameterSet &inputSet)
std::vector< TrackQCutFunc > TrackQCutFuncCollection
std::vector< std::string > getParameterNames() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
bool ptMin(const TrackBaseRef &track, double cut)
bool trkTrackerHits(const TrackBaseRef &track, int 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...
double minTrackVertexWeight_
bool trkTrackerHits_cand(const PFCandidate &cand, int cut)
bool mapAndCutByType(const PFCandidate &cand, const RecoTauQualityCuts::CandQCutFuncMap &funcMap)
double maxDeltaZToLeadTrack_
boost::function< bool(const TrackBaseRef &)> TrackQCutFunc
bool ptMin_cand(const PFCandidate &cand, double cut)
bool trkChi2_cand(const PFCandidate &cand, double cut)
double maxTransverseImpactParameter_
boost::function< bool(const PFCandidate &)> CandQCutFunc
bool trkChi2(const TrackBaseRef &track, double cut)
Particle reconstructed by the particle flow algorithm.
bool AND(const TrackBaseRef &track, const RecoTauQualityCuts::TrackQCutFuncCollection &cuts)
bool trkLongitudinalImpactParameter(const TrackBaseRef &track, const reco::VertexRef *pv, double cut)
reco::GsfTrackRef gsfTrackRef() const
bool trkPixelHits_cand(const PFCandidate &cand, int cut)
int numberOfValidPixelHits() const
void setLeadTrack(const reco::TrackRef &leadTrack) const
Update the leading track.
bool trkLongitudinalImpactParameterWrtTrack(const TrackBaseRef &track, const reco::TrackBaseRef *leadTrack, const reco::VertexRef *pv, double cut)
DZ cut, with respect to the current lead rack.
bool filterCand(const reco::PFCandidate &cand) const
Filter a single PFCandidate.
virtual ParticleType particleId() const
virtual float pt() const GCC11_FINAL
transverse momentum
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 AND_cand(const PFCandidate &cand, const RecoTauQualityCuts::CandQCutFuncCollection &cuts)
bool filterTrack(const reco::TrackBaseRef &track) const
Filter a single Track.