17#include <unordered_map>
18#include <unordered_set>
24#include "TClassEdit.h"
31#include "GaudiKernel/FileIncident.h"
32#include "GaudiKernel/IIoComponentMgr.h"
33#include "GaudiKernel/ISvcLocator.h"
34#include "GaudiKernel/ITHistSvc.h"
35#include "GaudiKernel/MsgStream.h"
36#include "GaudiKernel/StatusCode.h"
37#include "GaudiKernel/System.h"
52#include "AthenaRootComps/TransferTree.h"
55#include "EventInfo/EventInfo.h"
67#include "boost/tokenizer.hpp"
71 root_typename(
const std::string& root_type_name)
73 static const std::unordered_map<std::string,std::string>
s = {
74 {
"Int_t", System::typeinfoName(
typeid(Int_t))},
75 {
"UInt_t", System::typeinfoName(
typeid(UInt_t))},
77 {
"Long_t", System::typeinfoName(
typeid(Long_t))},
78 {
"ULong_t", System::typeinfoName(
typeid(ULong_t))},
80 {
"Long64_t", System::typeinfoName(
typeid(Long64_t))},
81 {
"ULong64_t", System::typeinfoName(
typeid(ULong64_t))},
83 {
"Float_t", System::typeinfoName(
typeid(Float_t))},
84 {
"Float16_t", System::typeinfoName(
typeid(Float16_t))},
85 {
"Double_t", System::typeinfoName(
typeid(Double_t))},
86 {
"Double32_t", System::typeinfoName(
typeid(Double32_t))},
88 {
"Bool_t", System::typeinfoName(
typeid(Bool_t))},
89 {
"Char_t", System::typeinfoName(
typeid(Char_t))},
90 {
"UChar_t", System::typeinfoName(
typeid(UChar_t))},
92 {
"Short_t", System::typeinfoName(
typeid(Short_t))},
93 {
"UShort_t", System::typeinfoName(
typeid(UShort_t))}
96 return s.at(root_type_name);
100 std::vector<std::string>
101 get_active_leaves(TTree *tuple)
103 std::vector<std::string>
active;
104 TObjArray *leaves = tuple->GetListOfLeaves();
107 for (Int_t i = 0;
i < leaves->GetEntries(); ++
i) {
108 TLeaf *leaf = (TLeaf *)leaves->At(i);
109 TBranch *branch = leaf->GetBranch();
111 const char *brname = branch->GetName();
112 if (tuple->GetBranchStatus(brname)) {
113 active.push_back(std::string(brname));
130 public ::IEvtSelector::Context
164 {
return m_evtsel->m_inputCollectionsName.value(); }
202 if (cur &&
tree != cur) {
203 TFile *old_file = cur->GetCurrentFile();
223 ISvcLocator* svcLoc ) :
224 extends ( name, svcLoc ),
225 m_dataStore(
"StoreGateSvc/StoreGateSvc", name ),
226 m_imetaStore(
"StoreGateSvc/InputMetaDataStore", name ),
227 m_ometaStore(
"StoreGateSvc/MetaDataStore", name ),
228 m_clidsvc (
"ClassIDSvc", name ),
229 m_dictsvc (
"AthDictLoaderSvc", name ),
230 m_incsvc (
"IncidentSvc", name ),
237 declareProperty(
"DataStore",
239 "Store where to publish data");
241 declareProperty(
"InputMetaStore",
243 "Store where to publish (input) metadata");
245 declareProperty(
"MetaStore",
247 "Store where to publish (output) metadata");
249 declareProperty(
"InputCollections",
250 m_inputCollectionsName,
251 "List of input (ROOT) file names" );
252 m_inputCollectionsName.declareUpdateHandler
255 declareProperty(
"TupleName",
256 m_tupleName =
"CollectionTree",
257 "Name of the TTree to load/read from input file(s). "
258 "May be a semicolon-separated string to read multiple TTrees.");
260 declareProperty(
"SkipEvents",
262 "Number of events to skip at the beginning" );
264 declareProperty(
"ActiveBranches",
266 "List of branch names to activate" );
276 ATH_MSG_INFO (
"Enter RootNtupleEventSelector initialization...");
279 if ( !m_clidsvc.retrieve().isSuccess() ) {
281 (
"Could not retrieve [" << m_clidsvc.typeAndName() <<
"]");
282 return StatusCode::FAILURE;
286 if ( !m_dictsvc.retrieve().isSuccess() ) {
288 (
"Could not retrieve [" << m_dictsvc.typeAndName() <<
"]");
289 return StatusCode::FAILURE;
292 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
293 boost::char_separator<char> sep (
" ;");
294 tokenizer tokens (m_tupleName.value(), sep);
295 m_tupleNames.assign (tokens.begin(), tokens.end());
297 if ( m_tupleNames.empty() ) {
299 (
"You have to give a TTree name to read from the ROOT files !");
300 return StatusCode::FAILURE;
303 CHECK( m_incsvc.retrieve() );
304 m_incsvc->addListener(
this,IncidentType::BeginEvent,99);
308 const std::size_t nbrInputFiles = m_inputCollectionsName.value().size();
309 if ( nbrInputFiles < 1 ) {
311 (
"You need to give at least 1 input file !!" <<
endmsg
312 <<
"(Got [" << nbrInputFiles <<
"] file instead !)");
313 return StatusCode::FAILURE;
316 (
"Selector configured to read [" << nbrInputFiles <<
"] file(s)..."
318 <<
" TTree [" << m_tupleName.value() <<
"]");
324 if (!iomgr.retrieve().isSuccess()) {
326 return StatusCode::FAILURE;
328 if (!iomgr->io_register(
this).isSuccess()) {
329 ATH_MSG_FATAL(
"Could not register myself with the IoComponentMgr !");
330 return StatusCode::FAILURE;
333 const std::vector<std::string>& incol = m_inputCollectionsName.value();
335 for (std::size_t icol = 0,
imax = incol.size(); icol <
imax; icol++) {
336 if (!iomgr->io_register(
this,
337 IIoComponentMgr::IoMode::READ,
338 incol[icol]).isSuccess()) {
339 ATH_MSG_FATAL(
"could not register [" << incol[icol] <<
"] for output !");
342 ATH_MSG_VERBOSE(
"io_register[" << this->name() <<
"](" << incol[icol] <<
") [ok]");
346 return StatusCode::FAILURE;
351 return StatusCode::FAILURE;
382 std::vector<std::string> propVal;
384 bool foundSvc(
false);
385 for(
const std::string& s : propVal) {
386 if(s==
"Athena::xAODCnvSvc") { foundSvc=
true;
break; }
389 propVal.push_back(
"Athena::NtupleCnvSvc");
390 CHECK( epSvc->setProperty(
"CnvServices", Gaudi::Utils::toString( propVal ) ));
395 CHECK( ppSvc.retrieve() );
396 ppSvc->addProvider(
this );
400 return StatusCode::SUCCESS;
409 return StatusCode::SUCCESS;
417 ATH_MSG_INFO (
"Total events read: " << (m_nbrEvts - m_skipEvts));
426 return StatusCode::SUCCESS;
450 if (
SG::DataProxy* dp = m_dataStore->proxy_exact (cdp->sgkey())) {
451 dp->setAddress (
nullptr);
456 const bool forceRemove =
false;
457 CHECK( m_dataStore->clearStore(forceRemove) );
463 return StatusCode::SUCCESS;
476 ATH_MSG_ERROR (
"Could not dyn-cast to RootNtupleEventContext !!");
477 throw "RootNtupleEventSelector: Unable to get RootNtupleEventContext";
489 const std::string& fname = fnames[fidx];
492 throw "RootNtupleEventSelector: Unable to get tree";
506 return StatusCode::FAILURE;
509 int64_t global_entry = rctx->
entry();
512 int64_t
entry = global_entry;
513 if (
m_collEvts[tupleIdx][collIdx].min_entries < 0) {
515 long coll_idx, tuple_idx;
532 if ( nentries > entry ) {
536 if (
tree->LoadTree(entry) < 0) {
538 (
"Problem loading tree for event [" << m_curEvt <<
"] !!");
539 throw "RootNtupleEventSelector: Problem loading input tree";
545 m_curEvt = global_entry + 1;
548 if (!m_eventNumberVar.value().empty()) {
549 if (TLeaf* leaf =
tree->GetLeaf (m_eventNumberVar.value().c_str())) {
550 leaf->GetBranch()->GetEntry(entry);
554 ATH_MSG_ERROR(
"Cannot find event number variable: " << m_eventNumberVar);
559 if (!m_runNumberVar.value().empty()) {
560 if (TLeaf* leaf =
tree->GetLeaf (m_runNumberVar.value().c_str())) {
561 leaf->GetBranch()->GetEntry(entry);
565 ATH_MSG_ERROR(
"Cannot find run number variable: " << m_runNumberVar);
569 EventIDBase::number_type lbn = EventIDBase::UNDEFNUM;
570 if (!m_lbnVar.value().empty()) {
571 if (TLeaf* leaf =
tree->GetLeaf (m_lbnVar.value().c_str())) {
572 leaf->GetBranch()->GetEntry(entry);
573 lbn = std::abs(leaf->GetValue());
582 EventType* evtType =
new EventType;
584 evtInfo->
event_ID()->set_lumi_block (lbn);
585 if ( !m_dataStore->record( evtInfo,
"TTreeEventInfo" ).isSuccess() ) {
587 delete evtInfo; evtInfo = 0;
588 return StatusCode::FAILURE;
592 auto ei = std::make_unique<xAOD::EventInfo>();
593 auto ei_store = std::make_unique<xAOD::EventAuxInfo>();
594 ei->setStore (ei_store.get());
595 ei->setRunNumber (runNumber);
596 ei->setEventNumber (eventNumber);
597 ei->setLumiBlock (lbn);
599 static const SG::AuxElement::Accessor<std::string> tupleName (
"tupleName");
600 static const SG::AuxElement::Accessor<std::string> collName (
"collectionName");
601 tupleName(*ei) = m_tupleNames[tupleIdx];
602 collName(*ei) = m_inputCollectionsName[collIdx];
604 CHECK( m_dataStore->record (std::move(ei),
"EventInfo") );
605 CHECK( m_dataStore->record (std::move(ei_store),
"EventInfoAux.") );
610 return StatusCode::SUCCESS;
630 if (self()->
seek(ctx, m_curEvt + jump).isSuccess()) {
631 return StatusCode::FAILURE;
639 return next( ctx, -1 );
645 return next( ctx, -jump );
651 ATH_MSG_ERROR (
"............. Last Event Not Implemented .............");
652 return StatusCode::FAILURE;
659 return self()->seek(ctxt, 0);
667 return StatusCode::SUCCESS;
672 IOpaqueAddress*& )
const
675 return StatusCode::SUCCESS;
684 return StatusCode::SUCCESS;
687 return StatusCode::FAILURE;
693 ATH_MSG_ERROR (
"............. resetCriteria Not Implemented .............");
694 return StatusCode::FAILURE;
710 return StatusCode::FAILURE;
717 long coll_idx, tuple_idx;
724 if ((coll_idx == -1 || tuple_idx == -1) && evtnum < m_curEvt) {
729 if (coll_idx == -1 || tuple_idx == -1) {
731 return StatusCode::RECOVERABLE;
734 if (coll_idx !=
static_cast<int>(rctx->
fileIndex()) ||
735 tuple_idx !=
static_cast<int>(rctx->
tupleIndex()))
746 return StatusCode::SUCCESS;
767 if (!iomgr.retrieve().isSuccess()) {
769 return StatusCode::FAILURE;
771 if (!iomgr->io_hasitem(
this)) {
772 ATH_MSG_FATAL(
"IoComponentMgr does not know about myself !");
773 return StatusCode::FAILURE;
775 std::vector<std::string> inputCollections = m_inputCollectionsName.value();
779 imax = m_inputCollectionsName.value().size();
782 std::string &fname = inputCollections[i];
784 if (!iomgr->io_contains(
this, fname)) {
785 ATH_MSG_ERROR(
"IoComponentMgr does not know about [" << fname <<
"] !");
786 return StatusCode::FAILURE;
788 if (!iomgr->io_retrieve(
this, fname).isSuccess()) {
789 ATH_MSG_FATAL(
"Could not retrieve new value for [" << fname <<
"] !");
790 return StatusCode::FAILURE;
795 m_inputCollectionsName = inputCollections;
810 return StatusCode::FAILURE;
814 return StatusCode::SUCCESS;
828 return StatusCode::SUCCESS;
839 return StatusCode::SUCCESS;
845 const EventContext& )
848 if (m_dataStore->proxy_exact (tad->
sgkey())) {
849 return StatusCode::SUCCESS;
851 return StatusCode::FAILURE;
854 return StatusCode::SUCCESS;
876 return(StatusCode::SUCCESS);
881 return StatusCode::FAILURE;
884 TObjArray *leaves =
m_tuple->GetListOfLeaves();
887 return StatusCode::SUCCESS;
891 for (Int_t i = 0; i < leaves->GetEntries(); ++i) {
892 TLeaf *leaf = (TLeaf *)leaves->At(i);
893 TBranch *branch = leaf->GetBranch();
897 const void* value_ptr =
m_tuple;
898 const std::string type_name = leaf->GetTypeName();
899 const std::string br_name = branch->GetName();
900 const std::string sg_key = br_name;
901 TClass *cls = TClass::GetClass(type_name.c_str());
902 const std::type_info *ti = 0;
905 ti = cls->GetTypeInfo();
908 m_dictsvc->load_type(*ti);
915 std::string ti_typename = System::typeinfoName(*ti);
916 if (!m_clidsvc->getIDOfTypeInfoName(ti_typename,
id)
923 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
924 ti_typename = TClassEdit::ShortType(ti_typename.c_str(),
925 TClassEdit::kDropAllDefault);
927 if (!m_clidsvc->getIDOfTypeInfoName(ti_typename,
id)
930 << System::typeinfoName(*ti) <<
"]");
931 ATH_MSG_DEBUG(
"** could not find a CLID from type-info-alias ["
932 << ti_typename <<
"]");
938 if (!m_clidsvc->getIDOfTypeName(::root_typename(type_name),
id)
941 << type_name <<
"]");
947 << type_name <<
"]");
951 (ROOT_StorageType,
id,
954 (
unsigned long)(value_ptr),
955 (
unsigned long)(m_curEvt-1));
960 proxy->setAddress (addr);
964 taddr->setProvider(
this, storeID);
967 tads.push_back(taddr);
974 return StatusCode::SUCCESS;
980 const std::string& prefix)
const
984 return StatusCode::FAILURE;
989 return StatusCode::FAILURE;
994 if (store->
record(temp,prefix).isFailure())
ATH_MSG_ERROR(
"Unable to record metadata tree " <<
tree->GetName());
996 const std::string tree_name =
tree->GetName();
997 TObjArray *branches =
tree->GetListOfBranches();
1000 return StatusCode::SUCCESS;
1004 for (Int_t i = 0; i < branches->GetEntries(); ++i) {
1005 TBranch *branch = (TBranch *)branches->At(i);
1009 const void* value_ptr =
tree;
1010 const std::string type_name = branch->GetClassName();
1011 const std::string br_name = branch->GetName();
1012 const std::string sg_key = prefix.empty()
1014 : prefix +
"/" + br_name;
1016 if (!type_name.empty()) {
1017 cls = TClass::GetClass(type_name.c_str());
1019 const std::type_info *ti = 0;
1022 ti = cls->GetTypeInfo();
1025 m_dictsvc->load_type(*ti);
1032 std::string ti_typename = System::typeinfoName(*ti);
1033 if (!m_clidsvc->getIDOfTypeInfoName(ti_typename,
id)
1040 R__WRITE_LOCKGUARD(ROOT::gCoreMutex);
1041 ti_typename = TClassEdit::ShortType(ti_typename.c_str(),
1042 TClassEdit::kDropAllDefault);
1044 if (!m_clidsvc->getIDOfTypeInfoName(ti_typename,
id)
1046 ATH_MSG_INFO(
"** could not find a CLID from type-info ["
1047 << System::typeinfoName(*ti) <<
"]");
1048 ATH_MSG_INFO(
"** could not find a CLID from type-info-alias ["
1049 << ti_typename <<
"]");
1055 TObjArray *leaves = branch->GetListOfLeaves();
1057 leaves->GetEntries() == 1) {
1058 const std::string type_name = ((TLeaf*)leaves->At(0))->GetTypeName();
1059 if (!m_clidsvc->getIDOfTypeName(::root_typename(type_name),
id)
1061 ATH_MSG_INFO(
"** could not find a CLID for type-name ["
1062 << type_name <<
"]");
1068 ATH_MSG_INFO(
"** could not find a CLID for type-name ["
1069 << type_name <<
"]");
1074 (ROOT_StorageType,
id,
1077 (
unsigned long)(value_ptr),
1078 (
unsigned long)(0)));
1079 if (!store->recordAddress(sg_key, std::move(addr),
true).isSuccess()) {
1080 ATH_MSG_ERROR(
"could not record address at [" << sg_key <<
"] in store ["
1081 << store->
name() <<
"]");
1090 return StatusCode::SUCCESS;
1095 const std::string& tupleName)
const
1101 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(fname.c_str());
1102 TFile* fnew =
nullptr;
1104 f = TFile::Open(fname.c_str(),
"READ");
1107 f->SetName(fname.c_str());
1110 if (!f || f->IsZombie()) {
1111 ATH_MSG_ERROR(
"could not open next file in input collection ["
1119 tree = (TTree*)f->Get(tupleName.c_str());
1121 ATH_MSG_ERROR(
"could not retrieve tree [" << tupleName <<
"]"
1122 <<
" from file [" << fname <<
"]");
1132 tree->SetBranchStatus(
"*", 0);
1133 if (!m_eventNumberVar.value().empty()) {
1134 tree->SetBranchStatus(m_eventNumberVar.value().c_str(), 1);
1136 if (!m_runNumberVar.value().empty()) {
1137 tree->SetBranchStatus(m_runNumberVar.value().c_str(), 1);
1139 if (!m_lbnVar.value().empty()) {
1140 tree->SetBranchStatus(m_lbnVar.value().c_str(), 1);
1143 if (!m_imetaStore->clearStore().isSuccess()) {
1144 ATH_MSG_INFO(
"could not clear store [" << m_imetaStore.typeAndName() <<
"]");
1155 TDirectoryFile *metadir = (TDirectoryFile*)fileObj->Get(metadirname.c_str());
1156 if (!metadir)
return;
1162 std::unordered_set<std::string> meta_keys;
1163 const TList *keys = metadir->GetListOfKeys();
1164 for (Int_t i=0; i < keys->GetSize(); ++i) {
1165 TKey* key =
dynamic_cast<TKey*
>(keys->At(i));
1170 const std::string meta_key = key->GetName();
1171 if (!meta_keys.emplace(key->GetName()).second) {
1179 std::string fullPrefix(prefix);
1180 if (prefix !=
"") fullPrefix +=
"/";
1181 const std::string path = fullPrefix + key->GetName();
1183 TString fullKeyName(TString::Format(
"%s;%hi", key->GetName(), key->GetCycle()));
1184 TObject *objRef = metadir->Get(fullKeyName);
1186 TTree *metatree =
dynamic_cast<TTree*
>(objRef);
1192 TObjString *metaObjString =
dynamic_cast<TObjString*
>(objRef);
1193 if (metaObjString) {
1198 ATH_MSG_WARNING(
"Unsupported metadata type: " << objRef->ClassName());
1204 if (metatree->GetEntry(0) < 0) {
1205 ATH_MSG_INFO(
"Problem retrieving data from metadata-tree [" << path <<
"] !!");
1210 ATH_MSG_INFO(
"Could not create metadata for tree [" << path <<
"]");
1216 std::string *converted =
new std::string(metastring->String());
1217 if (!m_imetaStore->record(converted, path).isSuccess()) {
1218 ATH_MSG_INFO(
"Could not create metadata for string [" << path <<
"]");
1230 zero.min_entries = -1;
1231 zero.max_entries = -1;
1234 for (
size_t i = 0; i <
m_collEvts.size(); i++) {
1235 m_collEvts[i].resize(m_inputCollectionsName.value().size(),
zero);
1242 throw "RootNtupleEventSelector: Unable to fetch Ntuple";
1250 m_curEvt = m_skipEvts;
1254 return StatusCode::SUCCESS;
1262RootNtupleEventSelector::find_coll_idx (
int evtidx,
1264 long& tuple_idx)
const
1271 for (
size_t ituple = 0; ituple <
m_collEvts.size(); ++ituple) {
1272 for (
size_t icoll = 0; icoll <
m_collEvts[ituple].size(); ++icoll) {
1273 CollMetaData &itr =
m_collEvts[ituple][icoll];
1274 if (itr.min_entries == -1) {
1276 m_tupleNames[ituple]);
1280 offset =
m_collEvts[ituple][icoll-1].max_entries;
1282 else if (ituple > 0) {
1283 offset =
m_collEvts[ituple-1].back().max_entries;
1285 itr.entries =
tree->GetEntriesFast();
1286 itr.min_entries =
offset;
1287 itr.max_entries =
offset + itr.entries;
1289 throw "RootNtupleEventSelector: Unable to fetch ntuple";
1295 if (itr.min_entries <= evtidx && evtidx < itr.max_entries) {
1307 long coll_idx, tuple_idx;
1314 if (
m_fireBIF && incident.type() == IncidentType::BeginEvent) {
1315 std::string fname =
m_tuple->GetCurrentFile()->GetName();
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
#define CHECK(...)
Evaluate an expression and check for errors.
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
This class provides general information about an event.
uint32_t CLID
The Class ID type.
size_t size() const
Number of registered mappings.
Include TBranchElement.h, suppressing clang warnings.
A simple class to hold the buffer of a TBranch from a TTree.
state of a few global resources from ROOT and restores their initial value upon d-tor call.
ROOT specific event selector context.
virtual void * identifier() const
context identifier
std::string m_fid
connection FID
long m_tupleIdx
current tuple index (into `m_tupleNames')
void setTree(TTree *tree)
set the tree used to iterate
std::size_t fileIndex() const
access to the file iterator
std::size_t tupleIndex() const
std::vector< std::string > FileNames_t
definition of the file container
const std::string & fid() const
access to the connection FID
virtual ~RootNtupleEventContext()
standard d-tor
void setFileIndex(std::size_t idx)
set file iterator
long m_collIdx
current collection index (into m_inputCollectionsName)
const FileNames_t & files() const
int64_t entry() const
access to the current event entry number
const RootNtupleEventSelector * m_evtsel
reference to the hosting event selector instance
TTree * tree() const
access to the tree used to iterate
void setTupleIndex(std::size_t idx)
void setFID(const std::string &fid)
set connection FID
RootNtupleEventContext(const RootNtupleEventSelector *sel)
standard c-tor with initialization
Class implementing the GAUDI IEvtSelector interface using ROOT TTree as a backend.
virtual StatusCode seek(Context &refCtxt, int evtnum) const override
Seek to a given event number.
virtual ~RootNtupleEventSelector()
Destructor:
virtual StatusCode finalize() override
virtual int size(Context &refCtxt) const override
ICollectionSize interface
RootNtupleEventSelector(const std::string &name, ISvcLocator *svcLoc)
Constructor with parameters:
virtual StatusCode releaseContext(Context *&refCtxt) const override
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.
virtual StatusCode last(Context &refContext) const override
virtual StatusCode resetCriteria(const std::string &cr, Context &ctx) const override
virtual StatusCode preLoadAddresses(StoreID::type storeID, tadList &list) override
TTree * m_tuple
current tree being read
std::vector< std::vector< CollMetaData > > m_collEvts
helper method to get the collection index (into m_inputCollectionsName) and tuple index (into m_tuple...
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
std::vector< TFile * > m_files
virtual StatusCode next(Context &refCtxt) const override
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
bool m_fireBIF
Flag to fire BeginInputFile on the next BeginEvent incident.
friend class Athena::RootNtupleEventContext
void addMetadataFromDirectoryName(const std::string &metadirname, TFile *fileObj, const std::string &prefix="") const
virtual StatusCode createContext(Context *&refpCtxt) const override
std::optional< InputFileIncidentGuard > m_inputFileGuard
RAII guard: guarantees a matching EndInputFile for every BeginInputFile.
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 initialize() override
virtual StatusCode previous(Context &refCtxt) const override
virtual StatusCode stop() override
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
Simple smart pointer for Gaudi-style refcounted objects.
EventID * event_ID()
the unique identification of the event.
void record(const T *p, const std::string &key)
virtual const std::string & name() const override
sgkey_t sgkey() const
Set the primary (hashed) SG key.
The Athena Transient Store API.
void zero(TH2 *h)
zero the contents of a 2d histogram
std::vector< std::string > files
file names and file pointers
Some weak symbol referencing magic... These are declared in AthenaKernel/getMessageSvc....
RootNtupleEventContext::FileNames_t FileNames_t
find_coll_idx(-1, coll_idx, tuple_idx)
StatusCode ROOTMessageFilterSvc::initialize ATLAS_NOT_THREAD_SAFE()
Return the file descriptor fataldump() uses for output.
StatusCode parse(std::tuple< Tup... > &tup, const Gaudi::Parsers::InputData &input)
EventInfo_v1 EventInfo
Definition of the latest event info version.