BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
checkEmc.cxx
Go to the documentation of this file.
1//$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibTreeCnv/src/test/checkEmc.cxx,v 1.1.1.1
2//2008/04/09 02:08:13 huangb Exp $
3/*#include <stdio.h>
4#include "CalibData/Emc/EmcCalibData.h"
5#include "GaudiKernel/AlgFactory.h"
6#include "GaudiKernel/Algorithm.h"
7#include "GaudiKernel/IDataProviderSvc.h"
8#include "GaudiKernel/MsgStream.h"
9#include "GaudiKernel/Service.h"
10#include "GaudiKernel/SmartDataPtr.h"
11//#include "CalibData/Emc/bEmcCalibBase.h"
12#include "CalibData/CalibModel.h"
13#include "CalibDataSvc/ICalibTreeSvc.h"
14#include "GaudiKernel/DataSvc.h"
15using namespace std;
16/// Simple algorithm to test functioning of "the other" TDS
17class checkEmc : public Algorithm {
18
19public:
20 checkEmc(const std::string& name, ISvcLocator* pSvcLocator);
21
22 StatusCode initialize();
23
24 StatusCode execute();
25
26 StatusCode finalize();
27
28private:
29 IDataProviderSvc* m_pCalibDataSvc;
30 ICalibTreeSvc* m_pTreeSvc;
31 // Maybe something to say which kind of data to look up?
32
33};
34*/
35/// Instantiation of a static factory to create instances of this algorithm
36// static const AlgFactory<checkEmc> Factory;
37// const IAlgFactory& UseCalibFactory = Factory;
38// const IAlgFactory& checkEmcFactory = Factory;
39#include "checkEmc.h"
40
41checkEmc::checkEmc( const std::string& name, ISvcLocator* pSvcLocator )
42 : Algorithm( name, pSvcLocator ), m_pCalibDataSvc( 0 ) {
43 // Declare properties here.
44}
45
47 StatusCode sc;
48 MsgStream log( msgSvc(), name() );
49 log << MSG::INFO << "Initialize()" << endmsg;
50
51 // So far don't have any properties, but in case we do some day..
52 // setProperties();
53
54 log << MSG::INFO << "setProperties()" << endmsg;
55
56 sc = service( "CalibDataSvc", m_pCalibDataSvc, true );
57
58 if ( !sc.isSuccess() )
59 {
60 log << MSG::ERROR << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
61 << endmsg;
62 return sc;
63 }
64 else
65 { log << MSG::DEBUG << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" << endmsg; }
66
67 sc = service( "CalibTreeCnvSvc", m_pTreeSvc, true );
68 if ( !sc.isSuccess() )
69 {
70 log << MSG::ERROR << "Could not get ICalibTreeSvc interface of CalibTreeCnvSvc" << endmsg;
71 return sc;
72 }
73 // Get properties from the JobOptionsSvc
74
75 sc = setProperties();
76
77 return StatusCode::SUCCESS;
78}
79
80StatusCode checkEmc::execute() {
81
82 MsgStream log( msgSvc(), name() );
83
84 // Cheat for now since Windows is having trouble finding definition
85 // of Calibdata::Test_t
86 std::string fullPath = "/Calib/EmcCal";
87 log << MSG::INFO << "execute() fullPath = " << fullPath << endmsg;
88 SmartDataPtr<CalibData::EmcCalibData> test( m_pCalibDataSvc, fullPath );
89 int no1 = test->getDigiCalibConstNo();
90 for ( int i = 0; i < no1; i++ )
91 {
92 double aa = test->getDigiCalibConst( i );
93 std::cout << "getDigiCalibConst(" << i << ")=========" << aa << endl;
94 }
95 return StatusCode::SUCCESS;
96}
97/*
98DataSvc::retrieveObject(fullPath,CalibData::CalibTest1);
99*/
100StatusCode checkEmc::finalize() {
101
102 MsgStream log( msgSvc(), name() );
103 log << MSG::INFO << " checkEmc FINALIZE!! " << endmsg;
104
105 return StatusCode::SUCCESS;
106}
std::string test
IMessageSvc * msgSvc()
checkEmc(const std::string &name, ISvcLocator *pSvcLocator)
Instantiation of a static factory to create instances of this algorithm.
Definition checkEmc.cxx:41
StatusCode initialize()
Definition checkEmc.cxx:46
StatusCode finalize()
Definition checkEmc.cxx:100
StatusCode execute()
Definition checkEmc.cxx:80