Skip to content

Commit e6d1989

Browse files
authored
TPC CalDetPublisher: remove name restriction in allowed CalDet object list (#762)
1 parent 76ac3ec commit e6d1989

3 files changed

Lines changed: 26 additions & 69 deletions

File tree

Modules/TPC/include/TPC/CalDetPublisher.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,6 @@ class TPaveText;
2828
namespace o2::quality_control_modules::tpc
2929
{
3030

31-
/// \brief Valid CalDet objects
32-
/// This struct contains the valid CalDet objects to be fetched from the CCDB
33-
enum struct outputCalPad { Pedestal,
34-
Noise
35-
};
36-
37-
/// \brief Valid vectors of CalDet objects
38-
/// This struct contains the valid std::unordered_maps of CalDet objects to be fetched from the CCDB
39-
enum struct outputCalPadMap { NoPe,
40-
Pulser,
41-
CE
42-
};
43-
4431
/// \brief Quality Control task for the calibration data of the TPC
4532
/// \author Thomas Klemenz
4633
class CalDetPublisher final : public quality_control::postprocessing::PostProcessingInterface
@@ -90,17 +77,7 @@ class CalDetPublisher final : public quality_control::postprocessing::PostProces
9077
long mInitRefPedestalTimestamp; ///< timestamp of the pedestal data used at init of the task
9178
long mInitRefNoiseTimestamp; ///< timestamp of the noise data used at init of the task
9279
TPaveText* mNewZSCalibMsg = nullptr; ///< badge to indicate the necessity to upload new calibration data for ZS
93-
94-
std::unordered_map<std::string, std::vector<int>> mRanges{ ///< histogram ranges configurable via config file
95-
{ "Pedestals", {} },
96-
{ "Noise", {} },
97-
{ "PulserQtot", {} },
98-
{ "PulserT0", {} },
99-
{ "PulserWidth", {} },
100-
{ "CEQtot", {} },
101-
{ "CET0", {} },
102-
{ "CEWidth", {} }
103-
};
80+
std::unordered_map<std::string, std::vector<float>> mRanges; ///< histogram ranges configurable via config file
10481
};
10582

10683
} // namespace o2::quality_control_modules::tpc

