1 #include "AliAltroDecoder.h" // decoder for altro payload
2 #include "AliAltroData.h" // container for altro payload
3 #include "AliAltroBunch.h" // container for altro bunches
14 #define MIN_BUNCH_SIZE 0
23 int main(int argc, const char** argv)
31 // catch( bad_alloc &moryAllocationExeption)
34 // catch( exception &e)
37 std::cerr<<"something bad happened\n";
38 cout << "SEGFAULT" << endl;
42 // int n_loops = 200000;
48 AliAltroData altrodata;
49 AliAltroBunch *altrobunchPtr = new AliAltroBunch;
54 AliAltroDecoder *decoder = new AliAltroDecoder();
56 fin.open(argv[1], ios::binary);
58 fin.seekg (0, ios::end);
60 fin.seekg (0, ios::beg);
62 char *dataPtr = new char[length];
64 fin.read (dataPtr,length);
72 for(int i=0; i < n_loops; i++)
74 decoder->SetMemory((UChar_t*)dataPtr, length);
78 //while(decoder->NextChannel(&altrodata) == true && channelCnt < 10)
79 while(decoder->NextChannel(&altrodata) == true)
83 // decoder->PrintInfo(altrodata, altrodata.GetDataSize() +4);
84 // if( altrodata.GetDataSize() != 0 )
89 while( altrodata.NextBunch(altrobunchPtr) == true)
94 // if(altrobunchPtr->GetBunchSize() > MIN_BUNCH_SIZE)
97 cout <<"bunchcnt = "<< cnt <<endl;
98 cout << "altrobunch.fDataSize = " << altrobunchPtr->GetBunchSize() << endl;
99 cout << "altrobunch.fEndTimeBin = " << altrobunchPtr->GetEndTimeBin() << endl;
100 cout << "altrobunch.fStartTimeBin = " << altrobunchPtr->GetStartTimeBin() << endl;
102 // for(int i=0; i<altrobunchPtr->GetBunchSize() + 20; i++)
103 for(int i=0; i<altrobunchPtr->GetBunchSize(); i++)
110 // printf("%d\t", altrobunchPtr->fData[i]);
111 printf("%d\t", (altrobunchPtr->GetData())[i]);
130 float mikro = (float)(((float)end -(float)start)/((float)n_loops));
132 printf("\nProcessing time per event is %f us\n", mikro);
134 decoder->GetFailureRate();
144 cout << "SEGFAULT" << endl;
157 for(int i=0; i < 100; i++)
159 printf("%d\n", tmp[i]);