CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/RootCnvSvc/RootCnvSvc-04-01-15/RootCnvSvc/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*/
36class RootEventBaseCnv : public Converter {
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
49 int m_branchNr;
50 int m_branchNrDst;
51 int m_branchNrMc;
56
57 /// the object that was read
58 TObject *m_objRead;
59
60 /// the CLID of the upper converter if any
61 CLID CLID_top;
62
63 /// array with number of branches for reading
64 TArrayS *m_branchNumbers;
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
const long int ROOT_StorageType
Definition of a Root address, derived from IOpaqueAddress.
Root Event Conversion Service which coordinates all of our converters.
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
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
static const unsigned char storageType()
Storage type and class ID.
virtual StatusCode createObj(IOpaqueAddress *addr, DataObject *&dat)
Convert the persistent object to transient.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of the converted object.
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.
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.
virtual StatusCode initialize()
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)
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)
Resolve the references of the converted object.
virtual StatusCode finalize()
RootEvtSelector performs the function of controlling the ApplicationMgr loop.