--- /dev/null
+#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
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();
}
{
if(!fParamSpace)
return;
- for(Int_t i=0; i<fNEtaSegments; i++)
+ for(Int_t i=0; i<GetNEtaSegments(); i++)
{
if(!fParamSpace[i]) continue;
delete fParamSpace[i];
Int_t nybin,Double_t ymin,Double_t ymax)
{
- fParamSpace = new AliL3Histogram*[fNEtaSegments];
+ fParamSpace = new AliL3Histogram*[GetNEtaSegments()];
Char_t histname[256];
- for(Int_t i=0; i<fNEtaSegments; i++)
+ for(Int_t i=0; i<GetNEtaSegments(); i++)
{
sprintf(histname,"paramspace_%d",i);
fParamSpace[i] = new AliL3Histogram(histname,"",nxbin,xmin,xmax,nybin,ymin,ymax);
return;
}
- for(Int_t i=0; i<fNEtaSegments; i++)
+ for(Int_t i=0; i<GetNEtaSegments(); i++)
fParamSpace[i]->Reset();
}
-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;
}
//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;
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:
//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);
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; di<tempPt->fNDigit; di++)
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;
for(Int_t i=0; i<total_digits; i++)
{
- if(digits[i].eta_index < 0 || digits[i].eta_index >= 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; j<total_digits; j++)
//Do a line transform on the data.
- AliL3DigitRowData *tempPt = (AliL3DigitRowData*)fDigitRowData;
- if(!tempPt || fNDigitRowData==0)
+ AliL3DigitRowData *tempPt = GetDataPointer();
+ if(!tempPt)
{
printf("\nAliL3HoughTransformer::TransformLine : No input data!!!\n\n");
return;
}
- //Double_t etaslice = (fEtaMax - fEtaMin)/fNEtaSegments;
- 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;
if(i != (Int_t)tempPt->fRow)
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:
#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:
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
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;