Fork me on GitHub

source: git/external/fastjet/contribs/Nsubjettiness/Njettiness.hh@ b25d4cf

ImprovedOutputFile Timing dual_readout llp
Last change on this file since b25d4cf 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.5 KB
Line 
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//
7// $Id: Njettiness.hh 670 2014-06-06 01:24:42Z jthaler $
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_NJETTINESS_HH__
26#define __FASTJET_CONTRIB_NJETTINESS_HH__
27
28
29#include "MeasureFunction.hh"
30#include "AxesFinder.hh"
31#include "NjettinessDefinition.hh"
32
33#include "fastjet/PseudoJet.hh"
34#include "fastjet/SharedPtr.hh"
35#include <fastjet/LimitedWarning.hh>
36
37#include <cmath>
38#include <vector>
39#include <list>
40
41FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
42
43namespace contrib {
44
45///////
46//
47// Main Njettiness Class
48//
49///////
50
51//------------------------------------------------------------------------
52/// \class Njettiness
53// Njettiness uses AxesFinder and MeasureFunction together in order to find tau_N for the event. The user specifies
54// which AxesFinder and which MeasureFunction to use in the calculation, and then Njettiness returns tau_N for the event.
55// It also can return information about the axes and jets it used in the calculation, as well as information about
56// how the event was partitioned.
57class Njettiness {
58public:
59
60 // The various axes choices available to the user
61 // It is recommended to use AxesDefinition instead of these.
62 enum AxesMode {
63 kt_axes, // exclusive kt axes
64 ca_axes, // exclusive ca axes
65 antikt_0p2_axes, // inclusive hardest axes with antikt-0.2
66 wta_kt_axes, // Winner Take All axes with kt
67 wta_ca_axes, // Winner Take All axes with CA
68 onepass_kt_axes, // one-pass minimization from kt starting point
69 onepass_ca_axes, // one-pass minimization from ca starting point
70 onepass_antikt_0p2_axes, // one-pass minimization from antikt-0.2 starting point
71 onepass_wta_kt_axes, //one-pass minimization of WTA axes with kt
72 onepass_wta_ca_axes, //one-pass minimization of WTA axes with ca
73 min_axes, // axes that minimize N-subjettiness (100 passes by default)
74 manual_axes, // set your own axes with setAxes()
75 onepass_manual_axes // one-pass minimization from manual starting point
76 // These options are commented out because they have not been fully tested
77 // wta2_kt_axes, // Winner Take All (alpha = 2) with kt
78 // wta2_ca_axes, // Winner Take All (alpha = 2) with CA
79 // onepass_wta2_kt_axes, //one-pass minimization of WTA (alpha = 2) axes with kt
80 // onepass_wta2_ca_axes, //one-pass minimization of WTA (alpha = 2) axes with ca
81 };
82
83 // The measures available to the user.
84 // "normalized_cutoff_measure" was the default in v1.0 of Nsubjettiness
85 // "unnormalized_measure" is now the recommended default usage
86 // But it is recommended to use MeasureDefinition instead of these.
87 enum MeasureMode {
88 normalized_measure, //default normalized measure
89 unnormalized_measure, //default unnormalized measure
90 geometric_measure, //geometric measure
91 normalized_cutoff_measure, //default normalized measure with explicit Rcutoff
92 unnormalized_cutoff_measure, //default unnormalized measure with explicit Rcutoff
93 geometric_cutoff_measure //geometric measure with explicit Rcutoff
94 };
95
96 // Main constructor that uses AxesMode and MeasureDefinition to specify measure
97 // Unlike Nsubjettiness or NjettinessPlugin, the value N is not chosen
98 Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def);
99
100 // Intermediate constructor (needed to enable v1.0.3 backwards compatibility?)
101 Njettiness(AxesMode axes_mode, const MeasureDefinition & measure_def);
102
103 // Alternative constructor which takes axes/measure information as enums with measure parameters
104 // This version is not recommended
105 Njettiness(AxesMode axes_mode,
106 MeasureMode measure_mode,
107 int num_para,
108 double para1 = std::numeric_limits<double>::quiet_NaN(),
109 double para2 = std::numeric_limits<double>::quiet_NaN(),
110 double para3 = std::numeric_limits<double>::quiet_NaN())
111 : _axes_def(createAxesDef(axes_mode)), _measure_def(createMeasureDef(measure_mode, num_para, para1, para2, para3)) {
112 setMeasureFunctionAndAxesFinder(); // call helper function to do the hard work
113 }
114
115 // destructor
116 ~Njettiness() {};
117
118 // setAxes for Manual mode
119 void setAxes(const std::vector<fastjet::PseudoJet> & myAxes);
120
121 // Calculates and returns all TauComponents that user would want.
122 // This information is stored in _current_tau_components for later access as well.
123 TauComponents getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const;
124
125 // Calculates the value of N-subjettiness,
126 // but only returns the tau value from _current_tau_components
127 double getTau(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
128 return getTauComponents(n_jets, inputJets).tau();
129 }
130
131 // Return all relevant information about tau components
132 TauComponents currentTauComponents() const {return _current_tau_components;}
133 // Return axes found by getTauComponents.
134 std::vector<fastjet::PseudoJet> currentAxes() const { return _currentAxes;}
135 // Return seedAxes used if onepass minimization (otherwise, same as currentAxes)
136 std::vector<fastjet::PseudoJet> seedAxes() const { return _seedAxes;}
137 // Return jet partition found by getTauComponents.
138 std::vector<fastjet::PseudoJet> currentJets() const {return _currentJets;}
139 // Return beam partition found by getTauComponents.
140 fastjet::PseudoJet currentBeam() const {return _currentBeam;}
141
142 // partition inputs by Voronoi (each vector stores indices corresponding to inputJets)
143 std::vector<std::list<int> > getPartitionList(const std::vector<fastjet::PseudoJet> & inputJets) const;
144
145private:
146
147 // Information about Axes and Measures to be Used
148 // Implemented as SharedPtrs to avoid memory management headaches
149 SharedPtr<const AxesDefinition> _axes_def;
150 SharedPtr<const MeasureDefinition> _measure_def;
151
152 // The chosen axes/measure mode workers
153 // Implemented as SharedPtrs to avoid memory management headaches
154 // TODO: make into a SharedPtr<const AxesFinder>?
155 SharedPtr<MeasureFunction> _measureFunction; // The chosen measure
156 SharedPtr<AxesFinder> _startingAxesFinder; // The initial axes finder
157 SharedPtr<AxesFinder> _finishingAxesFinder; // A possible minimization step
158
159 // Information about the current information
160 // Defined as mutables, so user should be aware that these change when getTau is called.
161 mutable TauComponents _current_tau_components; //automatically set to have components of 0; these values will be set by the getTau function call
162 mutable std::vector<fastjet::PseudoJet> _currentAxes; //axes found after minimization
163 mutable std::vector<fastjet::PseudoJet> _seedAxes; // axes used prior to minimization (if applicable)
164 mutable std::vector<fastjet::PseudoJet> _currentJets; //partitioning information
165 mutable fastjet::PseudoJet _currentBeam; //return beam, if requested
166
167 // created separate function to set MeasureFunction and AxesFinder in order to keep constructor cleaner.
168 void setMeasureFunctionAndAxesFinder();
169
170 // Convert old style enums into new style MeasureDefinition
171 AxesDefinition* createAxesDef(AxesMode axes_mode) const;
172
173 // Convert old style enums into new style MeasureDefinition
174 MeasureDefinition* createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const;
175
176};
177
178} // namespace contrib
179
180FASTJET_END_NAMESPACE
181
182#endif // __FASTJET_CONTRIB_NJETTINESS_HH__
183
Note: See TracBrowser for help on using the repository browser.