86 std::cout <<
"<RecoTauJetRegionProducer::produce (moduleLabel = " <<
moduleLabel_ <<
")>:" << std::endl;
97 std::vector<PFCandPtr> pfCands;
98 pfCands.reserve(pfCandsHandle->size());
99 for (
size_t icand = 0; icand < pfCandsHandle->size(); ++icand ) {
100 pfCands.push_back(PFCandPtr(pfCandsHandle, icand));
108 size_t nJets = jets.
size();
113 std::vector<std::unordered_set<unsigned> > fastJetToPFCandMap;
116 fastJetToPFCandMap.resize(nJets);
117 for (
size_t ijet = 0; ijet < nJets; ++ijet ) {
120 const auto& pfCandsMappedToJet = (*jetToPFCandMap)[jetRef];
121 for (
const auto& pfCandMappedToJet : pfCandsMappedToJet ) {
122 fastJetToPFCandMap[ijet].emplace(pfCandMappedToJet.key());
131 size_t nOriginalJets = 0;
136 evt.
get(originalId, originalJets);
139 <<
"Can't get the original jets that made: " <<
inputJets_ 140 <<
" that have product ID: " << originalId
141 <<
" from the event!!";
144 nOriginalJets = originalJets->size();
147 auto newJets = std::make_unique<reco::PFJetCollection>();
151 std::vector<int> matchInfo(nOriginalJets, -1);
152 newJets->reserve(nJets);
154 for (
size_t ijet = 0; ijet < nJets; ++ijet ) {
157 if(jetRef->pt() -
minJetPt_ < 1e-5)
continue;
160 newJets->emplace_back(*jetRef);
165 for (
const auto& pfCand : pfCands ) {
166 bool isMappedToJet =
false;
167 if ( jetToPFCandMap.
isValid() ) {
168 auto temp = jetToPFCandMap->
find(jetRef);
169 if(
temp == jetToPFCandMap->
end() ) {
170 edm::LogWarning(
"WeirdCandidateMap") <<
"Candidate map for jet " << jetRef.
key() <<
" is empty!";
173 isMappedToJet = fastJetToPFCandMap[ijet].count(pfCand.key());
175 isMappedToJet =
true;
180 std::cout <<
"jet #" << ijet <<
": Pt = " << jetRef->pt() <<
", eta = " << jetRef->eta() <<
", phi = " << jetRef->eta() <<
"," 181 <<
" mass = " << jetRef->mass() <<
", area = " << jetRef->jetArea() << std::endl;
184 for ( std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin();
185 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
186 std::cout <<
" constituent #" << idx <<
": Pt = " << (*jetConstituent)->pt() <<
", eta = " << (*jetConstituent)->eta() <<
", phi = " << (*jetConstituent)->phi() << std::endl;
192 matchInfo[jetRef.
key()] = nNewJets;
200 auto matching = std::make_unique<PFJetMatchMap>(newJetsInEvent);
203 filler.insert(originalJets, matchInfo.begin(), matchInfo.end());
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< reco::PFCandidateCollection > pf_token
const_iterator find(const key_type &k) const
find element with specified reference key
key_type key() const
Accessor for product key.
Jets made from PFObjects.
ProductID id() const
Accessor for product ID.
edm::EDGetTokenT< reco::CandidateView > Jets_token
edm::EDGetTokenT< JetToPFCandidateAssociation > pfCandAssocMap_token
Abs< T >::type abs(const T &t)
bool get(ProductID const &oid, Handle< PROD > &result) const
helper::Filler< ValueMap< int > > Filler
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
edm::InputTag pfCandAssocMapSrc_
void clearDaughters()
clear daughter references
void addDaughter(const CandidatePtr &)
add a daughter via a reference
virtual std::vector< reco::PFCandidatePtr > getPFConstituents() const
get all constituents
size_type size() const
Size of the RefVector.