The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
Gaudi::RootConnectionSetup Class Referencefinal

#include </builds/gaudi/Gaudi/RootCnv/include/RootCnv/RootDataConnection.h>

Collaboration diagram for Gaudi::RootConnectionSetup:

Public Types

typedef std::vector< std::string > StringVec
 Type definition for string maps.
 

Public Member Functions

 RootConnectionSetup ()=default
 Standard constructor.
 
void setMessageSvc (MsgStream *m)
 Set message service reference.
 
MsgStreammsgSvc () const
 Retrieve message service.
 
void setIncidentSvc (IIncidentSvc *m)
 Set incident service reference.
 
IIncidentSvcincidentSvc () const
 Retrieve incident service.
 

Static Public Member Functions

static StatusCode setCompression (std::string_view compression)
 Set the global compression level.
 
static int compression ()
 Access to global compression level.
 

Public Attributes

StringVec cacheBranches
 Vector of strings with branches to be cached for input files.
 
StringVec vetoBranches
 Vector of strings with branches to NOT be cached for input files.
 
std::string loadSection
 RootCnvSvc Property: Root data cache size.
 
int cacheSize { 0 }
 RootCnvSvc Property: Root data cache size.
 
int learnEntries { 0 }
 RootCnvSvc Property: ROOT cache learn entries.
 
Gaudi::Property< bool > produceReproducibleFiles
 
Gaudi::Property< bool > root630ForwardCompatibility
 

Private Attributes

std::unique_ptr< MsgStreamm_msgSvc
 Reference to message service.
 
SmartIF< IIncidentSvcm_incidentSvc = nullptr
 Reference to incident service.
 

Detailed Description

Definition at line 54 of file RootDataConnection.h.

Member Typedef Documentation

◆ StringVec

typedef std::vector<std::string> Gaudi::RootConnectionSetup::StringVec

Type definition for string maps.

Definition at line 63 of file RootDataConnection.h.

Constructor & Destructor Documentation

◆ RootConnectionSetup()

Gaudi::RootConnectionSetup::RootConnectionSetup ( )
default

Standard constructor.

Member Function Documentation

◆ compression()

int RootConnectionSetup::compression ( )
static

Access to global compression level.

Global compression level.

Definition at line 166 of file RootDataConnection.cpp.

166{ return s_compressionLevel; }

◆ incidentSvc()

IIncidentSvc * Gaudi::RootConnectionSetup::incidentSvc ( ) const
inline

Retrieve incident service.

Definition at line 101 of file RootDataConnection.h.

101{ return m_incidentSvc.get(); }
SmartIF< IIncidentSvc > m_incidentSvc
Reference to incident service.

◆ msgSvc()

MsgStream & Gaudi::RootConnectionSetup::msgSvc ( ) const
inline

Retrieve message service.

Definition at line 96 of file RootDataConnection.h.

96{ return *m_msgSvc; }
std::unique_ptr< MsgStream > m_msgSvc
Reference to message service.

◆ setCompression()

StatusCode RootConnectionSetup::setCompression ( std::string_view compression)
static

Set the global compression level.

Definition at line 126 of file RootDataConnection.cpp.

126 {
127#if ROOT_VERSION_CODE >= ROOT_VERSION( 5, 33, 0 )
128 int res = 0, level = ROOT::CompressionSettings( ROOT::RCompressionSetting::EAlgorithm::kLZMA, 6 );
129 auto idx = compression.find( ':' );
130 if ( idx != string::npos ) {
131 auto alg = compression.substr( 0, idx );
132 ROOT::RCompressionSetting::EAlgorithm::EValues alg_code = ROOT::RCompressionSetting::EAlgorithm::kUseGlobal;
133 if ( alg.size() == 4 && strncasecmp( alg.data(), "ZLIB", 4 ) == 0 )
134 alg_code = ROOT::RCompressionSetting::EAlgorithm::kZLIB;
135 else if ( alg.size() == 4 && strncasecmp( alg.data(), "LZMA", 4 ) == 0 )
136 alg_code = ROOT::RCompressionSetting::EAlgorithm::kLZMA;
137 else if ( alg.size() == 3 && strncasecmp( alg.data(), "LZ4", 3 ) == 0 )
138 alg_code = ROOT::RCompressionSetting::EAlgorithm::kLZ4;
139# if ROOT_VERSION_CODE >= ROOT_VERSION( 6, 20, 0 )
140 else if ( alg.size() == 4 && strncasecmp( alg.data(), "ZSTD", 4 ) == 0 )
141 alg_code = ROOT::RCompressionSetting::EAlgorithm::kZSTD;
142# endif
143 else
144 throw runtime_error( "ERROR: request to set unknown ROOT compression algorithm:" + std::string{ alg } );
145 res = ::sscanf( std::string{ compression.substr( idx + 1 ) }.c_str(), "%d",
146 &level ); // TODO: use C++17 std::from_chars instead...
147 if ( res == 1 ) {
148 s_compressionLevel = ROOT::CompressionSettings( alg_code, level );
149 return StatusCode::SUCCESS;
150 }
151 throw runtime_error( "ERROR: request to set unknown ROOT compression level:" +
152 std::string{ compression.substr( idx + 1 ) } );
153 } else if ( 1 == ::sscanf( std::string{ compression }.c_str(), "%d", &level ) ) { // TODO: use C++17 std::from_chars
154 // instead
155 s_compressionLevel = level;
156 return StatusCode::SUCCESS;
157 }
158 throw runtime_error( "ERROR: request to set unknown ROOT compression mechanism:" + std::string{ compression } );
159#else
160 if ( !compression.empty() ) {}
161 return StatusCode::SUCCESS;
162#endif
163}
static int compression()
Access to global compression level.
constexpr static const auto SUCCESS
Definition StatusCode.h:99

