139 {
140
142
143 MsgStream log(
msgSvc(), name() );
144
145 float e1 = 0,
e2 = 0;
146 char*
electron = getenv(
"BEPCII_INFO.BER_PRB" );
148 else
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 ); }
152 else
153 { log << MSG::ERROR << "Cannot get beam energy (e+)! Please call online people" << endmsg; }
155 else {}
156 log << MSG::INFO <<
"beam energy = " <<
m_beam << endmsg;
157
158
159 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
160 if ( !eventHeader )
161 {
162 log << MSG::FATAL << "Could not find Event Header" << endmsg;
163 return ( StatusCode::FAILURE );
164 }
165
166 SmartDataPtr<RecEmcShowerCol> emcShowerCol( eventSvc(), "/Event/Recon/RecEmcShowerCol" );
167 if ( !emcShowerCol )
168 {
169 log << MSG::FATAL << "Could not find Emc rec!!" << endmsg;
170 return ( StatusCode::FAILURE );
171 }
172
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;
176
177 unsigned int nshower = emcShowerCol->size();
178 for ( ; iterShower != emcShowerCol->end(); iterShower++ )
179 {
180 if ( ( *iterShower )->energy() >= max1 )
181 {
182 max3 = max2;
183 max2 = max1;
184 cost3 = cost2;
185 cost2 = cost1;
188 max1 = ( *iterShower )->energy();
189 cost1 =
cos( ( *iterShower )->position().theta() );
190 phi1 = ( *iterShower )->position().phi();
191 }
192 else if ( ( *iterShower )->energy() > max2 )
193 {
194 max3 = max2;
195 cost3 = cost2;
197 max2 = ( *iterShower )->energy();
198 cost2 =
cos( ( *iterShower )->position().theta() );
199 phi2 = ( *iterShower )->position().phi();
200 }
201 else if ( ( *iterShower )->energy() > max3 )
202 {
203 max3 = ( *iterShower )->energy();
204 cost3 = ( *iterShower )->position().theta();
205 phi3 = ( *iterShower )->position().phi();
206 }
207 }
208 double acop = 180, acol = 180.;
209 if ( nshower >= 2 )
210 {
211 acop = 180. -
213 acol = 180. -
214 180. / 3.1415927 *
217 cost1 * cost2 );
218 }
219
220 log << MSG::INFO << "nshower=" << nshower << "; acop=" << acop << "; emax1=" << max1
221 << "; emax2=" << max2 << endmsg;
222
223
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 );
237
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 );
251
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 );
258
260
261 return StatusCode::SUCCESS;
262}
double sin(const BesAngle a)
double cos(const BesAngle a)