Project
Loading...
Searching...
No Matches
FITDCSConfigReader.cxx
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
16
18
20
21#include <cstdint>
22#include <sstream>
23
24using namespace o2::fit;
25
26void FITDCSConfigReader::processDChM(gsl::span<const char> configBuf)
27{
28 LOG(info) << "Processing dead channel map";
29
30 // AM: need to specify the size,
31 // otherwise the configBuf.data() pointer might point to an array that is too long,
32 // the array sometimes includes "extra memory from previous runs"
33 std::istringstream iss(std::string(configBuf.data(), configBuf.size()));
34 uint8_t iLine = 0; // line 0 corresponds to cahnnel id 0 and so on
35
36 for (std::string line; std::getline(iss, line);) {
37 mDChM.setChannelAlive(iLine, std::stoi(line) == 1);
38 iLine++;
39 }
40
41 if (getVerboseMode()) {
42 LOGP(info, "Processed {} channels", iLine);
43 }
44}
45
47{
48 std::map<std::string, std::string> metadata;
49 o2::calibration::Utils::prepareCCDBobjectInfo(mDChM, mCcdbObjectInfoDChM, mCcdbPathDChM, metadata, getStartValidityDChM(), getEndValidityDChM());
50 mCcdbObjectInfoDChM.setValidateUpload(getValidateUploadMode());
51}
52
55const std::string& FITDCSConfigReader::getCcdbPathDChm() const { return mCcdbPathDChM; }
56void FITDCSConfigReader::setCcdbPathDChM(const std::string& ccdbPath) { mCcdbPathDChM = ccdbPath; }
57const long FITDCSConfigReader::getStartValidityDChM() const { return mStartValidityDChM; }
58const long FITDCSConfigReader::getEndValidityDChM() const { return mStartValidityDChM + getValidDaysDChM() * o2::ccdb::CcdbObjectInfo::DAY; }
59void FITDCSConfigReader::setStartValidityDChM(const long startValidity) { mStartValidityDChM = startValidity; }
62const o2::ccdb::CcdbObjectInfo& FITDCSConfigReader::getObjectInfoDChM() const { return mCcdbObjectInfoDChM; }
64
65const std::string& FITDCSConfigReader::getFileNameDChM() const { return mFileNameDChM; }
66void FITDCSConfigReader::setFileNameDChM(const std::string& fileName) { mFileNameDChM = fileName; }
67
68const uint FITDCSConfigReader::getValidDaysDChM() const { return mValidDaysDChM; }
69void FITDCSConfigReader::setValidDaysDChM(const uint validDays) { mValidDaysDChM = validDays; }
70
71const bool FITDCSConfigReader::getVerboseMode() const { return mVerbose; }
72void FITDCSConfigReader::setVerboseMode(const bool verboseMode) { mVerbose = verboseMode; }
73
74const bool FITDCSConfigReader::getValidateUploadMode() const { return mValidateUpload; }
75void FITDCSConfigReader::setValidateUploadMode(const bool validateUpload) { mValidateUpload = validateUpload; };
Utils and constants for calibration and related workflows.
DCS configuration reader for FIT.
std::string ccdbPath(const std::string badChannelType)
static constexpr long DAY
static constexpr long INFINITE_TIMESTAMP
void setVerboseMode(const bool verboseMode)
void setValidDaysDChM(const uint validDays)
const long getStartValidityDChM() const
const bool isStartValidityDChMSet() const
void setCcdbPathDChM(const std::string &ccdbPath)
o2::fit::DeadChannelMap mDChM
The dead channel map CCDB object.
void setValidateUploadMode(const bool validateUpload)
const bool getValidateUploadMode() const
virtual void processDChM(gsl::span< const char > configBuf)
const std::string & getFileNameDChM() const
void setStartValidityDChM(const long startValidity)
const o2::ccdb::CcdbObjectInfo & getObjectInfoDChM() const
const o2::fit::DeadChannelMap & getDChM() const
const long getEndValidityDChM() const
void setFileNameDChM(const std::string &fileName)
const std::string & getCcdbPathDChm() const
static void prepareCCDBobjectInfo(T &obj, o2::ccdb::CcdbObjectInfo &info, const std::string &path, const std::map< std::string, std::string > &md, long start, long end=-1)
Definition Utils.h:91
void setChannelAlive(const uint8_t &chId, const bool isAlive)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"