// -------------------------------------------------------------------------------------- // ----- CbmRichRingFinderHough source file ----- // ----- Algorithm idea: G.A. Ososkov (ososkov@jinr.ru) and Simeon Lebedev (salebedev@jinr.ru) ----- // ----- Implementation: Simeon Lebedev (salebedev@jinr.ru) and Andrei Lebedev (alebedev@jinr.ru)----- #ifndef CBM_RICH_RING_FINDER_HOUGH_H #define CBM_RICH_RING_FINDER_HOUGH_H #include #include "TClonesArray.h" #include "CbmRichLightSpot.h" #include "CbmRichRing.h" #include "CbmRichRingFinder.h" #include "TCanvas.h" #include "TH1F.h" class CbmRichHTCluster { public: int fX; int fY; int fHist; //CbmRichHThist2{fX=fY=fHist=0;} //~CbmRichHThist2{;} }; class CbmRichMyPoint { public: double fX; double fY; int fId; int fRefIndex; static bool CmpUp(const CbmRichMyPoint &m1, const CbmRichMyPoint &m2){ return m1.fX < m2.fX; }; //CbmRichMyPoint{fX=fY=fId=0;} //~CbmRichMyPoint{;} }; class CmpSortHTCluster { public: bool operator () (const CbmRichHTCluster &c1, const CbmRichHTCluster &c2) const { return c1.fHist < c2.fHist; } }; class CmpSortMyPoint { public: bool operator () (const CbmRichMyPoint &c1, const CbmRichMyPoint &c2) const { return c1.fId < c2.fId; } }; class CbmRichRingFinderHough : public CbmRichRingFinder { static const int kMAX_POINTS = 2200; //Maximum number of points static const int kMAX_POINTS_IN_BIN = 40; //Maximum number points in bin static const int kMAX_POINTS_IN_CLUSTER = 500; // Maximum point in cluster static const int kMAX_CLUSTERS = 200; //Maximum number of clusters static const int kMAX_GUIDANCE = 550; //Maximum number of guidance static const int kMAX_FOUND_RINGS = 100;//Maximum number of found rings static const int kNBINSX = 250; static const int kNBINSY = 100; static const int kNBINSXHT = 150; static const int kNBINSYHT = 60; //geometry of rich detector static const double kXMAX = 150.0; static const double kXMIN = -150.0; double kYMAX; double kYMIN; static const int kMAX_PARTS = 3; int fNIterations; //number of iterations int fCurIteration; //Curent iteration std::vector fNBinsX; //Number of bins in histogram in each iteration X axis std::vector fNBinsY; //Number of bins in histogram in each iteration Y axis std::vector fHTCut; //cut fot HT histogramm, we delete bins with the number of centers less than fHTCut[i]. i-iteration std::vector fHitCut; std::vector fHTNBinsX; //Number of biins in HT histogram X axis std::vector fHTNBinsY; //Number of biins in HT histogram Y axis std::vector fMaxDistance; //max length between 2 points in each iteration std::vector fMinDistance; //min length between 2 points in each iteration std::vector fMinRadius; //min radius in each iteration std::vector fMaxRadius; //max radius in each iterationfHTCut[] std::vector fNParts; std::vector fGuidance; //track extrapolations from STS to RICH std::vector fData; //Rich hits std::vector > fTempHist; //for the histogramming process of Rich hits int fSqLen; //for the histogramming process of Rich hits //std::vector > fHist; //histogram of RICH hits std::vector > fHistClusterNumber; //this vector contains the cluster number of all bins. std::vector > > fHist; //this vector contains the hits Id that belong to the bin std::vector > fAr1; //for Wave() method std::vector > fAr2; //for Wave() method int fNClusters; //number of clusters std::vector > > fCluster; //this vector contains the hits Id that belong to the cluster //std::vector fNPoints; //number of points in Cluster std::vector > fHTHist; //HT histogram, contain number of centers in all bins std::vector > fHTRadius; //contain the summa of radii for all bins std::vector > fHTHistClusterNumber; //this vector contains the cluster number of all bins.for HT; std::vector > fHTHist3;//this vector is the same as fHThist excluding bins where number of centers less than fHTCut[i]. std::vector > fHTCluster; std::vector > fHTCheck;//to know if we check this bins during finding peak or not std::vector > > fRingHits; std::vector< std::vector< std::vector< CbmRichRing> > > fFoundRings;//collect found rings Int_t fNEvent; // event number // Verbosity level Int_t fVerbose; public: /** Default constructor **/ CbmRichRingFinderHough(); /** Standard constructor **/ CbmRichRingFinderHough ( Int_t verbose); ~CbmRichRingFinderHough(); void SetParameters(int NIterations,int NBinsX[], int NBinsY[], int HTNBinsX[], int HTNBinsY[], int HTCut[], int HitCut[],double MaxDistance[], double MinDistance[], double MaxRadius[], double MinRadius[],int NParts[], int SqLen); void InitArray(); void DeleteArray(); void InitHist(double nbinsx, double nbinsy); //Init histogram void FindClusters(double nbinsx, double nbinsy); void Wave(int x, int y, double nbinsx, double nbinsy); void InitClusters(double nbinsx, double nbinsy); void CalculateRingParameters(double x[], double y[], double *xc, double *yc, double *r); //Calculate circle center and radius void HoughTransform(int htcut, double nbinsx, double nbinsy); void FindHTClusters(double nbinsx, double nbinsy, int hitcut, int UpOrDown); virtual void Init(); virtual void Finish(); virtual Int_t DoFind(TClonesArray* rHitArray, TClonesArray* rProjArray, TClonesArray* rRingArray); TH1F *fh_dist; TCanvas *c2; ClassDef(CbmRichRingFinderHough,1) }; #endif // CBM_RICH_RING_FINDER_HOUGH_H