Fork me on GitHub

source: svn/trunk/external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.cc

Last change on this file was 1368, checked in by Michele Selvaggi, 11 years ago

added nsubjettiness

File size: 2.7 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#include "WinnerTakeAllRecombiner.hh"
25
26FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
27
28namespace contrib{
29
30std::string WinnerTakeAllRecombiner::description() const {
31 return "Winner Take All scheme recombination";
32}
33
34// recombine pa and pb by creating pab with energy of the sum of particle energies in the direction of the harder particle
35
36// updated recombiner to use more general form of a metric equal to E*(pT/E)^(alpha), which reduces to pT*cosh(rap)^(1-alpha)
37// alpha is specified by the user. The default is alpha = 1, which is the typical behavior. alpha = 2 provides a metric which more
38// favors central jets
39void WinnerTakeAllRecombiner::recombine(const fastjet::PseudoJet & pa, const fastjet::PseudoJet & pb, fastjet::PseudoJet & pab) const {
40 double a_pt = pa.perp(), b_pt = pb.perp(), a_rap = pa.rap(), b_rap = pb.rap();
41
42 // special case of alpha = 1, everything is just pt (made separate so that pow function isn't called)
43 if (_alpha == 1.0) {
44 if (a_pt >= b_pt) {
45 pab.reset_PtYPhiM(a_pt + b_pt, a_rap, pa.phi());
46 }
47 else if (b_pt > a_pt) {
48 pab.reset_PtYPhiM(a_pt + b_pt, b_rap, pb.phi());
49 }
50 }
51
52 // every other case uses additional cosh(rap) term
53 else {
54 double a_metric = a_pt*pow(cosh(a_rap), 1.0-_alpha);
55 double b_metric = b_pt*pow(cosh(b_rap), 1.0-_alpha);
56 if (a_metric >= b_metric) {
57 double new_pt = a_pt + b_pt*pow(cosh(b_rap)/cosh(a_rap), 1.0-_alpha);
58 pab.reset_PtYPhiM(new_pt, a_rap, pa.phi());
59 }
60 if (b_metric > a_metric) {
61 double new_pt = b_pt + a_pt*pow(cosh(a_rap)/cosh(b_rap), 1.0-_alpha);
62 pab.reset_PtYPhiM(new_pt, b_rap, pb.phi());
63 }
64 }
65}
66
67} //namespace contrib
68
69FASTJET_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.