Skip to content

Proof-of-principle example of using a ConditionAccessor in a Consumer

Gerhard Raven requested to merge add-functional-ConditionAccessor-example into master

Allow conditions objects to be arguments to the Gaudi::Functional call operator, just like objects which have to be retrieved from the event store (i.e. event data). To distinguish between the two, the extra 'traits' template argument is used.

As example, one can now do:

class MyConsumer : public Gaudi::Functional::Consumer< void( const MyCondition&, const MyEventData& ),
                                                       details::usesConditions<MyCondition>> 
{
   MyConsumer( const std::string& name, ISvcLocator* svcLoc ) 
   : Consumer{ name, svcLoc,
               { KeyValue{"MyConditionDataPath", "Conditions/MyConditons "},
                 KeyValue{"MyEventDataPath", "Rec/MyData" } } 
             } {}
                
   void operator()(const MyCondition& cond, const MyEvenData& data) const override {

        // use `cond` and `data` as usual
   }
}

at which point the framework will provide cond in an efficient manner.

Note that details::usesConditions should still be moved into a more general namespace, eg. LHCb::DetDesc and made available from one of the header files required for conditions objects.

Edited by Gerhard Raven

Merge request reports