|
FastJet 3.0alpha3
|
00001 #ifndef __FASTJET_FUNCTION_OF_PSEUDOJET_HH__ 00002 #define __FASTJET_FUNCTION_OF_PSEUDOJET_HH__ 00003 00004 //STARTHEADER 00005 // $Id: FunctionOfPseudoJet.hh 2213 2011-06-02 21:05:47Z salam $ 00006 // 00007 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin Salam and Gregory Soyez 00008 // 00009 //---------------------------------------------------------------------- 00010 // This file is part of FastJet. 00011 // 00012 // FastJet is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU General Public License as published by 00014 // the Free Software Foundation; either version 2 of the License, or 00015 // (at your option) any later version. 00016 // 00017 // The algorithms that underlie FastJet have required considerable 00018 // development and are described in hep-ph/0512210. If you use 00019 // FastJet as part of work towards a scientific publication, please 00020 // include a citation to the FastJet paper. 00021 // 00022 // FastJet is distributed in the hope that it will be useful, 00023 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 // GNU General Public License for more details. 00026 // 00027 // You should have received a copy of the GNU General Public License 00028 // along with FastJet; if not, write to the Free Software 00029 // Foundation, Inc.: 00030 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00031 //---------------------------------------------------------------------- 00032 //ENDHEADER 00033 00034 #include <fastjet/PseudoJet.hh> 00035 #include <fastjet/Selector.hh> 00036 00037 FASTJET_BEGIN_NAMESPACE 00038 00039 /// \class FunctionOfPseudoJet 00040 /// base class providing interface for a generic function of a PseudoJet 00041 /// 00042 /// This class serves as a base class to provide a standard interface 00043 /// for a function that returns an object of a given (templated) type 00044 /// that depends on a PseudoJet argument. The rationale for using a 00045 /// class (rather than a pointer to a function) is that a class can be 00046 /// constructed with (and store) additional arguments. 00047 template<typename TOut> 00048 class FunctionOfPseudoJet{ 00049 public: 00050 /// default ctor 00051 FunctionOfPseudoJet(){} 00052 00053 /// ctor that creates a constant function 00054 FunctionOfPseudoJet(const TOut &constant_value); 00055 00056 /// default dtor (virtual to allow safe polymorphism) 00057 virtual ~FunctionOfPseudoJet(){} 00058 00059 /// returns a description of the function (an empty string by 00060 /// default) 00061 virtual std::string description() const{ return "";} 00062 00063 /// the action of the function 00064 /// this _has_ to be overloaded in derived classes 00065 /// \param pj the PseudoJet input to the function 00066 virtual TOut result(const PseudoJet &pj) const = 0; 00067 00068 /// apply the function using the "traditional" () operator. 00069 /// By default, this just calls the apply(...) method above. 00070 /// \param pj the PseudoJet input to the function 00071 TOut operator()(const PseudoJet &pj) const { return result(pj);} 00072 00073 /// apply the function on a vector of PseudoJet, returning a vector 00074 /// of the results. 00075 /// This just calls apply on every PseudoJet in the vector. 00076 /// \param pjs the vector of PseudoJet inputs to the function 00077 std::vector<TOut> operator()(const std::vector<PseudoJet> &pjs) const { 00078 std::vector<TOut> res(pjs.size()); 00079 for (unsigned int i=0; i<pjs.size(); i++) 00080 res[i] = result(pjs[i]); 00081 return res; 00082 } 00083 }; 00084 00085 00086 // Selectors created from the ordering between a FunctionOfPseudoJet 00087 // and a constant 00088 //---------------------------------------------------------------------- 00089 00090 /// 'larger than' operator 00091 /// 00092 /// Select jets for which the given function returns a reult larger 00093 /// than the specified constant 00094 Selector operator >(const FunctionOfPseudoJet<double> & fn, const double & cut); 00095 00096 /// 'smaller than' operator 00097 /// 00098 /// Select jets for which the given function returns a reult larger 00099 /// than the specified constant 00100 Selector operator <(const FunctionOfPseudoJet<double> & fn, const double & cut); 00101 00102 /// 'larger or equal' operator 00103 /// 00104 /// Select jets for which the given function returns a reult larger 00105 /// than the specified constant 00106 Selector operator >=(const FunctionOfPseudoJet<double> & fn, const double & cut); 00107 00108 /// 'smaller or equal' operator 00109 /// 00110 /// Select jets for which the given function returns a reult larger 00111 /// than the specified constant 00112 Selector operator <=(const FunctionOfPseudoJet<double> & fn, const double & cut); 00113 00114 00115 FASTJET_END_NAMESPACE 00116 00117 #endif // __FASTJET_FUNCTION_OF_PSEUDOJET_HH__
1.7.4