fastjet_subjets.cc File Reference

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

Include dependency graph for fastjet_subjets.cc:

fastjet/PseudoJet.hhfastjet/ClusterSequence.hhfastjet/internal/numconsts.hhfastjet/internal/base.hhfastjet/internal/DynamicNearestNeighbours.hhfastjet/Error.hhfastjet/JetDefinition.hh

Go to the source code of this file.

Functions

void print_jets (const fj::ClusterSequence &clust_seq, const vector< fj::PseudoJet > &jets)
 a function that pretty prints a list of jets
void print_jet (const fj::ClusterSequence &clust_seq, const fj::PseudoJet &jet)
 print a single jet
void print_jets_and_sub (const fj::ClusterSequence &clust_seq, const vector< fj::PseudoJet > &jets, double dcut)
 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 69 of file fastjet_subjets.cc.

References fastjet::cambridge_algorithm, fastjet::JetDefinition::description(), fastjet::ClusterSequence::exclusive_jets(), fastjet::ClusterSequence::inclusive_jets(), print_jets(), print_jets_and_sub(), and fastjet::ClusterSequence::strategy_string().

00069                                   {
00070   
00071   vector<fj::PseudoJet> input_particles;
00072   
00073   // read in input particles
00074   double px, py , pz, E;
00075   while (cin >> px >> py >> pz >> E) {
00076     // create a fj::PseudoJet with these components and put it onto
00077     // back of the input_particles vector
00078     input_particles.push_back(fj::PseudoJet(px,py,pz,E)); 
00079   }
00080   
00081   // We'll do two subjet analyses, physically rather different
00082   double R = 1.0;
00083   //fj::JetDefinition kt_def(fj::kt_algorithm, R);
00084   fj::JetDefinition cam_def(fj::cambridge_algorithm, R);
00085 
00086   // run the jet clustering with the above jet definition
00087   //fj::ClusterSequence kt_seq(input_particles, kt_def);
00088   fj::ClusterSequence cam_seq(input_particles, cam_def);
00089 
00090   // tell the user what was done
00091   cout << "Ran " << cam_def.description() << endl;
00092   cout << "Strategy adopted by FastJet was "<<
00093        cam_seq.strategy_string()<<endl<<endl;
00094 
00095   // extract the inclusive jets with pt > 5 GeV
00096   double ptmin = 5.0;
00097   vector<fj::PseudoJet> inclusive_jets = cam_seq.inclusive_jets(ptmin);
00098 
00099   // for the subjets  
00100   double smallR = 0.4;
00101   double dcut_cam = pow(smallR/R,2);
00102 
00103   // print them out
00104   cout << "Printing inclusive jets (R = "<<R<<") with pt > "<< ptmin<<" GeV\n";
00105   cout << "and their subjets with smallR = " << smallR << "\n";
00106   cout << "---------------------------------------\n";
00107   print_jets_and_sub(cam_seq, inclusive_jets, dcut_cam);
00108   cout << endl;
00109 
00110 
00111   // print them out
00112   vector<fj::PseudoJet> exclusive_jets = cam_seq.exclusive_jets(dcut_cam);
00113   cout << "Printing exclusive jets with dcut = "<< dcut_cam<<" \n";
00114   cout << "--------------------------------------------\n";
00115   print_jets(cam_seq, exclusive_jets);
00116 
00117 
00118 }

void print_jet ( const fj::ClusterSequence clust_seq,
const fj::PseudoJet jet 
)

print a single jet

Definition at line 172 of file fastjet_subjets.cc.

References fastjet::ClusterSequence::constituents(), fastjet::PseudoJet::perp(), fastjet::PseudoJet::phi(), and fastjet::PseudoJet::rap().

Referenced by print_jets(), and print_jets_and_sub().

00173                                          {
00174   int n_constituents = clust_seq.constituents(jet).size();
00175   printf("%15.8f %15.8f %15.8f %8u\n",
00176          jet.rap(), jet.phi(), jet.perp(), n_constituents);
00177 }

void print_jets ( const fj::ClusterSequence clust_seq,
const vector< fj::PseudoJet > &  jets 
)

a function that pretty prints a list of jets

Definition at line 123 of file fastjet_subjets.cc.

References print_jet(), and fastjet::sorted_by_pt().

00124                                                    {
00125 
00126   // sort jets into increasing pt
00127   vector<fj::PseudoJet> sorted_jets = sorted_by_pt(jets);  
00128 
00129   // label the columns
00130   printf("%5s %15s %15s %15s %15s\n","jet #", "rapidity", 
00131          "phi", "pt", "n constituents");
00132   
00133   // print out the details for each jet
00134   for (unsigned int i = 0; i < sorted_jets.size(); i++) {
00135     printf("%5u ",i);
00136     print_jet(clust_seq, sorted_jets[i]);
00137   }
00138 
00139 }

void print_jets_and_sub ( const fj::ClusterSequence clust_seq,
const vector< fj::PseudoJet > &  jets,
double  dcut 
)

a function that pretty prints a list of jets

Definition at line 144 of file fastjet_subjets.cc.

References fastjet::ClusterSequence::exclusive_subjets(), print_jet(), and fastjet::sorted_by_pt().

Referenced by main().

00146                                       {
00147 
00148   // sort jets into increasing pt
00149   vector<fj::PseudoJet> sorted_jets = sorted_by_pt(jets);  
00150 
00151   // label the columns
00152   printf("%5s %15s %15s %15s %15s\n","jet #", "rapidity", 
00153          "phi", "pt", "n constituents");
00154   
00155   // print out the details for each jet
00156   for (unsigned int i = 0; i < sorted_jets.size(); i++) {
00157     printf("%5u       ",i);
00158     print_jet(clust_seq, sorted_jets[i]);
00159     vector<fj::PseudoJet> subjets = 
00160       sorted_by_pt(clust_seq.exclusive_subjets(sorted_jets[i], dcut));
00161     for (unsigned int j = 0; j < subjets.size(); j++) {
00162       printf("    -sub-%02u ",j);
00163       print_jet(clust_seq, subjets[j]);
00164     }
00165   }
00166 
00167 }


Generated on Fri Apr 17 16:15:13 2009 for fastjet by  doxygen 1.5.7.1