10 #include <TClonesArray.h>
13 #include <fastjet/AreaDefinition.hh>
14 #include <fastjet/ClusterSequenceArea.hh>
15 #include <fastjet/Selector.hh>
16 #include <fastjet/tools/BackgroundEstimatorBase.hh>
17 #include <fastjet/tools/JetMedianBackgroundEstimator.hh>
18 #include <fastjet/tools/GridMedianBackgroundEstimator.hh>
19 #include <fastjet/ClusterSequence.hh>
20 #include <fastjet/FunctionOfPseudoJet.hh>
21 #include <fastjet/JetDefinition.hh>
22 #include <fastjet/PseudoJet.hh>
23 #include <fastjet/contrib/RecursiveSymmetryCutBase.hh>
24 #include <fastjet/contrib/SoftDrop.hh>
25 #include <fastjet/contrib/ConstituentSubtractor.hh>
42 fastjet::ClusterSequence clusseq;
43 if (m_opt.verbosity > 0)
45 clusseq.print_banner();
50 clusseq.set_fastjet_banner_stream(&nullstream);
51 clusseq.print_banner();
52 clusseq.set_fastjet_banner_stream(&std::cout);
58 os <<
" FastJetAlgo: ";
91 std::cout <<
PHWHERE << std::endl;
92 std::cout <<
"Warning, no recognized jet clustering algorithm provided in FastJetAlgo" << std::endl
93 <<
"defaulting to antikt_algorithm" << std::endl;
112 std::vector<fastjet::PseudoJet>& pseudojets
115 m_cluseq =
new fastjet::ClusterSequence( pseudojets, jetdef );
126 std::vector<fastjet::PseudoJet>& pseudojets
131 fastjet::AreaDefinition area_def (
132 fastjet::active_area_explicit_ghosts,
136 m_cluseqarea =
new fastjet::ClusterSequenceArea( pseudojets, jetdef, area_def );
138 fastjet::Selector selector = (
141 : !fastjet::SelectorIsPureGhost()
149 fastjet::AreaDefinition area_def (
150 fastjet::active_area_explicit_ghosts,
158 fastjet::JetMedianBackgroundEstimator bge {rho_select, jet_def_bkgd, area_def};
159 bge.set_particles(constituents);
163 std::vector<fastjet::PseudoJet>
165 std::vector<fastjet::PseudoJet> pseudojets;
166 for (
unsigned int ipart = 0; ipart < particles.size(); ++ipart)
171 if (particles[ipart]->get_e() == 0.)
continue;
172 if (!std::isfinite(particles[ipart]->get_px()) ||
173 !std::isfinite(particles[ipart]->get_py()) ||
174 !std::isfinite(particles[ipart]->get_pz()) ||
175 !std::isfinite(particles[ipart]->get_e()))
177 std::cout <<
PHWHERE <<
" invalid particle kinematics:"
178 <<
" px: " << particles[ipart]->get_px()
179 <<
" py: " << particles[ipart]->get_py()
180 <<
" pz: " << particles[ipart]->get_pz()
181 <<
" e: " << particles[ipart]->get_e() << std::endl;
184 fastjet::PseudoJet pseudojet(particles[ipart]->get_px(),
185 particles[ipart]->get_py(),
186 particles[ipart]->get_pz(),
187 particles[ipart]->get_e());
189 pseudojet.set_user_index(ipart);
190 pseudojets.push_back(pseudojet);
199 if (jetcont ==
nullptr)
return;
202 jetcont->
add_property( {Jet::PROPERTY::prop_zg, Jet::PROPERTY::prop_Rg, Jet::PROPERTY::prop_mu} );
215 cs_subtractor =
new fastjet::contrib::ConstituentSubtractor();
239 if (
m_opt.
verbosity > 1) std::cout <<
" Verbosity>1 FastJetAlgo::process_event -- entered" << std::endl;
240 if (
m_opt.
verbosity > 8) std::cout <<
" Verbosity>8 #input particles: " << particles.size() << std::endl;
248 std::cout <<
" Before Constituent Subtraction: " << std::endl;
251 for (
auto c : pseudojets) {
253 if (i<100) std::cout << Form(
" jet[%2i] %8.4f sum %8.4f", i,
c.perp(), sumpt) << std::endl;
256 auto _c = pseudojets.back();
257 std::cout << Form(
" jet[%2i] %8.4f sum %8.4f", i++, _c.perp(), sumpt) << std::endl << std::endl;
262 auto subtracted_pseudojets =
cs_subtractor->subtract_event(pseudojets);
263 pseudojets =
std::move(subtracted_pseudojets);
266 std::cout <<
" After Constituent Subtraction: " << std::endl;
269 for (
auto c : pseudojets) {
271 if (i<100) std::cout << Form(
" jet[%2i] %8.4f sum %8.4f", i,
c.perp(), sumpt) << std::endl;
274 auto _c = pseudojets.back();
275 std::cout << Form(
" jet[%2i] %8.4f sum %8.4f", i++, _c.perp(), sumpt) << std::endl << std::endl;
283 if (
m_opt.
verbosity > 8) std::cout <<
" Verbosity>8 fastjets: " << fastjets.size() << std::endl;
284 for (
unsigned int ijet = 0; ijet < fastjets.size(); ++ijet)
286 auto* jet = jetcont->
add_jet();
287 jet->
set_px(fastjets[ijet].px());
288 jet->set_py(fastjets[ijet].py());
289 jet->set_pz(fastjets[ijet].pz());
290 jet->set_e(fastjets[ijet].
e());
304 std::cout <<
"FastJetAlgo::get_jets : created SoftDrop groomer configuration : "
305 << sd.description() << std::endl;
308 fastjet::PseudoJet sd_jet = sd(fastjets[ijet]);
312 std::cout <<
"original jet: pt / eta / phi / m = " << fastjets[ijet].perp()
313 <<
" / " << fastjets[ijet].eta() <<
" / " << fastjets[ijet].phi() <<
" / "
314 << fastjets[ijet].m() << std::endl;
315 std::cout <<
"SoftDropped jet: pt / eta / phi / m = " << sd_jet.perp() <<
" / "
316 << sd_jet.eta() <<
" / " << sd_jet.phi() <<
" / " << sd_jet.m() << std::endl;
318 std::cout <<
" delta_R between subjets: " << sd_jet.structure_of<fastjet::contrib::SoftDrop>().delta_R() << std::endl;
319 std::cout <<
" symmetry measure(z): " << sd_jet.structure_of<fastjet::contrib::SoftDrop>().symmetry() << std::endl;
320 std::cout <<
" mass drop(mu): " << sd_jet.structure_of<fastjet::contrib::SoftDrop>().
mu() << std::endl;
324 jet->set_property(
m_zg_index, sd_jet.structure_of<fastjet::contrib::SoftDrop>().symmetry());
325 jet->set_property(
m_Rg_index, sd_jet.structure_of<fastjet::contrib::SoftDrop>().delta_R() );
326 jet->set_property(
m_mu_index, sd_jet.structure_of<fastjet::contrib::SoftDrop>().mu() );
331 std::vector<fastjet::PseudoJet> constituents = fastjets[ijet].constituents();
333 for (
auto&
comp : constituents) {
334 if (
comp.is_pure_ghost())
continue;
337 jet->insert_comp(particles[
comp.user_index()]->get_comp_vec(),
true);
341 n_clustered += constituents.size();
343 for (
auto&
comp : constituents) {
344 jet->insert_comp(particles[
comp.user_index()]->get_comp_vec(),
true);
348 jet->set_comp_sort_flag();
350 if (
m_opt.
verbosity > 1) std::cout <<
"FastJetAlgo::process_event -- exited" << std::endl;
364 std::cout <<
"FastJetAlgo::get_jets : created SoftDrop groomer configuration : " << sd.description() << std::endl;
368 std::vector<Jet*> jets;
369 for (
unsigned int ijet = 0; ijet < fastjets.size(); ++ijet)
372 jet->
set_px(fastjets[ijet].px());
373 jet->
set_py(fastjets[ijet].py());
374 jet->
set_pz(fastjets[ijet].pz());
375 jet->
set_e(fastjets[ijet].
e());
382 fastjet::PseudoJet sd_jet = sd(fastjets[ijet]);
386 std::cout <<
"original jet: pt / eta / phi / m = " << fastjets[ijet].perp() <<
" / " << fastjets[ijet].eta() <<
" / " << fastjets[ijet].phi() <<
" / " << fastjets[ijet].m() << std::endl;
387 std::cout <<
"SoftDropped jet: pt / eta / phi / m = " << sd_jet.perp() <<
" / " << sd_jet.eta() <<
" / " << sd_jet.phi() <<
" / " << sd_jet.m() << std::endl;
389 std::cout <<
" delta_R between subjets: " << sd_jet.structure_of<fastjet::contrib::SoftDrop>().delta_R() << std::endl;
390 std::cout <<
" symmetry measure(z): " << sd_jet.structure_of<fastjet::contrib::SoftDrop>().symmetry() << std::endl;
391 std::cout <<
" mass drop(mu): " << sd_jet.structure_of<fastjet::contrib::SoftDrop>().
mu() << std::endl;
395 jet->
set_property(Jet::PROPERTY::prop_zg, sd_jet.structure_of<fastjet::contrib::SoftDrop>().symmetry());
396 jet->
set_property(Jet::PROPERTY::prop_Rg, sd_jet.structure_of<fastjet::contrib::SoftDrop>().delta_R());
397 jet->
set_property(Jet::PROPERTY::prop_mu, sd_jet.structure_of<fastjet::contrib::SoftDrop>().mu());
402 std::vector<fastjet::PseudoJet> constituents = fastjets[ijet].constituents();
404 for (
auto&
comp : constituents) {
405 if (
comp.is_pure_ghost())
continue;
412 n_clustered += constituents.size();
414 for (
auto&
comp : constituents) {
428 if (
m_opt.
verbosity > 1) std::cout <<
"FastJetAlgo::process_event -- exited" << std::endl;