Several bugfixes
authorvestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Dec 2002 10:40:34 +0000 (10:40 +0000)
committervestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 16 Dec 2002 10:40:34 +0000 (10:40 +0000)
HLT/hough/AliL3HoughTest.cxx
HLT/hough/AliL3HoughTest.h

index bbf811c..4caa4b9 100644 (file)
@@ -34,7 +34,7 @@ AliL3HoughTest::~AliL3HoughTest()
     delete [] fData;
 }
 
-void AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t patch)
+Bool_t AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t sign,Int_t patch,Int_t minhits)
 {
   fCurrentPatch=patch;
   if(fData)
@@ -46,28 +46,32 @@ void AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t patch)
   track->Init(0,patch);
   track->SetPt(pt);
   track->SetPsi(psi);
-  track->SetCharge(1);
+  track->SetCharge(sign);
+  track->SetFirstPoint(0,0,0);
   track->CalculateHelix();
   
 
   Int_t temp[200];
   Int_t entries=100;
   Int_t clustercharge=100;
+  Int_t hitcounter=0;
   for(Int_t i=AliL3Transform::GetFirstRow(patch); i<=AliL3Transform::GetLastRow(patch); i++)
     {
       Float_t xyz[3];
       
       if(!track->GetCrossingPoint(i,xyz))
        continue;
-
+      
+      Int_t rowindex = i - AliL3Transform::GetFirstRow(patch);
       Int_t sector,row;
       AliL3Transform::Slice2Sector(0,i,sector,row);
       AliL3Transform::Local2Raw(xyz,sector,row);
 
       if(xyz[1] < 0 || xyz[1] >= AliL3Transform::GetNPads(i))
        continue;
-      track->SetPadHit(row,xyz[1]);
-
+      hitcounter++;
+      track->SetPadHit(i,xyz[1]);
+      //cout<<i<<" "<<xyz[1]<<endl;
       memset(temp,0,200*sizeof(Int_t));
       Double_t xysigma = sqrt(track->GetParSigmaY2(i));
       Int_t minpad=200,j;
@@ -94,15 +98,18 @@ void AliL3HoughTest::GenerateTrackData(Double_t pt,Double_t psi,Int_t patch)
            continue;
          if(charge > 1023)
            charge=1023;
-         fData[i].pads[index]=charge;
-         fData[i].npads++;
+         fData[rowindex].pads[index]=charge;
+         fData[rowindex].npads++;
        }
-      fData[i].minpad=minpad;
+      fData[rowindex].minpad=minpad;
     }
   delete track;
+  if(hitcounter < minhits)
+    return kFALSE;
+  return kTRUE;
 }
 
