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

Description: Base class converter for N-tuples and related classes. More...

#include <Root/RootStatCnv.h>

Inheritance diagram for Gaudi::RootStatCnv:
Collaboration diagram for Gaudi::RootStatCnv:

Public Member Functions

 RootStatCnv (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor. More...
 
virtual ~RootStatCnv ()
 Standard Destructor. More...
 
- Public Member Functions inherited from Gaudi::RootConverter
 RootConverter (long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
 Initializing Constructor. More...
 
virtual ~RootConverter ()
 Standard Destructor. More...
 
virtual long repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
virtual StatusCode createObj (IOpaqueAddress *pAddr, DataObject *&refpObj)
 Converter overrides: Create transient object from persistent data. More...
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Resolve the references of the created transient object. More...
 
virtual StatusCode createRep (DataObject *pObj, IOpaqueAddress *&refpAddr)
 Converter overrides: Convert the transient object to the requested representation. More...
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObj)
 Resolve the references of the created transient object. More...
 
- Public Member Functions inherited from Converter
virtual StatusCode setDataProvider (IDataProviderSvc *svc)
 Set Data provider service. More...
 
virtual SmartIF
< IDataProviderSvc > & 
dataProvider () const
 Get Data provider service. More...
 
virtual StatusCode setConversionSvc (IConversionSvc *svc)
 Set conversion service the converter is connected to. More...
 
virtual SmartIF< IConversionSvc > & conversionSvc () const
 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 const CLID & objType () const
 Retrieve the class type of objects the converter produces. More...
 
virtual long i_repSvcType () const
 Retrieve the class type of the data store the converter uses. More...
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
 Update the transient object from the other representation. More...
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an updated transient object. More...
 
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the converted representation of a transient object. More...
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Update the references of an already converted object. More...
 
 Converter (long storage_type, const CLID &class_type, ISvcLocator *svc=0)
 Standard Constructor. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=false) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &type, const std::string &name, T *&psvc) const
 Access a service by name, type creating it if it doesn't already exist. More...
 
SmartIF< IService > service (const std::string &name, const bool createIf=true) const
 Return a pointer to the service identified by name (or "type/name") More...
 
- Public Member Functions inherited from extend_interfaces1< IConverter >
virtual ~extend_interfaces1 ()
 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 IInterface
virtual void * i_cast (const InterfaceID &) const =0
 main cast function More...
 
virtual std::vector< std::string > getInterfaceNames () const =0
 Returns a vector of strings containing the names of all the implemented interfaces. More...
 
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long release ()=0
 Release Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)=0
 Set the void** to the pointer to the requested interface of the instance. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 

Protected Member Functions

MsgStream & log () const
 Helper to use mesage logger. More...
 
virtual StatusCode initialize ()
 Initialize converter object. More...
 
virtual StatusCode finalize ()
 Finalize converter object. More...
 
virtual const std::string containerName (IRegistry *pDir) const
 Retrieve the name of the container a given object is placed into. More...
 
virtual const std::string fileName (IRegistry *pReg) const
 Retrieve the name of the file a given object is placed into. More...
 
virtual const std::string topLevel (IRegistry *pReg) const
 Retrieve the full path of the file a given object is placed into. More...
 
StatusCode makeError (const std::string &msg, bool throw_exception=false) const
 Helper method to issue error messages. More...
 
StatusCode saveDescription (const std::string &path, const std::string &ident, const std::string &desc, const std::string &opt, const CLID &clid)
 Save statistics object description. More...
 
- Protected Member Functions inherited from Converter
virtual ~Converter ()
 Standard Destructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 Retrieve pointer to message service. More...
 
SmartIF< IMessageSvc > & messageService () const
 
SmartIF< IDataManagerSvc > & dataManager () const
 Get Data Manager service. More...
 

Protected Attributes

IDataManagerSvc * m_dataMgr
 Reference to data manager service to manipulate the TES. More...
 
MsgStream * m_log
 Reference to logger object. More...
 
- Protected Attributes inherited from Gaudi::RootConverter
RootCnvSvc * m_dbMgr
 Conversion service needed for proper operation to forward requests. More...
 

Additional Inherited Members

- Public Types inherited from Converter
typedef
Gaudi::PluginService::Factory
< IConverter *, ISvcLocator * > 
Factory
 
- Public Types inherited from implements1< IConverter >
typedef implements1 base_class
 Typedef to this class. More...
 
typedef extend_interfaces1
< IConverter > 
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_interfaces1< IConverter >
typedef IConverter::iid::iids::type ext_iids
 MPL set of interfaces extended by this one. 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...
 
- 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< iid > ext_iids
 Extra interfaces. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceID & interfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

Description: Base class converter for N-tuples and related classes.

Author
M.Frank
Version
1.0

Definition at line 31 of file RootStatCnv.h.

Constructor & Destructor Documentation

RootStatCnv::RootStatCnv ( long  typ,
const CLID &  clid,
ISvcLocator *  svc,
RootCnvSvc *  mgr 
)

