CbmRoot
Loading...
Searching...
No Matches
mvd/RecoSetupUnit.cxx
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
11
12#include <limits>
13#include <unordered_set>
14
16
17// ---------------------------------------------------------------------------------------------------------------------
18//
19RecoSetupUnit::RecoSetupUnit(std::pair<std::vector<GeoVolume>, std::vector<GeoVolume>>&& stationVolumes,
20 StationIdMap_t&& stationIdMap)
21 : TrackingSetupIfs<RecoSetupUnit>(std::move(stationVolumes))
22 , fvStationIdMap(std::move(stationIdMap))
23{
24}
25
26// ---------------------------------------------------------------------------------------------------------------------
27//
29{
30 // STS tracking detector is initialized, if:
31 // - the fvStationIdMap has elements
32 // - the fvStationIdMap contains valid station indices in a range [0, GetNofTrackingStations() - 1]
33
34 bool res = true;
35 if (!fvStationIdMap.size()) {
36 LOG(error) << "\t - station ID map is empty";
37 res = false;
38 }
39
40
41 // Collect the indices of tracking stations, which are stored in fvStationIdMap, in a set; check, if the set
42 // has a size == GetNofTrackingStations(), and if the all the station IDs are in the range
43 // [0, GetNofTrackingStations() - 1].
44 std::unordered_set<int> knownStationIds;
45 for (auto item : fvStationIdMap) {
46 knownStationIds.insert(item);
47 }
48
49 if (knownStationIds.size() != static_cast<size_t>(GetNofTrackingStations())) {
50 LOG(error) << "\t - number of known tracking station IDs (" << knownStationIds.size() << ") differs from the "
51 << "number of stations, provided by geometry (" << GetNofTrackingStations() << ')';
52 res = false;
53 }
54
55 for (int stationId : knownStationIds) {
56 if (stationId < 0 || stationId >= GetNofTrackingStations()) {
57 LOG(error) << "\t - found a tracking station < 0 or >= " << GetNofTrackingStations()
58 << " (geometry): " << stationId;
59 res = false;
60 }
61 }
62 return res;
63}
StationIdMap_t fvStationIdMap
A map of global index of MVD sensor on the tracking station.
RecoSetupUnit()=default
Default constructor (note: needed for serialization)
bool IsInitialized() const
Validates initialization of the instance.
MVD representation for tracking.
Hash for CbmL1LinkKey.