20#include "EmcBhaCalib/EmcCalibTagDeadOrHot.h"
31#include "GaudiKernel/MsgStream.h"
32#include "GaudiKernel/AlgFactory.h"
33#include "GaudiKernel/ISvcLocator.h"
34#include "GaudiKernel/SmartDataPtr.h"
35#include "GaudiKernel/IDataProviderSvc.h"
36#include "GaudiKernel/PropertyMgr.h"
37#include "GaudiKernel/DataObject.h"
39#include "CLHEP/Vector/ThreeVector.h"
42using CLHEP::Hep3Vector;
45#include "GaudiKernel/MsgStream.h"
60 :Algorithm(name, pSvcLocator),
62 m_fileDir(
"/ihepbatch/besdata/public/liucx/Calib/"),
68 declareProperty(
"fileExt", m_fileExt);
69 declareProperty(
"fileDir", m_fileDir);
70 declareProperty(
"deadIxtal", m_deadIxtal);
71 declareProperty(
"hotIxtal", m_hotIxtal);
73 m_oldConstants =
new double[6240];
74 m_IxtalNumber=
new int[6240];
82 if ( 0 != m_oldConstants) {
83 delete [] m_oldConstants;
86 if ( 0 != m_IxtalNumber) {
87 delete [] m_IxtalNumber;
95 MsgStream log(
msgSvc(), name());
96 log << MSG::INFO <<
"in initialize()" << endreq;
100 scCalib = Gaudi::svcLocator() -> service(
"EmcCalibConstSvc", m_emcCalibConstSvc);
101 if( scCalib != StatusCode::SUCCESS){
102 log << MSG::ERROR <<
"can not use EmcCalibConstSvc" << endreq;
105 std::cout <<
"Test EmcCalibConstSvc DigiCalibConst(0)= "
106 << m_emcCalibConstSvc -> getDigiCalibConst(0) << std::endl;
113 SetDeadOrHotChannel();
115 return StatusCode::SUCCESS;
121 MsgStream log(
msgSvc(), name());
122 log << MSG::DEBUG <<
"in execute()" << endreq;
124 return StatusCode::SUCCESS;
130 MsgStream log(
msgSvc(), name());
133 log << MSG::INFO <<
"in endRun()" << endreq;
136 return StatusCode::SUCCESS;
143EmcCalibTagDeadOrHot::initCalibConst( ) {
146 MsgStream log(
msgSvc(), name());
150 nConstEmc= m_emcCalibConstSvc -> getDigiCalibConstNo() ;
152 if ( nConstEmc!=6240) cout<<
"number of calibconst="<< nConstEmc<<endl;
154 for (
int i = 0; i< nConstEmc; i++ ) {
156 m_oldConstants[i]=m_emcCalibConstSvc -> getDigiCalibConst(i);
157 m_IxtalNumber[i]=m_emcCalibConstSvc -> getIxtalNumber(i);
162 In.open(
"/ihepbatch/bes/liucx/GrelConstIxtal2013.txt");
164 out.open(
"thephi.dat");
170 ithe= m_emcCalibConstSvc -> getThetaIndex(ixtal);
171 iphi= m_emcCalibConstSvc -> getPhiIndex(ixtal);
172 out<<ixtal<<
"\t"<<ithe<<
"\t"<<iphi<<
"\t"<<rel<<endl;
178 cout<<
"1,10,101"<<
"\t"<<m_emcCalibConstSvc -> getIndex(1,10,101)<<endl;
179 cout<<
"1,30,105"<<
"\t"<<m_emcCalibConstSvc -> getIndex(1,30,105)<<endl;
180 cout<<
"1,35,40"<<
"\t"<<m_emcCalibConstSvc -> getIndex(1,35,40)<<endl;
181 cout<<
"0,2,40"<<
"\t"<<m_emcCalibConstSvc -> getIndex(0,2,40)<<endl;
182 cout<<
"2,2,40"<<
"\t"<<m_emcCalibConstSvc -> getIndex(2,2,40)<<endl;
189EmcCalibTagDeadOrHot::SetDeadOrHotChannel() {
193 double DigiConst[6240];
194 int IxtalNumber[6240];
196 for(
int ind=0; ind < Nxtals; ind++ ) {
198 DigiConst[ind]=m_oldConstants[ind];
199 IxtalNumber[ind]=m_IxtalNumber[ind];
200 if (ind==m_deadIxtal) IxtalNumber[ind]=-9;
201 if (ind==m_hotIxtal) IxtalNumber[ind]=-99;
206 TFile fconst(
"EmcCalibConst_DeadOrHot.root",
"recreate");
209 TTree* constr=
new TTree(
"DigiCalibConst",
"DigiCalibConst");
210 constr->Branch(
"DigiCalibConst",DigiConst,
"DigiConst[6240]/D");
211 constr->Branch(
"IxtalNumber",IxtalNumber,
"IxtalNumber[6240]/I");
virtual ~EmcCalibTagDeadOrHot()
EmcCalibTagDeadOrHot(const std::string &name, ISvcLocator *pSvcLocator)