Fork me on GitHub

source: git/external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh@ e33e6db

Last change on this file since e33e6db 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: 7.3 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//
[35cdc46]7// $Id: NjettinessPlugin.hh 671 2014-06-10 17:47:52Z 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_NJETTINESSPLUGIN_HH__
26#define __FASTJET_CONTRIB_NJETTINESSPLUGIN_HH__
27
28#include "Njettiness.hh"
29#include "MeasureFunction.hh"
30#include "AxesFinder.hh"
31
32#include "fastjet/ClusterSequence.hh"
33#include "fastjet/JetDefinition.hh"
34
35#include <string>
36#include <climits>
37
38FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
39
40
41namespace contrib {
42
43//------------------------------------------------------------------------
44/// \class NjettinessExtras
45// This class contains the same information as Njettiness, but redoes it in terms of the ClusterSequence::Extras class.
46// This is done in order to help improve the interface for the main NjettinessPlugin class.
47// TODO: This class should probably be merged with TauComponents, since both have access
48// to similar information
49class NjettinessExtras : public ClusterSequence::Extras {
50
51 public:
52 NjettinessExtras(TauComponents tau_components, std::vector<fastjet::PseudoJet> jets, std::vector<fastjet::PseudoJet> axes) : _tau_components(tau_components), _jets(jets), _axes(axes) {}
53
54 double totalTau() const {return _tau_components.tau();}
55 std::vector<double> subTaus() const {return _tau_components.jet_pieces();}
56 std::vector<fastjet::PseudoJet> jets() const {return _jets;}
57 std::vector<fastjet::PseudoJet> axes() const {return _axes;}
58
[35cdc46]59 double totalTau(const fastjet::PseudoJet& /*jet*/) const {
[9687203]60 return _tau_components.tau();
61 }
[35cdc46]62
[9687203]63 double subTau(const fastjet::PseudoJet& jet) const {
[35cdc46]64 if (labelOf(jet) == -1) return std::numeric_limits<double>::quiet_NaN(); // nonsense
[9687203]65 return _tau_components.jet_pieces()[labelOf(jet)];
66 }
67
68 double beamTau() const {
69 return _tau_components.beam_piece();
70 }
71
72 fastjet::PseudoJet axis(const fastjet::PseudoJet& jet) const {
73 return _axes[labelOf(jet)];
74 }
75
76 bool has_njettiness_extras(const fastjet::PseudoJet& jet) const {
77 return (labelOf(jet) >= 0);
78 }
[35cdc46]79
80private:
81
82 TauComponents _tau_components;
83 std::vector<fastjet::PseudoJet> _jets;
84 std::vector<fastjet::PseudoJet> _axes;
85
86 int labelOf(const fastjet::PseudoJet& jet) const {
87 int thisJet = -1;
88 for (unsigned int i = 0; i < _jets.size(); i++) {
89 if (_jets[i].cluster_hist_index() == jet.cluster_hist_index()) {
90 thisJet = i;
91 break;
92 }
93 }
94 return thisJet;
95 }
[9687203]96};
97
98inline const NjettinessExtras * njettiness_extras(const fastjet::PseudoJet& jet) {
99 const ClusterSequence * myCS = jet.associated_cluster_sequence();
100 if (myCS == NULL) return NULL;
101 const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS->extras());
102 return extras;
103}
104
105inline const NjettinessExtras * njettiness_extras(const fastjet::ClusterSequence& myCS) {
106 const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS.extras());
107 return extras;
108}
109
110/// The Njettiness jet algorithm
111/**
112 * An exclusive jet finder that identifies N jets; first N axes are found, then
113 * particles are assigned to the nearest (DeltaR) axis and for each axis the
114 * corresponding jet is simply the four-momentum sum of these particles.
115 *
116 * Axes can be found in several ways, specified by the AxesMode argument. The
117 * recommended choices are
118 *
119 * kt_axes : exclusive kT
120 * wta_kt_axes : exclusive kT with winner-take-all-recombination
121 * onepass_kt_axes : one-pass minimization seeded by kt (pretty good)
122 * onepass_wta_kt_axes : one-pass minimization seeded by wta_kt
123 *
[35cdc46]124 * For the UnnormalizedMeasure(beta), N-jettiness is defined as:
[9687203]125 *
126 * tau_N = Sum_{all particles i} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...)
127 *
128 * DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i
129 * and jet j.
130 *
[35cdc46]131 * The NormalizedMeausure include an extra parameter R0, and the various cutoff
[9687203]132 * measures include an Rcutoff, which effectively defines an angular cutoff
133 * similar in effect to a cone-jet radius.
134 *
135 */
136
137class NjettinessPlugin : public JetDefinition::Plugin {
138public:
139
[35cdc46]140 // Constructor with same arguments as Nsubjettiness.
[9687203]141 NjettinessPlugin(int N,
[35cdc46]142 const AxesDefinition & axes_def,
143 const MeasureDefinition & measure_def)
144 : _njettinessFinder(axes_def, measure_def), _N(N) {}
145
146
147 // Alternative constructors that define the measure via enums and parameters
148 // These constructors are likely be removed
149 NjettinessPlugin(int N,
150 Njettiness::AxesMode axes_mode,
151 Njettiness::MeasureMode measure_mode)
152 : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {}
153
154
155 NjettinessPlugin(int N,
156 Njettiness::AxesMode axes_mode,
157 Njettiness::MeasureMode measure_mode,
158 double para1)
159 : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {}
160
161
162 NjettinessPlugin(int N,
163 Njettiness::AxesMode axes_mode,
164 Njettiness::MeasureMode measure_mode,
165 double para1,
166 double para2)
167 : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {}
168
169
170 NjettinessPlugin(int N,
171 Njettiness::AxesMode axes_mode,
172 Njettiness::MeasureMode measure_mode,
173 double para1,
174 double para2,
175 double para3)
176 : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {}
177
[9687203]178
179 // Old constructor for backwards compatibility with v1.0,
[35cdc46]180 // where NormalizedCutoffMeasure was the only option
[9687203]181 NjettinessPlugin(int N,
182 Njettiness::AxesMode mode,
183 double beta,
184 double R0,
[35cdc46]185 double Rcutoff=std::numeric_limits<double>::max())
186 : _njettinessFinder(mode, NormalizedCutoffMeasure(beta, R0, Rcutoff)), _N(N) {}
187
[9687203]188
189
190 // The things that are required by base class.
191 virtual std::string description () const;
192 virtual double R() const {return -1.0;} // TODO: make this not stupid
193 virtual void run_clustering(ClusterSequence&) const;
194
195 virtual ~NjettinessPlugin() {}
196
197private:
198
[35cdc46]199 Njettiness _njettinessFinder;
[9687203]200 int _N;
201
202};
203
204} // namespace contrib
205
206FASTJET_END_NAMESPACE
207
208#endif // __FASTJET_CONTRIB_NJETTINESSPLUGIN_HH__
Note: See TracBrowser for help on using the repository browser.