CbmRoot
Loading...
Searching...
No Matches
CbmCaTimeSliceReader.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 "CaDataManager.h"
13#include "CaDefs.h"
14#include "CaToolsHitRecord.h"
15#include "CaVector.h"
16#include "CbmCaMCModule.h"
17#include "CbmEvent.h"
18#include "CbmL1DetectorID.h"
19#include "CbmL1Hit.h"
20#include "CbmL1Track.h"
21#include "CbmMuchPixelHit.h"
23#include "CbmMvdHit.h"
25#include "CbmPixelHit.h"
26#include "CbmStsHit.h"
28#include "CbmTofHit.h"
30#include "CbmTrdHit.h"
32#include "TClonesArray.h"
33
34class CbmTimeSlice;
35namespace cbm::algo::ca
36{
37 class DataManager;
38 template<typename DataT>
39 class Parameters;
40} // namespace cbm::algo::ca
41
42namespace cbm::ca
43{
50 public:
53 TimeSliceReader() = default;
54
56 ~TimeSliceReader() = default;
57
60
63
66
69
71 void Clear();
72
75 const auto& GetHitFirstIndexDet() const { return fvHitFirstIndexDet; }
76
81 {
82 return fvHitFirstIndexDet[int(iDet) + 1] - fvHitFirstIndexDet[int(iDet)];
83 }
84
87
92 bool InitRun();
93
98 void ReadEvent(CbmEvent* pEvent = nullptr);
99
104
109
112 void RegisterParameters(std::shared_ptr<ca::Parameters<float>>& pParameters) { fpParameters = pParameters; }
113
117 void RegisterIODataManager(std::shared_ptr<ca::DataManager>& ioDataManager);
118
123
128 void SetDetector(ca::EDetectorID detID, bool flag = true) { fvbUseDet[detID] = flag; }
129
133
136 void SetSortQaHits(bool doSortQaHits) { fbSortQaHits = doSortQaHits; }
137
138 private:
141 void CheckInit() const;
142
144 void ReadHits();
145
147 void ReadRecoTracks();
148
153 template<ca::EDetectorID DetID>
155
157 void SortQaHits();
158
163 void StoreHitRecord(const tools::HitRecord& hitRecord);
164
167
168 // Input data branches
169 // CbmTimeSlice* fpBrTimeSlice = nullptr; ///< Pointer to the TS object
170 CbmEvent* fpEvent = nullptr;
172
173 // Branches for reconstructed tracks. The input at the moment (as for 27.02.2023) depends on the selected
174 // tracking mode. For simulations in CBM, the CA tracking is used only in STS + MVD detectors. In this case
175 // the reconstructed tracks are saved to the "StsTrack" branch as CbmStsTrack objects. For mCBM, the tracks from
176 // CA are saved as global tracks, and the local ones are used to keep indexes of hits in different subsystems
177 TClonesArray* fpBrRecoTracks = nullptr;
178 TClonesArray* fpBrStsTracks = nullptr;
179 TClonesArray* fpBrMuchTracks = nullptr;
180 TClonesArray* fpBrTrdTracks = nullptr;
181 TClonesArray* fpBrTofTracks = nullptr;
182
183 // Pointers to output data containers
187 std::shared_ptr<ca::DataManager> fpIODataManager = nullptr;
188 std::shared_ptr<ca::Parameters<float>> fpParameters = nullptr;
189
190 // Maps of hit indexes: ext -> int
192
196
198
199 bool fbSortQaHits = false;
200
201 // Variables for storing cache
202 int fNofHits = 0;
203 int fNofHitKeys = 0;
204 int fFirstHitKey = 0;
205
206 std::array<int, constants::size::MaxNdetectors + 1> fvHitFirstIndexDet = {{0}};
207 };
208} // namespace cbm::ca
Input-output data manager for L1 tracking algorithm.
Compile-time constants definition for the CA tracking algorithm.
CA Tracking performance interface for CBM (header)
Implementation of L1DetectorID enum class for CBM.
ECbmCaTrackingMode
Enumeration for different tracking running modes.
@ kSTS
Local tracking in CBM (STS + MVD), results stored to the StsTrack branch.
Class for pixel hits in MUCH detector.
Data class for a reconstructed hit in the STS.
Class for hits in TRD detector.
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
Bookkeeping of time-slice content.
A manager for the input-output data of the CA tracking algorithm.
A container for all external parameters of the CA tracking algorithm.
A reader of time slice for CA tracker.
TClonesArray * fpBrTrdTracks
Input branch for reconstructed TRD tracks ("TrdTrack")
ca::Vector< CbmL1Track > * fpvTracks
Pointer to array of reconstructed tracks.
void SetTrackingMode(ECbmCaTrackingMode mode)
Sets the tracking mode.
int fFirstHitKey
First index of hit key for the detector subsystem.
void ReadRecoTracks()
Reads reconstructed tracks.
std::shared_ptr< ca::DataManager > fpIODataManager
Pointer to input data manager.
const auto & GetHitFirstIndexDet() const
Gets reference to container of first hit indexes in a detector subsystem.
void RegisterHitIndexContainer(ca::Vector< CbmL1HitId > &vHitIds)
Registers hit index container.
void RegisterParameters(std::shared_ptr< ca::Parameters< float > > &pParameters)
Registers CA parameters object.
void StoreHitRecord(const tools::HitRecord &hitRecord)
Saves hit to data structures.
int GetNofHits(ca::EDetectorID iDet) const
Gets number of hits stored for a given detector.
void SetSortQaHits(bool doSortQaHits)
Sets flag to additionally sort QA hits by stations.
TClonesArray * fpBrRecoTracks
Input branch for reconstructed tracks ("GlobalTrack", "StsTrack")
TimeSliceReader(TimeSliceReader &&)=delete
Move constructor.
~TimeSliceReader()=default
Destructor.
TClonesArray * fpBrTofTracks
Input branch for reconstructed TOF tracks ("TofTrack")
TClonesArray * fpBrStsTracks
Input branch for reconstructed STS tracks ("StsTrack")
int fNofHitKeys
Recorded number of hit keys.
DetIdArr_t< bool > fvbUseDet
Flag: is detector subsystem used.
DetIdArr_t< TClonesArray * > fvpBrHits
Input branch for hits.
void ReadEvent(CbmEvent *pEvent=nullptr)
Reads time slice.
void SortQaHits()
Sorts QA hit objects by stations.
ECbmCaTrackingMode fTrackingMode
Tracking mode.
TimeSliceReader(const TimeSliceReader &)=delete
Copy constructor.
std::array< int, constants::size::MaxNdetectors+1 > fvHitFirstIndexDet
First hit index in detector.
DetIdArr_t< int > fvNofHitsUsed
Number of used hits in detector.
CbmEvent * fpEvent
Pointer to the event object.
TClonesArray * fpBrMuchTracks
Input branch for reconstructed MuCh tracks ("MuchTrack")
void SetDetector(ca::EDetectorID detID, bool flag=true)
Sets used detector subsystems.
std::shared_ptr< ca::Parameters< float > > fpParameters
Pointer to tracking parameters object.
ca::Vector< CbmL1HitDebugInfo > * fpvQaHits
Pointer to array of debug hits.
TimeSliceReader & operator=(TimeSliceReader &&)=delete
Move assignment operator.
DetIdArr_t< const CbmTrackingDetectorInterfaceBase * > fvpDetInterface
Pointers to the tracking detector interfaces for each subsystem.
int ReadHitsForDetector()
Reads hits for a given detector subsystem.
int fNofHits
Stored number of hits.
void RegisterQaHitContainer(ca::Vector< CbmL1HitDebugInfo > &vQaHits)
Registers hit debug info container.
void RegisterIODataManager(std::shared_ptr< ca::DataManager > &ioDataManager)
Registers the CA IO data manager instance.
ECbmCaTrackingMode GetTrackingMode() const
Gets CBM tracking mode.
TimeSliceReader & operator=(const TimeSliceReader &)=delete
Copy assignment operator.
DetIdArr_t< std::unordered_map< int, int > > fvmHitExtToIntIndexMap
Hit index map ext -> int.
bool InitRun()
Run initializer function.
TimeSliceReader()=default
Constructor from parameters.
void RegisterTracksContainer(ca::Vector< CbmL1Track > &vTracks)
Register the reconstructed tracks container.
ca::Vector< CbmL1HitId > * fpvHitIds
Pointer to array of hit index objects.
bool fbSortQaHits
Flag, if the QA hits must be sorted after reading.
void CheckInit() const
Check class initialization.
DetIdArr_t< int > fvNofHitsTotal
Total hit number in detector.
void Clear()
Clears class content.
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14
EDetectorID
Enumeration for the tracking detector subsystems in CBM-CA.
Definition CbmDefs.h:176
A helper structure to store hits information from different detectors in a uniform manner.