CGEM BOSS 6.6.5.i
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"
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, double chiCut=7., int debug=0);// 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(int type=2);
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 void updateLayerStat();
127
128 void clearHits();
129 bool isAGoodCircle();
130 int getNTried() {return m_untried;};// llwang 2018-12-23
131
132 void releaseSelHits(); // release m_vecHitPnt, llwang 2018-12-27
133
134 vector<double> getVecHitRes(){return m_vecHitResidual;}
135 vector<HoughHit*> getVecStereoHitPnt() {return m_vecStereoHitPnt;}; // llwang 2018-12-26
136 void addVecStereoHitPnt(HoughHit* aHitPnt) {m_vecStereoHitPnt.push_back(aHitPnt);};
137 vector<double> getVecStereoHitRes(){return m_vecStereoHitRes;}
138 TrkErrCode fitHelix(const MdcDetector* mdcDetector, const BField* bField, double bunchT0, vector<HoughHit*>& hot,int Layer);
139 TrkErrCode fitHelix(const MdcDetector* mdcDetector, TrkContextEv* trkContextEv, double bunchT0, vector<MdcHit*>& mdcHitCol, vector<HoughHit*>& hot);
140 int findVHot(vector<HoughHit*>& hitList, int charge, int maxLayer, double cutFactor=1.0);
141 vector<HoughHit*> getHotList(int type=2);
142 HoughTrack* getMcTrack()const{return m_mcTrack;}
143 void setMcTrack(HoughTrack* mcTrack){m_mcTrack = mcTrack;}
144 void clearMemory();
145
146 static int m_clearTrack;
147 static int m_useCgemInGlobalFit;//0:not at all, 1:circle fit, 2:circle fit + final helix fit, >=3:circle fit + all helix fit
148 static TGraph* m_cut[2][43];
149 //void setMdcHit(const vector<MdcHit*>* mdchit) {vec_mdcHit= mdchit;}
150
151 void setRecMdcHitVec(vector<RecMdcHit>& aRecMdcHitVec) { m_vecRecMdcHit=aRecMdcHitVec; };
152 vector<RecMdcHit>* getRecMdcHitVec() {return &m_vecRecMdcHit;};
153 void printRecMdcHitVec();
154
155 bool nearStereoHits() {return m_nearStereoHits;};
156
157 // --- for V-cluster selection with CGEM alone
158 void clearXVhitsCgem();
159 int findHelixInCgem();
160
161
162 private:
163 int m_trkID;
164 int m_charge;
165 double m_angle;// beta or phi
166 double m_rho;
167 int m_flag;
168
169 double m_dAngle;// bin width
170 double m_dRho;// bin width
171 double m_dTanl;// bin width
172 double m_dDz;// bin width
173
174 double m_dr;
175 double m_phi0;
176 double m_kappa;
177 double m_dz;
178 double m_tanl;
179
180 double m_chi2;
181
182 //Helix m_helix;
183 //vector<HoughHit> m_hot;
184 TrkRecoTrk* m_trkRecoTrk;
185
186 // --- added by llwang //
187 int m_circleFitStat;
188 vector<HoughHit*> m_vecHitPnt;
189 vector<double> m_vecHitResidual;
190 vector<double> m_vecHitChi2;
191 map<int,double> m_map_lay_d;
192 map<int,HoughHit*> m_map_lay_hit;
193 std::set<int> m_setLayer;
194 bool m_nearStereoHits;
195
196 int XGapSize(std::set<int> aLaySet, int& gapMax);// gap statistics, remove the last few hits after a big gap
197 void XhitCutWindow(double rho, int ilayer, double charge, double& cut1, double &cut2);
198 static TGraph* m_cut1_cgem, *m_cut2_cgem;
199 static TGraph* m_cut1_ODC1, *m_cut2_ODC1;
200 static TGraph* m_cut1_ODC2, *m_cut2_ODC2;
201
202 int m_unused;
203 int m_untried;
204 int m_nHitFirstHalf;
205 int m_nHitUnused_FirstHalf;
206 int m_nHitSecondHalf;
207 int m_nHitUnused_SecondHalf;
208 int m_nGap;
209 int m_maxGap;
210 //bool m_;
211
212 //TMinuit* m_pMnTrk;
213
214 vector<HoughHit*> m_vecStereoHitPnt;
215 vector<double> m_vecStereoHitRes;
216 HoughTrack* m_mcTrack;
217 vector<CgemHitOnTrack*> m_cgemHitVector;//store data in that created by "new"
218 //const vector<MdcHit*>* vec_mdcHit;
219
220
221 // --- DotsHelixFitter
222 //DotsHelixFitter* m_DotsHelixFitterPnt;
223 // --- input for DotsHelixFitter
224 vector<const MdcDigi*> m_vecMdcDigiPnt;
225 vector<const RecCgemCluster*> m_vecCgemClusterPnt;
226 // --- RecMdcHits for digis active in DotsHelixFitter
227 vector<RecMdcHit> m_vecRecMdcHit;
228
229 // --- for V-cluster selection with CGEM alone
230 //int m_nCgemLayerHasV;
231 //vector<double> m_s_cgem[3];
232 //vector<double> m_z_cgem[3];
233 vector<HoughHit*> m_XVhits_cgem[3];
234
235 // --- //
236};
237
238typedef vector<HoughTrack*>::iterator TrackVector_Iterator;
239#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:238
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 dropRedundentCgemXHits()
void printHot(int type=2)
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:130
double getChi2() const
Definition HoughTrack.h:58
static int m_useCgemInGlobalFit
Definition HoughTrack.h:147
vector< double > getVecStereoHitRes()
Definition HoughTrack.h:137
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:146
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:152
void updateLayerStat()
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:134
int findHelixInCgem()
void addVecStereoHitPnt(HoughHit *aHitPnt)
Definition HoughTrack.h:136
int getTrkID() const
Definition HoughTrack.h:49
void printRecMdcHitVec()
HoughTrack * getMcTrack() const
Definition HoughTrack.h:142
double getTanl() const
Definition HoughTrack.h:67
void setFlag(int flag)
Definition HoughTrack.h:35
void clearXVhitsCgem()
int getNhitSecondHalf()
Definition HoughTrack.h:93
int judgeHalf(HoughHit *hit)
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:135
void setMcTrack(HoughTrack *mcTrack)
Definition HoughTrack.h:143
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:18
void addHitPnt(HoughHit *aHitPnt)
Definition HoughTrack.h:84
double getDz() const
Definition HoughTrack.h:66
void setRecMdcHitVec(vector< RecMdcHit > &aRecMdcHitVec)
Definition HoughTrack.h:151
bool nearStereoHits()
Definition HoughTrack.h:155
void setChi2(double chi2)
Definition HoughTrack.h:43
int calculateZ_S(HoughHit *hit)
void dropRedundentCgemVHits()
int getCharge() const
Definition HoughTrack.h:50
int fitHelix(DotsHelixFitter *fitter, double bunchT0, RecCgemClusterCol::iterator recCgemClusterColBegin, double averageChi2cut=25)