7 #include <boost/bind.hpp>
16 else if ( cand.gsfTrackRef().isNonnull() )
return reco::TrackBaseRef(cand.gsfTrackRef());
33 return (track->
pt() >
cut);
39 return (cand.
pt() >
cut);
45 return (cand.
et() >
cut);
58 auto track = getTrackRef(cand);
59 if ( track.isNonnull() ) {
76 auto track = getTrackRef(cand);
77 if ( track.isNonnull() ) {
89 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
90 "RecoTauQualityCuts is invalid. - trkTransverseImpactParameter";
97 return (std::fabs(track->
dxy((*pv)->position())) <=
cut);
102 auto track = getTrackRef(cand);
103 if ( track.isNonnull() ) {
114 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
115 "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameter";
122 return (std::fabs(track->
dz((*pv)->position())) <=
cut);
127 auto track = getTrackRef(cand);
128 if ( track.isNonnull() ) {
139 if ( leadTrack->isNull()) {
140 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in " <<
141 "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameterWrtTrack";
144 return (std::fabs(track->
dz((*pv)->position()) - (*leadTrack)->dz((*pv)->position())) <=
cut);
149 auto track = getTrackRef(cand);
157 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
158 "RecoTauQualityCuts is invalid. - minTrackVertexWeight";
165 return ((*pv)->trackWeight(track) >=
cut);
170 auto track = getTrackRef(cand);
171 if ( track.isNonnull() ) {
187 auto track = getTrackRef(cand);
188 if ( track.isNonnull() ) {
201 if ( !
func(track) )
return false;
209 if ( !
func(cand) )
return false;
218 RecoTauQualityCuts::CandQCutFuncMap::const_iterator
cuts = funcMap.find(cand.
particleId());
220 if ( cuts == funcMap.end() )
return false;
221 return AND_cand(cand, cuts->second);
234 std::set<std::string> passedOptionSet;
237 BOOST_FOREACH(
const std::string& option, passedOptions) {
238 passedOptionSet.insert(option);
241 unsigned int nCuts = 0;
242 auto getDouble = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) {
245 passedOptionSet.erase(
name);
250 auto getUint = [&qcuts, &passedOptionSet, &nCuts](
const std::string&
name) ->
unsigned int {
253 passedOptionSet.erase(
name);
284 if ( passedOptionSet.size() ) {
286 bool thereIsABadParameter =
false;
287 BOOST_FOREACH(
const std::string& option, passedOptionSet ) {
289 if ( option ==
"useTracksInsteadOfPFHadrons" ) {
291 if ( qcuts.
getParameter<
bool>(
"useTracksInsteadOfPFHadrons") ) {
293 <<
"The obsolete exception useTracksInsteadOfPFHadrons "
294 <<
"is set to true in the quality cut config." << std::endl;
300 thereIsABadParameter =
true;
302 unParsedOptions += option;
303 unParsedOptions +=
"\n";
305 if ( thereIsABadParameter ) {
307 <<
" The PSet passed to the RecoTauQualityCuts class had"
308 <<
" the following unrecognized options: " << std::endl
316 <<
" No options were passed to the quality cut class!" << std::endl;
327 if ( cut ==
"minTrackVertexWeight" ||
328 cut ==
"maxDeltaZ" ||
329 cut ==
"maxDeltaZToLeadTrack" ) {
335 return std::make_pair(puCuts, nonPUCuts);
348 template <
typename T>
351 const Track *track = trackRef.get();
360 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
361 "RecoTauQualityCuts is invalid. - filterTrack";
371 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in " <<
372 "RecoTauQualityCuts is invalid. - filterTrack";
417 if(trackRef.isNonnull()) {
422 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)
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.
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.