+ /// Returns the next DDL present
+
+ assert( GetReader() != 0 );
+
+
+ Bool_t kFound(kFALSE);
+
+ while ( fCurrentDDLIndex < fgkMaxDDL-1 && !kFound )
+ {
+ ++fCurrentDDLIndex;
+ GetReader()->Reset();
+ GetReader()->Select("MUONTRG",fCurrentDDLIndex,fCurrentDDLIndex);
+ if ( GetReader()->ReadHeader() )
+ {
+ kFound = kTRUE;
+ }
+ }
+
+ if ( !kFound )
+ {
+ // fCurrentDDLIndex is set to fgkMaxDDL so that we exit the above loop immediately
+ // for a subsequent call to this method, unless NextEvent is called in between.
+ fCurrentDDLIndex = fgkMaxDDL;
+ // We have not actually been able to complete the loading of the new DDL so
+ // we are still on the old one. In this case we do not need to reset fCurrentDDL.
+ //fCurrentDDL = 0;
+ if (IsErrorLogger()) AddErrorMessage();
+ return kFALSE;
+ }
+
+ Int_t totalDataWord = GetReader()->GetDataSize(); // in bytes
+
+ Bool_t scalerEvent = GetReader()->GetDataHeader()->GetL1TriggerMessage() & 0x1;
+
+ AliDebug(3, Form("DDL Number %d totalDataWord %d\n", fCurrentDDLIndex,
+ totalDataWord));
+
+ UInt_t *buffer = new UInt_t[totalDataWord/4];
+
+ if ( !GetReader()->ReadNext((UChar_t*)buffer, totalDataWord) )
+ {
+ // We have not actually been able to complete the loading of the new DDL so
+ // we are still on the old one. In this case we do not need to reset fCurrentDDL.
+ //fCurrentDDL = 0;
+ delete [] buffer;
+ return kFALSE;
+ }
+
+#ifndef R__BYTESWAP
+ Swap(buffer, totalDataWord / sizeof(UInt_t)); // swap needed for mac power pc
+#endif
+
+ fPayload->ResetDDL();
+
+
+
+ Bool_t ok = fPayload->Decode(buffer, scalerEvent);
+
+ delete[] buffer;
+
+ fCurrentDDL = fPayload->GetDDLTrigger();
+
+ fCurrentDarcHeader = fCurrentDDL->GetDarcHeader();
+
+ fCurrentRegHeaderIndex = -1;
+
+
+ return ok;