Skip to content

Commit 05ef050

Browse files
pillotalcaliva
authored andcommitted
add creation of default MCH/Calib/HV object (#13313)
1 parent 7278425 commit 05ef050

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

Detectors/MUON/Common/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,17 @@ o2-mid-dcs-ccdb --put-datapoint-config --ccdb http://localhost:8080
7878

7979
### Default CCDB object
8080

81-
The default object in the CCDB can be produced with:
81+
The default objects in the CCDB can be produced as follow:
82+
83+
#### MCH/Calib/HV
84+
85+
```shell
86+
o2-mch-dcs-ccdb --ccdb http://localhost:8080 --upload-default-values -t 1546300800000
87+
```
88+
89+
One DCS data point is created for each channel with the timestamp provided with the `-t` option. The validity range of the object is set from 1 to 9999999999999 and its creation time is set to 1.
90+
91+
#### MID/Calib/HV
8292

8393
```shell
8494
o2-mid-dcs-ccdb --ccdb http://localhost:8080 --upload-default-values -t 1662532507890

Detectors/MUON/Common/src/dcs-ccdb.cxx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ void dump(const std::string what, DPMAP m, int verbose)
9393

9494
std::cout << fmt::format("{:64s} {:4d} ({:4d} unique) values of mean {:7.2f} : ", i.first.get_alias(), v.size(), vv.size(), mean);
9595
if (verbose > 1) {
96+
std::cout << "\n";
9697
for (auto dp : vv) {
97-
std::cout << " " << dp << "\n";
98+
std::cout << fmt::format(" {:7.2f} ", sum(0., dp)) << dp << "\n";
9899
}
99100
}
100101
std::cout << "timeRange=" << timeRange.first << " " << timeRange.second << "\n";
@@ -187,7 +188,15 @@ void makeDefaultCCDBEntry(const std::string ccdbUrl, uint64_t timestamp)
187188
DPMAP dpMap;
188189
std::string ccdb = fmt::format("{}/Calib/HV", o2::muon::subsysname());
189190
#if defined(MUON_SUBSYSTEM_MCH)
190-
// TODO: do the same for MCH
191+
std::array<o2::mch::dcs::MeasurementType, 2> types{o2::mch::dcs::MeasurementType::HV_V, o2::mch::dcs::MeasurementType::HV_I};
192+
std::array<double, 2> defaultValues{1650., 0.1};
193+
for (size_t itype = 0; itype < 2; ++itype) {
194+
auto aliases = o2::mch::dcs::aliases({types[itype]});
195+
for (const auto& alias : aliases) {
196+
auto obj = o2::dcs::createDataPointCompositeObject(alias, defaultValues[itype], timestamp_seconds, timestamp_ms);
197+
dpMap[obj.id].emplace_back(obj.data);
198+
}
199+
}
191200
#elif defined(MUON_SUBSYSTEM_MID)
192201
std::array<o2::mid::dcs::MeasurementType, 2> types{o2::mid::dcs::MeasurementType::HV_V, o2::mid::dcs::MeasurementType::HV_I};
193202
std::array<double, 2> defaultValues{9600., 5};
@@ -209,7 +218,12 @@ void makeDefaultCCDBEntry(const std::string ccdbUrl, uint64_t timestamp)
209218
md["default"] = "true";
210219
std::cout << "storing default values of " << o2::muon::subsysname() << " data points to " << ccdb << "\n";
211220

221+
#if defined(MUON_SUBSYSTEM_MCH)
222+
md["Created"] = "1";
223+
api.storeAsTFileAny(&dpMap, ccdb, md, 1, 9999999999999);
224+
#elif defined(MUON_SUBSYSTEM_MID)
212225
api.storeAsTFileAny(&dpMap, ccdb, md, 1, timestamp);
226+
#endif
213227
}
214228

215229
bool match(const std::vector<std::string>& queries, const char* pattern)

0 commit comments

Comments
 (0)