ATLAS Offline Software
Loading...
Searching...
No Matches
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.
Implementation of the @c xAODMaker::IEventFormatSvc interface
virtual StatusCode loadHeader (const std::string &headerName) const override
 (Force-)Load one particular header

Private Attributes

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

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 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
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.

◆ 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 }
#define ATH_MSG_FATAL(x)

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.

51 { this,
52 "HeaderNames", {},
53 "Names of the headers to auto-load during initialisation" };

The documentation for this class was generated from the following files: