199#include "fastjet/ClusterSequenceArea.hh"
200#include "fastjet/tools/JetMedianBackgroundEstimator.hh"
201#include "fastjet/tools/GridMedianBackgroundEstimator.hh"
202#include "fastjet/tools/Subtractor.hh"
203#include "fastjet/Selector.hh"
219#include "fastjet/config.h"
223#ifdef FASTJET_ENABLE_PLUGIN_SISCONE
224#include "fastjet/SISConePlugin.hh"
225#include "fastjet/SISConeSphericalPlugin.hh"
227#ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
228#include "fastjet/CDFMidPointPlugin.hh"
229#include "fastjet/CDFJetCluPlugin.hh"
231#ifdef FASTJET_ENABLE_PLUGIN_PXCONE
232#include "fastjet/PxConePlugin.hh"
234#ifdef FASTJET_ENABLE_PLUGIN_D0RUNIICONE
235#include "fastjet/D0RunIIConePlugin.hh"
237#ifdef FASTJET_ENABLE_PLUGIN_TRACKJET
238#include "fastjet/TrackJetPlugin.hh"
240#ifdef FASTJET_ENABLE_PLUGIN_ATLASCONE
241#include "fastjet/ATLASConePlugin.hh"
243#ifdef FASTJET_ENABLE_PLUGIN_EECAMBRIDGE
244#include "fastjet/EECambridgePlugin.hh"
246#ifdef FASTJET_ENABLE_PLUGIN_JADE
247#include "fastjet/JadePlugin.hh"
249#ifdef FASTJET_ENABLE_PLUGIN_CMSITERATIVECONE
250#include "fastjet/CMSIterativeConePlugin.hh"
252#ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
253#include "fastjet/D0RunIpre96ConePlugin.hh"
254#include "fastjet/D0RunIConePlugin.hh"
256#ifdef FASTJET_ENABLE_PLUGIN_GRIDJET
257#include "fastjet/GridJetPlugin.hh"
267using namespace fjcore;
270inline double pow2(
const double x) {
return x*x;}
273void print_jets_and_sub (
const vector<PseudoJet> & jets,
double dcut);
276void print_jets_bkgd(
const vector<PseudoJet> &jets,
277 const vector<PseudoJet> &subtracted_jets,
288enum SubType {subtype_internal, subtype_newclust_dcut, subtype_newclust_R};
290void do_compare_strategy(
int iev,
291 const vector<PseudoJet> & particles,
294 int compare_strategy);
304bool ee_print =
false;
305void print_jets(
const vector<PseudoJet> & jets,
bool show_const =
false);
307bool found_unavailable =
false;
308void is_unavailable(
const string & algname) {
309 cerr << algname <<
" requested, but not available for this compilation" << endl;
310 found_unavailable =
true;
317int main (
int argc,
char ** argv) {
320 cout <<
"# " << cmdline.command_line() << endl;
323 cmdline_p = &cmdline;
328 cmdline.int_val(
"-clever",
Best)));
329 int repeat = cmdline.int_val(
"-repeat",1);
330 int combine = cmdline.int_val(
"-combine",1);
331 bool write = cmdline.present(
"-write");
332 bool unique_write = cmdline.present(
"-unique_write");
333 bool hydjet = cmdline.present(
"-hydjet");
334 double ktR = cmdline.double_val(
"-r",1.0);
335 ktR = cmdline.double_val(
"-R",ktR);
336 double inclkt = cmdline.double_val(
"-incl",-1.0);
337 double repeatinclkt = cmdline.double_val(
"-repeat-incl",-1.0);
338 int excln = cmdline.int_val (
"-excln",-1);
339 double excld = cmdline.double_val(
"-excld",-1.0);
340 double excly = cmdline.double_val(
"-excly",-1.0);
341 ee_print = cmdline.present(
"-ee-print");
342 bool get_all_dij = cmdline.present(
"-get-all-dij");
343 bool get_all_yij = cmdline.present(
"-get-all-yij");
344 double subdcut = cmdline.double_val(
"-subdcut",-1.0);
345 double rapmax = cmdline.double_val(
"-rapmax",1.0e305);
346 if (cmdline.present(
"-etamax")) {
347 cerr <<
"WARNING: -etamax options actually sets maximum rapidity (and overrides -rapmax)\n";
348 rapmax = cmdline.double_val(
"-etamax");
350 bool show_constituents = cmdline.present(
"-const");
351 bool massless = cmdline.present(
"-massless");
352 int nev = cmdline.int_val(
"-nev",1);
353 int skip = cmdline.int_val(
"-skip",0);
354 bool add_dense_coverage = cmdline.present(
"-dense");
355 double ghost_maxrap = cmdline.value(
"-ghost-maxrap",5.0);
356 bool all_algs = cmdline.present(
"-all-algs");
357 int prec = cmdline.int_val(
"-prec",-1);
358 if (prec > 0) cout.precision(prec);
363 int compare_strategy = cmdline.value<
int>(
"-compare-strategy",
plugin_strategy);
366 Selector particles_sel = (cmdline.present(
"-nhardest"))
368 : SelectorIdentity();
370 do_areas = cmdline.present(
"-area");
376 cmdline.value(
"-area:repeat", 1),
377 cmdline.value(
"-ghost-area", 0.01));
378 if (cmdline.present(
"-area:fj2")) ghost_spec.set_fj2_placement(
true);
379 if (cmdline.present(
"-area:explicit")) {
380 area_def =
AreaDefinition(active_area_explicit_ghosts, ghost_spec);
381 }
else if (cmdline.present(
"-area:passive")) {
383 }
else if (cmdline.present(
"-area:voronoi")) {
384 double Rfact = cmdline.value<
double>(
"-area:voronoi");
388 cmdline.present(
"-area:active");
396 bool do_bkgd = cmdline.present(
"-bkgd");
398 bool do_bkgd_csab =
false, do_bkgd_jetmedian =
false, do_bkgd_fj2 =
false;
399 bool do_bkgd_gridmedian =
false;
400 bool do_bkgd_localrange =
false;
401 bool do_subtractor =
false;
402 double bkgd_alt_ktR = -1.0;
407 if (cmdline.present(
"-bkgd:csab")) {do_bkgd_csab =
true;}
408 else if (cmdline.present(
"-bkgd:jetmedian")) {do_bkgd_jetmedian =
true;
409 do_bkgd_fj2 = cmdline.present(
"-bkgd:fj2");
410 do_bkgd_localrange = cmdline.present(
"-bkgd:localrange");
411 bkgd_alt_ktR = cmdline.value(
"-bkgd:alt-ktR", bkgd_alt_ktR);
413 }
else if (cmdline.present(
"-bkgd:gridmedian")) {
414 do_bkgd_gridmedian =
true;
416 throw Error(
"with the -bkgd option, some particular background must be specified (csab or jetmedian)");
418 if (cmdline.present(
"-bkgd:rescaling")) {
421 assert(do_areas || do_bkgd_gridmedian);
422 do_subtractor = cmdline.present(
"-subtractor");
423 if (do_subtractor) assert(do_areas);
429 bool show_cones = cmdline.present(
"-cones");
433 double overlap_threshold = cmdline.double_val(
"-overlap",0.5);
434 overlap_threshold = cmdline.double_val(
"-f",overlap_threshold);
435 double seed_threshold = cmdline.double_val(
"-seed",1.0);
442 double ycut = cmdline.double_val(
"-ycut",0.08);
445 rootfile = cmdline.value<
string>(
"-root",
"");
453 vector<JetDefinition> jet_defs;
454 if (all_algs || cmdline.present(
"-cam") || cmdline.present(
"-CA")) {
457 if (all_algs || cmdline.present(
"-antikt")) {
460 if (all_algs || cmdline.present(
"-genkt")) {
462 if (cmdline.present(
"-genkt")) p = cmdline.value<
double>(
"-genkt");
466 if (all_algs || cmdline.present(
"-eekt")) {
469 if (all_algs || cmdline.present(
"-eegenkt")) {
471 if (cmdline.present(
"-eegenkt")) p = cmdline.value<
double>(
"-eegenkt");
477 if (all_algs || cmdline.present(
"-midpoint")) {
478#ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
480 double cone_area_fraction = 1.0;
481 int max_pair_size = 2;
482 int max_iterations = 100;
483 MPPlug::SplitMergeScale sm_scale = MPPlug::SM_pt;
484 if (cmdline.present(
"-sm-pttilde")) sm_scale = MPPlug::SM_pttilde;
485 if (cmdline.present(
"-sm-pt")) sm_scale = MPPlug::SM_pt;
486 if (cmdline.present(
"-sm-mt")) sm_scale = MPPlug::SM_mt;
487 if (cmdline.present(
"-sm-Et")) sm_scale = MPPlug::SM_Et;
490 cone_area_fraction, max_pair_size,
491 max_iterations, overlap_threshold,
494 is_unavailable(
"MidPoint");
497 if (all_algs || cmdline.present(
"-pxcone")) {
498#ifdef FASTJET_ENABLE_PLUGIN_PXCONE
499 double min_jet_energy = 5.0;
501 int mode = cmdline.value(
"-pxcone-mode", 2);
502 bool E_scheme_jets =
false;
505 overlap_threshold, E_scheme_jets, mode)));
507 is_unavailable(
"PxCone");
510 if (all_algs || cmdline.present(
"-jetclu")) {
511#ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
513 ktR, overlap_threshold, seed_threshold)));
515 is_unavailable(
"JetClu");
518 if (all_algs || cmdline.present(
"-siscone") || cmdline.present(
"-sisconespheri")) {
519#ifdef FASTJET_ENABLE_PLUGIN_SISCONE
521 int npass = cmdline.value(
"-npass",0);
522 if (all_algs || cmdline.present(
"-siscone")) {
523 double sisptmin = cmdline.value(
"-sisptmin",0.0);
524 bool cache = cmdline.present(
"-cache");
525 SISPlug * plugin =
new SISPlug (ktR, overlap_threshold,npass,sisptmin,cache);
526 if (cmdline.present(
"-sm-pt")) plugin->set_split_merge_scale(SISPlug::SM_pt);
527 if (cmdline.present(
"-sm-mt")) plugin->set_split_merge_scale(SISPlug::SM_mt);
528 if (cmdline.present(
"-sm-Et")) plugin->set_split_merge_scale(SISPlug::SM_Et);
529 if (cmdline.present(
"-sm-pttilde")) plugin->set_split_merge_scale(SISPlug::SM_pttilde);
531 plugin->set_use_jet_def_recombiner(
true);
534 if (all_algs || cmdline.present(
"-sisconespheri")) {
535 double sisEmin = cmdline.value(
"-sisEmin",0.0);
538 if (cmdline.present(
"-ghost-sep")) {
544 is_unavailable(
"SISCone");
547 if (all_algs || cmdline.present(
"-d0runiicone")) {
548#ifdef FASTJET_ENABLE_PLUGIN_D0RUNIICONE
549 double min_jet_Et = 6.0;
552 is_unavailable(
"D0RunIICone");
555 if (all_algs || cmdline.present(
"-trackjet")) {
556#ifdef FASTJET_ENABLE_PLUGIN_TRACKJET
559 is_unavailable(
"TrackJet");
562 if (all_algs || cmdline.present(
"-atlascone")) {
563#ifdef FASTJET_ENABLE_PLUGIN_ATLASCONE
566 is_unavailable(
"ATLASCone");
569 if (all_algs || cmdline.present(
"-eecambridge")) {
570#ifdef FASTJET_ENABLE_PLUGIN_EECAMBRIDGE
573 is_unavailable(
"EECambridge");
576 if (all_algs || cmdline.present(
"-jade")) {
577#ifdef FASTJET_ENABLE_PLUGIN_JADE
580 JadePlugin::strategy_NNFJN2Plain));
583 is_unavailable(
"Jade");
586 if (all_algs || cmdline.present(
"-cmsiterativecone")) {
587#ifdef FASTJET_ENABLE_PLUGIN_CMSITERATIVECONE
590 is_unavailable(
"CMSIterativeCone");
593 if (all_algs || cmdline.present(
"-d0runipre96cone")) {
594#ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
597 is_unavailable(
"D0RunIpre96Cone");
600 if (all_algs || cmdline.present(
"-d0runicone")) {
601#ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
604 is_unavailable(
"D0RunICone");
607 if (all_algs || cmdline.present(
"-gridjet")) {
608#ifdef FASTJET_ENABLE_PLUGIN_GRIDJET
616 double grid_ymax = 4.9999999999;
619 is_unavailable(
"GridJet");
624 cmdline.present(
"-kt") ||
625 (jet_defs.size() == 0 && !found_unavailable)) {
629 string filename = cmdline.value<
string>(
"-file",
"");
632 if (!cmdline.all_options_used()) {cerr <<
633 "Error: some options were not recognized"<<endl;
636 for (
unsigned idef = 0; idef < jet_defs.size(); idef++) {
639 if (filename ==
"") istr = &cin;
640 else istr =
new ifstream(filename.c_str());
642 for (
int iev = 0; iev < nev; iev++) {
643 vector<PseudoJet> jets;
644 vector<PseudoJet> particles;
647 while (getline(*istr, line)) {
649 istringstream linestream(line);
650 if (line ==
"#END") {
652 if (ndone == combine) {
break;}
654 if (line.substr(0,1) ==
"#") {
continue;}
655 valarray<double> fourvec(4);
660 int ii, istat,id,m1,m2,d1,d2;
662 linestream >> ii>> istat >>
id >> m1 >> m2 >> d1 >> d2
663 >> fourvec[0] >> fourvec[1] >> fourvec[2] >> mass;
666 fourvec[3] = sqrt(+pow2(fourvec[0])+pow2(fourvec[1])
667 +pow2(fourvec[2])+pow2(mass));
671 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2];
672 fourvec[3] = sqrt(pow2(fourvec[0])+pow2(fourvec[1])+pow2(fourvec[2]));}
674 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2] >> fourvec[3];
678 if (abs(psjet.rap()) < rapmax) {particles.push_back(psjet);}
685 if (add_dense_coverage) {
690 ghosted_area_spec.set_grid_scatter(0.5);
691 ghosted_area_spec.add_ghosts(particles);
713 add_dense_coverage =
false;
717 particles = particles_sel(particles);
720 if (iev < skip)
continue;
722 for (
int irepeat = 0; irepeat < repeat ; irepeat++) {
723 int nparticles = particles.size();
735 do_compare_strategy(iev, particles, jet_def, *clust_seq, compare_strategy);
739 if (repeatinclkt >= 0.0) {
740 vector<PseudoJet> jets_local =
sorted_by_pt(clust_seq->inclusive_jets(repeatinclkt));
743 if (irepeat != 0) {
continue;}
744 cout <<
"iev "<<iev<<
": number of particles = "<< nparticles << endl;
745 cout <<
"strategy used = "<< clust_seq->strategy_string()<< endl;
748 if (do_areas && iev == 0) cout <<
"Area definition: " << area_def.description() << endl;
753 vector<PseudoJet> jets_local =
sorted_by_pt(clust_seq->inclusive_jets(inclkt));
754 print_jets(jets_local, show_constituents);
759 cout <<
"Printing "<<excln<<
" exclusive jets\n";
760 print_jets(clust_seq->exclusive_jets(excln), show_constituents);
764 cout <<
"Printing exclusive jets for d = "<<excld<<
"\n";
765 print_jets(clust_seq->exclusive_jets(excld), show_constituents);
769 cout <<
"Printing exclusive jets for ycut = "<<excly<<
"\n";
770 print_jets(clust_seq->exclusive_jets_ycut(excly), show_constituents);
774 for (
int i = nparticles-1; i >= 0; i--) {
775 printf(
"d for n = %4d -> %4d is %14.5e\n", i+1, i, clust_seq->exclusive_dmerge(i));
779 for (
int i = nparticles-1; i >= 0; i--) {
780 printf(
"y for n = %4d -> %4d is %14.5e\n", i+1, i, clust_seq->exclusive_ymerge(i));
786 if (subdcut >= 0.0) {
787 print_jets_and_sub(clust_seq->inclusive_jets(), subdcut);
792 vector<int> unique_history = clust_seq->unique_history_order();
794 vector<int> inv_unique_history(clust_seq->history().size());
795 for (
unsigned int i = 0; i < unique_history.size(); i++) {
796 inv_unique_history[unique_history[i]] = i;}
798 for (
unsigned int i = 0; i < unique_history.size(); i++) {
800 clust_seq->history()[unique_history[i]];
803 printf(
"%7d u %15.8e %7d u %7d u\n",i,el.
dij,uhp1, uhp2);
808#ifdef FASTJET_ENABLE_PLUGIN_SISCONE
814 throw fastjet::Error(
"extras object for SISCone was null (this can happen with certain area types)");
815 cout <<
"most ambiguous split (difference in squared dist) = "
817 vector<fastjet::PseudoJet> stable_cones(extras->
stable_cones());
819 for (
unsigned int i = 0; i < stable_cones.size(); i++) {
821 printf(
"%5u %15.8f %15.8f %15.8f\n",
822 i,stable_cones[i].rap(),stable_cones[i].phi(),
823 stable_cones[i].perp() );
828 vector<PseudoJet> sisjets = clust_seq->inclusive_jets();
829 printf(
"\n%15s %15s %15s %12s %8s %8s\n",
"rap",
"phi",
"pt",
"user-index",
"pass",
"nconst");
830 for (
unsigned i = 0; i < sisjets.size(); i++) {
831 printf(
"%15.8f %15.8f %15.8f %12d %8d %8u\n",
832 sisjets[i].rap(), sisjets[i].phi(), sisjets[i].perp(),
833 sisjets[i].user_index(), extras->
pass(sisjets[i]),
834 (
unsigned int) clust_seq->constituents(sisjets[i]).size()
843 double rho, sigma, mean_area, empty_area, n_empty_jets;
851 }
else if (do_bkgd_jetmedian) {
857 if (bkgd_alt_ktR > 0) {
860 cout <<
"Alt JetDef for background-estimation CSAB: " << clust_seq_bkgd->
jet_def().
description() << endl;
866 if (!do_bkgd_localrange) {
868 sigma = bge->
sigma();
874 assert(do_bkgd_gridmedian);
875 double grid_rapmin, grid_rapmax;
882 sigma = bge->
sigma();
887 if (do_bkgd_localrange || do_subtractor) {
888 assert(bge_ptr != 0);
889 cout <<
"Background estimator: " << bge_ptr->
description() << endl;
892 vector<PseudoJet> subjets;
895 subtractor.set_use_rho_m(
true);
896 subtractor.set_safe_mass(
true);
897 cout <<
"Subtractor: " << subtractor.description() << endl;
898 subjets = subtractor(jets);
900 print_jets_bkgd(jets, subjets, bge_ptr, do_subtractor);
917 cout <<
" rho = " << rho
918 <<
", sigma = " << sigma
919 <<
", mean_area = " << mean_area
920 <<
", empty_area = " << empty_area
921 <<
", n_empty_jets = " << n_empty_jets
924 if (bge_ptr != 0)
delete bge_ptr;
928 catch (
Error &fjerr) {
929 cout <<
"Caught fastjet error, exiting gracefully" << endl;
940 if (istr != &cin)
delete istr;
951 unsigned int n_constituents = jet.
constituents().size();
952 printf(
"%15.8f %15.8f %15.8f %8u\n",
953 jet.
rap(), jet.
phi(), jet.
perp(), n_constituents);
958void print_jets(
const vector<PseudoJet> & jets_in,
bool show_constituents) {
959 vector<PseudoJet> jets;
962 for (
unsigned int j = 0; j < jets.size(); j++) {
963 printf(
"%5u %15.8f %15.8f %15.8f %15.8f\n",
964 j,jets[j].px(),jets[j].py(),jets[j].pz(),jets[j].E());
965 if (show_constituents) {
966 vector<PseudoJet> const_jets = jets[j].constituents();
967 for (
unsigned int k = 0; k < const_jets.size(); k++) {
968 printf(
" jet%03u %15.8f %15.8f %15.8f %15.8f\n",j,const_jets[k].px(),
969 const_jets[k].py(),const_jets[k].pz(),const_jets[k].E());
977 for (
unsigned int j = 0; j < jets.size(); j++) {
978 printf(
"%5u %15.8f %15.8f %15.8f",
979 j,jets[j].rap(),jets[j].phi(),jets[j].perp());
983 if (do_areas) printf(
" %15.8f %15.8f", jets[j].area(),
984 jets[j].area_4vector().perp());
988 if (show_constituents) {
989 vector<PseudoJet> const_jets = jets[j].constituents();
990 for (
unsigned int k = 0; k < const_jets.size(); k++) {
991 printf(
" jet%03u %15.8f %15.8f %15.8f %5d\n",j,const_jets[k].rap(),
992 const_jets[k].phi(),sqrt(const_jets[k].kt2()), const_jets[k].cluster_hist_index());
999 if (rootfile !=
"") {
1000 ofstream ostr(rootfile.c_str());
1002 ostr <<
"# output for root" << endl;
1003 assert(jets.size() > 0);
1004 jets[0].validated_cs()->print_jets_for_root(jets,ostr);
1013void print_jets_and_sub (
const vector<PseudoJet> & jets,
double dcut) {
1019 printf(
"Printing jets and their subjets with subdcut = %10.5f\n",dcut);
1020 printf(
"%5s %15s %15s %15s %15s\n",
"jet #",
"rapidity",
1021 "phi",
"pt",
"n constituents");
1024 SubType sub_type = subtype_internal;
1030 for (vector<PseudoJet>::const_iterator jet = sorted_jets.begin();
1031 jet != sorted_jets.end(); jet++) {
1037 && jet->
perp2() < dcut)
continue;
1040 printf(
"%5u ",(
unsigned int) (jet - sorted_jets.begin()));
1042 vector<PseudoJet> subjets;
1044 if (sub_type == subtype_internal) {
1049 cout <<
" for " << ddnp1 <<
" < d < " << ddn <<
" one has " << endl;
1050 }
else if (sub_type == subtype_newclust_dcut) {
1053 }
else if (sub_type == subtype_newclust_R) {
1059 cerr <<
"unrecognized subtype for subjet finding" << endl;
1064 for (
unsigned int j = 0; j < subjets.size(); j++) {
1065 printf(
" -sub-%02u ",j);
1066 print_jet(subjets[j]);
1069 if (cspoint != 0)
delete cspoint;
1083double make_safe_zero_truncation(
double x,
double precision){
1084 return std::abs(x)<0.5*precision ? 0.0 : x;
1088void print_jets_bkgd(
const vector<PseudoJet> &jets,
1089 const vector<PseudoJet> &subtracted_jets,
1091 bool do_subtractor){
1092 printf(
"Printing jets, background information");
1094 printf(
" and subtracted jets\n");
1095 printf(
"%5s %15s %15s %15s %15s %15s %15s %15s %15s\n",
"jet #",
1096 "rapidity",
"phi",
"pt",
"pt^2+m^2",
1097 "rho",
"rho_m",
"sigma",
"sigma_m");
1099 printf(
"%5s %15s %15s %15s %15s %15ss\n",
"jet #",
1100 "rapidity",
"phi",
"pt",
"sqrt(pt^2+m^2)",
"area");
1102 for (
unsigned i = 0; i < jets.size(); i++) {
1109 printf(
"%5u %15.8f %15.8f %15.8f %15.8f %15.8f %15.8f %15.8f %15.8f\n", i,
1111 estimate.
rho(), make_safe_zero_truncation(estimate.
rho_m(),1e-8),
1113 if (do_subtractor) {
1114 const PseudoJet & subjet = subtracted_jets[i];
1115 printf(
"%5u %15.8f %15.8f %15.8f %15.8f %15.8f\n", i,
1123void signal_failed_comparison(
int iev,
1124 const string & message,
1125 const vector<PseudoJet> & particles) {
1126 cout <<
"# failed comparison, reason is " << message << endl;
1127 cout <<
"# iev = " << iev << endl;
1128 cout << setprecision(16);
1129 for (
unsigned i = 0; i < particles.size(); i++) {
1131 cout << p.px() <<
" "
1136 cout <<
"#END" << endl;
1140void do_compare_strategy(
int iev,
1141 const vector<PseudoJet> & particles,
1144 int compare_strategy) {
1149 jet_def.recombination_scheme(),
1156 const vector<ClusterSequence::history_element> & history_in = cs.
history();
1157 const vector<ClusterSequence::history_element> & history_ref = cs_ref.history();
1159 if (history_in.size() != history_ref.size()) {
1160 signal_failed_comparison(iev,
"history sizes do not match", particles);
1164 for (
unsigned i = cs.
n_particles(); i < history_in.size(); i++) {
1165 bool fail_parents = (history_in[i].parent1 != history_ref[i].parent1 ||
1166 history_in[i].parent2 != history_ref[i].parent2);
1167 bool fail_dij = (history_in[i].dij != history_ref[i].dij);
1168 if (fail_parents || fail_dij) {
1170 ostr <<
"at step " << i <<
", ";
1171 if (fail_parents) ostr <<
"parents do not match, ";
1172 if (fail_dij) ostr <<
"dij does not match, ";
1173 ostr <<
"history in (p1, p2, dij) = "
1174 << history_in[i].parent1 <<
" " << history_in[i].parent2 <<
" " << history_in[i].dij;
1175 ostr <<
", history ref (p1, p2, dij) = "
1176 << history_ref[i].parent1 <<
" " << history_ref[i].parent2 <<
" " << history_ref[i].dij;
1177 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.
static void print_banner()
This is the function that is automatically called during clustering to print the FastJet banner.
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.
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 ...
@ Best
automatic selection of the best (based on N), including the LazyTiled strategies that are new to FJ3....
@ 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
@ ee_genkt_algorithm
the e+e- genkt algorithm (R > 2 and p=1 gives ee_kt)
@ genkt_algorithm
like the k_t but with distance measures dij = min(kti^{2p},ktj^{2p}) Delta R_{ij}^2 / R^2 diB = 1/kti...
@ ee_kt_algorithm
the e+e- kt algorithm
@ cambridge_algorithm
the longitudinally invariant variant of the cambridge algorithm (aka Aachen algoithm).
@ antikt_algorithm
like the k_t but with distance measures dij = min(1/kti^2,1/ktj^2) Delta R_{ij}^2 / R^2 diB = 1/kti^2
@ kt_algorithm
the longitudinally invariant kt algorithm
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.