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