11 #include <boost/bind.hpp>
75 produces<reco::PFJetCollection>(
"jets");
76 produces<PFJetMatchMap>();
82 std::cout <<
"<RecoTauJetRegionProducer::produce (moduleLabel = " <<
moduleLabel_ <<
")>:" << std::endl;
93 std::vector<PFCandPtr> pfCands;
94 pfCands.reserve(pfCandsHandle->size());
95 for (
size_t icand = 0; icand < pfCandsHandle->size(); ++icand ) {
96 pfCands.push_back(PFCandPtr(pfCandsHandle, icand));
104 size_t nJets = jets.
size();
117 size_t nOriginalJets = 0;
122 evt.
get(originalId, originalJets);
125 <<
"Can't get the original jets that made: " <<
inputJets_
126 <<
" that have product ID: " << originalId
127 <<
" from the event!!";
130 nOriginalJets = originalJets->size();
133 auto newJets = std::make_unique<reco::PFJetCollection>();
137 std::vector<int> matchInfo(nOriginalJets, -1);
138 newJets->reserve(nJets);
139 for (
size_t ijet = 0; ijet < nJets; ++ijet ) {
143 newJets->emplace_back(*jetRef);
148 for ( std::vector<PFCandPtr>::const_iterator pfCand = pfCands.begin();
149 pfCand != pfCands.end(); ++pfCand ) {
150 bool isMappedToJet =
false;
152 auto temp = jetToPFCandMap->find(jetRef);
153 if(
temp == jetToPFCandMap->end() ) {
154 edm::LogWarning(
"WeirdCandidateMap") <<
"Candidate map for jet " << jetRef.
key() <<
" is empty!";
159 pfCandMappedToJet != pfCandsMappedToJet.
end(); ++pfCandMappedToJet ) {
160 if (
reco::deltaR2(**pfCandMappedToJet, **pfCand) < 1.e-8 ) {
161 isMappedToJet =
true;
166 isMappedToJet =
true;
171 std::cout <<
"jet #" << ijet <<
": Pt = " << jetRef->pt() <<
", eta = " << jetRef->eta() <<
", phi = " << jetRef->eta() <<
","
172 <<
" mass = " << jetRef->mass() <<
", area = " << jetRef->jetArea() << std::endl;
175 for ( std::vector<reco::PFCandidatePtr>::const_iterator jetConstituent = jetConstituents.begin();
176 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
177 std::cout <<
" constituent #" << idx <<
": Pt = " << (*jetConstituent)->pt() <<
", eta = " << (*jetConstituent)->eta() <<
", phi = " << (*jetConstituent)->phi() << std::endl;
182 matchInfo[jetRef.
key()] = ijet;
189 auto matching = std::make_unique<PFJetMatchMap>(newJetsInEvent);
192 filler.
insert(originalJets, matchInfo.begin(), matchInfo.end());
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
RecoTauJetRegionProducer(const edm::ParameterSet &pset)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::Association< reco::PFJetCollection > PFJetMatchMap
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< reco::PFCandidateCollection > pf_token
void insert(const H &h, I begin, I end)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
key_type key() const
Accessor for product key.
const_iterator end() const
Termination of iteration.
void produce(edm::Event &evt, const edm::EventSetup &es) override
Jets made from PFObjects.
const_iterator begin() const
Initialize an iterator over the RefVector.
ProductID id() const
Accessor for product ID.
edm::EDGetTokenT< reco::CandidateView > Jets_token
~RecoTauJetRegionProducer()
edm::EDGetTokenT< JetToPFCandidateAssociation > pfCandAssocMap_token
bool get(ProductID const &oid, Handle< PROD > &result) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::InputTag pfCandAssocMapSrc_
void clearDaughters()
clear daughter references
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
edm::AssociationMap< edm::OneToMany< std::vector< reco::PFJet >, std::vector< reco::PFCandidate >, unsigned int > > JetToPFCandidateAssociation
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.