BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcHoughFinder/MdcHoughFinder-00-00-02/MdcHoughFinder/HoughValidUpdate.h
Go to the documentation of this file.
1#ifndef HOUGHVALIDUPDATE_H
2#define HOUGHVALIDUPDATE_H
3#include "GaudiKernel/Algorithm.h"
4#include "GaudiKernel/NTuple.h"
5#include "GaudiKernel/INTupleSvc.h"
6#include "MdcGeomSvc/IMdcGeomSvc.h"
7#include "MdcGeomSvc/MdcGeoWire.h"
8#include "MdcGeomSvc/MdcGeoLayer.h"
9#include "MdcPrintSvc/MdcPrintSvc.h"
10#include "RawDataProviderSvc/RawDataProviderSvc.h"
11#include <string>
12#include <vector>
13#include <iostream>
14#include <math.h>
15#include <map>
16#include <set>
17#include "TH2D.h"
18
19#include "CLHEP/Alist/AList.h"
20#include "MdcGeom/MdcDetector.h"
21#include "BField/BField.h"
22#include "TrkBase/TrkRecoTrk.h"
23#include "TrkFitter/TrkContextEv.h"
24#include "MdcCalibFunSvc/MdcCalibFunSvc.h"
25#include "MdcUtilitySvc/MdcUtilitySvc.h"
26#include "MdcPrintSvc/MdcPrintSvc.h"
27#include "HepPDT/ParticleDataTable.hh"
28#include "MdcData/MdcHit.h"
29class HoughValidUpdate:public Algorithm {
30 public:
31 HoughValidUpdate(const std::string& name, ISvcLocator* pSvcLocator);
32 StatusCode initialize();
33 StatusCode execute();
34 StatusCode finalize();
35 StatusCode beginRun();
36 typedef std::map<int, int> M2;
37 typedef std::map<int, M2> M1;
38 struct Mytrack{
39 double pt;
40 int charge;
41 double phi;
42 double x_cir;
43 double y_cir;
44 double r;
45 bool use_in_tds;
47 vector<int> vec_hit_on_trk;
48 };
49 private:
50 int GetMcInfo();
51 int digiToHots(MdcDigiVec mdcDigiVec,TrkRecoTrk* newTrack,vector<bool> vec_truthHit,uint32_t getDigiFlag,vector<double> vec_flt_truth,map<int,double> hit_to_circle1,vector<MdcHit*>&);
52 int digiToHots2(MdcDigiVec mdcDigiVec,TrkRecoTrk* newTrack,vector<bool> vec_truthHit,vector<double> vec_flt_truth,uint32_t getDigiFlag, vector<int> vec_slant,vector<double> vec_l_Calcu,vector<double> vec_l_axial,vector<double> vec_theta_ontrack,vector<int>& vec_hitbeforefit,map<int,double> hit_to_circle2,vector<MdcHit*>&,double );
53 double CFtrans(double x,double y);
54 int SlantId(int layer);
55 int LeastSquare(int n,vector<double> n_x,vector<double> n_y, vector<int> n_slant,vector<int> n_layer,vector<bool> vec_truthHit,double &d0,double &phi0, double &omega,double& circleX, double& circleY,double& circleR);
56 int Zposition(int n,vector<int> n_slant,double x_cirtemp,double y_cirtemp,double r_temp,vector<double> n_x_east,vector<double> n_x_west,vector<double> n_y_east,vector<double> n_y_west,vector<double> n_z_east,vector<double> n_z_west,vector<int> n_layer,vector<int> n_wire,vector<double> n_z,vector<double>& z_stereo_aver,vector<double>& l,vector<bool> vec_truthHit);
57
58 void Linefit(int z_stereoNum,vector<double> z_stereo_aver,vector<double> l, double& tanl,double& z0);
59 void Multi_array(int binX,int binY);
60 //void FillCells(int n,int binX,int binY,vector<double> vec_u,vector<double> vec_v,vector<int> vec_layer,vector<int> vec_wire);
61 void FillCells(TH2D *h1,int n,int binX,int binY,vector<double> vec_u,vector<double> vec_v,vector<int> vec_layer,vector<int> vec_wire,vector< vector <int> >& countij,vector< vector < vector<int> > >& vec_selectNum,vector< vector < vector<int> > >& vec_selectHit);
62 void RhoTheta(int m_nHit,vector<double> vec_u,vector<double> vec_v,vector<double>& vec_rho,vector<double>& vec_theta,vector< vector<int> >& vec_hitNum, vector<int> vec_digitruth);
63 void RhoThetaAxial(vector<int> vec_slant,int nHit,vector<double> vec_u,vector<double> vec_v,vector<double>& vec_rho,vector<double>& vec_theta,vector< vector<int> >& vec_hitNum,vector<int> vec_digitruth);
64 void FillHist(TH2D *h1,vector<double> vec_u,vector<double> vec_v,int m_nHit,vector< vector < vector<int> > > &vec_selectNum);
65 void FillRhoTheta(TH2D *h1 ,vector<double> vec_theta,vector<double> vec_rho);
66 int zPosition(MdcHit& h, double t0, double x_cirtemp,double y_cirtemp, double r_temp,int digiId,double& delta_z,double& delta_l,double& l_Calcu_Left,double& l_Calcu_Right,double& z_Calcu_Left,double& z_Calcu_Right,double& z_Calcu,double& l_Calcu,int& i_q);
67 void AmbigChoose(vector< vector< vector<double> > > point,int n_use,vector<int>& ambigList,double& tanl,double& z0);
68 void Combine(TH2D *h1,int widthX,int widthY,vector< vector < vector<int> > > vec_selectNum,M1 &hit_combine,M2 &peak_combine_num,int &ntrack,vector<int> peakList1[]);
69 void Combine_two_cell(TH2D *h1,int xPeakCell,int yPeakCell,int xAround,int yaround,vector< vector < vector<int> > > vec_selectNum,int m,M1 &hit_combine,M2 &peak_combine_num);
70 int LeastLine(int ,double x[] ,double y[] ,double& ,double& ,double&);
71 ///bool operator<(const HoughValidUpdate::Mytrack& a,const HoughValidUpdate::Mytrack& b);
72
73 int m_drawTuple;
74 int m_useMcInfo;
75 int m_par_use;
76 int m_method;
77 int m_debug;
78 int m_data;
79 int m_binx;
80 int m_biny;
81 int m_peakCellNumX;
82 int m_peakCellNumY;
83 int m_ndev1;
84 int m_ndev2;
85 double m_fpro;
86 double m_hit_pro;
87 std::string m_pdtFile;
88 bool m_pickHits;
89 double m_fltcut;
90 double m_nHitcut_low;
91 double m_nHitcut_high;
92 int m_eventcut;
93 double m_rhocut;
94 int m_setpeak_fit;
95 int m_mcpar;
96 int m_fillTruth;
97
98 // vector<int> peakList1[3];
99 double m_bunchT0;
100 int t_eventNum;
101 int t_runNum;
102 double m_maxrho;
103 //double m_minrho;
104 int binX;
105 int binY;
106
107 double d0_mc;
108 double phi0_mc;
109 double omega_mc;
110 double dz_mc;
111 double tanl_mc;
112 int track_fit;
113
114 uint32_t m_getDigiFlag;
115 int m_maxMdcDigi;
116 bool m_keepBadTdc;
117 bool m_dropHot;
118 bool m_keepUnmatch;
119 int m_minMdcDigi;
120 int m_q;
121 double m_dropTrkDrCut;
122 double m_dropTrkDzCut;
123 double m_dropTrkPtCut;
124 double m_dropTrkChi2Cut;
125
126 std::string m_configFile;
127 const MdcDetector* m_gm;
128 HepPDT::ParticleDataTable* m_particleTable;
129 TrkContextEv* m_context;
130 BField* m_bfield;
131 const MdcCalibFunSvc* m_mdcCalibFunSvc;
132
133 RawDataProviderSvc* m_rawDataProviderSvc;
134 MdcGeomSvc* m_mdcGeomSvc;
135 MdcPrintSvc* m_mdcPrintSvc;
136 int t_eventNo;
137 IMagneticFieldSvc* m_pIMF;
138 int m_pid;
139 int nfailure;
140 bool m_combineTracking;
141 std::vector<float> m_helixHitsSigma;
142 double m_qualityFactor;
143 bool m_removeBadTrack;
144 int m_dropTrkNhitCut;
145 double m_dropTrkChi2NdfCut;
146
147
148
149 NTuple::Tuple* ntuplehit;
150 NTuple::Item<int> m_eventNum;
151 NTuple::Item<int> m_eventTime;
152 NTuple::Item<int> m_runNum;
153 NTuple::Item<int> m_nHit_Mc;
154 NTuple::Item<int> m_nHitAxial_Mc;
155 NTuple::Array<int> m_layer_Mc;
156 NTuple::Array<int> m_cell_Mc;
157
158
159 NTuple::Item<int> m_nTrkMC;
160 NTuple::Array<double> m_pidTruth;
161 NTuple::Array<double> m_costaTruth;
162 NTuple::Array<double> m_ptTruth;
163 NTuple::Array<double> m_pzTruth;
164 NTuple::Array<double> m_pTruth;
165 NTuple::Array<double> m_qTruth;
166 NTuple::Array<double> m_drTruth;
167 NTuple::Array<double> m_phi0Truth;
168 NTuple::Array<double> m_omegaTruth;
169 NTuple::Array<double> m_dzTruth;
170 NTuple::Array<double> m_tanl_mc;
171
172 NTuple::Item<int> m_nHit;
173 NTuple::Item<int> m_nHitDigi;
174 NTuple::Item<int> m_nHitAxial;
175 NTuple::Item<int> m_nHitStereo;
176 NTuple::Array<int> m_layer;
177 NTuple::Array<int> m_cell;
178 NTuple::Array<double> m_x_east;
179 NTuple::Array<double> m_y_east;
180 NTuple::Array<double> m_x_west;
181 NTuple::Array<double> m_y_west;
182 NTuple::Array<double> m_z_east;
183 NTuple::Array<double> m_z_west;
184 NTuple::Array<double> m_x;
185 NTuple::Array<double> m_y;
186 NTuple::Array<double> m_z;
187 NTuple::Array<double> m_u;
188 NTuple::Array<double> m_v;
189 NTuple::Array<double> m_p;
190 NTuple::Array<int> m_slant;
191 NTuple::Item<int> m_layer_max;
192 NTuple::Array<int> m_layerNhit;
193 NTuple::Array<double> m_ltruth;
194 NTuple::Array<double> m_ztruth;
195 NTuple::Array<double> m_postruth;
196 NTuple::Array<int> m_digi_truth;
197 NTuple::Item<int> m_e_delta;
198
199 NTuple::Item<int> m_nCross;
200 NTuple::Array<double> m_rho;
201 NTuple::Array<double> m_theta;
202 NTuple::Item<int> m_xybinNum;
203 NTuple::Array<int> m_xybin;
204 NTuple::Item<double> m_xsigma;
205 NTuple::Item<double> m_ysigma;
206 // NTuple::Item<int> m_stereohit;
207 // NTuple::Item<int> m_failure;
208 //NTuple::Item<int> m_3d_nFitFailure;
209 //NTuple::Item<int> m_maxCount;
210
211 NTuple::Item<int> m_npeak_1;
212 NTuple::Item<int> m_npeak_2;
213 NTuple::Item<int> m_trackFailure;
214 NTuple::Item<int> m_npeak_after_tracking;
215 NTuple::Array<int> m_nHitSelect;
216 NTuple::Array<int> m_nHitAxialSelect;
217 NTuple::Array<int> m_nHitStereoSelect;
218 NTuple::Array<int> m_axiallose;
219 NTuple::Array<int> m_stereolose;
220
221 NTuple::Item<int> m_trackNum_Mc;
222 NTuple::Item<int> m_trackNum;
223 NTuple::Item<int> m_trackNum_fit;
224 NTuple::Item<int> m_trackNum_tds;
225 NTuple::Array<double> m_x_circle;
226 NTuple::Array<double> m_y_circle;
227 NTuple::Array<double> m_r;
228 NTuple::Array<double> m_chis_pt;
229 NTuple::Array<double> m_d0;
230 NTuple::Array<double> m_phi0;
231 NTuple::Array<double> m_omega;
232 NTuple::Array<double> m_z0;
233 NTuple::Array<double> m_tanl;
234 NTuple::Array<double> m_pt;
235 NTuple::Array<double> m_pt2;
236 NTuple::Array<double> m_pz;
237 NTuple::Array<double> m_pxyz;
238
239 NTuple::Array<int> m_nFitFailure;
240 NTuple::Array<int> m_2d_nFit;
241 NTuple::Array<int> m_2dFit;
242 NTuple::Array<int> m_3d_nFit;
243 NTuple::Array<int> m_3dFit;
244 NTuple::Array<double> m_pt2_rec_final;
245 NTuple::Array<double> m_p_rec_final;
246 NTuple::Array<double> m_d0_final;
247 NTuple::Array<double> m_phi0_final;
248 NTuple::Array<double> m_omega_final;
249 NTuple::Array<double> m_z0_final;
250 NTuple::Array<double> m_tanl_final;
251 NTuple::Array<double> m_chis_3d_final;
252 NTuple::Array<int> m_Q;
253
254 NTuple::Array<double> m_pt2_rec_tds;
255 NTuple::Array<double> m_p_rec_tds;
256 NTuple::Array<double> m_d0_tds;
257 NTuple::Array<double> m_phi0_tds;
258 NTuple::Array<double> m_omega_tds;
259 NTuple::Array<double> m_z0_tds;
260 NTuple::Array<double> m_tanl_tds;
261 NTuple::Array<double> m_chis_3d_tds;
262 NTuple::Array<int> m_Q_tds;
263
264
265 double m_truthPos[43][288][3];
266
267 NTuple::Array<double> m_dist_to_circle;
268 // NTuple::Item<int> m_3dFitFailure;
269
270 NTuple::Item<int> m_nHitStereo_use;
271 NTuple::Array<double> m_lCalcuLeft;
272 NTuple::Array<double> m_lCalcuRight;
273 NTuple::Array<double> m_zCalcuLeft;
274 NTuple::Array<double> m_zCalcuRight;
275 NTuple::Array<double> m_zCalcu;
276 NTuple::Array<double> m_lCalcu;
277 NTuple::Array<double> m_delta_z;
278 NTuple::Array<double> m_delta_l;
279 NTuple::Array<int> m_amb;
280 NTuple::Item<int> m_ambig_no_match;
281 NTuple::Item<double> m_tanl_Cal;
282 NTuple::Item<double> m_z0_Cal;
283 NTuple::Item<double> m_ambig_no_match_propotion;
284
285 NTuple::Item<int> m_nhitdis0;
286 NTuple::Item<int> m_nhitdis1;
287 NTuple::Item<int> m_nhitdis2;
288 NTuple::Array<double> m_hit_dis0;
289 NTuple::Array<double> m_hit_dis1;
290 NTuple::Array<double> m_hit_dis2;
291 NTuple::Array<double> m_hit_dis1_3d;
292 NTuple::Array<double> m_hit_dis2_3d;
293
294 // NTuple::Item<int> m_xbin;
295 // NTuple::Item<int> m_ybin;
296 // NTuple::Array<int> m_xbinsum;
297 // NTuple::Array<int> m_ybinsum;
298 // NTuple::Array<int> m_xsum;
299 // NTuple::Array<int> m_ysum;
300 // NTuple::Item<int> m_nTrack;
301 NTuple::Item<bool> m_decay;
302 NTuple::Item<int> m_outputTrk;
303 NTuple::Array<int> m_hitOnTrk;
304
305 NTuple::Item<int> m_track_use_intrk1;
306 NTuple::Item<int> m_noise_intrk1;
307 //TH2D *h1;
308 //TH2D *h2;
309 //TH2D *h3;
310};
312#endif
const Int_t n
bool compare(const HoughValidUpdate::Mytrack &a, const HoughValidUpdate::Mytrack &b)
StatusCode execute()
StatusCode beginRun()
StatusCode finalize()
HoughValidUpdate(const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize()