|
19 | 19 | #include <TH1.h> |
20 | 20 |
|
21 | 21 | #include "QualityControl/QcInfoLogger.h" |
| 22 | +#include "QualityControl/QCInputs.h" |
| 23 | +#include "QualityControl/QCInputsAdapters.h" |
22 | 24 | #include "Skeleton/SkeletonLateTask.h" |
23 | 25 | #include <Framework/InputRecordWalker.h> |
24 | 26 | #include <Framework/DataRefUtils.h> |
@@ -54,50 +56,19 @@ void SkeletonLateTask::startOfActivity(const Activity& activity) |
54 | 56 | // mGraph->Clear(); |
55 | 57 | } |
56 | 58 |
|
57 | | -void SkeletonLateTask::process(o2::framework::ProcessingContext& ctx) |
| 59 | +void SkeletonLateTask::process(const quality_control::core::QCInputs& data) |
58 | 60 | { |
59 | 61 | // THIS FUNCTION BODY IS AN EXAMPLE. PLEASE REMOVE EVERYTHING YOU DO NOT NEED. |
60 | 62 |
|
61 | | - if (ctx.inputs().isValid("QcTask")) { |
62 | | - auto qcTaskMOs = ctx.inputs().get<MonitorObjectCollection*>("QcTask"); |
63 | | - if (qcTaskMOs == nullptr) { |
64 | | - ILOG(Error, Ops) << "empty ptr" << ENDM; |
65 | | - return; |
66 | | - } |
67 | | - |
68 | | - ILOG(Info, Ops) << "MOC has " << qcTaskMOs->GetEntries() << " entries" << ENDM; |
69 | | - for (auto const& obj : *qcTaskMOs) { |
70 | | - |
71 | | - if (obj == nullptr) { |
72 | | - ILOG(Error, Ops) << "Found a null MonitorObject in the collection" << ENDM; |
73 | | - continue; |
74 | | - } |
75 | | - |
76 | | - auto mo = dynamic_cast<o2::quality_control::core::MonitorObject*>(obj); |
77 | | - if (mo == nullptr) { |
78 | | - ILOG(Error, Ops) << "Could not cast TObject into MonitorObject" << ENDM; |
79 | | - continue; |
80 | | - } |
81 | | - |
82 | | - if (mo->getName() == "example") { |
83 | | - ILOG(Info, Ops) << "Got the 'example' object" << ENDM; |
84 | | - } else { |
85 | | - continue; |
86 | | - } |
87 | | - |
88 | | - auto histo = dynamic_cast<TH1*>(mo->getObject()); |
89 | | - if (histo == nullptr) { |
90 | | - ILOG(Error, Ops) << "Could not cast MonitorObject to TH1" << ENDM; |
91 | | - continue; |
92 | | - } |
93 | | - |
94 | | - ILOG(Info, Ops) << "Histogram " << histo->GetName() << " has " << histo->GetEntries() << " entries" << ENDM; |
95 | | - |
96 | | - mGraph->AddPoint(histo->GetEntries(), histo->GetMean()); |
97 | | - } |
| 63 | + if (auto histoOpt = getMonitorObject<TH1>(data, "example")) { |
| 64 | + const TH1& histo = histoOpt.value(); |
| 65 | + |
| 66 | + ILOG(Info, Ops) << "Histogram " << histo.GetName() << " has " << histo.GetEntries() << " entries" << ENDM; |
| 67 | + mGraph->AddPoint(histo.GetEntries(), histo.GetMean()); |
98 | 68 | } |
99 | | - if (ctx.inputs().isValid("QcCheck")) { |
100 | | - ILOG(Info, Ops) << "got QcCheck results" << ENDM; |
| 69 | + |
| 70 | + if (auto qoOpt = getQualityObject(data, "QcCheck")) { |
| 71 | + ILOG(Info, Ops) << "Got QcCheck result: " << qoOpt.value().get().getQuality() << ENDM; |
101 | 72 | } |
102 | 73 | } |
103 | 74 |
|
|
0 commit comments