Moved to the latest version of the HLT code in Bergen.
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Feb 2004 15:00:34 +0000 (15:00 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 2 Feb 2004 15:00:34 +0000 (15:00 +0000)
Most important changes, since last checkin are:

a) Static Index in AliL3Filehandler to speed up IO

b) LUT Hough transformation improving track candidate
finding by a factor of 3

c) Changes related to how the track parameters are calculated and stored.
There should be no changes for normal use, i.e. the function calls are
still the same. The changes are the following:
- Most importantly, the first point on a track (accessible via
AliL3Track::GetFirstPoint()) is now calculated as the point lying on the helix
fit. Earlier, this point was just the coordinates of the innermost assigned
cluster of the track. This is in principle ok if you just want the quick
"global" coordinates of the track; momentum etc.  However, for precisce local
calculations such as residuals, this point should be the point of closest
approach lying on the helix fit. If not, the calculated track parameters (such
as center of curvature) will be slightly shifted. The tracks are updated to the
first point if the AliLevel3::fIsTracksAtFirstPoint is set to true (which is
default). If this is not desired, and the track should be defined at the vertex
(not DCAO!), you can still do AliLevel3::SetTracks2Vertex().

d) A new static boolean has been introduced in AliLevel3::fDoVertexFit, which
tells the track fitter to include the vertex in the fit or not.

e)Change in interface of updating tracks, instead of using the fitter class,
use track->UpdatetoFistPoint (see deconvoluter macro).

67 files changed:
HLT/Makefile.conf
HLT/Makefile.rules
HLT/comp/AliL3ClusterFitter.cxx
HLT/comp/AliL3CompLinkDef.h
HLT/comp/AliL3Compress.cxx
HLT/comp/AliL3Compress.h
HLT/comp/AliL3DataCompressor.cxx
HLT/comp/AliL3DataCompressor.h
HLT/comp/AliL3DataCompressorHelper.cxx [new file with mode: 0644]
HLT/comp/AliL3DataCompressorHelper.h [new file with mode: 0644]
HLT/comp/AliL3FitUtilities.h
HLT/comp/AliL3ModelTrack.cxx
HLT/comp/AliL3ModelTrack.h
HLT/comp/AliL3Models.h
HLT/comp/AliL3OfflineDataCompressor.cxx
HLT/comp/AliL3OfflineDataCompressor.h
HLT/comp/Makefile
HLT/doc/changelog.comp
HLT/doc/changelog.doc
HLT/doc/changelog.exa
HLT/doc/changelog.hough
HLT/doc/changelog.kalman
HLT/doc/changelog.misc
HLT/doc/changelog.src
HLT/doc/changelog.top
HLT/exa/SetFitParameters.C
HLT/exa/SetHoughParameters.C
HLT/exa/deconvclusters.C
HLT/exa/rootlogon.C
HLT/exa/runhough.C
HLT/exa/runtracker.C
HLT/hough/AliL3Histogram.cxx
HLT/hough/AliL3Histogram.h
HLT/hough/AliL3HistogramAdaptive.cxx
HLT/hough/AliL3HistogramAdaptive.h
HLT/hough/AliL3Hough.cxx
HLT/hough/AliL3HoughBaseTransformer.cxx
HLT/hough/AliL3HoughBaseTransformer.h
HLT/hough/AliL3HoughLinkDef.h
HLT/hough/AliL3HoughTransformer.cxx
HLT/hough/AliL3HoughTransformerLUT.cxx
HLT/hough/AliL3HoughTransformerLUT.h
HLT/hough/AliL3HoughTransformerNew.cxx
HLT/hough/AliL3HoughTransformerVhdl.h
HLT/hough/Makefile
HLT/kalman/AliL3Kalman.cxx
HLT/misc/AliL3DDLRawReader.h
HLT/misc/AliL3DDLRawReaderFile.h
HLT/misc/AliL3DDLTPCRawStream.h
HLT/misc/AliL3MiscLinkDef.h
HLT/misc/Makefile
HLT/src/AliL3ConfMapFit.cxx
HLT/src/AliL3ConfMapTrack.cxx
HLT/src/AliL3FileHandler.cxx
HLT/src/AliL3FileHandler.h
HLT/src/AliL3Fitter.cxx
HLT/src/AliL3Fitter.h
HLT/src/AliL3GlobalMerger.h
HLT/src/AliL3InterMerger.h
HLT/src/AliL3SrcLinkDef.h
HLT/src/AliL3Track.cxx
HLT/src/AliL3TrackArray.cxx
HLT/src/AliL3TrackMerger.h
HLT/src/AliL3Transform.h
HLT/src/AliLevel3.cxx
HLT/src/AliLevel3.h
HLT/src/Makefile

index 3c24264..833be2e 100644 (file)
@@ -6,6 +6,9 @@
 #         Constantin Loizide   #                    
 ################################
 
+#Added for MACOSX
+ARCH = $(shell uname)
+
 #Specify the directory where the level3code tree is located.
 ifndef ALIHLT_TOPDIR
 ALIHLT_TOPDIR = $(HOME)/workcode/level3code
@@ -66,18 +69,33 @@ endif
 #own setting by defining them outside (make -e)
 #----------------------------------------------------
 
-CXX          = g++
-LD           = $(CXX)
 GCCVERSION   = $(shell $(CXX) --version | head -n 1 | cut -d" " -f 3 | cut -d. -f 1 | cut -d" " -f1)
-
 CXXGCC3FLAGS = -DGCCVERSION=$(GCCVERSION)
+
+ifeq ($(ARCH),Darwin)
+FINKDIR         = /sw
+CXX             = g++
+CXXFLAGS        = -O -pipe -Wall -fsigned-char $(CXXGCC3FLAGS) $(EXTRACXXFLAGS)
+LD              = $(CXX)
+#SOFLAGS         = -bundle -flat_namespace -Xlinker -bind_at_load -undefined suppress
+SOFLAGS         = -bundle -flat_namespace -undefined suppress
+DYFLAGS         = -dynamiclib -flat_namespace -undefined suppress \
+                  -compatibility_version 1 -current_version 1.0.0 
+LDFLAGS         = -O $(EXTRALDFLAGS) -L/sw/lib -ldl
+
+CINTCXXFLAGS  = -pipe -W -Wall -fsigned-char \
+                -DG__REGEXP  -DG__UNIX -DG__SHAREDLIB \
+                -DG__ROOT -DG__REDIRECTIO -DG__OSFDLL
+else
+CXX          = g++
+LD           = $(CXX)
 #CXXGCC3FLAGS += -pedantic
 #CXXGCC3FLAGS += -Wno-deprecated
 #CXXGCC3FLAGS += -Woverloaded-virtual
 
 #If you are compiling on the alpha, use this flag:
 #EXTRACXXFLAGS += -mcpu=ev6
-
 CXXFLAGS     = -O2 -Wall -fPIC $(CXXGCC3FLAGS) $(EXTRACXXFLAGS) 
 LDFLAGS      = -O2 $(EXTRALDFLAGS)
 SOFLAGS      = -shared
+endif
index ed82709..a97d819 100644 (file)
@@ -13,7 +13,7 @@
 
 DEFSTR = -Dno_root
 OBJDIR = lib_alone
-INCLUDES = -I$(ALIHLT_TOPDIR)/hough -I$(ALIHLT_TOPDIR)/src -I$(ALIHLT_TOPDIR)/comp -I$(ALIHLT_TOPDIR)/misc -I$(ALIHLT_TOPDIR)/trigger -I$(ALIHLT_TOPDIR)/kalman
+INCLUDES = -I$(ALIHLT_TOPDIR)/src -I$(ALIHLT_TOPDIR)/hough -I$(ALIHLT_TOPDIR)/comp -I$(ALIHLT_TOPDIR)/misc -I$(ALIHLT_TOPDIR)/trigger -I$(ALIHLT_TOPDIR)/kalman
 
 ifeq ($(ALIHLT_USEPACKAGE),ROOT) 
 INCLUDES += -I$(ROOTSYS)/include 
@@ -54,7 +54,7 @@ INCLUDES += -I/prog/alice/level3/kip/MLUC/include
 endif
 endif
 
-DEFSTR += $(EXTRADEF)
+DEFSTR += -D$(ARCH) $(EXTRADEF)
 
 DICT  = $(MODNAME)Cint-$(ALIHLT_USEPACKAGE).cxx
 DICTH = $(MODNAME)Cint-$(ALIHLT_USEPACKAGE).h
@@ -71,6 +71,7 @@ endif
 endif
 
 ALIHLT_LIBSO = $(ALIHLT_LIBDIR)/lib$(MODNAME).so
+ALIHLT_DYLIB = $(ALIHLT_LIBDIR)/lib$(MODNAME).dylib
 
 #Default Targets  
 #
@@ -78,11 +79,16 @@ ALIHLT_LIBSO = $(ALIHLT_LIBDIR)/lib$(MODNAME).so
 all: $(OBJDIR) $(ALIHLT_LIBDIR) $(ALIHLT_LIBSO) 
 
 $(ALIHLT_LIBSO): $(OBJS)
-       $(LD) $(SOFLAGS) $(LDFLAGS) $^ -o $@
+ifeq ($(ARCH),Darwin)
+       $(LD) $(DYFLAGS) $^ $(LDFLAGS) -o $(ALIHLT_DYLIB)
+endif
+       $(LD) $(SOFLAGS) $^ $(LDFLAGS) -o $@
+
 
 $(DICT): $(HDRS)
        @echo "Generating dictionary..."
-       rootcint -f $(DICT) -c $(INCLUDES) -DGCCVERSION=$(GCCVERSION) $(DEFSTR) -include AliL3StandardIncludes.h $(HDRS)
+       rootcint -f $(DICT) -c $(CINTCXXFLAGS) $(INCLUDES) -DGCCVERSION=$(GCCVERSION) \
+                    $(DEFSTR) -include AliL3StandardIncludes.h $(HDRS)
 
 $(OBJDIR)/%.o: %.cxx 
        $(CXX) $(CXXFLAGS) $(DEFSTR) -c $(INCLUDES) -o $@ $<
@@ -124,7 +130,7 @@ clean:
        rm -rf $(OBJDIR)
 
 so:
-       rm -f $(ALIHLT_LIBSO)
+       rm -f $(ALIHLT_LIBSO) $(ALIHLT_DYLIB)
 
 realclean: clean so
 
index 72d7179..b4002a9 100644 (file)
@@ -710,7 +710,8 @@ Bool_t AliL3ClusterFitter::IsMaximum(Int_t pad,Int_t time)
 
 void AliL3ClusterFitter::CalculateWeightedMean(AliL3ModelTrack *track,Int_t *padrange,Int_t *timerange)
 {
-  Float_t sum=0,npads=0;
+  Float_t sum=0;
+  Int_t npads=0;
   Float_t pad=0,time=0;
   Int_t nt = AliL3Transform::GetNTimeBins()+1;
   for(Int_t i=padrange[0]; i<=padrange[1]; i++)
@@ -1122,8 +1123,8 @@ void AliL3ClusterFitter::AddClusters()
          
          tr->CalculateClusterWidths(i,kTRUE); //Parametrize errors
          
-         tr->GetXYWidth(i,xywidth);
-         tr->GetZWidth(i,zwidth);
+         tr->GetSigmaY2(i,xywidth);
+         tr->GetSigmaZ2(i,zwidth);
          Float_t xyz[3];
          Int_t sector,row;
          AliL3Transform::Slice2Sector(fSlice,i,sector,row);
index 6953025..f812c49 100644 (file)
@@ -7,11 +7,16 @@
 #pragma link off all functions;
 
 #pragma link C++ class AliL3Modeller; 
+#ifndef Darwin
 #pragma link C++ class AliL3ModelTrack; 
+#endif
 #pragma link C++ class AliL3Compress; 
 #pragma link C++ class AliL3ClusterFitter; 
 #pragma link C++ class AliL3DataCompressor; 
-
+#pragma link C++ class AliL3ClusterModel; 
+#ifndef Darwin
+#pragma link C++ class AliL3DataCompressorHelper; 
+#endif
 #ifdef use_aliroot
 #pragma link C++ class AliL3OfflineDataCompressor; 
 #endif
index 370bb52..d3a289f 100644 (file)
@@ -14,6 +14,7 @@
 #include "AliL3ModelTrack.h"
 #include "AliL3Transform.h"
 #include "AliL3MemHandler.h"
+#include "AliL3DataCompressorHelper.h"
 #include "AliL3DataCompressor.h"
 #include "AliL3SpacePointData.h"
 
@@ -254,13 +255,14 @@ Bool_t AliL3Compress::CompressFile()
            OutputBit(output,0);
          else
            OutputBit(output,1);
-         power = 1<<(AliL3DataCompressor::GetNTimeBits()-1);
+         power = 1<<(AliL3DataCompressorHelper::GetNTimeBits()-1);
          if(abs(temp)>=power)
            {
+             //cout<<abs(temp)<<" "<<power<<endl;
              timeo++;
              temp=power - 1;
            }
-         OutputBits(output,abs(temp),(AliL3DataCompressor::GetNTimeBits()-1));
+         OutputBits(output,abs(temp),(AliL3DataCompressorHelper::GetNTimeBits()-1));
          
          //Write pad information:
          temp = (Int_t)rint(cluster.fDPad);
@@ -268,52 +270,52 @@ Bool_t AliL3Compress::CompressFile()
            OutputBit(output,0);
          else
            OutputBit(output,1);
-         power = 1<<(AliL3DataCompressor::GetNPadBits()-1);
+         power = 1<<(AliL3DataCompressorHelper::GetNPadBits()-1);
          if(abs(temp)>=power)
            {
              pado++;
              temp=power - 1;
            }
-         OutputBits(output,abs(temp),(AliL3DataCompressor::GetNPadBits()-1));
+         OutputBits(output,abs(temp),(AliL3DataCompressorHelper::GetNPadBits()-1));
          
          //Write charge information:
          temp = (Int_t)cluster.fDCharge;
-         power = 1<<(AliL3DataCompressor::GetNChargeBits());
+         power = 1<<(AliL3DataCompressorHelper::GetNChargeBits());
          if(abs(temp)>=power)
            {
              chargeo++;
              temp=power - 1;
            }
-         OutputBits(output,abs(temp),(AliL3DataCompressor::GetNChargeBits()));
+         OutputBits(output,abs(temp),(AliL3DataCompressorHelper::GetNChargeBits()));
          
          if(fWriteShape)
            {
              //Write shape information:
-             temp = (Int_t)cluster.fDSigmaY2;
+             temp = (Int_t)cluster.fDSigmaY;
              if(temp<0)
                OutputBit(output,0);
              else
                OutputBit(output,1);
-             power = 1<<(AliL3DataCompressor::GetNPadShapeBits()-1);
+             power = 1<<(AliL3DataCompressorHelper::GetNShapeBits()-1);
              if(abs(temp) >= power)
                {
                  padshapeo++;
                  temp = power - 1;
                }
-             OutputBits(output,abs(temp),(AliL3DataCompressor::GetNPadShapeBits()-1));
+             OutputBits(output,abs(temp),(AliL3DataCompressorHelper::GetNShapeBits()-1));
              
-             temp = (Int_t)cluster.fDSigmaZ2;
+             temp = (Int_t)cluster.fDSigmaZ;
              if(temp<0)
                OutputBit(output,0);
              else
                OutputBit(output,1);
-             power = 1<<(AliL3DataCompressor::GetNTimeShapeBits()-1);
+             power = 1<<(AliL3DataCompressorHelper::GetNShapeBits()-1);
              if(abs(temp) >= power)
                {
                  timeshapeo++;
                  temp=power - 1;
                }
-             OutputBits(output,abs(temp),(AliL3DataCompressor::GetNTimeShapeBits()-1));
+             OutputBits(output,abs(temp),(AliL3DataCompressorHelper::GetNShapeBits()-1));
            }
          
          clustercount++;
@@ -404,36 +406,36 @@ Bool_t AliL3Compress::ExpandFile()
          
          //Read time information:
          sign=InputBit(input);
-         temp = InputBits(input,(AliL3DataCompressor::GetNTimeBits()-1));
+         temp = InputBits(input,(AliL3DataCompressorHelper::GetNTimeBits()-1));
          if(!sign)
            temp*=-1;
          clusters[i].fDTime = temp;
          
          //Read pad information:
          sign=InputBit(input);
-         temp = InputBits(input,(AliL3DataCompressor::GetNPadBits()-1));
+         temp = InputBits(input,(AliL3DataCompressorHelper::GetNPadBits()-1));
          if(!sign)
            temp*=-1;
          clusters[i].fDPad = temp;
          
          //Read charge information:
-         temp=InputBits(input,(AliL3DataCompressor::GetNChargeBits()));
+         temp=InputBits(input,(AliL3DataCompressorHelper::GetNChargeBits()));
          clusters[i].fDCharge = temp;
          
          if(fWriteShape)
            {
              //Read shape information:
              sign = InputBit(input);
-             temp = InputBits(input,(AliL3DataCompressor::GetNPadShapeBits()-1));
+             temp = InputBits(input,(AliL3DataCompressorHelper::GetNShapeBits()-1));
              if(!sign)
                temp*=-1;
-             clusters[i].fDSigmaY2 = temp;
+             clusters[i].fDSigmaY = temp;
              
              sign = InputBit(input);
-             temp = InputBits(input,(AliL3DataCompressor::GetNTimeShapeBits()-1));
+             temp = InputBits(input,(AliL3DataCompressorHelper::GetNShapeBits()-1));
              if(!sign)
                temp*=-1;
-             clusters[i].fDSigmaZ2 = temp;
+             clusters[i].fDSigmaZ = temp;
            }
          clustercount++;
        }
@@ -507,8 +509,8 @@ void AliL3Compress::CompressRemaining(AliL3SpacePointData *clusters[36][6],UInt_
              AliL3Transform::Slice2Sector(slice,padrow,sector,row);
              AliL3Transform::Global2Raw(xyz,sector,row);
              
-             Float_t padw = cl[i].fSigmaY2 / AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(padrow));
-             Float_t timew = cl[i].fSigmaZ2 / AliL3Transform::GetZWidth();
+             Float_t padw = sqrt(cl[i].fSigmaY2) / AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(padrow));
+             Float_t timew = sqrt(cl[i].fSigmaZ2) / AliL3Transform::GetZWidth();
              
              //Write pad
              buff = (Int_t)rint(xyz[1]*10);
@@ -589,9 +591,9 @@ void AliL3Compress::ExpandRemaining(TempCluster **clusters,Int_t *ncl,const Int_
                  
                  //Read widths 
                  buff = InputBits(input,8);
-                 clusters[slice][ncl[slice]].sigmaY2 = (Float_t)buff/100.;
+                 clusters[slice][ncl[slice]].sigmaY2 = pow((Float_t)buff/100.,2);
                  buff = InputBits(input,8);
-                 clusters[slice][ncl[slice]].sigmaZ2 = (Float_t)buff/100.;
+                 clusters[slice][ncl[slice]].sigmaZ2 = pow((Float_t)buff/100.,2);
                  
                  //Read charge
                  buff = InputBits(input,14);
@@ -644,17 +646,65 @@ void AliL3Compress::PrintCompRatio(ofstream *outfile)
     }
   
   Float_t compratio = (Float_t)(compress_size + remain_size)/(Float_t)digit_size;
+  Float_t entropy[2];
+  GetEntropy(entropy[0],entropy[1]);
   if(outfile)
     {
       ofstream &out = *outfile;
-      out<<compress_size<<' '<<remain_size<<' '<<digit_size<<endl;
+      out<<compress_size<<' '<<remain_size<<' '<<digit_size<<' '<<entropy[0]<<' '<<entropy[1]<<endl;
     }
-
+  
   cout<<"=========================================="<<endl;
   cout<<"Original digits size : "<<digit_size/1000<<" kByte ( 100 % )"<<endl;
   cout<<"Compressed file size : "<<compress_size/1000<<" kByte ( "<<(Float_t)compress_size*100/(Float_t)digit_size<<" % )"<<endl;
+  cout<<"Entropy of residuals : "<<entropy[0]<<" "<<entropy[1]<<endl;
   cout<<"Remainig file size   : "<<remain_size/1000<<" kByte ( "<<(Float_t)remain_size*100/(Float_t)digit_size<<" % )"<<endl;
   cout<<"---------------------- "<<endl;
   cout<<"Compression ratio    : "<<compratio*100<<" %"<<endl;
   cout<<"=========================================="<<endl;
 }
+
+void AliL3Compress::GetEntropy(Float_t &pad_entropy,Float_t &time_entropy)
+{
+  //Calculate the entropy of the quantized residuals in both directions
+  
+  if(!ReadFile('m'))
+    return;
+  const Int_t nmax=100000;
+  Float_t pads[nmax];
+  Float_t times[nmax];
+  memset(&pads[0],0,nmax*sizeof(Float_t));
+  memset(&times[0],0,nmax*sizeof(Float_t));
+  Float_t counter=0;
+
+  for(Int_t i=0; i<fTracks->GetNTracks(); i++)
+    {
+      AliL3ModelTrack *track = (AliL3ModelTrack*)fTracks->GetCheckedTrack(i);
+      if(!track) continue;
+      for(Int_t padrow=0; padrow<AliL3Transform::GetNRows(); padrow++)
+       {
+         if(!track->IsPresent(padrow)) continue;
+         Int_t dpad = abs((Int_t)rint(track->GetClusterModel(padrow)->fDPad));
+         Int_t dtime = abs((Int_t)rint(track->GetClusterModel(padrow)->fDTime));
+         if(dpad >= nmax || dtime >= nmax)
+           {
+             cerr<<"AliL3Compress::GetEntropy : Quantization out of range: "<<dpad<<" "<<dtime<<endl;
+             break;
+           }
+         pads[dpad]++;
+         times[dtime]++;
+         counter++;
+       }
+    }
+  pad_entropy=time_entropy=0;
+  for(Int_t i=0; i<nmax; i++)
+    {
+      if(pads[i]>0)
+       pad_entropy += (pads[i]/counter)*(log(pads[i]/counter)/log(2.0));
+      if(times[i]>0)
+       time_entropy += (times[i]/counter)*(log(times[i]/counter)/log(2.0));
+    }
+  
+  pad_entropy*=-1;
+  time_entropy*=-1;
+}
index 84f91b8..31b40e9 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef AliL3_Compress
 #define AliL3_Compress
 
