Access to timestamp of data

Dear Experts,
Is there a way to access the time when the given data was collected based on the digit file?

We would like to run QC (not only PostProcessing) on the old data (CTFs->digits), but for this we need a filling scheme from when the data was collected. Ideally, get timestamp from digit file and pull proper filling scheme from CCDB.

However, maybe there is another way to achieve our aim, we know for instance the runNumber so from automatic matching it to fillNumber it would be possible to construct the query which would return correct filling scheme?

No, digit files don’t have timing info. The correct way is to run the ctf-based workflow with o2-tfidinfo-writer-workflow piped to the global workflow. This will create a o2_tfidinfo.root file containing the run and timing info for every TF processed.

After that you can run any workflow using the results of the previous workflow (e.g. digits) by passing an option --hbfutils-config o2_tfidinfo.root.
The framework will take care of injecting the run/timing info into the DPL headers used by the DPL CCDB fetcher to query CCDB objects.

Thank you very much @shahoian for your immediate response.
We will give it at try!

Thanks Ruben,

Actually it runs with

o2-fv0-digit-reader-workflow --fv0-digit-infile o2_fv0digits.root --hbfutils-config o2_tfidinfo.root -b | o2-qc --config json://fv0_qc.json --override-values “qc.config.Activity.number=517035” -b

but we are getting stuck in QC when accessing CCDB (to be investigated).

Hi @jotwinow

sorry, I don’t understand what you mean: if you are running with ctf-reader, then the time and 1st orbit of every TF in injected into the DPL header. With the o2-fv0-digit-reader-workflow the same can be achieved by providing the o2_tfidinfo.root extracted during CTF processing. How do you access CCDB in the QC? Are you using DPL fetcher (in this case it knows how to extract the timestamp from the headers) or BasicCCDBManager (where you need to set the timestamp by hand)?

Cheers,
Ruben

Hi Ruben,

We run the o2-fv0-digit-reader-workflow with the o2_tfidinfo.root but still cannot get filing scheme objects with the proper timestamp from CCDB. I think we need to make something more in the code to make it. Sebastian pointed me to similar discussion

I hope it will be possible.

Can you show me how do you extract the object? And which data you use?

We are using o2::ccdb::CcdbApi not DPL fetcher…
Until now we were simply taking last object from CCDB:

You never set the timestamp to CcdbApi therefore it is querying with the timestamp of now. The approximate timestamp (up 1s precision) can be extracted from the o2::framework::ProcessingContext& pc, e.g. pc.services().get<o2::framework::TimingInfo>().creation.
I am not familiar enough with the QC framework to tell if it is available in the PostProcessing task, perhaps @pkonopka can comment. If it is not, then you need to extract the info you need from the CCDB objects during TF processing and use it in the postprocessing.
Note that we are trying to eliminate the usage of custom CCDB queries in the workflows, instead, the DPL CCDB fetched should be used, see CCDB_intro - Google Präsentationen for the reference.

Ok, using pc.services().get<o2::framework::TimingInfo>().creation is exactly what we were searching for, thank you @shahoian !
I don’t know how strictly you want to eliminate custom CCDB queries, in our case we need it only for 1 object per cycle (5 min).

@pkonopka in another topic, linked by Jacek, field Activity::start was mentioned as a potential solution – do you have any update on that?

Eventually we want to eliminate all custom queries, to minimize the number of connections to CCDB servers.

Activity::start is now accesible to QC tasks. The value comes from the config files and could be overwritten with --override-values "qc.config.Activity.start=123434" and it is done this way for QC in MC.
At P2 the SOR is not propagated yet.

Thanks for the feedback. Do you have any example of the fetcher working for the QC workflows? @pkonopka @sbysiak

There is no example yet, but the MFT team is now trying to see if it works. I advised them to add this to the query:

cldictMFT:MFT/CLUSDICT/0?lifetime=condition&ccdb-path=MFT/Calib/ClusterDictionary

and do this to retrieve the object in the code:

pc.inputs().get<o2::itsmft::TopologyDictionary*>("cldictMFT");  

I hope it helps.