|
FastJet 3.0alpha3
|
00001 //STARTHEADER 00002 // $Id: FunctionOfPseudoJet.cc 2192 2011-06-01 07:45:05Z soyez $ 00003 // 00004 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin Salam and Gregory Soyez 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 #include <fastjet/FunctionOfPseudoJet.hh> 00032 #include <string> 00033 #include <sstream> 00034 00035 using namespace std; 00036 00037 FASTJET_BEGIN_NAMESPACE 00038 00039 //---------------------------------------------------------------------- 00040 /// helper for the selector "FunctionOfPJ(jet) > ref" 00041 class SW_FofPJ_larger : public SelectorWorker { 00042 public: 00043 /// ctor with specification of the number of objects to keep 00044 SW_FofPJ_larger(const FunctionOfPseudoJet<double> & fn, const double &ref) 00045 : _fn(fn), _ref(ref){} 00046 00047 /// return true if the jet is a pure-ghost jet 00048 virtual bool pass(const PseudoJet & jet) const { return _fn(jet) > _ref; } 00049 00050 /// returns a description of the worker 00051 virtual string description() const { 00052 ostringstream oss; 00053 oss << "(" << _fn.description() << " > " << _ref << ")"; 00054 return oss.str(); 00055 } 00056 00057 protected: 00058 const FunctionOfPseudoJet<double> & _fn; 00059 double _ref; 00060 }; 00061 00062 00063 // select objects that are (or are only made of) ghosts 00064 Selector operator >(const FunctionOfPseudoJet<double> & fn, const double & ref){ 00065 return Selector(new SW_FofPJ_larger(fn, ref)); 00066 } 00067 00068 00069 00070 //---------------------------------------------------------------------- 00071 /// helper for the selector "FunctionOfPJ(jet) < ref" 00072 class SW_FofPJ_smaller : public SelectorWorker { 00073 public: 00074 /// ctor with specification of the number of objects to keep 00075 SW_FofPJ_smaller(const FunctionOfPseudoJet<double> & fn, const double &ref) 00076 : _fn(fn), _ref(ref){} 00077 00078 /// return true if the jet is a pure-ghost jet 00079 virtual bool pass(const PseudoJet & jet) const { return _fn(jet) < _ref; } 00080 00081 /// returns a description of the worker 00082 virtual string description() const { 00083 ostringstream oss; 00084 oss << "(" << _fn.description() << " < " << _ref << ")"; 00085 return oss.str(); 00086 } 00087 00088 protected: 00089 const FunctionOfPseudoJet<double> & _fn; 00090 double _ref; 00091 }; 00092 00093 00094 // select objects that are (or are only made of) ghosts 00095 Selector operator <(const FunctionOfPseudoJet<double> & fn, const double & ref){ 00096 return Selector(new SW_FofPJ_smaller(fn, ref)); 00097 } 00098 00099 00100 //---------------------------------------------------------------------- 00101 /// helper for the selector "FunctionOfPJ(jet) >= ref" 00102 class SW_FofPJ_larger_equal : public SelectorWorker { 00103 public: 00104 /// ctor with specification of the number of objects to keep 00105 SW_FofPJ_larger_equal(const FunctionOfPseudoJet<double> & fn, const double &ref) 00106 : _fn(fn), _ref(ref){} 00107 00108 /// return true if the jet is a pure-ghost jet 00109 virtual bool pass(const PseudoJet & jet) const { return _fn(jet) >= _ref; } 00110 00111 /// returns a description of the worker 00112 virtual string description() const { 00113 ostringstream oss; 00114 oss << "(" << _fn.description() << " >= " << _ref << ")"; 00115 return oss.str(); 00116 } 00117 00118 protected: 00119 const FunctionOfPseudoJet<double> & _fn; 00120 double _ref; 00121 }; 00122 00123 00124 // select objects that are (or are only made of) ghosts 00125 Selector operator >=(const FunctionOfPseudoJet<double> & fn, const double & ref){ 00126 return Selector(new SW_FofPJ_larger_equal(fn, ref)); 00127 } 00128 00129 00130 00131 //---------------------------------------------------------------------- 00132 /// helper for the selector "FunctionOfPJ(jet) <= ref" 00133 class SW_FofPJ_smaller_equal : public SelectorWorker { 00134 public: 00135 /// ctor with specification of the number of objects to keep 00136 SW_FofPJ_smaller_equal(const FunctionOfPseudoJet<double> & fn, const double &ref) 00137 : _fn(fn), _ref(ref){} 00138 00139 /// return true if the jet is a pure-ghost jet 00140 virtual bool pass(const PseudoJet & jet) const { return _fn(jet) <= _ref; } 00141 00142 /// returns a description of the worker 00143 virtual string description() const { 00144 ostringstream oss; 00145 oss << "(" << _fn.description() << " <= " << _ref << ")"; 00146 return oss.str(); 00147 } 00148 00149 protected: 00150 const FunctionOfPseudoJet<double> & _fn; 00151 double _ref; 00152 }; 00153 00154 00155 // select objects that are (or are only made of) ghosts 00156 Selector operator <=(const FunctionOfPseudoJet<double> & fn, const double & ref){ 00157 return Selector(new SW_FofPJ_smaller_equal(fn, ref)); 00158 } 00159 00160 00161 FASTJET_END_NAMESPACE
1.7.4