BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
CalibTreeCnvSvc Class Reference

#include <CalibTreeCnvSvc.h>

+ Inheritance diagram for CalibTreeCnvSvc:

Public Member Functions

virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 
std::string getrootfile ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *pObject)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress)
 
std::string getrootfile ()
 
virtual std::string getrootfile ()=0
 
virtual std::string getrootfile ()=0
 

Protected Member Functions

 CalibTreeCnvSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~CalibTreeCnvSvc ()
 
 CalibTreeCnvSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~CalibTreeCnvSvc ()
 

Friends

class SvcFactory< CalibTreeCnvSvc >
 Only factories can access protected constructors.
 

Additional Inherited Members

- Static Public Member Functions inherited from ICalibTreeSvc
static const InterfaceID & interfaceID ()
 
static const InterfaceID & interfaceID ()
 

Detailed Description


A conversion service for GLAST calibration bulk data in ROOT format.

Author
J. Bogart
Date
July 2004

Definition at line 34 of file Calibration/CalibSvc/CalibTreeCnv/CalibTreeCnv-00-01-22/CalibTreeCnv/CalibTreeCnvSvc.h.

Constructor & Destructor Documentation

◆ CalibTreeCnvSvc() [1/2]

CalibTreeCnvSvc::CalibTreeCnvSvc ( const std::string &  name,
ISvcLocator *  svc 
)
protected

Definition at line 21 of file CalibTreeCnvSvc.cxx.

22 :
23 ConversionSvc(name, svc, CALIBTREE_StorageType),
24 m_detPersSvc(0), m_detDataSvc(0) {
25 //huangb add
26}

◆ ~CalibTreeCnvSvc() [1/2]

virtual CalibTreeCnvSvc::~CalibTreeCnvSvc ( )
inlineprotectedvirtual

◆ CalibTreeCnvSvc() [2/2]

CalibTreeCnvSvc::CalibTreeCnvSvc ( const std::string &  name,
ISvcLocator *  svc 
)
protected

◆ ~CalibTreeCnvSvc() [2/2]

virtual CalibTreeCnvSvc::~CalibTreeCnvSvc ( )
inlineprotectedvirtual

Member Function Documentation

◆ createAddress() [1/2]

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

Create a ROOT address using explicit arguments to identify a single object

Parameters
svc_typethe service type
CLIDthe CLID of the ROOT Element for which an address is created
paran array of three strings containing the format version, calibration type name and the flavor, in this order
iphas a single element, the serial number of the MySQL row which corresponds to this element
refpAddressthe new address created
Returns
a StatusCode giving the status of the address creation

Definition at line 124 of file CalibTreeCnvSvc.cxx.