Initializing Constructor.

Parameters
typ[IN] Concrete storage type of the converter
clid[IN] Class identifier of the object
svc[IN] Pointer to service locator object
Returns
Reference to RootBaseCnv object

Definition at line 25 of file RootStatCnv.cpp.

26 : RootConverter(typ, clid, svc, mgr), m_dataMgr(0), m_log(0)
27 {
28 }
RootConverter(long typ, const CLID &clid, ISvcLocator *svc, RootCnvSvc *mgr)
Initializing Constructor.
Definition: RootConverter.h:48
MsgStream * m_log
Reference to logger object.
Definition: RootStatCnv.h:36
IDataManagerSvc * m_dataMgr
Reference to data manager service to manipulate the TES.
Definition: RootStatCnv.h:34
virtual Gaudi::RootStatCnv::~RootStatCnv ( )
inlinevirtual

Standard Destructor.

Definition at line 106 of file RootStatCnv.h.

106 { }

Member Function Documentation

const string RootStatCnv::containerName ( IRegistry *  pDir) const
protectedvirtual

Retrieve the name of the container a given object is placed into.

Parameters
pReg[IN] Pointer to registry entry.
Returns
Name of the container the object should be put to.

Reimplemented in Gaudi::RootDatabaseCnv.

Definition at line 58 of file RootStatCnv.cpp.

58  {
59  const string& path = pReg->identifier();
60  long loc = path.find('/',1);
61  string local = "<local>";
62  //local = "";
63  if ( loc > 0 ) {
64  loc = path.find('/',++loc);
65  if ( loc > 0 ) {
66  local += path.substr(loc,path.length()-loc);
67  }
68  }
69  //for(size_t i=0; i<local.length();++i)
70  // if ( !isalnum(local[i])) local[i] = '_';
71  return local;
72 }
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
const string RootStatCnv::fileName ( IRegistry *  pReg) const
protectedvirtual

Retrieve the name of the file a given object is placed into.

Parameters
pReg[IN] Pointer to registry entry.
Returns
Name of the file the object should be put to.

Definition at line 75 of file RootStatCnv.cpp.

75  {
76  string path = topLevel(pReg);
77  DataObject* pObj = 0;
78  dataProvider()->retrieveObject(path, pObj);
79  if ( pObj ) {
80  NTuple::File* fptr = dynamic_cast<NTuple::File*>(pObj);
81  if ( fptr ) {
82  return fptr->name();
83  }
84  }
85  return "";
86 }
const std::string & name() const
Retrun physical file name.
Definition: NTuple.h:1122
virtual const std::string topLevel(IRegistry *pReg) const
Retrieve the full path of the file a given object is placed into.
Definition: RootStatCnv.cpp:89
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
virtual SmartIF< IDataProviderSvc > & dataProvider() const
Get Data provider service.
Definition: Converter.cpp:94
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
Small class representing an N tuple file in the transient store.
Definition: NTuple.h:1085
StatusCode RootStatCnv::finalize ( )
protectedvirtual

Finalize converter object.

Reimplemented from Converter.

Definition at line 45 of file RootStatCnv.cpp.

45  {
46  if ( m_log ) {
47  delete m_log;
48  m_log = 0;
49  }
50  if ( m_dataMgr ) {
51  m_dataMgr->release();
52  m_dataMgr = 0;
53  }
54  return RootConverter::finalize();
55 }
virtual StatusCode finalize()
Initialize the converter.
Definition: Converter.cpp:76
virtual unsigned long release()=0
Release Interface instance.
MsgStream * m_log
Reference to logger object.
Definition: RootStatCnv.h:36
IDataManagerSvc * m_dataMgr
Reference to data manager service to manipulate the TES.
Definition: RootStatCnv.h:34
StatusCode RootStatCnv::initialize ( )
protectedvirtual

Initialize converter object.

Reimplemented from Converter.

Definition at line 31 of file RootStatCnv.cpp.

