]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/src/AliL3MemHandler.cxx
Made it possible to use different cuts for nonvertex tracking
[u/mrichter/AliRoot.git] / HLT / src / AliL3MemHandler.cxx
index fd274a350c3be464725e7af5be5ce7ef9e1d91e6..c2826218f7d7660a40d81643c0ba5de565ae9b47 100644 (file)
@@ -1,10 +1,11 @@
-//Author:        Uli Frankenfeld
-//Last Modified: 17.12.2000
+// Author: Uli Frankenfeld <mailto:franken@fi.uib.no>
+//*-- Copyright &copy Uli 
 
 #include <math.h>
 #include <time.h>
 #include <iostream.h>
 #include <stdio.h>
+#include <string.h>
 
 #include "AliL3MemHandler.h"
 #include "AliL3Transform.h"
@@ -14,7 +15,9 @@
 #include "AliL3TrackSegmentData.h"
 #include "AliL3SpacePointData.h"
 #include "AliL3TrackArray.h"
+
 //_____________________________________________________________
+// AliL3MemHandler
 //
 // The L3 Binary File handler 
 //
@@ -37,7 +40,7 @@ AliL3MemHandler::AliL3MemHandler(){
   fNUsed = 0;
   fNDigits = 0;
   
-  Int_t row[2] = {0,173};
+  Int_t row[2] = {0,175};
   Init(0,0,row);
   ResetROI();
 }
@@ -197,6 +200,7 @@ Byte_t *AliL3MemHandler::Allocate(UInt_t size){
   } 
   fPt = new Byte_t[size];
   fSize = size;
+  memset(fPt,0,fSize);
   LOG(AliL3Log::kDebug,"AliL3MemHandler::Allocate","Memory")
   <<AliL3Log::kDec<<"Allocate "<<size<<" Bytes of Memory"<<ENDLOG;
   return fPt;
@@ -442,6 +446,7 @@ void AliL3MemHandler::AddDataRandom(AliL3DigitData *data, UInt_t & ndata,
 void AliL3MemHandler::Write(UInt_t *comp, UInt_t & index, 
                                     UInt_t & subindex, UShort_t value){
   UInt_t shift[3] = {0,10,20};
+  if(subindex==0) comp[index] =0; //clean up memory
   comp[index] |= (value&0x03ff)<<shift[subindex];
   if(subindex == 2){
     subindex = 0;
@@ -713,7 +718,7 @@ UInt_t AliL3MemHandler::GetNRow(UInt_t *comp,UInt_t size){
   UInt_t nrow=0;
   UInt_t index=0;
   UInt_t subindex=0;
-  while(index+1<size){
+  while(index<size-1){ //don't start with last word
     nrow++;
     UInt_t ndigit=0;
     Read(comp,index,subindex);
@@ -730,10 +735,11 @@ UInt_t AliL3MemHandler::GetNRow(UInt_t *comp,UInt_t size){
       }
     }
   }
-  if(index+1==size)
-  if(subindex<2)
-  if(Read(comp,index,subindex)!=0) nrow++;
-
+  if(index==size-1){  //last word
+    if(subindex<2){
+      if(Read(comp,index,subindex)!=0) nrow++;
+    }
+  }
   return nrow;
 }
 
@@ -1094,3 +1100,12 @@ Bool_t AliL3MemHandler::Memory2TrackArray(UInt_t ntrack,AliL3TrackSegmentData *d
   return kTRUE;
 }
 
+void AliL3MemHandler::UpdateRowPointer(AliL3DigitRowData *&tempPt)
+{
+  //Update the data pointer to the next padrow
+  
+  Byte_t *tmp = (Byte_t*)tempPt;
+  Int_t size = sizeof(AliL3DigitRowData) + tempPt->fNDigit*sizeof(AliL3DigitData);
+  tmp += size;
+  tempPt = (AliL3DigitRowData*)tmp;
+}