Project
Loading...
Searching...
No Matches
EMCDCSProcessor.h
Go to the documentation of this file.
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#ifndef ALICEO2_EMCAL_EMCDCSPROCESSOR_H_
13#define ALICEO2_EMCAL_EMCDCSPROCESSOR_H_
14
15#include <Rtypes.h>
16#include <gsl/gsl>
17
22#include "CCDB/CcdbObjectInfo.h"
24#include "CCDB/CcdbApi.h"
25
30#include "EMCALCalib/FeeDCS.h"
31#include "EMCALCalib/ElmbData.h"
32
33namespace o2
34{
35
36namespace emcal
37{
38
44
46{
47
48 public:
49 using TFType = uint64_t;
51
52 EMCDCSProcessor() = default;
53 ~EMCDCSProcessor() = default;
54
55 void init(const std::vector<DPID>& pids);
56 int process(const gsl::span<const DPCOM> dps);
57 int processDP(const DPCOM& dpcom);
58 void processElmb();
59
60 void printPDCOM(const DPCOM& dpcom);
61
62 const FeeDCS& getFeeDCSdata() const { return *mFEECFG; }
63 const ElmbData& getELMBdata() const { return *mELMBdata; }
64
65 bool isUpdateELMB() { return mUpdateELMB; }
66 bool isUpdateFEEcfg() { return mUpdateFEEcfg; }
67
68 const CcdbObjectInfo& getccdbELMBinfo() const { return mccdbELMBinfo; }
69 const CcdbObjectInfo& getccdbFeeDCSinfo() const { return mccdbFEEcfginfo; }
70
71 CcdbObjectInfo& getccdbELMBinfo() { return mccdbELMBinfo; }
72 CcdbObjectInfo& getccdbFeeDCSinfo() { return mccdbFEEcfginfo; }
73 int getRunNumberFromGRP() { return mRunNumberFromGRP; }
74
75 void updateFeeCCDBinfo();
76 void updateElmbCCDBinfo();
77
78 void useVerboseMode() { mVerbose = true; }
79
80 template <typename T>
81 void prepareCCDBobjectInfo(const T& obj, CcdbObjectInfo& info, const std::string& path, TFType tf,
82 const std::map<std::string, std::string>& md);
83
84 void setTF(TFType tf) { mTF = tf; }
85 void setElmbCCDBupdateRate(TFType tf) { mElmbCCDBupdateRate = tf; }
86 void setRunNumberFromGRP(int rn) { mRunNumberFromGRP = rn; }
87
88 private:
89 TFType mTF{0}; // TF index for processing
90 TFType mTFprevELMB{0}; // TF index of previous ELMB data update in CCDB
91 TFType mElmbCCDBupdateRate{1000}; // duration (in TF units) for averaging and updating the ELMB data in CCDB
92 bool mVerbose = false;
93 int mRunNumberFromGRP = -2; // Run number from GRP; -1 is the default in RunStatusChecker.h. Here use -2.
94
95 std::unordered_map<DPID, bool> mPids; // contains all PIDs for the processor, the bool
96 // will be true if the DP was processed at least once
97 std::unordered_map<DPID, std::vector<DPVAL>> mapFEEcfg; // containds FEE CGF data
98
99 bool mUpdateFEEcfg{false};
100 bool mUpdateELMB{false};
101 CcdbObjectInfo mccdbELMBinfo;
102 CcdbObjectInfo mccdbFEEcfginfo;
103
104 std::unique_ptr<FeeDCS> mFEECFG;
105 std::unique_ptr<EMCELMB> mELMB;
106 std::unique_ptr<ElmbData> mELMBdata;
107
110
111 void FillFeeDP(const DPCOM& dpcom);
112 void FillElmbDP(const DPCOM& dpcom);
113
114 ClassDefNV(EMCDCSProcessor, 1);
115};
116
117template <typename T>
118void EMCDCSProcessor::prepareCCDBobjectInfo(const T& obj, CcdbObjectInfo& info, const std::string& path, TFType tf,
119 const std::map<std::string, std::string>& md)
120{
121
122 // prepare all info to be sent to CCDB for object obj
124 auto flName = o2::ccdb::CcdbApi::generateFileName(clName);
125 info.setPath(path);
126 info.setObjectType(clName);
127 info.setFileName(flName);
130 info.setMetaData(md);
131}
132
133} // namespace emcal
134} // namespace o2
135#endif
uint64_t TFType
DCS processor for EMCAL DPs.
static std::string generateFileName(const std::string &inp)
Definition CcdbApi.cxx:798
void setStartValidityTimestamp(long start)
void setFileName(const std::string &nm)
static constexpr long MONTH
void setPath(const std::string &path)
void setEndValidityTimestamp(long end)
void setObjectType(const std::string &tp)
void setMetaData(const std::map< std::string, std::string > &md)
CcdbObjectInfo & getccdbFeeDCSinfo()
void init(const std::vector< DPID > &pids)
void printPDCOM(const DPCOM &dpcom)
const FeeDCS & getFeeDCSdata() const
void setElmbCCDBupdateRate(TFType tf)
void prepareCCDBobjectInfo(const T &obj, CcdbObjectInfo &info, const std::string &path, TFType tf, const std::map< std::string, std::string > &md)
const CcdbObjectInfo & getccdbFeeDCSinfo() const
const ElmbData & getELMBdata() const
const CcdbObjectInfo & getccdbELMBinfo() const
int processDP(const DPCOM &dpcom)
CcdbObjectInfo & getccdbELMBinfo()
CCDB container for the DCS data in EMCAL.
Definition TriggerDCS.h:37
CCDB container for STU DCS data in EMCAL.
CCDB container for TRU DCS data in EMCAL.
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
static std::string getClassName(const T &obj)
get the class name of the object