15 #define _USE_MATH_DEFINES 23 #include "FairLogger.h" 59 output <<
"Triplet: ";
61 output << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /";
72 std::vector<std::string> detID_Names{
"MVD_Pixel",
"MVD_Strip",
"STT",
"GEM",
"NOTDEFINED"};
90 fHits[detector] = data;
91 fAllHits.insert(fAllHits.end(), data.begin(), data.end());
98 void AddHits(std::vector<PndSttHit *> sttHits)
100 fHits[STT].insert(fHits[STT].end(), sttHits.begin(), sttHits.end());
101 fAllHits.insert(fAllHits.end(), sttHits.begin(), sttHits.end());
111 if (fHits.count(detector) == 0) {
114 if (std::find(fHits[detector].begin(), fHits[detector].end(), data) == fHits[detector].end()) {
115 fHits[detector].push_back(data);
116 fAllHits.push_back(data);
121 int GetNHits() {
return fHits[MVDpixel].size() + fHits[MVDstrip].size() + fHits[STT].size() + fHits[
GEM].size(); }
128 TVector2
HitOnTrack(FairHit *hit) {
return TVector2(hit->GetX() - fTrack.X(), hit->GetY() - fTrack.Y()); }
138 void SortHits(TVector2 &firstHit,
detID detector);
166 bool IsReasonableHit(FairHit *CurrentHit, FairHit *PriviousHit);
170 output <<
"Track x/y/r " << t.
fTrack.X() <<
"/" << t.
fTrack.Y() <<
"/" << t.
fTrack.Z() <<
" ";
174 if (t.
fHits.count(TripletSolution::detID::MVDpixel) > 0) {
175 output << t.
detID_Names.at(TripletSolution::detID::MVDpixel) <<
" : ";
176 for (
auto hit : t.
fHits.at(TripletSolution::detID::MVDpixel)) {
177 output << hit->GetEntryNr() <<
"/";
181 if (t.
fHits.count(TripletSolution::detID::MVDstrip) > 0) {
182 output << t.
detID_Names.at(TripletSolution::detID::MVDstrip) <<
" : ";
183 for (
auto hit : t.
fHits.at(TripletSolution::detID::MVDstrip)) {
184 output << hit->GetEntryNr() <<
"/";
188 if (t.
fHits.count(TripletSolution::detID::STT) > 0) {
189 output << t.
detID_Names.at(TripletSolution::detID::STT) <<
" : ";
190 for (
auto hit : t.
fHits.at(TripletSolution::detID::STT)) {
199 output << hit->GetEntryNr() <<
"/";
210 std::map<detID, std::vector<FairHit *>>
fHits;
212 double fMeanSquare = 1000000.;
213 bool fClockwise =
true;
225 fMidRow.insert(fMidRow.end(), right.
fMidRow.begin(), right.
fMidRow.end());
226 fLastRow.insert(fLastRow.end(), right.
fLastRow.begin(), right.
fLastRow.end());
233 output <<
"FirstRow: ";
234 std::for_each(t.
fFirstRow.begin(), t.
fFirstRow.end(), [](
PndSttHit *hit) { std::cout << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /"; });
236 output <<
"MidRow: ";
237 std::for_each(t.
fMidRow.begin(), t.
fMidRow.end(), [](
PndSttHit *hit) { std::cout << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /"; });
239 output <<
"LastRow: ";
240 std::for_each(t.
fLastRow.begin(), t.
fLastRow.end(), [](
PndSttHit *hit) { std::cout << hit->GetTubeID() <<
"(" << hit->GetX() <<
"," << hit->GetY() <<
") /"; });
256 fMapCAToMidTube.clear();
257 fMapCAToOuterTube.clear();
258 fMapInnerTubeToCA.clear();
259 fMapMidTubeToCA.clear();
273 std::map<int, std::vector<PndSttHit *>> GetAllTubesByRow(std::vector<PndSttHit *> hits,
PndSttGeometryMap *fGeometryMap,
int &fAllHitsCounter);
285 std::map<int, std::vector<std::vector<PndSttHit *>>>
286 GetTubeStructure(std::vector<PndSttHit *> hits,
PndSttGeometryMap *fGeometryMap,
int &fAllHitsCounter,
bool &fIsStrongCurling);
308 std::vector<Triplet> ReduceCombinatorics(
TripletValues &triplets, std::map<FairLink, int> &fMapHitstoCATracklet, TClonesArray *sttHits,
PndSttCA *fCATrackFinder,
309 PndSttGeometryMap *fGeometryMap,
double &fMinDistance,
bool &fWithCombiReduction);
318 bool IsTripletUsed(std::vector<TripletSolution> &solutions,
Triplet &triplet);
328 std::vector<TripletSolution> GenerateTripletTracks(
Triplet triplet, std::vector<PndSttHit *> &sttHits,
PndSttGeometryMap *fGeometryMap);
339 std::vector<double> calcIntersectionPointCircleLine(std::vector<double> circle,
double m,
double b,
double Ax);
367 double DistanceCirclePoint(TVector3 &circle, FairHit *hit);
376 double DistanceCircleSttHit(TVector3 &circle,
PndSttHit *sttHit);
386 double DistanceCircleSttHit(TVector3 &circle,
PndSttHit *sttHit,
double &sqaredDistance);
405 double DistanceLineSttHit(TVector3 &circle,
PndSttHit *sttHit);
414 double SquaredDistanceLineSttHit(TVector3 &circle,
PndSttHit *sttHit);
423 double DistanceLinePoint(TVector3 &circle, FairHit *hit);
431 void CheckContinuitySolutions(std::vector<TripletSolution> &solutions,
PndSttGeometryMap *fGeometryMap);
450 void AddOtherDetectors(vector<TripletSolution> &solutions,
PndSttStrawMap *fStrawMap, std::map<TString, TClonesArray *> &fBranchMap, TString sttname);
457 std::vector<TripletSolution> FindBestSolutions(std::vector<TripletSolution> &solutions);
466 std::vector<TripletSolution> CheckCombinedSolutions(std::vector<TripletSolution> &solutions,
int nExpectedTracks);
475 std::vector<TripletSolution> CheckSolutions(std::vector<TripletSolution> &solutions, std::vector<std::vector<int>> combinations);
484 std::vector<int> GetUniqueTubeIDs(std::vector<TripletSolution> &solutions, std::vector<int> combinations);
493 std::vector<std::vector<int>> GetKOutOfN(
int k,
int n);
501 std::vector<TripletSolution> CombineIdenticalSolutions(std::vector<TripletSolution> &solutions);
521 std::vector<PndSttHit *> TubeReduction(std::vector<std::pair<int, int>> &Rows, std::map<
int, std::vector<std::vector<PndSttHit *>>> &tubeStructure,
522 std::map<FairLink, int> &fMapHitstoCATracklet,
int position);
528 std::map<FairLink, int> GetHitsToCAMap(
PndSttCA *fCATrackFinder);
538 double CalcRatioSameHits(
TripletSolution &sol, std::vector<TripletSolution> &AlreadyFoundSolutions);
546 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...