ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
xAODMaker::ROOTHeaderLoaderSvc Class Reference

Service implementing xAODMaker::IROOTHeaderLoaderSvc. More...

#include <ROOTHeaderLoaderSvc.h>

Inheritance diagram for xAODMaker::ROOTHeaderLoaderSvc:
Collaboration diagram for xAODMaker::ROOTHeaderLoaderSvc:

Public Member Functions

virtual StatusCode initialize () override
 Function initialising the service. More...
 
Implementation of the @c xAODMaker::IEventFormatSvc interface
virtual StatusCode loadHeader (const std::string &headerName) const override
 (Force-)Load one particular header More...
 

Private Attributes

Gaudi::Property< std::vector< std::string > > m_headerNames
 Names of the headers to auto-load during initialisation. More...
 

Detailed Description

Service implementing xAODMaker::IROOTHeaderLoaderSvc.

The service simply relies on TROOT::ProcessLine(...) to execute '#include "headerName.h"' commands. Forcing ROOT to interpret those headers during the job's initialisation. Allowing us to work around ATR-21753 / ROOT-10940.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 30 of file ROOTHeaderLoaderSvc.h.

Member Function Documentation

◆ initialize()

StatusCode xAODMaker::ROOTHeaderLoaderSvc::initialize ( )
overridevirtual

Function initialising the service.

Definition at line 15 of file ROOTHeaderLoaderSvc.cxx.

15  {
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  }

◆ loadHeader()

StatusCode xAODMaker::ROOTHeaderLoaderSvc::loadHeader ( const std::string &  headerName) const
overridevirtual

(Force-)Load one particular header

Definition at line 28 of file ROOTHeaderLoaderSvc.cxx.

28  {
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  }

Member Data Documentation

◆ m_headerNames

Gaudi::Property< std::vector< std::string > > xAODMaker::ROOTHeaderLoaderSvc::m_headerNames
private
Initial value:
{ this,
"HeaderNames", {},
"Names of the headers to auto-load during initialisation" }

Names of the headers to auto-load during initialisation.

Definition at line 51 of file ROOTHeaderLoaderSvc.h.


The documentation for this class was generated from the following files:
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
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
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