/////////////////////////////////////////////////////////////////////////////// // File: siscone.cpp // // Description: source file for the main SISCone class // // This file is part of the SISCone project. // // For more details, see http://projects.hepforge.org/siscone // // // // Copyright (c) 2006 Gavin Salam and Gregory Soyez // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // // // // $Revision:: 371 $// // $Date:: 2014-09-09 10:05:32 +0200 (Tue, 09 Sep 2014) $// /////////////////////////////////////////////////////////////////////////////// //#ifdef HAVE_CONFIG_H #include "config.h" //#else //#define PACKAGE_NAME "SISCone" //#define VERSION "3.0.0" //#warning "No config.h file available, using preset values" //#endif #include "ranlux.h" #include "momentum.h" #include "defines.h" #include "siscone.h" #include "siscone_error.h" #include #include #include namespace siscone{ using namespace std; /*************************************************************** * Csiscone implementation * * final class: gather everything to compute the jet contents. * * * * This is the class user should use. * * It computes the jet contents of a list of particles * * given a cone radius and a threshold for splitting/merging. * ***************************************************************/ // default ctor //-------------- Csiscone::Csiscone(){ rerun_allowed = false; } // default dtor //-------------- Csiscone::~Csiscone(){ rerun_allowed = false; } bool Csiscone::init_done=false; std::ostream* Csiscone::_banner_ostr = &cout; /* * compute the jets from a given particle set doing multiple passes * such pass N looks for jets among all particles not put into jets * during previous passes. * - _particles list of particles * - _radius cone radius * - _f shared energy threshold for splitting&merging * - _n_pass_max maximum number of runs * - _ptmin minimum pT of the protojets * - _split_merge_scale the scale choice for the split-merge procedure * NOTE: using pt leads to IR unsafety for some events with momentum * conservation. So we strongly advise not to change the default * value. * return the number of jets found. **********************************************************************/ int Csiscone::compute_jets(vector &_particles, double _radius, double _f, int _n_pass_max, double _ptmin, Esplit_merge_scale _split_merge_scale){ _initialise_if_needed(); // run some general safety tests (NB: f will be checked in split-merge) if (_radius <= 0.0 || _radius >= 0.5*M_PI) { ostringstream message; message << "Illegal value for cone radius, R = " << _radius << " (legal values are 00) && (_n_pass_max!=0)); rerun_allowed = true; // split & merge return perform(_f, _ptmin); } /* * compute the jets from a given particle set doing multiple passes * such pass N looks for jets among all particles not put into jets * during previous passes. * - _particles list of particles * - _radius cone radius * - _n_pass_max maximum number of runs * - _ptmin minimum pT of the protojets * - _ordering_scale the ordering scale to decide which stable * cone is removed * return the number of jets found. **********************************************************************/ int Csiscone::compute_jets_progressive_removal(vector &_particles, double _radius, int _n_pass_max, double _ptmin, Esplit_merge_scale _ordering_scale){ _initialise_if_needed(); // run some general safety tests (NB: f will be checked in split-merge) if (_radius <= 0.0 || _radius >= 0.5*M_PI) { ostringstream message; message << "Illegal value for cone radius, R = " << _radius << " (legal values are 00) && (_n_pass_max!=0)); // split & merge return jets.size(); } /* * recompute the jets with a different overlap parameter. * we use the same particles and R as in the preceeding call. * - _f shared energy threshold for splitting&merging * - _ptmin minimum pT of the protojets * - _split_merge_scale the scale choice for the split-merge procedure * NOTE: using pt leads to IR unsafety for some events with momentum * conservation. So we strongly advise not to change the default * value. * return the number of jets found, -1 if recomputation not allowed. ********************************************************************/ int Csiscone::recompute_jets(double _f, double _ptmin, Esplit_merge_scale _split_merge_scale){ if (!rerun_allowed) return -1; ptcomparison.split_merge_scale = _split_merge_scale; // restore particle list partial_clear(); init_pleft(); // initialise split/merge algorithm unsigned int i; for (i=0;iflush(); } } // finally, a bunch of functions to access to // basic information (package name, version) //--------------------------------------------- /* * return SISCone package name. * This is nothing but "SISCone", it is a replacement to the * PACKAGE_NAME string defined in config.h and which is not * public by default. * return the SISCone name as a string */ string siscone_package_name(){ return PACKAGE_NAME; } /* * return SISCone version number. * return a string of the form "X.Y.Z" with possible additional tag * (alpha, beta, devel) to mention stability status */ string siscone_version(){ return VERSION; } }