193 MsgStream log(
msgSvc(), name());
194 log << MSG::INFO <<
"TofRec in execute()!" << endreq;
196 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
198 log << MSG::FATAL <<
"TofRec could not find Event Header!" << endreq;
199 return StatusCode::FAILURE;
201 int run = eventHeader->runNumber();
202 int event = eventHeader->eventNumber();
203 if( ( event % 1000 == 0 ) && m_printOutInfo ) {
204 std::cout <<
"run:" << run <<
" event: " <<
event << std::endl;
206 log << MSG::INFO <<
"run= " << run <<
" event= " <<
event << endreq;
213 if( m_acceleratorStatus ==
"Colliding" ) {
215 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),
"/Event/Recon/RecEsTimeCol");
216 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
217 log << MSG::WARNING <<
"TofRec Could not find RecEsTimeCol! Run = " << run <<
" Event = " <<
event << endreq;
218 return StatusCode::SUCCESS;
220 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
221 double t0 = (*iter_ESTime)->getTest();
222 int t0Stat = (*iter_ESTime)->getStat();
223 log << MSG::INFO <<
"t0= " << t0 <<
" t0Stat= " << t0Stat << endreq;
226 IDataProviderSvc* m_pCalibDataSvc;
227 StatusCode sc = service(
"CalibDataSvc", m_pCalibDataSvc,
true);
228 std::string fullpath =
"/Calib/EsTimeCal";
229 SmartDataPtr<CalibData::EsTimeCalibData> Est( m_pCalibDataSvc, fullpath );
231 if( ( event % 1000 == 0 ) && m_printOutInfo ) {
233 std::cout <<
" t0 = " << t0 <<
" t0stat = " << t0Stat << std::endl;
236 std::cout <<
" t0 = " << t0 <<
" t0stat = " << t0Stat <<
" bunch = " << Est->getBunchTime() <<
" offset_b = " << Est->getToffsetb() <<
" offset_e = " << Est->getToffsete() << std::endl;
242 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(eventSvc(),
"/Event/Recon/RecMdcKalTrackCol");
243 if( !mdcKalTrackCol ) {
244 log << MSG::WARNING <<
"No MdcKalTrackCol in TDS! Run = " << run <<
" Event = " <<
event << endreq;
245 return StatusCode::SUCCESS;
247 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(eventSvc(),
"/Event/Recon/RecMdcTrackCol");
249 log << MSG::FATAL <<
"Could NOT find RecMdcTrackCol in TDS! Run = " << run <<
" Event = " <<
event << endreq;
250 return StatusCode::SUCCESS;
254 SmartDataPtr<RecExtTrackCol> extTrackCol(eventSvc(),
"/Event/Recon/RecExtTrackCol");
256 log << MSG::WARNING <<
"No ExtTrackCol in TDS! Run = " << run <<
" Event = " <<
event << endreq;
257 return StatusCode::SUCCESS;
260 if( m_printOutInfo ) { m_printOut->
setExtTrackNum( extTrackCol->size() ); }
261 if( m_checkDigi && m_checkDigiExt ) { m_checkdigi_tuple->
FillCol( *eventHeader, mdcTrackCol, mdcKalTrackCol, extTrackCol ); }
265 if( m_forCalibration ) {
266 if( m_printOutInfo ) { m_printOut->
addNumber(0); }
268 if( t0Stat%10 != 1 )
return StatusCode::SUCCESS;
269 if( m_printOutInfo ) { m_printOut->
addNumber(1); }
271 if( extTrackCol->size() != 2 )
return StatusCode::SUCCESS;
272 if( m_printOutInfo ) { m_printOut->
addNumber(2); }
274 if( mdcTrackCol->size() != 2 )
return StatusCode::SUCCESS;
275 if( m_printOutInfo ) { m_printOut->
addNumber(3); }
277 SmartDataPtr<RecEmcShowerCol> emcShowerCol(eventSvc(),
"/Event/Recon/RecEmcShowerCol");
278 if( !emcShowerCol ) {
279 log << MSG::FATAL <<
"Could NOT find EmcRecShowerCol in TDS! Run = " << run <<
" Event = " <<
event << endreq;
280 return StatusCode::SUCCESS;
282 if( m_printOutInfo ) { m_printOut->
addNumber(4); }
284 if( emcShowerCol->size() < 2 )
return StatusCode::SUCCESS;
285 if( m_printOutInfo ) { m_printOut->
addNumber(5); }
287 RecMdcTrackCol::iterator iter_mdc1 = mdcTrackCol->begin();
288 RecMdcTrackCol::iterator iter_mdc2 = mdcTrackCol->begin() + 1;
290 RecMdcKalTrackCol::iterator iter_kal1 = mdcKalTrackCol->begin();
291 RecMdcKalTrackCol::iterator iter_kal2 = mdcKalTrackCol->begin() + 1;
293 RecExtTrackCol::iterator iter_ext1 = extTrackCol->begin();
294 RecExtTrackCol::iterator iter_ext2 = extTrackCol->begin() + 1;
295 Hep3Vector extPos1 = (*iter_ext1)->emcPosition();
296 Hep3Vector extPos2 = (*iter_ext2)->emcPosition();
298 RecEmcShowerCol::iterator iter_emc1 = emcShowerCol->begin();
299 RecEmcShowerCol::iterator iter_emc2 = emcShowerCol->begin() + 1;
300 Hep3Vector emcPos1((*iter_emc1)->x(),(*iter_emc1)->y(),(*iter_emc1)->z());
301 Hep3Vector emcPos2((*iter_emc2)->x(),(*iter_emc2)->y(),(*iter_emc2)->z());
303 Hep3Vector pep = (*iter_mdc1)->p3();
304 Hep3Vector pem = (*iter_mdc2)->p3();
305 double delta_angle = 180.0 - pep.angle( pem.unit() )*180.0/
pi;
306 double delta_phi =
abs( (*iter_mdc1)->phi() - (*iter_mdc2)->phi() )*180.0/
pi;
308 Hep3Vector distant1 = extPos1 - emcPos1;
309 Hep3Vector distant2 = extPos2 - emcPos1;
310 if( distant1.r() > distant2.r() ) {
311 RecEmcShowerCol::iterator iter_tmp = iter_emc1;
312 iter_emc1 = iter_emc2;
313 iter_emc2 = iter_tmp;
314 Hep3Vector emc_tmp = emcPos1;
318 distant1 = extPos1 - emcPos1;
319 distant2 = extPos2 - emcPos2;
321 double p1 = (*iter_mdc1)->p();
322 double p2 = (*iter_mdc2)->p();
323 double e1 = (*iter_emc1)->energy();
324 double e2 = (*iter_emc2)->energy();
326 RecEmcShowerCol::iterator iter_emc = emcShowerCol->begin();
327 for( ; iter_emc != emcShowerCol->end(); iter_emc++ ) {
328 etot += (*iter_emc)->energy();
331 if( m_checkDigi ) { m_checkdigi_tuple->
FillCol( *eventHeader, extTrackCol, mdcTrackCol, emcShowerCol, mdcKalTrackCol ); }
333 if( ( (*iter_mdc1)->charge() + (*iter_mdc2)->charge() )!= 0 )
return StatusCode::SUCCESS;
334 if( m_printOutInfo ) { m_printOut->
addNumber(6); }
336 if( delta_angle > 10.0 )
return StatusCode::SUCCESS;
337 if( m_printOutInfo ) { m_printOut->
addNumber(7); }
339 if( (*iter_kal1)->getStat(1,0)!=0 || (*iter_kal2)->getStat(1,0)!=0 )
return StatusCode::SUCCESS;
340 if( m_printOutInfo ) { m_printOut->
addNumber(8); }
342 if( distant1.r()>6.0 || distant2.r()>6.0 )
return StatusCode::SUCCESS;
343 if( m_printOutInfo ) { m_printOut->
addNumber(9); }
346 if( m_data ==
"jpsi09" ) {
347 if( (*iter_mdc1)->x()<-0.2 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.5 || (*iter_mdc1)->y()>0.1 || abs((*iter_mdc1)->z())>4.0 )
return StatusCode::SUCCESS;
348 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
349 if( (*iter_mdc2)->x()<-0.2 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.5 || (*iter_mdc2)->y()>0.1 || abs((*iter_mdc2)->z())>4.0 )
return StatusCode::SUCCESS;
350 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
351 if( delta_phi<174.0 || delta_phi>186.0 )
return StatusCode::SUCCESS;
352 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
353 if( m_calibData ==
"Bhabha" ) {
354 if(
e1 < 1.1 ||
e2 < 1.1 )
return StatusCode::SUCCESS;
355 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
359 else if( m_data ==
"psip09" ) {
360 if( (*iter_mdc1)->x()<-0.2 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.5 || (*iter_mdc1)->y()>0.1 || abs((*iter_mdc1)->z())>4.0 )
return StatusCode::SUCCESS;
361 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
362 if( (*iter_mdc2)->x()<-0.2 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.5 || (*iter_mdc2)->y()>0.1 || abs((*iter_mdc2)->z())>4.0 )
return StatusCode::SUCCESS;
363 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
364 if( delta_phi<174.0 || delta_phi>183.0 )
return StatusCode::SUCCESS;
365 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
366 if( m_calibData ==
"Bhabha" ) {
367 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
368 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
372 else if( m_data ==
"psipp10" ) {
373 if( (*iter_mdc1)->x()<-0.2 || (*iter_mdc1)->x()>1.2 || (*iter_mdc1)->y()<-0.9 || (*iter_mdc1)->y()>0.5 || abs((*iter_mdc1)->z())>6.0 )
return StatusCode::SUCCESS;
374 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
375 if( (*iter_mdc2)->x()<-0.2 || (*iter_mdc2)->x()>1.2 || (*iter_mdc2)->y()<-0.9 || (*iter_mdc2)->y()>0.5 || abs((*iter_mdc2)->z())>6.0 )
return StatusCode::SUCCESS;
376 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
377 if( delta_phi<174.0 || delta_phi>186.0 )
return StatusCode::SUCCESS;
378 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
379 if( m_calibData ==
"Bhabha" ) {
380 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
381 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
385 else if( m_data ==
"psipp11" ) {
386 if( (*iter_mdc1)->x()<-0.15 || (*iter_mdc1)->x()>0.3 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.15 || abs((*iter_mdc1)->z())>6.0 )
return StatusCode::SUCCESS;
387 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
388 if( (*iter_mdc2)->x()<-0.15 || (*iter_mdc2)->x()>0.3 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.15 || abs((*iter_mdc2)->z())>6.0 )
return StatusCode::SUCCESS;
389 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
390 if( delta_phi<174.0 || delta_phi>184.0 )
return StatusCode::SUCCESS;
391 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
392 if( m_calibData ==
"Bhabha" ) {
393 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
394 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
398 else if( m_data ==
"psip12" ) {
399 if( (*iter_mdc1)->x()<-0.25 || (*iter_mdc1)->x()>0.3 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.15 || abs((*iter_mdc1)->z())>6.0 )
return StatusCode::SUCCESS;
400 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
401 if( (*iter_mdc2)->x()<-0.25 || (*iter_mdc2)->x()>0.3 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.15 || abs((*iter_mdc2)->z())>6.0 )
return StatusCode::SUCCESS;
402 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
403 if( delta_phi<172.0 || delta_phi>188.0 )
return StatusCode::SUCCESS;
404 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
405 if( m_calibData ==
"Bhabha" ) {
406 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
407 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
411 else if( m_data ==
"jpsi12" ) {
412 if( (*iter_mdc1)->x()<-0.2 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.4 || (*iter_mdc1)->y()>0.2 || abs((*iter_mdc1)->z())>4.0 )
return StatusCode::SUCCESS;
413 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
414 if( (*iter_mdc2)->x()<-0.2 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.4 || (*iter_mdc2)->y()>0.2 || abs((*iter_mdc2)->z())>4.0 )
return StatusCode::SUCCESS;
415 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
416 if( delta_phi<172.0 || delta_phi>188.0 )
return StatusCode::SUCCESS;
417 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
418 if( m_calibData ==
"Bhabha" ) {
419 if(
e1 < 1.1 ||
e2 < 1.1 )
return StatusCode::SUCCESS;
420 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
424 else if( m_data ==
"psi13" ) {
425 if( (*iter_mdc1)->x()<-0.15 || (*iter_mdc1)->x()>0.35 || (*iter_mdc1)->y()<-0.35 || (*iter_mdc1)->y()>0.15 || abs((*iter_mdc1)->z())>4.0 )
return StatusCode::SUCCESS;
426 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
427 if( (*iter_mdc2)->x()<-0.15 || (*iter_mdc2)->x()>0.35 || (*iter_mdc2)->y()<-0.35 || (*iter_mdc2)->y()>0.15 || abs((*iter_mdc2)->z())>4.0 )
return StatusCode::SUCCESS;
428 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
429 if( delta_phi<172.0 || delta_phi>188.0 )
return StatusCode::SUCCESS;
430 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
431 if( m_calibData ==
"Bhabha" ) {
432 if(
e1 < 1.5 ||
e2 < 1.5 )
return StatusCode::SUCCESS;
433 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
436 else if( m_data ==
"rxyz14" ) {
437 if( (*iter_mdc1)->x()<-0.15 || (*iter_mdc1)->x()>0.35 || (*iter_mdc1)->y()<-0.35 || (*iter_mdc1)->y()>0.15 || abs((*iter_mdc1)->z())>4.0 )
return StatusCode::SUCCESS;
438 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
439 if( (*iter_mdc2)->x()<-0.15 || (*iter_mdc2)->x()>0.35 || (*iter_mdc2)->y()<-0.35 || (*iter_mdc2)->y()>0.15 || abs((*iter_mdc2)->z())>4.0 )
return StatusCode::SUCCESS;
440 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
441 if( delta_phi<175.0 || delta_phi>185.0 )
return StatusCode::SUCCESS;
442 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
443 if( m_calibData ==
"Bhabha" ) {
444 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
445 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
448 else if( m_data ==
"r15" ) {
449 if( (*iter_mdc1)->x()<-0.15 || (*iter_mdc1)->x()>0.35 || (*iter_mdc1)->y()<-0.35 || (*iter_mdc1)->y()>0.15 || abs((*iter_mdc1)->z())>4.0 )
return StatusCode::SUCCESS;
450 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
451 if( (*iter_mdc2)->x()<-0.15 || (*iter_mdc2)->x()>0.35 || (*iter_mdc2)->y()<-0.35 || (*iter_mdc2)->y()>0.15 || abs((*iter_mdc2)->z())>4.0 )
return StatusCode::SUCCESS;
452 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
453 if( delta_phi<175.0 || delta_phi>185.0 )
return StatusCode::SUCCESS;
454 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
455 if( m_calibData ==
"Bhabha" ) {
456 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
457 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
460 else if( m_data ==
"data16" ) {
461 if( (*iter_mdc1)->x()<-0.15 || (*iter_mdc1)->x()>0.35 || (*iter_mdc1)->y()<-0.35 || (*iter_mdc1)->y()>0.2 || abs((*iter_mdc1)->z())>4.0 )
return StatusCode::SUCCESS;
462 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
463 if( (*iter_mdc2)->x()<-0.15 || (*iter_mdc2)->x()>0.35 || (*iter_mdc2)->y()<-0.35 || (*iter_mdc2)->y()>0.2 || abs((*iter_mdc2)->z())>4.0 )
return StatusCode::SUCCESS;
464 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
465 if( delta_phi<170.0 || delta_phi>190.0 )
return StatusCode::SUCCESS;
466 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
467 if( m_calibData ==
"Bhabha" ) {
468 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
469 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
472 else if( m_data ==
"data17" ) {
473 if( (*iter_mdc1)->x()<-0.15 || (*iter_mdc1)->x()>0.35 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.2 || (*iter_mdc1)->z()<-3.5 || (*iter_mdc1)->z()>4.5 )
return StatusCode::SUCCESS;
474 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
475 if( (*iter_mdc2)->x()<-0.15 || (*iter_mdc2)->x()>0.35 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.2 || (*iter_mdc2)->z()<-3.5 || (*iter_mdc2)->z()>4.5 )
return StatusCode::SUCCESS;
476 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
477 if( delta_phi<170.0 || delta_phi>190.0 )
return StatusCode::SUCCESS;
478 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
479 if( m_calibData ==
"Bhabha" ) {
480 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
481 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
484 else if( m_data ==
"jpsi18" ) {
485 if( (*iter_mdc1)->x()<-0.1 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.2 || (*iter_mdc1)->z()<-3.5 || (*iter_mdc1)->z()>4.0 )
return StatusCode::SUCCESS;
486 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
487 if( (*iter_mdc2)->x()<-0.1 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.2 || (*iter_mdc2)->z()<-3.5 || (*iter_mdc2)->z()>4.0 )
return StatusCode::SUCCESS;
488 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
489 if( delta_phi<170.0 || delta_phi>190.0 )
return StatusCode::SUCCESS;
490 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
491 if( m_calibData ==
"Bhabha" ) {
492 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
493 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
496 else if( m_data ==
"jpsi19" ) {
497 if( (*iter_mdc1)->x()<-0.1 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.2 || (*iter_mdc1)->z()<-3.5 || (*iter_mdc1)->z()>4.0 )
return StatusCode::SUCCESS;
498 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
499 if( (*iter_mdc2)->x()<-0.1 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.2 || (*iter_mdc2)->z()<-3.5 || (*iter_mdc2)->z()>4.0 )
return StatusCode::SUCCESS;
500 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
501 if( delta_phi<170.0 || delta_phi>190.0 )
return StatusCode::SUCCESS;
502 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
503 if( m_calibData ==
"Bhabha" ) {
504 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
505 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
508 else if( m_data ==
"data20" ) {
509 if( (*iter_mdc1)->x()<-0.1 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.2 || (*iter_mdc1)->z()<-3.5 || (*iter_mdc1)->z()>4.0 )
return StatusCode::SUCCESS;
510 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
511 if( (*iter_mdc2)->x()<-0.1 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.2 || (*iter_mdc2)->z()<-3.5 || (*iter_mdc2)->z()>4.0 )
return StatusCode::SUCCESS;
512 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
513 if( delta_phi<170.0 || delta_phi>190.0 )
return StatusCode::SUCCESS;
514 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
515 if( m_calibData ==
"Bhabha" ) {
516 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
517 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
520 else if( m_data ==
"data21" ) {
521 if( (*iter_mdc1)->x()<-0.1 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.2 || (*iter_mdc1)->z()<-3.5 || (*iter_mdc1)->z()>4.0 )
return StatusCode::SUCCESS;
522 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
523 if( (*iter_mdc2)->x()<-0.1 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.2 || (*iter_mdc2)->z()<-3.5 || (*iter_mdc2)->z()>4.0 )
return StatusCode::SUCCESS;
524 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
525 if( delta_phi<170.0 || delta_phi>190.0 )
return StatusCode::SUCCESS;
526 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
527 if( m_calibData ==
"Bhabha" ) {
528 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
529 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
532 else if( m_data ==
"data22" ) {
533 if( (*iter_mdc1)->x()<-0.1 || (*iter_mdc1)->x()>0.4 || (*iter_mdc1)->y()<-0.3 || (*iter_mdc1)->y()>0.2 || (*iter_mdc1)->z()<-3.5 || (*iter_mdc1)->z()>4.0 )
return StatusCode::SUCCESS;
534 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
535 if( (*iter_mdc2)->x()<-0.1 || (*iter_mdc2)->x()>0.4 || (*iter_mdc2)->y()<-0.3 || (*iter_mdc2)->y()>0.2 || (*iter_mdc2)->z()<-3.5 || (*iter_mdc2)->z()>4.0 )
return StatusCode::SUCCESS;
536 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
537 if( delta_phi<170.0 || delta_phi>190.0 )
return StatusCode::SUCCESS;
538 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
539 if( m_calibData ==
"Bhabha" ) {
540 if(
e1/
p1 < 0.75 ||
e2/
p2 < 0.75 )
return StatusCode::SUCCESS;
541 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
545 if( m_calibData ==
"Bhabha" ) {
546 if( (
etot -
e1 -
e2 ) > 0.3 )
return StatusCode::SUCCESS;
547 if( m_printOutInfo ) { m_printOut->
addNumber(14); }
549 else if( m_calibData ==
"Dimu" ) {
550 if(
e1 > 0.5 ||
e2 > 0.5 )
return StatusCode::SUCCESS;
551 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
557 RecExtTrackCol::iterator iter_track = extTrackCol->begin();
558 for( ; iter_track < extTrackCol->end(); iter_track++ ) {
559 RecMdcTrackCol::iterator iter_mdc = mdcTrackCol->begin();
560 for( ; iter_mdc != mdcTrackCol->end(); iter_mdc++ ) {
561 if( (*iter_mdc)->trackId() == (*iter_track)->trackId() )
break;
564 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol->begin();
565 for( ; iter_kal != mdcKalTrackCol->end(); iter_kal++ ) {
566 if( (*iter_kal)->trackId() == (*iter_track)->trackId() )
break;
568 double p[5] = {-1.0};
570 if( iter_kal != mdcKalTrackCol->end() ) {
571 for(
unsigned int i=0; i<5; i++ ) {
577 p[i] = (*iter_kal)->p3().mag();
578 kal[i] = (*iter_kal)->getStat(0,i);
584 if( tofTrackVec->size()>0 ) {
585 std::vector<TofTrack*>::iterator iterExt = tofTrackVec->begin();
586 for( ; iterExt < tofTrackVec->end(); iterExt++ ) {
587 if( (*iterExt)->isNoHit() )
continue;
592 tofTrackVec->push_back( tof );
595 if( m_printOutInfo ) {
601 if( tofDataMap.empty() ) {
602 log << MSG::WARNING <<
"No Tof Data Map in RawDataProviderSvc! Run=" << run <<
" Event=" <<
event << endreq;
605 if( m_checkDigi && m_checkDigiRaw ) {
606 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),
"/Event/Digi/TofDigiCol");
608 log << MSG::ERROR <<
"TofRec could not find Tof digi! Event = " <<
event << endreq;
610 else { m_checkdigi_tuple->
FillCol( *eventHeader, tofDigiCol, t0, t0Stat ); }
612 m_checkdigi_tuple->
FillCol( *eventHeader, tofDataMap, t0, t0Stat );
615 std::vector<int> deadId;
616 if( m_forCalibration ) {
617 for(
unsigned int i=0; i<5; i++ ) {
619 if( identmp != 0x2fffffff ) {
620 deadId.push_back( identmp );
623 if( identmp != 0x2fffffff ) {
624 deadId.push_back( identmp );
627 for(
unsigned int i=0; i<500; i++ ) {
629 if( identmp == 0x2fffffff )
break;
630 else { deadId.push_back( identmp ); }
634 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
635 for( ;
iter < tofTrackVec->end();
iter++ ) {
636 if( (*iter)->isNoHit() )
continue;
637 (*iter)->setTofData( tofDataMap );
639 if( (*iter)->isNoHit() )
continue;
640 (*iter)->match( m_forCalibration, deadId, tofTrackVec );
644 iter = tofTrackVec->begin();
645 for( ;
iter < tofTrackVec->end();
iter++ ) {
647 (*iter)->setCalibration();
650 if( m_checkTrigger ) {
652 SmartDataPtr<TrigData> trigData(eventSvc(),
"/Event/Trig/TrigData");
654 log << MSG::FATAL <<
"Could not find Trigger Data for physics analysis" << endreq;
662 if( ( run < 0 ) && m_checkMcTruth ) {
663 SmartDataPtr<TofMcHitCol> tofMcCol(eventSvc(),
"/Event/MC/TofMcHitCol");
664 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),
"/Event/MC/McParticleCol");
665 if ( !tofMcCol || !mcParticleCol ) {
666 m_checkdigi_tuple->
Fill_TofTrack( *eventHeader, *
iter, t0, t0Stat, mdcKalTrackCol );
669 m_checkdigi_tuple->
Fill_TofTrack( *eventHeader, *
iter, t0, t0Stat, mdcKalTrackCol, tofMcCol, mcParticleCol, m_calibData );
673 m_checkdigi_tuple->
Fill_TofTrack( *eventHeader, *
iter, t0, t0Stat, mdcKalTrackCol );
679 tds.
RegisterTDS( eventHeader->runNumber(), eventHeader->eventNumber(), tofTrackVec, m_forCalibration, m_calibData );
684 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),
"/Event/Recon/RecTofTrackCol");
686 log << MSG::FATAL <<
"TofRec could not find RecTofTrackCol!" << endreq;
687 return StatusCode::FAILURE;
690 if( m_saveRootFile ) {
691 m_checkdata_tuple->
FillCol( *eventHeader, tofTrackCol, mdcKalTrackCol );
695 if( m_forCalibration ) {
696 SmartDataPtr<RecBTofCalHitCol> bhitCol(eventSvc(),
"/Event/Recon/RecBTofCalHitCol");
698 log << MSG::WARNING <<
"TofRec could not find RecBTofCalHitCol!" << endreq;
701 if( m_saveRootFile ) {
702 m_checkdata_tuple->
FillCol( *eventHeader, bhitCol );
706 SmartDataPtr<RecETofCalHitCol> ehitCol(eventSvc(),
"/Event/Recon/RecETofCalHitCol");
708 log << MSG::WARNING <<
"TofRec could not find RecETofCalHitCol!" << endreq;
711 if( m_saveRootFile ) {
712 m_checkdata_tuple->
FillCol( *eventHeader, ehitCol );
719 log << MSG::FATAL <<
"In TofRec: AcceleratorStatus is NOT correct! m_acceleratorStatus = " << m_acceleratorStatus << endreq;
720 return StatusCode::FAILURE;
723 return StatusCode::SUCCESS;