143 MsgStream log(
msgSvc(), name() );
145 float e1 = 0,
e2 = 0;
146 char*
electron = getenv(
"BEPCII_INFO.BER_PRB" );
149 { log << MSG::ERROR <<
"Cannot get beam energy (e-)! Please call online people" << endmsg; }
150 char* positron = getenv(
"BEPCII_INFO.BPR_PRB" );
151 if ( positron ) {
e2 = atof( positron ); }
153 { log << MSG::ERROR <<
"Cannot get beam energy (e+)! Please call online people" << endmsg; }
156 log << MSG::INFO <<
"beam energy = " <<
m_beam << endmsg;
159 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
162 log << MSG::FATAL <<
"Could not find Event Header" << endmsg;
163 return ( StatusCode::FAILURE );
166 SmartDataPtr<RecEmcShowerCol> emcShowerCol( eventSvc(),
"/Event/Recon/RecEmcShowerCol" );
169 log << MSG::FATAL <<
"Could not find Emc rec!!" << endmsg;
170 return ( StatusCode::FAILURE );
173 RecEmcShowerCol::iterator iterShower = emcShowerCol->begin();
174 double max1 = -999, max2 = -999, max3 = -999;
175 double cost1 = -999, cost2 = -999, cost3 = -999,
phi1 = -999,
phi2 = -999, phi3 = -999;
177 unsigned int nshower = emcShowerCol->size();
178 for ( ; iterShower != emcShowerCol->end(); iterShower++ )
180 if ( ( *iterShower )->energy() >= max1 )
188 max1 = ( *iterShower )->energy();
189 cost1 =
cos( ( *iterShower )->position().theta() );
190 phi1 = ( *iterShower )->position().phi();
192 else if ( ( *iterShower )->energy() > max2 )
197 max2 = ( *iterShower )->energy();
198 cost2 =
cos( ( *iterShower )->position().theta() );
199 phi2 = ( *iterShower )->position().phi();
201 else if ( ( *iterShower )->energy() > max3 )
203 max3 = ( *iterShower )->energy();
204 cost3 = ( *iterShower )->position().theta();
205 phi3 = ( *iterShower )->position().phi();
208 double acop = 180, acol = 180.;
220 log << MSG::INFO <<
"nshower=" << nshower <<
"; acop=" << acop <<
"; emax1=" << max1
221 <<
"; emax2=" << max2 << endmsg;
224 m_nshower->setValue( nshower );
225 m_acop->setValue( acop );
226 m_acole->setValue( acol );
227 m_emax1->setValue( max1 /
abs(
m_beam ) );
228 m_emax2->setValue( max2 /
abs(
m_beam ) );
229 m_emax3->setValue( max3 /
abs(
m_beam ) );
230 m_emax12->setValue( ( max1 + max2 ) /
abs(
m_beam ) );
231 m_coste1->setValue( cost1 );
232 m_coste2->setValue( cost2 );
233 m_coste3->setValue( cost3 );
234 m_phi1->setValue(
phi1 );
235 m_phi2->setValue(
phi2 );
236 m_phi3->setValue( phi3 );
238 m_ef->addToEFVec( nshower, 38 );
239 m_ef->appToEFVec( max1, 39 );
240 m_ef->appToEFVec( cost1, 40 );
242 m_ef->appToEFVec( max2, 42 );
243 m_ef->appToEFVec( cost2, 43 );
245 m_ef->appToEFVec( acop, 45 );
246 m_ef->appToEFVec( acol, 46 );
247 m_ef->appToEFVec( max1 + max2, 47 );
248 m_ef->appToEFVec( max3, 48 );
249 m_ef->appToEFVec( cost3, 49 );
250 m_ef->appToEFVec( phi3, 50 );
252 m_ef->setVecBit(
true, 0, 2 );
253 if ( nshower == 0 )
m_ef->addToEFVec( 1 << 16, 1 );
254 else if ( nshower == 1 )
m_ef->addToEFVec( 4 << 16, 1 );
255 else if ( nshower == 2 )
m_ef->addToEFVec( 10 << 16, 1 );
256 else if ( nshower >= 3 )
m_ef->addToEFVec( 13 << 16, 1 );
257 else m_ef->addToEFVec( 0 << 16, 1 );
261 return StatusCode::SUCCESS;