30 namespace reco {
namespace tau {
40 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons,
41 const std::vector<RecoTauPiZero>& piZeros,
42 const std::vector<PFCandidatePtr>& 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"))
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<PFCandidatePtr>& regionalExtras)
const {
196 using namespace cone;
209 typedef std::vector<PFCandidatePtr>
PFCandPtrs;
247 PFCandPtrs::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 PFCandPtrs::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 PFCandPtrs signalPFCHs;
342 int numSignalPFCHs = 0;
343 PFCandPtrs isolationPFCHs;
344 int numIsolationPFCHs = 0;
348 signalPFCHs.push_back(*iter);
353 isolationPFCHs.push_back(*iter);
357 PFCandPtrs::const_iterator signalPFCHs_begin = signalPFCHs.begin();
358 PFCandPtrs::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 PFCandPtrs::const_iterator isolationPFCHs_begin = isolationPFCHs.begin();
383 PFCandPtrs::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");
static AlgebraicMatrix initialize()
const edm::Handle< PFCandidateCollection > & getPFCands() const
Hack to be able to convert Ptrs to Refs.
std::auto_ptr< reco::PFTau > get(bool setupLeadingCandidates=true)
bool isNonnull() const
Checks for non-null.
const PFCandidatePtr & leadPFChargedHadrCand() const
bool usePFLeptonsAsChargedHadrons_
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of PFCandidates.
JetFunc isoConeChargedHadrons_
std::vector< PFCandidatePtr > pfGammas(const PFJet &jet, bool sort=true)
Extract all pfGammas from a PFJet.
int maxSignalConeChargedHadrons_
ParameterSet const & getParameterSet(ParameterSetID const &id)
std::vector< reco::PFCandidatePtr > PFCandPtrs
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
JetFunc isoConeNeutralHadrons_
StringObjectFunction< reco::PFTau > signalConeSizeToStore_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
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
return_type operator()(const reco::PFJetRef &jet, const std::vector< reco::PFRecoTauChargedHadron > &chargedHadrons, const std::vector< RecoTauPiZero > &piZeros, const std::vector< PFCandidatePtr > ®ionalExtras) const override
reco::VertexRef primaryVertex(const reco::PFJetRef &jet) const
Get primary vertex associated to this jet.
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
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
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
RecoTauQualityCuts qcuts_
const LorentzVector & p4() const final
four-momentum Lorentz vector
void setleadPFCand(const T &cand)
Set leading PF candidate.
void addPFCands(Region region, ParticleType type, const InputIterator &begin, const InputIterator &end)
double leadObjecPtThreshold_
InputIterator leadPFCand(InputIterator begin, InputIterator end)
double minRelPhotonSumPt_insideSignalCone_
StringObjectFunction< reco::PFJet > JetFunc
bool isNonnull() const
Checks for non-null.
double minAbsPhotonSumPt_insideSignalCone_
std::vector< PFCandidatePtr > 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.
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
DeltaRFilter< RecoTauPiZero > PiZeroDRFilter
double signalConeSize() const
Size of signal cone.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
void setleadPFChargedHadrCand(const T &cand)
Set leading PFChargedHadron candidate.
minAbsPhotonSumPt_outsideSignalCone
std::vector< PFCandidatePtr > pfChargedCands(const PFJet &jet, bool sort=true)
Extract all non-neutral candidates from a PFJet.
void setleadPFNeutralCand(const T &cand)
Set leading PFGamma candidate.
boost::filter_iterator< PFCandPtrDRFilter, std::vector< PFCandidatePtr >::const_iterator > PFCandPtrDRFilterIter
minRelPhotonSumPt_insideSignalCone
#define DEFINE_EDM_PLUGIN(factory, type, name)
JetFunc signalConeChargedHadrons_
void setPdgId(int pdgId) final
JetFunc signalConeNeutralHadrons_
DeltaRPtrFilter< PFCandidatePtr > PFCandPtrDRFilter
std::vector< RecoTauPiZero > PiZeroList
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
Transform a pizero to remove given candidates.
PredicateAND< P1, P2 > makePredicateAND(const P1 &p1, const P2 &p2)