23static const char*
const APP_NAME =
"xAODFileReadTest";
26#define R_CHECK( EXP ) \
28 const auto result = EXP; \
29 if( ! result.isSuccess() ) { \
30 Error( APP_NAME, XAOD_MESSAGE( "Failed to execute: %s" ), #EXP ); \
46 return StatusCode::FAILURE;
49 for(
const auto & ef_itr : *ef ) {
62 ::TClass* cl = ::TClass::GetClass( efe.
className().c_str(), kTRUE,
65 if( cl->InheritsFrom(
"SG::IConstAuxStore" ) ) {
69 const std::type_info* ti = cl->GetTypeInfo();
71 ::Warning(
"REventClass::loadInputObjects",
72 "Couldn't find std::type_info object for type %s "
73 "(key=%s)", cl->GetName(), efe.
branchName().c_str() );
77 static constexpr bool METADATA =
false;
82 static constexpr bool SILENT =
false;
84 Error(
"REventClass::loadInputObjects",
87 return StatusCode::FAILURE;
91 return StatusCode::SUCCESS;
95int main(
int argc,
char* argv[] ) {
102 ( ! strcmp( argv[ 1 ],
"-h" ) ) ||
103 ( ! strcmp( argv[ 1 ],
"--help" ) ) ) {
106 Info(
APP_NAME,
" -m <access mode>" );
107 Info(
APP_NAME,
" 0: Branch access" );
108 Info(
APP_NAME,
" 1: Class access (default)" );
109 Info(
APP_NAME,
" 2: Athena access" );
114 std::vector< std::string > fileNames;
115 for(
int i = 1; i < argc; ++i ) {
116 fileNames.push_back( argv[ i ] );
123 for(
const std::string& fileName : fileNames ) {
126 Info(
APP_NAME,
"Opening file: %s", fileName.c_str() );
131 R_CHECK( event.readFrom( fileName ) );
134 const Long64_t
entries =
event.getEntries();
135 for( Long64_t entry = 0; entry <
entries; ++entry ) {
138 if( event.getEntry( entry ) < 0 ) {
140 XAOD_MESSAGE(
"Failed to load entry %i from file: %s" ),
141 static_cast< int >( entry ), fileName.c_str() );
146 R_CHECK( event.loadInputObjects() );
149 if( ( entry % 1000 == 0 ) || ( entry +1 ==
entries ) ) {
150 Info(
APP_NAME,
"===>>> Loaded entry %i / %i <<<===",
151 static_cast< int >( entry ),
static_cast< int >(
entries ) );
StatusCode loadInputObjects()
Function loading all interface objects of the event.
const EventFormat * inputEventFormat() const
Get information about the input objects.
bool contains(const std::string &key)
Function checking if an object is available from the store.
const void * getInputObject(SG::sgkey_t key, const std::type_info &ti, bool silent) override
Function for retrieving an input object in a non-template way.
Tool for accessing xAOD files outside of Athena, version RNTuple.
REvent()
Default constructor.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
EventFormat_v1 EventFormat
Definition of the current event format version.
#define R_CHECK(EXP)
Helper macro.