CbmRoot
Loading...
Searching...
No Matches
CbmCaTimeSliceReader.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
11
12#include "CaDefs.h"
13#include "CaInputData.h"
14#include "CaParameters.h"
15#include "CbmGlobalTrack.h"
16#include "CbmKfUtil.h" // for CopyTrackParam2TC
17#include "CbmL1.h"
18#include "CbmMuchTrack.h"
19#include "CbmRecoSetupManager.h"
20#include "CbmStsTrack.h"
21#include "CbmTofTrack.h"
22#include "CbmTrdTrack.h"
23
24#include <FairRootManager.h>
25#include <Logger.h>
26
27#include <algorithm>
28#include <bitset>
29#include <iostream>
30#include <numeric>
31
33
34using namespace cbm::algo::ca::constants;
35using namespace cbm::algo;
36
38
39// ---------------------------------------------------------------------------------------------------------------------
40//
42{
43 // Detector used
44 fvbUseDet.fill(false);
45
46 // Input branches
47 // fpBrTimeSlice = nullptr;
48 fpParameters = nullptr;
49
50 fvpBrHits.fill(nullptr);
51
52 fpBrRecoTracks = nullptr;
53 fpBrStsTracks = nullptr;
54 fpBrMuchTracks = nullptr;
55 fpBrTrdTracks = nullptr;
56 fpBrTofTracks = nullptr;
57
58 // Pointers to output containers
59 fpvHitIds = nullptr;
60 fpvQaHits = nullptr;
61 fpIODataManager = nullptr;
62 fpvTracks = nullptr;
63
64 fNofHits = 0;
65 fNofHitKeys = 0;
66 fFirstHitKey = 0;
67
68 std::fill(fvHitFirstIndexDet.begin(), fvHitFirstIndexDet.end(), 0);
69}
70
71// ---------------------------------------------------------------------------------------------------------------------
72//
74{
75 // Check parameters
76 if (!fpParameters.get()) {
77 throw std::logic_error("Tracking parameters object was not defined");
78 }
79 if (!fpvHitIds) {
80 throw std::logic_error("Hit index container was not defined");
81 }
82
83 //if (!fpBrTimeSlice) {
84 //throw std::logic_error("Time slice branch is unavailable");
85 //}
86
87 for (int iDet = 0; iDet < static_cast<int>(ca::EDetectorID::END); ++iDet) {
88 if (fvbUseDet[iDet] && !fvpBrHits[iDet]) {
89 throw std::logic_error(std::string(kDetName[iDet]) + " hits branch is not found");
90 }
91 }
92
93 if (fpvTracks) {
95 if (!fpBrRecoTracks) {
96 throw std::logic_error("StsTrack branch is unavailable");
97 }
98 }
100 if (!fpBrRecoTracks) {
101 throw std::logic_error("GlobalTrack branch is unavailable");
102 }
104 throw std::logic_error("StsTrack branch is not found");
105 }
107 throw std::logic_error("MuchTrack branch is not found");
108 }
110 throw std::logic_error("TrdTrack branch is not found");
111 }
113 throw std::logic_error("TofTrack branch is not found");
114 }
115 }
116 }
117}
118
119// ---------------------------------------------------------------------------------------------------------------------
120//
122try {
123 LOG(info) << "TimeSliceReader: initializing run ... ";
124
125 // ** Init data branches **
126
127 auto* pFairManager = FairRootManager::Instance();
128 LOG_IF(fatal, !pFairManager) << "TimeSliceReader: FairRootManager was not defined";
129
130 // fpBrTimeSlice = dynamic_cast<CbmTimeSlice*>(pFairManager->GetObject("TimeSlice."));
131
132 // Init branches
133 auto InitHitBranch = [&](ca::EDetectorID detID, const char* branchName) -> bool {
134 if (fvbUseDet[detID]) {
135 fvpBrHits[detID] = dynamic_cast<TClonesArray*>(pFairManager->GetObject(branchName));
136 }
137 return static_cast<bool>(fvpBrHits[detID]);
138 };
139
140 InitHitBranch(ca::EDetectorID::kMvd, "MvdHit");
141 InitHitBranch(ca::EDetectorID::kSts, "StsHit");
142 InitHitBranch(ca::EDetectorID::kMuch, "MuchPixelHit");
143 InitHitBranch(ca::EDetectorID::kTrd, "TrdHit");
144 if (!InitHitBranch(ca::EDetectorID::kTof, "TofCalHit")) {
145 LOG(warn) << "TimeSliceReader: TofCalHit branch not found, trying to get TofHit branch of uncalibrated hits";
146 InitHitBranch(ca::EDetectorID::kTof, "TofHit");
147 }
148
149 // Init track branches
150
151 if (fpvTracks) {
152 switch (fTrackingMode) {
154 fpBrRecoTracks = dynamic_cast<TClonesArray*>(pFairManager->GetObject("StsTrack"));
155 break;
157 fpBrRecoTracks = dynamic_cast<TClonesArray*>(pFairManager->GetObject("GlobalTrack"));
159 fpBrStsTracks = dynamic_cast<TClonesArray*>(pFairManager->GetObject("StsTrack"));
160 }
162 fpBrMuchTracks = dynamic_cast<TClonesArray*>(pFairManager->GetObject("MuchTrack"));
163 }
165 fpBrTrdTracks = dynamic_cast<TClonesArray*>(pFairManager->GetObject("TrdTrack"));
166 }
168 fpBrTofTracks = dynamic_cast<TClonesArray*>(pFairManager->GetObject("TofTrack"));
169 }
170 break;
171 }
172 }
173
174 // Reco setup manager
175 const auto* pRecoSetupMan = RecoSetupManager::Instance();
176 if (!pRecoSetupMan->IsInitialized()) {
177 return false;
178 }
179
180 auto CheckDetector = [&](ca::EDetectorID detId) {
181 if (fvbUseDet[detId] && !pRecoSetupMan->Has(ToCbmModuleId(detId))) {
182 throw std::runtime_error(fmt::format("Det ID {} is not in RecoSetup", static_cast<int>(detId)));
183 }
184 };
185
186 CheckDetector(ca::EDetectorID::kMvd);
187 CheckDetector(ca::EDetectorID::kSts);
188 CheckDetector(ca::EDetectorID::kMuch);
189 CheckDetector(ca::EDetectorID::kTrd);
190 CheckDetector(ca::EDetectorID::kTof);
191
192 // Check initialization
193 this->CheckInit();
194
195 //clrs::CL - clear log
196 //clrs::GNb - green bold log
197 //clrs::RDb - red bold log
198
199 LOG(info) << "TimeSliceReader: initializing run ... " << clrs::GNb << "done" << clrs::CL;
200 return true;
201}
202catch (const std::logic_error& error) {
203 LOG(info) << "TimeSliceReader: initializing run ... " << clrs::RDb << "failed" << clrs::CL
204 << "\nReason: " << error.what();
205 return false;
206}
207
208// ---------------------------------------------------------------------------------------------------------------------
209//
211{
212 fpEvent = pEvent;
213 this->ReadHits();
214 if (fpvTracks) {
215 this->ReadRecoTracks();
216 }
217}
218
219
220// ---------------------------------------------------------------------------------------------------------------------
221//
223{
224 assert(fpBrRecoTracks);
225 int nTracks = 0;
226 switch (fTrackingMode) {
228 nTracks = fpEvent ? fpEvent->GetNofData(ECbmDataType::kStsTrack) : fpBrRecoTracks->GetEntriesFast();
229 fpvTracks->reset(nTracks);
230 // Fill tracks from StsTrack branch
231 for (int iT = 0; iT < nTracks; ++iT) {
232 int iText = fpEvent ? fpEvent->GetIndex(ECbmDataType::kStsTrack, iT) : iT;
233 auto* pInputTrack = static_cast<CbmStsTrack*>(fpBrRecoTracks->At(iText));
234 auto& track = (*fpvTracks)[iT];
235
236 track.Set(cbm::kf::ConvertTrackParam(*pInputTrack->GetParamFirst()));
237 track.TLast = cbm::kf::ConvertTrackParam(*pInputTrack->GetParamLast());
238 track.ChiSq() = pInputTrack->GetChiSq();
239 track.Ndf() = pInputTrack->GetNDF();
240 track.Tpv.Time() = pInputTrack->GetStartTime();
241 track.Tpv.C55() = pInputTrack->GetStartTimeError();
242 track.Time() = pInputTrack->GetFirstHitTime();
243 track.C55() = pInputTrack->GetFirstHitTimeError();
244 track.TLast.Time() = pInputTrack->GetLastHitTime();
245 track.TLast.C55() = pInputTrack->GetLastHitTimeError();
246 track.Hits.clear();
247 track.Hits.reserve(pInputTrack->GetTotalNofHits());
248 for (int iH = 0; iH < pInputTrack->GetNofMvdHits(); ++iH) {
249 int iHext = pInputTrack->GetMvdHitIndex(iH);
251 track.Hits.push_back(iHint);
252 } // iH
253 for (int iH = 0; iH < pInputTrack->GetNofStsHits(); ++iH) {
254 int iHext = pInputTrack->GetStsHitIndex(iH);
256 track.Hits.push_back(iHint);
257 } // iH
258 } // iT
259 break;
260
262 // Fill tracks from GlobalTrack branch
263 nTracks = fpEvent ? fpEvent->GetNofData(ECbmDataType::kGlobalTrack) : fpBrRecoTracks->GetEntriesFast();
264 fpvTracks->reset(nTracks);
265 for (int iT = 0; iT < nTracks; ++iT) {
266 int iText = fpEvent ? fpEvent->GetIndex(ECbmDataType::kGlobalTrack, iT) : iT;
267 auto* pInputTrack = static_cast<CbmGlobalTrack*>(fpBrRecoTracks->At(iText));
268 auto& track = (*fpvTracks)[iT];
269 track.Set(cbm::kf::ConvertTrackParam(*pInputTrack->GetParamFirst()));
270 track.TLast = cbm::kf::ConvertTrackParam(*pInputTrack->GetParamLast());
271 track.ChiSq() = pInputTrack->GetChi2();
272 track.Ndf() = pInputTrack->GetNDF();
273
274 // ** Fill information from local tracks **
275 // STS tracks (+ MVD)
277 int iStsTrkId = pInputTrack->GetStsTrackIndex();
278 if (iStsTrkId > -1) {
279 auto* pStsTrack = static_cast<CbmStsTrack*>(fpBrStsTracks->At(iStsTrkId));
281 for (int iH = 0; iH < pStsTrack->GetNofMvdHits(); ++iH) {
282 int iHext = pStsTrack->GetMvdHitIndex(iH);
284 track.Hits.push_back(iHint);
285 }
286 }
287 for (int iH = 0; iH < pStsTrack->GetNofStsHits(); ++iH) {
288 int iHext = pStsTrack->GetStsHitIndex(iH);
290 track.Hits.push_back(iHint);
291 }
292 }
293 }
294
295 // MUCH tracks
297 int iMuchTrkId = pInputTrack->GetMuchTrackIndex();
298 if (iMuchTrkId > -1) {
299 auto* pMuchTrack = static_cast<CbmMuchTrack*>(fpBrMuchTracks->At(iMuchTrkId));
300 for (int iH = 0; iH < pMuchTrack->GetNofHits(); ++iH) {
301 int iHext = pMuchTrack->GetHitIndex(iH);
303 track.Hits.push_back(iHint);
304 }
305 }
306 }
307
308 // TRD tracks
310 int iTrdTrkId = pInputTrack->GetTrdTrackIndex();
311 if (iTrdTrkId > -1) {
312 const auto* pTrdTrack = static_cast<const CbmTrdTrack*>(fpBrTrdTracks->At(iTrdTrkId));
313 for (int iH = 0; iH < pTrdTrack->GetNofHits(); ++iH) {
314 int iHext = pTrdTrack->GetHitIndex(iH);
316 track.Hits.push_back(iHint);
317 } // iH
318 }
319 }
320
321 // TOF tracks
323 int iTofTrkId = pInputTrack->GetTofTrackIndex();
324 if (iTofTrkId > -1) {
325 const auto* pTofTrack = static_cast<const CbmTofTrack*>(fpBrTofTracks->At(iTofTrkId));
326 for (int iH = 0; iH < pTofTrack->GetNofHits(); ++iH) {
327 int iHext = pTofTrack->GetHitIndex(iH);
329 track.Hits.push_back(iHint);
330 } // iH
331 } // if iTofTrkId > -1
332 } // if fvbUseDet[ca::EDetectorID::kTof]
333 } // iT
334 break;
335 }
336}
337
338// ---------------------------------------------------------------------------------------------------------------------
339//
340void TimeSliceReader::RegisterIODataManager(std::shared_ptr<ca::DataManager>& pIODataManager)
341{
342 LOG_IF(fatal, !pIODataManager.get()) << "TimeSliceReader: passed null pointer as a ca::DataManager instance";
343 fpIODataManager = pIODataManager;
344}
345
346// ---------------------------------------------------------------------------------------------------------------------
347//
349{
350 int nStationsActive = fpParameters->GetNstationsActive();
351 ca::Vector<cbm::algo::ca::McHitInfo> vNewHits{"TimeSliceReader::SortQaHits(): vNewHits", fpvQaHits->size()};
352 std::vector<int> vHitFstIndexes(nStationsActive + 1, 0);
353 std::vector<int> vNofHitsStored(nStationsActive, 0);
354
355 // Count number of hits in each station (NOTE: we could use here boarders from the IO data manager, but we would keep
356 // these two procedures independent)
357 std::for_each(fpvQaHits->begin(), fpvQaHits->end(), [&](const auto& h) { ++vHitFstIndexes[h.GetStationId() + 1]; });
358 for (int iSt = 0; iSt < nStationsActive; ++iSt) {
359 vHitFstIndexes[iSt + 1] += vHitFstIndexes[iSt];
360 }
361 for (const auto& hit : (*fpvQaHits)) {
362 int iSt = hit.GetStationId();
363 vNewHits[vHitFstIndexes[iSt] + (vNofHitsStored[iSt]++)] = hit;
364 }
365
366 auto name = fpvQaHits->GetName();
367 std::swap(vNewHits, (*fpvQaHits));
368 fpvQaHits->SetName(name);
369}
370
371
372// ---------------------------------------------------------------------------------------------------------------------
373//
374template<ca::EDetectorID DetID>
376{
377 using Hit_t = HitTypes_t::at<DetID>;
378
379 if (!fvbUseDet[DetID]) {
380 return 0;
381 } // Detector is entirelly not used
382
383 const auto* pDetInterface = cbm::RecoSetupManager::Instance()->GetSetup().Get<ToCbmModuleId(DetID)>();
384 int nHitsTot = fpEvent ? fpEvent->GetNofData(kCbmHitType[DetID]) : fvpBrHits[DetID]->GetEntriesFast();
385 int nHitsStored = 0; // number of hits used in tracking
386
388
389 for (int iH = 0; iH < nHitsTot; ++iH) {
390 int iHext = fpEvent ? fpEvent->GetIndex(kCbmHitType[DetID], iH) : iH;
391 if (iHext < 0) {
392 LOG(warn) << "TimeSliceReader: hit index stored in the event is negative: " << iHext;
393 continue;
394 }
395 tools::HitRecord hitRecord;
396
397 auto* pHit = static_cast<Hit_t*>(fvpBrHits[DetID]->At(iHext));
398 int iStGeom = pDetInterface->GetTrackingStationId(pHit->GetAddress());
399 if (iStGeom < 0) {
400 continue; // NOTE: sensors with iStGeom = -1 are ignored in tracking
401 }
402
403 // Fill out detector specific data
404 if constexpr (ca::EDetectorID::kSts == DetID) {
405 hitRecord.fStripF = fFirstHitKey + pHit->GetFrontClusterId();
406 hitRecord.fStripB = fFirstHitKey + pHit->GetBackClusterId();
407 }
408 else if constexpr (ca::EDetectorID::kTof == DetID) {
409 // *** Additional cuts for TOF ***
410 // Skip Bmon hits
411 if (5 == CbmTofAddress::GetSmType(pHit->GetAddress())) {
412 continue;
413 }
414 }
415
416 int iStActive = fpParameters->GetStationIndexActive(iStGeom, DetID);
417 if (iStActive < 0) {
418 continue;
419 } // Cut off inactive stations
420
421 // Fill out data common for all the detectors
422 hitRecord.fStaId = iStActive;
423 hitRecord.fX = pHit->GetX();
424 hitRecord.fY = pHit->GetY();
425 hitRecord.fZ = pHit->GetZ();
426 hitRecord.fDx2 = pHit->GetDx() * pHit->GetDx();
427 hitRecord.fDy2 = pHit->GetDy() * pHit->GetDy();
428 hitRecord.fDxy = pHit->GetDxy();
429 hitRecord.fT = pHit->GetTime();
430 hitRecord.fDt2 = pHit->GetTimeError() * pHit->GetTimeError();
431
432 // Apply hit error smearing according to misalignment
433 auto misalignmentTolerance = fpParameters->GetConfig().GetMisalignmentTolerance(DetID);
434 hitRecord.fDx2 += misalignmentTolerance.GetXsq();
435 hitRecord.fDy2 += misalignmentTolerance.GetYsq();
436 hitRecord.fDt2 += misalignmentTolerance.GetTimeSq();
437
438 auto hitRange = pDetInterface->GetHitRange(*pHit);
439 hitRecord.fRangeX = hitRange.x;
440 hitRecord.fRangeY = hitRange.y;
441 hitRecord.fRangeT = hitRange.t;
442 hitRecord.fDet = static_cast<int>(DetID);
443 hitRecord.fDataStream = pHit->GetAddress() & kCbmDatastreamBitmask[DetID];
444 hitRecord.fExtId = iHext;
445
446
447 // Check if hit values are reasonable
448 {
449 // FIXME: Values are taken from a ceiling
450 const auto& station = fpParameters->GetActiveSetup().GetActiveLayer(iStActive);
451 if (pHit->GetX() < station.GetXmin() * 1.2 || pHit->GetX() > station.GetXmax() * 1.2
452 || pHit->GetY() < station.GetYmin() * 1.2 || pHit->GetY() > station.GetYmax() * 1.2
453 || fabs(pHit->GetZ() - station.GetZref()) > 150) {
454 LOG(error) << "Ca:TimeSliceReader: " << CbmL1::GetDetectorName(DetID)
455 << " hit is outside of the station boundaries: " << hitRecord.ToString() << "; station X "
456 << station.GetXmin() << ".." << station.GetXmax() << " Y " << station.GetYmin() << ".."
457 << station.GetYmax() << " Z " << station.GetZref();
458 continue;
459 }
460 }
461
462 // Update number of hit keys
463 if constexpr (ca::EDetectorID::kSts == DetID) {
464 if (fNofHitKeys <= hitRecord.fStripF) {
465 fNofHitKeys = hitRecord.fStripF + 1;
466 }
467 if (fNofHitKeys <= hitRecord.fStripB) {
468 fNofHitKeys = hitRecord.fStripB + 1;
469 }
470 }
471 else {
472 hitRecord.fStripF = fFirstHitKey + iHext;
473 hitRecord.fStripB = hitRecord.fStripF;
474 if (fNofHitKeys <= hitRecord.fStripF) {
475 fNofHitKeys = hitRecord.fStripF + 1;
476 }
477 }
478
479 // Save hit to data structures
480 if (hitRecord.Accept()) {
481 this->StoreHitRecord(hitRecord);
482 ++nHitsStored;
483 }
484 } // iH
485
486 return nHitsStored;
487}
488
489// ---------------------------------------------------------------------------------------------------------------------
490//
492{
493 fNofHits = 0;
494 fNofHitKeys = 0;
495 fFirstHitKey = 0;
496
497 // TODO: Address case with CbmEvent != nullptr
498 for (int iDet = 0; iDet < static_cast<int>(ca::EDetectorID::END); ++iDet) {
499 if (fvbUseDet[iDet]) {
500 fvNofHitsTotal[iDet] = fpEvent ? fpEvent->GetNofData(kCbmHitType[iDet]) : fvpBrHits[iDet]->GetEntriesFast();
501 }
502 }
503
504 int nHitsTot = std::accumulate(fvNofHitsTotal.begin(), fvNofHitsTotal.end(), 0);
505
506 // Resize the containers
507 if (fpvHitIds) {
508 fpvHitIds->clear();
509 fpvHitIds->reserve(nHitsTot);
510 }
511 if (fpvQaHits) {
512 fpvQaHits->clear();
513 fpvQaHits->reserve(nHitsTot);
514 }
515 if (fpIODataManager) {
516 fpIODataManager->ResetInputData(nHitsTot);
517 }
518
519 std::fill(fvHitFirstIndexDet.begin(), fvHitFirstIndexDet.end(), 0);
520
521 // Read hits for different detectors
527
528 // Save first hit index for different detector subsystems
529 for (uint32_t iDet = 0; iDet < fvNofHitsUsed.size(); ++iDet) {
530 fvHitFirstIndexDet[iDet + 1] = fvHitFirstIndexDet[iDet] + fvNofHitsUsed[iDet];
531 }
532
533 fNofHits = std::accumulate(fvNofHitsUsed.cbegin(), fvNofHitsUsed.cend(), 0);
534
535 LOG(debug) << "CA: N hits used/tot = " << fNofHits << "/" << nHitsTot;
536
537 // Update number of hit keys in input data object
538 if (fpIODataManager) {
539 fpIODataManager->SetNhitKeys(fNofHitKeys);
540 }
541
542 // Sort debug hits
543 if (fpvQaHits && fbSortQaHits) {
544 this->SortQaHits();
545 }
546
547 // Update maps of ext->int hit indexes
548 // NOTE: fvpHitIds must be initialized, if we want to read tracks from the file
549 if (fpvHitIds) {
550 auto ResetIndexMap = [&](auto& m) mutable { m.clear(); };
551 std::for_each(fvmHitExtToIntIndexMap.begin(), fvmHitExtToIntIndexMap.end(), ResetIndexMap);
552 for (int iH = 0; iH < fNofHits; ++iH) {
553 const auto& hit = (*fpvQaHits)[iH];
554 fvmHitExtToIntIndexMap[hit.Det][hit.ExtIndex] = iH;
555 }
556 }
557}
558
559// ---------------------------------------------------------------------------------------------------------------------
560//
562{
563 // Save the algo hit
564 if (fpIODataManager.get()) {
565 ca::Hit aHit;
566 aHit.SetFrontKey(hitRecord.fStripF);
567 aHit.SetBackKey(hitRecord.fStripB);
568 aHit.SetX(hitRecord.fX);
569 aHit.SetY(hitRecord.fY);
570 aHit.SetZ(hitRecord.fZ);
571 aHit.SetT(hitRecord.fT);
572 aHit.SetDx2(hitRecord.fDx2);
573 aHit.SetDy2(hitRecord.fDy2);
574 aHit.SetDxy(hitRecord.fDxy);
575 aHit.SetDt2(hitRecord.fDt2);
576 aHit.SetRangeX(hitRecord.fRangeX);
577 aHit.SetRangeY(hitRecord.fRangeY);
578 aHit.SetRangeT(hitRecord.fRangeT);
579 aHit.SetId(static_cast<int>(fpIODataManager->GetNofHits()));
580 aHit.SetStation(hitRecord.fStaId);
581
582 fpIODataManager->PushBackHit(aHit, hitRecord.fDataStream);
583 }
584
585 // Save hit ID information
586 if (fpvHitIds) {
587 fpvHitIds->emplace_back(hitRecord.fDet, hitRecord.fExtId);
588 }
589
590 // Save debug information
591 if (fpvQaHits) {
593 aHitQa.Det = hitRecord.fDet;
594 aHitQa.ExtIndex = hitRecord.fExtId;
595 aHitQa.IntIndex = static_cast<int>(fpvQaHits->size());
596 aHitQa.iStation = hitRecord.fStaId;
597 aHitQa.x = hitRecord.fX;
598 aHitQa.y = hitRecord.fY;
599 aHitQa.z = hitRecord.fZ;
600 aHitQa.dx = sqrt(hitRecord.fDx2);
601 aHitQa.dy = sqrt(hitRecord.fDy2);
602 aHitQa.dxy = hitRecord.fDxy;
603 aHitQa.time = hitRecord.fT;
604 aHitQa.dt = sqrt(hitRecord.fDt2);
605 fpvQaHits->push_back(aHitQa);
606 }
607}
Compile-time constants definition for the CA tracking algorithm.
Structure for input data to the L1 tracking algorithm (declaration)
Time-slice/event reader for CA tracker in CBM (header)
@ kMCBM
Global tracking in mCBM (STS, MuCh, TRD, TOF), results stored to GlobalTrack branch.
@ kSTS
Local tracking in CBM (STS + MVD), results stored to the StsTrack branch.
A manager for setup representation in CBM reconstruction.
Data class for STS tracks.
friend fvec sqrt(const fvec &a)
Generates beam ions for transport simulation.
Class characterising one event by a collection of links (indices) to data objects,...
Definition CbmEvent.h:34
static constexpr const char * GetDetectorName(ca::EDetectorID detectorID)
Utility to map the L1DetectorID items into detector names.
Definition CbmL1.h:239
static int32_t GetSmType(uint32_t address)
void Clear()
Clears class content.
const algo::RecoSetup & GetSetup() const
Setup accessor.
static RecoSetupManager * Instance()
Instance access.
const RecoSetupUnit_t< ModuleId > * Get() const
Access to a reconstruction setup unit.
Definition RecoSetup.h:112
ca::Hit class describes a generic hit for the CA tracker
Definition CaHit.h:32
void SetX(fscal x)
Set the X coordinate.
Definition CaHit.h:54
void SetRangeT(fscal rangeT)
Set the +/- range of uncertainty of time.
Definition CaHit.h:84
void SetDt2(fscal dt2)
Set the uncertainty of time.
Definition CaHit.h:75
void SetDy2(fscal dy2)
Set the uncertainty of Y coordinate.
Definition CaHit.h:69
void SetRangeY(fscal rangeY)
Set the +/- range of uncertainty of Y coordinate.
Definition CaHit.h:81
void SetStation(int station)
Set the station index.
Definition CaHit.h:90
void SetDx2(fscal dx2)
Set the uncertainty of X coordinate.
Definition CaHit.h:66
void SetRangeX(fscal rangeX)
Set the +/- range of uncertainty of X coordinate.
Definition CaHit.h:78
void SetZ(fscal z)
Set the Z coordinate.
Definition CaHit.h:60
void SetBackKey(HitKeyIndex_t key)
Set the back key index.
Definition CaHit.h:51
void SetFrontKey(HitKeyIndex_t key)
Set the front key index.
Definition CaHit.h:48
void SetId(HitIndex_t id)
Set the hit id.
Definition CaHit.h:87
void SetT(fscal t)
Set the time.
Definition CaHit.h:63
void SetDxy(fscal dxy)
Set the X/Y covariance.
Definition CaHit.h:72
void SetY(fscal y)
Set the Y coordinate.
Definition CaHit.h:57
double dy
y coordinate error [cm]
int Det
detector subsystem ID
double y
y coordinate of position [cm]
int IntIndex
index of hit in the internal array
double dt
time error [ns]
int iStation
index of station in active stations array
double z
z coordinate of position [cm]
double dx
x coordinate error [cm]
double dxy
covariance between x and y [cm2]
double x
x coordinate of position [cm]
int ExtIndex
index of hit in the external branch
double time
hit time [ns]
A reader of time slice for CA tracker.
TClonesArray * fpBrTrdTracks
Input branch for reconstructed TRD tracks ("TrdTrack")
std::shared_ptr< const ca::Parameters< double > > fpParameters
Pointer to tracking parameters object.
ca::Vector< CbmL1Track > * fpvTracks
Pointer to array of reconstructed tracks.
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.
void StoreHitRecord(const tools::HitRecord &hitRecord)
Saves hit to data structures.
TClonesArray * fpBrRecoTracks
Input branch for reconstructed tracks ("GlobalTrack", "StsTrack")
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.
ca::Vector< cbm::algo::ca::McHitInfo > * fpvQaHits
Pointer to array of debug hits.
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")
int ReadHitsForDetector()
Reads hits for a given detector subsystem.
int fNofHits
Stored number of hits.
void RegisterIODataManager(std::shared_ptr< ca::DataManager > &ioDataManager)
Registers the CA IO data manager instance.
DetIdArr_t< std::unordered_map< int, int > > fvmHitExtToIntIndexMap
Hit index map ext -> int.
bool InitRun()
Run initializer function.
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.
constexpr char RDb[]
bold red
Definition CaDefs.h:161
constexpr char GNb[]
bold green
Definition CaDefs.h:162
constexpr char CL[]
clear
Definition CaDefs.h:139
EDetectorID
Enumeration for the tracking detector subsystems in CBM-CA.
Definition CbmDefs.h:216
constexpr ECbmModuleId ToCbmModuleId(EDetectorID detID)
Conversion map from EDetectorID to ECbmModuleId.
Definition CbmDefs.h:228
constexpr DetIdArr_t< ECbmDataType > kCbmHitType
Data type of hits (for CbmEvent)
constexpr DetIdArr_t< const char * > kDetName
Names of detector subsystems.
constexpr DetIdArr_t< uint32_t > kCbmDatastreamBitmask
Bit-masks to define a data-stream (within this HW level the hits must be sorted in time) FIXME: Put i...
cbm::algo::kf::TrackParamD ConvertTrackParam(const FairTrackParam &par)
copy fair track param to Ca track param
Definition CbmKfUtil.cxx:18
std::tuple_element_t< static_cast< std::size_t >(DetID), std::tuple< Types... > > at
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
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
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]