ATLAS Offline Software
Classes | Macros | Functions
xAODRNFileReadTest.cxx File Reference
#include <cstring>
#include <memory>
#include <vector>
#include <string>
#include <TFile.h>
#include <TError.h>
#include <TClass.h>
#include "xAODRootAccess/Init.h"
#include "xAODRootAccess/REvent.h"
#include "xAODRootAccess/tools/Message.h"

Go to the source code of this file.

Classes

class  REventClass
 Class used for the test. More...
 

Macros

#define R_CHECK(EXP)
 Helper macro. More...
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

◆ R_CHECK

#define R_CHECK (   EXP)
Value:
do { \
const auto result = EXP; \
if( ! result.isSuccess() ) { \
Error( APP_NAME, XAOD_MESSAGE( "Failed to execute: %s" ), #EXP ); \
return 1; \
} \
} while( 0 )

Helper macro.

Definition at line 27 of file xAODRNFileReadTest.cxx.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 95 of file xAODRNFileReadTest.cxx.

95  {
96 
97  // Initialise the environment:
98  R_CHECK( xAOD::Init() );
99 
100  // Provide usage instructions if not enough options were given:
101  if( ( argc < 2 ) ||
102  ( ! strcmp( argv[ 1 ], "-h" ) ) ||
103  ( ! strcmp( argv[ 1 ], "--help" ) ) ) {
104  Info( APP_NAME, "Usage: %s [options] <file1> [file2]...", APP_NAME );
105  Info( APP_NAME, "Options:" );
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" );
110  return 1;
111  }
112 
113  // Decode the command line options:
114  std::vector< std::string > fileNames;
115  for( int i = 1; i < argc; ++i ) {
116  fileNames.push_back( argv[ i ] );
117  }
118 
119  // Create the "REvent" object used for the test:
121 
122  // Loop over the specified input files:
123  for( const std::string& fileName : fileNames ) {
124 
125  // // Open the file:
126  Info( APP_NAME, "Opening file: %s", fileName.c_str() );
127 
128  // Give it to REvent:
129 
130  // Call readFrom to setup REvent for reading
132 
133  // Loop over the file's events:
134  const Long64_t entries = event.getEntries();
135  for( Long64_t entry = 0; entry < entries; ++entry ) {
136 
137  // Load the event:
138  if( event.getEntry( entry ) < 0 ) {
139  Error( APP_NAME,
140  XAOD_MESSAGE( "Failed to load entry %i from file: %s" ),
141  static_cast< int >( entry ), fileName.c_str() );
142  return 1;
143  }
144 
145  // Load the event:
146  R_CHECK( event.loadInputObjects() );
147 
148  // Tell the user where we are:
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 ) );
152  }
153  }
154  }
155 
156  // Return gracefully:
157  return 0;
158 }
get_generator_info.result
result
Definition: get_generator_info.py:21
checkxAOD.fileNames
fileNames
Definition: Tools/PyUtils/bin/checkxAOD.py:79
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition: Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
ZDCMsg::Info
@ Info
Definition: ZDCMsg.h:20
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:133
REventClass
Class used for the test.
Definition: xAODRNFileReadTest.cxx:36
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
POOL::TEvent::getEntry
int getEntry(long entry)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:185
lumiFormat.i
int i
Definition: lumiFormat.py:85
LArCellNtuple.argv
argv
Definition: LArCellNtuple.py:152
R_CHECK
#define R_CHECK(EXP)
Helper macro.
Definition: xAODRNFileReadTest.cxx:26
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:19
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
entries
double entries
Definition: listroot.cxx:49
L1Topo::Error
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition: Error.h:16
jobOptions.fileName
fileName
Definition: jobOptions.SuperChic_ALP2.py:39
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition: Init.cxx:31