Fork me on GitHub

source: svn/trunk/external/fastjet/plugins/D0RunICone/HepEntityI.h@ 1182

Last change on this file since 1182 was 859, checked in by Pavel Demin, 12 years ago

update fastjet to version 3.0.3

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision Date
File size: 2.8 KB
Line 
1#ifndef D0RunIconeJets_HepEntity_class
2#define D0RunIconeJets_HepEntity_class
3
4#include "inline_maths.h"
5#include <fastjet/internal/base.hh>
6
7FASTJET_BEGIN_NAMESPACE
8
9namespace d0runi{
10
11//Author: Lars Sonnenschein 15/Sep/2009
12//This is an example class fulfilling the minimal requirements needed by the
13//D0 RunI cone jet algorithm implementation, which is an inlined template class
14
15// This file is distributed with FastJet under the terms of the GNU
16// General Public License (v2). Permission to do so has been granted
17// by Lars Sonnenschein and the D0 collaboration (see COPYING for
18// details)
19//
20// History of changes in FastJet compared tothe original version of
21// HepEntity.h
22//
23// 2011-12-13 Gregory Soyez <soyez@fastjet.fr>
24//
25// * added license information
26//
27// 2011-11-14 Gregory Soyez <soyez@fastjet.fr>
28//
29// * removed some harmless warnings coming with the -Wshadow gcc option
30//
31// 2011-10-06 Gregory Soyez <soyez@fastjet.fr>
32//
33// * put the code in the fastjet::d0runi namespace
34
35class HepEntityI {
36
37 public:
38
39 HepEntityI() {
40 Et=0.;
41 eta=0.;
42 phi=0.;
43 index = -1;
44 return;
45 }
46
47
48 HepEntityI(double E_in, double px_in, double py_in, double pz_in,
49 int index_in = -1) : index(index_in) {
50 //Snowmass Et scheme
51 double pt = sqrt(px_in*px_in+py_in*py_in);
52 double p = sqrt(pt*pt+pz_in*pz_in);
53 phi = inline_maths::phi(px_in,py_in);
54 double theta = asin(pt/p);
55 eta = inline_maths::eta(theta);
56
57 Et = E_in*sin(theta);
58
59 return;
60 }
61
62
63
64 HepEntityI(const HepEntityI& in) : Et(in.Et), eta(in.eta), phi(in.phi), index(in.index) {
65 return;
66 }
67
68
69
70
71 inline double pT() const {
72 return Et;
73 }
74
75 inline double px() const {
76 return Et*cos(phi);
77 }
78
79 inline double py() const {
80 return Et*sin(phi);
81 }
82
83 inline double pz() const {
84 return Et*sinh(eta);
85 }
86
87 inline double E() const {
88 return Et*cosh(eta);
89 }
90
91
92 inline void p4vec(float* p) const {
93 p[0] = Et*cos(phi);
94 p[1] = Et*sin(phi);
95 p[2] = Et*sinh(eta);
96 p[3] = Et*cosh(eta); //E
97 return;
98 }
99
100
101 inline void Add(const HepEntityI el) {
102 //assumes Et, eta and phi stored accurately
103 double w2 = el.Et;
104 Et += el.Et;
105 w2 /= Et;
106
107 eta += w2*(el.eta - eta);
108 phi += w2*inline_maths::delta_phi(el.phi, phi);
109
110 return;
111 }
112
113
114 inline void Fill(double E_in, double px_in, double py_in, double pz_in, int index_in) {
115 double pt = sqrt(px_in*px_in+py_in*py_in);
116 double p = sqrt(pt*pt+pz_in*pz_in);
117 phi = inline_maths::phi(px_in,py_in);
118 double theta = asin(pt/p);
119 eta = inline_maths::eta(theta);
120
121 Et = E_in*sin(theta);
122
123 index = index_in;
124
125 return;
126 }
127
128
129 double Et;
130 double eta;
131 double phi;
132 int index;
133
134 private:
135
136
137
138};
139//end of class HepEntityI;
140
141} // end of namespace d0runi
142
143FASTJET_END_NAMESPACE
144
145#endif
Note: See TracBrowser for help on using the repository browser.