197#include "fastjet/ClusterSequenceArea.hh"
198#include "fastjet/tools/JetMedianBackgroundEstimator.hh"
199#include "fastjet/tools/GridMedianBackgroundEstimator.hh"
200#include "fastjet/tools/Subtractor.hh"
201#include "fastjet/Selector.hh"
217#include "fastjet/config.h"
221#ifdef FASTJET_ENABLE_PLUGIN_SISCONE
222#include "fastjet/SISConePlugin.hh"
223#include "fastjet/SISConeSphericalPlugin.hh"
225#ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
226#include "fastjet/CDFMidPointPlugin.hh"
227#include "fastjet/CDFJetCluPlugin.hh"
229#ifdef FASTJET_ENABLE_PLUGIN_PXCONE
230#include "fastjet/PxConePlugin.hh"
232#ifdef FASTJET_ENABLE_PLUGIN_D0RUNIICONE
233#include "fastjet/D0RunIIConePlugin.hh"
235#ifdef FASTJET_ENABLE_PLUGIN_TRACKJET
236#include "fastjet/TrackJetPlugin.hh"
238#ifdef FASTJET_ENABLE_PLUGIN_ATLASCONE
239#include "fastjet/ATLASConePlugin.hh"
241#ifdef FASTJET_ENABLE_PLUGIN_EECAMBRIDGE
242#include "fastjet/EECambridgePlugin.hh"
244#ifdef FASTJET_ENABLE_PLUGIN_JADE
245#include "fastjet/JadePlugin.hh"
247#ifdef FASTJET_ENABLE_PLUGIN_CMSITERATIVECONE
248#include "fastjet/CMSIterativeConePlugin.hh"
250#ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
251#include "fastjet/D0RunIpre96ConePlugin.hh"
252#include "fastjet/D0RunIConePlugin.hh"
254#ifdef FASTJET_ENABLE_PLUGIN_GRIDJET
255#include "fastjet/GridJetPlugin.hh"
265using namespace fjcore;
268inline double pow2(
const double x) {
return x*x;}
271void print_jets_and_sub (
const vector<PseudoJet> & jets,
double dcut);
274void print_jets_bkgd(
const vector<PseudoJet> &jets,
275 const vector<PseudoJet> &subtracted_jets,
286enum SubType {subtype_internal, subtype_newclust_dcut, subtype_newclust_R};
288void do_compare_strategy(
int iev,
289 const vector<PseudoJet> & particles,
292 int compare_strategy);
302bool ee_print =
false;
303void print_jets(
const vector<PseudoJet> & jets,
bool show_const =
false);
305bool found_unavailable =
false;
306void is_unavailable(
const string & algname) {
307 cerr << algname <<
" requested, but not available for this compilation" << endl;
308 found_unavailable =
true;
315int main (
int argc,
char ** argv) {
318 cout <<
"# " << cmdline.command_line() << endl;
319 ClusterSequence::print_banner();
321 cmdline_p = &cmdline;
326 cmdline.int_val(
"-clever", Best)));
327 int repeat = cmdline.int_val(
"-repeat",1);
328 int combine = cmdline.int_val(
"-combine",1);
329 bool write = cmdline.present(
"-write");
330 bool unique_write = cmdline.present(
"-unique_write");
331 bool hydjet = cmdline.present(
"-hydjet");
332 double ktR = cmdline.double_val(
"-r",1.0);
333 ktR = cmdline.double_val(
"-R",ktR);
334 double inclkt = cmdline.double_val(
"-incl",-1.0);
335 double repeatinclkt = cmdline.double_val(
"-repeat-incl",-1.0);
336 int excln = cmdline.int_val (
"-excln",-1);
337 double excld = cmdline.double_val(
"-excld",-1.0);
338 double excly = cmdline.double_val(
"-excly",-1.0);
339 ee_print = cmdline.present(
"-ee-print");
340 bool get_all_dij = cmdline.present(
"-get-all-dij");
341 bool get_all_yij = cmdline.present(
"-get-all-yij");
342 double subdcut = cmdline.double_val(
"-subdcut",-1.0);
343 double rapmax = cmdline.double_val(
"-rapmax",1.0e305);
344 if (cmdline.present(
"-etamax")) {
345 cerr <<
"WARNING: -etamax options actually sets maximum rapidity (and overrides -rapmax)\n";
346 rapmax = cmdline.double_val(
"-etamax");
348 bool show_constituents = cmdline.present(
"-const");
349 bool massless = cmdline.present(
"-massless");
350 int nev = cmdline.int_val(
"-nev",1);
351 int skip = cmdline.int_val(
"-skip",0);
352 bool add_dense_coverage = cmdline.present(
"-dense");
353 double ghost_maxrap = cmdline.value(
"-ghost-maxrap",5.0);
354 bool all_algs = cmdline.present(
"-all-algs");
359 int compare_strategy = cmdline.value<
int>(
"-compare-strategy",
plugin_strategy);
362 Selector particles_sel = (cmdline.present(
"-nhardest"))
364 : SelectorIdentity();
366 do_areas = cmdline.present(
"-area");
372 cmdline.value(
"-area:repeat", 1),
373 cmdline.value(
"-ghost-area", 0.01));
374 if (cmdline.present(
"-area:fj2")) ghost_spec.set_fj2_placement(
true);
375 if (cmdline.present(
"-area:explicit")) {
376 area_def =
AreaDefinition(active_area_explicit_ghosts, ghost_spec);
377 }
else if (cmdline.present(
"-area:passive")) {
379 }
else if (cmdline.present(
"-area:voronoi")) {
380 double Rfact = cmdline.value<
double>(
"-area:voronoi");
384 cmdline.present(
"-area:active");
392 bool do_bkgd = cmdline.present(
"-bkgd");
394 bool do_bkgd_csab =
false, do_bkgd_jetmedian =
false, do_bkgd_fj2 =
false;
395 bool do_bkgd_gridmedian =
false;
396 bool do_bkgd_localrange =
false;
397 bool do_subtractor =
false;
398 double bkgd_alt_ktR = -1.0;
403 if (cmdline.present(
"-bkgd:csab")) {do_bkgd_csab =
true;}
404 else if (cmdline.present(
"-bkgd:jetmedian")) {do_bkgd_jetmedian =
true;
405 do_bkgd_fj2 = cmdline.present(
"-bkgd:fj2");
406 do_bkgd_localrange = cmdline.present(
"-bkgd:localrange");
407 bkgd_alt_ktR = cmdline.value(
"-bkgd:alt-ktR", bkgd_alt_ktR);
409 }
else if (cmdline.present(
"-bkgd:gridmedian")) {
410 do_bkgd_gridmedian =
true;
412 throw Error(
"with the -bkgd option, some particular background must be specified (csab or jetmedian)");
414 if (cmdline.present(
"-bkgd:rescaling")) {
417 assert(do_areas || do_bkgd_gridmedian);
418 do_subtractor = cmdline.present(
"-subtractor");
419 if (do_subtractor) assert(do_areas);
425 bool show_cones = cmdline.present(
"-cones");
429 double overlap_threshold = cmdline.double_val(
"-overlap",0.5);
430 overlap_threshold = cmdline.double_val(
"-f",overlap_threshold);
431 double seed_threshold = cmdline.double_val(
"-seed",1.0);
438 double ycut = cmdline.double_val(
"-ycut",0.08);
441 rootfile = cmdline.value<
string>(
"-root",
"");
449 vector<JetDefinition> jet_defs;
450 if (all_algs || cmdline.present(
"-cam") || cmdline.present(
"-CA")) {
451 jet_defs.push_back(
JetDefinition(cambridge_algorithm, ktR, scheme, strategy));
453 if (all_algs || cmdline.present(
"-antikt")) {
454 jet_defs.push_back(
JetDefinition(antikt_algorithm, ktR, scheme, strategy));
456 if (all_algs || cmdline.present(
"-genkt")) {
458 if (cmdline.present(
"-genkt")) p = cmdline.value<
double>(
"-genkt");
460 jet_defs.push_back(
JetDefinition(genkt_algorithm, ktR, p, scheme, strategy));
462 if (all_algs || cmdline.present(
"-eekt")) {
465 if (all_algs || cmdline.present(
"-eegenkt")) {
467 if (cmdline.present(
"-eegenkt")) p = cmdline.value<
double>(
"-eegenkt");
469 jet_defs.push_back(
JetDefinition(ee_genkt_algorithm, ktR, p, scheme, strategy));
473 if (all_algs || cmdline.present(
"-midpoint")) {
474#ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
476 double cone_area_fraction = 1.0;
477 int max_pair_size = 2;
478 int max_iterations = 100;
479 MPPlug::SplitMergeScale sm_scale = MPPlug::SM_pt;
480 if (cmdline.present(
"-sm-pttilde")) sm_scale = MPPlug::SM_pttilde;
481 if (cmdline.present(
"-sm-pt")) sm_scale = MPPlug::SM_pt;
482 if (cmdline.present(
"-sm-mt")) sm_scale = MPPlug::SM_mt;
483 if (cmdline.present(
"-sm-Et")) sm_scale = MPPlug::SM_Et;
486 cone_area_fraction, max_pair_size,
487 max_iterations, overlap_threshold,
490 is_unavailable(
"MidPoint");
493 if (all_algs || cmdline.present(
"-pxcone")) {
494#ifdef FASTJET_ENABLE_PLUGIN_PXCONE
495 double min_jet_energy = 5.0;
497 int mode = cmdline.value(
"-pxcone-mode", 2);
498 bool E_scheme_jets =
false;
501 overlap_threshold, E_scheme_jets, mode)));
503 is_unavailable(
"PxCone");
506 if (all_algs || cmdline.present(
"-jetclu")) {
507#ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
509 ktR, overlap_threshold, seed_threshold)));
511 is_unavailable(
"JetClu");
514 if (all_algs || cmdline.present(
"-siscone") || cmdline.present(
"-sisconespheri")) {
515#ifdef FASTJET_ENABLE_PLUGIN_SISCONE
517 int npass = cmdline.value(
"-npass",0);
518 if (all_algs || cmdline.present(
"-siscone")) {
519 double sisptmin = cmdline.value(
"-sisptmin",0.0);
520 bool cache = cmdline.present(
"-cache");
521 SISPlug * plugin =
new SISPlug (ktR, overlap_threshold,npass,sisptmin,cache);
522 if (cmdline.present(
"-sm-pt")) plugin->set_split_merge_scale(SISPlug::SM_pt);
523 if (cmdline.present(
"-sm-mt")) plugin->set_split_merge_scale(SISPlug::SM_mt);
524 if (cmdline.present(
"-sm-Et")) plugin->set_split_merge_scale(SISPlug::SM_Et);
525 if (cmdline.present(
"-sm-pttilde")) plugin->set_split_merge_scale(SISPlug::SM_pttilde);
527 plugin->set_use_jet_def_recombiner(
true);
530 if (all_algs || cmdline.present(
"-sisconespheri")) {
531 double sisEmin = cmdline.value(
"-sisEmin",0.0);
534 if (cmdline.present(
"-ghost-sep")) {
540 is_unavailable(
"SISCone");
543 if (all_algs || cmdline.present(
"-d0runiicone")) {
544#ifdef FASTJET_ENABLE_PLUGIN_D0RUNIICONE
545 double min_jet_Et = 6.0;
548 is_unavailable(
"D0RunIICone");
551 if (all_algs || cmdline.present(
"-trackjet")) {
552#ifdef FASTJET_ENABLE_PLUGIN_TRACKJET
555 is_unavailable(
"TrackJet");
558 if (all_algs || cmdline.present(
"-atlascone")) {
559#ifdef FASTJET_ENABLE_PLUGIN_ATLASCONE
562 is_unavailable(
"ATLASCone");
565 if (all_algs || cmdline.present(
"-eecambridge")) {
566#ifdef FASTJET_ENABLE_PLUGIN_EECAMBRIDGE
569 is_unavailable(
"EECambridge");
572 if (all_algs || cmdline.present(
"-jade")) {
573#ifdef FASTJET_ENABLE_PLUGIN_JADE
576 JadePlugin::strategy_NNFJN2Plain));
579 is_unavailable(
"Jade");
582 if (all_algs || cmdline.present(
"-cmsiterativecone")) {
583#ifdef FASTJET_ENABLE_PLUGIN_CMSITERATIVECONE
586 is_unavailable(
"CMSIterativeCone");
589 if (all_algs || cmdline.present(
"-d0runipre96cone")) {
590#ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
593 is_unavailable(
"D0RunIpre96Cone");
596 if (all_algs || cmdline.present(
"-d0runicone")) {
597#ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
600 is_unavailable(
"D0RunICone");
603 if (all_algs || cmdline.present(
"-gridjet")) {
604#ifdef FASTJET_ENABLE_PLUGIN_GRIDJET
612 double grid_ymax = 4.9999999999;
615 is_unavailable(
"GridJet");
620 cmdline.present(
"-kt") ||
621 (jet_defs.size() == 0 && !found_unavailable)) {
622 jet_defs.push_back(
JetDefinition(kt_algorithm, ktR, E_scheme, strategy));
625 string filename = cmdline.value<
string>(
"-file",
"");
628 if (!cmdline.all_options_used()) {cerr <<
629 "Error: some options were not recognized"<<endl;
632 for (
unsigned idef = 0; idef < jet_defs.size(); idef++) {
635 if (filename ==
"") istr = &cin;
636 else istr =
new ifstream(filename.c_str());
638 for (
int iev = 0; iev < nev; iev++) {
639 vector<PseudoJet> jets;
640 vector<PseudoJet> particles;
643 while (getline(*istr, line)) {
645 istringstream linestream(line);
646 if (line ==
"#END") {
648 if (ndone == combine) {
break;}
650 if (line.substr(0,1) ==
"#") {
continue;}
651 valarray<double> fourvec(4);
656 int ii, istat,id,m1,m2,d1,d2;
658 linestream >> ii>> istat >>
id >> m1 >> m2 >> d1 >> d2
659 >> fourvec[0] >> fourvec[1] >> fourvec[2] >> mass;
662 fourvec[3] = sqrt(+pow2(fourvec[0])+pow2(fourvec[1])
663 +pow2(fourvec[2])+pow2(mass));
667 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2];
668 fourvec[3] = sqrt(pow2(fourvec[0])+pow2(fourvec[1])+pow2(fourvec[2]));}
670 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2] >> fourvec[3];
674 if (abs(psjet.rap()) < rapmax) {particles.push_back(psjet);}
681 if (add_dense_coverage) {
686 ghosted_area_spec.set_grid_scatter(0.5);
687 ghosted_area_spec.add_ghosts(particles);
709 add_dense_coverage =
false;
713 particles = particles_sel(particles);
716 if (iev < skip)
continue;
718 for (
int irepeat = 0; irepeat < repeat ; irepeat++) {
719 int nparticles = particles.size();
730 if (compare_strategy != plugin_strategy) {
731 do_compare_strategy(iev, particles, jet_def, *clust_seq, compare_strategy);
735 if (repeatinclkt >= 0.0) {
736 vector<PseudoJet> jets_local =
sorted_by_pt(clust_seq->inclusive_jets(repeatinclkt));
739 if (irepeat != 0) {
continue;}
740 cout <<
"iev "<<iev<<
": number of particles = "<< nparticles << endl;
741 cout <<
"strategy used = "<< clust_seq->strategy_string()<< endl;
744 if (do_areas && iev == 0) cout <<
"Area definition: " << area_def.description() << endl;
749 vector<PseudoJet> jets_local =
sorted_by_pt(clust_seq->inclusive_jets(inclkt));
755 cout <<
"Printing "<<excln<<
" exclusive jets\n";
756 print_jets(clust_seq->exclusive_jets(excln), show_constituents);
760 cout <<
"Printing exclusive jets for d = "<<excld<<
"\n";
761 print_jets(clust_seq->exclusive_jets(excld), show_constituents);
765 cout <<
"Printing exclusive jets for ycut = "<<excly<<
"\n";
766 print_jets(clust_seq->exclusive_jets_ycut(excly), show_constituents);
770 for (
int i = nparticles-1; i >= 0; i--) {
771 printf(
"d for n = %4d -> %4d is %14.5e\n", i+1, i, clust_seq->exclusive_dmerge(i));
775 for (
int i = nparticles-1; i >= 0; i--) {
776 printf(
"y for n = %4d -> %4d is %14.5e\n", i+1, i, clust_seq->exclusive_ymerge(i));
782 if (subdcut >= 0.0) {
783 print_jets_and_sub(clust_seq->inclusive_jets(), subdcut);
788 vector<int> unique_history = clust_seq->unique_history_order();
790 vector<int> inv_unique_history(clust_seq->history().size());
791 for (
unsigned int i = 0; i < unique_history.size(); i++) {
792 inv_unique_history[unique_history[i]] = i;}
794 for (
unsigned int i = 0; i < unique_history.size(); i++) {
796 clust_seq->history()[unique_history[i]];
799 printf(
"%7d u %15.8e %7d u %7d u\n",i,el.
dij,uhp1, uhp2);
804#ifdef FASTJET_ENABLE_PLUGIN_SISCONE
810 throw fastjet::Error(
"extras object for SISCone was null (this can happen with certain area types)");
811 cout <<
"most ambiguous split (difference in squared dist) = "
813 vector<fastjet::PseudoJet> stable_cones(extras->
stable_cones());
815 for (
unsigned int i = 0; i < stable_cones.size(); i++) {
817 printf(
"%5u %15.8f %15.8f %15.8f\n",
818 i,stable_cones[i].rap(),stable_cones[i].phi(),
819 stable_cones[i].perp() );
824 vector<PseudoJet> sisjets = clust_seq->inclusive_jets();
825 printf(
"\n%15s %15s %15s %12s %8s %8s\n",
"rap",
"phi",
"pt",
"user-index",
"pass",
"nconst");
826 for (
unsigned i = 0; i < sisjets.size(); i++) {
827 printf(
"%15.8f %15.8f %15.8f %12d %8d %8u\n",
828 sisjets[i].rap(), sisjets[i].phi(), sisjets[i].perp(),
829 sisjets[i].user_index(), extras->
pass(sisjets[i]),
830 (
unsigned int) clust_seq->constituents(sisjets[i]).size()
839 double rho, sigma, mean_area, empty_area, n_empty_jets;
847 }
else if (do_bkgd_jetmedian) {
853 if (bkgd_alt_ktR > 0) {
856 cout <<
"Alt JetDef for background-estimation CSAB: " << clust_seq_bkgd->
jet_def().
description() << endl;
862 if (!do_bkgd_localrange) {
864 sigma = bge->
sigma();
870 assert(do_bkgd_gridmedian);
871 double grid_rapmin, grid_rapmax;
878 sigma = bge->
sigma();
883 if (do_bkgd_localrange || do_subtractor) {
884 assert(bge_ptr != 0);
885 cout <<
"Background estimator: " << bge_ptr->
description() << endl;
888 vector<PseudoJet> subjets;
891 subtractor.set_use_rho_m(
true);
892 subtractor.set_safe_mass(
true);
893 cout <<
"Subtractor: " << subtractor.description() << endl;
894 subjets = subtractor(jets);
896 print_jets_bkgd(jets, subjets, bge_ptr, do_subtractor);
913 cout <<
" rho = " << rho
914 <<
", sigma = " << sigma
915 <<
", mean_area = " << mean_area
916 <<
", empty_area = " << empty_area
917 <<
", n_empty_jets = " << n_empty_jets
920 if (bge_ptr != 0)
delete bge_ptr;
924 catch (
Error &fjerr) {
925 cout <<
"Caught fastjet error, exiting gracefully" << endl;
932 if (jet_def.strategy()==plugin_strategy){
936 if (istr != &cin)
delete istr;
947 unsigned int n_constituents = jet.
constituents().size();
948 printf(
"%15.8f %15.8f %15.8f %8u\n",
949 jet.
rap(), jet.
phi(), jet.
perp(), n_constituents);
954void print_jets(
const vector<PseudoJet> & jets_in,
bool show_constituents) {
955 vector<PseudoJet> jets;
958 for (
unsigned int j = 0; j < jets.size(); j++) {
959 printf(
"%5u %15.8f %15.8f %15.8f %15.8f\n",
960 j,jets[j].px(),jets[j].py(),jets[j].pz(),jets[j].E());
961 if (show_constituents) {
962 vector<PseudoJet> const_jets = jets[j].constituents();
963 for (
unsigned int k = 0; k < const_jets.size(); k++) {
964 printf(
" jet%03u %15.8f %15.8f %15.8f %15.8f\n",j,const_jets[k].px(),
965 const_jets[k].py(),const_jets[k].pz(),const_jets[k].E());
973 for (
unsigned int j = 0; j < jets.size(); j++) {
974 printf(
"%5u %15.8f %15.8f %15.8f",
975 j,jets[j].rap(),jets[j].phi(),jets[j].perp());
979 if (do_areas) printf(
" %15.8f %15.8f", jets[j].area(),
980 jets[j].area_4vector().perp());
984 if (show_constituents) {
985 vector<PseudoJet> const_jets = jets[j].constituents();
986 for (
unsigned int k = 0; k < const_jets.size(); k++) {
987 printf(
" jet%03u %15.8f %15.8f %15.8f %5d\n",j,const_jets[k].rap(),
988 const_jets[k].phi(),sqrt(const_jets[k].kt2()), const_jets[k].cluster_hist_index());
995 if (rootfile !=
"") {
996 ofstream ostr(rootfile.c_str());
998 ostr <<
"# output for root" << endl;
999 assert(jets.size() > 0);
1000 jets[0].validated_cs()->print_jets_for_root(jets,ostr);
1009void print_jets_and_sub (
const vector<PseudoJet> & jets,
double dcut) {
1015 printf(
"Printing jets and their subjets with subdcut = %10.5f\n",dcut);
1016 printf(
"%5s %15s %15s %15s %15s\n",
"jet #",
"rapidity",
1017 "phi",
"pt",
"n constituents");
1020 SubType sub_type = subtype_internal;
1026 for (vector<PseudoJet>::const_iterator jet = sorted_jets.begin();
1027 jet != sorted_jets.end(); jet++) {
1033 && jet->
perp2() < dcut)
continue;
1036 printf(
"%5u ",(
unsigned int) (jet - sorted_jets.begin()));
1038 vector<PseudoJet> subjets;
1040 if (sub_type == subtype_internal) {
1045 cout <<
" for " << ddnp1 <<
" < d < " << ddn <<
" one has " << endl;
1046 }
else if (sub_type == subtype_newclust_dcut) {
1049 }
else if (sub_type == subtype_newclust_R) {
1055 cerr <<
"unrecognized subtype for subjet finding" << endl;
1060 for (
unsigned int j = 0; j < subjets.size(); j++) {
1061 printf(
" -sub-%02u ",j);
1062 print_jet(subjets[j]);
1065 if (cspoint != 0)
delete cspoint;
1079double make_safe_zero_truncation(
double x,
double precision){
1080 return std::abs(x)<0.5*precision ? 0.0 : x;
1084void print_jets_bkgd(
const vector<PseudoJet> &jets,
1085 const vector<PseudoJet> &subtracted_jets,
1087 bool do_subtractor){
1088 printf(
"Printing jets, background information");
1090 printf(
" and subtracted jets\n");
1091 printf(
"%5s %15s %15s %15s %15s %15s %15s %15s %15s\n",
"jet #",
1092 "rapidity",
"phi",
"pt",
"pt^2+m^2",
1093 "rho",
"rho_m",
"sigma",
"sigma_m");
1095 printf(
"%5s %15s %15s %15s %15s %15ss\n",
"jet #",
1096 "rapidity",
"phi",
"pt",
"sqrt(pt^2+m^2)",
"area");
1098 for (
unsigned i = 0; i < jets.size(); i++) {
1105 printf(
"%5u %15.8f %15.8f %15.8f %15.8f %15.8f %15.8f %15.8f %15.8f\n", i,
1107 estimate.
rho(), make_safe_zero_truncation(estimate.
rho_m(),1e-8),
1109 if (do_subtractor) {
1110 const PseudoJet & subjet = subtracted_jets[i];
1111 printf(
"%5u %15.8f %15.8f %15.8f %15.8f %15.8f\n", i,
1119void signal_failed_comparison(
int iev,
1120 const string & message,
1121 const vector<PseudoJet> & particles) {
1122 cout <<
"# failed comparison, reason is " << message << endl;
1123 cout <<
"# iev = " << iev << endl;
1124 cout << setprecision(16);
1125 for (
unsigned i = 0; i < particles.size(); i++) {
1127 cout << p.px() <<
" "
1132 cout <<
"#END" << endl;
1136void do_compare_strategy(
int iev,
1137 const vector<PseudoJet> & particles,
1140 int compare_strategy) {
1145 jet_def.recombination_scheme(),
1152 const vector<ClusterSequence::history_element> & history_in = cs.
history();
1153 const vector<ClusterSequence::history_element> & history_ref = cs_ref.history();
1155 if (history_in.size() != history_ref.size()) {
1156 signal_failed_comparison(iev,
"history sizes do not match", particles);
1160 for (
unsigned i = cs.
n_particles(); i < history_in.size(); i++) {
1161 bool fail_parents = (history_in[i].parent1 != history_ref[i].parent1 ||
1162 history_in[i].parent2 != history_ref[i].parent2);
1163 bool fail_dij = (history_in[i].dij != history_ref[i].dij);
1164 if (fail_parents || fail_dij) {
1166 ostr <<
"at step " << i <<
", ";
1167 if (fail_parents) ostr <<
"parents do not match, ";
1168 if (fail_dij) ostr <<
"dij does not match, ";
1169 ostr <<
"history in (p1, p2, dij) = "
1170 << history_in[i].parent1 <<
" " << history_in[i].parent2 <<
" " << history_in[i].dij;
1171 ostr <<
", history ref (p1, p2, dij) = "
1172 << history_ref[i].parent1 <<
" " << history_ref[i].parent2 <<
" " << history_ref[i].dij;
1173 signal_failed_comparison(iev, ostr.str(), particles);
int main()
an example program showing how to use fastjet
string command_line() const
return the full command line
Implementation of the ATLAS Cone (plugin for fastjet v2.4 upwards)
class that holds a generic area definition
/// a class that holds the result of the calculation
double sigma_m() const
fluctuations in the purely longitudinal (particle-mass-induced) component of the background density p...
double rho() const
background density per unit area
double sigma() const
background fluctuations per unit square-root area must be multipled by sqrt(area) to get fluctuations...
double rho_m() const
purely longitudinal (particle-mass-induced) component of the background density per unit area
Abstract base class that provides the basic interface for classes that estimate levels of background ...
virtual std::string description() const =0
returns a textual description of the background estimator
virtual BackgroundEstimate estimate() const =0
get the full set of background properties
A background rescaling that is a simple polynomial in y.
Implementation of the JetClu algorithm from CDF (plugin for fastjet-v2.1 upwards)
Implementation of the MidPoint algorithm from CDF (plugin for fastjet-v2.1 upwards)
Implementation of the CMS Iterative Cone (plugin for fastjet v2.4 upwards)
base class that sets interface for extensions of ClusterSequence that provide information about the a...
virtual void get_median_rho_and_sigma(const Selector &selector, bool use_area_4vector, double &median, double &sigma, double &mean_area) const
using jets withing the selector range (and with 4-vector areas if use_area_4vector),...
virtual double n_empty_jets(const Selector &selector) const
return something similar to the number of pure ghost jets in the given selector's range in an active ...
virtual double empty_area(const Selector &selector) const
return the total area, corresponding to the given Selector, that is free of jets, in general based on...
General class for user to obtain ClusterSequence with additional area information.
const JetDefinition & jet_def() const
return a reference to the jet definition
const std::vector< history_element > & history() const
allow the user to access the raw internal history.
void delete_self_when_unused()
by calling this routine you tell the ClusterSequence to delete itself when all the Pseudojets associa...
unsigned int n_particles() const
returns the number of particles that were provided to the clustering algorithm (helps the user find t...
std::vector< PseudoJet > inclusive_jets(const double ptmin=0.0) const
return a vector of all jets (in the sense of the inclusive algorithm) with pt >= ptmin.
std::vector< PseudoJet > exclusive_jets(const double dcut) const
return a vector of all jets (in the sense of the exclusive algorithm) that would be obtained when run...
A plugin for FastJet (v3.0 or later) that provides an interface to the D0 version of Run-I cone algor...
Implementation of the D0 Run II Cone (plugin for fastjet v2.1 upwards)
A plugin for FastJet (v3.0 or later) that provides an interface to the pre 1996 D0 version of Run-I c...
Implementation of the e+e- Cambridge algorithm (plugin for fastjet v2.4 upwards)
base class corresponding to errors that can be thrown by FastJet
Parameters to configure the computation of jet areas using ghosts.
plugin for fastjet (v3.0 upwards) that clusters particles such that all particles in a given cell of ...
Implementation of the e+e- Jade algorithm (plugin for fastjet v2.4 upwards)
Strategy
enum that contains the two clustering strategy options; for higher multiplicities,...
class that is intended to hold a full definition of the jet clusterer
std::string description() const
return a textual description of the current jet definition
const Plugin * plugin() const
return a pointer to the plugin
JetAlgorithm jet_algorithm() const
return information about the definition...
Class to contain pseudojets, including minimal information of use to jet-clustering routines.
virtual std::vector< PseudoJet > constituents() const
retrieve the constituents.
double mt() const
returns the transverse mass = sqrt(kt^2+m^2)
double rap() const
returns the rapidity or some large value when the rapidity is infinite
double phi() const
returns phi (in the range 0..2pi)
double perp() const
returns the scalar transverse momentum
double perp2() const
returns the squared transverse momentum
double exclusive_subdmerge_max(int nsub) const
Returns the maximum dij that occurred in the whole event at the stage that the nsub+1 -> nsub merge o...
virtual double area() const
return the jet (scalar) area.
std::vector< PseudoJet > exclusive_subjets(const double dcut) const
return a vector of all subjets of the current jet (in the sense of the exclusive algorithm) that woul...
const ClusterSequence * validated_cs() const
shorthand for validated_cluster_sequence()
Implementation of the PxCone algorithm (plugin for fastjet v2.1 upwards)
virtual void set_ghost_separation_scale(double scale) const
set the ghost separation scale for passive area determinations just in the next run (strictly speakin...
Implementation of the SISCone algorithm (plugin for fastjet v2.1 upwards)
Implementation of the spherical version of the SISCone algorithm (plugin for fastjet v2....
Class that encodes information about cuts and other selection criteria that can be applied to PseudoJ...
void get_rapidity_extent(double &rapmin, double &rapmax) const
returns the rapidity range for which it may return "true"
An implementation of shared pointers that is broadly similar to C++11 shared_ptr (https://en....
T * get() const
get the stored pointer
void reset()
reset the pointer to default value (NULL)
Class that helps perform jet background subtraction.
Implementation of the TrackJet algorithm (plugin for fastjet v2.4 upwards)
Specification for the computation of the Voronoi jet area.
void print_jets(const vector< fastjet::PseudoJet > &)
a function that pretty prints a list of jets
Selector SelectorNHardest(unsigned int n)
select the n hardest objects
Selector SelectorStrip(const double half_width)
select objets within a rapidity distance 'half_width' from the location of the reference jet,...
Selector SelectorAbsRapMax(double absrapmax)
select objects with |rap| <= absrapmax
vector< PseudoJet > sorted_by_rapidity(const vector< PseudoJet > &jets)
return a vector of jets sorted into increasing rapidity
Strategy
the various options for the algorithmic strategy to adopt in clustering events with kt and cambridge ...
@ plugin_strategy
the plugin has been used...
RecombinationScheme
The various recombination schemes.
@ E_scheme
summing the 4-momenta
vector< PseudoJet > sorted_by_E(const vector< PseudoJet > &jets)
return a vector of jets sorted into decreasing energy
string fastjet_version_string()
return a string containing information about the release
vector< PseudoJet > sorted_by_pt(const vector< PseudoJet > &jets)
return a vector of jets sorted into decreasing kt2
a single element in the clustering history
int parent1
index in _history where first parent of this jet was created (InexistentParent if this jet is an orig...
int parent2
index in _history where second parent of this jet was created (InexistentParent if this jet is an ori...
double dij
the distance corresponding to the recombination at this stage of the clustering.