FastJet  3.1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ClusterSequence_N2.cc
1 //FJSTARTHEADER
2 // $Id: ClusterSequence_N2.cc 3433 2014-07-23 08:17:03Z salam $
3 //
4 // Copyright (c) 2005-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 
32 // The plain N^2 part of the ClusterSequence class -- separated out
33 // from the rest of the class implementation so as to speed up
34 // compilation of this particular part while it is under test.
35 
36 #include "fastjet/internal/ClusterSequence_N2.icc"
37 
38 #include<iostream>
39 
40 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
41 
42 
43 using namespace std;
44 
45 
46 //*************************************************************************
47 //
48 // THINGS FOR E+E-
49 //
50 //*************************************************************************
51 
52 
53 //----------------------------------------------------------------------
54 template<> inline void ClusterSequence::_bj_set_jetinfo(
55  EEBriefJet * const jetA, const int _jets_index) const {
56 
57  double E = _jets[_jets_index].E();
58  double scale = E*E; // the default energy scale for the kt alg
59  double p = jet_def().extra_param(); // in case we're ee_genkt
60  switch (_jet_algorithm) {
61  case ee_kt_algorithm:
62  assert(_Rparam > 2.0); // force this to be true! [not best place, but works]
63  // recall that _invR2 is artificially set to 1 for this alg
64  // so that we automatically have dij = scale * 2(1-cos theta_ij)
65  // Normally, _Rparam should be automatically set to 4 from JetDefinition
66  break;
67  case ee_genkt_algorithm:
68  if (p <= 0 && scale < 1e-300) scale = 1e-300; // same dodgy safety as genkt
69  scale = pow(scale,p);
70  break;
71  default:
72  throw Error("Unrecognised jet algorithm");
73  }
74  jetA->kt2 = scale; // "kt2" might one day be renamed as "scale" or some such
75 
76  double norm = _jets[_jets_index].modp2();
77  if (norm > 0) {
78  norm = 1.0/sqrt(norm);
79  jetA->nx = norm * _jets[_jets_index].px();
80  jetA->ny = norm * _jets[_jets_index].py();
81  jetA->nz = norm * _jets[_jets_index].pz();
82  } else {
83  jetA->nx = 0.0;
84  jetA->ny = 0.0;
85  jetA->nz = 1.0;
86  }
87  jetA->_jets_index = _jets_index;
88  // initialise NN info as well
89  jetA->NN_dist = _R2;
90  jetA->NN = NULL;
91 }
92 
93 //----------------------------------------------------------------------
94 // returns the angular distance between the two jets
95 template<> double ClusterSequence::_bj_dist(
96  const EEBriefJet * const jeta,
97  const EEBriefJet * const jetb) const {
98  double dist = 1.0
99  - jeta->nx*jetb->nx
100  - jeta->ny*jetb->ny
101  - jeta->nz*jetb->nz;
102  dist *= 2; // distance is _2_*min(Ei^2,Ej^2)*(1-cos theta)
103  return dist;
104 }
105 
106 
107 
108 // get explicit copies of the two N2 cluster cases we need
109 // plain BriefJet
110 void ClusterSequence::_simple_N2_cluster_BriefJet() {
111  _simple_N2_cluster<BriefJet>();
112 }
113 
114 
115 // e+e- BriefJet
116 void ClusterSequence::_simple_N2_cluster_EEBriefJet() {
117  _simple_N2_cluster<EEBriefJet>();
118 }
119 
120 // //----------------------------------------------------------------------
121 // /// Force instantiation of desired versions of _simple_N2_cluster
122 // ///
123 // /// This is not very elegant...
124 // void ClusterSequence::_dummy_N2_cluster_instantiation() {
125 // _simple_N2_cluster<BriefJet>();
126 // _simple_N2_cluster<EEBriefJet>();
127 // }
128 
129 FASTJET_END_NAMESPACE
130 
double norm(const VPoint p)
norm of a vector
Definition: Voronoi.hh:155
the e+e- genkt algorithm (R > 2 and p=1 gives ee_kt)
the e+e- kt algorithm