1 |
ntran |
1.1.2.1 |
// Njettiness Package
|
2 |
|
|
// Version 0.4.1 (January 22, 2012)
|
3 |
|
|
// Questions/Comments? jthaler@jthaler.net
|
4 |
|
|
|
5 |
|
|
// Copyright (c) 2011-12, Jesse Thaler, Ken Van Tilburg, and Christopher K.
|
6 |
|
|
// Vermilion
|
7 |
|
|
//
|
8 |
|
|
//----------------------------------------------------------------------
|
9 |
|
|
// This file is part of the N-jettiness package ("N-jettiness").
|
10 |
|
|
//
|
11 |
|
|
// N-jettiness is free software; you can redistribute it and/or modify
|
12 |
|
|
// it under the terms of the GNU General Public License as published by
|
13 |
|
|
// the Free Software Foundation; either version 3 of the License, or
|
14 |
|
|
// (at your option) any later version.
|
15 |
|
|
//
|
16 |
|
|
// SpartyJet is distributed in the hope that it will be useful,
|
17 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
18 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
19 |
|
|
// GNU General Public License for more details.
|
20 |
|
|
//
|
21 |
|
|
// You should have received a copy of the GNU General Public License
|
22 |
|
|
// along with SpartyJet; if not, write to the Free Software
|
23 |
|
|
// Foundation, Inc.:
|
24 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
25 |
|
|
//----------------------------------------------------------------------
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
#ifndef __NJETTINESSPLUGIN_HH__
|
29 |
|
|
#define __NJETTINESSPLUGIN_HH__
|
30 |
|
|
|
31 |
|
|
#include "Njettiness.hh"
|
32 |
|
|
|
33 |
|
|
#include "fastjet/ClusterSequence.hh"
|
34 |
|
|
#include "fastjet/JetDefinition.hh"
|
35 |
|
|
|
36 |
|
|
#include <string>
|
37 |
|
|
#include <climits>
|
38 |
|
|
|
39 |
|
|
FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
|
40 |
|
|
|
41 |
|
|
/// The Njettiness jet algorithm
|
42 |
|
|
/**
|
43 |
|
|
* An exclusive jet finder that identifies N jets; first N axes are found, then
|
44 |
|
|
* particles are assigned to the nearest (DeltaR) axis and for each axis the
|
45 |
|
|
* corresponding jet is simply the four-momentum sum of these particles.
|
46 |
|
|
*
|
47 |
|
|
* Axes can be found in several ways, specified by the AxesMode argument:
|
48 |
|
|
*
|
49 |
|
|
* kt_axes : exclusive kT
|
50 |
|
|
* ca_axes : exclusive CA
|
51 |
|
|
* min_axes : minimize N-jettiness by iteration (100 passes default)
|
52 |
|
|
* onepass_{kt,ca}_axes : one-pass minimization seeded by kt or CA (pretty good)
|
53 |
|
|
*
|
54 |
|
|
* N-jettiness is defined as:
|
55 |
|
|
*
|
56 |
|
|
* tau_N = Sum_{all particles i}
|
57 |
|
|
* p_T^i min((DR_i1/R_0)^beta, (DR_i2/R_0)^beta, ... , 1)
|
58 |
|
|
*
|
59 |
|
|
* DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i
|
60 |
|
|
* and jet j. R_0 and beta are parameters of the algorithm. R_0 effectively
|
61 |
|
|
* defines an angular cutoff similar in effect to a cone-jet radius.
|
62 |
|
|
*
|
63 |
|
|
* You can also specify an angular cutoff Rcutoff. Particles within R0 of an
|
64 |
|
|
* axis affect tau_N, but only particles with Rcutoff are included in the final
|
65 |
|
|
* jets. In principal Rcutoff can be smaller of larger than R0. Rcutoff=inf
|
66 |
|
|
* corresponds to a partition of the event such that all particles are assigned
|
67 |
|
|
* to jets.
|
68 |
|
|
*
|
69 |
|
|
*/
|
70 |
|
|
|
71 |
|
|
class NjettinessPlugin : public JetDefinition::Plugin {
|
72 |
|
|
public:
|
73 |
|
|
|
74 |
|
|
NjettinessPlugin(int N, Njettiness::AxesMode mode, double beta, double R0, double Rcutoff=std::numeric_limits<double>::max());
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
// The things that are required by base class.
|
78 |
|
|
virtual std::string description () const;
|
79 |
|
|
virtual double R() const {return -1.0;} // todo: make this not stupid
|
80 |
|
|
virtual void run_clustering(ClusterSequence&) const;
|
81 |
|
|
|
82 |
|
|
virtual ~NjettinessPlugin() {}
|
83 |
|
|
|
84 |
|
|
private:
|
85 |
|
|
|
86 |
|
|
int _N;
|
87 |
|
|
mutable Njettiness _njettinessFinder; // should muck with this so run_clustering can be const without this mutable
|
88 |
|
|
|
89 |
|
|
};
|
90 |
|
|
|
91 |
|
|
inline NjettinessPlugin::NjettinessPlugin(int N, Njettiness::AxesMode mode, double beta, double R0, double Rcutoff)
|
92 |
|
|
: _N(N), _njettinessFinder(mode, NsubParameters(beta, R0, Rcutoff))
|
93 |
|
|
{}
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
inline std::string NjettinessPlugin::description() const {return "NJettiness";}
|
97 |
|
|
|
98 |
|
|
inline void NjettinessPlugin::run_clustering(ClusterSequence& cs) const
|
99 |
|
|
{
|
100 |
|
|
std::vector<fastjet::PseudoJet> particles = cs.jets();
|
101 |
|
|
_njettinessFinder.getTau(_N, particles);
|
102 |
|
|
std::vector<std::list<int> > partition = _njettinessFinder.getPartition(particles);
|
103 |
|
|
|
104 |
|
|
// output clusterings for each jet
|
105 |
|
|
for (size_t i = 0; i < partition.size(); ++i) {
|
106 |
|
|
std::list<int>& indices = partition[i];
|
107 |
|
|
if (indices.size() == 0) continue;
|
108 |
|
|
std::list<int>::const_iterator it = indices.begin();
|
109 |
|
|
while (indices.size() > 1) {
|
110 |
|
|
int merge_i = indices.back(); indices.pop_back();
|
111 |
|
|
int merge_j = indices.back(); indices.pop_back();
|
112 |
|
|
int newIndex;
|
113 |
|
|
double fakeDij = -1.0;
|
114 |
|
|
cs.plugin_record_ij_recombination(merge_i, merge_j, fakeDij, newIndex);
|
115 |
|
|
indices.push_back(newIndex);
|
116 |
|
|
}
|
117 |
|
|
double fakeDib = -1.0;
|
118 |
|
|
cs.plugin_record_iB_recombination(indices.back(), fakeDib);
|
119 |
|
|
}
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
|
124 |
|
|
|
125 |
|
|
#endif // __NJETTINESSPLUGIN_HH__
|