]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/OnlineDisplay/AliHLTPHOSOnlineDisplayTab.cxx
Improved Online display, The Handle event function
[u/mrichter/AliRoot.git] / HLT / PHOS / OnlineDisplay / AliHLTPHOSOnlineDisplayTab.cxx
1 #include "AliHLTPHOSOnlineDisplayTab.h"
2 #include "HOMERReader.h"
3 #include <iostream>
4 #include "AliHLTDataTypes.h"
5
6
7 using namespace std;
8
9
10 AliHLTPHOSOnlineDisplayTab::AliHLTPHOSOnlineDisplayTab():AliHLTPHOSBase(),
11                                                          fgSyncronize(kFALSE)
12 {
13
14 }
15
16 AliHLTPHOSOnlineDisplayTab::~AliHLTPHOSOnlineDisplayTab()
17 {
18
19 }
20
21
22 void 
23 AliHLTPHOSOnlineDisplayTab::PrintBlockInfo(HOMERReader *homeReaderPtr, int i)
24 {
25   char tmp1[9], tmp2[5];
26   memset( tmp1, 0, 9 );
27   memset( tmp2, 0, 5);
28   void *tmp11 = tmp1;
29   ULong64_t* tmp12 = (ULong64_t*)tmp11;
30   *tmp12 =homeReaderPtr->GetBlockDataType( i );
31   void *tmp21 = tmp2;
32   ULong_t* tmp22 = (ULong_t*)tmp21;
33   *tmp22 = homeReaderPtr->GetBlockDataOrigin( i );
34   cout << "Dataype for block:  "<< i<<"  is:  "<< tmp1<<tmp2 <<endl;
35 }
36
37
38 int 
39 AliHLTPHOSOnlineDisplayTab::GetEventInfo(HOMERReader *homeReaderPtr, int i)
40 {
41   int ret = 0;
42   ret =homeReaderPtr->ReadNextEvent();  
43   if( ret ) 
44     {
45       int ndx = homeReaderPtr->GetErrorConnectionNdx();
46       printf( "------------ TRY AGAIN --------------->Error reading event from source %d: %s (%d)\n", ndx, strerror(ret), ret );
47       cout << "HOMER getconncetioNdx  status = " << ndx << endl;
48       return -1; 
49     }
50   else
51     {
52       unsigned long blockCnt = homeReaderPtr->GetBlockCnt();
53       cout << "AliHLTPHOSOnlineDisplayEventTab::GetNextEvent:  blockCnt ="  << blockCnt <<endl;
54       return blockCnt;
55     }
56 }
57
58
59 int 
60 AliHLTPHOSOnlineDisplayTab::DoGetNextEvent()
61 {
62   HOMERReader* CurrentReaderPtr;
63   int ret = 0;
64   unsigned long ndx;
65   const AliHLTComponentBlockData* iter = NULL;   
66   Bool_t nextSwitch=kTRUE; 
67   int nLoops=0;
68
69   if(fgSyncronize == kTRUE)
70     {
71       nLoops = 1;
72     }
73   else
74     {
75       nLoops =  fgNHosts; 
76     }
77
78   for(int reader = 0; reader <  nLoops; reader ++)
79     {
80       if(fgSyncronize == kTRUE)
81         {
82           CurrentReaderPtr =fgHomerReaderPtr;
83         }
84       else
85         {
86           CurrentReaderPtr =fgHomerReadersPtr[reader];
87         }
88
89       ret = GetEventInfo(CurrentReaderPtr, reader);
90
91       if( ret < 0) 
92         {
93           return ret; 
94         }
95       else
96         {
97           unsigned long blockCnt = ret;
98           for ( unsigned long i = 0; i < blockCnt; i++ ) 
99             {
100               PrintBlockInfo(CurrentReaderPtr, i);
101             }
102           ReadBlockData(CurrentReaderPtr);
103         }
104     }
105 }