19 cout <<
"PndSttHitCorrector::CorrectHits" << endl;
22 for (
size_t i = 0;
i < fSeparations[2].size(); ++
i) {
23 int actualTubeId = fSeparations[2][
i];
26 if (fStrawMap->IsSkewedStraw(actualTubeId))
30 cout <<
"Calculation for tube: " << actualTubeId << endl;
33 vector<vector<double> > angles;
36 if (!fStrawMap->IsSkewedStraw(fHitNeighbors[actualTubeId][0])
37 && !fStrawMap->IsSkewedStraw(fHitNeighbors[actualTubeId][1])) {
40 for (
size_t j = 0; j < fHitNeighbors[actualTubeId].size(); j++) {
41 int neighborTubeId = fHitNeighbors[actualTubeId][j];
44 cout <<
"NeighborTube: " << neighborTubeId <<
" : " << endl;
48 CalculateTangentAngles(
49 (
PndSttHit*) fHits[fMapTubeIdToHit[actualTubeId]],
50 (
PndSttHit*) fHits[fMapTubeIdToHit[neighborTubeId]]));
54 set<double> bestPhi = GetBestCombinatedPhi(angles);
56 if (bestPhi.size() == 2) {
57 double absDiff = abs(*bestPhi.begin() - *(++bestPhi.begin()));
58 if (absDiff < fDeltaDiff) {
62 GetAverageOfAngles(*bestPhi.begin(),
63 *(++bestPhi.begin())));
64 fTangentAngles[actualTubeId] = tmp;
67 fTangentAngles[actualTubeId] = bestPhi;
69 }
else if (bestPhi.size() == 1) {
70 fTangentAngles[actualTubeId] = bestPhi;
73 cout <<
"Found no good combination of tangent angles for tube "
74 << actualTubeId << endl;
81 cout <<
"Search for special positioning of 3 active neighbors" << endl;
82 map<int, set<double> > tmpTangentAngles;
86 for (
size_t i = 0;
i < fSeparations[3].size(); ++
i) {
87 int currentTube = fSeparations[3].at(
i);
90 if (fTangentAngles.find(currentTube) == fTangentAngles.end()) {
93 midNeighbor = GetMiddleHitNeighbor(currentTube);
94 if (midNeighbor != 0) {
96 phi1 = fGeometryMap->GetAngleBetweenTubes(currentTube,
98 fTangentAngles[currentTube].insert(phi1);
101 if (phi2 > 2 * TMath::Pi())
104 fTangentAngles[midNeighbor].insert(phi2);
106 cout <<
"current tube: " << currentTube <<
", midNeighbor: "
107 << midNeighbor <<
", angles: "
108 << phi1 * TMath::RadToDeg() <<
", "
109 << phi2 * TMath::RadToDeg() << endl;
115 cout <<
"Initialization done. Current fTangentAngles: " << endl;
116 PrintTangentAngles();
117 cout <<
"Adaption of angles: " << endl;
123 set<int> tubesToCheck;
125 for (
int i = 2;
i < 5; ++
i) {
126 for (
size_t j = 0; j < fSeparations[
i].size(); ++j) {
127 int actualTubeId = fSeparations[
i].at(j);
128 if (fTangentAngles.find(actualTubeId) == fTangentAngles.end()
129 || fTangentAngles[actualTubeId].size() != 1) {
131 tubesToCheck.insert(actualTubeId);
137 set<int> tmpTubesToCheck;
138 bool anglesChanged =
true;
141 while (anglesChanged) {
144 cout <<
"start loop - adaption of angles" << endl;
145 cout <<
"tubes to Check: " << tubesToCheck.size() << endl;
148 anglesChanged =
false;
149 tmpTubesToCheck.clear();
151 for (set<int>::iterator it = tubesToCheck.begin();
152 it != tubesToCheck.end(); ++it) {
155 if (fTangentAngles.find(*it) == fTangentAngles.end()
156 || fTangentAngles[*it].size() != 1) {
158 int actualTubeId = *it;
159 pair<int, int> straightNeighbors = GetStraightNeighbors(
163 cout <<
"currentTube: " << actualTubeId << endl;
166 if (straightNeighbors.first != 0) {
169 int unambiguousNeighbor = 0;
171 if (fHitNeighbors[actualTubeId].size() == 3) {
174 for (
size_t j = 0; j < fHitNeighbors[actualTubeId].size();
176 if (fHitNeighbors[actualTubeId].at(j)
177 != straightNeighbors.first
178 && fHitNeighbors[actualTubeId].at(j)
179 != straightNeighbors.second)
180 thirdNeighbor = fHitNeighbors[actualTubeId].at(
185 if (AreHitNeihbors(straightNeighbors.first,
187 && HasUnambiguousAngle(
188 straightNeighbors.first)) {
189 unambiguousNeighbor = straightNeighbors.first;
190 }
else if (AreHitNeihbors(straightNeighbors.second,
192 && HasUnambiguousAngle(
193 straightNeighbors.second)) {
194 unambiguousNeighbor = straightNeighbors.second;
201 if (HasUnambiguousAngle(straightNeighbors.first)) {
203 unambiguousNeighbor = straightNeighbors.first;
205 }
else if (HasUnambiguousAngle(
206 straightNeighbors.second)) {
208 unambiguousNeighbor = straightNeighbors.second;
212 if (unambiguousNeighbor != 0) {
214 cout <<
"unambiguous neighbor: "
215 << unambiguousNeighbor << endl;
219 (
PndSttHit*) fHits[fMapTubeIdToHit[actualTubeId]];
221 (
PndSttHit*) fHits[fMapTubeIdToHit[straightNeighbors.first]];
223 (
PndSttHit*) fHits[fMapTubeIdToHit[straightNeighbors.second]];
231 > secondNeigh->GetIsochrone()) {
235 *fTangentAngles[unambiguousNeighbor].begin();
238 <<
"isochrone is not the smallest one --> keep similar"
242 /
min(secondNeigh->GetIsochrone(),
244 >= fIsochroneEquality) {
249 *fTangentAngles[unambiguousNeighbor].begin();
252 cout <<
"nearly equal isochrones for tube "
253 << actualTubeId <<
": actual "
256 << secondNeigh->GetIsochrone()
259 <<
"--> keep similar" << endl;
265 int biggestNeigh, otherNeigh;
267 > secondNeigh->GetIsochrone()) {
268 biggestNeigh = straightNeighbors.first;
269 otherNeigh = straightNeighbors.second;
271 biggestNeigh = straightNeighbors.second;
272 otherNeigh = straightNeighbors.first;
276 cout <<
"Isochrones (actual, first, second): "
279 << secondNeigh->GetIsochrone() << endl;
281 <<
"isochrone is the smallest one, biggest neighbor: "
282 << biggestNeigh << endl;
285 if (unambiguousNeighbor == biggestNeigh) {
288 *fTangentAngles[unambiguousNeighbor].begin();
291 if (fTangentAngles.find(otherNeigh)
292 == fTangentAngles.end()
293 || fTangentAngles[otherNeigh].size()
297 cout <<
"keep similar, change neighbor "
298 << otherNeigh <<
" to opposite"
301 double otherAngle = similarAngle
303 if (otherAngle >= 2 * TMath::Pi())
305 KeepBestAngle(otherNeigh, otherAngle);
312 *fTangentAngles[unambiguousNeighbor].begin()
317 if (fTangentAngles.find(otherNeigh)
318 == fTangentAngles.end()
319 || fTangentAngles[otherNeigh].size()
323 <<
"keep opposite, change neighbor "
324 << otherNeigh <<
" to similar"
326 KeepBestAngle(otherNeigh,
327 *fTangentAngles[unambiguousNeighbor].begin());
334 KeepBestAngle(actualTubeId, similarAngle);
337 anglesChanged =
true;
339 cout <<
"angles changed for " << actualTubeId
344 tmpTubesToCheck.insert(actualTubeId);
346 cout <<
"try " << actualTubeId <<
" in next loop"
349 }
else if (fTangentAngles.find(actualTubeId)
350 != fTangentAngles.end()
351 && fHitNeighbors[actualTubeId].size() == 2
352 && !AreHitNeihbors(fHitNeighbors[actualTubeId].at(0),
353 fHitNeighbors[actualTubeId].at(1))) {
357 cout <<
"handle zigzag for tube " << actualTubeId
360 int firstNeigh = fHitNeighbors[actualTubeId].at(0);
361 int secondNeigh = fHitNeighbors[actualTubeId].at(1);
362 int unambiguousNeighor = 0;
364 if (HasUnambiguousAngle(firstNeigh)) {
365 unambiguousNeighor = firstNeigh;
366 }
else if (HasUnambiguousAngle(secondNeigh)) {
367 unambiguousNeighor = secondNeigh;
370 if (unambiguousNeighor != 0) {
371 double similarAngle =
372 *fTangentAngles[unambiguousNeighor].begin();
375 if (GetDiffBetweenAngles(similarAngle,
376 *fTangentAngles[actualTubeId].begin())
380 similarAngle = (similarAngle +
TMath::Pi());
387 double best = GetBestFittingAngle(similarAngle,
388 fTangentAngles[actualTubeId]);
389 KeepBestAngle(actualTubeId, best);
392 cout <<
"unambiguous neighbor: "
393 << unambiguousNeighor <<
", angle: "
394 << *fTangentAngles[unambiguousNeighor].begin()
395 * TMath::RadToDeg() <<
", similar: "
396 << similarAngle * TMath::RadToDeg()
397 <<
", keep:" << best * TMath::RadToDeg()
402 tmpTubesToCheck.insert(actualTubeId);
404 cout <<
"try " << actualTubeId <<
" in next loop"
409 cout <<
"found no straight neighbors" << endl;
414 tubesToCheck.clear();
415 tubesToCheck = tmpTubesToCheck;
418 cout <<
"new fTangentAngles: " << endl;
419 PrintTangentAngles();
425 for (vector<FairHit*>::iterator it = fHits.begin(); it != fHits.end();
430 if (!fStrawMap->IsSkewedStraw(actualHit->
GetTubeID())
431 && !HasUnambiguousAngle(actualHit->
GetTubeID())
435 fTangentAngles[actualHit->
GetTubeID()] = tmp;
440 cout <<
"Result:" << endl;
441 PrintTangentAngles();
449 cout <<
"Calculated tangent angles: " << endl;
451 for (
map<
int, set<double> >::iterator mapIt = fTangentAngles.begin();
452 mapIt != fTangentAngles.end(); ++mapIt) {
453 cout <<
"angles for tube " << mapIt->first <<
": ";
454 for (set<double>::iterator setIt = mapIt->second.begin();
455 setIt != mapIt->second.end(); ++setIt) {
457 cout << *setIt <<
", ";
459 cout << TMath::RadToDeg() * (*setIt) <<
", ";
469 cout <<
"PndSttHitCorrector::CalculateTangentAngles" << endl;
474 TVector3 origin1, origin2;
475 tube1->Position(origin1);
476 tube2->Position(origin2);
478 TVector3 directionBetweenTubes = origin2 - origin1;
481 cout <<
"---- Input ----" << endl;
484 cout <<
" Origin2: ";
487 directionBetweenTubes.Print();
488 cout << endl <<
"Radius1: " << radius1 <<
" Radius2: " << radius2
493 Bool_t tube1Larger = kTRUE;
494 if (radius1 > radius2) {
501 tube1Larger = kFALSE;
509 cout <<
"Phi0: " << TMath::RadToDeg() * phi0 <<
" Phi1: "
510 << TMath::RadToDeg() * phi1 <<
" Phi2: "
511 << TMath::RadToDeg() * phi2 << endl << endl;
514 vector<double> results;
519 results.push_back(angle1);
524 results.push_back(angle2);
529 results.push_back(angle3);
534 results.push_back(angle4);
537 cout <<
"---- Output ----" << endl;
538 cout <<
"Phi0 + Phi1 - Pi/2 = " << TMath::RadToDeg() * angle1
540 cout <<
"Phi0 - Phi1 + Pi/2 = " << TMath::RadToDeg() * angle2
542 cout <<
"Phi0 + Phi2 - Pi/2 = " << TMath::RadToDeg() * angle3
544 cout <<
"Phi0 - Phi2 + Pi/2 = " << TMath::RadToDeg() * angle4
551 results.push_back(angle1);
556 results.push_back(angle2);
561 results.push_back(angle3);
566 results.push_back(angle4);
569 cout <<
"---- Output ----" << endl;
570 cout <<
"Phi0 + Phi1 + Pi/2 = " << TMath::RadToDeg() * angle1
572 cout <<
"Phi0 - Phi1 - Pi/2 = " << TMath::RadToDeg() * angle2
574 cout <<
"Phi0 + Phi2 - Pi/2 = " << TMath::RadToDeg() * angle3
576 cout <<
"Phi0 - Phi2 + Pi/2 = " << TMath::RadToDeg() * angle4
588 cout <<
"PndSttHitCorrctor::GetMiddleHitNeighbor(" << tubeID <<
")"
591 int middleTubeID = 0;
593 if (fHitNeighbors[tubeID].size() == 3) {
594 double phi0 = fGeometryMap->GetAngleBetweenTubes(tubeID,
595 fHitNeighbors[tubeID].at(0));
596 double phi1 = fGeometryMap->GetAngleBetweenTubes(tubeID,
597 fHitNeighbors[tubeID].at(1));
598 double phi2 = fGeometryMap->GetAngleBetweenTubes(tubeID,
599 fHitNeighbors[tubeID].at(2));
602 double diff01 = GetDiffBetweenAngles(phi0, phi1);
603 double diff12 = GetDiffBetweenAngles(phi1, phi2);
604 double diff02 = GetDiffBetweenAngles(phi0, phi2);
607 double delta = pow(10, -4);
612 middleTubeID = fHitNeighbors[tubeID].at(1);
613 else if ((diff01 - (
TMath::Pi() / 3)) < delta
615 middleTubeID = fHitNeighbors[tubeID].at(0);
616 else if ((diff12 - (
TMath::Pi() / 3)) < delta
618 middleTubeID = fHitNeighbors[tubeID].at(2);
621 cout <<
"diff01: " << diff01 * TMath::RadToDeg() <<
", diff12: "
622 << diff12 * TMath::RadToDeg() <<
", diff02: "
623 << diff02 * TMath::RadToDeg() << endl;
624 cout <<
"middle-tube: " << middleTubeID << endl;
635 cout <<
"PndSttHitCorrector::GetStraightNeighbors(" << tubeID <<
")"
638 pair<int, int> straightNeighbors;
639 straightNeighbors.first = 0;
640 straightNeighbors.second = 0;
642 for (
size_t i = 0;
i < fHitNeighbors[tubeID].size() - 1; ++
i) {
644 for (
size_t j =
i + 1; j < fHitNeighbors[tubeID].size(); ++j) {
646 if (fGeometryMap->InStraightLine(tubeID,
647 fHitNeighbors[tubeID].at(
i), fHitNeighbors[tubeID].at(j))) {
648 straightNeighbors.first = fHitNeighbors[tubeID].at(
i);
649 straightNeighbors.second = fHitNeighbors[tubeID].at(j);
652 cout <<
"Found straight neighbors: "
653 << straightNeighbors.first <<
", "
654 << straightNeighbors.second << endl;
660 return straightNeighbors;
664 const vector<vector<double> > &angles) {
667 cout <<
"PndSttHitCorrector::GetBestCombinatedPhi()" << endl;
672 vector<vector<vector<double> > > differences;
673 vector<vector<double> > smallestDiff;
674 vector<vector<pair<int, int> > > smallestPairs;
676 CalcDifferencesBetweenAngles(angles, differences, smallestDiff,
679 vector<vector<double> > classification;
680 classification = CalcClassification(smallestDiff);
683 int biggestIndex, secondBiggestIndex;
684 double biggest = 0, secondBiggest = 0;
686 vector<double> tmp = classification.at(0);
688 for (
size_t j = 0; j < tmp.size(); ++j) {
689 if (tmp[j] > biggest) {
690 secondBiggest = biggest;
691 secondBiggestIndex = biggestIndex;
696 }
else if (tmp[j] > secondBiggest) {
697 secondBiggest = tmp[j];
698 secondBiggestIndex = j;
704 pair<int, int> bestPair = smallestPairs.at(0)[biggestIndex];
705 double firstAngle = angles[0][bestPair.first];
706 double secondAngle = angles[1][bestPair.second];
709 cout <<
"Best pair of angles: " << firstAngle * TMath::RadToDeg()
710 <<
", " << secondAngle * TMath::RadToDeg() << endl;
712 if (abs(firstAngle - secondAngle) < fMaxDiffBetweenAngles) {
714 double bestPhi = (firstAngle + secondAngle) / 2;
719 cout <<
"Two best values of classification: " << biggest <<
", "
720 << secondBiggest << endl;
721 cout <<
"Best Phi: " << TMath::RadToDeg() * bestPhi << endl;
725 if (secondBiggest / biggest > 0.90) {
727 pair<int, int> secondBestPair =
728 smallestPairs.at(0)[secondBiggestIndex];
729 double secondBestPhi = (angles[0][secondBestPair.first]
730 + angles[1][secondBestPair.second]) / 2;
731 ret.insert(secondBestPhi);
734 cout <<
"Second best Phi: " << TMath::RadToDeg() * secondBestPhi
743 const vector<vector<double> > &angles,
744 vector<vector<vector<double> > > &retDifferences,
745 vector<vector<double> > &retSmallestDiff,
746 vector<vector<pair<int, int> > > &retPairsOfSmallest) {
749 cout <<
"PndSttHitCorrector::CalcDifferencesBetweenAngles()" << endl;
751 cout <<
"Calculate differences between:";
752 for (vector<vector<double> >::const_iterator iterFirst = angles.begin();
753 iterFirst != angles.end(); ++iterFirst) {
754 vector<double> tmp = *iterFirst;
756 for (
size_t i = 0;
i < tmp.size(); ++
i) {
757 cout << TMath::RadToDeg() * tmp[
i] <<
",";
764 for (vector<vector<double> >::const_iterator iterFirst = angles.begin();
765 iterFirst != angles.end() - 1; ++iterFirst) {
768 for (vector<vector<double> >::const_iterator iterSecond = iterFirst + 1;
769 iterSecond != angles.end(); ++iterSecond) {
772 vector<vector<double> > tmp2D;
773 retDifferences.push_back(tmp2D);
776 vector<double> tmp1D;
777 retSmallestDiff.push_back(tmp1D);
778 vector<pair<int, int> > tmpPair;
779 retPairsOfSmallest.push_back(tmpPair);
781 vector<double> first = *iterFirst;
782 vector<double> second = *iterSecond;
786 for (
size_t k = 0; k < first.size(); k++) {
790 retDifferences.back().push_back(tmp);
793 pair<int, int> indexOfSmallest;
796 for (
size_t j = 0; j < second.size(); j++) {
799 cout <<
"Phi 0: " << k <<
" : "
800 << TMath::RadToDeg() * first[k] <<
" Phi 1: "
801 << j <<
" : " << TMath::RadToDeg() * second[j]
806 currentDiff = GetDiffBetweenAngles(first[k], second[j]);
807 retDifferences.back().at(k).push_back(currentDiff);
810 if (currentDiff < smallestDifference) {
812 smallestDifference = currentDiff;
813 indexOfSmallest = make_pair(k, j);
819 retSmallestDiff.back().push_back(smallestDifference);
820 retPairsOfSmallest.back().push_back(indexOfSmallest);
828 cout <<
"Result of Calculation:" << endl;
829 int first = 0, second = 1;
830 for (
size_t i = 0;
i < retDifferences.size(); ++
i) {
832 cout <<
"Smallest Difference for vectors (" << first <<
", "
833 << second <<
"): " << endl;
835 for (
size_t k = 0; k < retSmallestDiff.at(
i).size(); ++k) {
836 cout << TMath::RadToDeg() * retSmallestDiff.at(
i)[k]
837 <<
" for Phi [" << retPairsOfSmallest.at(
i)[k].first
838 <<
", " << retPairsOfSmallest.at(
i)[k].second <<
"]"
842 if (second == (
int)retDifferences.size() - 1) {
850 cout << endl << endl;
856 const vector<vector<double> > &smallestDiff) {
859 cout <<
"PndSttHitCorrector::CalcClassification(smallestDiff)" << endl;
861 vector<vector<double> > classification;
862 vector<double> sumOfSmallest;
864 for (
size_t i = 0;
i < smallestDiff.size(); ++
i) {
865 sumOfSmallest.push_back(0);
868 for (
size_t j = 0; j < smallestDiff[
i].size(); ++j) {
869 sumOfSmallest[
i] += smallestDiff[
i][j];
873 classification.push_back(tmp);
876 for (
size_t j = 0; j < smallestDiff[
i].size(); ++j) {
877 classification.back().push_back(
878 1 - smallestDiff[
i][j] / sumOfSmallest[
i]);
883 cout <<
"Calculated classification: " << endl;
885 for (
size_t i = 0;
i < classification.size(); ++
i) {
886 cout <<
"Data for " <<
i <<
". vector of smallest differences: ";
887 for (
size_t j = 0; j < classification[
i].size(); ++j) {
888 cout << classification[
i][j] <<
", ";
893 cout << endl << endl;
896 return classification;
900 const vector<vector<vector<double> > > &differences) {
902 vector<vector<double> > smallestValues;
903 vector<vector<pair<int, int> > > pairsOfSmallestValues;
904 vector<vector<double> > classification;
907 cout <<
"PndSttHitCorrector::CalcClassification: classification"
910 vector<double> sumOfSmallestValues;
914 for (vector<vector<vector<double> > >::const_iterator outerIter =
915 differences.begin(); outerIter != differences.end(); outerIter++) {
916 sumOfSmallestValues.push_back(0);
918 smallestValues.push_back(tmp);
919 classification.push_back(tmp);
921 vector<pair<int, int> > tmp2;
922 pairsOfSmallestValues.push_back(tmp2);
924 for (
size_t i = 0;
i < outerIter->size();
i++) {
925 double smallestValue = 10000;
926 pair<int, int> pairOfSmallest;
928 for (
size_t j = 0; j < outerIter->at(
i).size(); j++) {
930 cout <<
"Pairs: " <<
i <<
"/" << j <<
" : "
931 << outerIter->at(
i)[j] << endl;
932 if (outerIter->at(
i)[j] < smallestValue) {
933 smallestValue = outerIter->at(
i)[j];
934 pairOfSmallest = make_pair(
i, j);
940 smallestValues[
out].push_back(smallestValue);
941 pairsOfSmallestValues[
out].push_back(pairOfSmallest);
942 sumOfSmallestValues[
out] += smallestValue;
944 for (
size_t i = 0;
i < smallestValues[
out].size();
i++) {
945 classification[
out].push_back(
946 1 - smallestValues[out][
i] / sumOfSmallestValues[out]);
948 cout <<
"Pair: " << pairsOfSmallestValues[
out][
i].first <<
"/"
949 << pairsOfSmallestValues[
out][
i].second <<
" Value: "
950 << TMath::RadToDeg() * smallestValues[
out][
i]
951 <<
" Classification: " << classification[
out][
i]
957 return classification;
962 cout <<
"void PndSttHitCorrector::CorrectIsochrones()" << endl;
966 for (
map<
int, set<double> >::iterator it = fTangentAngles.begin();
967 it != fTangentAngles.end(); ++it) {
969 if (it->second.size() == 1) {
970 actualTubeId = it->first;
971 bestPhi = *it->second.begin();
974 (
PndSttHit*) fHits[fMapTubeIdToHit[actualTubeId]];
975 TVector3 origin(actualHit->GetX(), actualHit->GetY(),
977 TVector3 hitError(0.01, 0.01, 100);
981 TVector3 correctedPosition(
990 cout <<
"Corrected Position for " << actualTubeId <<
": ";
991 correctedPosition.Print();
994 fCorrectedIsochrones[fMapTubeIdToHit[actualTubeId]] =
995 new FairHit(-1, correctedPosition, hitError, -1);
998 fCorrectedIsochrones[fMapTubeIdToHit[actualTubeId]] =
999 new FairHit(-1, origin, hitError, -1);
1002 fCorrectedIsochrones[fMapTubeIdToHit[actualTubeId]]->SetLink(
1003 FairLink(
"STTHit", fMapTubeIdToHit[actualTubeId]));
1006 cout <<
"[warning: ambiguous tangent angles for tube "
1007 << it->first <<
"]" << endl;
1010 int indexCounter = 0;
1011 for (map<int, FairHit*>::iterator it = fCorrectedIsochrones.begin();
1012 it != fCorrectedIsochrones.end(); ++it) {
1013 it->second->SetEntryNr(FairLink(
"CorrectedIsochrones", indexCounter++));
1020 cout <<
"void PndSttHitCorrector::KeepBestAngle" << endl;
1025 if ((fTangentAngles.find(tubeID) != fTangentAngles.end())
1026 && (fTangentAngles.size() != 1)) {
1028 keep = GetBestFittingAngle(angle, fTangentAngles[tubeID]);
1036 fTangentAngles[tubeID].clear();
1037 fTangentAngles[tubeID].insert(keep);
1040 cout <<
"Result for tube: " << tubeID <<
", keep "
1041 << keep * TMath::RadToDeg() << endl;
1045 double diff = abs(angle1 - angle2);
1054 double diff = abs(angle1 - angle2);
1058 double tmp =
max(angle1, angle2) + (2 *
TMath::Pi() - diff) / 2;
1063 return (angle1 + angle2) / 2;
1067 set<double> anglesToTest) {
1069 double minDiff = 1000;
1073 for (set<double>::iterator it = anglesToTest.begin();
1074 it != anglesToTest.end(); ++it) {
1075 tmpDiff = GetDiffBetweenAngles(angle, *it);
1076 if (tmpDiff < minDiff) {
1088 if (fHitNeighbors.find(tubeID1) == fHitNeighbors.end()
1089 || fHitNeighbors.find(tubeID2) == fHitNeighbors.end()) {
1093 for (
size_t i = 0;
i < fHitNeighbors[tubeID1].size(); ++
i) {
1094 if (fHitNeighbors[tubeID1].at(
i) == tubeID2) {
1104 if (fTangentAngles.find(tubeID) != fTangentAngles.end()
1105 && fTangentAngles[tubeID].size() == 1)
static T ASin(const T &x)
void CalcDifferencesBetweenAngles(const std::vector< std::vector< double > > &angles, std::vector< std::vector< std::vector< double > > > &retDifferences, std::vector< std::vector< double > > &retSmallestDiff, std::vector< std::vector< std::pair< int, int > > > &retPairsOfSmallest)
bool HasUnambiguousAngle(int tubeID)
double GetDiffBetweenAngles(double angle1, double angle2)
double GetBestFittingAngle(double angle, std::set< double > anglesToTest)
std::pair< int, int > GetStraightNeighbors(int tubeID)
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
int GetMiddleHitNeighbor(int tubeID)
void KeepBestAngle(int tubeID, double angle)
std::vector< double > CalculateTangentAngles(PndSttHit *tube1, PndSttHit *tube2)
std::vector< std::vector< double > > CalcClassification(const std::vector< std::vector< double > > &smallestDiff)
Double_t GetIsochrone() const
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
bool AreHitNeihbors(int tubeID1, int tubeID2)
void PrintTangentAngles()
virtual void Print(const Option_t *opt=0) const
double GetAverageOfAngles(double angle1, double angle2)
std::set< double > GetBestCombinatedPhi(const std::vector< std::vector< double > > &angles)