19#include <unordered_map>
23 auto getNameFromLoc( std::string_view loc ) {
24 auto lastSlashPos = loc.find_last_of(
'/' );
25 return std::string{ lastSlashPos != loc.npos ? loc.substr( lastSlashPos + 1 ) : loc };
37 if ( extraOutputs.empty() ) {
38 error() <<
"No extra output locations specified. Please define extra output for the NTuple reader" <<
endmsg;
48 auto file = fileSvc->getFile(
m_fileId );
64 std::scoped_lock lock(
m_mutex );
65 m_tree->GetEntry( ctx.evt() );
69 .
orThrow( std::format(
"Failed to register object to location '{}'", address ),
name() );
78 "Identifier for the TFile to read from" };
88 for (
const auto& dep : extraOutputs ) {
89 auto branchName = getNameFromLoc( dep.key() );
90 auto branch =
m_tree->GetBranch( branchName.c_str() );
92 error() <<
"Failed to retrieve TBranch " << branchName <<
endmsg;
std::unordered_set< DataObjID, DataObjID_Hasher > DataObjIDColl
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
virtual const DataObjIDColl & extraOutputDeps() const override
This class represents an entry point to all the event specific data.
Base class from which all concrete algorithm classes should be derived.
SmartIF< IDataProviderSvc > & eventSvc() const
The standard event data service.
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
const std::string & name() const override
The identifying name of the algorithm object.
SmartIF< IService > service(std::string_view name, const bool createIf=true, const bool quiet=false) const
Return a pointer to the service identified by name (or "type/name").
StatusCode connectBranches(const DataObjIDColl &extraOutputs)
StatusCode execute(const EventContext &ctx) const override
StatusCode initialize() override
std::unordered_map< std::string, Gaudi::details::BranchReadHelper > m_branchReadHelpers
StatusCode finalize() override
Gaudi::Property< std::string > m_ntupleTname
Gaudi::Property< std::string > m_fileId
Implementation of property with value of concrete type.
StatusCode registerObject(std::string_view fullPath, DataObject *pObject)
Register object with the data store.
This class is used for returning status codes from appropriate routines.
const StatusCode & orThrow(std::string_view message, std::string_view tag) const
Throw a GaudiException in case of failures.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE