Skip to content

Commit f81d778

Browse files
authored
ZDC: add post-processing for ADC and TDC plots (#1958)
* [ZDC] added post-processing task for ADC and TDC plots The post-processing is needed in order to correctly plot the average values and errors from individual ADC and TDC plots. * [ZDC] updated reference cionfiguration for TaskRecData - added post-processing tasks - updated checker to take post-processing output and use `OnEachSeparately` policy - added quality aggregator and post-processing (summary) * [ZDC] implemented comments * [ZDC] renamed *_summmary_* to *_summary_* * [ZDC] Update zdcTaskRecData.json Removed quality aggregation and post-processing
1 parent 3cef3da commit f81d778

9 files changed

Lines changed: 632 additions & 15 deletions

Modules/ZDC/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
add_library(O2QcZDC)
44

5-
target_sources(O2QcZDC PRIVATE src/ZDCRecDataCheck.cxx src/ZDCRecDataTask.cxx src/ZDCRawDataCheck.cxx src/ZDCRawDataTask.cxx )
5+
target_sources(O2QcZDC PRIVATE src/ZDCRecDataCheck.cxx src/ZDCRecDataTask.cxx src/ZDCRecDataPostProcessing.cxx src/PostProcessingConfigZDC.cxx src/ZDCRawDataCheck.cxx src/ZDCRawDataTask.cxx )
66

77
target_include_directories(
88
O2QcZDC
@@ -21,6 +21,7 @@ add_root_dictionary(O2QcZDC
2121
HEADERS
2222
include/ZDC/ZDCRecDataCheck.h
2323
include/ZDC/ZDCRecDataTask.h
24+
include/ZDC/ZDCRecDataPostProcessing.h
2425
include/ZDC/ZDCRawDataCheck.h
2526
include/ZDC/ZDCRawDataTask.h
2627
LINKDEF include/ZDC/LinkDef.h)

Modules/ZDC/etc/zdcTaskRecData.json

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,84 @@
5454
"saveObjectsToFile": "QcZDCRecData.root", "": "For debugging, path to the file where to save. If empty it won't save."
5555
}
5656
},
57+
"postprocessing": {
58+
"RecPP": {
59+
"active": "true",
60+
"className": "o2::quality_control_modules::zdc::ZDCRecDataPostProcessing",
61+
"moduleName": "QcZDC",
62+
"detectorName": "ZDC",
63+
"customization": [
64+
],
65+
"dataSourcesADC": [
66+
{
67+
"type": "repository",
68+
"path": "ZDC/MO/QcZDCRecTask",
69+
"names": [
70+
"ZNAC:h_ADC_ZNA_TC",
71+
"ZNA1:h_ADC_ZNA_T1",
72+
"ZNA2:h_ADC_ZNA_T2",
73+
"ZNA3:h_ADC_ZNA_T3",
74+
"ZNA4:h_ADC_ZNA_T4",
75+
"ZNAS:h_ADC_ZNA_SUM",
76+
"ZPAC:h_ADC_ZPA_TC",
77+
"ZPA1:h_ADC_ZPA_T1",
78+
"ZPA2:h_ADC_ZPA_T2",
79+
"ZPA3:h_ADC_ZPA_T3",
80+
"ZPA4:h_ADC_ZPA_T4",
81+
"ZPAS:h_ADC_ZPA_SUM",
82+
"ZEM1:h_ADC_ZEM1",
83+
"ZEM2:h_ADC_ZEM2",
84+
"ZNCC:h_ADC_ZNC_TC",
85+
"ZNC1:h_ADC_ZNC_T1",
86+
"ZNC2:h_ADC_ZNC_T2",
87+
"ZNC3:h_ADC_ZNC_T3",
88+
"ZNC4:h_ADC_ZNC_T4",
89+
"ZNCS:h_ADC_ZNC_SUM",
90+
"ZPCC:h_ADC_ZPC_TC",
91+
"ZPC1:h_ADC_ZPC_T1",
92+
"ZPC2:h_ADC_ZPC_T2",
93+
"ZPC3:h_ADC_ZPC_T3",
94+
"ZPC4:h_ADC_ZPC_T4",
95+
"ZPCS:h_ADC_ZPC_SUM"
96+
]
97+
}
98+
],
99+
"dataSourcesTDC": [
100+
{
101+
"type": "repository",
102+
"path": "ZDC/MO/QcZDCRecTask",
103+
"names": [
104+
"ZNAC:h_TDC_ZNA_TC_V",
105+
"ZNAS:h_TDC_ZNA_SUM_V",
106+
"ZPAC:h_TDC_ZPA_TC_V",
107+
"ZPAS:h_TDC_ZPA_SUM_V",
108+
"ZEM1:h_TDC_ZEM1_V",
109+
"ZEM2:h_TDC_ZEM2_V",
110+
"ZNCC:h_TDC_ZNC_TC_V",
111+
"ZNCS:h_TDC_ZNC_SUM_V",
112+
"ZPCC:h_TDC_ZPC_TC_V",
113+
"ZPCS:h_TDC_ZPC_SUM_V"
114+
]
115+
}
116+
],
117+
"initTrigger": [
118+
"userorcontrol"
119+
],
120+
"updateTrigger": [
121+
"newobject:qcdb:ZDC/MO/QcZDCRecTask/h_ADC_ZNA_TC"
122+
],
123+
"stopTrigger": [
124+
"userorcontrol"
125+
]
126+
}
127+
},
57128
"checks": {
58-
"QcZDCRecCheck": {
129+
"RecCheck": {
59130
"active": "true",
60131
"className": "o2::quality_control_modules::zdc::ZDCRecDataCheck",
61132
"moduleName": "QcZDC",
62133
"detectorName" : "ZDC",
63-
"policy": "OnAny",
134+
"policy": "OnAll",
64135
"checkParameters" : {
65136
"ADC_ZNAC" : "461.2;10;20",
66137
"ADC_ZNA1" : "115.6;10;20",
@@ -104,12 +175,12 @@
104175
"TDC_POS_MSG_Y": "0.92"
105176
},
106177
"dataSource": [{
107-
"type": "Task",
108-
"name": "QcZDCRecTask",
109-
"MOs": ["h_summmary_ADC" , "h_summmary_TDC"]
178+
"type": "PostProcessing",
179+
"name": "RecPP",
180+
"MOs": ["h_summary_ADC" , "h_summary_TDC"]
110181
}]
111182
}
112-
}
183+
}
113184
},
114185
"dataSamplingPolicies": [
115186
{

Modules/ZDC/include/ZDC/LinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
#pragma link C++ class o2::quality_control_modules::zdc::ZDCRawDataCheck+;
88
#pragma link C++ class o2::quality_control_modules::zdc::ZDCRecDataTask+;
99
#pragma link C++ class o2::quality_control_modules::zdc::ZDCRecDataCheck+;
10+
#pragma link C++ class o2::quality_control_modules::zdc::ZDCRecDataPostProcessing+;
1011
#endif
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
///
13+
/// \file PostProcessingConfigZDC.h
14+
/// \author Andrea Ferrero andrea.ferrero@cern.ch
15+
/// \brief Header file for the configuration of ZDC post-processing tasks
16+
/// \since 30/08/2023
17+
///
18+
19+
#ifndef QC_MODULE_ZDC_PPCONFIG_H
20+
#define QC_MODULE_ZDC_PPCONFIG_H
21+
22+
#include "QualityControl/PostProcessingConfig.h"
23+
#include <vector>
24+
#include <map>
25+
#include <string>
26+
#include <sstream>
27+
28+
using namespace o2::quality_control::postprocessing;
29+
namespace o2::quality_control_modules::zdc
30+
{
31+
32+
/// \brief MCH trending configuration structure
33+
struct PostProcessingConfigZDC : PostProcessingConfig {
34+
PostProcessingConfigZDC() = default;
35+
PostProcessingConfigZDC(std::string name, const boost::property_tree::ptree& config);
36+
~PostProcessingConfigZDC() = default;
37+
38+
const bool hasParameter(std::string name) const
39+
{
40+
auto entry = parameters.find(name);
41+
return (entry != parameters.end());
42+
}
43+
44+
template <typename T>
45+
const T getParameter(std::string name) const;
46+
47+
template <typename T>
48+
const T getParameter(std::string name, T defaultValue) const;
49+
50+
struct DataSource {
51+
std::string path;
52+
std::string name;
53+
};
54+
55+
std::map<std::string, std::string> parameters;
56+
std::vector<DataSource> dataSourcesADC;
57+
std::vector<DataSource> dataSourcesTDC;
58+
};
59+
60+
template <typename T>
61+
const T PostProcessingConfigZDC::getParameter(std::string name) const
62+
{
63+
T result{};
64+
auto entry = parameters.find(name);
65+
if (entry != parameters.end()) {
66+
std::istringstream istr(entry->second);
67+
istr >> result;
68+
}
69+
70+
return result;
71+
}
72+
73+
template <typename T>
74+
const T PostProcessingConfigZDC::getParameter(std::string name, T defaultValue) const
75+
{
76+
T result = defaultValue;
77+
auto entry = parameters.find(name);
78+
if (entry != parameters.end()) {
79+
std::istringstream istr(entry->second);
80+
istr >> result;
81+
}
82+
83+
return result;
84+
}
85+
86+
} // namespace o2::quality_control_modules::zdc
87+
88+
#endif // QC_MODULE_ZDC_PPCONFIG_H
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
///
13+
/// \file ZDCRecDataPostProcessing.h
14+
/// \author Andrea Ferrero andrea.ferrero@cern.ch
15+
/// \brief Post-processing of the ZDC ADC and TDC plots
16+
/// \since 30/08/2023
17+
///
18+
19+
#ifndef QC_MODULE_ZDC_ZDCZDCRECDATAPP_H
20+
#define QC_MODULE_ZDC_ZDCZDCRECDATAPP_H
21+
22+
#include "QualityControl/PostProcessingInterface.h"
23+
24+
#include <TH1F.h>
25+
#include <memory>
26+
#include <string>
27+
28+
namespace o2::quality_control::repository
29+
{
30+
class DatabaseInterface;
31+
}
32+
33+
using namespace o2::quality_control;
34+
using namespace o2::quality_control::postprocessing;
35+
36+
namespace o2::quality_control_modules::zdc
37+
{
38+
39+
struct MOHelper {
40+
MOHelper();
41+
MOHelper(std::string p, std::string n);
42+
43+
bool update(o2::quality_control::repository::DatabaseInterface* qcdb,
44+
long timeStamp = -1,
45+
const o2::quality_control::core::Activity& activity = {});
46+
void setStartIme();
47+
long getTimeStamp() { return mTimeStamp; }
48+
template <typename T>
49+
T* get()
50+
{
51+
if (!mObject) {
52+
return nullptr;
53+
}
54+
if (!mObject->getObject()) {
55+
return nullptr;
56+
}
57+
58+
// Get histogram object
59+
T* h = dynamic_cast<T*>(mObject->getObject());
60+
return h;
61+
}
62+
63+
std::shared_ptr<o2::quality_control::core::MonitorObject> mObject;
64+
std::string mPath;
65+
std::string mName;
66+
uint64_t mTimeStart{ 0 };
67+
uint64_t mTimeStamp{ 0 };
68+
};
69+
70+
/// \brief A post-processing task which processes the ADC and TDC plots from ZDC
71+
class ZDCRecDataPostProcessing : public PostProcessingInterface
72+
{
73+
public:
74+
ZDCRecDataPostProcessing() = default;
75+
~ZDCRecDataPostProcessing() override = default;
76+
77+
void configure(const boost::property_tree::ptree& config) override;
78+
void initialize(Trigger, framework::ServiceRegistryRef) override;
79+
void update(Trigger, framework::ServiceRegistryRef) override;
80+
void finalize(Trigger, framework::ServiceRegistryRef) override;
81+
82+
private:
83+
template <typename T>
84+
void publishHisto(T* h, bool statBox = false,
85+
const char* drawOptions = "",
86+
const char* displayHints = "");
87+
void createSummaryADCHistos(Trigger t, repository::DatabaseInterface* qcdb);
88+
void createSummaryTDCHistos(Trigger t, repository::DatabaseInterface* qcdb);
89+
void updateSummaryADCHistos(Trigger t, repository::DatabaseInterface* qcdb);
90+
void updateSummaryTDCHistos(Trigger t, repository::DatabaseInterface* qcdb);
91+
92+
// CCDB object accessors
93+
std::map<size_t, MOHelper> mMOsADC;
94+
std::map<size_t, MOHelper> mMOsTDC;
95+
96+
// Hit rate histograms ===============================================
97+
std::unique_ptr<TH1F> mSummaryADCHisto;
98+
std::unique_ptr<TH1F> mSummaryTDCHisto;
99+
};
100+
101+
template <typename T>
102+
void ZDCRecDataPostProcessing::publishHisto(T* h, bool statBox,
103+
const char* drawOptions,
104+
const char* displayHints)
105+
{
106+
h->LabelsOption("v");
107+
h->SetLineColor(kBlack);
108+
if (!statBox) {
109+
h->SetStats(0);
110+
}
111+
getObjectsManager()->startPublishing(h);
112+
if (drawOptions) {
113+
getObjectsManager()->setDefaultDrawOptions(h, drawOptions);
114+
}
115+
if (displayHints) {
116+
getObjectsManager()->setDisplayHint(h, displayHints);
117+
}
118+
}
119+
120+
} // namespace o2::quality_control_modules::zdc
121+
122+
#endif // QC_MODULE_ZDC_ZDCZDCRECDATAPP_H

0 commit comments

Comments
 (0)