20 #define PERSISTENCYSVC_HISTOGRAMPERSISTENCYSVC_CPP
42 #pragma clang diagnostic push
43 #pragma clang diagnostic ignored "-Wkeyword-macro"
45 #define class class GAUDI_API
47 #pragma clang diagnostic pop
49 #include "AIDA/IBaseHistogram.h"
61 if ( !(m_convert.empty() && m_exclude.empty()) )
63 info() <<
"Histograms Converted/Excluded: "
64 << m_converted.size() <<
"/" << m_excluded.size() <<
endmsg ;
67 if ( !m_excluded.empty() )
70 log <<
"Excluded Histos : #" << m_excluded.size() ;
71 for (
const auto&
item : m_excluded )
76 if ( !m_converted.empty() )
79 log <<
"Converted Histos : #" << m_converted.size() ;
80 for (
const auto&
item : m_converted )
102 fatal() <<
"IProperty interface not found in ApplicationMgr." <<
endmsg;
106 setProperty(prpMgr->getProperty(
"HistogramPersistency")).ignore();
116 joptsvc->addPropertyToCatalogue(
"RootHistSvc", p).ignore();
118 joptsvc->addPropertyToCatalogue(
"HbookHistSvc", p).ignore();
175 return std::string::npos != name.
find ( pat );
184 if ( !obj ) {
return s_NULL ; }
186 return reg ? reg -> identifier() : obj -> name () ;
197 return obj && match ( oname ( obj ) , pat ) ;
211 if (
"NONE" == m_histPersName )
217 if ( dynamic_cast<AIDA::IBaseHistogram*> ( pObj ) )
220 auto match_pObj = [&](
const std::string&
s) {
return match( pObj ,
s ); };
222 bool select = ( m_convert.empty()
223 ||
std::any_of( m_convert.begin(), m_convert.end(), match_pObj )
224 ) &&
std::none_of( m_exclude.begin(), m_exclude.end(), match_pObj );
228 const auto&
path = oname ( pObj ) ;
230 if ( !select ) { m_excluded.insert (
path ) ; }
231 else { m_converted.insert (
path ) ; }
246 m_svcNames.set(defServices);
247 declareProperty (
"HistogramPersistency", m_histPersName =
"");
248 declareProperty (
"OutputFile", m_outputFile =
"");
251 (
"ConvertHistos" , m_convert ,
252 "The list of patterns to be accepted for conversion" ) ;
255 (
"ExcludeHistos" , m_exclude ,
256 "The list of patterns to be excluded for conversion" ) ;
257 declareProperty(
"Warnings",m_warnings=
true,
258 "Set this property to false to suppress warning messages");
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
StatusCode initialize() override
Initialize the service.
bool isSuccess() const
Test for a status code of SUCCESS.
StatusCode setProperty(const Property &p) override
StatusCode setConversionSvc(IConversionSvc *svc) override
Set conversion service the converter is connected to.
StatusCode reinitialize() override
Reinitialize the service.
IRegistry * registry() const
Get pointer to Registry.
#define DECLARE_COMPONENT(type)
bool m_warnings
Flag to disable warning messages when using external input.
bool enable(bool value)
Set enabled flag.
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Main interface for the JobOptions service.
StatusCode initialize() override
Initialize the service.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
This class is used for returning status codes from appropriate routines.
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
StatusCode finalize() override
stop the service.
PersistencySvc class implementation definition.
HistogramPersistencySvc class implementation definition.
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
HistogramPersistencySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Opaque address interface definition.
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
The IProperty is the basic interface for all components which have properties that can be set or get...
A DataObject is the base class of any identifiable object on any data store.
std::string m_outputFile
Name of the outputFile.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
std::string m_histPersName
Name of the Hist Pers type.