30 namespace reco {
namespace tau {
40 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons,
41 const std::vector<RecoTauPiZero>& piZeros,
42 const std::vector<CandidatePtr>& regionalExtras)
const override;
84 "signalConeChargedHadrons")),
86 pset.getParameter<
std::
string>(
"isoConeChargedHadrons")),
88 pset.getParameter<
std::
string>(
"signalConePiZeros")),
90 pset.getParameter<
std::
string>(
"signalConePiZeros")),
92 pset.getParameter<
std::
string>(
"isoConePiZeros")),
94 pset.getParameter<
std::
string>(
"signalConeNeutralHadrons")),
96 pset.getParameter<
std::
string>(
"isoConeNeutralHadrons")),
98 pset.getParameter<
int>(
"maxSignalConeChargedHadrons")),
100 pset.getParameter<double>(
"minAbsPhotonSumPt_insideSignalCone")),
102 pset.getParameter<double>(
"minRelPhotonSumPt_insideSignalCone"))
121 for(
auto const& ptr :
flattenPiZeros(piZerosBegin, piZerosEnd) ) {
140 charge += pfCh->charge();
142 charge = charge==0 ? leadCharge :
charge;
153 double photonSumPt_insideSignalCone = 0.;
154 double photonSumPt_outsideSignalCone = 0.;
155 int numPhotons = piZero.numberOfDaughters();
156 for(
int idxPhoton = 0; idxPhoton < numPhotons; ++idxPhoton) {
160 photonSumPt_insideSignalCone += photon->
pt();
162 photonSumPt_outsideSignalCone += photon->
pt();
165 if( photonSumPt_insideSignalCone > minAbsPhotonSumPt_insideSignalCone || photonSumPt_insideSignalCone > (minRelPhotonSumPt_insideSignalCone*aTau.
pt()) ||
166 photonSumPt_outsideSignalCone > minAbsPhotonSumPt_outsideSignalCone || photonSumPt_outsideSignalCone > (minRelPhotonSumPt_outsideSignalCone*aTau.
pt()) ) ++
nPiZeros;
171 unsigned int nCharged = pfChs.size();
173 unsigned int trackIndex = (nCharged - 1)*(maxPiZeros + 1);
189 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons,
190 const std::vector<RecoTauPiZero>& piZeros,
191 const std::vector<CandidatePtr>& regionalExtras)
const {
196 using namespace cone;
209 typedef std::vector<CandidatePtr>
CandPtrs;
247 CandPtrs::iterator leadPFCH_iter =
248 std::find_if(pfchs.begin(), pfchs.end(), matchingConeFilter);
250 if (leadPFCH_iter != pfchs.end()) {
251 leadPFCH = *leadPFCH_iter;
257 return output.release();
262 CandPtrs::iterator leadPFGamma_iter =
263 std::find_if(pfGammas.begin(), pfGammas.end(), matchingConeFilter);
265 if (leadPFGamma_iter != pfGammas.end()) {
266 leadPFGamma = *leadPFGamma_iter;
274 leadPFCand = leadPFCH;
278 leadPFCand = leadPFGamma;
281 leadPFCand = leadPFCH;
321 RegionalJunkConeAndIdFilter pfChargedJunk(
326 RegionalJunkConeAndIdFilter pfGammaJunk(
331 RegionalJunkConeAndIdFilter pfNeutralJunk(
338 signalConePFCHFilter, pfchs.begin(), pfchs.end());
340 signalConePFCHFilter, pfchs.end(), pfchs.end());
341 CandPtrs signalPFCHs;
342 int numSignalPFCHs = 0;
343 CandPtrs isolationPFCHs;
344 int numIsolationPFCHs = 0;
345 for (
CandPtrDRFilterIter iter = signalPFCHCands_begin; iter != signalPFCHCands_end; ++iter ) {
348 signalPFCHs.push_back(*iter);
353 isolationPFCHs.push_back(*iter);
357 CandPtrs::const_iterator signalPFCHs_begin = signalPFCHs.begin();
358 CandPtrs::const_iterator signalPFCHs_end = signalPFCHs.end();
362 signalPFCHCands_begin, signalPFCHCands_end);
363 std::vector<reco::RecoTauPiZero> cleanPiZeros = piZeroXCleaner(piZeros);
369 auto isolationPFCHCands_begin(
370 boost::make_filter_iterator(
372 pfchs.begin(), pfchs.end()));
373 auto isolationPFCHCands_end(
374 boost::make_filter_iterator(
376 pfchs.end(), pfchs.end()));
377 for (
auto iter = isolationPFCHCands_begin; iter != isolationPFCHCands_end; ++iter ) {
379 isolationPFCHs.push_back(*iter);
382 CandPtrs::const_iterator isolationPFCHs_begin = isolationPFCHs.begin();
383 CandPtrs::const_iterator isolationPFCHs_end = isolationPFCHs.end();
388 signalPFCHs_begin, signalPFCHs_end);
392 boost::make_filter_iterator(
394 pfnhs.begin(), pfnhs.end()),
395 boost::make_filter_iterator(
397 pfnhs.end(), pfnhs.end()));
402 cleanPiZeros.begin(), cleanPiZeros.end()),
404 cleanPiZeros.end(), cleanPiZeros.end()));
409 isolationPFCHs_begin, isolationPFCHs_end);
414 boost::make_filter_iterator(
415 pfChargedJunk, regionalJunk.begin(), regionalJunk.end()),
416 boost::make_filter_iterator(
417 pfChargedJunk, regionalJunk.end(), regionalJunk.end())
423 boost::make_filter_iterator(
425 pfnhs.begin(), pfnhs.end()),
426 boost::make_filter_iterator(
428 pfnhs.end(), pfnhs.end()));
433 boost::make_filter_iterator(
434 pfNeutralJunk, regionalJunk.begin(), regionalJunk.end()),
435 boost::make_filter_iterator(
436 pfNeutralJunk, regionalJunk.end(), regionalJunk.end())
444 cleanPiZeros.end()));
449 boost::make_filter_iterator(
450 pfGammaJunk, regionalJunk.begin(), regionalJunk.end()),
451 boost::make_filter_iterator(
452 pfGammaJunk, regionalJunk.end(), regionalJunk.end())
458 std::auto_ptr<reco::PFTau> tauPtr = tau.
get(
false);
463 tauPtr->setVertex(primaryVertexRef->position());
471 output.push_back(tauPtr);
472 return output.release();
479 "RecoTauBuilderConePlugin");
reco::VertexRef primaryVertex(const reco::JetBaseRef &jet) const
Get primary vertex associated to this jet.
std::vector< CandidatePtr > pfCandidatesByPdgId(const Jet &jet, int pdgId, bool sort=true)
static AlgebraicMatrix initialize()
std::auto_ptr< reco::PFTau > get(bool setupLeadingCandidates=true)
bool isNonnull() const
Checks for non-null.
return_type operator()(const reco::JetBaseRef &jet, const std::vector< reco::PFRecoTauChargedHadron > &chargedHadrons, const std::vector< RecoTauPiZero > &piZeros, const std::vector< CandidatePtr > ®ionalExtras) const override
bool usePFLeptonsAsChargedHadrons_
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
void setleadChargedHadrCand(const T &cand)
Set leading PFChargedHadron candidate.
JetFunc isoConeChargedHadrons_
int maxSignalConeChargedHadrons_
ParameterSet const & getParameterSet(ParameterSetID const &id)
void setleadNeutralCand(const T &cand)
Set leading PFGamma candidate.
boost::filter_iterator< PiZeroDRFilter, std::vector< RecoTauPiZero >::const_iterator > PiZeroDRFilterIter
boost::ptr_vector< reco::PFTau > output_type
double pt() const final
transverse momentum
std::auto_ptr< output_type > return_type
int charge() const final
electric charge
RecoTauBuilderConePlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
minRelPhotonSumPt_outsideSignalCone
std::vector< CandidatePtr > pfChargedCands(const Jet &jet, bool sort=true)
Extract all non-neutral candidates from a PFJet.
JetFunc isoConeNeutralHadrons_
StringObjectFunction< reco::PFTau > signalConeSizeToStore_
std::vector< CandidatePtr > flattenPiZeros(const std::vector< RecoTauPiZero >::const_iterator &, const std::vector< RecoTauPiZero >::const_iterator &)
Flatten a list of pi zeros into a list of there constituent PFCandidates.
void addPiZeros(Region region, const InputIterator &begin, const InputIterator &end)
Add a list of pizeros to the input collection.
void setCharge(Charge q) final
set electric charge
boost::filter_iterator< CandPtrDRFilter, std::vector< CandidatePtr >::const_iterator > CandPtrDRFilterIter
std::vector< reco::CandidatePtr > CandPtrs
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
const CandidatePtr & leadChargedHadrCand() const
const std::vector< RecoTauPiZero > & signalPiZeroCandidates() const
Retrieve the association of signal region gamma candidates into candidate PiZeros.
void setDecayMode(const hadronicDecayMode &)
void setTauQuantities(reco::PFTau &aTau, double minAbsPhotonSumPt_insideSignalCone=2.5, double minRelPhotonSumPt_insideSignalCone=0., double minAbsPhotonSumPt_outsideSignalCone=1.e+9, double minRelPhotonSumPt_outsideSignalCone=1.e+9) const
RecoTauQualityCuts qcuts_
const LorentzVector & p4() const final
four-momentum Lorentz vector
void addPFCands(Region region, ParticleType type, const InputIterator &begin, const InputIterator &end)
double leadObjecPtThreshold_
double minRelPhotonSumPt_insideSignalCone_
bool isNonnull() const
Checks for non-null.
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
double minAbsPhotonSumPt_insideSignalCone_
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
~RecoTauBuilderConePlugin() override
JetFunc signalConePiZeros_
virtual double pt() const =0
transverse momentum
minAbsPhotonSumPt_insideSignalCone
DeltaRPtrFilter< CandidatePtr > CandPtrDRFilter
DeltaRFilter< RecoTauPiZero > PiZeroDRFilter
double signalConeSize() const
Size of signal cone.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
minAbsPhotonSumPt_outsideSignalCone
void setleadCand(const T &cand)
Set leading PF candidate.
minRelPhotonSumPt_insideSignalCone
#define DEFINE_EDM_PLUGIN(factory, type, name)
StringObjectFunction< reco::Jet > JetFunc
const edm::Handle< edm::View< reco::Candidate > > & getPFCands() const
Hack to be able to convert Ptrs to Refs.
JetFunc signalConeChargedHadrons_
void setPdgId(int pdgId) final
JetFunc signalConeNeutralHadrons_
std::vector< RecoTauPiZero > PiZeroList
Transform a pizero to remove given candidates.
std::vector< CandidatePtr > pfGammas(const Jet &jet, bool sort=true)
Extract all pfGammas from a PFJet.
PredicateAND< P1, P2 > makePredicateAND(const P1 &p1, const P2 &p2)