190 {
191
192 MsgStream log(
msgSvc(), name());
193 log << MSG::INFO << "TofRec in execute()!" << endreq;
194
195 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
196 if( !eventHeader ) {
197 log << MSG::FATAL << "TofRec could not find Event Header!" << endreq;
198 return StatusCode::FAILURE;
199 }
200 int run = eventHeader->runNumber();
201 int event = eventHeader->eventNumber();
202 if( ( event % 1000 == 0 ) && m_printOutInfo ) {
203 std::cout << "run:" << run << " event: " << event << std::endl;
204 }
205 log << MSG::INFO << "run= " << run << " event= " << event << endreq;
207
210
211
212 if( m_acceleratorStatus == "Colliding" ) {
213
214 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
215 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
216 log << MSG::WARNING << "TofRec Could not find RecEsTimeCol! Run = " << run << " Event = " << event << endreq;
217 return StatusCode::SUCCESS;
218 }
219 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
220 double t0 = (*iter_ESTime)->getTest();
221 int t0Stat = (*iter_ESTime)->getStat();
222 log << MSG::INFO << "t0= " << t0 << " t0Stat= " << t0Stat << endreq;
223
224
225 IDataProviderSvc* m_pCalibDataSvc;
226 StatusCode sc = service("CalibDataSvc", m_pCalibDataSvc, true);
227 std::string fullpath = "/Calib/EsTimeCal";
228 SmartDataPtr<CalibData::EsTimeCalibData> Est( m_pCalibDataSvc, fullpath );
229
230 if( ( event % 1000 == 0 ) && m_printOutInfo ) {
231 if( !Est ) {
232 std::cout << " t0 = " << t0 << " t0stat = " << t0Stat << std::endl;
233 }
234 else {
235 std::cout << " t0 = " << t0 << " t0stat = " << t0Stat << " bunch = " << Est->getBunchTime() << " offset_b = " << Est->getToffsetb() << " offset_e = " << Est->getToffsete() << std::endl;
236 }
237 }
238
239
240
241 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
242 if( !mdcKalTrackCol ) {
243 log << MSG::WARNING << "No MdcKalTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
244 return StatusCode::SUCCESS;
245 }
246 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
247 if( !mdcTrackCol ) {
248 log << MSG::FATAL << "Could NOT find RecMdcTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
249 return StatusCode::SUCCESS;
250 }
251
252
253 SmartDataPtr<RecExtTrackCol> extTrackCol(eventSvc(),"/Event/Recon/RecExtTrackCol");
254 if( !extTrackCol ) {
255 log << MSG::WARNING << "No ExtTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
256 return StatusCode::SUCCESS;
257 }
258 else {
259 if( m_printOutInfo ) { m_printOut->
setExtTrackNum( extTrackCol->size() ); }
260 if( m_checkDigi && m_checkDigiExt ) { m_checkdigi_tuple->
FillCol( *eventHeader, mdcTrackCol, mdcKalTrackCol, extTrackCol ); }
261 }
262
263
264 if( m_forCalibration ) {
265 if( m_printOutInfo ) { m_printOut->
addNumber(0); }
266
267 if( t0Stat%10 != 1 ) return StatusCode::SUCCESS;
268 if( m_printOutInfo ) { m_printOut->
addNumber(1); }
269
270 if( extTrackCol->size() != 2 ) return StatusCode::SUCCESS;
271 if( m_printOutInfo ) { m_printOut->
addNumber(2); }
272
273 if( mdcTrackCol->size() != 2 ) return StatusCode::SUCCESS;
274 if( m_printOutInfo ) { m_printOut->
addNumber(3); }
275
276 SmartDataPtr<RecEmcShowerCol> emcShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol");
277 if( !emcShowerCol ) {
278 log << MSG::FATAL << "Could NOT find EmcRecShowerCol in TDS! Run = " << run << " Event = " << event << endreq;
279 return StatusCode::SUCCESS;
280 }
281 if( m_printOutInfo ) { m_printOut->
addNumber(4); }
282
283 if( emcShowerCol->size() < 2 ) return StatusCode::SUCCESS;
284 if( m_printOutInfo ) { m_printOut->
addNumber(5); }
285
286 RecMdcTrackCol::iterator iter_mdc1 = mdcTrackCol->begin();
287 RecMdcTrackCol::iterator iter_mdc2 = mdcTrackCol->begin() + 1;
288
289 RecMdcKalTrackCol::iterator iter_kal1 = mdcKalTrackCol->begin();
290 RecMdcKalTrackCol::iterator iter_kal2 = mdcKalTrackCol->begin() + 1;
291
292 RecExtTrackCol::iterator iter_ext1 = extTrackCol->begin();
293 RecExtTrackCol::iterator iter_ext2 = extTrackCol->begin() + 1;
294 Hep3Vector extPos1 = (*iter_ext1)->emcPosition();
295 Hep3Vector extPos2 = (*iter_ext2)->emcPosition();
296
297 RecEmcShowerCol::iterator iter_emc1 = emcShowerCol->begin();
298 RecEmcShowerCol::iterator iter_emc2 = emcShowerCol->begin() + 1;
299 Hep3Vector emcPos1((*iter_emc1)->x(),(*iter_emc1)->y(),(*iter_emc1)->z());
300 Hep3Vector emcPos2((*iter_emc2)->x(),(*iter_emc2)->y(),(*iter_emc2)->z());
301
302 Hep3Vector pep = (*iter_mdc1)->p3();
303 Hep3Vector pem = (*iter_mdc2)->p3();
304 double delta_angle = 180.0 - pep.angle( pem.unit() )*180.0/
pi;
305 double delta_phi =
abs( (*iter_mdc1)->phi() - (*iter_mdc2)->phi() )*180.0/
pi;
306
307 Hep3Vector distant1 = extPos1 - emcPos1;
308 Hep3Vector distant2 = extPos2 - emcPos1;
309 if( distant1.r() > distant2.r() ) {
310 RecEmcShowerCol::iterator iter_tmp = iter_emc1;
311 iter_emc1 = iter_emc2;
312 iter_emc2 = iter_tmp;
313 Hep3Vector emc_tmp = emcPos1;
314 emcPos1 = emcPos2;
315 emcPos2 = emc_tmp;
316 }
317 distant1 = extPos1 - emcPos1;
318 distant2 = extPos2 - emcPos2;
319
320 double p1 = (*iter_mdc1)->p();
321 double p2 = (*iter_mdc2)->p();
322 double e1 = (*iter_emc1)->energy();
323 double e2 = (*iter_emc2)->energy();
325 RecEmcShowerCol::iterator iter_emc = emcShowerCol->begin();
326 for( ; iter_emc != emcShowerCol->end(); iter_emc++ ) {
327 etot += (*iter_emc)->energy();
328 }
329
330 if( m_checkDigi ) { m_checkdigi_tuple->
FillCol( *eventHeader, extTrackCol, mdcTrackCol, emcShowerCol, mdcKalTrackCol ); }
331
332 if( ( (*iter_mdc1)->charge() + (*iter_mdc2)->charge() )!= 0 ) return StatusCode::SUCCESS;
333 if( m_printOutInfo ) { m_printOut->
addNumber(6); }
334
335 if( delta_angle > 10.0 ) return StatusCode::SUCCESS;
336 if( m_printOutInfo ) { m_printOut->
addNumber(7); }
337
338 if( (*iter_kal1)->getStat(1,0)!=0 || (*iter_kal2)->getStat(1,0)!=0 ) return StatusCode::SUCCESS;
339 if( m_printOutInfo ) { m_printOut->
addNumber(8); }
340
341 if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
342 if( m_printOutInfo ) { m_printOut->
addNumber(9); }
343
344
345 if( m_data == "jpsi09" ) {
346 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;
347 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
348 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;
349 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
350 if( delta_phi<174.0 || delta_phi>186.0 ) return StatusCode::SUCCESS;
351 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
352 if( m_calibData == "Bhabha" ) {
353 if(
e1 < 1.1 ||
e2 < 1.1 )
return StatusCode::SUCCESS;
354 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
355 }
356 }
357
358 else if( m_data == "psip09" ) {
359 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;
360 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
361 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;
362 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
363 if( delta_phi<174.0 || delta_phi>183.0 ) return StatusCode::SUCCESS;
364 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
365 if( m_calibData == "Bhabha" ) {
366 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
367 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
368 }
369 }
370
371 else if( m_data == "psipp10" ) {
372 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;
373 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
374 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;
375 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
376 if( delta_phi<174.0 || delta_phi>186.0 ) return StatusCode::SUCCESS;
377 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
378 if( m_calibData == "Bhabha" ) {
379 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
380 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
381 }
382 }
383
384 else if( m_data == "psipp11" ) {
385 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;
386 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
387 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;
388 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
389 if( delta_phi<174.0 || delta_phi>184.0 ) return StatusCode::SUCCESS;
390 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
391 if( m_calibData == "Bhabha" ) {
392 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
393 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
394 }
395 }
396
397 else if( m_data == "psip12" ) {
398 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;
399 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
400 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;
401 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
402 if( delta_phi<172.0 || delta_phi>188.0 ) return StatusCode::SUCCESS;
403 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
404 if( m_calibData == "Bhabha" ) {
405 if(
e1 < 1.4 ||
e2 < 1.4 )
return StatusCode::SUCCESS;
406 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
407 }
408 }
409
410 else if( m_data == "jpsi12" ) {
411 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;
412 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
413 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;
414 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
415 if( delta_phi<172.0 || delta_phi>188.0 ) return StatusCode::SUCCESS;
416 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
417 if( m_calibData == "Bhabha" ) {
418 if(
e1 < 1.1 ||
e2 < 1.1 )
return StatusCode::SUCCESS;
419 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
420 }
421 }
422
423 else if( m_data == "psi13" ) {
424 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;
425 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
426 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;
427 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
428 if( delta_phi<172.0 || delta_phi>188.0 ) return StatusCode::SUCCESS;
429 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
430 if( m_calibData == "Bhabha" ) {
431 if(
e1 < 1.5 ||
e2 < 1.5 )
return StatusCode::SUCCESS;
432 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
433 }
434 }
435 else if( m_data == "rxyz14" ) {
436 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;
437 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
438 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;
439 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
440 if( delta_phi<175.0 || delta_phi>185.0 ) return StatusCode::SUCCESS;
441 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
442 if( m_calibData == "Bhabha" ) {
443 if(
e1/p1 < 0.75 ||
e2/p2 < 0.75 )
return StatusCode::SUCCESS;
444 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
445 }
446 }
447 else if( m_data == "r15" ) {
448 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;
449 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
450 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;
451 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
452 if( delta_phi<175.0 || delta_phi>185.0 ) return StatusCode::SUCCESS;
453 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
454 if( m_calibData == "Bhabha" ) {
455 if(
e1/p1 < 0.75 ||
e2/p2 < 0.75 )
return StatusCode::SUCCESS;
456 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
457 }
458 }
459 else if( m_data == "data16" ) {
460 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;
461 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
462 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;
463 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
464 if( delta_phi<170.0 || delta_phi>190.0 ) return StatusCode::SUCCESS;
465 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
466 if( m_calibData == "Bhabha" ) {
467 if(
e1/p1 < 0.75 ||
e2/p2 < 0.75 )
return StatusCode::SUCCESS;
468 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
469 }
470 }
471 else if( m_data == "data17" ) {
472 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;
473 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
474 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;
475 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
476 if( delta_phi<170.0 || delta_phi>190.0 ) return StatusCode::SUCCESS;
477 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
478 if( m_calibData == "Bhabha" ) {
479 if(
e1/p1 < 0.75 ||
e2/p2 < 0.75 )
return StatusCode::SUCCESS;
480 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
481 }
482 }
483 else if( m_data == "jpsi18" ) {
484 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;
485 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
486 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;
487 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
488 if( delta_phi<170.0 || delta_phi>190.0 ) return StatusCode::SUCCESS;
489 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
490 if( m_calibData == "Bhabha" ) {
491 if(
e1/p1 < 0.75 ||
e2/p2 < 0.75 )
return StatusCode::SUCCESS;
492 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
493 }
494 }
495 else if( m_data == "jpsi19" ) {
496 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;
497 if( m_printOutInfo ) { m_printOut->
addNumber(10); }
498 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;
499 if( m_printOutInfo ) { m_printOut->
addNumber(11); }
500 if( delta_phi<170.0 || delta_phi>190.0 ) return StatusCode::SUCCESS;
501 if( m_printOutInfo ) { m_printOut->
addNumber(12); }
502 if( m_calibData == "Bhabha" ) {
503 if(
e1/p1 < 0.75 ||
e2/p2 < 0.75 )
return StatusCode::SUCCESS;
504 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
505 }
506 }
507
508 if( m_calibData == "Bhabha" ) {
509 if( (
etot -
e1 -
e2 ) > 0.3 )
return StatusCode::SUCCESS;
510 if( m_printOutInfo ) { m_printOut->
addNumber(14); }
511 }
512 else if( m_calibData == "Dimu" ) {
513 if(
e1 > 0.5 ||
e2 > 0.5 )
return StatusCode::SUCCESS;
514 if( m_printOutInfo ) { m_printOut->
addNumber(13); }
515 }
516 }
517
518
520 RecExtTrackCol::iterator iter_track = extTrackCol->begin();
521 for( ; iter_track < extTrackCol->end(); iter_track++ ) {
522 RecMdcTrackCol::iterator iter_mdc = mdcTrackCol->begin();
523 for( ; iter_mdc != mdcTrackCol->end(); iter_mdc++ ) {
524 if( (*iter_mdc)->trackId() == (*iter_track)->trackId() ) break;
525 }
527 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol->begin();
528 for( ; iter_kal != mdcKalTrackCol->end(); iter_kal++ ) {
529 if( (*iter_kal)->trackId() == (*iter_track)->trackId() ) break;
530 }
531 double p[5] = {-1.0};
532 int kal[5] = {-1};
533 if( iter_kal != mdcKalTrackCol->end() ) {
534 for( unsigned int i=0; i<5; i++ ) {
540 p[i] = (*iter_kal)->p3().mag();
541 kal[i] = (*iter_kal)->getStat(0,i);
542 }
543 }
546
547 if( tofTrackVec->size()>0 ) {
548 std::vector<TofTrack*>::iterator iterExt = tofTrackVec->begin();
549 for( ; iterExt < tofTrackVec->end(); iterExt++ ) {
550 if( (*iterExt)->isNoHit() ) continue;
552 }
553 }
554
555 tofTrackVec->push_back( tof );
556 }
557
558 if( m_printOutInfo ) {
560 }
561
562
564 if( tofDataMap.empty() ) {
565 log << MSG::WARNING << "No Tof Data Map in RawDataProviderSvc! Run=" << run << " Event=" << event << endreq;
566 }
567
568 if( m_checkDigi && m_checkDigiRaw ) {
569 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),"/Event/Digi/TofDigiCol");
570 if( !tofDigiCol ) {
571 log << MSG::ERROR << "TofRec could not find Tof digi! Event = " << event << endreq;
572 }
573 else { m_checkdigi_tuple->
FillCol( *eventHeader, tofDigiCol, t0, t0Stat ); }
574
575 m_checkdigi_tuple->
FillCol( *eventHeader, tofDataMap, t0, t0Stat );
576 }
577
578 std::vector<int> deadId;
579 if( m_forCalibration ) {
580 for( unsigned int i=0; i<5; i++ ) {
582 if( identmp != 0x2fffffff ) {
583 deadId.push_back( identmp );
584 }
586 if( identmp != 0x2fffffff ) {
587 deadId.push_back( identmp );
588 }
590 if( identmp != 0x2fffffff ) {
591 deadId.push_back( identmp );
592 }
593 }
594 }
595
596 std::vector<TofTrack*>::iterator
iter = tofTrackVec->begin();
597 for( ;
iter < tofTrackVec->end();
iter++ ) {
598 if( (*iter)->isNoHit() ) continue;
599 (*iter)->setTofData( tofDataMap );
601 if( (*iter)->isNoHit() ) continue;
602 (*iter)->match( m_forCalibration, deadId, tofTrackVec );
604 }
605
606 iter = tofTrackVec->begin();
607 for( ;
iter < tofTrackVec->end();
iter++ ) {
608
609 (*iter)->setCalibration();
610
611 if( m_checkDigi ) {
612 if( m_checkTrigger ) {
613
614 SmartDataPtr<TrigData> trigData(eventSvc(), "/Event/Trig/TrigData");
615 if (!trigData) {
616 log << MSG::FATAL << "Could not find Trigger Data for physics analysis" << endreq;
618 }
619 else {
621 }
622 }
623 else {
624 if( ( run < 0 ) && m_checkMcTruth ) {
625 SmartDataPtr<TofMcHitCol> tofMcCol(eventSvc(),"/Event/MC/TofMcHitCol");
626 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),"/Event/MC/McParticleCol");
627 if ( !tofMcCol || !mcParticleCol ) {
628 m_checkdigi_tuple->
Fill_TofTrack( *eventHeader, *
iter, t0, t0Stat, mdcKalTrackCol );
629 }
630 else {
631 m_checkdigi_tuple->
Fill_TofTrack( *eventHeader, *
iter, t0, t0Stat, mdcKalTrackCol, tofMcCol, mcParticleCol, m_calibData );
632 }
633 }
634 else {
635 m_checkdigi_tuple->
Fill_TofTrack( *eventHeader, *
iter, t0, t0Stat, mdcKalTrackCol );
636 }
637 }
638 }
639 }
640
641 tds.
RegisterTDS( eventHeader->runNumber(), eventHeader->eventNumber(), tofTrackVec, m_forCalibration, m_calibData );
642
644
645
646 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),"/Event/Recon/RecTofTrackCol");
647 if (!tofTrackCol) {
648 log << MSG::FATAL << "TofRec could not find RecTofTrackCol!" << endreq;
649 return StatusCode::FAILURE;
650 }
651 else{
652 if( m_saveRootFile ) {
653 m_checkdata_tuple->
FillCol( *eventHeader, tofTrackCol, mdcKalTrackCol );
654 }
655 }
656
657 if( m_forCalibration ) {
658 SmartDataPtr<RecBTofCalHitCol> bhitCol(eventSvc(),"/Event/Recon/RecBTofCalHitCol");
659 if (!bhitCol) {
660 log << MSG::WARNING << "TofRec could not find RecBTofCalHitCol!" << endreq;
661 }
662 else {
663 if( m_saveRootFile ) {
664 m_checkdata_tuple->
FillCol( *eventHeader, bhitCol );
665 }
666 }
667
668 SmartDataPtr<RecETofCalHitCol> ehitCol(eventSvc(),"/Event/Recon/RecETofCalHitCol");
669 if (!ehitCol) {
670 log << MSG::WARNING << "TofRec could not find RecETofCalHitCol!" << endreq;
671 }
672 else {
673 if( m_saveRootFile ) {
674 m_checkdata_tuple->
FillCol( *eventHeader, ehitCol );
675 }
676 }
677 }
678
679 }
680 else {
681 log << MSG::FATAL << "In TofRec: AcceleratorStatus is NOT correct! m_acceleratorStatus = " << m_acceleratorStatus << endreq;
682 return StatusCode::FAILURE;
683 }
684
685 return StatusCode::SUCCESS;
686
687}
std::multimap< unsigned int, TofData * > TofDataMap
double cos(const BesAngle a)
std::vector< TofTrack * > TofTrackVec
IRawDataProviderSvc * tofDigiSvc
virtual TofDataMap & tofDataMapTof(double estime=0)=0
virtual const int BrWest(unsigned int No)=0
virtual const int BrEast(unsigned int No)=0
virtual StatusCode chooseConstants(int run, int event)=0
virtual const int Endcap(unsigned int No)=0
void FillCol(Event::EventHeader &, RecTofTrackCol &, RecMdcKalTrackCol &)
void Fill_TofTrack(Event::EventHeader &, TofTrack *&, double, int)
void FillCol(Event::EventHeader &, TofDigiCol &, double, int)
void setExtTrackNum(unsigned int ntrk)
void setTrack1Col(std::vector< TofTrack * > *&tofTrackVec)
void addNumber(unsigned int i)
void setTrack3(TofTrack *&tof)
void setTrack2(TofTrack *&tof)
StatusCode RegisterTDS(int runNumber, int eventNumber, std::vector< TofTrack * > *&tofTrackVec, bool m_forCalibration, std::string m_calibData)
StatusCode RegisterNullRecTofTrackCol()
void clearTofTrackVec(std::vector< TofTrack * > *&tofTrackVec)
void getMultiHit(TofTrack *&)
void setExtTrack(RecExtTrack *extTrack, double costheta, double p[5], int kal[5], double t0, int t0Stat)