]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Coding conventions
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Jun 2004 13:43:47 +0000 (13:43 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 15 Jun 2004 13:43:47 +0000 (13:43 +0000)
HLT/hough/AliL3HoughTransformerLUT.cxx
HLT/hough/AliL3HoughTransformerLUT.h

index e124e28019a510100e1e2e5815e41b729b96ac01..a770a52bd21aa212ee122551dc6781f01080a939 100644 (file)
@@ -2,6 +2,15 @@
 
 // Author: Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
 //*-- Copyright &copy ALICE HLT Group
+/** /class AliL3HoughTransformerLUT
+//<pre>
+//_____________________________________________________________
+// AliL3HoughTransformerLUT
+//
+// Hough transformation class using Look-UP-Tables
+//
+//</pre>
+*/
 
 #include "AliL3StandardIncludes.h"
 
 using namespace std;
 #endif
 
-/** /class AliL3HoughTransformerLUT
-//<pre>
-//_____________________________________________________________
-// AliL3HoughTransformerLUT
-//
-// Hough transformation class using Look-UP-Tables
-//
-//</pre>
-*/
-
 ClassImp(AliL3HoughTransformerLUT)
 
 AliL3HoughTransformerLUT::AliL3HoughTransformerLUT() : AliL3HoughBaseTransformer()
 {
+  // default contructor
   fParamSpace=0;
   fMinRow=0;
   fMaxRow=0;
@@ -62,8 +62,9 @@ AliL3HoughTransformerLUT::AliL3HoughTransformerLUT() : AliL3HoughBaseTransformer
   fX=fY=0.;
 }
 
-AliL3HoughTransformerLUT::AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t n_eta_segments) : AliL3HoughBaseTransformer(slice,patch,n_eta_segments)
+AliL3HoughTransformerLUT::AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t nEtaSegments) : AliL3HoughBaseTransformer(slice,patch,nEtaSegments)
 {
+  // constructor
   fParamSpace=0;
   fMinRow=0;
   fMaxRow=0;
@@ -93,11 +94,12 @@ AliL3HoughTransformerLUT::AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t
   fAccCharge=0;
   fX=fY=0.;
 
-  Init(slice,patch,n_eta_segments);
+  Init(slice,patch,nEtaSegments);
 }
 
 AliL3HoughTransformerLUT::~AliL3HoughTransformerLUT()
 {
+  // destructor
   DeleteHistograms();
 
   if(fNRows){
@@ -115,6 +117,7 @@ AliL3HoughTransformerLUT::~AliL3HoughTransformerLUT()
 
 void AliL3HoughTransformerLUT::DeleteHistograms()
 {
+  // deletes all histograms
   if(fNPhi0){
     delete[] fLUT2sinphi0;
     delete[] fLUT2cosphi0;
@@ -137,9 +140,10 @@ void AliL3HoughTransformerLUT::DeleteHistograms()
   }
 }
 
-void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t n_eta_segments,Int_t /*n_seqs*/) 
+void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t nEtaSegments,Int_t /*nSeqs*/) 
 {
-  AliL3HoughBaseTransformer::Init(slice,patch,n_eta_segments);
+  // Initialization
+  AliL3HoughBaseTransformer::Init(slice,patch,nEtaSegments);
 
   //delete old LUT tables
   if(fNRows){
@@ -157,7 +161,7 @@ void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t n_eta_segments
   fMinRow=AliL3Transform::GetFirstRow(patch);;
   fMaxRow=AliL3Transform::GetLastRow(patch);;
   fNRows=AliL3Transform::GetNRows(patch);;
-  fNEtas=n_eta_segments;
+  fNEtas=nEtaSegments;
   if(fNEtas!=GetNEtaSegments()) {
     cerr << "AliL3HoughTransformerLUT::Init -> Error: Number of Etas must be equal!" << endl;
     exit(1);
@@ -175,9 +179,9 @@ void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t n_eta_segments
   else
     fPadPitch=AliL3Transform::GetPadPitchWidthUp();  
 
-  Float_t etamax_=GetEtaMax();
-  Float_t etamin_=GetEtaMin();
-  fEtaSlice=(etamax_-etamin_)/n_eta_segments;
+  Float_t etaMax=GetEtaMax();
+  Float_t etaMin=GetEtaMin();
+  fEtaSlice=(etaMax-etaMin)/nEtaSegments;
 
   //lookup tables for X and Y
   fLUTX=new Float_t[fNRows];
@@ -193,7 +197,7 @@ void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t n_eta_segments
   fLUTEta=new Float_t[fNEtas];
   fLUTEtaReal=new Float_t[fNEtas];
   for(Int_t rr=0;rr<fNEtas;rr++){
-    Float_t eta=etamin_+(rr+1)*fEtaSlice;
+    Float_t eta=etaMin+(rr+1)*fEtaSlice;
     fLUTEta[rr]=CalcRoverZ2(eta);
     fLUTEtaReal[rr]=eta-0.5*fEtaSlice;
     //cout << rr << ": " << eta << " " << fLUTEtaReal[rr] << " " << GetEta(rr,fSlice) << " - " << fLUTEta[rr] << endl;
@@ -246,18 +250,18 @@ void AliL3HoughTransformerLUT::CreateHistograms(Float_t ptmin,Float_t ptmax,Floa
     }
 }
 
-void AliL3HoughTransformerLUT::CreateHistograms(Int_t nxbin,Float_t pt_min,Int_t nybin,Float_t phimin,Float_t phimax)
+void AliL3HoughTransformerLUT::CreateHistograms(Int_t nxbin,Float_t ptMin,Int_t nybin,Float_t phimin,Float_t phimax)
 {
   //Create the histograms (parameter space).
   //These are 2D histograms, span by kappa (curvature of track) and phi0 (emission angle with x-axis).
   //The arguments give the range and binning; 
   //nxbin = #bins in kappa
   //nybin = #bins in phi0
-  //pt_min = mimium Pt of track (corresponding to maximum kappa)
+  //ptMin = mimium Pt of track (corresponding to maximum kappa)
   //phi_min = mimimum phi0 (degrees)
   //phi_max = maximum phi0 (degrees)
     
-  Double_t x = AliL3Transform::GetBFact()*AliL3Transform::GetBField()/pt_min;
+  Double_t x = AliL3Transform::GetBFact()*AliL3Transform::GetBField()/ptMin;
   //Double_t torad = AliL3Transform::Pi()/180;
   CreateHistograms(nxbin,-1.*x,x,nybin,phimin/**torad*/,phimax/**torad*/);
 }
@@ -324,18 +328,20 @@ Int_t AliL3HoughTransformerLUT::GetEtaIndex(Double_t eta)
 #endif
 }
 
-AliL3Histogram *AliL3HoughTransformerLUT::GetHistogram(Int_t eta_index)
+AliL3Histogram *AliL3HoughTransformerLUT::GetHistogram(Int_t etaIndex)
 {
-  if(!fParamSpace || eta_index >= fNEtas || eta_index < 0)
+  // gets hitogram
+  if(!fParamSpace || etaIndex >= fNEtas || etaIndex < 0)
     return 0;
-  if(!fParamSpace[eta_index])
+  if(!fParamSpace[etaIndex])
     return 0;
-  return fParamSpace[eta_index];
+  return fParamSpace[etaIndex];
 }
 
-Double_t AliL3HoughTransformerLUT::GetEta(Int_t eta_index,Int_t slice)
+Double_t AliL3HoughTransformerLUT::GetEta(Int_t etaIndex,Int_t slice) const
 {
-  if(eta_index >= fNEtas || eta_index < 0){
+  // gets eta
+  if(etaIndex >= fNEtas || etaIndex < 0){
     LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::GetEta","Index") << "Index out of range."<<ENDLOG;
     return 0.;
   }
@@ -344,7 +350,7 @@ Double_t AliL3HoughTransformerLUT::GetEta(Int_t eta_index,Int_t slice)
     return 0.;
   }
 
-  return(fLUTEtaReal[eta_index]);
+  return(fLUTEtaReal[etaIndex]);
 }
 
 void AliL3HoughTransformerLUT::TransformCircle()
@@ -428,24 +434,24 @@ void AliL3HoughTransformerLUT::TransformCircle()
 
          Float_t z2=z*z;
          Float_t rz2 = 1 + r2/z2;
-         Int_t eta_index = FindIndex(rz2,fLastIndex);
+         Int_t etaIndex = FindIndex(rz2,fLastIndex);
 #else
          Float_t z = CalcZ(time);
          Double_t r = sqrt(fX*fX+fY*fY+z*z);
          Double_t eta = 0.5 * log((r+z)/(r-z));
-         Int_t eta_index = GetEtaIndex(eta);
+         Int_t etaIndex = GetEtaIndex(eta);
 #endif
-         if(eta_index < 0 || eta_index >= fNEtas){
-           LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::TransformCircle","Histograms")<<"No histograms corresponding to eta index value of "<<eta_index<<"."<<ENDLOG;
+         if(etaIndex < 0 || etaIndex >= fNEtas){
+           LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::TransformCircle","Histograms")<<"No histograms corresponding to eta index value of "<<etaIndex<<"."<<ENDLOG;
            continue;
          }       
 
 #ifndef FULLLUT
-         if(fLastIndex==-1) fLastIndex=eta_index;
+         if(fLastIndex==-1) fLastIndex=etaIndex;
 #endif
 
-         if(fLastIndex!=eta_index){ //enter old values first
-           AddCurveToHistogram(eta_index);
+         if(fLastIndex!=etaIndex){ //enter old values first
+           AddCurveToHistogram(etaIndex);
          }
 
          fAccCharge+=charge;
@@ -462,6 +468,7 @@ void AliL3HoughTransformerLUT::TransformCircle()
 
 void AliL3HoughTransformerLUT::Print()
 {
+  // debug printout
   cout << "fSlice: " << GetSlice() << endl;
   cout << "fPatch: " << GetPatch() << endl;
   cout << "fSector: " << fSector << endl;
index 80a0c6863f70e769c7fd0a59039ffa037d57cd60..19548e1739ef2521007aa9840bd58c531908a64c 100644 (file)
 
 class AliL3HoughTransformerLUT : public AliL3HoughBaseTransformer {
   
- protected:
-  AliL3Histogram **fParamSpace; //!
-
-  void DeleteHistograms();
-  
-  Int_t fMinRow;
-  Int_t fMaxRow;
-  Int_t fNRows;
-  Int_t fNEtas;
-  Int_t fNPhi0;
-  Int_t fSlice;
-  Int_t fSector;
-  Int_t fSectorRow;
-  Int_t fZSign;
-  Float_t fZLengthPlusOff;
-  Float_t fTimeWidth;
-  Float_t fPadPitch;
-  Float_t fEtaSlice;
-
-  Float_t *fLUTX; //!
-  Float_t *fLUTY; //!
-  Float_t *fLUTEta; //!
-  Float_t *fLUTEtaReal; //!
-  Float_t *fLUTphi0; //!
-  Float_t *fLUT2sinphi0; //!   
-  Float_t *fLUT2cosphi0; //!
-  //not used but need for VHDL version
-  Float_t *fLUTKappa; //!
-  
-  Int_t fLastPad;
-  Int_t fLastIndex;
-  Int_t fAccCharge;
-  Float_t fX,fY; //trafo values per pad
-
-  Float_t CalcRoverZ2(Float_t eta);
-  Float_t CalcEta(Float_t roverz2);
-  Float_t CalcX(Int_t row);
-  Float_t CalcY(Int_t pad, Int_t row);
-  Float_t CalcZ(Int_t time);  
-  Int_t FindIndex(Float_t rz2, Int_t start=-100);
-  void AddCurveToHistogram(Int_t new_eta_index=-1);
-
  public:
 
   AliL3HoughTransformerLUT(); 
-  AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t n_eta_segments);
+  AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t nEtaSegments);
   virtual ~AliL3HoughTransformerLUT();
   
   void CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t pres,Int_t nybin,Float_t psi);
@@ -69,17 +27,59 @@ class AliL3HoughTransformerLUT : public AliL3HoughBaseTransformer {
   void TransformCircle();
 
   Int_t GetEtaIndex(Double_t eta);
-  AliL3Histogram *GetHistogram(Int_t eta_index);
-  Double_t GetEta(Int_t eta_index,Int_t slice);
+  AliL3Histogram *GetHistogram(Int_t etaIndex);
+  Double_t GetEta(Int_t etaIndex,Int_t slice) const;
   
   void Print();
-  void Init(Int_t slice=0,Int_t patch=0,Int_t n_eta_segments=100,Int_t n_seqs=-1);
+  void Init(Int_t slice=0,Int_t patch=0,Int_t nEtaSegments=100,Int_t nSeqs=-1);
+
+ protected:
+  AliL3Histogram **fParamSpace; //!
+
+  void DeleteHistograms();
+  
+  Int_t fMinRow; // Min row (= first row)
+  Int_t fMaxRow; // Max row (= last row)
+  Int_t fNRows;  // Number of rows
+  Int_t fNEtas;  // Number of eta slices
+  Int_t fNPhi0;  // Number of phi bins
+  Int_t fSlice;  // Current slice
+  Int_t fSector; // Current sector
+  Int_t fSectorRow; // Sector row (?)
+  Int_t fZSign; // Z sign
+  Float_t fZLengthPlusOff; // Z lenght plus offset
+  Float_t fTimeWidth; // Time width
+  Float_t fPadPitch; // Pad pitch
+  Float_t fEtaSlice; // Eta slice
+
+  Float_t *fLUTX; //! LUT for X
+  Float_t *fLUTY; //! LUT for Y
+  Float_t *fLUTEta; //! LUT for eta
+  Float_t *fLUTEtaReal; //! LUT for real eta (?)
+  Float_t *fLUTphi0; //! LUT for phi0
+  Float_t *fLUT2sinphi0; //! LUT for sin(phi0)
+  Float_t *fLUT2cosphi0; //! LUT for cos(phi0)
+  //not used but need for VHDL version
+  Float_t *fLUTKappa; //! LUT for kappa
+  
+  Int_t fLastPad; // Last pad
+  Int_t fLastIndex; // Last index
+  Int_t fAccCharge; // Accepted charge
+  Float_t fX,fY; //trafo values per pad
+
+  Float_t CalcRoverZ2(Float_t eta) const;
+  Float_t CalcEta(Float_t roverz2) const;
+  Float_t CalcX(Int_t row) const;
+  Float_t CalcY(Int_t pad, Int_t row) const;
+  Float_t CalcZ(Int_t time) const;  
+  Int_t FindIndex(Float_t rz2, Int_t start=-100) const;
+  void AddCurveToHistogram(Int_t newEtaIndex=-1);
 
   ClassDef(AliL3HoughTransformerLUT,1) //LUT Hough transformation class
 
 };
 
-inline Float_t AliL3HoughTransformerLUT::CalcRoverZ2(Float_t eta)
+inline Float_t AliL3HoughTransformerLUT::CalcRoverZ2(Float_t eta) const
 {
   Float_t e=exp(2*eta);
   Float_t ret=(e+1)/(e-1);
@@ -87,7 +87,7 @@ inline Float_t AliL3HoughTransformerLUT::CalcRoverZ2(Float_t eta)
   return ret;
 }
 
-inline Float_t AliL3HoughTransformerLUT::CalcEta(Float_t roverz2)
+inline Float_t AliL3HoughTransformerLUT::CalcEta(Float_t roverz2) const
 {
   Float_t rz=sqrt(roverz2);
   if(fZSign<0) rz=-rz;
@@ -96,17 +96,17 @@ inline Float_t AliL3HoughTransformerLUT::CalcEta(Float_t roverz2)
   return ret;
 }
 
-inline Float_t AliL3HoughTransformerLUT::CalcX(Int_t row)
+inline Float_t AliL3HoughTransformerLUT::CalcX(Int_t row) const
 {
   return fLUTX[row];
 }
 
-inline Float_t AliL3HoughTransformerLUT::CalcY(Int_t pad,Int_t row)
+inline Float_t AliL3HoughTransformerLUT::CalcY(Int_t pad,Int_t row) const
 {
   return pad*fPadPitch-fLUTY[row];
 }
 
-inline Float_t AliL3HoughTransformerLUT::CalcZ(Int_t time)
+inline Float_t AliL3HoughTransformerLUT::CalcZ(Int_t time) const
 {
   Float_t ret=time*fTimeWidth;
   if(fZSign>0) ret=fZLengthPlusOff-ret;
@@ -114,7 +114,7 @@ inline Float_t AliL3HoughTransformerLUT::CalcZ(Int_t time)
   return ret;
 }
 
-inline void AliL3HoughTransformerLUT::AddCurveToHistogram(Int_t new_eta_index)
+inline void AliL3HoughTransformerLUT::AddCurveToHistogram(Int_t newEtaIndex)
 {
   //get correct histogrampointer
   AliL3Histogram *hist = fParamSpace[fLastIndex];
@@ -128,10 +128,10 @@ inline void AliL3HoughTransformerLUT::AddCurveToHistogram(Int_t new_eta_index)
   }
 
   fAccCharge=0;
-  fLastIndex=new_eta_index;
+  fLastIndex=newEtaIndex;
 }
 
-inline Int_t AliL3HoughTransformerLUT::FindIndex(Float_t rz2, Int_t start)
+inline Int_t AliL3HoughTransformerLUT::FindIndex(Float_t rz2, Int_t start) const
 {
   //could improve search through devide and conquere strategy