|
| 1 | +// Copyright 2019-2022 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 ZDCRecDataTask.h |
| 14 | +/// \author Carlo Puggioni |
| 15 | +/// |
| 16 | + |
| 17 | +#ifndef QC_MODULE_ZDC_ZDCZDCRECDATATASK_H |
| 18 | +#define QC_MODULE_ZDC_ZDCZDCRECDATATASK_H |
| 19 | + |
| 20 | +#include "QualityControl/TaskInterface.h" |
| 21 | +#include "ZDCBase/Constants.h" |
| 22 | +#include "ZDCSimulation/ZDCSimParam.h" |
| 23 | +#include "DataFormatsZDC/BCRecData.h" |
| 24 | +#include "DataFormatsZDC/RecEventFlat.h" |
| 25 | +#include "DataFormatsZDC/ZDCEnergy.h" |
| 26 | +#include "DataFormatsZDC/ZDCTDCData.h" |
| 27 | +#include "SimulationDataFormat/DigitizationContext.h" |
| 28 | +#include "ZDCBase/Constants.h" |
| 29 | +#include "ZDCSimulation/Digitizer.h" |
| 30 | +#include <TH1.h> |
| 31 | +#include <TH2.h> |
| 32 | +#include <map> |
| 33 | +#include <string> |
| 34 | +#include <vector> |
| 35 | + |
| 36 | +class TH1F; |
| 37 | + |
| 38 | +using namespace o2::quality_control::core; |
| 39 | + |
| 40 | +namespace o2::quality_control_modules::zdc |
| 41 | +{ |
| 42 | + |
| 43 | +/// \brief Example Quality Control DPL Task |
| 44 | +/// \author My Name |
| 45 | +class ZDCRecDataTask final : public TaskInterface |
| 46 | +{ |
| 47 | + public: |
| 48 | + /// \brief Constructor |
| 49 | + ZDCRecDataTask() = default; |
| 50 | + /// Destructor |
| 51 | + ~ZDCRecDataTask() override; |
| 52 | + |
| 53 | + struct sHisto1D { |
| 54 | + TH1* histo; |
| 55 | + std::string ch; |
| 56 | + std::string typeh; |
| 57 | + std::string typech; |
| 58 | + }; |
| 59 | + struct sHisto2D { |
| 60 | + TH2* histo; |
| 61 | + std::string typeh; |
| 62 | + std::string ch1; |
| 63 | + std::string ch2; |
| 64 | + std::string typech1; |
| 65 | + std::string typech2; |
| 66 | + }; |
| 67 | + |
| 68 | + // Definition of the methods for the template method pattern |
| 69 | + void initialize(o2::framework::InitContext& ctx) override; |
| 70 | + void startOfActivity(Activity& activity) override; |
| 71 | + void startOfCycle() override; |
| 72 | + void monitorData(o2::framework::ProcessingContext& ctx) override; |
| 73 | + void endOfCycle() override; |
| 74 | + void endOfActivity(Activity& activity) override; |
| 75 | + void reset() override; |
| 76 | + void init(); |
| 77 | + void initVecCh(); |
| 78 | + void initVecType(); |
| 79 | + void initHisto(); |
| 80 | + void insertChVec(std::string ch); |
| 81 | + void insertTypeVec(std::string type); |
| 82 | + void setBinHisto1D(int numBinX, double minBinX, double maxBinX); |
| 83 | + void setBinHisto2D(int numBinX, double minBinX, double maxBinX, int numBinY, double minBinY, double maxBinY); |
| 84 | + void setNumBinX(int nbin) { fNumBinX = nbin; }; |
| 85 | + void setMinBinX(double min) { fMinBinX = min; }; |
| 86 | + void setMaxBinX(double max) { fMaxBinX = max; }; |
| 87 | + void setNumBinY(int nbin) { fNumBinY = nbin; }; |
| 88 | + void setMinBinY(double min) { fMinBinY = min; }; |
| 89 | + void setMaxBinY(double max) { fMaxBinY = max; }; |
| 90 | + int getNumBinX() { return fNumBinX; }; |
| 91 | + int getMinBinX() { return fMinBinX; }; |
| 92 | + int getMaxBinX() { return fMaxBinX; }; |
| 93 | + int getNumBinY() { return fNumBinY; }; |
| 94 | + int getMinBinY() { return fMinBinY; }; |
| 95 | + int getMaxBinY() { return fMaxBinY; }; |
| 96 | + float getADCRecValue(std::string typech, std::string ch); |
| 97 | + int getIdTDCch(std::string typech, std::string ch); |
| 98 | + // int getTDCRecValue(int tdcid); |
| 99 | + bool addNewHisto(std::string typeH, std::string name, std::string title, std::string typeCh1, std::string ch1, std::string typeCh2, std::string ch2); |
| 100 | + bool add1DHisto(std::string typeH, std::string name, std::string title, std::string typeCh1, std::string ch); |
| 101 | + bool add2DHisto(std::string typeH, std::string name, std::string title, std::string typeCh1, std::string ch1, std::string typeCh2, std::string ch2); |
| 102 | + void dumpHistoStructure(); |
| 103 | + int process(const gsl::span<const o2::zdc::BCRecData>& RecBC, const gsl::span<const o2::zdc::ZDCEnergy>& Energy, const gsl::span<const o2::zdc::ZDCTDCData>& TDCData, const gsl::span<const uint16_t>& Info); |
| 104 | + bool FillTDCValueHisto(); |
| 105 | + |
| 106 | + private: |
| 107 | + std::vector<std::string> mVecCh; |
| 108 | + std::vector<std::string> mVecType; |
| 109 | + std::vector<std::string> mNameHisto; |
| 110 | + std::vector<sHisto1D> mHisto1D; |
| 111 | + std::vector<sHisto2D> mHisto2D; |
| 112 | + o2::zdc::RecEventFlat mEv; |
| 113 | + int fNumBinX = 0; |
| 114 | + double fMinBinX = 0; |
| 115 | + double fMaxBinX = 0; |
| 116 | + int fNumBinY = 0; |
| 117 | + double fMinBinY = 0; |
| 118 | + double fMaxBinY = 0; |
| 119 | + // TH1F* mHistogram = nullptr; |
| 120 | +}; |
| 121 | + |
| 122 | +} // namespace o2::quality_control_modules::zdc |
| 123 | + |
| 124 | +#endif // QC_MODULE_ZDC_ZDCZDCRECDATATASK_H |
0 commit comments