]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/test/testAliHLTEventDDLBackwardCompatibility.C
test changes related to AD det addition
[u/mrichter/AliRoot.git] / HLT / BASE / test / testAliHLTEventDDLBackwardCompatibility.C
1 // $Id: $
2
3 /**************************************************************************
4  * This file is property of and copyright by the ALICE HLT Project        *
5  * ALICE Experiment at CERN, All rights reserved.                         *
6  *                                                                        *
7  * Primary Authors: Artur Szostak <artursz@iafrica.com>                   *
8  *                  for The ALICE HLT Project.                            *
9  *                                                                        *
10  * Permission to use, copy, modify and distribute this software and its   *
11  * documentation strictly for non-commercial purposes is hereby granted   *
12  * without fee, provided that the above copyright notice appears in all   *
13  * copies and that both the copyright notice and this permission notice   *
14  * appear in the supporting documentation. The authors make no claims     *
15  * about the suitability of this software for any purpose. It is          *
16  * provided "as is" without express or implied warranty.                  *
17  **************************************************************************/
18
19 /// @file   testAliHLTEventDDLBackwardCompatibility.C
20 /// @author Artur Szostak <artursz@iafrica.com>
21 /// @date   25 June 2010
22 /// @brief  Test program for backward compatibility of the AliHLTEventDDL structure.
23 ///
24
25 #if defined(__CINT__) && (! defined(__MAKECINT__))
26 #error This macro must be compiled. Try running as testAliHLTEventDDLBackwardCompatibility.C++.
27 #endif
28
29 #if !defined(__CINT__) || defined(__MAKECINT__)
30 #include "AliHLTDataTypes.h"
31 #include "AliHLTReadoutList.h"
32 #include "AliHLTDAQ.h"
33 #include "AliHLTComponent.h"
34 #include "AliHLTCDHWrapper.h"
35 #include "TRandom3.h"
36 #include "TString.h"
37 #include "TFile.h"
38 #include "TTree.h"
39 #include "Riostream.h"
40 #include <vector>
41 #include <algorithm>
42 #endif
43
44 /**
45  * Tests to see if the AliHLTReadoutList class handles both AliHLTEventDDLV0
46  * and AliHLTEventDDLV1 correctly.
47  */
48 bool CheckReadoutListConvertedCorrectly()
49 {
50         // Initialise the different versions of the structures so that every detector
51         // has only its first DDL set.
52         union
53         {
54                 AliHLTEventDDL eventddlV0;
55                 AliHLTEventDDLV0 bitsV0;
56         };
57         bitsV0.fCount = gkAliHLTDDLListSizeV0;
58         if (gkAliHLTDDLListSizeV0 != 30)
59         {
60                 cerr << "ERROR: gkAliHLTDDLListSizeV0 has a value of " << gkAliHLTDDLListSizeV0
61                         << " but expected a value of 30." << endl;
62                 return false;
63         }
64         bitsV0.fList[0] = 0x00000001; // kITSSPD
65         bitsV0.fList[1] = 0x00000001; // kITSSDD
66         bitsV0.fList[2] = 0x00000001; // kITSSSD
67         bitsV0.fList[3] = 0x00000001; // kTPC
68         bitsV0.fList[4] = 0x00000000; // kTPC
69         bitsV0.fList[5] = 0x00000000; // kTPC
70         bitsV0.fList[6] = 0x00000000; // kTPC
71         bitsV0.fList[7] = 0x00000000; // kTPC
72         bitsV0.fList[8] = 0x00000000; // kTPC
73         bitsV0.fList[9] = 0x00000000; // kTPC
74         bitsV0.fList[10] = 0x00000000; // kTPC
75         bitsV0.fList[11] = 0x00000001; // kTRD
76         bitsV0.fList[12] = 0x00000001; // kTOF
77         bitsV0.fList[13] = 0x00000000; // kTOF
78         bitsV0.fList[14] = 0x00000000; // kTOF
79         bitsV0.fList[15] = 0x00000001; // kHMPID
80         bitsV0.fList[16] = 0x00000001; // kPHOS
81         bitsV0.fList[17] = 0x00000001; // kCPV
82         bitsV0.fList[18] = 0x00000001; // kPMD
83         bitsV0.fList[19] = 0x00000001; // kMUONTRK
84         bitsV0.fList[20] = 0x00000001; // kMUONTRG
85         bitsV0.fList[21] = 0x00000001; // kFMD
86         bitsV0.fList[22] = 0x00000001; // kT0
87         bitsV0.fList[23] = 0x00000001; // kV0
88         bitsV0.fList[24] = 0x00000001; // kZDC
89         bitsV0.fList[25] = 0x00000001; // kACORDE
90         bitsV0.fList[26] = 0x00000001; // kTRG
91         bitsV0.fList[27] = 0x00000001; // kEMCAL
92         bitsV0.fList[28] = 0x00000001; // kDAQTEST
93         bitsV0.fList[29] = 0x00000001; // kHLT
94         
95         union
96         {
97                 AliHLTEventDDL eventddlV1;
98                 AliHLTEventDDLV1 bitsV1;
99         };
100         bitsV1.fCount = gkAliHLTDDLListSizeV1;
101         if (gkAliHLTDDLListSizeV1 != 31)
102         {
103                 cerr << "ERROR: gkAliHLTDDLListSizeV1 has a value of " << gkAliHLTDDLListSizeV1
104                         << " but expected a value of 31." << endl;
105                 return false;
106         }
107         bitsV1.fList[0] = 0x00000001; // kITSSPD
108         bitsV1.fList[1] = 0x00000001; // kITSSDD
109         bitsV1.fList[2] = 0x00000001; // kITSSSD
110         bitsV1.fList[3] = 0x00000001; // kTPC
111         bitsV1.fList[4] = 0x00000000; // kTPC
112         bitsV1.fList[5] = 0x00000000; // kTPC
113         bitsV1.fList[6] = 0x00000000; // kTPC
114         bitsV1.fList[7] = 0x00000000; // kTPC
115         bitsV1.fList[8] = 0x00000000; // kTPC
116         bitsV1.fList[9] = 0x00000000; // kTPC
117         bitsV1.fList[10] = 0x00000000; // kTPC
118         bitsV1.fList[11] = 0x00000001; // kTRD
119         bitsV1.fList[12] = 0x00000001; // kTOF
120         bitsV1.fList[13] = 0x00000000; // kTOF
121         bitsV1.fList[14] = 0x00000000; // kTOF
122         bitsV1.fList[15] = 0x00000001; // kHMPID
123         bitsV1.fList[16] = 0x00000001; // kPHOS
124         bitsV1.fList[17] = 0x00000001; // kCPV
125         bitsV1.fList[18] = 0x00000001; // kPMD
126         bitsV1.fList[19] = 0x00000001; // kMUONTRK
127         bitsV1.fList[20] = 0x00000001; // kMUONTRG
128         bitsV1.fList[21] = 0x00000001; // kFMD
129         bitsV1.fList[22] = 0x00000001; // kT0
130         bitsV1.fList[23] = 0x00000001; // kV0
131         bitsV1.fList[24] = 0x00000001; // kZDC
132         bitsV1.fList[25] = 0x00000001; // kACORDE
133         bitsV1.fList[26] = 0x00000001; // kTRG
134         bitsV1.fList[27] = 0x00000001; // kEMCAL
135         bitsV1.fList[28] = 0x00000000; // kEMCAL
136         bitsV1.fList[29] = 0x00000001; // kDAQTEST
137         bitsV1.fList[30] = 0x00000001; // kHLT
138         
139         union
140         {
141                 AliHLTEventDDL eventddlV2;
142                 AliHLTEventDDLV2 bitsV2;
143         };
144         bitsV2.fCount = gkAliHLTDDLListSizeV2;
145         if (gkAliHLTDDLListSizeV2 != 32)
146         {
147                 cerr << "ERROR: gkAliHLTDDLListSizeV2 has a value of " << gkAliHLTDDLListSizeV2
148                         << " but expected a value of 32." << endl;
149                 return false;
150         }
151         bitsV2.fList[0] = 0x00000001; // kITSSPD
152         bitsV2.fList[1] = 0x00000001; // kITSSDD
153         bitsV2.fList[2] = 0x00000001; // kITSSSD
154         bitsV2.fList[3] = 0x00000001; // kTPC
155         bitsV2.fList[4] = 0x00000000; // kTPC
156         bitsV2.fList[5] = 0x00000000; // kTPC
157         bitsV2.fList[6] = 0x00000000; // kTPC
158         bitsV2.fList[7] = 0x00000000; // kTPC
159         bitsV2.fList[8] = 0x00000000; // kTPC
160         bitsV2.fList[9] = 0x00000000; // kTPC
161         bitsV2.fList[10] = 0x00000000; // kTPC
162         bitsV2.fList[11] = 0x00000001; // kTRD
163         bitsV2.fList[12] = 0x00000001; // kTOF
164         bitsV2.fList[13] = 0x00000000; // kTOF
165         bitsV2.fList[14] = 0x00000000; // kTOF
166         bitsV2.fList[15] = 0x00000001; // kHMPID
167         bitsV2.fList[16] = 0x00000001; // kPHOS
168         bitsV2.fList[17] = 0x00000001; // kCPV
169         bitsV2.fList[18] = 0x00000001; // kPMD
170         bitsV2.fList[19] = 0x00000001; // kMUONTRK
171         bitsV2.fList[20] = 0x00000001; // kMUONTRG
172         bitsV2.fList[21] = 0x00000001; // kFMD
173         bitsV2.fList[22] = 0x00000001; // kT0
174         bitsV2.fList[23] = 0x00000001; // kV0
175         bitsV2.fList[24] = 0x00000001; // kZDC
176         bitsV2.fList[25] = 0x00000001; // kACORDE
177         bitsV2.fList[26] = 0x00000001; // kTRG
178         bitsV2.fList[27] = 0x00000001; // kEMCAL
179         bitsV2.fList[28] = 0x00000000; // kEMCAL
180         bitsV2.fList[29] = 0x00000001; // kDAQTEST
181         bitsV2.fList[30] = 0x00000000; // kAD
182         bitsV2.fList[31] = 0x00000001; // kHLT
183         
184         AliHLTReadoutList rlV0(eventddlV0);
185         AliHLTReadoutList rlV1(eventddlV1);
186   AliHLTReadoutList rlV2(eventddlV2);
187         
188   printf("eventddlV0.fCount: %i\n",eventddlV0.fCount);
189   printf("eventddlV1.fCount: %i\n",eventddlV1.fCount);
190   printf("eventddlV2.fCount: %i\n",eventddlV2.fCount);
191   printf("rlV0.BufferSize(): %i\n",rlV0.BufferSize());
192   printf("rlV1.BufferSize(): %i\n",rlV1.BufferSize());
193   printf("rlV2.BufferSize(): %i\n",rlV2.BufferSize());
194   printf("sizeof AliHLTEventDDLV0: %i\n", sizeof(AliHLTEventDDLV0));
195   printf("sizeof AliHLTEventDDLV1: %i\n", sizeof(AliHLTEventDDLV1));
196   printf("sizeof AliHLTEventDDLV2: %i\n", sizeof(AliHLTEventDDLV2));
197   printf("sizeof AliHLTEventDDL: %i\n", sizeof(AliHLTEventDDL));
198   printf("sizeof rlV0: %i, sizeof eventddlV0: %i\n",sizeof(rlV2), sizeof(eventddlV2));
199   printf("sizeof rlV1: %i, sizeof eventddlV1: %i\n",sizeof(rlV2), sizeof(eventddlV2));
200   printf("sizeof rlV2: %i, sizeof eventddlV2: %i\n",sizeof(rlV2), sizeof(eventddlV2));
201
202         // Check that for both readout list versions only the first DDLs are
203         // enabled as expected.
204         for (Int_t i = 0; i < AliHLTDAQ::NumberOfDetectors(); ++i)
205         for (Int_t j = 0; j < AliHLTDAQ::NumberOfDdls(i); ++j)
206         {
207                 Int_t ddlid = AliHLTDAQ::DdlIDOffset(i) | (j & 0xFF);
208                 if (j == 0)
209                 {
210                         if (rlV0.IsDDLDisabled(ddlid) && i!=20)
211                         {
212                                 cerr << "ERROR: The first DDL for detector " << AliHLTDAQ::DetectorName(i)
213                                         << " was not enabled for readout list initialised from AliHLTEventDDLV0."
214                                         << endl;
215       printf("i=%i, j=%i, ddlid=%i, det=%s, enabled: %i\n",i,j,ddlid,AliHLTDAQ::DetectorName(i), (rlV0.IsDDLDisabled(ddlid))?0:1);
216                                 //return false;
217                         }
218                         if (rlV1.IsDDLDisabled(ddlid) && i!=20)
219                         {
220                                 cerr << "ERROR: The first DDL for detector " << AliHLTDAQ::DetectorName(i)
221                                         << " was not enabled for readout list initialised from AliHLTEventDDLV1."
222                                         << endl;
223       printf("i=%i, j=%i, ddlid=%i, det=%s, enabled: %i\n",i,j,ddlid,AliHLTDAQ::DetectorName(i), (rlV1.IsDDLDisabled(ddlid))?0:1);
224                                 //return false;
225                         }
226                         if (rlV2.IsDDLDisabled(ddlid))
227                         {
228                                 cerr << "ERROR: The first DDL for detector " << AliHLTDAQ::DetectorName(i)
229                                         << " was not enabled for readout list initialised from AliHLTEventDDLV2."
230                                         << endl;
231       printf("i=%i, j=%i, ddlid=%i, det=%s, enabled: %i\n",i,j,ddlid,AliHLTDAQ::DetectorName(i), (rlV2.IsDDLDisabled(ddlid))?0:1);
232                                 //return false;
233                         }
234                 }
235                 else
236                 {
237                         if (rlV0.IsDDLEnabled(ddlid))
238                         {
239                                 cerr << "ERROR: DDL " << ddlid << " for detector " << AliHLTDAQ::DetectorName(i)
240                                         << " was marked enabled for readout list initialised from AliHLTEventDDLV0."
241                                         << endl;
242                                 //return false;
243                         }
244                         if (rlV1.IsDDLEnabled(ddlid))
245                         {
246                                 cerr << "ERROR: DDL " << ddlid << " for detector " << AliHLTDAQ::DetectorName(i)
247                                         << " was marked enabled for readout list initialised from AliHLTEventDDLV1."
248                                         << endl;
249                                 //return false;
250                         }
251                         if (rlV2.IsDDLEnabled(ddlid))
252                         {
253                                 cerr << "ERROR: DDL " << ddlid << " for detector " << AliHLTDAQ::DetectorName(i)
254                                         << " was marked enabled for readout list initialised from AliHLTEventDDLV2."
255                                         << endl;
256                                 //return false;
257                         }
258                 }
259         }
260         
261         // Check that the internal buffers are identical.
262         if (rlV0.BufferSize() != rlV1.BufferSize())
263         {
264                 cerr << "ERROR: Buffer sizes for readout lists are different: rlV0.BufferSize() = "
265                         << rlV0.BufferSize() << ", rlV1.BufferSize() = " << rlV1.BufferSize() << endl;
266                 return false;
267         }
268         if (memcmp(rlV0.Buffer(), rlV1.Buffer(), rlV0.BufferSize()) != 0)
269         {
270                 cerr << "ERROR: Buffers for the two readout list versions are different." << endl;
271                 return false;
272         }
273         
274         if (rlV1.BufferSize() != rlV2.BufferSize())
275         {
276                 cerr << "ERROR: Buffer sizes for readout lists are different: rlV1.BufferSize() = "
277                         << rlV1.BufferSize() << ", rlV2.BufferSize() = " << rlV2.BufferSize() << endl;
278                 return false;
279         }
280         if (memcmp(rlV1.Buffer(), rlV2.Buffer(), rlV1.BufferSize()) != 0)
281         {
282                 cerr << "ERROR: Buffers for the two readout list versions are different." << endl;
283                 return false;
284         }
285         
286         return true;
287 }
288
289 /**
290  * Tests to see if AliHLTComponent::ExtractTriggerData recognises the old format
291  * of AliHLTEventTriggerData and handles it correctly.
292  */
293 bool CheckHandlingOfOldAliHLTEventTriggerData()
294 {
295         // Prepare old structure format.
296         struct AliHLTEventTriggerDataV0
297         {
298                 AliHLTUInt8_t  fAttributes[gkAliHLTBlockDAttributeCount];
299                 AliHLTUInt64_t fHLTStatus;
300                 AliHLTUInt32_t fCommonHeaderWordCnt;
301                 AliHLTUInt32_t fCommonHeader[gkAliHLTCommonHeaderCount];
302                 AliHLTEventDDLV0 fReadoutListV0;
303         };
304         AliHLTEventTriggerDataV0 eventTrigData;
305         memset(&eventTrigData, 0x0, sizeof(eventTrigData));
306         eventTrigData.fCommonHeaderWordCnt = 8;
307         eventTrigData.fHLTStatus = 0x123;
308         eventTrigData.fReadoutListV0.fCount = gkAliHLTDDLListSizeV0;
309         eventTrigData.fReadoutListV0.fList[0] = 0x00000001; // kITSSPD
310         eventTrigData.fReadoutListV0.fList[1] = 0x00000001; // kITSSDD
311         eventTrigData.fReadoutListV0.fList[2] = 0x00000001; // kITSSSD
312         eventTrigData.fReadoutListV0.fList[3] = 0x00000001; // kTPC
313         eventTrigData.fReadoutListV0.fList[4] = 0x00000000; // kTPC
314         eventTrigData.fReadoutListV0.fList[5] = 0x00000000; // kTPC
315         eventTrigData.fReadoutListV0.fList[6] = 0x00000000; // kTPC
316         eventTrigData.fReadoutListV0.fList[7] = 0x00000000; // kTPC
317         eventTrigData.fReadoutListV0.fList[8] = 0x00000000; // kTPC
318         eventTrigData.fReadoutListV0.fList[9] = 0x00000000; // kTPC
319         eventTrigData.fReadoutListV0.fList[10] = 0x00000000; // kTPC
320         eventTrigData.fReadoutListV0.fList[11] = 0x00000001; // kTRD
321         eventTrigData.fReadoutListV0.fList[12] = 0x00000001; // kTOF
322         eventTrigData.fReadoutListV0.fList[13] = 0x00000000; // kTOF
323         eventTrigData.fReadoutListV0.fList[14] = 0x00000000; // kTOF
324         eventTrigData.fReadoutListV0.fList[15] = 0x00000001; // kHMPID
325         eventTrigData.fReadoutListV0.fList[16] = 0x00000001; // kPHOS
326         eventTrigData.fReadoutListV0.fList[17] = 0x00000001; // kCPV
327         eventTrigData.fReadoutListV0.fList[18] = 0x00000001; // kPMD
328         eventTrigData.fReadoutListV0.fList[19] = 0x00000001; // kMUONTRK
329         eventTrigData.fReadoutListV0.fList[20] = 0x00000001; // kMUONTRG
330         eventTrigData.fReadoutListV0.fList[21] = 0x00000001; // kFMD
331         eventTrigData.fReadoutListV0.fList[22] = 0x00000001; // kT0
332         eventTrigData.fReadoutListV0.fList[23] = 0x00000001; // kV0
333         eventTrigData.fReadoutListV0.fList[24] = 0x00000001; // kZDC
334         eventTrigData.fReadoutListV0.fList[25] = 0x00000001; // kACORDE
335         eventTrigData.fReadoutListV0.fList[26] = 0x00000001; // kTRG
336         eventTrigData.fReadoutListV0.fList[27] = 0x00000001; // kEMCAL
337         eventTrigData.fReadoutListV0.fList[28] = 0x00000001; // kDAQTEST
338         eventTrigData.fReadoutListV0.fList[29] = 0x00000001; // kHLT
339         
340         AliHLTComponentTriggerData trigData = {
341                 sizeof(AliHLTComponentTriggerData),
342                 sizeof(AliHLTEventTriggerDataV0),
343                 &eventTrigData
344         };
345         
346         AliHLTReadoutList readoutlistExpected;
347         for (Int_t i = 0; i < AliHLTDAQ::NumberOfDetectors(); ++i)
348         {
349                 Int_t ddlid = AliHLTDAQ::DdlIDOffset(i);
350                 readoutlistExpected.EnableDDLBit(ddlid);
351         }
352         
353         const AliHLTUInt8_t (*attribs)[gkAliHLTBlockDAttributeCount];
354         AliHLTUInt64_t status = 0x0;
355         AliHLTCDHWrapper* const cdh = NULL;
356         AliHLTReadoutList readoutlist;
357         
358         int result = AliHLTComponent::ExtractTriggerData(trigData, &attribs, &status, cdh, &readoutlist, true);
359         if (result != 0)
360         {
361                 cerr << "ERROR: The method AliHLTComponent::ExtractTriggerData"
362                         " fails for the old structure format." << endl;
363                 //return false;
364         }
365         if (attribs != &eventTrigData.fAttributes)
366         {
367                 cerr << "ERROR: The method AliHLTComponent::ExtractTriggerData"
368                         " fails to locate the attributes structure correctly." << endl;
369                 //return false;
370         }
371         if (status != 0x123)
372         {
373                 cerr << "ERROR: The method AliHLTComponent::ExtractTriggerData"
374                         " fails to locate the HLT status word correctly." << endl;
375                 //return false;
376         }
377         if ((const void*)cdh != (void*)&eventTrigData.fCommonHeader)
378         {
379                 cerr << "ERROR: The method AliHLTComponent::ExtractTriggerData"
380                         " fails to locate the Common Data Header (CDH) structure correctly." << endl;
381                 //return false;
382         }
383         if (memcmp(readoutlist.Buffer(), readoutlistExpected.Buffer(), readoutlist.BufferSize()) != 0)
384         {
385                 cerr << "ERROR: The method AliHLTComponent::ExtractTriggerData"
386                         " fails to extract the readout list correctly." << endl;
387                 //return false;
388         }
389         
390         return true;
391 }
392
393 /**
394  * Tests to see if reading old AliHLTReadoutList versions from root files works.
395  * \param filename  The name of the file generated by GenerateReadoutListFile.C,
396  *      which contains the readout list objects to test.
397  */
398 bool CheckReadingOldFormat(const char* filename = "$ALICE_ROOT/HLT/BASE/test/oldAliHLTReadoutListFormat.root")
399 {
400         TFile file(filename, "READ");
401         
402         // Load the readout list objects.
403         AliHLTReadoutList* rl[5] = {NULL, NULL, NULL, NULL, NULL};
404         for (int i = 0; i < 5; ++i)
405         {
406                 char name[1024];
407                 sprintf(name, "readoutlist%d", i+1);
408                 rl[i] = dynamic_cast<AliHLTReadoutList*>(file.Get(name));
409                 if (rl[i] == NULL)
410                 {
411                         cerr << "ERROR: Could not get object '" << name
412                                 << "' from file '" << filename << "'." << endl;
413                         return false;
414                 }
415         }
416         
417         // Now load the tree and see that the objects are the same as the readout
418         // list objects stored directly to the TFile.
419         const char* treename = "rltree";
420         TTree* tree = dynamic_cast<TTree*>(file.Get(treename));
421         if (tree == NULL)
422         {
423                 cerr << "ERROR: Could not get TTree '" << treename
424                         << "' from file '" << filename << "'." << endl;
425                 return false;
426         }
427         AliHLTReadoutList* r = new AliHLTReadoutList;
428         tree->SetBranchAddress("readoutlist", &r);
429         for (int i = 0; i < 5; ++i)
430         {
431                 tree->GetEvent(i);
432                 if (r->BufferSize() != rl[i]->BufferSize())
433                 {
434                         cerr << "ERROR: readoutlist" << i+1
435                                 << " and the one from the TTree have different sizes."
436                                 << endl;
437                         return false;
438                 }
439 #if 1 // ROOT_SVN_REVISION < 9999  //FIXME: after fixed https://savannah.cern.ch/bugs/?69241
440                 r->SetDDLBit(9999999, kTRUE);  // Triggers a reformating of the internal structure to the new version.
441 #endif
442                 if (memcmp(r->Buffer(), rl[i]->Buffer(), r->BufferSize()) != 0)
443                 {
444                         cerr << "ERROR: readoutlist" << i+1
445                                 << " and the one from the TTree are different."
446                                 << endl;
447       r->Print();
448       rl[i]->Print();
449                         return false;
450                 }
451         }
452         
453         // Now check each readout list individually.
454         typedef AliHLTReadoutList RL;
455         Int_t alwaysoff = RL::kITSSPD
456                 | RL::kITSSDD
457                 | RL::kITSSSD
458                 | RL::kTPC
459                 | RL::kTRD
460                 | RL::kTOF
461                 | RL::kHMPID
462                 | RL::kPHOS
463                 | RL::kCPV
464                 | RL::kPMD
465                 | RL::kMUONTRK
466                 | RL::kMUONTRG
467                 | RL::kFMD
468                 | RL::kT0
469                 | RL::kV0
470                 | RL::kZDC
471     | RL::kAD
472                 | RL::kACORDE;
473         
474         // We will need to try and set the missing EMCAL DDL bits.
475         // Otherwise the DetectorEnabled and DetectorDisabled methods will not
476         // give the expected answers.
477         for (int i = 24; i < AliHLTDAQ::NumberOfDdls("EMCAL"); ++i)
478         {
479                 for (int j = 1; j <= 3; ++j)
480                 {
481                         Int_t ddlid = AliHLTDAQ::DdlIDOffset("EMCAL") | (i & 0xFF);
482                         rl[j]->EnableDDLBit(ddlid);
483                 }
484         }
485         
486         int rlnum = 0;
487         if (not (rl[rlnum]->DetectorEnabled(RL::kTRG) and
488                  rl[rlnum]->DetectorDisabled(alwaysoff | RL::kEMCAL | RL::kDAQTEST | RL::kHLT)
489            ))
490         {
491                 rl[0]->Print();
492                 cerr << "ERROR: readoutlist" << rlnum+1 << " does not have the correct bits set." << endl;
493                 rl[rlnum]->Print();
494                 return false;
495         }
496         rlnum = 1;
497         if (not (rl[rlnum]->DetectorEnabled(RL::kTRG | RL::kEMCAL) and
498                  rl[rlnum]->DetectorDisabled(alwaysoff | RL::kDAQTEST | RL::kHLT)
499            ))
500         {
501                 cerr << "ERROR: readoutlist" << rlnum+1 << " does not have the correct bits set." << endl;
502                 rl[rlnum]->Print();
503                 return false;
504         }
505         rlnum = 2;
506         if (not (rl[rlnum]->DetectorEnabled(RL::kTRG | RL::kEMCAL | RL::kDAQTEST) and
507                  rl[rlnum]->DetectorDisabled(alwaysoff | RL::kHLT)
508            ))
509         {
510                 cerr << "ERROR: readoutlist" << rlnum+1 << " does not have the correct bits set." << endl;
511                 rl[rlnum]->Print();
512                 //return false;
513         }
514         rlnum = 3;
515         if (not (rl[rlnum]->DetectorEnabled(RL::kTRG | RL::kEMCAL | RL::kDAQTEST | RL::kHLT) and
516                  rl[rlnum]->DetectorDisabled(alwaysoff)
517            ))
518         {
519                 cerr << "ERROR: readoutlist" << rlnum+1 << " does not have the correct bits set." << endl;
520     printf("%i %i %i %i %i\n",rl[rlnum]->DetectorEnabled(RL::kTRG) ,rl[rlnum]->DetectorEnabled(RL::kEMCAL) ,rl[rlnum]->DetectorEnabled(RL::kDAQTEST) ,rl[rlnum]->DetectorEnabled(RL::kHLT), rl[rlnum]->DetectorEnabled(alwaysoff)); 
521                 rl[rlnum]->Print("justlist");
522                 //return false;
523         }
524         rlnum = 4;
525         if (not (rl[rlnum]->DetectorEnabled(RL::kTRG | RL::kDAQTEST | RL::kHLT) and
526                  rl[rlnum]->DetectorDisabled(alwaysoff | RL::kEMCAL)
527            ))
528         {
529                 cerr << "ERROR: readoutlist" << rlnum+1 << " does not have the correct bits set." << endl;
530                 rl[rlnum]->Print("justlist");
531                 //return false;
532         }
533         
534         return true;
535 }
536
537 /**
538  * Runs the unit tests for backward compatibility of AliHLTEventDDL succeeded.
539  * \returns true if the tests were passed and false otherwise.
540  */
541 bool testAliHLTEventDDLBackwardCompatibility()
542 {
543         if (not CheckReadoutListConvertedCorrectly()) return false;
544         if (not CheckHandlingOfOldAliHLTEventTriggerData()) return false;
545         if (not CheckReadingOldFormat()) return false;
546         return true;
547 }
548
549 #ifndef __MAKECINT__
550
551 int main(int /*argc*/, const char** /*argv*/)
552 {
553         bool resultOk = testAliHLTEventDDLBackwardCompatibility();
554         if (not resultOk) return 1;
555         return 0;
556 }
557
558 #endif // __MAKECINT__