Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:17

0001 #ifndef __FASTJET_FUNCTION_OF_PSEUDOJET_HH__
0002 #define __FASTJET_FUNCTION_OF_PSEUDOJET_HH__
0003 
0004 //FJSTARTHEADER
0005 // $Id$
0006 //
0007 // Copyright (c) 2005-2021, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
0008 //
0009 //----------------------------------------------------------------------
0010 // This file is part of FastJet.
0011 //
0012 //  FastJet is free software; you can redistribute it and/or modify
0013 //  it under the terms of the GNU General Public License as published by
0014 //  the Free Software Foundation; either version 2 of the License, or
0015 //  (at your option) any later version.
0016 //
0017 //  The algorithms that underlie FastJet have required considerable
0018 //  development. They are described in the original FastJet paper,
0019 //  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
0020 //  FastJet as part of work towards a scientific publication, please
0021 //  quote the version you use and include a citation to the manual and
0022 //  optionally also to hep-ph/0512210.
0023 //
0024 //  FastJet is distributed in the hope that it will be useful,
0025 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0027 //  GNU General Public License for more details.
0028 //
0029 //  You should have received a copy of the GNU General Public License
0030 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
0031 //----------------------------------------------------------------------
0032 //FJENDHEADER
0033 
0034 #include "fastjet/PseudoJet.hh"
0035 #include "fastjet/Selector.hh"
0036 
0037 FASTJET_BEGIN_NAMESPACE
0038 
0039 /// \class FunctionOfPseudoJet
0040 /// base class providing interface for a generic function of a PseudoJet
0041 ///
0042 /// This class serves as a base class to provide a standard interface
0043 /// for a function that returns an object of a given (templated) type
0044 /// that depends on a PseudoJet argument. The rationale for using a
0045 /// class (rather than a pointer to a function) is that a class can be
0046 /// constructed with (and store) additional arguments.
0047 template<typename TOut>
0048 class FunctionOfPseudoJet{
0049 public:
0050   /// default ctor
0051   FunctionOfPseudoJet(){}
0052 
0053   // ctor that creates a constant function
0054   //----------
0055   // this declaration was present in versions of FJ from 3.0.0 to 3.0.6,
0056   // but never implemented. It is being removed from 3.0.7 upwards
0057   // to avoid misleading users
0058   //FunctionOfPseudoJet(const TOut &constant_value);
0059 
0060   /// default dtor (virtual to allow safe polymorphism)
0061   virtual ~FunctionOfPseudoJet(){}
0062 
0063   /// returns a description of the function (an empty string by
0064   /// default)
0065   virtual std::string description() const{ return "";}
0066 
0067   /// the action of the function
0068   /// this _has_ to be overloaded in derived classes
0069   ///  \param pj   the PseudoJet input to the function
0070   virtual TOut result(const PseudoJet &pj) const = 0;
0071 
0072   /// apply the function using the "traditional" () operator.
0073   /// By default, this just calls the apply(...) method above.
0074   ///  \param pj   the PseudoJet input to the function
0075   TOut operator()(const PseudoJet &pj) const { return result(pj);}
0076 
0077   /// apply the function on a vector of PseudoJet, returning a vector
0078   /// of the results.
0079   /// This just calls apply on every PseudoJet in the vector.
0080   ///  \param pjs  the vector of PseudoJet inputs to the function
0081   std::vector<TOut> operator()(const std::vector<PseudoJet> &pjs) const {
0082     std::vector<TOut> res(pjs.size());
0083     for (unsigned int i=0; i<pjs.size(); i++)
0084       res[i] = result(pjs[i]);
0085     return res;
0086   }
0087 };
0088 
0089 // The following functions will not be for FJ3.0, because passing a
0090 // reference does not work when the argument is a temporary, which can
0091 // lead to hard-to-diagnose run-time errors. A workaround is to to
0092 // have a pointer rather than a reference as argument, since this
0093 // provides a clearer signal to the user that the object must remain
0094 // in scope.
0095 //
0096 //
0097 // // Selectors created from the ordering between a FunctionOfPseudoJet
0098 // // and a constant
0099 // //----------------------------------------------------------------------
0100 // 
0101 // /// 'larger than' operator
0102 // ///
0103 // /// Select jets for which the given function returns a result larger
0104 // /// than the specified constant
0105 // Selector operator >(const FunctionOfPseudoJet<double> & fn, const double & cut);
0106 // 
0107 // /// 'smaller than' operator
0108 // ///
0109 // /// Select jets for which the given function returns a result smaller
0110 // /// than the specified constant
0111 // Selector operator <(const FunctionOfPseudoJet<double> & fn, const double & cut);
0112 // 
0113 // /// 'larger or equal' operator
0114 // ///
0115 // /// Select jets for which the given function returns a result larger or equal 
0116 // /// to the specified constant
0117 // Selector operator >=(const FunctionOfPseudoJet<double> & fn, const double & cut);
0118 // 
0119 // /// 'smaller or equal' operator
0120 // ///
0121 // /// Select jets for which the given function returns a result smaller or equal
0122 // /// to the specified constant
0123 // Selector operator <=(const FunctionOfPseudoJet<double> & fn, const double & cut);
0124 
0125 
0126 FASTJET_END_NAMESPACE
0127 
0128 #endif  // __FASTJET_FUNCTION_OF_PSEUDOJET_HH__