run_jet_finder.cc File Reference

#include "fastjet/PseudoJet.hh"
#include "fastjet/ClusterSequence.hh"
#include <iostream>
#include <sstream>
#include <vector>
#include <cstdio>
Include dependency graph for run_jet_finder.cc:

Go to the source code of this file.

Functions

void print_jets (const fastjet::ClusterSequence &clust_seq, const vector< fastjet::PseudoJet > &jets)
 a function that pretty prints a list of jets
void run_jet_finder (const vector< fastjet::PseudoJet > &input_particles, const fastjet::JetDefinition &jet_def)
 subroutine that runs fastjet (on input particles from cin) using an arbitrary jet definition supplied as an argument
void read_input_particles (istream &input, vector< fastjet::PseudoJet > &input_particles)
 a function that reads particles from the supplied istream

Function Documentation

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

a function that pretty prints a list of jets

Definition at line 93 of file run_jet_finder.cc.

References fastjet::d0::inline_maths::phi(), and sorted_by_pt().

00094                                                         {
00095 
00096   // sort jets into increasing pt
00097   vector<fastjet::PseudoJet> sorted_jets = sorted_by_pt(jets);  
00098 
00099   // label the columns
00100   printf("%5s %15s %15s %15s %15s\n","jet #", "rapidity", 
00101          "phi", "pt", "n constituents");
00102   
00103   // print out the details for each jet
00104   for (unsigned int i = 0; i < sorted_jets.size(); i++) {
00105     int n_constituents = clust_seq.constituents(sorted_jets[i]).size();
00106     printf("%5u %15.8f %15.8f %15.8f %8u\n",
00107            i, sorted_jets[i].rap(), sorted_jets[i].phi(),
00108            sorted_jets[i].perp(), n_constituents);
00109   }
00110 
00111 }

void read_input_particles ( istream &  input,
vector< fastjet::PseudoJet > &  input_particles 
)

a function that reads particles from the supplied istream

Definition at line 74 of file run_jet_finder.cc.

Referenced by main().

00075                                                                      {
00076 
00077   // read in input particles
00078   double px, py , pz, E;
00079   string line;
00080   while (getline(input, line)) {
00081     if (line.substr(0,1) == "#") {continue;}
00082     istringstream linestream(line);
00083     linestream >> px >> py >> pz >> E;
00084   // create a fastjet::PseudoJet with these components and put it onto
00085     // back of the input_particles vector
00086     input_particles.push_back(fastjet::PseudoJet(px,py,pz,E)); 
00087   }
00088   
00089 }

void run_jet_finder ( const vector< fastjet::PseudoJet > &  input_particles,
const fastjet::JetDefinition &  jet_def 
)

subroutine that runs fastjet (on input particles from cin) using an arbitrary jet definition supplied as an argument

Definition at line 48 of file run_jet_finder.cc.

References print_jets().

Referenced by main().

00049                                                            {
00050   
00051   // run the jet clustering with the above jet definition
00052   fastjet::ClusterSequence clust_seq(input_particles, jet_def);
00053 
00054   // tell the user what was done
00055   cout << "Ran " << jet_def.description() << endl;
00056 
00057   // extract the inclusive jets with pt > 5 GeV
00058   double ptmin = 5.0;
00059   vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets(ptmin);
00060 
00061   // print them out
00062   cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV\n";
00063   cout << "---------------------------------------\n";
00064   print_jets(clust_seq, inclusive_jets);
00065   cout << endl;
00066 
00067   // print out unclustered stuff
00068   cout << clust_seq.unclustered_particles().size() << " particles unclustered" << endl << endl;
00069 }


Generated on 26 Feb 2010 for fastjet by  doxygen 1.6.1