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 |
#include "UHHAnalysis/NtupleWriter/interface/NjettinessPlugin.h"
|
28 |
|
29 |
#include "fastjet/ClusterSequence.hh"
|
30 |
#include "fastjet/JetDefinition.hh"
|
31 |
|
32 |
#include <string>
|
33 |
#include <climits>
|
34 |
|
35 |
FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
|
36 |
|
37 |
NjettinessPlugin::NjettinessPlugin(int N, Njettiness::AxesMode mode, double beta, double R0, double Rcutoff)
|
38 |
: _N(N), _njettinessFinder(mode, NsubParameters(beta, R0, Rcutoff))
|
39 |
{}
|
40 |
|
41 |
|
42 |
std::string NjettinessPlugin::description() const {return "NJettiness";}
|
43 |
|
44 |
void NjettinessPlugin::run_clustering(ClusterSequence& cs) const
|
45 |
{
|
46 |
std::vector<fastjet::PseudoJet> particles = cs.jets();
|
47 |
_njettinessFinder.getTau(_N, particles);
|
48 |
std::vector<std::list<int> > partition = _njettinessFinder.getPartition(particles);
|
49 |
|
50 |
// output clusterings for each jet
|
51 |
for (size_t i = 0; i < partition.size(); ++i) {
|
52 |
std::list<int>& indices = partition[i];
|
53 |
if (indices.size() == 0) continue;
|
54 |
//std::list<int>::const_iterator it = indices.begin();
|
55 |
while (indices.size() > 1) {
|
56 |
int merge_i = indices.back(); indices.pop_back();
|
57 |
int merge_j = indices.back(); indices.pop_back();
|
58 |
int newIndex;
|
59 |
double fakeDij = -1.0;
|
60 |
cs.plugin_record_ij_recombination(merge_i, merge_j, fakeDij, newIndex);
|
61 |
indices.push_back(newIndex);
|
62 |
}
|
63 |
double fakeDib = -1.0;
|
64 |
cs.plugin_record_iB_recombination(indices.back(), fakeDib);
|
65 |
}
|
66 |
}
|
67 |
|
68 |
FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
|