All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Gaudi::RootCnvSvc Class Reference

Description: More...

#include <src/RootCnvSvc.h>

Inheritance diagram for Gaudi::RootCnvSvc:
Collaboration diagram for Gaudi::RootCnvSvc:

Public Member Functions

 RootCnvSvc (const std::string &name, ISvcLocator *svc)
 Standard constructor. More...
 
virtual ~RootCnvSvc ()
 Standard destructor. More...
 
virtual StatusCode updateServiceState (IOpaqueAddress *)
 Update state of the service. More...
 
StatusCode error (const std::string &msg)
 Standard way to print errors. More...
 
StatusCode connectDatabase (const std::string &dataset, int mode, RootDataConnection **con)
 Connect the output file to the service with open mode. More...
 
virtual StatusCode initialize ()
 ConversionSvc overload: initialize Db service. More...
 
virtual StatusCode finalize ()
 ConversionSvc overload: Finalize Db service. More...
 
virtual IConvertercreateConverter (long typ, const CLID &wanted, const ICnvFactory *fac)
 ConversionSvc overload: Create new Converter using factory. More...
 
virtual void loadConverter (DataObject *pObj)
 ConversionSvc overload: Load the class (dictionary) for the converter. More...
 
virtual StatusCode connectOutput (const std::string &outputFile, const std::string &openMode)
 Connect the output file to the service with open mode. More...
 
virtual StatusCode connectOutput (const std::string &outputFile)
 Connect the output file to the service. More...
 
virtual StatusCode commitOutput (const std::string &outputFile, bool do_commit)
 Commit pending output. More...
 
virtual StatusCode disconnect (const std::string &dbName)
 Disconnect from an existing data stream. More...
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 IAddressCreator implementation: Address creation. More...
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress)
 IAddressCreator implementation: Creates an address in string form to object form. More...
 
virtual StatusCode createNullRep (const std::string &path)
 Insert null marker for not existent transient object. More...
 
virtual StatusCode createNullRef (const std::string &path)
 Insert null marker for not existent transient object. More...
 
virtual StatusCode i__createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
 Convert the transient object to the requested persistent representation. More...
 
virtual StatusCode i__fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Resolve the references of the converted object. More...
 
virtual StatusCode i__createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Create transient object from persistent data. More...
 
virtual StatusCode i__fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Resolve the references of the created transient object. More...
 
- Public Member Functions inherited from ConversionSvc
virtual long repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
const CLIDobjType () const
 Implementation of IConverter: dummy call. More...
 
virtual StatusCode setDataProvider (IDataProviderSvc *pService)
 Implementation of IConverter: Set Data provider service. More...
 
virtual SmartIF
< IDataProviderSvc > & 
dataProvider () const
 Implementation of IConverter: Get Data provider service. More...
 
virtual StatusCode setConversionSvc (IConversionSvc *svc)
 Implementation of IConverter: Set conversion service the converter is connected to. More...
 
virtual SmartIF< IConversionSvc > & conversionSvc () const
 Implementation of IConverter: Get conversion service the converter is connected to. More...
 
virtual StatusCode setAddressCreator (IAddressCreator *creator)
 Set address creator facility. More...
 
virtual SmartIF
< IAddressCreator > & 
addressCreator () const
 Retrieve address creator facility. More...
 
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Implementation of IConverter: Create the transient representation of an object. More...
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Resolve the references of the created transient object. More...
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
 Implementation of IConverter: Update the transient object from the other representation. More...
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Update the references of an updated transient object. More...
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Implementation of IConverter: Convert the transient object to the requested representation. More...
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Resolve the references of the converted object. More...
 
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Update the converted representation of a transient object. More...
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Update the references of an already converted object. More...
 
virtual StatusCode addConverter (const CLID &clid)
 Add converter object to conversion service. More...
 
virtual StatusCode addConverter (IConverter *pConverter)
 Add converter object to conversion service. More...
 
virtual StatusCode removeConverter (const CLID &clid)
 Remove converter object from conversion service (if present). More...
 
virtual IConverterconverter (const CLID &wanted)
 Retrieve converter from list. More...
 
virtual StatusCode convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress)
 Convert an address to string form. More...
 
 ConversionSvc (const std::string &name, ISvcLocator *svc, long type)
 Standard Constructor. More...
 
- Public Member Functions inherited from extends2< Service, IConversionSvc, IAddressCreator >
 extends2 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends2 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends2 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends2 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
 CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
 Templated constructor with 3 arguments. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces2< IConversionSvc, IAddressCreator >
virtual ~extend_interfaces2 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IConversionSvc
 DeclareInterfaceID (IConversionSvc, 4, 0)
 InterfaceID. More...
 
virtual ~IConversionSvc ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IConverter
 DeclareInterfaceID (IConverter, 3, 0)
 InterfaceID. More...
 
virtual ~IConverter ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IAddressCreator
 DeclareInterfaceID (IAddressCreator, 3, 0)
 InterfaceID. More...
 

Protected Member Functions

TClass * getClass (DataObject *pObject)
 Helper: Get TClass for a given DataObject pointer. More...
 
MsgStreamlog () const
 Helper: Use message streamer. More...
 
- Protected Member Functions inherited from ConversionSvc
virtual ~ConversionSvc ()
 Standard Destructor. More...
 
virtual StatusCode configureConverter (long typ, const CLID &clid, IConverter *cnv)
 Configure the new converter before initialize is called. More...
 
virtual StatusCode initializeConverter (long typ, const CLID &clid, IConverter *cnv)
 Initialize the new converter. More...
 
virtual StatusCode activateConverter (long typ, const CLID &clid, IConverter *cnv)
 Activate the new converter after initialization. More...
 
virtual SmartIF
< IAddressCreator > & 
addressCreator ()
 Retrieve address creation interface. More...
 
StatusCode makeCall (int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress *&pAddress, DataObject *&pObject)
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

Gaudi::IIODataManagerm_ioMgr
 Reference to the I/O data manager. More...
 
IIncidentSvcm_incidentSvc
 Reference to incident service. More...
 
Gaudi::RootDataConnectionm_current
 On writing: reference to active output stream. More...
 
TClass * m_classRefs
 TClass pointer to reference class. More...
 
TClass * m_classDO
 TClass pointer to DataObject class. More...
 
RootConnectionSetupm_setup
 Setup structure (ref-counted) and passed to data connections. More...
 
std::string m_currSection
 Property: ROOT section name. More...
 
bool m_incidentEnabled
 Property: Flag to enable incidents on FILE_OPEN. More...
 
std::string m_shareFiles
 Property: Share files ? If set to YES, files will not be closed on finalize. More...
 
std::string m_recordName
 Property: Records name to fire incident for file records. More...
 
