11#ifndef ATHENAROOTCOMPS_ATHENA_ROOTNTUPLEEVENTSELECTOR_H
12#define ATHENAROOTCOMPS_ATHENA_ROOTNTUPLEEVENTSELECTOR_H 1
15#include <unordered_map>
19#include "GaudiKernel/IEvtSelector.h"
20#include "GaudiKernel/IIoComponent.h"
21#include "GaudiKernel/IIncidentSvc.h"
22#include "GaudiKernel/MsgStream.h"
23#include "Gaudi/Property.h"
24#include "GaudiKernel/ServiceHandle.h"
30#include "TObjString.h"
46 public extends<AthService,
47 IEvtSelector, IEvtSelectorSeek,
48 IAddressProvider, IIoComponent, IIncidentListener>
67 virtual StatusCode
finalize()
override;
69 virtual void handle(
const Incident& incident)
override;
73 virtual StatusCode
createContext( Context*& refpCtxt )
const override;
75 virtual StatusCode
last( Context& refContext )
const override;
76 virtual StatusCode
next( Context& refCtxt )
const override;
77 virtual StatusCode
next( Context& refCtxt,
int jump )
const override;
78 virtual StatusCode
previous( Context& refCtxt )
const override;
79 virtual StatusCode
previous( Context& refCtxt,
int jump )
const override;
80 virtual StatusCode
rewind( Context& refCtxt )
const override;
83 IOpaqueAddress*& )
const override;
84 virtual StatusCode
releaseContext( Context*& refCtxt )
const override;
86 Context& ctx )
const override;
95 virtual StatusCode
seek (Context& refCtxt,
int evtnum)
const override;
101 virtual int curEvent (
const Context& refCtxt)
const override;
121 const EventContext& ctx)
override;
125 virtual int size (Context& refCtxt)
const override;
152 const std::string& tupleName)
const;
156 const std::string &prefix =
"")
const;
158 const std::string &prefix =
"")
const;
159 void addMetadata(TTree *metatree,
const std::string &path =
"")
const;
160 void addMetadata(TObjString *metastring,
const std::string &path =
"")
const;
165 const std::string& prefix)
const;
174 void find_coll_idx(
int evtidx,
long& coll_idx,
long& tuple_idx)
const;
Extension to IEvtSelector to allow for seeking.
Define macros for attributes used to control the static checker.
ROOT specific event selector context.
RootNtupleEventSelector * self() const
non-const access to self (b/c next() is const)
virtual StatusCode seek(Context &refCtxt, int evtnum) const override
Seek to a given event number.
virtual StatusCode finalize() override
RootNtupleEventSelector(const std::string &name, ISvcLocator *svcLoc)
Constructor with parameters:
virtual StatusCode releaseContext(Context *&refCtxt) const override
long m_curEvt
current event index
virtual int curEvent(const Context &refCtxt) const override
return the current event number.
void setupInputCollection(Gaudi::Details::PropertyBase &inputCollectionsName)
callback to synchronize the list of input files
virtual StatusCode loadAddresses(StoreID::type storeID, tadList &list) override
get all new addresses from Provider for this Event.
ServiceHandle< IDictLoaderSvc > IDictSvc_t
virtual StatusCode last(Context &refContext) const override
virtual int size(Context &refCtxt) const override
ICollectionSize interface
void find_coll_idx(int evtidx, long &coll_idx, long &tuple_idx) const
helper method to get the collection index (into m_inputCollectionsName) and tuple index (into ‘m_tupl...
virtual StatusCode resetCriteria(const std::string &cr, Context &ctx) const override
ServiceHandle< IIncidentSvc > IIncSvc_t
ServiceHandle< IClassIDSvc > ICLIDSvc_t
virtual StatusCode preLoadAddresses(StoreID::type storeID, tadList &list) override
IAddressProvider interface get all addresses from Provider : Called before Begin Event
StringArrayProperty m_activeBranchNames
List of branches to activate in the TTree.
TTree * m_tuple
current tree being read
std::vector< std::vector< CollMetaData > > m_collEvts
cache of the number of entries for each collection Indexed like [tuple][collection]
bool m_needReload
The (python) selection function to apply on the TChain we are reading.
virtual StatusCode updateAddress(StoreID::type storeID, SG::TransientAddress *tad, const EventContext &ctx) override
update a transient Address
IDictSvc_t m_dictsvc
Pointer to the IDictLoaderSvc.
std::vector< std::string > m_tupleNames
Names of all trees over which to iterate.
std::vector< TFile * > m_files
virtual StatusCode next(Context &refCtxt) const override
StoreGateSvc_t m_imetaStore
Pointer to the StoreGateSvc input metadata store.
StatusCode endInputFile(RootNtupleEventContext *rctx) const
StatusCode do_init_io()
helper method to init the i/o components
StatusCode createMetaDataRootBranchAddresses(StoreGateSvc *store, TTree *tree, const std::string &prefix) const
helper method to create proxies for the metadata store
ServiceHandle< StoreGateSvc > StoreGateSvc_t
friend class Athena::RootNtupleEventContext
IIncSvc_t m_incsvc
Handle to the incident service.
void addMetadataFromDirectoryName(const std::string &metadirname, TFile *fileObj, const std::string &prefix="") const
StringArrayProperty m_inputCollectionsName
List of input files containing TTree.
virtual StatusCode createContext(Context *&refpCtxt) const override
ICLIDSvc_t m_clidsvc
Pointer to the IClassIDSvc.
StringProperty m_tupleName
Name of TTree to load from collection of input files.
StoreGateSvc_t m_dataStore
Pointer to the StoreGateSvc event store.
void addMetadataFromDirectory(TDirectoryFile *metadir, const std::string &prefix="") const
void addMetadata(TTree *metatree, const std::string &path="") const
TTree * fetchNtuple(const std::string &fname, const std::string &tupleName) const
helper method to retrieve the correct tuple
virtual void handle(const Incident &incident) override
StatusCode createRootBranchAddresses(StoreID::type storeID, tadList &tads)
helper method to create proxies
virtual StatusCode previous(Context &refCtxt) const override
StoreGateSvc_t m_ometaStore
Pointer to the StoreGateSvc output metadata store.
long m_skipEvts
Number of events to skip at the beginning.
virtual StatusCode io_reinit() override
Callback method to reinitialize the internal state of the component for I/O purposes (e....
virtual StatusCode rewind(Context &refCtxt) const override
virtual StatusCode createAddress(const Context &refCtxt, IOpaqueAddress *&) const override
long m_nbrEvts
Number of Events read so far.
a simple interface to interact with the Reflex dictionaries and abstract/workaround a few ROOT bugs.
The Athena Transient Store API.
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
StatusCode ROOTMessageFilterSvc::initialize ATLAS_NOT_THREAD_SAFE()
Return the file descriptor fataldump() uses for output.