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