ATLAS Offline Software
dump-cbk.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Setup for reading ATLAS data
6 #ifdef XAOD_STANDALONE
7 #include <xAODRootAccess/Init.h>
9 #else
10 #include <POOLRootAccess/TEvent.h>
11 #endif
13 
14 // ASG
18 
20 ANA_MSG_SOURCE(CutFlow, "Dump")
21 
22 // ROOT dependencies
23 #include <TFile.h>
24 
25 // Main routine... here we go!
26 int main(int argc, char **argv)
27 {
28  // Make sure things know we are not in StatusCode land
29  using namespace CutFlow;
30  ANA_CHECK_SET_TYPE (int);
31 
32  if (argc < 2) {
33  ANA_MSG_ERROR("Input file missing.");
34  return 1;
35  }
36  const char *inputFile = argv[1];
37 
38  // Setup for reading -- if this fails, we have major problems
39 #ifdef XAOD_STANDALONE
40  if ( ! xAOD::Init().isSuccess() ) {
41  throw std::runtime_error("Cannot initialise xAOD access !");
42  }
43  ANA_MSG_INFO("Using xAOD access");
44 #else
45  IAppMgrUI *app = POOL::Init();
46  ANA_MSG_INFO("Using POOL access");
47 #endif
48 
50 
51  ANA_MSG_INFO("Reading file:" << inputFile);
52 
53  // Input chain
54  std::unique_ptr<TFile> file(TFile::Open(inputFile, "READ"));
55  ANA_CHECK(file.get());
56 #ifdef XAOD_STANDALONE
58 #else
60 #endif
61  ANA_CHECK(event.readFrom(file.get()));
62 
63  // Load metadata
64  event.getEntries();
65 
66  // Retrieve the tool
67  asg::StandaloneToolHandle<asg::AsgMetadataTool> tool("BookkeeperDumperTool/BookkeeperDumperTool");
68  ANA_CHECK(tool.setProperty("StandaloneMode", true));
69  ANA_CHECK(tool.setProperty("AllVariations", true));
70  ANA_CHECK(tool.retrieve());
71 
72  // Trigger finalization of all services and tools created by the Gaudi Application
73 #ifndef XAOD_STANDALONE
74  app->finalize().ignore();
75 #endif
76 
77  return 0;
78 }
xAOD::TFileAccessTracer::enableDataSubmission
static void enableDataSubmission(::Bool_t value)
Function for turning data submission on/off.
Definition: TFileAccessTracer.cxx:281
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:97
POOL::Init
IAppMgrUI * Init(const char *options="POOLRootAccess/basic.opts")
Bootstraps (creates and configures) the Gaudi Application with the provided options file.
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:29
POOL::TEvent::kClassAccess
@ kClassAccess
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:45
ANA_MSG_HEADER
#define ANA_MSG_HEADER(NAME)
for standalone code this creates a new message category
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:113
POOL::TEvent::readFrom
StatusCode readFrom(TFile *file)
Definition: PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx:132
TFileAccessTracer.h
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
CaloCondBlobAlgs_fillNoiseFromASCII.inputFile
string inputFile
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:17
asg::StandaloneToolHandle
an "initializing" ToolHandle for stand-alone applications
Definition: StandaloneToolHandle.h:44
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
MessageCheck.h
macros for messaging and checking status codes
TEvent.h
file
TFile * file
Definition: tile_monitor.h:29
CutFlow
Definition: CutFlow.h:166
Init.h
main
int main(int argc, char **argv)
Definition: dump-cbk.cxx:26
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
ANA_MSG_SOURCE
#define ANA_MSG_SOURCE(NAME, TITLE)
the source code part of ANA_MSG_SOURCE
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:133
POOL::TEvent
Definition: PhysicsAnalysis/POOLRootAccess/POOLRootAccess/TEvent.h:39
TEvent.h
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
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
AsgMetadataTool.h
StandaloneToolHandle.h
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