std::string m_ioPerfStats
 Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name. More...
 
std::string m_compression
 Property: Compression-algorithm:compression-level. More...
 
int m_autoFlush
 Property: AutoFlush parameter for ROOT TTree (Number of events between auto flushes) More...
 
int m_basketSize
 Property: Basket optimization parameter for ROOT TTree (total basket size) More...
 
int m_bufferSize
 Property: Buffer size optimization parameter for ROOT TTree. More...
 
int m_splitLevel
 Property: Split level optimization parameter for ROOT TTree. More...
 
std::set< std::string > m_badFiles
 Set with bad files/tables. More...
 
MsgStreamm_log
 Message streamer. More...
 
- Protected Attributes inherited from ConversionSvc
SmartIF< IDataProviderSvcm_dataSvc
 Pointer to data provider service. More...
 
SmartIF< IAddressCreatorm_addressCreator
 Pointer to the address creation service interface. More...
 
SmartIF< IConversionSvcm_cnvSvc
 Pointer to the IConversionSvc interface of this. More...
 
long m_type
 Conversion service type. More...
 
Workersm_workers
 List of conversion workers. More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

Additional Inherited Members

- Public Types inherited from ConversionSvc
typedef std::vector< WorkerEntryWorkers
 
- Public Types inherited from extends2< Service, IConversionSvc, IAddressCreator >
typedef extends2 base_class
 Typedef to this class. More...
 
typedef extend_interfaces2
< IConversionSvc,
IAddressCreator
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces2< IConversionSvc, IAddressCreator >
typedef mpl::fold< typename
IConversionSvc::iid::iids::type,
typename
IAddressCreator::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IConversionSvc
enum  Status { CONVERSIONSVC_NO_ERROR = ICONVERSIONSVC_LAST_ERROR+1, NO_CONVERTER }
 Status code definitions. More...
 
- Public Types inherited from IConverter
enum  Status {
  INVALID_ADDRESS = IInterface::LAST_ERROR+1, INVALID_OBJECT, NO_MEMORY, BAD_STORAGE_TYPE,
  NO_SOURCE_OBJECT, ICONVERSIONSVC_LAST_ERROR
}
 Status code. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Description:

RootCnvSvc class implementation definition.

Author
Markus Frank
Version
1.0
Date
20/12/2009

Definition at line 54 of file RootCnvSvc.h.

Constructor & Destructor Documentation

RootCnvSvc::RootCnvSvc ( const std::string &  name,
ISvcLocator svc 
)

Standard constructor.

Definition at line 50 of file RootCnvSvc.cpp.

51 : ConversionSvc( nam, svc, ROOT_StorageType),
52  m_ioMgr(0), m_incidentSvc(0), m_current(0), m_setup(0)
53 {
54  m_classRefs = m_classDO = 0;
56  m_setup->cacheBranches.push_back("*");
57  declareProperty("IOPerfStats", m_ioPerfStats);
58  declareProperty("ShareFiles", m_shareFiles = "NO");
59  declareProperty("EnableIncident", m_incidentEnabled = true);
60  declareProperty("RecordsName", m_recordName = "/FileRecords");
61  declareProperty("LoadSection", m_setup->loadSection = "Event");
62 
63  // ROOT Write parameters
64  declareProperty("AutoFlush", m_autoFlush = 100);
65  declareProperty("BasketSize", m_basketSize = 2*MBYTE);
66  declareProperty("BufferSize", m_bufferSize = 2*kBYTE);
67  declareProperty("SplitLevel", m_splitLevel = 0);
68  declareProperty("GlobalCompression",m_compression); // empty: do nothing
69 
70  // ROOT Read parameters: must be shared for the entire file!
71  declareProperty("CacheSize", m_setup->cacheSize = 10*MBYTE);
72  declareProperty("LearnEntries", m_setup->learnEntries = 10);
73  declareProperty("CacheBranches", m_setup->cacheBranches);
74  declareProperty("VetoBranches", m_setup->vetoBranches);
75 }
Gaudi::IIODataManager * m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:58
int m_basketSize
Property: Basket optimization parameter for ROOT TTree (total basket size)
Definition: RootCnvSvc.h:86
ConversionSvc(const std::string &name, ISvcLocator *svc, long type)
Standard Constructor.
RootConnectionSetup * m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:68
IIncidentSvc * m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:60
int cacheSize
RootCnvSvc Property: Root data cache size.
std::string loadSection
RootCnvSvc Property: Root data cache size.
int m_splitLevel
Property: Split level optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:90
int learnEntries
RootCnvSvc Property: ROOT cache learn entries.
TClass * m_classDO
TClass pointer to DataObject class.
Definition: RootCnvSvc.h:66
StringVec cacheBranches
Vector of strings with branches to be cached for input files.
const long ROOT_StorageType
Definition: ClassID.h:53
StringVec vetoBranches
Vector of strings with branches to NOT be cached for input files.
bool m_incidentEnabled
Property: Flag to enable incidents on FILE_OPEN.
Definition: RootCnvSvc.h:73
#define MBYTE
Definition: RootCnvSvc.cpp:47
std::string m_shareFiles
Property: Share files ? If set to YES, files will not be closed on finalize.
Definition: RootCnvSvc.h:75
std::string m_compression
Property: Compression-algorithm:compression-level.
Definition: RootCnvSvc.h:81
std::string m_recordName
Property: Records name to fire incident for file records.
Definition: RootCnvSvc.h:77
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
std::string m_ioPerfStats
Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.
Definition: RootCnvSvc.h:79
#define kBYTE
Definition: RootCnvSvc.cpp:48
int m_bufferSize
Property: Buffer size optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:88
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition: RootCnvSvc.h:62
int m_autoFlush
Property: AutoFlush parameter for ROOT TTree (Number of events between auto flushes) ...
Definition: RootCnvSvc.h:84
TClass * m_classRefs
TClass pointer to reference class.
Definition: RootCnvSvc.h:64
RootCnvSvc::~RootCnvSvc ( )
virtual

Standard destructor.

Definition at line 78 of file RootCnvSvc.cpp.

78  {
79  if (m_setup) m_setup->release();
80 }
RootConnectionSetup * m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:68
void release()
Decrease reference count.

Member Function Documentation

StatusCode RootCnvSvc::commitOutput ( const std::string &  outputFile,
bool  do_commit 
)
virtual

Commit pending output.

Parameters
outputFileString containig output file
do_commitif true commit the output and flush eventually pending items to the database if false, discard pending buffers. Note: The possibility to commit or rollback depends on the database technology used!
Returns
Status code indicating success or failure.

fill NULL pointers to all branches, which have less entries than the section branch

Reimplemented from ConversionSvc.

