CbmRoot
Loading...
Searching...
No Matches
CaQa.h
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#pragma once
11
12#include "CaEnumArray.h"
13#include "CaHit.h" // for HitIndex_t
14#include "CaTimesliceHeader.h"
15#include "CaVector.h"
16#include "QaData.h" // QA data
17
18namespace cbm::algo
19{
20 namespace qa
21 {
22 class H1D;
23 class H2D;
24 } // namespace qa
25 namespace ca
26 {
27 template<typename DataT>
28 class Parameters;
29 class InputData;
30 class Track;
31 } // namespace ca
32} // namespace cbm::algo
33
34namespace cbm::algo::ca
35{
39 class Qa {
41 enum class EHitSet
42 {
43 Input,
44 Used,
45 END
46 };
47
49 template<typename T>
51
54
55 public:
58 Qa(std::shared_ptr<HistogramSender> pSender) : fQaData("CA"), fpSender(pSender) {}
59
62 Qa() = default;
63
65 Qa(const Qa&) = delete;
66
68 Qa(Qa&&) = delete;
69
71 ~Qa() = default;
72
74 Qa& operator=(const Qa&) = delete;
75
77 Qa& operator=(Qa&&) = delete;
78
80 void Exec();
81
83 void Init();
84
88 bool CheckInit() const;
89
91 bool IsSenderDefined() const { return static_cast<bool>(fpSender.get()); }
92
95 void RegisterInputData(const InputData* pInputData) { fpInputData = pInputData; }
96
99 void RegisterTracks(const Vector<Track>* pvTracks) { fpvTracks = pvTracks; }
100
103 void RegisterRecoHitIndices(const Vector<HitIndex_t>* pvRecoHits) { fpvRecoHits = pvRecoHits; }
104
107 void RegisterParameters(const Parameters<fvec>* pParameters) { fpParameters = pParameters; }
108
109 private:
113 void FillHitDistributionsForHitSet(EHitSet hitSet, const ca::Hit& hit);
114
115 // parameters
116 static constexpr double kXYZMargin = 0.05;
117 static constexpr int knHitSets = 2;
118 static constexpr int knTrkParPoints = 2;
119 static constexpr int knStaMax = 16;
120 static constexpr bool kDebug = false;
121
122 double fMinHitTime = std::numeric_limits<double>::max();
123 double fMaxHitTime = std::numeric_limits<double>::lowest();
124
125 // utility
127
128 std::shared_ptr<HistogramSender> fpSender = nullptr;
130 const InputData* fpInputData = nullptr;
131 const Vector<Track>* fpvTracks = nullptr;
133
134 // Hit distributions
135 using OccupHistContainer_t = std::vector<HitSetArray_t<qa::H2D*>>;
139
140 std::vector<qa::Prof2D*> fvphHitUsageXY;
141
144
145 std::vector<HitSetArray_t<qa::H1D*>> fvphHitTime;
146
147 // Track distributions
148 std::array<qa::H1D*, knTrkParPoints> fvphTrkTheta = {{0}};
149 std::array<qa::H1D*, knTrkParPoints> fvphTrkPhi = {{0}};
150 std::array<qa::H1D*, knTrkParPoints> fvphTrkChi2Ndf = {{0}};
151 std::array<qa::H2D*, knTrkParPoints> fvphTrkPhiTheta = {{0}};
152
155 };
156} // namespace cbm::algo::ca
Implementation of cbm::algo::ca::EnumArray class.
A generic hit for the CA tracker (header)
A structure to keep all the common information on the timeslice coming from tracking.
CbmStsAlgoFindClusters::InputData InputData
Class of arrays, which can be accessed by an enum class entry as an index.
ca::Hit class describes a generic hit for the CA tracker
Definition CaHit.h:32
A container for all external parameters of the CA tracking algorithm.
std::vector< HitSetArray_t< qa::H2D * > > OccupHistContainer_t
Definition CaQa.h:135
void Exec()
QA execution function.
Definition CaQa.cxx:305
void RegisterParameters(const Parameters< fvec > *pParameters)
Registers tracking parameters object.
Definition CaQa.h:107
bool CheckInit() const
Check initialization.
Definition CaQa.cxx:30
std::vector< HitSetArray_t< qa::H1D * > > fvphHitTime
Time distribution of hits.
Definition CaQa.h:145
OccupHistContainer_t fvphHitOccupXY
hist: Hit occupancy in different stations in XY plane
Definition CaQa.h:136
Qa(std::shared_ptr< HistogramSender > pSender)
Default destructor.
Definition CaQa.h:58
const Vector< Track > * fpvTracks
Pointer to tracks vector.
Definition CaQa.h:131
static constexpr int knStaMax
Max number of stations (histogram binning)
Definition CaQa.h:119
std::array< qa::H1D *, knTrkParPoints > fvphTrkPhi
hist: phi at first/last hit
Definition CaQa.h:149
qa::Data fQaData
QA data.
Definition CaQa.h:126
void Init()
Initializes the QA.
Definition CaQa.cxx:54
void FillHitDistributionsForHitSet(EHitSet hitSet, const ca::Hit &hit)
Fills hit distributions.
Definition CaQa.cxx:384
static constexpr HitSetArray_t< EHitSet > kHitSets
Array of EHitSet entries for iteration.
Definition CaQa.h:53
HitSetArray_t< qa::H1D * > fvphHitBackKeyIndex
Indices of back hit keys.
Definition CaQa.h:143
std::vector< qa::Prof2D * > fvphHitUsageXY
prof: Hit usage in different stations in XY plane
Definition CaQa.h:140
bool IsSenderDefined() const
Checks, if the histogram sender is defined.
Definition CaQa.h:91
static constexpr double kXYZMargin
Margin for occupancy distributions in XY plane.
Definition CaQa.h:116
double fMinHitTime
Definition CaQa.h:122
HitSetArray_t< qa::H1D * > fvphHitFrontKeyIndex
Indices of front hit keys.
Definition CaQa.h:142
Qa(const Qa &)=delete
Copy constructor.
static constexpr int knTrkParPoints
Number of track points to build par distributions.
Definition CaQa.h:118
Qa & operator=(Qa &&)=delete
Move assignment operator.
const Vector< HitIndex_t > * fpvRecoHits
Pointer to reco hit indices.
Definition CaQa.h:132
qa::H1D * fphTrkNofHits
hist: number of hits in track
Definition CaQa.h:154
static constexpr int knHitSets
Number of hit sets: input/used.
Definition CaQa.h:117
OccupHistContainer_t fvphHitOccupZX
hist: Hit occupancy in different stations in ZX plane
Definition CaQa.h:137
qa::H2D * fphTrkFstLstSta
hist: fst vs lst station index
Definition CaQa.h:153
Qa()=default
Constructor from the configuration object.
Qa(Qa &&)=delete
Move constructor.
double fMaxHitTime
Definition CaQa.h:123
const InputData * fpInputData
Pointer to input data.
Definition CaQa.h:130
~Qa()=default
Destructor.
static constexpr bool kDebug
Additional histograms.
Definition CaQa.h:120
Qa & operator=(const Qa &)=delete
Copy assignment operator.
void RegisterRecoHitIndices(const Vector< HitIndex_t > *pvRecoHits)
Registers reco hits indices vector.
Definition CaQa.h:103
OccupHistContainer_t fvphHitOccupZY
hist: Hit occupancy in different stations in ZY plane
Definition CaQa.h:138
std::array< qa::H1D *, knTrkParPoints > fvphTrkChi2Ndf
hist: chi2/NDF at first/last hit
Definition CaQa.h:150
std::array< qa::H2D *, knTrkParPoints > fvphTrkPhiTheta
hist: theta vs. phi at first/last hit
Definition CaQa.h:151
std::array< qa::H1D *, knTrkParPoints > fvphTrkTheta
hist: theta at first/last hit
Definition CaQa.h:148
void RegisterInputData(const InputData *pInputData)
Registers tracking input data object.
Definition CaQa.h:95
std::shared_ptr< HistogramSender > fpSender
Histogram sender.
Definition CaQa.h:128
const Parameters< fvec > * fpParameters
Pointer to tracking parameters.
Definition CaQa.h:129
EHitSet
Hit set entries.
Definition CaQa.h:42
@ Used
Hits used in tracks.
void RegisterTracks(const Vector< Track > *pvTracks)
Registers track vector.
Definition CaQa.h:99
Class to handle QA-objects in the online reconstruction.
Definition QaData.h:28
1D-histogram
2D-histogram
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14