Newer
Older
TB_Chris / Kepler / options / .svn / text-base / TbTrackingWithKalman.h.svn-base
  1. #ifndef TB_TRACKING_H
  2. #define TB_TRACKING_H 1
  3.  
  4. // Root
  5. #include "TH1.h"
  6. #include "TH2.h"
  7.  
  8. // Tb/TbKernel
  9. #include "TbKernel/ITbTrackFit.h"
  10. #include "TbKernel/TbAlgorithm.h"
  11.  
  12. // Tb/TbEvent
  13. #include "Event/TbCluster.h"
  14. #include "Event/TbTrack.h"
  15. // Kalman classes in TbEvent
  16. #include "Event/TbKalmanTrack.h"
  17. #include "Event/TbKalmanNode.h"
  18. #include "Event/TbKalmanPixelMeasurement.h"
  19.  
  20. // Local
  21. #include "TbClusterFinder.h"
  22. #include "TbTrackVolume.h"
  23.  
  24. /** @class TbTracking TbTracking.h
  25. *
  26. * Algorithm for track reconstruction in Timepix3 telescope
  27. *
  28. * @author Dan Saunders
  29. */
  30.  
  31. class TbTracking : public TbAlgorithm {
  32. public:
  33. /// Constructor
  34. TbTracking(const std::string &name, ISvcLocator *pSvcLocator);
  35. /// Destructor
  36. virtual ~TbTracking();
  37.  
  38. virtual StatusCode initialize(); ///< Algorithm initialization
  39. virtual StatusCode execute(); ///< Algorithm execution
  40.  
  41. private:
  42. /// Track container (to be filled).
  43. LHCb::TbTracks *m_tracks;
  44.  
  45. /// Track fit tool
  46. ITbTrackFit *m_trackFit;
  47. /// Tool to find particular clusters.
  48. TbClusterFinder *m_clusterFinder;
  49.  
  50. // Tracking specific options.
  51. /// TES location of cluster containers.
  52. std::string m_clusterLocation;
  53. /// Flag to fill (or not) monitoring histograms.
  54. bool m_monitoring;
  55. /// Time width (in ns) of TbTrackVolumes.
  56. double m_twindow;
  57. /// Minimum number of clusters to form a track.
  58. unsigned int m_MinNClusters;
  59. /// Spatial shapes of TbTrackVolumes {cylinder, diabolo}.
  60. std::string m_search_3vol;
  61. /// Spatial shape parameter.
  62. double m_vol_radius;
  63. double m_vol_radiusY;
  64. /// Spatial shape parameter.
  65. double m_vol_theta;
  66. double m_vol_thetaY;
  67. /// Chi2 cut.
  68. double m_ChiSqRedCut;
  69. /// Upper cut on the number of cominations to try in a TbTrackVolume.
  70. /// Useful for speed, and rarely used; set O(100).
  71. int m_nComboCut;
  72. /// Search algorithm used to fill TbTrackVolumes - {"seq", "adap_seq"}.
  73. /// "adap_seq" recommeneded.
  74. std::string m_ClusterFinderSearchAlgorithm;
  75.  
  76. /// For certain volumes, it's advantageous to use seeds from the center of
  77. /// the telescope, so the order of the search can be specified here.
  78. std::vector<unsigned int> m_PlaneSearchOrder;
  79.  
  80. void performTracking();
  81. void fillATrackVolume(TbTrackVolume *);
  82. void evaluateTrackVolume(TbTrackVolume *);
  83. void timeOrderTracks();
  84. void poorMansEvaluation(TbTrackVolume *);
  85. // Errors for Kalman fit
  86. double m_hiterror2;
  87. double m_scat2;
  88. // Histo functions
  89. void setup_hists();
  90. void fill_khists(std::vector<LHCb::TbKalmanTrack*>&);
  91. float lowR, highR, binsR, lowS, highS;
  92. // Kalman filter histos
  93. //---------------------------------------------------
  94. // Track parameters
  95. TH1D* m_Kfit_chi2;
  96. TH1D* m_Kfit_prob;
  97. // unbiased residuals
  98. std::vector<TH1D*> m_XunresKfit;
  99. std::vector<TH1D*> m_YunresKfit;
  100. // biased residuals
  101. std::vector<TH1D*> m_XresKfit;
  102. std::vector<TH1D*> m_YresKfit;
  103. // biased residuals on X,Y
  104. std::vector<TH2D*> m_XresKfitOnX;
  105. std::vector<TH2D*> m_XresKfitOnY;
  106. std::vector<TH2D*> m_YresKfitOnY;
  107. std::vector<TH2D*> m_YresKfitOnX;
  108. // biased residuals on X,Y slopes
  109. std::vector<TH2D*> m_XresKfitOnTX;
  110. std::vector<TH2D*> m_XresKfitOnTY;
  111. std::vector<TH2D*> m_YresKfitOnTY;
  112. std::vector<TH2D*> m_YresKfitOnTX;
  113. // biased residuals errors
  114. std::vector<TH1D*> m_XreserrKfit;
  115. std::vector<TH1D*> m_YreserrKfit;
  116. // residual pulls
  117. std::vector<TH1D*> m_XrespullKfit;
  118. std::vector<TH1D*> m_YrespullKfit;
  119. // quality biased residuals
  120. std::vector<TH1D*> m_qXresKfit;
  121. std::vector<TH1D*> m_qYresKfit;
  122. // quality residual pulls
  123. std::vector<TH1D*> m_qXrespullKfit;
  124. std::vector<TH1D*> m_qYrespullKfit;
  125. // TbKalmanTrack container
  126. std::vector<LHCb::TbKalmanTrack*> ktracks_vec;
  127. //---------------------------------------------------
  128. };
  129. #endif