CbmRoot
Loading...
Searching...
No Matches
CbmStsPoint.cxx
Go to the documentation of this file.
1
/* Copyright (C) 2004-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2
SPDX-License-Identifier: GPL-3.0-only
3
Authors: Volker Friese, Florian Uhlig, Denis Bertini [committer] */
4
5
// -------------------------------------------------------------------------
6
// ----- CbmStsPoint source file -----
7
// ----- Created 26/07/04 by V. Friese -----
8
// -------------------------------------------------------------------------
9
10
#include "
CbmStsPoint.h
"
11
12
#include "
CbmDefs.h
"
// for kMCTrack
13
14
#include <FairLink.h>
// for FairLink
15
#include <FairMCPoint.h>
// for FairMCPoint
16
17
#include <sstream>
// for operator<<, basic_ostream, endl, stri...
18
#include <string>
// for char_traits
19
20
#include <cmath>
21
22
using
std::endl;
23
using
std::string;
24
using
std::stringstream;
25
26
// ----- Default constructor -------------------------------------------
27
CbmStsPoint::CbmStsPoint
()
28
: FairMCPoint()
29
,
fX_out
(0.)
30
,
fY_out
(0.)
31
,
fZ_out
(0.)
32
,
fPx_out
(0.)
33
,
fPy_out
(0.)
34
,
fPz_out
(0.)
35
,
fPid
(0)
36
,
fIndex
(0)
37
,
fFlag
(0)
38
{
39
}
40
// -------------------------------------------------------------------------
41
42
43
// ----- Standard constructor ------------------------------------------
44
CbmStsPoint::CbmStsPoint
(int32_t trackID, int32_t detID, TVector3 posIn, TVector3 posOut, TVector3 momIn,
45
TVector3 momOut,
double
tof,
double
length,
double
eLoss, int32_t pid, int32_t eventId,
46
int32_t index, int16_t flag)
47
: FairMCPoint(trackID, detID, posIn, momIn, tof, length, eLoss, eventId)
48
,
fX_out
(posOut.X())
49
,
fY_out
(posOut.Y())
50
,
fZ_out
(posOut.Z())
51
,
fPx_out
(momOut.Px())
52
,
fPy_out
(momOut.Py())
53
,
fPz_out
(momOut.Pz())
54
,
fPid
(pid)
55
,
fIndex
(index)
56
,
fFlag
(flag)
57
{
58
SetLink(FairLink(
ToIntegralType
(
ECbmDataType::kMCTrack
), trackID));
59
}
60
// -------------------------------------------------------------------------
61
62
63
// ----- Destructor ----------------------------------------------------
64
CbmStsPoint::~CbmStsPoint
() {}
65
// -------------------------------------------------------------------------
66
67
68
// ----- Copy constructor with event and epoch time --------------------
69
CbmStsPoint::CbmStsPoint
(
const
CbmStsPoint
& point, int32_t eventId,
double
eventTime,
double
epochTime)
70
: FairMCPoint(point)
71
,
fX_out
(point.
fX_out
)
72
,
fY_out
(point.
fY_out
)
73
,
fZ_out
(point.
fZ_out
)
74
,
fPx_out
(point.
fPx_out
)
75
,
fPy_out
(point.
fPy_out
)
76
,
fPz_out
(point.
fPz_out
)
77
,
fPid
(point.
fPid
)
78
,
fIndex
(point.
fIndex
)
79
,
fFlag
(point.
fFlag
)
80
81
{
82
// *this = point;
83
if
(eventId > 0) fEventId = eventId;
84
fTime = point.GetTime() + eventTime - epochTime;
85
}
86
// -------------------------------------------------------------------------
87
88
89
// ----- Point x coordinate from linear extrapolation ------------------
90
double
CbmStsPoint::GetX
(
double
z)
const
91
{
92
// LOG(info) << fZ << " " << z << " " << fZ_out;
93
double
dz =
fZ_out
- fZ;
94
if
(fabs(dz) < 1.e-4)
return
0.5 * (
fX_out
+ fX);
95
return
(fX + (z - fZ) / dz * (
fX_out
- fX));
96
}
97
// -------------------------------------------------------------------------
98
99
100
// ----- Point y coordinate from linear extrapolation ------------------
101
double
CbmStsPoint::GetY
(
double
z)
const
102
{
103
double
dz =
fZ_out
- fZ;
104
if
(fabs(dz) < 1.e-4)
return
0.5 * (
fY_out
+ fY);
105
return
(fY + (z - fZ) / dz * (
fY_out
- fY));
106
}
107
// -------------------------------------------------------------------------
108
109
110
// ----- Public method IsUsable ----------------------------------------
111
bool
CbmStsPoint::IsUsable
()
const
112
{
113
double
dz =
fZ_out
- fZ;
114
if
(abs(dz) < 1.e-4)
return
false
;
115
return
true
;
116
}
117
// -------------------------------------------------------------------------
118
119
120
// ----- String output -------------------------------------------------
121
string
CbmStsPoint::ToString
()
const
122
{
123
stringstream ss;
124
ss <<
"StsPoint: track ID "
<< fTrackID <<
", detector ID "
<< fDetectorID << endl;
125
ss <<
" IN Position ("
<< fX <<
", "
<< fY <<
", "
<< fZ <<
") cm"
<< endl;
126
ss <<
" OUT Position ("
<<
fX_out
<<
", "
<<
fY_out
<<
", "
<<
fZ_out
<<
") cm"
<< endl;
127
ss <<
" Momentum ("
<< fPx <<
", "
<< fPy <<
", "
<< fPz <<
") GeV"
<< endl;
128
ss <<
" Time "
<< fTime <<
" ns, Length "
<< fLength <<
" cm, Energy loss "
<< fELoss * 1.0e06 <<
" keV"
<< endl;
129
return
ss.str();
130
}
131
// -------------------------------------------------------------------------
132
133
134
ClassImp
(
CbmStsPoint
)
ClassImp
ClassImp(CbmConverterManager)
CbmDefs.h
ToIntegralType
XPU_D constexpr auto ToIntegralType(T enumerator) -> typename std::underlying_type< T >::type
Converts an element of enum class to its underlying integral type.
Definition
CbmDefs.h:33
ECbmDataType::kMCTrack
@ kMCTrack
Definition
CbmDefs.h:124
CbmStsPoint.h
CbmStsPoint
Definition
CbmStsPoint.h:32
CbmStsPoint::fPy_out
Double32_t fPy_out
Definition
CbmStsPoint.h:117
CbmStsPoint::IsUsable
bool IsUsable() const
Definition
CbmStsPoint.cxx:111
CbmStsPoint::fIndex
int32_t fIndex
Definition
CbmStsPoint.h:119
CbmStsPoint::fPz_out
Double32_t fPz_out
Definition
CbmStsPoint.h:117
CbmStsPoint::fPid
int32_t fPid
Definition
CbmStsPoint.h:118
CbmStsPoint::fFlag
int16_t fFlag
Definition
CbmStsPoint.h:120
CbmStsPoint::GetX
double GetX(double z) const
Definition
CbmStsPoint.cxx:90
CbmStsPoint::~CbmStsPoint
virtual ~CbmStsPoint()
Definition
CbmStsPoint.cxx:64
CbmStsPoint::fX_out
Double32_t fX_out
Definition
CbmStsPoint.h:116
CbmStsPoint::GetY
double GetY(double z) const
Definition
CbmStsPoint.cxx:101
CbmStsPoint::ToString
std::string ToString() const
Definition
CbmStsPoint.cxx:121
CbmStsPoint::fZ_out
Double32_t fZ_out
Definition
CbmStsPoint.h:116
CbmStsPoint::fY_out
Double32_t fY_out
Definition
CbmStsPoint.h:116
CbmStsPoint::fPx_out
Double32_t fPx_out
Definition
CbmStsPoint.h:117
CbmStsPoint::CbmStsPoint
CbmStsPoint()
Definition
CbmStsPoint.cxx:27
core
data
sts
CbmStsPoint.cxx
Generated on Fri Jan 30 2026 23:05:23 for CbmRoot by
1.13.2