BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
UseMuc.cxx
Go to the documentation of this file.
1//$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibROOTCnv/src/test/UseMuc.cxx,v 1.2 2008/04/09 01:02:04 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/Muc/MucCalibData.h"
10#include "CalibData/CalibModel.h"
11#include "GaudiKernel/DataSvc.h"
12#include "CalibDataSvc/ICalibRootSvc.h"
13#include "GaudiKernel/MsgStream.h"
14#include "CalibData/CalibModel.h"
15#include "CalibData/CalibBase1.h"
16#include "CalibData/Muc/MucCalibConst.h"
17//#include "CalibROOTCnv/MucIdTransform.h"
18//#include "MucCalibAlg/MucIdTransform.h"
19
20
21//using namespace std;
22/// Simple algorithm to test functioning of "the other" TDS
23class UseMuc : public Algorithm {
24
25public:
26 UseMuc(const std::string& name, ISvcLocator* pSvcLocator);
27
28 StatusCode initialize();
29
30 StatusCode execute();
31
32 StatusCode finalize();
33
34private:
35
36 IDataProviderSvc* m_pCalibDataSvc;
37 ICalibRootSvc* m_pRootSvc;
38 // MucIdTransform* m_pIdTr;
39 // Maybe something to say which kind of data to look up?
40
41};
42
43/// Instantiation of a static factory to create instances of this algorithm
44//static const AlgFactory<UseMuc> Factory;
45//const IAlgFactory& UseCalibFactory = Factory;
46//const IAlgFactory& UseMucFactory = Factory;
47*/
48#include "UseMuc.h"
49UseMuc::UseMuc( const std::string& name,
50 ISvcLocator* pSvcLocator )
51 : Algorithm ( name, pSvcLocator ), m_pCalibDataSvc(0)
52{
53 // Declare properties here.
54
55}
56
57
58StatusCode UseMuc::initialize() {
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 // m_pIdTr = new MucIdTransform();
93
94 return StatusCode::SUCCESS;
95
96}
97
98
99StatusCode UseMuc::execute( ) {
100
101 MsgStream log(msgSvc(), name());
102/* std::vector<double> emccalib;
103 CalibData::MucCalibData* emc = new CalibData::MucCalibData;
104 //set emcCalibdata--------------------------------
105 for(i=0;i<6000;i++)
106 { emccalib.push_back(i);
107 }
108
109 emc->setDigiCalibConst(&emccalib);
110 emccalib.clear();
111 //set EnCoeff
112 for(i=0;i<43;i++)
113 { emccalib.push_back(1);
114 }
115 emc->setEnCoeff(&emccalib);
116 emccalib.clear();
117 //set PosCoeff
118 for(i=0;i<15;i++)
119 { emccalib.push_back(0);
120 }
121 emc->setPosCoeff(&emccalib);
122 emc->setrunfrm(0);
123 emc->setrunto(0);
124 */
125 //register the emcCalibData into the TCDS ; nelectable
126 std::string fullPath = "/Calib/MucCal";
127 log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
128 // m_pCalibDataSvc->registerObject(fullPath,emc);
129
130 //write the MucCalibData to the rootfile;
131// m_pRootSvc->writeToRoot("./Muc_dat.root", fullPath);
132 //another way,write the MucCalibData without TCDS
133// m_pRootSvc->writeToRoot("./Muc_dat1.root", emc);
134 //retrieve DataObject from the TCDS-----------------
135 SmartDataPtr<CalibData::MucCalibData> test(m_pCalibDataSvc, fullPath);
136 if(!test);
137 std::cout<<"m_uniformEff="<<test->getUniformEff()<<std::endl;
138 std::cout<<"m_UniformNos="<<test->getUniformNos()<<std::endl;
139 std::cout<<"m_UniformClst="<<test->getUniformClst()<<std::endl;
140 for(int i=0;i<LAYER_MAX;i++){
141 std::cout<<"m_layerEff["<<i<<"]="<< test->getLayerEff(i)<<" m_layerNos["<<i<<"]="<<test->getLayerNos(i)<<std::endl;
142 for(int j=0;j<CLST_MAX;j++){
143 std::cout<<"m_layerClstPro["<<i<<"]["<<j<<"]="<<test->getLayerClstPro(i,j)<<std::endl;
144 }
145 }
146
147 for(int i=0; i<PART_MAX; i++)
148 {
149 for(int j=0; j<((i==1)?B_SEG_NUM:E_SEG_NUM); j++)
150 {
151 for(int k=0; k<((i==1)?B_LAY_NUM:E_LAY_NUM); k++)
152 {
153 std::cout << "Box: " << i << "\t" << j << "\t" << k << "\t"
154 << test->getBoxEff(i, j, k) << endl;
155 }
156 }
157 }
158/*
159 int strip_max;
160 for(int i=0; i<PART_MAX; i++)
161 {
162 for(int j=0; j<((i==1)?B_SEG_NUM:E_SEG_NUM); j++)
163 {
164 for(int k=0; k<((i==1)?B_LAY_NUM:E_LAY_NUM); k++)
165 {
166 strip_max = m_pIdTr->GetStripMax(i, j, k);
167 for(int n=0; n<strip_max; n++)
168 {
169 std::cout << "Strip: " << i << "\t" << j << "\t" << k << "\t"
170 << "\t" << n << "\t" << test->getStripEff(i, j, k, n) << endl;
171 }
172 }
173 }
174 }
175*/
176
177 return StatusCode::SUCCESS;
178}
179
180StatusCode UseMuc::finalize( ) {
181
182 MsgStream log(msgSvc(), name());
183 log << MSG::INFO
184 << " UseMuc FINALIZE!! "
185 << endreq;
186
187 return StatusCode::SUCCESS;
188}
189
190
std::string test
Definition: CalibModel.cxx:43
IMessageSvc * msgSvc()
StatusCode finalize()
Definition: UseMuc.cxx:180
UseMuc(const std::string &name, ISvcLocator *pSvcLocator)
Definition: UseMuc.cxx:49
StatusCode execute()
Definition: UseMuc.cxx:99
StatusCode initialize()
Definition: UseMuc.cxx:58