Fork me on GitHub

source: git/external/fastjet/contribs/Nsubjettiness/TauComponents.cc@ a7c9002

ImprovedOutputFile Timing dual_readout llp
Last change on this file since a7c9002 was 973b92a, checked in by Pavel Demin <pavel.demin@…>, 9 years ago

update FastJet library to 3.1.3 and Nsubjettiness library to 2.2.1

  • Property mode set to 100644
File size: 3.3 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: NjettinessDefinition.cc 704 2014-07-07 14:30:43Z 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#include "TauComponents.hh"
26#include "MeasureDefinition.hh"
27
28FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
29
30namespace contrib {
31
32// This constructor takes input vector and double and calculates all necessary tau components
33TauComponents::TauComponents(TauMode tau_mode,
34 const std::vector<double> & jet_pieces_numerator,
35 double beam_piece_numerator,
36 double denominator,
37 const std::vector<PseudoJet> & jets,
38 const std::vector<PseudoJet> & axes
39 )
40: _tau_mode(tau_mode),
41_jet_pieces_numerator(jet_pieces_numerator),
42_beam_piece_numerator(beam_piece_numerator),
43_denominator(denominator),
44_jets(jets),
45_axes(axes)
46{
47
48 if (!has_denominator()) assert(_denominator == 1.0); //make sure no effect from _denominator if _has_denominator is false
49 if (!has_beam()) assert (_beam_piece_numerator == 0.0); //make sure no effect from _beam_piece_numerator if _has_beam is false
50
51 // Put the pieces together
52 _numerator = _beam_piece_numerator;
53 _jet_pieces.resize(_jet_pieces_numerator.size(),0.0);
54 for (unsigned j = 0; j < _jet_pieces_numerator.size(); j++) {
55 _jet_pieces[j] = _jet_pieces_numerator[j]/_denominator;
56 _numerator += _jet_pieces_numerator[j];
57
58 // Add structural information to jets
59 StructureType * structure = new StructureType(_jets[j]);
60 structure->_tau_piece = _jet_pieces[j];
61 _jets[j].set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(structure));
62 }
63
64 _beam_piece = _beam_piece_numerator/_denominator;
65 _tau = _numerator/_denominator;
66
67 // Add total_jet with structural information
68 _total_jet = join(_jets);
69 StructureType * total_structure = new StructureType(_total_jet);
70 total_structure->_tau_piece = _tau;
71 _total_jet.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(total_structure));
72}
73
74
75
76// test for denominator/beams
77bool TauComponents::has_denominator() const {
78 return (_tau_mode == NORMALIZED_JET_SHAPE
79 || _tau_mode == NORMALIZED_EVENT_SHAPE);
80}
81
82bool TauComponents::has_beam() const {
83 return (_tau_mode == UNNORMALIZED_EVENT_SHAPE
84 || _tau_mode == NORMALIZED_EVENT_SHAPE);
85}
86
87} // namespace contrib
88
89FASTJET_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.