CbmRoot
Loading...
Searching...
No Matches
CbmTrackingDetectorInterfaceBase.h
Go to the documentation of this file.
1/* Copyright (C) 2022-2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov, Sergei Zharko [committer] */
4
5/***************************************************************************************************
6 * @file CbmTrackingDetectorInterfaceBase.h
7 * @brief Base abstract class for tracking detector interface to L1
8 * @since 31.05.2022
9 * @author S.Zharko <s.zharko@gsi.de>
10 ***************************************************************************************************/
11
12#ifndef CbmTrackingDetectorInterfaceBase_h
13#define CbmTrackingDetectorInterfaceBase_h 1
14
15#include "CbmHit.h"
16#include "CbmPixelHit.h"
17#include "FairMCPoint.h"
18
19#include <array>
20#include <cmath>
21#include <string>
22#include <tuple>
23#include <unordered_map>
24#include <utility>
25#include <vector>
26
27class TGeoNode;
28class TString;
29
34 public:
37 struct VolumeInfo {
38 double fXmin{+std::numeric_limits<double>::max()};
39 double fXmax{-std::numeric_limits<double>::max()};
40 double fYmin{+std::numeric_limits<double>::max()};
41 double fYmax{-std::numeric_limits<double>::max()};
42 double fZmin{+std::numeric_limits<double>::max()};
43 double fZmax{-std::numeric_limits<double>::max()};
44
46 VolumeInfo(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
47 : fXmin(xMin)
48 , fXmax(xMax)
49 , fYmin(yMin)
50 , fYmax(yMax)
51 , fZmin(zMin)
52 , fZmax(zMax)
53 {
54 }
55
57 VolumeInfo() = default;
58 //VolumeInfo(const VolumeInfo&) = default;
59 //VolumeInfo(VolumeInfo&&) = default;
60 //VolumeInfo& operator=(const VolumeInfo&) = default;
61 //VolumeInfo& operator=(VolumeInfo&&) = default;
62
65 {
66 fXmin = std::min(fXmin, other.fXmin);
67 fXmax = std::max(fXmax, other.fXmax);
68 fYmin = std::min(fYmin, other.fYmin);
69 fYmax = std::max(fYmax, other.fYmax);
70 fZmin = std::min(fZmin, other.fZmin);
71 fZmax = std::max(fZmax, other.fZmax);
72 return *this;
73 }
74
76 std::string ToString() const;
77 };
78
79 public:
82
84 bool Check() const;
85
87 virtual std::string GetDetectorName() const = 0;
88
90 int GetNtrackingStations() const { return fvStationFullVolume.size(); }
91
96 virtual std::tuple<double, double> GetStereoAnglesSensor(int address) const = 0;
97
101 virtual int GetTrackingStationIndex(const CbmHit* hit) const = 0;
102
106 virtual int GetTrackingStationIndex(const FairMCPoint* point) const = 0;
107
111 virtual int GetTrackingStationIndex(int address) const = 0;
112
116 double GetXmax(int stationId) const { return fvStationFullVolume[stationId].fXmax; }
117
121 double GetXmin(int stationId) const { return fvStationFullVolume[stationId].fXmin; }
122
126 double GetYmax(int stationId) const { return fvStationFullVolume[stationId].fYmax; }
127
131 double GetYmin(int stationId) const { return fvStationFullVolume[stationId].fYmin; }
132
136 double GetZref(int stationId) const { return 0.5 * (GetActiveZmin(stationId) + GetActiveZmax(stationId)); }
137
141 virtual double GetZrefModule(int address) { return GetZref(GetTrackingStationIndex(address)); }
142
146 double GetZmin(int stationId) const { return fvStationFullVolume[stationId].fZmin; }
147
151 double GetZmax(int stationId) const { return fvStationFullVolume[stationId].fZmax; }
152
156 double GetActiveXmin(int stationId) const { return fvStationActiveVolume[stationId].fXmin; }
157
161 double GetActiveXmax(int stationId) const { return fvStationActiveVolume[stationId].fXmax; }
162
166 double GetActiveYmin(int stationId) const { return fvStationActiveVolume[stationId].fYmin; }
167
171 double GetActiveYmax(int stationId) const { return fvStationActiveVolume[stationId].fYmax; }
172
176 double GetActiveZmin(int stationId) const { return fvStationActiveVolume[stationId].fZmin; }
177
181 double GetActiveZmax(int stationId) const { return fvStationActiveVolume[stationId].fZmax; }
182
186 virtual bool IsTimeInfoProvided(int stationId) const = 0;
187
191 virtual std::tuple<double, double, double> GetHitRanges(const CbmPixelHit& hit) const
192 {
193 // by default assume gaussian distributions of errors
194 return std::tuple(3.5 * hit.GetDx(), 3.5 * hit.GetDy(), 3.5 * hit.GetTimeError());
195 }
196
200 static constexpr bool kUseDynamicCast{true};
201
203 std::string ToString() const;
204
205 protected:
208 static constexpr bool kLegacy{false};
209
216 std::vector<TString> CollectNodes(const TString& detector, const TString& component, const TString& path,
217 TGeoNode* pNode);
218
222 VolumeInfo ReadVolume(const TString& path);
223
224 // NOTE: SZh 10.09.2024: For now the passive and active volumes destinguish in TRD and TOF only. For STS
225 // the z-components are active, and the x- and y-components are passive. For
226 // MVD and MuCh the components are legacy (active? taken from digitizers).
227 std::vector<VolumeInfo> fvStationFullVolume{};
228 std::vector<VolumeInfo> fvStationActiveVolume{};
229};
230
231#endif // CbmTrackingDetectorInterfaceBase_h
double GetTimeError() const
Definition CbmHit.h:77
double GetDy() const
Definition CbmPixelHit.h:76
double GetDx() const
Definition CbmPixelHit.h:75
Abstract class, which should be inherited by every detecting subsystem tracking interface class.
double GetYmin(int stationId) const
Gets lower bound of a station passive volume along the Y-axis.
int GetNtrackingStations() const
Gets actual number of stations, provided by the current geometry setup.
virtual int GetTrackingStationIndex(const CbmHit *hit) const =0
Gets a tracking station of a CbmHit.
virtual int GetTrackingStationIndex(int address) const =0
Gets a tracking station by the address of element.
double GetZref(int stationId) const
Gets reference z of the station passive volume.
std::vector< VolumeInfo > fvStationFullVolume
Geometric properties of each station passive volume.
virtual std::string GetDetectorName() const =0
Returns the name of the detector subsystem.
double GetActiveXmin(int stationId) const
Gets lower bound of the station active volume along x-axis.
double GetActiveZmax(int stationId) const
Gets upper bound of the station active volume along z-axis.
std::string ToString() const
Prints all the parameters into table and saves the table as a string.
double GetActiveYmax(int stationId) const
Gets upper bound of the station active volume along y-axis.
double GetZmax(int stationId) const
Gets max z of the station passive volume.
virtual bool IsTimeInfoProvided(int stationId) const =0
Check if station provides time measurements.
VolumeInfo ReadVolume(const TString &path)
Creates volume info from a geo node provided by path.
std::vector< VolumeInfo > fvStationActiveVolume
Geometric properties of each station active volume.
std::vector< TString > CollectNodes(const TString &detector, const TString &component, const TString &path, TGeoNode *pNode)
Collects paths of the components.
double GetActiveYmin(int stationId) const
Gets lower bound of the station active volume along y-axis.
double GetXmin(int stationId) const
Gets lower bound of a station passive volume along the X-axis.
virtual double GetZrefModule(int address)
Gets reference z of the detector module (e.g., RPC for TOF)
double GetYmax(int stationId) const
Gets upper bound of a station passive volume along the Y-axis.
double GetXmax(int stationId) const
Gets upper bound of a station passive volume along the X-axis.
virtual ~CbmTrackingDetectorInterfaceBase()
Virtual destructor.
virtual std::tuple< double, double > GetStereoAnglesSensor(int address) const =0
Gets stereo angles of the two independent measured coordinates.
double GetActiveZmin(int stationId) const
Gets lower bound of the station active volume along z-axis.
bool Check() const
Checks detector interface: boundary conditions of the parameters.
virtual int GetTrackingStationIndex(const FairMCPoint *point) const =0
Gets a tracking station of a FairMCPoint.
static constexpr bool kLegacy
If use legacy tracking detector interface definition FIXME: Remove after testing.
virtual std::tuple< double, double, double > GetHitRanges(const CbmPixelHit &hit) const
Gets x,y,t ranges of a CbmPixelHit.
double GetActiveXmax(int stationId) const
Gets upper bound of the station active volume along x-axis.
double GetZmin(int stationId) const
Gets min z of the station passive volume.
Structure to store geometry information of each station.
VolumeInfo & operator+=(const VolumeInfo &other)
Compound assingment of another volume.
VolumeInfo(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
Constructor from parameters.
std::string ToString() const
String representation of the structure.