|
| 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