4#include "GaudiKernel/Algorithm.h"
5#include "GaudiKernel/INTupleSvc.h"
6#include "GaudiKernel/NTuple.h"
7#include "MdcRecEvent/RecMdcTrack.h"
8#include "MdcRecEvent/RecMdcHit.h"
9#include "RawDataProviderSvc/RawDataProviderSvc.h"
10#include "MagneticField/IMagneticFieldSvc.h"
11#include "BField/BField.h"
12#include "TrkFitter/TrkContextEv.h"
13#include "HoughTransAlg/HoughTrack.h"
14#include "MdcTrkRecon/MdcTrack.h"
15#include "MdcTrkRecon/MdcTrackList.h"
22 HoughFinder(
const std::string& name, ISvcLocator* pSvcLocator);
56 vector<HoughTrack>::iterator
getHoughTrkIt(vector<HoughTrack>& houghTrkList,
int trkId);
77 std::string m_pdtFile;
85 int m_totEvtProcessed;
98 double m_shareHitRate;
106 int m_findPeakMethod;
108 int m_removeNOuterHits;
140 vector<MdcHit*> m_mdcHitCol;
141 vector<HoughHit> m_mcHitCol;
142 vector<HoughHit> m_houghHitList;
143 vector<HoughTrack> m_mcTrackCol;
144 vector<HoughTrack> m_houghTrackList;
146 vector<HoughHit*> m_XHoughHitList;
147 vector<HoughHit*> m_VHoughHitList;
150 std::string m_evtFile;
157 TH2D m_roughRhoThetaMap;
158 TH2D m_fineRhoThetaMap;
160 void getWeightedPeak(TH2D& h,
double& x_peak,
double& y_peak,
double& x_weight,
double& y_weight,
int x_ext=2,
int y_ext=1);
163 int nFineBinTheta(
double rho);
164 int nFineBinRho(
double rho);
165 TGraph* m_cut1_cgem, *m_cut2_cgem;
166 TGraph* m_cut1_ODC1, *m_cut2_ODC1;
167 TGraph* m_cut1_ODC2, *m_cut2_ODC2;
168 void XhitCutWindow(
double rho,
int ilayer,
double charge,
double& cut1,
double &cut2);
178 TH2D m_roughTanlDzMap;
179 TH2D m_fineTanlDzMap;
180 int associateVHits();
183 int nFineBinTanl(
double tanl);
184 int nFineBinDz(
double tanl);
185 void XVhitCutWindow(
double tanl,
int ilayer,
double charge,
double& cut1,
double &cut2);
189 int dumpHoughTrack();
190 int dumpHoughEvent();
195 NTuple::Tuple* ntuple_hit;
196 NTuple::Item<int> m_hit_run;
197 NTuple::Item<int> m_hit_event;
198 NTuple::Item<int> m_hit_nhit;
200 NTuple::Array<int> m_hit_hitID;
201 NTuple::Array<int> m_hit_hitType;
202 NTuple::Array<int> m_hit_layer;
203 NTuple::Array<int> m_hit_wire;
204 NTuple::Array<int> m_hit_flag;
205 NTuple::Array<int> m_hit_halfCircle;
206 NTuple::Array<double> m_hit_x;
207 NTuple::Array<double> m_hit_y;
208 NTuple::Array<double> m_hit_z;
209 NTuple::Array<double> m_hit_drift;
211 NTuple::Array<int> m_mcHit_hitID;
212 NTuple::Array<int> m_mcHit_hitType;
213 NTuple::Array<int> m_mcHit_layer;
214 NTuple::Array<int> m_mcHit_wire;
215 NTuple::Array<int> m_mcHit_flag;
216 NTuple::Array<int> m_mcHit_halfCircle;
217 NTuple::Array<double> m_mcHit_x;
218 NTuple::Array<double> m_mcHit_y;
219 NTuple::Array<double> m_mcHit_z;
220 NTuple::Array<double> m_mcHit_drift;
224 NTuple::Tuple* ntuple_track;
225 NTuple::Item<int> m_trk_run;
226 NTuple::Item<int> m_trk_event;
227 NTuple::Item<int> m_trk_nTrack;
228 NTuple::Item<int> m_trk_trackID;
229 NTuple::Item<int> m_trk_charge;
230 NTuple::Item<int> m_trk_flag;
231 NTuple::Item<double> m_trk_angle;
232 NTuple::Item<double> m_trk_rho;
233 NTuple::Item<double> m_trk_dAngle;
234 NTuple::Item<double> m_trk_dRho;
235 NTuple::Item<double> m_trk_dTanl;
236 NTuple::Item<double> m_trk_dDz;
237 NTuple::Item<double> m_trk_Xc;
238 NTuple::Item<double> m_trk_Yc;
239 NTuple::Item<double> m_trk_R;
240 NTuple::Item<double> m_trk_dr;
241 NTuple::Item<double> m_trk_phi0;
242 NTuple::Item<double> m_trk_kappa;
243 NTuple::Item<double> m_trk_dz;
244 NTuple::Item<double> m_trk_tanl;
245 NTuple::Item<double> m_trk_pxy;
246 NTuple::Item<double> m_trk_px;
247 NTuple::Item<double> m_trk_py;
248 NTuple::Item<double> m_trk_pz;
249 NTuple::Item<double> m_trk_p;
250 NTuple::Item<double> m_trk_phi;
251 NTuple::Item<double> m_trk_theta;
252 NTuple::Item<double> m_trk_cosTheta;
253 NTuple::Item<double> m_trk_vx;
254 NTuple::Item<double> m_trk_vy;
255 NTuple::Item<double> m_trk_vz;
256 NTuple::Item<double> m_trk_vr;
257 NTuple::Item<double> m_trk_chi2;
258 NTuple::Item<double> m_trk_fiTerm;
259 NTuple::Item<int> m_trk_nhit;
260 NTuple::Item<int> m_trk_ncluster;
261 NTuple::Item<int> m_trk_stat;
262 NTuple::Item<int> m_trk_ndof;
263 NTuple::Item<int> m_trk_nster;
264 NTuple::Item<int> m_trk_nlayer;
265 NTuple::Item<int> m_trk_firstLayer;
266 NTuple::Item<int> m_trk_lastLayer;
267 NTuple::Item<int> m_trk_nCgemXClusters;
268 NTuple::Item<int> m_trk_nCgemVClusters;
269 NTuple::Item<int> m_trk_nHot;
271 NTuple::Array<int> m_hot_hitID;
272 NTuple::Array<int> m_hot_hitType;
273 NTuple::Array<int> m_hot_layer;
274 NTuple::Array<int> m_hot_wire;
275 NTuple::Array<int> m_hot_flag;
276 NTuple::Array<int> m_hot_halfCircle;
277 NTuple::Array<double> m_hot_x;
278 NTuple::Array<double> m_hot_y;
279 NTuple::Array<double> m_hot_z;
280 NTuple::Array<double> m_hot_drift;
281 NTuple::Array<double> m_hot_residual;
283 NTuple::Array<int> m_mcHot_hitID;
284 NTuple::Array<int> m_mcHot_hitType;
285 NTuple::Array<int> m_mcHot_layer;
286 NTuple::Array<int> m_mcHot_wire;
287 NTuple::Array<int> m_mcHot_flag;
288 NTuple::Array<int> m_mcHot_halfCircle;
289 NTuple::Array<double> m_mcHot_x;
290 NTuple::Array<double> m_mcHot_y;
291 NTuple::Array<double> m_mcHot_z;
292 NTuple::Array<double> m_mcHot_drift;
294 NTuple::Item<int> m_mcTrk_trackID;
295 NTuple::Item<int> m_mcTrk_charge;
296 NTuple::Item<int> m_mcTrk_flag;
297 NTuple::Item<double> m_mcTrk_angle;
298 NTuple::Item<double> m_mcTrk_rho;
299 NTuple::Item<double> m_mcTrk_dAngle;
300 NTuple::Item<double> m_mcTrk_dRho;
301 NTuple::Item<double> m_mcTrk_dTanl;
302 NTuple::Item<double> m_mcTrk_dDz;
303 NTuple::Item<double> m_mcTrk_Xc;
304 NTuple::Item<double> m_mcTrk_Yc;
305 NTuple::Item<double> m_mcTrk_R;
306 NTuple::Item<double> m_mcTrk_dr;
307 NTuple::Item<double> m_mcTrk_phi0;
308 NTuple::Item<double> m_mcTrk_kappa;
309 NTuple::Item<double> m_mcTrk_dz;
310 NTuple::Item<double> m_mcTrk_tanl;
311 NTuple::Item<double> m_mcTrk_pxy;
312 NTuple::Item<double> m_mcTrk_px;
313 NTuple::Item<double> m_mcTrk_py;
314 NTuple::Item<double> m_mcTrk_pz;
315 NTuple::Item<double> m_mcTrk_p;
316 NTuple::Item<double> m_mcTrk_phi;
317 NTuple::Item<double> m_mcTrk_theta;
318 NTuple::Item<double> m_mcTrk_cosTheta;
319 NTuple::Item<double> m_mcTrk_vx;
320 NTuple::Item<double> m_mcTrk_vy;
321 NTuple::Item<double> m_mcTrk_vz;
322 NTuple::Item<double> m_mcTrk_vr;
323 NTuple::Item<double> m_mcTrk_chi2;
324 NTuple::Item<double> m_mcTrk_fiTerm;
325 NTuple::Item<int> m_mcTrk_nhit;
326 NTuple::Item<int> m_mcTrk_ncluster;
327 NTuple::Item<int> m_mcTrk_stat;
328 NTuple::Item<int> m_mcTrk_ndof;
329 NTuple::Item<int> m_mcTrk_nster;
330 NTuple::Item<int> m_mcTrk_nlayer;
331 NTuple::Item<int> m_mcTrk_firstLayer;
332 NTuple::Item<int> m_mcTrk_lastLayer;
333 NTuple::Item<int> m_mcTrk_nCgemXClusters;
334 NTuple::Item<int> m_mcTrk_nCgemVClusters;
335 NTuple::Item<int> m_mcTrk_nHot;
337 NTuple::Array<int> m_mcTrkHot_hitID;
338 NTuple::Array<int> m_mcTrkHot_hitType;
339 NTuple::Array<int> m_mcTrkHot_layer;
340 NTuple::Array<int> m_mcTrkHot_wire;
341 NTuple::Array<int> m_mcTrkHot_flag;
342 NTuple::Array<int> m_mcTrkHot_halfCircle;
343 NTuple::Array<double> m_mcTrkHot_x;
344 NTuple::Array<double> m_mcTrkHot_y;
345 NTuple::Array<double> m_mcTrkHot_z;
346 NTuple::Array<double> m_mcTrkHot_drift;
350 NTuple::Tuple* ntuple_event;
351 NTuple::Item<int> m_evt_run;
352 NTuple::Item<int> m_evt_event;
353 NTuple::Item<int> m_evt_nXCluster;
354 NTuple::Item<int> m_evt_nVCluster;
355 NTuple::Item<int> m_evt_nXVCluster;
356 NTuple::Item<int> m_evt_nCGEMCluster;
357 NTuple::Item<int> m_evt_nAxialHit;
358 NTuple::Item<int> m_evt_nStereoHit;
359 NTuple::Item<int> m_evt_nODCHit;
360 NTuple::Item<int> m_evt_nHit;
361 NTuple::Item<int> m_evt_nTrack;
363 NTuple::Array<int> m_evtTrk_trackID;
364 NTuple::Array<int> m_evtTrk_charge;
365 NTuple::Array<int> m_evtTrk_flag;
366 NTuple::Array<double> m_evtTrk_angle;
367 NTuple::Array<double> m_evtTrk_rho;
368 NTuple::Array<double> m_evtTrk_dAngle;
369 NTuple::Array<double> m_evtTrk_dRho;
370 NTuple::Array<double> m_evtTrk_dTanl;
371 NTuple::Array<double> m_evtTrk_dDz;
372 NTuple::Array<double> m_evtTrk_Xc;
373 NTuple::Array<double> m_evtTrk_Yc;
374 NTuple::Array<double> m_evtTrk_R;
375 NTuple::Array<double> m_evtTrk_dr;
376 NTuple::Array<double> m_evtTrk_phi0;
377 NTuple::Array<double> m_evtTrk_kappa;
378 NTuple::Array<double> m_evtTrk_dz;
379 NTuple::Array<double> m_evtTrk_tanl;
380 NTuple::Array<double> m_evtTrk_pxy;
381 NTuple::Array<double> m_evtTrk_px;
382 NTuple::Array<double> m_evtTrk_py;
383 NTuple::Array<double> m_evtTrk_pz;
384 NTuple::Array<double> m_evtTrk_p;
385 NTuple::Array<double> m_evtTrk_phi;
386 NTuple::Array<double> m_evtTrk_theta;
387 NTuple::Array<double> m_evtTrk_cosTheta;
388 NTuple::Array<double> m_evtTrk_vx;
389 NTuple::Array<double> m_evtTrk_vy;
390 NTuple::Array<double> m_evtTrk_vz;
391 NTuple::Array<double> m_evtTrk_vr;
392 NTuple::Array<double> m_evtTrk_chi2;
393 NTuple::Array<double> m_evtTrk_fiTerm;
394 NTuple::Array<int> m_evtTrk_nhit;
395 NTuple::Array<int> m_evtTrk_ncluster;
396 NTuple::Array<int> m_evtTrk_stat;
397 NTuple::Array<int> m_evtTrk_ndof;
398 NTuple::Array<int> m_evtTrk_nster;
399 NTuple::Array<int> m_evtTrk_nlayer;
400 NTuple::Array<int> m_evtTrk_firstLayer;
401 NTuple::Array<int> m_evtTrk_lastLayer;
402 NTuple::Array<int> m_evtTrk_nCgemXClusters;
403 NTuple::Array<int> m_evtTrk_nCgemVClusters;
405 NTuple::Array<int> m_mcEvtTrk_trackID;
406 NTuple::Array<int> m_mcEvtTrk_charge;
407 NTuple::Array<int> m_mcEvtTrk_flag;
408 NTuple::Array<double> m_mcEvtTrk_angle;
409 NTuple::Array<double> m_mcEvtTrk_rho;
410 NTuple::Array<double> m_mcEvtTrk_dAngle;
411 NTuple::Array<double> m_mcEvtTrk_dRho;
412 NTuple::Array<double> m_mcEvtTrk_dTanl;
413 NTuple::Array<double> m_mcEvtTrk_dDz;
414 NTuple::Array<double> m_mcEvtTrk_Xc;
415 NTuple::Array<double> m_mcEvtTrk_Yc;
416 NTuple::Array<double> m_mcEvtTrk_R;
417 NTuple::Array<double> m_mcEvtTrk_dr;
418 NTuple::Array<double> m_mcEvtTrk_phi0;
419 NTuple::Array<double> m_mcEvtTrk_kappa;
420 NTuple::Array<double> m_mcEvtTrk_dz;
421 NTuple::Array<double> m_mcEvtTrk_tanl;
422 NTuple::Array<double> m_mcEvtTrk_pxy;
423 NTuple::Array<double> m_mcEvtTrk_px;
424 NTuple::Array<double> m_mcEvtTrk_py;
425 NTuple::Array<double> m_mcEvtTrk_pz;
426 NTuple::Array<double> m_mcEvtTrk_p;
427 NTuple::Array<double> m_mcEvtTrk_phi;
428 NTuple::Array<double> m_mcEvtTrk_theta;
429 NTuple::Array<double> m_mcEvtTrk_cosTheta;
430 NTuple::Array<double> m_mcEvtTrk_vx;
431 NTuple::Array<double> m_mcEvtTrk_vy;
432 NTuple::Array<double> m_mcEvtTrk_vz;
433 NTuple::Array<double> m_mcEvtTrk_vr;
434 NTuple::Array<double> m_mcEvtTrk_chi2;
435 NTuple::Array<double> m_mcEvtTrk_fiTerm;
436 NTuple::Array<int> m_mcEvtTrk_nhit;
437 NTuple::Array<int> m_mcEvtTrk_ncluster;
438 NTuple::Array<int> m_mcEvtTrk_stat;
439 NTuple::Array<int> m_mcEvtTrk_ndof;
440 NTuple::Array<int> m_mcEvtTrk_nster;
441 NTuple::Array<int> m_mcEvtTrk_nlayer;
442 NTuple::Array<int> m_mcEvtTrk_firstLayer;
443 NTuple::Array<int> m_mcEvtTrk_lastLayer;
444 NTuple::Array<int> m_mcEvtTrk_nCgemXClusters;
445 NTuple::Array<int> m_mcEvtTrk_nCgemVClusters;
ObjectVector< RecMdcHit > RecMdcHitCol
ObjectVector< RecMdcTrack > RecMdcTrackCol
int separateHoughHitByPhi()
int activeUnusedCgemHitsOnly(vector< HoughHit * > &hitPntList)
int checkTrack(vector< HoughTrack > &trackVector)
int fillHistogram(HoughHit *hit, TH2D *hitMap, HoughTrack *trkCandi, int vote)
int storeTrack(vector< HoughTrack > &trackVector, RecMdcTrackCol *&recMdcTrackCol, RecMdcHitCol *&recMdcHitCol)
int storeTracks(RecMdcTrackCol *trackList, RecMdcHitCol *hitList, vector< HoughTrack > &trackVector)
vector< HoughTrack >::iterator getHoughTrkIt(vector< HoughTrack > &houghTrkList, int trkId)
int fillHistogram(vector< HoughHit * > &hitList, TH2D *hitMap, int charge, int vote, HoughTrack *trkCandi=NULL)
void checkSharedHits(vector< HoughHit * > &hitList)
void clearTrack(vector< HoughTrack > &trackVector)
HoughFinder(const std::string &name, ISvcLocator *pSvcLocator)
int checkHot(vector< HoughTrack > &trackVector)
int fillHistogram(HoughHit *hit, TH2D *hitMap, int charge, int vote)
StatusCode registerTrack(RecMdcTrackCol *&trackList_tds, RecMdcHitCol *&hitList_tds)