Fork me on GitHub

source: git/external/fastjet/ClusterSequence_N2.cc@ 66b590f

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 66b590f was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

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