21 #define PERSISTENCYSVC_HISTOGRAMPERSISTENCYSVC_CPP
27 #include "GaudiKernel/SmartIF.h"
28 #include "GaudiKernel/MsgStream.h"
29 #include "GaudiKernel/ISvcLocator.h"
30 #include "GaudiKernel/IJobOptionsSvc.h"
31 #include "GaudiKernel/DataObject.h"
32 #include "GaudiKernel/IRegistry.h"
33 #include "GaudiKernel/IDataProviderSvc.h"
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");