ATLAS Offline Software
Loading...
Searching...
No Matches
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
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:
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}
#define APP_NAME
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Tool for accessing xAOD files outside of Athena.
Tool for running sanity checks on xAOD files.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition Init.cxx:31