Depends on gaudi/Gaudi!1197 (merged)
Goes together with Rec!2735 and Moore!927
This allows to get rid of the ancient Gaudi way of reading input in favor of Producer algorithms and introduces multithreading reads for all ROOT files (digi and dst ones in particular)
The customizable way to achieve it is to declare an algorithm in few lines, inheriting from LHCb::IO::RootIOAlgBase and only specifying what you're reading and from which branches of the ROOT file. One can find a fully working example in the test rootioalg. For the impatient ones, the code to read a single item, namely here the RawEvent looks like this in C++ :
struct RootIOAlgRaw : LHCb::IO::RootIOAlgBase<LHCb::RawEvent> {
RootIOAlgRaw( const std::string& name, ISvcLocator* pSvcLocator )
: RootIOAlgBase( name, pSvcLocator,
{ KeyValue{"RawEventLocation", ""} } ){};
};
DECLARE_COMPONENT( RootIOAlgRaw )
And its python counter part is :
ioalg = RootIOAlgRaw("RootIOAlgRaw",
RawEventLocation=raw_event_location,
EventBufferLocation=raw_event_location + "Banks",
Input=qualifiers.filenames,
EventBranchNames = ("_Event_DAQ_RawEvent.",),
BufferNbEvents=20,
NSkip=20)
Note the different properties present on top of the ones you define directly. The first 3 are mandatory :
-
EventBufferLocation
is the location where the buffer of events in which the current event lives will be stored (or a shared_ptr to it actually) -
Input
is simply avector<string>
listing the input files to be used -
EventBranchNames
is an array of strings matching the list of template arguments inRootIOAlgBase
and specifying where each item resides -
BufferNbEvents
gives the number of events per buffer that the framework should target. Actually a maximum. If not given, will default to 20000 -
NSkip
gives the number of events to skip at the start of the input. Obviously defaulting to 0
For classical input files, 4 predefined algorithms have been declared for direct usage :
- LHCb::IO::RootIOAlgRAW will read the RawEvent only, whatever the format is
- LHCb::IO::RootIOAlgDIGI reading all content of .digi files
- LHCb::IO::RootIOAlgXDIGI reading all content of .xdigi files
- LHCb::IO::RootIOAlgLDST reading all content of .ldst files