]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/PHOS/testDecoder.cxx
Script to make defauilt reco param
[u/mrichter/AliRoot.git] / HLT / PHOS / testDecoder.cxx
index 1650886524e3e725f78554ea17db9ac5397837b2..41f5c1dee3e55758c17015271dd45b2e24c7c520 100644 (file)
@@ -1,7 +1,7 @@
+#include  "AliAltroDecoder.h"    // decoder for altro payload
+#include  "AliAltroData.h"       // container for altro payload
+#include  "AliAltroBunch.h"      // container for altro bunches
 
-#include "AliHLTDDLDecoder.h"
-
-#include "AliHLTAltroData.h"
 #include "Rtypes.h"
 #include <iostream>
 #include <fstream>
@@ -9,25 +9,49 @@
 #include <cstdlib>
 #include <time.h>
 #include "stdio.h"
+#include <stdexcept>
+
+#define MIN_BUNCH_SIZE 0
+
+void test();
 
 
 using namespace std;
 
+
+
 int main(int argc, const char** argv)
 {
-  
-  int n_loops = 200000;
+
+  /*
+  try
+  {
+    test(); 
+  }
+  // catch( bad_alloc &moryAllocationExeption)
+  // catch( bad_alloc)   
+  //  catch(...)   
+  //   catch( exception &e)
+  catch(...)   
+    {
+      std::cerr<<"something bad happened\n";
+      cout << "SEGFAULT" << endl;
+    }
+*/
+
+  //  int n_loops = 200000;
+  int n_loops = 1;
 
   clock_t  start;
   clock_t  end;
 
-  AliHLTAltroData altrodata;
-  AliHLTAltroBunch *altrobunchPtr = new AliHLTAltroBunch;
+  AliAltroData altrodata;
+  AliAltroBunch *altrobunchPtr = new AliAltroBunch;
 
   ifstream fin;
   int length;
   
-  AliHLTDDLDecoder *decoder = new AliHLTDDLDecoder();
+  AliAltroDecoder *decoder = new AliAltroDecoder();
   
   fin.open(argv[1], ios::binary);
   
@@ -40,6 +64,9 @@ int main(int argc, const char** argv)
   fin.read (dataPtr,length);
   fin.close();
 
+  int cnt = 0;
+  int channelCnt = 0;
+
   start =clock();
  
   for(int i=0; i < n_loops; i++)
@@ -47,25 +74,55 @@ int main(int argc, const char** argv)
       decoder->SetMemory((UChar_t*)dataPtr, length);
       decoder->Decode();
  
+      
+      //while(decoder->NextChannel(&altrodata) == true && channelCnt < 10)
       while(decoder->NextChannel(&altrodata) == true)
        {
-        
-         if(  altrodata.fDataSize != 0 )
-           {
-  
-
+         channelCnt ++;
+
+         //      decoder->PrintInfo(altrodata, altrodata.GetDataSize() +4);
+         //      if(  altrodata.GetDataSize() != 0 )
+         //        {
+             //   cnt = 0;
+             cnt = 0;
+             
              while( altrodata.NextBunch(altrobunchPtr) == true)
                {
-                 //cout << "altrobunch.fDataSize = "    << altrobunchPtr->fBunchSize   << endl;
-                 // cout << "altrobunch.fEndTimeBin = "  << altrobunchPtr->fEndTimeBin  << endl;
+                 //      cnt = 0;
+                 //              printf("\n");
+
+                 //              if(altrobunchPtr->GetBunchSize() > MIN_BUNCH_SIZE)
+                 //                { 
+                 printf("\n");
+                 cout <<"bunchcnt = "<< cnt <<endl;
+                 cout << "altrobunch.fDataSize = "      << altrobunchPtr->GetBunchSize()   << endl;
+                 cout << "altrobunch.fEndTimeBin = "    << altrobunchPtr->GetEndTimeBin()  << endl;
+                 cout << "altrobunch.fStartTimeBin = "  << altrobunchPtr->GetStartTimeBin()  << endl;
+
+                 // for(int i=0; i<altrobunchPtr->GetBunchSize() + 20; i++)
+                 for(int i=0; i<altrobunchPtr->GetBunchSize(); i++)  
+                   {
+                     if(i != 0 && i%4==0)
+                       {
+                         printf("\n");
+                       }
+                         
+                     //                          printf("%d\t", altrobunchPtr->fData[i]);
+                     printf("%d\t", (altrobunchPtr->GetData())[i]); 
+
+                   }
+                       
+                 cnt ++; 
+
+                 printf("\n\n");
                }
-           //  printf("\n\n");
-            
-           }
-       }
-
-      //     end = clock();
+             
+             //   cnt ++; 
+             //}
 
+             //  }
+       }
+      
     }
 
   end = clock();
@@ -77,7 +134,29 @@ int main(int argc, const char** argv)
   decoder->GetFailureRate();
 
   //  cnt ++;
-  
- return 0;
+  /*
+  try
+    {
+      test(); 
+    }
+  catch
+    {
+      cout << "SEGFAULT" << endl;
+    }
+  */
+
+  return 0;
  
 }  
+
+
+void test()
+{
+  int *tmp;
+
+  for(int i=0; i < 100; i++)
+    {
+      printf("%d\n", tmp[i]);
+    }
+
+}