Definition at line 331 of file RootCnvSvc.cpp.

331  {
332  if ( m_current ) {
333  size_t len = m_currSection.find('/',1);
334  string section = m_currSection.substr(1,len==string::npos ? string::npos : len-1);
335  TBranch* b = m_current->getBranch(section, m_currSection);
336  if ( b ) {
337  Long64_t evt = b->GetEntries();
338  TTree* t = b->GetTree();
339  TObjArray* a = t->GetListOfBranches();
340  Int_t nb = a->GetEntriesFast();
342  for(Int_t i=0; i<nb; ++i) {
343  TBranch* br_ptr = (TBranch*)a->UncheckedAt(i);
344  Long64_t br_evt = br_ptr->GetEntries();
345  if ( br_evt < evt ) {
346  Long64_t num = evt-br_evt;
347  br_ptr->SetAddress(0);
348  while(num>0) {
349  br_ptr->Fill();
350  --num;
351  }
352  if( log().level() <= MSG::DEBUG ) log() << MSG::DEBUG
353  << "commit: Added " << long(evt-br_evt)
354  << " Section: " << evt << " Branch: " << br_ptr->GetEntries()
355  << " RefNo: " << br_ptr->GetEntries()-1
356  << " NULL entries to:" << br_ptr->GetName() << endmsg;
357  }
358  }
359 
360  b->GetTree()->SetEntries(evt);
361  if ( evt == 1 ) {
362  b->GetTree()->OptimizeBaskets(m_basketSize,1.1,"");
363  }
364  if ( evt > 0 && (evt%m_autoFlush)==0 ) {
365  if ( evt == m_autoFlush ) {
366  b->GetTree()->SetAutoFlush(m_autoFlush);
367  b->GetTree()->OptimizeBaskets(m_basketSize,1.,"");
368  }
369  else {
370  b->GetTree()->FlushBaskets();
371  }
372  }
373  if( log().level() <= MSG::DEBUG )
374  log() << MSG::DEBUG << "Set section entries of " << m_currSection
375  << " to " << long(evt) << " entries." << endmsg;
376  }
377  else {
378  return error("commitOutput> Failed to update entry numbers on "+dsn);
379  }
380  }
381  return S_OK;
382 }
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
std::string m_currSection
Property: ROOT section name.
Definition: RootCnvSvc.h:70
int m_basketSize
Property: Basket optimization parameter for ROOT TTree (total basket size)
Definition: RootCnvSvc.h:86
#define S_OK
Definition: RootCnvSvc.cpp:39
TBranch * getBranch(const std::string &section, const std::string &branch_name)
Access data branch by name: Get existing branch in read only mode.
list i
Definition: ana.py:128
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition: RootCnvSvc.h:62
int m_autoFlush
Property: AutoFlush parameter for ROOT TTree (Number of events between auto flushes) ...
Definition: RootCnvSvc.h:84
StatusCode RootCnvSvc::connectDatabase ( const std::string &  dataset,
int  mode,
RootDataConnection **  con 
)

Connect the output file to the service with open mode.

Parameters
datasetString containig file name
modeString containig opening mode
Returns
Status code indicating success or failure.

Definition at line 224 of file RootCnvSvc.cpp.

