171 {
172
173 MsgStream log(
msgSvc(), name());
174 log << MSG::INFO << "in execute()" << endreq;
175
176
177 int event, run;
178
179 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
180 if (!eventHeader) {
181 log << MSG::FATAL << "Could not find Event Header" << endreq;
182 return( StatusCode::FAILURE);
183 }
184 log << MSG::INFO << "Run: " << eventHeader->runNumber() << " Event: " << eventHeader->eventNumber() << endreq;
185
186event = eventHeader->eventNumber();
187run = eventHeader->runNumber();
188
189
190 string release = getenv(
"BES_RELEASE");
191
192
193
194 for (std::vector<FilterEvent>::iterator it = m_filter_event.begin();
195 it != m_filter_event.end(); ++it) {
196 const FilterEvent& fe = (*it);
197 if (
release == fe.bossver && run == fe.runid && event == fe.eventid) {
198 cout << "SKIP: " << fe.bossver << " "
199 << fe.runid << " "
200 << fe.eventid << std::endl;
201 return StatusCode::SUCCESS;
202 }
203 }
204
205 int digiId;
206
207
208
209 Hep3Vector cosmicMom;
210 if(m_mccosmic==1){
211 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),"/Event/MC/McParticleCol");
212 if (!mcParticleCol) {
213 log << MSG::FATAL << "Could not find McParticle" << endreq;
214 return( StatusCode::FAILURE);
215 }
216
217 McParticleCol::iterator iter_mc = mcParticleCol->begin();
218 for (;iter_mc != mcParticleCol->end(); iter_mc++, digiId++) {
219 log << MSG::DEBUG
220 << " particleId = " << (*iter_mc)->particleProperty()
221 << endreq;
222 int pid = (*iter_mc)->particleProperty();
223
224 if(fabs(pid)!=13) continue;
225
226 HepLorentzVector initialMomentum = (*iter_mc)->initialFourMomentum();
227 Hep3Vector startP(initialMomentum.px(), initialMomentum.py(), initialMomentum.pz());
228 Hep3Vector rotate(-initialMomentum.px(),initialMomentum.pz(),initialMomentum.py());
229
230 if(m_NtOutput>=1){
231 m_px_mc = initialMomentum.px();
232 m_py_mc = initialMomentum.py();
233 m_pz_mc = initialMomentum.pz();
234
235 m_theta_mc = rotate.theta();
236 m_phi_mc = rotate.phi();
237
238 m_theta_mc_pipe = startP.theta();
239 m_phi_mc_pipe = startP.phi();
240
241
242 }
243
244
245 cosmicMom = startP;
246
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305 SmartDataPtr<MucDigiCol> mucDigiCol(eventSvc(),"/Event/Digi/MucDigiCol");
306 if (!mucDigiCol) {
307 log << MSG::FATAL << "Could not find MUC digi" << endreq;
308 return( StatusCode::FAILURE);
309 }
310
311 MucDigiCol::iterator iter4 = mucDigiCol->begin();
312 digiId = 0;
313 for (;iter4 != mucDigiCol->end(); iter4++, digiId++) {
314 }
315 log << MSG::INFO << "MUC digis:: " << digiId << endreq;
316 if( digiId == 0) return( StatusCode::SUCCESS );
317
318
320 int trackId = -1;
321 int muctrackId = -1;
322
323 if(m_united != 1)
324 {
326 if (!aMucRecHitContainer) {
328 }
329 aMucRecHitContainer->
Clear();
330
333
334
335 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
336 DataObject *mucRecHitCol;
337 eventSvc()->findObject("/Event/Recon/MucRecHitCol",mucRecHitCol);
338 if(mucRecHitCol != NULL) {
339 dataManSvc->clearSubTree("/Event/Recon/MucRecHitCol");
340 eventSvc()->unregisterObject("/Event/Recon/MucRecHitCol");
341 }
342
343 StatusCode sc = eventSvc()->registerObject(
"/Event/Recon/MucRecHitCol", aMucRecHitContainer->
GetMucRecHitCol());
344
345 MucDigiCol::iterator iterMuc = mucDigiCol->begin();
346 int mucDigiId = 0;
347 for (;iterMuc != mucDigiCol->end(); iterMuc++, mucDigiId++) {
348 mucID = (*iterMuc)->identify();
353
354
355
356 aMucRecHitContainer->
AddHit(part, seg, gap, strip);
357 log << MSG::INFO << " digit" << mucDigiId << " : "
358 << " part " << part
359 << " seg " << seg
360 << " gap " << gap
361 << " strip " << strip
362 << endreq;
363 }
364
365 DataObject *aReconEvent ;
366 eventSvc()->findObject("/Event/Recon",aReconEvent);
367 if(aReconEvent==NULL) {
368
370 StatusCode sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
371 if(sc!=StatusCode::SUCCESS) {
372 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
373 return( StatusCode::FAILURE);
374 }
375 }
376 StatusCode fr = eventSvc()->findObject("/Event/Recon",aReconEvent);
377 if(fr!=StatusCode::SUCCESS) {
378 log << MSG::WARNING << "Could not find register ReconEvent, will create it" <<endreq;
379 StatusCode sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
380 if(sc!=StatusCode::SUCCESS) {
381 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
382 return( StatusCode::FAILURE);
383 }
384 }
385
386
387
388 DataObject *mucTrackCol;
389 eventSvc()->findObject("/Event/Recon/RecMucTrackCol",mucTrackCol);
390 if(mucTrackCol != NULL) {
391 dataManSvc->clearSubTree("/Event/Recon/RecMucTrackCol");
392 eventSvc()->unregisterObject("/Event/Recon/RecMucTrackCol");
393 }
394
396 sc = eventSvc()->registerObject("/Event/Recon/RecMucTrackCol", aMucTrackCol);
397 aMucTrackCol->clear();
398
399
400 SmartDataPtr<RecMucTrackCol> findMucTrackCol(eventSvc(),"/Event/Recon/RecMucTrackCol");
401 if (!findMucTrackCol) {
402 log << MSG::FATAL << "Could not find RecMucTrackCol" << endreq;
403 return( StatusCode::FAILURE);
404 }
405 aMucTrackCol->clear();
406
407
408 log << MSG::INFO <<"MaxHitsRec : "<<m_maxHitsRec<< endreq;
409 if(digiId> m_maxHitsRec) return StatusCode::SUCCESS;
410
411
412
413 trackId = 0;
414 muctrackId = 0;
415 }
416 else if(m_united == 1){
417
419 if (!aMucRecHitContainer) {
421 }
422 aMucRecHitContainer->
Clear();
423
424 SmartDataPtr<MucRecHitCol> aMucRecHitCol (eventSvc(),"/Event/Recon/MucRecHitCol");
425 if(aMucRecHitCol == NULL) {
426 log << MSG::WARNING << "MucRecHitCol is NULL" << endreq;
427 }
428
430
431 SmartDataPtr<RecMucTrackCol> mucTrackCol (eventSvc(),"/Event/Recon/RecMucTrackCol");
432 if(mucTrackCol == NULL) {
433 log << MSG::WARNING << "aMucTrackCol is NULL" << endreq;
434 }
435
436 log << MSG::INFO <<"mucTrackCol size: "<<mucTrackCol->size()<<" hitCol size: "<<aMucRecHitCol->size()<<endreq;
437 aMucTrackCol = mucTrackCol;
438
439
440 SmartDataPtr<RecExtTrackCol> aExtTrackCol(eventSvc(),"/Event/Recon/RecExtTrackCol");
441 if (!aExtTrackCol) {
442 log << MSG::WARNING << "Can't find ExtTrackCol in TDS!" << endreq;
443 }
444
445 SmartDataPtr<RecMdcTrackCol> aMdcTrackCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
446 if (!aMdcTrackCol) {
447 log << MSG::WARNING << "Can't find MdcTrackCol in TDS!" << endreq;
448 }
449
450 if( aExtTrackCol && aMdcTrackCol ) trackId = aMdcTrackCol->size();
451 muctrackId = aMucTrackCol->size();
452 }
453
454 int hasEmcUp = 0;
455 int hasEmcDown = 0;
456 SmartDataPtr<RecEmcShowerCol> aShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol");
457 if (!aShowerCol) {
458 log << MSG::WARNING << "Could not find RecEmcShowerCol" << endreq;
459
460 }
461 else{
462 RecEmcShowerCol::iterator iShowerCol;
463 for(iShowerCol=aShowerCol->begin();
464 iShowerCol!=aShowerCol->end();
465 iShowerCol++){
466
467
468
469
470
471
472 if(((*iShowerCol)->position()).phi()>0&&((*iShowerCol)->position()).phi()<3.1415926) hasEmcUp++;
473 else hasEmcDown++;
474 }
475 }
476 if(m_NtOutput >= 1){
477 m_emcUp = hasEmcUp; m_emcDown = hasEmcDown;
478 }
479
480
481 m_NEvent++;
483
484 if (!p3DRoadC) {
486 }
487 p3DRoadC->clear();
488
490
491 if (!p2DRoad0C) {
493 }
494 p2DRoad0C->clear();
495
497
498 if (!p2DRoad1C) {
500 }
501 p2DRoad1C->clear();
502 log << MSG::INFO << "Muc 2D 3D Road Container created" << endreq;
503
504
505
506
507
508
509
510
512 int count0, count1,
count, iGap0, iGap1;
513 int orient;
514
517 for (int iOrient = 0; iOrient < 2; iOrient++) {
518 int nLoops = 1;
520 for (int iLoop = 0; iLoop < nLoops; iLoop++) {
521
523 if(m_seedtype == 1){
526 }
527 else {
528 int setgap0 = 0;
529 MucDigiCol::iterator iterMuc = mucDigiCol->begin();
530 int mucDigiId = 0;
532 iGap0 = 0; iGap1 = 0;
533 for (;iterMuc != mucDigiCol->end(); iterMuc++, mucDigiId++) {
534 mucID = (*iterMuc)->identify();
539 int orient = 0;
540 if ( (part == 1 && gap % 2 == 0) || (part != 1 && gap % 2 == 1) ) orient = 1;
541
542 if(part == iPart && seg == iSeg && orient == iOrient && setgap0 == 0){
543 iGap0 = gap;
544 setgap0 = 1;
545 }
546 if(part == iPart && seg == iSeg && orient == iOrient && setgap0 == 1 && gap != iGap0 ){
547 iGap1 = gap;
548 }
549 }
550 }
551
552 if(m_MsOutput) cout <<"Find seed gap in ( "<<iPart<<" "<<iSeg<<" ) gap0: "<<iGap0<<" gap1: "<<iGap1<<endl;
553
554
555 if(iGap0 > iGap1){
556 int tempGap = iGap0;
557 iGap0 = iGap1;
558 iGap1 = tempGap;
559 }
560 if(iGap1 == iGap0) continue;
561
563 for (int iHit0 = 0; iHit0 < count0; iHit0++) {
564
565 pHit0 = aMucRecHitContainer->
GetHit(iPart, iSeg, iGap0, iHit0);
566 if (!pHit0) {
567 log << MSG::FATAL << "MucRecRoadFinder-E10 " << " part " << iPart
568 << " seg " << iSeg << " gap " << iGap0 << " null pointer"
569 << endl;
570 }
571 else {
572
573
574 if(m_united == 1 && pHit0->
GetHitMode() != -1)
continue;
575
577 if(m_MsOutput) cout << "part " << iPart << " seg " << iSeg << " orient " << iOrient
578 << " gap0 " << iGap0 << " count0 " << count0
579 << " gap1 " << iGap1 << " count1 " << count1 << endl;
580 for (int iHit1 = 0; iHit1 < count1; iHit1++) {
581
582 pHit1 = aMucRecHitContainer->
GetHit(iPart, iSeg, iGap1, iHit1);
583 if (!pHit1) {
584 log << MSG::ERROR << "MucRecRoadFinder-E10 " << " part " << iPart
585 << " seg " << iSeg << " gap " << iGap1 << " null pointer"
586 << endl;
587 } else {
588
589
590 if(m_united == 1 && pHit1->GetHitMode() != -1) continue;
591
592
593
595 if (!road2D) {
596 log << MSG::FATAL << "MucRecRoadFinder-E20 " << "failed to create 2D road!" << endreq;
597 continue;
598 }
600
601 if (!pHit0->
GetGap()) log << MSG::ERROR <<
"pHit0->GetGap(), null pointer" << endreq;
603
604
605
606
607
608 bool isseed = true;
610 pHit1->SetHitSeed(true);
611
613 if(m_MsOutput) cout <<
"pHit0 attached, " << road2D->
GetTotalHits()
614 <<
", hitId= "<<pHit0->
Part()<<
" "<<pHit0->
Seg()<<
" "<<pHit0->
Gap()<<
" "<<pHit0->
Strip()<<endl;
615 }
616
617 if (pHit1->GetGap()->Orient() == iOrient) {
618
619
620
621
623 if(m_MsOutput) cout <<
"pHit1 attached, " << road2D->
GetTotalHits()
624 << ", hitId= "<<pHit1->Part()<<" "<<pHit1->Seg()<<" "<<pHit1->Gap()<<" "<<pHit1->Strip()<<endl;
625 }
626 if(m_MsOutput) cout <<
"Hit cout " << road2D->
GetTotalHits() <<
", slope " << road2D->
GetSlope() << endl;
627
628
629
630
631
632
633 for (int i = 0; i < length; i++) {
635
636 float dXmin = kInfinity;
638
640
641
642
643
644
645
646
648 for (
int iHit = 0; iHit <
count; iHit++) {
649 pHit = aMucRecHitContainer->
GetHit(iPart, iSeg, iGap, iHit);
650 if (!pHit) {
651 log << MSG::FATAL << "MucRecRoadFinder-E20 null cluster pointer pHit" << endreq;
652 continue;
653 }
654 else {
655
656
657 if(m_united == 1 && pHit->
GetHitMode() != -1)
continue;
658
659
661 if(m_MsOutput) cout<<
"dX = "<<dX<<
" Win = "<<Win<<
", hit: "<<pHit->
Part()<<
" "<<pHit->
Seg()<<
" "<<pHit->
Gap()<<
" "<<pHit->
Strip()<<endl;
662
663 if (dX < Win) {
664
665
666 if(iGap == iGap0 || iGap == iGap1) {
669 }
672 }
673 }
674
675 if(m_onlyseedfit == 0)road2D->
AttachHit(pHit);
676 else {
677 if(iGap == iGap0 || iGap == iGap1) road2D->
AttachHit(pHit);
679 }
680 }
681 }
682 }
683
684
685 }
686
687
688
689
690
691
692
693
694 bool lastGapOK = false;
696 lastGapOK = true;
697 }
698 else {
700 }
701
702
703
704
705 bool firedGapsOK = false;
707 firedGapsOK = true;
708 }
709 else {
711 }
712
713
714 bool duplicateRoad = false;
715 int maxSharedHits = 0, sharedHits = 0;
716 if (iOrient == 0) {
717 for (int index = 0; index < (int)p2DRoad0C->size(); index++) {
718 sharedHits =(*p2DRoad0C)[index]->GetNSharedHits(road2D);
719 }
720 if (maxSharedHits < sharedHits) maxSharedHits = sharedHits;
721 }
722 else {
723 for (int index = 0; index < (int)p2DRoad1C->size(); index++) {
724 sharedHits = (*p2DRoad1C)[index]->GetNSharedHits(road2D);
725 }
726 if (maxSharedHits < sharedHits) maxSharedHits = sharedHits;
727 }
728
731 duplicateRoad = true;
732 log<<MSG::INFO <<
" maxSharedHits " << maxSharedHits <<
" > " <<
kMinSharedHits2D << endreq;
733 }
734
735
736
737
738
739
740
741 if (lastGapOK && firedGapsOK && !duplicateRoad) {
742 if (iOrient == 0) {
743 log<<MSG::INFO << "Add a road0" << endreq;
744 p2DRoad0C->add(road2D);
745 }
746 else {
747 log<<MSG::INFO << "Add a road1" << endreq;
748 p2DRoad1C->add(road2D);
749 }
750 }
751 else {
752
753
754 vector<MucRecHit*> road2DHits = road2D->
GetHits();
755 for(int i=0; i< road2DHits.size(); i++)
756 {
758 if(ihit->
Gap() == iGap0 || ihit->
Gap() == iGap1){
761 }
762 }
763 delete road2D;
764 }
765 }
766 }
767 }
768 }
769 }
770 }
771 }
772 }
773
774 int print2DRoadInfo = 0;
775 if (print2DRoadInfo == 1) {
776
777 cout << "In 2DRoad container : " << endl
778 << " Num of 2DRoad0 = " << p2DRoad0C->size() << endl
779 << endl;
780
781 for (int iRoad = 0; iRoad < (int)p2DRoad0C->size(); iRoad++) {
782
784 cout << " " << iRoad << "th 2DRoad0 :" << endl
785 <<
" Part = " << road->
GetPart() << endl
786 <<
" Seg = " << road->
GetSeg() << endl
787 <<
" Orient = " << road->
GetOrient() << endl
788 <<
" LastGap = " << road->
GetLastGap() << endl
791 <<
" Slope = " << road->
GetSlope() << endl
793 << endl;
794
795 }
796
797 cout << " Num of 2DRoad1 = " << p2DRoad1C->size() << endl
798 << endl;
799
800 for ( int iRoad = 0; iRoad < (int)p2DRoad1C->size(); iRoad++) {
801
803 cout << " " << iRoad << "th 2DRoad1 :" << endl
804 <<
" Part = " << road->
GetPart() << endl
805 <<
" Seg = " << road->
GetSeg() << endl
806 <<
" Orient = " << road->
GetOrient() << endl
807 <<
" LastGap = " << road->
GetLastGap() << endl
810 <<
" Slope = " << road->
GetSlope() << endl
812 << endl;
813
814 }
815 }
816
817
818
819 for ( int iRoad0 = 0; iRoad0 < (int)p2DRoad0C->size(); iRoad0++) {
821 for ( int iRoad1 = 0; iRoad1 < (int)p2DRoad1C->size(); iRoad1++){
823
824
825 if ( !(road0 &&road1) ) {
826 cout << "Null pointer to road0 or road1: "
827 << "road0 = " << road0
828 << "road1 = " << road1
829 << endl;
830 continue;
831 }
832
833
836 continue;
837 }
838
840
841
842
843
844
845
846
847
848
849
850
851
852 bool lastGapDeltaOK = false;
854 lastGapDeltaOK = true;
855 }
856 else {
858 }
859
860 bool totalHitsDeltaOK = false;
862 totalHitsDeltaOK = true;
863 }
864 else {
865
866 }
867
868 bool chiSquareCutOK = false;
873 chiSquareCutOK = true;
874 }
875 else {
876 cout << "xChiSquare = " << xChiSquare
877 << "yChiSquare = " << yChiSquare
878 << endl;
879 }
880
881 bool minLastGapOK = false;
883 minLastGapOK = true;
884 }
885 else {
886 log<<MSG::INFO <<
" minLastGap = " << road3D->
GetLastGap() << endreq;
887 }
888
889 bool duplicateRoad = false;
890 int maxSharedHits = 0, sharedHits = 0;
891 for ( int i = 0; i < (int)p3DRoadC->size(); i++){
892 sharedHits =(*p3DRoadC)[i]->GetNSharedHits(road3D);
893 if ( maxSharedHits < sharedHits) maxSharedHits = sharedHits;
894
895
896 }
899 duplicateRoad = true;
900 log<<MSG::INFO << " MaxShareHits = " << maxSharedHits << endreq;
901 }
902
903 if ( lastGapDeltaOK &&
904 totalHitsDeltaOK &&
905 chiSquareCutOK &&
906 minLastGapOK &&
907 !duplicateRoad ) {
908 float vx, vy, x0, y0;
909 float slope1 = 100, slope0 = 100;
912
916 vx, vy, x0, y0);
917 }
918 else {
919 vx = slope1;
921 vy = slope0;
923 }
925
926 log<<MSG::INFO << "Add a 3D Road ... " << endreq;
927
928 float startx = 0.0, starty = 0.0, startz = 0.0;
929 float sigmax = 0.0, sigmay = 0.0, sigmaz = 0.0;
930 road3D->
ProjectWithSigma(0, startx, starty, startz, sigmax, sigmay, sigmaz);
931
932
933
934
935 float vz = 1;
936 float sign = vy/fabs(vy);
937 float signx = vx/fabs(vx);
938
941
942 vx *= -sign;
943 vy *= -sign;
944 vz *= -sign;
945 }
946 else if(road3D->
GetSeg()<2){
947 vx *= signx;
948 vy *= signx;
949 vz *= signx;
950 }
952 vx *= -signx;
953 vy *= -signx;
954 vz *= -signx;
955 }
956 else{
957 vx *= sign;
958 vy *= sign;
959 vz *= sign;
960 }
961 }
962 else if(road3D->
GetPart() == 0){
963
964
965
966
967
968 }
969 else if(road3D->
GetPart() == 2){
970
971
972 vx *= -1;
973 vy *= -1;
974 vz *= -1;
975
976
977
978
979 }
980
981
982 Hep3Vector mom(vx, vy, vz);
983
984
985
986
987
988
989 startx /= 10; starty /= 10; startz /= 10;
990 startx -= vx/mom.mag(); starty -= vy/mom.mag(); startz -= vz/mom.mag();
991
992
996 aTrack->
SetMucPos(startx, starty, startz);
1001
1002
1003
1005 aTrack->
setId(muctrackId);
1006 trackId++;
1007 muctrackId++;
1008
1009
1010 aMucTrackCol->add(aTrack);
1012 p3DRoadC->add(road3D);
1013
1014
1015
1016 vector<MucRecHit*> attachedHits = aTrack->
GetHits();
1018 vector<float> distanceHits = aTrack->
getDistHits();
1019
1020 for(int i=0; i< expectedHits.size(); i++)
1021 {
1023
1024 }
1025
1026 vector<int> multiHit;
1027 for(int i=0; i< attachedHits.size(); i++)
1028 {
1030
1031
1032 int hitnum = 0;
1033 for(int k=0; k < attachedHits.size(); k++){
1036 hitnum++;
1037 }
1038 multiHit.push_back(hitnum);
1039
1040
1041 }
1042
1043 for(int i=0; i< expectedHits.size(); i++)
1044 {
1045
1047
1048
1049 int diff = -999;
1050
1051 for(int j=0; j< attachedHits.size(); j++){
1053
1054
1055
1056 if((jhit->
Part()==ihit->
Part())&&(jhit->
Seg()==ihit->
Seg())&&(jhit->
Gap()==ihit->
Gap())&&attachedHits.size()==distanceHits.size())
1057 {
1059
1060
1061 if(m_NtOutput>=2){
1062
1063 m_part = ihit->
Part(); m_seg = ihit->
Seg(); m_gap = ihit->
Gap();
1064 m_strip = jhit->
Strip();
1065 m_diff = diff;
1066 m_dist = distanceHits[j];
1067
1068
1069 m_angle_cosmic = -999;
1070 m_angle_updown = -999;
1071
1072
1073
1077 m_multihit = multiHit[j];
1078 m_run = eventHeader->runNumber();
1079 m_event = eventHeader->eventNumber();
1080
1081 m_tuple->write();
1082 }
1083 }
1084
1085
1086 }
1087
1088
1089
1090 if(diff == -999) {
1091 if(m_NtOutput>=2){
1092 m_part = ihit->
Part(); m_seg = ihit->
Seg(); m_gap = ihit->
Gap();
1093 m_strip = ihit->
Strip();
1094 m_diff = diff;
1095 m_dist = -999;
1096 m_angle_updown = -999;
1097 m_angle_cosmic = -999;
1098
1099
1100
1102 m_run = eventHeader->runNumber();
1103 m_event = eventHeader->eventNumber();
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 else {
1146
1147 delete road3D;
1148
1149 }
1150 }
1151 }
1152
1153
1154
1157
1158 int hasMucUp = 0;
1159 int hasMucDown = 0;
1160 for(int iTrack = 0; iTrack < (int)aMucTrackCol->size(); iTrack++) {
1161 aaTrack = (*aMucTrackCol)[iTrack];
1163 else hasMucDown++;
1164
1165
1166 double px,py,pz,p,theta,phi;
1170
1171 if(py<0)continue;
1172
1173 if(m_NtOutput>=1){
1174
1175 m_angle_updown = -999;
1177 if(m_angle_cosmic>1.57) m_angle_cosmic = 3.14159265 - m_angle_cosmic;
1178 m_run = eventHeader->runNumber();
1179 m_event = eventHeader->eventNumber();
1180
1181 Hep3Vector rotate(-px,pz,py);
1182 theta = rotate.theta();
1183 phi = rotate.phi();
1184
1185 m_px = px; m_py = py; m_pz = pz;
1186 m_theta = theta; m_phi = phi;
1189
1190
1191
1192
1193 Hep3Vector mucPos = aaTrack->
getMucPos();
1194 double posx, posy, posz;
1195 posx = mucPos.x(); posy = mucPos.y(); posz = mucPos.z();
1196
1197 m_projx = -999; m_projz = -999;
1198 if(py!=0){
1199 m_projx = posx - px/py*posy;
1200 m_projz = posz - pz/py*posy;
1201 }
1202
1203 }
1204
1205 }
1206 if(m_NtOutput>=1){
1207 m_mucUp = hasMucUp; m_mucDown = hasMucDown;
1208 m_tuple->write();
1209 }
1210
1211 int forCosmic = 0;
1212 if(aMucTrackCol->size()>=2 && forCosmic == 1){
1213 for(int iTrack = 0; iTrack < (int)aMucTrackCol->size(); iTrack++) {
1214 log << MSG::DEBUG << "iTrack " << iTrack << " / " <<(int)aMucTrackCol->size()<<endreq;
1215 aaTrack = (*aMucTrackCol)[iTrack];
1216 if(aaTrack->
trackId()>=0)
continue;
1218
1219 for(int jTrack = iTrack+1; jTrack < (int)aMucTrackCol->size(); jTrack++){
1220 bbTrack = (*aMucTrackCol)[jTrack];
1221
1224
1225
1226 if(fabs(mom_a.angle(mom_b) - 3.1415926)<0.2)
1227 {
1229
1230
1231
1232
1233
1234 }
1235
1236 if(m_NtOutput>=1){
1237 m_angle_cosmic = cosmicMom.angle(mom_a);
1238 if(cosmicMom.angle(mom_a)>1.57) m_angle_cosmic = 3.14159265 - cosmicMom.angle(mom_a);
1239
1240 m_angle_updown = fabs(mom_a.angle(mom_b) - 3.1415926);
1241 m_px = -999; m_py = -999; m_pz = -999; m_theta = -999; m_phi = -999; m_theta_pipe = -999; m_phi_pipe = -999;
1242 m_px_mc = -999; m_py_mc = -999; m_pz_mc = -999; m_theta_mc = -999; m_phi_mc = -999;
1243 m_theta_mc_pipe = -999; m_phi_mc_pipe = -999;
1244
1245
1246 }
1247 }
1248
1249 }
1250
1251
1252 }
1253
1254 if( p3DRoadC->size() !=0 ) {
1255 log<<MSG::INFO << "In 3DRoad container : "
1256 << " Num of 3DRoad = " << p3DRoadC->size() <<endreq;
1257
1258 int print2DRoadInfo = 0;
1259 if (print2DRoadInfo == 1) {
1260 for ( int iRoad = 0; iRoad < (int)p3DRoadC->size(); iRoad++) {
1262 cout << endl << " " << iRoad << "th 3DRoad :" << endl
1263 <<
" Part = " << road->
GetPart() << endl
1264 <<
" Seg = " << road->
GetSeg() << endl
1272 <<
" SlopeZX = " << road->
GetSlopeZX() << endl
1274 <<
" SlopeZY = " << road->
GetSlopeZY() << endl
1276 << " Hits Info : " << endl;
1277
1278 }
1279 }
1280
1281 m_NEventReco ++;
1282 }
1283
1284
1285 for(int i = 0 ; i < p3DRoadC->size(); i++)
1286 delete (*p3DRoadC)[i];
1287 for(int i = 0 ; i < p2DRoad0C->size(); i++)
1288 delete (*p2DRoad0C)[i];
1289 for(int i = 0 ; i < p2DRoad1C->size(); i++)
1290 delete (*p2DRoad1C)[i];
1291
1292 p3DRoadC->clear();
1293 p2DRoad0C->clear();
1294 p2DRoad1C->clear();
1295 delete p3DRoadC;
1296 delete p2DRoad0C;
1297 delete p2DRoad1C;
1298 return StatusCode::SUCCESS;
1299}
DOUBLE_PRECISION count[3]
const int kMaxDeltaLastGap
const int kMinSharedHits2D
const int kMaxDeltaTotalHits
const float kWindowSize[3][9]
const int kSearchOrder[kNSeedLoops][3][2][5]
const int kMaxSkippedGaps
const int kSearchLength[kNSeedLoops][3][2]
ObjectVector< MucRec2DRoad > MucRec2DRoadContainer
ObjectVector< MucRec3DRoad > MucRec3DRoadContainer
ObjectVector< MucRecHit > MucRecHitCol
ObjectVector< RecMucTrack > RecMucTrackCol
int maxHitsInLayer() const
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)
int GetNGapsWithHits() const
How many gaps provide hits attached to this road?
int GetTotalHits() const
How many hits in all does this road contain?
float GetReducedChiSquare() const
Chi-square parameter (per degree of freedom) of the trajectory fit.
float GetIntercept() const
Intercept of trajectory.
void AttachHit(MucRecHit *hit)
Attach the given hit to this road.
int GetLastGap() const
Which gap is the last one with hits attached to this road?
void AttachHitNoFit(MucRecHit *hit)
Attach the given hit to this road, but not fit this road.
float GetSlope() const
Slope of trajectory.
void SetMaxNSkippedGaps(const int &nGaps)
int GetPart() const
In which part was this road found?
float GetHitDistance(const MucRecHit *hit)
Distance to a hit.
int GetDegreesOfFreedom() const
How many degrees of freedom in the trajectory fit?
vector< MucRecHit * > GetHits() const
int GetSeg() const
In which segment was this road found?
int GetOrient() const
In which orientation was this road found?
float GetSlopeZX() const
Get Z-X dimension slope.
float GetSlopeZY() const
Get Z-Y dimension slope.
void TransformPhiRToXY(const float &vk, const float &vr, const float &k0, const float &r0, float &vx, float &vy, float &x0, float &y0) const
Where does the trajectory of this road intersect the reference plane?
int GetLastGapDelta() const
Difference between the last gap in the two 1-D roads.
int GetPart() const
In which part was this road found?
int GetLastGap() const
Which gap is the last one with hits attached to this road?
int GetTotalHitsDelta() const
Difference between the number of hits in the two 1-D roads.
int GetTotalHits() const
How many hits in all does this road contain?
float GetInterceptZY() const
Get Z-Y dimension intercept.
void SetSimpleFitParams(const float &m_SlopeZX, const float &m_InterceptZX, const float &m_SlopeZY, const float &m_InterceptZY)
set the fit parameters : slope and intercept for XZ and YZ.
int GetSeg() const
In which segment was this road found?
int GetDegreesOfFreedom() const
How many degrees of freedom in the trajectory fit?
void ProjectWithSigma(const int &gap, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ)
Where does the trajectory of this road intersect a specific gap?
float GetInterceptZX() const
Get Z-X dimension intercept.
int GetNGapsWithHits() const
How many gaps provide hits attached to this road?
float GetReducedChiSquare() const
Chi-square parameter (per degree of freedom) of the trajectory fit.
int GetMaxHitsPerGap() const
How many hits were attached in the gap with the most attached hits?
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)
MucRecHitCol * GetMucRecHitCol()
Get MucRecHitCol pointer.
void SetMucRecHitCol(MucRecHitCol *p)
int GetGapHitCount(const MucRecHitID gapID)
How many hits are there in this gap?
void SetHitSeed(int seed)
MucGeoGap * GetGap() const
Get geometry data for the gap containing this hit.
int Part() const
Get Part.
int Strip() const
Get Strip.
void SetHitMode(int recmode)
void TrackFinding(RecMucTrack *aTrack)
Hep3Vector getMucPos() const
start position of this track in Muc.
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 SetCurrentDir(const float x, const float y, const float z)
set current direction of the trajectory.
void setTrackId(const int trackId)
set the index for this track.
void SetMucMomentum(const float px, const float py, const float pz)
set start moment of the track in Muc.
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.
Hep3Vector getMucMomentum() const
Start momentum of this track in Muc.
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)
vector< float > getDistHits() const