53 typedef std::vector<reco::CandidatePtr>
CandPtrs;
89 edm::ParameterSet qcuts_pset =
pset.getParameterSet(
"qualityCuts").getParameterSet(
"signalQualityCuts");
127 int maxUnmatchedBlockElements1plus2) {
129 int numBlocks1 = blockElements1.size();
131 int numBlocks2 = blockElements2.size();
132 int numBlocks_matched = 0;
133 for (reco::PFCandidate::ElementsInBlocks::const_iterator blockElement1 = blockElements1.begin();
134 blockElement1 != blockElements1.end();
137 for (reco::PFCandidate::ElementsInBlocks::const_iterator blockElement2 = blockElements2.begin();
138 blockElement2 != blockElements2.end();
140 if (blockElement1->first.id() == blockElement2->first.id() &&
141 blockElement1->first.key() == blockElement2->first.key() &&
142 blockElement1->second == blockElement2->second) {
149 assert(numBlocks_matched <= numBlocks1);
150 assert(numBlocks_matched <= numBlocks2);
151 if (numBlocks_matched >= minMatches1 && numBlocks_matched >= minMatches2 &&
152 ((numBlocks1 - numBlocks_matched) + (numBlocks2 - numBlocks_matched)) <= maxUnmatchedBlockElements1plus2) {
163 edm::LogPrint(
"TauChHadronFromPF") <<
"<PFRecoTauChargedHadronFromPFCandidatePlugin::operator()>:";
173 for (CandPtrs::iterator
cand = candsVector.begin();
cand != candsVector.end(); ++
cand) {
176 <<
"processing PFCandidate: Pt = " << (*cand)->pt() <<
", eta = " << (*cand)->eta()
177 <<
", phi = " << (*cand)->phi() <<
" (pdgId = " << (*cand)->pdgId() <<
", charge = " << (*cand)->charge()
182 if (
std::abs((*cand)->charge()) > 0.5)
190 if (pfCand->trackRef().isNonnull())
192 else if (pfCand->muonRef().isNonnull() && pfCand->muonRef()->innerTrack().isNonnull())
194 else if (pfCand->muonRef().isNonnull() && pfCand->muonRef()->globalTrack().isNonnull())
196 else if (pfCand->muonRef().isNonnull() && pfCand->muonRef()->outerTrack().isNonnull())
198 else if (pfCand->gsfTrackRef().isNonnull())
209 for (
const auto& jetConstituent :
jet.daughterPtrVector()) {
214 int jetConstituentPdgId =
std::abs(jetConstituent->pdgId());
215 if (!(jetConstituentPdgId == 130 || jetConstituentPdgId == 22))
220 double dRmerge = -1.;
221 int minBlockElementMatches = 1000;
222 int maxUnmatchedBlockElements = 0;
223 double minMergeEt = 1.e+6;
224 if (jetConstituentPdgId == 130) {
227 else if (
pdgId == 130)
229 else if (
pdgId == 11)
236 }
else if (jetConstituentPdgId == 22) {
239 else if (
pdgId == 130)
241 else if (
pdgId == 11)
250 if (jetConstituent->et() > minMergeEt) {
252 chargedHadron->neutralPFCandidates_.push_back(jetConstituent);
258 if (pfCand !=
nullptr && pfJetConstituent !=
nullptr) {
259 if (isMatchedByBlockElement(*pfJetConstituent,
261 minBlockElementMatches,
262 minBlockElementMatches,
263 maxUnmatchedBlockElements)) {
264 chargedHadron->neutralPFCandidates_.push_back(jetConstituent);
294 "PFRecoTauChargedHadronFromPFCandidatePlugin");
std::vector< CandidatePtr > pfCandidates(const Jet &jet, int particleId, bool sort=true)
RecoTauVertexAssociator vertexAssociator_
std::vector< std::unique_ptr< PFRecoTauChargedHadron > > ChargedHadronVector
math::XYZPointF atECALEntrance(const reco::Candidate *part, double bField)
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
return_type operator()(const reco::Jet &) const override
Build a collection of chargedHadrons from objects in the input jet.
ChargedHadronVector return_type
const edm::EventSetup * evtSetup() const
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_
reco::VertexRef associatedVertex(const Jet &jet) const
std::vector< ElementInBlock > ElementsInBlocks
PFRecoTauChargedHadronAlgorithm
const ElementsInBlocks & elementsInBlocks() const
Abs< T >::type abs(const T &t)
bool isMatched(TrackingRecHit const &hit)
double dRmergeNeutralHadronWrtChargedHadron_
bool getData(T &iHolder) const
int minBlockElementMatchesPhoton_
std::vector< int > inputParticleIds_
const edm::Event * evt() const
Log< level::Warning, true > LogPrint
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::vector< reco::CandidatePtr > CandPtrs
~PFRecoTauChargedHadronFromPFCandidatePlugin() override
double dRmergePhotonWrtChargedHadron_
double dRmergeNeutralHadronWrtNeutralHadron_
double dRmergeNeutralHadronWrtOther_
Particle reconstructed by the particle flow algorithm.
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken_
const std::string & name() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
double dRmergeNeutralHadronWrtElectron_
double minMergeNeutralHadronEt_
void setChargedHadronP4(reco::PFRecoTauChargedHadron &chargedHadron, double scaleFactor_neutralPFCands=1.0)
void setPV(const reco::VertexRef &vtx)
Update the primary vertex.
void beginEvent() override
Hook called at the beginning of the event.
double dRmergePhotonWrtNeutralHadron_