57 typedef std::vector<reco::CandidatePtr>
CandPtrs;
132 bool isMatchedByBlockElement(
const reco::PFCandidate& pfCandidate1,
const reco::PFCandidate& pfCandidate2,
int minMatches1,
int minMatches2,
int maxUnmatchedBlockElements1plus2)
135 int numBlocks1 = blockElements1.size();
137 int numBlocks2 = blockElements2.size();
138 int numBlocks_matched = 0;
139 for ( reco::PFCandidate::ElementsInBlocks::const_iterator blockElement1 = blockElements1.begin();
140 blockElement1 != blockElements1.end(); ++blockElement1 ) {
142 for ( reco::PFCandidate::ElementsInBlocks::const_iterator blockElement2 = blockElements2.begin();
143 blockElement2 != blockElements2.end(); ++blockElement2 ) {
144 if ( blockElement1->first.id() == blockElement2->first.id() &&
145 blockElement1->first.key() == blockElement2->first.key() &&
146 blockElement1->second == blockElement2->second ) {
150 if ( isMatched ) ++numBlocks_matched;
152 assert(numBlocks_matched <= numBlocks1);
153 assert(numBlocks_matched <= numBlocks2);
154 if ( numBlocks_matched >= minMatches1 && numBlocks_matched >= minMatches2 &&
155 ((numBlocks1 - numBlocks_matched) + (numBlocks2 - numBlocks_matched)) <= maxUnmatchedBlockElements1plus2 ) {
166 edm::LogPrint(
"TauChHadronFromPF") <<
"<PFRecoTauChargedHadronFromPFCandidatePlugin::operator()>:";
176 for ( CandPtrs::iterator
cand = candsVector.begin();
177 cand != candsVector.end(); ++
cand ) {
179 edm::LogPrint(
"TauChHadronFromPF") <<
"processing PFCandidate: Pt = " << (*cand)->pt() <<
", eta = " << (*cand)->eta() <<
", phi = " << (*cand)->phi()
180 <<
" (pdgId = " << (*cand)->pdgId() <<
", charge = " << (*cand)->charge() <<
")" ;
198 chargedHadron->chargedPFCandidate_ = (*cand);
199 chargedHadron->addDaughter(*
cand);
201 int pdgId =
std::abs(chargedHadron->chargedPFCandidate_->pdgId());
206 if ( jetConstituent == chargedHadron->chargedPFCandidate_ )
continue;
208 int jetConstituentPdgId =
std::abs(jetConstituent->pdgId());
209 if ( !(jetConstituentPdgId == 130 || jetConstituentPdgId == 22) )
continue;
212 double dRmerge = -1.;
213 int minBlockElementMatches = 1000;
214 int maxUnmatchedBlockElements = 0;
215 double minMergeEt = 1.e+6;
216 if ( jetConstituentPdgId == 130 ) {
224 }
else if ( jetConstituentPdgId == 22 ) {
234 if (jetConstituent->et() > minMergeEt) {
236 chargedHadron->neutralPFCandidates_.push_back(jetConstituent);
237 chargedHadron->addDaughter(jetConstituent);
242 if (pfCand !=
nullptr && pfJetConstituent !=
nullptr) {
243 if (isMatchedByBlockElement(*pfJetConstituent, *pfCand, minBlockElementMatches, minBlockElementMatches, maxUnmatchedBlockElements)) {
244 chargedHadron->neutralPFCandidates_.push_back(jetConstituent);
259 if ( chargedHadron->daughterPtr(0).isNonnull() ) chargedHadron->setVertex(chargedHadron->daughterPtr(0)->vertex());
260 output.push_back(chargedHadron);
263 return output.release();
std::vector< CandidatePtr > pfCandidates(const Jet &jet, int particleId, bool sort=true)
T getParameter(std::string const &) const
RecoTauVertexAssociator vertexAssociator_
math::XYZPointF atECALEntrance(const reco::Candidate *part, double bField)
bool isNonnull() const
Checks for non-null.
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
double dRmergePhotonWrtElectron_
Base class for all types of Jets.
RecoTauQualityCuts * qcuts_
double dRmergePhotonWrtOther_
PFRecoTauChargedHadronFromPFCandidatePlugin(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
Global3DPoint GlobalPoint
void setEvent(const edm::Event &evt)
Load the vertices from the event.
int minBlockElementMatchesNeutralHadron_
int maxUnmatchedBlockElementsPhoton_
double minMergeChargedHadronPt_
int maxUnmatchedBlockElementsNeutralHadron_
boost::ptr_vector< PFRecoTauChargedHadron > ChargedHadronVector
std::vector< ElementInBlock > ElementsInBlocks
virtual const daughters & daughterPtrVector() const
references to daughtes
reco::TrackRef trackRef() const
PFRecoTauChargedHadronAlgorithm
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
return_type operator()(const reco::Jet &) const override
Build a collection of chargedHadrons from objects in the input jet.
Abs< T >::type abs(const T &t)
bool isMatched(TrackingRecHit const &hit)
double dRmergeNeutralHadronWrtChargedHadron_
int minBlockElementMatchesPhoton_
const edm::EventSetup * evtSetup() const
std::vector< int > inputParticleIds_
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
void addDaughter(const Candidate &, const std::string &s="")
add a clone of the passed candidate as daughter
reco::MuonRef muonRef() const
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::vector< reco::CandidatePtr > CandPtrs
const edm::Event * evt() const
ParameterSet const & getParameterSet(std::string const &) const
~PFRecoTauChargedHadronFromPFCandidatePlugin() override
std::auto_ptr< ChargedHadronVector > return_type
double dRmergePhotonWrtChargedHadron_
double dRmergeNeutralHadronWrtNeutralHadron_
double dRmergeNeutralHadronWrtOther_
Particle reconstructed by the particle flow algorithm.
reco::VertexRef associatedVertex(const Jet &jet) const
reco::GsfTrackRef gsfTrackRef() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
double dRmergeNeutralHadronWrtElectron_
double minMergeNeutralHadronEt_
const std::string & name() const
void setChargedHadronP4(reco::PFRecoTauChargedHadron &chargedHadron, double scaleFactor_neutralPFCands=1.0)
const ElementsInBlocks & elementsInBlocks() const
void beginEvent() override
Hook called at the beginning of the event.
double dRmergePhotonWrtNeutralHadron_