9 #include "FairRootManager.h"
10 #include "FairRunAna.h"
11 #include "FairRuntimeDb.h"
12 #include "FairBaseParSet.h"
13 #include "FairTrackParam.h"
14 #include "FairTrackParP.h"
17 #include "FairRootManager.h"
23 #include "TClonesArray.h"
24 #include "TGeoManager.h"
25 #include "TMatrixFSym.h"
62 for ( Int_t ipar = 0 ; ipar < 3 ; ipar++ ) {
83 FairRootManager* ioman = FairRootManager::Instance();
86 cout <<
"-E- "<< GetName() <<
"::Init: "
87 <<
"RootManager not instantised!" << endl;
92 FairRunAna* ana = FairRunAna::Instance();
94 cout <<
"-E- "<< GetName() <<
"::Init :"
95 <<
" no FairRunAna object!" << endl;
99 FairRuntimeDb*
rtdb = ana->GetRuntimeDb();
101 cout <<
"-E- "<< GetName() <<
"::Init :"
102 <<
" no runtime database!" << endl;
109 cout <<
"-I- "<< GetName() <<
"::Init: No MCTrack array!"
115 fMCPointArray = (TClonesArray*) ioman->GetObject(
"GEMPoint");
117 cout <<
"-I- "<< GetName() <<
"::Init: No MCPoint array!"
123 cout <<
"-I- " <<
"PndGemTrackFinderOnHits" <<
"::Init(). There are " <<
fDigiPar->
GetNStations() <<
" GEM stations." << endl;
124 cout <<
"-I- " <<
"PndGemTrackFinderOnHits" <<
"::Init(). Initialization succesfull." << endl;
135 for ( Int_t in = 0 ; in < 3 ; in++ ) {
140 std::cout <<
"-I- "<< GetName() <<
": Intialization successfull" << std::endl;
147 FairRunAna*
run = FairRunAna::Instance();
148 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
150 FairRuntimeDb* db = run->GetRuntimeDb();
151 if ( ! db ) Fatal(
"SetParContainers",
"No runtime database");
162 TClonesArray* trackCandArray) {
170 cout << endl << endl<< endl << endl;
171 cout <<
"=======================================================" << endl;
172 cout <<
"-I- Event No: " <<
fNofEvents << endl;
173 cout <<
"=======================================================" << endl;
176 cout <<
"-I- "<< GetName() <<
"::DoFind "<< endl;
177 cout <<
"-------------------------------------------------------" << endl;
178 cout <<
" ### Start DoFind" << endl;
179 cout <<
"-------------------------------------------------------" << endl;
189 cout <<
"-E- "<< GetName() <<
"::DoFind: "
190 <<
"Hit arrays missing! "<< endl;
209 cout <<
"# MC Tracks: "<<
fMCTrackArray->GetEntriesFast() << endl;
210 cout <<
"# MC Points: "<<
fMCPointArray->GetEntriesFast() << endl;
214 Int_t nGemHits = hitArray->GetEntriesFast();
215 if(fVerbose) cout <<
"# GemHits: "<< nGemHits << endl;
217 for(Int_t iHit = 0; iHit < nGemHits; iHit++){
219 gemHit = (
PndGemHit*) hitArray->At(iHit);
221 cout <<
"Hit " << iHit <<
" -> " << gemHit->GetX() <<
" " << gemHit->GetY() <<
" " << gemHit->GetZ() <<
" -> " << gemHit->GetRefIndex() << endl;
225 map<Int_t, Double_t> hitMatchDist;
226 for(Int_t iHit = 0; iHit < nGemHits; iHit++){
228 gemHit = (
PndGemHit*) hitArray->At(iHit);
232 Int_t closestHit = -1;
235 for(Int_t iHit2 = 0; iHit2 < nGemHits; iHit2++){
236 gemHit2 = (
PndGemHit*) hitArray->At(iHit2);
241 if ( gemHit2->GetZ() < gemHit->GetZ()+0.5 || gemHit2->GetZ() > gemHit->GetZ()+10. ) {
247 Double_t x1p = x1*gemHit2->GetZ()/gemHit->GetZ();
248 Double_t y1p = y1*gemHit2->GetZ()/gemHit->GetZ();
253 Double_t xer =
TMath::Sqrt(gemHit->GetDx()*gemHit->GetDx()+gemHit2->GetDx()*gemHit2->GetDx());
254 Double_t yer =
TMath::Sqrt(gemHit->GetDy()*gemHit->GetDy()+gemHit2->GetDy()*gemHit2->GetDy());
257 cout <<
"X comparing " << x1 <<
" -> " << x1p <<
" with " << x2
258 <<
" //// error " << xer <<
" = " <<
TMath::Abs(x1p-x2)/xer << endl;
259 cout <<
"Y comparing " << y1 <<
" -> " << y1p <<
" with " << y2
260 <<
" //// error " << yer <<
" = " <<
TMath::Abs(y1p-y2)/yer << endl;
308 cout <<
"failed x" << endl;
315 cout <<
"failed y" << endl;
319 Double_t distSq = (x1p-x2)*(x1p-x2)/xer/xer+(y1p-y2)*(y1p-y2)/yer/yer;
321 cout <<
"distsq = " << distSq << endl;
322 if ( closestDist > distSq ) {
323 closestDist = distSq;
326 if ( closestHit != -1 ) {
327 gemHit2 = (
PndGemHit*) hitArray->At(closestHit);
329 if ( closestDist > hitMatchDist[closestHit] )
333 cout <<
" Remove matching of hits " << gemHit2->
GetNDigiHits() <<
" and " << closestHit << endl;
340 hitMatchDist[closestHit] = closestDist;
342 cout <<
"matching hits " << iHit <<
" and " << iHit2 << endl;
345 if ( closestHit != - 1 )
368 cout <<
"************************************************" << endl;
373 cout <<
"************************************************" << endl;
374 cout <<
"finished printing tracks" << endl;
377 nr =
CreateTracks(hitArray,trackArray,trackCandArray,nr);
380 cout <<
"------------------------------------------------" << endl;
381 cout <<
"!!!!!!!!!!!!!!!!!! " << nr <<
" tracks have been found" << endl;
382 cout <<
"------------------------------------------------" << endl;
394 TClonesArray* trackCandArray,
395 Int_t nofRecoTracks) {
396 Int_t nofCreatedTracks = 0;
398 const Int_t kNofRecoTracks = nofRecoTracks;
401 Int_t hitIndices[kNofRecoTracks][kNofStatDbl];
402 Int_t nofHits[kNofRecoTracks];
407 Int_t nofTS[kNofRecoTracks];
412 for ( Int_t itr = 0 ; itr < nofRecoTracks ; itr++ ) {
413 for ( Int_t ih = 0 ; ih < kNofStatDbl ; ih++ ) hitIndices[itr][ih] = -1;
423 for ( Int_t istat = 0 ; istat < 2 ; istat++ ) {
428 if ( meanPhi[itr]/(nofTS[itr]+1) < 5. && iterTS.
trackPhi > 355. ) { iterTS.
trackPhi -= 360.; }
429 if ( meanPhi[itr]/(nofTS[itr]+1) > 355. && iterTS.
trackPhi < 5. ) { iterTS.
trackPhi += 360.; }
436 if ( nofTS[itr] == 0 )
continue;
438 meanMom[itr] = meanMom[itr]/nofTS[itr];
439 meanPhi[itr] = meanPhi[itr]/nofTS[itr];
440 meanThe[itr] = meanThe[itr]/nofTS[itr];
444 for ( Int_t ih = 0 ; ih < kNofStatDbl ; ih++ ) {
445 if ( hitIndices[itr][ih] == -1 )
continue;
446 gemHit = (
PndGemHit*)hitArray->At(hitIndices[itr][ih]);
447 gemTrackCand->
AddHit(FairRootManager::Instance()->GetBranchId(
"GEMHit"),
451 gemTrackCand->
Sort();
453 TVector3
pos (0.,0.,0.);
455 mom.SetMagThetaPhi(
TMath::Abs(meanMom[itr]),meanThe[itr]*TMath::DegToRad(),meanPhi[itr]*TMath::DegToRad());
458 if ( mom.Mag() < 0. ) charge = 1;
460 FairTrackParP firstPar(pos,mom,
461 TVector3(0.5, 0.5, 0.5),
467 FairTrackParP lastPar (pos,mom,
468 TVector3(0.5, 0.5, 0.5),
474 new((*trackArray)[nofCreatedTracks])
PndTrack(firstPar, lastPar, *gemTrackCand);
479 return nofCreatedTracks;
485 Bool_t printInfo = kFALSE;
488 cout <<
"Trying to remove clone tracks" << endl;
490 const Int_t kNofRecoTracks = nofRecoTracks;
493 Int_t hitIndices[kNofRecoTracks][kNofStatDbl];
494 Int_t nofHits[kNofRecoTracks];
495 Int_t nofMultiHits[kNofRecoTracks];
503 const Int_t kNofComb = nofComb;
505 Int_t nofTS[kNofRecoTracks];
506 Double_t valMom[kNofRecoTracks][kNofComb];
507 Double_t valPhi[kNofRecoTracks][kNofComb];
508 Double_t valThe[kNofRecoTracks][kNofComb];
511 for ( Int_t itr = 0 ; itr < nofRecoTracks ; itr++ ) {
512 for ( Int_t ih = 0 ; ih < kNofStatDbl ; ih++ ) hitIndices[itr][ih] = -1;
514 nofMultiHits[itr] = 0;
519 for ( Int_t ic = 0 ; ic < kNofComb ; ic++ ) {
520 valMom[itr][ic] = -666.;
521 valPhi[itr][ic] = -666.;
522 valThe[itr][ic] = -666.;
529 for ( Int_t istat = 0 ; istat < 2 ; istat++ ) {
534 if ( meanPhi[itr]/(nofTS[itr]+1) < 5. && iterTS.
trackPhi > 355. ) { iterTS.
trackPhi -= 360.; }
535 if ( meanPhi[itr]/(nofTS[itr]+1) > 355. && iterTS.
trackPhi < 5. ) { iterTS.
trackPhi += 360.; }
537 valMom[itr][nofTS[itr]] = iterTS.
trackMom;
538 valPhi[itr][nofTS[itr]] = iterTS.
trackPhi;
545 meanMom[itr] = meanMom[itr]/nofTS[itr];
546 meanPhi[itr] = meanPhi[itr]/nofTS[itr];
547 meanThe[itr] = meanThe[itr]/nofTS[itr];
550 cout <<
" MEAN = " << meanMom[itr] <<
" " << meanPhi[itr] <<
" " << meanThe[itr] << endl;
551 for ( Int_t its = 0 ; its < nofTS[itr] ; its++ ) {
553 cout <<
" v" << its <<
" = " << valMom[itr][its] <<
" " << valPhi[itr][its] <<
" " << valThe[itr][its] << endl;
554 trackCons[itr] +=
TMath::Abs((valMom[itr][its]-meanMom[itr])/meanMom[itr]);
555 trackCons[itr] +=
TMath::Abs( valPhi[itr][its]-meanPhi[itr]);
556 trackCons[itr] +=
TMath::Abs( valThe[itr][its]-meanThe[itr]);
558 trackCons[itr] = trackCons[itr]/(3.*nofTS[itr]);
561 for ( Int_t itr = 0 ; itr < nofRecoTracks ; itr++ ) {
562 for ( Int_t ih = 0 ; ih < kNofStatDbl ; ih++ ) {
563 if ( hitIndices[itr][ih] == -1 )
continue;
565 for ( Int_t itr2 = 0 ; itr2 < nofRecoTracks ; itr2++ ) {
566 if ( itr == itr2 )
continue;
567 for ( Int_t ih2 = 0 ; ih2 < kNofStatDbl ; ih2++ ) {
568 if ( hitIndices[itr2][ih2] == -1 )
continue;
569 if ( hitIndices[itr2][ih2] == hitIndices[itr][ih] ) {
575 if ( hitFound )
break;
579 Int_t cloneIndicators = 0;
580 if ( trackCons[itr] > 1 ) cloneIndicators++;
581 if ( nofTS[itr] <= kNofComb*2/3 ) cloneIndicators++;
582 if ( nofMultiHits[itr] >= nofHits[itr]/2 ) cloneIndicators++;
584 if ( cloneIndicators >= 2 ) {
593 cout <<
" consistency = " << trackCons[itr] << ( trackCons[itr] > 1 ?
" YES":
"") << endl;
594 cout <<
" segments = " << nofTS[itr] << ( nofTS[itr] <= kNofComb*2/3 ?
" YES":
"") << endl;
595 cout <<
" multihits = " << nofMultiHits[itr] << ( nofMultiHits[itr] >= nofHits[itr]/2 ?
" YES":
"") << endl;
596 cout <<
"TRACK " << itr <<
" HAS " << nofMultiHits[itr] <<
" MULTI HITS AND CONSISTENCY = " << trackCons[itr] << (cloneIndicators>=2?
" >>> REMOVED!!!! ":
"") << endl;
606 Bool_t printInfo = kFALSE;
608 Int_t nofRecoTracks = 0;
614 cout <<
"MATCH TRACK SEGMENTS TO SEGM " << itrc <<
" with params: " << origTS.
trackMom <<
" " << origTS.
trackPhi <<
" " << origTS.
trackTheta << endl;
617 vector<Int_t> trackSegs;
618 trackSegs.push_back(itrc);
621 for (
size_t itrc2 = 0 ; itrc2 <
fTrackSegments.size() ; itrc2++ ) {
622 if ( itrc2 == itrc )
continue;
633 for (
size_t its = 0 ; its < trackSegs.size() ; its++ ) {
641 meanMom += iterTS.
trackMom/(trackSegs.size());
642 meanPhi += iterTS.
trackPhi/(trackSegs.size());
643 meanThe += iterTS.
trackTheta/(trackSegs.size());
645 if ( !matching )
continue;
647 if ( meanPhi < 5. && matchTS.trackPhi > 355. ) matchTS.
trackPhi-=360.;
654 cout <<
" mean > " << meanMom <<
" " << meanPhi <<
" " << meanThe << endl;
662 Bool_t mismatchSolved = kFALSE;
663 for (
size_t its = 0 ; its < trackSegs.size() ; its++ ) {
665 for ( Int_t istat1 = 0 ; istat1 < 2 ; istat1++ ) {
666 for ( Int_t istat2 = 0 ; istat2 < 2 ; istat2++ ) {
670 cout <<
"there are already " << trackSegs.size() <<
" segments in this track: " << endl;
674 for (
size_t its2 = 0 ; its2 < trackSegs.size() ; its2++ ) {
675 if ( its == its2 )
continue;
678 cout << its2 <<
" (" << trackSegs[its2] <<
") > " << aveTS.
trackMom <<
" " << aveTS.
trackPhi <<
" " << aveTS.
trackTheta << endl;
679 meanMom += aveTS.
trackMom/(trackSegs.size()-1);
680 meanPhi += aveTS.
trackPhi/(trackSegs.size()-1);
681 meanThe += aveTS.
trackTheta/(trackSegs.size()-1);
684 cout << its <<
" (" << trackSegs[its] <<
") > " << iterTS.
trackMom <<
" " << iterTS.
trackPhi <<
" " << iterTS.
trackTheta << endl;
685 cout <<
" this track conflicts with track " << its <<
" and is: " << endl;
687 cout <<
" should decide on mean of other track segments, which is: " << endl;
688 cout <<
"MEAN > " << meanMom <<
" " << meanPhi <<
" " << meanThe << endl;
690 if ( meanPhi < 5. ) {
694 if ( meanPhi > 355 ) {
698 Bool_t changeSegm = kFALSE;
706 trackSegs[its] = itrc2;
707 mismatchSolved = kTRUE;
717 mismatchSolved = kTRUE;
725 cout <<
" PROBLEM HERE " << endl;
729 if ( mismatchSolved ) {
continue; }
732 trackSegs.push_back(itrc2);
734 if ( overrepr )
continue;
735 if ( trackSegs.size() == 1 )
continue;
738 cout <<
"segments: " << endl;
739 for (
size_t its = 0 ; its < trackSegs.size() ; its++ ) {
743 for ( Int_t ihit = 0 ; ihit < 4 ; ihit++ )
744 cout << setw(4) << iterTS.
hitIndex[ihit] <<
" " << flush;
751 cout <<
" seems to belong to one track" << endl;
756 cout <<
"********* " << nofRecoTracks <<
" track candidates have been found" << endl;
758 return nofRecoTracks;
764 Bool_t printInfo = kFALSE;
771 Double_t zDistRatio = zStation2/zStation1;
772 Double_t zDiffRatio = zStation1/(zStation2-zStation1);
773 Double_t zCuDiff = zStation2*zStation2*zStation2-zStation1*zStation1*zStation1;
774 Double_t zSqDiff = zStation2*zStation2-zStation1*zStation1;
775 Double_t zDiff = zStation2-zStation1;
780 Int_t nGemHits = hitArray->GetEntriesFast();
785 for(Int_t iHit = 0; iHit < nGemHits; iHit++){
787 gemHit = (
PndGemHit*) hitArray->At(iHit);
789 cout <<
"LOOKING FOR TRACK SEGMENTS STARTING AT " << gemHit->GetX() <<
" " << gemHit->GetY() <<
" " << gemHit->GetZ() <<
"( " << zStation1 <<
") ndigihits = " << gemHit->
GetNDigiHits() << endl;
790 if ( gemHit->GetZ() > zStation1 )
continue;
793 cout <<
"possible segment " <<
fTrackSegments.size() <<
" starts here " << gemHit->GetX() <<
" " << gemHit->GetY() <<
" " << gemHit->GetZ() << endl;
794 Double_t radius =
TMath::Sqrt(gemHit->GetX()*gemHit->GetX()+gemHit->GetY()*gemHit->GetY());
795 Double_t pangle = TMath::ACos(gemHit->GetX()/radius);
796 if ( gemHit->GetY() < 0 )
801 cout <<
" -> with theta of " << theta <<
" (radius = " << radius <<
" and phi angle = " << pangle*TMath::RadToDeg() <<
")" << endl;
802 for(Int_t iHit2 = 0; iHit2 < nGemHits; iHit2++){
803 gemHit2 = (
PndGemHit*) hitArray->At(iHit2);
805 cout <<
"gemhit2.z = " << gemHit2->GetZ() <<
" /// gemhit1.z = " << gemHit->GetZ() <<
" /// station2z = " << zStation2 << endl;
806 if (
TMath::Abs(gemHit2->GetZ()-(zStation2-1.)) > 0.4 ) {
807 if (
fVerbose > 3 || printInfo ) cout <<
"not good Z" << endl;
812 cout <<
"trying to match it with " << gemHit2->GetX() <<
" " << gemHit2->GetY() <<
" " << gemHit2->GetZ() << endl;
813 Double_t radius2 =
TMath::Sqrt(gemHit2->GetX()*gemHit2->GetX()+gemHit2->GetY()*gemHit2->GetY());
814 Double_t pangle2 = TMath::ACos(gemHit2->GetX()/radius2);
815 if ( gemHit2->GetY() < 0 )
821 if (
TMath::Abs(pangle-pangle2)*TMath::RadToDeg() > 40 )
continue;
824 cout <<
" (radius = " << radius2 <<
" and phi angle = " << pangle2*TMath::RadToDeg() <<
")" << endl;
827 Double_t expRadUncert = 0.08*radius*zDistRatio;
830 cout <<
" -> while expected radius was " << expectedRad2 <<
" with error of " << expRadUncert << endl;
832 if ( radius2>expectedRad2+expRadUncert || radius2<expectedRad2-expRadUncert )
continue;
835 cout <<
"STRONG CORRELATION FOR THIS HIT!!!" << endl;
838 if ( (pangle-pangle2) != 0 )
839 trackMomentum = (par0_mom+par1_mom*radius)/((pangle-pangle2)*TMath::RadToDeg());;
841 cout <<
"calculated track momentum is " << trackMomentum << endl;
842 Double_t trackPhiAngle = pangle+(pangle-pangle2)*zDiffRatio;
843 if ( trackPhiAngle < 0. ) trackPhiAngle +=
TMath::Pi()*2.;
846 cout <<
"calculated phi is " << trackPhiAngle*TMath::RadToDeg() << endl;
858 tempTS.
trackPhi = trackPhiAngle*TMath::RadToDeg();
864 cout <<
" found segment (stat. " << stat1Id <<
" & " << stat2Id <<
"), hits "
866 <<
" >>> " << trackMomentum <<
" GeV, " << trackPhiAngle*TMath::RadToDeg() <<
" deg, " << theta <<
" deg." << endl;
875 cout <<
"===>>> " <<
fTrackSegments.size() <<
" track segments" << endl;
889 for ( Int_t ihit = 0 ; ihit < 4 ; ihit++ ) {
890 if ( tempTS.
hitIndex[ihit] == -1 )
continue;
892 cout <<
" <" << gemHit->GetX() <<
"/" << gemHit->GetY() <<
"> " << flush;
893 cout << setw(3) << tempTS.
hitIndex[ihit] <<
"(" << flush;
894 if ( gemHit->GetRefIndex() == -1 ) { cout <<
"--/-) " << flush;
continue;}
895 cout << setw(2) << gemHit->GetRefIndex() <<
") " << flush;
910 vector<Int_t> nofFiredStations(kNofMCTracks,0);
911 vector<TVector3> mcTrackMomentum(kNofMCTracks);
916 Int_t nofPointsPerStation[kNofMCTracks][kNofGemStations];
917 for ( Int_t imct = 0 ; imct < kNofMCTracks ; imct++ )
918 for ( Int_t
is = 0 ;
is < kNofGemStations ;
is++ )
919 nofPointsPerStation[imct][
is] = 0;
921 for ( Int_t imcp = 0 ; imcp < kNofGemPoints ; imcp++ ) {
926 nofPointsPerStation[mcPoint->GetTrackID()][stationNr-1] += 1;
930 for ( Int_t imct = 0 ; imct < kNofMCTracks ; imct++ ) {
933 for ( Int_t
is = 0 ;
is < kNofGemStations ;
is++ )
934 if ( nofPointsPerStation[imct][
is] > 0 )
936 nofFiredStations[imct] = nofCGM;
941 vector<Int_t> nofTrSegments(kNofMCTracks,0);
942 vector<Int_t> nofTrMCId(kNofMCTracks,0);
946 for ( Int_t itr = 0 ; itr < kNofMCTracks ; itr++ ) nofTrMCId[itr] = 0;
949 for ( Int_t ihit = 0 ; ihit < 4 ; ihit++ ) {
950 if ( tempTS.
hitIndex[ihit] == -1 )
continue;
952 cout <<
" <" << gemHit->GetX() <<
"/" << gemHit->GetY() <<
"> " << flush;
953 cout << setw(3) << tempTS.
hitIndex[ihit] <<
"(" << flush;
954 if ( gemHit->GetRefIndex() == -1 ) { cout <<
"--/-) " << flush;
continue;}
956 cout << setw(2) << gemHit->GetRefIndex() <<
"/" << mcPoint->GetTrackID() <<
") " << flush;
958 if ( ihit < 2 && nofTrMCId[mcPoint->GetTrackID()] < 1 )
959 nofTrMCId[mcPoint->GetTrackID()] += 1;
960 if ( ihit > 1 && nofTrMCId[mcPoint->GetTrackID()] < 2 )
961 nofTrMCId[mcPoint->GetTrackID()] += 2;
965 for ( Int_t itr = 0 ; itr < kNofMCTracks ; itr++ ) {
966 if ( nofTrMCId[itr] != 3 )
continue;
967 if ( bestMCId > -1 ) { bestMCId = -1;
break; }
970 cout <<
" " << flush;
971 if ( bestMCId == -1 ) cout <<
" -- NO MATCHING MC -----------------" << endl;
973 cout <<
"MC " << setw(3) << bestMCId <<
" TRUTH: "
974 << setw(11) << mcTrackMomentum[bestMCId].Mag() <<
" "
975 << setw(11) << TMath::RadToDeg()*mcTrackMomentum[bestMCId].Phi()+(mcTrackMomentum[bestMCId].Phi()>=0.?0:360.) <<
" "
976 << setw(11) << TMath::RadToDeg()*mcTrackMomentum[bestMCId].Theta() << endl;
977 nofTrSegments[bestMCId] += 1;
979 segmentMCId[itrc] = bestMCId;
984 for ( Int_t imct = 0 ; imct < kNofMCTracks ; imct++ ) {
985 if ( nofTrSegments[imct] == 0 || nofFiredStations[imct] == 0 )
continue;
986 cout <<
" track " << imct <<
" fired " << nofFiredStations[imct] <<
" stations, and " << nofTrSegments[imct] <<
" segments were created:" << endl;
989 if ( segmentMCId[itrc] != imct )
continue;
991 cout <<
" " << itrc <<
" " << setw(11) << tempTS.
trackMom <<
" " << setw(11) << tempTS.
trackPhi <<
" " << setw(11) << tempTS.
trackTheta << endl;
994 if ( mcTrackMomentum[imct].Mag() < 0.5 )
continue;
996 for ( Int_t
is = 0 ;
is < nofFiredStations[imct] ;
is++ )
for ( Int_t is2 =
is+1 ; is2 < nofFiredStations[imct] ; is2++ ) expSegms++;
998 fndNofS += nofTrSegments[imct];
1003 cout <<
"********* FOUND " << fndNofS <<
" OUT OF " << expNofS <<
" SEGMENTS IN THIS EVENT" << endl;
1015 for ( Int_t itr = 0 ; itr < nofRecoTracks ; itr++ ) {
1023 vector<Int_t> hitIndices(kNofStatDbl,-1);
1024 cout <<
"===================== TRACK " << itr <<
" ======================" << endl;
1030 for ( Int_t istat = 0 ; istat < 2 ; istat++ ) {
1042 meanMom = meanMom/nofTS;
1043 meanPhi = meanPhi/nofTS;
1044 meanThe = meanThe/nofTS;
1046 if ( nofTS == 0 ) { cout <<
"THIS TRACK WAS REMOVED " << endl;
continue; }
1048 for ( Int_t ihit = 0 ; ihit < kNofStatDbl ; ihit++ ) {
1049 cout << ihit <<
"/" << hitIndices[ihit] <<
"/" << flush;
1050 if ( hitIndices[ihit] == -1 ) { cout <<
"- - " << flush;
continue; }
1051 gemHit = (
PndGemHit*) hitArray->At(hitIndices[ihit]);
1052 if ( gemHit->GetRefIndex() == -1 ) { cout <<
"- " << flush;
continue;}
1053 cout << setw(2) << gemHit->GetRefIndex() <<
"_ " << flush;
1064 FairMCPoint* mcPoint;
1068 for ( Int_t itr = 0 ; itr < nofRecoTracks ; itr++ ) {
1069 vector<Int_t> nofTrMCId(500,0);
1078 vector<Int_t> hitIndices(kNofStatDbl,-1);
1079 cout <<
"===================== TRACK " << itr <<
" ======================" << endl;
1085 for ( Int_t istat = 0 ; istat < 2 ; istat++ ) {
1097 meanMom = meanMom/nofTS;
1098 meanPhi = meanPhi/nofTS;
1099 meanThe = meanThe/nofTS;
1101 if ( nofTS == 0 ) { cout <<
"THIS TRACK WAS REMOVED " << endl;
continue; }
1103 for ( Int_t ihit = 0 ; ihit < kNofStatDbl ; ihit++ ) {
1104 cout << ihit <<
"/" << hitIndices[ihit] <<
"/" << flush;
1105 if ( hitIndices[ihit] == -1 ) { cout <<
"- - " << flush;
continue; }
1106 gemHit = (
PndGemHit*) hitArray->At(hitIndices[ihit]);
1107 if ( gemHit->GetRefIndex() == -1 ) { cout <<
"- - " << flush;
continue;}
1108 mcPoint = (FairMCPoint*)
fMCPointArray->At(gemHit->GetRefIndex());
1109 cout << setw(2) << gemHit->GetRefIndex() <<
" _" << mcPoint->GetTrackID() <<
"_ " << flush;
1110 nofTrMCId[mcPoint->GetTrackID()] += 1;
1113 Int_t bestMCId = -1;
1114 Int_t largestNofTracks = 0;
1115 for ( Int_t itm = 0 ; itm < 500 ; itm++ ) {
1116 if ( nofTrMCId[itm] == largestNofTracks ) { bestMCId = -1; }
1117 if ( nofTrMCId[itm] > largestNofTracks ) { bestMCId = itm; largestNofTracks = nofTrMCId[itm]; }
1119 cout <<
" " << flush;
1120 cout << setw(11) << meanMom <<
" " << setw(11) << meanPhi <<
" " << setw(11) << meanThe << endl;
1121 cout <<
" " << flush;
1122 if ( bestMCId == -1 ) cout <<
" -- NO MATCHING MC -----------------" << endl;
1126 cout <<
"MC " << bestMCId <<
" TRUTH: "
1127 << setw(11) << mcmom.Mag() <<
" "
1128 << setw(11) << TMath::RadToDeg()*mcmom.Phi()+(mcmom.Phi()>=0.?0:360.) <<
" "
1129 << setw(11) << TMath::RadToDeg()*mcmom.Theta() << endl;
Double_t GetTrackFinderOnHits_ParTheta1()
Int_t fNofExpectedTrackSegments
TClonesArray * fMCPointArray
TClonesArray * trackArray
void RemoveCloneTracks(Int_t nofRecoTracks)
Double_t GetTrackFinderOnHits_ParThetaB()
Double_t GetTrackFinderOnHits_ParTheta3()
static T Sqrt(const T &x)
virtual void SetParContainers()
Double_t GetZ(Int_t it=0)
virtual ~PndGemTrackFinderOnHits()
OnHits track finding algorithm.
TVector3 GetMomentum() const
Double_t GetTrackFinderOnHits_ParMat1(Int_t in)
Int_t fNofFoundTrackSegments
Digitization Parameter Class for GEM part.
void PrintMCTrackSegments(TClonesArray *hitArray)
Double_t GetTrackFinderOnHits_ParTheta0()
Double_t GetTrackFinderOnHits_ParMat0(Int_t in)
void PrintTracks(TClonesArray *hitArray, Int_t nofRecoTracks)
std::vector< TrackSegment > fTrackSegments
TClonesArray * fMCTrackArray
void AddHit(UInt_t detId, UInt_t hitId, Double_t rho)
Int_t GetSensorId() const
Int_t GetNDigiHits() const
void PrintMCTracks(TClonesArray *hitArray, Int_t nofRecoTracks)
Int_t FindTrackSegments(TClonesArray *hitArray, Int_t stat1Id, Int_t stat2Id)
void PrintTrackSegments(TClonesArray *hitArray)
Int_t CreateTracks(TClonesArray *hitArray, TClonesArray *trackArray, TClonesArray *trackCandArray, Int_t nofRecoTracks)
void SetNDigiHits(Int_t pixel)
Int_t GetStationNr(Int_t sensorId)
TVector3 GetPosition() const
Double_t GetTrackFinderOnHits_ParRadPhi2()
virtual Int_t DoFind(TClonesArray *hitArray, TClonesArray *trackArray, TClonesArray *trackCandArray)
Int_t MatchTrackSegments()
Double_t GetTrackFinderOnHits_ParThetaA()
Double_t GetTrackFinderOnHits_ParTheta2()
PndGemTrackFinderOnHits()
Double_t GetTrackFinderOnHits_ParRadPhi0()
PndGemStation * GetStation(Int_t iStation)