CbmRoot
Loading...
Searching...
No Matches
CbmRunDatabase.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// DISCLAIMER
11//
12// Logic of this class is not final and will be (hopefully) improved.
13
14// FIXME: optimize parameter storage for setup geo tag (struct SetupConfig??)
15
16#ifndef CbmRunDatabase_h
17#define CbmRunDatabase_h 1
18
19#include "CbmYaml.h"
20
21#include <map>
22#include <string>
23
24namespace cbm
25{
31 struct DbCommon {
32 std::map<uint32_t, std::string> geoSetup;
33 // NOTE: std::map is used, because the keys must be ordered
34
36 util::yaml::Property(&RunDatabase::DbCommon::geoSetup, "geoSetup", "Run ID map for geometry setup tags"));
37 };
38
42 std::map<uint32_t, std::string> bmon;
43 std::map<uint32_t, std::string> tof;
44 // NOTE: std::map is used, because the keys must be ordered
45
47 util::yaml::Property(&RunDatabase::DbCalibration::bmon, "bmon", "Run ID map for BMON calibration tags"),
48 util::yaml::Property(&RunDatabase::DbCalibration::tof, "tof", "Run ID map for TOF calibration tags"));
49 };
50
53 struct DbContents {
56 std::map<uint32_t, std::string> alignment;
57 std::map<uint32_t, std::string> recoPar;
58 // NOTE: std::map is used, because the keys must be ordered
59
61 util::yaml::Property(&RunDatabase::DbContents::common, "common", "Common parameters"),
62 util::yaml::Property(&RunDatabase::DbContents::calibration, "calibration", "Calibration of detector subsystems"),
63 util::yaml::Property(&RunDatabase::DbContents::alignment, "alignment", "Alignment matrices tag"),
64 util::yaml::Property(&RunDatabase::DbContents::recoPar, "recoPar", "Reconstruction parameter tag"));
65 };
66
70 std::unordered_map<uint32_t, uint64_t> runStartTime;
71
73 algo::yaml::Property(&RunDatabase::DbStartTimeMcbm::runStartTime, "run_start", "Run ID map to start time"));
74 };
75
76 public:
78 const std::string& GetBmonCalibrationTag() const { return fBmonCalibrationTag; }
79
81 const std::string& GetGeoSetupTag() const { return fGeoSetupTag; }
82
84 const std::string& GetTofCalibrationTag() const { return fTofCalibrationTag; }
85
87 const std::string& GetAlignmentTag() const { return fAlignmentTag; }
88
90 const std::string& GetRecoParTag() const { return fRecoParTag; }
91
94 std::string GetRecoParDir() const { return std::string("parameters/online/recoPar/") + fRecoParTag; }
95
97 uint64_t GetRunStartTime() const { return fRunStartTimeNs / 1000000000; }
98
100 const uint64_t& GetRunStartTimeNs() const { return fRunStartTimeNs; }
101
104 std::string GetAlgoMainConfigPath() const { return GetRecoParDir() + "/MainConfig.yaml"; }
105
107 uint32_t GetRunId() const { return fRunId; }
108
113 bool LoadRun(uint32_t runId);
114
117 void SetPathCommonDb(const std::string& pathCommonDb) { fPathCommonDb = pathCommonDb; }
118
121 void SetPathRunStartTimeDb(const std::string& pathRunStartTimeDb) { fPathRunStartTimeDb = pathRunStartTimeDb; }
122
124 std::string ToString() const;
125
126 private:
127 //* Database properties
128 std::string fPathCommonDb;
130
131 //* Run properties
133 std::string fTofCalibrationTag;
134 std::string fGeoSetupTag;
135 std::string fAlignmentTag;
136 std::string fRecoParTag;
138 uint32_t fRunId{0};
139 };
140} // namespace cbm
141
142#endif // CbmRunDatabase_h
The main calibration data base class for CBM.
const std::string & GetRecoParTag() const
Returns tag of reconstruction parameter.
uint32_t fRunId
Current run ID.
const std::string & GetBmonCalibrationTag() const
Returns tag of BMON calibration for a provided run ID.
std::string fGeoSetupTag
Geometry setup tag for a given run ID.
const uint64_t & GetRunStartTimeNs() const
Returns the run start time in UTC nanoseconds for the selected run ID.
void SetPathRunStartTimeDb(const std::string &pathRunStartTimeDb)
Sets an alternative path to run starttime DB file.
std::string fTofCalibrationTag
TOF calibration tag for a given run ID.
uint64_t GetRunStartTime() const
Returns the run start time in UTC seconds for the selected run ID.
std::string fRecoParTag
Tag for reconstruction parameters for a given run ID.
std::string fPathRunStartTimeDb
Path to the runtime data-base.
void SetPathCommonDb(const std::string &pathCommonDb)
Sets an alternative path to the common DB file.
const std::string & GetTofCalibrationTag() const
Returns tag of TOF calibration for a provided run ID.
uint64_t fRunStartTimeNs
Run start time since the epoch [ns].
const std::string & GetAlignmentTag() const
Returns tag of alignment matrices (geoSetup + ref. run ID)
std::string ToString() const
String representation of the class contents.
std::string fAlignmentTag
Tag for alignment matrices.
const std::string & GetGeoSetupTag() const
Returns tag of the geometry setup for a provided run ID.
uint32_t GetRunId() const
Returns the loaded run ID.
std::string GetRecoParDir() const
Returns a path to the reconstruction parameter directory.
std::string fPathCommonDb
Path to the common data-base.
std::string GetAlgoMainConfigPath() const
Returns a path to the main configuration file of the online reconstruction.
bool LoadRun(uint32_t runId)
Loads the information for the run from the file.
std::string fBmonCalibrationTag
BMON calibration tag for a given run ID.
A helper structure, which defines "calibration" YAML node.
std::map< uint32_t, std::string > tof
TOF calibration tag.
CBM_YAML_PROPERTIES(util::yaml::Property(&RunDatabase::DbCalibration::bmon, "bmon", "Run ID map for BMON calibration tags"), util::yaml::Property(&RunDatabase::DbCalibration::tof, "tof", "Run ID map for TOF calibration tags"))
std::map< uint32_t, std::string > bmon
BMON calibration tag.
A helper structure, which defines a layout for "common" YAML node.
CBM_YAML_PROPERTIES(util::yaml::Property(&RunDatabase::DbCommon::geoSetup, "geoSetup", "Run ID map for geometry setup tags"))
std::map< uint32_t, std::string > geoSetup
geometry setup tag
A helper structure, which defines a layout of the YAML file.
CBM_YAML_PROPERTIES(util::yaml::Property(&RunDatabase::DbContents::common, "common", "Common parameters"), util::yaml::Property(&RunDatabase::DbContents::calibration, "calibration", "Calibration of detector subsystems"), util::yaml::Property(&RunDatabase::DbContents::alignment, "alignment", "Alignment matrices tag"), util::yaml::Property(&RunDatabase::DbContents::recoPar, "recoPar", "Reconstruction parameter tag"))
std::map< uint32_t, std::string > alignment
Alignment tags.
DbCalibration calibration
A node for calibration tags.
DbCommon common
A node for common maps.
std::map< uint32_t, std::string > recoPar
Reconstruction parameter tags.
A helper structure, which defines a layout of the "mCBM start time" YAML file.
CBM_YAML_PROPERTIES(algo::yaml::Property(&RunDatabase::DbStartTimeMcbm::runStartTime, "run_start", "Run ID map to start time"))
std::unordered_map< uint32_t, uint64_t > runStartTime
run start time