09-extra_info.cc

Go to the documentation of this file.
00001 //----------------------------------------------------------------------
00008 //----------------------------------------------------------------------
00009 
00010 //STARTHEADER
00011 // $Id: 09-extra_info.cc 1884 2011-01-27 14:48:39Z salam $
00012 //
00013 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin Salam and Gregory Soyez
00014 //
00015 //----------------------------------------------------------------------
00016 // This file is part of FastJet.
00017 //
00018 //  FastJet is free software; you can redistribute it and/or modify
00019 //  it under the terms of the GNU General Public License as published by
00020 //  the Free Software Foundation; either version 2 of the License, or
00021 //  (at your option) any later version.
00022 //
00023 //  The algorithms that underlie FastJet have required considerable
00024 //  development and are described in hep-ph/0512210. If you use
00025 //  FastJet as part of work towards a scientific publication, please
00026 //  include a citation to the FastJet paper.
00027 //
00028 //  FastJet is distributed in the hope that it will be useful,
00029 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00030 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00031 //  GNU General Public License for more details.
00032 //
00033 //  You should have received a copy of the GNU General Public License
00034 //  along with FastJet; if not, write to the Free Software
00035 //  Foundation, Inc.:
00036 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00037 //----------------------------------------------------------------------
00038 //ENDHEADER
00039 
00040 #include "fastjet/ClusterSequence.hh"
00041 #include <iostream> // needed for io
00042 #include <cstdio>   // needed for io
00043 
00044 using namespace std;
00045 
00047 int main (int argc, char ** argv) {
00048 
00049   cerr << "This example is still under construction" << endl;
00050   exit(-1);
00051   
00052   // read in input particles
00053   //----------------------------------------------------------
00054   vector<fastjet::PseudoJet> input_particles;
00055   
00056   double px, py , pz, E;
00057   while (cin >> px >> py >> pz >> E) {
00058     // create a fastjet::PseudoJet with these components and put it onto
00059     // back of the input_particles vector
00060     input_particles.push_back(fastjet::PseudoJet(px,py,pz,E)); 
00061   }
00062   
00063 
00064   // create a jet definition: 
00065   // a jet algorithm with a given radius parameter
00066   //----------------------------------------------------------
00067   double R = 0.6;
00068   fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, R);
00069 
00070 
00071   // run the jet clustering with the above jet definition
00072   //----------------------------------------------------------
00073   fastjet::ClusterSequence clust_seq(input_particles, jet_def);
00074 
00075 
00076   // get the resulting jets ordered in pt
00077   //----------------------------------------------------------
00078   double ptmin = 5.0;
00079   vector<fastjet::PseudoJet> inclusive_jets = sorted_by_pt(clust_seq.inclusive_jets(ptmin));
00080 
00081 
00082   // tell the user what was done
00083   //  - the description of the algorithm used
00084   //  - extract the inclusive jets with pt > 5 GeV
00085   //    show the output as 
00086   //      {index, rap, phi, pt}
00087   //----------------------------------------------------------
00088   cout << "Ran " << jet_def.description() << endl;
00089 
00090   // label the columns
00091   printf("%5s %15s %15s %15s\n","jet #", "rapidity", "phi", "pt");
00092  
00093   // print out the details for each jet
00094   for (unsigned int i = 0; i < inclusive_jets.size(); i++) {
00095     printf("%5u %15.8f %15.8f %15.8f\n",
00096            i, inclusive_jets[i].rap(), inclusive_jets[i].phi(),
00097            inclusive_jets[i].perp());
00098   }
00099 
00100   return 0;
00101 }