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

fastjet_example.cc File Reference

#include "fastjet/PseudoJet.hh"
#include "fastjet/ClusterSequence.hh"
#include <iostream>
#include <sstream>
#include <vector>

Include dependency graph for fastjet_example.cc:

Go to the source code of this file.

Functions

void print_jets (const fastjet::ClusterSequence &, const vector< fastjet::PseudoJet > &)
 a function that pretty prints a list of jets
int main (int argc, char **argv)
 an example program showing how to use fastjet


Function Documentation

int main int  argc,
char **  argv
 

an example program showing how to use fastjet

Definition at line 55 of file fastjet_example.cc.

References fastjet::Best, fastjet::ClusterSequence::inclusive_jets(), fastjet::kt_algorithm, print_jets(), and fastjet::ClusterSequence::strategy_string().

00055                                   {
00056   
00057   vector<fastjet::PseudoJet> input_particles;
00058   
00059   // read in input particles
00060   double px, py , pz, E;
00061   while (cin >> px >> py >> pz >> E) {
00062     // create a fastjet::PseudoJet with these components and put it onto
00063     // back of the input_particles vector
00064     input_particles.push_back(fastjet::PseudoJet(px,py,pz,E)); 
00065   }
00066   
00067   // create an object that represents your choice of jet finder and 
00068   // the associated parameters
00069   double Rparam = 1.0;
00070   fastjet::Strategy strategy = fastjet::Best;
00071   fastjet::JetDefinition jet_def(fastjet::kt_algorithm, Rparam, strategy);
00072 
00073   // run the jet clustering with the above jet definition
00074   fastjet::ClusterSequence clust_seq(input_particles, jet_def);
00075 
00076   // tell the user what was done
00077   cout << "Strategy adopted by FastJet was "<<
00078        clust_seq.strategy_string()<<endl<<endl;
00079 
00080   // extract the inclusive jets with pt > 5 GeV
00081   double ptmin = 5.0;
00082   vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets(ptmin);
00083 
00084   // print them out
00085   cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV\n";
00086   cout << "---------------------------------------\n";
00087   print_jets(clust_seq, inclusive_jets);
00088   cout << endl;
00089 
00090   // extract the exclusive jets with dcut = 25 GeV^2 
00091   double dcut = 25.0;
00092   vector<fastjet::PseudoJet> exclusive_jets = clust_seq.exclusive_jets(dcut);
00093 
00094   // print them out
00095   cout << "Printing exclusive jets with dcut = "<< dcut<<" GeV^2\n";
00096   cout << "--------------------------------------------\n";
00097   print_jets(clust_seq, exclusive_jets);
00098 
00099 
00100 }

void print_jets const fastjet::ClusterSequence ,
const vector< fastjet::PseudoJet > & 
 

a function that pretty prints a list of jets

Definition at line 105 of file fastjet_example.cc.

References fastjet::ClusterSequence::constituents(), and fastjet::sorted_by_pt().

00106                                                         {
00107 
00108   // sort jets into increasing pt
00109   vector<fastjet::PseudoJet> sorted_jets = sorted_by_pt(jets);  
00110 
00111   // label the columns
00112   printf("%5s %15s %15s %15s %15s\n","jet #", "rapidity", 
00113          "phi", "pt", "n constituents");
00114   
00115   // print out the details for each jet
00116   for (unsigned int i = 0; i < sorted_jets.size(); i++) {
00117     int n_constituents = clust_seq.constituents(sorted_jets[i]).size();
00118     printf("%5u %15.8f %15.8f %15.8f %8u\n",
00119            i, sorted_jets[i].rap(), sorted_jets[i].phi(),
00120            sorted_jets[i].perp(), n_constituents);
00121   }
00122 
00123 };


Generated on Thu Oct 12 17:36:34 2006 for fastjet by  doxygen 1.4.2