31  {
33  if ( sc.isSuccess() ) {
34  sc = dataProvider()->queryInterface(IDataManagerSvc::interfaceID(),(void**)&m_dataMgr);
35  if ( !sc.isSuccess() ) {
36  return makeError("Failed to access IDataManagerSvc interface.");
37  }
38  }
39  if ( m_log ) delete m_log;
40  m_log = new MsgStream(msgSvc(),System::typeinfoName(typeid(*this)));
41  return sc;
42 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
virtual StatusCode initialize()
Initialize the converter.
Definition: Converter.cpp:67
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:131
StatusCode makeError(const std::string &msg, bool throw_exception=false) const
Helper method to issue error messages.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual SmartIF< IDataProviderSvc > & dataProvider() const
Get Data provider service.
Definition: Converter.cpp:94
MsgStream * m_log
Reference to logger object.
Definition: RootStatCnv.h:36
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
IDataManagerSvc * m_dataMgr
Reference to data manager service to manipulate the TES.
Definition: RootStatCnv.h:34
MsgStream& Gaudi::RootStatCnv::log ( ) const
inlineprotected

Helper to use mesage logger.

Definition at line 39 of file RootStatCnv.h.

39 { return *m_log; }
MsgStream * m_log
Reference to logger object.
Definition: RootStatCnv.h:36
StatusCode RootStatCnv::makeError ( const std::string &  msg,
bool  throw_exception = false 
) const
protected

Helper method to issue error messages.

Parameters
msg[IN] Text of the error message
throw_exc[IN]If true throw an exception of type std::runtime_error
Returns
Status code indicating success or failure.

Definition at line 105 of file RootStatCnv.cpp.

105  {
106  if ( m_log ) {
107  log() << MSG::ERROR << msg << endmsg;
108  }
109  else {
110  MsgStream l(msgSvc(),"RootConverter");
111  l << MSG::ERROR << msg << endmsg;
112  }
113  if ( throw_exc ) {
114  }
115  return StatusCode::FAILURE;
116 }
MsgStream & log() const
Helper to use mesage logger.
Definition: RootStatCnv.h:39
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
SmartIF< IMessageSvc > & msgSvc() const
Retrieve pointer to message service.
Definition: Converter.cpp:131
dictionary l
Definition: gaudirun.py:365
MsgStream * m_log
Reference to logger object.
Definition: RootStatCnv.h:36
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode RootStatCnv::saveDescription ( const std::string &  path,
const std::string &  ident,
const std::string &  desc,
const std::string &  opt,
const CLID &  clid 
)
protected

Save statistics object description.

Parameters
path[IN] Path of file to save the description on.
ident[IN] Identifier of description to be saved.
desc[IN] Description
opt[IN] Optional description
guid[IN] Object giud of described object
openMode[IN] Mode of opening the file to save description
Returns
Status code indicating success or failure.

Definition at line 120 of file RootStatCnv.cpp.

125 {
126  RootDataConnection* con = 0;
128  if ( status.isSuccess() ) {
129  TClass* cl = gROOT->GetClass("Gaudi::RootNTupleDescriptor",kTRUE);
130  if ( cl ) {
132  auto_ptr<RootNTupleDescriptor> dsc(ptr=new RootNTupleDescriptor());
133  TBranch* b = con->getBranch("##Descriptors","GaudiStatisticsDescription",cl,ptr,512,0);
134  if ( b ) {
135  dsc->description = desc;
136  dsc->optional = opt;
137  dsc->container = ident;
138  dsc->clid = clid;
139  b->SetAddress(&ptr);
140  int nb = b->Fill();
141  if ( nb > 1 ) {
142  log() << MSG::DEBUG << "Save description for " << ident << endmsg;
143  return StatusCode::SUCCESS;
144  }
145  }
146  return makeError("Failed to access ROOT branch GaudiStatisticsDescription");
147  }
148  return makeError("Failed to access TClass RootNTupleDescriptor");
149  }
150  return makeError("Failed to access Tuple file:"+path);
151 }
MsgStream & log() const
Helper to use mesage logger.
Definition: RootStatCnv.h:39
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:62
RootCnvSvc * m_dbMgr
Conversion service needed for proper operation to forward requests.
Definition: RootConverter.h:37
StatusCode makeError(const std::string &msg, bool throw_exception=false) const
Helper method to issue error messages.
StatusCode connectDatabase(const std::string &dataset, int mode, RootDataConnection **con)
Connect the output file to the service with open mode.
Definition: RootCnvSvc.cpp:224
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
TBranch * getBranch(const std::string &section, const std::string &branch_name)
Access data branch by name: Get existing branch in read only mode.
string opt
print 'Summary: %32s [s] d d steps'%(summary.protocol,summary.type,summary.nevt,len(summary.data),)
Definition: ana.py:116
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
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
const string RootStatCnv::topLevel ( IRegistry *  pReg) const
protectedvirtual

Retrieve the full path of the file a given object is placed into.

Parameters
pReg[IN] Pointer to registry entry.
Returns
Name of the file the object should be put to.

Definition at line 89 of file RootStatCnv.cpp.

89  {
90  if ( pReg ) {
91  string path = pReg->identifier();
92  size_t idx = path.find('/', 1);
93  if ( idx != string::npos ) {
94  idx = path.find('/', idx+1);
95  if ( idx != string::npos ) {
96  path = path.substr(0, idx);
97  }
98  return path;
99  }
100  }
101  return "";
102 }
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
virtual const id_type & identifier() const =0
Full identifier (or key)

Member Data Documentation

IDataManagerSvc* Gaudi::RootStatCnv::m_dataMgr
protected

Reference to data manager service to manipulate the TES.

Definition at line 34 of file RootStatCnv.h.

MsgStream* Gaudi::RootStatCnv::m_log
protected

Reference to logger object.

Definition at line 36 of file RootStatCnv.h.


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