Fork me on GitHub

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

ImprovedOutputFile Timing dual_readout llp
Last change on this file since c2d6ea2 was 9687203, checked in by mselvaggi <mselvaggi@…>, 11 years ago

added nsubjettiness

  • Property mode set to 100644
File size: 6.1 KB
Line 
1// $Id$
2//
3// Nsubjettiness Package
4// Questions/Comments? jthaler@jthaler.net
5//
6// Copyright (c) 2011-14
7// Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
8//
9//----------------------------------------------------------------------
10// This file is part of FastJet contrib.
11//
12// It is free software; you can redistribute it and/or modify it under
13// the terms of the GNU General Public License as published by the
14// Free Software Foundation; either version 2 of the License, or (at
15// your option) any later version.
16//
17// It is distributed in the hope that it will be useful, but WITHOUT
18// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
20// License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this code. If not, see <http://www.gnu.org/licenses/>.
24//----------------------------------------------------------------------
25
26#ifndef __FASTJET_CONTRIB_NJETTINESSPLUGIN_HH__
27#define __FASTJET_CONTRIB_NJETTINESSPLUGIN_HH__
28
29#include "Njettiness.hh"
30#include "MeasureFunction.hh"
31#include "AxesFinder.hh"
32
33#include "fastjet/ClusterSequence.hh"
34#include "fastjet/JetDefinition.hh"
35
36#include <string>
37#include <climits>
38
39FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
40
41
42namespace contrib {
43
44//------------------------------------------------------------------------
45/// \class NjettinessExtras
46// This class contains the same information as Njettiness, but redoes it in terms of the ClusterSequence::Extras class.
47// This is done in order to help improve the interface for the main NjettinessPlugin class.
48// TODO: This class should probably be merged with TauComponents, since both have access
49// to similar information
50class NjettinessExtras : public ClusterSequence::Extras {
51 private:
52
53 TauComponents _tau_components;
54 std::vector<fastjet::PseudoJet> _jets;
55 std::vector<fastjet::PseudoJet> _axes;
56
57 int labelOf(const fastjet::PseudoJet& jet) const {
58 int thisJet = -1;
59 for (unsigned int i = 0; i < _jets.size(); i++) {
60 if (_jets[i].cluster_hist_index() == jet.cluster_hist_index()) {
61 thisJet = i;
62 break;
63 }
64 }
65 return thisJet;
66 }
67
68 public:
69 NjettinessExtras(TauComponents tau_components, std::vector<fastjet::PseudoJet> jets, std::vector<fastjet::PseudoJet> axes) : _tau_components(tau_components), _jets(jets), _axes(axes) {}
70
71 double totalTau() const {return _tau_components.tau();}
72 std::vector<double> subTaus() const {return _tau_components.jet_pieces();}
73 std::vector<fastjet::PseudoJet> jets() const {return _jets;}
74 std::vector<fastjet::PseudoJet> axes() const {return _axes;}
75
76 double totalTau(const fastjet::PseudoJet& jet) const {
77 return _tau_components.tau();
78 }
79 double subTau(const fastjet::PseudoJet& jet) const {
80 if (labelOf(jet) == -1) return NAN;
81 return _tau_components.jet_pieces()[labelOf(jet)];
82 }
83
84 double beamTau() const {
85 return _tau_components.beam_piece();
86 }
87
88 fastjet::PseudoJet axis(const fastjet::PseudoJet& jet) const {
89 return _axes[labelOf(jet)];
90 }
91
92 bool has_njettiness_extras(const fastjet::PseudoJet& jet) const {
93 return (labelOf(jet) >= 0);
94 }
95
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 *
124 * For the unnormalized_measure, N-jettiness is defined as:
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 *
131 * The normalized_meausure include an extra parameter R0, and the various cutoff
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
140 NjettinessPlugin(int N,
141 Njettiness::AxesMode axes_mode,
142 Njettiness::MeasureMode measure_mode,
143 double para1 = NAN,
144 double para2 = NAN,
145 double para3 = NAN,
146 double para4 = NAN);
147
148 // Old constructor for backwards compatibility with v1.0,
149 // where normalized_cutoff_measure was the only option
150 NjettinessPlugin(int N,
151 Njettiness::AxesMode mode,
152 double beta,
153 double R0,
154 double Rcutoff=std::numeric_limits<double>::max());
155
156
157 // The things that are required by base class.
158 virtual std::string description () const;
159 virtual double R() const {return -1.0;} // TODO: make this not stupid
160 virtual void run_clustering(ClusterSequence&) const;
161
162 virtual ~NjettinessPlugin() {}
163
164private:
165
166 int _N;
167 mutable Njettiness _njettinessFinder; // TODO: should muck with this so run_clustering can be const without this mutable
168
169};
170
171} // namespace contrib
172
173FASTJET_END_NAMESPACE
174
175#endif // __FASTJET_CONTRIB_NJETTINESSPLUGIN_HH__
Note: See TracBrowser for help on using the repository browser.