]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/MUON/utils/AliHLTMUONRawDataHistoComponent.cxx
correcting type in forward declaration
[u/mrichter/AliRoot.git] / HLT / MUON / utils / AliHLTMUONRawDataHistoComponent.cxx
index 9485c2d7d5bbe27e83a9754d5b7a0dd462eb0327..75ee3b29b4fa17438580df494f779c70469d31d4 100644 (file)
@@ -14,7 +14,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id: $ */
+// $Id: $
 
 ///
 ///  @file   AliHLTMUONRawDataHistoComponent.cxx
@@ -22,7 +22,8 @@
 ///  @date   30 April 2008
 ///  @brief  Implementation of the raw data histogramming component for dHLT.
 ///
-/// The class implements 
+/// The class implements a component for checking basic statistics and errors in
+/// raw data from the muon spectrometer. It is useful for basic monitoring.
 
 #include "AliHLTMUONRawDataHistoComponent.h"
 #include "AliHLTMUONConstants.h"
@@ -52,9 +53,10 @@ AliHLTMUONRawDataHistoComponent::AliHLTMUONRawDataHistoComponent() :
        fTriggerDecoder(),
        fLastPublishTime(-1),
        fCurrentEventTime(-1),
-       fPublishDelay(1),
+       fPublishDelay(0),
        fSuppressEmptyHists(false),
-       fProcessDataEventsOnly(false)
+       fProcessDataEventsOnly(false),
+       fClearAfterPublish(false)
 {
        /// Default constructor initialises all histogram object pointers to NULL.
        
@@ -118,7 +120,7 @@ void AliHLTMUONRawDataHistoComponent::GetOutputDataSize(
 {
        /// Inherited from AliHLTComponent. Returns an estimate of the expected output data size.
        
-       constBase = sizeof(TH1D) * 1024*1024;
+       constBase = (sizeof(TH1D)+50*sizeof(double))*22 + (sizeof(TH1D)+1024*4*sizeof(double))*20*2;
        inputMultiplier = 0;
 }
 
@@ -160,10 +162,11 @@ int AliHLTMUONRawDataHistoComponent::DoInit(int argc, const char** argv)
        if (result != 0) return result;
 
        fLastPublishTime = fCurrentEventTime = -1;
-       fPublishDelay = 1;
+       fPublishDelay = 0;
        bool pubDelaySet = false;
        fSuppressEmptyHists = false;
        fProcessDataEventsOnly = false;
+       fClearAfterPublish = false;
        fTrackerDecoder.TryRecover(false);
        fTriggerDecoder.TryRecover(false);
        
@@ -214,6 +217,12 @@ int AliHLTMUONRawDataHistoComponent::DoInit(int argc, const char** argv)
                        continue;
                }
                
+               if (strcmp(argv[i], "-clearafterpub") == 0)
+               {
+                       fClearAfterPublish = true;
+                       continue;
+               }
+               
                if (strcmp(argv[i], "-tryrecover") == 0)
                {
                        fTrackerDecoder.TryRecover(true);
@@ -282,8 +291,8 @@ int AliHLTMUONRawDataHistoComponent::DoDeinit()
 
 
 int AliHLTMUONRawDataHistoComponent::DoEvent(
-               const AliHLTComponentEventData& /*evtData*/,
-               AliHLTComponentTriggerData& /*trigData*/
+               const AliHLTComponentEventData& evtData,
+               AliHLTComponentTriggerData& trigData
        )
 {
        /// Inherited from AliHLTProcessor.
@@ -304,11 +313,21 @@ int AliHLTMUONRawDataHistoComponent::DoEvent(
 
                if (AliHLTMUONUtils::IsTrackerDDL(block->fSpecification))
                {
-                       ProcessTrackerDDL(block);
+                       bool decodeOk = ProcessTrackerDDL(block);
+                       if (not decodeOk and DumpDataOnError())
+                       {
+                               DumpEvent(evtData, trigData);
+                               return -EIO;
+                       }
                }
                else if (AliHLTMUONUtils::IsTriggerDDL(block->fSpecification))
                {
-                       ProcessTriggerDDL(block);
+                       bool decodeOk = ProcessTriggerDDL(block);
+                       if (not decodeOk and DumpDataOnError())
+                       {
+                               DumpEvent(evtData, trigData);
+                               return -EIO;
+                       }
                }
                else
                {
@@ -332,6 +351,8 @@ int AliHLTMUONRawDataHistoComponent::DoEvent(
                                AliHLTMUONConstants::HistogramDataType(),
                                AliHLTMUONUtils::DDLNumberToSpec(i)
                        );
+                       // If requested, clear histogram when published.
+                       if (fClearAfterPublish) fErrorHist[i]->Reset("M");
                }
                for (int i = 0; i < 20; i++)
                {
@@ -339,10 +360,12 @@ int AliHLTMUONRawDataHistoComponent::DoEvent(
                        if (not (fSuppressEmptyHists and fManuHist[i]->GetEntries() == 0))
                        {
                                PushBack(fManuHist[i], AliHLTMUONConstants::HistogramDataType(), spec);
+                               if (fClearAfterPublish) fManuHist[i]->Reset("M");
                        }
                        if (not (fSuppressEmptyHists and fSignalHist[i]->GetEntries() == 0))
                        {
                                PushBack(fSignalHist[i], AliHLTMUONConstants::HistogramDataType(), spec);
+                               if (fClearAfterPublish) fSignalHist[i]->Reset("M");
                        }
                }
                fLastPublishTime = fCurrentEventTime;
@@ -352,7 +375,7 @@ int AliHLTMUONRawDataHistoComponent::DoEvent(
 }
 
 
-void AliHLTMUONRawDataHistoComponent::ProcessTrackerDDL(const AliHLTComponentBlockData* block)
+bool AliHLTMUONRawDataHistoComponent::ProcessTrackerDDL(const AliHLTComponentBlockData* block)
 {
        /// Processes a raw data block from the tracker stations.
        
@@ -368,7 +391,7 @@ void AliHLTMUONRawDataHistoComponent::ProcessTrackerDDL(const AliHLTComponentBlo
                AliHLTUInt8_t* payload = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr)
                        + sizeof(AliRawDataHeader);
                UInt_t payloadSize = UInt_t(block->fSize) - sizeof(AliRawDataHeader);
-               fTrackerDecoder.Decode(payload, payloadSize);
+               return fTrackerDecoder.Decode(payload, payloadSize);
        }
        else
        {
@@ -378,10 +401,11 @@ void AliHLTMUONRawDataHistoComponent::ProcessTrackerDDL(const AliHLTComponentBlo
                );
                fErrorHist[ddl]->Fill(40);
        }
+       return false;
 }
 
 
-void AliHLTMUONRawDataHistoComponent::ProcessTriggerDDL(const AliHLTComponentBlockData* block)
+bool AliHLTMUONRawDataHistoComponent::ProcessTriggerDDL(const AliHLTComponentBlockData* block)
 {
        /// Processes a raw data block from the trigger stations.
        
@@ -396,7 +420,7 @@ void AliHLTMUONRawDataHistoComponent::ProcessTriggerDDL(const AliHLTComponentBlo
                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);
+               return fTriggerDecoder.Decode(payload, payloadSize, scalarEvent);
        }
        else
        {
@@ -406,6 +430,7 @@ void AliHLTMUONRawDataHistoComponent::ProcessTriggerDDL(const AliHLTComponentBlo
                );
                fErrorHist[ddl]->Fill(40);
        }
+       return false;
 }