CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcCalibConstSvc.cxx
Go to the documentation of this file.
2#include "GaudiKernel/Kernel.h"
3#include "GaudiKernel/IInterface.h"
4#include "GaudiKernel/StatusCode.h"
5#include "GaudiKernel/SvcFactory.h"
6#include "GaudiKernel/MsgStream.h"
7
8#include "GaudiKernel/ISvcLocator.h"
9#include "GaudiKernel/Bootstrap.h"
10
11#include "GaudiKernel/IDataProviderSvc.h"
12#include "GaudiKernel/SmartDataPtr.h"
13#include "GaudiKernel/DataSvc.h"
14
18
19#include <vector>
20#include <math.h>
21
22
23EmcCalibConstSvc::EmcCalibConstSvc( const std::string& name, ISvcLocator* svcloc) :
24 Service (name, svcloc) {
25}
26
30
31StatusCode EmcCalibConstSvc::queryInterface(const InterfaceID& riid, void** ppvInterface){
32 if( IID_IEmcCalibConstSvc.versionMatch(riid) ){
33 *ppvInterface = static_cast<IEmcCalibConstSvc*> (this);
34 } else{
35 return Service::queryInterface(riid, ppvInterface);
36 }
37 return StatusCode::SUCCESS;
38}
39
41 MsgStream log(messageService(), name());
42 log << MSG::INFO << "EmcCalibConstSvc::initialize()" << endreq;
43
44 StatusCode sc = Service::initialize();
45 if( sc.isFailure() ) return sc;
46
47 sc = service("CalibDataSvc", m_calDataSvc, true);
48 if( sc == StatusCode::SUCCESS ){
49 log << MSG::INFO << "Retrieve IDataProviderSvc" << endreq;
50 }else{
51 log << MSG::FATAL << "can not get IDataProviderSvc" << endreq;
52 }
53
54 // sc = service("EmcRecGeoSvc", m_emcGeomSvc);
55 // if( sc != StatusCode::SUCCESS ){
56 // log << MSG::ERROR << "can not use EmcRecGeoSvc" << endreq;
57 // }
58
61
62 //Dump();
63
64 return StatusCode::SUCCESS;
65}
66
68
69 delete m_theEmcStruc;
70
71 MsgStream log(messageService(), name());
72 log << MSG::INFO << "EmcCalibConstSvc::finalize()" << endreq;
73 return StatusCode::SUCCESS;
74
75}
76
78 {
79 double digiCalibConst = 0.0;
80 MsgStream log(messageService(), name());
81
82 std::string fullPath = "/Calib/EmcCal";
83 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
84 if( ! calConst ){
85 log << MSG::ERROR << "can not access to EmcDigi CalibData via SmartPtr"
86 << endreq;
87 }else {
88 digiCalibConst = calConst->getDigiCalibConst(No);
89 }
90
91 return digiCalibConst;
92}
93
95 {
96 int IxtalNumber = 999999;
97 MsgStream log(messageService(), name());
98
99 std::string fullPath = "/Calib/EmcCal";
100 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
101 if( ! calConst ){
102 log << MSG::ERROR << "can not access to EmcDigi CalibData via SmartPtr"
103 << endreq;
104 }else {
105 IxtalNumber = calConst->getIxtalNumber(No);
106 }
107
108 return IxtalNumber;
109}
110
112 {
113 int digiCalibConstNo = 0;
114 MsgStream log(messageService(), name());
115
116 std::string fullPath = "/Calib/EmcCal";
117 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
118 if( ! calConst ){
119 log << MSG::ERROR << "can not access to EmcDigiNo CalibData via SmartPtr"
120 << endreq;
121 }else {
122 digiCalibConstNo = calConst->getDigiCalibConstNo();
123 }
124
125 return digiCalibConstNo;
126}
127
129 {
130 int IxtalNumberNo = 0;
131 MsgStream log(messageService(), name());
132
133 std::string fullPath = "/Calib/EmcCal";
134 SmartDataPtr<CalibData::EmcCalibData> calConst(m_calDataSvc, fullPath);
135 if( ! calConst ){
136 log << MSG::ERROR << "can not access to EmcDigiNo CalibData via SmartPtr"
137 << endreq;
138 }else {
139 IxtalNumberNo = calConst->getIxtalNumberNo();
140 }
141
142 return IxtalNumberNo;
143}
144
145
146
147int EmcCalibConstSvc::getIndex( unsigned int PartId,
148 unsigned int ThetaIndex,
149 unsigned int PhiIndex) const
150{
151 return m_theEmcStruc->getGeomIndex(PartId, ThetaIndex, PhiIndex);
152}
153
154
155unsigned int EmcCalibConstSvc::getPartID(int Index) const
156{
157 return m_theEmcStruc->getPartId(Index);
158}
159
160unsigned int EmcCalibConstSvc::getThetaIndex( int Index) const
161{
162 return m_theEmcStruc->getTheta(Index);
163}
164
165unsigned int EmcCalibConstSvc::getPhiIndex( int Index) const
166{
167 return m_theEmcStruc->getPhi(Index);
168}
169
170
172{
173 for(int iNo=0;iNo<6;iNo++){
174 cout<<"getDigiCalibConst "<<getDigiCalibConst(iNo)<<endl;
175 }
176
177 cout<<"getDigiCalibConstNo "<<getDigiCalibConstNo()<<endl;
178
179
180 cout<<"ind"<<" "<<"getThetaIndex(ind)"<<" "
181 <<"getPhiIndex(ind)"<<"getPartID"<<endl;
182
183 for(int ind=0; ind<6240;ind++){
184
185 cout<<ind<<" "<<getThetaIndex(ind)<<" "
186 <<getPhiIndex(ind)<<" "<<getPartID(ind)<<endl;
187
188 }
189
190 cout<<"getIndex(0,5,95)="<<getIndex(0,5,95)<<endl;
191 cout<<"getIndex(1,43,119)="<<getIndex(1,43,119)<<endl;
192 cout<<"getIndex(2,5,95)="<<getIndex(2,5,95)<<endl;
193 cout<<"getIndex(0,5,96)="<<getIndex(0,5,96)<<endl;
194 cout<<"getIndex(1,43,120)="<<getIndex(1,43,120)<<endl;
195 cout<<"getIndex(2,5,96)="<<getIndex(2,5,96)<<endl;
196
197}
EmcCalibConstSvc(const std::string &name, ISvcLocator *svcloc)
virtual StatusCode finalize()
int getIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const
virtual StatusCode initialize()
int getIxtalNumberNo() const
unsigned int getPartID(int Index) const
int getDigiCalibConstNo() const
int getIxtalNumber(int No) const
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
EmcStructure * m_theEmcStruc
unsigned int getPhiIndex(int Index) const
IDataProviderSvc * m_calDataSvc
unsigned int getThetaIndex(int Index) const
double getDigiCalibConst(int No) const
int getGeomIndex(unsigned int PartId, unsigned int ThetaIndex, unsigned int PhiIndex) const
unsigned int getPartId(long Index) const
unsigned int getPhi(long Index) const
unsigned int getTheta(long Index) const