#include "AliLog.h"
#include <cassert>
#include <iostream>
-#include <iomanip>
using std::cout;
using std::endl;
using std::hex;
/// \endcond
const Int_t AliMUONRawStreamTriggerHP::fgkMaxDDL = 2;
+bool AliMUONRawStreamTriggerHP::AliLocalStruct::fgOverrideId = true;
+
+const AliMUONRegionalHeaderStruct
+AliMUONRawStreamTriggerHP::AliDecoderEventHandler::fgkEmptyHeader = {
+ AliMUONTriggerDDLDecoder<AliDecoderEventHandler>::RegionalErrorWord(),
+ 0,
+ {0, 0},
+ 0
+};
AliMUONRawStreamTriggerHP::AliMUONRawStreamTriggerHP() :
fDDL(0),
fBufferSize(8192),
fBuffer(new UChar_t[8192]),
- fCurrentLocalStruct(NULL),
+ fkCurrentLocalStruct(NULL),
fHadError(kFALSE),
fDone(kFALSE),
- fDDLObject(NULL)
+ fDDLObject(NULL),
+ fTotalNumberOfDarcEoWErrors(0),
+ fTotalNumberOfGlobalEoWErrors(0),
+ fTotalNumberOfRegEoWErrors(0),
+ fTotalNumberOfLocalEoWErrors(0)
{
///
/// Default constructor.
fDDL(0),
fBufferSize(8192),
fBuffer(new UChar_t[8192]),
- fCurrentLocalStruct(NULL),
+ fkCurrentLocalStruct(NULL),
fHadError(kFALSE),
fDone(kFALSE),
- fDDLObject(NULL)
+ fDDLObject(NULL),
+ fTotalNumberOfDarcEoWErrors(0),
+ fTotalNumberOfGlobalEoWErrors(0),
+ fTotalNumberOfRegEoWErrors(0),
+ fTotalNumberOfLocalEoWErrors(0)
{
///
/// Constructor with AliRawReader as argument.
fDDL = 0;
fDone = kFALSE;
NextDDL();
+ fTotalNumberOfDarcEoWErrors = 0;
+ fTotalNumberOfGlobalEoWErrors = 0;
+ fTotalNumberOfRegEoWErrors = 0;
+ fTotalNumberOfLocalEoWErrors = 0;
}
fDDLObject = NULL;
}
- fCurrentLocalStruct = NULL;
+ fkCurrentLocalStruct = NULL;
while (fDDL < GetMaxDDL())
{
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;
+ AliRawReader * reader = GetReader();
+ if (!reader) return kFALSE;
+
+ const AliRawDataHeader * cdh = reader->GetDataHeader();
+ const AliRawDataHeaderV3 * cdh3 = reader->GetDataHeaderV3();
+
+ if (!cdh && !cdh3) return kFALSE;
+
+ bool scalerEvent = ((cdh ? cdh->GetL1TriggerMessage() : cdh3->GetL1TriggerMessage()) & 0x1) == 0x1;
bool result = false;
try
// 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&)
{
}
// Update the current local structure pointer.
- fCurrentLocalStruct = fDecoder.GetHandler().FirstLocalStruct();
+ fkCurrentLocalStruct = fDecoder.GetHandler().FirstLocalStruct();
- fDDL++; // Remember to increment index to next DDL.
return kTRUE;
}
TArrayS& xPattern, TArrayS& yPattern
)
{
+ /// Advance one step in the iteration. Returns kFALSE if finished.
+ /// If kTRUE is returned then the output parameters are filled with
+ /// the values found in the next local trigger circuit structure.
+
const AliLocalStruct* localStruct = Next();
if (localStruct == NULL) return kFALSE;
{
memcpy(localStruct.GetScalers(), lstruct->GetScalars(), sizeof(AliMUONLocalScalarsStruct));
}
+ if (AliMUONRawStreamTriggerHP::AliLocalStruct::GetOverrideIdFlag() == true)
+ {
+ // 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 triggerBits = strptr->fTriggerBits;
+ triggerBits &= ~(0xF << 19);
+ strptr->fTriggerBits = triggerBits | ((lstruct->GetId() & 0xF) << 19);
+ }
fDDLObject->AddLocStruct(localStruct, iReg);
lstruct = lstruct->Next();
}
}
-void AliMUONRawStreamTriggerHP::SetMaxRegAllowed(Int_t reg)
+void AliMUONRawStreamTriggerHP::SetMaxReg(Int_t reg)
{
/// Set the maximum allowed number of regional cards in the DDL.
fRegionals = new AliRegionalHeader[maxRegionals];
fLocals = new AliLocalStruct[maxRegionals*maxLocals];
fEndOfLocals = fLocals;
+
+ fRegionalsCount = maxRegionals;
}
fRegEoWErrors = 0;
fLocalEoWErrors = 0;
- // Reset the current pointers which will be used to track where we need to
- // fill fRegionals and fLocals. We have to subtract one space because we
- // will increment the pointer the first time in the OnNewRegionalStruct
- // and OnLocalStruct methods.
- fCurrentRegional = fRegionals-1;
+ // Reset the current local structure pointer which will be used to track
+ // where we need to fill fLocals. We have to subtract one space because we
+ // will increment the pointer the first time in the OnLocalStruct method.
fCurrentLocal = fLocals-1;
- fRegionalsCount = 0;
+
+ fCurrentRegional = NULL;
+
+ // Reset and link up all the regional structures together.
+ for (UInt_t i = 0; i+1 < fRegionalsCount; i++)
+ {
+ fRegionals[i] = AliRegionalHeader(fLocals, &fgkEmptyHeader, NULL);
+ fRegionals[i].SetNext(&fRegionals[i+1]);
+ }
+ // Reset the last structure.
+ fRegionals[fRegionalsCount-1] = AliRegionalHeader(fLocals, &fgkEmptyHeader, NULL);
}
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)
+ (unsigned long)location - (unsigned long)fBufferStart + sizeof(AliRawDataHeaderV3)
);
fRawStream->GetReader()->AddMajorErrorLog(error, message);
break;