BOSS 8.0.0
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
2//2009/09/22 07:40:45 huangb Exp $
3/*#include <stdio.h>
4#include "CalibData/CalibModel.h"
5#include "CalibData/Tof/EstTofCalibData.h"
6#include "CalibData/Tof/bTofCalibBase.h"
7#include "CalibDataSvc/ICalibRootSvc.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"
15
16using namespace std;
17/// Simple algorithm to test functioning of "the other" TDS
18class UseTof : public Algorithm {
19
20public:
21 UseTof(const std::string& name, ISvcLocator* pSvcLocator);
22
23 StatusCode initialize();
24
25 StatusCode execute();
26
27 StatusCode finalize();
28
29private:
30 IDataProviderSvc* m_pCalibDataSvc;
31 ICalibRootSvc* m_pRootSvc;
32 // Maybe something to say which kind of data to look up?
33
34};
35
36/// Instantiation of a static factory to create instances of this algorithm
37//static const AlgFactory<UseTof> Factory;
38//const IAlgFactory& UseCalibFactory = Factory;
39//const IAlgFactory& UseTofFactory = Factory;
40*/
41#include "CalibData/Tof/BarrelElec.h"
42#include "CalibData/Tof/EndcapElec.h"
43#include "CalibData/Tof/TofElecData.h"
44#include "TDirectory.h"
45#include "TFile.h"
46#include "TObject.h"
47#include "TTree.h"
48#include "UseEstTof.h"
49
50UseEstTof::UseEstTof( const std::string& name, ISvcLocator* pSvcLocator )
51 : Algorithm( name, pSvcLocator ), m_pCalibDataSvc( 0 ) {
52 // Declare properties here.
53}
54
56 StatusCode sc;
57 MsgStream log( msgSvc(), name() );
58 log << MSG::INFO << "Initialize()" << endmsg;
59
60 // So far don't have any properties, but in case we do some day..
61 // setProperties();
62
63 log << MSG::INFO << "setProperties()" << endmsg;
64
65 sc = service( "CalibDataSvc", m_pCalibDataSvc, true );
66
67 if ( !sc.isSuccess() )
68 {
69 log << MSG::ERROR << "Could not get IDataProviderSvc interface of CalibXmlCnvSvc"
70 << endmsg;
71 return sc;
72 }
73 else
74 { log << MSG::DEBUG << "Retrieved IDataProviderSvc interface of CalibXmlCnvSvc" << endmsg; }
75
76 sc = service( "CalibRootCnvSvc", m_pRootSvc, true );
77 if ( !sc.isSuccess() )
78 {
79 log << MSG::ERROR << "Could not get ICalibRootSvc interface of CalibRootCnvSvc" << endmsg;
80 return sc;
81 }
82 // Get properties from the JobOptionsSvc
83
84 sc = setProperties();
85
86 return StatusCode::SUCCESS;
87}
88
89StatusCode UseEstTof::execute() {
90
91 MsgStream log( msgSvc(), name() );
92
93 // Cheat for now since Windows is having trouble finding definition
94 // of Calibdata::Test_t
95 std::string fullPath = "/Calib/TofQElec";
96 log << MSG::INFO << "execute() fullPath = " << fullPath << endmsg;
97
98 SmartDataPtr<CalibData::TofElecData> btof( m_pCalibDataSvc, fullPath );
99
100 for ( int i = 0; i < 96; i++ )
101 {
102 CalibData::BarrelElec aa = btof->getBTof( i );
103 CalibData::EndcapElec bb = btof->getETof( i );
104 std::cout << "i===========" << i << std::endl;
105 for ( int j = 0; j < 4; j++ )
106 {
107 std::cout << "getNumEast==" << aa.getNumEast( j )
108 << " getNumWest==" << aa.getNumWest( j ) << std::endl;
109 std::cout << "getEast==" << bb.getNum( j ) << std::endl;
110 }
111 for ( int j = 0; j < 10; j++ )
112 {
113 std::cout << "j===" << j << std::endl;
114 std::cout << " getP1==" << aa.getP1( j ) << std::endl;
115 std::cout << " getP2==" << aa.getP2( j ) << std::endl;
116 std::cout << " getSimP1==" << aa.getSimP1( j ) << std::endl;
117 std::cout << " getSimP2==" << aa.getSimP2( j ) << std::endl;
118 std::cout << " getP==" << bb.getP( j ) << std::endl;
119 std::cout << " getSimP==" << bb.getSimP( j ) << std::endl;
120 }
121 }
122
123 // maqm comment because cann't write
124 // m_pRootSvc->writeToRoot("./Tof_test.root", fullPath);
125
126 return StatusCode::SUCCESS;
127}
128/*
129DataSvc::retrieveObject(fullPath,CalibData::CalibTest1);
130*/
132
133 MsgStream log( msgSvc(), name() );
134 log << MSG::INFO << " UseTof FINALIZE!! " << endmsg;
135
136 return StatusCode::SUCCESS;
137}
IMessageSvc * msgSvc()
StatusCode execute()
Definition UseEstTof.cxx:89
StatusCode initialize()
Definition UseEstTof.cxx:55
UseEstTof(const std::string &name, ISvcLocator *pSvcLocator)
Definition UseEstTof.cxx:50
StatusCode finalize()