1#include "EmcCalibConstSvc/EmcCalibConstSvc.h"
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"
8#include "GaudiKernel/ISvcLocator.h"
9#include "GaudiKernel/Bootstrap.h"
11#include "GaudiKernel/IDataProviderSvc.h"
12#include "GaudiKernel/SmartDataPtr.h"
13#include "GaudiKernel/DataSvc.h"
15#include "EmcGeneralClass/EmcStructure.h"
16#include "CalibData/CalibModel.h"
17#include "CalibData/Emc/EmcCalibData.h"
24 Service (name, svcloc) {
32 if( IID_IEmcCalibConstSvc.versionMatch(riid) ){
35 return Service::queryInterface(riid, ppvInterface);
37 return StatusCode::SUCCESS;
41 MsgStream log(messageService(), name());
42 log << MSG::INFO <<
"EmcCalibConstSvc::initialize()" << endreq;
44 StatusCode sc = Service::initialize();
45 if( sc.isFailure() )
return sc;
48 if( sc == StatusCode::SUCCESS ){
49 log << MSG::INFO <<
"Retrieve IDataProviderSvc" << endreq;
51 log << MSG::FATAL <<
"can not get IDataProviderSvc" << endreq;
64 return StatusCode::SUCCESS;
71 MsgStream log(messageService(), name());
72 log << MSG::INFO <<
"EmcCalibConstSvc::finalize()" << endreq;
73 return StatusCode::SUCCESS;
79 double digiCalibConst = 0.0;
80 MsgStream log(messageService(), name());
82 std::string fullPath =
"/Calib/EmcCal";
83 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
85 log << MSG::ERROR <<
"can not access to EmcDigi CalibData via SmartPtr"
88 digiCalibConst = calConst->getDigiCalibConst(No);
91 return digiCalibConst;
96 int IxtalNumber = 999999;
97 MsgStream log(messageService(), name());
99 std::string fullPath =
"/Calib/EmcCal";
100 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
102 log << MSG::ERROR <<
"can not access to EmcDigi CalibData via SmartPtr"
105 IxtalNumber = calConst->getIxtalNumber(No);
113 int digiCalibConstNo = 0;
114 MsgStream log(messageService(), name());
116 std::string fullPath =
"/Calib/EmcCal";
117 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
119 log << MSG::ERROR <<
"can not access to EmcDigiNo CalibData via SmartPtr"
122 digiCalibConstNo = calConst->getDigiCalibConstNo();
125 return digiCalibConstNo;
130 int IxtalNumberNo = 0;
131 MsgStream log(messageService(), name());
133 std::string fullPath =
"/Calib/EmcCal";
134 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
136 log << MSG::ERROR <<
"can not access to EmcDigiNo CalibData via SmartPtr"
139 IxtalNumberNo = calConst->getIxtalNumberNo();
142 return IxtalNumberNo;
148 unsigned int ThetaIndex,
149 unsigned int PhiIndex)
const
173 for(
int iNo=0;iNo<6;iNo++){
180 cout<<
"ind"<<
" "<<
"getThetaIndex(ind)"<<
" "
181 <<
"getPhiIndex(ind)"<<
"getPartID"<<endl;
183 for(
int ind=0; ind<6240;ind++){
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;
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
IDataProviderSvc * m_calDataSvc
unsigned int getPartID(int Index) const
EmcStructure * m_theEmcStruc
int getDigiCalibConstNo() const
int getIxtalNumber(int No) const
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
unsigned int getPhiIndex(int Index) const
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