146 {
147
148 MsgStream log(
msgSvc(), name());
149 log << MSG::INFO << "in execute()" << endreq;
150
151
152 int event, run;
153
154 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
155 if (!eventHeader) {
156 log << MSG::FATAL << "Could not find Event Header" << endreq;
157 return( StatusCode::FAILURE);
158 }
159 log << MSG::INFO << "Run: " << eventHeader->runNumber() << " Event: " << eventHeader->eventNumber() << endreq;
160
161 int digiId;
162
163
164
165 Hep3Vector cosmicMom;
166 if(m_mccosmic==1){
167 SmartDataPtr<McParticleCol> mcParticleCol(eventSvc(),"/Event/MC/McParticleCol");
168 if (!mcParticleCol) {
169 log << MSG::FATAL << "Could not find McParticle" << endreq;
170 return( StatusCode::FAILURE);
171 }
172
173 McParticleCol::iterator iter_mc = mcParticleCol->begin();
174 for (;iter_mc != mcParticleCol->end(); iter_mc++, digiId++) {
175 log << MSG::DEBUG
176 << " particleId = " << (*iter_mc)->particleProperty()
177 << endreq;
178 int pid = (*iter_mc)->particleProperty();
179
180 if(fabs(pid)!=13) continue;
181
182 HepLorentzVector initialMomentum = (*iter_mc)->initialFourMomentum();
183 Hep3Vector startP(initialMomentum.px(), initialMomentum.py(), initialMomentum.pz());
184 Hep3Vector rotate(-initialMomentum.px(),initialMomentum.pz(),initialMomentum.py());
185
186 if(m_NtOutput>=1){
187 m_px_mc = initialMomentum.px();
188 m_py_mc = initialMomentum.py();
189 m_pz_mc = initialMomentum.pz();
190
191 m_theta_mc = rotate.theta();
192 m_phi_mc = rotate.phi();
193
194 m_theta_mc_pipe = startP.theta();
195 m_phi_mc_pipe = startP.phi();
196
197
198 }
199
200
201 cosmicMom = startP;
202
203 }
204 }
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261 SmartDataPtr<MucDigiCol> mucDigiCol(eventSvc(),"/Event/Digi/MucDigiCol");
262 if (!mucDigiCol) {
263 log << MSG::FATAL << "Could not find MUC digi" << endreq;
264 return( StatusCode::FAILURE);
265 }
266
267 MucDigiCol::iterator iter4 = mucDigiCol->begin();
268 digiId = 0;
269 for (;iter4 != mucDigiCol->end(); iter4++, digiId++) {
270 }
271 log << MSG::INFO << "MUC digis:: " << digiId << endreq;
272 if( digiId == 0) return( StatusCode::SUCCESS );
273
274
276 int trackId = -1;
277 int muctrackId = -1;
278
279 if(m_united != 1)
280 {
282 if (!aMucRecHitContainer) {
284 }
285 aMucRecHitContainer->
Clear();
286
289
290
291 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
292 DataObject *mucRecHitCol;
293 eventSvc()->findObject("/Event/Recon/MucRecHitCol",mucRecHitCol);
294 if(mucRecHitCol != NULL) {
295 dataManSvc->clearSubTree("/Event/Recon/MucRecHitCol");
296 eventSvc()->unregisterObject("/Event/Recon/MucRecHitCol");
297 }
298
299 StatusCode sc = eventSvc()->registerObject(
"/Event/Recon/MucRecHitCol", aMucRecHitContainer->
GetMucRecHitCol());
300
301 MucDigiCol::iterator iterMuc = mucDigiCol->begin();
302 int mucDigiId = 0;
303 for (;iterMuc != mucDigiCol->end(); iterMuc++, mucDigiId++) {
304 mucID = (*iterMuc)->identify();
309
310
311
312 aMucRecHitContainer->
AddHit(part, seg, gap, strip);
313 log << MSG::INFO << " digit" << mucDigiId << " : "
314 << " part " << part
315 << " seg " << seg
316 << " gap " << gap
317 << " strip " << strip
318 << endreq;
319 }
320
321 DataObject *aReconEvent ;
322 eventSvc()->findObject("/Event/Recon",aReconEvent);
323 if(aReconEvent==NULL) {
324
326 StatusCode sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
327 if(sc!=StatusCode::SUCCESS) {
328 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
329 return( StatusCode::FAILURE);
330 }
331 }
332 StatusCode fr = eventSvc()->findObject("/Event/Recon",aReconEvent);
333 if(fr!=StatusCode::SUCCESS) {
334 log << MSG::WARNING << "Could not find register ReconEvent, will create it" <<endreq;
335 StatusCode sc = eventSvc()->registerObject("/Event/Recon",aReconEvent);
336 if(sc!=StatusCode::SUCCESS) {
337 log << MSG::FATAL << "Could not register ReconEvent" <<endreq;
338 return( StatusCode::FAILURE);
339 }
340 }
341
342
343
344 DataObject *mucTrackCol;
345 eventSvc()->findObject("/Event/Recon/RecMucTrackCol",mucTrackCol);
346 if(mucTrackCol != NULL) {
347 dataManSvc->clearSubTree("/Event/Recon/RecMucTrackCol");
348 eventSvc()->unregisterObject("/Event/Recon/RecMucTrackCol");
349 }
350
352 sc = eventSvc()->registerObject("/Event/Recon/RecMucTrackCol", aMucTrackCol);
353 aMucTrackCol->clear();
354
355
356 SmartDataPtr<RecMucTrackCol> findMucTrackCol(eventSvc(),"/Event/Recon/RecMucTrackCol");
357 if (!findMucTrackCol) {
358 log << MSG::FATAL << "Could not find RecMucTrackCol" << endreq;
359 return( StatusCode::FAILURE);
360 }
361 aMucTrackCol->clear();
362
363
364 log << MSG::INFO <<"MaxHitsRec : "<<m_maxHitsRec<< endreq;
365 if(digiId> m_maxHitsRec) return StatusCode::SUCCESS;
366
367
368
369 trackId = 0;
370 muctrackId = 0;
371 }
372 else if(m_united == 1){
373
375 if (!aMucRecHitContainer) {
377 }
378 aMucRecHitContainer->
Clear();
379
380 SmartDataPtr<MucRecHitCol> aMucRecHitCol (eventSvc(),"/Event/Recon/MucRecHitCol");
381 if(aMucRecHitCol == NULL) {
382 log << MSG::WARNING << "MucRecHitCol is NULL" << endreq;
383 }
384
386
387 SmartDataPtr<RecMucTrackCol> mucTrackCol (eventSvc(),"/Event/Recon/RecMucTrackCol");
388 if(mucTrackCol == NULL) {
389 log << MSG::WARNING << "aMucTrackCol is NULL" << endreq;
390 }
391
392 log << MSG::INFO <<"mucTrackCol size: "<<mucTrackCol->size()<<" hitCol size: "<<aMucRecHitCol->size()<<endreq;
393 aMucTrackCol = mucTrackCol;
394
395
396 SmartDataPtr<RecExtTrackCol> aExtTrackCol(eventSvc(),"/Event/Recon/RecExtTrackCol");
397 if (!aExtTrackCol) {
398 log << MSG::WARNING << "Can't find ExtTrackCol in TDS!" << endreq;
399 }
400
401 SmartDataPtr<RecMdcTrackCol> aMdcTrackCol(eventSvc(),"/Event/Recon/RecMdcTrackCol");
402 if (!aMdcTrackCol) {
403 log << MSG::WARNING << "Can't find MdcTrackCol in TDS!" << endreq;
404 }
405
406 if( aExtTrackCol && aMdcTrackCol ) trackId = aMdcTrackCol->size();
407 muctrackId = aMucTrackCol->size();
408 }
409
410 int hasEmcUp = 0;
411 int hasEmcDown = 0;
412 SmartDataPtr<RecEmcShowerCol> aShowerCol(eventSvc(),"/Event/Recon/RecEmcShowerCol");
413 if (!aShowerCol) {
414 log << MSG::WARNING << "Could not find RecEmcShowerCol" << endreq;
415
416 }
417 else{
418 RecEmcShowerCol::iterator iShowerCol;
419 for(iShowerCol=aShowerCol->begin();
420 iShowerCol!=aShowerCol->end();
421 iShowerCol++){
422
423
424
425
426
427
428 if(((*iShowerCol)->position()).phi()>0&&((*iShowerCol)->position()).phi()<3.1415926) hasEmcUp++;
429 else hasEmcDown++;
430 }
431 }
432 if(m_NtOutput >= 1){
433 m_emcUp = hasEmcUp; m_emcDown = hasEmcDown;
434 }
435
436
437 m_NEvent++;
439
440 if (!p3DRoadC) {
442 }
443 p3DRoadC->clear();
444
446
447 if (!p2DRoad0C) {
449 }
450 p2DRoad0C->clear();
451
453
454 if (!p2DRoad1C) {
456 }
457 p2DRoad1C->clear();
458 log << MSG::INFO << "Muc 2D 3D Road Container created" << endreq;
459
460
461
462
463
464
465
466
468 int count0, count1,
count, iGap0, iGap1;
469 int orient;
470
473 for (int iOrient = 0; iOrient < 2; iOrient++) {
474 int nLoops = 1;
476 for (int iLoop = 0; iLoop < nLoops; iLoop++) {
477
479 if(m_seedtype == 1){
482 }
483 else {
484 int setgap0 = 0;
485 MucDigiCol::iterator iterMuc = mucDigiCol->begin();
486 int mucDigiId = 0;
488 iGap0 = 0; iGap1 = 0;
489 for (;iterMuc != mucDigiCol->end(); iterMuc++, mucDigiId++) {
490 mucID = (*iterMuc)->identify();
495 int orient = 0;
496 if ( (part == 1 && gap % 2 == 0) || (part != 1 && gap % 2 == 1) ) orient = 1;
497
498 if(part == iPart && seg == iSeg && orient == iOrient && setgap0 == 0){
499 iGap0 = gap;
500 setgap0 = 1;
501 }
502 if(part == iPart && seg == iSeg && orient == iOrient && setgap0 == 1 && gap != iGap0 ){
503 iGap1 = gap;
504 }
505 }
506 }
507
508 if(m_MsOutput) cout <<"Find seed gap in ( "<<iPart<<" "<<iSeg<<" ) gap0: "<<iGap0<<" gap1: "<<iGap1<<endl;
509
510
511 if(iGap0 > iGap1){
512 int tempGap = iGap0;
513 iGap0 = iGap1;
514 iGap1 = tempGap;
515 }
516 if(iGap1 == iGap0) continue;
517
519 for (int iHit0 = 0; iHit0 < count0; iHit0++) {
520
521 pHit0 = aMucRecHitContainer->
GetHit(iPart, iSeg, iGap0, iHit0);
522 if (!pHit0) {
523 log << MSG::FATAL << "MucRecRoadFinder-E10 " << " part " << iPart
524 << " seg " << iSeg << " gap " << iGap0 << " null pointer"
525 << endl;
526 }
527 else {
528
529
530 if(m_united == 1 && pHit0->
GetHitMode() != -1)
continue;
531
533 if(m_MsOutput) cout << "part " << iPart << " seg " << iSeg << " orient " << iOrient
534 << " gap0 " << iGap0 << " count0 " << count0
535 << " gap1 " << iGap1 << " count1 " << count1 << endl;
536 for (int iHit1 = 0; iHit1 < count1; iHit1++) {
537
538 pHit1 = aMucRecHitContainer->
GetHit(iPart, iSeg, iGap1, iHit1);
539 if (!pHit1) {
540 log << MSG::ERROR << "MucRecRoadFinder-E10 " << " part " << iPart
541 << " seg " << iSeg << " gap " << iGap1 << " null pointer"
542 << endl;
543 } else {
544
545
546 if(m_united == 1 && pHit1->GetHitMode() != -1) continue;
547
548
549
551 if (!road2D) {
552 log << MSG::FATAL << "MucRecRoadFinder-E20 " << "failed to create 2D road!" << endreq;
553 continue;
554 }
556
557 if (!pHit0->
GetGap()) log << MSG::ERROR <<
"pHit0->GetGap(), null pointer" << endreq;
559
560
561
562
563
564 bool isseed = true;
566 pHit1->SetHitSeed(true);
567
569 if(m_MsOutput) cout <<
"pHit0 attached, " << road2D->
GetTotalHits()
570 <<
", hitId= "<<pHit0->
Part()<<
" "<<pHit0->
Seg()<<
" "<<pHit0->
Gap()<<
" "<<pHit0->
Strip()<<endl;
571 }
572
573 if (pHit1->GetGap()->Orient() == iOrient) {
574
575
576
577
579 if(m_MsOutput) cout <<
"pHit1 attached, " << road2D->
GetTotalHits()
580 << ", hitId= "<<pHit1->Part()<<" "<<pHit1->Seg()<<" "<<pHit1->Gap()<<" "<<pHit1->Strip()<<endl;
581 }
582 if(m_MsOutput) cout <<
"Hit cout " << road2D->
GetTotalHits() <<
", slope " << road2D->
GetSlope() << endl;
583
584
585
586
587
588
589 for (int i = 0; i < length; i++) {
591
592 float dXmin = kInfinity;
594
596
597
598
599
600
601
602
604 for (
int iHit = 0; iHit <
count; iHit++) {
605 pHit = aMucRecHitContainer->
GetHit(iPart, iSeg, iGap, iHit);
606 if (!pHit) {
607 log << MSG::FATAL << "MucRecRoadFinder-E20 null cluster pointer pHit" << endreq;
608 continue;
609 }
610 else {
611
612
613 if(m_united == 1 && pHit->
GetHitMode() != -1)
continue;
614
615
617 if(m_MsOutput) cout<<
"dX = "<<dX<<
" Win = "<<Win<<
", hit: "<<pHit->
Part()<<
" "<<pHit->
Seg()<<
" "<<pHit->
Gap()<<
" "<<pHit->
Strip()<<endl;
618
619 if (dX < Win) {
620
621
622 if(iGap == iGap0 || iGap == iGap1) {
625 }
628 }
629 }
630
631 if(m_onlyseedfit == 0)road2D->
AttachHit(pHit);
632 else {
633 if(iGap == iGap0 || iGap == iGap1) road2D->
AttachHit(pHit);
635 }
636 }
637 }
638 }
639
640
641 }
642
643
644
645
646
647
648
649
650 bool lastGapOK = false;
652 lastGapOK = true;
653 }
654 else {
656 }
657
658
659
660
661 bool firedGapsOK = false;
663 firedGapsOK = true;
664 }
665 else {
667 }
668
669
670 bool duplicateRoad = false;
671 int maxSharedHits = 0, sharedHits = 0;
672 if (iOrient == 0) {
673 for (int index = 0; index < (int)p2DRoad0C->size(); index++) {
674 sharedHits =(*p2DRoad0C)[index]->GetNSharedHits(road2D);
675 }
676 if (maxSharedHits < sharedHits) maxSharedHits = sharedHits;
677 }
678 else {
679 for (int index = 0; index < (int)p2DRoad1C->size(); index++) {
680 sharedHits = (*p2DRoad1C)[index]->GetNSharedHits(road2D);
681 }
682 if (maxSharedHits < sharedHits) maxSharedHits = sharedHits;
683 }
684
687 duplicateRoad = true;
688 log<<MSG::INFO <<
" maxSharedHits " << maxSharedHits <<
" > " <<
kMinSharedHits2D << endreq;
689 }
690
691
692
693
694
695
696
697 if (lastGapOK && firedGapsOK && !duplicateRoad) {
698 if (iOrient == 0) {
699 log<<MSG::INFO << "Add a road0" << endreq;
700 p2DRoad0C->add(road2D);
701 }
702 else {
703 log<<MSG::INFO << "Add a road1" << endreq;
704 p2DRoad1C->add(road2D);
705 }
706 }
707 else {
708
709
710 vector<MucRecHit*> road2DHits = road2D->
GetHits();
711 for(int i=0; i< road2DHits.size(); i++)
712 {
714 if(ihit->
Gap() == iGap0 || ihit->
Gap() == iGap1){
717 }
718 }
719 delete road2D;
720 }
721 }
722 }
723 }
724 }
725 }
726 }
727 }
728 }
729
730 int print2DRoadInfo = 0;
731 if (print2DRoadInfo == 1) {
732
733 cout << "In 2DRoad container : " << endl
734 << " Num of 2DRoad0 = " << p2DRoad0C->size() << endl
735 << endl;
736
737 for (int iRoad = 0; iRoad < (int)p2DRoad0C->size(); iRoad++) {
738
740 cout << " " << iRoad << "th 2DRoad0 :" << endl
741 <<
" Part = " << road->
GetPart() << endl
742 <<
" Seg = " << road->
GetSeg() << endl
743 <<
" Orient = " << road->
GetOrient() << endl
744 <<
" LastGap = " << road->
GetLastGap() << endl
747 <<
" Slope = " << road->
GetSlope() << endl
749 << endl;
750
751 }
752
753 cout << " Num of 2DRoad1 = " << p2DRoad1C->size() << endl
754 << endl;
755
756 for ( int iRoad = 0; iRoad < (int)p2DRoad1C->size(); iRoad++) {
757
759 cout << " " << iRoad << "th 2DRoad1 :" << endl
760 <<
" Part = " << road->
GetPart() << endl
761 <<
" Seg = " << road->
GetSeg() << endl
762 <<
" Orient = " << road->
GetOrient() << endl
763 <<
" LastGap = " << road->
GetLastGap() << endl
766 <<
" Slope = " << road->
GetSlope() << endl
768 << endl;
769
770 }
771 }
772
773
774
775 for ( int iRoad0 = 0; iRoad0 < (int)p2DRoad0C->size(); iRoad0++) {
777 for ( int iRoad1 = 0; iRoad1 < (int)p2DRoad1C->size(); iRoad1++){
779
780
781 if ( !(road0 &&road1) ) {
782 cout << "Null pointer to road0 or road1: "
783 << "road0 = " << road0
784 << "road1 = " << road1
785 << endl;
786 continue;
787 }
788
789
792 continue;
793 }
794
796
797
798
799
800
801
802
803
804
805
806
807
808 bool lastGapDeltaOK = false;
810 lastGapDeltaOK = true;
811 }
812 else {
814 }
815
816 bool totalHitsDeltaOK = false;
818 totalHitsDeltaOK = true;
819 }
820 else {
821
822 }
823
824 bool chiSquareCutOK = false;
829 chiSquareCutOK = true;
830 }
831 else {
832 cout << "xChiSquare = " << xChiSquare
833 << "yChiSquare = " << yChiSquare
834 << endl;
835 }
836
837 bool minLastGapOK = false;
839 minLastGapOK = true;
840 }
841 else {
842 log<<MSG::INFO <<
" minLastGap = " << road3D->
GetLastGap() << endreq;
843 }
844
845 bool duplicateRoad = false;
846 int maxSharedHits = 0, sharedHits = 0;
847 for ( int i = 0; i < (int)p3DRoadC->size(); i++){
848 sharedHits =(*p3DRoadC)[i]->GetNSharedHits(road3D);
849 if ( maxSharedHits < sharedHits) maxSharedHits = sharedHits;
850
851
852 }
855 duplicateRoad = true;
856 log<<MSG::INFO << " MaxShareHits = " << maxSharedHits << endreq;
857 }
858
859 if ( lastGapDeltaOK &&
860 totalHitsDeltaOK &&
861 chiSquareCutOK &&
862 minLastGapOK &&
863 !duplicateRoad ) {
864 float vx, vy, x0, y0;
865 float slope1 = 100, slope0 = 100;
868
872 vx, vy, x0, y0);
873 }
874 else {
875 vx = slope1;
877 vy = slope0;
879 }
881
882 log<<MSG::INFO << "Add a 3D Road ... " << endreq;
883
884 float startx = 0.0, starty = 0.0, startz = 0.0;
885 float sigmax = 0.0, sigmay = 0.0, sigmaz = 0.0;
886 road3D->
ProjectWithSigma(0, startx, starty, startz, sigmax, sigmay, sigmaz);
887
888
889
890
891 float vz = 1;
892 float sign = vy/fabs(vy);
893 float signx = vx/fabs(vx);
894
897
898 vx *= -sign;
899 vy *= -sign;
900 vz *= -sign;
901 }
902 else if(road3D->
GetSeg()<2){
903 vx *= signx;
904 vy *= signx;
905 vz *= signx;
906 }
908 vx *= -signx;
909 vy *= -signx;
910 vz *= -signx;
911 }
912 else{
913 vx *= sign;
914 vy *= sign;
915 vz *= sign;
916 }
917 }
918 else if(road3D->
GetPart() == 0){
919
920
921
922
923
924 }
925 else if(road3D->
GetPart() == 2){
926
927
928 vx *= -1;
929 vy *= -1;
930 vz *= -1;
931
932
933
934
935 }
936
937
938 Hep3Vector mom(vx, vy, vz);
939
940
941
942
943
944
945 startx /= 10; starty /= 10; startz /= 10;
946 startx -= vx/mom.mag(); starty -= vy/mom.mag(); startz -= vz/mom.mag();
947
948
952 aTrack->
SetMucPos(startx, starty, startz);
957
958
959
961 aTrack->
setId(muctrackId);
962 trackId++;
963 muctrackId++;
964
965
966 aMucTrackCol->add(aTrack);
968 p3DRoadC->add(road3D);
969
970
971
972 vector<MucRecHit*> attachedHits = aTrack->
GetHits();
974 vector<float> distanceHits = aTrack->
getDistHits();
975
976 for(int i=0; i< expectedHits.size(); i++)
977 {
979
980 }
981
982 vector<int> multiHit;
983 for(int i=0; i< attachedHits.size(); i++)
984 {
986
987
988 int hitnum = 0;
989 for(int k=0; k < attachedHits.size(); k++){
992 hitnum++;
993 }
994 multiHit.push_back(hitnum);
995
996
997 }
998
999 for(int i=0; i< expectedHits.size(); i++)
1000 {
1001
1003
1004
1005 int diff = -999;
1006
1007 for(int j=0; j< attachedHits.size(); j++){
1009
1010
1011
1012 if((jhit->
Part()==ihit->
Part())&&(jhit->
Seg()==ihit->
Seg())&&(jhit->
Gap()==ihit->
Gap())&&attachedHits.size()==distanceHits.size())
1013 {
1015
1016
1017 if(m_NtOutput>=2){
1018
1019 m_part = ihit->
Part(); m_seg = ihit->
Seg(); m_gap = ihit->
Gap();
1020 m_strip = jhit->
Strip();
1021 m_diff = diff;
1022 m_dist = distanceHits[j];
1023
1024
1025 m_angle_cosmic = -999;
1026 m_angle_updown = -999;
1027
1028
1029
1033 m_multihit = multiHit[j];
1034 m_run = eventHeader->runNumber();
1035 m_event = eventHeader->eventNumber();
1036
1037 m_tuple->write();
1038 }
1039 }
1040
1041
1042 }
1043
1044
1045
1046 if(diff == -999) {
1047 if(m_NtOutput>=2){
1048 m_part = ihit->
Part(); m_seg = ihit->
Seg(); m_gap = ihit->
Gap();
1049 m_strip = ihit->
Strip();
1050 m_diff = diff;
1051 m_dist = -999;
1052 m_angle_updown = -999;
1053 m_angle_cosmic = -999;
1054
1055
1056
1058 m_run = eventHeader->runNumber();
1059 m_event = eventHeader->eventNumber();
1060
1061 }
1062 }
1063
1064
1065 }
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098 */
1099
1100 }
1101 else {
1102
1103 delete road3D;
1104
1105 }
1106 }
1107 }
1108
1109
1110
1113
1114 int hasMucUp = 0;
1115 int hasMucDown = 0;
1116 for(int iTrack = 0; iTrack < (int)aMucTrackCol->size(); iTrack++) {
1117 aaTrack = (*aMucTrackCol)[iTrack];
1119 else hasMucDown++;
1120
1121
1122 double px,py,pz,p,theta,phi;
1126
1127 if(py<0)continue;
1128
1129 if(m_NtOutput>=1){
1130
1131 m_angle_updown = -999;
1133 if(m_angle_cosmic>1.57) m_angle_cosmic = 3.14159265 - m_angle_cosmic;
1134 m_run = eventHeader->runNumber();
1135 m_event = eventHeader->eventNumber();
1136
1137 Hep3Vector rotate(-px,pz,py);
1138 theta = rotate.theta();
1139 phi = rotate.phi();
1140
1141 m_px = px; m_py = py; m_pz = pz;
1142 m_theta = theta; m_phi = phi;
1145
1146
1147
1148
1149 Hep3Vector mucPos = aaTrack->
getMucPos();
1150 double posx, posy, posz;
1151 posx = mucPos.x(); posy = mucPos.y(); posz = mucPos.z();
1152
1153 m_projx = -999; m_projz = -999;
1154 if(py!=0){
1155 m_projx = posx - px/py*posy;
1156 m_projz = posz - pz/py*posy;
1157 }
1158
1159 }
1160
1161 }
1162 if(m_NtOutput>=1){
1163 m_mucUp = hasMucUp; m_mucDown = hasMucDown;
1164 m_tuple->write();
1165 }
1166
1167 int forCosmic = 0;
1168 if(aMucTrackCol->size()>=2 && forCosmic == 1){
1169 for(int iTrack = 0; iTrack < (int)aMucTrackCol->size(); iTrack++) {
1170 log << MSG::DEBUG << "iTrack " << iTrack << " / " <<(int)aMucTrackCol->size()<<endreq;
1171 aaTrack = (*aMucTrackCol)[iTrack];
1172 if(aaTrack->
trackId()>=0)
continue;
1174
1175 for(int jTrack = iTrack+1; jTrack < (int)aMucTrackCol->size(); jTrack++){
1176 bbTrack = (*aMucTrackCol)[jTrack];
1177
1180
1181
1182 if(fabs(mom_a.angle(mom_b) - 3.1415926)<0.2)
1183 {
1185
1186
1187
1188
1189
1190 }
1191
1192 if(m_NtOutput>=1){
1193 m_angle_cosmic = cosmicMom.angle(mom_a);
1194 if(cosmicMom.angle(mom_a)>1.57) m_angle_cosmic = 3.14159265 - cosmicMom.angle(mom_a);
1195
1196 m_angle_updown = fabs(mom_a.angle(mom_b) - 3.1415926);
1197 m_px = -999; m_py = -999; m_pz = -999; m_theta = -999; m_phi = -999; m_theta_pipe = -999; m_phi_pipe = -999;
1198 m_px_mc = -999; m_py_mc = -999; m_pz_mc = -999; m_theta_mc = -999; m_phi_mc = -999;
1199 m_theta_mc_pipe = -999; m_phi_mc_pipe = -999;
1200
1201
1202 }
1203 }
1204
1205 }
1206
1207
1208 }
1209
1210 if( p3DRoadC->size() !=0 ) {
1211 log<<MSG::INFO << "In 3DRoad container : "
1212 << " Num of 3DRoad = " << p3DRoadC->size() <<endreq;
1213
1214 int print2DRoadInfo = 0;
1215 if (print2DRoadInfo == 1) {
1216 for ( int iRoad = 0; iRoad < (int)p3DRoadC->size(); iRoad++) {
1218 cout << endl << " " << iRoad << "th 3DRoad :" << endl
1219 <<
" Part = " << road->
GetPart() << endl
1220 <<
" Seg = " << road->
GetSeg() << endl
1228 <<
" SlopeZX = " << road->
GetSlopeZX() << endl
1230 <<
" SlopeZY = " << road->
GetSlopeZY() << endl
1232 << " Hits Info : " << endl;
1233
1234 }
1235 }
1236
1237 m_NEventReco ++;
1238 }
1239
1240
1241 for(int i = 0 ; i < p3DRoadC->size(); i++)
1242 delete (*p3DRoadC)[i];
1243 for(int i = 0 ; i < p2DRoad0C->size(); i++)
1244 delete (*p2DRoad0C)[i];
1245 for(int i = 0 ; i < p2DRoad1C->size(); i++)
1246 delete (*p2DRoad1C)[i];
1247
1248 p3DRoadC->clear();
1249 p2DRoad0C->clear();
1250 p2DRoad1C->clear();
1251 delete p3DRoadC;
1252 delete p2DRoad0C;
1253 delete p2DRoad1C;
1254 return StatusCode::SUCCESS;
1255}
ObjectVector< MucRec2DRoad > MucRec2DRoadContainer
ObjectVector< MucRec3DRoad > MucRec3DRoadContainer
ObjectVector< MucRecHit > MucRecHitCol
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< 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