Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ParticleFlowElementv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file ParticleFlowElementv1.cc
1
#include "
ParticleFlowElementv1.h
"
2
3
#include <cmath>
4
#include <iostream>
5
6
ParticleFlowElementv1::ParticleFlowElementv1
()
7
: _mom() , _e(NAN)
8
{
9
for
(
int
i
= 0;
i
< 3; ++
i
)
_mom
[
i
] = NAN;
10
11
_id
= 0;
12
13
_type
= ParticleFlowElement::PFLOWTYPE::UNASSIGNED;
14
}
15
16
void
ParticleFlowElementv1::identify
(std::ostream&
os
)
const
17
{
18
os <<
"-- ParticleFlowElement v1 : "
;
19
os <<
" id: "
<<
get_id
() <<
", type: "
<<
get_type
() <<
","
;
20
os <<
" (px, py, pz, e) = ("
<<
get_px
() <<
", "
<<
get_py
() <<
", "
;
21
os <<
get_pz
() <<
", "
<<
get_e
() <<
") GeV"
<< std::endl;
22
23
return
;
24
}
25
26
void
ParticleFlowElementv1::Reset
()
27
{
28
for
(
int
i
= 0;
i
< 3; ++
i
)
_mom
[
i
] = NAN;
29
_e
= NAN;
30
}
31
32
int
ParticleFlowElementv1::isValid
()
const
33
{
34
for
(
int
i
= 0;
i
< 3; ++
i
)
35
{
36
if
(std::isnan(
_mom
[
i
]))
return
0;
37
}
38
if
(std::isnan(
_e
))
return
0;
39
40
return
1;
41
}
42
43
float
ParticleFlowElementv1::get_p
()
const
44
{
45
return
std::sqrt(
get_px
() *
get_px
() +
get_py
() *
get_py
() +
get_pz
() *
get_pz
());
46
}
47
48
float
ParticleFlowElementv1::get_pt
()
const
49
{
50
return
std::sqrt(
get_px
() *
get_px
() +
get_py
() *
get_py
());
51
}
52
53
float
ParticleFlowElementv1::get_et
()
const
54
{
55
return
get_pt
() /
get_p
() *
get_e
();
56
}
57
58
float
ParticleFlowElementv1::get_eta
()
const
59
{
60
return
std::asinh(
get_pz
() /
get_pt
());
61
}
62
63
float
ParticleFlowElementv1::get_phi
()
const
64
{
65
return
std::atan2(
get_py
(),
get_px
());
66
}
67
68
float
ParticleFlowElementv1::get_mass
()
const
69
{
70
71
return
std::sqrt(
get_e
() *
get_e
() -
get_px
() *
get_px
() +
get_py
() *
get_py
() +
get_pz
() *
get_pz
() );
72
73
}
74
coresoftware
blob
master
offline
packages
particleflow
ParticleFlowElementv1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:07
using
1.8.2 with
sPHENIX GitHub integration