276 LogDebug(
"discriminate") <<
" tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
277 LogDebug(
"discriminate") << *pfTau ;
280 std::vector<PFCandidatePtr> isoCharged_;
281 std::vector<PFCandidatePtr> isoNeutral_;
282 std::vector<PFCandidatePtr> isoPU_;
284 std::vector<PFCandidatePtr> chPV_;
285 isoCharged_.reserve(pfTau->isolationPFChargedHadrCands().size());
286 isoNeutral_.reserve(pfTau->isolationPFGammaCands().size());
288 isoNeutralWeight_.reserve(pfTau->isolationPFGammaCands().size());
298 LogTrace(
"discriminate") <<
"pv: x = " << pv->position().x() <<
", y = " << pv->position().y() <<
", z = " << pv->position().z() ;
300 LogTrace(
"discriminate") <<
"pv: N/A" ;
302 if ( pfTau->leadPFChargedHadrCand().
isNonnull() ) {
303 LogTrace(
"discriminate") <<
"leadPFChargedHadron:"
304 <<
" Pt = " << pfTau->leadPFChargedHadrCand()->pt() <<
","
305 <<
" eta = " << pfTau->leadPFChargedHadrCand()->eta() <<
","
306 <<
" phi = " << pfTau->leadPFChargedHadrCand()->phi() ;
308 LogTrace(
"discriminate") <<
"leadPFChargedHadron: N/A" ;
316 qcuts_->setLeadTrack(pfTau->leadPFChargedHadrCand());
327 for(
auto const & cand : pfTau->isolationPFChargedHadrCands() ) {
328 if (
qcuts_->filterCandRef(cand) ) {
329 LogTrace(
"discriminate") <<
"adding charged iso cand with pt " << cand->pt() ;
330 isoCharged_.push_back(cand);
335 for(
auto const & cand : pfTau->isolationPFGammaCands() ) {
336 if (
qcuts_->filterCandRef(cand) ) {
337 LogTrace(
"discriminate") <<
"adding neutral iso cand with pt " << cand->pt() ;
338 isoNeutral_.push_back(cand);
353 std::vector<PFCandidatePtr> allPU =
357 std::vector<PFCandidatePtr> allNPU =
360 LogTrace(
"discriminate") <<
"After track cuts: " << allPU.size() ;
364 std::vector<PFCandidatePtr> cleanPU =
367 std::vector<PFCandidatePtr> cleanNPU =
371 LogTrace(
"discriminate") <<
"After cleaning cuts: " << cleanPU.size() ;
376 for(
auto const & cand : cleanPU) {
377 if ( deltaBetaFilter(cand) ) isoPU_.push_back(cand);
380 for(
auto const & cand : cleanNPU) {
381 if ( deltaBetaFilter(cand) ) chPV_.push_back(cand);
383 LogTrace(
"discriminate") <<
"After cone cuts: " << isoPU_.size() <<
" " << chPV_.size() ;
392 for(
auto const & isoObject : isoNeutral_ ) {
393 if(isoObject->charge() !=0){
395 isoNeutralWeight_.push_back(*isoObject);
399 double eta=isoObject->eta();
400 double phi=isoObject->phi();
405 if (sumNPU+sumPU>0) neutral.
setP4(((sumNPU)/(sumNPU+sumPU))*neutral.
p4());
407 isoNeutralWeight_.push_back(neutral);
415 std::vector<PFCandidatePtr> isoCharged_filter;
416 std::vector<PFCandidatePtr> isoNeutral_filter;
419 for(
auto const & isoObject : isoCharged_ ) {
420 if (
filter(isoObject) ) isoCharged_filter.push_back(isoObject);
423 for(
auto const & isoObject : isoNeutral_ ) {
424 if (
filter(isoObject) ) isoNeutral_filter.push_back(isoObject);
426 isoNeutral_ = isoNeutral_filter;
428 for(
auto const & isoObject : isoNeutralWeight_){
429 if ( filter2(isoObject) ) isoNeutralWeight_filter.push_back(isoObject);
431 isoNeutralWeight_ = isoNeutralWeight_filter;
433 isoCharged_ = isoCharged_filter;
436 bool failsOccupancyCut =
false;
437 bool failsSumPtCut =
false;
438 bool failsRelativeSumPtCut =
false;
441 int neutrals = isoNeutral_.size();
446 if ( neutrals < 0 ) {
450 size_t nOccupants = isoCharged_.size() + neutrals;
454 double totalPt = 0.0;
458 double chargedPt = 0.0;
459 double neutralPt = 0.0;
460 double weightedNeutralPt = 0.0;
461 for(
auto const & isoObject : isoCharged_ ) {
462 chargedPt += isoObject->pt();
465 for(
auto const & isoObject : isoNeutral_ ) {
466 neutralPt += isoObject->pt();
469 for(
auto const & isoObject : isoNeutralWeight_){
470 weightedNeutralPt+=isoObject.pt();
473 for(
auto const & isoObject : isoPU_ ) {
474 puPt += isoObject->pt();
476 LogTrace(
"discriminate") <<
"chargedPt = " << chargedPt ;
477 LogTrace(
"discriminate") <<
"neutralPt = " << neutralPt ;
478 LogTrace(
"discriminate") <<
"weighted neutral Pt = " << weightedNeutralPt ;
481 neutralPt = weightedNeutralPt;
492 if ( neutralPt < 0.0 ) {
496 totalPt = chargedPt + neutralPt;
519 return (fails ? 0. : 1.);
double weightedSum(std::vector< PFCandidatePtr > inColl_, double eta, double phi) const
bool isNonnull() const
Checks for non-null.
std::auto_ptr< tau::RecoTauQualityCuts > pileupQcutsGeneralQCuts_
virtual void setP4(const LorentzVector &p4)
set 4-momentum
double maximumRelativeSumPt_
bool applyRelativeSumPtCut_
double deltaBetaFactorThisEvent_
double offsetRelativeSumPt_
std::vector< reco::PFCandidatePtr > chargedPFCandidatesInEvent_
std::auto_ptr< tau::RecoTauQualityCuts > qcuts_
std::auto_ptr< tau::RecoTauQualityCuts > pileupQcutsPUTrackSelection_
double deltaBetaCollectionCone_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
uint32_t maximumOccupancy_
Particle reconstructed by the particle flow algorithm.
std::auto_ptr< tau::RecoTauVertexAssociator > vertexAssociator_
virtual const LorentzVector & p4() const
four-momentum Lorentz vector