00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "fastjet/PseudoJet.hh"
00032 #include "fastjet/ClusterSequence.hh"
00033 #include<iostream>
00034 #include<sstream>
00035 #include<vector>
00036
00037 using namespace std;
00038
00039
00040 void print_jets (const fastjet::ClusterSequence &,
00041 const vector<fastjet::PseudoJet> &);
00042
00043
00044
00047 void run_jet_finder (const vector<fastjet::PseudoJet> & input_particles,
00048 const fastjet::JetDefinition & jet_def) {
00049
00050
00051 fastjet::ClusterSequence clust_seq(input_particles, jet_def);
00052
00053
00054 cout << "Ran " << jet_def.description() << endl;
00055
00056
00057 double ptmin = 5.0;
00058 vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets(ptmin);
00059
00060
00061 cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV\n";
00062 cout << "---------------------------------------\n";
00063 print_jets(clust_seq, inclusive_jets);
00064 cout << endl;
00065
00066
00067 cout << clust_seq.unclustered_particles().size() << " particles unclustered" << endl << endl;
00068 }
00069
00070
00071
00073 void read_input_particles(istream & input,
00074 vector<fastjet::PseudoJet> & input_particles){
00075
00076
00077 double px, py , pz, E;
00078 string line;
00079 while (getline(input, line)) {
00080 if (line.substr(0,1) == "#") {continue;}
00081 istringstream linestream(line);
00082 linestream >> px >> py >> pz >> E;
00083
00084
00085 input_particles.push_back(fastjet::PseudoJet(px,py,pz,E));
00086 }
00087
00088 }
00089
00090
00092 void print_jets (const fastjet::ClusterSequence & clust_seq,
00093 const vector<fastjet::PseudoJet> & jets) {
00094
00095
00096 vector<fastjet::PseudoJet> sorted_jets = sorted_by_pt(jets);
00097
00098
00099 printf("%5s %15s %15s %15s %15s\n","jet #", "rapidity",
00100 "phi", "pt", "n constituents");
00101
00102
00103 for (unsigned int i = 0; i < sorted_jets.size(); i++) {
00104 int n_constituents = clust_seq.constituents(sorted_jets[i]).size();
00105 printf("%5u %15.8f %15.8f %15.8f %8u\n",
00106 i, sorted_jets[i].rap(), sorted_jets[i].phi(),
00107 sorted_jets[i].perp(), n_constituents);
00108 }
00109
00110 }