/* * PndTrackCombiner.cxx * * Created on: Jun 7, 2016 * Author: kibellus */ #include Double_t PndTrackCombiner::compQuali = 600; Double_t PndTrackCombiner::compDist = 0.7; Double_t PndTrackCombiner::compAngle = 2.5; PndTrackCombiner::~PndTrackCombiner() { // TODO Auto-generated destructor stubPndTrack* } vector PndTrackCombiner::combine(Int_t bigLayer){ Int_t l1 = 4*bigLayer+0; Int_t l2 = 4*bigLayer+1; Int_t l3 = 4*bigLayer+2; Int_t l4 = 4*bigLayer+3; vector layer1a4 = compareAndRefit(l1,l4); vector arr[3]; arr[0] = combine(layer1a4,fExpandedTrackCands[l2],0,1); arr[1] = combine(layer1a4,fExpandedTrackCands[l3],0,2); arr[2] = combine(fExpandedTrackCands[l2],fExpandedTrackCands[l3],1,2); // cout << "firstAndLast=" << layer1a4.size() << endl; // cout << "arr[0]=" << arr[0].size() << endl; // cout << "arr[1]=" << arr[1].size() << endl; // cout << "arr[2]=" << arr[2].size() << endl; //new implementation vector combindedLines; //add the tracks of the first layer for(size_t i=0;i lines = arr[i]; fComparator.setZValue(ftsPos[bigLayer]+5*i); Int_t maxVal = combindedLines.size(); //tracks in layers before -> no combination in same layer for(size_t j=0;j result; for(size_t i=0;i2){ result.push_back(approx); } } //combine similar tracks vector result2; fComparator.setZValue(ftsPos[bigLayer]); Bool_t used[result.size()]; for(size_t i=0;i PndTrackCombiner::combine (vector cands1, vector cands2, Int_t layer1, Int_t layer2){ vector result; for(size_t i=0;i lines = combine(cand1,cand2,layer1,layer2); result.insert(result.begin(),lines.begin(),lines.end()); } //layer1 track not used? if(layer1==0 && result.size()==resultSizeBefore){ PndLineApproximation la = cand1.getLineApproximations()[0]; la.getLine().setRating(3); la.setYInfo(kFALSE); result.push_back(la); } } return result; } vector PndTrackCombiner::combine(PndFtsExpandedTrackCand c1, PndFtsExpandedTrackCand c2, Int_t layer1, Int_t layer2){ vector approx1 = c1.getLineApproximations(); vector approx2 = c2.getLineApproximations(); vector result; for(size_t i=0;iangleLimit){ vector cHits1 = approx1[i].getHits(); vector cHits2 = approx2[j].getHits(); l.setRating(TMath::Max(line1.getRating(),line2.getRating())); PndLineApproximation newApprox(l,cHits1,cHits2); result.push_back(newApprox); } } } return result; } void PndTrackCombiner::addLine(vector &lines, PndLineApproximation& la, Int_t max){ PndLine &l = la.getLine(); Bool_t inUse = kFALSE; for(int i=0;icompQuali)continue; //is this line better as the current best line if(lines[i].getQuality()>quality){ //better line found lines[i].setApprox2(&la); lines[i].setQuality(quality); } inUse = kTRUE; } if(!inUse){ PndLineCombination newCom(la); lines.push_back(newCom); } } void PndTrackCombiner::refitLines(vector &lines){ for(size_t i=0;i &lines, PndLineApproximation &la,Int_t end){ PndLine &l = la.getLine(); for(int i=0;i PndTrackCombiner::compareAndRefit(Int_t layer1, Int_t layer2){ vector cands1 = fExpandedTrackCands[layer1]; vector cands2 = fExpandedTrackCands[layer2]; vector result; Bool_t used2[cands2.size()]; //second cand is used for(size_t j=0;j a1 = cand1.getLineApproximations(); vector a2 = cand2.getLineApproximations(); vector lines = compareAndRefit(a1,a2); if(lines.size()==0)continue; used = kTRUE; used2[j]=kTRUE; PndFtsExpandedTrackCand etc(cand1.getSourceHits(),cand2.getSourceHits(),lines); result.push_back(etc); } if(!used)result.push_back(cands1[i]); } for(size_t j=0;j PndTrackCombiner::compareAndRefit (vector l1, vector l2){ vector result; for(size_t i=0;i