#ifndef _CBMSTTHOUGHACCUMULATORNEW_H_ #define _CBMSTTHOUGHACCUMULATORNEW_H_ #include #include #include "TObject.h" #include "TMath.h" #include "TH2.h" #include "TH3.h" #include "CbmSttHoughCellNew.h" #include "CbmSttHoughDefines.h" class CbmSttHoughAccumulatorNew : public TObject { private: /** The accumulator, where the maxima are created */ CbmSttHoughCellNew **** fAccumulator; CbmSttHoughCellNew * maxCellPointer; /** Flag to enable verbose output for the << streaming operator */ Bool_t fVerbose; /** The threshold above which a maximum is recognized as such */ Int_t fThreshold; /** The binning of the accumulator in z (can only be set via the constructor) */ Int_t fZBins; /** The binning of the accumulator in y (can only be set via the constructor) */ Int_t fYBins; /** The binning of the accumulator in x (can only be set via the constructor) */ Int_t fXBins; /** The lower edge of the accumulator in z. Can only be set via the constructor */ Float_t fZLow; /** The upper edge of the accumulator in z. Can only be set via the constructor */ Float_t fZHigh; /** The lower edge of the accumulator in y. Can only be set via the constructor */ Float_t fYLow; /** The upper edge of the accumulator in y. Can only be set via the constructor */ Float_t fYHigh; /** The lower edge of the accumulator in x. Can only be set via the constructor */ Float_t fXLow; /** The lower edge of the accumulator in x. Can only be set via the constructor */ Float_t fXHigh; Bool_t fWrappingX; Bool_t fWrappingY; Bool_t fWrappingZ; Int_t fNumberOfClusters; TH2F fHistogram; TH3F fHistogram3d; /** the helper function that copies all fields and the accumulator table one to one */ void Copy(CbmSttHoughAccumulatorNew const &other); /** the helper function that cleans up the accumulator table */ void Destroy(); /** the default constructor, initializes all values to -1, and does not create the accumulator therefore this should not be used */ CbmSttHoughAccumulatorNew(); void AddHitInternal(Int_t bin1, Int_t bin2, Int_t bin3, Int_t iFirst, Int_t iSecond, Int_t iThird); void FillTH2F(Int_t cluster = -1, Int_t thisZ = 0); void FillTH3F(Int_t cluster = -1); public: CbmSttHoughCellNew *GetHighestPeak() const; Int_t GetHighestPeakXBin() const; Int_t GetHighestPeakYBin() const; Int_t GetHighestPeakZBin() const; Int_t ConvertX(Double_t valX); Int_t ConvertY(Double_t valY); Int_t ConvertZ(Double_t valZ); CbmSttHoughAccumulatorNew(Int_t threshold, Bool_t verbose, Int_t xbins, Float_t xlow, Float_t xhigh, Int_t ybins, Float_t ylow, Float_t yhigh, Int_t zbins = 1, Float_t zlow = 0., Float_t zhigh = 0.); CbmSttHoughAccumulatorNew(CbmSttHoughAccumulatorNew const &other); ~CbmSttHoughAccumulatorNew(); void RemoveHit(Int_t elementNumber, Bool_t onlyThisCell = kFALSE, Int_t xbin = -1, Int_t ybin = -1, Int_t zbin = -1); TH2F const *GetTH2F(Int_t cluster = -1, Int_t thisZ = 0); TH3F const *GetTH3F(Int_t cluster = -1); void AddHit(Double_t zval, Int_t iHitFirst, Double_t yval, Int_t iHitSecond = -1); void AddHit(Double_t zval, Int_t iHitFirst, Double_t yval, Int_t iHitSecond, Double_t xval, Int_t iHitThird = -1); void ClearAccumulator(); Double_t GetHighestPeakX() const; Double_t GetHighestPeakY() const; Double_t GetHighestPeakZ() const; Int_t GetHighestPeakContents() const; void GetHighestPeakEntry(Int_t index, Int_t &element1, Int_t &element2, Int_t &element3) const; void GetHighestPeakEntry(Int_t index, Int_t &element1, Int_t &element2) const; Int_t GetHighestPeakCluster() const; void GetHighestPeakEntryList(vector &resultVect); void Cluster(Bool_t merge = kTRUE); Int_t GetThreshold() const {return fThreshold;} void SetThreshold(Int_t newThreshold) {fThreshold = newThreshold;} Int_t GetXBins() const {return fXBins;} Int_t GetYBins() const {return fYBins;} Int_t GetZBins() const {return fZBins;} Float_t GetXLow() const {return fXLow;} Float_t GetXHigh() const {return fXHigh;} Float_t GetYLow() const {return fYLow;} Float_t GetYHigh() const {return fYHigh;} Float_t GetZLow() const {return fZLow;} Float_t GetZHigh() const {return fZHigh;} Bool_t IsVerbose() const {return fVerbose;} void SetVerbose(bool newVerbose = true) {fVerbose = newVerbose;} Bool_t IsWrappingZ() const {return fWrappingZ;} void SetWrappingZ(bool newWrapping = true) {fWrappingZ = newWrapping;} Bool_t IsWrappingY() const {return fWrappingY;} void SetWrappingY(bool newWrapping = true) {fWrappingY = newWrapping;} Bool_t IsWrappingX() const {return fWrappingX;} void SetWrappingX(bool newWrapping = true) {fWrappingX = newWrapping;} void operator=(CbmSttHoughAccumulatorNew const &other); Int_t GetNumberOfClusters() const {return fNumberOfClusters;} Int_t GetContents(Int_t xbin, Int_t ybin, Int_t zbin); ClassDef(CbmSttHoughAccumulatorNew,1) }; #endif