fastjet 2.4.5
|
00001 //STARTHEADER 00002 // $Id: JetDefinition.hh 1674 2010-02-12 14:26:51Z salam $ 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 #ifndef __FASTJET_JETDEFINITION_HH__ 00032 #define __FASTJET_JETDEFINITION_HH__ 00033 00034 #include<cassert> 00035 #include "fastjet/internal/numconsts.hh" 00036 #include "fastjet/PseudoJet.hh" 00037 #include<string> 00038 #include<memory> 00039 00040 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00041 00043 // NB: (implemented in ClusterSequence.cc but defined here because 00044 // this is a visible location) 00045 std::string fastjet_version_string(); 00046 00047 //====================================================================== 00050 enum Strategy { 00052 N2MinHeapTiled = -4, 00054 N2Tiled = -3, 00056 N2PoorTiled = -2, 00058 N2Plain = -1, 00060 N3Dumb = 0, 00062 Best = 1, 00064 NlnN = 2, 00066 NlnN3pi = 3, 00068 NlnN4pi = 4, 00071 NlnNCam4pi = 14, 00072 NlnNCam2pi2R = 13, 00073 NlnNCam = 12, // 2piMultD 00075 plugin_strategy = 999 00076 }; 00077 00078 00079 //====================================================================== 00081 enum JetAlgorithm { 00083 kt_algorithm=0, 00086 cambridge_algorithm=1, 00090 antikt_algorithm=2, 00095 genkt_algorithm=3, 00098 cambridge_for_passive_algorithm=11, 00101 genkt_for_passive_algorithm=13, 00102 //................................................................. 00104 ee_kt_algorithm=50, 00106 ee_genkt_algorithm=53, 00107 //................................................................. 00109 plugin_algorithm = 99 00110 }; 00111 00114 typedef JetAlgorithm JetFinder; 00115 00117 const JetAlgorithm aachen_algorithm = cambridge_algorithm; 00118 const JetAlgorithm cambridge_aachen_algorithm = cambridge_algorithm; 00119 00120 //====================================================================== 00122 enum RecombinationScheme { 00124 E_scheme=0, 00127 pt_scheme=1, 00130 pt2_scheme=2, 00133 Et_scheme=3, 00136 Et2_scheme=4, 00139 BIpt_scheme=5, 00142 BIpt2_scheme=6, 00144 external_scheme = 99 00145 }; 00146 00147 00148 00149 00150 // forward declaration, needed in order to specify interface for the 00151 // plugin. 00152 class ClusterSequence; 00153 00154 00155 00156 00157 //====================================================================== 00160 class JetDefinition { 00161 00162 public: 00163 00166 class Plugin; 00167 00168 // forward declaration of a class that will provide the 00169 // recombination scheme facilities and/or allow a user to 00170 // extend these facilities 00171 class Recombiner; 00172 00173 00174 00178 JetDefinition(JetAlgorithm jet_algorithm, 00179 double R, 00180 RecombinationScheme recomb_scheme = E_scheme, 00181 Strategy strategy = Best) { 00182 *this = JetDefinition(jet_algorithm, R, strategy, recomb_scheme, 1); 00183 } 00184 00187 JetDefinition(JetAlgorithm jet_algorithm, 00188 RecombinationScheme recomb_scheme = E_scheme, 00189 Strategy strategy = Best) { 00190 double dummyR = 0.0; 00191 *this = JetDefinition(jet_algorithm, dummyR, strategy, recomb_scheme, 0); 00192 } 00193 00196 JetDefinition(JetAlgorithm jet_algorithm, 00197 double R, 00198 double xtra_param, 00199 RecombinationScheme recomb_scheme = E_scheme, 00200 Strategy strategy = Best) { 00201 *this = JetDefinition(jet_algorithm, R, strategy, recomb_scheme, 2); 00202 set_extra_param(xtra_param); 00203 } 00204 00205 00209 JetDefinition(JetAlgorithm jet_algorithm, 00210 double R, 00211 const Recombiner * recombiner, 00212 Strategy strategy = Best) { 00213 *this = JetDefinition(jet_algorithm, R, external_scheme, strategy); 00214 _recombiner = recombiner; 00215 } 00216 00217 00220 JetDefinition(JetAlgorithm jet_algorithm, 00221 const Recombiner * recombiner, 00222 Strategy strategy = Best) { 00223 *this = JetDefinition(jet_algorithm, external_scheme, strategy); 00224 _recombiner = recombiner; 00225 } 00226 00229 JetDefinition(JetAlgorithm jet_algorithm, 00230 double R, 00231 double xtra_param, 00232 const Recombiner * recombiner, 00233 Strategy strategy = Best) { 00234 *this = JetDefinition(jet_algorithm, R, external_scheme, strategy); 00235 _recombiner = recombiner; 00236 set_extra_param(xtra_param); 00237 } 00238 00240 JetDefinition() { 00241 *this = JetDefinition(kt_algorithm, 1.0); 00242 } 00243 00247 JetDefinition(const Plugin * plugin) { 00248 _plugin = plugin; 00249 _strategy = plugin_strategy; 00250 _Rparam = _plugin->R(); 00251 _jet_algorithm = plugin_algorithm; 00252 set_recombination_scheme(E_scheme); 00253 } 00254 00255 00261 JetDefinition(JetAlgorithm jet_algorithm, 00262 double R, 00263 Strategy strategy, 00264 RecombinationScheme recomb_scheme = E_scheme, 00265 int nparameters = 1); 00266 // : 00267 // _jet_algorithm(jet_algorithm), _Rparam(R), _strategy(strategy) { 00268 // // the largest sensible value for R 00269 // if (jet_algorithm != ee_kt_algorithm && 00270 // jet_algorithm != ee_genkt_algorithm) assert(_Rparam <= 0.5*pi); 00271 // assert(_jet_algorithm != plugin_algorithm && 00272 // _strategy != plugin_strategy); 00273 // _plugin = NULL; 00274 // set_recombination_scheme(recomb_scheme); 00275 // set_extra_param(0.0); // make sure it's defined 00276 // } 00277 00278 00280 void set_recombination_scheme(RecombinationScheme); 00281 00283 void set_recombiner(const Recombiner * recomb) { 00284 _recombiner = recomb; 00285 _default_recombiner = DefaultRecombiner(external_scheme); 00286 } 00287 00289 const Plugin * plugin() const {return _plugin;}; 00290 00292 JetAlgorithm jet_algorithm () const {return _jet_algorithm ;} 00294 JetAlgorithm jet_finder () const {return _jet_algorithm ;} 00295 double R () const {return _Rparam ;} 00296 // a general purpose extra parameter, whose meaning depends on 00297 // the algorithm, and may often be unused. 00298 double extra_param () const {return _extra_param ;} 00299 Strategy strategy () const {return _strategy ;} 00300 RecombinationScheme recombination_scheme() const { 00301 return _default_recombiner.scheme();} 00302 00304 void set_jet_algorithm(JetAlgorithm njf) {_jet_algorithm = njf;} 00306 void set_jet_finder(JetAlgorithm njf) {_jet_algorithm = njf;} 00308 void set_extra_param(double xtra_param) {_extra_param = xtra_param;} 00309 00312 const Recombiner * recombiner() const { 00313 return _recombiner == 0 ? & _default_recombiner : _recombiner;} 00314 00316 std::string description() const; 00317 00318 00319 public: 00320 //====================================================================== 00323 class Recombiner { 00324 public: 00327 virtual std::string description() const = 0; 00328 00330 virtual void recombine(const PseudoJet & pa, const PseudoJet & pb, 00331 PseudoJet & pab) const = 0; 00332 00335 virtual void preprocess(PseudoJet & ) const {}; 00336 00338 virtual ~Recombiner() {}; 00339 00342 inline void plus_equal(PseudoJet & pa, const PseudoJet & pb) const { 00343 // put result in a temporary location in case the recombiner 00344 // does something funny (ours doesn't, but who knows about the 00345 // user's) 00346 PseudoJet pres; 00347 recombine(pa,pb,pres); 00348 pa = pres; 00349 } 00350 00351 }; 00352 00353 00354 //====================================================================== 00357 class DefaultRecombiner : public Recombiner { 00358 public: 00359 DefaultRecombiner(RecombinationScheme recomb_scheme = E_scheme) : 00360 _recomb_scheme(recomb_scheme) {} 00361 00362 virtual std::string description() const; 00363 00365 virtual void recombine(const PseudoJet & pa, const PseudoJet & pb, 00366 PseudoJet & pab) const; 00367 00368 virtual void preprocess(PseudoJet & p) const; 00369 00371 RecombinationScheme scheme() const {return _recomb_scheme;} 00372 00373 private: 00374 RecombinationScheme _recomb_scheme; 00375 }; 00376 00377 00378 //====================================================================== 00381 class Plugin{ 00382 public: 00385 virtual std::string description() const = 0; 00386 00393 virtual void run_clustering(ClusterSequence &) const = 0; 00394 00395 virtual double R() const = 0; 00396 00401 virtual bool supports_ghosted_passive_areas() const {return false;} 00402 00406 virtual void set_ghost_separation_scale(double scale) const; 00407 virtual double ghost_separation_scale() const {return 0.0;} 00408 00412 virtual bool exclusive_sequence_meaningful() const {return false;} 00413 00415 virtual ~Plugin() {}; 00416 }; 00417 00418 private: 00419 00420 00421 JetAlgorithm _jet_algorithm; 00422 double _Rparam; 00423 double _extra_param ; 00424 Strategy _strategy ; 00425 00426 const Plugin * _plugin; 00427 00428 // when we use our own recombiner it's useful to point to it here 00429 // so that we don't have to worry about deleting it etc... 00430 DefaultRecombiner _default_recombiner; 00431 const Recombiner * _recombiner; 00432 00433 }; 00434 00435 00436 00437 00438 00439 00440 FASTJET_END_NAMESPACE 00441 00442 #endif // __FASTJET_JETDEFINITION_HH__