CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
UseTof Class Reference

Simple algorithm to test functioning of "the other" TDS. More...

#include <UseTof.h>

+ Inheritance diagram for UseTof:

Public Member Functions

 UseTof (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Simple algorithm to test functioning of "the other" TDS.

Definition at line 16 of file UseTof.h.

Constructor & Destructor Documentation

◆ UseTof()

UseTof::UseTof ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 46 of file UseTof.cxx.

48 : Algorithm ( name, pSvcLocator ), m_pCalibDataSvc(0)
49{
50 // Declare properties here.
51
52}

Member Function Documentation

◆ execute()

StatusCode UseTof::execute ( )

Definition at line 94 of file UseTof.cxx.

94 {
95
96 MsgStream log(msgSvc(), name());
97
98 // Cheat for now since Windows is having trouble finding definition
99 // of Calibdata::Test_t
100 std::string fullPath = "/Calib/TofCal";
101 log << MSG::INFO<<"execute() fullPath = "<<fullPath<< endreq;
102
103 SmartDataPtr<CalibData::TofCalibData> btof(m_pCalibDataSvc, fullPath);
104
105 TFile *f1 = new TFile("TofCalConst.root","read");
106
107 TTree *btoftree = (TTree*)f1 -> Get("BarTofPar");
108 double fCount[10];
109 double fLeft[5];
110 double fRight[5];
111 btoftree ->SetBranchAddress("FCounter0",&fCount[0]);
112 btoftree ->SetBranchAddress("FCounter1",&fCount[1]);
113 btoftree ->SetBranchAddress("FCounter2",&fCount[2]);
114 btoftree ->SetBranchAddress("FCounter3",&fCount[3]);
115 btoftree ->SetBranchAddress("FCounter4",&fCount[4]);
116 btoftree ->SetBranchAddress("FCounter5",&fCount[5]);
117 btoftree ->SetBranchAddress("FCounter6",&fCount[6]);
118 btoftree ->SetBranchAddress("FCounter7",&fCount[7]);
119 btoftree ->SetBranchAddress("FCounter8",&fCount[8]);
120 btoftree ->SetBranchAddress("FCounter9",&fCount[9]);
121 btoftree->SetBranchAddress("FLeft0",&fLeft[0]);
122 btoftree->SetBranchAddress("FLeft1",&fLeft[1]);
123 btoftree->SetBranchAddress("FLeft2",&fLeft[2]);
124 btoftree->SetBranchAddress("FLeft3",&fLeft[3]);
125 btoftree->SetBranchAddress("FLeft4",&fLeft[4]);
126 btoftree->SetBranchAddress("FRight0",&fRight[0]);
127 btoftree->SetBranchAddress("FRight1",&fRight[1]);
128 btoftree->SetBranchAddress("FRight2",&fRight[2]);
129 btoftree->SetBranchAddress("FRight3",&fRight[3]);
130 btoftree->SetBranchAddress("FRight4",&fRight[4]);
131
132
133
134 for(int i =0;i<176;i++)
135 {
136 btoftree -> GetEntry(i);
137
138 double bAtten0 = btof->getBTofAtten(i,0);
139 double bAtten1 = btof->getBTofAtten(i,1);
140 double bP0 = btof->getBTofPleft(i,0);
141 double bP1 = btof->getBTofPleft(i,1);
142 double bP2 = btof->getBTofPleft(i,2);
143 double bP3 = btof->getBTofPleft(i,3);
144 double bP4 = btof->getBTofPleft(i,4);
145 double bP5 = btof->getBTofPleft(i,5);
146 double bP10 = btof->getBTofPright(i,0);
147
148 // double bQ = btof->getBTofQ(i);
149 double bSpeed0 = btof->getBTofSpeed(i,0);
150 double bSpeed1 = btof->getBTofSpeed(i,1);
151 // double bW1 = btof->getBTofW(i,0);
152 // double bW2 = btof->getBTofW(i,1);
153 // double bW3 = btof->getBTofW(i,2);
154 // double bW4 = btof->getBTofW(i,3);
155 // std::cout<<"=========================================="<<"\n";
156 // std::cout<<"cnt ="<<i<<"\n";
157 double fCount1[10],fLeft1[5],fRight1[5];
158 for(int j=0;j<10;j++){
159 fCount1[j]=btof->getBTofFcounter(i,j);
160 if(fCount1[j]!=fCount[j]) std::cout<<"error error error error"<<std::endl;
161 // std::cout<<"
162 // std::cout<<" fCount["<<j<<"]="<<fCount[j]<<" fCount1["<<j<<"]="<<fCount1[j];
163 }
164 // std::cout<<"\n"<<"=========================================="<<"\n";
165 for(int j=0;j<5;j++){
166 fLeft1[j]=btof->getBTofFleft(i,j);
167 if(fLeft1[j]!=fLeft[j]) std::cout<<"error error error error"<<std::endl;
168 // std::cout<<" fLeft["<<j<<"]="<<fLeft[j];
169 }
170// std::cout<<"\n"<<"=========================================="<<"\n";
171
172 for(int j=0;j<5;j++){
173 fRight1[j]=btof->getBTofFright(i,j);
174 if( fRight1[j]!= fRight[j]) std::cout<<"error error error error"<<std::endl;
175 // std::cout<<" fRight["<<j<<"]="<<fRight[j];
176 }
177
178
179 /* std::cout<<"Atten0="<<bAtten0<<"Atten1="<<bAtten1<<"Q="<<bQ<<"Speed0="<<bSpeed0<<"Speed1="<<bSpeed1<<"P0="<<bP0<<"P1="<<bP1<<"P2="<<bP2<<"P3="<<bP3<<"P4="<<bP4<<"P10="<<bP10;
180 std::cout<<"\n";
181 std::cout<<"P5="<<bP5<<"Q="<<bQ;
182 std::cout<<"W1="<<bW1<<"W2="<<bW2<<"W3="<<bW3<<"W4="<<bW4;
183 std::cout<<"\n";*/
184 /*
185 std::cout<<"Atten[1]="<<*(bAtten+1)<<"P0[1]="<<*(bP0+1)<<"P1[1]="<<*(bP1+1)<<"P2[1]="<<*(bP2+1)<<"P3[1]="<<*(bP3+1)<<"P4[1]="<<*(bP4+1);
186 std::cout<<"\n";
187 std::cout<<"P5[1]="<<*(bP5+1)<<"S[1]="<<*(bS+1)<<"SS[1]="<<*(bSS+1)<<"Veff[1]="<<*(bVeff+1);
188 */
189 }
190/* for(int i =0;i<96;i++)
191 {
192 double eAtten0 = btof->getETofAtten(i,0);
193 double eAtten1 = btof->getETofAtten(i,1);
194 double eP0 = btof->getETofP(i,0);
195 double eP1 = btof->getETofP(i,1);
196 double eP2 = btof->getETofP(i,2);
197 double eP3 = btof->getETofP(i,3);
198 double eP4 = btof->getETofP(i,4);
199 double eP5 = btof->getETofP(i,5);
200 double eP6 = btof->getETofP(i,6);
201 double eSpeed0 = btof->getETofSpeed(i,0);
202 double eSpeed1 = btof->getETofSpeed(i,1);
203
204 std::cout<<"=========================================="<<"\n";
205 std::cout<<"cnt ="<<i<<"\n";
206
207 std::cout<<"Atten0="<<eAtten0<<"Atten1="<<eAtten1<<"Speed0="<<eSpeed0<<"Speed1="<<eSpeed1<<"P0="<<eP0<<"P1="<<eP1<<"P2="<<eP2<<"P3="<<eP3<<"P4="<<eP4<<"P6="<<eP6;
208 std::cout<<"\n";
209 std::cout<<"P5="<<eP5;
210 std::cout<<"\n";
211 }
212*/
213
214/*double P_b[20];
215 TTree *btofinnertree = (TTree*)f1 -> Get("BarTofParInner");
216 btofinnertree->SetBranchAddress("P0",&P_b[0]);
217 btofinnertree->SetBranchAddress("P1",&P_b[1]);
218 btofinnertree->SetBranchAddress("P2",&P_b[2]);
219 btofinnertree->SetBranchAddress("P3",&P_b[3]);
220 btofinnertree->SetBranchAddress("P4",&P_b[4]);
221 btofinnertree->SetBranchAddress("P5",&P_b[5]);
222 btofinnertree->SetBranchAddress("P6",&P_b[6]);
223 btofinnertree->SetBranchAddress("P7",&P_b[7]);
224 btofinnertree->SetBranchAddress("P8",&P_b[8]);
225 btofinnertree->SetBranchAddress("P9",&P_b[9]);
226 btofinnertree->SetBranchAddress("P10",&P_b[10]);
227 btofinnertree->SetBranchAddress("P11",&P_b[11]);
228 btofinnertree->SetBranchAddress("P12",&P_b[12]);
229 btofinnertree->SetBranchAddress("P13",&P_b[13]);
230 btofinnertree->SetBranchAddress("P14",&P_b[14]);
231 btofinnertree->SetBranchAddress("P15",&P_b[15]);
232 btofinnertree->SetBranchAddress("P16",&P_b[16]);
233 btofinnertree->SetBranchAddress("P17",&P_b[17]);
234 btofinnertree->SetBranchAddress("P18",&P_b[18]);
235 btofinnertree->SetBranchAddress("P19",&P_b[19]);
236
237 for(int i=0;i<88;i++){
238 btofinnertree->GetEntry(i);
239 double P[20];
240 std::cout<<"\n"<<" i================= "<<i<<std::endl;
241 for(int j=0;j<10;j++){
242 // P[j]=btof->getBTofInnerPleft(i,j);
243
244 std::cout<<" P["<<j<<"]"<< P[j];
245 }
246
247 for(int j=0;j<10;j++){
248// P[j+10]=btof->getBTofInnerPright(i,j);
249 std::cout<<" P["<<j+10<<"]"<< P[j+10];
250}
251*/
252/*if(P_b[16]!=P[16]){
253 std::cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<std::endl;
254 std::cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<std::endl;
255 std::cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<std::endl;
256 std::cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<std::endl;
257 std::cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<std::endl;
258std::cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<std::endl;
259 std::cout<<"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"<<std::endl;
260}
261 std::cout<<"\n";
262if(P[16]>0){
263std::cout<<"aaa"<<std::endl;
264}
265std::cout<<"P_b[16]===="<<P_b[16]<<"P_[16]"<<P[16]<<std::endl;
266 }
267 */
268 double sigma[8];
269
270 for(int i=0;i<8;i++){
271 sigma[i]=btof->getBTofSigmaCorr(i);
272 std::cout<<" sigma["<<i<<"]="<< sigma[i];
273}
274 std::cout<<"\n";
275
276 std::cout<<"t0offset0 ="<< btof->getBTofOffset(0)<<" t0offset1 ="<< btof->getBTofOffset(1)<<std::endl;
277
278std::cout<<" btof->getRunBegin()"<<btof->getRunBegin();
279 std::cout<<"btof->getRunEnd()"<<btof->getRunEnd();
280 std::cout<<"btof->getVersion()"<<btof->getVersion();
281 std::cout<<"btof->getQCorr()"<<btof->getQCorr();
282 std::cout<<"btof->getMisLable()"<<btof->getMisLable();
283 std::cout<<"btof->getQElec()"<<btof->getQElec();
284 for(int i=0;i<5;i++){
285 std::cout<<"i==="<<i<<std::endl;
286 std::cout<<" btof->getBrEast(int index)"<<btof->getBrEast(i);
287 std::cout<<" btof->getBrWest(int index)"<<btof->getBrWest(i);
288 std::cout<<" btof->getEndcap(int index)"<<btof->getEndcap(i);
289}
290 //maqm comment because cann't write
291 // m_pRootSvc->writeToRoot("./Tof_test.root", fullPath);
292
293 return StatusCode::SUCCESS;
294}
TFile * f1
data GetEntry(0)
IMessageSvc * msgSvc()

◆ finalize()

StatusCode UseTof::finalize ( )

Definition at line 298 of file UseTof.cxx.

298 {
299
300 MsgStream log(msgSvc(), name());
301 log << MSG::INFO
302 << " UseTof FINALIZE!! "
303 << endreq;
304
305 return StatusCode::SUCCESS;
306}

◆ initialize()

StatusCode UseTof::initialize ( )

Definition at line 55 of file UseTof.cxx.

55 {
56 StatusCode sc;
57 MsgStream log(msgSvc(), name());
58 log << MSG::INFO << "Initialize()" << endreq;
59
60 // So far don't have any properties, but in case we do some day..
61// setProperties();
62
63 log<<MSG::INFO << "setProperties()" << endreq;
64
65 sc = service("CalibDataSvc", m_pCalibDataSvc, true);
66
67 if ( !sc.isSuccess() ) {
68 log << MSG::ERROR
69 << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
70 << endreq;
71 return sc;
72 } else {
73 log << MSG::DEBUG
74 << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"
75 << endreq;
76 }
77
78 sc = service("CalibRootCnvSvc", m_pRootSvc, true);
79 if ( !sc.isSuccess() ) {
80 log << MSG::ERROR
81 << "Could not get ICalibRootSvc interface of CalibRootCnvSvc"
82 << endreq;
83 return sc;
84 }
85 // Get properties from the JobOptionsSvc
86
87 sc = setProperties();
88
89 return StatusCode::SUCCESS;
90
91}

The documentation for this class was generated from the following files: