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 ExtractPz();
57 
58  PndRiemannTrack GetRiemannTrack(int i) { return fResultPndRiemannTrack[i]; };
59 
60  PndTrack GetTrack(int i) { return fResultPndTrack[i]; };
61 
62  PndTrackCand GetTrackCand(int i) { return fResultPndTrackCand[i]; };
63 
64  PndSttSkewStrawPzFinderData GetPzData(int i) { return fResultPzData[i]; };
65 
66  vector<PndSttHit> GetSttHits(int i) { return fResultSkewedSttHits[i]; };
67 
68  vector<FairHit> GetMvdPixelHits(int i) { return fResultMvdPixelHits[i]; };
69 
70  vector<FairHit> GetMvdStripHits(int i) { return fResultMvdStripHits[i]; };
71 
72  int NumPndRiemannTracks() { return fResultPndRiemannTrack.size(); };
73 
74  int NumPndTracks() { return fResultPndTrack.size(); };
75 
76  int NumPndTrackCands() { return fResultPndTrackCand.size(); };
77 
78  int NumPndPzData() { return fResultPzData.size(); };
79 
80  int NumPndSttHits() { return fResultSkewedSttHits.size(); };
81 
82  int NumPndMvdPixelHits() { return fResultMvdPixelHits.size(); };
83 
84  int NumPndMvdStripHits() { return fResultMvdStripHits.size(); };
85 
86  void Reset()
87  {
88 
89  fVectorPndRiemannTrack.clear();
90  fVectorPndTrack.clear();
91  fVectorPndTrackCand.clear();
92  fVectorSkewedSttHits.clear();
93  fVectorMvdPixelHits.clear();
94  fVectorMvdStripHits.clear();
95 
96  fResultPndRiemannTrack.clear();
97  fResultPndTrack.clear();
98  fResultPndTrackCand.clear();
99  fResultPzData.clear();
100  fResultSkewedSttHits.clear();
101  fResultMvdPixelHits.clear();
102  fResultMvdStripHits.clear();
103 
104  if (fVerbose > 0) {
105  cout << "PndSttSkewStrawPzFinder::Reset()" << endl;
106  }
107  }
108 
109  private:
110  bool fWithRiemann;
111  int fVerbose;
112  int fMethod;
113  Double_t fStepTheta;
114  Int_t fStepR;
115  Double_t LineCombiAngleThreshold;
116  TClonesArray *fTubeArray;
117  TClonesArray *fSTTHits;
118  PndSttStrawMap *fStrawMap; // for getting more information about the tubes
119 
120  TH2D *fHoughHisto; // Line Hough histogram
121 
122  // Vectors of initial tracks and hits
123  vector<PndRiemannTrack> fVectorPndRiemannTrack;
124  vector<PndTrack> fVectorPndTrack;
125  vector<PndTrackCand> fVectorPndTrackCand;
126 
127  vector<vector<PndSttHit>> fVectorSkewedSttHits;
128  vector<vector<FairHit>> fVectorMvdPixelHits;
129  vector<vector<FairHit>> fVectorMvdStripHits;
130 
131  // Vectors of final tracks and hits that extracted Pz
132  vector<PndRiemannTrack> fResultPndRiemannTrack;
133  vector<PndTrack> fResultPndTrack;
134  vector<PndTrackCand> fResultPndTrackCand;
135 
136  vector<vector<PndSttHit>> fResultSkewedSttHits;
137  vector<vector<FairHit>> fResultMvdPixelHits;
138  vector<vector<FairHit>> fResultMvdStripHits;
139 
140  // Additional data produced by PzFinder
141  vector<PndSttSkewStrawPzFinderData> fResultPzData;
142 
143  // void InitSkewed();
144 
145  void GetCenterOfTrack(PndTrack temp, TVector2 &center, double &radius);
146 
147  Int_t ComputeSegmentCircleIntersection(TVector2 ex1, TVector2 ex2, double xc, double yc, double R, TVector2 &intersection1, TVector2 &intersection2);
148 
149  TVector2 ComputeTangentInPoint(double xc, double yc, TVector2 point);
150 
151  // vector<vector<TVector2>> LineCombiIsoFinder(vector<vector<TVector2>> SZPairVector);
152  // vector<pair<unsigned int,unsigned int>> LineCombiIsoFinderIndex(vector<vector<TVector2>> SZPairVector);
153  vector<pair<unsigned int, unsigned int>>
154  LineCombiIsoFinderIndex2(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip);
155 
156  // TODO: refine Hough transform part
157  // vector<vector<TVector2>> HoughTrueIsoFinder(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip, TH2D
158  //*HoughSpace);
159  vector<pair<unsigned int, unsigned int>>
160  HoughTrueIsoFinderIndex(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip, bool draw);
161 
162  // vector<vector<TVector2>> HoughTrueIsoFinder2(vector<vector<TVector2>> SZPairVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip, TH2D
163  //*HoughSpace);
164 
165  // TVector2 TheilSen(vector<vector<TVector2>> SZPairVector);
166 
167  vector<vector<PndSttHit>> MoveSkewedHitsToCircle(TVector2 circle, Double_t circlerad, vector<PndSttHit> skewhits, vector<vector<PndSttHit>> &corrxy);
168 
169  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);
170 
171  // TVector2 PzLineFitExtract(vector<TVector2> TrueSZ);
172 
173  // TVector2 PzLineFitExtract2(vector<vector<TVector2>> TrueSZPairVector);
174 
175  double PzLineFitExtract3(vector<vector<TVector2>> TrueSZPairVector, vector<TVector2> TrueSZPairVectorMvdPixel, vector<TVector2> TrueSZPairVectorMvdStrip, TVector2 &lineparams);
176 
177  void LineFitRecursiveAnnealFinder(vector<vector<TVector2>> SZPairVector, vector<double> DriftRadVector, vector<TVector2> SZPairVectorMvdPixel,
178  vector<TVector2> SZPairVectorMvdStrip, vector<pair<unsigned int, unsigned int>> &TrueSZPairVectorindex,
179  vector<unsigned int> &TrueSZPairVectorMvdPixelindex, vector<unsigned int> &TrueSZPairVectorMvdStripindex);
180 
181  FairTrackParP GetTrackParam(FairTrackParP oldParam, TVector2 center, double radius, TVector2 lineparams, double S0, int charge);
182 
183  Double_t CalculateResidual(Double_t lineSlope, Double_t lineIntercept, TVector2 SZPoint);
184 
185  void
186  LineFit(vector<vector<TVector2>> SZPairVector, vector<double> DriftRadVector, vector<TVector2> SZPairVectorMvdPixel, vector<TVector2> SZPairVectorMvdStrip, double &k, double &m);
187  void DrawOpt2D(TH2D *ShitSpace);
188 
189  ClassDef(PndSttSkewStrawPzFinder, 1);
190 };
191 
192 #endif /* PNDSTTSKEWSTRAWPZFINDER_H_ */
__m128 m
Definition: P4_F32vec4.h:26
PndRiemannTrack GetRiemannTrack(int i)
vector< FairHit > GetMvdPixelHits(int i)
STL namespace.
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)