]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliSimDigits.cxx
Adding some QCD diffractive states to the PDG list
[u/mrichter/AliRoot.git] / TPC / AliSimDigits.cxx
index a3fbba53f3e399cfe0b4703bfdb0778b87dc153f..479df5748ac50d0fade3c68783f5c9e80fe7c276 100644 (file)
 
 /*
 $Log$
+Revision 1.7  2002/10/23 07:17:33  alibrary
+Introducing Riostream.h
+
+Revision 1.6  2002/01/21 17:15:23  kowal2
+Better protection.
+
+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
 
@@ -52,7 +64,7 @@ Digits handling in a new data structure
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "TClass.h"
-#include <iostream.h>
+#include <Riostream.h>
 #include "TError.h"
 #include "AliSegmentID.h"
 #include "AliH2F.h"
@@ -255,11 +267,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 +284,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 +304,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 +313,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 +324,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++;       
@@ -403,9 +421,9 @@ TClonesArray *  AliSimDigits::GenerTPCClonesArray(TClonesArray * arr)
        dig.fSignal= amp;
        dig.fPadRow =fSegmentID;
        dig.fSector =fSegmentID;
-       dig.fTracks[0]= GetTrackID(row,col,0);
-       dig.fTracks[1]= GetTrackID(row,col,1);
-       dig.fTracks[2]= GetTrackID(row,col,2);
+       dig.GetTracks()[0]= GetTrackID(row,col,0);
+       dig.GetTracks()[1]= GetTrackID(row,col,1);
+       dig.GetTracks()[2]= GetTrackID(row,col,2);
        TClonesArray &ldigits = *digits;
        new(ldigits[index++]) AliTPCdigit(dig);
       }