]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliSimDigits.cxx
Updated SDigitizer; Added AliTOFanalyzeSDigits.C macro
[u/mrichter/AliRoot.git] / TPC / AliSimDigits.cxx
index a3fbba53f3e399cfe0b4703bfdb0778b87dc153f..bcef1be68cdfbb2801a0f7cd3d1d60fb2074028c 100644 (file)
 
 /*
 $Log$
+Revision 1.5  2001/11/24 16:10:22  kowal2
+Faster algorithms.
+
+Revision 1.4  2000/10/05 16:01:49  kowal2
+Corrected for memory leaks.
+
 Revision 1.3  2000/06/30 12:07:49  kowal2
 Updated from the TPC-PreRelease branch
 
@@ -255,11 +261,16 @@ void  AliSimDigits::CompresTrackBuffer1()
   buf->Set(fNrows*fNcols*fNlevel); //lets have the nearly the "worst case"
   AliArrayI *  index = new AliArrayI;
   index->Set(fNcols*fNlevel);
+  //  Int_t * pindex = 
 
+  
   Int_t icurrent=-1;  //current index
   Int_t izero;      //number of zero
   Int_t inum;      //number of digits  with the same current track id  
-  Int_t lastID =0;  //last track id
+  Int_t lastID =0;  //last track id  
+  
+  Int_t *cbuff=fTracks->GetArray(); //MI change
+
   for (Int_t lev =0; lev<fNlevel; lev++){    //loop over levels 
     for (Int_t col = 0; col<fNcols; col++){    //loop over columns
       izero = 0;
@@ -267,12 +278,13 @@ void  AliSimDigits::CompresTrackBuffer1()
       lastID = 0;
       (*index)[lev*fNcols+col]=icurrent+1;//set collumn pointer
       Int_t id=0;  //current id
-      for (Int_t row = 0; row< fNrows;row++){ //loop over rows
-       id = GetTrackIDFast(row,col,lev);
+      for (Int_t row = 0; row< fNrows;row++){ //loop over rows        
+       id = *cbuff;  //MI change
+       //      id = GetTrackIDFast(row,col,lev);
        if (id <= 0) {
          if ( inum> 0 ) { //if we have some tracks in buffer
            icurrent++;
-           if ((icurrent+1)>=buf->fN) buf->Expand(icurrent*2);
+           if ((icurrent+1)>=buf->fN) buf->Expand(icurrent*2+1); //MI change - allocate +1
            (*buf)[icurrent] = inum;
            icurrent++;
            (*buf)[icurrent] = lastID;  
@@ -286,7 +298,7 @@ void  AliSimDigits::CompresTrackBuffer1()
            if ( izero > 0 ) { 
              //if we have currently izero count of non tracks digits
              icurrent++;         
-             if (icurrent>=buf->fN) buf->Expand(icurrent*2);
+             if (icurrent>=buf->fN) buf->Expand(icurrent*2+1);
              (*buf)[icurrent]= -izero;  //write how many under zero
              inum++;
              izero = 0;             
@@ -295,7 +307,7 @@ void  AliSimDigits::CompresTrackBuffer1()
            else{ 
              //if we change track id from another track id         
              icurrent++;         
-             if ((icurrent+1)>=buf->fN) buf->Expand(icurrent*2);
+             if ((icurrent+1)>=buf->fN) buf->Expand(icurrent*2+1);
              (*buf)[icurrent] = inum;
              icurrent++;
              (*buf)[icurrent] = lastID;        
@@ -306,8 +318,8 @@ void  AliSimDigits::CompresTrackBuffer1()
          else {          
            inum++;
          }
-       
-      }//end of loop over rows
+       cbuff++;  //MI change
+      }//end of loop over row
       if ( izero > 0 ) { 
        //if we have currently izero count of non tracks digits
        icurrent++;