196 using namespace cone;
209 typedef std::vector<CandidatePtr>
CandPtrs;
223 std::sort(pfchs.begin(), pfchs.end(), SortPFCandsDescendingPt());
247 CandPtrs::iterator leadPFCH_iter =
248 std::find_if(pfchs.begin(), pfchs.end(), matchingConeFilter);
250 if (leadPFCH_iter != pfchs.end()) {
251 leadPFCH = *leadPFCH_iter;
253 tau.setleadChargedHadrCand(leadPFCH);
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;
268 tau.setleadNeutralCand(leadPFGamma);
274 leadPFCand = leadPFCH;
275 }
else if (leadPFGamma.isNonnull() &&
278 leadPFCand = leadPFGamma;
281 leadPFCand = leadPFCH;
284 tau.setleadCand(leadPFCand);
314 typedef xclean::PredicateAND<xclean::FilterCandByAbsPdgId, CandPtrDRFilter> RegionalJunkConeAndIdFilter;
316 xclean::FilterCandByAbsPdgId pfchCandSelector(211);
317 xclean::FilterCandByAbsPdgId pfgammaCandSelector(22);
318 xclean::FilterCandByAbsPdgId pfnhCandSelector(130);
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();
361 xclean::CrossCleanPiZeros<CandPtrDRFilterIter> piZeroXCleaner(
362 signalPFCHCands_begin, signalPFCHCands_end);
363 std::vector<reco::RecoTauPiZero> cleanPiZeros = piZeroXCleaner(piZeros);
367 xclean::CrossCleanPtrs<PiZeroList::const_iterator> pfCandXCleaner(cleanPiZeros.begin(), cleanPiZeros.end());
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();
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)
bool isNonnull() const
Checks for non-null.
bool usePFLeptonsAsChargedHadrons_
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
JetFunc isoConeChargedHadrons_
int maxSignalConeChargedHadrons_
boost::filter_iterator< PiZeroDRFilter, std::vector< RecoTauPiZero >::const_iterator > PiZeroDRFilterIter
boost::ptr_vector< reco::PFTau > output_type
std::vector< CandidatePtr > pfChargedCands(const Jet &jet, bool sort=true)
Extract all non-neutral candidates from a PFJet.
JetFunc isoConeNeutralHadrons_
StringObjectFunction< reco::PFTau > signalConeSizeToStore_
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.
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_
double leadObjecPtThreshold_
double minRelPhotonSumPt_insideSignalCone_
double minAbsPhotonSumPt_insideSignalCone_
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
JetFunc signalConePiZeros_
DeltaRPtrFilter< CandidatePtr > CandPtrDRFilter
DeltaRFilter< RecoTauPiZero > PiZeroDRFilter
math::XYZTLorentzVector LorentzVector
Lorentz vector.
const edm::Handle< edm::View< reco::Candidate > > & getPFCands() const
Hack to be able to convert Ptrs to Refs.
JetFunc signalConeChargedHadrons_
JetFunc signalConeNeutralHadrons_
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)