ATLAS Offline Software
Loading...
Searching...
No Matches
EventIDFromStore.cxx
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
4*/
5
7
8#include "GaudiKernel/EventContext.h"
11#include "SGTools/DataProxy.h"
12#include "EventInfo/EventID.h"
13#include "EventInfo/EventInfo.h"
14
15const EventIDBase* EventIDFromStore( IProxyDict* store )
16{
17 if( store ) {
18 //MN: FIX: is this OK to have it static in case of multiple Stores?
19 static const SG::sgkey_t ctxkey = store->stringToKey( "EventContext", ClassID_traits<EventContext>::ID() );
20 SG::DataProxy* proxy = store->proxy_exact(ctxkey);
21 if( proxy && proxy->object() ) {
22 return & SG::DataProxy_cast<EventContext>( proxy )->eventID();
23 }
24
25 // Check for EventInfo
26 proxy = store->proxy( ClassID_traits<EventInfo>::ID(), "" );
27 if( proxy && proxy->object() ) {
28 return SG::DataProxy_cast<EventInfo>( proxy )->event_ID();
29 }
30
31 }
32 return nullptr;
33}
34
Assign a CLID to EventContext.
const EventIDBase * EventIDFromStore(IProxyDict *store)
Retrieve the EventID from EventContext saved in store STORE.
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
virtual sgkey_t stringToKey(const std::string &str, CLID clid) override
virtual SG::DataProxy * proxy(const void *const pTransient) const override
virtual SG::DataProxy * proxy_exact(SG::sgkey_t sgkey) const override
DATA * DataProxy_cast(DataProxy *proxy)
cast the proxy into the concrete data object it proxies
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
Definition sgkey_t.h:32