CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
UseMdcCalibData.cxx
Go to the documentation of this file.
1//$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibROOTCnv/src/test/UseMdcCalibData.cxx,v 1.7 2008/04/08 08:34:13 huangb Exp $
2/*#include <stdio.h>
3#include "GaudiKernel/Algorithm.h"
4#include "GaudiKernel/AlgFactory.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/Service.h"
7#include "GaudiKernel/MsgStream.h"
8#include "GaudiKernel/SmartDataPtr.h"
9#include "CalibData/Mdc/MdcCalibData.h"
10#include "CalibData/CalibModel.h"
11#include "GaudiKernel/DataSvc.h"
12#include "CalibDataSvc/ICalibRootSvc.h"
13using namespace std;
14/// Simple algorithm to test functioning of "the other" TDS
15class UseMdcCalibData : public Algorithm {
16
17public:
18 UseMdcCalibData(const std::string& name, ISvcLocator* pSvcLocator);
19
20 StatusCode initialize();
21
22 StatusCode execute();
23
24 StatusCode finalize();
25
26private:
27 IDataProviderSvc* m_pCalibDataSvc;
28 ICalibRootSvc* m_pRootSvc;
29 // Maybe something to say which kind of data to look up?
30
31};
32
33/// Instantiation of a static factory to create instances of this algorithm
34//static const AlgFactory<UseMdcCalibData> Factory;
35//const IAlgFactory& UseCalibFactory = Factory;
36//const IAlgFactory& UseMdcCalibDataFactory = Factory;
37*/
38#include "UseMdcCalibData.h"
39UseMdcCalibData::UseMdcCalibData( const std::string& name,
40 ISvcLocator* pSvcLocator )
41 : Algorithm ( name, pSvcLocator ), m_pCalibDataSvc(0)
42{
43 // Declare properties here.
44
45}
46
47
49 StatusCode sc;
50 MsgStream log(msgSvc(), name());
51 log << MSG::INFO << "Initialize()" << endreq;
52
53 // So far don't have any properties, but in case we do some day..
54// setProperties();
55
56 log<<MSG::INFO << "setProperties()" << endreq;
57
58 sc = service("CalibDataSvc", m_pCalibDataSvc, true);
59
60 if ( !sc.isSuccess() ) {
61 log << MSG::ERROR
62 << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
63 << endreq;
64 return sc;
65 } else {
66 log << MSG::DEBUG
67 << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"
68 << endreq;
69 }
70
71 sc = service("CalibRootCnvSvc", m_pRootSvc, true);
72 if ( !sc.isSuccess() ) {
73 log << MSG::ERROR
74 << "Could not get ICalibRootSvc interface of CalibRootCnvSvc"
75 << endreq;
76 return sc;
77 }
78 // Get properties from the JobOptionsSvc
79
80 sc = setProperties();
81 return StatusCode::SUCCESS;
82
83}
84
85
87
88 MsgStream log(msgSvc(), name());
89
90 // Cheat for now since Windows is having trouble finding definition
91
92 std::string fullPath = "/Calib/MdcCal";
93 std::string file =m_pRootSvc->getrootfile();
94 std::cout<<"file="<<file<<"\n";
95// return StatusCode::SUCCESS;
96 log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
97
98 SmartDataPtr<CalibData::MdcCalibData> test1Copy(m_pCalibDataSvc, fullPath);
99 if(!test1Copy);
100 // CalibData::MdcCalibData test;
101
102 // m_pCalibDataSvc->registerObject(FullPath,test);
103 m_pRootSvc->writeToRoot("Mdc_test.root", fullPath);
104// SmartDataPtr<CalibData::MdcCalibData> test1Copy(m_pCalibDataSvc, fullPath);
105 // if(!test1Copy);
106 return StatusCode::SUCCESS;
107}
108/*
109DataSvc::retrieveObject(fullPath,CalibData::CalibTest1);
110*/
112
113 MsgStream log(msgSvc(), name());
114 log << MSG::INFO
115 << " UseMdcCalibData1 FINALIZE!! "
116 << endreq;
117
118 return StatusCode::SUCCESS;
119}
120
121
IMessageSvc * msgSvc()
virtual StatusCode writeToRoot(const std::string &outputFile, const std::string &tdsPath)=0
virtual std::string getrootfile()=0
StatusCode execute()
StatusCode initialize()
UseMdcCalibData(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode finalize()