fastjet 2.4.5
|
00001 //---------------------------------------------------------------------- 00002 // ktjet example program that should do the same thing as the 00003 // fastjet_example program (as of 3 Feb 2006) 00004 // 00005 // NB: the ../Makefile may need to be modified to set proper 00006 // paths for access to the CLHEP and KtJet libraries. 00007 //---------------------------------------------------------------------- 00008 #include<iostream> // needed for io 00009 #include<sstream> // needed for internal io 00010 #include<vector> 00011 00013 #include "KtJet/KtEvent.h" 00014 #include "KtJet/KtLorentzVector.h" 00015 00016 using namespace std; 00017 using namespace KtJet; 00018 00019 // a declaration of a function that pretty prints a list of jets 00020 void print_jets (const vector<KtLorentzVector> &); 00021 00024 int main (int argc, char ** argv) { 00025 00026 vector<KtLorentzVector> input_particles; 00027 00028 // read in input particles 00029 double px, py , pz, E; 00030 while (cin >> px >> py >> pz >> E) { 00031 // create a KtLorentzVector with these components and put it onto 00032 // back of the input_particles vector 00033 input_particles.push_back(KtLorentzVector(px,py,pz,E)); 00034 } 00035 00036 // run the inclusive jet clustering in PP mode using the covariant 00037 // E-scheme for recobination (type=4, angle=2, recom=1, rparameter=1.0) 00038 double Rparam = 1.0; 00039 KtEvent clust_seq(input_particles,4,2,1,Rparam); 00040 00041 // extract the inclusive jets with pt > 5 GeV, sorted by pt 00042 double ptmin = 5.0; 00043 vector<KtLorentzVector> temporary_jets = clust_seq.getJetsPt(); 00044 vector<KtLorentzVector> inclusive_jets; 00045 for (unsigned int i = 0; i < temporary_jets.size(); i++) { 00046 if (temporary_jets[i].perp() >= ptmin) { 00047 inclusive_jets.push_back(temporary_jets[i]);} 00048 else {break;} 00049 } 00050 00051 // print them out 00052 cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV\n"; 00053 cout << "---------------------------------------\n"; 00054 print_jets(inclusive_jets); 00055 cout << endl; 00056 00057 // Extract the exclusive jets with dcut = 25 GeV^2. 00058 double dcut = 25.0; 00059 // Note that KtJet's definition of dij differs from Ellis&Soper (and 00060 // fastjet) in the case where Rparam /= 1.0 (though in this case one 00061 // should perhaps not be using the exclusive kt algorithm in any case). 00062 clust_seq.findJetsD(dcut * Rparam*Rparam); 00063 vector<KtLorentzVector> exclusive_jets = clust_seq.getJetsPt(); 00064 00065 // print them out 00066 cout << "Printing exclusive jets with dcut = "<< dcut<<" GeV^2\n"; 00067 cout << "--------------------------------------------\n"; 00068 print_jets(exclusive_jets); 00069 00070 00071 } 00072 00073 00074 //---------------------------------------------------------------------- 00075 // a function that pretty prints a list of jets 00076 void print_jets (const vector<KtLorentzVector> & jets) { 00077 00078 // label the columns 00079 printf("%5s %15s %15s %15s %15s\n","jet #", "rapidity", 00080 "phi", "pt", "n constituents"); 00081 00082 // print out the details for each jet 00083 for (unsigned int i = 0; i < jets.size(); i++) { 00084 int n_constituents = jets[i].getConstituents().size(); 00085 double phi = jets[i].phi(); 00086 if (phi < 0.0) {phi += 6.283185307179586476925286766559005768394;} 00087 printf("%5u %15.8f %15.8f %15.8f %8u\n", 00088 i, jets[i].rapidity(), phi, 00089 jets[i].perp(), n_constituents); 00090 } 00091 00092 }