+#include "AliL3RootTypes.h"
 #include "AliL3DataCompressor.h"
 
 class AliL3Compress {
@@ -28,6 +29,7 @@ class AliL3Compress {
   void CompressRemaining(AliL3SpacePointData *points[36][6],UInt_t npoints[36][6]);
   void ExpandRemaining(TempCluster **clusters,Int_t *ncl,Int_t maxclusters);
   void PrintCompRatio(ofstream *outfile=0);
+  void GetEntropy(Float_t &pad_entropy,Float_t &time_entropy);
   
   AliL3TrackArray *GetTracks() {return fTracks;}
   
index 3aa8afa..ff7f9d9 100644 (file)
@@ -37,6 +37,7 @@
 #include <TH2F.h>
 #endif
 
+#include "AliL3DataCompressorHelper.h"
 #include "AliL3DataCompressor.h"
 
 #if GCCVERSION == 3
@@ -53,22 +54,6 @@ using namespace std;
 
 ClassImp(AliL3DataCompressor)
 
-Int_t AliL3DataCompressor::fNumTimeBits = 12;
-Int_t AliL3DataCompressor::fNumPadBits = 12;
-Int_t AliL3DataCompressor::fNumChargeBits = 14;
-Int_t AliL3DataCompressor::fNumPadShapeBits = 14;
-Int_t AliL3DataCompressor::fNumTimeShapeBits = 14;
-Float_t AliL3DataCompressor::fPadResidualStep1 = 0.03;
-Float_t AliL3DataCompressor::fPadResidualStep2 = 0.03;
-Float_t AliL3DataCompressor::fPadResidualStep3 = 0.03;
-Float_t AliL3DataCompressor::fTimeResidualStep1 = 0.05;
-Float_t AliL3DataCompressor::fTimeResidualStep2 = 0.05;
-Float_t AliL3DataCompressor::fTimeResidualStep3 = 0.05;
-Float_t AliL3DataCompressor::fPadSigma2Step1 = 0.005;
-Float_t AliL3DataCompressor::fPadSigma2Step2 = 0.005;
-Float_t AliL3DataCompressor::fTimeSigma2Step = 0.005;
-Int_t AliL3DataCompressor::fClusterCharge = 100;
-
 AliL3DataCompressor::AliL3DataCompressor()
 {
   fBenchmark=0;
@@ -124,62 +109,6 @@ void AliL3DataCompressor::DoBench(Char_t *fname)
   fBenchmark->Analyze(fname);
 }
 
-void AliL3DataCompressor::SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shapepad,Int_t shapetime)
-{
-  fNumPadBits = pad;
-  fNumTimeBits = time;
-  fNumChargeBits = charge;
-  fNumPadShapeBits = shapepad;
-  fNumTimeShapeBits = shapetime;
-}
-
-void AliL3DataCompressor::SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
-{
-  fPadResidualStep1 = res1/AliL3Transform::GetPadPitchWidth(0);
-  fPadResidualStep2 = res2/AliL3Transform::GetPadPitchWidth(2);
-  fPadResidualStep3 = res3/AliL3Transform::GetPadPitchWidth(2);
-  fPadSigma2Step1 = width*width/pow(AliL3Transform::GetPadPitchWidth(0),2);
-  fPadSigma2Step2 = width*width/pow(AliL3Transform::GetPadPitchWidth(2),2);
-}
-
-void AliL3DataCompressor::SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
-{
-  fTimeResidualStep1 = res1/AliL3Transform::GetZWidth();
-  fTimeResidualStep2 = res2/AliL3Transform::GetZWidth();
-  fTimeResidualStep3 = res3/AliL3Transform::GetZWidth();
-  fTimeSigma2Step = width*width/pow(AliL3Transform::GetZWidth(),2);
-}
-
-const Float_t AliL3DataCompressor::GetPadResidualStep(Int_t row) 
-{
-  if(row < AliL3Transform::GetNRowLow())
-    return fPadResidualStep1;
-  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
-    return fPadResidualStep2;
-  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
-    return fPadResidualStep3;
-  else
-    {
-      cerr<<"AliL3DataCompressor::GetXYResidualStep : Wrong row number "<<row<<endl;
-      return -1;
-    }
-}
-
-const Float_t AliL3DataCompressor::GetTimeResidualStep(Int_t row) 
-{
-  if(row < AliL3Transform::GetNRowLow())
-    return fTimeResidualStep1;
-  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
-    return fTimeResidualStep2;
-  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
-    return fTimeResidualStep3;
-  else
-    {
-      cerr<<"AliL3DataCompressor::GetXYResidualStep : Wrong row number "<<row<<endl;
-      return -1;
-    }
-}
-
 void AliL3DataCompressor::OpenOutputFile()
 {
 #ifndef use_aliroot
@@ -281,7 +210,8 @@ void AliL3DataCompressor::FillData(Int_t min_hits,Bool_t expand)
       if(!intrack) continue;
 
       if(intrack->GetNHits()<min_hits) break;
-
+      if(intrack->GetPt()<0.1) continue;
+      
       intrack->CalculateHelix();
       
       AliL3ModelTrack *outtrack = (AliL3ModelTrack*)comptracks->NextTrack();
@@ -298,6 +228,7 @@ void AliL3DataCompressor::FillData(Int_t min_hits,Bool_t expand)
       UInt_t *hitids = intrack->GetHitNumbers();
       Int_t origslice = (hitids[nhits-1]>>25)&0x7f;
       outtrack->Init(origslice,-1);
+      
       for(Int_t j=nhits-1; j>=0; j--)
        {
          UInt_t id=hitids[j];
@@ -322,7 +253,7 @@ void AliL3DataCompressor::FillData(Int_t min_hits,Bool_t expand)
            }
          
          Float_t xyz_cross[3] = {intrack->GetPointX(),intrack->GetPointY(),intrack->GetPointZ()};
-         
+
          Int_t sector,row;
          AliL3Transform::Slice2Sector(slice,padrow,sector,row);
          AliL3Transform::Global2Raw(xyz_cross,sector,row);
@@ -330,10 +261,10 @@ void AliL3DataCompressor::FillData(Int_t min_hits,Bool_t expand)
          
          outtrack->SetPadHit(padrow,xyz_cross[1]);
          outtrack->SetTimeHit(padrow,xyz_cross[2]);
-         
+
          outtrack->SetCrossingAngleLUT(padrow,intrack->GetCrossingAngle(padrow,slice));
          outtrack->CalculateClusterWidths(padrow,kTRUE);
-         
+
          if(fWriteClusterShape)
            {
              Int_t patch = AliL3Transform::GetPatch(padrow);
@@ -352,7 +283,6 @@ void AliL3DataCompressor::FillData(Int_t min_hits,Bool_t expand)
       if(!expand)
        outtrack->SetNClusters(AliL3Transform::GetNRows(-1));
     }
-  
   if(expand)
     ExpandTrackData(comptracks);
   
@@ -427,12 +357,12 @@ void AliL3DataCompressor::ExpandTrackData(AliL3TrackArray *tracks)
              AliL3Transform::Global2Local(xyz,last_slice,kTRUE);
              
              //Check for overflow:
-             Int_t temp = (Int_t)rint((xyz_cross[1]-xyz[1])/GetPadResidualStep(padrow));
-             if( abs(temp) > 1<<(GetNPadBits()-1))
+             Int_t temp = (Int_t)rint((xyz_cross[1]-xyz[1])/AliL3DataCompressorHelper::GetXYResidualStep(padrow));
+             if( abs(temp) > 1<<(AliL3DataCompressorHelper::GetNPadBits()-1))
                continue;
              
-             temp = (Int_t)rint((xyz_cross[2]-xyz[2])/GetTimeResidualStep(padrow));
-             if( abs(temp) > 1<<(GetNTimeBits()-1))
+             temp = (Int_t)rint((xyz_cross[2]-xyz[2])/AliL3DataCompressorHelper::GetZResidualStep(padrow));
+             if( abs(temp) > 1<<(AliL3DataCompressorHelper::GetNTimeBits()-1))
                continue;
              
              Float_t dist = sqrt( pow(xyz_cross[1]-xyz[1],2) + pow(xyz_cross[2]-xyz[2],2) );
@@ -478,6 +408,57 @@ void AliL3DataCompressor::ExpandTrackData(AliL3TrackArray *tracks)
   
 }
 
+void AliL3DataCompressor::DetermineMinBits()
+{
+  //Make a pass through the modelled data (after FillData has been done) to determine
+  //how many bits is needed to encode the residuals _without_ overflows.
+  
+  AliL3Compress *comp = new AliL3Compress(-1,-1,fPath,fWriteClusterShape,fEvent);
+  comp->ReadFile('m');
+  AliL3TrackArray *tracks = comp->GetTracks();
+  if(tracks->GetNTracks()==0)
+    {
+      delete comp;
+      return;
+    }
+  
+  Int_t maxtime=0,maxpad=0,maxsigma=0,maxcharge=0;
+  Int_t dpad,dtime,charge,dsigmaY,dsigmaZ,npadbits,ntimebits,nchargebits,nshapebits=0;
+  for(Int_t i=0; i<tracks->GetNTracks(); i++)
+    {
+      AliL3ModelTrack *track = (AliL3ModelTrack*)tracks->GetCheckedTrack(i);
+      if(!track) continue;
+      for(Int_t padrow=0; padrow<AliL3Transform::GetNRows(); padrow++)
+       {
+         if(!track->IsPresent(padrow)) continue;
+         dpad = TMath::Abs(TMath::Nint(track->GetClusterModel(padrow)->fDPad));
+         dtime = TMath::Abs(TMath::Nint(track->GetClusterModel(padrow)->fDTime));
+         charge = TMath::Abs((Int_t)track->GetClusterModel(padrow)->fDCharge);
+         dsigmaY = TMath::Abs(TMath::Nint(track->GetClusterModel(padrow)->fDSigmaY));
+         dsigmaZ = TMath::Abs(TMath::Nint(track->GetClusterModel(padrow)->fDSigmaZ));
+         if(dpad > maxpad)
+           maxpad=dpad;
+         if(dtime > maxtime)
+           maxtime=dtime;
+         if(charge > maxcharge)
+           maxcharge=charge;
+         if(dsigmaY > maxsigma)
+           maxsigma=dsigmaY;
+         if(dsigmaZ > maxsigma)
+           maxsigma=dsigmaZ;
+       }
+    }
+  cout<<"maxpad "<<maxpad<<" maxtime "<<maxtime<<" maxcharge "<<maxcharge<<endl;
+  npadbits = (Int_t)TMath::Ceil(TMath::Log(maxpad)/TMath::Log(2)) + 1; //need 1 extra bit to encode the sign
+  ntimebits = (Int_t)TMath::Ceil(TMath::Log(maxtime)/TMath::Log(2)) + 1;
+  nchargebits = (Int_t)TMath::Ceil(TMath::Log(maxcharge)/TMath::Log(2)); //Store as a absolute value
+  if(fWriteClusterShape)
+    nshapebits = (Int_t)TMath::Ceil(TMath::Log(maxsigma)/TMath::Log(2)) + 1;
+  
+  cout<<"Updating bitnumbers; pad "<<npadbits<<" time "<<ntimebits<<" charge "<<nchargebits<<" shape "<<nshapebits<<endl;
+  AliL3DataCompressorHelper::SetBitNumbers(npadbits,ntimebits,nchargebits,nshapebits);
+}
+
 void AliL3DataCompressor::WriteRemaining(Bool_t select)
 {
   //Write remaining clusters (not assigned to any tracks) to file
@@ -489,116 +470,16 @@ void AliL3DataCompressor::WriteRemaining(Bool_t select)
   if(select)
     SelectRemainingClusters();
   
-  Char_t filename[1024];
-  
   if(!fSinglePatch)
     {
       cerr<<"AliL3Compressor::WriteRemaining : You have to modify this function when not running singlepatch"<<endl;
       return;
     }
-
+  cout<<"Writing remaining clusters "<<endl;
   AliL3Compress *comp = new AliL3Compress(-1,-1,fPath,fWriteClusterShape,fEvent);
   comp->CompressRemaining(fClusters,fNcl);
   delete comp;
   return;
-
-  cout<<"Writing remaining clusters "<<endl;
-  Int_t nrows = AliL3Transform::GetNRows();
-  Int_t *npoints = new Int_t[nrows];
-  for(Int_t i=0; i<=35; i++)
-    {
-      for(Int_t patch=0; patch < 1; patch++)
-       {
-         sprintf(filename,"%s/comp/remains_%d_%d_%d.raw",fPath,fEvent,i,-1);
-         FILE *outfile = fopen(filename,"w");
-         if(!outfile)
-           {
-             cerr<<"AliL3DataCompressor::WriteRemaining : Cannot open file "<<filename<<endl;
-             exit(5);
-           }
-
-         AliL3SpacePointData *points = fClusters[i][patch];
-         
-         memset(npoints,0,nrows*sizeof(Int_t));
-         
-         for(UInt_t j=0; j<fNcl[i][patch]; j++)
-           {
-             if(points[j].fCharge == 0) continue; //has been used
-             npoints[points[j].fPadRow]++;
-           }
-         Int_t size =0;
-         Byte_t *data = 0;
-         AliL3RemainingRow *tempPt=0;
-         
-         Int_t last_row = -2;
-         Int_t localcounter=0;
-         
-         for(UInt_t j=0; j<fNcl[i][patch]; j++)
-           {
-             if(points[j].fCharge == 0) continue; //has been used
-             
-             Int_t padrow = points[j].fPadRow;
-             if(padrow != last_row)
-               {
-                 if(last_row != -2)
-                   {
-                     if(!tempPt)
-                       {
-                         cerr<<"AliL3DataCompressor::WriteRemaining : Zero row pointer "<<endl;
-                         exit(5);
-                       }
-                     if(localcounter != tempPt->fNClusters)
-                       {
-                         cerr<<"AliL3DataCompressor::WriteRemaining : Mismatching clustercounter "<<localcounter<<" "
-                             <<(Int_t)tempPt->fNClusters<<endl;
-                         exit(5);
-                       }
-                     //cout<<"Writing row "<<(int)tempPt->fPadRow<<" with "<<(int)tempPt->fNClusters<<" clusters"<<endl;
-                     fwrite(tempPt,size,1,outfile);
-                   }
-                 if(data)
-                   delete [] data;
-                 size = sizeof(AliL3RemainingRow) + npoints[padrow]*sizeof(AliL3RemainingCluster);
-                 data = new Byte_t[size];
-                 tempPt = (AliL3RemainingRow*)data;
-                 
-                 localcounter=0;
-                 tempPt->fPadRow = padrow;
-                 tempPt->fNClusters = npoints[padrow];
-                 last_row = padrow;
-               }
-             if(localcounter >= npoints[padrow])
-               {
-                 cerr<<"AliL3DataCompressor::WriteRemaining : Cluster counter out of range: "
-                     <<localcounter<<" "<<npoints[padrow]<<endl;
-                 exit(5);
-               }
-             
-             Float_t xyz[3] = {points[j].fX,points[j].fY,points[j].fZ};
-             Int_t sector,row;
-             AliL3Transform::Slice2Sector(i,padrow,sector,row);
-             AliL3Transform::Global2Raw(xyz,sector,row);
-             
-             Float_t padw = points[j].fSigmaY2 / pow(AliL3Transform::GetPadPitchWidth(patch),2);
-             Float_t timew = points[j].fSigmaZ2 / pow(AliL3Transform::GetZWidth(),2);
-             
-             tempPt->fClusters[localcounter].fPad = (UShort_t)(xyz[1]*100);
-             tempPt->fClusters[localcounter].fTime = (UShort_t)(xyz[2]*100);
-             tempPt->fClusters[localcounter].fCharge = points[j].fCharge;
-             tempPt->fClusters[localcounter].fSigmaY2 = (Byte_t)(padw*100);
-             tempPt->fClusters[localcounter].fSigmaZ2 = (Byte_t)(timew*100);
-             localcounter++;
-             fNunusedClusters++;
-           }
-         
-         //Write the last row:
-         fwrite(tempPt,size,1,outfile);
-         if(data)
-           delete [] data;
-         fclose(outfile);
-       }
-    }
-  delete [] npoints;
 }
 
 void AliL3DataCompressor::SelectRemainingClusters()
@@ -628,9 +509,9 @@ void AliL3DataCompressor::SelectRemainingClusters()
          Int_t padrow = (Int_t)points[i].fPadRow;
          
          //Check the widths (errors) of the cluster, and remove big bastards:
-         Float_t xyw = points[i].fSigmaY2 / pow(AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(padrow)),2);
-         Float_t zw  = points[i].fSigmaZ2 / pow(AliL3Transform::GetZWidth(),2);
-         if(xyw >= 2.55 || zw >= 2.55)//Because we use 1 byte to store
+         Float_t padw = sqrt(points[i].fSigmaY2) / AliL3Transform::GetPadPitchWidth(AliL3Transform::GetPatch(padrow));
+         Float_t timew = sqrt(points[i].fSigmaZ2) / AliL3Transform::GetZWidth();
+         if(padw >= 2.55 || timew >= 2.55)//Because we use 1 byte to store
            {
              points[i].fCharge = 0;
              continue;
@@ -671,9 +552,13 @@ void AliL3DataCompressor::CompressAndExpand()
   comp->PrintCompRatio(fCompRatioFile);
   delete comp;
   
-  //Write the ratio between used and unused clusters to comp file:
   ofstream &out = *fCompRatioFile;
+  out<<AliL3DataCompressorHelper::GetNPadBits()<<' '<<AliL3DataCompressorHelper::GetNTimeBits()<<' '
+     <<AliL3DataCompressorHelper::GetNChargeBits()<<' '<<AliL3DataCompressorHelper::GetNShapeBits()<<endl;
+  /*
+  //Write the ratio between used and unused clusters to comp file:
   out<<fNusedClusters<<' '<<fNunusedClusters<<endl;
+  */
 }
 
 
