ATLAS Offline Software
Loading...
Searching...
No Matches
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
9#else
11#endif
13
14// ASG
18
21
22// ROOT dependencies
23#include <TFile.h>
24
25// Main routine... here we go!
26int main(int argc, char **argv)
27{
28 // Make sure things know we are not in StatusCode land
29 using namespace CutFlow;
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}
macros for messaging and checking status codes
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
#define ANA_MSG_HEADER(NAME)
for standalone code this creates a new message category
#define ANA_MSG_SOURCE(NAME, TITLE)
the source code part of ANA_MSG_SOURCE
#define ANA_CHECK_SET_TYPE(TYPE)
set the type for ANA_CHECK to report failures
an "initializing" ToolHandle for stand-alone applications
Tool for accessing xAOD files outside of Athena.
@ kClassAccess
Access auxiliary data using the aux containers.
static void enableDataSubmission(::Bool_t value)
Function for turning data submission on/off.
int main()
Definition hello.cxx:18
IAppMgrUI * Init(const char *options="POOLRootAccess/basic.opts")
Bootstraps (creates and configures) the Gaudi Application with the provided options file.
StatusCode Init(const char *appname)
Function initialising ROOT/PyROOT for using the ATLAS EDM.
Definition Init.cxx:31
TFile * file