]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/programs/read.cxx
New topdir Makefile for compiling all libraries in the HLT tree.
[u/mrichter/AliRoot.git] / HLT / programs / read.cxx
index 66ed93236eae58326dfc6b6bba27dc502d73a911..f03d37127033cc3aefd8d2671891d63e5ce965dc 100644 (file)
@@ -13,8 +13,8 @@ Author: Constantin Loizides <mailto: loizides@ikf.physik.uni-frankfurt.de
 
 /**
 Example program how to open and read a raw datafile.
 
 /**
 Example program how to open and read a raw datafile.
-In addition it shows, how to store results in an Altro like 
-data format. 
+In addition it shows, how to store (and read) the
+digits in an Altro like data format. 
 */
 
 int main(int argc,char **argv)
 */
 
 int main(int argc,char **argv)
@@ -24,12 +24,10 @@ int main(int argc,char **argv)
   Bool_t altroout=kFALSE;
   FILE *afile=0;
   
   Bool_t altroout=kFALSE;
   FILE *afile=0;
   
-  /*
-    AliL3Logger l;
-    l.Set(AliL3Logger::kAll);
-    //l.UseStdout();
-    l.UseStream();
-  */
+  //AliL3Logger l;
+  //l.Set(AliL3Logger::kAll);
+  //l.UseStdout();
+  //l.UseStream();
 
   if(argc<2)
     {
 
   if(argc<2)
     {
@@ -60,7 +58,8 @@ int main(int argc,char **argv)
   if((patch>=0)&&(patch<6)) file.Init(slice,patch);
   else {
     Int_t srows[2]={0,175};
   if((patch>=0)&&(patch<6)) file.Init(slice,patch);
   else {
     Int_t srows[2]={0,175};
-    file.Init(slice,0,srows);
+    patch=0;
+    file.Init(slice,patch,srows);
   }
 
   //Open the data file:
   }
 
   //Open the data file:
@@ -94,14 +93,13 @@ int main(int argc,char **argv)
       
       //Loop over all digits on this padrow:
       for(UInt_t ndig=0; ndig<digits->fNDigit; ndig++)
       
       //Loop over all digits on this padrow:
       for(UInt_t ndig=0; ndig<digits->fNDigit; ndig++)
-      //for(UInt_t ndig=digits->fNDigit;ndig>0;ndig--)
        {
          lrow=row;
          pad = dataPt[ndig].fPad;
          time = dataPt[ndig].fTime;
          charge = dataPt[ndig].fCharge;
          cout << "Padrow " << row << " pad " << (int)pad << " time " <<(int) time << " charge " << (int)charge << endl;
        {
          lrow=row;
          pad = dataPt[ndig].fPad;
          time = dataPt[ndig].fTime;
          charge = dataPt[ndig].fCharge;
          cout << "Padrow " << row << " pad " << (int)pad << " time " <<(int) time << " charge " << (int)charge << endl;
-         if(altroout) altromem.Write(row,pad,charge,time);
+         if(altroout) altromem.Write(row,pad,time,charge);
        }
       
       //Move the pointer to the next padrow:
        }
       
       //Move the pointer to the next padrow:
@@ -111,6 +109,33 @@ int main(int argc,char **argv)
   if(afile) {
     altromem.WriteFinal();
     fclose(afile);
   if(afile) {
     altromem.WriteFinal();
     fclose(afile);
+    
+#if 0
+    //test Altro read
+    UShort_t rrow=0,rtime=0,rcharge=0;
+    UChar_t rpad=0;
+    afile=fopen(argv[4],"r");
+    altromem.SetASCIIInput(afile);
+    while(altromem.Read(rrow,rpad,rtime,rcharge)){
+      cout << "Padrow " << (int)rrow << " pad " << (int)rpad << " time " <<(int)rtime << " charge " << (int)rcharge << endl;
+    }
+    fclose(afile);  
+#endif
+#if 0
+    //test Altro read sequence
+    UShort_t rrow=0,rtime=0;
+    UChar_t rpad=0,n=100,i=100;
+    UShort_t *charges=new UShort_t[100];
+    afile=fopen(argv[4],"r");
+    altromem.SetASCIIInput(afile);
+    while(altromem.ReadSequence(rrow,rpad,rtime,i,&charges)){
+      cout << "Padrow " << (int)rrow << " pad " << (int)rpad << " time " <<(int)rtime << " charges ";
+      for(UChar_t ii=0;ii<i;ii++) cout << (int)charges[ii] << " ";
+      cout << endl;
+      i=n;
+    }
+    fclose(afile);  
+#endif
   }
 
   //cerr << "Rows: " << (file.GetRowMax()-file.GetRowMin()+1) << " Consecutive: " << crows << endl;
   }
 
   //cerr << "Rows: " << (file.GetRowMax()-file.GetRowMin()+1) << " Consecutive: " << crows << endl;