#include <CalibRootCnvSvc.h>
Inheritance diagram for CalibRootCnvSvc:
Public Member Functions | |
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) |
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string *par, const unsigned long *ip, IOpaqueAddress *&refpAddress) |
StatusCode | decodeDescription (const std::string &oldpath, std::string &realpath) |
StatusCode | decodeDescription (const std::string &oldpath, std::string &realpath) |
virtual StatusCode | finalize () |
virtual StatusCode | finalize () |
std::string | getrootfile () |
std::string | getrootfile () |
virtual StatusCode | initialize () |
virtual StatusCode | initialize () |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface) |
virtual StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *pObject) |
virtual StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *pObject) |
virtual StatusCode | writeToRoot (const std::string &outputFile, CalibData::CalibBase1 *calib) |
virtual StatusCode | writeToRoot (const std::string &outputFile, const std::string &tdsPath) |
virtual StatusCode | writeToRoot (const std::string &outputFile, CalibData::CalibBase1 *calib) |
virtual StatusCode | writeToRoot (const std::string &outputFile, const std::string &tdsPath) |
Static Public Member Functions | |
const InterfaceID & | interfaceID () |
const InterfaceID & | interfaceID () |
Protected Member Functions | |
CalibRootCnvSvc (const std::string &name, ISvcLocator *svc) | |
CalibRootCnvSvc (const std::string &name, ISvcLocator *svc) | |
virtual | ~CalibRootCnvSvc () |
virtual | ~CalibRootCnvSvc () |
Private Attributes | |
IDataProviderSvc * | m_detDataSvc |
Handle to IDataProviderSvc interface of CalibDataSvc. | |
IDataProviderSvc * | m_detDataSvc |
Handle to IDataProviderSvc interface of CalibDataSvc. | |
IConversionSvc * | m_detPersSvc |
Handle to the IConversionSvc interface of the DetectorPersistencySvc. | |
IConversionSvc * | m_detPersSvc |
Handle to the IConversionSvc interface of the DetectorPersistencySvc. | |
std::string | m_rootfile [10] |
Friends | |
class | SvcFactory<CalibRootCnvSvc> |
Only factories can access protected constructors. |
A conversion service for GLAST calibration bulk data in ROOT format.
|
00024 : 00025 ConversionSvc(name, svc, CALIBROOT_StorageType), 00026 m_detPersSvc(0), m_detDataSvc(0) { 00027 //huangb add 00028 declareProperty("Mdcrootfile",m_rootfile[0]= std::string("no rootfile")); 00029 declareProperty("Tofrootfile",m_rootfile[1]= std::string("no rootfile")); 00030 declareProperty("Dedxrootfile",m_rootfile[2]= std::string("no rootfile")); 00031 declareProperty("Emcrootfile",m_rootfile[3]= std::string("no rootfile")); 00032 declareProperty("Mucrootfile",m_rootfile[4]= std::string("no rootfile")); 00033 declareProperty("EsTimerootfile",m_rootfile[5]= std::string("no rootfile")); 00034 declareProperty("EstTofrootfile",m_rootfile[6]= std::string("no rootfile")); 00035 declareProperty("TofQElecrootfile",m_rootfile[7]= std::string("no rootfile")); 00036 declareProperty("TofSimrootfile",m_rootfile[8]= std::string("no rootfile")); 00037 declareProperty("DedxSimrootfile",m_rootfile[9]= std::string("no rootfile")); 00038 // Some day might have a property to declare having to do with path to 00039 // xml files. 00040 }
|
|
00050 {}
|
|
|
|
00050 {}
|
|
Create a ROOT address using explicit arguments to identify a single object
|
|
Create a ROOT address using explicit arguments to identify a single object
00139 { 00140 MsgStream log( msgSvc(), name() ); 00141 log << MSG::DEBUG<<"here is the createAddress in the CalibRootCnvSvc"<<endreq; 00142 if (svc_type != CALIBROOT_StorageType) { 00143 log << MSG::ERROR << "bad storage type" << (int)svc_type << endreq; 00144 return StatusCode::FAILURE; 00145 } 00146 std::cout<<"clid=="<<clid<<std::endl; 00147 std::string dataIdent; 00148 std::string fullpath; 00149 int index=-99; 00150 if(clid==6412) return StatusCode::SUCCESS; 00151 if(clid==CLID_Calib_MdcCal) 00152 { index=0;} 00153 else if(clid==CLID_Calib_TofCal) 00154 {index =1;} 00155 else if(clid==CLID_Calib_DedxCal) 00156 {index =2;} 00157 else if(clid==CLID_Calib_EmcCal) 00158 {index =3;} 00159 else if(clid==CLID_Calib_MucCal) 00160 {index =4;} 00161 else if(clid==CLID_Calib_EsTimeCal) 00162 {index =5;} 00163 else if(clid==CLID_Calib_EstTofCal) 00164 {index =6;} 00165 else if(clid==CLID_TofQ_Elec) 00166 {index =7;} 00167 else if(clid==CLID_Calib_TofSim) 00168 {index =8;} 00169 else if(clid==CLID_Dedx_Sim) 00170 {index =9;} 00171 00172 else{ 00173 log << MSG::WARNING<<"Wrong CLID"<<endreq; 00174 } 00175 std::cout<<"index=="<<index<<std::endl; 00176 //see if svctype set in the CalibDataSvc is MYSQL_StorageType or CALIBROOT_StorageType 00177 /* IInstrumentName* iInstrumentName; 00178 StatusCode sc = m_detDataSvc->queryInterface(IID_IInstrumentName, 00179 (void**) &iInstrumentName); 00180 00181 if ( !sc.isSuccess() ) { 00182 log << MSG::ERROR 00183 << "Cannot query IInstrumentName interface of CalibDataSvc" 00184 << endreq; 00185 return sc; 00186 } else { 00187 log << MSG::DEBUG 00188 << "Retrieved IInstrumentName interface of CalibDataSvc" 00189 << endreq; 00190 } 00191 00192 int svctype = iInstrumentName->getsvctype(); 00193 if(svctype== CALIBROOT_StorageType) 00194 { 00195 */ 00196 // dataIdent = m_rootfile[index]; 00197 if(m_rootfile[index]=="no rootfile") 00198 { 00199 log << MSG::INFO<<"no sepcified calibration file path of type "<< index <<endreq; 00200 return StatusCode::FAILURE; 00201 } 00202 decodeDescription(m_rootfile[index],dataIdent); 00203 fullpath = par[0]; 00204 /* } 00205 00206 if(svctype== MYSQL_StorageType) 00207 { log << MSG::INFO<<"rootfile is not set in the jobOption,get it from MySQL"<<endreq; 00208 dataIdent = par[0]; 00209 fullpath = par[1]; 00210 } 00211 00212 if ((svctype != CALIBROOT_StorageType)&&(svctype!= MYSQL_StorageType)) { 00213 log << MSG::ERROR << "bad storage type" << (int)svctype << endreq; 00214 return StatusCode::FAILURE; 00215 } 00216 */ 00217 00218 // std::string dataIdent(par[0]); // file identifier for PDS version of data 00219 log << MSG::INFO<<"dataIdent is:"<<dataIdent<<endreq; 00220 //std::string fullpath(par[1]); // path within TCDS for the object 00221 log << MSG::INFO<<"fullpath is :"<<fullpath<<endreq; 00222 00223 00224 int runfrm = ip[0]; 00225 int runto = ip[1]; 00226 00227 // for now have to ignore fmtVersion because of defective implementation 00228 // of GenericAddress. If we want it, should probably write new 00229 // opaque address implementation for this package to use. All 00230 // dealings with (calibration) opaque addresses are confined to 00231 // the CalibSvc package. 00232 refpAddress = new GenericAddress(CALIBROOT_StorageType, 00233 clid, 00234 dataIdent, 00235 fullpath, 00236 runfrm, 00237 runto); 00238 00239 return StatusCode::SUCCESS; 00240 00241 }
|
|
|
|
00303 { 00304 MsgStream log(msgSvc(), "CalibMySQLCnvSvc"); 00305 00306 if(oldpath[0]!='$'){ 00307 realpath=oldpath; 00308 } 00309 if(oldpath[0]=='$'){ 00310 int idx =oldpath.find("/"); 00311 if( std::string::npos != idx ) 00312 { std::string relpath; 00313 for(int i=1;i<idx-1;i++){ 00314 relpath[i-1] = oldpath[i]; 00315 } 00316 std::string otherpath; 00317 for(int i=idx-1;i<oldpath.size();i++){ 00318 otherpath[i-idx+1]=oldpath[i]; 00319 } 00320 realpath = std::string(getenv(relpath.c_str()))+otherpath; 00321 } 00322 if( std::string::npos == idx ){ 00323 std::string relpath; 00324 for(int i=1;i<oldpath.size();i++){ 00325 relpath[i-1] = oldpath[i]; 00326 } 00327 realpath = std::string(getenv(relpath.c_str())); 00328 } 00329 } 00330 00331 return StatusCode::SUCCESS; 00332 }
|
|
|
|
00128 { 00129 // If anything was allocated, get rid of it. So far, nothing was. 00130 00131 return ConversionSvc::finalize(); 00132 }
|
|
Implements ICalibRootSvc. 00092 { return m_rootfile[0];}
|
|
Implements ICalibRootSvc. 00092 { return m_rootfile[0];}
|
|
|
|
00057 { 00058 StatusCode sc = ConversionSvc::initialize(); 00059 00060 MsgStream log(msgSvc(), "CalibRootCnvSvc"); 00061 00062 if (!sc.isSuccess()) return sc; 00063 00064 // Locate the Calib Data Service. Since it inherits from DataSvc 00065 // it has to implement IDataProviderSvc 00066 m_detDataSvc = 0; 00067 sc = serviceLocator()->getService 00068 ("CalibDataSvc", IID_IDataProviderSvc,(IInterface*&) m_detDataSvc); 00069 if ( !sc.isSuccess() ) { 00070 log << MSG::ERROR << "Could not locate CalibDataSvc" << endreq; 00071 return sc; 00072 } 00073 00074 /* IInstrumentName* iInstrumentName; 00075 sc = m_detDataSvc->queryInterface(IID_IInstrumentName, 00076 (void**) &iInstrumentName); 00077 */ 00078 // Set the CalibDataSvc as data provider service 00079 sc = setDataProvider(m_detDataSvc); 00080 if ( !sc.isSuccess() ) { 00081 log << MSG::ERROR << "Could not set data provider" << endreq; 00082 return sc; 00083 } 00084 //huangb add 00085 sc = setProperties(); 00086 00087 // Locate IConversionSvc interface of the DetectorPersistencySvc 00088 sc = serviceLocator()->service 00089 ("DetectorPersistencySvc", m_detPersSvc, true); 00090 if ( !sc.isSuccess() ) { 00091 log << MSG::ERROR 00092 << "Cannot locate IConversionSvc interface of DetectorPersistencySvc" 00093 << endreq; 00094 return sc; 00095 } else { 00096 log << MSG::DEBUG 00097 << "Retrieved IConversionSvc interface of DetectorPersistencySvc" 00098 << endreq; 00099 } 00100 00101 // Query the IAddressCreator interface of the detector persistency service 00102 IAddressCreator* iAddrCreator; 00103 sc = m_detPersSvc->queryInterface(IID_IAddressCreator, 00104 (void**) &iAddrCreator); 00105 if ( !sc.isSuccess() ) { 00106 log << MSG::ERROR 00107 << "Cannot query IAddressCreator interface of DetectorPersistencySvc" 00108 << endreq; 00109 return sc; 00110 } else { 00111 log << MSG::DEBUG 00112 << "Retrieved IAddressCreator interface of DetectorPersistencySvc" 00113 << endreq; 00114 } 00115 log << MSG::DEBUG 00116 << "Set it as the address creator of the CalibRootCnvSvc" << endreq; 00117 sc = setAddressCreator(iAddrCreator); 00118 if ( !sc.isSuccess() ) { 00119 log << MSG::ERROR << "Cannot set the address creator" << endreq; 00120 return sc; 00121 } 00122 00123 // set properties if there are any?? 00124 00125 return sc; 00126 }
|
|
00036 { return IID_ICalibRootSvc; }
|
|
00036 { return IID_ICalibRootSvc; }
|
|
|
|
00043 { 00044 /* Uncomment if choose to derive from abstract root conv. interface */ 00045 if (IID_ICalibRootSvc.versionMatch(riid)) { 00046 *ppvInterface = (ICalibRootSvc*)this; 00047 } 00048 else { 00049 // Interface is not directly availible: try out a base class 00050 return ConversionSvc::queryInterface(riid, ppvInterface); 00051 /* } */ 00052 addRef(); 00053 } 00054 return StatusCode::SUCCESS; 00055 }
|
|
|
|
00285 { 00286 00287 // using facilities::Timestamp; 00288 00289 MsgStream log(msgSvc(), "CalibRootCnvSvc" ); 00290 00291 // Don't update when we're using enter time 00292 log << MSG::DEBUG << "CalibRootCnvSvc::updateObj starting ...."<<endreq; 00293 /* 00294 if (!m_useEventTime) 00295 { log << MSG::DEBUG << "Method updateObj needn't update" << endreq; 00296 return StatusCode::SUCCESS; 00297 } 00298 */ 00299 }
|
|
Implements ICalibRootSvc. |
|
Method to write a ROOT file corresponding to TDS object
Implements ICalibRootSvc. |
|
Implements ICalibRootSvc. 00265 { 00266 MsgStream log(msgSvc(), name() ); 00267 // Find converter corresponding to this object 00268 IConverter* converter = ConversionSvc::converter(pCalib->clID()); 00269 if (!converter) { 00270 log << "No converter found for object with CLID " << pCalib->clID() 00271 << endreq; 00272 return StatusCode::FAILURE; 00273 } 00274 RootCalBaseCnv* pCnv = dynamic_cast<RootCalBaseCnv*>(converter); 00275 if (!pCnv) { 00276 log << "Converter for CLID " << pCalib->clID() << " not of proper type" 00277 << endreq; 00278 return StatusCode::FAILURE; 00279 } 00280 // Call its createRoot method 00281 return pCnv->createRoot(outfile, pCalib); 00282 }
|
|
Method to write a ROOT file corresponding to TDS object
Implements ICalibRootSvc. 00244 { 00245 MsgStream log( msgSvc(), name() ); 00246 00247 // Find corresponding object 00248 DataObject* pObj; 00249 m_detDataSvc->findObject(tdsPath, pObj); 00250 if (!pObj) { 00251 log << "No object in TDS with path " << tdsPath << endreq; 00252 return StatusCode::FAILURE; 00253 } 00254 00255 CalibData::CalibBase1* pCalib = 00256 dynamic_cast<CalibData::CalibBase1*> (pObj); 00257 00258 if (!pCalib) { 00259 log << "Object with path " << tdsPath << " not of proper type" << endreq; 00260 return StatusCode::FAILURE; 00261 } 00262 return writeToRoot(outfile, pCalib); 00263 }
|
|
Only factories can access protected constructors.
|
|
Handle to IDataProviderSvc interface of CalibDataSvc.
|
|
Handle to IDataProviderSvc interface of CalibDataSvc.
|
|
Handle to the IConversionSvc interface of the DetectorPersistencySvc.
|
|
Handle to the IConversionSvc interface of the DetectorPersistencySvc.
|
|
|