CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
TofRec Class Reference

#include <TofRec.h>

+ Inheritance diagram for TofRec:

Public Member Functions

 TofRec (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode beginRun ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
void clearTofTrackVec (std::vector< TofTrack * > *&tofTrackVec)
 

Detailed Description

Definition at line 17 of file TofRec.h.

Constructor & Destructor Documentation

◆ TofRec()

TofRec::TofRec ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 49 of file TofRec.cxx.

49 :
50 Algorithm(name, pSvcLocator)
51{
52 declareProperty( "AcceleratorStatus", m_acceleratorStatus );
53 declareProperty( "MagneticField", m_magneticField );
54 declareProperty( "ForCalibration", m_forCalibration );
55 declareProperty( "Data", m_data );
56 declareProperty( "CalibData", m_calibData );
57 // declareProperty( "CalibDataBarrel", m_calibDataBarrel );
58 declareProperty( "FirstIteration", m_firstIteration );
59 declareProperty( "CheckTrigger", m_checkTrigger );
60 declareProperty( "SaveRootFile4Rec", m_saveRootFile );
61 declareProperty( "PrintOutInfo", m_printOutInfo );
62 declareProperty( "CheckDigi", m_checkDigi );
63 declareProperty( "CheckDigiRaw", m_checkDigiRaw );
64 declareProperty( "CheckDigiExt", m_checkDigiExt );
65 declareProperty( "CheckMcTruth", m_checkMcTruth );
66}

Member Function Documentation

◆ beginRun()

StatusCode TofRec::beginRun ( )

Definition at line 172 of file TofRec.cxx.

172 {
173 MsgStream log(msgSvc(), name());
174 log << MSG::INFO <<"TofRec begin_run!"<< endreq;
175 return StatusCode::SUCCESS;
176}
IMessageSvc * msgSvc()

◆ clearTofTrackVec()

void TofRec::clearTofTrackVec ( std::vector< TofTrack * > *&  tofTrackVec)

Definition at line 580 of file TofRec.cxx.

580 {
581 if( tofTrackVec ) {
582 std::vector<TofTrack*>::iterator iter = tofTrackVec->begin();
583 for( ; iter < tofTrackVec->end(); iter++ ) {
584 delete (*iter);
585 }
586 tofTrackVec->clear();
587 delete tofTrackVec;
588 }
589 return;
590}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

Referenced by execute().

◆ execute()

StatusCode TofRec::execute ( )

Definition at line 180 of file TofRec.cxx.

180 {
181
182 MsgStream log(msgSvc(), name());
183 log << MSG::INFO << "TofRec in execute()!" << endreq;
184
185 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
186 if( !eventHeader ) {
187 log << MSG::FATAL << "TofRec could not find Event Header!" << endreq;
188 return StatusCode::FAILURE;
189 }
190 int run = eventHeader->runNumber();
191 int event = eventHeader->eventNumber();
192 if( ( event % 1000 == 0 ) && m_printOutInfo ) {
193 std::cout << "run:" << run << " event: " << event << std::endl;
194 }
195 log << MSG::INFO << "run= " << run << " event= " << event << endreq;
196
197 TofRecTDS tds;
199
200 // Magnetic Field: Colliding data and Cosmic Ray
201 if( m_acceleratorStatus == "Colliding" ) {
202 // Retrieve Event Start Time
203 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
204 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
205 log << MSG::WARNING << "TofRec Could not find RecEsTimeCol! Run = " << run << " Event = " << event << endreq;
206 return StatusCode::SUCCESS;
207 }
208 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
209 double t0 = (*iter_ESTime)->getTest();
210 int t0Stat = (*iter_ESTime)->getStat();
211 log << MSG::INFO << "t0= " << t0 << " t0Stat= " << t0Stat << endreq;
212
213 // Kalman Filter Track
214 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
215 if( !mdcKalTrackCol ) {
216 log << MSG::WARNING << "No MdcKalTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
217 return StatusCode::SUCCESS;
218 }
219
220 // Tof Get Extrapolated Track
221 SmartDataPtr<RecExtTrackCol> extTrackCol(eventSvc(),"/Event/Recon/RecExtTrackCol");
222 if( !extTrackCol ) {
223 log << MSG::WARNING << "No ExtTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
224 return StatusCode::SUCCESS;
225 }
226 else {
227 if( m_printOutInfo ) { m_printOut->setExtTrackNum( extTrackCol->size() ); }
228 if( m_checkDigi && m_checkDigiExt ) { m_checkdigi_tuple->FillCol( *eventHeader, mdcKalTrackCol, extTrackCol ); }
229 }
230
231 //sunss add 08/9/17
232 if( m_forCalibration ) { // Bhabha Events Selection
233 if( m_printOutInfo ) { m_printOut->addNumber(0); }
234 // if( t0Stat != 111 && t0Stat != 121 ) return StatusCode::SUCCESS;
235 if( t0Stat%10 != 1 ) return StatusCode::SUCCESS;
236 if( m_printOutInfo ) { m_printOut->addNumber(1); }
237
238 if( extTrackCol->size() != 2 ) return StatusCode::SUCCESS;
239 if( m_printOutInfo ) { m_printOut->addNumber(2); }
240
241 SmartDataPtr<RecMdcTrackCol> mdcTrackCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
242 if( !mdcTrackCol ) {
243 log << MSG::FATAL << "Could NOT find RecMdcTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
244 return StatusCode::SUCCESS;
245 }
246 if( mdcTrackCol->size() != 2 ) return StatusCode::SUCCESS;
247 if( m_printOutInfo ) { m_printOut->addNumber(3); }
248
249 SmartDataPtr<RecEmcShowerCol> emcShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol");
250 if( !emcShowerCol ) {
251 log << MSG::FATAL << "Could NOT find EmcRecShowerCol in TDS! Run = " << run << " Event = " << event << endreq;
252 return StatusCode::SUCCESS;
253 }
254 if( m_printOutInfo ) { m_printOut->addNumber(4); }
255
256 if( emcShowerCol->size() < 2 ) return StatusCode::SUCCESS;
257 if( m_printOutInfo ) { m_printOut->addNumber(5); }
258
259 RecMdcTrackCol::iterator iter_mdc1 = mdcTrackCol->begin();
260 RecMdcTrackCol::iterator iter_mdc2 = mdcTrackCol->begin() + 1;
261
262 RecMdcKalTrackCol::iterator iter_kal1 = mdcKalTrackCol->begin();
263 RecMdcKalTrackCol::iterator iter_kal2 = mdcKalTrackCol->begin() + 1;
264
265 RecExtTrackCol::iterator iter_ext1 = extTrackCol->begin();
266 RecExtTrackCol::iterator iter_ext2 = extTrackCol->begin() + 1;
267 Hep3Vector extPos1 = (*iter_ext1)->emcPosition();
268 Hep3Vector extPos2 = (*iter_ext2)->emcPosition();
269
270 RecEmcShowerCol::iterator iter_emc1 = emcShowerCol->begin();
271 RecEmcShowerCol::iterator iter_emc2 = emcShowerCol->begin() + 1;
272 Hep3Vector emcPos1((*iter_emc1)->x(),(*iter_emc1)->y(),(*iter_emc1)->z());
273 Hep3Vector emcPos2((*iter_emc2)->x(),(*iter_emc2)->y(),(*iter_emc2)->z());
274
275 Hep3Vector pep = (*iter_mdc1)->p3();
276 Hep3Vector pem = (*iter_mdc2)->p3();
277 double delta_angle = 180.0 - pep.angle( pem.unit() )*180.0/pi;
278 double delta_phi = abs( (*iter_mdc1)->phi() - (*iter_mdc2)->phi() )*180.0/pi;
279
280 Hep3Vector distant1 = extPos1 - emcPos1;
281 Hep3Vector distant2 = extPos2 - emcPos1;
282 if( distant1.r() > distant2.r() ) {
283 RecEmcShowerCol::iterator iter_tmp = iter_emc1;
284 iter_emc1 = iter_emc2;
285 iter_emc2 = iter_tmp;
286 Hep3Vector emc_tmp = emcPos1;
287 emcPos1 = emcPos2;
288 emcPos2 = emc_tmp;
289 }
290 distant1 = extPos1 - emcPos1;
291 distant2 = extPos2 - emcPos2;
292
293 double e1 = (*iter_emc1)->energy();
294 double e2 = (*iter_emc2)->energy();
295 double etot = 0.0;
296 RecEmcShowerCol::iterator iter_emc = emcShowerCol->begin();
297 for( ; iter_emc != emcShowerCol->end(); iter_emc++ ) {
298 etot += (*iter_emc)->energy();
299 }
300
301 if( m_checkDigi ) { m_checkdigi_tuple->FillCol( *eventHeader, extTrackCol, mdcTrackCol, emcShowerCol, mdcKalTrackCol ); }
302
303 if( ( (*iter_mdc1)->charge() + (*iter_mdc2)->charge() )!= 0 ) return StatusCode::SUCCESS;
304 if( m_printOutInfo ) { m_printOut->addNumber(6); }
305 // if( (*iter_mdc1)->ndof()<23.0 || (*iter_mdc2)->ndof()<23.0 ) return StatusCode::SUCCESS;
306 // if( ((*iter_mdc1)->chi2()/(*iter_mdc1)->ndof())>2.5 || ((*iter_mdc2)->chi2()/(*iter_mdc2)->ndof())>2.5 ) return StatusCode::SUCCESS;
307 if( delta_angle > 10.0 ) return StatusCode::SUCCESS;
308 if( m_printOutInfo ) { m_printOut->addNumber(7); }
309 // if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
310 if( m_calibData == "Bhabha" ) {
311 if( (*iter_kal1)->getStat(1,0)!=0 || (*iter_kal2)->getStat(1,0)!=0 ) return StatusCode::SUCCESS;
312 if( m_printOutInfo ) { m_printOut->addNumber(8); }
313 // Jpsi data taken in 2009
314 if( m_data == "jpsi" ) {
315 if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
316 if( m_printOutInfo ) { m_printOut->addNumber(9); }
317 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;
318 if( m_printOutInfo ) { m_printOut->addNumber(10); }
319 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;
320 if( m_printOutInfo ) { m_printOut->addNumber(11); }
321 if( delta_phi<174.0 || delta_phi>186.0 ) return StatusCode::SUCCESS;
322 if( m_printOutInfo ) { m_printOut->addNumber(12); }
323 if( e1 < 1.1 || e2 < 1.1 ) return StatusCode::SUCCESS;
324 if( m_printOutInfo ) { m_printOut->addNumber(13); }
325 }
326 // Psi prime data taken in 2009
327 else if( m_data == "psip" ) {
328 if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
329 if( m_printOutInfo ) { m_printOut->addNumber(9); }
330 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;
331 if( m_printOutInfo ) { m_printOut->addNumber(10); }
332 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;
333 if( m_printOutInfo ) { m_printOut->addNumber(11); }
334 if( delta_phi<174.0 || delta_phi>183.0 ) return StatusCode::SUCCESS;
335 if( m_printOutInfo ) { m_printOut->addNumber(12); }
336 if( e1 < 1.4 || e2 < 1.4 ) return StatusCode::SUCCESS;
337 if( m_printOutInfo ) { m_printOut->addNumber(13); }
338 }
339 // Psi double prime data taken in first half of 2010
340 else if( m_data == "psipp10" ) {
341 if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
342 if( m_printOutInfo ) { m_printOut->addNumber(9); }
343 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;
344 if( m_printOutInfo ) { m_printOut->addNumber(10); }
345 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;
346 if( m_printOutInfo ) { m_printOut->addNumber(11); }
347 if( delta_phi<174.0 || delta_phi>186.0 ) return StatusCode::SUCCESS;
348 if( m_printOutInfo ) { m_printOut->addNumber(12); }
349 if( e1 < 1.4 || e2 < 1.4 ) return StatusCode::SUCCESS;
350 if( m_printOutInfo ) { m_printOut->addNumber(13); }
351 }
352 // Psi double prime data taken in end of 2010 and 2011
353 else if( m_data == "psipp11" ) {
354 if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
355 if( m_printOutInfo ) { m_printOut->addNumber(9); }
356 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;
357 if( m_printOutInfo ) { m_printOut->addNumber(10); }
358 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;
359 if( m_printOutInfo ) { m_printOut->addNumber(11); }
360 if( delta_phi<174.0 || delta_phi>184.0 ) return StatusCode::SUCCESS;
361 if( m_printOutInfo ) { m_printOut->addNumber(12); }
362 if( e1 < 1.4 || e2 < 1.4 ) return StatusCode::SUCCESS;
363 if( m_printOutInfo ) { m_printOut->addNumber(13); }
364 }
365 // Psi prime data taken in end of 2011 and 2012
366 else if( m_data == "psip12" ) {
367 if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
368 if( m_printOutInfo ) { m_printOut->addNumber(9); }
369 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;
370 if( m_printOutInfo ) { m_printOut->addNumber(10); }
371 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;
372 if( m_printOutInfo ) { m_printOut->addNumber(11); }
373 if( delta_phi<172.0 || delta_phi>188.0 ) return StatusCode::SUCCESS;
374 if( m_printOutInfo ) { m_printOut->addNumber(12); }
375 if( e1 < 1.4 || e2 < 1.4 ) return StatusCode::SUCCESS;
376 if( m_printOutInfo ) { m_printOut->addNumber(13); }
377 }
378 // Jpsi data taken in 2012
379 else if( m_data == "jpsi12" ) {
380 if( distant1.r()>6.0 || distant2.r()>6.0 ) return StatusCode::SUCCESS;
381 if( m_printOutInfo ) { m_printOut->addNumber(9); }
382 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;
383 if( m_printOutInfo ) { m_printOut->addNumber(10); }
384 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;
385 if( m_printOutInfo ) { m_printOut->addNumber(11); }
386 if( delta_phi<172.0 || delta_phi>188.0 ) return StatusCode::SUCCESS;
387 if( m_printOutInfo ) { m_printOut->addNumber(12); }
388 if( e1 < 1.1 || e2 < 1.1 ) return StatusCode::SUCCESS;
389 if( m_printOutInfo ) { m_printOut->addNumber(13); }
390 }
391 if( ( etot - e1 - e2 ) > 0.3 ) return StatusCode::SUCCESS;
392 if( m_printOutInfo ) { m_printOut->addNumber(14); }
393 }
394 else if( m_calibData == "Dimu" ) {
395 if( (*iter_kal1)->getStat(1,1)!=0 || (*iter_kal2)->getStat(1,1)!=0 ) return StatusCode::SUCCESS;
396 if( m_printOutInfo ) { m_printOut->addNumber(8); }
397 if( e1 > 0.5 || e2 > 0.5 )return StatusCode::SUCCESS;
398 if( m_printOutInfo ) { m_printOut->addNumber(9); }
399 }
400
401 }
402 //sunss add 08/9/17
403
404 TofTrackVec* tofTrackVec = new TofTrackVec;
405 RecExtTrackCol::iterator iter_track = extTrackCol->begin();
406 for( ; iter_track < extTrackCol->end(); iter_track++ ) {
407 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol->begin();
408 for( ; iter_kal != mdcKalTrackCol->end(); iter_kal++ ) {
409 if( (*iter_kal)->trackId() == (*iter_track)->trackId() ) break;
410 }
411 int kal[5] = {-1};
412 if( iter_kal != mdcKalTrackCol->end() ) {
413 for( unsigned int i=0; i<5; i++ ) {
414 kal[i] = (*iter_kal)->getStat( 1, i );
415 }
416 }
417 TofTrack* tof = new TofTrack;
418 tof->setExtTrack( (*iter_track), kal, t0, t0Stat );
419
420 if( tofTrackVec->size()>0 ) {
421 std::vector<TofTrack*>::iterator iterExt = tofTrackVec->begin();
422 for( ; iterExt < tofTrackVec->end(); iterExt++ ) {
423 if( (*iterExt)->isNoHit() ) continue;
424 tof->getMultiHit( *iterExt );
425 }
426 }
427
428 tofTrackVec->push_back( tof );
429 }
430
431 if( m_printOutInfo ) {
432 m_printOut->setTrack1Col( tofTrackVec );
433 }
434
435 // Retrieve Tof Digi Data
436 TofDataMap tofDataMap = tofDigiSvc->tofDataMapTof( t0 );
437 if( tofDataMap.empty() ) {
438 log << MSG::WARNING << "No Tof Data Map in RawDataProviderSvc! Run=" << run << " Event=" << event << endreq;
439 }
440
441 if( m_checkDigi && m_checkDigiRaw ) {
442 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),"/Event/Digi/TofDigiCol");
443 if( !tofDigiCol ) {
444 log << MSG::ERROR << "TofRec could not find Tof digi! Event = " << event << endreq;
445 }
446 else { m_checkdigi_tuple->FillCol( *eventHeader, tofDigiCol, t0, t0Stat ); }
447
448 m_checkdigi_tuple->FillCol( *eventHeader, tofDataMap, t0, t0Stat );
449 }
450
451 std::vector<int> deadId;
452 if( m_forCalibration ) {
453 for( unsigned int i=0; i<5; i++ ) {
454 int identmp = tofCaliSvc->BrEast(i);
455 if( identmp != 0x2fffffff ) {
456 deadId.push_back( identmp );
457 }
458 identmp = tofCaliSvc->BrWest(i);
459 if( identmp != 0x2fffffff ) {
460 deadId.push_back( identmp );
461 }
462 identmp = tofCaliSvc->Endcap(i);
463 if( identmp != 0x2fffffff ) {
464 deadId.push_back( identmp );
465 }
466 }
467 }
468
469 std::vector<TofTrack*>::iterator iter = tofTrackVec->begin();
470 for( ; iter < tofTrackVec->end(); iter++ ) {
471 if( (*iter)->isNoHit() ) continue;
472 (*iter)->setTofData( tofDataMap );
473 if( m_printOutInfo ) { m_printOut->setTrack2( (*iter) ); }
474 if( (*iter)->isNoHit() ) continue;
475 (*iter)->match( m_forCalibration, deadId, tofTrackVec );
476 if( m_printOutInfo ) { m_printOut->setTrack3( (*iter) ); }
477 }
478
479 iter = tofTrackVec->begin();
480 for( ; iter < tofTrackVec->end(); iter++ ) {
481
482 (*iter)->setCalibration();
483
484 if( m_checkDigi ) {
485 if( m_checkTrigger ) {
486 // retrieve trigger data for physics analysis
487 SmartDataPtr<TrigData> trigData(eventSvc(), "/Event/Trig/TrigData");
488 if (!trigData) {
489 log << MSG::FATAL << "Could not find Trigger Data for physics analysis" << endreq;
490 m_checkdigi_tuple->Fill_TofTrack( *eventHeader, *iter, t0, t0Stat );
491 }
492 else {
493 m_checkdigi_tuple->Fill_TofTrack( *eventHeader, *iter, t0, t0Stat, trigData );
494 }
495 }
496 else {
497 if( ( run < 0 ) && m_checkMcTruth ) {
498 SmartDataPtr<TofMcHitCol> tofMcCol(eventSvc(),"/Event/MC/TofMcHitCol");
499 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),"/Event/MC/McParticleCol");
500 if ( !tofMcCol || !mcParticleCol ) {
501 m_checkdigi_tuple->Fill_TofTrack( *eventHeader, *iter, t0, t0Stat, mdcKalTrackCol );
502 }
503 else {
504 m_checkdigi_tuple->Fill_TofTrack( *eventHeader, *iter, t0, t0Stat, mdcKalTrackCol, tofMcCol, mcParticleCol, m_calibData );
505 }
506 }
507 else {
508 m_checkdigi_tuple->Fill_TofTrack( *eventHeader, *iter, t0, t0Stat, mdcKalTrackCol );
509 }
510 }
511 }
512 }
513
514 tds.RegisterTDS( eventHeader->runNumber(), eventHeader->eventNumber(), tofTrackVec, m_forCalibration, m_calibData );
515
516 clearTofTrackVec( tofTrackVec );
517
518// Check RecTofTrackCol Registered
519 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),"/Event/Recon/RecTofTrackCol");
520 if (!tofTrackCol) {
521 log << MSG::FATAL << "TofRec could not find RecTofTrackCol!" << endreq;
522 return StatusCode::FAILURE;
523 }
524 else{
525 if( m_saveRootFile ) {
526 m_checkdata_tuple->FillCol( *eventHeader, tofTrackCol, mdcKalTrackCol );
527 }
528 }
529
530 if( m_forCalibration ) {
531 SmartDataPtr<RecBTofCalHitCol> bhitCol(eventSvc(),"/Event/Recon/RecBTofCalHitCol");
532 if (!bhitCol) {
533 log << MSG::WARNING << "TofRec could not find RecBTofCalHitCol!" << endreq;
534 }
535 else {
536 if( m_saveRootFile ) {
537 m_checkdata_tuple->FillCol( *eventHeader, bhitCol );
538 }
539 }
540
541 SmartDataPtr<RecETofCalHitCol> ehitCol(eventSvc(),"/Event/Recon/RecETofCalHitCol");
542 if (!ehitCol) {
543 log << MSG::WARNING << "TofRec could not find RecETofCalHitCol!" << endreq;
544 }
545 else {
546 if( m_saveRootFile ) {
547 m_checkdata_tuple->FillCol( *eventHeader, ehitCol );
548 }
549 }
550 }
551
552 }
553 else {
554 log << MSG::FATAL << "In TofRec: AcceleratorStatus is NOT correct! m_acceleratorStatus = " << m_acceleratorStatus << endreq;
555 return StatusCode::FAILURE;
556 }
557
558 return StatusCode::SUCCESS;
559
560}
Double_t etot
Double_t e1
Double_t e2
double abs(const EvtComplex &c)
Definition: EvtComplex.hh:212
IRawDataProviderSvc * tofDigiSvc
Definition: MrpcRec.cxx:46
std::vector< MrpcTrack * > TofTrackVec
Definition: MrpcTrack.h:220
std::multimap< unsigned int, TofData * > TofDataMap
Definition: TofData.h:244
ITofCaliSvc * tofCaliSvc
virtual TofDataMap & tofDataMapTof(double estime=0)=0
virtual const int BrWest(unsigned int No)=0
virtual const int BrEast(unsigned int No)=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)
Definition: TofCount.cxx:92
void setTrack1Col(std::vector< TofTrack * > *&tofTrackVec)
Definition: TofCount.cxx:109
void addNumber(unsigned int i)
Definition: TofCount.cxx:199
void setTrack3(TofTrack *&tof)
Definition: TofCount.cxx:131
void setTrack2(TofTrack *&tof)
Definition: TofCount.cxx:118
StatusCode RegisterTDS(int runNumber, int eventNumber, std::vector< TofTrack * > *&tofTrackVec, bool m_forCalibration, std::string m_calibData)
Definition: TofRecTDS.cxx:58
StatusCode RegisterNullRecTofTrackCol()
Definition: TofRecTDS.cxx:22
void clearTofTrackVec(std::vector< TofTrack * > *&tofTrackVec)
Definition: TofRec.cxx:580
void setExtTrack(RecExtTrack *extTrack, int kal[5], double t0, int t0Stat)
Definition: TofTrack.cxx:144
void getMultiHit(TofTrack *&)
Definition: TofTrack.cxx:244
const float pi
Definition: vector3.h:133

