30 LOGF(info,
"ITSDCSAdaposParser init...", mSelfName);
32 this->mCcdbUrl = ic.
options().
get<std::string>(
"ccdb-out-url");
34 this->mVerboseOutput = ic.
options().
get<
bool>(
"use-verbose-mode");
37 this->mCcdbFetchUrl = ic.
options().
get<std::string>(
"ccdb-fetch-url");
38 mMgr.
setURL(mCcdbFetchUrl);
39 getCurrentCcdbAlpideParam();
52 auto dps = pc.
inputs().
get<gsl::span<DPCOM>>(
"input");
55 if (doStrobeUpload && dps.size() > 0) {
63 if (currentTs - startTime > 10000) {
64 getCurrentCcdbAlpideParam();
65 startTime = currentTs;
76void ITSDCSAdaposParser::getCurrentCcdbAlpideParam()
79 LOG(info) <<
"Getting AlpideParam from CCDB url " << mCcdbFetchUrl <<
" with timestamp " << ts;
86void ITSDCSAdaposParser::process(
const gsl::span<const DPCOM> dps)
92 LOG(info) <<
"\n\n\nProcessing new TF\n-----------------";
96 for (
const auto& it : dps) {
107 auto mapel = mDPstrobe.begin();
108 if (!mDPstrobe.size()) {
109 doStrobeUpload =
false;
113 mStrobeToUpload = mapel->second.payload_pt1;
115 if (pushTime - lastPushTime > 30000) {
116 doStrobeUpload =
true;
118 doStrobeUpload =
false;
121 doStrobeUpload =
false;
129void ITSDCSAdaposParser::processDP(
const DPCOM& dpcom)
131 auto& dpid = dpcom.
id;
136 if (mVerboseOutput) {
137 LOG(info) <<
"Processing DP = " << dpcom <<
", with value = " << o2::dcs::getValue<int>(dpcom);
139 auto value = o2::dcs::getValue<int>(dpcom);
141 if (mVerboseOutput) {
142 LOG(info) <<
"Value is < 190 BCs, skipping it";
148 mDPstrobe[dpid] =
val;
156 long tstart = 0, tend = 0;
159 api.
init(
"http://alice-ccdb.cern.ch");
161 std::map<std::string, std::string> metadata;
164 tend = tstart + 365L * 2 * 24 * 3600 * 1000;
167 metadata = {{
"comment",
"uploaded by flp199 (ADAPOS data)"}, {
"StrobeLength",
std::to_string(mStrobeToUpload + 8)}};
169 std::string
path(
"ITS/Config/AlpideParam");
183 if (mCcdbUrl.empty()) {
184 LOG(info) <<
"Class Name: " << class_name <<
" | File Name: " <<
filename
185 <<
"\nSending to ccdb-populator the object " << info.getPath() <<
"/" << info.getFileName()
186 <<
" of size " <<
image->size() <<
" bytes, valid for "
187 << info.getStartValidityTimestamp() <<
" : "
188 << info.getEndValidityTimestamp();
195 LOG(info) <<
"Sending object " << info.getFileName() <<
" to " << mCcdbUrl <<
"/browse/"
196 << info.getPath() <<
" from the ITS ADAPOS parser workflow";
200 &
image->at(0),
image->size(), info.getFileName(), info.getObjectType(), info.getPath(),
201 info.getMetaData(), info.getStartValidityTimestamp(), info.getEndValidityTimestamp());
214 std::vector<InputSpec> inputs;
215 inputs.emplace_back(
"input",
"DCS",
"ITSDATAPOINTS");
217 std::vector<OutputSpec> outputs;
227 {
"use-verbose-mode", VariantType::Bool,
false, {
"Use verbose output mode"}},
228 {
"ccdb-out-url", VariantType::String,
"", {
"CCDB url, default is empty (i.e. send output to CCDB populator workflow)"}},
229 {
"ccdb-fetch-url", VariantType::String,
"", {
"CCDB url from when to fetch the AlpideParam object, default is ccdb-test"}}}};
void setTimestamp(long t)
set timestamp cache for all queries
void setURL(const std::string &url)
set a URL to query from
T * get(std::string const &path)
retrieve an object of type T from CCDB as stored under path; will use the timestamp member
void init(std::string const &hosts)
static std::unique_ptr< std::vector< char > > createObjectImage(const T *obj, CcdbObjectInfo *info=nullptr)
int storeAsBinaryFile(const char *buffer, size_t size, const std::string &fileName, const std::string &objectType, const std::string &path, const std::map< std::string, std::string > &metadata, long startValidityTimestamp, long endValidityTimestamp, std::vector< char >::size_type maxSize=0) const
static const DPLAlpideParam< N > & Instance()
static void setProvenance(std::string const &mainkey, std::string const &subkey, EParamProvenance p)
static void setValue(std::string const &mainkey, std::string const &subkey, T x)
DeliveryType get_type() const noexcept
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
void run(ProcessingContext &pc) final
void init(InitContext &ic) final
static constexpr std::string_view getName()
GLsizei const GLfloat * value
GLint GLint GLsizei GLint GLenum GLenum type
GLsizei const GLchar *const * path
constexpr o2::header::DataOrigin gDataOriginITS
long getCurrentTimestamp()
returns the timestamp in long corresponding to "now"
std::vector< ConfigParamSpec > Options
o2::framework::DataProcessorSpec getITSDCSAdaposParserSpec()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)
static constexpr o2::header::DataOrigin gDataOriginCDBWrapper
static constexpr o2::header::DataOrigin gDataOriginCDBPayload
const DataPointIdentifier id
uint16_t get_flags() const noexcept
int roFrameLengthInBC
ROF length in BC for continuos mode.
static std::string getClassName(const T &obj)
get the class name of the object
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"