◆ setIncidentSvc()

void RootConnectionSetup::setIncidentSvc ( IIncidentSvc * m)

Set incident service reference.

Definition at line 172 of file RootDataConnection.cpp.

172{ m_incidentSvc.reset( s ); }

◆ setMessageSvc()

void RootConnectionSetup::setMessageSvc ( MsgStream * m)

Set message service reference.

Definition at line 169 of file RootDataConnection.cpp.

169{ m_msgSvc.reset( m ); }

Member Data Documentation

◆ cacheBranches

StringVec Gaudi::RootConnectionSetup::cacheBranches

Vector of strings with branches to be cached for input files.

Definition at line 66 of file RootDataConnection.h.

◆ cacheSize

int Gaudi::RootConnectionSetup::cacheSize { 0 }

RootCnvSvc Property: Root data cache size.

Definition at line 72 of file RootDataConnection.h.

72{ 0 };

◆ learnEntries

int Gaudi::RootConnectionSetup::learnEntries { 0 }

RootCnvSvc Property: ROOT cache learn entries.

Definition at line 74 of file RootDataConnection.h.

74{ 0 };

◆ loadSection

std::string Gaudi::RootConnectionSetup::loadSection

RootCnvSvc Property: Root data cache size.

Definition at line 70 of file RootDataConnection.h.

◆ m_incidentSvc

SmartIF<IIncidentSvc> Gaudi::RootConnectionSetup::m_incidentSvc = nullptr
private

Reference to incident service.

Definition at line 59 of file RootDataConnection.h.

◆ m_msgSvc

std::unique_ptr<MsgStream> Gaudi::RootConnectionSetup::m_msgSvc
private

Reference to message service.

Definition at line 57 of file RootDataConnection.h.

◆ produceReproducibleFiles

Gaudi::Property<bool> Gaudi::RootConnectionSetup::produceReproducibleFiles
Initial value:
{ "ProduceReproducibleFiles", true,
"configure output files to be more reproducible" }

Definition at line 76 of file RootDataConnection.h.

76 { "ProduceReproducibleFiles", true,
77 "configure output files to be more reproducible" };

◆ root630ForwardCompatibility

Gaudi::Property<bool> Gaudi::RootConnectionSetup::root630ForwardCompatibility
Initial value:
{
"ROOT630ForwardCompatibility", false,
"When opening a file for CREATE or RECREATE, enable ROOT 6.30 forward compatibility "
"(i.e. write a file that is readable with ROOT 6.24). Requires ROOT >= 6.30.06, see "
"<https://github.com/root-project/root/issues/14793>." }

Definition at line 79 of file RootDataConnection.h.

79 {
80 "ROOT630ForwardCompatibility", false,
81 "When opening a file for CREATE or RECREATE, enable ROOT 6.30 forward compatibility "
82 "(i.e. write a file that is readable with ROOT 6.24). Requires ROOT >= 6.30.06, see "
83 "<https://github.com/root-project/root/issues/14793>." };

◆ vetoBranches

StringVec Gaudi::RootConnectionSetup::vetoBranches

Vector of strings with branches to NOT be cached for input files.

Definition at line 68 of file RootDataConnection.h.


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