]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Better protection.
authorkowal2 <kowal2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Jan 2002 17:15:23 +0000 (17:15 +0000)
committerkowal2 <kowal2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Jan 2002 17:15:23 +0000 (17:15 +0000)
TPC/AliSimDigits.cxx

index 1929ef0a299f04185a7e9b60aceefac80b8e5c73..bcef1be68cdfbb2801a0f7cd3d1d60fb2074028c 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $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.
 
@@ -281,7 +284,7 @@ void  AliSimDigits::CompresTrackBuffer1()
        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;  
@@ -295,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;             
@@ -304,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;