/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/CalibSvc/CalibROOTCnv/CalibROOTCnv-00-01-13/src/test/UseMdcCalibData.cxx

Go to the documentation of this file.
00001 //$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibROOTCnv/src/test/UseMdcCalibData.cxx,v 1.7 2008/04/08 08:34:13 huangb Exp $
00002 /*#include <stdio.h>
00003 #include "GaudiKernel/Algorithm.h"
00004 #include "GaudiKernel/AlgFactory.h"
00005 #include "GaudiKernel/IDataProviderSvc.h"
00006 #include "GaudiKernel/Service.h"
00007 #include "GaudiKernel/MsgStream.h"
00008 #include "GaudiKernel/SmartDataPtr.h"
00009 #include "CalibData/Mdc/MdcCalibData.h"
00010 #include "CalibData/CalibModel.h"
00011 #include "GaudiKernel/DataSvc.h"
00012 #include "CalibDataSvc/ICalibRootSvc.h"
00013 using namespace std;
00015 class UseMdcCalibData : public Algorithm {
00016 
00017 public:
00018   UseMdcCalibData(const std::string& name, ISvcLocator* pSvcLocator); 
00019 
00020   StatusCode initialize();
00021 
00022   StatusCode execute();
00023 
00024   StatusCode finalize();
00025 
00026 private:
00027   IDataProviderSvc* m_pCalibDataSvc;
00028   ICalibRootSvc*    m_pRootSvc;
00029   // Maybe something to say which kind of data to look up?
00030 
00031 };
00032 
00034 //static const AlgFactory<UseMdcCalibData> Factory;
00035 //const IAlgFactory& UseCalibFactory = Factory;
00036 //const IAlgFactory& UseMdcCalibDataFactory = Factory;
00037 */
00038 #include "UseMdcCalibData.h"
00039 UseMdcCalibData::UseMdcCalibData( const std::string&  name, 
00040                     ISvcLocator*        pSvcLocator )
00041   : Algorithm     ( name, pSvcLocator ), m_pCalibDataSvc(0)
00042 {
00043   // Declare properties here.
00044 
00045 }
00046 
00047 
00048 StatusCode UseMdcCalibData::initialize() {
00049   StatusCode sc;
00050   MsgStream log(msgSvc(), name());
00051   log << MSG::INFO << "Initialize()" << endreq;
00052 
00053   // So far don't have any properties, but in case we do some day..
00054 //  setProperties();
00055 
00056    log<<MSG::INFO << "setProperties()" << endreq;
00057   
00058    sc = service("CalibDataSvc", m_pCalibDataSvc, true);
00059 
00060   if ( !sc.isSuccess() ) {
00061     log << MSG::ERROR 
00062         << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc" 
00063         << endreq;
00064     return sc;
00065   } else {
00066     log << MSG::DEBUG 
00067         << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" 
00068         << endreq;
00069   }
00070 
00071   sc = service("CalibRootCnvSvc", m_pRootSvc, true);
00072   if ( !sc.isSuccess() ) {
00073     log << MSG::ERROR 
00074         << "Could not get ICalibRootSvc interface of CalibRootCnvSvc" 
00075         << endreq;
00076     return sc;
00077   }
00078   // Get properties from the JobOptionsSvc
00079   
00080  sc = setProperties();
00081  return StatusCode::SUCCESS;
00082 
00083 }
00084 
00085 
00086 StatusCode UseMdcCalibData::execute( ) {
00087    
00088   MsgStream log(msgSvc(), name());
00089 
00090   // Cheat for now since Windows is having trouble finding definition
00091 
00092   std::string fullPath = "/Calib/MdcCal";
00093  std::string file =m_pRootSvc->getrootfile();
00094  std::cout<<"file="<<file<<"\n";
00095 // return StatusCode::SUCCESS;
00096    log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
00097    
00098    SmartDataPtr<CalibData::MdcCalibData> test1Copy(m_pCalibDataSvc, fullPath);
00099    if(!test1Copy);
00100    //    CalibData::MdcCalibData test;
00101  
00102    //   m_pCalibDataSvc->registerObject(FullPath,test);
00103     m_pRootSvc->writeToRoot("Mdc_test.root", fullPath);
00104 //  SmartDataPtr<CalibData::MdcCalibData> test1Copy(m_pCalibDataSvc, fullPath);
00105    //  if(!test1Copy);
00106   return StatusCode::SUCCESS;
00107 }
00108 /*
00109 DataSvc::retrieveObject(fullPath,CalibData::CalibTest1);
00110 */
00111 StatusCode UseMdcCalibData::finalize( ) {
00112 
00113   MsgStream log(msgSvc(), name());
00114   log << MSG::INFO 
00115       << "        UseMdcCalibData1 FINALIZE!! "
00116       << endreq;
00117   
00118   return StatusCode::SUCCESS;
00119 }
00120 
00121 

Generated on Tue Nov 29 22:57:51 2016 for BOSS_7.0.2 by  doxygen 1.4.7