86 MsgStream log(
msgSvc(), name());
89 char*
electron=getenv(
"BEPCII_INFO.BER_PRB");
94 log << MSG::ERROR <<
"Cannot get beam energy (e-)! Please call online people" << endreq;
96 char* positron=getenv(
"BEPCII_INFO.BPR_PRB");
101 log << MSG::ERROR <<
"Cannot get beam energy (e+)! Please call online people" << endreq;
109 log << MSG::INFO <<
"beam energy = " <<
m_beam << endreq;
112 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
114 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
115 return( StatusCode::FAILURE);
129 SmartDataPtr<EmcDigiCol> emcDigi(eventSvc(),
"/Event/Digi/EmcDigiCol");
131 log << MSG::FATAL <<
"Could not find Emc digi!!" << endreq;
132 return( StatusCode::FAILURE);
139 double adc,
etot=0.,ebarrel=0.,eendcap=0.;
140 double energyx=0.,energyy=0.,energyz=0.;
142 unsigned int idBarrel_Endcap,itheta,iphi;
143 double ewest=0.,eeast=0.;
146 EmcDigiCol::iterator iterEMC=emcDigiCol->begin();
147 while(iterEMC!= emcDigiCol->end()) {
148 id=(*iterEMC)->identify();
154 if(!calFlag&&m_emcCalibConstSvc) {
155 int index = m_emcCalibConstSvc->getIndex(idBarrel_Endcap,itheta,iphi);
156 double adc2e = m_emcCalibConstSvc->getDigiCalibConst(index);
157 log << MSG::DEBUG <<
"adc= " << adc <<
" and calibration constant: " << adc2e <<
" at " << idBarrel_Endcap <<
" " << itheta <<
" " << iphi << endreq;
162 double theta=0,phi=0;
164 if(idBarrel_Endcap==1){
165 theta=(34.+112.*(itheta+0.5)/44.)/180.*3.1415926;
166 phi=(iphi+0.5)/120.*6.2831852;
168 if(itheta<22) eeast+=adc;
172 theta=(90.+(90.-(itheta+0.5)/6.*(34.-21.56)+21.56)*(idBarrel_Endcap-1))
174 if(itheta==0||itheta==1)phi=(iphi+0.5)/64.*6.2831852;
175 if(itheta==2||itheta==3)phi=(iphi+0.5)/80.*6.2831852;
176 if(itheta==4||itheta==5)phi=(iphi+0.5)/96.*6.2831852;
178 if(idBarrel_Endcap==0) {
185 energyx +=adc*
sin(theta)*
cos(phi);
186 energyy +=adc*
sin(theta)*
sin(phi);
187 energyz +=adc*
cos(theta);
193 ebalance=sqrt(energyx*energyx+energyy*energyy+energyz*energyz)/
etot;
197 log << MSG::INFO <<
"etot=" <<
etot <<
"(" <<
etot/2./
abs(
m_beam) <<
"); ebarrel=" <<ebarrel
198 <<
"; eendcap="<<eendcap <<
"; ebalanece="<<ebalance<<endreq;
202 m_ebar->setValue(ebarrel/2./
abs(
m_beam));
203 m_eend->setValue(eendcap/2./
abs(
m_beam));
204 m_ebal->setValue(ebalance);
207 m_ef->appToEFVec(ebalance,34);
208 m_ef->appToEFVec(ebarrel,32);
209 m_ef->appToEFVec(eendcap,33);
210 m_ef->appToEFVec(eeast,35);
211 m_ef->appToEFVec(ewest,36);
212 m_ef->setVecBit(
true, 0, 1);
213 m_ef->addToEFVec(7<<16,1);
216 return StatusCode::SUCCESS;
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)