164 {
165
166 MsgStream log(
msgSvc(), name());
167 log << MSG::INFO << "in execute()" << endreq;
168
169
170 StatusCode sc = StatusCode::SUCCESS;
171
172
173 int event, run;
174
175 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
176 if (!eventHeader) {
177 log << MSG::FATAL << "Could not find Event Header" << endreq;
178
179 }
180 m_totalEvent ++;
181 log << MSG::INFO << "Event: "<<m_totalEvent<<"\tcurrent run: "<<eventHeader->runNumber()<<"\tcurrent event: "<< eventHeader->eventNumber()<<endreq;
182
183
184 if(m_CompareWithMcHit==1){
185 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),"/Event/MC/McParticleCol");
186 if (!mcParticleCol) {
187 log << MSG::FATAL << "Could not find McParticle" << endreq;
188
189 }
190
191 McParticleCol::iterator iter_mc = mcParticleCol->begin();
192
193
194
195 int pid = (*iter_mc)->particleProperty();
196 int charge = 0;
198
199 if( pid >0 )
200 {
201 if(m_particleTable->particle( pid )){
202 charge = (int)m_particleTable->particle( pid )->charge();
203 mass = m_particleTable->particle( pid )->mass();
204 }
205 else log << MSG::ERROR << "no this particle id in particle table, please check data" <<endreq;
206 } else if ( pid <0 ) {
207 if(m_particleTable->particle( -pid )){
208 charge = (int)m_particleTable->particle( -pid )->charge();
209 charge *= -1;
210 mass = m_particleTable->particle( -pid )->mass();
211 }
212 else log << MSG::ERROR << "no this particle id in particle table, please check data" <<endreq;
213 } else {
214 log << MSG::WARNING << "wrong particle id, please check data" <<endreq;
215 }
216
217
218
219
220
221
222
223 HepLorentzVector initialMomentum = (*iter_mc)->initialFourMomentum();
224 HepLorentzVector initialPos = (*iter_mc)->initialPosition();
225 if(m_NtOutput>=1){
226 m_px_mc = initialMomentum.px();
227 m_py_mc = initialMomentum.py();
228 m_pz_mc = initialMomentum.pz();
229 }
230
231
232 log << MSG::INFO << " particleId = " << (*iter_mc)->particleProperty() << endreq;
233 }
234
235
236 int digiId = 0;
237 SmartDataPtr<MucDigiCol> mucDigiCol(eventSvc(),"/Event/Digi/MucDigiCol");
238 if (!mucDigiCol) {
239 log << MSG::FATAL << "Could not find MUC digi" << endreq;
240 return( StatusCode::FAILURE);
241 }
242 MucDigiCol::iterator iter4 = mucDigiCol->begin();
243 for (;iter4 != mucDigiCol->end(); iter4++, digiId++) {
244 }
245 log << MSG::INFO << "Total MUC digis:\t" << digiId << endreq;
246 if( digiId == 0 ) return ( StatusCode::SUCCESS);
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
275
276
277
278
279 if (m_CompareWithMcHit) {
282
283 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),"/Event/MC/McParticleCol");
284 if (!mcParticleCol) {
285 log << MSG::FATAL << "Could not find McParticle" << endreq;
286
287 }
288 McParticleCol::iterator iter_mc = mcParticleCol->begin();
289
290
291 SmartDataPtr<Event::MucMcHitCol> aMucMcHitCol(eventSvc(),"/Event/MC/MucMcHitCol");
292 if (!aMucMcHitCol) {
293 log << MSG::WARNING << "Could not find MucMcHitCol" << endreq;
294
295 }
296
297 log << MSG::DEBUG << "MucMcHitCol contains " << aMucMcHitCol->size() << " Hits " << endreq;
298 MucMcHitCol::iterator iter_MucMcHit = aMucMcHitCol->begin();
299 for (; iter_MucMcHit != aMucMcHitCol->end(); iter_MucMcHit++) {
300 mucID = (*iter_MucMcHit)->identify();
301
302 log << MSG::DEBUG << " MucMcHit " << " : "
307 << " Track Id " << (*iter_MucMcHit)->getTrackIndex()
308 << " pos x " << (*iter_MucMcHit)->getPositionX()
309 << " pos y " << (*iter_MucMcHit)->getPositionY()
310 << " pos z " << (*iter_MucMcHit)->getPositionZ()
311 << endreq;
312
314 for (iter_mc = mcParticleCol->begin(); iter_mc != mcParticleCol->end(); iter_mc++) {
315 if ( (*iter_mc)->trackIndex() == (*iter_MucMcHit)->getTrackIndex() ) {
316 assocMcPart = *iter_mc;
317 break;
318 }
319 }
320 if (assocMcPart == 0) {
321 log << MSG::WARNING << "No Corresponding Mc Particle found for this MucMcHit" << endreq;
322 }
323
324 MucMcHit *assocMucMcHit = *iter_MucMcHit;
327 if (relMcMuc == 0) log << MSG::DEBUG << "relMcMuc not created " << endreq;
328 else {
330 if(!addstat) delete relMcMuc;
331 }
332 }
333
334 log << MSG::DEBUG <<
" Fill McPartToMucHitTab, size " << assocMcMuc.
size() << endreq;
335 iter_mc = mcParticleCol->begin();
336 for (;iter_mc != mcParticleCol->end(); iter_mc++) {
337 log << MSG::DEBUG << " Track index " << (*iter_mc)->trackIndex()
338 << " particleId = " << (*iter_mc)->particleProperty()
339 << endreq;
340
341 vector< McPartToMucHitRel* > vecMucMcHit = assocMcMuc.
getRelByFirst(*iter_mc);
342 vector< McPartToMucHitRel* >::iterator iter_MucMcHit = vecMucMcHit.begin();
343 for (; iter_MucMcHit != vecMucMcHit.end(); iter_MucMcHit++) {
344 mucID = (*iter_MucMcHit)->getSecond()->identify();
345
346 log << MSG::DEBUG
347
348 << " MC Particle index "
349 << (*iter_MucMcHit)->getFirst()->trackIndex()
350 << " contains " << " MucMcHit "
355
356
357
358 << endreq;
359 }
360 }
361
362
363
364
365
366
367
368
369
370
371
372
373 }
374
375
376
377 if (!m_MucRecHitContainer) {
379 }
380 m_MucRecHitContainer->
Clear();
383
384 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
385 DataObject *mucRecHitCol;
386 eventSvc()->findObject("/Event/Recon/MucRecHitCol",mucRecHitCol);
387 if(mucRecHitCol != NULL) {
388 dataManSvc->clearSubTree("/Event/Recon/MucRecHitCol");
389 eventSvc()->unregisterObject("/Event/Recon/MucRecHitCol");
390 }
391
392 sc = eventSvc()->registerObject("/Event/Recon/MucRecHitCol", aMucRecHitCol);
393 if (!sc) {
394 log << MSG::ERROR << "/Event/Recon/MucRecHitCol not registerd!" << endreq;
395 return( StatusCode::FAILURE);
396 }
397
398 log << MSG::INFO << "Add digis" << endreq;
399 MucDigiCol::iterator iter_Muc = mucDigiCol->begin();
400 int mucDigiId = 0;
401 for (;iter_Muc != mucDigiCol->end(); iter_Muc++, mucDigiId++) {
402 mucID = (*iter_Muc)->identify();
407
408 m_MucRecHitContainer->
AddHit(part, seg, gap, strip);
409
410 log << MSG::DEBUG << " digit" << mucDigiId << " : "
411 << " part " << part
412 << " seg " << seg
413 << " gap " << gap
414 << " strip " << strip
415 << endreq;
416 }
417
418
419
421
422
423 DataObject *aReconEvent ;
424 eventSvc()->findObject("/Event/Recon",aReconEvent);
425 if(aReconEvent==NULL) {
426
428 StatusCode sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
429 if(sc!=StatusCode::SUCCESS) {
430 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
431 return( StatusCode::FAILURE);
432 }
433 }
434 StatusCode fr = eventSvc()->findObject("/Event/Recon",aReconEvent);
435 if(fr!=StatusCode::SUCCESS) {
436 log << MSG::WARNING << "Could not find register ReconEvent, will create it" <<endreq;
437 StatusCode sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
438 if(sc!=StatusCode::SUCCESS) {
439 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
440 return( StatusCode::FAILURE);
441 }
442 }
443
444 DataObject *mucTrackCol;
445 eventSvc()->findObject("/Event/Recon/RecMucTrackCol",mucTrackCol);
446 if(mucTrackCol != NULL) {
447 dataManSvc->clearSubTree("/Event/Recon/RecMucTrackCol");
448 eventSvc()->unregisterObject("/Event/Recon/RecMucTrackCol");
449 }
450
451 sc = eventSvc()->registerObject("/Event/Recon/RecMucTrackCol", aRecMucTrackCol);
452 if(sc!=StatusCode::SUCCESS) {
453 log << MSG::FATAL << "Could not register MUC track collection" << endreq;
454 return( StatusCode::FAILURE);
455 }
456
457
458 SmartDataPtr<RecMucTrackCol> findRecMucTrackCol(eventSvc(),"/Event/Recon/RecMucTrackCol");
459 if (!findRecMucTrackCol) {
460 log << MSG::FATAL << "Could not find RecMucTrackCol" << endreq;
461 return( StatusCode::FAILURE);
462 }
463 aRecMucTrackCol->clear();
464
465
466
467
468
469 SmartDataPtr<RecExtTrackCol> aExtTrackCol(eventSvc(),"/Event/Recon/RecExtTrackCol");
470 if (!aExtTrackCol) {
471 log << MSG::WARNING << "Can't find ExtTrackCol in TDS!" << endreq;
472
473 }
474
475 SmartDataPtr<RecMdcTrackCol> aMdcTrackCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
476 if (!aMdcTrackCol) {
477 log << MSG::WARNING << "Can't find MdcTrackCol in TDS!" << endreq;
478
479 }
480
481
482
483 SmartDataPtr<RecEmcShowerCol> aShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol");
484 if (!aShowerCol) {
485 log << MSG::WARNING << "Could not find RecEmcShowerCol" << endreq;
486
487 }
488
489
490
491
492
493
494
495
496
497 int muctrackId = 0;
498
499 log << MSG::INFO << "Add tracks info, ExtTrackSeedMode = " << m_ExtTrackSeedMode << ", EmcShowerSeedMode = " << m_EmcShowerSeedMode << endreq;
500
501 if (m_ExtTrackSeedMode == 1)
502 {
503 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),"/Event/MC/McParticleCol");
504 if (!mcParticleCol) {
505 log << MSG::FATAL << "Could not find McParticle" << endreq;
506
507 return( StatusCode::SUCCESS);
508 }
509 McParticleCol::iterator iter_mc = mcParticleCol->begin();
510
511 int trackIndex = -99;
512 for (int iTrack = 0;iter_mc != mcParticleCol->end(); iter_mc++, iTrack++) {
513 if(!(*iter_mc)->primaryParticle()) continue;
514 int pid = (*iter_mc)->particleProperty();
515 int charge = 0;
517 if( pid >0 )
518 {
519 if(m_particleTable->particle( pid )){
520 charge = (int)m_particleTable->particle( pid )->charge();
521 mass = m_particleTable->particle( pid )->mass();
522 }
523 else log << MSG::ERROR << "no this particle id in particle table, please check data" <<endreq;
524 } else if ( pid <0 )
525 {
526 if(m_particleTable->particle( -pid )){
527 charge = (int)m_particleTable->particle( -pid )->charge();
528 charge *= -1;
529 mass = m_particleTable->particle( -pid )->mass();
530 }
531 else log << MSG::ERROR << "no this particle id in particle table, please check data" <<endreq;
532 } else {
533 log << MSG::WARNING << "wrong particle id, please check data" <<endreq;
534 }
535
536 if(!charge) {
537 log << MSG::WARNING
538 << " neutral particle charge = 0!!! ...just skip it !"
539 << endreq;
540 continue;
541 }
542
543 trackIndex = (*iter_mc)->trackIndex();
544 log << MSG::DEBUG << "iTrack " << iTrack << " index " << trackIndex
545 << " particleId = " << (*iter_mc)->particleProperty()
546 << endreq;
547
550 aTrack->
setId(muctrackId);
551
552 HepLorentzVector initialMomentum = (*iter_mc)->initialFourMomentum();
553 HepLorentzVector initialPos = (*iter_mc)->initialPosition();
554 float theta0 = initialMomentum.theta();
555 float phi0 = initialMomentum.phi();
556
557
558
559 float x0 = initialPos.x();
560 float y0 = initialPos.y();
561 float z0 = initialPos.z();
562
563 Hep3Vector startPos(x0, y0, z0);
564 Hep3Vector startP(initialMomentum.px(), initialMomentum.py(), initialMomentum.pz());
565 log << MSG::DEBUG << "startP " << startP <<" startPos "<<startPos<< endreq;
566 Hep3Vector endPos(0, 0, 0), endP;
567
572 aTrack->
SetExtMucPos( endPos.x(), endPos.y(), endPos.z() );
574 aTrack->
SetMucPos( endPos.x(), endPos.y(), endPos.z() );
578
579
580
581
582
583
584
585
586
587
588 log << MSG::INFO << "Add track, trkIndex: " << trackIndex << "\tmucTrkId: " << muctrackId << endreq;
589 aRecMucTrackCol->add(aTrack);
590 muctrackId ++ ;
591 }
592 }
593 else if (m_ExtTrackSeedMode == 2)
594 {
595 if (!aExtTrackCol || !aMdcTrackCol) {
596 log << MSG::WARNING << "Can't find ExtTrackCol or MdcTrackCol in TDS!" << endreq;
597 return StatusCode::SUCCESS;
598 }
599
600 int trackIndex = -99;
601 double kdep = -99;
602 double krechi = 0.;
603 int kdof = 0;
604 int kbrLay = -1;
605 int kecLay = -1;
606
607 RecExtTrackCol::iterator iter_ExtTrack = aExtTrackCol->begin();
608 RecMdcTrackCol::iterator iter_MdcTrack = aMdcTrackCol->begin();
609 int iExtTrack = 0;
610 for (;iter_ExtTrack != aExtTrackCol->end() && iter_MdcTrack != aMdcTrackCol->end(); iter_ExtTrack++, iter_MdcTrack++, iExtTrack++)
611 {
612 trackIndex = (*iter_ExtTrack)->GetTrackId();
613 log << MSG::DEBUG << "iExtTrack " << iExtTrack << " index " << trackIndex << " MucPos "
614 << iExtTrack << (*iter_ExtTrack)->mucPosition().x() << " "
615 << (*iter_ExtTrack)->mucPosition().y() << " "
616 << (*iter_ExtTrack)->mucPosition().z() << " r "
617 << (*iter_ExtTrack)->mucPosition().r() << endreq;
618
619 if((*iter_ExtTrack)->mucPosition().x() == -99 &&
620 (*iter_ExtTrack)->mucPosition().y() == -99 &&
621 (*iter_ExtTrack)->mucPosition().z() == -99)
622 {
623 log << MSG::INFO <<"Bad ExtTrack, trackIndex: " << trackIndex << ", skip" << endreq;
624 continue;
625 }
626
627
628 krechi = (*iter_ExtTrack)->MucKalchi2();
629 kdof= (*iter_ExtTrack)->MucKaldof();
630 kdep = (*iter_ExtTrack)->MucKaldepth();
631 kbrLay = (*iter_ExtTrack)->MucKalbrLastLayer();
632 kecLay = (*iter_ExtTrack)->MucKalecLastLayer();
633 if(kdof<=0)krechi = 0.;
634 else krechi = krechi/kdof;
635 kdep = kdep/10.;
636
639 aTrack->
setId(muctrackId);
640
642
644
645
651
652
653 Hep3Vector mdcMomentum = (*iter_MdcTrack)->p3();
654 Hep3Vector mucPos = (*iter_ExtTrack)->mucPosition();
655 Hep3Vector mucMomentum = (*iter_ExtTrack)->mucMomentum();
656
657
658 aTrack->
SetMdcMomentum( mdcMomentum.x(), mdcMomentum.y(), mdcMomentum.z() );
659 aTrack->
SetExtMucPos( mucPos.x(), mucPos.y(), mucPos.z() );
660
662 aTrack->
SetMucPos( mucPos.x(), mucPos.y(), mucPos.z() );
663 aTrack->
SetMucMomentum( mucMomentum.x(), mucMomentum.y(), mucMomentum.z() );
665 aTrack->
SetCurrentDir( mucMomentum.x(), mucMomentum.y(), mucMomentum.z() );
667
668 log << MSG::INFO << "Add track, trkIndex: " << trackIndex << "\tmucTrkId: " << muctrackId << endreq;
669 aRecMucTrackCol->add(aTrack);
670 muctrackId ++ ;
671 }
672 }
673 else if(m_ExtTrackSeedMode == 3)
674 {
675
676 if (!aMdcTrackCol) {
677 log << MSG::WARNING << "Can't find MdcTrackCol in TDS!" << endreq;
678 return StatusCode::SUCCESS;
679
680 }
681 log<< MSG::INFO << "Mdc track size: "<<aMdcTrackCol->size()<<endreq;
682
683 int trackIndex = -99;
684 for(RecMdcTrackCol::iterator iter_mdc1 = aMdcTrackCol->begin(); iter_mdc1 != aMdcTrackCol->end(); iter_mdc1++){
685
686
687
688
689 trackIndex = (*iter_mdc1)->trackId();
690 HepVector helix = (*iter_mdc1)->helix();
691
692
693 float x0 = helix[0] *
cos(helix[1]);
694 float y0 = helix[0] *
sin(helix[1]);
695 float z0 = helix[3];
696
697
698
699
700
701 float dx = -1*
sin(helix[1]);
702 float dy =
cos(helix[1]);
703 float dz = helix[4];
704
705
706
709 aTrack->
setId(muctrackId);
710 muctrackId ++ ;
711
713
714
715 Hep3Vector mucPos(x0,y0,z0);
716 Hep3Vector mucMomentum(dx,dy,dz);
717
720
726
727 log << MSG::INFO << "Add track, trkIndex: " << trackIndex << "\tmucTrkId: " << muctrackId << endreq;
728 aRecMucTrackCol->add(aTrack);
729 muctrackId ++ ;
730 }
731 }
732 else {log << MSG::INFO <<"ExtTrackSeedMode error!"<<endreq; }
733
734
735 if(m_EmcShowerSeedMode == 1)
736 {
737 int trackIndex = 999;
738 RecEmcShowerCol::iterator iShowerCol;
739 for(iShowerCol=aShowerCol->begin(); iShowerCol!=aShowerCol->end(); iShowerCol++)
740 {
741
742
743
744
747 aTrack->
setId(muctrackId);
749
750 Hep3Vector mucPos = (*iShowerCol)->position();
751 Hep3Vector mucMomentum = (*iShowerCol)->position();
752
753 aTrack->
SetExtMucPos( mucPos.x(), mucPos.y(), mucPos.z() );
754
756 aTrack->
SetMucPos( mucPos.x(), mucPos.y(), mucPos.z() );
757 aTrack->
SetMucMomentum( mucMomentum.x(), mucMomentum.y(), mucMomentum.z() );
759 aTrack->
SetCurrentDir( mucMomentum.x(), mucMomentum.y(), mucMomentum.z() );
761
762
763 log << MSG::INFO << "Add track, trkIndex: " << trackIndex << "\tmucTrkId: " << muctrackId << endreq;
764 aRecMucTrackCol->add(aTrack);
765 muctrackId ++ ;
766
767 m_emcrec = 1;
768 }
769 }
770 log << MSG::DEBUG << " track container filled " << endreq;
771
772
773 log << MSG::INFO << "Start tracking..." << endreq;
774 int runVerbose = 1;
776 for(int iTrack = 0; iTrack < (int)aRecMucTrackCol->size(); iTrack++)
777 {
778 log << MSG::DEBUG << "iTrack " << iTrack << endreq;
779 aTrack = (*aRecMucTrackCol)[iTrack];
780
781
784 if(currentPos.mag() <
kMinor) {
785 log << MSG::WARNING << "No MUC intersection in track " << iTrack << endreq;
786 continue;
787 }
788
789
790 int firstHitFound[2] = { 0, 0};
791 int firstHitGap[2] = {-1, -1};
793 {
796 {
797
798 int seg = -1;
800
801 float xInsct, yInsct, zInsct;
802 aTrack->
Project(iPart, iGap, xInsct, yInsct, zInsct, seg);
803 if(m_MsOutput) cout << "part " << iPart << " gap " << iGap << " x " << xInsct << " y " << yInsct << " z " << zInsct << " seg " << seg << endl;
804
805 if(seg == -1) continue;
806
808
809 for(
int iDeltaSeg = 0; iDeltaSeg <
kNSegSearch; iDeltaSeg++)
810 {
814
815
816
817
818
819
822
824 for (
int iHit = 0; iHit < m_MucRecHitContainer->
GetGapHitCount(iPart, iSeg, iGap); iHit++)
825 {
826 log << MSG::DEBUG << "iSeg " << iSeg << " iHit " << iHit << endreq;
827 MucRecHit* pHit = m_MucRecHitContainer->
GetHit(iPart, iSeg, iGap, iHit);
828
829
830 if (!pHit) {
831 log << MSG::WARNING << "MucRecTrkExt: null pointer to pHit" << endreq;
832 continue;
833 }
834 else
835 {
836
837
838
840 log << MSG::DEBUG << "distance = " << setw(8) << dX << " size " << setw(4) << window << endreq;
841
842 if(m_NtOutput >= 2){
843 m_distance = dX;
844 m_part = iPart; m_seg = iSeg; m_gap = iGap; m_strip = pHit->
Strip();
845 m_diff = -99; m_tuple->write();
846 }
847
848 if (fabs(dX) < window)
849 {
850
851
852
853
857
858 }
860
864 }
865 }
866
867
869
870 if (firstHitGap[orient] == -1) firstHitGap[orient] = iGap;
871 firstHitFound[orient] = 1;
872
873
874 log << MSG::DEBUG << " part " << iPart << " seg " << iSeg << " gap " << iGap
875 <<
" strip " << setw(2) << pHit->
Strip() <<
" attatched" << endreq;
876 log << MSG::DEBUG <<
"current total hits " << aTrack->
GetTotalHits() << endreq;
877 }
878 else {
879 m_NHitsLostInGap[iGap]++;
880
881
882
883 }
884 }
885 }
887 }
888
889
890 if(m_ExtTrackSeedMode != 3 && !m_Blind) {
891 if (firstHitFound[orient] && firstHitGap[orient] != iGap) aTrack->
CorrectDir();
893 }
894
895
897 }
898 }
899 aTrack->
LineFit(m_fittingMethod);
901 log << MSG::INFO <<
"Fit track done! trackIndex: " << aTrack->
trackId() <<
", mucId: " << aTrack->
id() <<
", RecMode: " << aTrack->
GetRecMode() << endreq;
902
903 if(m_NtOutput>=1)
904 {
905 m_depth = aTrack->
depth();
908 m_Chi2 = aTrack->
chi2();
915
916 m_emctrack = m_emcrec;
917 }
918
919
920 if(m_NtOutput>=2)
921 {
922 vector<MucRecHit*> attachedHits = aTrack->
GetHits();
924 vector<float> distanceHits = aTrack->
getDistHits();
927
928 for(int i=0; i< expectedHits.size(); i++)
929 {
931
932 }
933
934 for(int j=0; j< attachedHits.size(); j++)
935 {
937
938 if(attachedHits.size()==distanceHits.size())
939 {
940 m_part = jhit->
Part(); m_seg = jhit->
Seg(); m_gap = jhit->
Gap();
941 m_strip = jhit->
Strip();
942 m_distance = distanceHits[j];
943 m_Distance = distanceHits_quad[j];
944 m_diff = -9999;
945
946
947
948 m_tuple->write();
949 }
950 }
951 }
952
954
955
956 log << MSG::DEBUG <<
"track Index " << aTrack->
trackId()
957 << setw(2) << mucDigiCol->size() - nHitsAttached << " of "
958 << setw(2) << mucDigiCol->size() << " lost " << endreq;
959
960 }
961
962
963
964
965
966
967
968 if(m_MucHitSeedMode == 1)
969 {
970 MucRecHit *pHit = 0 ,*pHit0 = 0, *pHit1 = 0;
972
974 {
976 {
977 bool hit0 = false, hit1 = false; int firstgap0 = -1, firstgap1 = -1; int nStrip0 = 0, nStrip1 = 0;
978 Hep3Vector posHit0, posHit1;
980 {
982 for (
int iHit0 = 0; iHit0 <
count; iHit0++)
983 {
984
985 pHit = m_MucRecHitContainer->
GetHit(iPart, iSeg, iGap, iHit0);
986 if (!pHit) {
987 log << MSG::FATAL << "MucRecRoadFinder-E10 " << " part " << iPart
988 << " seg " << iSeg << " gap " << iGap << " null pointer"
989 << endl;
990 }
991 else
992 {
993
995 {
997 if(orient == 1 && hit0 == false){
998 hit0 = true;
999 firstgap0 = iGap;
1000 }
1001 if(iGap == firstgap0){
1003 nStrip0++;
1004 }
1005
1006 if(orient == 0 && hit1 == false){
1007 hit1 = true;
1008 firstgap1 = iGap;
1009 }
1010 if(iGap == firstgap1){
1012 nStrip1++;
1013 }
1014
1015
1016
1017
1018
1019
1020
1021
1022 }
1023 }
1024 }
1025 }
1026
1027
1028 if(hit0 && hit1)
1029 {
1030 posHit0 /= nStrip0;
1031 posHit1 /= nStrip1;
1032
1033
1034
1035 int trackIndex = 999;
1038 aTrack->
setId(muctrackId);
1039 muctrackId ++ ;
1040
1042
1043 Hep3Vector mucPos, mucMomentum;
1044 if(iPart==1) {
1045 mucMomentum.set(posHit0.x(),posHit0.y(),posHit1.z());
1046 mucPos = mucMomentum * 0.9;
1047 }
1048 else{
1049 mucMomentum.set(posHit0.x(),posHit1.y(),posHit0.z()*0.5+posHit1.z()*0.5);
1050 mucPos = mucMomentum * 0.9;
1051 }
1052
1053 aTrack->
SetExtMucPos( mucPos.x(), mucPos.y(), mucPos.z() );
1054
1056 aTrack->
SetMucPos( mucPos.x(), mucPos.y(), mucPos.z() );
1057 aTrack->
SetMucMomentum( mucMomentum.x(), mucMomentum.y(), mucMomentum.z() );
1059 aTrack->
SetCurrentDir( mucMomentum.x(), mucMomentum.y(), mucMomentum.z() );
1060
1062 aRecMucTrackCol->add(aTrack);
1063
1065 }
1066
1067 if(m_NtOutput>=1){
1068 m_depth = aTrack->
depth();
1071 m_Chi2 = aTrack->
chi2();
1078
1079 m_emctrack = 2;
1080 }
1081
1082 }
1083 }
1084 }
1085
1086
1087 int nTracksTotal = 0;
1088 int nTracksFound = 0;
1089 int nTracksLost = 0;
1090 int nTracksLostByExt = 0;
1091 int nTracksMisFound = 0;
1092
1093 int nDigisTotal = 0;
1094 int nHitsTotal = 0;
1095 int nHitsFound = 0;
1096 int nHitsLost = 0;
1097 int nHitsMisFound = 0;
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303 m_NDigisTotal += nDigisTotal;
1304 m_NHitsTotal += nHitsTotal;
1305 m_NHitsFoundTotal += nHitsFound;
1306 m_NHitsLostTotal += nHitsLost;
1307 m_NHitsMisFoundTotal += nHitsMisFound;
1308
1309
1310 m_NTracksTotal += nTracksTotal;
1311 m_NTracksRecoTotal += nTracksFound;
1312 m_NTracksLostByMdcTotal += nTracksLost;
1313 m_NTracksLostByExtTotal += nTracksLostByExt;
1314 m_NTracksMdcGhostTotal += nTracksMisFound;
1315 if (aRecMucTrackCol->size() > 0)
1316 {
1317 RecMucTrack *aRecMucTrack = (*aRecMucTrackCol)[0];
1318
1319 if(m_NtOutput>=1){
1323
1327 }
1328
1329
1330 }
1331
1332 if(m_NtOutput>=1) m_tuple->write();
1333 return StatusCode::SUCCESS;
1334}
double sin(const BesAngle a)
double cos(const BesAngle a)
ObjectVector< MucRecHit > MucRecHitCol
const int kDeltaSeg[kNSegSearch]
const float kFirstHitWindowRatio
ObjectVector< RecMucTrack > RecMucTrackCol
void setkalbrLastLayer(int br)
int maxHitsInLayer() const
void setkalecLastLayer(int ec)
void setkalRechi2(double ch)
void setkalDepth(double de)
void init()
Initialize the internal pointer to an ObjectList of relations.
unsigned long size() const
This method returns the number of relations in the table.
bool addRelation(Relation< T1, T2 > *rel)
std::vector< Relation< T1, T2 > * > getRelByFirst(const T1 *pobj) const
MucGeoGap * GetGap(const int part, const int seg, const int gap) const
Get a pointer to the gap identified by (part,seg,gap).
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
static int barrel_ec(const Identifier &id)
Values of different levels.
static int layer(const Identifier &id)
static int channel(const Identifier &id)
static int segment(const Identifier &id)
static value_type getPartNum()
static value_type getSegNum(int part)
static value_type getGapNum(int part)
void Clear()
Remove all hit objects from the container, and destroy them.
MucRecHit * GetHit(const MucRecHitID hitID)
Get a MucRecHit object by hit identifier.
void AddHit(const Identifier id)
void SetMucRecHitCol(MucRecHitCol *p)
int GetGapHitCount(const MucRecHitID gapID)
How many hits are there in this gap?
Hep3Vector GetCenterPos() const
Get Center position of the strip (global coords).
int Part() const
Get Part.
int Strip() const
Get Strip.
void SetHitMode(int recmode)
void TrackFinding(RecMucTrack *aTrack)
float getWindowSize(Hep3Vector mom, int part, int seg, int gap)
int GetTotalHits() const
How many hits in all does this track contain?
void LineFit(int fittingMethod)
Line fit with hits on a seg with max hits.
void CorrectPos()
Correct current position of this trajectory.
void CorrectDir()
Correct direction of this trajectory.
void ComputeTrackInfo(int fittingmethod)
Get corresponding monte carlo track pointer.
void pushExtDistHits(float dist)
vector< float > getExtDistHits() const
void SetMdcMomentum(const float px, const float py, const float pz)
set start moment of the track in Mdc.
Hep3Vector getMucPos() const
start position of this track in Muc.
Hep3Vector getMucPosSigma() const
void AttachInsct(Hep3Vector insct)
Attach the intersection to this trajectory.
void SetExtMucPos(const float x, const float y, const float z)
set start position of ext track in Muc. (compute from MdcPos MdcMomentum or get from ExtTrack)
void SetExtTrackID(int id)
set Ext track id. for compute from mdc myself
void SetMdcPos(const float x, const float y, const float z)
set start position of the track in Mdc.
void SetCurrentDir(const float x, const float y, const float z)
set current direction of the trajectory.
void SetExtTrack(RecExtTrack *extTrack)
set Ext track point.
void setTrackId(const int trackId)
set the index for this track.
Hep3Vector GetExtMucDistance() const
Distance match of the ext track with muc track in first layer.
void GetMdcExtTrack(Hep3Vector mdcStartPos, Hep3Vector mdcStartMomentum, int charge, Hep3Vector &mucStartPos, Hep3Vector &mucStartMomentum)
compute ext track myself from mdc.
Hep3Vector GetMucStripPos() const
Hep3Vector GetCurrentDir() const
Current direction.
Hep3Vector getMdcMomentum() const
momentum of this track in Mdc
Hep3Vector CalculateInsct(const int part, const int seg, const int gap)
Calculate intersection from all hits attached on this gap.
void Project(const int &part, const int &gap, float &x, float &y, float &z, int &seg)
Where does the trajectory of this track intersect a specific gap?
vector< float > getQuadDistHits() const
void SetMucMomentum(const float px, const float py, const float pz)
set start moment of the track in Muc.
Hep3Vector GetCurrentInsct() const
Current intersection.
void SetExtMucMomentum(const float px, const float py, const float pz)
set start moment of ext track in Muc.
vector< MucRecHit * > GetHits() const
Get all hits on this track.
void AttachHit(MucRecHit *hit)
set corresponding monte carlo track pointer.
Hep3Vector GetCurrentPos() const
Current position.
void SetCurrentInsct(const float x, const float y, const float z)
set current intersection of the trajectory with strip plane.
void SetCurrentPos(const float x, const float y, const float z)
set current position of the trajectory.
vector< MucRecHit * > GetExpectedHits() const
void SetRecMode(int recmode)
void SetMucPos(const float x, const float y, const float z)
set start position of the track in Muc. (after line fit and correction)
float GetHitDistance2(const MucRecHit *hit)
no abs value
vector< float > getDistHits() const
Event::Relation< Event::McParticle, Event::MucMcHit > McPartToMucHitRel