CbmRoot
Loading...
Searching...
No Matches
CaToolsHitRecord.cxx
Go to the documentation of this file.
1/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#include "CaToolsHitRecord.h"
11
12#include "Logger.h"
13
14#include <cmath>
15#include <sstream>
16
18
19// ---------------------------------------------------------------------------------------------------------------------
20//
22{
23 if constexpr (kVerboseAccept) {
24 std::stringstream msg;
25 if (std::isnan(fX) || std::isinf(fX)) {
26 msg << ", x = " << fX;
27 }
28 if (std::isnan(fY) || std::isinf(fY)) {
29 msg << ", y = " << fY;
30 }
31 if (std::isnan(fZ) || std::isinf(fZ)) {
32 msg << ", z = " << fZ;
33 }
34 if (std::isnan(fT) || std::isinf(fT)) {
35 msg << ", t = " << fT;
36 }
37 if (std::isnan(fDx2) || std::isinf(fDx2)) {
38 msg << ", dx2 = " << fDx2;
39 }
40 if (std::isnan(fDy2) || std::isinf(fDy2)) {
41 msg << ", dy2 = " << fDy2;
42 }
43 if (std::isnan(fDxy) || std::isinf(fDxy)) {
44 msg << ", dxy = " << fDxy;
45 }
46 if (std::isnan(fDt2) || std::isinf(fDt2)) {
47 msg << ", dt2 = " << fDt2;
48 }
49 const auto& sMsg = msg.str();
50 if (sMsg.size()) {
51 LOG(warn) << "HitRecord: Discarding hit " << fExtId << ": det = " << fDet
52 << ", addr = " << static_cast<int32_t>(fDataStream) << ", " << sMsg;
53 return false;
54 }
55 }
56 else {
57 bool res = true;
58 res = res && !(std::isnan(fX) || std::isinf(fX));
59 res = res && !(std::isnan(fY) || std::isinf(fY));
60 res = res && !(std::isnan(fZ) || std::isinf(fZ));
61 res = res && !(std::isnan(fT) || std::isinf(fT));
62 res = res && !(std::isnan(fDx2) || std::isinf(fDx2));
63 res = res && !(std::isnan(fDy2) || std::isinf(fDy2));
64 res = res && !(std::isnan(fDt2) || std::isinf(fDt2));
65 res = res && !(std::isnan(fDxy) || std::isinf(fDxy));
66 return res;
67 }
68 return true;
69}
70
71// ---------------------------------------------------------------------------------------------------------------------
72//
73std::string HitRecord::ToString() const
74{
75 std::stringstream msg;
76 msg << "HitRecord: det = " << fDet << ", addr = " << static_cast<int32_t>(fDataStream) << ", extId = " << fExtId
77 << ", staId = " << fStaId << ", pointId = " << fPointId << ", stripF = " << fStripF << ", stripB = " << fStripB
78 << ", x = " << fX << ", y = " << fY << ", z = " << fZ << ", t = " << fT << ", dx2 = " << fDx2
79 << ", dy2 = " << fDy2 << ", dt2 = " << fDt2 << ", dxy = " << fDxy << ", rangeX = " << fRangeX
80 << ", rangeY = " << fRangeY << ", rangeT = " << fRangeT;
81 return msg.str();
82}
A helper structure to store hits information from different detectors in a uniform manner.
double fZ
z component of hit position [cm]
int fStaId
index of active tracking station
int64_t fDataStream
Global index of detector module.
double fRangeY
range of y [cm]
double fRangeX
range of x [cm]
double fDt2
time error of hit [ns]
int fStripF
index of front strip
int fPointId
index of MC point
double fDxy
correlation between x and y components [cm]
double fT
time of hit [ns]
std::string ToString() const
Converts hit record to a string.
int fStripB
index of back strip
static constexpr bool kVerboseAccept
Tests hit quality (for example, if all the quantities are not nan)
int fExtId
external index of hit
double fDy2
error of y component of hit position [cm]
double fX
x component of hit position [cm]
double fY
y component of hit position [cm]
double fRangeT
range of t [ns]
double fDx2
error of x component of hit position [cm]