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"
25 Service (name, svcloc) {
28 for(
int i=0;i<6240;i++){
33 string paraPath = getenv(
"EMCCALIBCONSTSVCROOT");
34 paraPath +=
"/share/emax_data.dat";
37 in.open(paraPath.c_str());
42 while (in.peek() != EOF)
45 in >> ixtal>>emaxData;
61 if( IID_IEmcCalibConstSvc.versionMatch(riid) ){
64 return Service::queryInterface(riid, ppvInterface);
66 return StatusCode::SUCCESS;
70 MsgStream log(messageService(), name());
71 log << MSG::INFO <<
"EmcCalibConstSvc::initialize()" << endreq;
73 StatusCode sc = Service::initialize();
74 if( sc.isFailure() )
return sc;
77 if( sc == StatusCode::SUCCESS ){
78 log << MSG::INFO <<
"Retrieve IDataProviderSvc" << endreq;
80 log << MSG::FATAL <<
"can not get IDataProviderSvc" << endreq;
93 return StatusCode::SUCCESS;
100 MsgStream log(messageService(), name());
101 log << MSG::INFO <<
"EmcCalibConstSvc::finalize()" << endreq;
102 return StatusCode::SUCCESS;
108 double digiCalibConst = 0.0;
109 MsgStream log(messageService(), name());
111 std::string fullPath =
"/Calib/EmcCal";
112 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
114 log << MSG::ERROR <<
"can not access to EmcDigi CalibData via SmartPtr"
117 digiCalibConst = calConst->getDigiCalibConst(No);
120 return digiCalibConst;
125 int IxtalNumber = 999999;
126 MsgStream log(messageService(), name());
128 std::string fullPath =
"/Calib/EmcCal";
129 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
131 log << MSG::ERROR <<
"can not access to EmcDigi CalibData via SmartPtr"
134 IxtalNumber = calConst->getIxtalNumber(No);
142 int digiCalibConstNo = 0;
143 MsgStream log(messageService(), name());
145 std::string fullPath =
"/Calib/EmcCal";
146 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
148 log << MSG::ERROR <<
"can not access to EmcDigiNo CalibData via SmartPtr"
151 digiCalibConstNo = calConst->getDigiCalibConstNo();
154 return digiCalibConstNo;
159 int IxtalNumberNo = 0;
160 MsgStream log(messageService(), name());
162 std::string fullPath =
"/Calib/EmcCal";
163 SmartDataPtr<CalibData::EmcCalibData> calConst(
m_calDataSvc, fullPath);
165 log << MSG::ERROR <<
"can not access to EmcDigiNo CalibData via SmartPtr"
168 IxtalNumberNo = calConst->getIxtalNumberNo();
171 return IxtalNumberNo;
177 unsigned int ThetaIndex,
178 unsigned int PhiIndex)
const
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
double m_CrystalEmaxData[6240]
EmcStructure * m_theEmcStruc
int getDigiCalibConstNo() const
int getIxtalNumber(int No) const
double getCrystalEmaxData(int Index) 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