Fork me on GitHub

source: git/external/fastjet/plugins/Jade/JadePlugin.cc@ 239e1d0

ImprovedOutputFile Timing dual_readout llp 3.3.3pre11
Last change on this file since 239e1d0 was 35cdc46, checked in by Pavel Demin <demin@…>, 10 years ago

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

  • Property mode set to 100644
File size: 3.3 KB
Line 
1//FJSTARTHEADER
2// $Id: JadePlugin.cc 3433 2014-07-23 08:17:03Z salam $
3//
4// Copyright (c) 2007-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
5//
6//----------------------------------------------------------------------
7// This file is part of FastJet.
8//
9// FastJet is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//
14// The algorithms that underlie FastJet have required considerable
15// development. They are described in the original FastJet paper,
16// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17// FastJet as part of work towards a scientific publication, please
18// quote the version you use and include a citation to the manual and
19// optionally also to hep-ph/0512210.
20//
21// FastJet is distributed in the hope that it will be useful,
22// but WITHOUT ANY WARRANTY; without even the implied warranty of
23// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24// GNU General Public License for more details.
25//
26// You should have received a copy of the GNU General Public License
27// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28//----------------------------------------------------------------------
29//FJENDHEADER
30
31// fastjet stuff
32#include "fastjet/ClusterSequence.hh"
33#include "fastjet/JadePlugin.hh"
34#include <iostream>
35//#include "fastjet/internal/ClusterSequence_N2.icc"
36#include "fastjet/NNH.hh"
37
38// other stuff
39#include <vector>
40#include <sstream>
41#include <limits>
42
43
44
45
46using namespace std;
47
48FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
49
50
51//----------------------------------------------------------------------
52/// class to help run a JADE algorithm
53class JadeBriefJet {
54public:
55 void init(const PseudoJet & jet) {
56 double norm = 1.0/sqrt(jet.modp2());
57 nx = jet.px() * norm;
58 ny = jet.py() * norm;
59 nz = jet.pz() * norm;
60 rt2E = sqrt(2.0)*jet.E();
61 }
62
63 double distance(const JadeBriefJet * jet) const {
64 double dij = 1 - nx*jet->nx
65 - ny*jet->ny
66 - nz*jet->nz;
67 dij *= rt2E*jet->rt2E;
68 return dij;
69 }
70
71 double beam_distance() const {
72 return numeric_limits<double>::max();
73 }
74
75private:
76 double rt2E, nx, ny, nz;
77};
78
79
80//----------------------------------------------------------------------
81string JadePlugin::description () const {
82 ostringstream desc;
83 desc << "e+e- JADE algorithm plugin";
84 return desc.str();
85}
86
87//----------------------------------------------------------------------
88void JadePlugin::run_clustering(ClusterSequence & cs) const {
89 int njets = cs.jets().size();
90 NNH<JadeBriefJet> nnh(cs.jets());
91
92 // if testing against Hoeth's implementation, need to rescale the
93 // dij by Q^2.
94 //double Q2 = cs.Q2();
95
96 while (njets > 0) {
97 int i, j, k;
98 double dij = nnh.dij_min(i, j);
99
100 if (j >= 0) {
101 cs.plugin_record_ij_recombination(i, j, dij, k);
102 nnh.merge_jets(i, j, cs.jets()[k], k);
103 } else {
104 double diB = cs.jets()[i].E()*cs.jets()[i].E(); // get new diB
105 cs.plugin_record_iB_recombination(i, diB);
106 nnh.remove_jet(i);
107 }
108 njets--;
109 }
110}
111
112FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
Note: See TracBrowser for help on using the repository browser.