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
SvtxVertex_v1.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file SvtxVertex_v1.cc
1
#include "
SvtxVertex_v1.h
"
2
3
#include <cmath>
4
#include <utility>
// for swap
5
6
using namespace
std;
7
8
SvtxVertex_v1::SvtxVertex_v1
()
9
: _id(0xFFFFFFFF)
10
, _t0(NAN)
11
, _pos()
12
, _chisq(NAN)
13
, _ndof(0xFFFFFFFF)
14
, _err()
15
, _track_ids()
16
{
17
for
(
int
i
= 0;
i
< 3; ++
i
)
_pos
[
i
] = NAN;
18
for
(
int
j
= 0;
j
< 3; ++
j
)
19
{
20
for
(
int
i
=
j
;
i
< 3; ++
i
)
21
{
22
set_error
(
i
,
j
, NAN);
23
}
24
}
25
}
26
27
void
SvtxVertex_v1::identify
(ostream&
os
)
const
28
{
29
os <<
"---SvtxVertex_v1--------------------"
<< endl;
30
os <<
"vertexid: "
<<
get_id
() << endl;
31
32
os <<
" t0 = "
<<
get_t
() << endl;
33
34
os <<
" (x,y,z) = ("
<<
get_position
(0);
35
os <<
", "
<<
get_position
(1) <<
", "
;
36
os <<
get_position
(2) <<
") cm"
<< endl;
37
38
os <<
" chisq = "
<<
get_chisq
() <<
", "
;
39
os <<
" ndof = "
<<
get_ndof
() << endl;
40
41
os <<
" ( "
;
42
os <<
get_error
(0, 0) <<
" , "
;
43
os <<
get_error
(0, 1) <<
" , "
;
44
os <<
get_error
(0, 2) <<
" )"
<< endl;
45
os <<
" err = ( "
;
46
os <<
get_error
(1, 0) <<
" , "
;
47
os <<
get_error
(1, 1) <<
" , "
;
48
os <<
get_error
(1, 2) <<
" )"
<< endl;
49
os <<
" ( "
;
50
os <<
get_error
(2, 0) <<
" , "
;
51
os <<
get_error
(2, 1) <<
" , "
;
52
os <<
get_error
(2, 2) <<
" )"
<< endl;
53
54
os <<
" list of tracks ids: "
;
55
for
(
ConstTrackIter
iter =
begin_tracks
(); iter !=
end_tracks
(); ++iter)
56
{
57
os << *iter <<
" "
;
58
}
59
os << endl;
60
os <<
"-----------------------------------------------"
<< endl;
61
62
return
;
63
}
64
65
int
SvtxVertex_v1::isValid
()
const
66
{
67
if
(
_id
== 0xFFFFFFFF)
return
0;
68
if
(std::isnan(
_t0
))
return
0;
69
if
(std::isnan(
_chisq
))
return
0;
70
if
(
_ndof
== 0xFFFFFFFF)
return
0;
71
72
for
(
int
i
= 0;
i
< 3; ++
i
)
73
{
74
if
(std::isnan(
_pos
[
i
]))
return
0;
75
}
76
for
(
int
j
= 0;
j
< 3; ++
j
)
77
{
78
for
(
int
i
=
j
;
i
< 3; ++
i
)
79
{
80
if
(std::isnan(
get_error
(
i
,
j
)))
return
0;
81
}
82
}
83
if
(
_track_ids
.empty())
return
0;
84
return
1;
85
}
86
87
void
SvtxVertex_v1::set_error
(
unsigned
int
i
,
unsigned
int
j
,
float
value
)
88
{
89
_err
[
covar_index
(i, j)] =
value
;
90
return
;
91
}
92
93
float
SvtxVertex_v1::get_error
(
unsigned
int
i
,
unsigned
int
j
)
const
94
{
95
return
_err
[
covar_index
(i, j)];
96
}
97
98
unsigned
int
SvtxVertex_v1::covar_index
(
unsigned
int
i
,
unsigned
int
j
)
const
99
{
100
if
(i > j)
std::swap
(i, j);
101
return
i + 1 + (j + 1) * (j) / 2 - 1;
102
}
coresoftware
blob
master
offline
packages
globalvertex
SvtxVertex_v1.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:06
using
1.8.2 with
sPHENIX GitHub integration