-void AliL3HoughTest::Transform(AliL3Histogram *hist)
+void AliL3HoughTest::Transform2Circle(AliL3Histogram *hist)
 {
   if(!fData)
     {
@@ -113,11 +120,12 @@ void AliL3HoughTest::Transform(AliL3Histogram *hist)
   Int_t pad,charge,sector,row;
   for(Int_t i=AliL3Transform::GetFirstRow(fCurrentPatch); i<=AliL3Transform::GetLastRow(fCurrentPatch); i++)
     {
+      Int_t rowindex = i - AliL3Transform::GetFirstRow(fCurrentPatch);
       AliL3Transform::Slice2Sector(0,i,sector,row);
-      for(Int_t j=0; j<fData[i].npads; j++)
+      for(Int_t j=0; j<fData[rowindex].npads; j++)
        {
-         pad = j + fData[i].minpad;
-         charge = fData[i].pads[j];
+         pad = j + fData[rowindex].minpad;
+         charge = fData[rowindex].pads[j];
          
          AliL3Transform::Raw2Local(xyz,sector,row,pad,0);
 
@@ -135,7 +143,7 @@ void AliL3HoughTest::Transform(AliL3Histogram *hist)
     }
 }
 
-void AliL3HoughTest::TransformC(AliL3Histogram *hist)
+void AliL3HoughTest::Transform2CircleC(AliL3Histogram *hist)
 {
   if(!fData)
     {
@@ -146,10 +154,11 @@ void AliL3HoughTest::TransformC(AliL3Histogram *hist)
   Float_t r1,r2,phi1,phi2,phi_0,kappa,hit[3],hit2[3];
   for(Int_t i=AliL3Transform::GetFirstRow(fCurrentPatch); i<=AliL3Transform::GetLastRow(fCurrentPatch); i++)
     {
-      for(Int_t d1=0; d1<fData[i].npads; d1++)
+      Int_t rowindex1 = i - AliL3Transform::GetFirstRow(fCurrentPatch);
+      for(Int_t d1=0; d1<fData[rowindex1].npads; d1++)
        {
-         pad1 = d1 + fData[i].minpad;
-         charge1 = fData[i].pads[d1];
+         pad1 = d1 + fData[rowindex1].minpad;
+         charge1 = fData[rowindex1].pads[d1];
          AliL3Transform::Slice2Sector(0,i,sector,row);
          AliL3Transform::Raw2Local(hit,sector,row,pad1,0);
          r1 = sqrt(hit[0]*hit[0]+hit[1]*hit[1]);
@@ -157,15 +166,17 @@ void AliL3HoughTest::TransformC(AliL3Histogram *hist)
          
          for(Int_t j=i+1; j<=AliL3Transform::GetLastRow(fCurrentPatch); j++)
            {
-             for(Int_t d2=0; d2<fData[j].npads; d2++)
+             Int_t rowindex2 = j - AliL3Transform::GetFirstRow(fCurrentPatch);
+             for(Int_t d2=0; d2<fData[rowindex2].npads; d2++)
                {
-                 pad2 = d2 + fData[j].minpad;
-                 charge2 = fData[j].pads[d2];
+                 pad2 = d2 + fData[rowindex2].minpad;
+                 charge2 = fData[rowindex2].pads[d2];
                  AliL3Transform::Slice2Sector(0,j,sector,row);
                  AliL3Transform::Raw2Local(hit2,sector,row,pad2,0);
                  r2 = sqrt(hit2[0]*hit2[0]+hit2[1]*hit2[1]);
                  phi2 = atan2(hit2[1],hit2[0]);
                  phi_0 = atan( (r2*sin(phi1) - r1*sin(phi2)) / (r2*cos(phi1) - r1*cos(phi2)) );
+
                  kappa = 2*sin(phi1-phi_0) / r1;
                  hist->Fill(kappa,phi_0,charge1+charge2);
                }
@@ -174,6 +185,82 @@ void AliL3HoughTest::TransformC(AliL3Histogram *hist)
     }
 }
 
+void AliL3HoughTest::Transform2Line(AliL3Histogram *hist,Int_t *rowrange)
+{
+  if(!fData)
+    {
+      cerr<<"AliL3HoughTest::Transform2Line : No data"<<endl;
+      return;
+    }
+  
+  Int_t pad,charge,sector,row;
+  Float_t hit[3],theta,rho;
+  for(Int_t i=rowrange[0]; i<=rowrange[1]; i++)
+    {
+      Int_t rowindex = i - AliL3Transform::GetFirstRow(fCurrentPatch);
+      for(Int_t d=0; d<fData[rowindex].npads; d++)
+       {
+         pad = d + fData[rowindex].minpad;
+         charge = fData[rowindex].pads[d];
+         AliL3Transform::Slice2Sector(0,i,sector,row);
+         AliL3Transform::Raw2Local(hit,sector,row,pad,0);
+         
+         hit[0] = hit[0] - AliL3Transform::Row2X(rowrange[0]);
+         
+         for(Int_t xbin=hist->GetFirstXbin(); xbin<hist->GetLastXbin(); xbin++)
+           {
+             theta = hist->GetBinCenterX(xbin);
+             rho = hit[0]*cos(theta) + hit[1]*sin(theta);
+             hist->Fill(theta,rho,charge);
+           }
+       }
+    }
+}
+
+void AliL3HoughTest::Transform2LineC(AliL3Histogram *hist,Int_t *rowrange)
+{
+  if(!fData)
+    {
+      cerr<<"AliL3HoughTest::Transform2Line : No data"<<endl;
+      return;
+    }
+  
+  Int_t pad1,pad2,charge1,charge2,sector,row;
+  Float_t theta,rho,hit[3],hit2[3];
+  for(Int_t i=rowrange[0]; i<=rowrange[1]; i++)
+    {
+      Int_t rowindex1 = i - AliL3Transform::GetFirstRow(fCurrentPatch);
+      for(Int_t d1=0; d1<fData[rowindex1].npads; d1++)
+       {
+         pad1 = d1 + fData[rowindex1].minpad;
+         charge1 = fData[rowindex1].pads[d1];
+         AliL3Transform::Slice2Sector(0,i,sector,row);
+         AliL3Transform::Raw2Local(hit,sector,row,pad1,0);
+         
+         hit[0] = hit[0] - AliL3Transform::Row2X(rowrange[0]);
+         
+         for(Int_t j=i+1; j<=rowrange[1]; j++)
+           {
+             Int_t rowindex2 = j - AliL3Transform::GetFirstRow(fCurrentPatch);
+             for(Int_t d2=0; d2<fData[rowindex2].npads; d2++)
+               {
+                 pad2 = d2 + fData[rowindex2].minpad;
+                 charge2 = fData[rowindex2].pads[d2];
+                 AliL3Transform::Slice2Sector(0,j,sector,row);
+                 AliL3Transform::Raw2Local(hit2,sector,row,pad2,0);
+                 
+                 hit2[0] = hit2[0] - AliL3Transform::Row2X(rowrange[0]);
+                 
+                 theta = atan2(hit2[0]-hit[0],hit[1]-hit2[1]);
+                 rho = hit[0]*cos(theta)+hit[1]*sin(theta);
+                 hist->Fill(theta,rho,charge1+charge2);
+               }
+           }
+       }
+    }
+}
+
+
 void AliL3HoughTest::FillImage(TH2 *hist)
 {
   if(!fData)
@@ -183,10 +270,11 @@ void AliL3HoughTest::FillImage(TH2 *hist)
     }
   for(Int_t i=AliL3Transform::GetFirstRow(fCurrentPatch); i<=AliL3Transform::GetLastRow(fCurrentPatch); i++)
     {
-      for(Int_t j=0; j<fData[i].npads; j++)
+      Int_t rowindex = i - AliL3Transform::GetFirstRow(fCurrentPatch);
+      for(Int_t j=0; j<fData[rowindex].npads; j++)
        {
-         Int_t pad = j + fData[i].minpad;
-         Int_t charge = fData[i].pads[j];
+         Int_t pad = j + fData[rowindex].minpad;
+         Int_t charge = fData[rowindex].pads[j];
          Float_t xyz[3];
          Int_t sector,row;
          AliL3Transform::Slice2Sector(0,i,sector,row);
index 431f63f..49db453 100644 (file)
@@ -23,11 +23,13 @@ class AliL3HoughTest {
   AliL3HoughTest(); 
   virtual ~AliL3HoughTest();
   
-  void GenerateTrackData(Double_t pt,Double_t psi,Int_t patch);
+  Bool_t GenerateTrackData(Double_t pt,Double_t psi,Int_t sign,Int_t patch,Int_t minhits);
   void FillImage(TH2 *hist);
-  void Transform(AliL3Histogram *hist);
-  void TransformC(AliL3Histogram *hist);
-
+  void Transform2Circle(AliL3Histogram *hist);
+  void Transform2CircleC(AliL3Histogram *hist);
+  void Transform2Line(AliL3Histogram *hist,Int_t *rowrange);
+  void Transform2LineC(AliL3Histogram *hist,Int_t *rowrange);
+  
   ClassDef(AliL3HoughTest,1) //Hough transform base class
 };