◆ finalize()

StatusCode TofRec::finalize ( )

Definition at line 564 of file TofRec.cxx.

564 {
565 if( m_printOutInfo ) {
566 if( m_forCalibration ) {
567 m_printOut->finalBhabha( m_calibData );
568 }
569 m_printOut->final();
570 delete m_printOut;
571 }
572 if( m_checkDigi ) delete m_checkdigi_tuple;
573 if( m_saveRootFile ) delete m_checkdata_tuple;
574 return StatusCode::SUCCESS;
575}
void finalBhabha(std::string calibData)
Definition: TofCount.cxx:207
void final()
Definition: TofCount.cxx:174

◆ initialize()

StatusCode TofRec::initialize ( )

Definition at line 70 of file TofRec.cxx.

70 {
71
72 MsgStream log(msgSvc(), name());
73 log << MSG::INFO << "TofRec in initialize()" << endreq;
74
75 //Get TOF Geomertry Service
76 StatusCode scg = service("TofGeomSvc", tofGeomSvc);
77 if (scg== StatusCode::SUCCESS) {
78 log << MSG::INFO << "TofRec Get Geometry Service Sucessfully!" << endreq;
79 }else {
80 log << MSG::ERROR << "TofRec Get Geometry Service Failed !" << endreq;
81 return StatusCode::FAILURE;
82 }
83
84 //Get TOF Calibtration Service
85 StatusCode scc = service("TofCaliSvc", tofCaliSvc);
86 if (scc == StatusCode::SUCCESS) {
87 log << MSG::INFO << "TofRec Get Calibration Service Sucessfully!" << endreq;
88 } else {
89 log << MSG::ERROR << "TofRec Get Calibration Service Failed !" << endreq;
90 return StatusCode::FAILURE;
91 }
92
93 //Get TOF Raw Data Provider Service
94 StatusCode scd = service("RawDataProviderSvc", tofDigiSvc);
95 if (scd == StatusCode::SUCCESS) {
96 log << MSG::INFO << "TofRec Get Tof Raw Data Service Sucessfully!" << endreq;
97 } else {
98 log << MSG::ERROR << "TofRec Get Tof Raw Data Service Failed !" << endreq;
99 return StatusCode::FAILURE;
100 }
101
102 if( m_checkDigi ) {
103 NTuplePtr nt11(ntupleSvc(),"FILE203/digi");
104 NTuplePtr nt12(ntupleSvc(),"FILE203/barrel");
105 NTuplePtr nt13(ntupleSvc(),"FILE203/endcap");
106 NTuplePtr nt14(ntupleSvc(),"FILE203/ext");
107 NTuplePtr nt15(ntupleSvc(),"FILE203/tof");
108 NTuplePtr nt16(ntupleSvc(),"FILE203/bb");
109
110 if( nt11 || nt12 || nt13 || nt14 || nt15 || nt16 ) {
111 m_tuple_digi = nt11;
112 m_tuple_barrel = nt12;
113 m_tuple_endcap = nt13;
114 m_tuple_ext = nt14;
115 m_tuple_tof = nt15;
116 m_tuple_bb = nt16;
117 }
118 else {
119 m_tuple_digi = ntupleSvc()->book("FILE203/digi",CLID_ColumnWiseTuple,"TofRec");
120 m_tuple_barrel = ntupleSvc()->book("FILE203/barrel",CLID_ColumnWiseTuple,"TofRec");
121 m_tuple_endcap = ntupleSvc()->book("FILE203/endcap",CLID_ColumnWiseTuple,"TofRec");
122 m_tuple_ext = ntupleSvc()->book("FILE203/ext",CLID_ColumnWiseTuple,"TofRec");
123 m_tuple_tof = ntupleSvc()->book("FILE203/tof",CLID_ColumnWiseTuple,"TofRec");
124 m_tuple_bb = ntupleSvc()->book("FILE203/bb",CLID_ColumnWiseTuple,"TofRec");
125
126 if( m_tuple_digi || m_tuple_barrel || m_tuple_endcap || m_tuple_ext || m_tuple_tof || m_tuple_bb ) {
127 m_checkdigi_tuple = new TofCheckDigi( m_tuple_digi, m_tuple_barrel, m_tuple_endcap, m_tuple_ext, m_tuple_tof, m_tuple_bb );
128 }
129 else {
130 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_digi) <<endmsg;
131 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_barrel) <<endmsg;
132 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_endcap) <<endmsg;
133 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_ext) <<endmsg;
134 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_tof) <<endmsg;
135 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_bb) <<endmsg;
136 return StatusCode::FAILURE;
137 }
138 }
139 }
140
141 if( m_saveRootFile ) {
142 NTuplePtr nt21(ntupleSvc(),"FILE201/trk");
143 NTuplePtr nt22(ntupleSvc(),"FILE201/cbtrk");
144 NTuplePtr nt23(ntupleSvc(),"FILE201/cetrk");
145
146 if( nt21 || nt22 || nt23 ) {
147 m_tuple_trk = nt21;
148 m_tuple_cbtrk = nt22;
149 m_tuple_cetrk = nt23;
150 }
151 else {
152 m_tuple_trk = ntupleSvc()->book("FILE201/trk",CLID_ColumnWiseTuple,"TofRec");
153 m_tuple_cbtrk = ntupleSvc()->book("FILE201/cbtrk",CLID_ColumnWiseTuple,"TofRec");
154 m_tuple_cetrk = ntupleSvc()->book("FILE201/cetrk",CLID_ColumnWiseTuple,"TofRec");
155 if( m_tuple_trk || m_tuple_cbtrk || m_tuple_cetrk ) {
156 m_checkdata_tuple = new TofCheckData( m_tuple_trk, m_tuple_cbtrk, m_tuple_cetrk );
157 }
158 else {
159 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_trk) <<endmsg;
160 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_cbtrk) <<endmsg;
161 log << MSG::ERROR <<"Cannot book N-tuple:" << long(m_tuple_cetrk) <<endmsg;
162 return StatusCode::FAILURE;
163 }
164 }
165 }
166
167 if( m_printOutInfo ) { m_printOut = new TofCount; }
168
169 return StatusCode::SUCCESS;
170}
ITofGeomSvc * tofGeomSvc
Definition: MrpcRec.cxx:42
INTupleSvc * ntupleSvc()

The documentation for this class was generated from the following files: