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