37 #include <boost/foreach.hpp> 73 produces<reco::PFJetCollection>();
74 produces<JetToPFCandidateAssociation>(
"pfCandAssocMapForIsolation");
80 typedef std::vector<std::unordered_set<uint32_t> > JetToConstitMap;
86 double chargedHadronEnergy = 0.;
87 double neutralHadronEnergy = 0.;
88 double chargedEmEnergy = 0.;
89 double neutralEmEnergy = 0.;
90 double chargedMuEnergy = 0.;
91 int chargedMultiplicity = 0;
92 int neutralMultiplicity = 0;
94 for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
95 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
100 chargedHadronEnergy += pfCandidate->
energy();
101 ++chargedMultiplicity;
104 chargedEmEnergy += pfCandidate->
energy();
105 ++chargedMultiplicity;
108 chargedMuEnergy += pfCandidate->
energy();
109 ++chargedMultiplicity;
114 neutralEmEnergy += pfCandidate->
energy();
115 ++neutralMultiplicity;
119 neutralHadronEnergy += pfCandidate->
energy();
120 ++neutralMultiplicity;
124 <<
"PFCandidate: Pt = " << pfCandidate->
pt() <<
", eta = " << pfCandidate->
eta() <<
", phi = " << pfCandidate->
phi()
125 <<
" has invalid particleID = " << pfCandidate->
particleId() <<
" !!" << std::endl;
130 <<
"Jet constituent: Pt = " << pfCandidate->
pt() <<
", eta = " << pfCandidate->
eta() <<
", phi = " << pfCandidate->
phi()
131 <<
" is not of type PFCandidate !!" << std::endl;
153 for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
154 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
157 getJetConstituents(*subjet, jet_and_subjetConstituents);
159 jet_and_subjetConstituents.push_back(*jetConstituent);
167 auto const & collection_cand = (*pfCandidates);
168 std::vector<reco::PFCandidateRef> pfCandidates_exclJetConstituents;
169 size_t numPFCandidates = pfCandidates->size();
170 for (
size_t pfCandidateIdx = 0; pfCandidateIdx < numPFCandidates; ++pfCandidateIdx ) {
171 if(!(
deltaR2(collection_cand[pfCandidateIdx], jet)<1.0))
continue;
172 bool isJetConstituent = constitmap.count(pfCandidateIdx);
173 if ( !(isJetConstituent^invert) ) {
175 pfCandidates_exclJetConstituents.push_back(pfCandidate);
178 return pfCandidates_exclJetConstituents;
183 std::cout <<
"#" << label <<
" = " << jetConstituents.size() <<
":" << std::endl;
185 for ( reco::Jet::Constituents::const_iterator jetConstituent = jetConstituents.begin();
186 jetConstituent != jetConstituents.end(); ++jetConstituent ) {
187 std::cout <<
" jetConstituent #" << idx <<
": Pt = " << (*jetConstituent)->pt() <<
", eta = " << (*jetConstituent)->eta() <<
", phi = " << (*jetConstituent)->phi() << std::endl;
196 std::cout <<
"<BoostedTauSeedsProducer::produce (moduleLabel = " <<
moduleLabel_ <<
")>:" << std::endl;
204 assert((subjets->
size() % 2) == 0);
209 std::cout <<
"#pfCandidates = " << pfCandidates->size() << std::endl;
212 auto selectedSubjets = std::make_unique<reco::PFJetCollection>();
215 auto selectedSubjetPFCandidateAssociationForIsolation = std::make_unique<JetToPFCandidateAssociation>(&evt.
productGetter());
219 JetToConstitMap constitmap(subjets->
size());
222 const auto& thesubjets = *subjets;
223 for(
unsigned i = 0;
i < thesubjets.size(); ++
i ) {
224 for (
unsigned j = 0; j < thesubjets[
i].numberOfDaughters(); ++j ) {
225 constitmap[
i].emplace(thesubjets[
i].daughterPtr(j).
key());
232 assert(subjet1 && subjet2);
234 std::cout <<
"processing jet #" <<
idx <<
":" << std::endl;
235 std::cout <<
" subjet1: Pt = " << subjet1->
pt() <<
", eta = " << subjet1->
eta() <<
", phi = " << subjet1->
phi() <<
", mass = " << subjet1->
mass()
236 <<
" (#constituents = " << subjet1->
nConstituents() <<
", area = " << subjet1->
jetArea() <<
")" << std::endl;
237 std::cout <<
" subjet2: Pt = " << subjet2->
pt() <<
", eta = " << subjet2->
eta() <<
", phi = " << subjet2->
phi() <<
", mass = " << subjet2->
mass()
238 <<
" (#constituents = " << subjet2->
nConstituents() <<
", area = " << subjet2->
jetArea() <<
")" << std::endl;
246 getJetConstituents(*subjet1, subjetConstituents1);
248 getJetConstituents(*subjet2, subjetConstituents2);
250 printJetConstituents(
"subjetConstituents1", subjetConstituents1);
251 printJetConstituents(
"subjetConstituents2", subjetConstituents2);
254 selectedSubjets->push_back(convertToPFJet(*subjet1, subjetConstituents1));
256 selectedSubjets->push_back(convertToPFJet(*subjet2, subjetConstituents2));
260 std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet1 = getPFCandidates_exclJetConstituents(*subjet1, pfCandidates, constitmap[2*
idx], subjetConstituents2, 1.
e-4,
false);
261 std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet2 = getPFCandidates_exclJetConstituents(*subjet2, pfCandidates, constitmap[2*idx+1], subjetConstituents1, 1.
e-4,
false);
263 std::cout <<
"#pfCandidatesNotInSubjet1 = " << pfCandidatesNotInSubjet1.size() << std::endl;
264 std::cout <<
"#pfCandidatesNotInSubjet2 = " << pfCandidatesNotInSubjet2.size() << std::endl;
270 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef1, pfCandidate);
273 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef2, pfCandidate);
278 evt.
put(
std::move(selectedSubjetPFCandidateAssociationForIsolation),
"pfCandAssocMapForIsolation");
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
EDProductGetter const & productGetter() const
~BoostedTauSeedsProducer() override
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< Constituent > Constituents
double pt() const final
transverse momentum
float mNeutralHadronEnergy
virtual Constituents getJetConstituents() const
list of constituents
Jets made from PFObjects.
float mChargedHadronEnergy
BoostedTauSeedsProducer(const edm::ParameterSet &)
virtual void setJetArea(float fArea)
set jet area
Container::value_type value_type
edm::View< reco::Jet > JetView
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
const Point & vertex() const override
vertex position (overwritten by PF...)
double energy() const final
energy
const LorentzVector & p4() const final
four-momentum Lorentz vector
RefProd< PROD > getRefBeforePut()
edm::AssociationMap< edm::OneToMany< std::vector< reco::PFJet >, std::vector< reco::PFCandidate >, unsigned int > > JetToPFCandidateAssociation
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
std::vector< PFJet > PFJetCollection
collection of PFJet objects
Particle reconstructed by the particle flow algorithm.
virtual float jetArea() const
get jet area
virtual int nConstituents() const
of constituents
const_reference at(size_type pos) const
edm::EDGetTokenT< JetView > srcSubjets_
void produce(edm::Event &, const edm::EventSetup &) override
virtual ParticleType particleId() const
double phi() const final
momentum azimuthal angle
double mass() const final
mass