ATLAS Offline Software
Functions
xAODTrigConfReadTest.cxx File Reference
#include <memory>
#include "AsgTools/ToolHandle.h"
#include "AsgTools/ToolHandleArray.h"
#include "TrigConfxAOD/xAODConfigTool.h"
Include dependency graph for xAODTrigConfReadTest.cxx:

Go to the source code of this file.

Functions

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

Function Documentation

◆ main()

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

Definition at line 30 of file xAODTrigConfReadTest.cxx.

30  {
31 
32  // Get the application's name:
33  const char* APP_NAME = argv[ 0 ];
34 
35  // Check that we received at least one file name:
36  if( argc < 2 ) {
37  ::Error( APP_NAME, "Usage: %s <xAOD file1> [xAOD file2]...", APP_NAME );
38  return 1;
39  }
40 
41  // Initialise the application:
43 
44  // Create a TEvent object:
46 
47  // Create the trigger configuration tool:
48  TrigConf::xAODConfigTool configTool( "xAODConfigTool" );
49  // configTool.setProperty( "MetaObjectName", "Bla" );
50  configTool.setProperty( "OutputLevel", MSG::VERBOSE ).ignore();
51  if( configTool.initialize().isFailure() ) {
52  ::Error( APP_NAME, "Couldn't initialise the trigger configuration tool" );
53  return 1;
54  }
55 
56  // Try creating ToolHandles for this tool:
57  ToolHandle< TrigConf::ITrigConfigTool > handle( "xAODConfigTool" );
58  ToolHandleArray< TrigConf::ITrigConfigTool > handleArray{ "xAODConfigTool" };
59 
60  // Check if they can be retrieved:
61  if( handle.retrieve().isFailure() || handleArray.retrieve().isFailure() ) {
63  "Couldn't retrieve the tested tool through tool handles" );
64  return 1;
65  }
66 
67  // Loop over the files:
68  for( int i = 1; i < argc; ++i ) {
69 
70  // Open the input file:
71  std::unique_ptr< ::TFile > ifile( ::TFile::Open( argv[ i ], "READ" ) );
72  if( ! ifile.get() ) {
73  ::Error( APP_NAME, "Couldn't open file: %s", argv[ i ] );
74  return 1;
75  }
76  ::Info( APP_NAME, "Opened file: %s", argv[ i ] );
77 
78  // Connect the TEvent object to it:
80 
81  // Loop over a few events:
82  const ::Long64_t entries = event.getEntries();
83  for( ::Long64_t entry = 0; entry < entries; ++entry ) {
84 
85  // Get the current entry:
86  event.getEntry( entry );
87 
88  // Print some additional info for the first 10 events:
89  if( entry < 10 ) {
90  ::Info( APP_NAME, "Processing entry %i", static_cast< int >( entry ) );
91 
92  // Get some information out of the tested tool:
93  ::Info( APP_NAME, "SMK: %i, L1PSK: %i, HLTPSK: %i",
94  static_cast< int >( configTool.masterKey() ),
95  static_cast< int >( configTool.lvl1PrescaleKey() ),
96  static_cast< int >( configTool.hltPrescaleKey() ) );
97  ::Info( APP_NAME, " Number of L1 items: %i",
98  static_cast< int >( configTool.ctpConfig()->menu().items().size() ) );
99  ::Info( APP_NAME, " Number of HLT chains: %i",
100  static_cast< int >( configTool.chains().size() ) );
101  ::Info( APP_NAME, " L1 menu " );
102  configTool.ctpConfig()->print("", 100);
103  }
104 
105  // Give some feedback of where we are:
106  if( ! ( entry % 100 ) ) {
107  ::Info( APP_NAME, "Processed %i/%i events",
108  static_cast< int >( entry ),
109  static_cast< int >( entries ) );
110  }
111  }
112  }
113 
114  // Return gracefully:
115  return 0;
116 }
TestSUSYToolsAlg.ifile
ifile
Definition: TestSUSYToolsAlg.py:92
RETURN_CHECK
#define RETURN_CHECK(CONTEXT, EXP)
Helper macro for checking return codes in a compact form in the code.
Definition: ReturnCheck.h:26
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:132
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
lumiFormat.i
int i
Definition: lumiFormat.py:92
APP_NAME
#define APP_NAME
Definition: BoostedXbbTag.cxx:23
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
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
xAOD::TEvent::kBranchAccess
@ kBranchAccess
Access auxiliary data branch-by-branch.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:96
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
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
TrigConf::xAODConfigTool
Trigger configuration metadata tool for xAOD analysis.
Definition: xAODConfigTool.h:55