FastJet 3.0beta1
|
00001 //---------------------------------------------------------------------- 00002 /// \file 00003 /// \page Example02 02 - changing the jet definition 00004 /// 00005 /// fastjet basic example program: 00006 /// illustration of the usage of how to change the jet definition 00007 /// used for the clustering (see also fastjet::JetDefinition) 00008 /// 00009 /// run it with : ./02-jetdef < data/single-event.dat 00010 /// 00011 /// Source code: 02-jetdef.cc 00012 //---------------------------------------------------------------------- 00013 // 00014 //STARTHEADER 00015 // $Id: 02-jetdef.cc 2003 2011-03-11 16:10:08Z soyez $ 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 00045 #include "fastjet/ClusterSequence.hh" 00046 #include <iostream> // needed for io 00047 #include <cstdio> // needed for io 00048 00049 using namespace std; 00050 00051 /// an example program showing how to use fastjet 00052 int main (int argc, char ** argv) { 00053 00054 // read in input particles 00055 //---------------------------------------------------------- 00056 vector<fastjet::PseudoJet> input_particles; 00057 00058 double px, py , pz, E; 00059 while (cin >> px >> py >> pz >> E) { 00060 // create a fastjet::PseudoJet with these components and put it onto 00061 // back of the input_particles vector 00062 input_particles.push_back(fastjet::PseudoJet(px,py,pz,E)); 00063 } 00064 00065 00066 // create a jet definition: 00067 // a jet algorithm with a given radius parameter 00068 //---------------------------------------------------------- 00069 00070 // select a jet algorithm to use 00071 // 00072 // this could be one of 00073 // {kt_algorithm, cambridge_algorithm, antikt_algorithm, 00074 // genkt_algorithm, ee_kt_algorithm, ee_genkt_algorithm} 00075 // see example 03-plugin.cc for extra options using plugins 00076 // instead of naive algorithms) 00077 fastjet::JetAlgorithm jet_alg = fastjet::kt_algorithm; 00078 00079 // when appropriate select a radius to use 00080 // 00081 // this would not be mandatory for e^+ e^- algorithms (see 05-eplus_eminus.cc) 00082 double R = 0.6; 00083 00084 // select an __optional__ recombination scheme 00085 // 00086 // this could be one of 00087 // {E_scheme, pt_scheme, pt2_scheme, Et_scheme, Et2_scheme, BIpt_scheme, 00088 // BIpt2_scheme, external_sheme} 00089 // 00090 // Notes: 00091 // - for the usage of a user-defined recombination scheme 00092 // (external_scheme), see 11-boosted_higgs.cc 00093 // 00094 // By default, the E_scheme is used 00095 fastjet::RecombinationScheme recomb_scheme=fastjet::E_scheme; 00096 00097 // select an __optional__ strategy 00098 // 00099 // this could be chosen among 00100 // {N2MinHeapTiled, N2Tiled, N2PoorTiled, N2Plain, N3Dumb, 00101 // Best, 00102 // NlnN, NlnN3pi, NlnN4pi, NlnNCam4pi, NlnNCam2pi2R, NlnNCam} 00103 // 00104 // By default, the Best strategy is chosen and we advise to keep 00105 // that default unless you are targeting a very specific usage. Note 00106 // also that the N log (N) strategies for algorithms other than 00107 // Cambridge/Aachen need CGAL support. 00108 fastjet::Strategy strategy = fastjet::Best; 00109 00110 // create the JetDefinition from the above information 00111 fastjet::JetDefinition jet_def(jet_alg, R, recomb_scheme, strategy); 00112 00113 00114 // run the jet clustering with the above jet definition 00115 //---------------------------------------------------------- 00116 fastjet::ClusterSequence clust_seq(input_particles, jet_def); 00117 00118 00119 // get the resulting jets ordered in pt 00120 //---------------------------------------------------------- 00121 double ptmin = 5.0; 00122 vector<fastjet::PseudoJet> inclusive_jets = sorted_by_pt(clust_seq.inclusive_jets(ptmin)); 00123 00124 00125 // tell the user what was done 00126 // - the description of the algorithm used 00127 // - extract the inclusive jets with pt > 5 GeV 00128 // show the output as 00129 // {index, rap, phi, pt} 00130 //---------------------------------------------------------- 00131 cout << "Ran " << jet_def.description() << endl; 00132 00133 // label the columns 00134 printf("%5s %15s %15s %15s\n","jet #", "rapidity", "phi", "pt"); 00135 00136 // print out the details for each jet 00137 for (unsigned int i = 0; i < inclusive_jets.size(); i++) { 00138 printf("%5u %15.8f %15.8f %15.8f\n", 00139 i, inclusive_jets[i].rap(), inclusive_jets[i].phi(), 00140 inclusive_jets[i].perp()); 00141 } 00142 00143 return 0; 00144 }