fastjet_areas.cc File Reference

#include "fastjet/PseudoJet.hh"
#include "fastjet/ClusterSequenceArea.hh"
#include "fastjet/ClusterSequencePassiveArea.hh"
#include "fastjet/config.h"
#include "fastjet/SISConePlugin.hh"
#include <iostream>
#include <sstream>
#include <vector>

Include dependency graph for fastjet_areas.cc:

fastjet/PseudoJet.hhfastjet/ClusterSequenceArea.hhfastjet/ClusterSequencePassiveArea.hhfastjet/config.hfastjet/internal/numconsts.hhfastjet/internal/base.hhfastjet/ClusterSequenceAreaBase.hhfastjet/ClusterSequenceActiveArea.hhfastjet/ClusterSequenceActiveAreaExplicitGhosts.hhfastjet/ClusterSequenceVoronoiArea.hhfastjet/AreaDefinition.hhfastjet/ClusterSequence.hhfastjet/internal/LimitedWarning.hhfastjet/RangeDefinition.hhfastjet/internal/DynamicNearestNeighbours.hhfastjet/Error.hhfastjet/JetDefinition.hhfastjet/ActiveAreaSpec.hhfastjet/ClusterSequenceWithArea.hhfastjet/GhostedAreaSpec.hhfastjet/internal/BasicRandom.hhfastjet/ClusterSequence1GhostPassiveArea.hh

Go to the source code of this file.

Functions

void print_jets (const fastjet::ClusterSequenceAreaBase &clust_seq, const vector< fastjet::PseudoJet > &unsorted_jets)
 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 67 of file fastjet_areas.cc.

References fastjet::Best, fastjet::AreaDefinition::description(), fastjet::JetDefinition::description(), fastjet::ClusterSequence::inclusive_jets(), fastjet::kt_algorithm, fastjet::passive_area, print_jets(), fastjet::ClusterSequence::strategy_string(), and fastjet::ClusterSequence::unclustered_particles().

00067                                   {
00068   
00069   vector<fastjet::PseudoJet> input_particles;
00070   
00071   // read in input particles
00072   double px, py , pz, E;
00073   while (cin >> px >> py >> pz >> E) {
00074     // create a fastjet::PseudoJet with these components and put it onto
00075     // back of the input_particles vector
00076     input_particles.push_back(fastjet::PseudoJet(px,py,pz,E)); 
00077   }
00078 
00079   // create an object that represents your choice of jet algorithm, and 
00080   // the associated parameters
00081   double Rparam = 1.0;
00082   fastjet::Strategy strategy = fastjet::Best;
00083   fastjet::JetDefinition jet_def(fastjet::kt_algorithm, Rparam, strategy);
00084   //fastjet::JetDefinition jet_def(fastjet::cambridge_algorithm, Rparam, strategy);
00085   //fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, Rparam, strategy);
00086   //fastjet::JetDefinition jet_def(new fastjet::SISConePlugin(1.0));
00087 
00088   // create an object that specifies how we to define the area
00089   fastjet::AreaDefinition area_def;
00090   bool use_voronoi = false;
00091   if (!use_voronoi) {
00092     double ghost_etamax = 7.0;
00093     double ghost_area    = 0.05;
00094     int    active_area_repeats = 1;
00095     // alternative settings for more precision:
00096     // reducing ghost area gives better sensitivity to the exact edges of the jet
00097     //double ghost_area    = 0.01;
00098     // increasing the repeats is useful in sparse events
00099     //int    active_area_repeats = 100; 
00100 
00101     // now create the object that holds info about ghosts, and from that
00102     // get an area definition
00103     fastjet::GhostedAreaSpec ghost_spec(ghost_etamax, active_area_repeats, 
00104                                         ghost_area);
00105     area_def = fastjet::AreaDefinition(fastjet::passive_area,ghost_spec);
00106   } else {
00107     double effective_Rfact = 1.0;
00108     area_def = fastjet::VoronoiAreaSpec(effective_Rfact);
00109   }
00110 
00111   // run the jet clustering with the above jet definition
00112   fastjet::ClusterSequenceArea clust_seq(input_particles, 
00113                                              jet_def, area_def);
00114   // you can also run the individual area classes directly
00115   //fastjet::ClusterSequencePassiveArea clust_seq(input_particles, jet_def, 
00116   //                                              area_def.ghost_spec());
00117 
00118   // you may want to find out how much area in a given range (|y|<range)
00119   // is empty of real jets (or corresponds to pure "ghost" jets).
00120   //double range = 4.0;
00121   //cout << clust_seq.empty_area(range) << endl;
00122   //cout << clust_seq.n_empty_jets(range) << endl;
00123 
00124   // tell the user what was done
00125   cout << "Jet definition was: " << jet_def.description() << endl;
00126   cout << "Area definition was: " << area_def.description() << endl;
00127   cout << "Strategy adopted by FastJet was "<<
00128        clust_seq.strategy_string()<<endl<<endl;
00129 
00130   // extract the inclusive jets with pt > 5 GeV, sorted by pt
00131   double ptmin = 5.0;
00132   vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets(ptmin);
00133 
00134   // print them out
00135   cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV\n";
00136   cout << "---------------------------------------\n";
00137   print_jets(clust_seq, inclusive_jets);
00138   cout << endl;
00139 
00140   
00141   cout << "Number of unclustered particles: " 
00142        << clust_seq.unclustered_particles().size() << endl;
00143 
00144 
00145 }

void print_jets ( const fastjet::ClusterSequenceAreaBase clust_seq,
const vector< fastjet::PseudoJet > &  unsorted_jets 
)

a function that pretty prints a list of jets

Definition at line 150 of file fastjet_areas.cc.

References fastjet::ClusterSequenceAreaBase::area(), fastjet::ClusterSequenceAreaBase::area_error(), and fastjet::sorted_by_pt().

Referenced by main(), and run_jet_finder().

00151                                                                  {
00152 
00153   // sort jets into increasing pt
00154   vector<fastjet::PseudoJet> jets = sorted_by_pt(unsorted_jets);  
00155 
00156   printf(" ijet   rap      phi        Pt         area  +-   err\n");
00157   for (size_t j = 0; j < jets.size(); j++) {
00158 
00159     double area     = clust_seq.area(jets[j]);
00160     double area_error = clust_seq.area_error(jets[j]);
00161 
00162     printf("%5u %9.5f %8.5f %10.3f %8.3f +- %6.3f\n",j,jets[j].rap(),
00163            jets[j].phi(),jets[j].perp(), area, area_error);
00164   }
00165 
00166 
00167 }


Generated on Thu Jan 3 19:04:32 2008 for fastjet by  doxygen 1.5.2