3 #define _USE_MATH_DEFINES 11 #include "FairLogger.h" 47 output <<
"Triplet: ";
49 output << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /";
60 std::vector<std::string> detID_Names{
"MVD_Pixel",
"MVD_Strip",
"STT",
"GEM",
"NOTDEFINED"};
78 fHits[detector] = data;
79 fAllHits.insert(fAllHits.end(), data.begin(), data.end());
86 void AddHits(std::vector<PndSttHit *> sttHits)
88 fHits[STT].insert(fHits[STT].end(), sttHits.begin(), sttHits.end());
89 fAllHits.insert(fAllHits.end(), sttHits.begin(), sttHits.end());
99 if (fHits.count(detector) == 0) {
102 if (std::find(fHits[detector].begin(), fHits[detector].end(), data) == fHits[detector].end()) {
103 fHits[detector].push_back(data);
104 fAllHits.push_back(data);
109 int GetNHits() {
return fHits[MVDpixel].size() + fHits[MVDstrip].size() + fHits[STT].size() + fHits[
GEM].size(); }
116 TVector2
HitOnTrack(FairHit *hit) {
return TVector2(hit->GetX() - fTrack.X(), hit->GetY() - fTrack.Y()); }
126 void SortHits(TVector2 &firstHit,
detID detector);
154 bool IsReasonableHit(FairHit *CurrentHit, FairHit *PriviousHit);
158 output <<
"Track x/y/r " << t.
fTrack.X() <<
"/" << t.
fTrack.Y() <<
"/" << t.
fTrack.Z() <<
" ";
162 if (t.
fHits.count(TripletSolution::detID::MVDpixel) > 0) {
163 output << t.
detID_Names.at(TripletSolution::detID::MVDpixel) <<
" : ";
164 for (
auto hit : t.
fHits.at(TripletSolution::detID::MVDpixel)) {
165 output << hit->GetEntryNr() <<
"/";
169 if (t.
fHits.count(TripletSolution::detID::MVDstrip) > 0) {
170 output << t.
detID_Names.at(TripletSolution::detID::MVDstrip) <<
" : ";
171 for (
auto hit : t.
fHits.at(TripletSolution::detID::MVDstrip)) {
172 output << hit->GetEntryNr() <<
"/";
176 if (t.
fHits.count(TripletSolution::detID::STT) > 0) {
177 output << t.
detID_Names.at(TripletSolution::detID::STT) <<
" : ";
178 for (
auto hit : t.
fHits.at(TripletSolution::detID::STT)) {
187 output << hit->GetEntryNr() <<
"/";
198 std::map<detID, std::vector<FairHit *>>
fHits;
200 double fMeanSquare = 1000000.;
201 bool fClockwise =
true;
213 fMidRow.insert(fMidRow.end(), right.
fMidRow.begin(), right.
fMidRow.end());
214 fLastRow.insert(fLastRow.end(), right.
fLastRow.begin(), right.
fLastRow.end());
221 output <<
"FirstRow: ";
222 std::for_each(t.
fFirstRow.begin(), t.
fFirstRow.end(), [](
PndSttHit *hit) { std::cout << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /"; });
224 output <<
"MidRow: ";
225 std::for_each(t.
fMidRow.begin(), t.
fMidRow.end(), [](
PndSttHit *hit) { std::cout << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /"; });
227 output <<
"LastRow: ";
228 std::for_each(t.
fLastRow.begin(), t.
fLastRow.end(), [](
PndSttHit *hit) { std::cout << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /"; });
244 fMapCAToMidTube.clear();
245 fMapCAToOuterTube.clear();
246 fMapInnerTubeToCA.clear();
247 fMapMidTubeToCA.clear();
261 std::map<int, std::vector<PndSttHit *>> GetAllTubesByRow(std::vector<PndSttHit *> hits,
PndSttGeometryMap *fGeometryMap,
int &fAllHitsCounter);
273 std::map<int, std::vector<std::vector<PndSttHit *>>>
274 GetTubeStructure(std::vector<PndSttHit *> hits,
PndSttGeometryMap *fGeometryMap,
int &fAllHitsCounter,
bool &fIsStrongCurling);
296 std::vector<Triplet> ReduceCombinatorics(
TripletValues &triplets, std::map<FairLink, int> &fMapHitstoCATracklet, TClonesArray *sttHits,
PndSttCA *fCATrackFinder,
297 PndSttGeometryMap *fGeometryMap,
double &fMinDistance,
bool &fWithCombiReduction);
306 bool IsTripletUsed(std::vector<TripletSolution> &solutions,
Triplet &triplet);
316 std::vector<TripletSolution> GenerateTripletTracks(
Triplet triplet, std::vector<PndSttHit *> &sttHits,
PndSttGeometryMap *fGeometryMap);
327 std::vector<double> calcIntersectionPointCircleLine(std::vector<double> circle,
double m,
double b,
double Ax);
355 double DistanceCirclePoint(TVector3 &circle, FairHit *hit);
364 double DistanceCircleSttHit(TVector3 &circle,
PndSttHit *sttHit);
374 double DistanceCircleSttHit(TVector3 &circle,
PndSttHit *sttHit,
double &sqaredDistance);
393 double DistanceLineSttHit(TVector3 &circle,
PndSttHit *sttHit);
402 double SquaredDistanceLineSttHit(TVector3 &circle,
PndSttHit *sttHit);
411 double DistanceLinePoint(TVector3 &circle, FairHit *hit);
419 void CheckContinuitySolutions(std::vector<TripletSolution> &solutions,
PndSttGeometryMap *fGeometryMap);
438 void AddOtherDetectors(vector<TripletSolution> &solutions,
PndSttStrawMap *fStrawMap, std::map<TString, TClonesArray *> &fBranchMap, TString sttname);
445 std::vector<TripletSolution> FindBestSolutions(std::vector<TripletSolution> &solutions);
454 std::vector<TripletSolution> CheckCombinedSolutions(std::vector<TripletSolution> &solutions,
int nExpectedTracks);
463 std::vector<TripletSolution> CheckSolutions(std::vector<TripletSolution> &solutions, std::vector<std::vector<int>> combinations);
472 std::vector<int> GetUniqueTubeIDs(std::vector<TripletSolution> &solutions, std::vector<int> combinations);
481 std::vector<std::vector<int>> GetKOutOfN(
int k,
int n);
489 std::vector<TripletSolution> CombineIdenticalSolutions(std::vector<TripletSolution> &solutions);
509 std::vector<PndSttHit *> TubeReduction(std::vector<std::pair<int, int>> &Rows, std::map<
int, std::vector<std::vector<PndSttHit *>>> &tubeStructure,
510 std::map<FairLink, int> &fMapHitstoCATracklet,
int position);
516 std::map<FairLink, int> GetHitsToCAMap(
PndSttCA *fCATrackFinder);
526 double CalcRatioSameHits(
TripletSolution &sol, std::vector<TripletSolution> &AlreadyFoundSolutions);
534 std::vector<TripletSolution> CombineIdenticalSolutionsFinal(std::vector<TripletSolution> &solutions, Double_t ratioOfSameHits = 0.6);
std::map< int, PndSttHit * > fMapCAToMidTube
std::array< PndSttHit *, 3 > fTripletHits
friend std::ostream & operator<<(std::ostream &output, const TripletSolution &t)
double fMVDArcLengthCutMid
Contains all distance thresholds for different detector hits to be defined as "close to the track and...
friend F32vec4 sqrt(const F32vec4 &a)
void AddHits(detID detector, std::vector< FairHit *> data)
A vector of hits is added.
double fDistanceThresholdMVDMid1
friend std::ostream & operator<<(std::ostream &output, const Triplet &t)
double fDistanceThresholdSTTFar
double fDistanceThresholdSTTCombinedSkewed
double fDistanceThresholdGEM
double fMVDArcLengthCutNarrow
TripletValues & operator+=(const TripletValues &right)
A structure that defines all functions used for the Apollonius Triplet track finder.
void AddHit(detID detector, FairHit *data)
One hit of a specific subdetector is added.
A structure that defines a triplet consisting of three STT Hits.
TripletSolution()
Constructor.
std::map< int, PndSttHit * > fMapCAToOuterTube
friend std::ostream & operator<<(std::ostream &output, const TripletValues &t)
std::map< PndSttHit *, int > fMapInnerTubeToCA
double fDistanceThresholdMVDFar
double fDistanceThresholdSTTNarrow
TVector2 HitOnTrack(FairHit *hit)
Determins a vector from the circle center to the corresponding hit.
double fDistanceThresholdMVDMid2
std::vector< PndSttHit * > fFirstRow
double fDistanceThresholdSTTSkewed
double fMVDArcLengthCutFar
int GetNHits()
Returns the total number of hits in a TripletSolution.
double fDistanceThresholdMVDNarrow
TripletSolution(TVector3 track)
Constructor.
std::map< detID, std::vector< FairHit * > > fHits
A structure that defines a solution of a triplet (an Apollonius Circle and all hits close to the circ...
std::vector< PndSttHit * > fMidRow
void AddHits(std::vector< PndSttHit *> sttHits)
A vector of STT hits is added.
std::vector< PndSttHit * > fLastRow
A structure that defines all maps that are used to reduce to number of possible triplet combinations...
std::map< PndSttHit *, int > fMapMidTubeToCA
double DistanceLineSttHit(TVector3 &circle, PndSttHit *sttHit, double &squaredDistance)
Determines the distance between a STT Hit and a line if the squared distance between the line and hit...
std::vector< FairHit * > fAllHits
std::vector< std::string > detID_Names
A structure that defines the three sets of STT hits (inner, mid, outer STT set), that are used to com...