1 | //STARTHEADER |
---|
2 | // $Id: JadePlugin.cc 859 2012-11-28 01:49:23Z pavel $ |
---|
3 | // |
---|
4 | // Copyright (c) 2007-2011, 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 and are described in hep-ph/0512210. If you use |
---|
16 | // FastJet as part of work towards a scientific publication, please |
---|
17 | // include a citation to the FastJet paper. |
---|
18 | // |
---|
19 | // FastJet is distributed in the hope that it will be useful, |
---|
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
22 | // GNU General Public License for more details. |
---|
23 | // |
---|
24 | // You should have received a copy of the GNU General Public License |
---|
25 | // along with FastJet. If not, see <http://www.gnu.org/licenses/>. |
---|
26 | //---------------------------------------------------------------------- |
---|
27 | //ENDHEADER |
---|
28 | |
---|
29 | // fastjet stuff |
---|
30 | #include "fastjet/ClusterSequence.hh" |
---|
31 | #include "fastjet/JadePlugin.hh" |
---|
32 | #include <iostream> |
---|
33 | //#include "fastjet/internal/ClusterSequence_N2.icc" |
---|
34 | #include "fastjet/NNH.hh" |
---|
35 | |
---|
36 | // other stuff |
---|
37 | #include <vector> |
---|
38 | #include <sstream> |
---|
39 | #include <limits> |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | using namespace std; |
---|
45 | |
---|
46 | FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh |
---|
47 | |
---|
48 | |
---|
49 | //---------------------------------------------------------------------- |
---|
50 | /// class to help run a JADE algorithm |
---|
51 | class JadeBriefJet { |
---|
52 | public: |
---|
53 | void init(const PseudoJet & jet) { |
---|
54 | double norm = 1.0/sqrt(jet.modp2()); |
---|
55 | nx = jet.px() * norm; |
---|
56 | ny = jet.py() * norm; |
---|
57 | nz = jet.pz() * norm; |
---|
58 | rt2E = sqrt(2.0)*jet.E(); |
---|
59 | } |
---|
60 | |
---|
61 | double distance(const JadeBriefJet * jet) const { |
---|
62 | double dij = 1 - nx*jet->nx |
---|
63 | - ny*jet->ny |
---|
64 | - nz*jet->nz; |
---|
65 | dij *= rt2E*jet->rt2E; |
---|
66 | return dij; |
---|
67 | } |
---|
68 | |
---|
69 | double beam_distance() const { |
---|
70 | return numeric_limits<double>::max(); |
---|
71 | } |
---|
72 | |
---|
73 | private: |
---|
74 | double rt2E, nx, ny, nz; |
---|
75 | }; |
---|
76 | |
---|
77 | |
---|
78 | //---------------------------------------------------------------------- |
---|
79 | string JadePlugin::description () const { |
---|
80 | ostringstream desc; |
---|
81 | desc << "e+e- JADE algorithm plugin"; |
---|
82 | return desc.str(); |
---|
83 | } |
---|
84 | |
---|
85 | //---------------------------------------------------------------------- |
---|
86 | void JadePlugin::run_clustering(ClusterSequence & cs) const { |
---|
87 | int njets = cs.jets().size(); |
---|
88 | NNH<JadeBriefJet> nnh(cs.jets()); |
---|
89 | |
---|
90 | // if testing against Hoeth's implementation, need to rescale the |
---|
91 | // dij by Q^2. |
---|
92 | //double Q2 = cs.Q2(); |
---|
93 | |
---|
94 | while (njets > 0) { |
---|
95 | int i, j, k; |
---|
96 | double dij = nnh.dij_min(i, j); |
---|
97 | |
---|
98 | if (j >= 0) { |
---|
99 | cs.plugin_record_ij_recombination(i, j, dij, k); |
---|
100 | nnh.merge_jets(i, j, cs.jets()[k], k); |
---|
101 | } else { |
---|
102 | double diB = cs.jets()[i].E()*cs.jets()[i].E(); // get new diB |
---|
103 | cs.plugin_record_iB_recombination(i, diB); |
---|
104 | nnh.remove_jet(i); |
---|
105 | } |
---|
106 | njets--; |
---|
107 | } |
---|
108 | } |
---|
109 | |
---|
110 | FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh |
---|