ATLAS Offline Software
Loading...
Searching...
No Matches
xAODChecker.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5// System include(s):
6#include <cstring>
7#include <memory>
8
9// ROOT include(s):
10#include <TFile.h>
11#include <TError.h>
12
15
16// Local include(s):
17#include "xAODRootAccess/Init.h"
21
22int main ATLAS_NOT_THREAD_SAFE ( int argc, char* argv[] ) {
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:
41 xAOD::TFileChecker checker;
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:
63 xAOD::TEvent event;
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
macros for messaging and checking status codes
#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.
int main(int, char **)
Main class for all the CppUnit test classes.
Define macros for attributes used to control the static checker.
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
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