BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/RootCnvSvc/include/RootCnvSvc/RootEventBaseCnv.h
Go to the documentation of this file.
1#ifndef _RootEventBaseCnv_H
2#define _RootEventBaseCnv_H 1
3
4#include "GaudiKernel/Converter.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "TArrayS.h"
7#include <map>
8#include <string>
9#include <vector>
10
11#include "IRootCnvSvc.h"
12#include "RootCnvSvc.h"
13#include "RootInterface.h"
14
15#include <iostream>
16
17class RootAddress;
18class DataObject;
19class TObject;
20class RootEvtSelector;
21
22extern const long int ROOT_StorageType;
23
24/** @class RootEventBaseCnv
25 * @brief Base class for all Root Converters.
26 *
27 * Based on SICb's SicbBaseCnv
28 * all specific converters inherit from this base class.
29 * The basic functions they have to implement are the pure conversions
30 * to and from DataObjects/Root Objects.
31 * In case there is more to do ( calling of upper converters, creation of branches for writing,
32 * reading of subbranches) they may also override the methods
33 * createObj/createRep.
34 * Based on the RootEventBaseCnv of Glast.
35 */
36
37// class RootEventBaseCnv : public Converter {
38class GAUDI_API RootEventBaseCnv : public Converter {
39protected:
41 // SmartIF<IConversionSvc> m_cnvSvc;
42 std::vector<RootCnvSvc::Leaf> m_leaves;
43
44 /// pointer to the RootInterface
46
47 /// pointer to eventdataservice
48 IDataProviderSvc* m_eds;
49
50 /// the branchNr of this converter for writing
58
59 /// the object that was read
60 TObject* m_objRead;
61
62 /// the CLID of the upper converter if any
64
65 /// array with number of branches for reading
67
68 /// root branchname (may be concatenated of severals)
69 std::string m_rootBranchname;
70 /// each converter knows it's treename
71 std::string m_rootTreename;
72
73 std::string m_currentFileName;
74 /// each converter knows the corresponding adresses
75 std::vector<void*> m_adresses;
76
78
79public:
80 RootEventBaseCnv( const CLID& clid, ISvcLocator* svc );
81
82 virtual ~RootEventBaseCnv(){};
83
84 /// Storage type and class ID
85 static const unsigned char storageType() { return ROOT_StorageType; }
86
87 virtual long repSvcType() const { return ROOT_StorageType; }
88
89 virtual StatusCode initialize();
90
91 virtual StatusCode finalize();
92
93 /// Store TDS path to link a particular converter to an object on the TDS
94 void declareObject( const std::string& fullPath, const CLID& clid,
95 const std::string& treename, const std::string& branchname );
96
97 /// Convert the persistent object to transient
98 virtual StatusCode createObj( IOpaqueAddress* addr, DataObject*& dat );
99
100 /// Convert the transient object to the requested representation.
101 virtual StatusCode createRep( DataObject* pObject, IOpaqueAddress*& refpAddress );
102
103 /// Resolve the references of the converted object.
104 virtual StatusCode fillRepRefs( IOpaqueAddress* pAddress, DataObject* pObject );
105
106 /// Resolve the references of the converted object.
107 virtual StatusCode fillObjRefs( IOpaqueAddress* pAddress, DataObject* pObject );
108
109 /// Do the concrete conversion from TDS to ROOT
110 virtual StatusCode DataObjectToTObject( DataObject* dat, RootAddress* addr ) = 0;
111
112 /// Do the concrete conversion from ROOT to TDS
113 virtual StatusCode TObjectToDataObject( DataObject*& dat ) = 0;
114
115 /// get the object to be read
116 TObject* getReadObject() const { return m_objRead; }
117};
118
119#endif // _RootEventBaseCnv_H
const long int ROOT_StorageType
const long int ROOT_StorageType
Definition of a Root address, derived from IOpaqueAddress.
virtual StatusCode DataObjectToTObject(DataObject *dat, RootAddress *addr)=0
Do the concrete conversion from TDS to ROOT.
std::string m_rootTreename
each converter knows it's treename
static const unsigned char storageType()
Storage type and class ID.
IDataProviderSvc * m_eds
pointer to eventdataservice
TObject * getReadObject() const
get the object to be read
std::vector< void * > m_adresses
each converter knows the corresponding adresses
TArrayS * m_branchNumbers
array with number of branches for reading
virtual StatusCode TObjectToDataObject(DataObject *&dat)=0
Do the concrete conversion from ROOT to TDS.
int m_branchNr
the branchNr of this converter for writing
RootInterface * m_rootInterface
pointer to the RootInterface
std::string m_rootBranchname
root branchname (may be concatenated of severals)
CLID CLID_top
the CLID of the upper converter if any
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)
RootEvtSelector performs the function of controlling the ApplicationMgr loop.