CbmRoot
Loading...
Searching...
No Matches
sts/RecoSetupUnit.h
Go to the documentation of this file.
1/* Copyright (C) 2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#ifndef ALGO_STS_RecoSetupUnit_h
11#define ALGO_STS_RecoSetupUnit_h 1
12
13#include "CbmDefs.h"
14#include "CbmStsAddress.h"
16
17#include <boost/serialization/access.hpp>
18#include <boost/serialization/utility.hpp>
19
20#include <utility>
21#include <vector>
22
23namespace cbm::algo::sts
24{
25 class RecoSetupUnit : public TrackingSetupIfs<RecoSetupUnit> {
26 friend class TrackingSetupIfs<RecoSetupUnit>;
27
28 public:
29 using StationIdMap_t = std::vector<std::pair<uint32_t, int>>;
30
32 RecoSetupUnit() = default;
33
37 RecoSetupUnit(std::pair<std::vector<GeoVolume>, std::vector<GeoVolume>>&& stationVolumes,
38 StationIdMap_t&& stationIdMap);
39
41 static constexpr std::string_view GetDetectorName() { return "STS"; }
42
44 static constexpr ECbmModuleId GetModuleId() { return ECbmModuleId::kSts; }
45
46 private:
68
72 int ImplGetTrackingStationId(uint32_t address) const;
73
76 bool ImplIsTimeInfoProvided(int /*stationId*/) const { return true; }
77
81 bool IsInitialized() const;
82
84 template<class Archive>
86 void serialize(Archive& ar, const unsigned int /*version*/)
87 {
88 ar& boost::serialization::base_object<TrackingSetupIfs<RecoSetupUnit>>(*this);
90 }
91 };
92
93
94 //* Inline method implementations
95
96 // -------------------------------------------------------------------------------------------------------------------
97 //
98 inline int RecoSetupUnit::ImplGetTrackingStationId(uint32_t address) const
99 {
100 const auto& [ladderIdThrsh, stationId] = fvStationIdMap[CbmStsAddress::GetElementId(address, kStsUnit)];
101 return CbmStsAddress::GetElementId(address, kStsLadder) < ladderIdThrsh ? stationId : stationId + 1;
102 }
103
104} // namespace cbm::algo::sts
105
106
107#endif // ALGO_STS_RecoSetupUnit_h
ECbmModuleId
Enumerator for module Identifiers.
Definition CbmDefs.h:45
@ kSts
Silicon Tracking System.
Definition CbmDefs.h:48
@ kStsLadder
@ kStsUnit
Base class for the detector interface for reconstruction algorithms.
void serialize(Archive &ar, const unsigned int)
Serialization rule.
StationIdMap_t fvStationIdMap
A map of STS address to STS station ID.
static constexpr std::string_view GetDetectorName()
Name of the detector.
static constexpr ECbmModuleId GetModuleId()
Module ID.
bool IsInitialized() const
Validates initialization of the instance.
std::vector< std::pair< uint32_t, int > > StationIdMap_t
int ImplGetTrackingStationId(uint32_t address) const
Returns tracking station index by the STS address.
bool ImplIsTimeInfoProvided(int) const
Returns a flag, if time information is provided by the detector.
friend class boost::serialization::access
RecoSetupUnit()=default
Default constructor (note: needed for serialization)
uint32_t GetElementId(int32_t address, int32_t level)
Get the index of an element.