Update from Alberica. Addition of VZERO equalized signals and ZNC.
[u/mrichter/AliRoot.git] / MUON / AliMUONRawStreamTriggerHP.cxx
index d9698bb..aa9b12a 100644 (file)
@@ -77,7 +77,11 @@ AliMUONRawStreamTriggerHP::AliMUONRawStreamTriggerHP() :
        fkCurrentLocalStruct(NULL),
        fHadError(kFALSE),
        fDone(kFALSE),
-       fDDLObject(NULL)
+       fDDLObject(NULL),
+       fTotalNumberOfDarcEoWErrors(0),
+       fTotalNumberOfGlobalEoWErrors(0),
+       fTotalNumberOfRegEoWErrors(0),
+       fTotalNumberOfLocalEoWErrors(0)
 {
        ///
        /// Default constructor.
@@ -103,7 +107,11 @@ AliMUONRawStreamTriggerHP::AliMUONRawStreamTriggerHP(AliRawReader* rawReader) :
        fkCurrentLocalStruct(NULL),
        fHadError(kFALSE),
        fDone(kFALSE),
-       fDDLObject(NULL)
+       fDDLObject(NULL),
+       fTotalNumberOfDarcEoWErrors(0),
+       fTotalNumberOfGlobalEoWErrors(0),
+       fTotalNumberOfRegEoWErrors(0),
+       fTotalNumberOfLocalEoWErrors(0)
 {
        ///
        /// Constructor with AliRawReader as argument.
@@ -147,6 +155,10 @@ void AliMUONRawStreamTriggerHP::First()
        fDDL = 0;
        fDone = kFALSE;
        NextDDL();
+       fTotalNumberOfDarcEoWErrors = 0;
+       fTotalNumberOfGlobalEoWErrors = 0;
+       fTotalNumberOfRegEoWErrors = 0;
+       fTotalNumberOfLocalEoWErrors = 0;
 }
 
 
@@ -225,6 +237,10 @@ Bool_t AliMUONRawStreamTriggerHP::NextDDL()
        Swap(reinterpret_cast<UInt_t*>(fBuffer), dataSize / sizeof(UInt_t)); // Swap needed for mac power pc.
 #endif
        
+       fDDL++; // Remember to increment index to next DDL before the calls to
+               // fDecoder.Decode since the callback methods of the decoder might
+               // use AliMUONRawStreamTriggerHP::GetDDL()
+       
        // Check if this is a scalar event.
        bool scalerEvent = (GetReader()->GetDataHeader()->GetL1TriggerMessage() & 0x1) == 0x1;
        
@@ -235,6 +251,10 @@ Bool_t AliMUONRawStreamTriggerHP::NextDDL()
                // handler we need to trap any memory allocation exception to be robust.
                result = fDecoder.Decode(fBuffer, dataSize, scalerEvent);
                fHadError = (result == true ? kFALSE : kTRUE);
+               fTotalNumberOfDarcEoWErrors += fDecoder.GetHandler().GetDarcEoWErrors();
+               fTotalNumberOfGlobalEoWErrors += fDecoder.GetHandler().GetGlobalEoWErrors();
+               fTotalNumberOfRegEoWErrors += fDecoder.GetHandler().GetRegEoWErrors();
+               fTotalNumberOfLocalEoWErrors += fDecoder.GetHandler().GetLocalEoWErrors();
        }
        catch (const std::bad_alloc&)
        {
@@ -245,7 +265,6 @@ Bool_t AliMUONRawStreamTriggerHP::NextDDL()
        // Update the current local structure pointer.
        fkCurrentLocalStruct = fDecoder.GetHandler().FirstLocalStruct();
 
-       fDDL++; // Remember to increment index to next DDL.
        return kTRUE;
 }
 
@@ -354,9 +373,9 @@ AliMUONDDLTrigger* AliMUONRawStreamTriggerHP::GetDDLTrigger() const
                                // Since the override ID flag is set, we need to replace the
                                // ID in the structure with the calculated one returned by GetId().
                                AliMUONLocalInfoStruct* strptr = reinterpret_cast<AliMUONLocalInfoStruct*>( localStruct.GetData() );
-                               UInt_t word = strptr->fTriggerBits;
-                               word &= (0xF << 19);
-                               strptr->fTriggerBits = word | (lstruct->GetId() << 19);
+                               UInt_t triggerBits = strptr->fTriggerBits;
+                               triggerBits &= ~(0xF << 19);
+                               strptr->fTriggerBits = triggerBits | ((lstruct->GetId() & 0xF) << 19);
                        }
                        fDDLObject->AddLocStruct(localStruct, iReg);
                        lstruct = lstruct->Next();
@@ -707,7 +726,7 @@ void AliMUONRawStreamTriggerHP::AliDecoderEventHandler::OnError(
                
        default:
                message = Form(
-                       "%s (At byte %d in DDL.)",
+                       "%s (At byte %lu in DDL.)",
                        ErrorCodeToMessage(error),
                        (unsigned long)location - (unsigned long)fBufferStart + sizeof(AliRawDataHeader)
                );