Skip to content

add UnpackRawEvents algorithm

Gerhard Raven requested to merge add-unpack-rawevent-s into master

Adds UnpackRawEvents which takes as input a vector of RawEvent, and which outputs a number of RawBank::Views, as long as they have unique types and which each can be configured to be obtained from a any of the RawEvents in the input. Example of a new SplittingMergingTransformer (previously, to do the same would have required one instance for each input RawEvent)

An instance of UnpackRawEvents should be configured as follows:

  alg = UnpackRawEvents( name = name,
                         RawEventLocations = [ 'event0', 'event1', 'event2' ],   # inputs
                         RawBankLocations = [ 'ODINView', 'DstDataView' ]        # outputs
                         BankTypeIndices = [ ( 'ODIN', 0 ), ( 'DstData', 2 ) ]   # where to find the relevant input for the n-th output
                        )

where it is assumed that ODIN can be found in the RawEvent at the input event with index 0, i.e. event0, and DstData can be found in the RawEvent at index 2, ie. event2. Note that there must be a one-to-one correspondence between the entries in RawBankLocations and BankTypeIndices, and that the types which appear in BankTypeIndices must be unique. Also note that if a type cannot be found in the specified RawEvent, an empty view is returned. If needed, a distinct version of the algorithm could be created which returns an optional<RawBankVector>, and which would 'not be engaged' if no banks of a given type are present, which would result in skipping writing an entry into the TES. But that just changes the error for a consumer from finding an empty view to not finding a view at all -- and in the current setup, the consumer would obtain a RawEvent without the requested banks, ie. the current algorithm mimics the current behavior.

The envisaged use is to assign all three properties from a single map retrieved from here, doing something like:

    db = Raw_location_db[raw_event_format]
    values = list(set(db.values()))  # make a unique list of values
    alg = UnpackRawEvents( RawEventLocations = values,
                           RawBankLocations  = [ '/Event/DAQ/RawBanks/%s' % k for k in db.keys ],
                           BankTypeIndices   = [ (k, values.index( db[k] )) for k in db.keys ] )
    return { k: alg.RawBankLocations[i] for i,k in enumerate(db.keys()) }

which returns a dictionary of { bank_type : TES location } to the caller for subsequent use in building the dataflow dependency graph (provided of course that all subsequent algorithms accept RawBank::Views instead of requiring RawEvent and figuring out themselves whether they contain the relevant banks...)

requires gaudi/Gaudi!1315 (merged)

Edited by Rosen Matev

Merge request reports