43void EMCDCSProcessor::init(
const std::vector<DPID>& pids)
46 for (
const auto& it : pids) {
50 mFEECFG = std::make_unique<FeeDCS>();
51 mELMB = std::make_unique<EMCELMB>();
52 mELMBdata = std::make_unique<ElmbData>();
61 mUpdateFEEcfg =
false;
65 LOG(info) <<
"\n\n\nProcessing new TF\n-----------------";
68 for (
auto& it : dps) {
69 const auto& el = mPids.find(it.id);
71 if (el == mPids.end()) {
72 LOG(
debug) <<
"DP " << it.id <<
" not found in the map of expected DPs- ignoring...";
75 LOG(
debug) <<
"DP " << it.id <<
" found in map";
89 mELMBdata->setData(mELMB->getData());
102 LOG(info) <<
"Processing DP = " << dp <<
", with value = " << o2::dcs::getValue<double>(dp);
104 LOG(info) <<
"Processing DP = " << dp <<
", with value = " << o2::dcs::getValue<int32_t>(dp);
106 LOG(info) <<
"Processing DP = " << dp <<
", with value = " << o2::dcs::getValue<uint32_t>(dp);
112 auto& dpval_prev = mapFEEcfg[dpid];
113 if (dpval_prev.size() == 0 ||
val.get_epoch_time() != dpval_prev.back().get_epoch_time())
115 dpval_prev.push_back(
val);
129void EMCDCSProcessor::FillElmbDP(
const DPCOM& dpcom)
131 auto& dpid = dpcom.
id;
135 std::string alias(dpid.get_alias());
137 auto& dpval = dpcom.
data;
138 auto val = o2::dcs::getValue<double>(dpcom);
143 if ((
index = alias.find(
"EMC_PT")) != std::string::npos) {
144 std::sscanf(alias.data(),
"EMC_PT_%d.Temperature", &iPT);
146 LOG(
debug) <<
"alias=" << alias.data() <<
": iPT=" << iPT <<
", val=" <<
val;
149 if (iPT < 0 || iPT > 159) {
150 LOG(error) <<
"Wrong Sensor Index iPT=" << iPT <<
" for DP " << alias.data();
153 mELMB->addMeasurement(iPT,
val);
155 LOG(info) <<
"EMC_PT pattern not found for DPype = DPVAL_DOUBLE: alias = " << alias.data();
160void EMCDCSProcessor::FillFeeDP(
const DPCOM& dpcom)
162 auto& dpid = dpcom.
id;
166 std::string alias(dpid.get_alias());
168 auto& dpval = dpcom.
data;
170 auto val = dpval.payload_pt1;
182 if ((
index = alias.find(
"STU_ERROR_COUNT_TRU")) != std::string::npos) {
187 else if (alias.find(
"EMC_RUNNUMBER") != std::string::npos) {
188 if (mFEECFG->getRunNumber() !=
val) {
189 mUpdateFEEcfg =
true;
191 if (mRunNumberFromGRP == -2) {
192 mFEECFG->setRunNumber(
val);
194 mFEECFG->setRunNumber(mRunNumberFromGRP);
195 if (mRunNumberFromGRP !=
val) {
196 LOG(error) <<
"RunNumber from GRP (=" << mRunNumberFromGRP <<
") and from EMC DCS (=" <<
val <<
") are not consistant";
199 }
else if (alias.find(
"EMC_DDL_LIST0") != std::string::npos) {
200 mFEECFG->setDDLlist0(
val);
201 }
else if (alias.find(
"EMC_DDL_LIST1") != std::string::npos) {
202 mFEECFG->setDDLlist1(
val);
203 }
else if ((
index = alias.find(
"SRU")) != std::string::npos) {
204 if ((
index = alias.find(
"FMVER")) != std::string::npos) {
205 std::sscanf((std::string(alias.substr(
index - 3, 2))).data(),
"%02d", &iSM);
206 if (iSM < 0 || iSM >= 20) {
207 LOG(error) <<
"ERROR : iSM = " << iSM <<
" for" << alias.data();
210 mFEECFG->setSRUFWversion(iSM,
val);
211 }
else if ((
index = alias.find(
"CFG")) != std::string::npos) {
212 std::sscanf((std::string(alias.substr(
index - 3, 2))).data(),
"%02d", &iSM);
213 if (iSM < 0 || iSM >= 20) {
214 LOG(error) <<
"ERROR : iSM = " << iSM <<
" for" << alias.data();
217 mFEECFG->setSRUconfig(iSM,
val);
219 }
else if ((
index = alias.find(
"TRU")) != std::string::npos) {
220 std::sscanf((std::string(alias.substr(
index + 3, 2))).data(),
"%02d", &iTRU);
222 if (iTRU < 0 || iTRU >=
kNTRU) {
223 LOG(error) <<
"ERROR : iTRU = " << iTRU <<
" for" << alias.data();
227 mTRU = mFEECFG->getTRUDCS(iTRU);
228 if (alias.find(
"L0ALGSEL") != std::string::npos) {
230 }
else if (alias.find(
"PEAKFINDER") != std::string::npos) {
232 }
else if (alias.find(
"GLOBALTHRESH") != std::string::npos) {
234 }
else if (alias.find(
"COSMTHRESH") != std::string::npos) {
236 }
else if ((
index = alias.find(
"MASK")) != std::string::npos) {
237 std::sscanf((std::string(alias.substr(
index + 4, 1))).data(),
"%02d", &iMask);
239 if (iMask < 0 || iMask > 5) {
240 LOG(error) <<
"ERROR : iMask = " << iMask <<
" for" << alias.data();
245 mFEECFG->setTRUDCS(iTRU, mTRU);
246 }
else if ((
index = alias.find(
"_STU_")) != std::string::npos) {
247 bool kEMC = (std::string(alias.substr(
index - 3, 3))).
compare(0, 3,
"DMC", 0, 3);
248 mSTU = kEMC ? mFEECFG->getSTUDCSEMCal() : mFEECFG->getSTUDCSDCal();
250 if (alias.find(
"MEDIAN") != std::string::npos) {
252 }
else if (alias.find(
"GETRAW") != std::string::npos) {
254 }
else if (alias.find(
"REGION") != std::string::npos) {
256 }
else if (alias.find(
"FWVERS") != std::string::npos) {
258 }
else if (alias.find(
"PATCHSIZE") != std::string::npos) {
260 }
else if ((
index = alias.find(
"STU_G")) != std::string::npos) {
263 std::sscanf((std::string(alias.substr(
index + 5, 2))).data(),
"%c%d", &par1, &par2);
269 }
else if ((
index = alias.find(
"STU_J")) != std::string::npos) {
272 std::sscanf((std::string(alias.substr(
index + 5, 2))).data(),
"%c%d", &par1, &par2);
281 mFEECFG->setSTUEMCal(mSTU);
283 mFEECFG->setSTUDCal(mSTU);
291 LOG(info) <<
"updating Temperture objects in CCDB";
296 std::map<std::string, std::string> metadata;
297 metadata[
"responsible"] =
"Martin Poghosyan";
304 LOG(info) <<
"updating FEE DCS objects in CCDB";
308 std::map<std::string, std::string> metadata;
309 metadata[
"responsible"] =
"Martin Poghosyan";
315 auto& dpid = dpcom.
id;
319 auto alias = dpid.get_alias();
321 auto& dpval = dpcom.
data;
323 auto val = dpval.payload_pt1;
325 std::cout <<
"DPCOM Info:";
327 std::cout <<
" alias: " << alias;
328 std::cout <<
" | type : " << type_str;
329 std::cout <<
" | ts : " << ts;
330 std::cout <<
" | value: " <<
val << std::endl;
DeliveryType get_type() const noexcept
static const char * getCDBPathTemperatureSensor()
Get CDB path for the Temperature Sensor data.
static const char * getCDBPathFeeDCS()
Get CDB path for the FEE DCS settings.
void updateElmbCCDBinfo()
void printPDCOM(const DPCOM &dpcom)
void prepareCCDBobjectInfo(const T &obj, CcdbObjectInfo &info, const std::string &path, TFType tf, const std::map< std::string, std::string > &md)
int processDP(const DPCOM &dpcom)
int process(const gsl::span< const DPCOM > dps)
void setPatchSize(int size)
void setGammaHigh(int vzpar, int val)
void setJetHigh(int vzpar, int val)
void setMedianMode(int mode)
void setGammaLow(int vzpar, int val)
void setJetLow(int vzpar, int val)
void setL0SEL(uint64_t la)
void setL0COSM(uint64_t lc)
void setGTHRL0(uint64_t lg)
void setSELPF(uint64_t pf)
void setMaskReg(uint32_t msk, int pos)
GLint GLint GLsizei GLint GLenum GLenum type
std::string show(const DeliveryType type)
void compare(const PedestalProcessorData &testobject, const TProfile &refFECHG, const TProfile &refFECLG, const TProfile &refLEDMONHG, const TProfile &refLEDMONLG, bool testCount, bool verbose)
const DataPointIdentifier id
uint64_t get_epoch_time() const noexcept
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"