CbmRoot
Loading...
Searching...
No Matches
CaMcHitInfo.h
Go to the documentation of this file.
1/* Copyright (C) 2010-2023 Frankfurt Institute for Advanced Studies, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Igor Kulakov [committer], Valentina Akishina, Maksym Zyzak, Sergei Zharko */
4
5#ifndef CaMcHitInfo_h
6#define CaMcHitInfo_h 1
7
8#include <cmath>
9#include <iomanip>
10#include <sstream>
11#include <string>
12#include <vector>
13
14namespace cbm::algo::ca
15{
16 // TODO: SZh: Complete the rule of five
17 // TODO: SZh: Make variables private
18 // TODO: SZh: Move class to ca::tools (ca::tools::Hit)
19
20
24 class McHitInfo { // TODO: SZh 21.09.2022: Replace instances of this class with ca::Hit
25 public:
32 // TODO: SZh 02.03.2023: Replace det. ID with L1DetectorID
33 int GetDetectorType() const { return Det; }
34
36 double GetR() const { return std::sqrt(x * x + y * y); }
37
39 int GetExternalHitId() const { return ExtIndex; }
40
42 int GetBestMcPointId() const { return fBestMcPointId; }
43
44 const std::vector<int>& GetMcPointIds() const { return fMcPointIds; }
45
47 int GetStationId() const { return iStation; }
48
50 double GetT() const { return time; }
51
53 double GetX() const { return x; }
54
56 double GetY() const { return y; }
57
59 double GetZ() const { return z; }
60
63 void SetBestMcPointId(int pointID) { fBestMcPointId = pointID; }
64
67 void AddMcPointId(int pointID) { fMcPointIds.push_back(pointID); }
68
72 std::string ToString(int verbose = 0, bool header = false) const
73 {
74 using std::setfill;
75 using std::setw;
76 std::stringstream msg;
77 msg.precision(4);
78 if (header) {
79 msg << setw(8) << setfill(' ') << "ext. ID" << ' ';
80 msg << setw(8) << setfill(' ') << "int. ID" << ' ';
81 msg << setw(8) << setfill(' ') << "st. ID" << ' ';
82 msg << setw(8) << setfill(' ') << "Det. ID" << ' ';
83 msg << setw(8) << setfill(' ') << "MC p. ID" << ' ';
84 msg << setw(14) << setfill(' ') << "x [cm]" << ' ';
85 msg << setw(14) << setfill(' ') << "y [cm]" << ' ';
86 msg << setw(14) << setfill(' ') << "z [cm]" << ' ';
87 msg << setw(14) << setfill(' ') << "time [ns]" << ' ';
88 if (verbose > 0) {
89 msg << setw(14) << setfill(' ') << "dx [cm]" << ' ';
90 msg << setw(14) << setfill(' ') << "dy [cm]" << ' ';
91 msg << setw(14) << setfill(' ') << "dxy [cm2]" << ' ';
92 msg << setw(14) << setfill(' ') << "dt [ns]" << ' ';
93 }
94 }
95 else {
96 msg << setw(8) << setfill(' ') << ExtIndex << ' ';
97 msg << setw(8) << setfill(' ') << IntIndex << ' ';
98 msg << setw(8) << setfill(' ') << iStation << ' ';
99 msg << setw(8) << setfill(' ') << Det << ' ';
100 msg << setw(8) << setfill(' ') << GetBestMcPointId() << ' ';
101 msg << setw(14) << setfill(' ') << x << ' ';
102 msg << setw(14) << setfill(' ') << y << ' ';
103 msg << setw(14) << setfill(' ') << z << ' ';
104 msg << setw(14) << setfill(' ') << time << ' ';
105 if (verbose > 0) {
106 msg << setw(14) << setfill(' ') << dx << ' ';
107 msg << setw(14) << setfill(' ') << dy << ' ';
108 msg << setw(14) << setfill(' ') << dxy << ' ';
109 msg << setw(14) << setfill(' ') << dt << ' ';
110 }
111 }
112 return msg.str();
113 }
114
115 // TODO: SZh 2.03.2023: make the variables private
119 int Det;
120 double x;
121 double y;
122 double z;
123 double time;
124 double dx;
125 double dy;
126 double dt;
127 double dxy;
129 std::vector<int> fMcPointIds{};
130 };
131
132} // namespace cbm::algo::ca
133
134#endif
double dy
y coordinate error [cm]
int Det
detector subsystem ID
double y
y coordinate of position [cm]
int GetExternalHitId() const
Gets index of the hit in the external container.
Definition CaMcHitInfo.h:39
double GetZ() const
Gets z component of position [cm].
Definition CaMcHitInfo.h:59
const std::vector< int > & GetMcPointIds() const
Definition CaMcHitInfo.h:44
int IntIndex
index of hit in the internal array
double GetT() const
Gets time measurement [ns].
Definition CaMcHitInfo.h:50
void AddMcPointId(int pointID)
Sets index of matched MC point.
Definition CaMcHitInfo.h:67
double dt
time error [ns]
double GetR() const
Gets distance from z-axis [cm].
Definition CaMcHitInfo.h:36
int fBestMcPointId
index of best matched MC point
int iStation
index of station in active stations array
double GetX() const
Gets x component of position [cm].
Definition CaMcHitInfo.h:53
double z
z coordinate of position [cm]
double dx
x coordinate error [cm]
double GetY() const
Gets y component of position [cm].
Definition CaMcHitInfo.h:56
double dxy
covariance between x and y [cm2]
std::vector< int > fMcPointIds
indices of all matched MC points
std::string ToString(int verbose=0, bool header=false) const
String representation of the object.
Definition CaMcHitInfo.h:72
int GetBestMcPointId() const
Gets index of matched MC point.
Definition CaMcHitInfo.h:42
int GetDetectorType() const
Gets detector type 0 - MVD 1 - STS 2 - MuCh 3 - TRD 4 - TOF.
Definition CaMcHitInfo.h:33
double x
x coordinate of position [cm]
int ExtIndex
index of hit in the external branch
int GetStationId() const
Gets global index of active tracking station.
Definition CaMcHitInfo.h:47
void SetBestMcPointId(int pointID)
Sets index of matched MC point.
Definition CaMcHitInfo.h:63
double time
hit time [ns]
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14