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