21 #define PERSISTENCYSVC_HISTOGRAMPERSISTENCYSVC_CPP
42 #define class class GAUDI_API
43 #include "AIDA/IBaseHistogram.h"
56 if ( !(m_convert.empty() && m_exclude.empty()) )
58 log <<
MSG::INFO <<
"Histograms Converted/Excluded: "
59 << m_converted.size() <<
"/" << m_excluded.size() <<
endmsg ;
62 if ( !m_excluded.empty() )
64 log <<
MSG::DEBUG <<
"Excluded Histos : #" << m_excluded.size() ;
65 for ( Set::const_iterator
item = m_excluded.begin() ;
67 { log << std::endl <<
" '" << (*item) <<
"'" ; }
71 if ( !m_converted.empty() )
73 log <<
MSG::DEBUG <<
"Converted Histos : #" << m_converted.size() ;
74 for ( Set::const_iterator
item = m_converted.begin() ;
76 { log << std::endl <<
" '" << (*item) <<
"'" ; }
101 log <<
MSG::FATAL <<
"IProperty interface not found in ApplicationMgr." <<
endmsg;
105 setProperty(prpMgr->getProperty(
"HistogramPersistency")).ignore();
115 joptsvc->addPropertyToCatalogue(
"RootHistSvc", p).ignore();
117 joptsvc->addPropertyToCatalogue(
"HbookHistSvc", p).ignore();
161 const std::string s_NULL =
"<NULL>" ;
170 (
const std::string& name ,
171 const std::string& pat )
174 return std::string::npos != name.find ( pat );
181 inline const std::string& oname (
const DataObject* obj )
183 if ( 0 == obj ) {
return s_NULL ; }
185 return ( 0 == reg ) ? obj -> name () : reg -> identifier () ;
194 const std::string& pat )
196 if ( 0 == obj ) {
return false ; }
197 return match ( oname ( obj ) , pat ) ;
211 if (
"NONE" == m_histPersName )
217 if ( 0 != dynamic_cast<AIDA::IBaseHistogram*> ( pObj ) )
221 if ( m_convert.empty() ) { select = true ; }
224 for ( Strings::const_iterator
item = m_convert.begin() ;
226 {
if ( match ( pObj , *
item ) ) { select = true ; break ; } }
229 for ( Strings::const_iterator
item = m_exclude.begin() ;
231 {
if ( match ( pObj , *
item ) ) { select = false ; break ; } }
235 const std::string&
path = oname ( pObj ) ;
237 if ( !select ) { m_excluded.insert ( path ) ; }
238 else { m_converted.insert ( path ) ; }
247 (
const std::string& name ,
257 std::vector<std::string> defServices;
258 defServices.push_back(
"RootHistSvc");
259 m_svcNames.set(defServices);
260 declareProperty (
"HistogramPersistency", m_histPersName =
"");
261 declareProperty (
"OutputFile", m_outputFile =
"");
264 (
"ConvertHistos" , m_convert ,
265 "The list of patterns to be accepted for conversion" ) ;
268 (
"ExcludeHistos" , m_exclude ,
269 "The list of patterns to be excluded for conversion" ) ;
270 declareProperty(
"Warnings",m_warnings=
true,
271 "Set this property to false to suppress warning messages");
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Implementation of IConverter: Convert the transient object to the requested representation.
Definition of the MsgStream class used to transmit messages.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual StatusCode setProperty(const Property &p)
Set the property by property.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
virtual StatusCode initialize()
Initialize the service.
virtual StatusCode setConversionSvc(IConversionSvc *svc)
Set conversion service the converter is connected to.
virtual StatusCode reinitialize()
Reinitialize the service.
virtual StatusCode initialize()
Initialize 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.
virtual StatusCode finalize()
stop the service.
bool enable(bool value)
Set enabled flag.
virtual SmartIF< IConversionSvc > & conversionSvc() const
Get conversion service the converter is connected to.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Implementation of IConverter: Convert the transient object to the requested representation.
bool isValid() const
Allow for check if smart pointer is valid.
This class is used for returning status codes from appropriate routines.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
PersistencySvc class implementation definition.
HistogramPersistencySvc class implementation definition.
HistogramPersistencySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
virtual const std::string & name() const
Retrieve name of the service.
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
virtual ~HistogramPersistencySvc()
Standard Destructor.
Opaque address interface definition.
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.
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
std::string m_histPersName
Name of the Hist Pers type.