]>
Commit | Line | Data |
---|---|---|
939c67e7 | 1 | #include "AliAltroDecoder.h" // decoder for altro payload |
2 | #include "AliAltroData.h" // container for altro payload | |
3 | #include "AliAltroBunch.h" // container for altro bunches | |
56673b84 | 4 | |
241d9cf8 | 5 | #include "Rtypes.h" |
6 | #include <iostream> | |
7 | #include <fstream> | |
8 | #include <iomanip> | |
9 | #include <cstdlib> | |
6e709a0d | 10 | #include <time.h> |
11 | #include "stdio.h" | |
241d9cf8 | 12 | |
939c67e7 | 13 | #define MIN_BUNCH_SIZE 0 |
9c9d15d6 | 14 | |
56673b84 | 15 | using namespace std; |
6e709a0d | 16 | |
241d9cf8 | 17 | int main(int argc, const char** argv) |
18 | { | |
56673b84 | 19 | |
cd9b0124 | 20 | // int n_loops = 200000; |
21 | int n_loops = 1; | |
6e709a0d | 22 | |
23 | clock_t start; | |
24 | clock_t end; | |
25 | ||
939c67e7 | 26 | AliAltroData altrodata; |
27 | AliAltroBunch *altrobunchPtr = new AliAltroBunch; | |
241d9cf8 | 28 | |
29 | ifstream fin; | |
30 | int length; | |
31 | ||
939c67e7 | 32 | AliAltroDecoder *decoder = new AliAltroDecoder(); |
241d9cf8 | 33 | |
34 | fin.open(argv[1], ios::binary); | |
35 | ||
36 | fin.seekg (0, ios::end); | |
37 | length = fin.tellg(); | |
38 | fin.seekg (0, ios::beg); | |
39 | ||
40 | char *dataPtr = new char[length]; | |
41 | ||
42 | fin.read (dataPtr,length); | |
43 | fin.close(); | |
241d9cf8 | 44 | |
cd9b0124 | 45 | int cnt = 0; |
46 | int channelCnt = 0; | |
47 | ||
6e709a0d | 48 | start =clock(); |
49 | ||
50 | for(int i=0; i < n_loops; i++) | |
241d9cf8 | 51 | { |
6e709a0d | 52 | decoder->SetMemory((UChar_t*)dataPtr, length); |
53 | decoder->Decode(); | |
03b3d247 | 54 | |
cd9b0124 | 55 | |
56 | while(decoder->NextChannel(&altrodata) == true && channelCnt < 10) | |
6e709a0d | 57 | { |
cd9b0124 | 58 | channelCnt ++; |
939c67e7 | 59 | |
60 | // decoder->PrintInfo(altrodata, altrodata.GetDataSize() +4); | |
61 | ||
62 | if( altrodata.GetDataSize() != 0 ) | |
6e709a0d | 63 | { |
cd9b0124 | 64 | cnt = 0; |
65 | ||
9c9d15d6 | 66 | while( altrodata.NextBunch(altrobunchPtr) == true) |
67 | { | |
939c67e7 | 68 | // printf("\n"); |
cd9b0124 | 69 | |
939c67e7 | 70 | if(altrobunchPtr->GetBunchSize() > MIN_BUNCH_SIZE) |
cd9b0124 | 71 | { |
72 | printf("\n"); | |
73 | cout <<"cnt = "<< cnt <<endl; | |
939c67e7 | 74 | cout << "altrobunch.fDataSize = " << altrobunchPtr->GetBunchSize() << endl; |
75 | cout << "altrobunch.fEndTimeBin = " << altrobunchPtr->GetEndTimeBin() << endl; | |
76 | cout << "altrobunch.fStartTimeBin = " << altrobunchPtr->GetStartTimeBin() << endl; | |
77 | ||
78 | for(int i=0; i<altrobunchPtr->GetBunchSize() + 20; i++) | |
cd9b0124 | 79 | { |
80 | if(i != 0 && i%4==0) | |
81 | { | |
82 | printf("\n"); | |
83 | } | |
939c67e7 | 84 | |
85 | // printf("%d\t", altrobunchPtr->fData[i]); | |
86 | printf("%d\t", (altrobunchPtr->GetData())[i]); | |
87 | ||
cd9b0124 | 88 | } |
89 | ||
90 | printf("\n\n"); | |
91 | } | |
92 | cnt ++; | |
9c9d15d6 | 93 | } |
cd9b0124 | 94 | |
6e709a0d | 95 | } |
241d9cf8 | 96 | } |
cd9b0124 | 97 | |
241d9cf8 | 98 | } |
99 | ||
6e709a0d | 100 | end = clock(); |
101 | ||
102 | float mikro = (float)(((float)end -(float)start)/((float)n_loops)); | |
103 | ||
6e709a0d | 104 | printf("\nProcessing time per event is %f us\n", mikro); |
105 | ||
241d9cf8 | 106 | decoder->GetFailureRate(); |
107 | ||
6e709a0d | 108 | // cnt ++; |
56673b84 | 109 | |
110 | return 0; | |
111 | ||
241d9cf8 | 112 | } |