128 {
129 //createAddress of CalibTreeCnvSvc
130 MsgStream log( msgSvc(), name() );
131 if (svc_type != CALIBTREE_StorageType) {
132 log << MSG::ERROR << "bad storage type" << (int)svc_type << endreq;
133 return StatusCode::FAILURE;
134 }
135 std::string dataIdent;
136 std::string fullpath;
137 int index ;
138 if(clid==CLID_Calib_MdcCal)
139 { index=0;}
140 else if(clid==CLID_Calib_TofCal)
141 {index =1;}
142 else if(clid==CLID_Calib_DedxCal)
143 {index =2;}
144 else if(clid==CLID_Calib_EmcCal)
145 {index =3;}
146 else{
147 log << MSG::WARNING<<"Wrong CLID"<<endreq;
148 }
149
150 //see if svctype set in the CalibDataSvc is MYSQL_StorageType or CALIBROOT_StorageType
151/* IInstrumentName* iInstrumentName;
152 StatusCode sc = m_detDataSvc->queryInterface(IID_IInstrumentName,
153 (void**) &iInstrumentName);
154
155 if ( !sc.isSuccess() ) {
156 log << MSG::ERROR
157 << "Cannot query IInstrumentName interface of CalibDataSvc"
158 << endreq;
159 return sc;
160 } else {
161 log << MSG::DEBUG
162 << "Retrieved IInstrumentName interface of CalibDataSvc"
163 << endreq;
164 }
165
166 int svctype = iInstrumentName->getsvctype();
167 if(svctype== CALIBROOT_StorageType)
168 {
169 dataIdent = m_rootfile[index];
170 fullpath = par[0];
171 }
172
173 if(svctype== MYSQL_StorageType)
174 { log << MSG::INFO<<"rootfile is not set in the jobOption,get it from MySQL"<<endreq;
175 dataIdent = par[0];
176 fullpath = par[1];
177 }
178
179 if ((svctype != CALIBROOT_StorageType)&&(svctype!= MYSQL_StorageType)) {
180 log << MSG::ERROR << "bad storage type" << (int)svctype << endreq;
181 return StatusCode::FAILURE;
182 }
183*/
184 // std::string dataIdent(par[0]); // file identifier for PDS version of data
185 // log << MSG::INFO<<"dataIdent is:"<<dataIdent<<endreq;
186 //std::string fullpath(par[1]); // path within TCDS for the object
187 // log << MSG::INFO<<"fullpath is :"<<fullpath<<endreq;
188
189
190 int runfrm = ip[0];
191 int runto = ip[1];
192 dataIdent = par[0];
193 fullpath = par[1];
194
195 // for now have to ignore fmtVersion because of defective implementation
196 // of GenericAddress. If we want it, should probably write new
197 // opaque address implementation for this package to use. All
198 // dealings with (calibration) opaque addresses are confined to
199 // the CalibSvc package.
200 refpAddress = new GenericAddress(CALIBTREE_StorageType,
201 clid,
202 dataIdent,
203 fullpath,
204 runfrm,
205 runto);
206
207
208 return StatusCode::SUCCESS;
209
210}

◆ createAddress() [2/2]

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

Create a ROOT address using explicit arguments to identify a single object

Parameters
svc_typethe service type
CLIDthe CLID of the ROOT Element for which an address is created
paran array of three strings containing the format version, calibration type name and the flavor, in this order
iphas a single element, the serial number of the MySQL row which corresponds to this element
refpAddressthe new address created
Returns
a StatusCode giving the status of the address creation

◆ finalize() [1/2]

StatusCode CalibTreeCnvSvc::finalize ( )
virtual

Definition at line 118 of file CalibTreeCnvSvc.cxx.

118 {
119 // If anything was allocated, get rid of it. So far, nothing was.
120
121 return ConversionSvc::finalize();
122}

◆ finalize() [2/2]

virtual StatusCode CalibTreeCnvSvc::finalize ( )
virtual

◆ getrootfile() [1/2]

std::string CalibTreeCnvSvc::getrootfile ( )
inlinevirtual

Method to write a ROOT file corresponding to TDS object

Parameters
fileNamethe name of the file to be written
Returns
the document issued from the parsing

Implements ICalibTreeSvc.

Definition at line 85 of file Calibration/CalibSvc/CalibTreeCnv/CalibTreeCnv-00-01-22/CalibTreeCnv/CalibTreeCnvSvc.h.

86 { return m_rootfile[0];}

◆ getrootfile() [2/2]

std::string CalibTreeCnvSvc::getrootfile ( )
inlinevirtual

Method to write a ROOT file corresponding to TDS object

Parameters
fileNamethe name of the file to be written
Returns
the document issued from the parsing

Implements ICalibTreeSvc.

Definition at line 85 of file InstallArea/include/CalibTreeCnv/CalibTreeCnv/CalibTreeCnvSvc.h.

86 { return m_rootfile[0];}

◆ initialize() [1/2]

StatusCode CalibTreeCnvSvc::initialize ( )
virtual

Definition at line 43 of file CalibTreeCnvSvc.cxx.

