00001 #ifndef MDCHOUGHFINDER_H
00002 #define MDCHOUGHFINDER_H
00003 #include "GaudiKernel/NTuple.h"
00004 #include "GaudiKernel/INTupleSvc.h"
00005 #include "MdcGeomSvc/IMdcGeomSvc.h"
00006 #include "MdcGeomSvc/MdcGeoWire.h"
00007 #include "MdcGeomSvc/MdcGeoLayer.h"
00008 #include "RawDataProviderSvc/IRawDataProviderSvc.h"
00009 #include "RawDataProviderSvc/RawDataProviderSvc.h"
00010 #include "GaudiKernel/Algorithm.h"
00011 #include <string>
00012 #include "TH2D.h"
00013
00014 #include "GaudiKernel/Algorithm.h"
00015 #include "CLHEP/Alist/AList.h"
00016 #include "MdcGeom/MdcDetector.h"
00017 #include "BField/BField.h"
00018 #include "MdcRecEvent/RecMdcTrack.h"
00019 #include "MdcRecEvent/RecMdcHit.h"
00020 #include "TrkBase/TrkRecoTrk.h"
00021 #include "MdcTrkRecon/MdcTrack.h"
00022 #include "TrkFitter/TrkContextEv.h"
00023 #include "MdcCalibFunSvc/MdcCalibFunSvc.h"
00024 #include "RawDataProviderSvc/RawDataProviderSvc.h"
00025 #include "GaudiKernel/NTuple.h"
00026 #include "MdcUtilitySvc/MdcUtilitySvc.h"
00027 #include "MdcPrintSvc/MdcPrintSvc.h"
00028 #include "HepPDT/ParticleDataTable.hh"
00029
00030 #include "McTruth/MdcMcHit.h"
00031 class MdcHoughFinder:public Algorithm {
00032 public:
00033 MdcHoughFinder(const std::string& name, ISvcLocator* pSvcLocator);
00034 StatusCode initialize();
00035 StatusCode execute();
00036 StatusCode finalize();
00037 StatusCode beginRun();
00038 private:
00039 int GetMcInfo();
00040 int digiToHots(TrkRecoTrk* newTrack,vector<bool> vec_truthHit);
00041 int digiToHots2(TrkRecoTrk* newTrack,vector<bool> vec_truthHit);
00042 double CFtrans(double x,double y);
00043 int SlantId(int layer);
00044 int LeastSquare(int n,int nselecthit_axial,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);
00045 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);
00046
00047 void Linefit(int z_stereoNum,vector<double> z_stereo_aver,vector<double> l, double& tanl,double& z0);
00048 void Multi_array(int binX,int binY);
00049
00050 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);
00051 void RhoTheta(int numCross,int m_nHit,vector<double> vec_u,vector<double> vec_v,vector<double>& vec_rho,vector<double>& vec_theta,vector< vector<int> >& vec_hitNum);
00052 void FillHist(TH2D *h1,vector<double> vec_u,vector<double> vec_v,int m_nHit,vector< vector < vector<int> > > vec_selectNum);
00053 void FillRhoTheta(TH2D *h1 ,vector<double> vec_theta,vector<double> vec_rho,int numCross);
00054
00055 int m_trackNum_Mc_set;
00056 int m_method;
00057 int m_debug;
00058 int m_data;
00059 int m_binx;
00060 int m_biny;
00061 std::vector<float> m_peakCellNum;
00062 int m_ndev;
00063 double m_fpro;
00064 double m_hit_pro;
00065 std::string m_pdtFile;
00066 bool m_pickHits;
00067
00068 double m_bunchT0;
00069 int t_eventNum;
00070 int t_runNum;
00071 double t_maxP;
00072 double t_minP;
00073 int binX;
00074 int binY;
00075
00076 double dz_mc;
00077 double tanl_mc;
00078 int track_fit;
00079
00080 uint32_t m_getDigiFlag;
00081 int m_maxMdcDigi;
00082 bool m_keepBadTdc;
00083 bool m_dropHot;
00084 bool m_keepUnmatch;
00085 int m_minMdcDigi;
00086
00087 std::string m_configFile;
00088 const MdcDetector* m_gm;
00089 HepPDT::ParticleDataTable* m_particleTable;
00090 TrkContextEv* m_context;
00091 BField* m_bfield;
00092 const MdcCalibFunSvc* m_mdcCalibFunSvc;
00093
00094 RawDataProviderSvc* m_rawDataProviderSvc;
00095 MdcGeomSvc* m_mdcGeomSvc;
00096 int t_eventNo;
00097 int m_nEvtSuccess;
00098 IMagneticFieldSvc* m_pIMF;
00099 double t_t0Truth;
00100 double t_nTrkMC;
00101 int m_pid;
00102 int nfailure;
00103 bool m_combineTracking;
00104 std::vector<float> m_helixHitsSigma;
00105
00106 NTuple::Tuple* ntuplehit;
00107 NTuple::Array<int> m_hitCol;
00108 NTuple::Array<int> m_layerNhit;
00109 NTuple::Array<int> m_hitSignal;
00110 NTuple::Array<int> m_layer;
00111 NTuple::Array<int> m_cell;
00112 NTuple::Array<int> m_layer_Mc;
00113 NTuple::Array<int> m_cell_Mc;
00114 NTuple::Array<double> m_x_east;
00115 NTuple::Array<double> m_y_east;
00116 NTuple::Array<double> m_x_west;
00117 NTuple::Array<double> m_y_west;
00118 NTuple::Array<double> m_z_east;
00119 NTuple::Array<double> m_z_west;
00120 NTuple::Array<double> m_x;
00121 NTuple::Array<double> m_y;
00122 NTuple::Array<double> m_z;
00123 NTuple::Array<double> m_u;
00124 NTuple::Array<double> m_v;
00125 NTuple::Array<double> m_rho;
00126 NTuple::Array<double> m_theta;
00127 NTuple::Array<double> m_p;
00128 NTuple::Array<int> m_slant;
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 NTuple::Item<int> m_eventNum;
00141 NTuple::Item<int> m_runNum;
00142 NTuple::Item<int> m_nCross;
00143 NTuple::Item<int> m_nHit;
00144 NTuple::Item<int> m_nHit_Mc;
00145
00146
00147
00148 NTuple::Item<int> m_cosCut;
00149
00150 NTuple::Item<int> m_maxCount;
00151
00152 NTuple::Item<int> m_npeak;
00153 NTuple::Array<double> m_peakWidth;
00154 NTuple::Array<double> m_peakHigh;
00155 NTuple::Array<double> m_peakArea;
00156 NTuple::Item<double> m_areaLeast;
00157 NTuple::Item<double> m_areaLeastNum;
00158 NTuple::Item<double> m_areaSelectHit;
00159 NTuple::Item<double> m_areaSelectHit_signal;
00160
00161
00162 NTuple::Item<double> m_x_circle;
00163 NTuple::Item<double> m_y_circle;
00164 NTuple::Item<double> m_r;
00165
00166 NTuple::Item<int> m_trackNum_Mc;
00167 NTuple::Item<int> m_trackNum;
00168 NTuple::Array<double> m_d0;
00169 NTuple::Array<double> m_phi0;
00170 NTuple::Array<double> m_omega;
00171 NTuple::Array<double> m_z0;
00172 NTuple::Array<double> m_tanl;
00173
00174 NTuple::Array<double> m_pt;
00175 NTuple::Array<double> m_pt2;
00176 NTuple::Array<double> m_pz;
00177 NTuple::Array<double> m_pxyz;
00178
00179 NTuple::Array<int> m_nFitFailure;
00180 NTuple::Item<int> m_nHitSignal;
00181 NTuple::Item<int> m_nHitAxial;
00182 NTuple::Item<int> m_nHitAxialSignal;
00183 NTuple::Array<int> m_nHitSelect;
00184 NTuple::Array<int> m_nHitSignal_select;
00185
00186 NTuple::Array<int> m_nHitAxialSignal_select;
00187 NTuple::Array<int> m_2d_nFit;
00188 NTuple::Array<int> m_3d_nFit;
00189
00190 NTuple::Item<int> m_nFitSucess;
00191
00192 NTuple::Item<int> m_zStereoNum;
00193 NTuple::Array<double> m_zStereo;
00194 NTuple::Array<double> m_l;
00195
00196
00197 double m_truthPos[43][288][3];
00198
00199
00200 NTuple::Item<double> m_pidTruth;
00201 NTuple::Item<double> m_costaTruth;
00202 NTuple::Item<double> m_phi0Truth;
00203 NTuple::Item<double> m_drTruth;
00204 NTuple::Item<double> m_dzTruth;
00205 NTuple::Item<double> m_ptTruth;
00206 NTuple::Item<double> m_pzTruth;
00207 NTuple::Item<double> m_pTruth;
00208 NTuple::Item<double> m_qTruth;
00209
00210 };
00211 #endif