Moved from AliTransbit to AliL3Transbit.
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Sep 2002 13:23:08 +0000 (13:23 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Sep 2002 13:23:08 +0000 (13:23 +0000)
HLT/misc/AliL3TransBit.cxx [moved from HLT/misc/AliTransBit.cxx with 55% similarity]
HLT/misc/AliL3TransBit.h [moved from HLT/misc/AliTransBit.h with 60% similarity]

similarity index 55%
rename from HLT/misc/AliTransBit.cxx
rename to HLT/misc/AliL3TransBit.cxx
index ccc7438..02a8f6e 100644 (file)
@@ -1,70 +1,53 @@
-///////////////////////////////////////////////////////////////////////////////
-//                                                                           //
-//  Time Projection Chamber ADC bit compresion lookup table                  //
-//                                                                           // 
-//
-//  Origin: Marian Ivanov , GSI Darmstadt                                   // 
-//                                                                          //
-
-//  
-/*
-  Conversion equation:  
-  For AliTransBit_v1   
-  dy/dx= Int_t(1+x/fX0)
+//$Id$
 
-  For AliTransBit_v2    
-  y  =(2**bit0) ln(1+x/fX0) / ln(1+(2**bit1-1)/fX0)                        
-  
-  where x0 is calculated in function GetOptimumX0()
-    
-*/
-
-// Example Session                                                          // 
-/*
-
-Int_t b0=10;  // original number of bits
-  Int_t b1=8;   // compressed
-
-  AliTransBit_v1 trans;
-  Int_t x0=TMath::Nint(TMath::Exp(b0*TMath::Log(2)));
-  Int_t x1=TMath::Nint(TMath::Exp(b1*TMath::Log(2)));  
-  trans.SetBits(b0,b1);
-  trans.FindOptimumX0();
-  trans.Update();
-  cout<<trans.Get0to1(x0-2)<<"\n";
-  cout<<trans.Get1to0(x1-2)<<"\n";
-   
-  // to produce table of 
-  for( Int_t i=0;i<x1;i++) cout<<i<<"\t"<<trans.Get1to0(i)<<"\n"; > table1to0.txt
-  for( Int_t i=0;i<x0;i++) cout<<i<<"\t"<<trans.Get0to1(i)<<"\n"; > table0to1.txt
-
-  for( Int_t i=0;i<x1-1;i++) cout<<i<<"\t"<<trans.Get1to0(i+1)-trans.Get1to0(i)<<"\n"; > tabled.txt
-
-  
-
-*/
-//Begin_Html                                                                //
-/*                                                                          // 
-<img src="gif/AliTPCTransBit.gif">  
-*/
-//End_Html
-//                                                                           //
-//                                                                          //
-///////////////////////////////////////////////////////////////////////////////
+// Original author: Marian Ivanov, GSI Darmstadt for AliROOT
+// migrated to L3 by Anders Vestbo <mailto:vestbo@fi.uib.no>
+//*-- Copyright & copy ASV
 
 #include "AliL3StandardIncludes.h"
 
-#include "AliTransBit.h"
+#include "AliL3TransBit.h"
 
-ClassImp(AliTransBit)
-ClassImp(AliTransBit_v1)
-ClassImp(AliTransBit_v2)
+//_____________________________________________________________
+// AliL3Transbit (taken from the offline AliROOT code)
+//
+// Time Projection Chamber ADC bit compresion lookup table
+//
+//  Conversion equation:
+//    For AliTransBit_v1
+//    dy/dx= Int_t(1+x/fX0)
+//
+//    For AliTransBit_v2
+//    y  =(2**bit0) ln(1+x/fX0) / ln(1+(2**bit1-1)/fX0)
+//
+//    where x0 is calculated in function GetOptimumX0()
+//
+//  Example session in aliroot:
+//    Int_t b0=10;  // original number of bits
+//    Int_t b1=8;   // compressed
+//
+//    AliTransBit_v1 trans;
+//    Int_t x0=TMath::Nint(TMath::Exp(b0*TMath::Log(2)));
+//    Int_t x1=TMath::Nint(TMath::Exp(b1*TMath::Log(2)));
+//    trans.SetBits(b0,b1);
+//    trans.FindOptimumX0();
+//    trans.Update();
+//    cout<<trans.Get0to1(x0-2)<<"\n";
+//    cout<<trans.Get1to0(x1-2)<<"\n";
+//
+//    // to produce table
+//    for( Int_t i=0;i<x1;i++) cout<<i<<"\t"<<trans.Get1to0(i)<<"\n"; > table1to0.txt
+//    for( Int_t i=0;i<x0;i++) cout<<i<<"\t"<<trans.Get0to1(i)<<"\n"; > table0to1.txt
+//
+//    for( Int_t i=0;i<x1-1;i++) cout<<i<<"\t"<<trans.Get1to0(i+1)-trans.Get1to0(i)<<"\n"; > tabled.txt
+//
 
+ClassImp(AliL3TransBit)
+ClassImp(AliL3TransBit_v1)
+ClassImp(AliL3TransBit_v2)
 
-AliTransBit::AliTransBit()
+AliL3TransBit::AliL3TransBit()
 {
-  //
-  //
   fTable0 = 0;
   fTable1 = 0;
   fBit0   = 10;
@@ -72,23 +55,16 @@ AliTransBit::AliTransBit()
   fX0     = 0;
 }
 
-AliTransBit::~AliTransBit() 
+AliL3TransBit::~AliL3TransBit() 
 {
-  //
   //default destructor
   if (fTable0!=0) delete [] fTable0;
   if (fTable1!=0) delete [] fTable1;
 }
 
-
-
-
-
-Double_t AliTransBit_v1::FindOptimumX0()
+Double_t AliL3TransBit_v1::FindOptimumX0()
 {
-  //
   //find x0 for which derivation at xder1 is equal 1
-  //
   Int_t x0=(Int_t)rint(exp(fBit0*log(2.)));
   Int_t x1=(Int_t)rint(exp(fBit1*log(2.)));
 
@@ -110,11 +86,9 @@ Double_t AliTransBit_v1::FindOptimumX0()
   return fX0;
 }
 
-
-void AliTransBit_v1::Update()
+void AliL3TransBit_v1::Update()
 {
-  //
-  //construct lookup tables for loosy compresion from 
+  //construct lookup tables for loosy compression from 
   if (fX0<1) fX0 = FindOptimumX0();  
   Int_t x0=(Int_t)rint(exp(fBit0*log(2.)));
   Int_t x1=(Int_t)rint(exp(fBit1*log(2.)));
@@ -125,26 +99,24 @@ void AliTransBit_v1::Update()
   //fTable1 - conversion table from bit1 to bit0 coding
   if (fTable1!=0) delete [] fTable1;
   fTable1= new Int_t[x1];
-  //   
+
   Int_t digit=0;
   for (Int_t  i=0; i<x1-1;i++){    
     Int_t ddig=Int_t(1+Double_t(i)/fX0);
     for (Int_t j=0;j<ddig;j++) if ((digit+j)<x0) fTable0[digit+j] = i;    
     fTable1[i]= digit+ddig/2;
     digit+= ddig;
-  } 
+  }
+
   for (Int_t i=digit;i<x0-1;i++) fTable0[i]=x1-2;
   fTable1[x1-1]=x0-1; //overflow 
   fTable0[x0-1]=x1-1; //overflow    
   return;
 }
 
