CbmRoot
Loading...
Searching...
No Matches
CbmL1Hit.h
Go to the documentation of this file.
1/* Copyright (C) 2010-2023 Frankfurt Institute for Advanced Studies, Goethe-Universität Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Igor Kulakov [committer], Valentina Akishina, Maksym Zyzak, Sergei Zharko */
4
5#ifndef _CbmL1Hit_h_
6#define _CbmL1Hit_h_
7
8#include <cmath>
9#include <iomanip>
10#include <sstream>
11#include <string>
12#include <vector>
13
14// TODO: SZh: Complete the rule of five
15// TODO: SZh: Make variables private
16// TODO: SZh: Move class to ca::tools (ca::tools::Hit)
17
22 public:
23 CbmL1HitId() = default;
24 CbmL1HitId(int det, int index) : detId(det), hitId(index){};
25
28 std::string ToString(bool header = false) const
29 {
30 std::stringstream msg;
31 if (header) {
32 msg << std::setw(8) << std::setfill(' ') << "det. id" << ' ';
33 msg << std::setw(8) << std::setfill(' ') << "ext. id";
34 }
35 else {
36 msg << std::setw(8) << std::setfill(' ') << detId << ' ';
37 msg << std::setw(8) << std::setfill(' ') << hitId;
38 }
39 return msg.str();
40 }
41
42 int detId = -1;
43 int hitId = -1;
44};
45
46
50class CbmL1HitDebugInfo { // TODO: SZh 21.09.2022: Replace instances of this class with ca::Hit
51 public:
58 // TODO: SZh 02.03.2023: Replace det. ID with L1DetectorID
59 int GetDetectorType() const { return Det; }
60
62 double GetR() const { return std::sqrt(x * x + y * y); }
63
65 int GetExternalHitId() const { return ExtIndex; }
66
68 int GetBestMcPointId() const { return fBestMcPointId; }
69
70 const std::vector<int>& GetMcPointIds() const { return fMcPointIds; }
71
73 int GetStationId() const { return iStation; }
74
76 double GetT() const { return time; }
77
79 double GetX() const { return x; }
80
82 double GetY() const { return y; }
83
85 double GetZ() const { return z; }
86
89 void SetBestMcPointId(int pointID) { fBestMcPointId = pointID; }
90
93 void AddMcPointId(int pointID) { fMcPointIds.push_back(pointID); }
94
98 std::string ToString(int verbose = 0, bool header = false) const
99 {
100 using std::setfill;
101 using std::setw;
102 std::stringstream msg;
103 msg.precision(4);
104 if (header) {
105 msg << setw(8) << setfill(' ') << "ext. ID" << ' ';
106 msg << setw(8) << setfill(' ') << "int. ID" << ' ';
107 msg << setw(8) << setfill(' ') << "st. ID" << ' ';
108 msg << setw(8) << setfill(' ') << "Det. ID" << ' ';
109 msg << setw(8) << setfill(' ') << "MC p. ID" << ' ';
110 msg << setw(14) << setfill(' ') << "x [cm]" << ' ';
111 msg << setw(14) << setfill(' ') << "y [cm]" << ' ';
112 msg << setw(14) << setfill(' ') << "z [cm]" << ' ';
113 msg << setw(14) << setfill(' ') << "time [ns]" << ' ';
114 if (verbose > 0) {
115 msg << setw(14) << setfill(' ') << "dx [cm]" << ' ';
116 msg << setw(14) << setfill(' ') << "dy [cm]" << ' ';
117 msg << setw(14) << setfill(' ') << "dxy [cm2]" << ' ';
118 msg << setw(14) << setfill(' ') << "dt [ns]" << ' ';
119 }
120 }
121 else {
122 msg << setw(8) << setfill(' ') << ExtIndex << ' ';
123 msg << setw(8) << setfill(' ') << IntIndex << ' ';
124 msg << setw(8) << setfill(' ') << iStation << ' ';
125 msg << setw(8) << setfill(' ') << Det << ' ';
126 msg << setw(8) << setfill(' ') << GetBestMcPointId() << ' ';
127 msg << setw(14) << setfill(' ') << x << ' ';
128 msg << setw(14) << setfill(' ') << y << ' ';
129 msg << setw(14) << setfill(' ') << z << ' ';
130 msg << setw(14) << setfill(' ') << time << ' ';
131 if (verbose > 0) {
132 msg << setw(14) << setfill(' ') << dx << ' ';
133 msg << setw(14) << setfill(' ') << dy << ' ';
134 msg << setw(14) << setfill(' ') << dxy << ' ';
135 msg << setw(14) << setfill(' ') << dt << ' ';
136 }
137 }
138 return msg.str();
139 }
140
141 // TODO: SZh 2.03.2023: make the variables private
145 int Det;
146 double x;
147 double y;
148 double z;
149 double time;
150 double dx;
151 double dy;
152 double dt;
153 double dxy;
155 std::vector<int> fMcPointIds{};
156};
157
158#endif
int GetBestMcPointId() const
Gets index of matched MC point.
Definition CbmL1Hit.h:68
int ExtIndex
index of hit in the external branch
Definition CbmL1Hit.h:142
double GetZ() const
Gets z component of position [cm].
Definition CbmL1Hit.h:85
int Det
detector subsystem ID
Definition CbmL1Hit.h:145
double dy
y coordinate error [cm]
Definition CbmL1Hit.h:151
void SetBestMcPointId(int pointID)
Sets index of matched MC point.
Definition CbmL1Hit.h:89
double y
y coordinate of position [cm]
Definition CbmL1Hit.h:147
int IntIndex
index of hit in the internal array
Definition CbmL1Hit.h:143
double GetT() const
Gets time measurement [ns].
Definition CbmL1Hit.h:76
int iStation
index of station in active stations array
Definition CbmL1Hit.h:144
int GetStationId() const
Gets global index of active tracking station.
Definition CbmL1Hit.h:73
double time
hit time [ns]
Definition CbmL1Hit.h:149
int fBestMcPointId
index of best matched MC point
Definition CbmL1Hit.h:154
double dx
x coordinate error [cm]
Definition CbmL1Hit.h:150
double dxy
covariance between x and y [cm2]
Definition CbmL1Hit.h:153
double GetX() const
Gets x component of position [cm].
Definition CbmL1Hit.h:79
double z
z coordinate of position [cm]
Definition CbmL1Hit.h:148
double GetR() const
Gets distance from z-axis [cm].
Definition CbmL1Hit.h:62
std::vector< int > fMcPointIds
indices of all matched MC points
Definition CbmL1Hit.h:155
double x
x coordinate of position [cm]
Definition CbmL1Hit.h:146
int GetExternalHitId() const
Gets index of the hit in the external container.
Definition CbmL1Hit.h:65
std::string ToString(int verbose=0, bool header=false) const
String representation of the object.
Definition CbmL1Hit.h:98
double GetY() const
Gets y component of position [cm].
Definition CbmL1Hit.h:82
void AddMcPointId(int pointID)
Sets index of matched MC point.
Definition CbmL1Hit.h:93
int GetDetectorType() const
Gets detector type 0 - MVD 1 - STS 2 - MuCh 3 - TRD 4 - TOF.
Definition CbmL1Hit.h:59
double dt
time error [ns]
Definition CbmL1Hit.h:152
const std::vector< int > & GetMcPointIds() const
Definition CbmL1Hit.h:70
CbmL1HitId(int det, int index)
Definition CbmL1Hit.h:24
int detId
detector ID
Definition CbmL1Hit.h:42
CbmL1HitId()=default
std::string ToString(bool header=false) const
String representation of class object.
Definition CbmL1Hit.h:28
int hitId
index of hit in the TClonesArray array
Definition CbmL1Hit.h:43