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