BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
RootEventBaseCnv.h
Go to the documentation of this file.
1#ifndef _RootEventBaseCnv_H
2#define _RootEventBaseCnv_H 1
3
4#include <vector>
5#include <string>
6#include <map>
7#include "TArrayS.h"
8#include "GaudiKernel/Converter.h"
9#include "GaudiKernel/CnvFactory.h"
10#include "GaudiKernel/IDataProviderSvc.h"
11
12#include "RootInterface.h"
13#include "RootCnvSvc.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*/
37protected:
38
40 std::vector<RootCnvSvc::Leaf> m_leaves;
41
42 /// pointer to the RootInterface
44
45 /// pointer to eventdataservice
46 IDataProviderSvc* m_eds;
47
48 /// the branchNr of this converter for writing
56
57 /// the object that was read
58 TObject *m_objRead;
59
60 /// the CLID of the upper converter if any
62
63 /// array with number of branches for reading
65
66 /// root branchname (may be concatenated of severals)
67 std::string m_rootBranchname;
68 /// each converter knows it's treename
69 std::string m_rootTreename;
70
71 std::string m_currentFileName;
72 /// each converter knows the corresponding adresses
73 std::vector<void *> m_adresses;
74
76
77public:
78
79 RootEventBaseCnv(const CLID& clid, ISvcLocator* svc);
80
81 virtual ~RootEventBaseCnv() { };
82
83 /// Storage type and class ID
84 static const unsigned char storageType() {
85 return ROOT_StorageType;
86 }
87
88 virtual long repSvcType() const {
89 return ROOT_StorageType;
90 }
91
92 virtual StatusCode initialize();
93
94 virtual StatusCode finalize();
95
96 /// Store TDS path to link a particular converter to an object on the TDS
97 void declareObject(const std::string& fullPath, const CLID& clid,
98 const std::string& treename,
99 const std::string& branchname );
100
101 /// Convert the persistent object to transient
102 virtual StatusCode createObj(IOpaqueAddress* addr,
103 DataObject*& dat );
104
105 /// Convert the transient object to the requested representation.
106 virtual StatusCode createRep(DataObject* pObject,
107 IOpaqueAddress*& refpAddress);
108
109 /// Resolve the references of the converted object.
110 virtual StatusCode fillRepRefs(IOpaqueAddress* pAddress,
111 DataObject* pObject);
112
113 /// Resolve the references of the converted object.
114 virtual StatusCode fillObjRefs(IOpaqueAddress* pAddress,
115 DataObject* pObject);
116
117 /// Do the concrete conversion from TDS to ROOT
118 virtual StatusCode DataObjectToTObject(DataObject* dat,
119 RootAddress* addr) =0;
120
121 /// Do the concrete conversion from ROOT to TDS
122 virtual StatusCode TObjectToDataObject(DataObject*& dat) =0;
123
124 /// get the object to be read
125 TObject* getReadObject() const { return m_objRead;}
126
127};
128
129
130#endif // _RootEventBaseCnv_H
131
132
133
134
const long int ROOT_StorageType
Definition of a Root address, derived from IOpaqueAddress.
Definition: RootAddress.h:21
Root Event Conversion Service which coordinates all of our converters.
Definition: RootCnvSvc.h:40
Base class for all Root Converters.
virtual StatusCode DataObjectToTObject(DataObject *dat, RootAddress *addr)=0
Do the concrete conversion from TDS to ROOT.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of the converted object.
std::string m_rootTreename
each converter knows it's treename
std::vector< void * > m_adresses
each converter knows the corresponding adresses
virtual StatusCode createObj(IOpaqueAddress *addr, DataObject *&dat)
Convert the persistent object to transient.
static const unsigned char storageType()
Storage type and class ID.
RootCnvSvc * m_cnvSvc
RootEvtSelector * m_evtsel
TObject * m_objRead
the object that was read
virtual StatusCode initialize()
RootInterface * m_rootInterface
pointer to the RootInterface
TObject * getReadObject() const
get the object to be read
TArrayS * m_branchNumbers
array with number of branches for reading
virtual StatusCode finalize()
virtual ~RootEventBaseCnv()
virtual StatusCode TObjectToDataObject(DataObject *&dat)=0
Do the concrete conversion from ROOT to TDS.
virtual long repSvcType() const
void declareObject(const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
Store TDS path to link a particular converter to an object on the TDS.
std::string m_currentFileName
IDataProviderSvc * m_eds
pointer to eventdataservice
int m_branchNr
the branchNr of this converter for writing
std::string m_rootBranchname
root branchname (may be concatenated of severals)
CLID CLID_top
the CLID of the upper converter if any
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of the converted object.
std::vector< RootCnvSvc::Leaf > m_leaves
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
RootEvtSelector performs the function of controlling the ApplicationMgr loop.