15#include "fastjet/internal/numconsts.hh"
20#include "KtJet/KtEvent.h"
21#include "KtJet/KtLorentzVector.h"
25inline double pow2(
const double x) {
return x*x;}
28int main (
int argc,
char ** argv) {
32 int repeat = cmdline.int_val(
"-repeat",1);
33 int combine = cmdline.int_val(
"-combine",1);
34 bool write = cmdline.present(
"-write");
35 double ktR = cmdline.double_val(
"-r",1.0);
36 double inclkt = cmdline.double_val(
"-incl",-1.0);
37 int excln = cmdline.int_val (
"-excln",-1);
38 double excld = cmdline.double_val(
"-excld",-1.0);
39 int nev = cmdline.int_val(
"-nev",1);
40 bool massless = cmdline.present(
"-massless");
41 bool get_all_dij = cmdline.present(
"-get-all-dij");
44 for (
int iev = 0; iev < nev; iev++) {
45 vector<KtJet::KtLorentzVector> jets;
48 while (getline(cin, line)) {
50 istringstream linestream(line);
53 if (ndone == combine) {
break;}
55 if (line.substr(0,1) ==
"#") {
continue;}
56 valarray<double> fourvec(4);
57 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2] >> fourvec[3];
59 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2];
60 fourvec[3] = sqrt(pow2(fourvec[0])+pow2(fourvec[1])+pow2(fourvec[2]));}
62 linestream >> fourvec[0] >> fourvec[1] >> fourvec[2] >> fourvec[3];
64 KtJet::KtLorentzVector p(fourvec[0],fourvec[1],fourvec[2],fourvec[3]);
69 int type, angle, recom;
71 if (cmdline.present(
"-eekt")) {
75 info <<
"Algorithm: KtJet e+e- kt algorithm" ;
80 info <<
"Algorithm: KtJet (long.inv.) with R = " << ktR ;
84 for (
int i = 0; i < repeat ; i++) {
86 KtJet::KtEvent ev(jets,type,angle,recom,ktR);
89 int nparticles = jets.size();
90 cout <<
"Number of particles = "<< nparticles << endl;
91 cout << info.str() << endl;
97 std::vector<KtJet::KtLorentzVector> jets = ev.getJetsPt();
100 std::vector<KtJet::KtLorentzVector>::const_iterator itr = jets.begin();
101 for( ; itr != jets.end() ; ++itr) {
102 std::cout <<
"Jets Pt2: " << pow2((*itr).perp()) << std::endl;
108 std::vector<KtJet::KtLorentzVector> jets = ev.getJetsPt();
111 for (
size_t j = 0; j < jets.size(); j++) {
112 if (jets[j].perp() < inclkt) {
break;}
113 double phi = jets[j].phi();
114 if (phi < 0.0) {phi += fastjet::twopi;}
115 printf(
"%5u %15.8f %15.8f %15.8f\n",j,jets[j].rapidity(),phi,jets[j].perp());
121 vector<KtJet::KtLorentzVector> jets = ev.getJetsPt();
122 cout <<
"Printing "<<excln<<
" exclusive jets\n";
123 for (
size_t j = 0; j < jets.size(); j++) {
124 double phi = jets[j].phi();
125 if (phi < 0) phi += fastjet::twopi;
126 printf(
"%5u %15.8f %15.8f %15.8f\n",j,
127 jets[j].rapidity(),phi,jets[j].perp());
133 vector<KtJet::KtLorentzVector> jets = ev.getJetsPt();
134 cout <<
"Printing exclusive jets for d = "<<excld<<
"\n";
135 for (
size_t j = 0; j < jets.size(); j++) {
136 double phi = jets[j].phi();
137 if (phi < 0) phi += fastjet::twopi;
138 printf(
"%5u %15.8f %15.8f %15.8f\n",j,
139 jets[j].rapidity(),phi,jets[j].perp());
144 for (
int i = nparticles-1; i > 0; i--) {
145 printf(
"d for n = %4d -> %4d is %14.5e\n", i+1, i, ev.getDMerge(i));
int main()
an example program showing how to use fastjet