17class UseTof : public Algorithm {
20 UseTof(const std::string& name, ISvcLocator* pSvcLocator);
22 StatusCode initialize();
26 StatusCode finalize();
29 IDataProviderSvc* m_pCalibDataSvc;
30 ICalibRootSvc* m_pRootSvc;
31 // Maybe something to say which kind of data to look up?
36//static const AlgFactory<UseTof> Factory;
37//const IAlgFactory& UseCalibFactory = Factory;
38//const IAlgFactory& UseTofFactory = Factory;
43#include "TDirectory.h"
47 ISvcLocator* pSvcLocator )
48 : Algorithm ( name, pSvcLocator ), m_pCalibDataSvc(0)
57 MsgStream log(
msgSvc(), name());
58 log << MSG::INFO <<
"Initialize()" << endreq;
63 log<<MSG::INFO <<
"setProperties()" << endreq;
65 sc = service(
"CalibDataSvc", m_pCalibDataSvc,
true);
67 if ( !sc.isSuccess() ) {
69 <<
"Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
74 <<
"Retrieved IDataProviderSvc interface of CalibXmlCnvSvc"
78 sc = service(
"CalibRootCnvSvc", m_pRootSvc,
true);
79 if ( !sc.isSuccess() ) {
81 <<
"Could not get ICalibRootSvc interface of CalibRootCnvSvc"
89 return StatusCode::SUCCESS;
96 MsgStream log(
msgSvc(), name());
100 std::string fullPath =
"/Calib/TofCal";
101 log << MSG::INFO<<
"execute() fullPath = "<<fullPath<< endreq;
103 SmartDataPtr<CalibData::TofCalibData> btof(m_pCalibDataSvc, fullPath);
105 TFile *
f1 =
new TFile(
"TofCalConst.root",
"read");
107 TTree *btoftree = (TTree*)
f1 -> Get(
"BarTofPar");
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]);
134 for(
int i =0;i<176;i++) {
137 double bAtten0 = btof->getBTofAtten(i,0);
138 double bAtten1 = btof->getBTofAtten(i,1);
139 double bP0 = btof->getBTofPleft(i,0);
140 double bP1 = btof->getBTofPleft(i,1);
141 double bP2 = btof->getBTofPleft(i,2);
142 double bP3 = btof->getBTofPleft(i,3);
143 double bP4 = btof->getBTofPleft(i,4);
144 double bP5 = btof->getBTofPleft(i,5);
145 double bP10 = btof->getBTofPright(i,0);
148 double bSpeed0 = btof->getBTofSpeed(i,0);
149 double bSpeed1 = btof->getBTofSpeed(i,1);
156 double fCount1[10],fLeft1[5],fRight1[5];
157 for(
int j=0;j<10;j++){
158 fCount1[j]=btof->getBTofFcounter(i,j);
159 if(fCount1[j]!=fCount[j]) std::cout<<
"error error error error"<<std::endl;
164 for(
int j=0;j<5;j++){
165 fLeft1[j]=btof->getBTofFleft(i,j);
166 if(fLeft1[j]!=fLeft[j]) std::cout<<
"error error error error"<<std::endl;
171 for(
int j=0;j<5;j++){
172 fRight1[j]=btof->getBTofFright(i,j);
173 if( fRight1[j]!= fRight[j]) std::cout<<
"error error error error"<<std::endl;
269 for(
int i=0;i<8;i++){
270 sigma[i]=btof->getBTofSigmaCorr(0,i);
271 std::cout<<
" sigma["<<i<<
"]="<<
sigma[i];
275 std::cout<<
" btof->getRunBegin()"<<btof->getRunBegin(0);
276 std::cout<<
"btof->getRunEnd()"<<btof->getRunEnd(0);
277 std::cout<<
"btof->getVersion()"<<btof->getVersion(0);
278 std::cout<<
"btof->getQCorr()"<<btof->getQCorr(0);
279 std::cout<<
"btof->getMisLable()"<<btof->getMisLable(0);
280 std::cout<<
"btof->getQElec()"<<btof->getQElec(0);
281 for(
int i=0;i<5;i++){
282 std::cout<<
"i==="<<i<<std::endl;
283 std::cout<<
" btof->getBrEast(int index)"<<btof->getBrEast(0,i);
284 std::cout<<
" btof->getBrWest(int index)"<<btof->getBrWest(0,i);
285 std::cout<<
" btof->getEndcap(int index)"<<btof->getEndcap(0,i);
290 return StatusCode::SUCCESS;
297 MsgStream log(
msgSvc(), name());
299 <<
" UseTof FINALIZE!! "
302 return StatusCode::SUCCESS;
UseTof(const std::string &name, ISvcLocator *pSvcLocator)