224  {
225  try {
226  IDataConnection* c = m_ioMgr->connection(dataset);
227  bool fire_incident = false;
228  *con = 0;
229  if ( !c ) {
230  auto_ptr<RootDataConnection> connection(new RootDataConnection(this,dataset,m_setup));
232  ? m_ioMgr->connectWrite(connection.get(),IDataConnection::IoType(mode),"ROOT")
233  : m_ioMgr->connectRead(false,connection.get());
234  c = sc.isSuccess() ? m_ioMgr->connection(dataset) : 0;
235  if ( c ) {
236  bool writable = 0 != (mode&(IDataConnection::UPDATE|IDataConnection::RECREATE));
237  fire_incident = m_incidentEnabled && (0 != (mode&(IDataConnection::UPDATE|IDataConnection::READ)));
238  if ( writable ) {
239  m_incidentSvc->fireIncident(ContextIncident<TFile*>(connection->pfn(),"CONNECTED_OUTPUT",connection->file()));
240  }
241  if ( 0 != (mode&IDataConnection::READ) ) {
242  if ( !m_ioPerfStats.empty() ) {
243  connection->enableStatistics(m_setup->loadSection);
244  }
245  }
246  connection.release();
247  }
248  else {
249  m_incidentSvc->fireIncident(Incident(dataset,mode == IDataConnection::READ
252  // An error message was already printed by the IODataManager. no need to do it here!
253  return StatusCode::FAILURE;
254  }
255  }
256  RootDataConnection* pc = dynamic_cast<RootDataConnection*>(c);
257  if ( pc ) {
258  if ( !pc->isConnected() ) pc->connectRead();
259  *con = pc;
260  pc->resetAge();
261  pc->addClient(this);
262  }
263  if ( *con ) {
264  if ( fire_incident ) {
265  IOpaqueAddress* pAddr = 0;
266  string fid = pc->fid();
267  string section = m_recordName[0] == '/' ? m_recordName.substr(1) : m_recordName;
268  TBranch* b = pc->getBranch(section,m_recordName);
269  if ( b ) {
270  const string par[2] = { fid, m_recordName };
271  unsigned long ipar[2] = { (unsigned long)(*con), (unsigned long)b->GetEntries()-1 };
272  for(int i=0; i<b->GetEntries(); ++i) {
273  ipar[1] = i;
274  if ( !pc->mergeFIDs().empty() )
275  fid = pc->mergeFIDs()[i];
276  if ( !createAddress(repSvcType(),CLID_DataObject,par,ipar,pAddr).isSuccess() ) {
277  if( log().level() <= MSG::VERBOSE )
278  log() << MSG::VERBOSE << "Failed to create address for " << m_recordName << " in:" << fid
279  << " [" << pc->fid() << "][" << i << "]" << endmsg;
280  continue;
281  }
282  if( log().level() <= MSG::VERBOSE )
283  log() << MSG::VERBOSE << "Prepare " << m_recordName << " " << fid << " [" << par[0] << "][" << i << "]" << endmsg;
284  m_incidentSvc->fireIncident(ContextIncident<IOpaqueAddress*>(fid,"FILE_OPEN_READ",pAddr));
285  }
286  }
287  else {
288  if( log().level() <= MSG::VERBOSE )
289  log() << MSG::VERBOSE << "No valid Records " << m_recordName << " present in:" << pc->fid() << endmsg;
290  }
291  }
292 
293  // We can remove retired connections, which are no longer used....
295  for(IIODataManager::Connections::iterator i=cons.begin(); i != cons.end(); ++i) {
296  if ( (*i) != *con && !(*i)->isConnected() ) {
297  RootDataConnection* pc = dynamic_cast<RootDataConnection*>(*i);
298  if ( pc && pc->lookupClient(this) ) {
299  size_t num_client = pc->removeClient(this);
300  if ( num_client == 0 ) {
301  if ( m_ioMgr->disconnect(pc).isSuccess() ) {
302  log() << MSG::INFO << "Removed disconnected IO stream:" << pc->fid()
303  << " [" << pc->pfn() << "]" << endmsg;
304  delete pc;
305  }
306  }
307  }
308  }
309  }
310  return S_OK;
311  }
313  return S_FAIL;
314  }
315  catch (exception& e) {
317  return error(string("connectDatabase> Caught exception:")+e.what());
318  }
319  catch (...) {
321  return error("connectDatabase> Unknown Fatal Exception for "+dataset);
322  }
323 }
void addClient(const IInterface *client)
Add new client to this data source.
bool lookupClient(const IInterface *client) const
Lookup client for this data source.
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
const std::string & fid() const
Access file id.
IoType
I/O Connection types.
Gaudi::IIODataManager * m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:58
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
IAddressCreator implementation: Address creation.
Definition: RootCnvSvc.cpp:391
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
tuple c
Definition: gaudirun.py:341
std::vector< Connection * > Connections
RootConnectionSetup * m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:68
IIncidentSvc * m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:60
size_t removeClient(const IInterface *client)
Remove client from this data source.
virtual Connection * connection(const std::string &dsn) const =0
Retrieve known connection.
const std::string FailInputFile
could not open or read from this file
Definition: Incident.h:78
const std::string & pfn() const
Access physical file name.
virtual StatusCode disconnect(IDataConnection *con)=0
Release data stream.
std::string loadSection
RootCnvSvc Property: Root data cache size.
virtual bool isConnected() const
Check if connected to data source.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
#define S_OK
Definition: RootCnvSvc.cpp:39
virtual Connections connections(const IInterface *owner) const =0
Get connection by owner instance (0=ALL)
TBranch * getBranch(const std::string &section, const std::string &branch_name)
Access data branch by name: Get existing branch in read only mode.
virtual StatusCode connectRead(bool keep_open, IDataConnection *con)=0
Open data stream in read mode.
bool m_incidentEnabled
Property: Flag to enable incidents on FILE_OPEN.
Definition: RootCnvSvc.h:73
const StringVec & mergeFIDs() const
Access merged FIDs.
ABC describing basic data connection.
virtual StatusCode connectRead()
Open data stream in read mode.
void resetAge()
Reset age.
Base class for all Incidents (computing events).
Definition: Incident.h:16
std::string m_recordName
Property: Records name to fire incident for file records.
Definition: RootCnvSvc.h:77
const std::string FailOutputFile
could not create or write to this file
Definition: Incident.h:73
Opaque address interface definition.
std::string m_ioPerfStats
Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.
Definition: RootCnvSvc.h:79
#define S_FAIL
Definition: RootCnvSvc.cpp:40
list i
Definition: ana.py:128
Concrete implementation of the IDataConnection interface to access ROOT files.
virtual StatusCode connectWrite(IDataConnection *con, IoType mode=Connection::CREATE, const std::string &doctype="UNKNOWN")=0
Open data stream in write mode.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
virtual StatusCode Gaudi::RootCnvSvc::connectOutput ( const std::string &  outputFile,
const std::string &  openMode 
)
virtual

Connect the output file to the service with open mode.

Parameters
outputFileString containig output file
openModeString containig opening mode of the output file
Returns
Status code indicating success or failure.

Reimplemented from ConversionSvc.

virtual StatusCode Gaudi::RootCnvSvc::connectOutput ( const std::string &  outputFile)
virtual

Connect the output file to the service.

Parameters
outputFileString containig output file
Returns
Status code indicating success or failure.

Reimplemented from ConversionSvc.

StatusCode RootCnvSvc::createAddress ( long  svc_type,
const CLID clid,
const std::string *  par,
const unsigned long *  ip,
IOpaqueAddress *&  refpAddress 
)
virtual

IAddressCreator implementation: Address creation.

Create an address using the link infotmation together with the triple (database name/container name/object name).

Parameters
refLinkReference to abstract link information
dbNameDatabase name
containerNameObject container name
refpAddressOpaque address information to retrieve object
Returns
StatusCode indicating SUCCESS or failure

Reimplemented from ConversionSvc.

Definition at line 391 of file RootCnvSvc.cpp.

396 {
397  refpAddress = new RootAddress(typ,clid,par[0],par[1],ip[0],ip[1]);
398  return S_OK;
399 }
Description:
Definition: RootAddress.h:38
#define S_OK
Definition: RootCnvSvc.cpp:39
virtual StatusCode Gaudi::RootCnvSvc::createAddress ( long  svc_type,
const CLID clid,
const std::string &  refAddress,
IOpaqueAddress *&  refpAddress 
)
inlinevirtual

IAddressCreator implementation: Creates an address in string form to object form.

Parameters
svc_typeTechnology identifier encapsulated in this address.
clidClass identifier of the DataObject represented by the opaque address
addressInput address.
refpAddressOutput address in string form.
Returns
Status code indicating success or failure.

Reimplemented from ConversionSvc.

Definition at line 206 of file RootCnvSvc.h.

209  {
210  return this->ConversionSvc::createAddress(svc_type,clid,refAddress,refpAddress);
211  }
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
Create a Generic address using explicit arguments to identify a single object.
IConverter * RootCnvSvc::createConverter ( long  typ,
const CLID wanted,
const ICnvFactory *  fac 
)
virtual

ConversionSvc overload: Create new Converter using factory.

Reimplemented from ConversionSvc.

Definition at line 157 of file RootCnvSvc.cpp.

157  {
158  if ( wanted == CLID_StatisticsFile )
159  return new RootDatabaseCnv(typ,wanted,serviceLocator().get(),this);
160  else if ( wanted == CLID_StatisticsDirectory )
161  return new RootDirectoryCnv(typ,wanted,serviceLocator().get(),this);
162  else if ( wanted == CLID_RowWiseTuple )
163  return new RootNTupleCnv(typ,wanted,serviceLocator().get(),this);
164  else if ( wanted == CLID_ColumnWiseTuple )
165  return new RootNTupleCnv(typ,wanted,serviceLocator().get(),this);
166  else
167  return new RootConverter(typ,wanted,serviceLocator().get(),this);
168 }
Statistics file converter class definition.
NTuple converter class definition for NTuples writted/read using ROOT.
Definition: RootNTupleCnv.h:35
Description: NTuple directory converter class definition Definition of the converter to manage the di...
Description: Definition of the ROOT data converter.
Definition: RootConverter.h:33
SmartIF< ISvcLocator > & serviceLocator() const
Retrieve pointer to service locator.
Definition: Service.cpp:336
StatusCode RootCnvSvc::createNullRef ( const std::string &  path)
virtual

Insert null marker for not existent transient object.

Parameters
path[IN] Path to the (null-)object
Returns
Status code indicating success or failure.

Definition at line 410 of file RootCnvSvc.cpp.

410  {
411  RootObjectRefs* refs = 0;
412  size_t len = path.find('/',1);
413  string section = path.substr(1,len==string::npos ? string::npos : len-1);
414  pair<int,unsigned long> ret =
415  m_current->save(section,path+"#R",0,refs,m_bufferSize,m_splitLevel);
416  if( log().level() <= MSG::VERBOSE )
417  log() << MSG::VERBOSE << "Writing object:" << path << " "
418  << ret.first << " " << hex << ret.second << dec << " [NULL]" << endmsg;
419  return S_OK;
420 }
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
Persistent reference object containing all leafs and links corresponding to a Gaudi DataObject...
Definition: RootRefs.h:72
int m_splitLevel
Property: Split level optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:90
#define S_OK
Definition: RootCnvSvc.cpp:39
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
std::pair< int, unsigned long > save(const std::string &section, const std::string &cnt, TClass *cl, void *pObj, int buff_siz, int split_lvl, bool fill_missing=false)
Save object of a given class to section and container.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int m_bufferSize
Property: Buffer size optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:88
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition: RootCnvSvc.h:62
StatusCode RootCnvSvc::createNullRep ( const std::string &  path)
virtual

Insert null marker for not existent transient object.

Parameters
path[IN] Path to the (null-)object
Returns
Status code indicating success or failure.

Definition at line 402 of file RootCnvSvc.cpp.

402  {
403  size_t len = path.find('/',1);
404  string section = path.substr(1,len==string::npos ? string::npos : len-1);
406  return S_OK;
407 }
std::pair< int, unsigned long > saveObj(const std::string &section, const std::string &cnt, TClass *cl, DataObject *pObj, int buff_siz, int split_lvl, bool fill_missing=false)
Save object of a given class to section and container.
int m_splitLevel
Property: Split level optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:90
#define S_OK
Definition: RootCnvSvc.cpp:39
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
int m_bufferSize
Property: Buffer size optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:88
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition: RootCnvSvc.h:62
StatusCode RootCnvSvc::disconnect ( const std::string &  dbName)
virtual

Disconnect from an existing data stream.

Parameters
dbNameString containing name of the database
Returns
Status code indicating success or failure.

Definition at line 385 of file RootCnvSvc.cpp.

385  {
386  IDataConnection* c = m_ioMgr->connection(dataset);
387  return c ? m_ioMgr->disconnect(c) : S_FAIL;
388 }
Gaudi::IIODataManager * m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:58
tuple c
Definition: gaudirun.py:341
virtual Connection * connection(const std::string &dsn) const =0
Retrieve known connection.
virtual StatusCode disconnect(IDataConnection *con)=0
Release data stream.
ABC describing basic data connection.
#define S_FAIL
Definition: RootCnvSvc.cpp:40
StatusCode RootCnvSvc::error ( const std::string &  msg)

Standard way to print errors.

after the printout an exception is thrown.

Parameters
msg[IN] Message string to be printed.
Returns
Status code returning failure.

Definition at line 83 of file RootCnvSvc.cpp.

83  {
84  if ( m_log ) {
85  log() << MSG::ERROR << "Error: " << msg << endmsg;
86  return S_FAIL;
87  }
88  MsgStream m(msgSvc(),name());
89  m << MSG::ERROR << "Error: " << msg << endmsg;
90  return S_FAIL;
91 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MsgStream * m_log
Message streamer.
Definition: RootCnvSvc.h:96
#define S_FAIL
Definition: RootCnvSvc.cpp:40
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode RootCnvSvc::finalize ( )
virtual

ConversionSvc overload: Finalize Db service.

Reimplemented from ConversionSvc.

Definition at line 126 of file RootCnvSvc.cpp.

126  {
127  log() << MSG::INFO;
128  if ( m_ioMgr ) {
130  for(IIODataManager::Connections::iterator i=cons.begin(); i != cons.end(); ++i) {
131  RootDataConnection* pc = dynamic_cast<RootDataConnection*>(*i);
132  if ( pc ) {
133  if ( pc->owner() == this && !m_ioPerfStats.empty() ) {
135  }
136  if ( pc->lookupClient(this) ) {
137  size_t num_clients = pc->removeClient(this);
138  if ( num_clients == 0 ) {
139  if ( m_ioMgr->disconnect(pc).isSuccess() ) {
140  log() << "Disconnected data IO:" << pc->fid()
141  << " [" << pc->pfn() << "]" << endmsg;
142  delete pc;
143  }
144  }
145  }
146  }
147  }
148  releasePtr(m_ioMgr);
149  }
150  deletePtr(m_log);
151  releasePtr(m_incidentSvc);
153  return ConversionSvc::finalize();
154 }
bool lookupClient(const IInterface *client) const
Lookup client for this data source.
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
const std::string & fid() const
Access file id.
Gaudi::IIODataManager * m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:58
void saveStatistics(const std::string &statisticsFile)
Save TTree access statistics if required.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
std::vector< Connection * > Connections
RootConnectionSetup * m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:68
IIncidentSvc * m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:60
size_t removeClient(const IInterface *client)
Remove client from this data source.
const std::string & pfn() const
Access physical file name.
virtual StatusCode disconnect(IDataConnection *con)=0
Release data stream.
virtual StatusCode finalize()
stop the service.
virtual Connections connections(const IInterface *owner) const =0
Get connection by owner instance (0=ALL)
MsgStream * m_log
Message streamer.
Definition: RootCnvSvc.h:96
const IInterface * owner() const
Owner instance.
std::string m_ioPerfStats
Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.
Definition: RootCnvSvc.h:79
void setIncidentSvc(IIncidentSvc *m)
Set incident service reference.
list i
Definition: ana.py:128
Concrete implementation of the IDataConnection interface to access ROOT files.
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
TClass * RootCnvSvc::getClass ( DataObject pObject)
protected

Helper: Get TClass for a given DataObject pointer.

Definition at line 188 of file RootCnvSvc.cpp.

188  {
189  map<CLID, TClass*>::iterator i=s_classesClids.find(pObject->clID());
190  if ( i != s_classesClids.end() ) return (*i).second;
191  loadConverter(pObject);
192  i=s_classesClids.find(pObject->clID());
193  if ( i != s_classesClids.end() ) return (*i).second;
194 
195  string cname = System::typeinfoName(typeid(*pObject));
196  throw runtime_error("Unknown ROOT class for object:"+cname);
197  return 0;
198 }
virtual void loadConverter(DataObject *pObj)
ConversionSvc overload: Load the class (dictionary) for the converter.
Definition: RootCnvSvc.cpp:171
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:58
list i
Definition: ana.py:128
StatusCode RootCnvSvc::i__createObj ( IOpaqueAddress pAddr,
DataObject *&  refpObj 
)
virtual

Create transient object from persistent data.

Parameters
pAddr[IN] Pointer to object address.
refpObj[OUT] Location to pointer to store data object
Returns
Status code indicating success or failure.

Definition at line 487 of file RootCnvSvc.cpp.

487  {
488  refpObj = 0;
489  if ( pA ) {
490  RootDataConnection* con = 0;
491  const string* par = pA->par();
492  unsigned long* ipar = const_cast<unsigned long*>(pA->ipar());
494  if ( sc.isSuccess() ) {
495  ipar[0] = (unsigned long)con;
496  DataObject* pObj = 0;
497  size_t len = par[1].find('/',1);
498  string section = par[1].substr(1,len==string::npos ? string::npos : len-1);
499 
500  int nb = con->loadObj(section,par[1],ipar[1],pObj);
501  if ( nb > 1 || (nb == 1 && pObj->clID() == CLID_DataObject) ) {
502  refpObj = pObj;
503  return S_OK;
504  }
505  delete pObj;
506  }
507  string tag = par[0]+":"+par[1];
508  if ( m_badFiles.find(tag) == m_badFiles.end() ) {
509  m_badFiles.insert(tag);
510  return error("createObj> Cannot access the object:"+tag);
511  }
512  return S_FAIL;
513  }
514  return S_FAIL;
515 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
int loadObj(const std::string &section, const std::string &cnt, unsigned long entry, DataObject *&pObj)
Load object.
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
Definition: RootCnvSvc.cpp:224
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:58
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
#define S_OK
Definition: RootCnvSvc.cpp:39
std::set< std::string > m_badFiles
Set with bad files/tables.
Definition: RootCnvSvc.h:93
#define S_FAIL
Definition: RootCnvSvc.cpp:40
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
Concrete implementation of the IDataConnection interface to access ROOT files.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode RootCnvSvc::i__createRep ( DataObject pObj,
IOpaqueAddress *&  refpAddr 
)
virtual

Convert the transient object to the requested persistent representation.

Parameters
pObj[IN] Pointer to data object
refpAddr[OUT] Location to store pointer to object address.
Returns
Status code indicating success or failure.

Definition at line 423 of file RootCnvSvc.cpp.

423  {
424  refpAddr = 0;
425  if ( pObj ) {
426  CLID clid = pObj->clID();
427  IRegistry* pR = pObj->registry();
428  string p[2] = {m_current->fid(), pR->identifier()};
429  TClass* cl = (clid == CLID_DataObject) ? m_classDO : getClass(pObj);
430  size_t len = p[1].find('/',1);
431  string sect = p[1].substr(1,len==string::npos ? string::npos : len-1);
432  pair<int,unsigned long> ret =
433  m_current->saveObj(sect,p[1],cl,pObj,m_bufferSize,m_splitLevel,true);
434  if ( ret.first > 1 || (clid == CLID_DataObject && ret.first==1) ) {
435  unsigned long ip[2] = {0,ret.second};
436  if ( m_currSection.empty() ) m_currSection = p[1];
437  return createAddress(repSvcType(),clid,p,ip,refpAddr);
438  }
439  return error("Failed to write object data for:"+p[1]);
440  }
441  return error("createRep> Current Database is invalid!");
442 }
const std::string & fid() const
Access file id.
std::string m_currSection
Property: ROOT section name.
Definition: RootCnvSvc.h:70
std::pair< int, unsigned long > saveObj(const std::string &section, const std::string &cnt, TClass *cl, DataObject *pObj, int buff_siz, int split_lvl, bool fill_missing=false)
Save object of a given class to section and container.
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
IAddressCreator implementation: Address creation.
Definition: RootCnvSvc.cpp:391
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:69
int m_splitLevel
Property: Split level optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:90
virtual long repSvcType() const
Retrieve the class type of the data store the converter uses.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:58
TClass * m_classDO
TClass pointer to DataObject class.
Definition: RootCnvSvc.h:66
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
virtual const id_type & identifier() const =0
Full identifier (or key)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
int m_bufferSize
Property: Buffer size optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:88
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition: RootCnvSvc.h:62
TClass * getClass(DataObject *pObject)
Helper: Get TClass for a given DataObject pointer.
Definition: RootCnvSvc.cpp:188
StatusCode RootCnvSvc::i__fillObjRefs ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Resolve the references of the created transient object.

Parameters
pAddr[IN] Pointer to object address.
pObj[IN] Pointer to data object
Returns
Status code indicating success or failure.

Definition at line 518 of file RootCnvSvc.cpp.

518  {
519  if ( pA && pObj ) {
520  const unsigned long* ipar = pA->ipar();
521  RootDataConnection* con = (RootDataConnection*)ipar[0];
522  if ( con ) {
523  RootObjectRefs refs;
524  const string* par = pA->par();
525  size_t len = par[1].find('/',1);
526  string section = par[1].substr(1,len==string::npos ? string::npos : len-1);
527  int nb = con->loadRefs(section,par[1],ipar[1],refs);
528  if ( nb >= 1 ) {
529  string npar[3];
530  unsigned long nipar[2];
531  IOpaqueAddress* nPA;
532  IRegistry* pR = pObj->registry();
533  SmartIF<IService> isvc(pR->dataSvc());
534  SmartIF<IDataManagerSvc> dataMgr(pR->dataSvc());
535  LinkManager* mgr = pObj->linkMgr();
536  for(vector<int>::const_iterator i=refs.links.begin(); i!=refs.links.end();++i) {
537  mgr->addLink(con->getLink(*i),0);
538  }
539  for(size_t j=0, n=refs.refs.size(); j<n; ++j) {
540  const RootRef& r = refs.refs[j];
541  npar[0] = con->getDb(r.dbase);
542  npar[1] = con->getCont(r.container);
543  npar[2] = con->getLink(r.link);
544  nipar[0] = 0;
545  nipar[1] = r.entry;
546  StatusCode sc = addressCreator()->createAddress(r.svc,r.clid,npar,nipar,nPA);
547  if ( sc.isSuccess() ) {
548  if( log().level() <= MSG::VERBOSE )
549  log() << MSG::VERBOSE << isvc->name() << " -> Register:" << pA->registry()->identifier()
550  << "#" << npar[2] << "[" << r.entry << "]" << endmsg;
551  sc = dataMgr->registerAddress(pA->registry(),npar[2],nPA);
552  if ( sc.isSuccess() ) {
553  continue;
554  }
555  }
556  log() << MSG::ERROR << con->fid() << ": Failed to create address!!!!" << endmsg;
557  return S_FAIL;
558  }
559  return pObj->update();
560  }
561  else if ( nb < 0 ) {
562  string tag = par[0]+":"+par[1];
563  if ( m_badFiles.find(tag) == m_badFiles.end() ) {
564  m_badFiles.insert(tag);
565  return error("createObj> Cannot access the object:"+tag+" [Corrupted file]");
566  }
567  }
568  }
569  return S_FAIL;
570  }
571  return error("read> Cannot read object -- no valid object address present ");
572 }
virtual StatusCode update()
Provide empty placeholder for internal object reconfiguration callback.
Definition: DataObject.cpp:78
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
const std::string & fid() const
Access file id.
MSG::Level level()
Retrieve output level.
Definition: MsgStream.h:112
const std::string & getDb(int which) const
Access database/file name from saved index.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
const std::string & getLink(int which) const
Access link name from saved index.
std::vector< RootRef > refs
The references corresponding to the next layer of items in the data store.
Definition: RootRefs.h:76
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:69
int loadRefs(const std::string &section, const std::string &cnt, unsigned long entry, RootObjectRefs &refs)
Load references object.
Persistent reference object containing all leafs and links corresponding to a Gaudi DataObject...
Definition: RootRefs.h:72
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:73
int dbase
Data members to define object location in the persistent world.
Definition: RootRefs.h:33
Persistent reference object.
Definition: RootRefs.h:31
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
const std::string & getCont(int which) const
Access container name from saved index.
std::vector< int > links
The links of the link manager.
Definition: RootRefs.h:74
std::set< std::string > m_badFiles
Set with bad files/tables.
Definition: RootCnvSvc.h:93
virtual IDataProviderSvc * dataSvc() const =0
Retrieve pointer to Transient Store.
virtual SmartIF< IAddressCreator > & addressCreator() const
Retrieve address creator facility.
Opaque address interface definition.
#define S_FAIL
Definition: RootCnvSvc.cpp:40
list i
Definition: ana.py:128
Concrete implementation of the IDataConnection interface to access ROOT files.
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode RootCnvSvc::i__fillRepRefs ( IOpaqueAddress pAddr,
DataObject pObj 
)
virtual

Resolve the references of the converted object.

Parameters
pAddr[IN] Pointer to object address.
pObj[IN] Pointer to data object
Returns
Status code indicating success or failure.

Definition at line 445 of file RootCnvSvc.cpp.

445  {
446  if ( pObj ) {
447  typedef vector<IRegistry*> Leaves;
448  Leaves leaves;
449  RootObjectRefs refs;
450  IRegistry* pR = pObj->registry();
451  SmartIF<IDataManagerSvc> dataMgr(pR->dataSvc());
452  if ( dataMgr ) {
453  StatusCode status = dataMgr->objectLeaves(pObj, leaves);
454  if ( status.isSuccess() ) {
455  RootRef ref;
456  const string& id = pR->identifier();
457  size_t len = id.find('/',1);
458  string sect = id.substr(1,len==string::npos ? string::npos : len-1);
459  LinkManager* pLinks = pObj->linkMgr();
460  for(Leaves::iterator i=leaves.begin(), iend=leaves.end(); i != iend; ++i) {
461  if ( (*i)->address() ) {
462  m_current->makeRef(*i,ref);
463  ref.entry = (*i)->address()->ipar()[1];
464  refs.refs.push_back(ref);
465  }
466  }
467  for(int i = 0, n=pLinks->size(); i < n; ++i) {
468  LinkManager::Link* lnk = pLinks->link(i);
469  int link_id = m_current->makeLink(lnk->path());
470  refs.links.push_back(link_id);
471  }
472  pair<int,unsigned long> ret =
473  m_current->save(sect,id+"#R",m_classRefs,&refs,m_bufferSize,m_splitLevel,true);
474  if ( ret.first > 1 ) {
475  if( log().level() <= MSG::DEBUG )
476  log() << MSG::DEBUG << "Writing object:" << id << " "
477  << ret.first << " " << hex << ret.second << dec << endmsg;
478  return S_OK;
479  }
480  }
481  }
482  }
483  return S_FAIL;
484 }
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
std::vector< RootRef > refs
The references corresponding to the next layer of items in the data store.
Definition: RootRefs.h:76
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:69
Persistent reference object containing all leafs and links corresponding to a Gaudi DataObject...
Definition: RootRefs.h:72
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:73
Persistent reference object.
Definition: RootRefs.h:31
int m_splitLevel
Property: Split level optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:90
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
#define S_OK
Definition: RootCnvSvc.cpp:39
void makeRef(IRegistry *pA, RootRef &ref)
Create reference object from registry entry.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
std::vector< int > links
The links of the link manager.
Definition: RootRefs.h:74
std::pair< int, unsigned long > save(const std::string &section, const std::string &cnt, TClass *cl, void *pObj, int buff_siz, int split_lvl, bool fill_missing=false)
Save object of a given class to section and container.
int makeLink(const std::string &p)
Convert path string to path index.
virtual IDataProviderSvc * dataSvc() const =0
Retrieve pointer to Transient Store.
virtual const id_type & identifier() const =0
Full identifier (or key)
#define S_FAIL
Definition: RootCnvSvc.cpp:40
list i
Definition: ana.py:128
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
int m_bufferSize
Property: Buffer size optimization parameter for ROOT TTree.
Definition: RootCnvSvc.h:88
Gaudi::RootDataConnection * m_current
On writing: reference to active output stream.
Definition: RootCnvSvc.h:62
TClass * m_classRefs
TClass pointer to reference class.
Definition: RootCnvSvc.h:64
StatusCode RootCnvSvc::initialize ( )
virtual

ConversionSvc overload: initialize Db service.

Reimplemented from ConversionSvc.

Definition at line 94 of file RootCnvSvc.cpp.

94  {
95  string cname;
97  if ( !status.isSuccess() ) {
98  return error("Failed to initialize ConversionSvc base class.");
99  }
100  m_log = new MsgStream(msgSvc(),name());
101  if ( !m_compression.empty() ) {
102  log() << MSG::INFO << "Setting global ROOT compression to:" << m_compression << endmsg;
103  if ( !(status=RootConnectionSetup::setCompression(m_compression)).isSuccess() ) {
104  return error("Unable to interprete ROOT compression encoding:"+m_compression);
105  }
106  }
107  if( !(status=service("IODataManager", m_ioMgr)).isSuccess() )
108  return error("Unable to localize interface from service:IODataManager");
109  if( !(status=service("IncidentSvc", m_incidentSvc)).isSuccess() )
110  return error("Unable to localize interface from service:IncidentSvc");
114  cname = System::typeinfoName(typeid(DataObject));
115  m_classDO = TClass::GetClass(cname.c_str());
116  if ( 0 == m_classDO )
117  return error("Unable to load class description for DataObject");
118  cname = System::typeinfoName(typeid(RootObjectRefs));
119  m_classRefs = TClass::GetClass(cname.c_str());
120  if ( 0 == m_classRefs )
121  return error("Unable to load class description for ObjectRefs");
122  return S_OK;
123 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
Gaudi::IIODataManager * m_ioMgr
Reference to the I/O data manager.
Definition: RootCnvSvc.h:58
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
RootConnectionSetup * m_setup
Setup structure (ref-counted) and passed to data connections.
Definition: RootCnvSvc.h:68
IIncidentSvc * m_incidentSvc
Reference to incident service.
Definition: RootCnvSvc.h:60
bool patchStreamers(MsgStream &log)
void setMessageSvc(MsgStream *m)
Set message service reference.
Persistent reference object containing all leafs and links corresponding to a Gaudi DataObject...
Definition: RootRefs.h:72
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
#define S_OK
Definition: RootCnvSvc.cpp:39
TClass * m_classDO
TClass pointer to DataObject class.
Definition: RootCnvSvc.h:66
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
MsgStream * m_log
Message streamer.
Definition: RootCnvSvc.h:96
std::string m_compression
Property: Compression-algorithm:compression-level.
Definition: RootCnvSvc.h:81
static long setCompression(const std::string &compression)
Set the global compression level.
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
Definition: Service.h:142
virtual StatusCode initialize()
Initialize the service.
void setIncidentSvc(IIncidentSvc *m)
Set incident service reference.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
TClass * m_classRefs
TClass pointer to reference class.
Definition: RootCnvSvc.h:64
void RootCnvSvc::loadConverter ( DataObject pObj)
virtual

ConversionSvc overload: Load the class (dictionary) for the converter.

Reimplemented from ConversionSvc.

Definition at line 171 of file RootCnvSvc.cpp.

171  {
172  if (pObject) {
173  string cname = System::typeinfoName(typeid(*pObject));
174  if( log().level() <= MSG::DEBUG )
175  log() << MSG::DEBUG << "Trying to 'Autoload' dictionary for class " << cname << endmsg;
176  TClass* cl = s_classesNames[cname];
177  if ( 0 == cl ) {
178  cl = TClass::GetClass(cname.c_str());
179  if ( cl ) {
180  s_classesNames[cname] = cl;
181  s_classesClids[pObject->clID()] = cl;
182  }
183  }
184  }
185 }
MsgStream & log() const
Helper: Use message streamer.
Definition: RootCnvSvc.h:101
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
MsgStream& Gaudi::RootCnvSvc::log ( ) const
inlineprotected

Helper: Use message streamer.

Definition at line 101 of file RootCnvSvc.h.

101 { return *m_log; }
MsgStream * m_log
Message streamer.
Definition: RootCnvSvc.h:96
virtual StatusCode Gaudi::RootCnvSvc::updateServiceState ( IOpaqueAddress )
inlinevirtual

Update state of the service.

Reimplemented from ConversionSvc.

Definition at line 112 of file RootCnvSvc.h.

Member Data Documentation

int Gaudi::RootCnvSvc::m_autoFlush
protected

Property: AutoFlush parameter for ROOT TTree (Number of events between auto flushes)

Definition at line 84 of file RootCnvSvc.h.

std::set<std::string> Gaudi::RootCnvSvc::m_badFiles
protected

Set with bad files/tables.

Definition at line 93 of file RootCnvSvc.h.

int Gaudi::RootCnvSvc::m_basketSize
protected

Property: Basket optimization parameter for ROOT TTree (total basket size)

Definition at line 86 of file RootCnvSvc.h.

int Gaudi::RootCnvSvc::m_bufferSize
protected

Property: Buffer size optimization parameter for ROOT TTree.

Definition at line 88 of file RootCnvSvc.h.

TClass* Gaudi::RootCnvSvc::m_classDO
protected

TClass pointer to DataObject class.

Definition at line 66 of file RootCnvSvc.h.

TClass* Gaudi::RootCnvSvc::m_classRefs
protected

TClass pointer to reference class.

Definition at line 64 of file RootCnvSvc.h.

std::string Gaudi::RootCnvSvc::m_compression
protected

Property: Compression-algorithm:compression-level.

Definition at line 81 of file RootCnvSvc.h.

Gaudi::RootDataConnection* Gaudi::RootCnvSvc::m_current
protected

On writing: reference to active output stream.

Definition at line 62 of file RootCnvSvc.h.

std::string Gaudi::RootCnvSvc::m_currSection
protected

Property: ROOT section name.

Definition at line 70 of file RootCnvSvc.h.

bool Gaudi::RootCnvSvc::m_incidentEnabled
protected

Property: Flag to enable incidents on FILE_OPEN.

Definition at line 73 of file RootCnvSvc.h.

IIncidentSvc* Gaudi::RootCnvSvc::m_incidentSvc
protected

Reference to incident service.

Definition at line 60 of file RootCnvSvc.h.

Gaudi::IIODataManager* Gaudi::RootCnvSvc::m_ioMgr
protected

Reference to the I/O data manager.

Definition at line 58 of file RootCnvSvc.h.

std::string Gaudi::RootCnvSvc::m_ioPerfStats
protected

Property: Enable TTree IOperfStats if not empty; otherwise perf stat file name.

Definition at line 79 of file RootCnvSvc.h.

MsgStream* Gaudi::RootCnvSvc::m_log
protected

Message streamer.

Definition at line 96 of file RootCnvSvc.h.

std::string Gaudi::RootCnvSvc::m_recordName
protected

Property: Records name to fire incident for file records.

Definition at line 77 of file RootCnvSvc.h.

RootConnectionSetup* Gaudi::RootCnvSvc::m_setup
protected

Setup structure (ref-counted) and passed to data connections.

Definition at line 68 of file RootCnvSvc.h.

std::string Gaudi::RootCnvSvc::m_shareFiles
protected

Property: Share files ? If set to YES, files will not be closed on finalize.

Definition at line 75 of file RootCnvSvc.h.

int Gaudi::RootCnvSvc::m_splitLevel
protected

Property: Split level optimization parameter for ROOT TTree.

Definition at line 90 of file RootCnvSvc.h.


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