Modules/TPC/run/tpcQCCalDetPublisher.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@
2828
"className": "o2::quality_control_modules::tpc::CalDetPublisher",
2929
"moduleName": "QcTPC",
3030
"detectorName": "TPC",
31-
"valid_outputCalPadMaps_comment" : [ "CE", "Pulser" ],
31+
"outputCalPadMaps_comment" : [ "CalDet objects that are stored in std::unordered_map<std::string, o2::tpc::CalDet<float>> need to go here.",
32+
"This needs to be the last part of the CCDB path, e.g. Pulser or CE." ],
3233
"outputCalPadMaps": [
3334
"CE",
3435
"Pulser"
3536
],
36-
"outputCalPads_comment" : [ "Put all CalPad objects you want to look at in the list. The name has to be the same one as on the CCDB.",
37-
"valid outputCalPads: 'Pedestal', 'Noise'" ],
37+
"outputCalPads_comment" : [ "CalDet objects that are stored as plain o2::tpc::CalDet<float> objects need to go here.",
38+
"This needs to be the last part of the CCDB path, e.g. Pedestal or Noise." ],
3839
"outputCalPads": [
3940
"Pedestal",
4041
"Noise"
@@ -85,7 +86,7 @@
8586
{ "CEWidth" : [ "100", "0", "1" ] }
8687
],
8788
"checkZSCalibration": {
88-
"check": "true",
89+
"check": "false",
8990
"initRefCalibTimestamp": "-1",
9091
"initRefPedestalTimestamp": "-1",
9192
"initRefNoiseTimestamp": "-1"

Modules/TPC/src/CalDetPublisher.cxx

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,14 @@ using namespace o2::quality_control::postprocessing;
3535
namespace o2::quality_control_modules::tpc
3636
{
3737

38-
const std::unordered_map<std::string, outputCalPad> OutputMapCalPad{
39-
{ "Pedestal", outputCalPad::Pedestal },
40-
{ "Noise", outputCalPad::Noise }
41-
};
42-
43-
const std::unordered_map<std::string, outputCalPadMap> OutputMapCalPadMap{
44-
{ "PedestalNoise", outputCalPadMap::NoPe },
45-
{ "Pulser", outputCalPadMap::Pulser },
46-
{ "CE", outputCalPadMap::CE }
47-
};
48-
4938
void CalDetPublisher::configure(std::string name, const boost::property_tree::ptree& config)
5039
{
5140
for (const auto& output : config.get_child("qc.postprocessing." + name + ".outputCalPadMaps")) {
52-
try {
53-
OutputMapCalPadMap.at(output.second.data());
54-
mOutputListMap.emplace_back(output.second.data());
55-
} catch (std::out_of_range&) {
56-
throw std::invalid_argument(std::string("Invalid output CalDet map object specified in config: ") + output.second.data());
57-
}
41+
mOutputListMap.emplace_back(output.second.data());
5842
}
5943

6044
for (const auto& output : config.get_child("qc.postprocessing." + name + ".outputCalPads")) {
61-
try {
62-
OutputMapCalPad.at(output.second.data());
63-
mOutputList.emplace_back(output.second.data());
64-
} catch (std::out_of_range&) {
65-
throw std::invalid_argument(std::string("Invalid output CalDet object specified in config: ") + output.second.data());
66-
}
45+
mOutputList.emplace_back(output.second.data());
6746
}
6847

6948
for (const auto& timestamp : config.get_child("qc.postprocessing." + name + ".timestamps")) {
@@ -86,7 +65,7 @@ void CalDetPublisher::configure(std::string name, const boost::property_tree::pt
8665
}
8766
auto vecIter = 0;
8867
if ((keyVec.size() > 0) && (keyVec.size() == valueVec.size())) {
89-
for (auto& key : keyVec) {
68+
for (const auto& key : keyVec) {
9069
mLookupMaps.back().insert(std::pair<std::string, std::string>(key, valueVec.at(vecIter)));
9170
vecIter++;
9271
}
@@ -112,7 +91,7 @@ void CalDetPublisher::configure(std::string name, const boost::property_tree::pt
11291
}
11392
auto vecIter = 0;
11493
if ((keyVec.size() > 0) && (keyVec.size() == valueVec.size())) {
115-
for (auto& key : keyVec) {
94+
for (const auto& key : keyVec) {
11695
mStoreMaps.back().insert(std::pair<std::string, std::string>(key, valueVec.at(vecIter)));
11796
vecIter++;
11897
}
@@ -132,9 +111,9 @@ void CalDetPublisher::configure(std::string name, const boost::property_tree::pt
132111
//if(std::find(mOutputListMap.begin(), mOutputListMap.end(), "PedestalNoise") != mOutputListMap.end()) { mCheckZSPrereq = true; }
133112

134113
for (const auto& entry : config.get_child("qc.postprocessing." + name + ".histogramRanges")) {
135-
for (auto& type : entry.second) {
136-
for (auto& value : type.second) {
137-
mRanges[type.first].emplace_back(std::stoi(value.second.data()));
114+
for (const auto& type : entry.second) {
115+
for (const auto& value : type.second) {
116+
mRanges[type.first].emplace_back(std::stof(value.second.data()));
138117
}
139118
}
140119
}
@@ -161,11 +140,11 @@ void CalDetPublisher::configure(std::string name, const boost::property_tree::pt
161140
void CalDetPublisher::initialize(Trigger, framework::ServiceRegistry&)
162141
{
163142
auto calDetIter = 0;
164-
for (auto& type : mOutputListMap) {
143+
for (const auto& type : mOutputListMap) {
165144
auto& calMap = o2::tpc::CDBInterface::instance().getSpecificObjectFromCDB<std::unordered_map<std::string, o2::tpc::CalDet<float>>>(fmt::format("TPC/Calib/{}", type).data(),
166145
-1,
167146
std::map<std::string, std::string>());
168-
for (auto& item : calMap) {
147+
for (const auto& item : calMap) {
169148
mCalDetCanvasVec.emplace_back(std::vector<std::unique_ptr<TCanvas>>());
170149
addAndPublish(getObjectsManager(),
171150
mCalDetCanvasVec.back(),
@@ -177,7 +156,7 @@ void CalDetPublisher::initialize(Trigger, framework::ServiceRegistry&)
177156
calDetIter++;
178157
}
179158

180-
for (auto& type : mOutputList) {
159+
for (const auto& type : mOutputList) {
181160
mCalDetCanvasVec.emplace_back(std::vector<std::unique_ptr<TCanvas>>());
182161
addAndPublish(getObjectsManager(),
183162
mCalDetCanvasVec.back(),
@@ -218,14 +197,14 @@ void CalDetPublisher::update(Trigger t, framework::ServiceRegistry&)
218197

219198
auto calDetIter = 0;
220199
auto calVecIter = 0;
221-
for (auto& type : mOutputListMap) {
200+
for (const auto& type : mOutputListMap) {
222201
auto& calMap = o2::tpc::CDBInterface::instance().getSpecificObjectFromCDB<std::unordered_map<std::string, o2::tpc::CalDet<float>>>(
223202
fmt::format("TPC/Calib/{}", type).data(),
224203
mTimestamps.size() > 0 ? mTimestamps.at(calVecIter) : -1,
225204
mLookupMaps.size() > 1 ? mLookupMaps.at(calVecIter) : mLookupMaps.at(0));
226-
for (auto& item : calMap) {
205+
for (const auto& item : calMap) {
227206
auto vecPtr = toVector(mCalDetCanvasVec.at(calDetIter));
228-
o2::tpc::painter::makeSummaryCanvases(item.second, mRanges[item.second.getName()].at(0), mRanges[item.second.getName()].at(1), mRanges[item.second.getName()].at(2), true, &vecPtr);
207+
o2::tpc::painter::makeSummaryCanvases(item.second, int(mRanges[item.second.getName()].at(0)), mRanges[item.second.getName()].at(1), mRanges[item.second.getName()].at(2), true, &vecPtr);
229208
calDetIter++;
230209
}
231210
calVecIter++;
@@ -241,7 +220,7 @@ void CalDetPublisher::update(Trigger t, framework::ServiceRegistry&)
241220
mRefNoise = std::make_unique<o2::tpc::CalDet<float>>(calMap["Noise"]);
242221
ILOG(Info, Support) << "New reference noise file set!" << ENDM;
243222
244-
for (auto& canvasVec : mCalDetCanvasVec) {
223+
for (const auto& canvasVec : mCalDetCanvasVec) {
245224
for (auto& canvas : canvasVec) {
246225
if (canvas->GetName() == std::string("c_Sides_Pedestal")) {
247226
canvas->cd(3);
@@ -254,12 +233,12 @@ void CalDetPublisher::update(Trigger t, framework::ServiceRegistry&)
254233
}*/
255234
}
256235

257-
for (auto& type : mOutputList) {
236+
for (const auto& type : mOutputList) {
258237
auto& calDet = o2::tpc::CDBInterface::instance().getSpecificObjectFromCDB<o2::tpc::CalDet<float>>(fmt::format("TPC/Calib/{}", type).data(),
259238
mTimestamps.size() > 0 ? mTimestamps.at(calDetIter) : -1,
260239
mLookupMaps.size() > 1 ? mLookupMaps.at(calDetIter) : mLookupMaps.at(0));
261240
auto vecPtr = toVector(mCalDetCanvasVec.at(calDetIter));
262-
o2::tpc::painter::makeSummaryCanvases(calDet, mRanges[calDet.getName()].at(0), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2), true, &vecPtr);
241+
o2::tpc::painter::makeSummaryCanvases(calDet, int(mRanges[calDet.getName()].at(0)), mRanges[calDet.getName()].at(1), mRanges[calDet.getName()].at(2), true, &vecPtr);
263242
calDetIter++;
264243

265244
/// This will be removed when Pedestal and Noise are stored in a unordered_map
@@ -278,8 +257,8 @@ void CalDetPublisher::update(Trigger t, framework::ServiceRegistry&)
278257
mRefNoise.reset(nullptr);
279258
mRefNoise = std::make_unique<o2::tpc::CalDet<float>>(calDet);
280259
ILOG(Info, Support) << "New reference noise file set!" << ENDM;
281-
for (auto& canvasVec : mCalDetCanvasVec) {
282-
for (auto& canvas : canvasVec) {
260+
for (const auto& canvasVec : mCalDetCanvasVec) {
261+
for (const auto& canvas : canvasVec) {
283262
if (canvas->GetName() == std::string("c_Sides_Pedestal")) {
284263
canvas->cd(3);
285264
mNewZSCalibMsg->Draw();
@@ -294,8 +273,8 @@ void CalDetPublisher::update(Trigger t, framework::ServiceRegistry&)
294273

295274
void CalDetPublisher::finalize(Trigger, framework::ServiceRegistry&)
296275
{
297-
for (auto& calDetCanvasVec : mCalDetCanvasVec) {
298-
for (auto& canvas : calDetCanvasVec) {
276+
for (const auto& calDetCanvasVec : mCalDetCanvasVec) {
277+
for (const auto& canvas : calDetCanvasVec) {
299278
getObjectsManager()->stopPublishing(canvas.get());
300279
}
301280
}

0 commit comments

Comments
 (0)