-
-Double_t AliTransBit_v2::FindOptimumX0()
+Double_t AliL3TransBit_v2::FindOptimumX0()
 {
-  //
   //find x0 for which derivation at xder1 is equal 1
-  //
   const Float_t xder1=1;
   const Float_t dx=0.1;
 
@@ -161,10 +133,8 @@ Double_t AliTransBit_v2::FindOptimumX0()
   return fX0;
 }
 
-
-void AliTransBit_v2::Update()
+void AliL3TransBit_v2::Update()
 {
-  //
   //construct lookup tables for loosy compresion from 
   if (fX0<1) fX0 = FindOptimumX0();  
   //Float_t x0=(Int_t)rint(exp(fBit0*log(2.)));
@@ -180,7 +150,6 @@ void AliTransBit_v2::Update()
   if (fTable1!=0) delete [] fTable1;
   fTable1= new Int_t[x1];
 
-  //  
   Int_t i;
 
   for ( i=0; i<x0;i++)
similarity index 60%
rename from HLT/misc/AliTransBit.h
rename to HLT/misc/AliL3TransBit.h
index 6e9c40e..16f60f9 100644 (file)
@@ -1,12 +1,12 @@
-#ifndef ALITRANSBIT_H
-#define ALITRANSBIT_H
+#ifndef ALIL3TRANSBIT_H
+#define ALIL3TRANSBIT_H
 
 #include "AliL3RootTypes.h"
 
-class AliTransBit {
-public:
-  AliTransBit();
-  virtual ~AliTransBit();
+class AliL3TransBit {
+ public:
+  AliL3TransBit();
+  virtual ~AliL3TransBit();
   inline Int_t Get0to1(Int_t val0);
   inline Int_t Get1to0(Int_t val1);
   Int_t GetBit0() {return fBit0;}
@@ -16,45 +16,45 @@ public:
   void SetX0(Double_t x0) {fX0=x0;}
   virtual void Update()=0;
   virtual Double_t FindOptimumX0()=0;
-protected:
+ protected:
   Int_t  * fTable0; //! table
   Int_t  * fTable1; //! table
   Int_t fBit0;
   Int_t fBit1;
   Double_t fX0;
-  ClassDef(AliTransBit,1)  // Tclusters
-};
 
+  ClassDef(AliL3TransBit,1)
+};
 
-class AliTransBit_v1 : public AliTransBit {
-public:
+class AliL3TransBit_v1 : public AliL3TransBit {
+ public:
   virtual void Update();
   virtual Double_t FindOptimumX0();
-protected:
-  ClassDef(AliTransBit_v1,1)  // Tclusters
+ protected:
+  
+  ClassDef(AliL3TransBit_v1,1)
 };
 
-class AliTransBit_v2 : public AliTransBit {
-public:
+class AliL3TransBit_v2 : public AliL3TransBit {
+ public:
   virtual void Update();
   virtual Double_t FindOptimumX0();
-protected:
-  ClassDef(AliTransBit_v2,1)  // Tclusters
-};
+ protected:
 
+  ClassDef(AliL3TransBit_v2,1)
+};
 
-Int_t AliTransBit::Get0to1(Int_t val0)
+Int_t AliL3TransBit::Get0to1(Int_t val0)
 {
-  //
   //return compressed bit values
   return fTable0[val0];
 }
  
-Int_t AliTransBit::Get1to0(Int_t val1)
+Int_t AliL3TransBit::Get1to0(Int_t val1)
 {
   //return uncompressed bit value
   return fTable1[val1];
 }
 
+#endif 
 
-#endif //ALITRANSBIT_H