70 edm::LogWarning(
"") <<
"The \"correctlyExcludeOverlap\" flag set to \"False\":\n" 71 <<
"=> module is working in a buggy backward compatibility mode; is it intended?";
76 produces<reco::PFJetCollection>();
77 produces<JetToPFCandidateAssociation>(
"pfCandAssocMapForIsolation");
82 typedef std::vector<std::unordered_set<uint32_t> > JetToConstitMap;
87 double chargedHadronEnergy = 0.;
88 double neutralHadronEnergy = 0.;
89 double chargedEmEnergy = 0.;
90 double neutralEmEnergy = 0.;
91 double chargedMuEnergy = 0.;
92 int chargedMultiplicity = 0;
93 int neutralMultiplicity = 0;
95 for (
auto const& jetConstituent : jetConstituents) {
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()
125 <<
", phi = " << pfCandidate->
phi() <<
" has invalid particleID = " << pfCandidate->
particleId()
126 <<
" !!" << std::endl;
131 <<
"Jet constituent: Pt = " << jetConstituent->pt() <<
", eta = " << jetConstituent->eta()
132 <<
", phi = " << jetConstituent->phi() <<
" is not of type PFCandidate !!" << std::endl;
153 for (
auto const& jetConstituent : jetConstituents) {
156 getJetConstituents(*subjet, jet_and_subjetConstituents);
158 jet_and_subjetConstituents.push_back(jetConstituent);
163 std::vector<reco::PFCandidateRef> getPFCandidates_exclJetConstituents(
168 auto const& collection_cand = (*pfCandidates);
169 std::vector<reco::PFCandidateRef> pfCandidates_exclJetConstituents;
170 size_t numPFCandidates = pfCandidates->size();
171 for (
size_t pfCandidateIdx = 0; pfCandidateIdx < numPFCandidates; ++pfCandidateIdx) {
172 if (!(
deltaR2(collection_cand[pfCandidateIdx], jet) < 1.0))
174 bool isJetConstituent = constitmap.count(pfCandidateIdx);
175 if (!(isJetConstituent ^ invert)) {
177 pfCandidates_exclJetConstituents.push_back(pfCandidate);
180 return pfCandidates_exclJetConstituents;
184 std::cout <<
"#" << label <<
" = " << jetConstituents.size() <<
":" << std::endl;
186 for (
auto const& jetConstituent : jetConstituents) {
187 std::cout <<
" jetConstituent #" << idx <<
": Pt = " << (*jetConstituent).pt()
188 <<
", 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 =
216 std::make_unique<JetToPFCandidateAssociation>(&evt.
productGetter());
220 JetToConstitMap constitmap(subjets->
size());
223 const auto& thesubjets = *subjets;
224 for (
unsigned i = 0;
i < thesubjets.size(); ++
i) {
225 for (
unsigned j = 0; j < thesubjets[
i].numberOfDaughters(); ++j) {
226 constitmap[
i].emplace(thesubjets[
i].daughterPtr(j).
key());
233 assert(subjet1 && subjet2);
235 std::cout <<
"processing jet #" <<
idx <<
":" << std::endl;
236 std::cout <<
" subjet1: Pt = " << subjet1->
pt() <<
", eta = " << subjet1->
eta() <<
", phi = " << subjet1->
phi()
237 <<
", mass = " << subjet1->
mass() <<
" (#constituents = " << subjet1->
nConstituents()
238 <<
", area = " << subjet1->
jetArea() <<
")" << std::endl;
239 std::cout <<
" subjet2: Pt = " << subjet2->
pt() <<
", eta = " << subjet2->
eta() <<
", phi = " << subjet2->
phi()
240 <<
", mass = " << subjet2->
mass() <<
" (#constituents = " << subjet2->
nConstituents()
241 <<
", area = " << subjet2->
jetArea() <<
")" << std::endl;
249 getJetConstituents(*subjet1, subjetConstituents1);
251 getJetConstituents(*subjet2, subjetConstituents2);
253 printJetConstituents(
"subjetConstituents1", subjetConstituents1);
254 printJetConstituents(
"subjetConstituents2", subjetConstituents2);
257 selectedSubjets->push_back(convertToPFJet(*subjet1, subjetConstituents1));
259 selectedSubjets->push_back(convertToPFJet(*subjet2, subjetConstituents2));
263 std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet1, pfCandidatesNotInSubjet2;
268 pfCandidatesNotInSubjet1 = getPFCandidates_exclJetConstituents(*subjet1, pfCandidates, constitmap[2 *
idx + 1],
false);
269 pfCandidatesNotInSubjet2 = getPFCandidates_exclJetConstituents(*subjet2, pfCandidates, constitmap[2 *
idx],
false);
272 pfCandidatesNotInSubjet1 = getPFCandidates_exclJetConstituents(*subjet1, pfCandidates, constitmap[2 *
idx],
false);
273 pfCandidatesNotInSubjet2 = getPFCandidates_exclJetConstituents(*subjet2, pfCandidates, constitmap[2 * idx + 1],
false);
276 std::cout <<
"#pfCandidatesNotInSubjet1 = " << pfCandidatesNotInSubjet1.size() << std::endl;
277 std::cout <<
"#pfCandidatesNotInSubjet2 = " << pfCandidatesNotInSubjet2.size() << std::endl;
282 for (
auto const& pfCandidate : pfCandidatesNotInSubjet1) {
283 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef1, pfCandidate);
285 for (
auto const& pfCandidate : pfCandidatesNotInSubjet2) {
286 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef2, pfCandidate);
291 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
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
#define DEFINE_FWK_MODULE(type)
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
bool correctlyExcludeOverlap_
RefProd< PROD > getRefBeforePut()
edm::AssociationMap< edm::OneToMany< std::vector< reco::PFJet >, std::vector< reco::PFCandidate >, unsigned int > > JetToPFCandidateAssociation
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
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