Accessing info inside a DataRef

Dear all

I wrote a data producer that has as an output
outputs.emplace_back(“MFT”, “DIGITS”, 0, Lifetime::Timeframe);
pc.outputs().snapshot(Output{“MFT”, “DIGITS”, 0, Lifetime::Timeframe}, DigitsInROF);
std::vectoro2::itsmft::Digit DigitsInROF;

In the JSON file I have
“query”: “randomdigit:MFT/DIGITS/0”,

Now I would like to ‘catch’ this output as input for a QcTask, specifically to use it inside the
corresponding monitorData(o2::framework::ProcessingContext& ctx) function.

My code runs (ie producer piped with qctask)
Inside monitorData, this line works:
const auto* header = header::getheader::DataHeader*(ctx.inputs().get(“randomdigit”).header);
so I am pretty sure that the data is flowing in the right direction.

I see in DataRef.h that it has an InputSpec* member … and I guess that if I dig deep enough I will get the answer on how to get at the vector of digits inside the InputSpec, but if any of you could shorten the process for me I would be greatful.

Bottomline, I want to have access to the std::vectoro2::itsmft::Digit … any hints?

thanks a lot


not promising, but I would expect at least one of these to work:

  auto digits = ctx.inputs().get<std::vector<o2::itsmft::Digit>>("randomdigit");

  auto digits = framework::DataRefUtils::as<std::vector<o2::itsmft::Digit>>(yourDataRef);

For the second one, you might need to include <Framework/DataRefUtils.h>
Please let me know if these work.
BTW, you can put your code within ``` to display it correctly.

Dear Piotr

the first version worked :slight_smile:
(I did not try the second one)

thanks a lot