ATLAS Offline Software
Loading...
Searching...
No Matches
ROOTHeaderLoaderSvc.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// Local include(s).
7
8// ROOT include(s).
9#include <TInterpreter.h>
10#include <TString.h>
11#include <TROOT.h>
12
13namespace xAODMaker {
14
16
17 // Load all the configured headers.
18 for( const std::string& headerName : m_headerNames.value() ) {
19 ATH_MSG_INFO( "Loading header \"" << headerName << "\"" );
20 ATH_CHECK( loadHeader( headerName ) );
21 }
22
23 // Return gracefully.
24 return StatusCode::SUCCESS;
25 }
26
27 StatusCode
28 ROOTHeaderLoaderSvc::loadHeader( const std::string& headerName ) const {
29
30 // Load the requested header.
31 Int_t errorCode = 0;
32 gROOT->ProcessLine( TString::Format( "#include \"%s\"",
33 headerName.c_str() ),
34 &errorCode );
35
36 // Check if the call succeeded.
37 if( errorCode != TInterpreter::kNoError ) {
38 ATH_MSG_FATAL( "Failed to load header \"" << headerName << "\"" );
39 return StatusCode::FAILURE;
40 }
41
42 // Return gracefully.
43 return StatusCode::SUCCESS;
44 }
45
46} // namespace xAODMaker
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
virtual StatusCode initialize() override
Function initialising the service.
virtual StatusCode loadHeader(const std::string &headerName) const override
(Force-)Load one particular header
Gaudi::Property< std::vector< std::string > > m_headerNames
Names of the headers to auto-load during initialisation.