Fork me on GitHub

source: git/external/fastjet/tools/Subtractor.hh@ be2222c

ImprovedOutputFile Timing dual_readout llp
Last change on this file since be2222c was 35cdc46, checked in by Pavel Demin <demin@…>, 10 years ago

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

  • Property mode set to 100644
File size: 8.0 KB
Line 
1//FJSTARTHEADER
2// $Id: Subtractor.hh 3584 2014-08-12 12:40:10Z soyez $
3//
4// Copyright (c) 2005-2014, 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. They are described in the original FastJet paper,
16// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17// FastJet as part of work towards a scientific publication, please
18// quote the version you use and include a citation to the manual and
19// optionally also to hep-ph/0512210.
20//
21// FastJet is distributed in the hope that it will be useful,
22// but WITHOUT ANY WARRANTY; without even the implied warranty of
23// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24// GNU General Public License for more details.
25//
26// You should have received a copy of the GNU General Public License
27// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28//----------------------------------------------------------------------
29//FJENDHEADER
30
31#ifndef __FASTJET_TOOLS_SUBTRACTOR_HH__
32#define __FASTJET_TOOLS_SUBTRACTOR_HH__
33
34#include "fastjet/tools/Transformer.hh" // to derive Subtractor from Transformer
35#include "fastjet/tools/BackgroundEstimatorBase.hh" // used as a ctor argument
36
37FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
38
39
40//----------------------------------------------------------------------
41/// @ingroup tools_background
42/// \class Subtractor
43/// Class that helps perform jet background subtraction.
44///
45/// This class derives from Transformer and makes use of a pointer to
46/// a BackgroundEstimatorBase object in order to determine the background
47/// in the vicinity of a given jet and then subtract area*background from
48/// the jet. It can also be initialised with a specific fixed value for the
49/// background pt density.
50///
51/// \section input Input conditions
52///
53/// The original jet must have area support (4-vector)
54///
55/// \section output Output/interface
56///
57/// The underlying structure of the returned, subtracted jet
58/// (i.e. constituents, pieces, etc.) is identical to that of the
59/// original jet.
60///
61class Subtractor : public Transformer{
62public:
63 /// define a subtractor based on a BackgroundEstimator
64 Subtractor(BackgroundEstimatorBase * bge) :
65 _bge(bge), _rho(-1.0) { set_defaults(); }
66
67 /// define a subtractor that uses a fixed value of rho, the background
68 /// pt density per unit area (which must be positive)
69 Subtractor(double rho);
70
71 /// default constructor
72 Subtractor() : _bge(0), _rho(_invalid_rho) { set_defaults(); }
73
74 /// default dtor
75 virtual ~Subtractor(){};
76
77 /// @name configuring the behaviour
78 //\{
79 //----------------------------------------------------------------
80
81 /// reset all parameters to default values
82 ///
83 /// Note: by default, the rho_m term is not included and the safety
84 /// test for the mass is not done. This is mostly for backwards
85 /// compatibility with FastJet 3.0 and is highly likely to change in
86 /// a future release of FastJet
87 void set_defaults();
88
89 /// when 'use_rho_m' is true, include in the subtraction the
90 /// correction from rho_m, the purely longitudinal,
91 /// particle-mass-induced component of the background density per
92 /// unit area
93 ///
94 /// Note: this will be switched off by default (for backwards
95 /// compatibility with FastJet 3.0) but is highly likely to change
96 /// in a future release of FastJet
97 void set_use_rho_m(bool use_rho_m_in = true){
98 if (_bge == 0) {
99 throw Error("Subtractor: rho_m support works only for Subtractors constructed with background estimator");
100 }
101 _use_rho_m=use_rho_m_in;
102 }
103
104 /// returns whether or not the rho_m component is used
105 bool use_rho_m() const{ return _use_rho_m;}
106
107 /// when 'safe_mass' is true, ensure that the mass of the subtracted
108 /// 4-vector remain positive
109 ///
110 /// when true, if the subtracted mass is negative, we return a
111 /// 4-vector with 0 mass, pt and phi from the subtracted 4-vector
112 /// and the rapidity of the original, unsubtracted jet.
113 ///
114 /// Note: this will be switched off by default (for backwards
115 /// compatibility with FastJet 3.0) but is highly likely to change
116 /// in a future release of FastJet
117 void set_safe_mass(bool safe_mass_in=true){ _safe_mass=safe_mass_in;}
118
119 /// returns whether or not safety tests on the mass are included
120 bool safe_mass() const{ return _safe_mass;}
121
122 /// This is mostly intended for cherge-hadron-subtracted type of
123 /// events where we wich to use vertex information to improve the
124 /// subtraction.
125 ///
126 /// Given the following parameters:
127 /// \param sel_known_vertex selects the particles with a
128 /// known vertex origin
129 /// \param sel_leading_vertex amongst the particles with a
130 /// known vertex origin, select those
131 /// coming from the leading vertex
132 /// Momentum identified as coming from the leading vertex will be
133 /// kept, momentum identified as coming from a non-leading vertex
134 /// will be eliminated and a regular area-median subtraction will be
135 /// applied on the 4-vector sum of the particles with unknown vertex
136 /// origin.
137 ///
138 /// When this is set, we shall ensure that the pt of the subtracted
139 /// 4-vector is at least the pt of the particles that are known to
140 /// come from the leading vertex (if it fails, subtraction returns
141 /// the component that is known to come from the leading vertex ---
142 /// or, the original unsubtracted jet if it contains no particles
143 /// from the leading vertex). Furthermore, when safe_mass() is on, we
144 /// also impose a similar constraint on the mass of the subtracted
145 /// 4-vector (if the test fails, the longitudinal part of the
146 /// subtracted 4-vector is taken from the component that is known to
147 /// come from the leading vertex).
148 void set_known_selectors(const Selector &sel_known_vertex,
149 const Selector &sel_leading_vertex){
150 _sel_known_vertex = sel_known_vertex;
151 _sel_leading_vertex = sel_leading_vertex;
152 }
153
154 //\}
155
156 /// @name description and action
157 //\{
158 //----------------------------------------------------------------
159
160 /// returns a jet that's subtracted
161 ///
162 /// \param jet the jet that is to be subtracted
163 /// \return the subtracted jet
164 virtual PseudoJet result(const PseudoJet & jet) const;
165
166 /// class description
167 virtual std::string description() const;
168
169 //\}
170protected:
171 /// compute the 4-vector that should be subtracted from the given
172 /// jet
173 PseudoJet _amount_to_subtract(const PseudoJet &jet) const;
174
175 /// the tool used to estimate the background
176 /// if has to be mutable in case its underlying selector takes a reference jet
177 mutable BackgroundEstimatorBase * _bge;
178 /// the fixed value of rho to use if the user has selected that option
179 double _rho;
180
181 // configuration parameters/flags
182 bool _use_rho_m; ///< include the rho_m correction
183 bool _safe_mass; ///< ensures that the subtracted mass is +ve
184
185 Selector _sel_known_vertex; ///< selects the particles with a
186 ///< known vertex origin
187 Selector _sel_leading_vertex; ///< amongst the particles with a
188 ///< known vertex origin, select those
189 ///< coming from the leading vertex
190
191 /// a value of rho that is used as a default to label that the stored
192 /// rho is not valid for subtraction.
193 //
194 // NB: there are two reasons for not having the value written here:
195 // 1) that it caused problems on karnak with g++ 4.0.1 and 2) that
196 // we anyway like -infinity as a default, and since that's a function,
197 // that's not allowed in an include file.
198 static const double _invalid_rho;
199
200 mutable LimitedWarning _unused_rho_m_warning;
201};
202
203FASTJET_END_NAMESPACE
204
205#endif // __FASTJET_TOOLS_SUBTRACTOR_HH__
206
Note: See TracBrowser for help on using the repository browser.