43 {
44 StatusCode sc = ConversionSvc::initialize();
45
46 MsgStream log(msgSvc(), "CalibTreeCnvSvc");
47
48 if (!sc.isSuccess()) return sc;
49
50 // Locate the Calib Data Service. Since it inherits from DataSvc
51 // it has to implement IDataProviderSvc
52 m_detDataSvc = 0;
53 /*sc = serviceLocator()->getService
54 ("CalibDataSvc", IID_IDataProviderSvc,(IInterface*&) m_detDataSvc);*/
55 sc = serviceLocator()->getService
56 ("CalibDataSvc", IDataProviderSvc::interfaceID(),(IInterface*&) m_detDataSvc);
57 if ( !sc.isSuccess() ) {
58 log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq;
59 return sc;
60 }
61
62 /* IInstrumentName* iInstrumentName;
63 sc = m_detDataSvc->queryInterface(IID_IInstrumentName,
64 (void**) &iInstrumentName);
65*/
66 // Set the CalibDataSvc as data provider service
67 sc = setDataProvider(m_detDataSvc);
68 if ( !sc.isSuccess() ) {
69 log << MSG::ERROR << "Could not set data provider" << endreq;
70 return sc;
71 }
72 //huangb add
73 sc = setProperties();
74
75 // Locate IConversionSvc interface of the DetectorPersistencySvc
76 sc = serviceLocator()->service
77 ("DetectorPersistencySvc", m_detPersSvc, true);
78 if ( !sc.isSuccess() ) {
79 log << MSG::ERROR
80 << "Cannot locate IConversionSvc interface of DetectorPersistencySvc"
81 << endreq;
82 return sc;
83 } else {
84 log << MSG::DEBUG
85 << "Retrieved IConversionSvc interface of DetectorPersistencySvc"
86 << endreq;
87 }
88
89 // Query the IAddressCreator interface of the detector persistency service
90 IAddressCreator* iAddrCreator;
91 /*sc = m_detPersSvc->queryInterface(IID_IAddressCreator,
92 (void**) &iAddrCreator);*/
93 sc = m_detPersSvc->queryInterface(IAddressCreator::interfaceID(),
94 (void**) &iAddrCreator);
95 if ( !sc.isSuccess() ) {
96 log << MSG::ERROR
97 << "Cannot query IAddressCreator interface of DetectorPersistencySvc"
98 << endreq;
99 return sc;
100 } else {
101 log << MSG::DEBUG
102 << "Retrieved IAddressCreator interface of DetectorPersistencySvc"
103 << endreq;
104 }
105 log << MSG::DEBUG
106 << "Set it as the address creator of the CalibTreeCnvSvc" << endreq;
107 sc = setAddressCreator(iAddrCreator);
108 if ( !sc.isSuccess() ) {
109 log << MSG::ERROR << "Cannot set the address creator" << endreq;
110 return sc;
111 }
112
113 // set properties if there are any??
114
115 return sc;
116}

◆ initialize() [2/2]

virtual StatusCode CalibTreeCnvSvc::initialize ( )
virtual

◆ queryInterface() [1/2]

StatusCode CalibTreeCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

Definition at line 28 of file CalibTreeCnvSvc.cxx.

29 {
30 /* Uncomment if choose to derive from abstract root conv. interface */
31 if (IID_ICalibTreeSvc.versionMatch(riid)) {
32 *ppvInterface = (ICalibTreeSvc*)this;
33 }
34 else {
35 // Interface is not directly availible: try out a base class
36 return ConversionSvc::queryInterface(riid, ppvInterface);
37 /* } */
38 addRef();
39 }
40 return StatusCode::SUCCESS;
41}

◆ queryInterface() [2/2]

virtual StatusCode CalibTreeCnvSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)
virtual

◆ updateObj() [1/2]

StatusCode CalibTreeCnvSvc::updateObj ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Definition at line 213 of file CalibTreeCnvSvc.cxx.

214 {
215
216 // using facilities::Timestamp;
217
218 MsgStream log(msgSvc(), "CalibTreeCnvSvc" );
219
220 // Don't update when we're using enter time
221 log << MSG::DEBUG << "CalibTreeCnvSvc::updateObj starting ...."<<endreq;
222}

◆ updateObj() [2/2]

virtual StatusCode CalibTreeCnvSvc::updateObj ( IOpaqueAddress *  pAddress,
DataObject *  pObject 
)
virtual

Friends And Related Function Documentation

◆ SvcFactory< CalibTreeCnvSvc >

friend class SvcFactory< CalibTreeCnvSvc >
friend

Only factories can access protected constructors.

Definition at line 1 of file Calibration/CalibSvc/CalibTreeCnv/CalibTreeCnv-00-01-22/CalibTreeCnv/CalibTreeCnvSvc.h.


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