Skip to content

Commit 0dfe1e4

Browse files
wiechuladavidrohr
authored andcommitted
TPC: fix DP type, add missing cleanup
1 parent 09d3b27 commit 0dfe1e4

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

DataFormats/Detectors/TPC/include/DataFormatsTPC/DCS.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ struct Temperature {
183183
void clear()
184184
{
185185
doClear(raw);
186+
statsA.clear();
187+
statsC.clear();
186188
}
187189

188190
ClassDefNV(Temperature, 1);

Detectors/TPC/dcs/macro/makeTPCCCDBEntryForDCS.C

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
#include <fmt/format.h>
1213
#include <vector>
1314
#include <string>
1415
#include "TFile.h"
@@ -24,11 +25,10 @@
2425

2526
using DPID = o2::dcs::DataPointIdentifier;
2627

28+
/// macro to populate CCDB for TPC with the configuration for DCS
2729
int makeTPCCCDBEntryForDCS(const std::string url = "http://localhost:8080")
2830
{
2931

30-
// std::string url(argv[0]);
31-
// macro to populate CCDB for TOF with the configuration for DCS
3232
std::unordered_map<DPID, std::string> dpid2DataDesc;
3333
std::vector<std::string> aliases;
3434
auto dphints = o2::tpc::dcs::getTPCDCSDPHints();
@@ -42,22 +42,31 @@ int makeTPCCCDBEntryForDCS(const std::string url = "http://localhost:8080")
4242

4343
std::vector<std::string> expaliases = o2::dcs::expandAliases(aliases);
4444

45-
// for (const auto& alias : expaliases) {
46-
// printf("%s\n", alias.data());
47-
//}
45+
if (url == "printOnly") {
46+
for (const auto& alias : expaliases) {
47+
fmt::print("{}\n", alias.data());
48+
}
49+
return 0;
50+
}
4851

4952
DPID dpidtmp;
50-
for (size_t i = 0; i < expaliases.size(); ++i) {
51-
DPID::FILL(dpidtmp, expaliases[i], o2::dcs::DeliveryType::DPVAL_DOUBLE);
53+
for (const auto& alias : expaliases) {
54+
std::string type = "DPVAL_DOUBLE";
55+
if (alias.find("STATUS") == (alias.size() - std::string("STATUS").size())) {
56+
DPID::FILL(dpidtmp, alias, o2::dcs::DeliveryType::DPVAL_INT);
57+
type = "DPVAL_INT";
58+
} else {
59+
DPID::FILL(dpidtmp, alias, o2::dcs::DeliveryType::DPVAL_DOUBLE);
60+
}
5261
dpid2DataDesc[dpidtmp] = "TPCDATAPOINTS";
53-
LOG(info) << expaliases[i];
62+
LOGP(info, "{} ({})", alias, type);
5463
}
5564

5665
o2::ccdb::CcdbApi api;
5766
api.init(url); // or http://localhost:8080 for a local installation
5867
std::map<std::string, std::string> md;
5968
long ts = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
60-
api.storeAsTFileAny(&dpid2DataDesc, "TPC/Config/DCSDPconfig", md, ts);
69+
api.storeAsTFileAny(&dpid2DataDesc, "TPC/Config/DCSDPconfig", md, ts, 99999999999999);
6170

6271
return 0;
6372
}

Detectors/TPC/dcs/src/DCSDPHints.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ std::vector<o2::dcs::test::HintType> o2::tpc::dcs::getTPCDCSDPHints(const int ma
9292
dphints.emplace_back(o2::dcs::test::DataPointHint<double>{fmt::format("TPC_HV_C[00..{:02}]_O[1..3]_G[1..4]T_I", maxSectors), 0, 800.});
9393

9494
// ---| Stack status |--------------------------------------------------------
95-
dphints.emplace_back(o2::dcs::test::DataPointHint<uint32_t>{fmt::format("TPC_HV_A[00..{:02}]_I_STATUS", maxSectors), 0, 29});
96-
dphints.emplace_back(o2::dcs::test::DataPointHint<uint32_t>{fmt::format("TPC_HV_A[00..{:02}]_O[1..3]_STATUS", maxSectors), 0, 29});
95+
dphints.emplace_back(o2::dcs::test::DataPointHint<int32_t>{fmt::format("TPC_HV_A[00..{:02}]_I_STATUS", maxSectors), 0, 29});
96+
dphints.emplace_back(o2::dcs::test::DataPointHint<int32_t>{fmt::format("TPC_HV_A[00..{:02}]_O[1..3]_STATUS", maxSectors), 0, 29});
9797

98-
dphints.emplace_back(o2::dcs::test::DataPointHint<uint32_t>{fmt::format("TPC_HV_C[00..{:02}]_I_STATUS", maxSectors), 0, 29});
99-
dphints.emplace_back(o2::dcs::test::DataPointHint<uint32_t>{fmt::format("TPC_HV_C[00..{:02}]_O[1..3]_STATUS", maxSectors), 0, 29});
98+
dphints.emplace_back(o2::dcs::test::DataPointHint<int32_t>{fmt::format("TPC_HV_C[00..{:02}]_I_STATUS", maxSectors), 0, 29});
99+
dphints.emplace_back(o2::dcs::test::DataPointHint<int32_t>{fmt::format("TPC_HV_C[00..{:02}]_O[1..3]_STATUS", maxSectors), 0, 29});
100100

101101
return dphints;
102102
}

0 commit comments

Comments
 (0)