|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
HistogramPersistencySvc class implementation definition. More...
#include <HistogramPersistencySvc.h>


Public Types | |
| typedef std::vector< std::string > | Strings |
| the actual type for the vector of strings | |
| typedef std::set< std::string > | Set |
| for report: unconverted histograms | |
Public Member Functions | |
PersistencySvc overrides | |
| virtual StatusCode | initialize () |
| Initialize the service. | |
| virtual StatusCode | reinitialize () |
| Reinitialize the service. | |
| virtual StatusCode | finalize () |
| Finalize the service. | |
| virtual StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) |
| Implementation of IConverter: Convert the transient object to the requested representation. | |
: Object implementation | |
| HistogramPersistencySvc (const std::string &name, ISvcLocator *svc) | |
| Standard Constructor. | |
| virtual | ~HistogramPersistencySvc () |
| Standard Destructor. | |
Protected Attributes | |
| std::string | m_histPersName |
| Name of the Hist Pers type. | |
| std::string | m_outputFile |
| Name of the outputFile. | |
| Strings | m_convert |
| the list of patterns to be converted | |
| Strings | m_exclude |
| the list of patterns to be excludes | |
| Set | m_converted |
| for the final report: the list of converted histograms | |
| Set | m_excluded |
| for the final report: the list of excluded histograms | |
| bool | m_warnings |
| Flag to disable warning messages when using external input. | |
Friends | |
| class | SvcFactory< HistogramPersistencySvc > |
| class | Factory< HistogramPersistencySvc, IService *(std::string, ISvcLocator *)> |
HistogramPersistencySvc class implementation definition.
System: The LHCb Offline System
Package: HistogramPersistencySvc
Dependencies:
History:
+---------+----------------------------------------------+---------+ | Date | Comment | Who | +---------+----------------------------------------------+---------+ | 3/11/98 | Initial version | M.Frank | +---------+----------------------------------------------+---------+
Definition at line 48 of file HistogramPersistencySvc.h.
for report: unconverted histograms
Definition at line 79 of file HistogramPersistencySvc.h.
the actual type for the vector of strings
Definition at line 77 of file HistogramPersistencySvc.h.
| HistogramPersistencySvc::HistogramPersistencySvc | ( | const std::string & | name, |
| ISvcLocator * | svc | ||
| ) |
Standard Constructor.
Definition at line 249 of file HistogramPersistencySvc.cpp.
: PersistencySvc(name, svc) // , m_convert () , m_exclude () , m_converted () , m_excluded () // { std::vector<std::string> defServices; defServices.push_back("HbookHistSvc"); defServices.push_back("RootHistSvc"); m_svcNames.set(defServices); declareProperty ("HistogramPersistency", m_histPersName = ""); declareProperty ("OutputFile", m_outputFile = ""); // declareProperty ("ConvertHistos" , m_convert , "The list of patterns to be accepted for conversion" ) ; // declareProperty ("ExcludeHistos" , m_exclude , "The list of patterns to be excluded for conversion" ) ; declareProperty("Warnings",m_warnings=true, "Set this property to false to suppress warning messages"); }
| HistogramPersistencySvc::~HistogramPersistencySvc | ( | ) | [virtual] |
| StatusCode HistogramPersistencySvc::createRep | ( | DataObject * | pObject, |
| IOpaqueAddress *& | refpAddress | ||
| ) | [virtual] |
Implementation of IConverter: Convert the transient object to the requested representation.
Reimplemented from PersistencySvc.
Definition at line 207 of file HistogramPersistencySvc.cpp.
{
// enable the conversion
enable ( true ) ;
// conversion is possible ?
if ( "NONE" == m_histPersName )
{
enable ( false ) ;
return PersistencySvc::createRep ( pObj , refpAddr ) ; // RETURN
}
// histogram ?
if ( 0 != dynamic_cast<AIDA::IBaseHistogram*> ( pObj ) )
{
bool select = false ;
// Empty ConvertHistos property means convert all
if ( m_convert.empty() ) { select = true ; }
else
{
for ( Strings::const_iterator item = m_convert.begin() ;
m_convert.end() != item ; ++item )
{ if ( match ( pObj , *item ) ) { select = true ; break ; } }
}
// exclude ?
for ( Strings::const_iterator item = m_exclude.begin() ;
m_exclude.end() != item && select ; ++item )
{ if ( match ( pObj , *item ) ) { select = false ; break ; } }
//
enable ( select ) ;
//
const std::string& path = oname ( pObj ) ;
//
if ( !select ) { m_excluded.insert ( path ) ; }
else { m_converted.insert ( path ) ; }
}
//
return PersistencySvc::createRep ( pObj , refpAddr ) ; // RETURN
}
| StatusCode HistogramPersistencySvc::finalize | ( | void | ) | [virtual] |
Finalize the service.
Reimplemented from PersistencySvc.
Definition at line 53 of file HistogramPersistencySvc.cpp.
{
//
MsgStream log ( msgSvc() , name() );
if ( !(m_convert.empty() && m_exclude.empty()) )
{ // print message if any of the two properties is used
log << MSG::INFO << "Histograms Converted/Excluded: "
<< m_converted.size() << "/" << m_excluded.size() << endmsg ;
}
//
if ( !m_excluded.empty() )
{
log << MSG::DEBUG << "Excluded Histos : #" << m_excluded.size() ;
for ( Set::const_iterator item = m_excluded.begin() ;
m_excluded.end() != item ; ++item )
{ log << std::endl << " '" << (*item) << "'" ; }
log << endmsg ;
}
//
if ( !m_converted.empty() )
{
log << MSG::DEBUG << "Converted Histos : #" << m_converted.size() ;
for ( Set::const_iterator item = m_converted.begin() ;
m_converted.end() != item ; ++item )
{ log << std::endl << " '" << (*item) << "'" ; }
log << endmsg ;
}
//
StatusCode status = PersistencySvc::finalize();
return status;
}
| StatusCode HistogramPersistencySvc::initialize | ( | ) | [virtual] |
Initialize the service.
Reimplemented from PersistencySvc.
Definition at line 87 of file HistogramPersistencySvc.cpp.
{
StatusCode status = PersistencySvc::initialize();
if ( status.isSuccess() ) {
status = reinitialize();
}
return status;
}
| StatusCode HistogramPersistencySvc::reinitialize | ( | ) | [virtual] |
Reinitialize the service.
Reimplemented from Service.
Definition at line 97 of file HistogramPersistencySvc.cpp.
{
MsgStream log(msgSvc(), name());
// Obtain the IProperty of the ApplicationMgr
SmartIF<IProperty> prpMgr(serviceLocator());
if ( !prpMgr.isValid() ) {
log << MSG::FATAL << "IProperty interface not found in ApplicationMgr." << endmsg;
return StatusCode::FAILURE;
}
else {
setProperty(prpMgr->getProperty("HistogramPersistency")).ignore();
}
// To keep backward compatibility, we set the property of conversion service
// into JobOptions catalogue
if( m_outputFile != "" ) {
SmartIF<IJobOptionsSvc> joptsvc(serviceLocator()->service("JobOptionsSvc"));
if( joptsvc.isValid() ) {
StringProperty p("OutputFile", m_outputFile);
if ( m_histPersName == "ROOT" ) {
joptsvc->addPropertyToCatalogue("RootHistSvc", p).ignore();
} else if (m_histPersName == "HBOOK" ) {
joptsvc->addPropertyToCatalogue("HbookHistSvc", p).ignore();
}
}
}
// Load the Histogram persistency service that's required as default
setConversionSvc(0).ignore();
if ( m_histPersName == "ROOT" ) {
setConversionSvc(service("RootHistSvc")).ignore();
if ( !conversionSvc() ) {
return StatusCode::FAILURE;
}
enable(true);
}
else if ( m_histPersName == "HBOOK" ) {
setConversionSvc(service("HbookHistSvc")).ignore();
if ( !conversionSvc() ) {
return StatusCode::FAILURE;
}
enable(true);
}
else if ( m_histPersName == "NONE" ) {
enable(false);
if ( m_warnings ) {
log << MSG::WARNING << "Histograms saving not required." << endmsg;
}
}
else {
setConversionSvc(service(m_histPersName)).ignore();
if ( !conversionSvc() ) {
return StatusCode::FAILURE;
}
enable(true);
if ( m_warnings ) {
log << MSG::WARNING << "Unknown Histogram Persistency Mechanism " << m_histPersName << endmsg;
}
}
return StatusCode::SUCCESS;
}
friend class Factory< HistogramPersistencySvc, IService *(std::string, ISvcLocator *)> [friend] |
Definition at line 52 of file HistogramPersistencySvc.h.
friend class SvcFactory< HistogramPersistencySvc > [friend] |
Definition at line 51 of file HistogramPersistencySvc.h.
Strings HistogramPersistencySvc::m_convert [protected] |
the list of patterns to be converted
Definition at line 87 of file HistogramPersistencySvc.h.
Set HistogramPersistencySvc::m_converted [protected] |
for the final report: the list of converted histograms
Definition at line 91 of file HistogramPersistencySvc.h.
Strings HistogramPersistencySvc::m_exclude [protected] |
the list of patterns to be excludes
Definition at line 89 of file HistogramPersistencySvc.h.
Set HistogramPersistencySvc::m_excluded [protected] |
for the final report: the list of excluded histograms
Definition at line 93 of file HistogramPersistencySvc.h.
std::string HistogramPersistencySvc::m_histPersName [protected] |
Name of the Hist Pers type.
Definition at line 83 of file HistogramPersistencySvc.h.
std::string HistogramPersistencySvc::m_outputFile [protected] |
Name of the outputFile.
Definition at line 85 of file HistogramPersistencySvc.h.
bool HistogramPersistencySvc::m_warnings [protected] |
Flag to disable warning messages when using external input.
Definition at line 95 of file HistogramPersistencySvc.h.