Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ktjet_example.cc File Reference

#include <iostream>
#include <sstream>
#include <vector>
#include "KtJet/KtEvent.h"
#include "KtJet/KtLorentzVector.h"

Include dependency graph for ktjet_example.cc:

Go to the source code of this file.

Namespaces

namespace  KtJet

Functions

void print_jets (const vector< KtLorentzVector > &)
int main (int argc, char **argv)
 an example program showing how the fastjet_example program would be translated for use with ktjet.


Function Documentation

int main int  argc,
char **  argv
 

an example program showing how the fastjet_example program would be translated for use with ktjet.

Definition at line 24 of file ktjet_example.cc.

References print_jets().

00024                                   {
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 }

void print_jets const vector< KtLorentzVector > &   ) 
 

Definition at line 76 of file ktjet_example.cc.

00076                                                        {
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 }


Generated on Mon Apr 2 20:57:52 2007 for fastjet by  doxygen 1.4.2