#include "AliCDBEntry.h"
#include "AliCDBManager.h"
#include "AliRawDataHeader.h"
-#include "TH1D.h"
#include "TTimeStamp.h"
#include <cstdlib>
#include <cstring>
AliHLTMUONRawDataHistoComponent::AliHLTMUONRawDataHistoComponent() :
AliHLTMUONProcessor(),
+ fTrackerDecoder(),
+ fTriggerDecoder(),
fLastPublishTime(-1),
fCurrentEventTime(-1),
- fPublishDelay(1)
+ fPublishDelay(1),
+ fSuppressEmptyHists(false),
+ fProcessDataEventsOnly(false)
{
/// Default constructor initialises all histogram object pointers to NULL.
fManuHist[i] = NULL;
fSignalHist[i] = NULL;
}
+
+ fTrackerDecoder.ExitOnError(false);
+ fTrackerDecoder.TryRecover(false);
+ fTrackerDecoder.SendDataOnParityError(true);
+ fTrackerDecoder.AutoDetectTrailer(true);
+ fTrackerDecoder.CheckForTrailer(true);
+
+ fTriggerDecoder.ExitOnError(false);
+ fTriggerDecoder.TryRecover(false);
+ fTriggerDecoder.AutoDetectScalars(false);
}
const char* AliHLTMUONRawDataHistoComponent::GetComponentID()
{
- ///
/// Inherited from AliHLTComponent. Returns the component ID.
- ///
return AliHLTMUONConstants::RawDataHistogrammerId();
}
void AliHLTMUONRawDataHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
{
- ///
/// Inherited from AliHLTProcessor. Returns the list of expected input data types.
- ///
assert( list.empty() );
list.push_back( AliHLTMUONConstants::DDLRawDataType() );
unsigned long& constBase, double& inputMultiplier
)
{
- ///
/// Inherited from AliHLTComponent. Returns an estimate of the expected output data size.
- ///
constBase = sizeof(TH1D) * 1024*1024;
inputMultiplier = 0;
AliHLTComponent* AliHLTMUONRawDataHistoComponent::Spawn()
{
- ///
/// Inherited from AliHLTComponent. Creates a new object instance.
- ///
return new AliHLTMUONRawDataHistoComponent;
}
fLastPublishTime = fCurrentEventTime = -1;
fPublishDelay = 1;
bool pubDelaySet = false;
+ fSuppressEmptyHists = false;
+ fProcessDataEventsOnly = false;
+ fTrackerDecoder.TryRecover(false);
+ fTriggerDecoder.TryRecover(false);
for (int i = 0; i < argc; i++)
{
i++;
continue;
}
+
+ if (strcmp(argv[i], "-noemptyhists") == 0)
+ {
+ fSuppressEmptyHists = true;
+ continue;
+ }
+
+ if (strcmp(argv[i], "-onlydataevents") == 0)
+ {
+ fProcessDataEventsOnly = true;
+ continue;
+ }
+
+ if (strcmp(argv[i], "-tryrecover") == 0)
+ {
+ fTrackerDecoder.TryRecover(true);
+ fTriggerDecoder.TryRecover(true);
+ continue;
+ }
HLTError("Unknown option '%s'.", argv[i]);
return -EINVAL;
AliHLTInt32_t equipId = AliHLTMUONUtils::DDLNumberToEquipId(i);
sprintf(name, "rawDataErrors_%d", equipId);
sprintf(title, "Distribution of errors found in raw data from DDL %d.", equipId);
- cout << "TRACE: " << name << endl;
fErrorHist[i] = new TH1D(name, title, 40, 0.5, 40.5);
fErrorHist[i]->SetXTitle("Error code");
fErrorHist[i]->SetYTitle("Number of errors");
/// Inherited from AliHLTProcessor.
/// Processes the new event data and generates summary histograms.
+ if (fProcessDataEventsOnly and not IsDataEvent()) return 0; // Only process data events.
+
fCurrentEventTime = TTimeStamp().AsDouble();
const AliHLTComponentBlockData* block = GetFirstInputBlock(AliHLTMUONConstants::DDLRawDataType());
}
}
- if (fLastPublishTime == -1 or fCurrentEventTime - fLastPublishTime > fPublishDelay)
+ // See if 'fPublishDelay' number of seconds has elapsed or this is the first event,
+ // in that case publish the histograms. Do not publish histograms that are empty
+ // if the fSuppressEmptyHists flag is set.
+ if (fLastPublishTime == -1 or fCurrentEventTime - fLastPublishTime >= fPublishDelay)
{
for (int i = 0; i < 22; i++)
{
+ if (fSuppressEmptyHists and fErrorHist[i]->GetEntries() == 0) continue;
PushBack(fErrorHist[i],
AliHLTMUONConstants::HistogramDataType(),
AliHLTMUONUtils::DDLNumberToSpec(i)
for (int i = 0; i < 20; i++)
{
AliHLTUInt32_t spec = AliHLTMUONUtils::DDLNumberToSpec(i);
- PushBack(fManuHist[i], AliHLTMUONConstants::HistogramDataType(), spec);
- PushBack(fSignalHist[i], AliHLTMUONConstants::HistogramDataType(), spec);
+ if (not (fSuppressEmptyHists and fManuHist[i]->GetEntries() == 0))
+ {
+ PushBack(fManuHist[i], AliHLTMUONConstants::HistogramDataType(), spec);
+ }
+ if (not (fSuppressEmptyHists and fSignalHist[i]->GetEntries() == 0))
+ {
+ PushBack(fSignalHist[i], AliHLTMUONConstants::HistogramDataType(), spec);
+ }
}
fLastPublishTime = fCurrentEventTime;
}
AliHLTInt32_t ddl = AliHLTMUONUtils::SpecToDDLNumber(block->fSpecification);
assert(0 <= ddl and ddl < 20);
+ fTrackerDecoder.GetHandler().ErrorHist(fErrorHist[ddl]);
+ fTrackerDecoder.GetHandler().ManuHist(fManuHist[ddl]);
+ fTrackerDecoder.GetHandler().SignalHist(fSignalHist[ddl]);
+
if (block->fSize >= sizeof(AliRawDataHeader))
{
- AliHLTUInt8_t* buffer = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
- buffer += sizeof(AliRawDataHeader);
- UInt_t bufferSize = UInt_t(block->fSize) - sizeof(AliRawDataHeader);
+ AliHLTUInt8_t* payload = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr)
+ + sizeof(AliRawDataHeader);
+ UInt_t payloadSize = UInt_t(block->fSize) - sizeof(AliRawDataHeader);
+ fTrackerDecoder.Decode(payload, payloadSize);
}
else
{
{
/// Processes a raw data block from the trigger stations.
- HLTFatal("Processing of trigger data not yet implemented!");
-
AliHLTInt32_t ddl = AliHLTMUONUtils::SpecToDDLNumber(block->fSpecification);
assert(21 <= ddl and ddl < 22);
+ fTriggerDecoder.GetHandler().ErrorHist(fErrorHist[ddl]);
+
if (block->fSize >= sizeof(AliRawDataHeader))
{
AliRawDataHeader* header = reinterpret_cast<AliRawDataHeader*>(block->fPtr);
- AliHLTUInt8_t* buffer = reinterpret_cast<AliHLTUInt8_t*>(header+1);
- UInt_t bufferSize = UInt_t(block->fSize) - sizeof(AliRawDataHeader);
+ AliHLTUInt8_t* payload = reinterpret_cast<AliHLTUInt8_t*>(header+1);
+ UInt_t payloadSize = UInt_t(block->fSize) - sizeof(AliRawDataHeader);
+ bool scalarEvent = ((header->GetL1TriggerMessage() & 0x1) == 0x1);
+ fTriggerDecoder.Decode(payload, payloadSize, scalarEvent);
}
else
{
}
}
}
+
#include "AliHLTMUONProcessor.h"
#include "AliHLTMUONDataTypes.h"
-
-class TH1D;
+#include "AliMUONTrackerDDLDecoder.h"
+#include "AliMUONTriggerDDLDecoder.h"
+#include "TH1D.h"
/**
* @class AliHLTMUONRawDataHistoComponent
private:
+ class AliDecoderHandler : public AliHLTLogging
+ {
+ public:
+
+ AliDecoderHandler() : AliHLTLogging(), fErrorHist(NULL) {}
+ virtual ~AliDecoderHandler() {}
+
+ /// Returns the error codes histogram.
+ TH1D* ErrorHist() const { return fErrorHist; }
+
+ /// Sets the error codes histogram.
+ void ErrorHist(TH1D* hist) { fErrorHist = hist; }
+
+ protected:
+
+ /// Fills the error histogram with the given error code.
+ void FillErrorHist(Int_t code);
+
+ TH1D* fErrorHist; /// Histogram of error codes found.
+
+ private:
+
+ // Do not allow copying of this object.
+ /// Not implemented.
+ AliDecoderHandler(const AliDecoderHandler& obj);
+ /// Not implemented.
+ AliDecoderHandler& operator = (const AliDecoderHandler& obj);
+ };
+
+ class AliTrackerDecoderHandler :
+ public AliMUONTrackerDDLDecoderEventHandler, public AliDecoderHandler
+ {
+ public:
+ AliTrackerDecoderHandler() :
+ AliMUONTrackerDDLDecoderEventHandler(),
+ AliDecoderHandler(),
+ fManuHist(NULL),
+ fSignalHist(NULL)
+ {}
+
+ virtual ~AliTrackerDecoderHandler() {}
+
+ /// Returns the signals per MANU histogram.
+ TH1D* ManuHist() const { return fManuHist; }
+
+ /// Sets the signals per MANU histogram.
+ void ManuHist(TH1D* hist) { fManuHist = hist; }
+
+ /// Returns the signals histogram.
+ TH1D* SignalHist() const { return fSignalHist; }
+
+ /// Sets the signals histogram.
+ void SignalHist(TH1D* hist) { fSignalHist = hist; }
+
+ // Methods inherited from AliMUONTrackerDDLDecoderEventHandler:
+
+ /// Called for each new data word found.
+ void OnData(UInt_t data, bool /*parityError*/);
+
+ /// Fills the fErrorHist histogram with the error code received.
+ void OnError(ErrorCode code, const void* /*location*/) { FillErrorHist(Int_t(code)); }
+
+ private:
+
+ // Do not allow copying of this object.
+ /// Not implemented.
+ AliTrackerDecoderHandler(const AliTrackerDecoderHandler& obj);
+ /// Not implemented.
+ AliTrackerDecoderHandler& operator = (const AliTrackerDecoderHandler& obj);
+
+ TH1D* fManuHist; /// Histogram of signal distribution per MANU.
+ TH1D* fSignalHist; /// Histogram of the ADC signal distribution.
+ };
+
+ class AliTriggerDecoderHandler :
+ public AliMUONTriggerDDLDecoderEventHandler, public AliDecoderHandler
+ {
+ public:
+ AliTriggerDecoderHandler() :
+ AliMUONTriggerDDLDecoderEventHandler(),
+ AliDecoderHandler()
+ {}
+
+ virtual ~AliTriggerDecoderHandler() {}
+
+ // Methods inherited from AliMUONTriggerDDLDecoderEventHandler:
+
+ /// Fills the fErrorHist histogram with the error code received.
+ void OnError(ErrorCode code, const void* /*location*/) { FillErrorHist(Int_t(code)); }
+
+ private:
+
+ // Do not allow copying of this object.
+ /// Not implemented.
+ AliTriggerDecoderHandler(const AliTriggerDecoderHandler& obj);
+ /// Not implemented.
+ AliTriggerDecoderHandler& operator = (const AliTriggerDecoderHandler& obj);
+ };
+
// Do not allow copying of this class.
AliHLTMUONRawDataHistoComponent(const AliHLTMUONRawDataHistoComponent& /*obj*/);
AliHLTMUONRawDataHistoComponent& operator = (const AliHLTMUONRawDataHistoComponent& /*obj*/);
void ProcessTriggerDDL(const AliHLTComponentBlockData* block);
void FreeObjects();
+ AliMUONTrackerDDLDecoder<AliTrackerDecoderHandler> fTrackerDecoder; // Raw data decoder for the tracker data.
+ AliMUONTriggerDDLDecoder<AliTriggerDecoderHandler> fTriggerDecoder; // Raw data decoder for the trigger data.
+
double fLastPublishTime; /// Timestamp for the last time we published data (seconds).
double fCurrentEventTime; /// Timestamp for the current event being processed (seconds).
double fPublishDelay; /// Delay in second to wait between publishing data.
TH1D* fErrorHist[22]; /// Histograms for error codes per DDL.
TH1D* fManuHist[20]; /// Histograms for MANU distributions per DDL.
TH1D* fSignalHist[20]; /// Histograms for signal distributions per DDL.
+ bool fSuppressEmptyHists; /// Flag indicating if empty histograms should be published or not.
+ bool fProcessDataEventsOnly; /// Flag indicating if only data events should be processed.
ClassDef(AliHLTMUONRawDataHistoComponent, 0); // Trigger decision component for the dimuon HLT.
};
+//-----------------------------------------------------------------------------
+
+inline void AliHLTMUONRawDataHistoComponent::AliDecoderHandler::FillErrorHist(Int_t code)
+{
+ /// Fills the error code into the error code histogram.
+
+ assert(fErrorHist != NULL);
+ Int_t mincode = Int_t( fErrorHist->GetXaxis()->GetBinCenter(1) );
+ Int_t maxcode = Int_t( fErrorHist->GetXaxis()->GetBinCenter(fErrorHist->GetNbinsX()) );
+ if (code < mincode or maxcode < code)
+ {
+ HLTError("Filling an error code which is out of range."
+ " Received code %d, but expected it to be in the range [%d..%d]",
+ int(code), mincode, maxcode
+ );
+ }
+ fErrorHist->Fill(code);
+}
+
+
+inline void AliHLTMUONRawDataHistoComponent::AliTrackerDecoderHandler::OnData(
+ UInt_t data, bool /*parityError*/
+ )
+{
+ /// Fills the signals histogram and also the signal per MANU histogram.
+
+ UInt_t minadc = UInt_t( fSignalHist->GetXaxis()->GetBinCenter(1) );
+ UInt_t maxadc = UInt_t( fSignalHist->GetXaxis()->GetBinCenter(fSignalHist->GetNbinsX()) );
+ UInt_t minmanu = UInt_t( fManuHist->GetXaxis()->GetBinCenter(1) );
+ UInt_t maxmanu = UInt_t( fManuHist->GetXaxis()->GetBinCenter(fManuHist->GetNbinsX()) );
+
+ UShort_t manuId; UChar_t channelId; UShort_t adc;
+ UnpackADC(data, manuId, channelId, adc);
+
+ if (adc < minadc or maxadc < adc)
+ {
+ HLTError("Filling a signal value which is out of range. Received ADC value"
+ " of %d channels, but expected it to be in the range [%d..%d]",
+ int(adc), minadc, maxadc
+ );
+ }
+ fSignalHist->Fill(adc);
+
+ if (manuId < minmanu or maxmanu < manuId)
+ {
+ HLTError("Filling a MANU ID value which is out of range. Received"
+ " value of %d, but expected it to be in the range [%d..%d]",
+ int(manuId), minmanu, maxmanu
+ );
+ }
+ fManuHist->Fill(manuId);
+}
+
#endif // AliHLTMUONRAWDATAHISTOCOMPONENT_H
+