#include <EmcCalibTagDeadOrHot.h>
Public Member Functions | |
EmcCalibTagDeadOrHot (const std::string &name, ISvcLocator *pSvcLocator) | |
virtual | ~EmcCalibTagDeadOrHot () |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Member Functions | |
void | initCalibConst () |
void | SetDeadOrHotChannel () |
Private Attributes | |
int | m_deadIxtal |
int | m_hotIxtal |
std::string | m_fileExt |
std::string | m_fileDir |
double * | m_oldConstants |
int * | m_IxtalNumber |
IEmcCalibConstSvc * | m_emcCalibConstSvc |
Definition at line 35 of file EmcCalibTagDeadOrHot.h.
EmcCalibTagDeadOrHot::EmcCalibTagDeadOrHot | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 59 of file EmcCalibTagDeadOrHot.cxx.
References m_deadIxtal, m_fileDir, m_fileExt, m_hotIxtal, m_IxtalNumber, and m_oldConstants.
00060 :Algorithm(name, pSvcLocator), 00061 m_fileExt(""), 00062 m_fileDir("/ihepbatch/besdata/public/liucx/Calib/"), 00063 m_deadIxtal(-999), 00064 m_hotIxtal(-999) 00065 { 00066 00067 // Declare the properties 00068 declareProperty("fileExt", m_fileExt); 00069 declareProperty("fileDir", m_fileDir); 00070 declareProperty("deadIxtal", m_deadIxtal); 00071 declareProperty("hotIxtal", m_hotIxtal); 00072 00073 m_oldConstants = new double[6240]; 00074 m_IxtalNumber= new int[6240]; 00075 }
EmcCalibTagDeadOrHot::~EmcCalibTagDeadOrHot | ( | ) | [virtual] |
Definition at line 80 of file EmcCalibTagDeadOrHot.cxx.
References m_IxtalNumber, and m_oldConstants.
00080 { 00081 00082 if ( 0 != m_oldConstants) { 00083 delete [] m_oldConstants; 00084 m_oldConstants = 0; 00085 } 00086 if ( 0 != m_IxtalNumber) { 00087 delete [] m_IxtalNumber; 00088 m_IxtalNumber = 0; 00089 } 00090 }
StatusCode EmcCalibTagDeadOrHot::execute | ( | ) |
Definition at line 119 of file EmcCalibTagDeadOrHot.cxx.
References Bes_Common::DEBUG, and msgSvc().
00119 { 00120 00121 MsgStream log(msgSvc(), name()); 00122 log << MSG::DEBUG << "in execute()" << endreq; 00123 00124 return StatusCode::SUCCESS; 00125 }
StatusCode EmcCalibTagDeadOrHot::finalize | ( | ) |
Definition at line 128 of file EmcCalibTagDeadOrHot.cxx.
References Bes_Common::INFO, and msgSvc().
00128 { 00129 00130 MsgStream log(msgSvc(), name()); 00131 00132 00133 log << MSG::INFO << "in endRun()" << endreq; 00134 00135 00136 return StatusCode::SUCCESS; 00137 }
void EmcCalibTagDeadOrHot::initCalibConst | ( | ) | [private] |
Definition at line 143 of file EmcCalibTagDeadOrHot.cxx.
References genRecEmupikp::i, m_emcCalibConstSvc, m_IxtalNumber, m_oldConstants, and msgSvc().
Referenced by initialize().
00143 { 00144 00145 00146 MsgStream log(msgSvc(), name()); 00147 00148 int nConstEmc; 00149 00150 nConstEmc= m_emcCalibConstSvc -> getDigiCalibConstNo() ; 00151 00152 if ( nConstEmc!=6240) cout<<"number of calibconst="<< nConstEmc<<endl; 00153 00154 for ( int i = 0; i< nConstEmc; i++ ) { 00155 00156 m_oldConstants[i]=m_emcCalibConstSvc -> getDigiCalibConst(i); 00157 m_IxtalNumber[i]=m_emcCalibConstSvc -> getIxtalNumber(i); 00158 00159 } 00160 00161 ifstream In; 00162 In.open("/ihepbatch/bes/liucx/GrelConstIxtal2013.txt"); 00163 ofstream out; 00164 out.open("thephi.dat"); 00165 int ixtal,ithe,iphi; 00166 double rel; 00167 while( !In.eof() ) { 00168 00169 In >> ixtal>>rel; 00170 ithe= m_emcCalibConstSvc -> getThetaIndex(ixtal); 00171 iphi= m_emcCalibConstSvc -> getPhiIndex(ixtal); 00172 out<<ixtal<<"\t"<<ithe<<"\t"<<iphi<<"\t"<<rel<<endl; 00173 } 00174 In.close(); 00175 00176 out.close(); 00177 00178 cout<<"1,10,101"<<"\t"<<m_emcCalibConstSvc -> getIndex(1,10,101)<<endl; 00179 cout<<"1,30,105"<<"\t"<<m_emcCalibConstSvc -> getIndex(1,30,105)<<endl; 00180 cout<<"1,35,40"<<"\t"<<m_emcCalibConstSvc -> getIndex(1,35,40)<<endl; 00181 cout<<"0,2,40"<<"\t"<<m_emcCalibConstSvc -> getIndex(0,2,40)<<endl; 00182 cout<<"2,2,40"<<"\t"<<m_emcCalibConstSvc -> getIndex(2,2,40)<<endl; 00183 00184 }
StatusCode EmcCalibTagDeadOrHot::initialize | ( | ) |
Definition at line 93 of file EmcCalibTagDeadOrHot.cxx.
References calibUtil::ERROR, Bes_Common::INFO, initCalibConst(), m_emcCalibConstSvc, msgSvc(), and SetDeadOrHotChannel().
00093 { 00094 00095 MsgStream log(msgSvc(), name()); 00096 log << MSG::INFO << "in initialize()" << endreq; 00097 00098 // use EmcCalibConstSvc 00099 StatusCode scCalib; 00100 scCalib = Gaudi::svcLocator() -> service("EmcCalibConstSvc", m_emcCalibConstSvc); 00101 if( scCalib != StatusCode::SUCCESS){ 00102 log << MSG::ERROR << "can not use EmcCalibConstSvc" << endreq; 00103 } 00104 else { 00105 std::cout << "Test EmcCalibConstSvc DigiCalibConst(0)= " 00106 << m_emcCalibConstSvc -> getDigiCalibConst(0) << std::endl; 00107 } 00108 00109 //init starting values for calibration constants from file or set to 1 00110 00111 initCalibConst(); 00112 00113 SetDeadOrHotChannel(); 00114 00115 return StatusCode::SUCCESS; 00116 }
void EmcCalibTagDeadOrHot::SetDeadOrHotChannel | ( | ) | [private] |
Definition at line 189 of file EmcCalibTagDeadOrHot.cxx.
References m_deadIxtal, m_hotIxtal, m_IxtalNumber, and m_oldConstants.
Referenced by initialize().
00189 { 00190 00191 int Nxtals=6240; 00192 00193 double DigiConst[6240]; 00194 int IxtalNumber[6240]; 00195 00196 for(int ind=0; ind < Nxtals; ind++ ) { 00197 00198 DigiConst[ind]=m_oldConstants[ind]; 00199 IxtalNumber[ind]=m_IxtalNumber[ind]; 00200 if (ind==m_deadIxtal) IxtalNumber[ind]=-9; 00201 if (ind==m_hotIxtal) IxtalNumber[ind]=-99; 00202 // cout<<"ind="<<ind<<"\t"<< DigiConst[ind]<<endl; 00203 } 00204 00205 00206 TFile fconst("EmcCalibConst_DeadOrHot.root", "recreate"); 00207 00208 //define tree fill the absolute digicalibconsts into the root-file 00209 TTree* constr= new TTree("DigiCalibConst","DigiCalibConst"); 00210 constr->Branch("DigiCalibConst",DigiConst,"DigiConst[6240]/D"); 00211 constr->Branch("IxtalNumber",IxtalNumber,"IxtalNumber[6240]/I"); 00212 00213 constr->Fill(); 00214 00215 00216 constr->Write(); 00217 00218 delete constr; 00219 00220 fconst.Close(); 00221 00222 // end tree 00223 00224 00225 00226 00227 00228 }
int EmcCalibTagDeadOrHot::m_deadIxtal [private] |
Definition at line 63 of file EmcCalibTagDeadOrHot.h.
Referenced by EmcCalibTagDeadOrHot(), and SetDeadOrHotChannel().
Definition at line 75 of file EmcCalibTagDeadOrHot.h.
Referenced by initCalibConst(), and initialize().
std::string EmcCalibTagDeadOrHot::m_fileDir [private] |
std::string EmcCalibTagDeadOrHot::m_fileExt [private] |
int EmcCalibTagDeadOrHot::m_hotIxtal [private] |
Definition at line 64 of file EmcCalibTagDeadOrHot.h.
Referenced by EmcCalibTagDeadOrHot(), and SetDeadOrHotChannel().
int* EmcCalibTagDeadOrHot::m_IxtalNumber [private] |
Definition at line 74 of file EmcCalibTagDeadOrHot.h.
Referenced by EmcCalibTagDeadOrHot(), initCalibConst(), SetDeadOrHotChannel(), and ~EmcCalibTagDeadOrHot().
double* EmcCalibTagDeadOrHot::m_oldConstants [private] |
Definition at line 73 of file EmcCalibTagDeadOrHot.h.
Referenced by EmcCalibTagDeadOrHot(), initCalibConst(), SetDeadOrHotChannel(), and ~EmcCalibTagDeadOrHot().