Fork me on GitHub

source: git/external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh@ a0f5d71

3.4.3pre03
Last change on this file since a0f5d71 was 973b92a, checked in by Pavel Demin <pavel.demin@…>, 9 years ago

update FastJet library to 3.1.3 and Nsubjettiness library to 2.2.1

  • Property mode set to 100644
File size: 12.2 KB
RevLine 
[9687203]1// Nsubjettiness Package
2// Questions/Comments? jthaler@jthaler.net
3//
4// Copyright (c) 2011-14
5// Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
6//
[973b92a]7// $Id: Nsubjettiness.hh 822 2015-06-15 23:52:57Z jthaler $
[9687203]8//----------------------------------------------------------------------
9// This file is part of FastJet contrib.
10//
11// It is free software; you can redistribute it and/or modify it under
12// the terms of the GNU General Public License as published by the
13// Free Software Foundation; either version 2 of the License, or (at
14// your option) any later version.
15//
16// It is distributed in the hope that it will be useful, but WITHOUT
17// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
19// License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this code. If not, see <http://www.gnu.org/licenses/>.
23//----------------------------------------------------------------------
24
25#ifndef __FASTJET_CONTRIB_NSUBJETTINESS_HH__
26#define __FASTJET_CONTRIB_NSUBJETTINESS_HH__
27
28#include <fastjet/internal/base.hh>
29
30#include "Njettiness.hh"
31
32#include "fastjet/FunctionOfPseudoJet.hh"
33#include <string>
34#include <climits>
35
36FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
37
38namespace contrib {
39
[973b92a]40// Classes defined in this file.
41class Nsubjettiness;
42class NsubjettinessRatio;
43
44///------------------------------------------------------------------------
[9687203]45/// \class Nsubjettiness
[973b92a]46/// \brief Implements the N-subjettiness jet shape
47///
48/**
49 * The N-jettiness jet shape.
50 *
51 * Nsubjettiness extends the concept of Njettiness to a jet shape, but other
52 * than the set of particles considered, they are identical. This class
53 * wraps the core Njettiness code to provide the fastjet::FunctionOfPseudoJet
54 * interface for convenience in larger analyses.
55 *
56 * The recommended AxesDefinitions are:
57 * KT_Axes : exclusive kt axes
58 * WTA_KT_Axes : exclusive kt with winner-take-all recombination
59 * OnePass_KT_Axes : one-pass minimization from kt starting point
60 * OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point
61 * More AxesDefinitions are listed in the README and defined in AxesDefinition.hh
62 *
63 * The recommended MeasureDefinitions are (with the corresponding parameters)
64 * NormalizedMeasure(beta,R0)
65 * : This was the original N-subjettiness measure (dimensionless)
66 * UnnormalizedMeasure(beta)
67 * : This is the new recommended default, same as above but without
68 * : the normalization factor, and hence has units of GeV
69 * NormalizedCutoffMeasure(beta,R0,Rcutoff)
70 * : Same as normalized_measure, but cuts off at Rcutoff
71 * UnnormalizedCutoffMeasure(beta,Rcutoff)
72 * : Same as unnormalized_measure, but cuts off at Rcutoff
73 * More MeasureDefinitions are listed in the README and defined in MeasureDefinition.hh
74 *
75 * For example, for the UnnormalizedMeasure(beta), N-subjettiness is defined as:
76 *
77 * tau_N = Sum_{i in jet} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...)
78 *
79 * DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i
80 * and jet j.
81 *
82 * The NormalizedMeausure include an extra parameter R0, and the various cutoff
83 * measures include an Rcutoff, which effectively defines an angular cutoff
84 * similar in effect to a cone-jet radius.
85 */
[9687203]86class Nsubjettiness : public FunctionOfPseudoJet<double> {
87
88public:
[35cdc46]89
[973b92a]90 /// Main constructor, which takes N, the AxesDefinition, and the MeasureDefinition.
91 /// The Definitions are given in AxesDefinition.hh and MeasureDefinition.hh
[35cdc46]92 Nsubjettiness(int N,
93 const AxesDefinition& axes_def,
94 const MeasureDefinition& measure_def)
95 : _njettinessFinder(axes_def,measure_def), _N(N) {}
96
[973b92a]97 /// Returns tau_N, measured on the constituents of this jet
[9687203]98 double result(const PseudoJet& jet) const;
99
[973b92a]100 /// Returns components of tau_N, so that user can find individual tau values.
[9687203]101 TauComponents component_result(const PseudoJet& jet) const;
102
[973b92a]103 /// To set axes in manual mode
104 void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
105 // Note that cross check that manual mode has been set is in Njettiness
106 _njettinessFinder.setAxes(myAxes);
[9687203]107 }
[973b92a]108
[9687203]109 /// returns seed axes used for onepass minimization (otherwise same as currentAxes)
110 std::vector<fastjet::PseudoJet> seedAxes() const {
111 return _njettinessFinder.seedAxes();
112 }
113
[973b92a]114 /// returns current axes found by result() calculation
115 std::vector<fastjet::PseudoJet> currentAxes() const {
116 return _njettinessFinder.currentAxes();
117 }
118
[35cdc46]119 /// returns subjet regions found by result() calculation (these have valid constituents)
120 /// Note that the axes and the subjets are not the same
121 std::vector<fastjet::PseudoJet> currentSubjets() const {
122 return _njettinessFinder.currentJets();
123 }
124
125 /// returns components of tau_N without recalculating anything
126 TauComponents currentTauComponents() const {
127 return _njettinessFinder.currentTauComponents();
128 }
[973b92a]129
130 /// returns components of tau_N without recalculating anything
131 TauPartition currentPartition() const {
132 return _njettinessFinder.currentPartition();
[9687203]133 }
134
135private:
136
[973b92a]137 /// Core Njettiness code that is called
[35cdc46]138 Njettiness _njettinessFinder; // TODO: should muck with this so result can be const without this mutable
[973b92a]139 /// Number of subjets to find
[9687203]140 int _N;
[973b92a]141
142 /// Warning if the user tries to use v1.0.3 constructor.
143 static LimitedWarning _old_constructor_warning;
[9687203]144
[973b92a]145public:
146
147 // The following interfaces are included for backwards compatibility, but no longer recommended.
148 // They may be deleted in a future release
149
150 /// \deprecated
151 /// Alternative constructors that define the measure via enums and parameters
152 /// These constructors will be removed in v3.0
153 /// Zero parameter arguments
154 /// (Currently, no measure uses this)
155 Nsubjettiness(int N,
156 Njettiness::AxesMode axes_mode,
157 Njettiness::MeasureMode measure_mode)
158 : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {
159 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
160 }
161
162 /// \deprecated
163 /// Construcotr for one parameter argument
164 /// (for unnormalized_measure, para1=beta)
165 Nsubjettiness(int N,
166 Njettiness::AxesMode axes_mode,
167 Njettiness::MeasureMode measure_mode,
168 double para1)
169 : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {
170 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
171 }
172
173 /// \deprecated
174 /// Constructor for two parameter arguments
175 /// (for normalized_measure, para1=beta, para2=R0)
176 /// (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff)
177 Nsubjettiness(int N,
178 Njettiness::AxesMode axes_mode,
179 Njettiness::MeasureMode measure_mode,
180 double para1,
181 double para2)
182 : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {
183 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
184 }
185
186 /// \deprecated
187 /// Constructor for three parameter arguments
188 /// (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff)
189 Nsubjettiness(int N,
190 Njettiness::AxesMode axes_mode,
191 Njettiness::MeasureMode measure_mode,
192 double para1,
193 double para2,
194 double para3)
195 : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {
196 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
197 }
198
199 /// \deprecated
200 /// Old constructor for backwards compatibility with v1.0,
201 /// where normalized_cutoff_measure was the only option
202 Nsubjettiness(int N,
203 Njettiness::AxesMode axes_mode,
204 double beta,
205 double R0,
206 double Rcutoff=std::numeric_limits<double>::max())
207 : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) {
208 _old_constructor_warning.warn("Nsubjettiness: You are using the old style constructor. This is deprecated as of v2.1 and will be removed in v3.0. Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
209 }
210
[9687203]211};
212
213
[973b92a]214///------------------------------------------------------------------------
[9687203]215/// \class NsubjettinessRatio
[973b92a]216/// \brief Implements ratios of N-subjettiness jet shapes
217///
218/// NsubjettinessRatio uses the results from Nsubjettiness to calculate the ratio
219/// tau_N/tau_M, where N and M are specified by the user. The ratio of different tau values
220/// is often used in analyses, so this class is helpful to streamline code. Note that
221/// manual axis mode is not supported
[9687203]222class NsubjettinessRatio : public FunctionOfPseudoJet<double> {
223public:
224
[973b92a]225 /// Main constructor. Apart from specifying both N and M, the same options as Nsubjettiness
[35cdc46]226 NsubjettinessRatio(int N,
227 int M,
228 const AxesDefinition & axes_def,
229 const MeasureDefinition & measure_def)
230 : _nsub_numerator(N,axes_def,measure_def),
[973b92a]231 _nsub_denominator(M,axes_def,measure_def) {
232 if (axes_def.needsManualAxes()) {
233 throw Error("NsubjettinessRatio does not support ManualAxes mode.");
234 }
235 }
236
237 /// Returns tau_N/tau_M based off the input jet using result function from Nsubjettiness
238 double result(const PseudoJet& jet) const;
239
240private:
241
242 Nsubjettiness _nsub_numerator; ///< Function for numerator
243 Nsubjettiness _nsub_denominator; ///< Function for denominator
244
245public:
246
247 // The following interfaces are included for backwards compatibility, but no longer recommended.
248 // They may be deprecated at some point.
[35cdc46]249
[973b92a]250 /// \deprecated
251 /// Old-style constructor for zero arguments
252 /// Alternative constructor with enums and parameters
253 /// Again, likely to be removed
[35cdc46]254 NsubjettinessRatio(int N,
255 int M,
256 Njettiness::AxesMode axes_mode,
257 Njettiness::MeasureMode measure_mode)
258 : _nsub_numerator(N, axes_mode, measure_mode),
259 _nsub_denominator(M, axes_mode, measure_mode) {}
260
[973b92a]261 /// \deprecated
262 /// Old-style constructor for one argument
[9687203]263 NsubjettinessRatio(int N,
264 int M,
265 Njettiness::AxesMode axes_mode,
266 Njettiness::MeasureMode measure_mode,
[35cdc46]267 double para1)
268 : _nsub_numerator(N, axes_mode, measure_mode, para1),
269 _nsub_denominator(M, axes_mode, measure_mode, para1) {}
[973b92a]270
271 /// \deprecated
272 /// Old-style constructor for 2 arguments
[35cdc46]273 NsubjettinessRatio(int N,
274 int M,
275 Njettiness::AxesMode axes_mode,
276 Njettiness::MeasureMode measure_mode,
277 double para1,
278 double para2)
279 : _nsub_numerator(N, axes_mode, measure_mode, para1, para2),
280 _nsub_denominator(M, axes_mode, measure_mode, para1, para2) {}
281
[973b92a]282 /// \deprecated
283 /// Old-style constructor for 3 arguments
[35cdc46]284 NsubjettinessRatio(int N,
285 int M,
286 Njettiness::AxesMode axes_mode,
287 Njettiness::MeasureMode measure_mode,
288 double para1,
289 double para2,
290 double para3)
291 : _nsub_numerator(N, axes_mode, measure_mode, para1, para2, para3),
292 _nsub_denominator(M, axes_mode, measure_mode, para1, para2, para3) {}
293
[973b92a]294
[9687203]295};
296
297} // namespace contrib
298
299FASTJET_END_NAMESPACE
300
301#endif // __FASTJET_CONTRIB_NSUBJETTINESS_HH__
Note: See TracBrowser for help on using the repository browser.