fastjet_subtraction.cc File Reference

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

Include dependency graph for fastjet_subtraction.cc:

fastjet/PseudoJet.hhfastjet/ClusterSequenceArea.hhfastjet/internal/numconsts.hhfastjet/internal/base.hhfastjet/ClusterSequenceAreaBase.hhfastjet/ClusterSequenceActiveArea.hhfastjet/ClusterSequenceActiveAreaExplicitGhosts.hhfastjet/ClusterSequencePassiveArea.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, and performs the subtraction in two different ways, using a generic ClusterSequenceAreaBase type object.
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 61 of file fastjet_subtraction.cc.

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

00061                                   {
00062   
00063   // since we use here simulated data we can split the hard event
00064   // from the full (i.e. with pileup added) one
00065   vector<fastjet::PseudoJet> hard_event, full_event;
00066   
00067   // maximum rapidity that we accept for the input particles
00068   double etamax = 6.0;
00069   
00070   // read in input particles. Keep the hard event generated by PYTHIA
00071   // separated from the full event, so as to be able to gauge the
00072   // "goodness" of the subtraction from the full event which also
00073   // includes pileup
00074   string line;
00075   int  nsub  = 0;
00076   while (getline(cin, line)) {
00077     istringstream linestream(line);
00078     // take substrings to avoid problems when there are extra "pollution"
00079     // characters (e.g. line-feed).
00080     if (line.substr(0,4) == "#END") {break;}
00081     if (line.substr(0,9) == "#SUBSTART") {
00082       // if more sub events follow, make copy of hard one here
00083       if (nsub == 1) hard_event = full_event;
00084       nsub += 1;
00085     }
00086     if (line.substr(0,1) == "#") {continue;}
00087     valarray<double> fourvec(4);
00088     linestream >> fourvec[0] >> fourvec[1] >> fourvec[2] >> fourvec[3];
00089     fastjet::PseudoJet psjet(fourvec);
00090     psjet.set_user_index(0);
00091     // push event onto back of full_event vector
00092     if (abs(psjet.rap()) < etamax) {full_event.push_back(psjet);}
00093   }
00094 
00095   // if we have read in only one event, copy it across here...
00096   if (nsub == 1) hard_event = full_event;
00097 
00098   // if there was nothing in the event 
00099   if (nsub == 0) {
00100     cerr << "Error: read empty event\n";
00101     exit(-1);
00102   }
00103   
00104   
00105   // create an object that represents your choice of jet algorithm and 
00106   // the associated parameters
00107   double R = 0.7;
00108   fastjet::Strategy strategy = fastjet::Best;
00109   fastjet::JetDefinition jet_def(fastjet::kt_algorithm, R, strategy);
00110   //fastjet::JetDefinition jet_def(fastjet::cambridge_algorithm, R, strategy);
00111   //fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, R, strategy);
00112 
00113   // create an object that specifies how we to define the (active) area
00114   double ghost_etamax = 6.0;
00115   int    active_area_repeats = 1;
00116   double ghost_area    = 0.01;
00117   fastjet::ActiveAreaSpec area_spec(ghost_etamax, active_area_repeats, 
00118                                     ghost_area);
00119   fastjet::AreaDefinition area_def(area_spec);
00120   //fastjet::AreaDefinition area_def(fastjet::VoronoiAreaSpec(1.0));
00121 
00122   // run the jet clustering with the above jet definition. hard event first
00123   fastjet::ClusterSequenceArea clust_seq(hard_event, jet_def, area_def);
00124   //fastjet::ClusterSequencePassiveArea clust_seq(hard_event, jet_def);
00125 
00126 
00127   // extract the inclusive jets with pt > 5 GeV, sorted by pt
00128   double ptmin = 5.0;
00129   vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets(ptmin);
00130 
00131   // print them out
00132   cout << "" <<endl;
00133   cout << "Hard event only"<<endl;
00134   cout << "Number of input particles: "<<hard_event.size()<<endl;
00135   cout << "Strategy used: "<<clust_seq.strategy_string()<<endl;
00136   cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV\n";
00137   cout << "---------------------------------------\n";
00138   print_jets(clust_seq, inclusive_jets);
00139   cout << endl;
00140 
00141 
00142   // repeat everything on the full event
00143 
00144   // run the jet clustering with the above jet definition
00145   //fastjet::ClusterSequenceActiveArea clust_seq_full(full_event, jet_def, area_spec);
00146   fastjet::ClusterSequenceArea clust_seq_full(full_event, jet_def, area_def);
00147   //fastjet::ClusterSequencePassiveArea clust_seq_full(full_event, jet_def,0.9);
00148 
00149   // extract the inclusive jets with pt > 20 GeV, sorted by pt
00150   ptmin = 20.0;
00151   inclusive_jets = clust_seq_full.inclusive_jets(ptmin);
00152 
00153   // print them out
00154   cout << "Full event, with pileup, and its subtraction"<<endl;
00155   cout << "Number of input particles: "<<full_event.size()<<endl;
00156   cout << "Strategy used: "<<clust_seq_full.strategy_string()<<endl;
00157   cout << "Printing inclusive jets with pt > "<< ptmin<<" GeV (before subtraction)\n";
00158   cout << "---------------------------------------\n";
00159   print_jets(clust_seq_full, inclusive_jets);
00160   cout << endl;
00161 
00162 
00163 }

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

a function that pretty prints a list of jets, and performs the subtraction in two different ways, using a generic ClusterSequenceAreaBase type object.


Generated on Tue Dec 18 17:05:08 2007 for fastjet by  doxygen 1.5.2