Fork me on GitHub

source: git/external/fastjet/contribs/Nsubjettiness/MeasureFunction.cc@ 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: 2.9 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//----------------------------------------------------------------------
8// This file is part of FastJet contrib.
9//
10// It is free software; you can redistribute it and/or modify it under
11// the terms of the GNU General Public License as published by the
12// Free Software Foundation; either version 2 of the License, or (at
13// your option) any later version.
14//
15// It is distributed in the hope that it will be useful, but WITHOUT
16// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
18// License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this code. If not, see <http://www.gnu.org/licenses/>.
22//----------------------------------------------------------------------
23
24
25#include "MeasureFunction.hh"
26
27FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
28
29namespace contrib{
30
31///////
32//
33// Measure Function
34//
35///////
36
37// Return all of the necessary TauComponents for specific input particles and axes
38TauComponents MeasureFunction::result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) {
39
40 std::vector<double> jetPieces(axes.size(), 0.0);
41 double beamPiece = 0.0;
42
43 // Calculates the unnormalized sub-tau values, i.e. a std::vector of the contributions to tau_N of each Voronoi region (or region within R_0)
44 for (unsigned i = 0; i < particles.size(); i++) {
45
46 // find minimum distance; start with beam (-1) for reference
47 int j_min = -1;
48 double minRsq;
49 if (_has_beam) minRsq = beam_distance_squared(particles[i]);
50 else minRsq = std::numeric_limits<double>::max(); // make it large value
51
52 // check to see which axis the particle is closest to
53 for (unsigned j = 0; j < axes.size(); j++) {
54 double tempRsq = jet_distance_squared(particles[i],axes[j]); // delta R distance
55 if (tempRsq < minRsq) {
56 minRsq = tempRsq;
57 j_min = j;
58 }
59 }
60
61 if (j_min == -1) {
62 if (_has_beam) beamPiece += beam_numerator(particles[i]);
63 else assert(_has_beam); // this should never happen.
64 } else {
65 jetPieces[j_min] += jet_numerator(particles[i],axes[j_min]);
66 }
67 }
68
69 // Calculates normalization for tau and subTau if _has_denominator is true, otherwise returns 1.0 (i.e. no normalization)
70 double tauDen = 0.0;
71 if (_has_denominator) {
72 for (unsigned i = 0; i < particles.size(); i++) {
73 tauDen += denominator(particles[i]);
74 }
75 } else {
76 tauDen = 1.0; // if no denominator, then 1.0 for no normalization factor
77 }
78
79 return TauComponents(jetPieces, beamPiece, tauDen, _has_denominator, _has_beam);
80}
81
82} //namespace contrib
83
84FASTJET_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.