2 #include "Math/GenVector/VectorUtil.h" 33 std::vector<PFCandidatePtr> hadrons = tagInfo->PFChargedHadrCands();
78 pfTau.
setP4(tagInfo->pfjetRef()->p4());
93 for(
unsigned int h=0;
h<hadrons.size();++
h) {
109 std::vector<PFCandidatePtr> signal;
110 signal.push_back(hadron);
148 if(!hadrons.empty()&&!
strips.empty()){
150 for(std::vector<std::vector<PFCandidatePtr>>::const_iterator candVector=
strips.begin();candVector!=
strips.end();++candVector)
151 for(std::vector<PFCandidatePtr>::const_iterator hadron=hadrons.begin();hadron!=hadrons.end();++hadron) {
155 std::vector<PFCandidatePtr> emConstituents = *candVector;
166 (*hadron)->p4()+
strip,
167 (*hadron)->vertex());
174 tau.setpfTauTagInfoRef(tagInfo);
177 std::vector<PFCandidatePtr> signal;
178 std::vector<PFCandidatePtr> signalH;
179 std::vector<PFCandidatePtr> signalG;
182 signalH.push_back(*hadron);
183 signal.push_back(*hadron);
188 tauCone=
std::max(fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),(*hadron)->p4())),
189 fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),
strip)));
194 if(!emConstituents.empty())
195 for(std::vector<PFCandidatePtr>::const_iterator j=emConstituents.begin();j!=emConstituents.end();++j) {
196 signal.push_back(*j);
197 signalG.push_back(*j);
201 tau.setsignalPFChargedHadrCands(signalH);
202 tau.setsignalPFGammaCands(signalG);
203 tau.setsignalPFCands(signal);
204 tau.setleadPFChargedHadrCand(*hadron);
205 tau.setleadPFNeutralCand(emConstituents[0]);
208 if((*hadron)->pt()>emConstituents[0]->pt())
209 tau.setleadPFCand(*hadron);
211 tau.setleadPFCand(emConstituents[0]);
241 if(!hadrons.empty()&&
strips.size()>1){
243 for(
unsigned int Nstrip1=0;Nstrip1<
strips.size()-1;++Nstrip1)
244 for(
unsigned int Nstrip2=Nstrip1+1;Nstrip2<
strips.size();++Nstrip2)
245 for(std::vector<PFCandidatePtr>::const_iterator hadron=hadrons.begin();hadron!=hadrons.end();++hadron) {
250 std::vector<PFCandidatePtr> emConstituents1 =
strips[Nstrip1];
251 std::vector<PFCandidatePtr> emConstituents2 =
strips[Nstrip2];
268 (*hadron)->p4()+strip1+strip2,
269 (*hadron)->vertex());
277 tau.setpfTauTagInfoRef(tagInfo);
281 std::vector<PFCandidatePtr> signal;
282 std::vector<PFCandidatePtr> signalH;
283 std::vector<PFCandidatePtr> signalG;
286 signalH.push_back(*hadron);
287 signal.push_back(*hadron);
290 double tauCone=1000.0;
293 fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),strip1))),
294 fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),strip2)));
303 for(std::vector<PFCandidatePtr>::const_iterator j=emConstituents1.begin();j!=emConstituents1.end();++j) {
304 signal.push_back(*j);
305 signalG.push_back(*j);
308 for(std::vector<PFCandidatePtr>::const_iterator j=emConstituents2.begin();j!=emConstituents2.end();++j) {
309 signal.push_back(*j);
310 signalG.push_back(*j);
314 tau.setsignalPFChargedHadrCands(signalH);
315 tau.setsignalPFGammaCands(signalG);
316 tau.setsignalPFCands(signal);
317 tau.setleadPFChargedHadrCand(*hadron);
320 if((*hadron)->pt()>emConstituents1[0]->pt())
321 tau.setleadPFCand(*hadron);
323 tau.setleadPFCand(emConstituents1[0]);
362 for(
unsigned int a=0;
a<hadrons.size()-2;++
a)
363 for(
unsigned int b=
a+1;
b<hadrons.size()-1;++
b)
364 for(
unsigned int c=
b+1;
c<hadrons.size();++
c) {
384 std::vector<PFCandidatePtr> signal;
385 signal.push_back(h1);
386 signal.push_back(h2);
387 signal.push_back(h3);
389 double tauCone = 10000.0;
398 tauCone =
std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.
p4(),h1->
p4())),
399 std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.
p4(),h2->
p4())),
400 fabs(ROOT::Math::VectorUtil::Angle(tau.
p4(),h3->
p4()))));
439 if(cone<allowedConeSize)
452 using namespace reco;
460 std::vector<PFCandidatePtr> hadrons;
461 std::vector<PFCandidatePtr> gammas;
462 std::vector<PFCandidatePtr> neutral;
467 const std::vector<reco::PFCandidatePtr>& pfChargedHadrCands = tau.
pfTauTagInfoRef()->PFChargedHadrCands();
468 double tauEta=tau.
eta();
469 double tauPhi=tau.
phi();
470 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfChargedHadrCand = pfChargedHadrCands.begin();
471 pfChargedHadrCand != pfChargedHadrCands.end(); ++pfChargedHadrCand ) {
472 double dR =
reco::deltaR(tauEta, tauPhi, (*pfChargedHadrCand)->eta(), (*pfChargedHadrCand)->phi());
476 const std::vector<reco::PFCandidatePtr>& pfGammaCands = tau.
pfTauTagInfoRef()->PFGammaCands();
477 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfGammaCand = pfGammaCands.begin();
478 pfGammaCand != pfGammaCands.end(); ++pfGammaCand ) {
479 double dR =
reco::deltaR(tauEta, tauPhi, (*pfGammaCand)->eta(), (*pfGammaCand)->phi());
483 const std::vector<reco::PFCandidatePtr>& pfNeutralHadrCands = tau.
pfTauTagInfoRef()->PFNeutrHadrCands();
484 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfNeutralHadrCand = pfNeutralHadrCands.begin();
485 pfNeutralHadrCand != pfNeutralHadrCands.end(); ++pfNeutralHadrCand ) {
486 double dR =
reco::deltaR(tauEta, tauPhi, (*pfNeutralHadrCand)->eta(), (*pfNeutralHadrCand)->phi());
490 double tauEta=tau.
eta();
491 double tauPhi=tau.
phi();
492 const std::vector<reco::PFCandidatePtr>& pfChargedHadrCands = tau.
pfTauTagInfoRef()->PFChargedHadrCands();
493 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfChargedHadrCand = pfChargedHadrCands.begin();
494 pfChargedHadrCand != pfChargedHadrCands.end(); ++pfChargedHadrCand ) {
495 double dR =
reco::deltaR(tauEta, tauPhi, (*pfChargedHadrCand)->eta(), (*pfChargedHadrCand)->phi());
499 const std::vector<reco::PFCandidatePtr>& pfGammaCands = tau.
pfTauTagInfoRef()->PFGammaCands();
500 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfGammaCand = pfGammaCands.begin();
501 pfGammaCand != pfGammaCands.end(); ++pfGammaCand ) {
502 double dR =
reco::deltaR(tauEta, tauPhi, (*pfGammaCand)->eta(), (*pfGammaCand)->phi());
506 const std::vector<reco::PFCandidatePtr>& pfNeutralHadrCands = tau.
pfTauTagInfoRef()->PFNeutrHadrCands();
507 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfNeutralHadrCand = pfNeutralHadrCands.begin();
508 pfNeutralHadrCand != pfNeutralHadrCands.end(); ++pfNeutralHadrCand ) {
509 double dR =
reco::deltaR(tauEta, tauPhi, (*pfNeutralHadrCand)->eta(), (*pfNeutralHadrCand)->phi());
528 for(
unsigned int i=0;
i<hadrons.size();++
i)
530 sumPT+=hadrons[
i]->pt();
533 for(
unsigned int i=0;
i<gammas.size();++
i)
535 sumET+=gammas[
i]->pt();
545 std::vector<PFCandidatePtr> isoAll = hadrons;
546 for(
unsigned int i=0;
i<gammas.size();++
i)
547 isoAll.push_back(gammas[
i]);
549 for(
unsigned int i=0;i<neutral.size();++
i)
550 isoAll.push_back(neutral[i]);
571 segComp=(
float)(mu->matches().size());
572 if(mu->caloCompatibility()>caloComp)
573 caloComp = mu->caloCompatibility();
618 bool electronDecision;
620 electronDecision=
true;
622 electronDecision=
false;
665 if(oneProngStripMassWindow_.size()!=2)
666 throw cms::Exception(
"") <<
"OneProngStripMassWindow must be a vector of size 2 [min,max] " << std::endl;
667 if(oneProngTwoStripsMassWindow_.size()!=2)
668 throw cms::Exception(
"") <<
"OneProngTwoStripsMassWindow must be a vector of size 2 [min,max] " << std::endl;
669 if(threeProngMassWindow_.size()!=2)
670 throw cms::Exception(
"") <<
"ThreeProngMassWindow must be a vector of size 2 [min,max] " << std::endl;
671 if(coneMetric_!=
"angle" && coneMetric_ !=
"DR")
672 throw cms::Exception(
"") <<
"Cone Metric should be angle or DR " << std::endl;
685 for(
unsigned int i=0;
i<cands.size();++
i) {
694 std::vector<PFCandidatePtr> newVec;
696 std::vector<PFCandidatePtr>::iterator it;
697 it =
std::find(vec.begin(),vec.end(),cand);
705 double factor =
sqrt(vec.energy()*vec.energy()-mass*
mass)/vec.P();
706 vec.SetCoordinates(vec.px()*factor,vec.py()*factor,vec.pz()*factor,vec.energy());
723 std::vector<TransientTrack> transientTracks;
741 const std::vector<reco::TransientTrack>& refittedTracks = myVertex.
refittedTracks();
742 const reco::Track& track1 = refittedTracks.at(0).track();
744 const reco::Track& track2 = refittedTracks.at(1).track();
746 const reco::Track& track3 = refittedTracks.at(2).track();
761 reco::PFTauCollection::iterator it;
764 it = std::min_element(taus.begin(),taus.end(),
sorter);
769 it = std::min_element(taus.begin(),taus.end(),
sorter);
std::string coneSizeFormula_
T getParameter(std::string const &) const
double ecalEnergy() const
return corrected Ecal energy
int pdgId() const final
PDG identifier.
void setMuonDecision(const bool &)
void setelectronPreIDOutput(const float &)
bool isNonnull() const
Checks for non-null.
std::vector< PFTau > PFTauCollection
collection of PFTau objects
double eta() const final
momentum pseudorapidity
void setleadPFChargedHadrCand(const PFCandidatePtr &)
const PFCandidatePtr & leadPFChargedHadrCand() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void setelectronPreIDDecision(const bool &)
math::XYZTLorentzVector createMergedLorentzVector(const std::vector< reco::PFCandidatePtr > &)
void setisolationPFCands(const std::vector< reco::PFCandidatePtr > &)
void buildOneProng(const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidatePtr > &)
const TransientTrackBuilder * TransientTrackBuilder_
double gammaIsolationCone_
~HPSPFRecoTauAlgorithm() override
void buildThreeProngs(const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidatePtr > &)
Sin< T >::type sin(const T &t)
const std::vector< reco::PFCandidatePtr > & signalPFGammaCands() const
Gamma candidates in signal region.
bool useIsolationAnnulus_
reco::TransientTrack build(const reco::Track *p) const
double pt() const final
transverse momentum
void buildOneProngStrip(const reco::PFTauTagInfoRef &, const std::vector< std::vector< reco::PFCandidatePtr >> &, const std::vector< reco::PFCandidatePtr > &)
int charge() const final
electric charge
double leadPionThreshold_
std::string overlapCriterion_
bool hasRefittedTracks() const
std::vector< double > threeProngMassWindow_
double px() const
x coordinate of momentum vector
void sethcal3x3OverPLead(const float &)
const Vector & momentum() const
track momentum vector
reco::PFTauCollection pfTaus_
void setisolationPFGammaCandsEtSum(const float &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void setemFraction(const float &)
const math::XYZPointF & positionAtECALEntrance() const
void setVertex(const Point &vertex) override
set vertex
void setisolationPFNeutrHadrCands(const std::vector< reco::PFCandidatePtr > &)
reco::TrackRef trackRef() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setsignalPFChargedHadrCands(const std::vector< reco::PFCandidatePtr > &)
const Point & vertex() const override
vertex position (overwritten by PF...)
reco::PFTau getBestTauCandidate(reco::PFTauCollection &)
double et() const final
transverse energy
GlobalPoint position() const
void setleadPFCand(const PFCandidatePtr &)
void setCaloComp(const float &)
void applyElectronRejection(reco::PFTau &, double)
double energy() const final
energy
Abs< T >::type abs(const T &t)
CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const override
void setisolationPFChargedHadrCandsPtSum(const float &)
void setleadPFChargedHadrCandsignedSipt(const float &)
void setsignalPFCands(const std::vector< reco::PFCandidatePtr > &)
const LorentzVector & p4() const final
four-momentum Lorentz vector
virtual std::vector< std::vector< reco::PFCandidatePtr > > mergeCandidates(const std::vector< reco::PFCandidatePtr > &)=0
reco::PFTau buildPFTau(const reco::PFTauTagInfoRef &, const reco::Vertex &) override
bool isNull() const
Checks for null.
void setbremsRecoveryEOverPLead(const float &)
reco::MuonRef muonRef() const
bool isNonnull() const
Checks for non-null.
double pz() const
z coordinate of momentum vector
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
float mva_e_pi() const
mva for electron-pion discrimination
double chargeIsolationCone_
const PFTauTagInfoRef & pfTauTagInfoRef() const
void sethcalMaxOverPLead(const float &)
std::vector< double > oneProngTwoStripsMassWindow_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void setisolationPFGammaCands(const std::vector< reco::PFCandidatePtr > &)
void setSegComp(const float &)
XYZPointD XYZPoint
point in space with cartesian internal representation
void setisolationPFChargedHadrCands(const std::vector< reco::PFCandidatePtr > &)
void buildOneProngTwoStrips(const reco::PFTauTagInfoRef &, const std::vector< std::vector< reco::PFCandidatePtr >> &, const std::vector< reco::PFCandidatePtr > &)
bool doOneProngTwoStrips_
std::vector< double > oneProngStripMassWindow_
void setmaximumHCALPFClusterEt(const float &)
void removeCandidateFromRefVector(const reco::PFCandidatePtr &, std::vector< reco::PFCandidatePtr > &)
void applyMuonRejection(reco::PFTau &)
double hcalEnergy() const
return corrected Hcal energy
void setecalStripSumEOverPLead(const float &)
std::vector< double > oneProngTwoStripsPi0MassWindow_
double neutrHadrIsolationCone_
std::vector< reco::TransientTrack > const & refittedTracks() const
void sethcalTotOverPLead(const float &)
void applyMassConstraint(math::XYZTLorentzVector &, double)
void setelectronPreIDTrack(const reco::TrackRef &)
void configure(const edm::ParameterSet &)
bool refitThreeProng(reco::PFTau &)
PFCandidateMergerBase * candidateMerger_
double phi() const final
momentum azimuthal angle
bool isNarrowTau(const reco::PFTau &, double)
void setP4(const LorentzVector &p4) final
set 4-momentum
void associateIsolationCandidates(reco::PFTau &, double)
const std::vector< reco::PFCandidatePtr > & signalPFChargedHadrCands() const
Charged hadrons in signal region.
double py() const
y coordinate of momentum vector
double mass() const final
mass
void setpfTauTagInfoRef(const PFTauTagInfoRef)