@@ -845,8 +730,8 @@ void AliL3DataCompressor::ReadUncompressedData(TempCluster **clusters,Int_t *ncl
          track->GetPad(padrow,pad);
          track->GetTime(padrow,time);
          track->GetClusterCharge(padrow,charge);
-         track->GetXYWidth(padrow,sigmaY2);
-         track->GetZWidth(padrow,sigmaZ2);
+         track->GetSigmaY2(padrow,sigmaY2);
+         track->GetSigmaZ2(padrow,sigmaZ2);
          Int_t slice = track->GetClusterModel(padrow)->fSlice;
          /*
            if(pad < -1 || pad > AliL3Transform::GetNPads(padrow) || time < -1 || time > AliL3Transform::GetNTimeBins())
@@ -878,83 +763,12 @@ void AliL3DataCompressor::ReadUncompressedData(TempCluster **clusters,Int_t *ncl
 void AliL3DataCompressor::ReadRemaining(TempCluster **clusters,Int_t *ncl,const Int_t maxpoints)
 {
   
-  Char_t filename[1024];
   cout<<"Reading remaining clusters "<<endl;
 
   AliL3Compress *comp = new AliL3Compress(-1,-1,fPath,fWriteClusterShape,fEvent);
   comp->ExpandRemaining(clusters,ncl,maxpoints);
   delete comp;
   return;
-
-  AliL3MemHandler mem;
-  
-  for(Int_t slice=0; slice<=35; slice++)
-    {
-      for(Int_t p=0; p<1; p++)
-       {
-         sprintf(filename,"%s/comp/remains_%d_%d_%d.raw",fPath,fEvent,slice,-1);
-         
-         mem.SetBinaryInput(filename);
-         AliL3RemainingRow *tempPt = (AliL3RemainingRow*)mem.Allocate();
-         
-         Int_t nrows=0;
-         FILE *infile = mem.GetFilePointer();
-         while(!feof(infile))
-           {
-             Byte_t *dPt = (Byte_t*)tempPt;
-             if(fread(tempPt,sizeof(AliL3RemainingRow),1,infile)!=1) break;
-             
-             dPt += sizeof(AliL3RemainingRow);
-             
-             Int_t size = sizeof(AliL3RemainingCluster)*tempPt->fNClusters;
-             
-             fread(dPt,size,1,infile);
-             dPt += size;
-             tempPt = (AliL3RemainingRow*)dPt;
-             nrows++;
-           }
-         
-         mem.CloseBinaryInput();
-         UInt_t dummy;
-         tempPt = (AliL3RemainingRow*)mem.GetDataPointer(dummy);
-         
-         for(Int_t i=0; i<nrows; i++)
-           {
-             AliL3RemainingCluster *points = tempPt->fClusters;
-             Int_t padrow = (Int_t)tempPt->fPadRow;
-             //Int_t sector,row;
-             //AliL3Transform::Slice2Sector(slice,padrow,sector,row);
-             //cout<<"Loading slice "<<slice<<" row "<<padrow<<" with "<<(Int_t)tempPt->fNClusters<<" clusters "<<endl;
-             for(Int_t j=0; j<tempPt->fNClusters; j++)
-               {
-                 
-                 //Float_t xyz[3] = {AliL3Transform::Row2X(padrow),points[j].fY,points[j].fZ};
-                 //AliL3Transform::Local2Raw(xyz,sector,row);
-                 
-                 if(ncl[slice] >= maxpoints)
-                   {
-                     cerr<<"AliL3DataCompressor::ReadRemaining : Too many clusters"<<endl;
-                     exit(5);
-                   }
-                 //cout<<"slice "<<slice<<" padrow "<<padrow<<" pad "<<xyz[1]<<" time "<<xyz[2]<<endl;
-                 clusters[slice][ncl[slice]].pad = (Float_t)(points[j].fPad/100.);
-                 clusters[slice][ncl[slice]].time = (Float_t)(points[j].fTime/100.);
-                 clusters[slice][ncl[slice]].charge = points[j].fCharge;
-                 clusters[slice][ncl[slice]].sigmaY2 = (Float_t)(points[j].fSigmaY2/100.);
-                 clusters[slice][ncl[slice]].sigmaZ2 = (Float_t)(points[j].fSigmaZ2/100.);
-                 clusters[slice][ncl[slice]].padrow = padrow;
-                 cout<<"padrow "<<padrow<<" pad "<<clusters[slice][ncl[slice]].pad<<" time "<<clusters[slice][ncl[slice]].time<<" charge "<<clusters[slice][ncl[slice]].charge<<" widths "<<clusters[slice][ncl[slice]].sigmaY2<<" "<<clusters[slice][ncl[slice]].sigmaZ2<<endl;
-                 ncl[slice]++;
-               }
-             Byte_t *dPt = (Byte_t*)tempPt;
-             Int_t size = sizeof(AliL3RemainingRow) + tempPt->fNClusters*sizeof(AliL3RemainingCluster);
-             dPt += size;
-             tempPt = (AliL3RemainingRow*)dPt;
-           }
-         
-         mem.Free();
-       }
-    }
 }
 
 void AliL3DataCompressor::QSort(TempCluster **a, Int_t first, Int_t last)
@@ -997,26 +811,6 @@ void AliL3DataCompressor::QSort(TempCluster **a, Int_t first, Int_t last)
 
 Int_t AliL3DataCompressor::Compare(TempCluster *a,TempCluster *b)
 {
-  /*
-  if(a->padrow < 0 || a->padrow > AliL3Transform::GetNRows(-1) ||
-     b->padrow < 0 || b->padrow > AliL3Transform::GetNRows(-1))
-    {
-      cerr<<"AliL3Compressor::Compare : Wrong padrows "<<a->padrow<<" "<<b->padrow<<endl;
-      exit(5);
-    }
-  else if(a->pad < 0 || a->pad > AliL3Transform::GetNPads(a->padrow) || 
-         b->pad < 0 || b->pad > AliL3Transform::GetNPads(b->padrow))
-    {
-      cerr<<"AliL3Compressor::Compare : Wrong pads "<<a->pad<<" "<<b->pad<<endl;
-      exit(5);
-    }
-  else if(a->time < 0 || a->time > AliL3Transform::GetNTimeBins() || 
-         b->time < 0 || b->time > AliL3Transform::GetNTimeBins())
-    {
-      cerr<<"AliL3Compressor::Compare : Wrong timebins "<<a->time<<" "<<b->time<<endl;
-      exit(5);
-    }
-  */
   if(a->padrow < b->padrow) return -1;
   if(a->padrow > b->padrow) return 1;
 
index ea011d5..5f51e35 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef AliL3_DataCompressor
 #define AliL3_DataCompressor
 
+#include "AliL3RootTypes.h"
+
 class AliL3SpacePointData;
 class AliL3Benchmark;
 class AliL3TrackArray;
@@ -37,6 +39,7 @@ class AliL3DataCompressor {
   
   UInt_t fNcl[36][6];
   
+  /*
   static Int_t fNumPadBits;
   static Int_t fNumTimeBits;
   static Int_t fNumChargeBits;
@@ -53,7 +56,8 @@ class AliL3DataCompressor {
   static Float_t fPadSigma2Step2;
   static Float_t fTimeSigma2Step;
   static Int_t fClusterCharge;
-  
+  */
   void SelectRemainingClusters();
   void ExpandTrackData(AliL3TrackArray *tracks);
   void ReadUncompressedData(TempCluster **clusters,Int_t *ncl,const Int_t maxpoints);
@@ -64,7 +68,7 @@ class AliL3DataCompressor {
   void CloseOutputFile();
   
  protected:
-  Char_t fPath[1024];            //!
+  Char_t fPath[1024];   //!
   Int_t fEvent;
   Int_t fNusedClusters;
   Int_t fNunusedClusters;
@@ -82,17 +86,20 @@ class AliL3DataCompressor {
   virtual void LoadData(Int_t event,Bool_t sp=kTRUE);
   virtual void FillData(Int_t minhits,Bool_t expand);
   virtual void WriteRemaining(Bool_t select);
+  void DetermineMinBits();
   void CompressAndExpand();
   void RestoreData(Bool_t remaining_only=kFALSE);
   void DoBench(Char_t *fname="benchmark");
   
+  /*
   void SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shapepad,Int_t shapetime);
   void SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
   void SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
-  
+  */
   Int_t GetNusedClusters() {return fNusedClusters;}
   Int_t GetNunusedClusters() {return fNunusedClusters;}
 
+  /*
   static const Int_t GetNPadBits() {return fNumPadBits;}
   static const Int_t GetNTimeBits() {return fNumTimeBits;}
   static const Int_t GetNChargeBits() {return fNumChargeBits;}
@@ -103,7 +110,7 @@ class AliL3DataCompressor {
   static const Int_t GetClusterCharge() {return fClusterCharge;}
   static const Float_t GetPadResidualStep(Int_t row);
   static const Float_t GetTimeResidualStep(Int_t row);
-
+  */
 
   ClassDef(AliL3DataCompressor,1) 
 
diff --git a/HLT/comp/AliL3DataCompressorHelper.cxx b/HLT/comp/AliL3DataCompressorHelper.cxx
new file mode 100644 (file)
index 0000000..9042b85
--- /dev/null
@@ -0,0 +1,95 @@
+// @(#) $Id$
+
+// Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
+//*-- Copyright &copy ALICE HLT Group
+
+#include "AliL3StandardIncludes.h"
+
+#include "AliL3RootTypes.h"
+#include "AliL3Transform.h"
+
+#include "AliL3DataCompressorHelper.h"
+
+#if GCCVERSION == 3
+using namespace std;
+#endif
+
+//_____________________________________________________________
+//
+//  AliL3DataCompression
+//
+// Interface class; binary <-> AliROOT handling of TPC data compression classes.
+//
+
+
+ClassImp(AliL3DataCompressorHelper)
+
+
+Int_t AliL3DataCompressorHelper::fNumTimeBits = 12;
+Int_t AliL3DataCompressorHelper::fNumPadBits = 12;
+Int_t AliL3DataCompressorHelper::fNumChargeBits = 14;
+Int_t AliL3DataCompressorHelper::fNumShapeBits = 14;
+Float_t AliL3DataCompressorHelper::fXYResidualStep1 = 0.03;
+Float_t AliL3DataCompressorHelper::fXYResidualStep2 = 0.03;
+Float_t AliL3DataCompressorHelper::fXYResidualStep3 = 0.03;
+Float_t AliL3DataCompressorHelper::fZResidualStep1 = 0.05;
+Float_t AliL3DataCompressorHelper::fZResidualStep2 = 0.05;
+Float_t AliL3DataCompressorHelper::fZResidualStep3 = 0.05;
+Float_t AliL3DataCompressorHelper::fXYWidthStep = 0.005;
+Float_t AliL3DataCompressorHelper::fZWidthStep = 0.005;
+Int_t AliL3DataCompressorHelper::fClusterCharge = 100;
+
+
+void AliL3DataCompressorHelper::SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape)
+{
+  fNumPadBits = pad;
+  fNumTimeBits = time;
+  fNumChargeBits = charge;
+  fNumShapeBits = shape;
+}
+
+void AliL3DataCompressorHelper::SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
+{
+  fXYResidualStep1 = res1;
+  fXYResidualStep2 = res2;
+  fXYResidualStep3 = res3;
+  fXYWidthStep = width;
+}
+
+void AliL3DataCompressorHelper::SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width)
+{
+  fZResidualStep1 = res1;
+  fZResidualStep2 = res2;
+  fZResidualStep3 = res3;
+  fZWidthStep = width;
+}
+
+const Float_t AliL3DataCompressorHelper::GetXYResidualStep(Int_t row) 
+{
+  if(row < AliL3Transform::GetNRowLow())
+    return fXYResidualStep1;
+  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
+    return fXYResidualStep2;
+  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
+    return fXYResidualStep3;
+  else
+    {
+      cerr<<"AliL3DataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
+      return -1;
+    }
+}
+
+const Float_t AliL3DataCompressorHelper::GetZResidualStep(Int_t row) 
+{
+  if(row < AliL3Transform::GetNRowLow())
+    return fZResidualStep1;
+  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1())
+    return fZResidualStep2;
+  else if(row < AliL3Transform::GetNRowLow() + AliL3Transform::GetNRowUp1() + AliL3Transform::GetNRowUp2())
+    return fZResidualStep3;
+  else
+    {
+      cerr<<"AliL3DataCompressorHelper::GetXYResidualStep : Wrong row number "<<row<<endl;
+      return -1;
+    }
+}
diff --git a/HLT/comp/AliL3DataCompressorHelper.h b/HLT/comp/AliL3DataCompressorHelper.h
new file mode 100644 (file)
index 0000000..bc7cd97
--- /dev/null
@@ -0,0 +1,46 @@
+// @(#) $Id$
+
+#ifndef AliL3_DataCompressorHelper
+#define AliL3_DataCompressorHelper
+
+#include "AliL3RootTypes.h"
+
+class AliL3DataCompressorHelper {
+  
+ private:
+  static Int_t fNumPadBits;
+  static Int_t fNumTimeBits;
+  static Int_t fNumChargeBits;
+  static Int_t fNumShapeBits;
+  
+  static Float_t fXYResidualStep1;
+  static Float_t fXYResidualStep2;
+  static Float_t fXYResidualStep3;
+  static Float_t fZResidualStep1;
+  static Float_t fZResidualStep2;
+  static Float_t fZResidualStep3;
+  static Float_t fXYWidthStep;
+  static Float_t fZWidthStep;
+  static Int_t fClusterCharge;
+  
+ protected:
+  
+ public:
+  static void SetBitNumbers(Int_t pad,Int_t time,Int_t charge,Int_t shape);
+  static void SetTransverseResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
+  static void SetLongitudinalResolutions(Float_t res1,Float_t res2,Float_t res3,Float_t width=0.005);
+  static const Int_t GetNPadBits() {return fNumPadBits;}
+  static const Int_t GetNTimeBits() {return fNumTimeBits;}
+  static const Int_t GetNChargeBits() {return fNumChargeBits;}
+  static const Int_t GetNShapeBits() {return fNumShapeBits;}
+  static const Float_t GetXYWidthStep() {return fXYWidthStep;}
+  static const Float_t GetZWidthStep() {return fZWidthStep;}
+  static const Int_t GetClusterCharge() {return fClusterCharge;}
+  static const Float_t GetXYResidualStep(Int_t row);
+  static const Float_t GetZResidualStep(Int_t row);
+
+  ClassDef(AliL3DataCompressorHelper,1) 
+
+};
+
+#endif
index 335b033..3b3d876 100644 (file)
@@ -30,8 +30,8 @@ int lev_marq_fit( double x[], double y[], double sig[], int NPT, double a[], int
 #define NR_END 1
 #define FREE_ARG char*
 #define EPSILON             1.0E-12
-#define TRUE 1
-#define FALSE 1
+//#define TRUE 1
+//#define FALSE 1
 #define FIT_PTS     2000
 #define  FIT_MAXPAR   41
 #define NUM_PARS 5
index 59a9721..501e687 100644 (file)
@@ -6,10 +6,11 @@
 #include "AliL3StandardIncludes.h"
 
 #include "AliL3Logging.h"
-#include "AliL3ModelTrack.h"
 #include "AliL3Transform.h"
-#include "AliL3DataCompressor.h"
 #include "AliL3Vertex.h"
+#include "AliL3DataCompressorHelper.h"
+
+#include "AliL3ModelTrack.h"
 
 #if GCCVERSION == 3
 using namespace std;
@@ -146,6 +147,7 @@ void AliL3ModelTrack::SetCluster(Int_t row,Float_t fpad,Float_t ftime,Float_t ch
   
   cl->fPresent |= 0x2; //set second bit to true, because a fit attempt has been made
   
+  Int_t patch = AliL3Transform::GetPatch(row);
   if(!charge || npads == 1)
     {
       cl->fPresent &= ~0x1; //set first bit to false
@@ -153,18 +155,20 @@ void AliL3ModelTrack::SetCluster(Int_t row,Float_t fpad,Float_t ftime,Float_t ch
   else
     {
       cl->fPresent|=0x1;//set first bit to true
-      cl->fDPad = QuantizePad(row,fpad);
-      cl->fDTime = QuantizeTime(row,ftime);
+      cl->fDPad = (fpad - GetPadHit(row))/(AliL3DataCompressorHelper::GetXYResidualStep(row)/AliL3Transform::GetPadPitchWidth(patch));
+      cl->fDTime = (ftime - GetTimeHit(row))/(AliL3DataCompressorHelper::GetZResidualStep(row)/AliL3Transform::GetZWidth());
       cl->fDCharge = charge;
       if(sigmaY2==0 && sigmaZ2==0)
        {
-         cl->fDSigmaY2=0;//if width is zero, shape is not supposed to be written
-         cl->fDSigmaZ2=0;
+         cl->fDSigmaY=0;//if width is zero, shape is not supposed to be written
+         cl->fDSigmaZ=0;
        }
       else
        {
-         cl->fDSigmaY2 = QuantizeSigmaY2(row,sigmaY2);
-         cl->fDSigmaZ2 = QuantizeSigmaZ2(row,sigmaZ2);
+         //cl->fDSigmaY2 = (sigmaY2 - GetParSigmaY2(row))/(pow(AliL3DataCompressorHelper::GetXYWidthStep(),2)/pow(AliL3Transform::GetPadPitchWidth(patch),2));
+         //cl->fDSigmaZ2 = (sigmaZ2 - GetParSigmaZ2(row))/(pow(AliL3DataCompressorHelper::GetZWidthStep(),2)/pow(AliL3Transform::GetZWidth(),2));
+         cl->fDSigmaY = (sqrt(sigmaY2) - sqrt(GetParSigmaY2(row)))/(AliL3DataCompressorHelper::GetXYWidthStep()/AliL3Transform::GetPadPitchWidth(patch));
+         cl->fDSigmaZ = (sqrt(sigmaZ2) - sqrt(GetParSigmaZ2(row)))/(AliL3DataCompressorHelper::GetZWidthStep()/AliL3Transform::GetZWidth());
        }
       cl->fNPads = npads;
     }
@@ -329,58 +333,6 @@ void AliL3ModelTrack::FillTrack()
     }
 }
 
-Float_t AliL3ModelTrack::QuantizePad(Int_t row,Float_t pad)
-{
-  Float_t diff = pad - GetPadHit(row);
-  Float_t step = AliL3DataCompressor::GetPadResidualStep(row);
-  return diff/step;
-} 
-
-Float_t AliL3ModelTrack::RetrievePad(Int_t row,Float_t dpad)
-{
-  Float_t step = AliL3DataCompressor::GetPadResidualStep(row);
-  return dpad*step + GetPadHit(row);
-}
-
-Float_t AliL3ModelTrack::QuantizeTime(Int_t row,Float_t time)
-{
-  Float_t diff = time - GetTimeHit(row);
-  Float_t step = AliL3DataCompressor::GetTimeResidualStep(row);
-  return diff/step;
-} 
-
-Float_t AliL3ModelTrack::RetrieveTime(Int_t row,Float_t dtime)
-{
-  Float_t step = AliL3DataCompressor::GetTimeResidualStep(row);
-  return dtime*step + GetTimeHit(row);
-}
-
-Float_t AliL3ModelTrack::QuantizeSigmaY2(Int_t row,Float_t sigmaY2)
-{
-  Float_t diff = sigmaY2 - GetParSigmaY2(row);
-  Float_t step = AliL3DataCompressor::GetPadSigma2Step(AliL3Transform::GetPatch(row));
-  return diff/step;
-}
-
-Float_t AliL3ModelTrack::RetrieveSigmaY2(Int_t row,Float_t dsigmaY2)
-{
-  Float_t step = AliL3DataCompressor::GetPadSigma2Step(AliL3Transform::GetPatch(row));
-  return dsigmaY2*step + GetParSigmaY2(row);
-}
-
-Float_t AliL3ModelTrack::QuantizeSigmaZ2(Int_t row,Float_t sigmaZ2)
-{
-  Float_t diff = sigmaZ2 - GetParSigmaZ2(row);
-  Float_t step = AliL3DataCompressor::GetTimeSigma2Step();
-  return diff/step;
-}
-
-Float_t AliL3ModelTrack::RetrieveSigmaZ2(Int_t row,Float_t dsigmaZ2)
-{
-  Float_t step = AliL3DataCompressor::GetTimeSigma2Step();
-  return dsigmaZ2*step + GetParSigmaZ2(row);
-}
-
 void AliL3ModelTrack::SetPadHit(Int_t row,Float_t pad)
 {
   Int_t index = row-AliL3Transform::GetFirstRow(fPatch);
@@ -447,64 +399,73 @@ Int_t AliL3ModelTrack::GetNPads(Int_t row)
 
 Bool_t AliL3ModelTrack::GetPad(Int_t row,Float_t &pad)
 {
+  //(fpad - GetPadHit(row))/(AliL3DataCompressorHelper::GetXYResidualStep(row)/AliL3Transform::GetPadPitchWidth(patch));
   AliL3ClusterModel *cl = GetClusterModel(row);
-  pad = RetrievePad(row,cl->fDPad);
+  Int_t patch = AliL3Transform::GetPatch(row);
+  pad = cl->fDPad*(AliL3DataCompressorHelper::GetXYResidualStep(row)/AliL3Transform::GetPadPitchWidth(patch)) + GetPadHit(row);
   return IsPresent(row);
 }
 
 Bool_t AliL3ModelTrack::GetTime(Int_t row,Float_t &time)
 {
   AliL3ClusterModel *cl = GetClusterModel(row);
-  time = RetrieveTime(row,cl->fDTime);
+  time = cl->fDTime*(AliL3DataCompressorHelper::GetZResidualStep(row)/AliL3Transform::GetZWidth()) + GetTimeHit(row);
   return IsPresent(row);
 }
 
 Bool_t AliL3ModelTrack::GetClusterCharge(Int_t row,Int_t &charge)
 {
   AliL3ClusterModel *cl = GetClusterModel(row);
-  charge = (Int_t)cl->fDCharge;// + AliL3DataCompressor::GetClusterCharge();
+  charge = (Int_t)cl->fDCharge;// + AliL3DataCompressorHelperHelper::GetClusterCharge();
   return IsPresent(row);
 }
 
-Bool_t AliL3ModelTrack::GetXYWidth(Int_t row,Float_t &width)
+Bool_t AliL3ModelTrack::GetSigmaY2(Int_t row,Float_t &sigma2)
 {
+  //cl->fDSigmaY = (sqrt(sigmaY2) - sqrt(GetParSigmaY2(row)))/(AliL3DataCompressorHelper::GetXYWidthStep()/AliL3Transform::GetPadPitchWidth(patch));
   AliL3ClusterModel *cl = GetClusterModel(row);
-  width = RetrieveSigmaY2(row,cl->fDSigmaY2);
+  Int_t patch = AliL3Transform::GetPatch(row);
+  Float_t sigma = cl->fDSigmaY*(AliL3DataCompressorHelper::GetXYWidthStep()/AliL3Transform::GetPadPitchWidth(patch)) + sqrt(GetParSigmaY2(row));
+  sigma2 = sigma*sigma;
   return IsPresent(row);
 }
 
-Bool_t AliL3ModelTrack::GetZWidth(Int_t row,Float_t &width)
+Bool_t AliL3ModelTrack::GetSigmaZ2(Int_t row,Float_t &sigma2)
 {
+  //cl->fDSigmaZ = (sqrt(sigmaZ2) - sqrt(GetParSigmaZ2(row)))/(AliL3DataCompressorHelper::GetZWidthStep()/AliL3Transform::GetZWidth());
   AliL3ClusterModel *cl = GetClusterModel(row);
-  RetrieveSigmaZ2(row,cl->fDSigmaZ2);
+  Float_t sigma = cl->fDSigmaZ*(AliL3DataCompressorHelper::GetZWidthStep()/AliL3Transform::GetZWidth()) + sqrt(GetParSigmaZ2(row));
+  sigma2 = sigma*sigma;
   return IsPresent(row);
 }
 
 Bool_t AliL3ModelTrack::GetPadResidual(Int_t row,Float_t &res)
 {
   AliL3ClusterModel *cl = GetClusterModel(row);
-  res = cl->fDPad;
+  Int_t patch = AliL3Transform::GetPatch(row);
+  res = cl->fDPad*(AliL3DataCompressorHelper::GetXYResidualStep(row)/AliL3Transform::GetPadPitchWidth(patch));
   return IsPresent(row);
 }
 
 Bool_t AliL3ModelTrack::GetTimeResidual(Int_t row,Float_t &res)
 {
   AliL3ClusterModel *cl = GetClusterModel(row);
-  res = cl->fDTime;
+  res = cl->fDTime*(AliL3DataCompressorHelper::GetZResidualStep(row)/AliL3Transform::GetZWidth());
   return IsPresent(row);
 }
 
 Bool_t AliL3ModelTrack::GetXYWidthResidual(Int_t row,Float_t &res)
 {
   AliL3ClusterModel *cl = GetClusterModel(row);
-  res = cl->fDSigmaY2;
+  Int_t patch = AliL3Transform::GetPatch(row);
+  res = cl->fDSigmaY*(AliL3DataCompressorHelper::GetXYWidthStep()/AliL3Transform::GetPadPitchWidth(patch));
   return IsPresent(row);
 }
 
 Bool_t AliL3ModelTrack::GetZWidthResidual(Int_t row,Float_t &res)
 {
   AliL3ClusterModel *cl = GetClusterModel(row);
-  res = cl->fDSigmaZ2;
+  res = cl->fDSigmaZ*(AliL3DataCompressorHelper::GetZWidthStep()/AliL3Transform::GetZWidth());
   return IsPresent(row);
 }
 
@@ -617,7 +578,7 @@ void AliL3ModelTrack::Print(Bool_t everything)
 
   cout<<"Clusters:"<<endl;
   Int_t origslice=-1,counter=0;
-  Float_t fpad,ftime;
+  Float_t fpad,ftime,sigmaY2,sigmaZ2;
   for(Int_t i=AliL3Transform::GetFirstRow(fPatch); i<=AliL3Transform::GetLastRow(fPatch); i++)
     {
       AliL3ClusterModel *cl = GetClusterModel(i);
@@ -628,14 +589,16 @@ void AliL3ModelTrack::Print(Bool_t everything)
        {
          GetPad(i,fpad);
          GetTime(i,ftime);
+         GetSigmaY2(i,sigmaY2);
+         GetSigmaZ2(i,sigmaZ2);
          if(counter==0)
            origslice=cl->fSlice;
          else if(cl->fSlice != origslice)
            cout<<"Change in slice "<<cl->fSlice<<" "<<origslice<<endl;
          cout<<i<<" Slice "<<cl->fSlice<<" Dpad "<<cl->fDPad<<" Dtime "<<cl->fDTime<<" Dcharge "<<cl->fDCharge;
-         cout<<" sigmaY2 "<<GetParSigmaY2(i)<<" sigmaZ2 "<<GetParSigmaZ2(i);
+         cout<<" sigmaY2 "<<sigmaY2<<" sigmaZ2 "<<sigmaZ2;
+         cout<<" parsigmaY2 "<<GetParSigmaY2(i)<<" parsigmaZ2 "<<GetParSigmaZ2(i);
          cout<<" Pad "<<fpad<<" padhit "<<GetPadHit(i)<<" Time "<<ftime<<" timehit "<<GetTimeHit(i)<<" ";
-         cout<<"Number of pads "<<GetNPads(i)<<" Overlaps "<<GetNOverlaps(i);
          counter++;
        }
       cout<<endl;
index c0e7826..d1fb597 100644 (file)
@@ -23,17 +23,8 @@ class AliL3ModelTrack : public AliL3Track {
   Int_t fPatch;
 
   //Crossing points with padrows
-  Float_t *fPad; //!
-  Float_t *fTime; //!
-  
-  Float_t QuantizePad(Int_t row,Float_t pad);
-  Float_t QuantizeTime(Int_t row,Float_t time);
-  Float_t QuantizeSigmaY2(Int_t row,Float_t dsigmaY2);
-  Float_t QuantizeSigmaZ2(Int_t row,Float_t dsigmaZ2);
-  Float_t RetrievePad(Int_t row,Float_t dpad);
-  Float_t RetrieveTime(Int_t row,Float_t time);
-  Float_t RetrieveSigmaY2(Int_t row,Float_t dsigmaY2);
-  Float_t RetrieveSigmaZ2(Int_t row,Float_t dsigmaZ2);
+  Float_t *fPad;  //!
+  Float_t *fTime;  //!
   
  public:
   AliL3ModelTrack();
@@ -73,8 +64,8 @@ class AliL3ModelTrack : public AliL3Track {
   Bool_t GetPad(Int_t row,Float_t &pad);
   Bool_t GetTime(Int_t row,Float_t &time);
   Bool_t GetClusterCharge(Int_t row,Int_t &charge);
-  Bool_t GetXYWidth(Int_t row,Float_t &width);
-  Bool_t GetZWidth(Int_t row,Float_t &width);
+  Bool_t GetSigmaY2(Int_t row,Float_t &sigma2);
+  Bool_t GetSigmaZ2(Int_t row,Float_t &sigma2);
   Bool_t GetPadResidual(Int_t row,Float_t &res);
   Bool_t GetTimeResidual(Int_t row,Float_t &res);
   Bool_t GetXYWidthResidual(Int_t row,Float_t &res);
index 9c826ef..ff77cfa 100644 (file)
@@ -12,8 +12,8 @@ struct AliL3ClusterModel {
   Float_t fDTime;
   Float_t fDPad;
   Float_t fDCharge;
-  Float_t fDSigmaY2;
-  Float_t fDSigmaZ2;
+  Float_t fDSigmaY;
+  Float_t fDSigmaZ;
   UInt_t fNPads;
   Short_t fSlice;
 #ifdef do_mc
index 940d715..2d2c4ea 100644 (file)
@@ -23,7 +23,7 @@
 #include <TMath.h>
 #include <TDirectory.h>
 #include <TSystem.h>
-#include <TH2F.h>
+#include <TH1F.h>
 
 #include "AliL3Transform.h"
 #include "AliL3ModelTrack.h"
@@ -89,6 +89,12 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
   else
     sprintf(filename,"%s/offline/AliTPCclustersMI.root",fPath);
   
+  bool compressed=0;
+  if(compressed)
+    {
+      cout<<"AliL3OfflineDataCompressor::LoadData : Taking compressed offline files!!"<<endl;
+      sprintf(filename,"%s/comp/offline/AliTPCclusters.root",fPath);
+    }
   TFile *in = TFile::Open(filename);
   AliTPCParam *param=(AliTPCParam*)in->Get("75x40_100x60_150x60");
 
@@ -102,8 +108,8 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
 #endif  
   if(fMarian==kTRUE)
     {
-      AliTPCtrackerMI *mitracker = (AliTPCtrackerMI*)fTracker;
 #ifdef asvversion
+      AliTPCtrackerMI *mitracker = (AliTPCtrackerMI*)fTracker;
       mitracker->LoadInnerSectors();
       mitracker->LoadOuterSectors();
 #endif
@@ -115,6 +121,10 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
     sprintf(filename,"%s/offline/AliTPCtracks.root",fPath);
   else
     sprintf(filename,"%s/offline/AliTPCtracksMI.root",fPath);
+  
+  if(compressed)
+    sprintf(filename,"%s/comp/offline/AliTPCtracks.root",fPath);
+  
   TFile *tf=TFile::Open(filename);
   
   char tname[100]; sprintf(tname,"TreeT_TPC_%d",event);
@@ -137,6 +147,7 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
   cout<<"Loaded "<<nentr<<" offline tracks"<<endl;
   Int_t slice,padrow;
   Int_t totcounter=0;
+
   for(i=0; i<nentr; i++)
     {
       
@@ -179,8 +190,8 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
          fcl = mitracker->GetClusterMI(idx);
        }
       first[0] = xk;
-      first[1] = fcl->GetY();
-      first[2] = fcl->GetZ();
+      first[1] = par[0];
+      first[2] = par[1];
 
       AliL3Transform::Local2Global(first,slice);
       
@@ -261,7 +272,7 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
              cout<<"Track hit "<<xyz[0]<<" "<<xyz[1]<<" "<<xyz[2]<<endl;
              exit(5);
            }
-         
+
          Float_t angle = 0;
          AliL3Transform::Local2GlobalAngle(&angle,slice);
          if(!outtrack->CalculateReferencePoint(angle,AliL3Transform::Row2X(padrow)))
@@ -270,6 +281,7 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
                  <<slice<<" row "<<padrow<<endl;
              exit(5);
            }
+
          Float_t xyz_cross[3] = {outtrack->GetPointX(),outtrack->GetPointY(),outtrack->GetPointZ()};
          AliL3Transform::Global2Raw(xyz_cross,sec,row);
          /*
@@ -310,7 +322,7 @@ void AliL3OfflineDataCompressor::LoadData(Int_t event,Bool_t sp)
   comp->WriteFile(comptracks);
   delete comp;
   delete comptracks;
-
+  
 }
 
 void AliL3OfflineDataCompressor::WriteRemaining(Bool_t select)
@@ -340,7 +352,9 @@ void AliL3OfflineDataCompressor::WriteRemaining(Bool_t select)
   
   cout<<"Writing remaining clusters "<<endl;
   Int_t nrows = AliL3Transform::GetNRows(),sector,row,sec;
+#ifdef asvversion
   AliTPCtracker *tracker = (AliTPCtracker*)fTracker;
+#endif
   for(Int_t slice=0; slice<=35; slice++)
     {
       sprintf(filename,"%s/comp/remains_%d_%d_%d.raw",fPath,fEvent,slice,-1);
@@ -400,7 +414,7 @@ void AliL3OfflineDataCompressor::WriteRemaining(Bool_t select)
              if(cluster->GetZ() < 0 && slice < 18) continue;
              if(cluster->GetZ() > 0 && slice > 17) continue;
              if(cluster->IsUsed())
-               continue;
+               continue;
              
              if(fWriteIdsToFile)
                idfile << cluster->GetLabel(0)<<' ';
@@ -463,7 +477,10 @@ void AliL3OfflineDataCompressor::SelectRemainingClusters()
   Int_t gap=(Int_t)(0.125*nrows), shift=(Int_t)(0.5*gap);
   
   Int_t sector,row,sec;
+
+#ifdef asvversion
   AliTPCtracker *tracker = (AliTPCtracker*)fTracker;
+#endif
   for(Int_t slice=0; slice<36; slice++)
     {
       for(Int_t padrow=0; padrow < nrows; padrow++)
index 97e48f4..50bfbc7 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef AliL3_OfflineDataCompressor
 #define AliL3_OfflineDataCompressor
 
+#include "AliL3RootTypes.h"
 #include "AliL3DataCompressor.h"
 
 class AliTracker;
index ff26a59..94158af 100644 (file)
@@ -14,8 +14,12 @@ endif
 
 include $(ALIHLT_TOPDIR)/Makefile.conf
 
-SRCS =  AliL3Modeller.cxx AliL3ModelTrack.cxx AliL3ClusterFitter.cxx \
-        AliL3Compress.cxx AliL3DataCompressor.cxx 
+SRCS =  AliL3Modeller.cxx AliL3ClusterFitter.cxx \
+        AliL3Compress.cxx  AliL3DataCompressor.cxx 
+
+ifneq ($(ARCH),Darwin)
+SRCS += AliL3DataCompressorHelper.cxx AliL3ModelTrack.cxx
+endif
 
 ADD_C_OBJS = $(OBJDIR)/bitio.o $(OBJDIR)/errhand.o $(OBJDIR)/AliL3FitUtilities.o
 
index 553b610..ddcf4e2 100644 (file)
@@ -1,3 +1,58 @@
+2004-01-28  Anders Strand Vestbo  <vestbo@hansa>
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3ClusterFitter.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3Compress.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3Models.h, /alice/cvs/hltcvs/level3code/comp/AliL3ModelTrack.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3ModelTrack.h:
+       Changing the names of data members AliL3ClusterModel::fDSigmaY2 and fDSigmaZ2
+       to fDSigmaY and fDSigmaZ, in order to reflect the fact that their are really
+       the sigmas and not sigma squared.
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3Compress.cxx: Bugfix.
+
+2004-01-25  Anders Strand Vestbo  <vestbo@hansa>
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.cxx: Bugfix.
+
+2004-01-24  Anders Strand Vestbo  <vestbo@hansa>
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3OfflineDataCompressor.cxx:
+       Bugfix
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.h:
+       Added function to make a pass over the data and calculate how many bits
+       is required to encode the residuals (assuming no further compression).
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3Compress.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3Compress.h:
+       Added function to calculate entropy of the quantized residuals.
+
+2004-01-23  Anders Strand Vestbo  <vestbo@hansa>
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3CompLinkDef.h, /alice/cvs/hltcvs/level3code/comp/AliL3Compress.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.h, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressorHelper.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressorHelper.h, /alice/cvs/hltcvs/level3code/comp/AliL3ModelTrack.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3ModelTrack.h:
+       - Changed back to the old method for quantizing the residuals, since
+       there appeared some strange behaviour when running the code in multi-event
+       mode. It still remains a mystery, so this problem has been postponed and will
+       be solved sometime in the future.
+       - Removed some obsolute code as a result of moving the handling of remaining
+       clusters from AliL3DataCompressor to AliL3Compress.
+
+2004-01-22  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3Compress.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3Compress.h, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressor.h, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressorHelper.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3DataCompressorHelper.h, /alice/cvs/hltcvs/level3code/comp/AliL3FitUtilities.h, /alice/cvs/hltcvs/level3code/comp/AliL3ModelTrack.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3OfflineDataCompressor.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3OfflineDataCompressor.h:
+       Introduced new class AliL3DataCompressorHandler, which is static
+       and capsulates all static calls from the former Compressor
+       class in order to remove some very nasty dependencies.
+       The other classes had to be adapter to call the
+       right static function.
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3CompLinkDef.h, /alice/cvs/hltcvs/level3code/comp/Makefile:
+       Changes to compile for MACOSX at core Makefiles. Check for
+       $(ARCH) and -D$(ARCH). In order to solve cyclic dependencies
+       for libs (which is _very_ bad, but the Linux linker is friendly)
+       a few changes have to be done (moving files around) which
+       we dont do at the moment. SO: Linux users should see _NO_
+       difference!!!
+
+       * /alice/cvs/hltcvs/level3code/comp/AliL3ClusterFitter.cxx:
+       Paranoic change :-)
+
 2004-01-09  Anders Strand Vestbo  <vestbo@hansa>
 
        * /alice/cvs/hltcvs/level3code/comp/AliL3ModelTrack.cxx, /alice/cvs/hltcvs/level3code/comp/AliL3ModelTrack.h:
index 21b54b8..ecf461f 100644 (file)
@@ -1,3 +1,7 @@
+2004-01-22  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/doc/taginfo: Added new tag.
+
 2003-11-18  Constantin Loizides  <loizides@hansa>
 
        * /alice/cvs/hltcvs/level3code/doc/README: Added newio define.
index 92b318b..b0ccd39 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-02  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/exa/deconvclusters.C, /alice/cvs/hltcvs/level3code/exa/rootlogon.C, /alice/cvs/hltcvs/level3code/exa/runhough.C, /alice/cvs/hltcvs/level3code/exa/runtracker.C, /alice/cvs/hltcvs/level3code/exa/SetFitParameters.C, /alice/cvs/hltcvs/level3code/exa/SetHoughParameters.C:
+       Updated macros to latest parameter settings, added compiled version of runhough, deconvcluster and runtracker. Added static index support, loading if possible and some benchmark info.
+
 2003-11-18  Constantin Loizides  <loizides@hansa>
 
        * /alice/cvs/hltcvs/level3code/exa/SetFitParameters.C, /alice/cvs/hltcvs/level3code/exa/SetHoughParameters.C, /alice/cvs/hltcvs/level3code/exa/runhough.C:
index 10309c8..eff84e7 100644 (file)
@@ -1,3 +1,21 @@
+2004-02-02  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/hough/AliL3HoughBaseTransformer.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HoughBaseTransformer.h, /alice/cvs/hltcvs/level3code/hough/AliL3Hough.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HoughTransformer.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HoughTransformerLUT.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HoughTransformerLUT.h, /alice/cvs/hltcvs/level3code/hough/AliL3HoughTransformerNew.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HoughTransformerVhdl.h:
+       Reworked the LUT version of the Hough Transform. This should be the default transformer now, it is 3 times faster than the normal transformer. It produces almost the same peaks, in a central event, a few differ. The reason seems to be due to rounding. The efficiency of the deconvoluter is verified to be the same, too.
+
+       * /alice/cvs/hltcvs/level3code/hough/AliL3HistogramAdaptive.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HistogramAdaptive.h, /alice/cvs/hltcvs/level3code/hough/AliL3Histogram.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3Histogram.h:
+       Added ostream& <<operator for debugging purposes, because of that changed most get member function  to const.
+
+2004-01-22  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/hough/AliL3HoughLinkDef.h, /alice/cvs/hltcvs/level3code/hough/Makefile:
+       Changes to compile for MACOSX at core Makefiles. Check for
+       $(ARCH) and -D$(ARCH). In order to solve cyclic dependencies
+       for libs (which is _very_ bad, but the Linux linker is friendly)
+       a few changes have to be done (moving files around) which
+       we dont do at the moment. SO: Linux users should see _NO_
+       difference!!!
+
 2003-11-18  Anders Strand Vestbo  <vestbo@hansa>
 
        * /alice/cvs/hltcvs/level3code/hough/AliL3Hough.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HoughMaxFinder.cxx, /alice/cvs/hltcvs/level3code/hough/AliL3HoughMaxFinder.h:
index 00f72cc..443ec45 100644 (file)
@@ -1,3 +1,8 @@
+2004-02-02  Thomas Vik  <tvik@hansa>
+
+       * /alice/cvs/hltcvs/level3code/kalman/AliL3Kalman.cxx:
+       Added track label to rootfile with the kalman cariables.
+
 2003-10-13  Thomas Vik  <tvik@hansa>
 
        * /alice/cvs/hltcvs/level3code/kalman/AliL3KalmanTrack.h, /alice/cvs/hltcvs/level3code/kalman/AliL3KalmanTrack.cxx:
index 286c347..53cecb7 100644 (file)
@@ -1,3 +1,16 @@
+2004-01-22  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/misc/AliL3MiscLinkDef.h, /alice/cvs/hltcvs/level3code/misc/Makefile:
+       Changes to compile for MACOSX at core Makefiles. Check for
+       $(ARCH) and -D$(ARCH). In order to solve cyclic dependencies
+       for libs (which is _very_ bad, but the Linux linker is friendly)
+       a few changes have to be done (moving files around) which
+       we dont do at the moment. SO: Linux users should see _NO_
+       difference!!!
+
+       * /alice/cvs/hltcvs/level3code/misc/AliL3DDLRawReaderFile.h, /alice/cvs/hltcvs/level3code/misc/AliL3DDLRawReader.h, /alice/cvs/hltcvs/level3code/misc/AliL3DDLTPCRawStream.h:
+       Update to ALIROOT head version.
+
 2003-11-25  Constantin Loizides  <loizides@hansa>
 
        * /alice/cvs/hltcvs/level3code/misc/AliL3DDLDataFileHandler.cxx:
index da1a256..cbd2b52 100644 (file)
@@ -1,3 +1,58 @@
+2004-02-02  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/src/AliLevel3.cxx:
+       Added static index support for aliroot files.
+
+       * /alice/cvs/hltcvs/level3code/src/AliL3FileHandler.cxx, /alice/cvs/hltcvs/level3code/src/AliL3FileHandler.h:
+       Added static index support. This means, that if you are working with several filehandlers on one rootfile, only once the index will be created. Be careful, only one such static index exists per session, so if you want to use two input digit root files, it would not why (but why would you need two?). Also you can load/store the index to a file (see the exa example) which decreases debugging time.
+
+2004-01-27  Anders Strand Vestbo  <vestbo@hansa>
+
+       * /alice/cvs/hltcvs/level3code/src/AliL3ConfMapFit.cxx, /alice/cvs/hltcvs/level3code/src/AliL3ConfMapTrack.cxx, /alice/cvs/hltcvs/level3code/src/AliL3Fitter.cxx, /alice/cvs/hltcvs/level3code/src/AliL3Fitter.h, /alice/cvs/hltcvs/level3code/src/AliL3TrackArray.cxx, /alice/cvs/hltcvs/level3code/src/AliL3Track.cxx, /alice/cvs/hltcvs/level3code/src/AliLevel3.cxx, /alice/cvs/hltcvs/level3code/src/AliLevel3.h:
+       Changes related to how the track parameters are calculated and stored.
+       There should be no changes for normal use, i.e. the function calls are
+       still the same. The changes are the following:
+
+       - Most importantly, the first point on a track (accessible via
+       AliL3Track::GetFirstPoint()) is now calculated as the point lying on the helix
+       fit. Earlier, this point was just the coordinates of the innermost assigned
+       cluster of the track. This is in principle ok if you just want the quick
+       "global" coordinates of the track; momentum etc.  However, for precisce local
+       calculations such as residuals, this point should be the point of closest
+       approach lying on the helix fit. If not, the calculated track parameters (such
+       as center of curvature) will be slightly shifted. The tracks are updated to the
+       first point if the AliLevel3::fIsTracksAtFirstPoint is set to true (which is
+       default). If this is not desired, and the track should be defined at the vertex
+       (not DCAO!), you can still do AliLevel3::SetTracks2Vertex().
+
+       - A new static boolean has been introduced in AliLevel3::fDoVertexFit, which
+       tells the track fitter to include the vertex in the fit or not.
+
+       - A (minor) bugfix was also done in AliL3TrackArray.
+
+2004-01-23  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/src/Makefile: Fixed dep for linux.
+
+2004-01-22  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/src/AliL3SrcLinkDef.h, /alice/cvs/hltcvs/level3code/src/Makefile:
+       Changes to compile for MACOSX at core Makefiles. Check for
+       $(ARCH) and -D$(ARCH). In order to solve cyclic dependencies
+       for libs (which is _very_ bad, but the Linux linker is friendly)
+       a few changes have to be done (moving files around) which
+       we dont do at the moment. SO: Linux users should see _NO_
+       difference!!!
+
+       * /alice/cvs/hltcvs/level3code/src/AliL3GlobalMerger.h, /alice/cvs/hltcvs/level3code/src/AliL3InterMerger.h, /alice/cvs/hltcvs/level3code/src/AliL3TrackMerger.h:
+       Changed to compile with gcc-3.4
+
+       * /alice/cvs/hltcvs/level3code/src/AliL3FileHandler.cxx:
+       Changed to avoid warning of gcc-3.4.
+
+       * /alice/cvs/hltcvs/level3code/src/AliL3Transform.h:
+       Changed order to avoid warning of gcc-3.4.
+
 2003-11-26  Anders Strand Vestbo  <vestbo@hansa>
 
        * /alice/cvs/hltcvs/level3code/src/AliL3ConfMapTrack.cxx, /alice/cvs/hltcvs/level3code/src/AliL3Fitter.cxx, /alice/cvs/hltcvs/level3code/src/AliLevel3.cxx, /alice/cvs/hltcvs/level3code/src/AliLevel3.h:
index a46cbcf..cdef080 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-22  Constantin Loizides  <loizides@hansa>
+
+       * /alice/cvs/hltcvs/level3code/Makefile.conf, /alice/cvs/hltcvs/level3code/Makefile.rules:
+       Changes to compile for MACOSX at core Makefiles. Check for
+       $(ARCH) and -D$(ARCH). In order to solve cyclic dependencies
+       for libs (which is _very_ bad, but the Linux linker is friendly)
+       a few changes have to be done (moving files around) which
+       we dont do at the moment. SO: Linux users should see _NO_
+       difference!!!
+
 2003-11-18  Constantin Loizides  <loizides@hansa>
 
        * /alice/cvs/hltcvs/level3code/Makefile.conf, /alice/cvs/hltcvs/level3code/Makefile.rules:
index 3335a3f..20004be 100644 (file)
@@ -2,12 +2,11 @@
 
 void SetFitParameters(AliL3ClusterFitter *fitter)
 {
-
-  fitter->SetInnerWidthFactor(1,1.5);
-  fitter->SetOuterWidthFactor(1,1.5);
+  fitter->SetInnerWidthFactor(1,1);
+  fitter->SetOuterWidthFactor(1,1);
   fitter->SetNmaxOverlaps(5);
-  
-  //fitter->SetChiSqMax(5,kFALSE); //isolated clusters
-  fitter->SetChiSqMax(5,kTRUE);  //overlapping clusters
 
+  fitter->SetChiSqMax(5,0);
+  fitter->SetChiSqMax(5,1);
+  fitter->SetChiSqMax(5,2);
 }
index 1417449..9d68bbe 100644 (file)
@@ -1,8 +1,7 @@
 //$Id$
 
-void SetHoughParameters(AliL3Hough *hough,Char_t *path)
+void SetHoughParameters(AliL3Hough *hough,Char_t *path,Int_t tversion=1)
 {
-  
   bool binary = kTRUE;    //binary files input
   int n_eta_segments=100;
   double histptmin = 0.5; //mininum pt to find (controls the histogram range)
@@ -10,20 +9,14 @@ void SetHoughParameters(AliL3Hough *hough,Char_t *path)
   int threshold=6000;  //peak threshold
   int nxbins = 140;
   int nybins = 150;
+  //Int_t threshold=5000;  //peak threshold
+  //Int_t nxbins = 190;
+  //Int_t nybins = 200;
   
   int patch=-1; //-1 -> Hough transform on slices (means adding histograms)
   
   hough->SetThreshold(4); //noise threshold on single digits
   hough->SetTransformerParams(nxbins,nybins,histptmin,patch);
-
-/*
-  hough->SetTransformerParams(0.068,histptmin,histptmax,20,0);
-  hough->SetTransformerParams(0.043,histptmin,histptmax,23,1);
-  hough->SetTransformerParams(0.03,histptmin,histptmax,25,2);
-  hough->SetTransformerParams(0.02,histptmin,histptmax,25,3);
-  hough->SetTransformerParams(0.016,histptmin,histptmax,30,4);
-  hough->SetTransformerParams(0.012,histptmin,histptmax,30,5);
-*/
   hough->SetPeakThreshold(threshold,patch);
-  hough->Init(path,binary,n_eta_segments);
+  hough->Init(path,binary,n_eta_segments,kFALSE,tversion);
 }
index f0630a9..c2e4caa 100644 (file)
@@ -6,7 +6,7 @@
    The path "path" should contain the link to the digitsfile, 
    and the directories called fitter (for the results) and hough
    (for the track files). For NEWIO, make sure that the file 
-   TPC.Digits.root is in the path!
+   TPC.Digits.root is in the path (symlink)!
 
    Also provide the neccessary parameters in SetFitParameters.C.
 
    supported right now.
 */
 
-void deconvclusters(char *path,int minslice=0,int maxslice=35,int nevent=1)
+#ifndef __CINT__
+#include "AliL3Logger.h"
+#include "AliL3FileHandler.h"
+#include "AliL3DigitData.h"
+#include "AliL3Track.h"
+#include "AliL3Transform.h"
+#include "AliL3Hough.h"
+#include "AliL3Fitter.h"
+#include "AliL3ClusterFitter.h"
+#include "AliL3Vertex.h"
+#include "AliL3TrackArray.h"
+#include <TNtuple.h>
+#include <TRandom.h>
+#include <TSystem.h>
+#include <TStopwatch.h>
+#include <stdio.h>
+#include <iostream.h>
+#include <time.h>
+#endif
+
+void deconvclusters(Char_t *path,Int_t minslice=0,Int_t maxslice=35,Int_t nevent=1)
 {
   
   AliL3Transform::Init(path,kTRUE);
   
-  char filename[1024];
-  AliL3FileHandler *file = new AliL3FileHandler();
+  Char_t filename[1024];
+  AliL3FileHandler *file = new AliL3FileHandler(kTRUE); //static index
   UInt_t ndigits=0;
   
   sprintf(filename,"%s/digitfile.root",path);
-  
   file->SetAliInput(filename);
-  int index=0;
-  
   AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path);
   
-  char macroname[1024];
+#ifdef __CINT__
+  Char_t macroname[1024];
   gROOT->LoadMacro("SetFitParameters.C");
   SetFitParameters(fitter);
-  
-  int patch=-1;
-  int rowrange[2] = {0,AliL3Transform::GetNRows()-1};
-  
-  for(int ev=0; ev<nevent; ev++)
+#else /*compiled version */
+  fitter->SetInnerWidthFactor(1,1);
+  fitter->SetOuterWidthFactor(1,1);
+  fitter->SetNmaxOverlaps(5);
+
+  fitter->SetChiSqMax(5,0);
+  fitter->SetChiSqMax(5,1);
+  fitter->SetChiSqMax(5,2);
+#endif
+  
+  TStopwatch tloader;tloader.Stop();
+  TStopwatch tfinder;tfinder.Stop();
+  TStopwatch trefitter;trefitter.Stop();
+
+  Int_t patch=-1;
+  Int_t rowrange[2] = {0,AliL3Transform::GetNRows()-1};  
+  for(Int_t ev=0; ev<nevent; ev++)
     {
-      fitter->LoadSeeds(rowrange,kFALSE,ev);//Takes input from global hough tracks
+      AliL3FileHandler::LoadStaticIndex(0,ev);
+      fitter->LoadSeeds(rowrange,kFALSE,ev); //Takes input from global hough tracks
       
-      for(int slice=minslice; slice<=maxslice; slice++)
+      for(Int_t slice=minslice; slice<=maxslice; slice++)
        {
+         tloader.Start(0);
          file->Init(slice,-1);
          cout<<"Processing event "<<ev<<" slice "<<slice<<" patch "<<patch<<endl;
          AliL3DigitRowData *digits = (AliL3DigitRowData*)file->AliAltroDigits2Memory(ndigits,ev);
-         
          fitter->Init(slice,patch);
          fitter->SetInputData(digits);
+         tloader.Stop();
          
+         tfinder.Start(0);
          fitter->FindClusters();
-         
          fitter->WriteClusters();
-         
+         tfinder.Stop();
+
+         tloader.Start(0);
          file->Free();
-         
+         tloader.Stop();
        }
       
       //If you want a refit of the clusters;-------------------------
+      tloader.Start(0);
       AliL3Vertex vertex;
-      AliL3TrackArray *tracks = fitter->GetSeeds(); //The seeds are the input tracks from circle HT
+      AliL3TrackArray *tracks = fitter->GetSeeds(); //The seeds are the 
+                                                    //input tracks from circle HT
       AliL3Fitter *ft = new AliL3Fitter(&vertex,1);
       sprintf(filename,"%s/fitter/",path);
       ft->LoadClusters(filename,0,kTRUE);
+      tloader.Stop();
+
+      trefitter.Start(0);
       for(Int_t i=0; i<tracks->GetNTracks(); i++)
        {
-         track = tracks->GetCheckedTrack(i);
+         AliL3Track *track = tracks->GetCheckedTrack(i);
          if(!track) continue;
          if(track->GetNHits() < 40) continue;
          ft->SortTrackClusters(track);
          ft->FitHelix(track);
-         ft->UpdateTrack(track);
+         track->UpdateToFirstPoint();
        }
-      delete ft;
+      trefitter.Stop();
       //-------------------------------------------------------------
-      
+      tloader.Start(0);
+      delete ft;
       fitter->WriteTracks(5); //Write the final tracks
       file->FreeDigitsTree();
+      tloader.Stop();
     }
+  cout << " --- Timing values --- " << endl;
+  cout << "Data  Loading:        "; tloader.Print("m");
+  cout << "Cluster Deconvolution "; tfinder.Print("m");
+  cout << "Track ReFitter        "; trefitter.Print("m");
+
   delete fitter;
 }
 
-
-void deconvlocally(char *path,int minslice=0,int maxslice=17)
+void deconvlocally(Char_t *path,Int_t minslice=0,Int_t maxslice=17)
 {
   
   AliL3Transform::Init(path,kTRUE);
   
-  char filename[1024];
-  AliL3FileHandler *file = new AliL3FileHandler();
+  Char_t filename[1024];
+  AliL3FileHandler *file = new AliL3FileHandler(kTRUE);
   UInt_t ndigits=0;
   
   sprintf(filename,"%s/digitfile.root",path);
-  
   file->SetAliInput(filename);
-  int index=0;
-  
   AliL3ClusterFitter *fitter = new AliL3ClusterFitter(path);
   
-  char macroname[1024];
+#ifdef __CINT__
+  Char_t macroname[1024];
   sprintf(macroname,"%s/SetFitParameters.C",path);
   gROOT->LoadMacro(macroname);
   SetFitParameters(fitter);
+#else /*compiled version */
+  fitter->SetInnerWidthFactor(1,1);
+  fitter->SetOuterWidthFactor(1,1);
+  fitter->SetNmaxOverlaps(5);
+
+  fitter->SetChiSqMax(5,0);
+  fitter->SetChiSqMax(5,1);
+  fitter->SetChiSqMax(5,2);
+#endif
   
-  int patch=-1;
+  Int_t patch=-1;
   
-  for(int slice=minslice; slice<=maxslice; slice++)
+  for(Int_t slice=minslice; slice<=maxslice; slice++)
     {
       file->Init(slice,patch);
       cout<<"Processing slice "<<slice<<" patch "<<patch<<endl;
index 0ea3a1d..859402f 100644 (file)
@@ -61,6 +61,9 @@
       gErrorIgnoreLevel=kFatal; //dont report errors
       gSystem->Load("MakePileup_C.so");
       gSystem->Load("Read_C.so");
+      gSystem->Load("runhough_C.so");
+      gSystem->Load("deconvclusters_C.so");
+      gSystem->Load("runtracker_C.so");
       gErrorIgnoreLevel=saveErrIgLevel;
 
       if(strcmp("true",getenv("ALIHLT_DOMC"))==0) gSystem->SetIncludePath(" -Ddo_mc");
index 773abee..786e4a9 100644 (file)
@@ -10,7 +10,8 @@
    to the rootfile containing AliROOT digits tree 
    and a symbolic link "alirunfile.root" pointing to a file 
    containing the ALIROOT geometry (TPC param).
-   For NEWIO, make sure that the file TPC.Digits.root is in the path!
+   For NEWIO, make sure that the file TPC.Digits.root is in the 
+   path (or make a symlink to it)!
  
    Also provide the neccessary parameters in SetHoughParameters.C.
 
 
 */
 
-void runhough(Char_t *path,Char_t *outpath,int s1=0,int s2=35,int nevent=1)
+#ifndef __CINT__
+#include "AliL3Logger.h"
+#include "AliL3FileHandler.h"
+#include "AliL3DigitData.h"
+#include "AliL3Transform.h"
+#include "AliL3Hough.h"
+#include "AliL3TrackArray.h"
+#include "AliL3Track.h"
+#include "AliL3HoughTrack.h"
+#include <TNtuple.h>
+#include <TRandom.h>
+#include <TSystem.h>
+#include <TStopwatch.h>
+#include <stdio.h>
+#include <iostream.h>
+#include <time.h>
+#endif
+
+void runhough(Char_t *path,Char_t *outpath,Int_t s1=0,Int_t s2=35,Int_t nevent=1)
 {
 
   Bool_t isinit=AliL3Transform::Init(path,kTRUE);
@@ -26,29 +45,70 @@ void runhough(Char_t *path,Char_t *outpath,int s1=0,int s2=35,int nevent=1)
     cerr << "Could not create transform settings, please check log for error messages!" << endl;
     return;
   }
-  
-  hough = new AliL3Hough();
 
-  char macroname[1024];
-  sprintf(macroname,"SetHoughParameters.C",path);
+  Int_t tversion=1; //0 = normal transformer
+                    //1 = LUT transformer
+
+  AliL3Hough *hough = new AliL3Hough();
+#ifdef __CINT__
+  Char_t macroname[1024];
+  sprintf(macroname,"SetHoughParameters.C");
   gROOT->LoadMacro(macroname);
-  SetHoughParameters(hough,path);
+  SetHoughParameters(hough,path,tversion);
+#else /*compiled version*/
+  Bool_t binary = kFALSE;    //binary files input
+  Int_t n_eta_segments=100;
+  Double_t histptmin = 0.5; //mininum pt to find (controls the histogram range) 
+  Int_t threshold=6000;  //peak threshold
+  //Int_t threshold=5000;  //peak threshold
+  Int_t nxbins = 140;
+  Int_t nybins = 150;
+  //Int_t nxbins = 190;
+  //Int_t nybins = 200;
+  Int_t patch=-1; //-1 -> Hough transform on slices (means adding histograms)
+  hough->SetThreshold(4); //noise threshold on single digits
+  hough->SetTransformerParams(nxbins,nybins,histptmin,patch);
+  hough->SetPeakThreshold(threshold,patch);
+  hough->Init(path,binary,n_eta_segments,kFALSE,tversion); 
+#endif
 
-  for(int ev=0; ev<nevent; ev++)
+  TStopwatch tloader;tloader.Stop();
+  TStopwatch ttransform;ttransform.Stop();
+  TStopwatch tfinder;tfinder.Stop();
+
+  for(Int_t ev=0; ev<nevent; ev++)
     {
-      for(int slice=s1; slice<=s2; slice++)
+      AliL3FileHandler::LoadStaticIndex(0,ev);
+      for(Int_t slice=s1; slice<=s2; slice++)
        {
          cout<<"Processing slice "<<slice<<endl;
-         hough->ReadData(slice,ev);
-         hough->Transform();
+         tloader.Start(0);hough->ReadData(slice,ev);tloader.Stop();
+         ttransform.Start(0);hough->Transform();ttransform.Stop();
+         tfinder.Start(0);
          hough->AddAllHistograms();
          hough->FindTrackCandidates();
          hough->AddTracks();
+         tfinder.Stop();
+#if 0 /*print track list */
+         AliL3TrackArray *tracks = (AliL3TrackArray*)hough->GetTracks(0);
+         tracks->QSort();
+         for(int i=0; i<tracks->GetNTracks(); i++)
+           {
+             AliL3HoughTrack *track = (AliL3HoughTrack*)tracks->GetCheckedTrack(i);
+             if(!track) continue;
+             cout<<"pt "<<track->GetPt()<<" psi "<<track->GetPsi()<<" eta "<<track->GetEta()<<" etaindex "<<track->GetEtaIndex()<<" weight "<<track->GetWeight()<<endl;
+           }
+#endif
        }
       hough->WriteTracks(outpath);
+      AliL3FileHandler::SaveStaticIndex(0,ev);
     }
+
+  cout << " --- Timing values --- " << endl;
+  cout << "Data  Loading:     "; tloader.Print("m");
+  cout << "Hough Transforming "; ttransform.Print("m");
+  cout << "Track Finding      "; tfinder.Print("m");
   
   delete hough;
-  
 }
 
index d9728e7..a10f6bd 100644 (file)
@@ -8,23 +8,38 @@
    make a symbolic link "digitfile.root", which points to the rootfile containing AliROOT 
    digits tree and a symbolic link "alirunfile.root" pointing to a file containing
    the ALIROOT geometry (TPC param). For NEWIO, make sure that the 
-   file TPC.Digits.root is in the path!
+   file TPC.Digits.root is in the path (symlink)!
 
    RUN with ALIROOT (not ROOT) if using root files.
 */
 
-void runtracker(Int_t minslice=0,Int_t maxslice=35,Char_t* path="./",Int_t nevent=1,Char_t *opath="./")
+#ifndef __CINT__
+#include "AliL3Logger.h"
+#include "AliL3FileHandler.h"
+#include "AliL3DigitData.h"
+#include "AliL3Transform.h"
+#include "AliLevel3.h"
+#include <TNtuple.h>
+#include <TRandom.h>
+#include <TSystem.h>
+#include <stdio.h>
+#include <iostream.h>
+#include <time.h>
+#endif
+
+void runtracker(Int_t minslice=0,Int_t maxslice=35,Char_t* path="./",Int_t nevent=1,Char_t *opath="./tracker/")
 {
   //Set your configuration here:
   AliLevel3::EFileType filetype=AliLevel3::kRoot; //Input is RLE binary files or rootfile.
   Bool_t pileup=kFALSE; //Assume input is pileup event = non RLE binary files.
   Int_t npatches = 1;   //Options; 1, 2 and 6.
+#ifdef __CINT__
   Char_t trackparams[] = "SetTrackingParameters_4000bf04.C"; //Set this to correspond 
                                                              //with mult. and BField
+#endif
   
   //for aliroot the path should point to a file 
   //containing the tpc geometry called alirunfile.root
-  //Bool_t isinit=AliL3Transform::Init(path,!binary);
   Bool_t isinit=AliL3Transform::Init(path,(filetype!=AliLevel3::kBinary));
   if(!isinit){
     cerr << "Could not create transform settings, please check log for error messages!" << endl;
@@ -33,6 +48,7 @@ void runtracker(Int_t minslice=0,Int_t maxslice=35,Char_t* path="./",Int_t neven
 
   for(Int_t ev=0; ev<nevent; ev++)
     {
+      AliLevel3 *a;
       if(filetype==AliLevel3::kBinary)
        a = new AliLevel3();
       else 
@@ -47,39 +63,50 @@ void runtracker(Int_t minslice=0,Int_t maxslice=35,Char_t* path="./",Int_t neven
       
       a->Init(path,filetype,npatches);
       
-      if(pileup)
-       a->DoPileup();
-      
+#ifdef __CINT__
       gROOT->LoadMacro(trackparams);
       SetTrackingParameters(a);
+#else /* compiled for 4000 and 0.4 */
+      Int_t phi_segments,eta_segments,trackletlength,tracklength;
+      Int_t rowscopetracklet,rowscopetrack;
+      Double_t min_pt_fit,maxangle,goodDist,hitChi2Cut,xyerror,zerror;
+      Double_t goodHitChi2,trackChi2Cut,maxphi,maxeta;
 
-#if 0 /* little comments */
-      phi_segments = 50;   //devide the space into phi_segments and eta_segments
-      eta_segments = 100;  //to access the search of points to that area!
-      trackletlength = 3;  //number of hits a tracklet has to have
-      tracklength = 5;     //number of hits a track has to have 
-      rowscopetracklet = 2;//search range of rows for a tracklet
-      rowscopetrack = 2;   //search range of rows for a track
+      phi_segments = 50;    //devide the space into phi_segments and eta_segments
+      eta_segments = 100;   //to access the search of points to that area!
+      trackletlength = 3;   //number of hits a tracklet has to have
+      tracklength = 10;     //number of hits a track has to have 
+      rowscopetracklet = 2; //search range of rows for a tracklet
+      rowscopetrack = 10;   //search range of rows for a track
       min_pt_fit = 0;      
-      maxangle = 1.31;     //maximum angle for the three point look ahead
+      maxangle = 0.1745;   //AliL3Transform::Deg2Rad(10);
+                           //maximum angle for the three point look ahead
       goodDist = 5;        //threshold distance between two hits when building tracklets
-      maxphi=100;          //maximum phi difference for neighboring hits
-      maxeta=100;          //maximum eta difference for neighboring hits
-      hitChi2Cut = 100;    //maximum chi2 of added hit to track
-      goodHitChi2 = 20;    //stop looking for next hit to add if chi2 is less than goodHitChi2
-      trackChi2Cut = 50;   //maximum chi2 for track after final fit
+      maxphi=0.1;          //maximum phi difference for neighboring hits
+      maxeta=0.1;          //maximum eta difference for neighboring hits
+      hitChi2Cut = 20;     //maximum chi2 of added hit to track
+      goodHitChi2 = 5;     //stop looking for next hit to add if chi2 is less than goodHitChi2
+      trackChi2Cut = 10;   //maximum chi2 for track after final fit
+      xyerror = -1;
+      zerror =  -1;
+  
+      a->SetClusterFinderParam(xyerror,zerror,kTRUE);
+      a->SetTrackerParam(phi_segments,eta_segments,trackletlength,tracklength,
+                          rowscopetracklet,rowscopetrack,
+                          min_pt_fit,maxangle,goodDist,hitChi2Cut,
+                          goodHitChi2,trackChi2Cut,50,maxphi,maxeta,kTRUE);
 #endif
 
-
+      if(pileup)
+       a->DoPileup();
       //a->DoRoi();    /*do region of interest*/
       //a->DoMc();     /*do monte carlo identification*/
       a->WriteFiles(opath); /*enable output*/
-      
       a->ProcessEvent(minslice,maxslice);
-      //a->DoBench("benchmark_0");
+      a->DoBench("benchmark_0");
 
       delete a;
-    }
+    } // event loop
 }
 
 
index 55403cf..779119c 100644 (file)
@@ -3,7 +3,10 @@
 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
 //*-- Copyright &copy ALICE HLT Group
 
+#include <ostream.h>
+
 #include "AliL3StandardIncludes.h"
+
 #include "AliL3Logging.h"
 #include "AliL3Histogram.h"
 
@@ -99,7 +102,7 @@ void AliL3Histogram::Fill(Double_t x,Double_t y,Int_t weight)
   AddBinContent(bin,weight);
 }
 
-Int_t AliL3Histogram::FindBin(Double_t x,Double_t y)
+Int_t AliL3Histogram::FindBin(Double_t x,Double_t y) const
 {
   Int_t xbin = FindXbin(x);
   Int_t ybin = FindYbin(y);
@@ -109,7 +112,7 @@ Int_t AliL3Histogram::FindBin(Double_t x,Double_t y)
   return GetBin(xbin,ybin);
 }
 
-Int_t AliL3Histogram::FindXbin(Double_t x)
+Int_t AliL3Histogram::FindXbin(Double_t x) const
 {
   if(x < fXmin || x > fXmax)
     return 0;
@@ -117,7 +120,7 @@ Int_t AliL3Histogram::FindXbin(Double_t x)
   return 1 + (Int_t)(fNxbins*(x-fXmin)/(fXmax-fXmin));
 }
 
-Int_t AliL3Histogram::FindYbin(Double_t y)
+Int_t AliL3Histogram::FindYbin(Double_t y) const
 {
   if(y < fYmin || y > fYmax)
     return 0;
@@ -125,7 +128,7 @@ Int_t AliL3Histogram::FindYbin(Double_t y)
   return 1 + (Int_t)(fNybins*(y-fYmin)/(fYmax-fYmin));
 }
 
-Int_t AliL3Histogram::GetBin(Int_t xbin,Int_t ybin)
+Int_t AliL3Histogram::GetBin(Int_t xbin,Int_t ybin) const
 {
   if(xbin < fFirstXbin || xbin > fLastXbin)
     return 0;
@@ -135,7 +138,7 @@ Int_t AliL3Histogram::GetBin(Int_t xbin,Int_t ybin)
   return xbin + ybin*(fNxbins+2);
 }
 
-Int_t AliL3Histogram::GetBinContent(Int_t bin)
+Int_t AliL3Histogram::GetBinContent(Int_t bin) const
 {
   if(bin >= fNcells)
     {
@@ -225,7 +228,7 @@ void AliL3Histogram::Add(AliL3Histogram *h1,Double_t weight)
   fEntries += h1->GetNEntries();
 }
 
-Double_t AliL3Histogram::GetBinCenterX(Int_t xbin)
+Double_t AliL3Histogram::GetBinCenterX(Int_t xbin) const
 {
   if(xbin < fFirstXbin || xbin > fLastXbin)
     {
@@ -233,11 +236,11 @@ Double_t AliL3Histogram::GetBinCenterX(Int_t xbin)
        <<"Bin-value out of range "<<xbin<<ENDLOG;
       return -1;
     }
-  //  return fXmin + (xbin-1) * fBinwidthX + 0.5*fBinwidthX;
+
   return fXmin + (xbin-0.5) * fBinwidthX;
 }
 
-Double_t AliL3Histogram::GetBinCenterY(Int_t ybin)
+Double_t AliL3Histogram::GetBinCenterY(Int_t ybin) const
 {
   if(ybin < fFirstYbin || ybin > fLastYbin)
     {
@@ -245,7 +248,7 @@ Double_t AliL3Histogram::GetBinCenterY(Int_t ybin)
        <<"Bin-value out of range "<<ybin<<ENDLOG;
       return -1;
     }
-  //  return fYmin + (ybin-1) * fBinwidthY + 0.5*fBinwidthY;
+
   return fYmin + (ybin-0.5) * fBinwidthY;
 }
 
@@ -280,3 +283,17 @@ void AliL3Histogram::CreateRootHisto()
 #endif
   cerr<<"AliL3Histogram::CreateRootHisto : You need to compile with ROOT in order to create ROOT histogram"<<endl;
 }
+
+ostream& operator<<(ostream &o, const AliL3Histogram &h)
+{
+  for(Int_t xbin=h.GetFirstXbin(); xbin<=h.GetLastXbin(); xbin++)
+    {
+      for(Int_t ybin=h.GetFirstYbin(); ybin<=h.GetLastYbin(); ybin++)
+       {
+         Int_t bin = h.GetBin(xbin,ybin);
+         o << h.GetBinContent(bin) << " ";
+       }
+      o << endl;
+    }
+  return o;
+}
index 7dbfc4a..e2a86d1 100644 (file)
@@ -9,6 +9,8 @@
 #include <TH2.h>
 #endif
 
+class ostream;
+
 class AliL3Histogram {
   
  private:
@@ -45,11 +47,11 @@ class AliL3Histogram {
   
   void Reset();
   virtual void Fill(Double_t x,Double_t y,Int_t weight=1);
-  virtual Int_t FindBin(Double_t x,Double_t y);
-  virtual Int_t FindXbin(Double_t x);
-  virtual Int_t FindYbin(Double_t y);
-  Int_t GetBin(Int_t xbin,Int_t ybin);
-  Int_t GetBinContent(Int_t bin);
+  virtual Int_t FindBin(Double_t x,Double_t y) const;
+  virtual Int_t FindXbin(Double_t x) const;
+  virtual Int_t FindYbin(Double_t y) const;
+  Int_t GetBin(Int_t xbin,Int_t ybin) const;
+  Int_t GetBinContent(Int_t bin) const;
   void SetBinContent(Int_t xbin,Int_t ybin,Int_t value);
   void SetBinContent(Int_t bin,Int_t value);
   void AddBinContent(Int_t xbin,Int_t ybin,Int_t weight);
@@ -60,27 +62,29 @@ class AliL3Histogram {
   virtual void Draw(Char_t *option="hist");
   virtual void Print() {};
 
+  friend ostream& operator<< (ostream &o, const AliL3Histogram &h);
+
 #ifdef use_root
   TH2F *GetRootHisto();
 #else
   void *GetRootHisto();
 #endif
     
-  Double_t GetXmin() {return fXmin;}
-  Double_t GetXmax() {return fXmax;}
-  Double_t GetYmin() {return fYmin;}
-  Double_t GetYmax() {return fYmax;}
-  virtual Double_t GetBinCenterX(Int_t xbin);
-  virtual Double_t GetBinCenterY(Int_t ybin);
-  Double_t GetBinWidthX() {return fBinwidthX;}
-  Double_t GetBinWidthY() {return fBinwidthY;}
-  Int_t GetFirstXbin() {return fFirstXbin;}
-  Int_t GetLastXbin() {return fLastXbin;}
-  Int_t GetFirstYbin() {return fFirstYbin;}
-  Int_t GetLastYbin() {return fLastYbin;}
-  Int_t GetNbinsX() {return fNxbins;}
-  Int_t GetNbinsY() {return fNybins;}
-  Int_t GetNEntries() {return fEntries;}
+  Double_t GetXmin() const {return fXmin;}
+  Double_t GetXmax() const {return fXmax;}
+  Double_t GetYmin() const {return fYmin;}
+  Double_t GetYmax() const {return fYmax;}
+  virtual Double_t GetBinCenterX(Int_t xbin) const;
+  virtual Double_t GetBinCenterY(Int_t ybin) const;
+  Double_t GetBinWidthX() const {return fBinwidthX;}
+  Double_t GetBinWidthY() const {return fBinwidthY;}
+  Int_t GetFirstXbin() const {return fFirstXbin;}
+  Int_t GetLastXbin() const {return fLastXbin;}
+  Int_t GetFirstYbin() const {return fFirstYbin;}
+  Int_t GetLastYbin() const {return fLastYbin;}
+  Int_t GetNbinsX() const {return fNxbins;}
+  Int_t GetNbinsY() const {return fNybins;}
+  Int_t GetNEntries() const {return fEntries;}
   
   ClassDef(AliL3Histogram,1) //2D histogram class
     
index 373dcfe..8bb7c85 100644 (file)
@@ -105,7 +105,7 @@ void AliL3HistogramAdaptive::Fill(Double_t x,Double_t y,Int_t weight)
 
 }
 
-Int_t AliL3HistogramAdaptive::FindBin(Double_t x,Double_t y)
+Int_t AliL3HistogramAdaptive::FindBin(Double_t x,Double_t y) const
 {
   
   Int_t xbin = FindXbin(x);
@@ -116,7 +116,7 @@ Int_t AliL3HistogramAdaptive::FindBin(Double_t x,Double_t y)
   return GetBin(xbin,ybin);
 }
 
-Int_t AliL3HistogramAdaptive::FindXbin(Double_t x)
+Int_t AliL3HistogramAdaptive::FindXbin(Double_t x) const
 {
 
   if(x < fXmin || x > fXmax || fabs(x) < fKappaBins[(fNxbins/2-1)])
@@ -140,7 +140,7 @@ Int_t AliL3HistogramAdaptive::FindXbin(Double_t x)
   
 }
 
-Int_t AliL3HistogramAdaptive::FindYbin(Double_t y)
+Int_t AliL3HistogramAdaptive::FindYbin(Double_t y) const
 {
   if(y < fYmin || y > fYmax)
     return 0;
@@ -148,7 +148,7 @@ Int_t AliL3HistogramAdaptive::FindYbin(Double_t y)
   return 1 + (Int_t)(fNybins*(y-fYmin)/(fYmax-fYmin));
 }
 
-Double_t AliL3HistogramAdaptive::GetBinCenterX(Int_t xbin)
+Double_t AliL3HistogramAdaptive::GetBinCenterX(Int_t xbin) const
 {
   if(xbin < fFirstXbin || xbin > fLastXbin)
     {
@@ -177,7 +177,7 @@ Double_t AliL3HistogramAdaptive::GetBinCenterX(Int_t xbin)
 
 }
 
-Double_t AliL3HistogramAdaptive::GetBinCenterY(Int_t ybin)
+Double_t AliL3HistogramAdaptive::GetBinCenterY(Int_t ybin) const
 {
   if(ybin < fFirstYbin || ybin > fLastYbin)
     {
index 22926cb..56eb46d 100644 (file)
@@ -23,14 +23,14 @@ class AliL3HistogramAdaptive : public AliL3Histogram {
   ~AliL3HistogramAdaptive();
 
   void Fill(Double_t x,Double_t y,Int_t weight=1);
-  Int_t FindBin(Double_t x,Double_t y);
-  Int_t FindXbin(Double_t x);
-  Int_t FindYbin(Double_t x);
+  Int_t FindBin(Double_t x,Double_t y) const;
+  Int_t FindXbin(Double_t x) const;
+  Int_t FindYbin(Double_t x) const;
   void Draw(Char_t *option = "hist");
   void Print();
 
-  Double_t GetBinCenterX(Int_t xbin);
-  Double_t GetBinCenterY(Int_t ybin);
+  Double_t GetBinCenterX(Int_t xbin) const;
+  Double_t GetBinCenterY(Int_t ybin) const;
 
   ClassDef(AliL3HistogramAdaptive,1) //2D histogram class
     
index ad04c42..f8c301c 100644 (file)
@@ -86,12 +86,14 @@ AliL3Hough::AliL3Hough()
   SetThreshold();
   SetNSaveIterations();
   SetPeakThreshold();
+#ifdef use_aliroot
+  //just be sure that index is empty for new event
+    AliL3FileHandler::CleanStaticIndex(); 
+#endif
 }
 
 AliL3Hough::AliL3Hough(Char_t *path,Bool_t binary,Int_t n_eta_segments,Bool_t bit8,Int_t tv,Char_t *infile)
 {
-  //Default ctor.
-
   fBinary = binary;
   strcpy(fPath,path);
   fNEtaSegments  = n_eta_segments;
@@ -104,6 +106,11 @@ AliL3Hough::AliL3Hough(Char_t *path,Bool_t binary,Int_t n_eta_segments,Bool_t bi
     fInputFile = infile;
   else
     fInputFile = 0;
+
+#ifdef use_aliroot
+  //just be sure that index is empty for new event
+    AliL3FileHandler::CleanStaticIndex(); 
+#endif
 }
 
 AliL3Hough::~AliL3Hough()
@@ -113,16 +120,22 @@ AliL3Hough::~AliL3Hough()
   CleanUp();
   if(fMerger)
     delete fMerger;
+  //cout << "Cleaned class merger " << endl;
   if(fInterMerger)
     delete fInterMerger;
+  //cout << "Cleaned class inter " << endl;
   if(fPeakFinder)
     delete fPeakFinder;
+  //cout << "Cleaned class peak " << endl;
   if(fGlobalMerger)
     delete fGlobalMerger;
+  //cout << "Cleaned class global " << endl;
   if(fBenchmark)
     delete fBenchmark;
+  //cout << "Cleaned class bench " << endl;
   if(fGlobalTracks)
     delete fGlobalTracks;
+  //cout << "Cleaned class globaltracks " << endl;
 }
 
 void AliL3Hough::CleanUp()
@@ -132,16 +145,23 @@ void AliL3Hough::CleanUp()
   for(Int_t i=0; i<fNPatches; i++)
     {
       if(fTracks[i]) delete fTracks[i];
+      //cout << "Cleaned tracks " << i << endl;
       if(fEval[i]) delete fEval[i];
+      //cout << "Cleaned eval " << i << endl;
       if(fHoughTransformer[i]) delete fHoughTransformer[i];
+      //cout << "Cleaned traf " << i << endl;
       if(fMemHandler[i]) delete fMemHandler[i];
+      //cout << "Cleaned mem " << i << endl;
     }
   
   if(fTracks) delete [] fTracks;
+  //cout << "Cleaned class tracks " << endl;
   if(fEval) delete [] fEval;
+  //cout << "Cleaned class eval " << endl;
   if(fHoughTransformer) delete [] fHoughTransformer;
+  //cout << "Cleaned cleass trafo " << endl;
   if(fMemHandler) delete [] fMemHandler;
-  
+  //cout << "Cleaned class mem " << endl;
 }
 
 void AliL3Hough::Init(Char_t *path,Bool_t binary,Int_t n_eta_segments,Bool_t bit8,Int_t tv,Char_t *infile)
@@ -193,6 +213,7 @@ void AliL3Hough::Init(Bool_t doit, Bool_t addhists)
 
       fHoughTransformer[i]->CreateHistograms(fNBinX[i],fLowPt[i],fNBinY[i],-fPhi[i],fPhi[i]);
       //fHoughTransformer[i]->CreateHistograms(fLowPt[i],fUpperPt[i],fPtRes[i],fNBinY[i],fPhi[i]);
+
       fHoughTransformer[i]->SetLowerThreshold(fThreshold[i]);
       fHoughTransformer[i]->SetUpperThreshold(100);
 
@@ -208,7 +229,7 @@ void AliL3Hough::Init(Bool_t doit, Bool_t addhists)
        {
          if(!fInputFile) {
            /* In case of reading digits file */
-           fMemHandler[i] = new AliL3FileHandler();
+           fMemHandler[i] = new AliL3FileHandler(kTRUE); //use static index
            if(!fBinary) {
              Char_t filename[1024];
              sprintf(filename,"%s/digitfile.root",fPath);
@@ -356,8 +377,13 @@ void AliL3Hough::ReadData(Int_t slice,Int_t eventnr)
 {
   //Read data from files, binary or root.
   
+#ifdef use_aliroot
+  if(fEvent!=eventnr) //just be sure that index is empty for new event
+    AliL3FileHandler::CleanStaticIndex(); 
+#endif
   fEvent=eventnr;
   fCurrentSlice = slice;
+
   for(Int_t i=0; i<fNPatches; i++)
     {
       fMemHandler[i]->Free();
index 88b6f31..74d2efe 100644 (file)
@@ -6,10 +6,10 @@
 #include "AliL3StandardIncludes.h"
 
 #include "AliL3Logging.h"
-#include "AliL3HoughBaseTransformer.h"
 #include "AliL3MemHandler.h"
 #include "AliL3DigitData.h"
 #include "AliL3Histogram.h"
+#include "AliL3HoughBaseTransformer.h"
 
 
 //_____________________________________________________________
index 6d4555b..411ac7d 100644 (file)
@@ -39,14 +39,25 @@ class AliL3HoughBaseTransformer {
   
   void SetInputData(UInt_t ndigits,AliL3DigitRowData *ptr) {fDigitRowData = ptr;}
   
-  virtual void CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t pres,Int_t nybin,Float_t psi) {return;}
+  //this is for adaptave histograms
+  virtual void CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t pres,Int_t nybin,Float_t psi)
+    {STDCERR<<"Adaptive histograms are not supported  for this Transformer!"<<STDENDL;}
+
   virtual void CreateHistograms(Int_t nxbin,Float_t ptmin,Int_t nybin,Float_t phimin,Float_t phimax) = 0;
   virtual void CreateHistograms(Int_t nxbin,Float_t xmin,Float_t xmax,Int_t nybin,Float_t ymin,Float_t ymax) = 0;
+
   virtual void Reset() = 0;
-  virtual void TransformCircle() = 0;
-  virtual void TransformCircleC(Int_t *row_range,Int_t every=1) = 0;
-  virtual void TransformLine(Int_t *rowrange=0,Float_t *phirange=0) = 0;
-  
+  virtual void TransformCircle()
+    {STDCERR<<"TransformCircle is not defined for this transformer!"<<STDENDL;}
+  virtual void TransformCircle(Int_t *row_range,Int_t every)
+    {STDCERR<<"TransformCircle is not defined for this transformer!"<<STDENDL;}
+  virtual void TransformCircleC(Int_t *row_range,Int_t every)
+    {STDCERR<<"TransformCircleC is not defined for this transformer!"<<STDENDL;}
+  virtual void TransformLine(Int_t *rowrange=0,Float_t *phirange=0)
+    {STDCERR<<"TransformLine is not defined for this Transformer!"<<STDENDL;}
+  virtual void TransformLineC(Int_t *rowrange,Float_t *phirange)
+      {STDCERR<<"TransformLineC is not defined for this Transformer!"<<STDENDL;}
+
   //Getters
   Int_t GetSlice() {return fSlice;}
   Int_t GetPatch() {return fPatch;}
@@ -59,10 +70,15 @@ class AliL3HoughBaseTransformer {
   AliL3DigitRowData *GetDataPointer() {return fDigitRowData;}
  
   virtual Int_t GetEtaIndex(Double_t eta) = 0;
-  virtual void GetEtaIndexes(Double_t eta,Int_t *indexes) {STDCERR<<"GetEtaIndexes not implemented for this Transformer class"<<STDENDL;}
+  virtual void GetEtaIndexes(Double_t eta,Int_t *indexes)
+    {STDCERR<<"GetEtaIndexes not implemented for this Transformer class"<<STDENDL;}
   virtual AliL3Histogram *GetHistogram(Int_t eta_index) = 0;
   virtual Double_t GetEta(Int_t eta_index,Int_t slice) = 0;
-  virtual Int_t GetTrackID(Int_t eta_index,Double_t kappa,Double_t psi) {return -1;}
+
+  virtual Int_t GetTrackID(Int_t eta_index,Double_t kappa,Double_t psi){
+    STDCERR<<"GetTrackID not implemented for this Transformer class"<<STDENDL; 
+    return -1;
+  }
   
   //setters
   virtual void Init(Int_t slice=0,Int_t patch=0,Int_t n_eta_segments=100,Int_t n_segs=-1);
index 33dc729..8a1d5bd 100644 (file)
@@ -11,7 +11,9 @@
 #pragma link C++ class AliL3HoughTransformer;
 #pragma link C++ class AliL3HoughTransformerLUT;
 #pragma link C++ class AliL3HoughTransformerVhdl;
+#ifndef Darwin
 #pragma link C++ class AliL3HoughTrack;
+#endif
 #pragma link C++ class AliL3HoughMaxFinder;
 #pragma link C++ class AliL3HoughEval;
 #pragma link C++ class AliL3Histogram;
@@ -22,7 +24,9 @@
 #pragma link C++ class AliL3HoughDisplay;
 #pragma link C++ class AliL3HoughClusterTransformer;
 #pragma link C++ class AliL3HistogramAdaptive;
+#ifndef Darwin
 #pragma link C++ class AliL3HoughTest;
+#endif
 #pragma link C++ class AliL3HoughTransformerNew;
 
 #ifdef use_aliroot
index f52566c..b501875 100644 (file)
 using namespace std;
 #endif
 
+/** \class AliL3HoughTransformer
+<pre>
 //_____________________________________________________________
 // AliL3HoughTransformer
 //
 // Hough transformation class
 //
+</pre>
+*/
 
 ClassImp(AliL3HoughTransformer)
 
@@ -42,16 +46,6 @@ AliL3HoughTransformer::AliL3HoughTransformer(Int_t slice,Int_t patch,Int_t n_eta
   fDoMC = kFALSE;
   fEtaOverlap = DoEtaOverlap;
   fDoMC=kFALSE;
-  /*
-  if(DoMC==kTRUE)
-    {
-      if(patch==0)
-       
-fDoMC = kTRUE;
-      else
-       fDoMC = kFALSE;
-    }
-  */
 #ifdef do_mc
   fTrackID = 0;
 #endif
@@ -94,7 +88,7 @@ void AliL3HoughTransformer::CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t
   
   if(ptmin > ptmax)
     {
-      cerr<<"AliL3HoughTransformer.:CreateHistograms: Error in ptrange "<<ptmin<<" "<<ptmax<<endl;
+      cerr<<"AliL3HoughTransformer::CreateHistograms: Error in ptrange "<<ptmin<<" "<<ptmax<<endl;
       return;
     }
   if(psi < 0)
@@ -111,7 +105,6 @@ void AliL3HoughTransformer::CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t
       sprintf(histname,"paramspace_%d",i);
       fParamSpace[i] = new AliL3HistogramAdaptive(histname,ptmin,ptmax,ptres,nybin,-psi,psi);
     }
-  
 }
 
 void AliL3HoughTransformer::CreateHistograms(Int_t nxbin,Float_t pt_min,
@@ -234,7 +227,6 @@ Double_t AliL3HoughTransformer::GetEta(Int_t eta_index,Int_t slice)
   return eta;
 }
 
-
 void AliL3HoughTransformer::TransformCircle()
 {
   //Transform the input data with a circle HT.
@@ -343,7 +335,6 @@ void AliL3HoughTransformer::TransformCircle()
     }
 }
 
-
 struct Digit {
   Int_t row;
   Double_t r;
@@ -351,10 +342,12 @@ struct Digit {
   Int_t charge;
   Digit *next;
 };
+
 struct EtaContainer {
   Digit *first;
   Digit *last;
 };
+
 void AliL3HoughTransformer::TransformCircleC(Int_t *row_range,Int_t every)
 {
   //Circle transform, using combinations of every 2 points lying
index a3897c0..d9129d7 100644 (file)
 #include "AliL3MemHandler.h"
 #include "AliL3DigitData.h"
 #include "AliL3Histogram.h"
+#include "AliL3HistogramAdaptive.h"
 
 #if GCCVERSION == 3
 using namespace std;
 #endif
 
-//#define FULLLUT
-
+/** /class AliL3HoughTransformerLUT
+//<pre>
 //_____________________________________________________________
 // AliL3HoughTransformerLUT
 //
 // Hough transformation class using Look-UP-Tables
 //
+//</pre>
+*/
 
 ClassImp(AliL3HoughTransformerLUT)
 
 AliL3HoughTransformerLUT::AliL3HoughTransformerLUT() : AliL3HoughBaseTransformer()
 {
+  fParamSpace=0;
   fMinRow=0;
   fMaxRow=0;
 
@@ -55,12 +59,12 @@ AliL3HoughTransformerLUT::AliL3HoughTransformerLUT() : AliL3HoughBaseTransformer
   fLastPad=0;
   fLastIndex=0;
   fAccCharge=0;
-
-  fDoMC = kFALSE;
+  fX=fY=0.;
 }
 
 AliL3HoughTransformerLUT::AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t n_eta_segments) : AliL3HoughBaseTransformer(slice,patch,n_eta_segments)
 {
+  fParamSpace=0;
   fMinRow=0;
   fMaxRow=0;
 
@@ -87,7 +91,7 @@ AliL3HoughTransformerLUT::AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t
   fLastPad=0;
   fLastIndex=0;
   fAccCharge=0;
-  fDoMC=kFALSE;
+  fX=fY=0.;
 
   Init(slice,patch,n_eta_segments);
 }
@@ -160,7 +164,7 @@ void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t n_eta_segments
   }
 
   AliL3Transform::Slice2Sector(slice,fMinRow,fSector,fSectorRow);
-  fZSign = slice < 18 ? 1:-1;
+  fZSign = slice < 18 ? 1:-1; //see AliL3Transformer
   fSlice = slice;
   fZLengthPlusOff=AliL3Transform::GetZLength()+AliL3Transform::GetZOffset();
   fTimeWidth=AliL3Transform::GetZWidth();
@@ -185,6 +189,7 @@ void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t n_eta_segments
   }
 
   //lookup tables for rz2s <=> etas
+  //will only be used ifdef FULLLUT 
   fLUTEta=new Float_t[fNEtas];
   fLUTEtaReal=new Float_t[fNEtas];
   for(Int_t rr=0;rr<fNEtas;rr++){
@@ -195,6 +200,52 @@ void AliL3HoughTransformerLUT::Init(Int_t slice,Int_t patch,Int_t n_eta_segments
   }
 }
 
+void AliL3HoughTransformerLUT::CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t ptres,
+                                            Int_t nybin,Float_t psi)
+{
+  //Create histograms.
+  //_Only_ to be used in case of the adaptive histograms!
+  //phimax is given in radians!!
+  
+  if(ptmin > ptmax)
+    {
+      cerr<<"AliL3HoughTransformerLUT::CreateHistograms: Error in ptrange "<<ptmin<<" "<<ptmax<<endl;
+      return;
+    }
+  if(psi < 0)
+    {
+      cerr<<"AliL3HoughTransformerLUT::CreateHistograms: Wrong psi-angle "<<psi<<endl;
+      return;
+    }
+  
+  fParamSpace = new AliL3Histogram*[fNEtas];
+  Char_t histname[256];
+  for(Int_t i=0; i<GetNEtaSegments(); i++)
+    {
+      sprintf(histname,"paramspace_%d",i);
+      fParamSpace[i] = new AliL3HistogramAdaptive(histname,ptmin,ptmax,ptres,nybin,-psi,psi);
+    }
+
+  //create lookup table for sin and cos
+  fNPhi0=nybin;
+  fLUTphi0=new Float_t[fNPhi0];
+  fLUT2sinphi0=new Float_t[fNPhi0];
+  fLUT2cosphi0=new Float_t[fNPhi0];
+  fLUTKappa=new Float_t[fNPhi0];
+  AliL3Histogram *hist=fParamSpace[0];
+  Int_t i=0;
+  for(Int_t b=hist->GetFirstYbin(); b<=hist->GetLastYbin(); b++)
+    {
+      Float_t phi0 = hist->GetBinCenterY(b);
+      fLUTphi0[i]=phi0;
+      fLUT2sinphi0[i]=2.*sin(phi0);
+      fLUT2cosphi0[i]=2.*cos(phi0);
+      fLUTKappa[i]=0.;
+      i++;
+      //cout << i << ": " << fLUTphi0[i] << " " << fLUT2sinphi0[i] << " " << fLUT2cosphi0[i] << endl;
+    }
+}
+
 void AliL3HoughTransformerLUT::CreateHistograms(Int_t nxbin,Float_t pt_min,Int_t nybin,Float_t phimin,Float_t phimax)
 {
   //Create the histograms (parameter space).
@@ -207,8 +258,8 @@ void AliL3HoughTransformerLUT::CreateHistograms(Int_t nxbin,Float_t pt_min,Int_t
   //phi_max = maximum phi0 (degrees)
     
   Double_t x = AliL3Transform::GetBFact()*AliL3Transform::GetBField()/pt_min;
-  Double_t torad = AliL3Transform::Pi()/180;
-  CreateHistograms(nxbin,-1.*x,x,nybin,phimin*torad,phimax*torad);
+  //Double_t torad = AliL3Transform::Pi()/180;
+  CreateHistograms(nxbin,-1.*x,x,nybin,phimin/**torad*/,phimax/**torad*/);
 }
 
 void AliL3HoughTransformerLUT::CreateHistograms(Int_t nxbin,Float_t xmin,Float_t xmax,Int_t nybin,Float_t ymin,Float_t ymax)
@@ -223,22 +274,24 @@ void AliL3HoughTransformerLUT::CreateHistograms(Int_t nxbin,Float_t xmin,Float_t
     }
   
   //create lookup table for sin and cos
-  fNPhi0=nybin+1;
-
+  fNPhi0=nybin;
   fLUTphi0=new Float_t[fNPhi0];
   fLUT2sinphi0=new Float_t[fNPhi0];
   fLUT2cosphi0=new Float_t[fNPhi0];
   fLUTKappa=new Float_t[fNPhi0];
-  Float_t diff=(ymax-ymin)/nybin;
-  Float_t phi0=ymin-0.5*diff;
-  for(Int_t i=0; i<fNPhi0; i++){
-    phi0+=diff;
-    fLUTphi0[i]=phi0;
-    fLUT2sinphi0[i]=2.*sin(phi0);
-    fLUT2cosphi0[i]=2.*cos(phi0);
-    fLUTKappa[i]=0.;
-    //cout << i << ": " << fLUTphi0[i] << " " << fLUT2sinphi0[i] << " " << fLUT2cosphi0[i] << endl;
-  }  
+
+  AliL3Histogram *hist=fParamSpace[0];
+  Int_t i=0;
+  for(Int_t b=hist->GetFirstYbin(); b<=hist->GetLastYbin(); b++)
+    {
+      Float_t phi0 = hist->GetBinCenterY(b);
+      fLUTphi0[i]=phi0;
+      fLUT2sinphi0[i]=2.*sin(phi0);
+      fLUT2cosphi0[i]=2.*cos(phi0);
+      fLUTKappa[i]=0.; 
+      //cout << i << ": " << fLUTphi0[i] << " " << fLUT2sinphi0[i] << " " << fLUT2cosphi0[i] << endl;
+      i++;
+    }
 }
 
 void AliL3HoughTransformerLUT::Reset()
@@ -271,28 +324,7 @@ Int_t AliL3HoughTransformerLUT::GetEtaIndex(Double_t eta)
 #endif
 }
 
-Int_t AliL3HoughTransformerLUT::FindIndex(Float_t rz2, Int_t start)
-{
-  //could improve search through devide and conquere strategy
-  
-  Int_t index=start; 
-  if(index==-100){
-    index=0;
-    while((index<fNEtas)&&(rz2<=fLUTEta[index])){
-      index++;
-    }
-  } else {
-    while((index>=0)&&(rz2>fLUTEta[index])){
-      index--;
-    }
-    index++;
-  }
-  //cout << start << " - " << index << " " << ": " << rz2 << " " << fLUTEta[index] << endl;
-
-  return index;
-}
-
-inline AliL3Histogram *AliL3HoughTransformerLUT::GetHistogram(Int_t eta_index)
+AliL3Histogram *AliL3HoughTransformerLUT::GetHistogram(Int_t eta_index)
 {
   if(!fParamSpace || eta_index >= fNEtas || eta_index < 0)
     return 0;
@@ -301,75 +333,20 @@ inline AliL3Histogram *AliL3HoughTransformerLUT::GetHistogram(Int_t eta_index)
   return fParamSpace[eta_index];
 }
 
-Float_t AliL3HoughTransformerLUT::CalcRoverZ2(Float_t eta)
-{
-  Float_t e=exp(2*eta);
-  Float_t ret=(e+1)/(e-1);
-  ret*=ret;
-  return ret;
-}
-
-Float_t AliL3HoughTransformerLUT::CalcEta(Float_t roverz2)
-{
-  Float_t rz=sqrt(roverz2);
-  if(fZSign<0) rz=-rz;
-  Float_t ret=(1+rz)/(rz-1);
-  ret=0.5*log(ret);
-  return ret;
-}
-
-Float_t AliL3HoughTransformerLUT::CalcX(Int_t row)
-{
-  return fLUTX[row];
-}
-
-Float_t AliL3HoughTransformerLUT::CalcY(Int_t pad,Int_t row)
-{
-  return pad*fPadPitch-fLUTY[row];
-}
-
-Float_t AliL3HoughTransformerLUT::CalcZ(Int_t time)
-{
-  Float_t ret=time*fTimeWidth;
-  if(fZSign>0) ret=fZLengthPlusOff-ret;
-  else ret=ret-fZLengthPlusOff;
-  return ret;
-}
-
 Double_t AliL3HoughTransformerLUT::GetEta(Int_t eta_index,Int_t slice)
 {
   if(eta_index >= fNEtas || eta_index < 0){
-    //LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::GetEta","Index") << "Index out of range."<<ENDLOG;
+    LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::GetEta","Index") << "Index out of range."<<ENDLOG;
     return 0.;
   }
   if(slice != fSlice){
-    //LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::GetEta","Index") << "Given slice does not match internal slice."<<ENDLOG;
+    LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::GetEta","Index") << "Given slice does not match internal slice."<<ENDLOG;
     return 0.;
   }
 
-  //return (CalcEta(fLUTEta[eta_index])-0.5*fEtaSlice);
   return(fLUTEtaReal[eta_index]);
 }
 
-void AliL3HoughTransformerLUT::AddCurveToHistogram(Int_t new_eta_index)
-{
-  //Get the correct histogrampointer:
-  AliL3Histogram *hist = fParamSpace[fLastIndex];
-  if(!hist){
-    //LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::TransformCircle","Histograms")<<"Error getting histogram in index "<<fLastIndex<<"."<<ENDLOG;
-    return;
-  }
-
-  //Fill the histogram along the phirange
-  for(Int_t b=0; b<fNPhi0; b++){
-    hist->Fill(fLUTKappa[b],fLUTphi0[b],fAccCharge);
-    //cout << kappa << " " << fLUTphi0[b] << " " << fAccCharge << endl;
-  }
-
-  fAccCharge=0;
-  fLastIndex=new_eta_index;
-}
-
 void AliL3HoughTransformerLUT::TransformCircle()
 {
   //Transform the input data with a circle HT.
@@ -379,9 +356,7 @@ void AliL3HoughTransformerLUT::TransformCircle()
   //
   //where R^2 = x^2 + y^2
   //
-  //Each pixel then transforms into a curve in the (kappa,phi0)-space. In order to find
-  //which histogram in which the pixel should be transformed, the eta-value is calcluated
-  //and the proper histogram index is found by GetEtaIndex(eta).
+  //After a day of testing it is proven that this h
 
   AliL3DigitRowData *tempPt = GetDataPointer();
   if(!tempPt)
@@ -390,7 +365,10 @@ void AliL3HoughTransformerLUT::TransformCircle()
        <<"No input data "<<ENDLOG;
       return;
     }
-  
+
+  Int_t lowch=GetLowerThreshold();
+  Int_t highch=GetUpperThreshold();
+
   //Loop over the padrows:
   for(Int_t i=fMinRow, row=0; i<=fMaxRow; i++, row++)
     {
@@ -403,19 +381,15 @@ void AliL3HoughTransformerLUT::TransformCircle()
          continue;
        }
 
-      //calculate x for this row
-      Float_t x = CalcX(row);
-      Float_t x2=x*x;
-      Float_t r2=0;
 
       //start a new row
       fLastPad=-1;
-
-      if(fAccCharge>0) cerr << "Big error " << endl;
-
-      //accumulate charge per histogram
+      //store x for this row
+      fX = CalcX(row);
+      //accumulate charge per etaslice
       fAccCharge=0;
-      fLastIndex=-1;
+      //last histogram
+      fLastIndex=-1; 
 
       //Loop over the data on this padrow:
       for(UInt_t j=0; j<tempPt->fNDigit; j++)
@@ -423,63 +397,46 @@ void AliL3HoughTransformerLUT::TransformCircle()
          UShort_t charge = digPt[j].fCharge;
 
          //check threshold
-         if((Int_t)charge <= GetLowerThreshold() || (Int_t)charge > GetUpperThreshold())
+         if((Int_t)charge <=  lowch)
            continue;
+         if ((Int_t)charge > highch)
+           charge=highch;
 
          UChar_t pad = digPt[j].fPad;
          UShort_t time = digPt[j].fTime;
 
          if(fLastPad!=pad){ //only update if necessary
 
-           //if there is accumalated charge, put it in the right histogram
-           if(fAccCharge>0) AddCurveToHistogram(-1);
+           //if there is accumalated charge, 
+           //put it in the old histogram
+           //using the old X and Y values
+           if(fAccCharge>0) AddCurveToHistogram(-1); //fLastIndex will be set to -1
 
 #ifdef FULLLUT
            fLastIndex=fNEtas-1;
 #endif
 
-           //calculate hough for the new pad
-           Float_t y = CalcY(pad,row);
-           Float_t y2 = y*y;
-           r2 = x2 + y2;
-           Float_t xr2=x/r2;
-           Float_t yr2=y/r2;
-
-           //AliL3Histogram *hist = fParamSpace[0];
-           //Int_t bb=hist->GetFirstYbin();
-           //if(fNPhi0-1!=hist->GetLastYbin()) cerr << "should not be" << endl;
-           for(Int_t b=0; b<fNPhi0; b++){
-             fLUTKappa[b]=(yr2*fLUT2cosphi0[b]-xr2*fLUT2sinphi0[b]);
-
-             //Float_t phi=atan2(y,x);
-             //Float_t phi0 = hist->GetBinCenterY(bb);
-             //Float_t R=sqrt(r2);
-             //Float_t kappa = 2*sin(phi - phi0)/R;
-             //cout << fLUTKappa[b] << " " << kappa << endl;
-             //bb++;
-             //Int_t bina=hist->FindBin(fLUTphi0[b],fLUTKappa[b]);
-             //Int_t binb=hist->FindBin(phi0,kappa);
-             //if(bina!=binb) cout << bina << " " << binb << endl;
-           }
-           
+           //calculate Y for the new pad
+           fY = CalcY(pad,row);
+           //remember new pad
            fLastPad=pad;
          }
 
+#ifdef FULLLUT
          //find eta slice
          Float_t z = CalcZ(time);
-         Float_t z2=z*z;
 
-#ifdef FULLLUT
+         Float_t z2=z*z;
          Float_t rz2 = 1 + r2/z2;
          Int_t eta_index = FindIndex(rz2,fLastIndex);
 #else
-         Double_t r = sqrt(r2+z2);
-         Double_t etaval = 0.5 * log((r+z)/(r-z));
-         Int_t eta_index = GetEtaIndex(etaval);
+         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);
 #endif
-         //cout << row << " " << (int)pad << " " << (int)time << " " << eta_index << " " << fLastIndex << endl;
          if(eta_index < 0 || eta_index >= fNEtas){
-           //LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::TransformCircle","Histograms")<<"No histograms corresponding to eta index value of "<<eta_index<<"."<<ENDLOG;
+           LOG(AliL3Log::kWarning,"AliL3HoughTransformerLUT::TransformCircle","Histograms")<<"No histograms corresponding to eta index value of "<<eta_index<<"."<<ENDLOG;
            continue;
          }       
 
@@ -487,7 +444,7 @@ void AliL3HoughTransformerLUT::TransformCircle()
          if(fLastIndex==-1) fLastIndex=eta_index;
 #endif
 
-         if(fLastIndex!=eta_index){
+         if(fLastIndex!=eta_index){ //enter old values first
            AddCurveToHistogram(eta_index);
          }
 
@@ -501,19 +458,6 @@ void AliL3HoughTransformerLUT::TransformCircle()
       //Move the data pointer to the next padrow:
       AliL3MemHandler::UpdateRowPointer(tempPt);
     }
-
-      if(fAccCharge>0) cerr << "Big error " << endl;
-}
-
-Int_t AliL3HoughTransformerLUT::GetTrackID(Int_t eta_index,Double_t kappa,Double_t psi)
-{
-  if(fDoMC)
-    {
-      cerr<<"AliL3HoughTransformerLUT does not provide MC information..."<<endl;
-      return -1;
-    }
-  
-  return -1;
 }
 
 void AliL3HoughTransformerLUT::Print()
index e60bf46..a4c8207 100644 (file)
@@ -5,17 +5,16 @@
 
 #include "AliL3RootTypes.h"
 #include "AliL3HoughBaseTransformer.h"
+#include "AliL3Histogram.h"
 
-class AliL3Histogram;
+/* use if you also want the eta index 
+   to be looked up and linear searched */
+//#define FULLLUT
 
 class AliL3HoughTransformerLUT : public AliL3HoughBaseTransformer {
   
  protected:
   AliL3Histogram **fParamSpace; //!
-#ifdef do_mc
-  TrackIndex **fTrackID; //!
-#endif
-  Bool_t fDoMC;
 
   void DeleteHistograms();
   
@@ -40,18 +39,19 @@ class AliL3HoughTransformerLUT : public AliL3HoughBaseTransformer {
   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);
 
@@ -61,23 +61,98 @@ class AliL3HoughTransformerLUT : public AliL3HoughBaseTransformer {
   AliL3HoughTransformerLUT(Int_t slice,Int_t patch,Int_t n_eta_segments);
   virtual ~AliL3HoughTransformerLUT();
   
+  void CreateHistograms(Float_t ptmin,Float_t ptmax,Float_t pres,Int_t nybin,Float_t psi);
   void CreateHistograms(Int_t nxbin,Float_t ptmin,Int_t nybin,Float_t phimin,Float_t phimax);
   void CreateHistograms(Int_t nxbin,Float_t xmin,Float_t xmax,Int_t nybin,Float_t ymin,Float_t ymax);
   void Reset();
 
   void TransformCircle();
-  void TransformCircleC(Int_t *row_range,Int_t every){STDCERR<<"TransformCircleC is not defined for this transformer!"<<STDENDL;}
-  void TransformLine(Int_t *rowrange=0,Float_t *phirange=0) {STDCERR<<"TransformLine is not defined for this transformer!"<<STDENDL;}
 
   Int_t GetEtaIndex(Double_t eta);
   AliL3Histogram *GetHistogram(Int_t eta_index);
   Double_t GetEta(Int_t eta_index,Int_t slice);
-  Int_t GetTrackID(Int_t eta_index,Double_t kappa,Double_t psi);
   
   void Print();
   void Init(Int_t slice=0,Int_t patch=0,Int_t n_eta_segments=100,Int_t n_seqs=-1);
 
-  ClassDef(AliL3HoughTransformerLUT,1) //Normal Hough transformation class
+  ClassDef(AliL3HoughTransformerLUT,1) //LUT Hough transformation class
 
 };
+
+inline Float_t AliL3HoughTransformerLUT::CalcRoverZ2(Float_t eta)
+{
+  Float_t e=exp(2*eta);
+  Float_t ret=(e+1)/(e-1);
+  ret*=ret;
+  return ret;
+}
+
+inline Float_t AliL3HoughTransformerLUT::CalcEta(Float_t roverz2)
+{
+  Float_t rz=sqrt(roverz2);
+  if(fZSign<0) rz=-rz;
+  Float_t ret=(1+rz)/(rz-1);
+  ret=0.5*log(ret);
+  return ret;
+}
+
+inline Float_t AliL3HoughTransformerLUT::CalcX(Int_t row)
+{
+  return fLUTX[row];
+}
+
+inline Float_t AliL3HoughTransformerLUT::CalcY(Int_t pad,Int_t row)
+{
+  return pad*fPadPitch-fLUTY[row];
+}
+
+inline Float_t AliL3HoughTransformerLUT::CalcZ(Int_t time)
+{
+  Float_t ret=time*fTimeWidth;
+  if(fZSign>0) ret=fZLengthPlusOff-ret;
+  else ret=ret-fZLengthPlusOff;
+  return ret;
+}
+
+inline void AliL3HoughTransformerLUT::AddCurveToHistogram(Int_t new_eta_index)
+{
+  //get correct histogrampointer
+  AliL3Histogram *hist = fParamSpace[fLastIndex];
+
+  //Fill the histogram along the phirange
+  Float_t r2=fX*fX+fY*fY;
+  for(Int_t b=0; b<fNPhi0; b++){
+    Float_t kappa=(fY*fLUT2cosphi0[b]-fX*fLUT2sinphi0[b])/r2;
+    hist->Fill(kappa,fLUTphi0[b],fAccCharge);
+    //cout << kappa << " " << fLUTphi0[b] << " " << fAccCharge << endl;
+  }
+
+  fAccCharge=0;
+  fLastIndex=new_eta_index;
+}
+
+inline Int_t AliL3HoughTransformerLUT::FindIndex(Float_t rz2, Int_t start)
+{
+  //could improve search through devide and conquere strategy
+  
+  Int_t index=start; 
+  if(index==-100){
+    index=0;
+    while((index<fNEtas)&&(rz2<=fLUTEta[index])){
+      index++;
+    }
+  } else {
+    while((index>=0)&&(rz2>fLUTEta[index])){
+      index--;
+    }
+    index++;
+  }
+  //cout << start << " - " << index << " " << ": " << rz2 << " " << fLUTEta[index] << endl;
+
+  return index;
+}
+
+
+
+
 #endif
index 073ebc3..fa2904b 100644 (file)
@@ -125,10 +125,12 @@ struct Digit {
   Float_t z;
   Digit *next;
 };
+
 struct EtaContainer {
   void *first;
   void *last;
 };
+
 void AliL3HoughTransformerNew::TransformLineC(Int_t *rowrange,Float_t *phirange)
 {
   AliL3DigitRowData *tempPt = GetDataPointer();
index 0821f57..116132a 100644 (file)
@@ -39,7 +39,7 @@ class AliL3HoughTransformerVhdl : public AliL3HoughTransformerLUT
   void Print();
   void PrintVhdl();
 
-  ClassDef(AliL3HoughTransformerVhdl,1) //Normal Hough transformation class
+  ClassDef(AliL3HoughTransformerVhdl,1) //VHDL Hough transformation class
 
 };
 
index a711ab4..70ad7a2 100644 (file)
@@ -14,13 +14,18 @@ endif
 
 include $(ALIHLT_TOPDIR)/Makefile.conf
 
-SRCS = AliL3HoughTransformer.cxx AliL3HoughTrack.cxx AliL3HoughClusterTransformer.cxx \
+SRCS = AliL3HoughTransformer.cxx AliL3HoughClusterTransformer.cxx \
        AliL3HoughEval.cxx AliL3HoughMerger.cxx AliL3HoughBaseTransformer.cxx \
        AliL3HoughIntMerger.cxx AliL3HoughGlobalMerger.cxx AliL3HoughTransformerVhdl.cxx \
        AliL3Histogram.cxx AliL3Histogram1D.cxx AliL3HoughMaxFinder.cxx AliL3Hough.cxx \
        AliL3HoughTransformerLUT.cxx AliL3HistogramAdaptive.cxx 
 
-EXTRA_SRCS = AliL3HoughDisplay.cxx AliL3HoughTransformerNew.cxx AliL3HoughTest.cxx
+ifeq ($(ARCH),Darwin)
+## AliL3HoughTrack put into src as symbolic link
+EXTRA_SRCS = AliL3HoughDisplay.cxx AliL3HoughTransformerNew.cxx
+else
+EXTRA_SRCS = AliL3HoughDisplay.cxx AliL3HoughTransformerNew.cxx  AliL3HoughTrack.cxx AliL3HoughTest.cxx
+endif
 
 ifeq ($(ALIHLT_USEPACKAGE),ROOT)
 SRCS += $(EXTRA_SRCS)
index 152d783..54a793c 100644 (file)
@@ -153,10 +153,33 @@ void AliL3Kalman::ProcessTracks()
 
   fKalmanTracks = new AliL3TrackArray();
 
-  // Make a ntuple to store state vector, covariance matrix and chisquare
+  // Make a tree to store state vector, covariance matrix and chisquare
   // Will eventually not need a TTree??
-  TNtuple *kalmanTree = new TNtuple("kalmanTree","kalmantracks","x0:x1:x2:x3:x4:c0:c1:c2:c3:c4:c5:c6:c7:c8:c9:c10:c11:c12:c13:c14:chisq");
+  TTree *kalmanTree = new TTree("kalmanTree","kalmantracks");
   Float_t meas[21];
+  Int_t lab = 123456789;
+  kalmanTree->Branch("x0",&meas[0],"x0/F");
+  kalmanTree->Branch("x1",&meas[1],"x1/F");
+  kalmanTree->Branch("x2",&meas[2],"x2/F");
+  kalmanTree->Branch("x3",&meas[3],"x3/F");
+  kalmanTree->Branch("x4",&meas[4],"x4/F");
+  kalmanTree->Branch("c0",&meas[5],"c0/F");
+  kalmanTree->Branch("c1",&meas[6],"c1/F");
+  kalmanTree->Branch("c2",&meas[7],"c2/F");
+  kalmanTree->Branch("c3",&meas[8],"c3/F");
+  kalmanTree->Branch("c4",&meas[9],"c4/F");
+  kalmanTree->Branch("c5",&meas[10],"c5/F");
+  kalmanTree->Branch("c6",&meas[11],"c6/F");
+  kalmanTree->Branch("c7",&meas[12],"c7/F");
+  kalmanTree->Branch("c8",&meas[13],"c8/F");
+  kalmanTree->Branch("c9",&meas[14],"c9/F");
+  kalmanTree->Branch("c10",&meas[15],"c10/F");
+  kalmanTree->Branch("c11",&meas[16],"c11/F");
+  kalmanTree->Branch("c12",&meas[17],"c12/F");
+  kalmanTree->Branch("c13",&meas[18],"c13/F");
+  kalmanTree->Branch("c14",&meas[19],"c14/F");
+  kalmanTree->Branch("chisq",&meas[20],"chisq/F");
+  kalmanTree->Branch("lab",&lab,"lab/I");
 
   // Go through the tracks from conformal or hough tracker
   for (Int_t iTrack = 0; iTrack < fTracks->GetNTracks(); iTrack++)
@@ -169,6 +192,17 @@ void AliL3Kalman::ProcessTracks()
       if (!track) continue;
       if (track->GetNumberOfPoints() < fMinPointsOnTrack) continue;    
 
+      UInt_t *hitnum = track->GetHitNumbers();
+      UInt_t id;
+      
+      id = hitnum[0];
+      Int_t slice = (id>>25) & 0x7f;
+      Int_t patch = (id>>22) & 0x7;    
+      UInt_t pos = id&0x3fffff;
+      AliL3SpacePointData *points = fClusters[slice][patch];
+      lab=points[pos].fTrackID[0];
+      //cout << lab << endl;
+
       AliL3KalmanTrack *kalmantrack = new AliL3KalmanTrack();
 
       Bool_t save = kTRUE;
@@ -192,6 +226,7 @@ void AliL3Kalman::ProcessTracks()
       if (Propagate(kalmantrack, track) == 0) 
        {
          save = kFALSE;
+         continue;
        }
       
       if (save) {
@@ -227,8 +262,8 @@ void AliL3Kalman::ProcessTracks()
        outtrack->Set(track);
 
        // Fill the ntuple with the state vector, covariance matrix and
-       // chisquare
-       kalmanTree->Fill(meas);
+       // chisquare and track label
+       kalmanTree->Fill();
       }
 
       delete track;
index efc224d..a23e973 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef ALIL3DDLRAWREADER_H
 #define ALIL3DDLRAWREADER_H
 
+#include "AliL3RootTypes.h"
+
 // see description in upcoming ALICE note
 // by D.Favretto and A.K.Mohanty
 struct AliL3DDLMiniHeader 
index 525e270..fdd1470 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef ALIL3DDLRAWREADERFILE_H
 #define ALIL3DDLRAWREADERFILE_H
 
+#include "AliL3RootTypes.h"
 #include "AliL3DDLRawReader.h"
 
 class AliL3DDLRawReaderFile: public AliL3DDLRawReader 
index 5566a43..d03a217 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef ALIL3DDLTPCRAWSTREAM_H
 #define ALIL3DDLTPCRAWSTREAM_H
 
+#include "AliL3RootTypes.h"
+
 class AliL3DDLRawReader;
 
 class AliL3DDLTPCRawStream 
index 998943a..dde7793 100644 (file)
@@ -6,17 +6,21 @@
 #pragma link off all classes;
 #pragma link off all functions;
 
+#ifndef Darwin
 #pragma link C++ class AliL3TransBit; 
 #pragma link C++ class AliL3TransBit_v1; 
 #pragma link C++ class AliL3TransBit_v2; 
-#pragma link C++ class AliL3AltroMemHandler;
 #pragma link C++ class AliL3DataHandler;
+#endif
+#pragma link C++ class AliL3AltroMemHandler;
 #pragma link C++ class AliL3VHDLClusterFinder;
 #pragma link C++ class AliL3TPCMapping;
 #pragma link C++ class AliL3DDLRawReader;
 #pragma link C++ class AliL3DDLRawReaderFile;
 #pragma link C++ class AliL3DDLTPCRawStream;
+#ifndef Darwin
 #pragma link C++ class AliL3DDLDataFileHandler;
+#endif
 
 #ifdef USEFFLOAT
 #pragma link C++ class AliL3FFloat;
index 68364a4..c42b254 100644 (file)
@@ -14,9 +14,13 @@ endif
 
 include $(ALIHLT_TOPDIR)/Makefile.conf
 
-SRCS   = AliL3TransBit.cxx AliL3AltroMemHandler.cxx AliL3DataHandler.cxx \
+SRCS   = AliL3TransBit.cxx AliL3AltroMemHandler.cxx \
           AliL3VHDLClusterFinder.cxx AliL3TPCMapping.cxx \
           AliL3FFloat.cxx AliL3Stopwatch.cxx AliL3DDLRawReader.cxx \
-          AliL3DDLRawReaderFile.cxx AliL3DDLTPCRawStream.cxx AliL3DDLDataFileHandler.cxx
+          AliL3DDLRawReaderFile.cxx AliL3DDLTPCRawStream.cxx 
+
+ifneq ($(ARCH),Darwin)
+SRCS   += AliL3DDLDataFileHandler.cxx AliL3DataHandler.cxx 
+endif
 
 include $(ALIHLT_TOPDIR)/Makefile.rules
index cfe55c9..ca4453c 100644 (file)
@@ -371,15 +371,24 @@ Int_t AliL3ConfMapFit::FitCircle()
       r0   =  sqrt ( lHit->GetX() * lHit->GetX() + lHit->GetY() * lHit->GetY() )  ;
       fTrack->SetPhi0(phi0);
       fTrack->SetR0(r0);
+
     }
-  //
+  
+  //Set the first point on the track to the space point coordinates of the innermost track
+  //This will be updated to lie on the fit later on (AliL3Track::UpdateToFirstPoint).
+  fTrack->SetFirstPoint(x0,y0,0); //Z-value is set in FitLine
+
   psi  = (Double_t)atan2(bcent-y0,acent-x0) ;
   psi  = psi + q * 0.5F * pi ;
   if ( psi < 0 ) psi = psi + 2*pi;
-  
   pt   = (Double_t)(BFACT * AliL3Transform::GetBField() * radius ) ;
+  
+  //Update the track parameters with the parameters from this fit:
   fTrack->SetPsi(psi);
   fTrack->SetPt(pt);
+  fTrack->SetRadius(radius);
+  fTrack->SetCenterX(acent);
+  fTrack->SetCenterY(bcent);
 
   //
 //    Get errors from fast fit
index 934d57e..c018710 100644 (file)
@@ -175,26 +175,18 @@ void AliL3ConfMapTrack::Fill(AliL3Vertex *vertex,Double_t max_Dca)
   if(GetPt() > max_Dca) //go for fit of helix in real space
     {
       AliL3ConfMapFit *fit = new AliL3ConfMapFit(this,vertex);
+      ComesFromMainVertex(AliLevel3::DoVertexFit());
       fit->FitHelix();
       
-      AliL3ConfMapPoint *lHit = (AliL3ConfMapPoint*)lastHit;
+      //AliL3ConfMapPoint *lHit = (AliL3ConfMapPoint*)lastHit;
       AliL3ConfMapPoint *fHit = (AliL3ConfMapPoint*)firstHit;
+      SetLastPoint(fHit->GetX(),fHit->GetY(),fHit->GetZ());
       
-      if(AliLevel3::IsTracksAtFirstPoint())
+      if(AliLevel3::IsTracksAtFirstPoint())//Set the track fit parameter at the innermost most point
        {
-         //Z0 should not be overwritten here, since it is used as a starting
-         //point for the track swim in UpdateToFirstPoint. fFirstPointX and Y
-         //will be overwritten in UpdateToFirstPoint with the track fit 
-         //crossing point.
-         SetFirstPoint(lHit->GetX(),lHit->GetY(),GetZ0());
          UpdateToFirstPoint();
        }
-      else
-       {
-         SetFirstPoint(vertex->GetX(),vertex->GetY(),vertex->GetZ());
-       }
       
-      SetLastPoint(fHit->GetX(),fHit->GetY(),fHit->GetZ());
       delete fit;
     }
   else if(GetPt() == 0)
@@ -206,74 +198,7 @@ void AliL3ConfMapTrack::Fill(AliL3Vertex *vertex,Double_t max_Dca)
        "Track with pt<max_Dca :"<<GetPt()<<ENDLOG;
     }
 }
-/*
-void AliL3ConfMapTrack::UpdateToFirstPoint()
-{
-  //Update track parameters to the innermost point on the track.
-  //Basically it justs calculates the intersection of the track, and a cylinder
-  //with radius = r(innermost point). Then the parameters are updated to this point.
-  //Should be called after the helixfit (in FillTracks).
-  
-  //AliL3ConfMapPoint *lHit = (AliL3ConfMapPoint*)fPoints->Last();
-  AliL3ConfMapPoint *lHit = (AliL3ConfMapPoint*)lastHit;
-  Double_t radius = sqrt(lHit->GetX()*lHit->GetX()+lHit->GetY()*lHit->GetY());
-  
-  //Get the track parameters
-  
-  Double_t tPhi0 = GetPsi() + GetCharge() * 0.5 * pi / abs(GetCharge()) ;
-  Double_t x0    = GetR0() * cos(GetPhi0()) ;
-  Double_t y0    = GetR0() * sin(GetPhi0()) ;
-  Double_t rc    = fabs(GetPt()) / ( BFACT * AliL3Transform::GetBField() )  ;
-  Double_t xc    = x0 - rc * cos(tPhi0) ;
-  Double_t yc    = y0 - rc * sin(tPhi0) ;
-  
-  //Check helix and cylinder intersect
-  
-  Double_t fac1 = xc*xc + yc*yc ;
-  Double_t sfac = sqrt( fac1 ) ;
-    
-  if ( fabs(sfac-rc) > radius || fabs(sfac+rc) < radius ) {
-    LOG(AliL3Log::kError,"AliL3ConfMapTrack::UpdateToLastPoint","Tracks")<<AliL3Log::kDec<<
-      "Track does not intersect"<<ENDLOG;
-    return;
-  }
-  
-  //Find intersection
-  
-  Double_t fac2   = ( radius*radius + fac1 - rc*rc) / (2.00 * radius * sfac ) ;
-  Double_t phi    = atan2(yc,xc) + GetCharge()*acos(fac2) ;
-  Double_t td     = atan2(radius*sin(phi) - yc,radius*cos(phi) - xc) ;
-  
-  //Intersection in z
-  
-  if ( td < 0 ) td = td + 2. * pi ;
-  Double_t deltat = fmod((-GetCharge()*td + GetCharge()*tPhi0),2*pi) ;
-  if ( deltat < 0.      ) deltat += 2. * pi ;
-  if ( deltat > 2.*pi ) deltat -= 2. * pi ;
-  Double_t z = GetZ0() + rc * GetTgl() * deltat ;
-  
-  Double_t xExtra = radius * cos(phi) ;
-  Double_t yExtra = radius * sin(phi) ;
-  
-  Double_t tPhi = atan2(yExtra-yc,xExtra-xc);
-  
-  //if ( tPhi < 0 ) tPhi += 2. * M_PI ;
-  
-  Double_t tPsi = tPhi - GetCharge() * 0.5 * pi / abs(GetCharge()) ;
-  if ( tPsi > 2. * pi ) tPsi -= 2. * pi ;
-  if ( tPsi < 0.        ) tPsi += 2. * pi ;
-  
-  //And finally, update the track parameters
-  
-  SetCenterX(xc);
-  SetCenterY(yc);
-  SetR0(radius);
-  SetPhi0(phi);
-  SetZ0(z);
-  SetPsi(tPsi);
-}
-*/
+
 Int_t AliL3ConfMapTrack::GetMCLabel()
 {
   //For evaluation study.
index d3f8314..04bedb3 100644 (file)
@@ -71,7 +71,71 @@ using namespace std;
 
 ClassImp(AliL3FileHandler)
 
-AliL3FileHandler::AliL3FileHandler()
+// of course on start up the index is not created
+Bool_t AliL3FileHandler::fStaticIndexCreated=kFALSE;
+Int_t  AliL3FileHandler::fStaticIndex[36][159]; 
+
+void AliL3FileHandler::CleanStaticIndex() 
+{ // use this static call to clean static index after
+  // running over one event
+
+  for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
+    for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
+      fStaticIndex[i][j]=-1;
+  }
+  fStaticIndexCreated=kFALSE;
+}
+
+Int_t AliL3FileHandler::SaveStaticIndex(Char_t *prefix,Int_t event) 
+{ // use this static call to store static index after
+  if(!fStaticIndexCreated) return -1;
+
+  Char_t fname[1024];
+  if(prefix)
+    sprintf(fname,"%s-%d.txt",prefix,event);
+  else
+    sprintf(fname,"TPC.Digits.staticindex-%d.txt",event);
+
+  ofstream file(fname,ios::trunc);
+  if(!file.good()) return -1;
+
+  for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
+    for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
+      file << fStaticIndex[i][j] << " ";
+    file << endl;
+  }
+  file.close();
+  return 0;
+}
+
+Int_t AliL3FileHandler::LoadStaticIndex(Char_t *prefix,Int_t event) 
+{ // use this static call to store static index after
+  if(fStaticIndexCreated){
+      LOG(AliL3Log::kWarning,"AliL3FileHandler::LoadStaticIndex","Inxed")
+       <<"Static index already created, will overwrite"<<ENDLOG;
+      CleanStaticIndex();
+  }
+
+  Char_t fname[1024];
+  if(prefix)
+    sprintf(fname,"%s-%d.txt",prefix,event);
+  else
+    sprintf(fname,"TPC.Digits.staticindex-%d.txt",event);
+
+  ifstream file(fname);
+  if(!file.good()) return -1;
+
+  for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
+    for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
+      file >> fStaticIndex[i][j];
+  }
+  file.close();
+
+  fStaticIndexCreated=kTRUE;
+  return 0;
+}
+
+AliL3FileHandler::AliL3FileHandler(Bool_t b)
 {
   //Default constructor
   fInAli = 0;
@@ -79,11 +143,14 @@ AliL3FileHandler::AliL3FileHandler()
   fMC =0;
   fDigits=0;
   fDigitsTree=0;
-  for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
-    for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
-      fIndex[i][j]=-1;
-  }
   fIndexCreated=kFALSE;
+  fUseStaticIndex=b;
+
+  for(Int_t i=0;i<AliL3Transform::GetNSlice();i++)
+    for(Int_t j=0;j<AliL3Transform::GetNRows();j++) 
+      fIndex[i][j]=-1;
+
+  if(fUseStaticIndex&&!fStaticIndexCreated) CleanStaticIndex();
 }
 
 AliL3FileHandler::~AliL3FileHandler()
@@ -324,39 +391,50 @@ Bool_t AliL3FileHandler::AliDigits2CompBinary(Int_t event,Bool_t altro)
 
 Bool_t AliL3FileHandler::CreateIndex()
 {
-  //create the access index
-
-  LOG(AliL3Log::kInformational,"AliL3FileHandler::CreateIndex","Index")
-    <<"Starting to create index, this can take a while."<<ENDLOG;
-
+  //create the access index or copy from static index
   fIndexCreated=kFALSE;
-  for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
-    for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
-      fIndex[i][j]=-1;
-  }
 
-  for(Int_t n=0; n<fDigitsTree->GetEntries(); n++){
-    Int_t sector, row;
-    Int_t lslice,lrow;
-    fDigitsTree->GetEvent(n);
-    fParam->AdjustSectorRow(fDigits->GetID(),sector,row);
-    if(!AliL3Transform::Sector2Slice(lslice,lrow,sector,row)){
-      LOG(AliL3Log::kError,"AliL3FileHandler::CreateIndex","Slice/Row")
-       <<AliL3Log::kDec<<"Index could not be created. Wrong values "
-       <<sector<<" "<<row<<ENDLOG;
-      return kFALSE;
+  if(!fStaticIndexCreated || !fUseStaticIndex) { //we have to create index 
+    LOG(AliL3Log::kInformational,"AliL3FileHandler::CreateIndex","Index")
+      <<"Starting to create index, this can take a while."<<ENDLOG;
+
+    for(Int_t n=0; n<fDigitsTree->GetEntries(); n++) {
+      Int_t sector, row;
+      Int_t lslice,lrow;
+      fDigitsTree->GetEvent(n);
+      fParam->AdjustSectorRow(fDigits->GetID(),sector,row);
+      if(!AliL3Transform::Sector2Slice(lslice,lrow,sector,row)){
+       LOG(AliL3Log::kError,"AliL3FileHandler::CreateIndex","Slice/Row")
+         <<AliL3Log::kDec<<"Index could not be created. Wrong values "
+         <<sector<<" "<<row<<ENDLOG;
+       return kFALSE;
+      }
+      if(fIndex[lslice][lrow]==-1) {
+       fIndex[lslice][lrow]=n;
+      }
+    }
+    if(fUseStaticIndex) { // create static index
+      for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
+       for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
+         fStaticIndex[i][j]=fIndex[i][j];
+      }
+      fStaticIndexCreated=kTRUE; //remember that index has been created
     }
-    if(fIndex[lslice][lrow]==-1) fIndex[lslice][lrow]=n;
-  }
 
   LOG(AliL3Log::kInformational,"AliL3FileHandler::CreateIndex","Index")
     <<"Index successfully created."<<ENDLOG;
 
-  //for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
-  //  for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
-  //    cout << fIndex[i][j] << " ";
-  //cout << endl;}
+  } else if(fUseStaticIndex) { //simply copy static index
+    for(Int_t i=0;i<AliL3Transform::GetNSlice();i++){
+      for(Int_t j=0;j<AliL3Transform::GetNRows();j++)
+       fIndex[i][j]=fStaticIndex[i][j];
+    }
+
+  LOG(AliL3Log::kInformational,"AliL3FileHandler::CreateIndex","Index")
+    <<"Index successfully taken from static copy."<<ENDLOG;
 
+  }
   fIndexCreated=kTRUE;
   return kTRUE;
 }
@@ -1105,7 +1183,7 @@ AliL3SpacePointData * AliL3FileHandler::AliPoints2Memory(UInt_t & npoint,Int_t e
   if(!tpcLoader){
     LOG(AliL3Log::kWarning,"AliL3FileHandler::AliPoints2Memory","File")
     <<"Pointer to AliLoader for TPC = 0x0 "<<ENDLOG;
-    return kFALSE;
+    return 0;
   }
   fInAli->GetEvent(eventn);
   tpcLoader->LoadRecPoints();
index 5e70d95..0b916b8 100644 (file)
@@ -32,23 +32,30 @@ class AliL3FileHandler:public AliL3MemHandler{
 #endif
   AliTPCParam *fParam;
   virtual Bool_t SetAliInput();
-  //  Int_t fLastIndex;
   AliSimDigits *fDigits;
+
   TTree *fDigitsTree;
   FILE *fMC;//!
   
   Bool_t fIndexCreated;   //is index created
   Int_t  fIndex[36][159]; //stores index over digitstree 
                           //for faster access w/o ASVVERSION
+  Bool_t fUseStaticIndex; //take static index
+  static Bool_t fStaticIndexCreated;   //global index created
+  static Int_t  fStaticIndex[36][159]; //global index
 
   Bool_t GetDigitsTree(Int_t event);
   Bool_t CreateIndex();  //create the index
 
  public:
-  AliL3FileHandler();
+  AliL3FileHandler(Bool_t b=kFALSE);
   ~AliL3FileHandler();
 
   void FreeDigitsTree();
+  static void CleanStaticIndex();
+  static Int_t SaveStaticIndex(Char_t *prefix=0,Int_t event=0);
+  static Int_t LoadStaticIndex(Char_t *prefix=0,Int_t event=0);
+
   Bool_t SetAliInput(Char_t *name);
   Bool_t SetAliInput(TFile *file);
 #ifdef use_newio
index 0562441..ee414ee 100644 (file)
@@ -134,31 +134,6 @@ void AliL3Fitter::SortTrackClusters(AliL3Track *track)
   delete [] mk;
 }
 
-void AliL3Fitter::UpdateTrack(AliL3Track *track)
-{
-  //Update the track parameters to the first point on the track.
-  //This function should be called after the track fit has been
-  //done, in order to calculate the track parameters at the 
-  //first point on the track. 
-  
-  UInt_t *ids = track->GetHitNumbers();
-  Int_t nhits = track->GetNHits();
-  UInt_t id=ids[nhits-1];
-  Int_t slice = (id>>25) & 0x7f;
-  Int_t patch = (id>>22) & 0x7;
-  UInt_t pos = id&0x3fffff;          
-  AliL3SpacePointData *points = fClusters[slice][patch];
-  if(AliLevel3::IsTracksAtFirstPoint())
-    {
-      track->SetFirstPoint(points[pos].fX,points[pos].fY,track->GetZ0());
-      track->UpdateToFirstPoint();
-    }
-  else
-    {
-      track->SetFirstPoint(fVertex->GetX(),fVertex->GetY(),fVertex->GetZ());
-    }
-}
-
 Int_t AliL3Fitter::FitHelix(AliL3Track *track)
 {
   fTrack = track;
@@ -208,7 +183,6 @@ Int_t AliL3Fitter::FitCircle()
       wsum += fXYWeight[i];
       xav += fXYWeight[i]*points[pos].fX;
       yav += fXYWeight[i]*points[pos].fY;
-      
     }
   if (fVertexConstraint == kTRUE)
     {    
@@ -509,7 +483,11 @@ Int_t AliL3Fitter::FitCircle()
       fTrack->SetPhi0(phi0);
       fTrack->SetR0(r0);
     }
-  //
+  
+  //Set the first point on the track to the space point coordinates of the innermost track
+  //This will be updated to lie on the fit later on (AliL3Track::UpdateToFirstPoint).
+  fTrack->SetFirstPoint(x0,y0,0); //Z-value is set in FitLine
+
   psi  = (Double_t)atan2(bcent-y0,acent-x0) ;
   psi  = psi + q * 0.5F * AliL3Transform::Pi() ;
   if ( psi < 0 ) psi = psi + 2*AliL3Transform::Pi();
@@ -517,7 +495,9 @@ Int_t AliL3Fitter::FitCircle()
   pt   = (Double_t)(AliL3Transform::GetBFact() * AliL3Transform::GetBField() * radius ) ;
   fTrack->SetPsi(psi);
   fTrack->SetPt(pt);
-  //fTrack->SetFirstPoint(x0,y0,0);
+  fTrack->SetRadius(radius);
+  fTrack->SetCenterX(acent);
+  fTrack->SetCenterY(bcent);
   //
 //    Get errors from fast fit
 //
index 73a75f6..6bd2566 100644 (file)
@@ -25,7 +25,6 @@ class AliL3Fitter {
   
   void LoadClusters(Char_t *path,Int_t event=0,Bool_t sp=kFALSE);
   void SortTrackClusters(AliL3Track *track);
-  void UpdateTrack(AliL3Track *track);
   Int_t FitHelix(AliL3Track *track);
   Int_t FitCircle();
   Int_t FitLine();
index 61cf25e..b933ab7 100644 (file)
@@ -7,6 +7,8 @@
 #include "AliL3Merger.h"
 #endif
 
+#include "AliL3RootTypes.h"
+
 class AliL3GlobalMerger : public AliL3Merger{
 
  private:
index 104ace2..ee0ece0 100644 (file)
@@ -7,6 +7,8 @@
 #include "AliL3Merger.h"
 #endif
 
+#include "AliL3RootTypes.h"
+
 class AliL3InterMerger : public AliL3Merger {
 
  private:
index 2d65714..600d6d0 100644 (file)
 #pragma link C++ class AliL3Fitter;
 #pragma link C++ class AliL3RawDataFileHandler;
 
+#ifdef Darwin
+//new to solve dep problem
+#pragma link C++ class AliL3HoughTrack;
+#pragma link C++ class AliL3ModelTrack;
+#pragma link C++ class AliL3DataCompressorHelper;
+#pragma link C++ class AliL3DDLDataFileHandler;
+#pragma link C++ class AliL3DataHandler;
+#pragma link C++ class AliL3TransBit;
+#pragma link C++ class AliL3TransBit_v1; 
+#pragma link C++ class AliL3TransBit_v2; 
+#endif
+
 #ifdef use_aliroot
 #pragma link C++ class AliL3FileHandler;
 #pragma link C++ class AliL3Evaluate; 
index 67c4646..994547e 100644 (file)
@@ -408,74 +408,62 @@ Bool_t AliL3Track::CalculatePoint(Double_t xplane){
 void AliL3Track::UpdateToFirstPoint()
 {
   //Update track parameters to the innermost point on the track.
-  //Basically it justs calculates the intersection of the track, and a cylinder
-  //with radius = r(innermost point). Then the parameters are updated to this point.
-  //Should be called after the helixfit (in FillTracks).
-  
-  Double_t radius = sqrt(GetFirstPointX()*GetFirstPointX() + GetFirstPointY()*GetFirstPointY());
-  
-  //Get the track parameters
-  
-  Double_t tPhi0 = GetPsi() + GetCharge() * 0.5 * pi / abs(GetCharge()) ;
-  
-  Double_t x0    = GetR0() * cos(GetPhi0()) ;
-  Double_t y0    = GetR0() * sin(GetPhi0()) ;
-  Double_t rc    = fabs(GetPt()) / ( BFACT * AliL3Transform::GetBField() )  ;
-  Double_t xc    = x0 - rc * cos(tPhi0) ;
-  Double_t yc    = y0 - rc * sin(tPhi0) ;
+  //This means that the parameters of the track will be given in the point
+  //of closest approach to the first innermost point, i.e. the point 
+  //lying on the track fit (and not the coordinates of the innermost point itself).
+  //This function assumes that fFirstPoint is already set to the coordinates of the innermost
+  //assigned cluster.
+  //
+  //During the helix-fit, the first point on the track is set to the coordinates
+  //of the innermost assigned cluster. This may be ok, if you just want a fast
+  //estimate of the "global" track parameters; such as the momentum etc.
+  //However, if you later on want to do more precise local calculations, such
+  //as impact parameter, residuals etc, you need to give the track parameters
+  //according to the actual fit.
 
-  //Check helix and cylinder intersect
-  
-  Double_t fac1 = xc*xc + yc*yc ;
-  Double_t sfac = sqrt( fac1 ) ;
-    
-  if ( fabs(sfac-rc) > radius || fabs(sfac+rc) < radius ) {
-    LOG(AliL3Log::kError,"AliL3ConfMapTrack::UpdateToLastPoint","Tracks")<<AliL3Log::kDec<<
-      "Track does not intersect"<<ENDLOG;
-    return;
-  }
-  
-  //Find intersection
-  
-  Double_t fac2   = ( radius*radius + fac1 - rc*rc) / (2.00 * radius * sfac ) ;
-  Double_t phi    = atan2(yc,xc) + GetCharge()*acos(fac2) ;
-  Double_t td     = atan2(radius*sin(phi) - yc,radius*cos(phi) - xc) ;
-  
-  //Intersection in z
+  Double_t xc = GetCenterX() - GetFirstPointX();
+  Double_t yc = GetCenterY() - GetFirstPointY();
   
-  if ( td < 0 ) td = td + 2. * pi ;
-  Double_t deltat = fmod((-GetCharge()*td + GetCharge()*tPhi0),2*pi) ;
-  if ( deltat < 0.      ) deltat += 2. * pi ;
-  if ( deltat > 2.*pi ) deltat -= 2. * pi ;
-  Double_t z = GetZ0() + rc * GetTgl() * deltat ;
-  
-  Double_t xExtra = radius * cos(phi) ;
-  Double_t yExtra = radius * sin(phi) ;
+  Double_t dist_x1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
+  Double_t dist_y1 = yc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
+  Double_t distance1 = sqrt(dist_x1*dist_x1 + dist_y1*dist_y1);
   
-  Double_t tPhi = atan2(yExtra-yc,xExtra-xc);
+  Double_t dist_x2 = xc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
+  Double_t dist_y2 = yc*(1 - GetRadius()/sqrt(xc*xc + yc*yc));
+  Double_t distance2 = sqrt(dist_x2*dist_x2 + dist_y2*dist_y2);
   
-  //if ( tPhi < 0 ) tPhi += 2. * M_PI ;
+  //Choose the closest:
+  Double_t point[2];
+  if(distance1 < distance2)
+    {
+      point[0] = dist_x1 + GetFirstPointX();
+      point[1] = dist_y1 + GetFirstPointY();
+    }
+  else
+    {
+      point[0] = dist_x2 + GetFirstPointX();
+      point[1] = dist_y2 + GetFirstPointY();
+    }
+
+  Double_t pointpsi = atan2(point[1]-GetCenterY(),point[0]-GetCenterX());
+  pointpsi -= GetCharge()*0.5*AliL3Transform::Pi();
+  if(pointpsi < 0) pointpsi += 2*AliL3Transform::Pi();
   
-  Double_t tPsi = tPhi - GetCharge() * 0.5 * pi / abs(GetCharge()) ;
-  if ( tPsi > 2. * pi ) tPsi -= 2. * pi ;
-  if ( tPsi < 0.        ) tPsi += 2. * pi ;
+  //Update the track parameters
+  SetR0(sqrt(point[0]*point[0]+point[1]*point[1]));
+  SetPhi0(atan2(point[1],point[0]));
+  SetFirstPoint(point[0],point[1],GetZ0());
+  SetPsi(pointpsi);
   
-  //And finally, update the track parameters
-  SetCenterX(xc);
-  SetCenterY(yc);
-  SetR0(radius);
-  SetPhi0(phi);
-  SetFirstPoint(radius*cos(phi),radius*sin(phi),z);
-  SetPsi(tPsi);
 }
 
 void AliL3Track::GetClosestPoint(AliL3Vertex *vertex,Double_t &closest_x,Double_t &closest_y,Double_t &closest_z)
 {
   //Calculate the point of closest approach to the vertex
+  //This function calculates the minimum distance from the helix to the vertex, and choose 
+  //the corresponding point lying on the helix as the point of closest approach.
   
-  
-  Double_t xc = GetCenterX() - vertex->GetX();//Shift the center of curvature with respect to the vertex
+  Double_t xc = GetCenterX() - vertex->GetX();
   Double_t yc = GetCenterY() - vertex->GetY();
   
   Double_t dist_x1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc));
index 373d735..5646fe1 100644 (file)
@@ -252,7 +252,7 @@ UInt_t AliL3TrackArray::WriteTracks(UInt_t & ntracks,AliL3TrackSegmentData* tr){
 }
 
 UInt_t AliL3TrackArray::WriteTracks(AliL3TrackSegmentData* tr){
-  if(GetTrackType()=='c') return WriteConfMapTracks(tr);
+  //if(GetTrackType()=='c') return WriteConfMapTracks(tr);
   AliL3TrackSegmentData *tP = tr;
   UInt_t *pP;
   UInt_t size = 0;
index 41c3bfa..3c8240d 100644 (file)
@@ -7,6 +7,8 @@
 #include "AliL3Merger.h"
 #endif
 
+#include "AliL3RootTypes.h"
+
 class AliL3Merger;
 
 class AliL3TrackMerger : public AliL3Merger {
index 315160c..f597dbc 100644 (file)
@@ -11,9 +11,9 @@ class AliL3Transform {
   enum VersionType { fV_default=0, fV_deprecated=1, fV_aliroot=10, fV_cosmics=100};
 
  private:
-  const static Double_t fBFACT;
-  const static Double_t fPi;
-  const static Double_t fAnodeWireSpacing; 
+  static const Double_t fBFACT;
+  static const Double_t fPi;
+  static const Double_t fAnodeWireSpacing; 
 
   static Int_t fNPatches; //6 (dont change this) 
   static Int_t fRows[6][2];
index d2b5bb2..3a54954 100644 (file)
@@ -56,6 +56,7 @@
 ClassImp(AliLevel3)
 
 Bool_t AliLevel3::fSetTracks2FirstPoint = kTRUE;//Define track parameters at first point
+Bool_t AliLevel3::fDoVertexFit = kTRUE;//Include the vertex in the final track fit
 
 AliLevel3::AliLevel3()
 {
@@ -72,7 +73,6 @@ AliLevel3::AliLevel3(Char_t *infile)
   //meaning rootfiles or raw files.
   
   fInputFile = infile;
-
 }
 
 void AliLevel3::Init(Char_t *path,EFileType filetype,Int_t npatches)
@@ -99,6 +99,9 @@ void AliLevel3::Init(Char_t *path,EFileType filetype,Int_t npatches)
   fEta[1] = 1.1;
 
   fEvent=0;
+#ifdef use_aliroot /*just to be sure*/
+  AliL3FileHandler::CleanStaticIndex();
+#endif
 
   switch(npatches){
   case 0:
@@ -143,7 +146,7 @@ void AliLevel3::Init(Char_t *path,EFileType filetype,Int_t npatches)
   SetMergerParameters();//Set default merger parameters
 #ifdef use_aliroot
   if(filetype==kRoot){
-    fFileHandler = new AliL3FileHandler();
+    fFileHandler = new AliL3FileHandler(kTRUE); //static version
     fFileHandler->SetAliInput(fInputFile);
   }else if(filetype==kRaw){
     fFileHandler = new AliL3DDLDataFileHandler();
@@ -202,7 +205,8 @@ void AliLevel3::SetTrackerParam(Int_t phi_segments, Int_t eta_segments,
                                Double_t min_pt_fit, Double_t maxangle,
                                Double_t goodDist, Double_t hitChi2Cut,
                                Double_t goodHitChi2, Double_t trackChi2Cut,
-                               Int_t maxdist,Double_t maxphi,Double_t maxeta,Bool_t vertexconstraint)
+                               Int_t maxdist,Double_t maxphi,Double_t maxeta,
+                               Bool_t vertexconstraint)
 {
   //Set parameters input to the tracker
   //If no arguments are given, default parameters will be used
@@ -230,6 +234,9 @@ void AliLevel3::ProcessEvent(Int_t first,Int_t last,Int_t event){
   //inner=2 + outer=38.
 
   fGlobalMerger->Setup(first,last);
+#ifdef use_aliroot
+  if(fEvent!=event) AliL3FileHandler::CleanStaticIndex();
+#endif
   fEvent=event;
   for(Int_t i=first; i<=last; i++){
     ProcessSlice(i);
@@ -547,7 +554,7 @@ void AliLevel3::ProcessSlice(Int_t slice){
 
 void AliLevel3::FitGlobalTracks()
 {
-  AliL3Fitter *fitter = new AliL3Fitter(fVertex);
+  AliL3Fitter *fitter = new AliL3Fitter(fVertex,AliLevel3::DoVertexFit());
   if(fNPatch==1)
     fitter->LoadClusters(fWriteOutPath,fEvent,kTRUE);
   else
@@ -560,7 +567,8 @@ void AliLevel3::FitGlobalTracks()
       AliL3Track *tr = tracks->GetCheckedTrack(i);
       if(!tr) continue;
       fitter->FitHelix(tr);
-      fitter->UpdateTrack(tr);
+      if(AliLevel3::IsTracksAtFirstPoint())
+       tr->UpdateToFirstPoint();
     }
   fBenchmark->Stop("Global track fitter");
   delete fitter;
index 42cb6be..0553bff 100644 (file)
@@ -71,6 +71,7 @@ class AliLevel3 : public TObject {
   //Define whether track parameters should be given at first point on track (default)
   //If not, the parameters will be given at the vertex.
   static Bool_t fSetTracks2FirstPoint; 
+  static Bool_t fDoVertexFit;
 
   Bool_t fClusterDeconv;
   Float_t fXYClusterError;
@@ -116,8 +117,10 @@ class AliLevel3 : public TObject {
   
   static void SetTracks2FirstPoint()   {fSetTracks2FirstPoint = kTRUE;}
   static void SetTracks2Vertex()       {fSetTracks2FirstPoint = kFALSE;}
+  static void SetVertexFit(Bool_t f)   {fDoVertexFit=f;}
   static Bool_t IsTracksAtFirstPoint() {return fSetTracks2FirstPoint;}
-  
+  static Bool_t DoVertexFit()          {return fDoVertexFit;}
+
   ClassDef(AliLevel3,1) //Interface class for Level3-tracking
 };
 
index 6a8eb3d..bfebc3a 100644 (file)
@@ -20,8 +20,16 @@ SRCS = AliL3ConfMapper.cxx AliL3ConfMapPoint.cxx \
           AliL3Vertex.cxx AliL3VertexFinder.cxx \
           AliL3Merger.cxx AliL3GlobalMerger.cxx AliL3ClustFinderNew.cxx \
           AliL3TrackArray.cxx AliL3InterMerger.cxx AliL3Logger.cxx \
-          AliL3MemHandler.cxx AliLevel3.cxx AliL3Benchmark.cxx AliL3Fitter.cxx \
-          AliL3RawDataFileHandler.cxx
+          AliL3MemHandler.cxx AliLevel3.cxx AliL3Benchmark.cxx  \
+          AliL3Fitter.cxx AliL3RawDataFileHandler.cxx
+
+ifeq ($(ARCH),Darwin)
+EXTRA_SRCS = AliL3HoughTrack.cxx AliL3ModelTrack.cxx \
+             AliL3DataCompressorHelper.cxx AliL3DataHandler.cxx \
+             AliL3TransBit.cxx  AliL3DDLDataFileHandler.cxx
+endif
+
+SRCS += $(EXTRA_SRCS)
 
 ifeq ($(ALIHLT_USEPACKAGE),ROOT)
 SRCS += AliL3Display.cxx