ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
GlobalVertexv1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file GlobalVertexv1.cc
1
#include "
GlobalVertexv1.h
"
2
3
#include <cmath>
4
5
using namespace
std;
6
7
GlobalVertexv1::GlobalVertexv1
()
8
: _id(0xFFFFFFFF)
9
, _t(NAN)
10
, _t_err(NAN)
11
, _pos()
12
, _chisq(NAN)
13
, _ndof(0xFFFFFFFF)
14
, _err()
15
, _vtx_ids()
16
{
17
for
(
int
i = 0; i < 3; ++i)
_pos
[i] = NAN;
18
19
for
(
int
j = 0; j < 3; ++j)
20
{
21
for
(
int
i = j; i < 3; ++i)
22
{
23
set_error
(i, j, NAN);
24
}
25
}
26
}
27
28
GlobalVertexv1::~GlobalVertexv1
() {}
29
30
void
GlobalVertexv1::identify
(ostream& os)
const
31
{
32
os <<
"---GlobalVertexv1-----------------------"
<< endl;
33
os <<
"vertexid: "
<<
get_id
() << endl;
34
35
os <<
" t = "
<<
get_t
() << endl;
36
37
os <<
" (x,y,z) = ("
<<
get_position
(0);
38
os <<
", "
<<
get_position
(1) <<
", "
;
39
os <<
get_position
(2) <<
") cm"
<< endl;
40
41
os <<
" chisq = "
<<
get_chisq
() <<
", "
;
42
os <<
" ndof = "
<<
get_ndof
() << endl;
43
44
os <<
" ( "
;
45
os <<
get_error
(0, 0) <<
" , "
;
46
os <<
get_error
(0, 1) <<
" , "
;
47
os <<
get_error
(0, 2) <<
" )"
<< endl;
48
os <<
" err = ( "
;
49
os <<
get_error
(1, 0) <<
" , "
;
50
os <<
get_error
(1, 1) <<
" , "
;
51
os <<
get_error
(1, 2) <<
" )"
<< endl;
52
os <<
" ( "
;
53
os <<
get_error
(2, 0) <<
" , "
;
54
os <<
get_error
(2, 1) <<
" , "
;
55
os <<
get_error
(2, 2) <<
" )"
<< endl;
56
57
os <<
" list of vtx ids: "
<< endl;
58
for
(
ConstVtxIter
iter =
begin_vtxids
(); iter !=
end_vtxids
(); ++iter)
59
{
60
os <<
" "
<< iter->first <<
" => "
<< iter->second << endl;
61
}
62
os <<
"-----------------------------------------------"
<< endl;
63
64
return
;
65
}
66
67
int
GlobalVertexv1::isValid
()
const
68
{
69
if
(
_id
== 0xFFFFFFFF)
return
0;
70
if
(isnan(
_t
))
return
0;
71
if
(isnan(
_t_err
))
return
0;
72
if
(isnan(
_chisq
))
return
0;
73
if
(
_ndof
== 0xFFFFFFFF)
return
0;
74
75
for
(
int
i = 0; i < 3; ++i)
76
{
77
if
(isnan(
_pos
[i]))
return
0;
78
}
79
for
(
int
j = 0; j < 3; ++j)
80
{
81
for
(
int
i = j; i < 3; ++i)
82
{
83
if
(isnan(
get_error
(i, j)))
return
0;
84
}
85
}
86
if
(
_vtx_ids
.empty())
return
0;
87
return
1;
88
}
89
90
void
GlobalVertexv1::set_error
(
unsigned
int
i,
unsigned
int
j,
float
value
)
91
{
92
_err
[
covar_index
(i, j)] =
value
;
93
return
;
94
}
95
96
float
GlobalVertexv1::get_error
(
unsigned
int
i,
unsigned
int
j)
const
97
{
98
return
_err
[
covar_index
(i, j)];
99
}
100
101
unsigned
int
GlobalVertexv1::covar_index
(
unsigned
int
i,
unsigned
int
j)
const
102
{
103
if
(i > j)
std::swap
(i, j);
104
return
i + 1 + (j + 1) * (j) / 2 - 1;
105
}
coresoftware
blob
master
simulation
g4simulation
g4vertex
GlobalVertexv1.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:24:45
using
1.8.2 with
ECCE GitHub integration