Access run number in QC checker

Dear @pkonopka, @bvonhall,
are there any way to access run numbers in the QC? I’m interested in accessing run number by checker in order to add message to the Monitoring Object like msg->AddText(Form("Run %d: OK", runNumber));.

Hi, I think you should be able to access it as MonitorObject metadata, with “RunNumber” key.
However, I just checked some MOs on QCDB, and it seems the run number is set to zero, which is probably a bug:
http://qcdb.cern.ch:8083/browse/qc/CPV/MO/PedestalsOnFLP/HistAmplitude128
I created an issue for this:
https://alice.its.cern.ch/jira/browse/QC-629

Still this metadata key is the place where you should look for it after the problem is fixed.

Hello @pkonopka,

thank you! that’s exactly what I need. May I ask you also for the commands you used to inspect the MO in qcdb?

Oh, sorry for the flood. I thought that MOs are stored in database as o2::quality_control::core::MonitorObjects but actually they are stored as TH1/TH2 objects with metadata attached to database entry. Everything is displayed in ‘Metadata’ field in database browser.

Yes, exactly

Dear Piotr, Barth,

I still facing a problem with accessing run numbers in checker. In the checker I prepared this piece of code:

        /* mo is MonitorObject which provided by PedestalTask, namely qc/CPV/MO/CPVPedestalTask/PedestalValueM2 /*
        int runNumber{ 0 };
        auto metaData = mo->getMetadataMap();
        ILOG(Info, Support) << "PedestalCheck::check() : I have following metadata:" << ENDM;
        for ( auto [key, value] : metaData) {
          ILOG(Info, Support) << "key = " << key << "; value = " << value << ENDM;
        }
        auto foundRN = metaData.find("RunNumber");
        if (foundRN != metaData.end()) {
          runNumber = std::stoi(foundRN->second);
          ILOG(Info, Support) << "PedestalCheck::check() : I found in metadata RunNumber = " << foundRN->second << ENDM;
        } else {
          ILOG(Info, Support) << "PedestalCheck::check() : I haven't found RunNumber in metadata, using from Activity." << ENDM;
          runNumber = mo->getActivity().mId;
          ILOG(Info, Support) << "PedestalCheck::check() : RunNumber = " << runNumber << ENDM;
        }

When I execute the code, it appears that metadata is empty((
And also run number from the Activity is also 0!
See output:

[279362:QC-CHECK-RUNNER-CPVPedestalCheck]: 2021-10-11 19:24:09.232421     PedestalCheck::check() : I have following metadata:
[279362:QC-CHECK-RUNNER-CPVPedestalCheck]: 2021-10-11 19:24:09.232431     PedestalCheck::check() : I haven't found RunNumber in metadata, using from Activity.
[279362:QC-CHECK-RUNNER-CPVPedestalCheck]: 2021-10-11 19:24:09.232437     PedestalCheck::check() : RunNumber = 0

However the metadata appears in database:
http://ccdb-test.cern.ch:8080/browse/qc/CPV/MO/CPVPedestalTask/PedestalValueM2


Is it a bug or a feature? At which step metadata is attached to MO? I just want to draw run number on the MO, nothing more. And facing such a problem…
Any help is very appreciated.

Thank you & regards,
Sergey

Hello,

mo->getActivity()->mId should contain what you need. If you confirm that it works I will add a sentence to the doc.

Cheesr,
Barth

EDIT:

To answer your questions:
We attach the run number to the monitor object in the CheckRunner. The CheckRunner knows it because it is driven by the aliECS.

Hello, Barth!

No, I don’t see proper run number in the Activity.
In the example above I tried to access run number from the metadata or Activity, but it again appeared to be 0 (must be 42). And there were no metadata at all.

Can you please check my code in flp suite 0.31.1?
As production example, see this MO. Text in the box says “Run 0”. Here is the code:

msg->AddText(Form("Run %d", mo->getActivity().mId));

However in the qcdb run number is present in metadata, it is 503790.
What am I doing wrong? At which stage you attach run number in the CheckRunner? Before PedestalCheck::check() call or after it?

Regards,
Sergey

To provide more information:
I attached metadata to MO in PedestalTask, and it appeared in the PedestalCheck::check(). So my conclusion is that metadata which appears in qcdb is attached to MO after PedestalCheck::check() called.

Dear Sergey,

Thank you for your investigation. I have to do a bit of testing myself to understand exactly.

I’ll let you know.
Cheers,
Barth

https://alice.its.cern.ch/jira/browse/QC-671

Probably fixed in https://github.com/AliceO2Group/QualityControl/pull/902

Thanks, it is working now!
Best regards,
Sergey