ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
xAODRootAccess
util
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
13
#include "
AsgMessaging/MessageCheck.h
"
14
#include "
CxxUtils/checker_macros.h
"
15
16
// Local include(s):
17
#include "
xAODRootAccess/Init.h
"
18
#include "
xAODRootAccess/TEvent.h
"
19
#include "
xAODRootAccess/tools/TFileChecker.h
"
20
#include "
xAODRootAccess/tools/ReturnCheck.h
"
21
22
int
main
ATLAS_NOT_THREAD_SAFE
(
int
argc,
char
* argv[] ) {
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:
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
}
APP_NAME
#define APP_NAME
Definition
BoostedXbbTag.cxx:25
MessageCheck.h
macros for messaging and checking status codes
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:325
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:315
TEvent.h
XAOD_MESSAGE
#define XAOD_MESSAGE(MESSAGE)
Simple macro for printing error/verbose messages.
Definition
Control/xAODRootAccess/xAODRootAccess/tools/Message.h:19
main
int main(int, char **)
Main class for all the CppUnit test classes.
Definition
CppUnit_SGtestdriver.cxx:141
Init.h
ReturnCheck.h
TFileChecker.h
checker_macros.h
Define macros for attributes used to control the static checker.
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition
checker_macros.h:212
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:59
xAOD::TFileChecker
Tool for running sanity checks on xAOD files.
Definition
TFileChecker.h:39
xAOD::Init
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition
Init.cxx:31
Generated on
for ATLAS Offline Software by
1.17.0