AliMUONLogger::Log(const char* message)
{
/// Log a message
- if ( fLog->GetNofItems() >= fMaxNumberOfEntries )
+
+ if ( fMaxNumberOfEntries >0 && fLog->GetNofItems() >= fMaxNumberOfEntries )
{
- AliWarning("Reached max number of entries. Printing and resetting.");
+ AliWarning(Form("Reached max number of entries (%d over %d). Printing and resetting.",
+ fLog->GetNofItems(),fMaxNumberOfEntries));
Print();
fLog->Clear();
}
}
-
+//_____________________________________________________________________________
+Int_t
+AliMUONLogger::NumberOfEntries() const
+{
+ /// Get the number of logs we have so far
+ return fLog->GetNofItems();
+}
void Clear(Option_t* /*option*/ ="");
Bool_t Next(TString& msg, Int_t& occurance);
+
void ResetItr();
+ Int_t NumberOfEntries() const;
+
private:
/// Not implemented
AliMUONLogger(const AliMUONLogger& rhs); // not implemented
kTrackerBusPatchNofPads = 5, ///< Number of pads per bus patch
kTrackerBusPatchNofManus = 6, ///< Number of manus per bus patch
kTrackerBusPatchConfig = 7, ///< Configuration of the tracker
+ kTrackerBusPatchParityErrors = 8, ///< Parity errors during readout of the tracker
+ kTrackerBusPatchTokenLostErrors = 9, ///< Token lost errors during readout of the tracker
+ kTrackerBusPatchPaddingErrors = 10, ///< Padding errors during readout of the tracker
+ kTrackerNofRawEventSeen = 11, ///< Number of events seen (and used)
+ kTrackerReadoutErrors = 12, ///< Integrated number of errors (and events for 1st bin)
kTriggerScalersTime = 22, ///< Trigger scalers acquisition time index
kTriggerScalers = 23, ///< Trigger scalers histogram per plane index
kTriggerScalersDisplay = 31, ///< Trigger scalers display histogram per plane index
#include "AliMUONBlockHeader.h"
#include "AliMUONBusStruct.h"
#include "AliMUONDDLTracker.h"
+#include "AliMUONLogger.h"
#include "AliRawReader.h"
#include "AliLog.h"
+#include "AliDAQ.h"
#include <cassert>
#include <iostream>
using std::cout;
AliMUONRawStreamTrackerHP::AliMUONRawStreamTrackerHP() :
TObject(),
- fEnableErrorLogger(kFALSE),
+ fRawReader(NULL),
+ fLogger(NULL),
+ fDetailLevel(kMediumErrorDetail),
+ fEnableMUONErrorLogger(kFALSE),
+ fEnableRawReaderErrorLogger(kFALSE),
+ fWarnings(kTRUE),
fDecoder(),
fDDL(0),
fBufferSize(8192),
fDecoder.MaxDSPs(),
fDecoder.MaxBusPatches()
);
+
+ fDecoder.GetHandler().SetRawStream(this);
}
AliMUONRawStreamTrackerHP::AliMUONRawStreamTrackerHP(AliRawReader* rawReader) :
TObject(),
- fEnableErrorLogger(kFALSE),
+ fRawReader(rawReader),
+ fLogger(NULL),
+ fDetailLevel(kMediumErrorDetail),
+ fEnableMUONErrorLogger(kFALSE),
+ fEnableRawReaderErrorLogger(kFALSE),
+ fWarnings(kTRUE),
fDecoder(),
fDDL(0),
fBufferSize(8192),
fDecoder.MaxBusPatches()
);
- fDecoder.GetHandler().SetReader(rawReader);
+ fDecoder.GetHandler().SetRawStream(this);
}
);
}
-AliRawReader* AliMUONRawStreamTrackerHP::GetReader()
-{
- return fDecoder.GetHandler().GetReader();
-}
-
-void AliMUONRawStreamTrackerHP::SetReader(AliRawReader* reader)
-{
- fDecoder.GetHandler().SetReader(reader);
-}
-
///////////////////////////////////////////////////////////////////////////////
void AliMUONRawStreamTrackerHP::AliBlockHeader::Print() const
///////////////////////////////////////////////////////////////////////////////
AliMUONRawStreamTrackerHP::AliDecoderEventHandler::AliDecoderEventHandler() :
- fRawReader(0x0),
+ fRawStream(NULL),
fBufferStart(NULL),
fBlockCount(0),
fBlocks(NULL),
fGlitchErrors(0),
fPaddingErrors(0),
fTokenLostErrors(0),
- fWarnings(kTRUE),
fMaxBlocks(),
fMaxDsps(),
fMaxBusPatches()
}
+void AliMUONRawStreamTrackerHP::Swap(UInt_t* buffer, Int_t size) const
+{
+ // swap from little to big endian
+
+ typedef struct {
+ UInt_t b1:8; ///< first byte word
+ UInt_t b2:8; ///< second byte word
+ UInt_t b3:8; ///< third byte word
+ UInt_t b4:8; ///< fourth byte word
+ } RawWord;
+
+ RawWord* word, temp;
+ word = (RawWord*) buffer;
+
+ for (Int_t i = 0; i < size; i++)
+ {
+ temp = *(((RawWord*)buffer)+i);
+ word->b1 = temp.b4;
+ word->b2 = temp.b3;
+ word->b3 = temp.b2;
+ word->b4 = temp.b1;
+ word++;
+ }
+}
+
+
void AliMUONRawStreamTrackerHP::AliDecoderEventHandler::OnError(
ErrorCode error, const void* location
)
/// This is called by the high performance decoder when a error occurs
/// when trying to decode the DDL payload. This indicates corruption in
/// the data. This method converts the error code to a descriptive message
- /// and logs this with the raw reader.
+ /// and logs this with the logger object.
/// \param error The error code indicating the problem.
/// \param location A pointer to the location within the DDL payload buffer
/// being decoded where the problem with the data was found.
-
- assert( fRawReader != NULL );
- Char_t* message = NULL;
+ assert(fRawStream != NULL);
+
+ const char* message = NULL;
UInt_t word = 0;
-
+ bool logAsMajorError = true;
+
+ // Build the detailed part of the error message if high detail selected.
+ const char* detail = "";
+ if (fRawStream->GetLoggingDetailLevel() == kHighErrorDetail)
+ {
+ bool blockPtrOk = fBlockCount > 0;
+ bool dspPtrOk = blockPtrOk ? fCurrentBlock->GetDspCount() > 0 : false;
+ bool buspatchPtrOk = dspPtrOk ? fCurrentDSP->GetBusPatchCount() > 0 : false;
+ // We subtract 1 from the current numbers of blocks, DSPs
+ // and bus patches to get the iBlock, iDsp and iBus indices.
+ detail = Form(
+ "At byte %d in DDL %d, event %d, iBlock %d, iDsp %d [DSP ID: %d (0x%X)],"
+ " iBus %d [bus patch ID: %d (0x%X)].",
+ (unsigned long)location - (unsigned long)fBufferStart + sizeof(AliRawDataHeader),
+ AliDAQ::DdlID("MUONTRK", fRawStream->GetDDL()),
+ fRawStream->GetReader()->GetEventIndex(),
+ int(fBlockCount)-1,
+ blockPtrOk ? int(fCurrentBlock->GetDspCount())-1 : -1,
+ blockPtrOk ? fCurrentBlock->GetDspId() : -1,
+ blockPtrOk ? fCurrentBlock->GetDspId() : -1,
+ dspPtrOk ? int(fCurrentDSP->GetBusPatchCount())-1 : -1,
+ buspatchPtrOk ? fCurrentBusPatch->GetBusPatchId() : -1,
+ buspatchPtrOk ? fCurrentBusPatch->GetBusPatchId() : -1
+ );
+ }
+
+ // Build the log message.
switch (error)
{
case kGlitchFound:
fGlitchErrors++;
- message = Form(
- "Glitch error detected in DSP %d (0x%X), skipping event ",
- fCurrentBlock->GetDspId(), fCurrentBlock->GetDspId()
- );
- fRawReader->AddMajorErrorLog(error, message);
+ switch (fRawStream->GetLoggingDetailLevel())
+ {
+ case kLowErrorDetail:
+ message = "Glitch error detected.";
+ break;
+ case kMediumErrorDetail:
+ message = Form(
+ "Glitch error detected in DSP %d (0x%X), skipping event.",
+ fCurrentBlock->GetDspId(), fCurrentBlock->GetDspId()
+ );
+ break;
+ case kHighErrorDetail:
+ default:
+ message = Form("%s %s", ErrorCodeToMessage(error), detail);
+ break;
+ }
+ logAsMajorError = true;
break;
case kBadPaddingWord:
fPaddingErrors++;
- // We subtract 1 from the current numbers of blocks, DSPs
- // and bus patches to get the indices.
- message = Form(
- "Padding word error for iBlock %d, iDsp %d, iBus %d\n",
- fBlockCount-1,
- fCurrentBlock->GetDspCount()-1,
- fCurrentDSP->GetBusPatchCount()-1
- );
- fRawReader->AddMinorErrorLog(error, message);
+ switch (fRawStream->GetLoggingDetailLevel())
+ {
+ case kLowErrorDetail:
+ message = "Padding word error detected.";
+ break;
+ case kMediumErrorDetail:
+ // We subtract 1 from the current numbers of blocks, DSPs
+ // and bus patches to get the indices.
+ message = Form(
+ "Padding word error for iBlock %d, iDsp %d, iBus %d.",
+ fBlockCount-1,
+ fCurrentBlock->GetDspCount()-1,
+ fCurrentDSP->GetBusPatchCount()-1
+ );
+ break;
+ case kHighErrorDetail:
+ default:
+ message = Form("%s %s", ErrorCodeToMessage(error), detail);
+ break;
+ }
+ logAsMajorError = false;
break;
case kParityError:
fParityErrors++;
- // location points to the incorrect data word and
- // fCurrentBusPatch->GetData() returns a pointer to the start of
- // bus patches data, so the difference divided by 4 gives the 32
- // bit word number.
- word = ((unsigned long)location - (unsigned long)fCurrentBusPatch->GetData())
+ switch (fRawStream->GetLoggingDetailLevel())
+ {
+ case kLowErrorDetail:
+ message = "Parity error detected.";
+ break;
+ case kMediumErrorDetail:
+ message = Form(
+ "Parity error in buspatch %d (0x%X).",
+ fCurrentBusPatch->GetBusPatchId(),
+ fCurrentBusPatch->GetBusPatchId()
+ );
+ break;
+ case kHighErrorDetail:
+ default:
+ // location points to the incorrect data word and
+ // fCurrentBusPatch->GetData() returns a pointer to the start of
+ // bus patches data, so the difference divided by 4 gives the 32
+ // bit word number.
+ word = ((unsigned long)location - (unsigned long)fCurrentBusPatch->GetData())
/ sizeof(UInt_t);
- message = Form(
- "Parity error in word %d for manuId %d and channel %d in buspatch %d\n",
- word,
- fCurrentBusPatch->GetManuId(word),
- fCurrentBusPatch->GetChannelId(word),
- fCurrentBusPatch->GetBusPatchId()
- );
- fRawReader->AddMinorErrorLog(error, message);
+ message = Form(
+ "Parity error in word %d for manuId %d and channel %d in buspatch %d. %s",
+ word,
+ fCurrentBusPatch->GetManuId(word),
+ fCurrentBusPatch->GetChannelId(word),
+ fCurrentBusPatch->GetBusPatchId(),
+ detail
+ );
+ break;
+ }
+ logAsMajorError = false;
break;
case kTokenLost:
fTokenLostErrors++;
- word = *reinterpret_cast<const UInt_t*>(location);
- message = Form(
- "Lost token error detected in DSP %d (0x%X) with address 0x%X and code %d.",
- fCurrentBlock->GetDspId(), fCurrentBlock->GetDspId(),
- ((word & 0xFFFF0000) >> 16),
- (word & 0xF)
- );
- fRawReader->AddMinorErrorLog(error, message);
+ switch (fRawStream->GetLoggingDetailLevel())
+ {
+ case kLowErrorDetail:
+ message = "Lost token error detected.";
+ break;
+ case kMediumErrorDetail:
+ word = *reinterpret_cast<const UInt_t*>(location);
+ message = Form(
+ "Lost token error detected in DSP 0x%X of DDL %d and code %d.",
+ ((word & 0xFFFF0000) >> 16),
+ fRawStream->GetDDL(),
+ (word & 0xF)
+ );
+ break;
+ case kHighErrorDetail:
+ default:
+ word = *reinterpret_cast<const UInt_t*>(location);
+ message = Form(
+ "Lost token error detected with address 0x%X and code %d. %s",
+ ((word & 0xFFFF0000) >> 16),
+ (word & 0xF),
+ detail
+ );
+ message = Form("Lost token error detected. %s.", detail);
+ break;
+ }
+ logAsMajorError = false;
break;
default:
- message = Form(
- "%s (At byte %d in DDL.)",
- ErrorCodeToMessage(error),
- (unsigned long)location - (unsigned long)fBufferStart + sizeof(AliRawDataHeader)
- );
- fRawReader->AddMajorErrorLog(error, message);
+ switch (fRawStream->GetLoggingDetailLevel())
+ {
+ case kLowErrorDetail:
+ message = ErrorCodeToMessage(error);
+ break;
+ case kMediumErrorDetail:
+ message = Form(
+ "%s (At byte %d)",
+ ErrorCodeToMessage(error),
+ (unsigned long)location - (unsigned long)fBufferStart + sizeof(AliRawDataHeader)
+ );
+ break;
+ case kHighErrorDetail:
+ default:
+ message = Form(
+ "%s Error code: %d (%s). %s",
+ ErrorCodeToMessage(error),
+ error, ErrorCodeToString(error),
+ detail
+ );
+ break;
+ }
+ logAsMajorError = true;
break;
}
-
- if (fWarnings)
+
+ // Now log the error message depending on the logging flags set.
+ if (fRawStream->IsRawReaderErrorLoggerEnabled())
+ {
+ if (logAsMajorError)
+ fRawStream->GetReader()->AddMajorErrorLog(Int_t(error), message);
+ else
+ fRawStream->GetReader()->AddMinorErrorLog(Int_t(error), message);
+ }
+ if (fRawStream->IsMUONErrorLoggerEnabled())
+ {
+ AliMUONLogger* logger = fRawStream->GetMUONErrorLogger();
+ if (logger != NULL)
+ {
+ logger->Log(message);
+ }
+ else
+ {
+ AliErrorGeneral(
+ "AliMUONRawStreamTrackerHP::AliDecoderEventHandler",
+ "Enabled logging to AliMUONLogger, but the logger object"
+ " was not set with SetMUONErrorLogger()."
+ );
+ }
+ }
+ if (fRawStream->IsWarningsEnabled())
{
AliWarningGeneral(
"AliMUONRawStreamTrackerHP::AliDecoderEventHandler",
class AliMUONDDLTracker;
class AliRawReader;
+class AliMUONLogger;
class AliMUONRawStreamTrackerHP : public TObject
{
public:
class AliDspHeader;
class AliBusPatch;
+
+ /// Values indicating the logging detail level to use for error messages.
+ enum EDetailLevel
+ {
+ kLowErrorDetail, /// Logs minimal information in the error messages.
+ kMediumErrorDetail, /// Logs a medium level of detail in the error messages.
+ kHighErrorDetail /// Logs maximum information in the error messages.
+ };
/// Default constructor.
AliMUONRawStreamTrackerHP();
virtual ~AliMUONRawStreamTrackerHP();
/// Get object for reading the raw data
- virtual AliRawReader* GetReader();
+ virtual AliRawReader* GetReader() { return fRawReader; }
+
+ /// Set the raw reader
+ void SetReader(AliRawReader* reader) { fRawReader = reader; }
/// Initialize iterator
virtual void First();
/// Whether the iteration is finished or not
virtual Bool_t IsDone() const;
-
- /// Nothing is actually done in the AddErrorMessage method because we log
- /// the error messages as we find them in AliDecoderEventHandler::OnError().
- virtual void AddErrorMessage() { };
/// Advance one step in the iteration. Returns false if finished.
virtual Bool_t Next(Int_t& busPatchId,
}
/// Set warnings flag to disable warnings on data errors.
- void DisableWarnings() { fDecoder.GetHandler().Warnings(kFALSE); }
+ void DisableWarnings() { fWarnings = kFALSE; }
/// Set warnings flag to enable warnings on data errors.
- void EnableWarnings() { fDecoder.GetHandler().Warnings(kTRUE); }
+ void EnableWarnings() { fWarnings = kTRUE; }
+
+ Bool_t IsWarningsEnabled() const { return fWarnings; }
/// Returns the "try to recover from errors" flag.
Bool_t TryRecover() const { return Bool_t(fDecoder.TryRecover()); }
return (dsp != NULL) ? dsp->GetBlockHeader() : NULL;
}
- /// Set the raw reader
- void SetReader(AliRawReader* reader);
+ /// Enable error logging to the raw reader. \note Kept for backward compatibility.
+ virtual void EnabbleErrorLogger() { EnableRawReaderErrorLogger(); }
+
+ /// Enable error info logging to AliMUONLogger.
+ void EnableMUONErrorLogger() { fEnableMUONErrorLogger = kTRUE; }
+
+ /// Disable logging to AliMUONLogger.
+ void DisableMUONErrorLogger() { fEnableMUONErrorLogger = kFALSE; }
+
+ /// Enable error info logging to raw reader.
+ void EnableRawReaderErrorLogger() { fEnableRawReaderErrorLogger = kTRUE; }
+
+ /// Disable logging to the raw reader.
+ void DisableRawReaderErrorLogger() { fEnableRawReaderErrorLogger = kFALSE; }
- /// Enable error info logger
- virtual void EnabbleErrorLogger() { fEnableErrorLogger = kTRUE; }
+ /// Check if the AliMUONLogger is enabled for error logging.
+ Bool_t IsMUONErrorLoggerEnabled() const { return fEnableMUONErrorLogger; }
- /// Check if error info logger enable
- virtual Bool_t IsErrorLogger() const {return fEnableErrorLogger; }
+ /// Check if the AliMUONLogger is enabled for error logging.
+ Bool_t IsRawReaderErrorLoggerEnabled() const { return fEnableRawReaderErrorLogger; }
+
+ /// Returns the logger object. (constant version)
+ const AliMUONLogger* GetMUONErrorLogger() const { return fLogger; }
+
+ /// Returns the logger object.
+ AliMUONLogger* GetMUONErrorLogger() { return fLogger; }
+
+ /// Sets the logger object to use. Ownership of the logger object remains with the caller.
+ void SetMUONErrorLogger(AliMUONLogger* logger) { fLogger = logger; }
+
+ /// Returns the level of detail used in the error messages.
+ EDetailLevel GetLoggingDetailLevel() const { return fDetailLevel; }
+
+ /// Sets the level of detail used in the error messages.
+ void SetLoggingDetailLevel(EDetailLevel level) { fDetailLevel = level; }
/// Number of glitch errors since First() was called
UInt_t NumberOfGlitchErrors() const { return fTotalNumberOfGlitchErrors; }
/// Return max number of tracker DDLs
Int_t GetMaxDDL() const { return fgkMaxDDL; }
-
+
+ /// swap method for Power PC
+ virtual void Swap(UInt_t* buffer, Int_t size) const;
+
/// This is the custom event handler (callback interface) class which
/// unpacks raw data words and fills an internal buffer with decoded digits
/// as they are decoded by the high performance decoder.
/// Sets the internal arrays based on the maximum number of structures allowed.
void SetMaxStructs(UInt_t maxBlocks, UInt_t maxDsps, UInt_t maxBusPatches);
+ /// Sets the raw stream object which should be the parent of this class.
+ void SetRawStream(AliMUONRawStreamTrackerHP* rawStream) { fRawStream = rawStream; }
+
/// Return the number of blocks found in the payload.
UInt_t BlockCount() const { return fBlockCount; };
UInt_t PaddingErrorCount() const { return fPaddingErrors; }
/// Returns the number of token lost errors found in the DDL.
UInt_t TokenLostCount() const { return fTokenLostErrors; }
-
- /// Returns the warnings flag.
- Bool_t Warnings() const { return fWarnings; }
- /// Sets the warnings flag.
- void Warnings(Bool_t value) { fWarnings = value; }
// The following methods are inherited from AliMUONTrackerDDLDecoderEventHandler:
/// Error handler.
void OnError(ErrorCode error, const void* location);
- /// Set reader
- void SetReader(AliRawReader* reader) { fRawReader = reader; }
-
- /// Get reader
- AliRawReader* GetReader() const { return fRawReader; }
-
private:
// Do not allow copying of this class.
/// Not implemented
AliDecoderEventHandler& operator = (const AliDecoderEventHandler& /*obj*/);
- AliRawReader* fRawReader; //!< Pointer to the raw reader
+ AliMUONRawStreamTrackerHP* fRawStream; //!< Pointer to the parent raw stream object.
const void* fBufferStart; //!< Pointer to the start of the current DDL payload buffer.
UInt_t fBlockCount; //!< Number of blocks filled in fBlocks.
AliBlockHeader* fBlocks; //!< Array of blocks. [0..fMaxBlocks-1]
UInt_t fGlitchErrors; //!< Number of glitch errors found in DDL.
UInt_t fPaddingErrors; //!< Number of padding errors found in DDL.
UInt_t fTokenLostErrors; //!< Number of token lost errors found in DDL.
- Bool_t fWarnings; //!< Flag indicating if we should generate a warning for errors.
UInt_t fMaxBlocks; //!< max number of blocks
UInt_t fMaxDsps; //!< max number of dsps per block
UInt_t fMaxBusPatches; //!< max number of buspatches per dsp
};
- Bool_t fEnableErrorLogger; //!< whether or not we log errors
+ AliRawReader* fRawReader; //!< Pointer to the raw reader
+ AliMUONLogger* fLogger; //!< Logger object to store error messages.
+ EDetailLevel fDetailLevel; //!< The logging detail level used in the error messages generated in OnError.
+ Bool_t fEnableMUONErrorLogger; //!< whether or not we log errors to AliMUONLogger
+ Bool_t fEnableRawReaderErrorLogger; //!< whether or not we log errors to the raw reader.
+ Bool_t fWarnings; //!< Flag indicating if we should generate a warning for errors.
AliMUONTrackerDDLDecoder<AliDecoderEventHandler> fDecoder; //!< The decoder for the DDL payload.
Int_t fDDL; //!< The current DDL number being handled.
Int_t fBufferSize; //!< This is the buffer size in bytes of fBuffer.
#include "AliMUONCalibParamND.h"
#include "AliMUONCalibrationData.h"
#include "AliMUONDigitCalibrator.h"
+#include "AliMUONLogger.h"
#include "AliMUONRawStreamTrackerHP.h"
#include "AliMUONTrackerData.h"
#include "AliMpDDLStore.h"
fRunNumber(0),
fIsRunning(kFALSE),
fIsOwnerOfRawReader(kFALSE),
-fIsEventByEvent(kFALSE)
+fIsEventByEvent(kFALSE),
+fLogger(0x0)
{
/// Root IO ctor
}
fRunNumber(runNumber),
fIsRunning(kFALSE),
fIsOwnerOfRawReader(kFALSE),
-fIsEventByEvent(kFALSE)
+fIsEventByEvent(kFALSE),
+fLogger(0x0)
{
/// Ctor in which this object will NOT be the owner of the reader
/// and can NOT apply rewind to it, nor use Next on it.
fRunNumber(0),
fIsRunning(kFALSE),
fIsOwnerOfRawReader(kTRUE),
-fIsEventByEvent(kFALSE)
+fIsEventByEvent(kFALSE),
+fLogger(0x0)
{
/// Ctor in which we take the ownership of the rawReader, so we can rewind
/// and advance it as we wish
fRunNumber(0),
fIsRunning(kFALSE),
fIsOwnerOfRawReader(kTRUE),
-fIsEventByEvent(kFALSE)
+fIsEventByEvent(kFALSE),
+fLogger(0x0)
{
/// Ctor from raw data reader
if (fRawReader)
AliCodeTimerAuto("",0);
AliMUONRawStreamTrackerHP stream(fRawReader);
-
+
stream.DisableWarnings();
- stream.EnabbleErrorLogger();
+ stream.DisableRawReaderErrorLogger();
+ stream.DisableMUONErrorLogger();
+
+ if (fLogger)
+ {
+ stream.EnableMUONErrorLogger();
+ stream.SetMUONErrorLogger(fLogger);
+ stream.SetLoggingDetailLevel(AliMUONRawStreamTrackerHP::kMediumErrorDetail);
+ }
const Int_t nddls = AliDAQ::NumberOfDdls("MUONTRK");
TArrayI nevents(nddls);
{
fAccumulatedData->Add(*fOneEventData,&nevents);
}
-
+
return !badEvent;
}
class AliMUONVStore;
class AliMUONVTrackerData;
class AliRawReader;
+class AliMUONLogger;
class AliMUONTrackerDataMaker : public AliMUONVTrackerDataMaker
{
void SetRawReader(AliRawReader* rawReader);
+ void EnableErrorLogger(AliMUONLogger* logger) { fLogger = logger; }
+
private:
/// not implemented
AliMUONTrackerDataMaker(const AliMUONTrackerDataMaker& rhs);
Bool_t fIsOwnerOfRawReader; ///< whether we must delete rawReader or not
Bool_t fIsEventByEvent; ///< we only keep one event's data (no accumulation)
static Int_t fgkCounter; ///< to count the number of instances
+ AliMUONLogger* fLogger; ///< error logger (not owner)
- ClassDef(AliMUONTrackerDataMaker,1) // Producer of AliMUONVTrackerData from raw
+ ClassDef(AliMUONTrackerDataMaker,2) // Producer of AliMUONVTrackerData from raw
};
#endif
TH1* hbpconfig = AliQAv1::GetData(list,AliMUONQAIndices::kTrackerBusPatchConfig,AliRecoParam::ConvertIndex(specie));
- if (!hbp || !hnpads )
+ TH1* hnevents = AliQAv1::GetData(list,AliMUONQAIndices::kTrackerNofRawEventSeen,AliRecoParam::ConvertIndex(specie));
+
+ if ( !hbp || !hnpads || !hnevents )
{
continue;
}
- rv[specie] = BeautifyTrackerBusPatchOccupancy(*hbp,hbpconfig,*hnpads,*recoParam);
+ Int_t nevents = TMath::Nint(hnevents->GetBinContent(1));
+
+ rv[specie] = BeautifyTrackerBusPatchOccupancy(*hbp,hbpconfig,*hnpads,nevents,*recoParam);
}
return rv;
AliMUONTrackerQAChecker::BeautifyTrackerBusPatchOccupancy(TH1& hbp,
const TH1* hbuspatchconfig,
const TH1& hnpads,
+ Int_t nevents,
AliMUONRecoParam& recoParam)
{
/// Put labels, limits and so on on the TrackerBusPatchOccupancy histogram
hbp.SetMaximum(ymax*1.4);
- TPaveText* text = new TPaveText(0.50,0.80,0.99,0.99,"NDC");
+ TPaveText* text = new TPaveText(0.50,0.60,0.99,0.99,"NDC");
- if (ok < 0 )
+ text->AddText(Form("MCH RUN %d - %d events",AliCDBManager::Instance()->GetRun(),nevents));
+
+ if ( ok < 0 )
{
text->AddText("Could not compute truncated mean. Not enough events ?");
+ text->AddText(Form("nBusPatches=%d n=%d",nBusPatches,n));
}
else if (!nPads || !nBusPatches)
{
- text->AddText("Could not get the total number of pads. ERROR !!!");
+ text->AddText(Form("Could not get the total number of pads (%d) or total number of buspatches (%d). ERROR !!!",
+ nPads,nBusPatches));
}
else
{
Float_t aboveLimitFraction = nBusPatchesAboveLimit*100.0/nBusPatches;
Float_t belowLimitFraction = nBusPatchesBelowLimit*100.0/nBusPatches;
- text->AddText(Form("MCH RUN %d",AliCDBManager::Instance()->GetRun()));
text->AddText(Form("%5.2f %% of missing buspatches (%d out of %d)",missingBusPatchFraction,nMissingBusPatches,nBusPatches));
text->AddText(Form("%5.2f %% of missing pads (%d out of %d)",missingPadFraction,nMissingPads,nPads));
text->AddText(Form("%5.2f %% bus patches above the %5.2f %% limit",aboveLimitFraction,maxToleratedOccupancy));
AliMUONVQAChecker::ECheckCode BeautifyTrackerBusPatchOccupancy(TH1& hbp,
const TH1* hbuspatchconfig,
- const TH1& hnpads, AliMUONRecoParam& recoParam);
+ const TH1& hnpads,
+ Int_t nevents,
+ AliMUONRecoParam& recoParam);
ClassDef(AliMUONTrackerQAChecker,1) // MUON quality assurance checker
#include "AliMUONDigitMaker.h"
#include "AliMUONQAIndices.h"
#include "AliMUONQAMappingCheck.h"
+#include "AliMUONLogger.h"
#include "AliMUONTrackerDataMaker.h"
#include "AliMUONVCluster.h"
#include "AliMUONVClusterStore.h"
#include <TH2F.h>
#include <Riostream.h>
#include <TMath.h>
+#include <TPaveText.h>
//-----------------------------------------------------------------------------
/// \class AliMUONTrackerQADataMakerRec
ClassImp(AliMUONTrackerQADataMakerRec)
/// \endcond
+Double_t AliMUONTrackerQADataMakerRec::fgkRawNofGlitchErrors(0.0);
+Double_t AliMUONTrackerQADataMakerRec::fgkRawNofTokenLostErrors(1.0);
+Double_t AliMUONTrackerQADataMakerRec::fgkRawNofParityErrors(2.0);
+Double_t AliMUONTrackerQADataMakerRec::fgkRawNofPaddingErrors(3.0);
+
//____________________________________________________________________________
AliMUONTrackerQADataMakerRec::AliMUONTrackerQADataMakerRec(AliQADataMakerRec* master) :
AliMUONVQADataMakerRec(master),
fClusterStore(0x0),
fTrackerDataMaker(0x0),
fMappingCheckRecPoints(0x0),
-fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun()))
+fCalibrationData(new AliMUONCalibrationData(AliCDBManager::Instance()->GetRun())),
+fLogger(0x0)
{
/// ctor
}
delete fTrackerDataMaker;
delete fCalibrationData;
delete fMappingCheckRecPoints;
+ if (fLogger)
+ {
+ if ( fLogger->NumberOfEntries() != 0 )
+ {
+ AliError("Some unprocessed logged errors are still there... Please check");
+ }
+ delete fLogger;
+ }
}
//____________________________________________________________________________
Int_t bin = hbp->FindBin(busPatchId);
hbp->SetBinContent(bin,data->BusPatch(busPatchId,occDim)*100.0); // occupancy, in percent
}
+
+ TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofRawEventSeen);
+ hnevents->Reset();
+ hnevents->Fill(0.0,fTrackerDataMaker->Data()->NumberOfEvents(-1));
+
+ if ( fLogger->NumberOfEntries() > 0 )
+ {
+ // readout errors
+ FillErrors(*fLogger);
+ fLogger->Clear();
+ }
+ }
+}
+
+//____________________________________________________________________________
+void AliMUONTrackerQADataMakerRec::FillErrors(AliMUONLogger& log)
+{
+ log.ResetItr();
+
+ TString msg;
+ Int_t occurence;
+
+ TH1* hparity = GetRawsData(AliMUONQAIndices::kTrackerBusPatchParityErrors);
+
+ TH1* htoken = GetRawsData(AliMUONQAIndices::kTrackerBusPatchTokenLostErrors);
+
+ TH1* hpadding = GetRawsData(AliMUONQAIndices::kTrackerBusPatchPaddingErrors);
+
+ TH1* hroe = GetRawsData(AliMUONQAIndices::kTrackerReadoutErrors);
+
+ TH1* hnevents = GetRawsData(AliMUONQAIndices::kTrackerNofRawEventSeen);
+
+ Int_t nevents = TMath::Nint(hnevents->GetBinContent(1));
+
+ if ( !nevents )
+ {
+ TPaveText* text = new TPaveText(0,0,0.99,0.99,"NDC");
+ text->AddText("FATAL : 0 event seen ? That's NOT normal...");
+ text->SetFillColor(2); // red = FATAL
+ hroe->GetListOfFunctions()->Add(text);
+ return;
+ }
+
+ while ( log.Next(msg,occurence) )
+ {
+ AliDebug(1,Form("msg=%s occurence=%d",msg.Data(),occurence));
+
+ if ( msg.Contains("token") )
+ {
+ Int_t dsp(-1),ddl(-1),ecode(-1);
+
+ sscanf(msg.Data(),"Lost token error detected in DSP 0x%X of DDL %d and code %d.",
+ &dsp,&ddl,&ecode);
+ Int_t localBP = ((dsp >> 16)- 4)*5 + 1;
+ Int_t buspatch = localBP + ddl*100;
+ htoken->Fill(buspatch,occurence);
+ hroe->Fill(fgkRawNofTokenLostErrors,occurence);
+ AliDebug(1,Form("DDL %d DSP %d busPatch %d",ddl,dsp,buspatch));
+ }
+
+ if ( msg.Contains("Parity") )
+ {
+ Int_t buspatch;
+ sscanf(msg.Data(),"Parity error in buspatch %d (0x%X).",&buspatch,&buspatch);
+ hparity->Fill(buspatch,occurence);
+ hroe->Fill(fgkRawNofParityErrors,occurence);
+ }
+
+ if ( msg.Contains("Glitch") )
+ {
+ hroe->Fill(fgkRawNofGlitchErrors,occurence);
+ }
+
+ if ( msg.Contains("Padding") )
+ {
+ Int_t block, dsp, buspatch;
+ sscanf(msg.Data(),"Padding word error for iBlock %d, iDsp %d, iBus %d.",&block,&dsp,&buspatch);
+ hpadding->Fill(buspatch,occurence);
+ hroe->Fill(fgkRawNofPaddingErrors,occurence);
+ }
}
+
+ /// Finally we normalize to the number of events, for the shifter plot only
+ hroe->Scale(100.0/nevents);
}
+
//____________________________________________________________________________
void AliMUONTrackerQADataMakerRec::InitRaws()
{
const Bool_t saveCorr = kTRUE ;
const Bool_t image = kTRUE ;
- Int_t bpmin(999999);
+ Int_t bpmin(999999);
Int_t bpmax(0);
TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
TH1* hbp = new TH1F("hTrackerBusPatchOccupancy","Occupancy of bus patches",nbins,xmin,xmax);
-
TH1* hbpnpads = new TH1F("hTrackerBusPatchNofPads","Number of pads per bus patch",nbins,xmin,xmax);
TH1* hbpnmanus = new TH1F("hTrackerBusPatchNofManus","Number of manus per bus patch",nbins,xmin,xmax);
Add2RawsList(hbpnpads,AliMUONQAIndices::kTrackerBusPatchNofPads, expert, !image, !saveCorr);
Add2RawsList(hbpnmanus,AliMUONQAIndices::kTrackerBusPatchNofManus, expert, !image, !saveCorr);
+ Add2RawsList(new TH1F("hTrackerBusPatchParityErrors","Number of parity errors per bus patch",nbins,xmin,xmax),
+ AliMUONQAIndices::kTrackerBusPatchParityErrors,expert,!image,!saveCorr);
+
+ Add2RawsList(new TH1F("hTrackerBusPatchTokenLostErrors","Number of token lost errors per bus patch",nbins,xmin,xmax),
+ AliMUONQAIndices::kTrackerBusPatchTokenLostErrors,expert,!image,!saveCorr);
+
+ Add2RawsList(new TH1F("hTrackerBusPatchPaddingErrors","Number of padding errors per bus patch",nbins,xmin,xmax),
+ AliMUONQAIndices::kTrackerBusPatchPaddingErrors,expert,!image,!saveCorr);
+
+ TH1* h = new TH1F("hTrackerReadoutErrors","Number of readout errors per event;;Error rate in %",4,-0.5,3.5);
+ h->SetStats(kFALSE);
+
+ // The QA shifter will only see the summary plot below
+ TAxis* a = h->GetXaxis();
+
+ a->SetBinLabel(h->FindBin(fgkRawNofGlitchErrors),"Glitch errors");
+ a->SetBinLabel(h->FindBin(fgkRawNofTokenLostErrors),"Token lost errors");
+ a->SetBinLabel(h->FindBin(fgkRawNofParityErrors),"Parity errors");
+ a->SetBinLabel(h->FindBin(fgkRawNofPaddingErrors),"Padding errors");
+
+ Add2RawsList(h,AliMUONQAIndices::kTrackerReadoutErrors,!expert,image,!saveCorr);
+
+ TH1* hnevents = new TH1F("hTrackerNofRawEventSeen","Number of events seen",1,-0.5,0.5);
+ a = hnevents->GetXaxis();
+ a->SetBinLabel(1,"Nevents");
+ hnevents->SetStats(kFALSE);
+
+ Add2RawsList(hnevents,AliMUONQAIndices::kTrackerNofRawEventSeen,expert,!image,!saveCorr);
+
const Bool_t histogram(kFALSE);
if(!fTrackerDataMaker)
{
- fTrackerDataMaker = new AliMUONTrackerDataMaker(GetRecoParam(),
+
+ AliMUONTrackerDataMaker* dm = new AliMUONTrackerDataMaker(GetRecoParam(),
AliCDBManager::Instance()->GetRun(),
0x0,
"",
"NOGAIN",
histogram,
0.0,0.0);
+
+ fLogger = new AliMUONLogger(-1);
+ dm->EnableErrorLogger(fLogger);
+ fTrackerDataMaker = dm;
}
fTrackerDataMaker->Data()->DisableChannelLevel(); // to save up disk space, we only store starting at the manu level
((AliMUONTrackerDataMaker*)fTrackerDataMaker)->SetRawReader(rawReader);
fTrackerDataMaker->ProcessEvent();
+
+
}
//__________________________________________________________________
class AliMUONVTrackerDataMaker;
class AliMUONCalibrationData;
class AliMUONQAMappingCheck;
+class AliMUONLogger;
class AliMUONTrackerQADataMakerRec: public AliMUONVQADataMakerRec {
void InsertTrackerData(Int_t specie, TObjArray** list, TObject* object,
Int_t indexNumber, Bool_t replace=kFALSE);
+ void FillErrors(AliMUONLogger& log);
+
private:
/// Not implemented
AliMUONTrackerQADataMakerRec(const AliMUONTrackerQADataMakerRec& rhs);
AliMUONCalibrationData* fCalibrationData; //!< Used to load Local, Regional and Global masks
- ClassDef(AliMUONTrackerQADataMakerRec,1) // MUON Quality assurance data maker
+ AliMUONLogger* fLogger; //!< (readout) error logger
+
+ static Double_t fgkRawNofEvents; //!< x-position to fill kTrackerReadoutErrors with nof events
+ static Double_t fgkRawNofGlitchErrors; //!< x-position to fill kTrackerReadoutErrors with nof glitch errors
+ static Double_t fgkRawNofTokenLostErrors; //!< x-position to fill kTrackerReadoutErrors with nof token lost errors
+ static Double_t fgkRawNofParityErrors; //!< x-position to fill kTrackerReadoutErrors with nof parity errors
+ static Double_t fgkRawNofPaddingErrors; //!< x-position to fill kTrackerReadoutErrors with nof padding errors
+
+ ClassDef(AliMUONTrackerQADataMakerRec,2) // MUON Quality assurance data maker
};
#endif
AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
// raw stream
- AliMUONRawStreamTrackerHP rawStream(rawReader);
+ AliMUONRawStreamTrackerHP rawStream(rawReader);
+ rawStream.EnableRawReaderErrorLogger();
// Loop over events
Int_t iEvent = 0;
AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
// raw stream
- AliMUONRawStreamTrackerHP rawStream(rawReader);
+ AliMUONRawStreamTrackerHP rawStream(rawReader);
+ rawStream.EnableRawReaderErrorLogger();
+ rawStream.DisableWarnings();
// Loop over events
Int_t iEvent = 0;