2 #include "Math/GenVector/VectorUtil.h"
77 pfTau.
setP4(tagInfo->pfjetRef()->p4());
92 for(
unsigned int h=0;
h<hadrons.
size();++
h) {
100 if(ROOT::Math::VectorUtil::DeltaR(hadron->p4(),tagInfo->pfjetRef()->p4())<
matchingCone_) {
102 PFTau tau =
PFTau(hadron->charge(),hadron->p4(),hadron->vertex());
147 if(hadrons.
size()>0&&strips.size()>0){
149 for(std::vector<PFCandidateRefVector>::const_iterator candVector=strips.begin();candVector!=strips.end();++candVector)
165 (*hadron)->p4()+strip,
166 (*hadron)->vertex());
171 if(ROOT::Math::VectorUtil::DeltaR(
tau.p4(),tagInfo->pfjetRef()->p4())<
matchingCone_) {
173 tau.setpfTauTagInfoRef(tagInfo);
187 tauCone=
std::max(fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),(*hadron)->p4())),
188 fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),strip)));
190 tauCone=
std::max(ROOT::Math::VectorUtil::DeltaR(
tau.p4(),(*hadron)->p4()),
191 ROOT::Math::VectorUtil::DeltaR(
tau.p4(),strip));
193 if(emConstituents.
size()>0)
200 tau.setsignalPFChargedHadrCands(signalH);
201 tau.setsignalPFGammaCands(signalG);
202 tau.setsignalPFCands(signal);
203 tau.setleadPFChargedHadrCand(*hadron);
204 tau.setleadPFNeutralCand(emConstituents.
at(0));
207 if((*hadron)->pt()>emConstituents.
at(0)->pt())
208 tau.setleadPFCand(*hadron);
210 tau.setleadPFCand(emConstituents.
at(0));
240 if(hadrons.
size()>0&&strips.size()>1){
242 for(
unsigned int Nstrip1=0;Nstrip1<strips.size()-1;++Nstrip1)
243 for(
unsigned int Nstrip2=Nstrip1+1;Nstrip2<strips.size();++Nstrip2)
267 (*hadron)->p4()+strip1+strip2,
268 (*hadron)->vertex());
274 if(ROOT::Math::VectorUtil::DeltaR(
tau.p4(),tagInfo->pfjetRef()->p4())<
matchingCone_) {
276 tau.setpfTauTagInfoRef(tagInfo);
289 double tauCone=1000.0;
292 fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),strip1))),
293 fabs(ROOT::Math::VectorUtil::Angle(
tau.p4(),strip2)));
297 (ROOT::Math::VectorUtil::DeltaR(
tau.p4(),strip1))),
298 (ROOT::Math::VectorUtil::DeltaR(
tau.p4(),strip2)));
313 tau.setsignalPFChargedHadrCands(signalH);
314 tau.setsignalPFGammaCands(signalG);
315 tau.setsignalPFCands(signal);
316 tau.setleadPFChargedHadrCand(*hadron);
319 if((*hadron)->pt()>emConstituents1.
at(0)->pt())
320 tau.setleadPFCand(*hadron);
322 tau.setleadPFCand(emConstituents1.
at(0));
333 if(ROOT::Math::VectorUtil::DeltaR(strip1,(*hadron)->p4())<
334 ROOT::Math::VectorUtil::DeltaR(strip2,(*hadron)->p4()))
361 for(
unsigned int a=0;
a<hadrons.
size()-2;++
a)
362 for(
unsigned int b=
a+1;
b<hadrons.
size()-1;++
b)
363 for(
unsigned int c=
b+1;
c<hadrons.
size();++
c) {
370 int charge=h1->charge()+h2->charge()+h3->charge();
373 if(h1->trackRef()!=h2->trackRef()&&h1->trackRef()!=h3->trackRef()&&h2->trackRef()!=h3->trackRef())
377 PFTau tau =
PFTau(charge,h1->p4()+h2->p4()+h3->p4(),h1->vertex());
381 if(ROOT::Math::VectorUtil::DeltaR(tau.
p4(),tagInfo->pfjetRef()->p4())<
matchingCone_) {
388 double tauCone = 10000.0;
391 tauCone =
std::max(ROOT::Math::VectorUtil::DeltaR(tau.
p4(),h1->p4()),
392 std::max(ROOT::Math::VectorUtil::DeltaR(tau.
p4(),h2->p4()),
393 ROOT::Math::VectorUtil::DeltaR(tau.
p4(),h3->p4())));
397 tauCone =
std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.
p4(),h1->p4())),
398 std::max(fabs(ROOT::Math::VectorUtil::Angle(tau.
p4(),h2->p4())),
399 fabs(ROOT::Math::VectorUtil::Angle(tau.
p4(),h3->p4()))));
438 if(cone<allowedConeSize)
451 using namespace reco;
468 double DR = ROOT::Math::VectorUtil::DeltaR(tau.
p4(),tau.
pfTauTagInfoRef()->PFChargedHadrCands().at(
i)->p4());
475 double DR = ROOT::Math::VectorUtil::DeltaR(tau.
p4(),tau.
pfTauTagInfoRef()->PFGammaCands().at(
i)->p4());
481 double DR = ROOT::Math::VectorUtil::DeltaR(tau.
p4(),tau.
pfTauTagInfoRef()->PFNeutrHadrCands().at(
i)->p4());
490 double DR = ROOT::Math::VectorUtil::DeltaR(tau.
p4(),tau.
pfTauTagInfoRef()->PFChargedHadrCands().at(
i)->p4());
497 double DR = ROOT::Math::VectorUtil::DeltaR(tau.
p4(),tau.
pfTauTagInfoRef()->PFGammaCands().at(
i)->p4());
503 double DR = ROOT::Math::VectorUtil::DeltaR(tau.
p4(),tau.
pfTauTagInfoRef()->PFNeutrHadrCands().at(
i)->p4());
524 for(
unsigned int i=0;
i<hadrons.size();++
i)
526 sumPT+=hadrons.at(
i)->pt();
529 for(
unsigned int i=0;
i<gammas.size();++
i)
531 sumET+=gammas.at(
i)->pt();
542 for(
unsigned int i=0;
i<gammas.size();++
i)
545 for(
unsigned int i=0;
i<neutral.size();++
i)
546 isoAll.push_back(neutral.at(
i));
567 segComp=(float)(mu->matches().size());
568 if(mu->caloCompatibility()>caloComp)
569 caloComp = mu->caloCompatibility();
594 leadCharged->positionAtECALEntrance().y(),
595 leadCharged->positionAtECALEntrance().z());
601 if(leadCharged->trackRef().
isNonnull()) {
602 TrackRef track = leadCharged->trackRef();
603 tau.
setemFraction(leadCharged->ecalEnergy()/(leadCharged->ecalEnergy()+leadCharged->hcalEnergy()));
614 bool electronDecision;
615 if(
std::abs(leadCharged->pdgId())==11)
616 electronDecision=
true;
618 electronDecision=
false;
661 if(oneProngStripMassWindow_.size()!=2)
662 throw cms::Exception(
"") <<
"OneProngStripMassWindow must be a vector of size 2 [min,max] " << std::endl;
663 if(oneProngTwoStripsMassWindow_.size()!=2)
664 throw cms::Exception(
"") <<
"OneProngTwoStripsMassWindow must be a vector of size 2 [min,max] " << std::endl;
665 if(threeProngMassWindow_.size()!=2)
666 throw cms::Exception(
"") <<
"ThreeProngMassWindow must be a vector of size 2 [min,max] " << std::endl;
667 if(coneMetric_!=
"angle" && coneMetric_ !=
"DR")
668 throw cms::Exception(
"") <<
"Cone Metric should be angle or DR " << std::endl;
681 for(
unsigned int i=0;
i<cands.
size();++
i) {
682 sum+=cands.
at(
i)->p4();
701 double factor =
sqrt(vec.energy()*vec.energy()-mass*mass)/vec.P();
702 vec.SetCoordinates(vec.px()*factor,vec.py()*factor,vec.pz()*factor,vec.energy());
719 std::vector<TransientTrack> transientTracks;
765 reco::PFTauCollection::iterator it;
768 it = std::min_element(taus.begin(),taus.end(),
sorter);
773 it = std::min_element(taus.begin(),taus.end(),
sorter);
void setisolationPFGammaCands(const PFCandidateRefVector &)
std::string coneSizeFormula_
virtual double energy() const GCC11_FINAL
energy
T getParameter(std::string const &) const
virtual double et() const GCC11_FINAL
transverse energy
void setMuonDecision(const bool &)
void setisolationPFChargedHadrCands(const PFCandidateRefVector &)
void setelectronPreIDOutput(const float &)
void setisolationPFNeutrHadrCands(const PFCandidateRefVector &)
std::vector< PFTau > PFTauCollection
collection of PFTau objects
void setelectronPreIDDecision(const bool &)
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
const TransientTrackBuilder * TransientTrackBuilder_
double gammaIsolationCone_
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const
Sin< T >::type sin(const T &t)
bool useIsolationAnnulus_
reco::PFTau buildPFTau(const reco::PFTauTagInfoRef &, const reco::Vertex &)
reco::TransientTrack build(const reco::Track *p) const
void removeCandidateFromRefVector(const reco::PFCandidateRef &, reco::PFCandidateRefVector &)
double leadPionThreshold_
std::string overlapCriterion_
bool hasRefittedTracks() const
std::vector< double > threeProngMassWindow_
const PFCandidateRefVector & signalPFChargedHadrCands() const
Charged hadrons in signal region.
void sethcal3x3OverPLead(const float &)
reco::PFTauCollection pfTaus_
void setisolationPFGammaCandsEtSum(const float &)
const_iterator end() const
Termination of iteration.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void setisolationPFCands(const PFCandidateRefVector &)
void setemFraction(const float &)
const_iterator begin() const
Initialize an iterator over the RefVector.
void buildOneProng(const reco::PFTauTagInfoRef &, const reco::PFCandidateRefVector &)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool isNonnull() const
Checks for non-null.
reco::PFTau getBestTauCandidate(reco::PFTauCollection &)
bool isNull() const
Checks for null.
const T & max(const T &a, const T &b)
GlobalPoint position() const
void buildOneProngTwoStrips(const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidateRefVector > &, const reco::PFCandidateRefVector &)
void setCaloComp(const float &)
void applyElectronRejection(reco::PFTau &, double)
math::XYZTLorentzVector createMergedLorentzVector(const reco::PFCandidateRefVector &)
void setsignalPFChargedHadrCands(const PFCandidateRefVector &)
void setisolationPFChargedHadrCandsPtSum(const float &)
void setleadPFChargedHadrCandsignedSipt(const float &)
virtual void setVertex(const Point &vertex)
set vertex
std::vector< reco::TransientTrack > refittedTracks() const
void setbremsRecoveryEOverPLead(const float &)
double chargeIsolationCone_
const PFTauTagInfoRef & pfTauTagInfoRef() const
virtual float mass() const GCC11_FINAL
mass
void sethcalMaxOverPLead(const float &)
void setleadPFChargedHadrCand(const PFCandidateRef &)
const PFCandidateRef & leadPFChargedHadrCand() const
std::vector< double > oneProngTwoStripsMassWindow_
const PFCandidateRefVector & signalPFGammaCands() const
Gamma candidates in signal region.
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void setSegComp(const float &)
XYZPointD XYZPoint
point in space with cartesian internal representation
void buildThreeProngs(const reco::PFTauTagInfoRef &, const reco::PFCandidateRefVector &)
bool doOneProngTwoStrips_
std::vector< double > oneProngStripMassWindow_
value_type const at(size_type idx) const
Retrieve an element of the RefVector.
void setsignalPFCands(const PFCandidateRefVector &)
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
void setmaximumHCALPFClusterEt(const float &)
void applyMuonRejection(reco::PFTau &)
void setecalStripSumEOverPLead(const float &)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
size_type size() const
Size of the RefVector.
std::vector< double > oneProngTwoStripsPi0MassWindow_
double neutrHadrIsolationCone_
void sethcalTotOverPLead(const float &)
virtual std::vector< reco::PFCandidateRefVector > mergeCandidates(const reco::PFCandidateRefVector &)=0
void applyMassConstraint(math::XYZTLorentzVector &, double)
virtual float pt() const GCC11_FINAL
transverse momentum
void setelectronPreIDTrack(const reco::TrackRef &)
void configure(const edm::ParameterSet &)
bool refitThreeProng(reco::PFTau &)
void setleadPFCand(const PFCandidateRef &)
PFCandidateMergerBase * candidateMerger_
bool isNarrowTau(const reco::PFTau &, double)
void associateIsolationCandidates(reco::PFTau &, double)
void buildOneProngStrip(const reco::PFTauTagInfoRef &, const std::vector< reco::PFCandidateRefVector > &, const reco::PFCandidateRefVector &)
iterator erase(iterator const &pos)
Erase an element from the vector.
void setpfTauTagInfoRef(const PFTauTagInfoRef)