FastJet  3.0.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Subtractor.hh
1 //STARTHEADER
2 // $Id: Subtractor.hh 2577 2011-09-13 15:11:38Z salam $
3 //
4 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
5 //
6 //----------------------------------------------------------------------
7 // This file is part of FastJet.
8 //
9 // FastJet is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU General Public License as published by
11 // the Free Software Foundation; either version 2 of the License, or
12 // (at your option) any later version.
13 //
14 // The algorithms that underlie FastJet have required considerable
15 // development and are described in hep-ph/0512210. If you use
16 // FastJet as part of work towards a scientific publication, please
17 // include a citation to the FastJet paper.
18 //
19 // FastJet is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with FastJet. If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------
27 //ENDHEADER
28 
29 #ifndef __FASTJET_TOOLS_SUBTRACTOR_HH__
30 #define __FASTJET_TOOLS_SUBTRACTOR_HH__
31 
32 #include "fastjet/tools/Transformer.hh" // to derive Subtractor from Transformer
33 #include "fastjet/tools/BackgroundEstimatorBase.hh" // used as a ctor argument
34 
35 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
36 
37 
38 //----------------------------------------------------------------------
39 /// @ingroup tools_background
40 /// \class Subtractor
41 /// Class that helps perform jet background subtraction.
42 ///
43 /// This class derives from Transformer and makes use of a pointer to
44 /// a BackgroundEstimatorBase object in order to determine the background
45 /// in the vicinity of a given jet and then subtract area*background from
46 /// the jet. It can also be initialised with a specific fixed value for the
47 /// background pt density.
48 ///
49 /// \section input Input conditions
50 ///
51 /// The original jet must have area support (4-vector)
52 ///
53 /// \section output Output/interface
54 ///
55 /// The underlying structure of the returned, subtracted jet
56 /// (i.e. constituents, pieces, etc.) is identical to that of the
57 /// original jet.
58 ///
59 class Subtractor : public Transformer{
60 public:
61  /// define a subtractor based on a BackgroundEstimator
62  Subtractor(BackgroundEstimatorBase * bge) :
63  _bge(bge), _rho(-1.0) {}
64 
65  /// define a subtractor that uses a fixed value of rho, the background
66  /// pt density per unit area (which must be positive)
67  Subtractor(double rho);
68 
69  /// default constructor
71 
72  /// default dtor
73  virtual ~Subtractor(){};
74 
75  /// returns a jet that's subtracted
76  ///
77  /// \param jet the jet that is to be subtracted
78  /// \return the subtracted jet
79  virtual PseudoJet result(const PseudoJet & jet) const;
80 
81  /// class description
82  virtual std::string description() const;
83 
84 protected:
85 
86  /// the tool used to estimate the background
87  /// if has to be mutable in case its underlying selector takes a reference jet
88  mutable BackgroundEstimatorBase * _bge;
89  /// the fixed value of rho to use if the user has selected that option
90  double _rho;
91 
92  /// a value of rho that is used as a default to label that the stored
93  /// rho is not valid for subtraction.
94  //
95  // NB: there are two reasons for not having the value written here:
96  // 1) that it caused problems on karnak with g++ 4.0.1 and 2) that
97  // we anyway like -infinity as a default, and since that's a function,
98  // that's not allowed in an include file.
99  static const double _invalid_rho;
100 };
101 
102 FASTJET_END_NAMESPACE
103 
104 #endif // __FASTJET_TOOLS_SUBTRACTOR_HH__
105