PandaRoot
PndSttSkewStrawPzFinder.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /*
14  * PndSttSkewStrawPzFinder.h
15  *
16  * Created on: Mar 17, 2016
17  * Author: walan603
18  */
19 
20 #ifndef PNDSTTSKEWSTRAWPZFINDER_H_
21 #define PNDSTTSKEWSTRAWPZFINDER_H_
22 
23 #include <iostream>
24 
25 // Root includes
26 #include <TH2D.h>
27 
28 // Pandaroot includes
30 #include "PndSttStrawMap.h"
31 #include <PndRiemannTrack.h>
32 
33 class PndSttHit;
34 class FairHit;
35 class PndTrack;
36 class PndTrackCand;
37 
38 class TH2D;
39 
40 using namespace std;
41 
43  public:
44  PndSttSkewStrawPzFinder(TClonesArray *sttTubeArray, TClonesArray *sttHitArray);
45 
47 
48  void WithRiemann(bool set) { fWithRiemann = set; };
49 
50  int getMethod() const { return fMethod; }
51  void setMethod(int input) { fMethod = input; }
52 
53  void setStepTheta(double input) { fStepTheta = input; }
54  void setStepR(int input) { fStepR = input; }
55 
56  void AddPndRiemannTracks(vector<PndRiemannTrack> AllRiemannTracks);
57 
58  void AddPndTracks(vector<PndTrack> AllTracks);
59 
60  void AddPndTrackCands(vector<PndTrackCand> AllTrackCands);
61 
62  void AddPndSttHits(vector<vector<PndSttHit>> AllSkewedHits);
63 
64  void AddMvdPixelHits(vector<vector<FairHit>> AllMvdPixelHits);
65 
66  void AddMvdStripHits(vector<vector<FairHit>> AllMvdStripHits);
67 
68  void AddGemHits(vector<vector<FairHit>> AllMvdStripHits);
69 
70  void ExtractPz();
71 
72  PndRiemannTrack GetRiemannTrack(int i) { return fResultPndRiemannTrack[i]; };
73 
74  PndTrack GetTrack(int i) { return fResultPndTrack[i]; };
75 
76  PndTrackCand GetTrackCand(int i) { return fResultPndTrackCand[i]; };
77 
78  PndSttSkewStrawPzFinderData GetPzData(int i) { return fResultPzData[i]; };
79 
80  vector<PndSttHit> GetSttHits(int i) { return fResultSkewedSttHits[i]; };
81 
82  vector<FairHit> GetMvdPixelHits(int i) { return fResultMvdPixelHits[i]; };
83 
84  vector<FairHit> GetMvdStripHits(int i) { return fResultMvdStripHits[i]; };
85 
86  vector<FairHit> GetGemHits(int i) { return fResultGemHits[i]; };
87 
88  int NumPndRiemannTracks() { return fResultPndRiemannTrack.size(); };
89 
90  int NumPndTracks() { return fResultPndTrack.size(); };
91 
92  int NumPndTrackCands() { return fResultPndTrackCand.size(); };
93 
94  int NumPndPzData() { return fResultPzData.size(); };
95 
96  int NumPndSttHits() { return fResultSkewedSttHits.size(); };
97 
98  int NumPndMvdPixelHits() { return fResultMvdPixelHits.size(); };
99 
100  int NumPndMvdStripHits() { return fResultMvdStripHits.size(); };
101 
102  int NumPndGemHits() { return fResultGemHits.size(); };
103 
104  void Reset()
105  {
106 
107  fVectorPndRiemannTrack.clear();
108  fVectorPndTrack.clear();
109  fVectorPndTrackCand.clear();
110  fVectorSkewedSttHits.clear();
111  fVectorMvdPixelHits.clear();
112  fVectorMvdStripHits.clear();
113  fVectorGemHits.clear();
114 
115  fResultPndRiemannTrack.clear();
116  fResultPndTrack.clear();
117  fResultPndTrackCand.clear();
118  fResultPzData.clear();
119  fResultSkewedSttHits.clear();
120  fResultMvdPixelHits.clear();
121  fResultMvdStripHits.clear();
122  fVectorGemHits.clear();
123 
124  if (fVerbose > 0) {
125  cout << "PndSttSkewStrawPzFinder::Reset()" << endl;
126  }
127  }
128 
129  private:
130  bool fWithRiemann;
131  int fVerbose;
132  int fMethod;
133  Double_t fStepTheta;
134  Int_t fStepR;
135  Double_t LineCombiAngleThreshold;
136  TClonesArray *fTubeArray;
137  TClonesArray *fSTTHits;
138  PndSttStrawMap *fStrawMap; // for getting more information about the tubes
139 
140  TH2D *fHoughHisto; // Line Hough histogram
141 
142  // Vectors of initial tracks and hits
143  vector<PndRiemannTrack> fVectorPndRiemannTrack;
144  vector<PndTrack> fVectorPndTrack;
145  vector<PndTrackCand> fVectorPndTrackCand;
146 
147  vector<vector<PndSttHit>> fVectorSkewedSttHits;
148  vector<vector<FairHit>> fVectorMvdPixelHits;
149  vector<vector<FairHit>> fVectorMvdStripHits;
150  vector<vector<FairHit>> fVectorGemHits;
151 
152  // Vectors of final tracks and hits that extracted Pz
153  vector<PndRiemannTrack> fResultPndRiemannTrack;
154  vector<PndTrack> fResultPndTrack;
155  vector<PndTrackCand> fResultPndTrackCand;
156 
157  vector<vector<PndSttHit>> fResultSkewedSttHits;
158  vector<vector<FairHit>> fResultMvdPixelHits;
159  vector<vector<FairHit>> fResultMvdStripHits;
160  vector<vector<FairHit>> fResultGemHits;
161 
162  // Additional data produced by PzFinder
163  vector<PndSttSkewStrawPzFinderData> fResultPzData;
164 
165  // void InitSkewed();
166 
167  void GetCenterOfTrack(PndTrack temp, TVector2 &center, double &radius);
168 
169  Int_t ComputeSegmentCircleIntersection(TVector2 ex1, TVector2 ex2, double xc, double yc, double R, TVector2 &intersection1, TVector2 &intersection2);
170 
171  TVector2 ComputeTangentInPoint(double xc, double yc, TVector2 point);
172 
173  // vector<vector<TVector2>> LineCombiIsoFinder(vector<vector<TVector2>> SZPairVector);
174  // vector<pair<unsigned int,unsigned int>> LineCombiIsoFinderIndex(vector<vector<TVector2>> SZPairVector);
175  vector<pair<unsigned int, unsigned int>>
176  LineCombiIsoFinderIndex2(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip, vector<TVector2> SZPairVectorGem);
177 
178  // TODO: refine Hough transform part
179  // vector<vector<TVector2>> HoughTrueIsoFinder(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip, TH2D
180  //*HoughSpace);
181  vector<pair<unsigned int, unsigned int>> HoughTrueIsoFinderIndex(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel,
182  vector<TVector2> SZPairVectorMvdStrip, vector<TVector2> SZPairVectorGem, bool draw);
183 
184  // vector<vector<TVector2>> HoughTrueIsoFinder2(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip, TH2D
185  //*HoughSpace);
186 
187  // TVector2 TheilSen(vector<vector<TVector2>> SZPairVector);
188 
189  vector<vector<PndSttHit>> MoveSkewedHitsToCircle(TVector2 circle, Double_t circlerad, vector<PndSttHit> skewhits, vector<vector<PndSttHit>> &corrxy);
190 
191  void NestedFor(vector<int> &times, vector<int> &current, pair<vector<int>, double> &best, double sum, vector<vector<pair<vector<int>, double>>> matrix, unsigned int depth);
192 
193  // TVector2 PzLineFitExtract(vector<TVector2> TrueSZ);
194 
195  // TVector2 PzLineFitExtract2(vector<vector<TVector2>> TrueSZPairVector);
196 
197  double PzLineFitExtract3(vector<vector<TVector2>> TrueSZPairVector, vector<TVector2> TrueSZPairVectorMvdPixel, vector<TVector2> TrueSZPairVectorMvdStrip,
198  vector<TVector2> TrueSZPairVectorGem, TVector2 &lineparams);
199 
200  void LineFitRecursiveAnnealFinder(vector<vector<TVector2>> SZPairVector, vector<double> DriftRadVector, vector<TVector2> SZPairVectorMvdPixel,
201  vector<TVector2> SZPairVectorMvdStrip, vector<TVector2> SZPairVectorGem, vector<pair<unsigned int, unsigned int>> &TrueSZPairVectorindex,
202  vector<unsigned int> &TrueSZPairVectorMvdPixelindex, vector<unsigned int> &TrueSZPairVectorMvdStripindex,
203  vector<unsigned int> &TrueSZPairVectorGemindex);
204 
205  FairTrackParP GetTrackParam(FairTrackParP oldParam, TVector2 center, double radius, TVector2 lineparams, double S0, int charge);
206 
207  Double_t CalculateResidual(Double_t lineSlope, Double_t lineIntercept, TVector2 SZPoint);
208 
209  void LineFit(vector<vector<TVector2>> SZPairVector, vector<double> DriftRadVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip,
210  vector<TVector2> SZPairVectorGem, double &k, double &m);
211  void DrawOpt2D(TH2D *ShitSpace);
212 
213  ClassDef(PndSttSkewStrawPzFinder, 1);
214 };
215 
216 #endif /* PNDSTTSKEWSTRAWPZFINDER_H_ */
__m128 m
Definition: P4_F32vec4.h:38
PndRiemannTrack GetRiemannTrack(int i)
vector< FairHit > GetMvdPixelHits(int i)
STL namespace.
vector< FairHit > GetGemHits(int i)
PndTrackCand GetTrackCand(int i)
unsigned int i
Definition: P4_F32vec4.h:33
PndSttSkewStrawPzFinderData GetPzData(int i)
vector< FairHit > GetMvdStripHits(int i)
vector< PndSttHit > GetSttHits(int i)