12#ifndef DETECTOR_GRPDCSDPSPROCESSOR_H_
13#define DETECTOR_GRPDCSDPSPROCESSOR_H_
16#include <unordered_map>
45 std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>>
mEnvVars;
50 s += el.second.size();
57 std::printf(
"%-30s\n", el.first.c_str());
58 for (
const auto& it : el.second) {
59 std::printf(
"timestamp %lu val %.3f\n",
llu2lu(it.first), it.second);
82 LOG(info) <<
"L3 current will be updated from " <<
curL3 <<
" to " <<
v;
93 LOG(info) <<
"Dipole current will be updated from " <<
curDip <<
" to " <<
v;
104 LOG(info) <<
"L3 polarity will be updated from " <<
negL3 <<
" to " <<
v;
115 LOG(info) <<
"Dipole polarity will be updated from " <<
negDip <<
" to " <<
v;
126 std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>>
mCollimators;
131 s += el.second.size();
138 std::printf(
"%-60s\n", el.first.c_str());
139 for (
const auto& it : el.second) {
140 std::printf(
"timestamp %lu val %.3f\n",
llu2lu(it.first), it.second);
183 "LHC_CollimatorPos_TCLIA_4R2_lvdt_left_downstream",
"LHC_CollimatorPos_TCLIA_4R2_lvdt_left_upstream",
184 "LHC_CollimatorPos_TCLIA_4R2_lvdt_right_downstream",
"LHC_CollimatorPos_TCLIA_4R2_lvdt_right_upstream"};
185 static constexpr std::string_view
beamAliases[
NBeamAliases] = {
"LHC_IntensityBeam1_totalIntensity",
"LHC_IntensityBeam2_totalIntensity"};
186 static constexpr std::string_view
bkgAliases[
NBkgAliases] = {
"ALI_Background1",
"ALI_Background2",
"ALI_Background3"};
196 std::array<std::vector<std::pair<O2LongUInt, double>>, 3>
mBackground;
200 std::array<std::vector<std::pair<O2LongUInt, double>>, 2>
mBPTXPhase;
210 if (vect.begin() != vect.end()) {
211 vect.erase(vect.begin(), vect.end() - 1);
217 for (
int i = 0;
i < 2; ++
i) {
223 for (
int i = 0;
i < 3; ++
i) {
246 for (
int iel = 0; iel <
mInstLumi.size(); ++iel) {
250 for (
int iel = 0; iel <
mBPTXdeltaT.size(); ++iel) {
259 for (
int iel = 0; iel <
mBPTXPhase[
i].size(); ++iel) {
292 void init(
const std::vector<DPID>& pids);
293 int process(
const gsl::span<const DPCOM> dps);
298 bool processPairD(
const DPCOM& dpcom,
const std::string& alias, std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>>& mapToUpdate);
299 bool processPairS(
const DPCOM& dpcom,
const std::string& alias, std::pair<O2LongUInt, std::string>& p,
bool& flag);
304 void resetAndKeepLast(std::unordered_map<std::string, std::vector<std::pair<O2LongUInt, double>>>& mapToReset)
307 for (
auto& el : mapToReset) {
308 if (el.second.begin() != el.second.end()) {
309 el.second.erase(el.second.begin(), el.second.end() - 1);
316 for (
auto& it : mPids) {
323 for (
auto& it : mPids) {
324 for (
const auto& iArray : mArrLHCAliases) {
325 if (it.first.get_alias() ==
static_cast<std::string
>(iArray).c_str()) {
370 void printVectorInfo(
const std::vector<std::pair<O2LongUInt, double>>& vect,
bool afterUpdate);
374 std::unordered_map<DPID, bool> mPids;
382 size_t mCallSlice = 0;
383 bool mVerbose =
false;
396 bool mUpdateLHCIFInfo =
false;
398 bool mClearVectors =
false;
399 std::array<std::string_view, GRPLHCInfo::nAliasesLHC> mArrLHCAliases;
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
Header of the General Run Parameters object for B field values.
static constexpr long INFINITE_TIMESTAMP
long getStartValidityEnvVa() const
const o2::ccdb::CcdbObjectInfo & getccdbEnvVarsInfo() const
o2::ccdb::CcdbObjectInfo & getccdbLHCIFInfo()
o2::ccdb::CcdbObjectInfo & getccdbCollimatorsInfo()
void resetStartValidityColli()
const o2::parameters::GRPMagField & getMagFieldObj() const
o2::ccdb::CcdbObjectInfo & getccdbEnvVarsInfo()
void setStartValidityLHCIF(long t)
bool processEnvVar(const DPCOM &dpcom)
void resetAndKeepLast(std::unordered_map< std::string, std::vector< std::pair< O2LongUInt, double > > > &mapToReset)
long getStartValidityColli() const
void printVectorInfo(const std::vector< std::pair< O2LongUInt, double > > &vect, bool afterUpdate)
bool isMagFieldUpdated() const
const o2::ccdb::CcdbObjectInfo & getccdbLHCIFInfo() const
void resetStartValidityEnvVa()
void setStartValidityMagFi(long t)
void setStartValidityEnvVa(long t)
GRPCollimators & getCollimatorsObj()
long getStartValidityLHCIF() const
const o2::ccdb::CcdbObjectInfo & getccdbMagFieldInfo() const
bool processPairS(const DPCOM &dpcom, const std::string &alias, std::pair< O2LongUInt, std::string > &p, bool &flag)
void updateCollimatorsCCDB()
void setStartValidityColli(long t)
const o2::ccdb::CcdbObjectInfo & getccdbCollimatorsInfo() const
bool isLHCIFInfoUpdated() const
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)
const GRPLHCInfo & getLHCIFObj() const
~GRPDCSDPsProcessor()=default
o2::ccdb::CcdbObjectInfo & getccdbMagFieldInfo()
bool compareToLatest(std::pair< O2LongUInt, double > &p, double val)
const GRPCollimators & getCollimatorsObj() const
O2LongUInt processFlags(O2LongUInt flag, const char *pid)
GRPDCSDPsProcessor()=default
void resetStartValidityLHCIF()
int processDP(const DPCOM &dpcom)
bool processLHCIFDPs(const DPCOM &dpcom)
GRPEnvVariables & getEnvVarsObj()
void updateLHCIFInfoCCDB()
void init(const std::vector< DPID > &pids)
void resetAndKeepLastLHCIFDPs()
const GRPEnvVariables & getEnvVarsObj() const
bool processCollimators(const DPCOM &dpcom)
O2LongUInt llu2lu(std::uint64_t v)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
unsigned long int O2LongUInt
std::unordered_map< std::string, std::vector< std::pair< O2LongUInt, double > > > mCollimators
size_t totalEntries() const
ClassDefNV(GRPCollimators, 2)
std::unordered_map< std::string, std::vector< std::pair< O2LongUInt, double > > > mEnvVars
ClassDefNV(GRPEnvVariables, 2)
size_t totalEntries() const
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
void resetAndKeepLastVector(std::vector< std::pair< O2LongUInt, double > > &vect)
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
ClassDefNV(GRPLHCInfo, 1)
std::pair< O2LongUInt, std::string > mBeamMode
static constexpr std::string_view bptxAliases[NBPTXAliases]
std::array< std::vector< std::pair< O2LongUInt, double > >, 2 > mBPTXPhaseRMS
@ LHC_IntensityBeam1_totalIntensity
@ LHC_IntensityBeam2_totalIntensity
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)
static constexpr float ZeroCurrent
void updateCurL3(float v)
static constexpr float DeltaThreshold
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"