63 : moduleLabel_(
cfg.getParameter<
std::
string>(
"@module_label")) {
67 verbosity_ = (
cfg.exists(
"verbosity")) ?
cfg.getParameter<
int>(
"verbosity") : 0;
69 produces<reco::PFJetCollection>();
70 produces<JetToPFCandidateAssociation>(
"pfCandAssocMapForIsolation");
75 typedef std::vector<std::unordered_set<uint32_t> > JetToConstitMap;
80 double chargedHadronEnergy = 0.;
81 double neutralHadronEnergy = 0.;
82 double chargedEmEnergy = 0.;
83 double neutralEmEnergy = 0.;
84 double chargedMuEnergy = 0.;
85 int chargedMultiplicity = 0;
86 int neutralMultiplicity = 0;
88 for (
auto const& jetConstituent : jetConstituents) {
89 const reco::PFCandidate* pfCandidate = dynamic_cast<const reco::PFCandidate*>(jetConstituent.get());
93 chargedHadronEnergy += pfCandidate->
energy();
94 ++chargedMultiplicity;
97 chargedEmEnergy += pfCandidate->
energy();
98 ++chargedMultiplicity;
101 chargedMuEnergy += pfCandidate->
energy();
102 ++chargedMultiplicity;
107 neutralEmEnergy += pfCandidate->
energy();
108 ++neutralMultiplicity;
112 neutralHadronEnergy += pfCandidate->
energy();
113 ++neutralMultiplicity;
117 <<
"PFCandidate: Pt = " << pfCandidate->
pt() <<
", eta = " << pfCandidate->
eta()
118 <<
", phi = " << pfCandidate->
phi() <<
" has invalid particleID = " << pfCandidate->
particleId()
119 <<
" !!" << std::endl;
124 <<
"Jet constituent: Pt = " << jetConstituent->pt() <<
", eta = " << jetConstituent->eta()
125 <<
", phi = " << jetConstituent->phi() <<
" is not of type PFCandidate !!" << std::endl;
146 for (
auto const& jetConstituent : jetConstituents) {
147 const reco::Jet* subjet = dynamic_cast<const reco::Jet*>(jetConstituent.get());
149 getJetConstituents(*subjet, jet_and_subjetConstituents);
151 jet_and_subjetConstituents.push_back(jetConstituent);
156 std::vector<reco::PFCandidateRef> getPFCandidates_exclJetConstituents(
161 auto const& collection_cand = (*pfCandidates);
162 std::vector<reco::PFCandidateRef> pfCandidates_exclJetConstituents;
164 for (
size_t pfCandidateIdx = 0; pfCandidateIdx < numPFCandidates; ++pfCandidateIdx) {
165 if (!(
deltaR2(collection_cand[pfCandidateIdx],
jet) < 1.0))
167 bool isJetConstituent = constitmap.count(pfCandidateIdx);
168 if (!(isJetConstituent ^
invert)) {
170 pfCandidates_exclJetConstituents.push_back(pfCandidate);
173 return pfCandidates_exclJetConstituents;
177 std::cout <<
"#" <<
label <<
" = " << jetConstituents.size() <<
":" << std::endl;
179 for (
auto const& jetConstituent : jetConstituents) {
180 std::cout <<
" jetConstituent #" <<
idx <<
": Pt = " << (*jetConstituent).pt()
181 <<
", eta = " << (*jetConstituent).eta() <<
", phi = " << (*jetConstituent).phi() << std::endl;
189 std::cout <<
"<BoostedTauSeedsProducer::produce (moduleLabel = " <<
moduleLabel_ <<
")>:" << std::endl;
205 auto selectedSubjets = std::make_unique<reco::PFJetCollection>();
208 auto selectedSubjetPFCandidateAssociationForIsolation =
209 std::make_unique<JetToPFCandidateAssociation>(&evt.
productGetter());
213 JetToConstitMap constitmap(subjets->
size());
216 const auto& thesubjets = *subjets;
217 for (
unsigned i = 0;
i < thesubjets.size(); ++
i) {
218 for (
unsigned j = 0;
j < thesubjets[
i].numberOfDaughters(); ++
j) {
219 constitmap[
i].emplace(thesubjets[
i].daughterPtr(
j).
key());
226 assert(subjet1 && subjet2);
228 std::cout <<
"processing jet #" <<
idx <<
":" << std::endl;
229 std::cout <<
" subjet1: Pt = " << subjet1->
pt() <<
", eta = " << subjet1->
eta() <<
", phi = " << subjet1->
phi()
230 <<
", mass = " << subjet1->
mass() <<
" (#constituents = " << subjet1->
nConstituents()
231 <<
", area = " << subjet1->
jetArea() <<
")" << std::endl;
232 std::cout <<
" subjet2: Pt = " << subjet2->
pt() <<
", eta = " << subjet2->
eta() <<
", phi = " << subjet2->
phi()
233 <<
", mass = " << subjet2->
mass() <<
" (#constituents = " << subjet2->
nConstituents()
234 <<
", area = " << subjet2->
jetArea() <<
")" << std::endl;
242 getJetConstituents(*subjet1, subjetConstituents1);
244 getJetConstituents(*subjet2, subjetConstituents2);
246 printJetConstituents(
"subjetConstituents1", subjetConstituents1);
247 printJetConstituents(
"subjetConstituents2", subjetConstituents2);
250 selectedSubjets->push_back(convertToPFJet(*subjet1, subjetConstituents1));
252 selectedSubjets->push_back(convertToPFJet(*subjet2, subjetConstituents2));
256 std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet1 =
257 getPFCandidates_exclJetConstituents(*subjet1,
pfCandidates, constitmap[2 *
idx + 1],
false);
258 std::vector<reco::PFCandidateRef> pfCandidatesNotInSubjet2 =
259 getPFCandidates_exclJetConstituents(*subjet2,
pfCandidates, constitmap[2 *
idx],
false);
261 std::cout <<
"#pfCandidatesNotInSubjet1 = " << pfCandidatesNotInSubjet1.size() << std::endl;
262 std::cout <<
"#pfCandidatesNotInSubjet2 = " << pfCandidatesNotInSubjet2.size() << std::endl;
267 for (
auto const& pfCandidate : pfCandidatesNotInSubjet1) {
268 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef1, pfCandidate);
270 for (
auto const& pfCandidate : pfCandidatesNotInSubjet2) {
271 selectedSubjetPFCandidateAssociationForIsolation->insert(subjetRef2, pfCandidate);
276 evt.
put(
std::move(selectedSubjetPFCandidateAssociationForIsolation),
"pfCandAssocMapForIsolation");