Bug fix for HMPID bits in readout list.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Jun 2010 12:13:15 +0000 (12:13 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 24 Jun 2010 12:13:15 +0000 (12:13 +0000)
HLT/BASE/AliHLTReadoutList.cxx
HLT/BASE/test/testAliHLTReadoutList.C

index 14b65cd..a975ff6 100644 (file)
@@ -291,7 +291,7 @@ void AliHLTReadoutList::Enable(Int_t detector)
     fReadoutList.fList[13] = 0xFFFFFFFF;
     fReadoutList.fList[14] = 0x000000FF;
   }
-  if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x00003FFF;
+  if ((detector & kHMPID) != 0) fReadoutList.fList[15] = 0x000FFFFF;
   if ((detector & kPHOS) != 0) fReadoutList.fList[16] = 0x000FFFFF;
   if ((detector & kCPV) != 0) fReadoutList.fList[17] = 0x000003FF;
   if ((detector & kPMD) != 0) fReadoutList.fList[18] = 0x0000003F;
@@ -387,7 +387,7 @@ bool AliHLTReadoutList::DetectorEnabled(Int_t detector) const
     result &= fReadoutList.fList[13] == 0xFFFFFFFF;
     result &= fReadoutList.fList[14] == 0x000000FF;
   }
-  if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x00003FFF;
+  if ((detector & kHMPID) != 0) result &= fReadoutList.fList[15] == 0x000FFFFF;
   if ((detector & kPHOS) != 0) result &= fReadoutList.fList[16] == 0x000FFFFF;
   if ((detector & kCPV) != 0) result &= fReadoutList.fList[17] == 0x000003FF;
   if ((detector & kPMD) != 0) result &= fReadoutList.fList[18] == 0x0000003F;
@@ -554,7 +554,7 @@ AliHLTReadoutList AliHLTReadoutList::operator ~ () const
   readoutlist.fReadoutList.fList[12] = 0xFFFFFFFF & (~fReadoutList.fList[12]);
   readoutlist.fReadoutList.fList[13] = 0xFFFFFFFF & (~fReadoutList.fList[13]);
   readoutlist.fReadoutList.fList[14] = 0x000000FF & (~fReadoutList.fList[14]);
-  readoutlist.fReadoutList.fList[15] = 0x00003FFF & (~fReadoutList.fList[15]);
+  readoutlist.fReadoutList.fList[15] = 0x000FFFFF & (~fReadoutList.fList[15]);
   readoutlist.fReadoutList.fList[16] = 0x000FFFFF & (~fReadoutList.fList[16]);
   readoutlist.fReadoutList.fList[17] = 0x000003FF & (~fReadoutList.fList[17]);
   readoutlist.fReadoutList.fList[18] = 0x0000003F & (~fReadoutList.fList[18]);
index bc21bfb..fbc639f 100644 (file)
@@ -163,14 +163,27 @@ bool CheckEnablingDisabling()
        for (int i = 0; i < 10000; ++i)
        {
                // Get 3 random detector codes.
+               int detNum[3] = {
+                       gRandom->Integer(kgNumberOfCodes),
+                       gRandom->Integer(kgNumberOfCodes),
+                       gRandom->Integer(kgNumberOfCodes)
+               };
                int code[3] = {
-                       kgDetCodes[gRandom->Integer(kgNumberOfCodes)],
-                       kgDetCodes[gRandom->Integer(kgNumberOfCodes)],
-                       kgDetCodes[gRandom->Integer(kgNumberOfCodes)]
+                       kgDetCodes[detNum[0]],
+                       kgDetCodes[detNum[1]],
+                       kgDetCodes[detNum[2]]
                };
                // make sure the codes are not duplicated.
-               while (code[1] == code[0]) code[1] = kgDetCodes[gRandom->Integer(kgNumberOfCodes)];
-               while (code[2] == code[1] or code[2] == code[0]) code[2] = kgDetCodes[gRandom->Integer(kgNumberOfCodes)];
+               while (code[1] == code[0])
+               {
+                       detNum[1] = gRandom->Integer(kgNumberOfCodes);
+                       code[1] = kgDetCodes[detNum[1]];
+               }
+               while (code[2] == code[1] or code[2] == code[0])
+               {
+                       detNum[2] = gRandom->Integer(kgNumberOfCodes);
+                       code[2] = kgDetCodes[detNum[2]];
+               }
                
                // Choose the number of codes to use, from 1 to max 3.
                int codeCount = gRandom->Integer(3) + 1;
@@ -196,6 +209,23 @@ bool CheckEnablingDisabling()
                                        << CodeToString(code[j]) << " by constructor." << endl;
                                return false;
                        }
+                       
+                       // Also check each bit individualy according to AliHLTDAQ values.
+                       int det = detNum[j];
+                       int maxddls = AliHLTDAQ::NumberOfDdls(det);
+                       for (int ddlindex = 0; ddlindex < maxddls; ++ddlindex)
+                       {
+                               int ddlid = AliHLTDAQ::DdlIDOffset(det) | (ddlindex & 0xFF);
+                               if (rl.IsDDLDisabled(ddlid))
+                               {
+                                       cerr << "ERROR: Bit not set for DDL " << ddlid
+                                               << ", even though detector "
+                                               << AliHLTDAQ::OnlineName(det)
+                                               << " was enabled." << endl;
+                                       return false;
+                               }
+                       }
+                       
                        rl.Disable(code[j]);
                        if (rl.DetectorEnabled(code[j]) == true)
                        {