53 typedef std::vector<reco::CandidatePtr>
CandPtrs;
57 std::unique_ptr<RecoTauQualityCuts>
qcuts_;
89 edm::ParameterSet qcuts_pset =
pset.getParameterSet(
"qualityCuts").getParameterSet(
"signalQualityCuts");
90 qcuts_ = std::make_unique<RecoTauQualityCuts>(qcuts_pset);
125 int maxUnmatchedBlockElements1plus2) {
127 int numBlocks1 = blockElements1.size();
129 int numBlocks2 = blockElements2.size();
130 int numBlocks_matched = 0;
131 for (reco::PFCandidate::ElementsInBlocks::const_iterator blockElement1 = blockElements1.begin();
132 blockElement1 != blockElements1.end();
135 for (reco::PFCandidate::ElementsInBlocks::const_iterator blockElement2 = blockElements2.begin();
136 blockElement2 != blockElements2.end();
138 if (blockElement1->first.id() == blockElement2->first.id() &&
139 blockElement1->first.key() == blockElement2->first.key() &&
140 blockElement1->second == blockElement2->second) {
147 assert(numBlocks_matched <= numBlocks1);
148 assert(numBlocks_matched <= numBlocks2);
149 if (numBlocks_matched >= minMatches1 && numBlocks_matched >= minMatches2 &&
150 ((numBlocks1 - numBlocks_matched) + (numBlocks2 - numBlocks_matched)) <= maxUnmatchedBlockElements1plus2) {
161 edm::LogPrint(
"TauChHadronFromPF") <<
"<PFRecoTauChargedHadronFromPFCandidatePlugin::operator()>:";
171 for (CandPtrs::iterator
cand = candsVector.begin();
cand != candsVector.end(); ++
cand) {
174 <<
"processing PFCandidate: Pt = " << (*cand)->pt() <<
", eta = " << (*cand)->eta()
175 <<
", phi = " << (*cand)->phi() <<
" (pdgId = " << (*cand)->pdgId() <<
", charge = " << (*cand)->charge()
180 if (
std::abs((*cand)->charge()) > 0.5)
188 if (pfCand->trackRef().isNonnull())
190 else if (pfCand->muonRef().isNonnull() && pfCand->muonRef()->innerTrack().isNonnull())
192 else if (pfCand->muonRef().isNonnull() && pfCand->muonRef()->globalTrack().isNonnull())
194 else if (pfCand->muonRef().isNonnull() && pfCand->muonRef()->outerTrack().isNonnull())
196 else if (pfCand->gsfTrackRef().isNonnull())
207 for (
const auto& jetConstituent :
jet.daughterPtrVector()) {
212 int jetConstituentPdgId =
std::abs(jetConstituent->pdgId());
213 if (!(jetConstituentPdgId == 130 || jetConstituentPdgId == 22))
218 double dRmerge = -1.;
219 int minBlockElementMatches = 1000;
220 int maxUnmatchedBlockElements = 0;
221 double minMergeEt = 1.e+6;
222 if (jetConstituentPdgId == 130) {
225 else if (
pdgId == 130)
227 else if (
pdgId == 11)
234 }
else if (jetConstituentPdgId == 22) {
237 else if (
pdgId == 130)
239 else if (
pdgId == 11)
248 if (jetConstituent->et() > minMergeEt) {
250 chargedHadron->neutralPFCandidates_.push_back(jetConstituent);
256 if (pfCand !=
nullptr && pfJetConstituent !=
nullptr) {
257 if (isMatchedByBlockElement(*pfJetConstituent,
259 minBlockElementMatches,
260 minBlockElementMatches,
261 maxUnmatchedBlockElements)) {
262 chargedHadron->neutralPFCandidates_.push_back(jetConstituent);
292 "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)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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.
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_
int minBlockElementMatchesPhoton_
std::vector< int > inputParticleIds_
const edm::Event * evt() const
Log< level::Warning, true > LogPrint
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 beginEvent() override
Hook called at the beginning of the event.
double dRmergePhotonWrtNeutralHadron_
std::unique_ptr< RecoTauQualityCuts > qcuts_