BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
UseEstTof.cxx
Go to the documentation of this file.
1//$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibROOTCnv/src/test/UseEstTof.cxx,v 1.2 2009/09/22 07:40:45 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/Tof/EstTofCalibData.h"
10#include "CalibData/Tof/bTofCalibBase.h"
11#include "CalibData/CalibModel.h"
12#include "GaudiKernel/DataSvc.h"
13#include "CalibDataSvc/ICalibRootSvc.h"
14
15using namespace std;
16/// Simple algorithm to test functioning of "the other" TDS
17class UseTof : public Algorithm {
18
19public:
20 UseTof(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 ICalibRootSvc* m_pRootSvc;
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<UseTof> Factory;
37//const IAlgFactory& UseCalibFactory = Factory;
38//const IAlgFactory& UseTofFactory = Factory;
39*/
40#include "UseEstTof.h"
41#include "TFile.h"
42#include "TTree.h"
43#include "TDirectory.h"
44#include "TObject.h"
48
49UseEstTof::UseEstTof( const std::string& name,
50 ISvcLocator* pSvcLocator )
51 : Algorithm ( name, pSvcLocator ), m_pCalibDataSvc(0)
52{
53 // Declare properties here.
54
55}
56
57
59 StatusCode sc;
60 MsgStream log(msgSvc(), name());
61 log << MSG::INFO << "Initialize()" << endreq;
62
63 // So far don't have any properties, but in case we do some day..
64// setProperties();
65
66 log<<MSG::INFO << "setProperties()" << endreq;
67
68 sc = service("CalibDataSvc", m_pCalibDataSvc, true);
69
70 if ( !sc.isSuccess() ) {
71 log << MSG::ERROR
72 << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
73 << endreq;
74 return sc;
75 } else {
76 log << MSG::DEBUG
77 << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"
78 << endreq;
79 }
80
81 sc = service("CalibRootCnvSvc", m_pRootSvc, true);
82 if ( !sc.isSuccess() ) {
83 log << MSG::ERROR
84 << "Could not get ICalibRootSvc interface of CalibRootCnvSvc"
85 << endreq;
86 return sc;
87 }
88 // Get properties from the JobOptionsSvc
89
90 sc = setProperties();
91
92 return StatusCode::SUCCESS;
93
94}
95
96
97StatusCode UseEstTof::execute( ) {
98
99 MsgStream log(msgSvc(), name());
100
101 // Cheat for now since Windows is having trouble finding definition
102 // of Calibdata::Test_t
103 std::string fullPath = "/Calib/TofQElec";
104 log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
105
106 SmartDataPtr<CalibData::TofElecData> btof(m_pCalibDataSvc, fullPath);
107
108 for(int i =0;i<96;i++)
109 {
110 CalibData::BarrelElec aa = btof->getBTof(i);
111 CalibData::EndcapElec bb = btof->getETof(i);
112 std::cout<<"i==========="<<i<<std::endl;
113 for(int j=0;j<4;j++){
114 std::cout<<"getNumEast=="<<aa.getNumEast(j)<<" getNumWest=="<<aa.getNumWest(j)<<std::endl;
115 std::cout<<"getEast=="<<bb.getNum(j)<<std::endl;
116 }
117 for(int j=0;j<10;j++){
118 std::cout<<"j==="<<j<<std::endl;
119 std::cout<<" getP1=="<<aa.getP1(j)<<std::endl;
120 std::cout<<" getP2=="<<aa.getP2(j)<<std::endl;
121 std::cout<<" getSimP1=="<<aa.getSimP1(j)<<std::endl;
122 std::cout<<" getSimP2=="<<aa.getSimP2(j)<<std::endl;
123 std::cout<<" getP=="<<bb.getP(j)<<std::endl;
124 std::cout<<" getSimP=="<<bb.getSimP(j)<<std::endl;
125 }
126 }
127
128
129
130
131
132 //maqm comment because cann't write
133 // m_pRootSvc->writeToRoot("./Tof_test.root", fullPath);
134
135 return StatusCode::SUCCESS;
136}
137/*
138DataSvc::retrieveObject(fullPath,CalibData::CalibTest1);
139*/
140StatusCode UseEstTof::finalize( ) {
141
142 MsgStream log(msgSvc(), name());
143 log << MSG::INFO
144 << " UseTof FINALIZE!! "
145 << endreq;
146
147 return StatusCode::SUCCESS;
148}
149
IMessageSvc * msgSvc()
StatusCode execute()
Definition: UseEstTof.cxx:97
StatusCode initialize()
Definition: UseEstTof.cxx:58
UseEstTof(const std::string &name, ISvcLocator *pSvcLocator)
Definition: UseEstTof.cxx:49
StatusCode finalize()
Definition: UseEstTof.cxx:140