ATLAS Offline Software
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).
6 #include "ROOTHeaderLoaderSvc.h"
7 
8 // ROOT include(s).
9 #include <TInterpreter.h>
10 #include <TString.h>
11 #include <TROOT.h>
12 
13 namespace 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 
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
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
xAODMaker::ROOTHeaderLoaderSvc::loadHeader
virtual StatusCode loadHeader(const std::string &headerName) const override
(Force-)Load one particular header
Definition: ROOTHeaderLoaderSvc.cxx:28
xAODMaker::ROOTHeaderLoaderSvc::initialize
virtual StatusCode initialize() override
Function initialising the service.
Definition: ROOTHeaderLoaderSvc.cxx:15
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
xAODMaker
Definition: StoreGateSvc.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAODMaker::ROOTHeaderLoaderSvc::m_headerNames
Gaudi::Property< std::vector< std::string > > m_headerNames
Names of the headers to auto-load during initialisation.
Definition: ROOTHeaderLoaderSvc.h:51
ROOTHeaderLoaderSvc.h