ATLAS Offline Software
Functions
xAODChecker.cxx File Reference
#include <cstring>
#include <memory>
#include <TFile.h>
#include <TError.h>
#include "AsgMessaging/MessageCheck.h"
#include "CxxUtils/checker_macros.h"
#include "xAODRootAccess/Init.h"
#include "xAODRootAccess/TEvent.h"
#include "xAODRootAccess/tools/TFileChecker.h"
#include "xAODRootAccess/tools/ReturnCheck.h"

Go to the source code of this file.

Functions

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

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

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

Definition at line 22 of file xAODChecker.cxx.

22  {
23 
24  ANA_CHECK_SET_TYPE (int);
25  using namespace asg::msgUserCode;
26 
27  // The application's name:
28  const char* APP_NAME = argv[ 0 ];
29 
30  // Check that the application will be able to run:
31  if( ( argc == 1 ) ||
32  ( ( argc == 2 ) && ( ::strcmp( argv[ 1 ], "-h" ) == 0 ) ) ) {
33  ::Info( APP_NAME, "Usage: %s <xAOD file1> [xAOD file2] ...", APP_NAME );
34  return 0;
35  }
36 
37  // Initialise the application's environment:
38  ANA_CHECK( xAOD::Init() );
39 
40  // The object used in the checks:
42  checker.setStopOnError( kFALSE ); // Don't stop on errors, print them all
43 
44  // Loop over the files:
45  for( int i = 1; i < argc; ++i ) {
46 
47  // The file name:
48  const char* fname = argv[ i ];
49 
50  // Open the file:
51  std::unique_ptr< ::TFile > ifile( ::TFile::Open( fname, "READ" ) );
52  if( ! ifile.get() ) {
53  ::Error( APP_NAME, XAOD_MESSAGE( "Couldn't open file: %s" ), fname );
54  return 1;
55  }
56  ::Info( APP_NAME, "Opened file: %s", fname );
57 
58  // Later on the code should find all the top level event trees in the
59  // input file. But for now let's just assume that only "CollectionTree" is
60  // in the file.
61 
62  // Set up reading from the file:
64  ANA_CHECK( event.readFrom( ifile.get() ) );
65 
66  // Run the sanity checks:
67  ANA_CHECK( checker.check( event ) );
68  }
69 
70  // Return gracefully:
71  return 0;
72 }
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition: Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:133
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:85
APP_NAME
#define APP_NAME
Definition: BoostedXbbTag.cxx:23
xAOD::TFileChecker
Tool for running sanity checks on xAOD files.
Definition: TFileChecker.h:39
run_gep.ifile
ifile
Definition: run_gep.py:65
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
ANA_CHECK_SET_TYPE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:314
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:81
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition: Init.cxx:31
dumpTriggerInfo.checker
checker
Definition: dumpTriggerInfo.py:20