7 #include <boost/bind.hpp>
16 else if ( cand.gsfTrackRef().isNonnull() )
return reco::TrackBaseRef(cand.gsfTrackRef());
27 return (track->
pt() >
cut);
33 return (cand.
pt() >
cut);
39 return (cand.
et() >
cut);
52 auto track = getTrackRef(cand);
53 if ( track.isNonnull() ) {
70 auto track = getTrackRef(cand);
71 if ( track.isNonnull() ) {
83 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
84 "RecoTauQualityCuts is invalid. - trkTransverseImpactParameter";
91 return (std::fabs(track->
dxy((*pv)->position())) <=
cut);
96 auto track = getTrackRef(cand);
97 if ( track.isNonnull() ) {
108 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
109 "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameter";
116 return (std::fabs(track->
dz((*pv)->position())) <=
cut);
121 auto track = getTrackRef(cand);
122 if ( track.isNonnull() ) {
133 if ( leadTrack->isNull()) {
134 edm::LogError(
"QCutsNoValidLeadTrack") <<
"Lead track Ref in " <<
135 "RecoTauQualityCuts is invalid. - trkLongitudinalImpactParameterWrtTrack";
138 return (std::fabs(track->
dz((*pv)->position()) - (*leadTrack)->dz((*pv)->position())) <=
cut);
143 auto track = getTrackRef(cand);
151 edm::LogError(
"QCutsNoPrimaryVertex") <<
"Primary vertex Ref in " <<
152 "RecoTauQualityCuts is invalid. - minTrackVertexWeight";
159 return ((*pv)->trackWeight(track) >=
cut);
164 auto track = getTrackRef(cand);
165 if ( track.isNonnull() ) {
181 auto track = getTrackRef(cand);
182 if ( track.isNonnull() ) {
195 if ( !
func(track) )
return false;
203 if ( !
func(cand) )
return false;
212 RecoTauQualityCuts::CandQCutFuncMap::const_iterator
cuts = funcMap.find(cand.
particleId());
214 if ( cuts == funcMap.end() )
return false;
215 return AND_cand(cand, cuts->second);
228 std::set<std::string> passedOptionSet;
231 BOOST_FOREACH(
const std::string& option, passedOptions) {
232 passedOptionSet.insert(option);
236 if ( qcuts.
exists(
"minTrackPt") ) {
238 passedOptionSet.erase(
"minTrackPt");
241 if ( qcuts.
exists(
"maxTrackChi2") ) {
243 passedOptionSet.erase(
"maxTrackChi2");
246 if ( qcuts.
exists(
"minTrackPixelHits") ) {
247 uint32_t minTrackPixelHits = qcuts.
getParameter<uint32_t>(
"minTrackPixelHits");
248 if ( minTrackPixelHits >= 1 ) {
251 passedOptionSet.erase(
"minTrackPixelHits");
254 if ( qcuts.
exists(
"minTrackHits") ) {
255 uint32_t minTrackHits = qcuts.
getParameter<uint32_t>(
"minTrackHits");
256 if ( minTrackHits >= 1 ) {
259 passedOptionSet.erase(
"minTrackHits");
264 if ( qcuts.
exists(
"maxTransverseImpactParameter") ) {
266 passedOptionSet.erase(
"maxTransverseImpactParameter");
269 if ( qcuts.
exists(
"maxDeltaZ") ) {
271 passedOptionSet.erase(
"maxDeltaZ");
274 if ( qcuts.
exists(
"maxDeltaZToLeadTrack") ) {
276 passedOptionSet.erase(
"maxDeltaZToLeadTrack");
280 if ( qcuts.
exists(
"minTrackVertexWeight") ) {
282 if ( minTrackVertexWeight > -1. ) {
285 passedOptionSet.erase(
"minTrackVertexWeight");
289 if ( qcuts.
exists(
"minGammaEt") ) {
291 passedOptionSet.erase(
"minGammaEt");
295 if ( qcuts.
exists(
"minNeutralHadronEt") ) {
297 passedOptionSet.erase(
"minNeutralHadronEt");
301 if ( passedOptionSet.size() ) {
303 bool thereIsABadParameter =
false;
304 BOOST_FOREACH(
const std::string& option, passedOptionSet ) {
306 if ( option ==
"useTracksInsteadOfPFHadrons" ) {
308 if ( qcuts.
getParameter<
bool>(
"useTracksInsteadOfPFHadrons") ) {
310 <<
"The obsolete exception useTracksInsteadOfPFHadrons "
311 <<
"is set to true in the quality cut config." << std::endl;
317 thereIsABadParameter =
true;
319 unParsedOptions += option;
320 unParsedOptions +=
"\n";
322 if ( thereIsABadParameter ) {
324 <<
" The PSet passed to the RecoTauQualityCuts class had"
325 <<
" the following unrecognized options: " << std::endl
331 size_t nCuts = chargedHadronCuts.size() + gammaCuts.size() + neutralHadronCuts.size() +
trackQCuts_.size();
334 <<
" No options were passed to the quality cut class!" << std::endl;
359 if ( cut ==
"minTrackVertexWeight" ||
360 cut ==
"maxDeltaZ" ||
361 cut ==
"maxDeltaZToLeadTrack" ) {
367 return std::make_pair(puCuts, nonPUCuts);
377 auto track = getTrackRef(cand);
T getParameter(std::string const &) const
TrackQCutFuncCollection trackQCuts_
virtual double et() const GCC11_FINAL
transverse energy
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)
TrackQCutFunc trackPredicate_
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)
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 etMin_cand(const PFCandidate &cand, double cut)
bool trkPixelHits(const TrackBaseRef &track, int cut)
bool trkTransverseImpactParameter(const TrackBaseRef &track, const reco::VertexRef *pv, double cut)
static std::string const input
std::vector< CandQCutFunc > CandQCutFuncCollection
bool isNonnull() const
Checks for non-null.
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
CandQCutFunc candPredicate_
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...
bool trkTrackerHits_cand(const PFCandidate &cand, int cut)
bool mapAndCutByType(const PFCandidate &cand, const RecoTauQualityCuts::CandQCutFuncMap &funcMap)
boost::function< bool(const TrackBaseRef &)> TrackQCutFunc
bool ptMin_cand(const PFCandidate &cand, double cut)
bool trkChi2_cand(const PFCandidate &cand, double cut)
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)
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.
CandQCutFuncMap candQCuts_
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.