31 for (
const auto& it : pids) {
34 mMagFieldHelper.
verbose = mVerbose;
37 int lastFilledElement = 0;
84 LOG(fatal) <<
"Something went wrong definining aliases, expected " <<
GRPLHCInfo::nAliasesLHC <<
", found " << lastFilledElement;
95 LOG(info) <<
"\n\n\nProcessing new TF\n-----------------";
97 mMagFieldHelper.
updated =
false;
99 mUpdateLHCIFInfo =
false;
102 for (
const auto& it : dps) {
120 auto& dpid = dpcom.
id;
126 LOG(info) <<
"Processing DP = " << dpcom <<
", with double value = " << o2::dcs::getValue<double>(dpcom);
129 LOG(info) <<
"Processing DP = " << dpcom <<
", with bool value = " << o2::dcs::getValue<bool>(dpcom);
132 LOG(info) <<
"Processing DP = " << dpcom <<
", with string value = " << o2::dcs::getValue<std::string>(dpcom);
138 std::string aliasStr(dpid.get_alias());
141 if (aliasStr ==
"L3Current") {
142 mMagFieldHelper.
updateCurL3(
static_cast<float>(o2::dcs::getValue<double>(dpcom)));
143 }
else if (aliasStr ==
"DipoleCurrent") {
144 mMagFieldHelper.
updateCurDip(
static_cast<float>(o2::dcs::getValue<double>(dpcom)));
145 }
else if (aliasStr ==
"L3Polarity") {
146 mMagFieldHelper.
updateSignL3(o2::dcs::getValue<bool>(dpcom));
147 }
else if (aliasStr ==
"DipolePolarity") {
148 mMagFieldHelper.
updateSignDip(o2::dcs::getValue<bool>(dpcom));
193 auto& vect = mapToUpdate[alias];
195 auto& dpcomdata = dpcom.
data;
196 auto& dpid = dpcom.
id;
197 std::string aliasStr(dpid.get_alias());
199 if (aliasStr == alias) {
201 LOG(info) <<
"It matches the requested string " << alias <<
", let's check if the value needs to be updated";
203 updateVector(dpid, mapToUpdate[alias], aliasStr, dpcomdata.get_epoch_time(), o2::dcs::getValue<double>(dpcom));
215 auto& dpcomdata = dpcom.
data;
216 auto& dpid = dpcom.
id;
217 std::string aliasStr(dpid.get_alias());
219 if (aliasStr == alias) {
220 auto val = o2::dcs::getValue<std::string>(dpcom);
222 LOG(info) <<
"It matches the requested string " << alias <<
", let's check if the value needs to be updated";
223 LOG(info) <<
"old value = " << p.second <<
", new value = " <<
val <<
", call " << mCallSlice;
225 if (mCallSlice == 0 || (
val != p.second)) {
226 p.first = dpcomdata.get_epoch_time();
230 LOG(info) <<
"Updating value " << alias <<
" with timestamp " << p.first;
246 LOG(info) <<
"old value = " << p.second <<
", new value = " <<
val <<
", absolute difference = " << std::abs(p.second -
val) <<
" call " << mCallSlice;
248 if (mCallSlice == 0 || (std::abs(p.second -
val) > 0.5e-7 * (std::abs(p.second) + std::abs(
val)))) {
250 LOG(info) <<
"value will be updated";
255 LOG(info) <<
"value will not be updated";
267 auto& dpcomdata = dpcom.
data;
268 auto& dpid = dpcom.
id;
269 std::string aliasStr(dpid.get_alias());
271 LOG(info) <<
"Processing LHCIF DP " << aliasStr;
273 const auto&
type = dpid.get_type();
274 double val = -99999999;
276 val = o2::dcs::getValue<double>(dpcom);
286 if (aliasStr.find(
"BPTX") != string::npos) {
320 for (
int ibkg = 0; ibkg < 3; ++ibkg) {
347 LOG(info) <<
"At least one DP related to B field changed --> we will update CCDB with startTime " << mStartValidityMagFi;
349 if (mMagFieldHelper.
isSet != (0x1 << 4) - 1) {
350 LOG(alarm) <<
"Magnetic field was updated but not all fields were set: no FBI was seen?";
351 mMagFieldHelper.
updated =
false;
356 std::map<std::string, std::string> md;
357 md[
"responsible"] =
"Chiara Zampolli";
369 LOG(info) <<
"Entry related to LHCIF needs to be updated with startTime " << mStartValidityLHCIF;
371 std::map<std::string, std::string> md;
372 md[
"responsible"] =
"Chiara Zampolli";
385 LOG(info) <<
"Entry related to Env Vars needs to be updated with startTime " << mStartValidityEnvVa;
387 std::map<std::string, std::string> md;
388 md[
"responsible"] =
"Chiara Zampolli";
401 LOG(info) <<
"Entry related to Collimators needs to be updated with startTime " << mStartValidityColli;
403 std::map<std::string, std::string> md;
404 md[
"responsible"] =
"Chiara Zampolli";
414 std::string stage = afterUpdate ?
"after update" :
"before update";
416 LOG(info) <<
"size " << stage <<
" : " << vect.size();
417 for (
const auto& it : vect) {
418 LOG(info) << it.first <<
", " << it.second;
428 bool updateFlag =
false;
430 if (!mClearVectors) {
431 if (mPids[dpid] ==
false) {
433 LOG(info) <<
"We will clear the existing vector, since it is the very first time we receive values for it and we have a dummy one, or the only value present is from the previous processing, so it is old";
440 LOG(info) <<
"We will just update the existing vector without clearing it";
449 LOG(info) <<
"Adding value " <<
val <<
" with timestamp " <<
timestamp <<
" to vector for DP " << alias;
Utils and constants for calibration and related workflows.
static constexpr long MONTH
static constexpr long DAY
DeliveryType get_type() const noexcept
bool processEnvVar(const DPCOM &dpcom)
void printVectorInfo(const std::vector< std::pair< O2LongUInt, double > > &vect, bool afterUpdate)
bool isMagFieldUpdated() const
int process(const gsl::span< const DPCOM > dps)
bool processPairS(const DPCOM &dpcom, const std::string &alias, std::pair< O2LongUInt, std::string > &p, bool &flag)
void updateCollimatorsCCDB()
void updateMagFieldCCDB()
void updateVector(const DPID &dpid, std::vector< std::pair< O2LongUInt, double > > &vect, std::string alias, O2LongUInt timestamp, double val)
bool processPairD(const DPCOM &dpcom, const std::string &alias, std::unordered_map< std::string, std::vector< std::pair< O2LongUInt, double > > > &mapToUpdate)
bool compareToLatest(std::pair< O2LongUInt, double > &p, double val)
O2LongUInt processFlags(O2LongUInt flag, const char *pid)
int processDP(const DPCOM &dpcom)
bool processLHCIFDPs(const DPCOM &dpcom)
void updateLHCIFInfoCCDB()
void init(const std::vector< DPID > &pids)
bool processCollimators(const DPCOM &dpcom)
void setDipoleCurrent(o2::units::Current_t v)
void setL3Current(o2::units::Current_t v)
bool match(const std::vector< std::string > &queries, const char *pattern)
GLint GLint GLsizei GLint GLenum GLenum type
std::string timestamp() noexcept
unsigned long int O2LongUInt
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)
const DataPointIdentifier id
std::unordered_map< std::string, std::vector< std::pair< O2LongUInt, double > > > mCollimators
std::unordered_map< std::string, std::vector< std::pair< O2LongUInt, double > > > mEnvVars
static constexpr std::string_view bptxPhaseAliases[NBPTXPhaseAliases]
std::vector< std::pair< O2LongUInt, double > > mInstLumi
std::array< std::vector< std::pair< O2LongUInt, double > >, 3 > mBackground
std::vector< std::pair< O2LongUInt, double > > mBPTXdeltaT
static constexpr std::string_view bptxPhaseShiftAliases[NBPTXPhaseShiftAliases]
static constexpr std::string_view lhcStringAliases[NLHCStringAliases]
static constexpr int nAliasesLHC
static constexpr std::string_view bptxPhaseRMSAliases[NBPTXPhaseRMSAliases]
@ LHC_CollimatorPos_TCLIA_4R2_lvdt_left_downstream
@ LHC_CollimatorPos_TCLIA_4R2_lvdt_gap_upstream
@ LHC_CollimatorPos_TCLIA_4R2_lvdt_left_upstream
@ LHC_CollimatorPos_TCLIA_4R2_lvdt_right_upstream
@ LHC_CollimatorPos_TCLIA_4R2_lvdt_right_downstream
@ LHC_CollimatorPos_TCLIA_4R2_lvdt_gap_downstream
std::pair< O2LongUInt, std::string > mLumiSource
static constexpr std::string_view lumiAliases[NLumiAliases]
std::array< std::vector< std::pair< O2LongUInt, double > >, 2 > mBPTXPhaseShift
static constexpr std::string_view collimatorAliases[NCollimatorAliases]
std::array< std::vector< std::pair< O2LongUInt, double > >, 2 > mIntensityBeam
std::pair< O2LongUInt, std::string > mBeamMode
static constexpr std::string_view bptxAliases[NBPTXAliases]
std::array< std::vector< std::pair< O2LongUInt, double > >, 2 > mBPTXPhaseRMS
static constexpr std::string_view beamAliases[NBeamAliases]
static constexpr std::string_view bkgAliases[NBkgAliases]
std::vector< std::pair< O2LongUInt, double > > mBPTXdeltaTRMS
std::pair< O2LongUInt, std::string > mMachineMode
std::array< std::vector< std::pair< O2LongUInt, double > >, 2 > mBPTXPhase
void updateCurDip(float v)
void updateSignDip(bool v)
void updateSignL3(bool v)
void updateCurL3(float v)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"