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

#include <CalibTreeCnvSvc.h>

+ Inheritance diagram for CalibTreeCnvSvc:

Public Member Functions

 CalibTreeCnvSvc (const std::string &name, ISvcLocator *svc)
 
virtual ~CalibTreeCnvSvc ()
 
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 ()
 
- Public Member Functions inherited from ICalibTreeSvc
 DeclareInterfaceID (ICalibTreeSvc, 1, 0)
 

Friends

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

Detailed Description


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

Author
J. Bogart
Date
July 2004

Definition at line 35 of file CalibTreeCnvSvc.h.

Constructor & Destructor Documentation

◆ CalibTreeCnvSvc()

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

Definition at line 21 of file CalibTreeCnvSvc.cxx.

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

◆ ~CalibTreeCnvSvc()

virtual CalibTreeCnvSvc::~CalibTreeCnvSvc ( )
inlinevirtual

Definition at line 42 of file CalibTreeCnvSvc.h.

42{}

Member Function Documentation

◆ createAddress()

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 125 of file CalibTreeCnvSvc.cxx.

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

◆ finalize()

StatusCode CalibTreeCnvSvc::finalize ( )
virtual

Definition at line 119 of file CalibTreeCnvSvc.cxx.

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

◆ getrootfile()

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 CalibTreeCnvSvc.h.

86 { return m_rootfile[0];}

◆ initialize()

StatusCode CalibTreeCnvSvc::initialize ( )
virtual

Definition at line 44 of file CalibTreeCnvSvc.cxx.

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

◆ updateObj()

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

Definition at line 214 of file CalibTreeCnvSvc.cxx.

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

Friends And Related Symbol Documentation

◆ SvcFactory< CalibTreeCnvSvc >

friend class SvcFactory< CalibTreeCnvSvc >
friend

Only factories can access protected constructors.

Definition at line 1 of file CalibTreeCnvSvc.h.


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