14#include <TDirectory.h>
33 const char* treeName ) {
43 if(
m_event.getEntry( 0 ) < 0 ) {
44 ::Error(
"xAOD::TTreeMgr::readFrom",
45 "Couldn't load the first event from file \"%s\"",
47 return StatusCode::FAILURE;
54 return StatusCode::SUCCESS;
62 ::Warning(
"xAOD::TTreeMgr::enableEventObj",
63 "Event tree already created, can't filter its contents "
65 return StatusCode::RECOVERABLE;
72 return StatusCode::SUCCESS;
80 ::Warning(
"xAOD::TTreeMgr::suppressEventObj",
81 "Event tree already created, can't filter its contents "
83 return StatusCode::RECOVERABLE;
90 return StatusCode::SUCCESS;
98 ::Warning(
"xAOD::TTreeMgr::enableMetaObj",
99 "Metadata tree already created, can't filter its contents "
101 return StatusCode::RECOVERABLE;
108 return StatusCode::SUCCESS;
116 ::Warning(
"xAOD::TTreeMgr::suppressMetaObj",
117 "Metadata tree already created, can't filter its contents "
119 return StatusCode::RECOVERABLE;
126 return StatusCode::SUCCESS;
139 ::Error(
"xAOD::TTreeMgr::eventTree",
141 "metadata. Did you use readFrom(...)?" ) );
147 ::TDirectory* dir = gDirectory;
159 for(
const auto& ef_itr : *ef ) {
178 TRegexp
re(
name.c_str() );
180 if(
re.Index( efe.
branchName().c_str(), &dummy ) >= 0 ) {
192 TRegexp
re(
name.c_str() );
194 if(
re.Index( efe.
branchName().c_str(), &dummy ) >= 0 ) {
210 ::TClass* cl = ::TClass::GetClass( efe.
className().c_str(), kTRUE,
215 if( cl->InheritsFrom(
"SG::IConstAuxStore" ) ) {
220 const std::type_info* ti = cl->GetTypeInfo();
222 ::Warning(
"xAOD::TTreeMgr::eventTree",
223 "Couldn't find std::type_info object for type %s "
224 "(key=%s)", cl->GetName(), efe.
branchName().c_str() );
229 static constexpr bool METADATA =
false;
255 ::Error(
"xAOD::TTreeMgr::metaTree",
257 "tree. Did you use readFrom(...)?" ) );
263 ::TDirectory* dir = gDirectory;
274 TObjArray* branches =
m_event.m_inMetaTree->GetListOfBranches();
275 for( ::Int_t i = 0; i < branches->GetEntries(); ++i ) {
278 ::TBranch* br =
dynamic_cast< ::TBranch*
>( branches->At( i ) );
280 ::Error(
"xAOD::TTreeMgr::metaTree",
281 XAOD_MESSAGE(
"Couldn't access branch %i as a TBranch" ),
288 if( ! strcmp( br->GetName(),
"EventFormat" ) )
continue;
294 TRegexp
re(
name.c_str() );
296 if(
re.Index( br->GetName(), &dummy ) >= 0 ) {
308 TRegexp
re(
name.c_str() );
310 if(
re.Index( br->GetName(), &dummy ) >= 0 ) {
321 ::TClass* cl = ::TClass::GetClass( br->GetClassName(), kTRUE, kTRUE );
325 const std::type_info* ti = cl->GetTypeInfo();
329 if( cl->InheritsFrom(
"SG::IConstAuxStore" ) ) {
337 br->GetClassName() );
const boost::regex re(r_e)
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Transient TTree for interactive xAOD event data access.
Tool for accessing xAOD files outside of Athena.
EAuxMode
Auxiliary store "mode".
std::unique_ptr< xAODTMetaTree > m_metaTree
The transient metadata tree.
StatusCode enableMetaObj(const std::vector< std::string > &names)
Object/container names that should be used in the metadata tree.
std::vector< std::string > m_enableEventObj
Names to select for the event tree.
StatusCode enableEventObj(const std::vector< std::string > &names)
Object/container names that should be used in the event tree.
TEvent m_event
The internal TEvent object.
::TTree * eventTree()
Get a pointer to the transient event tree.
std::vector< std::string > m_enableMetaObj
Names to select for the metatada tree.
TTreeMgr(TEvent::EAuxMode mode=TEvent::kClassAccess)
Constructor, with an optional access mode selector.
StatusCode readFrom(::TFile *file, ::Bool_t useTreeCache=kTRUE, const char *treeName="CollectionTree")
Read from the file given to the function.
std::vector< std::string > m_suppressMetaObj
Names to suppress from the metadata tree.
StatusCode suppressEventObj(const std::vector< std::string > &names)
Object/container names that should be vetoed from the event tree.
StatusCode suppressMetaObj(const std::vector< std::string > &names)
Object/container names that should be suppressed in the metadata tree.
std::string m_eventTreeName
The name of the event tree to create.
std::unique_ptr< xAODTEventTree > m_eventTree
The transient event tree.
std::vector< std::string > m_suppressEventObj
Names to suppress from the event tree.
TEvent & event()
Get the TEvent object being used by the transient tree(s)
::TTree * metaTree()
Get a pointer to the transient metadata tree.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
EventFormat_v1 EventFormat
Definition of the current event format version.
static const SG::AuxElement::Accessor< std::vector< std::string > > names("thrNames")
Accessor for the names of the passed thresholds.