From c52cf5d8e51982f36f3a56ab0cc273ba2519c197 Mon Sep 17 00:00:00 2001 From: vestbo Date: Thu, 25 Apr 2002 15:13:30 +0000 Subject: [PATCH] Made a new abstract base class; AliL3HoughBaseTransformer for different implementations of the circle Hough transform. All the member functions which were previously in AliL3HoughTransformer are virtual in this class, and should be appropriately overloaded in the underlying implementations. --- HLT/hough/AliL3HoughBaseTransformer.cxx | 46 +++++++++++++++ HLT/hough/AliL3HoughBaseTransformer.h | 61 ++++++++++++++++++++ HLT/hough/AliL3HoughLinkDef.h | 1 + HLT/hough/AliL3HoughTransformer.cxx | 74 ++++++++++--------------- HLT/hough/AliL3HoughTransformer.h | 37 ++----------- 5 files changed, 140 insertions(+), 79 deletions(-) create mode 100644 HLT/hough/AliL3HoughBaseTransformer.cxx create mode 100644 HLT/hough/AliL3HoughBaseTransformer.h diff --git a/HLT/hough/AliL3HoughBaseTransformer.cxx b/HLT/hough/AliL3HoughBaseTransformer.cxx new file mode 100644 index 00000000000..0e804a2c35e --- /dev/null +++ b/HLT/hough/AliL3HoughBaseTransformer.cxx @@ -0,0 +1,46 @@ +//$Id$ + +// Author: Anders Vestbo +//*-- Copyright © ASV + +#include "AliL3MemHandler.h" +#include "AliL3Logging.h" +#include "AliL3HoughBaseTransformer.h" +#include "AliL3Defs.h" +#include "AliL3Transform.h" +#include "AliL3DigitData.h" +#include "AliL3Histogram.h" + +//_____________________________________________________________ +// AliL3HoughBaseTransformer +// +// The base class for implementations of Hough Transform on ALICE TPC data. + +ClassImp(AliL3HoughBaseTransformer) + +AliL3HoughBaseTransformer::AliL3HoughBaseTransformer() +{ + //Default constructor + fTransform = 0; + fDigitRowData = 0; + +} + +AliL3HoughBaseTransformer::AliL3HoughBaseTransformer(Int_t slice,Int_t patch,Int_t n_eta_segments) +{ + fSlice = slice; + fPatch = patch; + fNEtaSegments = n_eta_segments; + fEtaMin = 0; + fEtaMax = fSlice < 18 ? 0.9 : -0.9; + fTransform = new AliL3Transform(); + fThreshold = 0; + fDigitRowData=0; +} + +AliL3HoughBaseTransformer::~AliL3HoughBaseTransformer() +{ + if(fTransform) + delete fTransform; +} + diff --git a/HLT/hough/AliL3HoughBaseTransformer.h b/HLT/hough/AliL3HoughBaseTransformer.h new file mode 100644 index 00000000000..9f294af72bd --- /dev/null +++ b/HLT/hough/AliL3HoughBaseTransformer.h @@ -0,0 +1,61 @@ +#ifndef ALIL3_HOUGHBASETRANSFORMER +#define ALIL3_HOUGHBASETRANSFORMER + +#include "AliL3RootTypes.h" + +class AliL3Transform; +class AliL3DigitRowData; +class AliL3Histogram; + +class AliL3HoughBaseTransformer { + + private: + + Int_t fSlice; + Int_t fPatch; + Int_t fNEtaSegments; + Double_t fEtaMin; + Double_t fEtaMax; + Int_t fThreshold; + + AliL3DigitRowData *fDigitRowData; //! + + protected: + AliL3Transform *fTransform; //! + + public: + AliL3HoughBaseTransformer(); + AliL3HoughBaseTransformer(Int_t slice,Int_t patch,Int_t n_eta_segments); + virtual ~AliL3HoughBaseTransformer(); + + void SetInputData(UInt_t ndigits,AliL3DigitRowData *ptr) {fDigitRowData = ptr;} + + virtual void CreateHistograms(Int_t nxbin,Double_t ptmin,Int_t nybin,Double_t phimin,Double_t phimax) = 0; + virtual void CreateHistograms(Int_t nxbin,Double_t xmin,Double_t xmax,Int_t nybin,Double_t ymin,Double_t ymax) = 0; + virtual void Reset() = 0; + virtual void TransformCircle() = 0; + virtual void TransformCircleC(Int_t row_range) = 0; + virtual void TransformLine() = 0; + + //Getters + Int_t GetSlice() {return fSlice;} + Int_t GetPatch() {return fPatch;} + Int_t GetNEtaSegments() {return fNEtaSegments;} + Int_t GetThreshold() {return fThreshold;} + Double_t GetEtaMin() {return fEtaMin;} + Double_t GetEtaMax() {return fEtaMax;} + + AliL3DigitRowData *GetDataPointer() {return fDigitRowData;} + + virtual Int_t GetEtaIndex(Double_t eta) = 0; + virtual AliL3Histogram *GetHistogram(Int_t eta_index) = 0; + + //setters + void SetThreshold(Int_t i) {fThreshold = i;} + + ClassDef(AliL3HoughBaseTransformer,1) //Hough transformation base class + +}; + + +#endif diff --git a/HLT/hough/AliL3HoughLinkDef.h b/HLT/hough/AliL3HoughLinkDef.h index 79cd6f6e233..e1bfc69fbbc 100644 --- a/HLT/hough/AliL3HoughLinkDef.h +++ b/HLT/hough/AliL3HoughLinkDef.h @@ -6,6 +6,7 @@ #pragma link C++ class AliL3Hough; #pragma link C++ class AliL3HoughTransformer; +#pragma link C++ class AliL3HoughBaseTransformer; #pragma link C++ class AliL3HoughTrack; #pragma link C++ class AliL3HoughMaxFinder; #pragma link C++ class AliL3HoughEval; diff --git a/HLT/hough/AliL3HoughTransformer.cxx b/HLT/hough/AliL3HoughTransformer.cxx index 8ea344e4705..399a7534593 100644 --- a/HLT/hough/AliL3HoughTransformer.cxx +++ b/HLT/hough/AliL3HoughTransformer.cxx @@ -22,28 +22,18 @@ ClassImp(AliL3HoughTransformer) AliL3HoughTransformer::AliL3HoughTransformer() { //Default constructor - + fParamSpace = 0; } -AliL3HoughTransformer::AliL3HoughTransformer(Int_t slice,Int_t patch,Int_t n_eta_segments) +AliL3HoughTransformer::AliL3HoughTransformer(Int_t slice,Int_t patch,Int_t n_eta_segments) : AliL3HoughBaseTransformer(slice,patch,n_eta_segments) { //Normal constructor - fSlice = slice; - fPatch = patch; - fNEtaSegments = n_eta_segments; - fEtaMin = 0; - fEtaMax = fSlice < 18 ? 0.9 : -0.9; - fTransform = new AliL3Transform(); - fThreshold = 0; - fNDigitRowData=0; - fDigitRowData=0; + fParamSpace = 0; } AliL3HoughTransformer::~AliL3HoughTransformer() { - if(fTransform) - delete fTransform; DeleteHistograms(); } @@ -51,7 +41,7 @@ void AliL3HoughTransformer::DeleteHistograms() { if(!fParamSpace) return; - for(Int_t i=0; iReset(); } -void AliL3HoughTransformer::SetInputData(UInt_t ndigits,AliL3DigitRowData *ptr) -{ - //Give the pointer to the data. - - fNDigitRowData = ndigits; - fDigitRowData = ptr; -} Int_t AliL3HoughTransformer::GetEtaIndex(Double_t eta) { //Return the histogram index of the corresponding eta. - Double_t etaslice = (fEtaMax - fEtaMin)/fNEtaSegments; - Double_t index = (eta-fEtaMin)/etaslice; + Double_t etaslice = (GetEtaMax() - GetEtaMin())/GetNEtaSegments(); + Double_t index = (eta-GetEtaMin())/etaslice; return (Int_t)index; } @@ -137,15 +120,15 @@ void AliL3HoughTransformer::TransformCircle() //and the proper histogram index is found by GetEtaIndex(eta). - AliL3DigitRowData *tempPt = (AliL3DigitRowData*)fDigitRowData; - if(!tempPt || fNDigitRowData==0) + AliL3DigitRowData *tempPt = GetDataPointer(); + if(!tempPt) { printf("\nAliL3HoughTransformer::TransformCircle : No input data!!!\n\n"); return; } //Loop over the padrows: - for(Int_t i=NRows[fPatch][0]; i<=NRows[fPatch][1]; i++) + for(Int_t i=NRows[GetPatch()][0]; i<=NRows[GetPatch()][1]; i++) { //Get the data on this padrow: AliL3DigitData *digPt = tempPt->fDigitData; @@ -161,21 +144,21 @@ void AliL3HoughTransformer::TransformCircle() UShort_t charge = digPt[j].fCharge; UChar_t pad = digPt[j].fPad; UShort_t time = digPt[j].fTime; - if(charge <= fThreshold) + if(charge <= GetThreshold()) continue; Int_t sector,row; Float_t xyz[3]; //Transform data to local cartesian coordinates: - fTransform->Slice2Sector(fSlice,i,sector,row); + fTransform->Slice2Sector(GetSlice(),i,sector,row); fTransform->Raw2Local(xyz,sector,row,(Int_t)pad,(Int_t)time); //Calculate the eta: Double_t eta = fTransform->GetEta(xyz); //Get the corresponding index, which determines which histogram to fill: - Int_t eta_index = GetEtaIndex(eta);//(Int_t)((eta-fEtaMin)/etaslice); - if(eta_index < 0 || eta_index >= fNEtaSegments) + Int_t eta_index = GetEtaIndex(eta); + if(eta_index < 0 || eta_index >= GetNEtaSegments()) continue; //Get the correct histogrampointer: @@ -209,12 +192,12 @@ void AliL3HoughTransformer::TransformCircleC(Int_t row_range) //Circle transform, using combinations of every 2 points lying //on different padrows and within the same etaslice. - AliL3DigitRowData *tempPt = (AliL3DigitRowData*)fDigitRowData; + AliL3DigitRowData *tempPt = GetDataPointer(); if(!tempPt) printf("\nAliL3HoughTransformer::TransformCircleC() : Zero data pointer\n"); Int_t counter=0; - for(Int_t i=NRows[fPatch][0]; i<=NRows[fPatch][1]; i++) + for(Int_t i=NRows[GetPatch()][0]; i<=NRows[GetPatch()][1]; i++) { counter += tempPt->fNDigit; AliL3MemHandler::UpdateRowPointer(tempPt); @@ -237,9 +220,9 @@ void AliL3HoughTransformer::TransformCircleC(Int_t row_range) Float_t xyz[3]; counter=0; - tempPt = (AliL3DigitRowData*)fDigitRowData; + tempPt = GetDataPointer(); - for(Int_t i=NRows[fPatch][0]; i<=NRows[fPatch][1]; i++) + for(Int_t i=NRows[GetPatch()][0]; i<=NRows[GetPatch()][1]; i++) { AliL3DigitData *digPt = tempPt->fDigitData; for(UInt_t di=0; difNDigit; di++) @@ -247,7 +230,7 @@ void AliL3HoughTransformer::TransformCircleC(Int_t row_range) charge = digPt[di].fCharge; pad = digPt[di].fPad; time = digPt[di].fTime; - fTransform->Slice2Sector(fSlice,i,sector,row); + fTransform->Slice2Sector(GetSlice(),i,sector,row); fTransform->Raw2Local(xyz,sector,row,(Int_t)pad,(Int_t)time); eta = fTransform->GetEta(xyz); digits[counter].row = i; @@ -262,7 +245,7 @@ void AliL3HoughTransformer::TransformCircleC(Int_t row_range) for(Int_t i=0; i= fNEtaSegments) continue; + if(digits[i].eta_index < 0 || digits[i].eta_index >= GetNEtaSegments()) continue; Int_t ind = digits[i].eta_index; for(Int_t j=i+1; jfDigitData; if(i != (Int_t)tempPt->fRow) @@ -318,15 +300,15 @@ void AliL3HoughTransformer::TransformLine() UShort_t charge = digPt[j].fCharge; UChar_t pad = digPt[j].fPad; UShort_t time = digPt[j].fTime; - if(charge < fThreshold) + if(charge < GetThreshold()) continue; Int_t sector,row; Float_t xyz[3]; - fTransform->Slice2Sector(fSlice,i,sector,row); + fTransform->Slice2Sector(GetSlice(),i,sector,row); fTransform->Raw2Local(xyz,sector,row,(Int_t)pad,(Int_t)time); Float_t eta = fTransform->GetEta(xyz); Int_t eta_index = GetEtaIndex(eta);//(Int_t)(eta/etaslice); - if(eta_index < 0 || eta_index >= fNEtaSegments) + if(eta_index < 0 || eta_index >= GetNEtaSegments()) continue; //Get the correct histogram: diff --git a/HLT/hough/AliL3HoughTransformer.h b/HLT/hough/AliL3HoughTransformer.h index a48b784bacb..d8e3c74f896 100644 --- a/HLT/hough/AliL3HoughTransformer.h +++ b/HLT/hough/AliL3HoughTransformer.h @@ -2,31 +2,15 @@ #define ALIL3_HOUGHTRANSFORMER #include "AliL3RootTypes.h" +#include "AliL3HoughBaseTransformer.h" -class AliL3Transform; class AliL3Histogram; -class AliL3DigitRowData; -class AliL3HoughTransformer { +class AliL3HoughTransformer : public AliL3HoughBaseTransformer { private: - - Int_t fSlice; - Int_t fPatch; - Int_t fNEtaSegments; - Double_t fEtaMin; - Double_t fEtaMax; - Int_t fThreshold; - AliL3Transform *fTransform; //! - //Pointers to histograms AliL3Histogram **fParamSpace; //! - - //Data pointers - UInt_t fNDigitRowData; - AliL3DigitRowData *fDigitRowData; //! - - Int_t GetEtaIndex(Double_t eta); void DeleteHistograms(); public: @@ -34,30 +18,17 @@ class AliL3HoughTransformer { AliL3HoughTransformer(Int_t slice,Int_t patch,Int_t n_eta_segments); virtual ~AliL3HoughTransformer(); - void SetInputData(UInt_t ndigits,AliL3DigitRowData *ptr); void CreateHistograms(Int_t nxbin,Double_t ptmin,Int_t nybin,Double_t phimin,Double_t phimax); void CreateHistograms(Int_t nxbin,Double_t xmin,Double_t xmax, Int_t nybin,Double_t ymin,Double_t ymax); - //void CreateHistograms(Int_t nxbin=64,Double_t xmin=-0.006,Double_t xmax=0.006, - //Int_t nybin=64,Double_t ymin=-0.26,Double_t ymax=0.26); void Reset(); void TransformCircle(); void TransformCircleC(Int_t row_range); void TransformLine(); - //Getters - Int_t GetSlice() {return fSlice;} - Int_t GetPatch() {return fPatch;} - Int_t GetNEtaSegments() {return fNEtaSegments;} - Int_t GetThreshold() {return fThreshold;} - Double_t GetEtaMin() {return fEtaMin;} - Double_t GetEtaMax() {return fEtaMax;} - Double_t GetEtaSlice() {return (fEtaMax - fEtaMin)/fNEtaSegments;} - void *GetDataPointer() {return (void*)fDigitRowData;} + Int_t GetEtaIndex(Double_t eta); AliL3Histogram *GetHistogram(Int_t eta_index); - //setters - void SetThreshold(Int_t i) {fThreshold = i;} ClassDef(AliL3HoughTransformer,1) //Hough transformation class @@ -65,7 +36,7 @@ class AliL3HoughTransformer { inline AliL3Histogram *AliL3HoughTransformer::GetHistogram(Int_t eta_index) { - if(!fParamSpace || eta_index >= fNEtaSegments || eta_index < 0) + if(!fParamSpace || eta_index >= GetNEtaSegments() || eta_index < 0) return 0; if(!fParamSpace[eta_index]) return 0; -- 2.39.3