many_algs_example.cc

00001 //STARTHEADER
00002 // $Id: many_algs_example.cc 1909 2011-01-28 16:27:25Z soyez $
00003 //
00004 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
00005 //
00006 //----------------------------------------------------------------------
00007 // This file is part of FastJet.
00008 //
00009 //  FastJet is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU General Public License as published by
00011 //  the Free Software Foundation; either version 2 of the License, or
00012 //  (at your option) any later version.
00013 //
00014 //  The algorithms that underlie FastJet have required considerable
00015 //  development and are described in hep-ph/0512210. If you use
00016 //  FastJet as part of work towards a scientific publication, please
00017 //  include a citation to the FastJet paper.
00018 //
00019 //  FastJet is distributed in the hope that it will be useful,
00020 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 //  GNU General Public License for more details.
00023 //
00024 //  You should have received a copy of the GNU General Public License
00025 //  along with FastJet; if not, write to the Free Software
00026 //  Foundation, Inc.:
00027 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //----------------------------------------------------------------------
00029 //ENDHEADER
00030 
00031 //----------------------------------------------------------------------
00032 // example program to illustrate the use of multiple jet-definitions,
00033 // some of which are plugin based.
00034 //
00035 // Compile it with: make many_algs_example
00036 // run it with    : ./many_algs_example < data/single-event.dat
00037 //----------------------------------------------------------------------
00038 
00039 #include "fastjet/config.h"
00040 #include "run_jet_finder.hh"
00041 
00042 // get info on how fastjet was configured
00043 #include "fastjet/config.h"
00044 
00045 #ifdef FASTJET_ENABLE_PLUGIN_SISCONE
00046 #  include "fastjet/SISConePlugin.hh"
00047 #endif
00048 #ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
00049 #  include "fastjet/CDFMidPointPlugin.hh"
00050 #  include "fastjet/CDFJetCluPlugin.hh"
00051 #endif
00052 #ifdef FASTJET_ENABLE_PLUGIN_PXCONE
00053 #  include "fastjet/PxConePlugin.hh"
00054 #endif
00055 #ifdef FASTJET_ENABLE_PLUGIN_D0RUNIICONE
00056 #  include "fastjet/D0RunIIConePlugin.hh"
00057 #endif
00058 #ifdef FASTJET_ENABLE_PLUGIN_TRACKJET
00059 #include "fastjet/TrackJetPlugin.hh"
00060 #endif
00061 #ifdef FASTJET_ENABLE_PLUGIN_ATLASCONE
00062 #include "fastjet/ATLASConePlugin.hh"
00063 #endif
00064 #ifdef FASTJET_ENABLE_PLUGIN_EECAMBRIDGE
00065 #include "fastjet/EECambridgePlugin.hh"
00066 #endif
00067 #ifdef FASTJET_ENABLE_PLUGIN_JADE
00068 #include "fastjet/JadePlugin.hh"
00069 #endif
00070 #ifdef FASTJET_ENABLE_PLUGIN_CMSITERATIVECONE
00071 #include "fastjet/CMSIterativeConePlugin.hh"
00072 #endif
00073 #ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
00074 #include "fastjet/D0RunIpre96ConePlugin.hh"
00075 #include "fastjet/D0RunIConePlugin.hh"
00076 #endif
00077 // end of the plugin list (don't modify this line)
00078 
00079 #include<vector>
00080 #include<iostream>
00081 #include "fastjet/PseudoJet.hh"
00082 
00083 using namespace std;
00084 
00085 int main(int argc, char** argv) {
00086 
00087   // read input particles
00088   vector<fastjet::PseudoJet> input_particles;
00089   read_input_particles(cin, input_particles);
00090   
00091   // we will have four jet definitions, and the first two will be
00092   // plugins
00093   vector<fastjet::JetDefinition> jet_defs;
00094   vector<fastjet::JetDefinition::Plugin *> plugins;
00095 
00096   // common parameters
00097   double jet_radius = 0.7;
00098   //double jet_radius = 1.0;
00099   double overlap_threshold = 0.5;
00100 
00101   // set up a pxcone jet definition (if wanted -- requires f77, and you
00102   // should compile the pxcone plugin (not there by default))
00103 #ifdef FASTJET_ENABLE_PLUGIN_PXCONE
00104   double min_jet_energy = 5.0;
00105   bool   E_scheme_jets = false;
00106   plugins.push_back( new fastjet::PxConePlugin (jet_radius, min_jet_energy, 
00107                                         overlap_threshold, E_scheme_jets));
00108   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00109 #endif // FASTJET_ENABLE_PLUGIN_PXCONE
00110 
00111 
00112 
00113   // set up a CDF midpoint jet definition
00114 #ifdef FASTJET_ENABLE_PLUGIN_CDFCONES
00115   double seed_threshold = 1.0;
00116   double cone_area_fraction = 1.0;
00117   int    max_pair_size = 2;
00118   int    max_iterations = 100;
00119   plugins.push_back(new fastjet::CDFMidPointPlugin(seed_threshold, jet_radius, 
00120                                           cone_area_fraction, max_pair_size,
00121                                           max_iterations, overlap_threshold));
00122   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00123 #endif
00124 
00125   // set up a siscone jet definition
00126 #ifdef FASTJET_ENABLE_PLUGIN_SISCONE
00127   int npass = 0;               // do infinite number of passes
00128   double protojet_ptmin = 0.0; // use all protojets
00129   plugins.push_back(new fastjet::SISConePlugin (jet_radius, overlap_threshold, 
00130                                                 npass, protojet_ptmin));
00131   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00132 #endif
00133 
00134   // set up a d0runiicone jet definition
00135 #ifdef FASTJET_ENABLE_PLUGIN_D0RUNIICONE
00136   double min_jet_Et = 6.0; // earlier D0 analyses used 8 GeV
00137   plugins.push_back(new fastjet::D0RunIIConePlugin (jet_radius, min_jet_Et, 
00138                                               overlap_threshold));
00139   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00140 #endif // FASTJET_ENABLE_PLUGIN_D0RUNIICONE
00141 
00142   // set up a trackjet
00143 #ifdef FASTJET_ENABLE_PLUGIN_TRACKJET
00144   plugins.push_back(new fastjet::TrackJetPlugin(jet_radius));
00145   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00146 #endif // FASTJET_ENABLE_PLUGIN_TRACKJET
00147   // set up a atlascone
00148 #ifdef FASTJET_ENABLE_PLUGIN_ATLASCONE
00149   plugins.push_back(new fastjet::ATLASConePlugin(jet_radius));
00150   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00151 #endif // FASTJET_ENABLE_PLUGIN_ATLASCONE
00152   // set up a eecambridge
00153 #ifdef FASTJET_ENABLE_PLUGIN_EECAMBRIDGE
00154   double ycut = 0.08;
00155   plugins.push_back(new fastjet::EECambridgePlugin(ycut));
00156   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00157 #endif // FASTJET_ENABLE_PLUGIN_EECAMBRIDGE
00158   // set up a jade
00159 #ifdef FASTJET_ENABLE_PLUGIN_JADE
00160   plugins.push_back(new fastjet::JadePlugin());
00161   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00162 #endif // FASTJET_ENABLE_PLUGIN_JADE
00163   // set up a cmsiterativecone
00164 #ifdef FASTJET_ENABLE_PLUGIN_CMSITERATIVECONE
00165   double cms_seed_threshold = 1.0;
00166   plugins.push_back(new fastjet::CMSIterativeConePlugin(jet_radius, cms_seed_threshold));
00167   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00168 #endif // FASTJET_ENABLE_PLUGIN_CMSITERATIVECONE
00169   // set up a d0runicone
00170 #ifdef FASTJET_ENABLE_PLUGIN_D0RUNICONE
00171   double d0runi_seed_threshold = 8.0;
00172   plugins.push_back(new fastjet::D0RunIpre96ConePlugin(jet_radius, d0runi_seed_threshold));
00173   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00174   plugins.push_back(new fastjet::D0RunIConePlugin(jet_radius, d0runi_seed_threshold));
00175   jet_defs.push_back(fastjet::JetDefinition(plugins.back()));
00176 #endif // FASTJET_ENABLE_PLUGIN_D0RUNICONE
00177   // end of the plugins instantiation (don't modify this line)
00178 
00179   // set up kt and cam/aachen definitions
00180   jet_defs.push_back(fastjet::JetDefinition(fastjet::kt_algorithm, jet_radius));
00181   jet_defs.push_back(fastjet::JetDefinition(fastjet::cambridge_algorithm, 
00182                                             jet_radius));
00183   jet_defs.push_back(fastjet::JetDefinition(fastjet::antikt_algorithm, 
00184                                             jet_radius));
00185 
00186   // call the example jet-finding routine with each of jet definitions
00187   for (vector<fastjet::JetDefinition>::const_iterator jd_it = jet_defs.begin();
00188        jd_it != jet_defs.end(); jd_it++) {
00189     run_jet_finder(input_particles, *jd_it);
00190   }
00191 
00192   // clean up plugin memory.
00193   for (vector<fastjet::JetDefinition>::const_iterator jd_it = jet_defs.begin();
00194        jd_it != jet_defs.end(); jd_it++) {
00195     if (jd_it->plugin() != NULL) delete jd_it->plugin();
00196   }
00197 }