BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
checkEstTof.cxx
Go to the documentation of this file.
1//$Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibTreeCnv/src/test/checkEstTof.cxx,v 1.2
2//2010/10/14 05:33:40 huangb Exp $
3/*#include <stdio.h>
4#include "CalibData/CalibModel.h"
5#include "CalibData/Tof/TofCalibData.h"
6#include "CalibData/Tof/bTofCalibBase.h"
7#include "CalibDataSvc/ICalibTreeSvc.h"
8#include "GaudiKernel/AlgFactory.h"
9#include "GaudiKernel/Algorithm.h"
10#include "GaudiKernel/DataSvc.h"
11#include "GaudiKernel/IDataProviderSvc.h"
12#include "GaudiKernel/MsgStream.h"
13#include "GaudiKernel/Service.h"
14#include "GaudiKernel/SmartDataPtr.h"
15using namespace std;
16/// Simple algorithm to test functioning of "the other" TDS
17class checkTof : public Algorithm {
18
19public:
20 checkTof(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<checkTof> Factory;
37//const IAlgFactory& UseCalibFactory = Factory;
38//const IAlgFactory& checkTofFactory = Factory;
39*/
40#include "checkEstTof.h"
41checkEstTof::checkEstTof( 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
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/EstTofCal";
87 log << MSG::INFO << "execute() fullPath = " << fullPath << endmsg;
88
89 SmartDataPtr<CalibData::TofCalibData> btof( m_pCalibDataSvc, fullPath );
90
91 for ( int i = 0; i < 176; i++ )
92 {
93 double bAtten0 = btof->getBTofAtten( i, 0 );
94 double bAtten1 = btof->getBTofAtten( i, 1 );
95 double bP0 = btof->getBTofPleft( i, 0 );
96 double bP1 = btof->getBTofPleft( i, 1 );
97 double bP2 = btof->getBTofPleft( i, 2 );
98 double bP3 = btof->getBTofPleft( i, 3 );
99 double bP4 = btof->getBTofPleft( i, 4 );
100 double bP5 = btof->getBTofPleft( i, 5 );
101 double bP10 = btof->getBTofPright( i, 0 );
102
103 // double bQ = btof->getBTofQ(i);
104 double bSpeed0 = btof->getBTofSpeed( i, 0 );
105 double bSpeed1 = btof->getBTofSpeed( i, 1 );
106 // double bW1 = btof->getBTofW(i,0);
107 // double bW2 = btof->getBTofW(i,1);
108 // double bW3 = btof->getBTofW(i,2);
109 // double bW4 = btof->getBTofW(i,3);
110 std::cout << "=========================================="
111 << "\n";
112 std::cout << "cnt =" << i << "\n";
113 std::cout << "Atten0=" << bAtten0 << "Atten1=" << bAtten1 << "Q="
114 << "bQ "
115 << "Speed0=" << bSpeed0 << "Speed1=" << bSpeed1 << "P0=" << bP0 << "P1=" << bP1
116 << "P2=" << bP2 << "P3=" << bP3 << "P4=" << bP4 << "P10=" << bP10;
117 std::cout << "\n";
118 std::cout << "P5=" << bP5 << "Q="
119 << "bQ";
120 // std::cout<<"W1="<<bW1<<"W2="<<bW2<<"W3="<<bW3<<"W4="<<bW4;
121 std::cout << "\n";
122
123 /*
124 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);
125 std::cout<<"\n";
126 std::cout<<"P5[1]="<<*(bP5+1)<<"S[1]="<<*(bS+1)<<"SS[1]="<<*(bSS+1)<<"Veff[1]="<<*(bVeff+1);
127 */
128 }
129 for ( int i = 0; i < 96; i++ )
130 {
131 double eAtten0 = btof->getETofAtten( i, 0 );
132 double eAtten1 = btof->getETofAtten( i, 1 );
133 double eP0 = btof->getETofP( i, 0 );
134 double eP1 = btof->getETofP( i, 1 );
135 double eP2 = btof->getETofP( i, 2 );
136 double eP3 = btof->getETofP( i, 3 );
137 double eP4 = btof->getETofP( i, 4 );
138 double eP5 = btof->getETofP( i, 5 );
139 double eP6 = btof->getETofP( i, 6 );
140
141 double eSpeed0 = btof->getETofSpeed( i, 0 );
142 double eSpeed1 = btof->getETofSpeed( i, 1 );
143
144 std::cout << "=========================================="
145 << "\n";
146 std::cout << "cnt =" << i << "\n";
147
148 std::cout << "Atten0=" << eAtten0 << "Atten1=" << eAtten1 << "Speed0=" << eSpeed0
149 << "Speed1=" << eSpeed1 << "P0=" << eP0 << "P1=" << eP1 << "P2=" << eP2
150 << "P3=" << eP3 << "P4=" << eP4 << "P6=" << eP6;
151 std::cout << "\n";
152 std::cout << "P5=" << eP5;
153 std::cout << "\n";
154 }
155 // maqm comment because cann't write
156 // m_pTreeSvc->writeToTree("./Tof_test.root", fullPath);
157
158 return StatusCode::SUCCESS;
159}
160/*
161DataSvc::retrieveObject(fullPath,CalibData::CalibTest1);
162*/
164
165 MsgStream log( msgSvc(), name() );
166 log << MSG::INFO << " checkEstTof FINALIZE!! " << endmsg;
167
168 return StatusCode::SUCCESS;
169}
IMessageSvc * msgSvc()
StatusCode initialize()
StatusCode execute()
StatusCode finalize()
checkEstTof(const std::string &name, ISvcLocator *pSvcLocator)