CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
HoughTrack.h
Go to the documentation of this file.
1#ifndef HOUGHTRACK2_H
2#define HOUGHTRACK2_H
3
5#include "TrackUtil/Helix.h"
6//#include "KalFitAlg/helix/Helix.h"
10#include "MdcData/MdcHit.h"
12#include "TrkBase/TrkRecoTrk.h"
13#include "TGraph.h"
14#include <set>
15#include <map>
16#include "TMinuit.h"
18
19using namespace std;
20
21class HoughHit;
22class HoughTrack:public Helix
23{
24 public:
25 HoughTrack(int charge, double angle, double rho, double dAngle, double dRho, int trkID);
26 HoughTrack(int charge, const HepPoint3D & position, const Hep3Vector & momentum, int trkID);
27 HoughTrack(HepPoint3D& pivot, HepVector& a, int trkID);
28 //HoughTrack(Helix& helix, int trkID);
29 HoughTrack(const HoughTrack& other);
30 HoughTrack& operator=(const HoughTrack& other);
31 HoughTrack();
32 //~HoughTrack();
33
34 void setTrkID(int trkID) {m_trkID = trkID;}
35 void setFlag(int flag) {m_flag = flag;}
36 void setCharge(int charge) {m_charge = charge;}
37 void setAngle(double angle) {m_angle = angle;}
38 void setRho(double rho ) {m_rho = rho;}
39 void setDAngle(double dAngle){m_dAngle = dAngle;}
40 void setDRho(double dRho){m_dRho = dRho;}
41 void setDTanl(double dTanl){m_dTanl = dTanl;}
42 void setDDz(double dDz){m_dDz = dDz;}
43 void setChi2(double chi2){m_chi2 = chi2;}
44 //void setHelix(Helix helix) {m_helix = helix;}
45 //void setHot(vector<HoughHit> hot) {m_hot = hot;}
46 void setDz(double dz){m_dz = dz;}
47 void setTanl(double tanl){m_tanl = tanl;}
48
49 int getTrkID() const {return m_trkID;}
50 int getCharge() const {return m_charge;}
51 int getFlag() const {return m_flag;}
52 double getAngle() const {return m_angle;}
53 double getRho() const {return m_rho;}
54 double getDAngle() const {return m_dAngle;}
55 double getDRho() const {return m_dRho;}
56 double getDTanl() const {return m_dTanl;}
57 double getDDz() const {return m_dDz;}
58 double getChi2() const {return m_chi2;}
59 int getCircleFitStat() const {return m_circleFitStat;};
60 //Helix* getHelix() {return &m_helix;}
61 //vector<HoughHit>* getHot() {return &m_hot;}
62 TrkRecoTrk* getTrkRecoTrk() {return m_trkRecoTrk;}
63 double getDr() const {return m_dr;}
64 double getPhi0() const {return m_phi0;}
65 double getKappa() const {return m_kappa;}
66 double getDz() const {return m_dz;}
67 double getTanl() const {return m_tanl;}
68 //double angle() const {return m_helix.center().phi();}
69 //double rho() const {return 1./m_helix.radius();}
70 //double angle() const {return center().phi();}
71 //double rho() const {return 1./radius();}
72
73 //void addHot(HoughHit& hit){m_hot.push_back(hit);}
74 //void dropHot(HoughHit& hit);
75 //void dropHot(int hitID);
76 //int findHot(vector<HoughHit*>& hitList, int flag);
77 //int findHot(vector<HoughHit*>& hitList, vector<HoughHit*>& hot, int flag);
78 //int findHot(vector<HoughHit>& hitList, vector<HoughHit*>& hitPntList, int flag, int charge=0);// llwang
79 int findXHot(vector<HoughHit*>& hitList, int charge);// llwang
80 //void sortHot();
81 void sortHot(vector<HoughHit*>& hotList);
82
83 vector<HoughHit*> getVecHitPnt() {return m_vecHitPnt;}; // llwang 2018-12-26
84 void addHitPnt(HoughHit* aHitPnt) {m_vecHitPnt.push_back(aHitPnt);};// llwang 2018-12-26
85 void dropHitPnt(HoughHit* aHitPnt);
86 void dropVHitPnt(HoughHit* aHitPnt);
87 //void sortHitPnt();// sort hits, llwang 2019-01-02
88 int getNHitsShared();
91
92 int getNhitFirstHalf() {return m_nHitFirstHalf;};
93 int getNhitSecondHalf() {return m_nHitSecondHalf;};
94 int getNhitUnusedFirstHalf() {return m_nHitUnused_FirstHalf;};
95 int getNhitUnusedSecondHalf() {return m_nHitUnused_SecondHalf;};
96 void resetNhitHalf() {m_nHitFirstHalf=0; m_nHitSecondHalf=0; m_nHitUnused_FirstHalf=0; m_nHitUnused_SecondHalf=0;};
97
98 double driftDistRes(HoughHit* hit);
99 int judgeHalf(HoughHit* hit);
100 int judgeCharge(HoughHit* hit);
101 int judgeCharge(double xHit, double yHit);
102 //double flightLength(HoughHit& hit);
103 TrkErrCode fitCircle(const MdcDetector* mdcDetector, TrkContextEv* trkContextEv, double bunchT0);
104
105 //void setDotsHelixFitter(DotsHelixFitter* fitter);
106 int fitCircle(DotsHelixFitter* fitter, double bunchT0);// circle fit with DotsHelixFitter
107 //vector<MdcDigi*> getVecMdcDigi(vector<HoughHit*> aHoughHitVec);
108 //vector<RecCgemCluster*> getVecCgemCluster(vector<HoughHit*> aHoughHitVec);
109 int fitHelix(DotsHelixFitter* fitter, double bunchT0, RecCgemClusterCol::iterator recCgemClusterColBegin, double averageChi2cut=25);// helix fit with DotsHelixFitter
110
111
112 //TrkErrCode fitHelix(const MdcDetector* mdcDetector, TrkContextEv* trkContextEv, double bunchT0, vector<MdcHit*> mdcHitCol);
113 int calculateZ_S(HoughHit* hit);
114 void updateHelix();
115 void update(double angle, double rho);//llwang
116 void updateCirclePar(double dr, double phi0, double kappa);//llwang
117 void markUsedHot(vector<HoughHit*>& hitPntList, int use=1);
118 void markUsedHot(int use=1);
119 void print();
120 void printHot();
121 //HepVector calCircle(vector<HoughHit*>& aVecHoughHit, double& chi2);
122
123 //vector<double> CircleFitByTaubin(vector< pair<double, double> > pos_hits);// llwang 2018-12-22
124 //vector<double> fitCircle_Taubin(vector<HoughHit*>& aVecHoughHit);// llwang 2018-12-22
125 //double chi2_circle(vector<HoughHit*>& aVecHoughHit);// llwang 2018-12-22
126
127 void clearHits();
128 bool isAGoodCircle();
129 int getNTried() {return m_untried;};// llwang 2018-12-23
130
131 void releaseSelHits(); // release m_vecHitPnt, llwang 2018-12-27
132
133 vector<double> getVecHitRes(){return m_vecHitResidual;}
134 vector<HoughHit*> getVecStereoHitPnt() {return m_vecStereoHitPnt;}; // llwang 2018-12-26
135 void addVecStereoHitPnt(HoughHit* aHitPnt) {m_vecStereoHitPnt.push_back(aHitPnt);};
136 vector<double> getVecStereoHitRes(){return m_vecStereoHitRes;}
137 TrkErrCode fitHelix(const MdcDetector* mdcDetector, const BField* bField, double bunchT0, vector<HoughHit*>& hot,int Layer);
138 TrkErrCode fitHelix(const MdcDetector* mdcDetector, TrkContextEv* trkContextEv, double bunchT0, vector<MdcHit*>& mdcHitCol, vector<HoughHit*>& hot);
139 int findVHot(vector<HoughHit*>& hitList, int charge, int maxLayer, double cutFactor=1.0);
140 vector<HoughHit*> getHotList(int type=2);
141 HoughTrack* getMcTrack()const{return m_mcTrack;}
142 void setMcTrack(HoughTrack* mcTrack){m_mcTrack = mcTrack;}
143 void clearMemory();
144
145 static int m_clearTrack;
146 static int m_useCgemInGlobalFit;//0:not at all, 1:circle fit, 2:circle fit + final helix fit, >=3:circle fit + all helix fit
147 static TGraph* m_cut[2][43];
148 //void setMdcHit(const vector<MdcHit*>* mdchit) {vec_mdcHit= mdchit;}
149
150 void setRecMdcHitVec(vector<RecMdcHit>& aRecMdcHitVec) { m_vecRecMdcHit=aRecMdcHitVec; };
151 vector<RecMdcHit>* getRecMdcHitVec() {return &m_vecRecMdcHit;};
152 void printRecMdcHitVec();
153
154 private:
155 int m_trkID;
156 int m_charge;
157 double m_angle;// beta or phi
158 double m_rho;
159 int m_flag;
160
161 double m_dAngle;// bin width
162 double m_dRho;// bin width
163 double m_dTanl;// bin width
164 double m_dDz;// bin width
165
166 double m_dr;
167 double m_phi0;
168 double m_kappa;
169 double m_dz;
170 double m_tanl;
171
172 double m_chi2;
173
174 //Helix m_helix;
175 //vector<HoughHit> m_hot;
176 TrkRecoTrk* m_trkRecoTrk;
177
178 // --- added by llwang //
179 int m_circleFitStat;
180 vector<HoughHit*> m_vecHitPnt;
181 vector<double> m_vecHitResidual;
182 vector<double> m_vecHitChi2;
183 map<int,double> m_map_lay_d;
184 map<int,HoughHit*> m_map_lay_hit;
185 std::set<int> m_setLayer;
186 int XGapSize(std::set<int> aLaySet, int& gapMax);// gap statistics, remove the last few hits after a big gap
187 void XhitCutWindow(double rho, int ilayer, double charge, double& cut1, double &cut2);
188 static TGraph* m_cut1_cgem, *m_cut2_cgem;
189 static TGraph* m_cut1_ODC1, *m_cut2_ODC1;
190 static TGraph* m_cut1_ODC2, *m_cut2_ODC2;
191
192 int m_unused;
193 int m_untried;
194 int m_nHitFirstHalf;
195 int m_nHitUnused_FirstHalf;
196 int m_nHitSecondHalf;
197 int m_nHitUnused_SecondHalf;
198 int m_nGap;
199 int m_maxGap;
200 //bool m_;
201
202 //TMinuit* m_pMnTrk;
203
204 vector<HoughHit*> m_vecStereoHitPnt;
205 vector<double> m_vecStereoHitRes;
206 HoughTrack* m_mcTrack;
207 vector<CgemHitOnTrack*> m_cgemHitVector;//store data in that created by "new"
208 //const vector<MdcHit*>* vec_mdcHit;
209
210
211 // --- DotsHelixFitter
212 //DotsHelixFitter* m_DotsHelixFitterPnt;
213 // --- input for DotsHelixFitter
214 vector<const MdcDigi*> m_vecMdcDigiPnt;
215 vector<const RecCgemCluster*> m_vecCgemClusterPnt;
216 // --- RecMdcHits for digis active in DotsHelixFitter
217 vector<RecMdcHit> m_vecRecMdcHit;
218
219
220 // --- //
221};
222
223typedef vector<HoughTrack*>::iterator TrackVector_Iterator;
224#endif
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
vector< HoughTrack * >::iterator TrackVector_Iterator
Definition HoughTrack.h:223
double dr(void) const
returns an element of parameters.
const HepVector & a(void) const
returns helix parameters.
const HepPoint3D & pivot(void) const
returns pivot position.
void clearHits()
double getKappa() const
Definition HoughTrack.h:65
int getCircleFitStat() const
Definition HoughTrack.h:59
void updateCirclePar(double dr, double phi0, double kappa)
double getPhi0() const
Definition HoughTrack.h:64
int getNhitFirstHalf()
Definition HoughTrack.h:92
void setAngle(double angle)
Definition HoughTrack.h:37
int findXHot(vector< HoughHit * > &hitList, int charge)
void resetNhitHalf()
Definition HoughTrack.h:96
void setRho(double rho)
Definition HoughTrack.h:38
void clearMemory()
int getNTried()
Definition HoughTrack.h:129
double getChi2() const
Definition HoughTrack.h:58
static int m_useCgemInGlobalFit
Definition HoughTrack.h:146
vector< double > getVecStereoHitRes()
Definition HoughTrack.h:136
bool isAGoodCircle()
double driftDistRes(HoughHit *hit)
double getDTanl() const
Definition HoughTrack.h:56
void sortHot(vector< HoughHit * > &hotList)
static int m_clearTrack
Definition HoughTrack.h:145
TrkRecoTrk * getTrkRecoTrk()
Definition HoughTrack.h:62
int findVHot(vector< HoughHit * > &hitList, int charge, int maxLayer, double cutFactor=1.0)
int getNhitUnusedSecondHalf()
Definition HoughTrack.h:95
void setDDz(double dDz)
Definition HoughTrack.h:42
void markUsedHot(vector< HoughHit * > &hitPntList, int use=1)
vector< RecMdcHit > * getRecMdcHitVec()
Definition HoughTrack.h:151
double getDRho() const
Definition HoughTrack.h:55
void dropHitPnt(HoughHit *aHitPnt)
void setDAngle(double dAngle)
Definition HoughTrack.h:39
int getNhitUnusedFirstHalf()
Definition HoughTrack.h:94
void setTanl(double tanl)
Definition HoughTrack.h:47
void setDRho(double dRho)
Definition HoughTrack.h:40
int getFlag() const
Definition HoughTrack.h:51
int getNHitsShared()
TrkErrCode fitCircle(const MdcDetector *mdcDetector, TrkContextEv *trkContextEv, double bunchT0)
double getDDz() const
Definition HoughTrack.h:57
void setTrkID(int trkID)
Definition HoughTrack.h:34
vector< double > getVecHitRes()
Definition HoughTrack.h:133
void addVecStereoHitPnt(HoughHit *aHitPnt)
Definition HoughTrack.h:135
int getTrkID() const
Definition HoughTrack.h:49
void printRecMdcHitVec()
HoughTrack * getMcTrack() const
Definition HoughTrack.h:141
double getTanl() const
Definition HoughTrack.h:67
void setFlag(int flag)
Definition HoughTrack.h:35
int getNhitSecondHalf()
Definition HoughTrack.h:93
int judgeHalf(HoughHit *hit)
void dropRedundentCgemXHits()
void releaseSelHits()
vector< HoughHit * > getVecHitPnt()
Definition HoughTrack.h:83
double getRho() const
Definition HoughTrack.h:53
double getAngle() const
Definition HoughTrack.h:52
void updateHelix()
double getDr() const
Definition HoughTrack.h:63
HoughTrack & operator=(const HoughTrack &other)
vector< HoughHit * > getVecStereoHitPnt()
Definition HoughTrack.h:134
void setMcTrack(HoughTrack *mcTrack)
Definition HoughTrack.h:142
void setCharge(int charge)
Definition HoughTrack.h:36
void setDz(double dz)
Definition HoughTrack.h:46
int judgeCharge(HoughHit *hit)
double getDAngle() const
Definition HoughTrack.h:54
vector< HoughHit * > getHotList(int type=2)
void dropVHitPnt(HoughHit *aHitPnt)
void setDTanl(double dTanl)
Definition HoughTrack.h:41
static TGraph * m_cut[2][43]
Definition HoughTrack.h:16
void addHitPnt(HoughHit *aHitPnt)
Definition HoughTrack.h:84
double getDz() const
Definition HoughTrack.h:66
void setRecMdcHitVec(vector< RecMdcHit > &aRecMdcHitVec)
Definition HoughTrack.h:150
void setChi2(double chi2)
Definition HoughTrack.h:43
int calculateZ_S(HoughHit *hit)
void dropRedundentCgemVHits()
void printHot()
int getCharge() const
Definition HoughTrack.h:50
int fitHelix(DotsHelixFitter *fitter, double bunchT0, RecCgemClusterCol::iterator recCgemClusterColBegin, double averageChi2cut=25)