]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Little bugfixes for new alitroot version.
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 5 Sep 2002 10:55:15 +0000 (10:55 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 5 Sep 2002 10:55:15 +0000 (10:55 +0000)
HLT/programs/Makefile
HLT/programs/gettransform.cxx
HLT/programs/read.cxx
HLT/programs/runit.cxx

index f786559b9fef29fd8e7b2f9126315748aae077e8..878544ec77bacc5a41a049d5aebcdd734f9127e2 100644 (file)
@@ -69,6 +69,10 @@ all : $(PRGS)
 runhough : runhough.o
        $(LD) $< $(LDFLAGS) -o $@
 
 runhough : runhough.o
        $(LD) $< $(LDFLAGS) -o $@
 
+#run hough transform on l3 data.
+runvhdlhough : runvhdlhough.o
+       $(LD) $< $(LDFLAGS) -o $@
+
 #run conventional clusterfinder on altro data
 runvhdlcf : runvhdlcf.o
        $(LD) $< $(LDFLAGS) -o $@
 #run conventional clusterfinder on altro data
 runvhdlcf : runvhdlcf.o
        $(LD) $< $(LDFLAGS) -o $@
@@ -81,9 +85,11 @@ runit : runit.o
 read : read.o
        $(LD) $< $(LDFLAGS) -o $@
 
 read : read.o
        $(LD) $< $(LDFLAGS) -o $@
 
+#convert to binary
 convbin : ali2raw.o
        $(LD) $< $(LDFLAGS) -o $@
 
 convbin : ali2raw.o
        $(LD) $< $(LDFLAGS) -o $@
 
+#get transform values
 gettransform : gettransform.o
        $(LD) $< $(LDFLAGS) -o $@
 
 gettransform : gettransform.o
        $(LD) $< $(LDFLAGS) -o $@
 
index 2f2b0c9e825b83fcd19a020fb3864e8405f20578..1830d60d078bc0da0652f300a5be03684efdcf8d 100644 (file)
@@ -1,30 +1,19 @@
-//#define DOTESTS /* undefine this for getting the parameters */
+//$Id$
 
 
-#ifdef DOTESTS
-#define use_root
-#endif
+//Author: Constantin Loizides <mailto:loizides@ikf.uni-frankfurt.de>
 
 
-#include <stream.h>
-#include <libgen.h>
-#include <math.h>
+/**
+   This program extracts parameters and lookup tables needed for the
+   vhdl implementation of the Hough transform. 
+*/
+
+#include <AliL3StandardIncludes.h>
 #include <AliL3RootTypes.h>
 #include <AliL3Transform.h>
 #include <AliL3Logging.h>
 #include <AliL3Logger.h>
 #include <AliL3MemHandler.h>
 #include <AliL3RootTypes.h>
 #include <AliL3Transform.h>
 #include <AliL3Logging.h>
 #include <AliL3Logger.h>
 #include <AliL3MemHandler.h>
-
-#ifdef use_root
-#include <TApplication.h>
-#include <TCanvas.h>
-#include <TPad.h>
-#include <TH1.h>
-#include <TMath.h>
-#endif
-
-/**
-   This program extracts parameters and lookup tables needed for the
-   vhdl implementation of the Hough transform. 
-*/
+#include <AliL3HoughTransformerVhdl.h>
 
 int main(int argc,char **argv)
 {
 
 int main(int argc,char **argv)
 {
@@ -55,223 +44,9 @@ int main(int argc,char **argv)
   AliL3Transform::Init(path);
   //cerr << "Transform version: " << AliL3Transform::GetVersion() << endl;
 
   AliL3Transform::Init(path);
   //cerr << "Transform version: " << AliL3Transform::GetVersion() << endl;
 
-  Int_t npads=0;
-  Int_t sector=0;
-  Int_t sector_row=0;
-
-  Float_t Xt[200];
-  Float_t Yt[200];
-
-
-#ifdef DOTESTS /* do some tests in root histos */
-#ifdef use_root
-  Float_t xbins[126];
-  for(int t=0;t<126;t++){
-    Float_t eta=exp(2.*1./125*t);
-    xbins[t]=(eta-1)/(1+eta);
-    //cout << eta << " " << xbins[t] << endl;
-  }
-
-  TApplication theApp("App", &argc, argv);
-  
-  TCanvas *c = new TCanvas("c", "The Histogram Canvas", 800, 800);
-  TPad *pad1 = new TPad("pad1","Pad for Eta",0.05,0.50,0.95,0.95,21);
-  TPad *pad2 = new TPad("pad2","Pad for Tests",0.05,0.05,0.95,0.45,21);
-  //  TH1F *h1f = new TH1F("h1f","Eta Distribution",125,0,1.);
-  TH1F *h1f = new TH1F("h1f","Test Error",100,90,110);
-  TH1F *h2f = new TH1F("h2f","Test Distribution",1000,0,10);
-  //  TH1F *h2f = new TH1F("h2f","Test Distribution",125,xbins);
-  pad1->Draw();
-  pad2->Draw();
-  pad1->cd();
-#endif
-
-  Int_t ntime=AliL3Transform::GetNTimeBins();
-  Float_t xyz[3]={0,0,0};
-  Float_t rpe[3]={0,0,0};
-  int rebinned=0;
-  for(Int_t rr=AliL3Transform::GetFirstRow(patch);rr<=AliL3Transform::GetLastRow(patch);rr++){
-    npads=AliL3Transform::GetNPads(rr);
-    AliL3Transform::Slice2Sector(slice,rr,sector,sector_row);
-    for(Int_t pp=0;pp<npads;pp++){
-      for (Int_t tt=0;tt<ntime;tt++){
-       AliL3Transform::Raw2Local(xyz,sector,sector_row,pp,tt);
-       AliL3Transform::XYZtoRPhiEta(rpe,xyz);
-#ifdef use_root
-       if(!rebinned) {
-         h2f->SetBins(500,0,252.*252/xyz[0]/xyz[0]);
-         rebinned=1;
-       }
-       //h1f->Fill(rpe[2]);
-       //h2f->Fill(xyz[2]/rpe[0]);
-       Float_t A2=xyz[2]*xyz[2]/(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
-       Float_t Sroot=1./TMath::Sqrt(1.+A2);
-       Int_t bin=h2f->FindBin(A2);
-       Double_t binCenter = h2f->GetBinCenter(bin);
-       Double_t binCenterval = 1./TMath::Sqrt(1.+binCenter);
-       Float_t err=(Sroot*100./binCenterval);
-       h1f->Fill(err);
-       h2f->Fill(A2);
-       //printf("%.3f %.3f %.3f\n",Sroot,binCenter,err);
-#endif
-       //printf("%d %d %d %f %f %f %f %f %f\n",rr,pp,tt,xyz[0],xyz[1],xyz[2],rpe[0],rpe[1],rpe[2]);
-      }
-    }
-  }
-#else /* do the extraction of the parameters */
-  Int_t firstrow=AliL3Transform::GetFirstRow(patch);
-  Int_t lastrow=AliL3Transform::GetLastRow(patch);
-  AliL3Transform::Slice2Sector(slice,firstrow,sector,sector_row);
-
-  Float_t ytabval=0;
-  //Int_t maxrow=NRows[patch][1]-NRows[patch][0];
-  Int_t maxrow=AliL3Transform::GetNRows(patch);  
-  Float_t padpitch=0;
-  if(sector<AliL3Transform::GetNSectorLow())
-    padpitch=AliL3Transform::GetPadPitchWidthLow();
-  else
-    padpitch=AliL3Transform::GetPadPitchWidthUp();  
-
-  printf("MinRow: %d\nMaxRow: %d\n",0,maxrow);
-  printf("YPadWidth: %.2f\n",padpitch);
-  printf("ZSign: %d\n",slice < 18 ? 1:-1);
-  //printf("ZWidth: %.2f\n",AliL3Transform::GetZWidth());
-  printf("ZWidth: %.2f\n",AliL3Transform::GetZLength()+AliL3Transform::GetZOffset());
-  printf("TimeWidth: %.2f\n\n",AliL3Transform::GetZWidth());
-
-  //calculating lookup tables for slice and patch!
-  for(Int_t rr=firstrow;rr<=lastrow;rr++){
-    npads=AliL3Transform::GetNPads(rr);
-    
-    //Y(row,pad)=pad*padpitch-ytabval(row);
-    ytabval=0.5*(npads-1)*padpitch;
-
-    Xt[rr-firstrow]=AliL3Transform::Row2X(rr);
-    Yt[rr-firstrow]=ytabval;
-    //row in patch: X(row) Y_part(row)
-    printf("Row: %d X: %.2f Y: %.2f\n",rr-firstrow,AliL3Transform::Row2X(rr),ytabval);
-  }
-  printf("\n\nVHDL-Output for LUT:\nX_table := (");
-  for(int i=0;i<maxrow-1;i++){
-    printf("%.2f, ",Xt[i]);
-  }
-  printf("%.2f);\n",Xt[maxrow-1]);
-  printf("Y_table := (");
-  for(int i=0;i<maxrow-1;i++){
-    printf("%.2f, ",Yt[i]);
-  }
-  printf("%.2f);\n",Yt[maxrow-1]);
-#endif
-
-#ifdef DOTESTS 
-#ifdef use_root
-  h1f->Draw();
-  pad2->cd();
-  h2f->Draw();
-  c->Update();
-
-  theApp.Run();
-#endif
-#endif
-
+  AliL3HoughTransformerVhdl vtest(slice,patch,100,10);
+  vtest.CreateHistograms(64,0.1,64,-30,30);
+  vtest.PrintVhdl();
   exit(0);
 }
   
   exit(0);
 }
   
-//#############################################################
-
-#if 0
-  AliL3MemHandler file; //Does all the file/data handling
-
-  //Open the data file:
-  if(!file.SetBinaryInput(digitfile))
-    {
-      cerr<<"Error opening file "<< digitfile <<endl;
-      return -1;
-    }
-  
-  //Store the data in memory, and get the pointer to it:
-  unsigned int ndigits=0;
-  AliL3DigitRowData *digits=0;
-  digits=(AliL3DigitRowData*)file.CompBinary2Memory(ndigits);
-  file.CloseBinaryInput();
-  
-  /*  
-  for(Int_t r=0; r<31; r++) {
-    UInt_t padrow=digits->fRow;
-    AliL3DigitData *dPt = (AliL3DigitData*)digits->fDigitData;
-    cout<<"padrow "<<padrow<<" ndigits "<<digits->fNDigit<<endl;
-         
-    for(Int_t d=0; d<digits->fNDigit; d++) {
-      cout<<" padrow "<<padrow<<" pad "<<(int)dPt[d]->fPad<<" time " <<(int)dPt[d]->fTime<<" charge "<<(int)dPt[d]->fCharge<<endl;
-    }
-    file->UpdateRowPointer(digits);
-  }
-  return 100;
-  */
-    
-  digits=(AliL3DigitRowData*)file->GetDataPointer(ndigits);
-  AliL3Transform transform; //Storing all detector-spesific quantities, needed by the clusterfinder.
-  AliL3ClustFinderNew cf(&transform); //The cluster finder itself.
-
-  //Switch off deconvolution:
-  cf.SetDeconv(false);
-  cf.SetXYError(0.2);
-  cf.SetZError(0.3);
-
-  //Init cluster finder
-  cf.InitSlice(0,0,0,20,10000);
-  
-  //Give the data pointer to the cluster finder
-  cf.Read(ndigits,digits);
-  cout << digits << endl;
-  //Start processing:
-  cf.ProcessDigits();
-  
-/* 
- int slice=1;
-  a = new AliL3Hough(digitfile,kTRUE,n_eta_segments);
-  
-  a->ReadData(slice);
-  
-  a->Transform();
-  a->AddAllHistograms();
-    
-  c1 = new TCanvas("c1","",2);
-  a->GetTransformer(0)->GetHistogram(0)->Draw("box");
-  
-  
-  a->FindTrackCandidates();
-  //a->Evaluate(2);
- */ 
-  /*
-  //Display the track:
-  dhist = new AliL3Histogram("dhist","",250,0,250,250,-125,125);
-  for(int i=0; i<6; i++)
-    a->GetEval(i)->DisplayEtaSlice(0,dhist);
-  c2 = new TCanvas("c2","",2);
-  dhist->Draw();
-  */
-  
-  //a->WriteTracks();//"../compression/");
-    
-/*
-  tracks = (AliL3TrackArray*)a->GetTracks(0);
-   
-  float xyz[3];
-  int row=0;
-  cout<<"Found "<<tracks->GetNTracks()<<" tracks"<<endl;
-  for(int i=0; i<tracks->GetNTracks(); i++)
-    {
-      AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
-      if(!track) continue;
-      //track->GetCrossingPoint(row,xyz);
-      //transform->Local2Raw(xyz,1,row);
-      //cout<<"Recon. pad "<<(int)xyz[1]<<" time "<<(int)xyz[2]<<endl;
-      cout<<"Pt "<<track->GetPt()<<" phi "<<track->GetPhi0()<<" charge "<<track->GetCharge()<<" weigth "<<track->GetWeight()<<endl;
-    }
-*/
-  
-  return;
-}
-
-#endif  
index 8c8d547909ec6979d0b5c530deea54f476ed5ef0..c576bf303ae44fdabd939d3acf54d8e2af5f4a62 100644 (file)
@@ -102,7 +102,8 @@ int main(int argc,char **argv)
          pad = dataPt[ndig].fPad;
          time = dataPt[ndig].fTime;
          charge = dataPt[ndig].fCharge;
          pad = dataPt[ndig].fPad;
          time = dataPt[ndig].fTime;
          charge = dataPt[ndig].fCharge;
-         cout << "Padrow " << row << " pad " << (int)pad << " time " <<(int) time << " charge " << (int)charge << endl;
+         cout << "Padrow " << r << " pad " << (int)pad << " time " <<(int) time << " charge " << (int)charge << endl;
+         //      cout << "Padrow " << row << " pad " << (int)pad << " time " <<(int) time << " charge " << (int)charge << endl;
          if(altroout) altromem.Write(row,pad,time,charge);
        }
       
          if(altroout) altromem.Write(row,pad,time,charge);
        }
       
index c3e99f4bdf946993319249d326ef1dace8b090d7..56f304c134b3c4e811e7ad039ee3f25c761cd362 100644 (file)
@@ -67,7 +67,7 @@ int main(int argc,char **argv)
   //Give slice and patch information (see filename convention)
   if((patch>=0)&&(patch<6)) file.Init(slice,patch);
   else {
   //Give slice and patch information (see filename convention)
   if((patch>=0)&&(patch<6)) file.Init(slice,patch);
   else {
-    Int_t srows[2]={0,175};
+    Int_t srows[2]={0,AliL3Transform::GetLastRow(5)};
     patch=0;
     file.Init(slice,patch,srows);
   }
     patch=0;
     file.Init(slice,patch,srows);
   }