#include "AliL3Transform.h"
#include "AliL3DigitData.h"
#include "AliL3HoughTransformerVhdl.h"
+#include "AliL3FFloat.h"
#if GCCVERSION == 3
using namespace std;
fSinEpsilon=sin(fEpsilon);
fCosEpsilon=cos(fEpsilon);
+ fNxbin=nxbin;
+ fXmin=xmin;
+ fXmax=xmax;
+ fNybin=nybin;
+ fYmin=ymin;
+ fYmax=ymax;
// cout << fEpsilon << " - " << (xmax-xmin)/nxbin << endl;
}
//which histogram in which the pixel should be transformed, the eta-value is calcluated
//and the proper histogram index is found by GetEtaIndex(eta).
+
AliL3DigitRowData *tempPt = GetDataPointer();
if(!tempPt)
{
continue;
}
+ Float_t x = CalcX(row);
+ Float_t x2=x*x;
+ Float_t y=0,y2=0;
+ Float_t r2=0;
+ Float_t R2=0;
+ fLastPad=-1;
+
+
//Loop over the data on this padrow:
for(UInt_t j=0; j<tempPt->fNDigit; j++)
{
UChar_t pad = digPt[j].fPad;
UShort_t time = digPt[j].fTime;
- Float_t x = CalcX(row);
- Float_t y = CalcY(pad,row);
+ if(fLastPad!=pad){ //only update if necessary
+ fLastIndex=fNEtas-1;
+ y = CalcY(pad,row);
+ y2 = y*y;
+ r2 = x2 + y2;
+ R2 = 1. / r2;
+ for(Int_t b=0; b<fNPhi0; b++)
+ fLUTKappa[b]=R2*(y*fLUT2cosphi0[b]-x*fLUT2sinphi0[b]);
+
+ //Fill the histogram along the phirange
+ Float_t kappa=0;
+ Float_t kappaprime=0;
+ Float_t lastkappa=0;
+ Float_t lastkappaprime=0;
+ Int_t its=0;
+ Float_t R2=1/(x*x+y*y);
+ Float_t A=2*y*R2;
+ Float_t B=-2*x*R2;
+
+ //starting point
+ Float_t phi = fLUTphi0[fNPhi0/2];
+ kappa=A*cos(phi)+B*sin(phi);
+ kappaprime=B*cos(phi)-A*sin(phi);
+ its=fIts;
+ lastkappa=kappa;
+ lastkappaprime=kappaprime;
+ // hist->Fill(kappa,phi,charge);
+
+ for(Int_t b=fNPhi0/2+1; b<fNPhi0; b++){
+ Float_t exact_kappa=R2*(y*fLUT2cosphi0[b]-x*fLUT2sinphi0[b]);
+
+ phi=fLUTphi0[b];
+
+ if(its==0) { //initialize or re-adjust values
+ kappa=A*cos(phi)+B*sin(phi); //equals exact_kappa!
+ kappaprime=B*cos(phi)-A*sin(phi);
+ its=fIts;
+ } else {
+ //kappa=fCosEpsilon*lastkappa+fSinEpsilon*lastkappaprime;
+ //kappaprime=fCosEpsilon*lastkappaprime-fSinEpsilon*lastkappa;
+ kappa=lastkappa+fEpsilon*lastkappaprime;
+ kappaprime=lastkappaprime-fEpsilon*lastkappa;
+ its--;
+ }
+
+ lastkappa=kappa;
+ lastkappaprime=kappaprime;
+
+ // hist->Fill(kappa,phi,charge);
+ } // end positive running values
+
+ phi = fLUTphi0[fNPhi0/2];
+ kappa=A*cos(phi)+B*sin(phi);
+ kappaprime=B*cos(phi)-A*sin(phi);
+ its=fIts;
+ lastkappa=kappa;
+ lastkappaprime=kappaprime;
+ //hist->Fill(kappa,fLUTphi0[b],charge);
+
+ for(Int_t b=fNPhi0/2-1; b>=0; b--){
+ Float_t exact_kappa=R2*(y*fLUT2cosphi0[b]-x*fLUT2sinphi0[b]);
+
+ Float_t phi = fLUTphi0[b];
+
+ if(its==0) { //initialize or re-adjust values
+ kappa=A*cos(phi)+B*sin(phi); //equals exact_kappa!
+ kappaprime=B*cos(phi)-A*sin(phi);
+ its=fIts;
+ } else {
+ //kappa=fCosEpsilon*lastkappa-fSinEpsilon*lastkappaprime;
+ //kappaprime=fCosEpsilon*lastkappaprime+fSinEpsilon*lastkappa;
+ kappa=lastkappa-fEpsilon*lastkappaprime;
+ kappaprime=lastkappaprime+fEpsilon*lastkappa;
+ its--;
+ }
+
+ lastkappa=kappa;
+ lastkappaprime=kappaprime;
+
+ // hist->Fill(kappa,phi,charge);
+ }
+
+ fLastPad=pad;
+ }
+
Float_t z = CalcZ(time);
//find eta slice
continue;
}
- //Fill the histogram along the phirange
- Float_t kappa=0;
- Float_t kappaprime=0;
- Float_t lastkappa=0;
- Float_t lastkappaprime=0;
- Int_t its=0;
- Float_t R2=1/(x*x+y*y);
- Float_t A=2*y*R2;
- Float_t B=-2*x*R2;
-
-#if 1
- //starting point
- Float_t phi = fLUTphi0[fNPhi0/2];
- kappa=A*cos(phi)+B*sin(phi);
- kappaprime=B*cos(phi)-A*sin(phi);
- its=fIts;
- lastkappa=kappa;
- lastkappaprime=kappaprime;
- hist->Fill(kappa,phi,charge);
-
- for(Int_t b=fNPhi0/2+1; b<fNPhi0; b++){
- Float_t exact_kappa=R2*(y*fLUT2cosphi0[b]-x*fLUT2sinphi0[b]);
-
- phi=fLUTphi0[b];
-
- if(its==0) { //initialize or re-adjust values
- kappa=A*cos(phi)+B*sin(phi); //equals exact_kappa!
- kappaprime=B*cos(phi)-A*sin(phi);
- its=fIts;
- } else {
- //kappa=fCosEpsilon*lastkappa+fSinEpsilon*lastkappaprime;
- //kappaprime=fCosEpsilon*lastkappaprime-fSinEpsilon*lastkappa;
- kappa=lastkappa+fEpsilon*lastkappaprime;
- kappaprime=lastkappaprime-fEpsilon*lastkappa;
- its--;
- }
-
- lastkappa=kappa;
- lastkappaprime=kappaprime;
-
- hist->Fill(kappa,phi,charge);
- } // end positive running values
-
- phi = fLUTphi0[fNPhi0/2];
- kappa=A*cos(phi)+B*sin(phi);
- kappaprime=B*cos(phi)-A*sin(phi);
- its=fIts;
- lastkappa=kappa;
- lastkappaprime=kappaprime;
- //hist->Fill(kappa,fLUTphi0[b],charge);
-
- for(Int_t b=fNPhi0/2-1; b>=0; b--){
- Float_t exact_kappa=R2*(y*fLUT2cosphi0[b]-x*fLUT2sinphi0[b]);
-
- Float_t phi = fLUTphi0[b];
-
- if(its==0) { //initialize or re-adjust values
- kappa=A*cos(phi)+B*sin(phi); //equals exact_kappa!
- kappaprime=B*cos(phi)-A*sin(phi);
- its=fIts;
- } else {
- //kappa=fCosEpsilon*lastkappa-fSinEpsilon*lastkappaprime;
- //kappaprime=fCosEpsilon*lastkappaprime+fSinEpsilon*lastkappa;
- kappa=lastkappa-fEpsilon*lastkappaprime;
- kappaprime=lastkappaprime+fEpsilon*lastkappa;
- its--;
- }
-
- lastkappa=kappa;
- lastkappaprime=kappaprime;
-
- hist->Fill(kappa,phi,charge);
- }
-
-#else
for(Int_t b=0; b<fNPhi0; b++){
- Float_t exact_kappa=R2*(y*fLUT2cosphi0[b]-x*fLUT2sinphi0[b]);
-
- Float_t phi = fLUTphi0[b];
-
- if(its==0) { //initialize or re-adjust values
- kappa=A*cos(phi)+B*sin(phi); //equals exact_kappa!
- kappaprime=B*cos(phi)-A*sin(phi);
- its=fIts;
- } else {
- //kappa=fCosEpsilon*lastkappa+fSinEpsilon*lastkappaprime;
- //kappaprime=fCosEpsilon*lastkappaprime-fSinEpsilon*lastkappa;
- kappa=lastkappa+fEpsilon*lastkappaprime;
- kappaprime=lastkappaprime-fEpsilon*lastkappa;
- its--;
- }
#ifdef use_error
Float_t err=fabs((exact_kappa-kappa)/exact_kappa);
rel_error+=err;
counter++;
#endif
-
- lastkappa=kappa;
- lastkappaprime=kappaprime;
-
- hist->Fill(kappa,fLUTphi0[b],charge);
+ //hist->Fill(kappa,fLUTphi0[b],charge);
//cout << kappa << " " << fLUTphi0[b] << " " << charge << endl;
}
-#endif /*test*/
-
}
//Move the data pointer to the next padrow:
AliL3MemHandler::UpdateRowPointer(tempPt);
cout <<"Max Error: " << max_error << endl;
cout <<"Rel Error average: " << rel_error/counter << endl;
#endif
+
}
void AliL3HoughTransformerVhdl::Print()
cout << "fEpsilon: " << fEpsilon << endl;
cout << "fIts: " << fIts << endl;
}
+
+void AliL3HoughTransformerVhdl::PrintVhdl()
+{
+ cout << "fSlice := " << GetSlice() << ";" << endl;
+ cout << "fPatch := " << GetPatch() << ";" << endl;
+ // cout << "fSector := " << fSector << ";" << endl;
+ // cout << "fSectorRow := " << fSectorRow << ";" << endl;
+ // cout << "fMinRow := " << fMinRow << ";" << endl;
+ // cout << "fMaxRow := " << fMaxRow << ";" << endl;
+ // cout << "fNRows := " << fNRows << ";" << endl;
+ // cout << "fNEtas := " << fNEtas << ";" << endl;
+ // cout << "fNPhi0 := " << fNPhi0 << ";" << endl;
+ cout << "fZSign := " << fZSign << ";" << endl;
+ cout << "fZLengthPlusOff := " << fZLengthPlusOff << ";" << endl;
+ cout << "fPadPitch := " << fPadPitch << ";" << endl;
+ cout << "fTimeWidth := " << fTimeWidth << ";" << endl;
+
+ if(!fNRows) return;
+ cout << "fNLUTX :=" << fNRows << ";" << endl;
+ cout << "fLUTX := ( ";
+ for(Int_t i=0;i<fNRows-1;i++) cout << fLUTX[i] << ", ";
+ cout << fLUTX[fNRows-1] << " );\n" << endl;
+ cout << "fNLUTY := " << fNRows << ";" << endl;
+ cout << "fLUTY := ( ";
+ for(Int_t i=0;i<fNRows-1;i++) cout << fLUTY[i] << ", ";
+ cout << fLUTY[fNRows-1] << " );\n" << endl;
+
+ if(!fNEtas) return;
+ cout << "fNLUTEta := " << fNEtas << ";" << endl;
+ cout << "fLUTEta := (";
+ for(Int_t i=0;i<fNEtas-1;i++) cout << fLUTEta[i] << ", ";
+ cout << fLUTEta[fNEtas-1] << " );\n" << endl;
+
+ if(!fNPhi0) return;
+ cout << "fNxbin := " << fNxbin << endl;
+ cout << "fxmin := " << fXmin << endl;
+ cout << "fxmax := " << fXmax << endl;
+ cout << "fNybin := " << fNybin << endl;
+ cout << "fymin := " << fYmin << endl;
+ cout << "fymax := " << fYmax << endl;
+
+ cout << "\nfNLUTphi0 := " << fNPhi0 << ";" << endl;
+ cout << "fLUTphi0 := (";
+ for(Int_t i=0;i<fNPhi0-1;i++) cout << fLUTphi0[i] << ", ";
+ cout << fLUTphi0[fNPhi0-1] << " );\n" << endl;
+
+ cout << "fLUT2sinphi0 := (";
+ for(Int_t i=0;i<fNPhi0-1;i++) cout << fLUT2sinphi0[i] << ", ";
+ cout << fLUT2sinphi0[fNPhi0-1] << " );\n" << endl;
+
+ cout << "fLUT2cosphi0 := (";
+ for(Int_t i=0;i<fNPhi0;i++) cout << fLUT2cosphi0[i] << ", ";
+ cout << fLUT2cosphi0[fNPhi0-1] << " );\n" << endl;
+}