BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
CbmVertex.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- CbmVertex source file -----
3
// ----- Created 28/11/05 by V. Friese -----
4
// -------------------------------------------------------------------------
5
#include "
CbmVertex.h
"
6
7
#include <
TNamed.h
>
8
#include <iostream>
9
10
using
std::cout;
11
using
std::endl;
12
13
// ----- Default constructor -------------------------------------------
14
15
CbmVertex::CbmVertex
()
16
:
TNamed
(
"Vertex"
,
"Global"
)
17
,
fX
(0.)
18
,
fY
(0.)
19
,
fZ
(0.)
20
,
fChi2
(0.)
21
,
fNDF
(0)
22
,
fNTracks
(0)
23
,
fCovMatrix
()
24
{
25
for
(
Int_t
i
= 0;
i
< 6;
i
++)
26
fCovMatrix
[
i
] = 0;
27
}
28
// -------------------------------------------------------------------------
29
30
// ----- Constructor with name and title -------------------------------
31
32
CbmVertex::CbmVertex
(
const
char
* name,
const
char
* title)
33
:
TNamed
(name, title)
34
,
fX
(0.)
35
,
fY
(0.)
36
,
fZ
(0.)
37
,
fChi2
(0.)
38
,
fNDF
(0)
39
,
fNTracks
(0)
40
,
fCovMatrix
()
41
{
42
for
(
Int_t
i
= 0;
i
< 6;
i
++)
43
fCovMatrix
[
i
] = 0;
44
}
45
// -------------------------------------------------------------------------
46
47
// ----- Constructor with all parameters -------------------------------
48
49
CbmVertex::CbmVertex
(
const
char
* name,
50
const
char
* title,
51
Double_t
x,
52
Double_t
y,
53
Double_t
z,
54
Double_t
chi2,
55
Int_t
ndf,
56
Int_t
nTracks,
57
const
TMatrixFSym
& covMat)
58
:
TNamed
(name, title)
59
,
fX
(x)
60
,
fY
(y)
61
,
fZ
(z)
62
,
fChi2
(chi2)
63
,
fNDF
(ndf)
64
,
fNTracks
(nTracks)
65
,
fCovMatrix
()
66
{
67
Int_t
index = 0;
68
for
(
Int_t
i
= 0;
i
< 3;
i
++) {
69
for
(
Int_t
j =
i
; j < 3; j++)
70
fCovMatrix
[index++] = covMat[
i
][j];
71
}
72
}
73
// -------------------------------------------------------------------------
74
75
// ----- Destructor ----------------------------------------------------
76
77
CbmVertex::~CbmVertex
() {}
78
// -------------------------------------------------------------------------
79
80
// ----- Public method Print -------------------------------------------
81
82
void
CbmVertex::Print
()
83
{
84
Double_t
chi2ndf;
85
if
(
fNDF
)
86
chi2ndf =
fChi2
/
Double_t
(
fNDF
);
87
else
88
chi2ndf = 0.;
89
90
// if(chi2ndf>0 && chi2ndf<2){
91
92
cout <<
"Vertex coord. ("
<<
fX
<<
","
<<
fY
<<
","
<<
fZ
<<
") cm, "
93
<<
"chi2/ndf = "
<< chi2ndf <<
", "
<<
fNTracks
<<
" tracks used"
<< endl;
94
//}
95
}
96
// -------------------------------------------------------------------------
97
98
// ----- Accessor to covariance matrix --------------------------------
99
100
void
CbmVertex::CovMatrix
(
TMatrixFSym
& covMat)
const
101
{
102
Int_t
index = 0;
103
for
(
int
i
= 0;
i
< 3;
i
++) {
104
for
(
int
j =
i
; j < 3; j++) {
105
covMat[
i
][j] =
fCovMatrix
[index];
106
covMat[j][
i
] =
fCovMatrix
[index];
107
index++;
108
}
109
}
110
}
111
// -------------------------------------------------------------------------
112
113
// ----- Accessor to covariance matrix elements ------------------------
114
115
Double_t
CbmVertex::GetCovariance
(
Int_t
i
,
Int_t
j)
const
116
{
117
TMatrixFSym
* mat =
new
TMatrixFSym
(3);
118
CovMatrix
(*mat);
119
Double_t
element = (*mat)[
i
][j];
120
delete
mat;
121
return
element;
122
}
123
// -------------------------------------------------------------------------
124
125
// ----- Public method SetVertex ---------------------------------------
126
127
void
CbmVertex::SetVertex
(
Double_t
x,
128
Double_t
y,
129
Double_t
z,
130
Double_t
chi2,
131
Int_t
ndf,
132
Int_t
nTracks,
133
const
TMatrixFSym
& covMat)
134
{
135
fX
= x;
136
fY
= y;
137
fZ
= z;
138
fChi2
= chi2;
139
fNDF
= ndf;
140
fNTracks
= nTracks;
141
Int_t
index = 0;
142
for
(
Int_t
i
= 0;
i
< 3;
i
++) {
143
for
(
Int_t
j =
i
; j < 3; j++)
144
fCovMatrix
[index++] = covMat[
i
][j];
145
}
146
}
147
// -------------------------------------------------------------------------
148
149
// ----- Public method Reset -------------------------------------------
150
151
void
CbmVertex::Reset
()
152
{
153
fX
=
fY
=
fZ
=
fChi2
= 0.;
154
fNDF
=
fNTracks
= 0;
155
for
(
Int_t
i
= 0;
i
< 6;
i
++)
156
fCovMatrix
[
i
] = 0;
157
}
158
// -------------------------------------------------------------------------
159
160
void
CbmVertex::CopyFrom
(
CbmVertex
*
v
)
161
{
162
TMatrixFSym
cm(3);
163
v
->CovMatrix(cm);
164
SetVertex
(
v
->GetX(),
v
->GetY(),
v
->GetZ(),
v
->GetChi2(),
v
->GetNDF(),
v
->GetNTracks(), cm);
165
// SetName(v->GetName());
166
SetTitle
(
v
->GetTitle());
167
}
168
169
/* void CbmVertex::Copy(CbmVertex * v) {
170
TNamed::Copy(v);
171
CovMatrix(v->GetCovMatrix());
172
173
174
v->SetVertex(
175
GetX(),
176
GetY(),
177
GetZ(),
178
GetChi2(),
179
GetNDF(),
180
GetNTracks(),
181
GetCovMatrix());
182
}
183
*/
v
__m128 v
Definition
P4_F32vec4.h:1
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
Double_t
double Double_t
TMatrixFSym
TMatrixTSym< Float_t > TMatrixFSym
TNamed.h
CbmVertex.h
CbmVertex::SetVertex
void SetVertex(Double_t x, Double_t y, Double_t z, Double_t chi2, Int_t ndf, Int_t nTracks, const TMatrixFSym &covMat)
Set the member variables.
Definition
CbmVertex.cxx:127
CbmVertex::fY
Double32_t fY
Definition
CbmVertex.h:106
CbmVertex::CopyFrom
void CopyFrom(CbmVertex *hdr)
Definition
CbmVertex.cxx:160
CbmVertex::CbmVertex
CbmVertex()
Default constructor.
Definition
CbmVertex.cxx:15
CbmVertex::fCovMatrix
Double32_t fCovMatrix[6]
Covariance matrix for x, y, and z stored in an array.
Definition
CbmVertex.h:120
CbmVertex::fNTracks
Int_t fNTracks
Number of tracks used for the vertex fit.
Definition
CbmVertex.h:115
CbmVertex::Reset
void Reset()
Reset the member variables.
Definition
CbmVertex.cxx:151
CbmVertex::Print
void Print()
Ouput to screen.
Definition
CbmVertex.cxx:82
CbmVertex::CovMatrix
void CovMatrix(TMatrixFSym &covMat) const
Definition
CbmVertex.cxx:100
CbmVertex::fZ
Double32_t fZ
Definition
CbmVertex.h:106
CbmVertex::fX
Double32_t fX
Position coordinates [cm].
Definition
CbmVertex.h:106
CbmVertex::~CbmVertex
virtual ~CbmVertex()
Destructor.
Definition
CbmVertex.cxx:77
CbmVertex::fChi2
Double32_t fChi2
Chi2 of vertex fit.
Definition
CbmVertex.h:109
CbmVertex::GetCovariance
Double_t GetCovariance(Int_t i, Int_t j) const
Definition
CbmVertex.cxx:115
CbmVertex::fNDF
Int_t fNDF
Number of degrees of freedom of vertex fit.
Definition
CbmVertex.h:112
TNamed::SetTitle
virtual void SetTitle(const char *title="")
TNamed::TNamed
TNamed()
base
cbm
CbmVertex.cxx
Generated on
for BmnRoot by
1.17.0