Fork me on GitHub

source: git/external/fastjet/FunctionOfPseudoJet.hh@ c2d6ea2

ImprovedOutputFile Timing dual_readout llp
Last change on this file since c2d6ea2 was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 4.6 KB
Line 
1#ifndef __FASTJET_FUNCTION_OF_PSEUDOJET_HH__
2#define __FASTJET_FUNCTION_OF_PSEUDOJET_HH__
3
4//STARTHEADER
5// $Id: FunctionOfPseudoJet.hh 2577 2011-09-13 15:11:38Z salam $
6//
7// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
8//
9//----------------------------------------------------------------------
10// This file is part of FastJet.
11//
12// FastJet is free software; you can redistribute it and/or modify
13// it under the terms of the GNU General Public License as published by
14// the Free Software Foundation; either version 2 of the License, or
15// (at your option) any later version.
16//
17// The algorithms that underlie FastJet have required considerable
18// development and are described in hep-ph/0512210. If you use
19// FastJet as part of work towards a scientific publication, please
20// include a citation to the FastJet paper.
21//
22// FastJet is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
29//----------------------------------------------------------------------
30//ENDHEADER
31
32#include <fastjet/PseudoJet.hh>
33#include <fastjet/Selector.hh>
34
35FASTJET_BEGIN_NAMESPACE
36
37/// \class FunctionOfPseudoJet
38/// base class providing interface for a generic function of a PseudoJet
39///
40/// This class serves as a base class to provide a standard interface
41/// for a function that returns an object of a given (templated) type
42/// that depends on a PseudoJet argument. The rationale for using a
43/// class (rather than a pointer to a function) is that a class can be
44/// constructed with (and store) additional arguments.
45template<typename TOut>
46class FunctionOfPseudoJet{
47public:
48 /// default ctor
49 FunctionOfPseudoJet(){}
50
51 /// ctor that creates a constant function
52 FunctionOfPseudoJet(const TOut &constant_value);
53
54 /// default dtor (virtual to allow safe polymorphism)
55 virtual ~FunctionOfPseudoJet(){}
56
57 /// returns a description of the function (an empty string by
58 /// default)
59 virtual std::string description() const{ return "";}
60
61 /// the action of the function
62 /// this _has_ to be overloaded in derived classes
63 /// \param pj the PseudoJet input to the function
64 virtual TOut result(const PseudoJet &pj) const = 0;
65
66 /// apply the function using the "traditional" () operator.
67 /// By default, this just calls the apply(...) method above.
68 /// \param pj the PseudoJet input to the function
69 TOut operator()(const PseudoJet &pj) const { return result(pj);}
70
71 /// apply the function on a vector of PseudoJet, returning a vector
72 /// of the results.
73 /// This just calls apply on every PseudoJet in the vector.
74 /// \param pjs the vector of PseudoJet inputs to the function
75 std::vector<TOut> operator()(const std::vector<PseudoJet> &pjs) const {
76 std::vector<TOut> res(pjs.size());
77 for (unsigned int i=0; i<pjs.size(); i++)
78 res[i] = result(pjs[i]);
79 return res;
80 }
81};
82
83// The following functions will not be for FJ3.0, because passing a
84// reference does not work when the argument is a temporary, which can
85// lead to hard-to-diagnose run-time errors. A workaround is to to
86// have a pointer rather than a reference as argument, since this
87// provides a clearer signal to the user that the object must remain
88// in scope.
89//
90//
91// // Selectors created from the ordering between a FunctionOfPseudoJet
92// // and a constant
93// //----------------------------------------------------------------------
94//
95// /// 'larger than' operator
96// ///
97// /// Select jets for which the given function returns a result larger
98// /// than the specified constant
99// Selector operator >(const FunctionOfPseudoJet<double> & fn, const double & cut);
100//
101// /// 'smaller than' operator
102// ///
103// /// Select jets for which the given function returns a result smaller
104// /// than the specified constant
105// Selector operator <(const FunctionOfPseudoJet<double> & fn, const double & cut);
106//
107// /// 'larger or equal' operator
108// ///
109// /// Select jets for which the given function returns a result larger or equal
110// /// to the specified constant
111// Selector operator >=(const FunctionOfPseudoJet<double> & fn, const double & cut);
112//
113// /// 'smaller or equal' operator
114// ///
115// /// Select jets for which the given function returns a result smaller or equal
116// /// to the specified constant
117// Selector operator <=(const FunctionOfPseudoJet<double> & fn, const double & cut);
118
119
120FASTJET_END_NAMESPACE
121
122#endif // __FASTJET_FUNCTION_OF_PSEUDOJET_HH__
Note: See TracBrowser for help on using the repository browser.