[20] | 1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | // File: siscone.cpp //
|
---|
| 3 | // Description: source file for the main SISCone class //
|
---|
| 4 | // This file is part of the SISCone project. //
|
---|
| 5 | // For more details, see http://projects.hepforge.org/siscone //
|
---|
| 6 | // //
|
---|
| 7 | // Copyright (c) 2006 Gavin Salam and Gregory Soyez //
|
---|
| 8 | // //
|
---|
| 9 | // This program is free software; you can redistribute it and/or modify //
|
---|
| 10 | // it under the terms of the GNU General Public License as published by //
|
---|
| 11 | // the Free Software Foundation; either version 2 of the License, or //
|
---|
| 12 | // (at your option) any later version. //
|
---|
| 13 | // //
|
---|
| 14 | // This program is distributed in the hope that it will be useful, //
|
---|
| 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
---|
| 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
---|
| 17 | // GNU General Public License for more details. //
|
---|
| 18 | // //
|
---|
| 19 | // You should have received a copy of the GNU General Public License //
|
---|
| 20 | // along with this program; if not, write to the Free Software //
|
---|
| 21 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
|
---|
| 22 | // //
|
---|
| 23 | // $Revision: 1.1 $//
|
---|
| 24 | // $Date: 2008-10-02 15:20:28 $//
|
---|
| 25 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 26 |
|
---|
| 27 | #include "config.h"
|
---|
| 28 |
|
---|
| 29 | #include "ranlux.h"
|
---|
| 30 | #include "momentum.h"
|
---|
| 31 | #include "defines.h"
|
---|
| 32 | #include "siscone.h"
|
---|
| 33 | #include "siscone_error.h"
|
---|
| 34 | #include <iostream>
|
---|
| 35 | #include <sstream>
|
---|
| 36 | #include <iomanip>
|
---|
| 37 |
|
---|
| 38 | namespace siscone{
|
---|
| 39 | using namespace std;
|
---|
| 40 |
|
---|
| 41 | /***************************************************************
|
---|
| 42 | * Csiscone implementation *
|
---|
| 43 | * final class: gather everything to compute the jet contents. *
|
---|
| 44 | * *
|
---|
| 45 | * This is the class user should use. *
|
---|
| 46 | * It computes the jet contents of a list of particles *
|
---|
| 47 | * given a cone radius and a threshold for splitting/merging. *
|
---|
| 48 | ***************************************************************/
|
---|
| 49 |
|
---|
| 50 | // default ctor
|
---|
| 51 | //--------------
|
---|
| 52 | Csiscone::Csiscone(){
|
---|
| 53 | rerun_allowed = false;
|
---|
| 54 | }
|
---|
| 55 |
|
---|
| 56 | // default dtor
|
---|
| 57 | //--------------
|
---|
| 58 | Csiscone::~Csiscone(){
|
---|
| 59 | rerun_allowed = false;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | bool Csiscone::init_done=false;
|
---|
| 63 |
|
---|
| 64 | /*
|
---|
| 65 | * compute the jets from a given particle set doing multiple passes
|
---|
| 66 | * such pass N looks for jets among all particles not put into jets
|
---|
| 67 | * during previous passes.
|
---|
| 68 | * - _particles list of particles
|
---|
| 69 | * - _radius cone radius
|
---|
| 70 | * - _f shared energy threshold for splitting&merging
|
---|
| 71 | * - _n_pass_max maximum number of runs
|
---|
| 72 | * - _ptmin minimum pT of the protojets
|
---|
| 73 | * - _split_merge_scale the scale choice for the split-merge procedure
|
---|
| 74 | * NOTE: using pt leads to IR unsafety for some events with momentum
|
---|
| 75 | * conservation. So we strongly advise not to change the default
|
---|
| 76 | * value.
|
---|
| 77 | * return the number of jets found.
|
---|
| 78 | **********************************************************************/
|
---|
| 79 | int Csiscone::compute_jets(vector<Cmomentum> &_particles, double _radius, double _f,
|
---|
| 80 | int _n_pass_max, double _ptmin,
|
---|
| 81 | Esplit_merge_scale _split_merge_scale){
|
---|
| 82 | // initialise random number generator
|
---|
| 83 | if (!init_done){
|
---|
| 84 | // initialise random number generator
|
---|
| 85 | ranlux_init();
|
---|
| 86 |
|
---|
| 87 | // print the banner
|
---|
| 88 | cout << "#ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" << endl;
|
---|
| 89 | cout << "# SISCone version " << setw(28) << left << siscone_version() << "o" << endl;
|
---|
| 90 | cout << "# http://projects.hepforge.org/siscone o" << endl;
|
---|
| 91 | cout << "# o" << endl;
|
---|
| 92 | cout << "# This is SISCone: the Seedless Infrared Safe Cone Jet Algorithm o" << endl;
|
---|
| 93 | cout << "# SISCone was written by Gavin Salam and Gregory Soyez o" << endl;
|
---|
| 94 | cout << "# It is released under the terms of the GNU General Public License o" << endl;
|
---|
| 95 | cout << "# o" << endl;
|
---|
| 96 | cout << "# A description of the algorithm is available in the publication o" << endl;
|
---|
| 97 | cout << "# JHEP 05 (2007) 086 [arXiv:0704.0292 (hep-ph)]. o" << endl;
|
---|
| 98 | cout << "# Please cite it if you use SISCone. o" << endl;
|
---|
| 99 | cout << "#ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo" << endl;
|
---|
| 100 | cout << endl;
|
---|
| 101 | // do not do this again
|
---|
| 102 | init_done=true;
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | // run some general safety tests (NB: f will be checked in split-merge)
|
---|
| 106 | if (_radius <= 0.0 || _radius >= 0.5*M_PI) {
|
---|
| 107 | ostringstream message;
|
---|
| 108 | message << "Illegal value for cone radius, R = " << _radius
|
---|
| 109 | << " (legal values are 0<R<pi/2)";
|
---|
| 110 | throw Csiscone_error(message.str());
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | ptcomparison.split_merge_scale = _split_merge_scale;
|
---|
| 116 | partial_clear(); // make sure some things are initialised properly
|
---|
| 117 |
|
---|
| 118 | // init the split_merge algorithm with the initial list of particles
|
---|
| 119 | // this initialises particle list p_left of remaining particles to deal with
|
---|
| 120 | init_particles(_particles);
|
---|
| 121 |
|
---|
| 122 | bool finished = false;
|
---|
| 123 |
|
---|
| 124 | rerun_allowed = false;
|
---|
| 125 | protocones_list.clear();
|
---|
| 126 |
|
---|
| 127 | do{
|
---|
| 128 | // initialise stable_cone finder
|
---|
| 129 | // here we use the list of remaining particles
|
---|
| 130 | // AFTER COLLINEAR CLUSTERING !!!!!!
|
---|
| 131 | Cstable_cones::init(p_uncol_hard);
|
---|
| 132 |
|
---|
| 133 | // get stable cones
|
---|
| 134 | if (get_stable_cones(_radius)){
|
---|
| 135 | // we have some new protocones.
|
---|
| 136 | // add them to candidates
|
---|
| 137 | protocones_list.push_back(protocones);
|
---|
| 138 | add_protocones(&protocones, R2, _ptmin);
|
---|
| 139 | } else {
|
---|
| 140 | // no new protocone: leave
|
---|
| 141 | finished=true;
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | _n_pass_max--;
|
---|
| 145 | } while ((!finished) && (n_left>0) && (_n_pass_max!=0));
|
---|
| 146 |
|
---|
| 147 | rerun_allowed = true;
|
---|
| 148 |
|
---|
| 149 | // split & merge
|
---|
| 150 | return perform(_f, _ptmin);
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | /*
|
---|
| 154 | * recompute the jets with a different overlap parameter.
|
---|
| 155 | * we use the same particles and R as in the preceeding call.
|
---|
| 156 | * - _f shared energy threshold for splitting&merging
|
---|
| 157 | * - _ptmin minimum pT of the protojets
|
---|
| 158 | * - _split_merge_scale the scale choice for the split-merge procedure
|
---|
| 159 | * NOTE: using pt leads to IR unsafety for some events with momentum
|
---|
| 160 | * conservation. So we strongly advise not to change the default
|
---|
| 161 | * value.
|
---|
| 162 | * return the number of jets found, -1 if recomputation not allowed.
|
---|
| 163 | ********************************************************************/
|
---|
| 164 | int Csiscone::recompute_jets(double _f, double _ptmin,
|
---|
| 165 | Esplit_merge_scale _split_merge_scale){
|
---|
| 166 | if (!rerun_allowed)
|
---|
| 167 | return -1;
|
---|
| 168 |
|
---|
| 169 | ptcomparison.split_merge_scale = _split_merge_scale;
|
---|
| 170 |
|
---|
| 171 | // restore particle list
|
---|
| 172 | partial_clear();
|
---|
| 173 | init_pleft();
|
---|
| 174 |
|
---|
| 175 | // initialise split/merge algorithm
|
---|
| 176 | unsigned int i;
|
---|
| 177 | for (i=0;i<protocones_list.size();i++)
|
---|
| 178 | add_protocones(&(protocones_list[i]), R2, _ptmin);
|
---|
| 179 |
|
---|
| 180 | // split & merge
|
---|
| 181 | return perform(_f, _ptmin);
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | // finally, a bunch of functions to access to
|
---|
| 186 | // basic information (package name, version)
|
---|
| 187 | //---------------------------------------------
|
---|
| 188 |
|
---|
| 189 | /*
|
---|
| 190 | * return SISCone package name.
|
---|
| 191 | * This is nothing but "SISCone", it is a replacement to the
|
---|
| 192 | * PACKAGE_NAME string defined in config.h and which is not
|
---|
| 193 | * public by default.
|
---|
| 194 | * return the SISCone name as a string
|
---|
| 195 | */
|
---|
| 196 | string siscone_package_name(){
|
---|
| 197 | return VERSION;
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | /*
|
---|
| 201 | * return SISCone version number.
|
---|
| 202 | * return a string of the form "X.Y.Z" with possible additional tag
|
---|
| 203 | * (alpha, beta, devel) to mention stability status
|
---|
| 204 | */
|
---|
| 205 | string siscone_version(){
|
---|
| 206 | return VERSION;
|
---|
| 207 | }
|
---|
| 208 |
|
---|
| 209 | }
|
---|