Dumping a variable at event level

Dear colleagues,
I started by asking this in mattermost:
and Dan kindly answered:
however it is crashing with:
DatasetDumper FATAL Standard std::exception is caught
DatasetDumper ERROR SG::ExcBadAuxVar: Attempt to retrieve nonexistent aux data item `::FCal_Et’ (198).

I added the code that retrieves the float FCal_Et to processSingleBTagEvent.cxx. The code runs well (I can print FCal_Et values), the problem is that I’m missing the bridge between the FCal_Et retrieved in this code and the request in the json file (at event:):
I’m missing the decorating step at least. I do not know how to add a float to EventInfo as decoration.

Thanks a lot for help.

Hi, @shelena, I think what you need to do is create a decoration on the EventInfo object.

At some point before the EventInfo is written out, you need to decorate it, by doing something like

// This can be at global scope, or declared in SingleBTagTools.h
SG::AuxElement::ConstAccessor::Decorator<float> fcal_et("FCal_Et");

// this should happen in the event loop
fcal_et(*event_info) = your_fcal_et_variable;

Then the stuff you do in the configuration file should make it print out.

Thanks a lot Dan! That was the missing piece indeed.
And a h5ls -v over the output .h5 file reveals:
“nPrimaryVertices” +316 native int
“FCal_Et” +320 native float
So everything should be fine.


1 Like