Refactoring code to extract common data block checking functionality into new base...
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 May 2008 09:48:31 +0000 (09:48 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 May 2008 09:48:31 +0000 (09:48 +0000)
Alsi made minor fixes to HLT error messages.

17 files changed:
HLT/MUON/AliHLTMUONDataBlockReader.h
HLT/MUON/AliHLTMUONProcessor.cxx [new file with mode: 0644]
HLT/MUON/AliHLTMUONProcessor.h [new file with mode: 0644]
HLT/MUON/HLTMUONLinkDef.h
HLT/MUON/OfflineInterface/AliHLTMUONRootifierComponent.cxx
HLT/MUON/OfflineInterface/AliHLTMUONRootifierComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONDecisionComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONDecisionComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.h
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx
HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.h
HLT/MUON/utils/AliHLTMUONEmptyEventFilterComponent.cxx
HLT/MUON/utils/AliHLTMUONEmptyEventFilterComponent.h
HLT/libAliHLTMUON.pkg

index 91098fe..015995c 100644 (file)
@@ -199,7 +199,7 @@ public:
                return sizeof(DataBlockType) + Nentries() * sizeof(DataElementType);
        }
 
-       AliHLTUInt32_t BufferSize() { return fSize; }
+       AliHLTUInt32_t BufferSize() const { return fSize; }
        
 private:
 
diff --git a/HLT/MUON/AliHLTMUONProcessor.cxx b/HLT/MUON/AliHLTMUONProcessor.cxx
new file mode 100644 (file)
index 0000000..7c03775
--- /dev/null
@@ -0,0 +1,32 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * All rights reserved.                                                   *
+ *                                                                        *
+ * Primary Authors:                                                       *
+ *   Artur Szostak <artursz@iafrica.com>                                  *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id: $ */
+
+///
+/// @file   AliHLTMUONProcessor.cxx
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date   2007-12-12
+/// @brief  Implementation of the abstract base dHLT processor component.
+///
+/// This component is the abstract base class of dHLT specific components.
+/// It implements some common methods used by all the dHLT components.
+///
+
+#include "AliHLTMUONProcessor.h"
+
+ClassImp(AliHLTMUONProcessor)
+
diff --git a/HLT/MUON/AliHLTMUONProcessor.h b/HLT/MUON/AliHLTMUONProcessor.h
new file mode 100644 (file)
index 0000000..db21d2c
--- /dev/null
@@ -0,0 +1,166 @@
+#ifndef ALIHLTMUONPROCESSOR_H
+#define ALIHLTMUONPROCESSOR_H
+/* This file is property of and copyright by the ALICE HLT Project        *
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: $ */
+
+///
+/// @file   AliHLTMUONProcessor.h
+/// @author Artur Szostak <artursz@iafrica.com>
+/// @date   2007-12-12
+/// @brief  Declaration of a common processor component abstract interface for dHLT components.
+///
+
+#include "AliHLTProcessor.h"
+#include "AliHLTMUONDataBlockReader.h"
+#include "AliHLTMUONUtils.h"
+
+/**
+ * @class AliHLTMUONProcessor
+ * This component class is an abstract base class for dHLT components.
+ * Some common methods useful to all dHLT specific components are implemented
+ * by this class.
+ */
+class AliHLTMUONProcessor : public AliHLTProcessor
+{
+public:
+       /// Default constructor.
+       AliHLTMUONProcessor() : AliHLTProcessor() {}
+       /// Default destructor.
+       virtual ~AliHLTMUONProcessor() {}
+
+protected:
+
+       /**
+        * Method to check the block structure and log appropriate error messages.
+        * If a problem is found with the data block then an appropriate HLT error
+        * message is logged and the method returns false.
+        * \param block  The lightweight block reader whose data block should be checked.
+        * \param name  A string containing a descriptive name of the data block
+        *          type. This name is used in the logged error messages.
+        * \returns  true if the structure of the block looks OK and false otherwise.
+        * \note  The BlockType should be a class deriving from AliHLTMUONDataBlockReader.
+        */
+       template <class BlockType>
+       bool BlockStructureOk(const BlockType& block, const char* name) const;
+       
+       /// Checks the structure of a trigger records data block.
+       bool BlockStructureOk(const AliHLTMUONTriggerRecordsBlockReader& block) const
+       {
+               return BlockStructureOk(block, "trigger records");
+       }
+       
+       /// Checks the structure of a trigger records debug information data block.
+       bool BlockStructureOk(const AliHLTMUONTrigRecsDebugBlockReader& block) const
+       {
+               return BlockStructureOk(block, "trigger records debug information");
+       }
+
+       /// Checks the structure of a reconstructed hits data block.
+       bool BlockStructureOk(const AliHLTMUONRecHitsBlockReader& block) const
+       {
+               return BlockStructureOk(block, "reconstructed hits");
+       }
+       
+       /// Checks the structure of a clusters data block.
+       bool BlockStructureOk(const AliHLTMUONClustersBlockReader& block) const
+       {
+               return BlockStructureOk(block, "clusters");
+       }
+       
+       /// Checks the structure of a ADC channels data block.
+       bool BlockStructureOk(const AliHLTMUONChannelsBlockReader& block) const
+       {
+               return BlockStructureOk(block, "channels");
+       }
+
+       /// Checks the structure of a Manso tracks data block.
+       bool BlockStructureOk(const AliHLTMUONMansoTracksBlockReader& block) const
+       {
+               return BlockStructureOk(block, "Manso tracks");
+       }
+       
+       /// Checks the structure of a Manso track candidates data block.
+       bool BlockStructureOk(const AliHLTMUONMansoCandidatesBlockReader& block) const
+       {
+               return BlockStructureOk(block, "Manso track candidates");
+       }
+
+       /// Checks the structure of a single track trigger decision data block.
+       bool BlockStructureOk(const AliHLTMUONSinglesDecisionBlockReader& block) const
+       {
+               return BlockStructureOk(block, "singles decision");
+       }
+
+       /// Checks the structure of a track pairs trigger decision data block.
+       bool BlockStructureOk(const AliHLTMUONPairsDecisionBlockReader& block) const
+       {
+               return BlockStructureOk(block, "pairs decision");
+       }
+       
+private:
+
+       // Do not allow copying of this class.
+       AliHLTMUONProcessor(const AliHLTMUONProcessor& /*obj*/);
+       AliHLTMUONProcessor& operator = (const AliHLTMUONProcessor& /*obj*/);
+       
+       ClassDef(AliHLTMUONProcessor, 0)  // Abstract base class for dHLT specific components.
+};
+
+//______________________________________________________________________________
+
+template <class BlockType>
+bool AliHLTMUONProcessor::BlockStructureOk(const BlockType& block, const char* name) const
+{
+       /// Performs basic checks to see if the input data block structure is OK,
+       /// that it is not corrupt, too short etc...
+       
+       if (not block.BufferSizeOk())
+       {
+               size_t headerSize = sizeof(typename BlockType::HeaderType);
+               if (block.BufferSize() < headerSize)
+               {
+                       HLTError("Received a %s data block with a size of %d bytes,"
+                               " which is smaller than the minimum valid header size of %d bytes."
+                               " The block must be corrupt.",
+                               name, block.BufferSize(), headerSize
+                       );
+                       return false;
+               }
+               
+               size_t expectedWidth = sizeof(typename BlockType::ElementType);
+               if (block.CommonBlockHeader().fRecordWidth != expectedWidth)
+               {
+                       HLTError("Received a %s data block with a record"
+                               " width of %d bytes, but the expected value is %d bytes."
+                               " The block might be corrupt.",
+                               name,
+                               block.CommonBlockHeader().fRecordWidth,
+                               expectedWidth
+                       );
+                       return false;
+               }
+               
+               HLTError("Received a %s data block with a size of %d bytes,"
+                       " but the block header claims the block should be %d bytes."
+                       " The block might be corrupt.",
+                       name, block.BufferSize(), block.BytesUsed()
+               );
+               return false;
+       }
+       
+       AliHLTMUONUtils::WhyNotValid reason;
+       if (not AliHLTMUONUtils::HeaderOk(block.BlockHeader(), &reason))
+       {
+               HLTError("Received a %s data block which might be corrupt. %s",
+                       name, AliHLTMUONUtils::FailureReasonToMessage(reason)
+               );
+               return false;
+       }
+       
+       return true;
+}
+
+#endif // ALIHLTMUONPROCESSOR_H
index c11eb7e..c40a7d0 100644 (file)
 /// @file   HLTMUONLinkDef.h
 /// @author Artur Szostak <artursz@iafrica.com>
 /// @date   29 May 2007
-/// @brief  The linkdef file for rootcint to build a ROOT dictionary of
-///         the dimuon HLT classes exposed to AliRoot.
+/// @brief  Linkdef file for dHLT.
+///
+/// The linkdef file for rootcint to build a ROOT dictionary of the dimuon
+/// HLT classes exposed to AliRoot.
 ///
 
 #ifdef __CINT__
@@ -36,6 +38,7 @@
 #pragma link C++ nestedfunction;
 
 #pragma link C++ class AliHLTMUONAgent+;
+#pragma link C++ class AliHLTMUONProcessor+;
 #pragma link C++ class AliHLTMUONTriggerRecordsSource+;
 #pragma link C++ class AliHLTMUONRecHitsSource+;
 #pragma link C++ class AliHLTMUONTriggerReconstructorComponent+;
index e121a04..fd155cd 100644 (file)
@@ -27,7 +27,6 @@
 #include "AliHLTMUONEvent.h"
 #include "AliHLTMUONConstants.h"
 #include "AliHLTMUONUtils.h"
-#include "AliHLTMUONDataBlockReader.h"
 #include "AliHLTMUONRecHit.h"
 #include "AliHLTMUONTriggerRecord.h"
 #include "AliHLTMUONMansoTrack.h"
@@ -39,7 +38,7 @@ ClassImp(AliHLTMUONRootifierComponent);
 
 
 AliHLTMUONRootifierComponent::AliHLTMUONRootifierComponent() :
-       AliHLTProcessor(),
+       AliHLTMUONProcessor(),
        fWarnForUnexpecedBlock(false)
 {
        ///
@@ -184,37 +183,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
                        AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
                        ptr += block->fOffset;
                        AliHLTMUONRecHitsBlockReader inblock(ptr, block->fSize);
-                       if (not inblock.BufferSizeOk())
-                       {
-                               size_t headerSize = sizeof(AliHLTMUONRecHitsBlockReader::HeaderType);
-                               if (block->fSize < headerSize)
-                               {
-                                       HLTError("Received a reconstructed hits data block with a size of %d bytes,"
-                                               " which is smaller than the minimum valid header size of %d bytes."
-                                               " The block must be corrupt.",
-                                               block->fSize, headerSize
-                                       );
-                                       continue;
-                               }
-                               
-                               size_t expectedWidth = sizeof(AliHLTMUONRecHitsBlockReader::ElementType);
-                               if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                               {
-                                       HLTError("Received a reconstructed hits data block with a record"
-                                               " width of %d bytes, but the expected value is %d bytes."
-                                               " The block might be corrupt.",
-                                               block->fSize, headerSize
-                                       );
-                                       continue;
-                               }
-                               
-                               HLTError("Received a reconstructed hits data block with a size of %d bytes,"
-                                       " but the block header claims the block should be %d bytes."
-                                       " The block might be corrupt.",
-                                       block->fSize, inblock.BytesUsed()
-                               );
-                               continue;
-                       }
+                       if (not BlockStructureOk(inblock)) continue;
                        
                        // Decode the source DDL from the specification bits.
                        Int_t sourceDDL = -1;
@@ -255,37 +224,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
                        AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
                        ptr += block->fOffset;
                        AliHLTMUONTriggerRecordsBlockReader inblock(ptr, block->fSize);
-                       if (not inblock.BufferSizeOk())
-                       {
-                               size_t headerSize = sizeof(AliHLTMUONTriggerRecordsBlockReader::HeaderType);
-                               if (block->fSize < headerSize)
-                               {
-                                       HLTError("Received a trigger records data block with a size of %d bytes,"
-                                               " which is smaller than the minimum valid header size of %d bytes."
-                                               " The block must be corrupt.",
-                                               block->fSize, headerSize
-                                       );
-                                       continue;
-                               }
-                               
-                               size_t expectedWidth = sizeof(AliHLTMUONTriggerRecordsBlockReader::ElementType);
-                               if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                               {
-                                       HLTError("Received a trigger records data block with a record"
-                                               " width of %d bytes, but the expected value is %d bytes."
-                                               " The block might be corrupt.",
-                                               block->fSize, headerSize
-                                       );
-                                       continue;
-                               }
-                               
-                               HLTError("Received a trigger records data block with a size of %d bytes,"
-                                       " but the block header claims the block should be %d bytes."
-                                       " The block might be corrupt.",
-                                       block->fSize, inblock.BytesUsed()
-                               );
-                               continue;
-                       }
+                       if (not BlockStructureOk(inblock)) continue;
                        
                        // Decode the source DDL from the specification bits.
                        Int_t sourceDDL = -1;
@@ -364,37 +303,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
                AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
                ptr += block->fOffset;
                AliHLTMUONMansoTracksBlockReader inblock(ptr, block->fSize);
-               if (not inblock.BufferSizeOk())
-               {
-                       size_t headerSize = sizeof(AliHLTMUONMansoTracksBlockReader::HeaderType);
-                       if (block->fSize < headerSize)
-                       {
-                               HLTError("Received a Manso tracks data block with a size of %d bytes,"
-                                       " which is smaller than the minimum valid header size of %d bytes."
-                                       " The block must be corrupt.",
-                                       block->fSize, headerSize
-                               );
-                               continue;
-                       }
-                       
-                       size_t expectedWidth = sizeof(AliHLTMUONMansoTracksBlockReader::ElementType);
-                       if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                       {
-                               HLTError("Received a Manso tracks data block with a record"
-                                       " width of %d bytes, but the expected value is %d bytes."
-                                       " The block might be corrupt.",
-                                       block->fSize, headerSize
-                               );
-                               continue;
-                       }
-                       
-                       HLTError("Received a Manso tracks data block with a size of %d bytes,"
-                               " but the block header claims the block should be %d bytes."
-                               " The block might be corrupt.",
-                               block->fSize, inblock.BytesUsed()
-                       );
-                       continue;
-               }
+               if (not BlockStructureOk(inblock)) continue;
                
                for (AliHLTUInt32_t n = 0; n < inblock.Nentries(); n++)
                {
@@ -503,37 +412,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
                AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
                ptr += block->fOffset;
                AliHLTMUONSinglesDecisionBlockReader inblock(ptr, block->fSize);
-               if (not inblock.BufferSizeOk())
-               {
-                       size_t headerSize = sizeof(AliHLTMUONSinglesDecisionBlockReader::HeaderType);
-                       if (block->fSize < headerSize)
-                       {
-                               HLTError("Received a single tracks trigger decision data block with a size of %d bytes,"
-                                       " which is smaller than the minimum valid header size of %d bytes."
-                                       " The block must be corrupt.",
-                                       block->fSize, headerSize
-                               );
-                               continue;
-                       }
-                       
-                       size_t expectedWidth = sizeof(AliHLTMUONSinglesDecisionBlockReader::ElementType);
-                       if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                       {
-                               HLTError("Received a single tracks trigger decision data block with a record"
-                                       " width of %d bytes, but the expected value is %d bytes."
-                                       " The block might be corrupt.",
-                                       block->fSize, headerSize
-                               );
-                               continue;
-                       }
-                       
-                       HLTError("Received a single tracks trigger decision data block with a size of %d bytes,"
-                               " but the block header claims the block should be %d bytes."
-                               " The block might be corrupt.",
-                               block->fSize, inblock.BytesUsed()
-                       );
-                       continue;
-               }
+               if (not BlockStructureOk(inblock)) continue;
                
                numLowPt += inblock.BlockHeader().fNlowPt;
                numHighPt += inblock.BlockHeader().fNhighPt;
@@ -594,37 +473,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
                AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
                ptr += block->fOffset;
                AliHLTMUONPairsDecisionBlockReader inblock(ptr, block->fSize);
-               if (not inblock.BufferSizeOk())
-               {
-                       size_t headerSize = sizeof(AliHLTMUONPairsDecisionBlockReader::HeaderType);
-                       if (block->fSize < headerSize)
-                       {
-                               HLTError("Received a track pairs trigger decision data block with a size of %d bytes,"
-                                       " which is smaller than the minimum valid header size of %d bytes."
-                                       " The block must be corrupt.",
-                                       block->fSize, headerSize
-                               );
-                               continue;
-                       }
-                       
-                       size_t expectedWidth = sizeof(AliHLTMUONPairsDecisionBlockReader::ElementType);
-                       if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                       {
-                               HLTError("Received a track pairs trigger decision data block with a record"
-                                       " width of %d bytes, but the expected value is %d bytes."
-                                       " The block might be corrupt.",
-                                       block->fSize, headerSize
-                               );
-                               continue;
-                       }
-                       
-                       HLTError("Received a track pairs trigger decision data block with a size of %d bytes,"
-                               " but the block header claims the block should be %d bytes."
-                               " The block might be corrupt.",
-                               block->fSize, inblock.BytesUsed()
-                       );
-                       continue;
-               }
+               if (not BlockStructureOk(inblock)) continue;
                
                numUnlikeAnyPt += inblock.BlockHeader().fNunlikeAnyPt;
                numUnlikeLowPt += inblock.BlockHeader().fNunlikeLowPt;
index 7cb884e..c50e7d1 100644 (file)
 /// @brief  Component for converting dHLT raw data into ROOT objects.
 ///
 
-#include "AliHLTProcessor.h"
+#include "AliHLTMUONProcessor.h"
 
 /**
  * Converts dHLT raw data blocks into ROOT objects.
  */
-class AliHLTMUONRootifierComponent : public AliHLTProcessor
+class AliHLTMUONRootifierComponent : public AliHLTMUONProcessor
 {
 public:
 
index fc928e8..af8b697 100644 (file)
@@ -49,7 +49,7 @@ ClassImp(AliHLTMUONDecisionComponent);
 
 
 AliHLTMUONDecisionComponent::AliHLTMUONDecisionComponent() :
-       AliHLTProcessor(),
+       AliHLTMUONProcessor(),
        fMaxTracks(1),
        fTrackCount(0),
        fTracks(new AliHLTMUONMansoTrackStructP[fMaxTracks]),
@@ -342,37 +342,7 @@ int AliHLTMUONDecisionComponent::DoEvent(
                        specification |= blocks[n].fSpecification;
                        
                        AliHLTMUONMansoTracksBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-                       if (not inblock.BufferSizeOk())
-                       {
-                               size_t headerSize = sizeof(AliHLTMUONMansoTracksBlockReader::HeaderType);
-                               if (blocks[n].fSize < headerSize)
-                               {
-                                       HLTError("Received a manso tracks data block with a size of %d bytes,"
-                                               " which is smaller than the minimum valid header size of %d bytes."
-                                               " The block must be corrupt.",
-                                               blocks[n].fSize, headerSize
-                                       );
-                                       continue;
-                               }
-                               
-                               size_t expectedWidth = sizeof(AliHLTMUONMansoTracksBlockReader::ElementType);
-                               if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                               {
-                                       HLTError("Received a manso tracks data block with a record"
-                                               " width of %d bytes, but the expected value is %d bytes."
-                                               " The block might be corrupt.",
-                                               inblock.CommonBlockHeader().fRecordWidth, expectedWidth
-                                       );
-                                       continue;
-                               }
-                               
-                               HLTError("Received a manso tracks data block with a size of %d bytes,"
-                                       " but the block header claims the block should be %d bytes."
-                                       " The block might be corrupt.",
-                                       blocks[n].fSize, inblock.BytesUsed()
-                               );
-                               continue;
-                       }
+                       if (not BlockStructureOk(inblock)) continue;
                        
                        for (AliHLTUInt32_t i = 0; i < inblock.Nentries(); i++)
                        {
index dd5c4bd..1c6961e 100644 (file)
@@ -13,7 +13,7 @@
 ///  @brief  Declares the decision component for dimuon HLT triggering.
 ///
 
-#include "AliHLTProcessor.h"
+#include "AliHLTMUONProcessor.h"
 #include "AliHLTMUONDataTypes.h"
 #include <vector>
 
@@ -45,7 +45,7 @@ extern "C" struct AliHLTMUONPairsDecisionBlockStruct;
  * counted. The results are encoded into two data blocks, one for trigger decisions
  * for single tracks and another for the track pairs.
  */
-class AliHLTMUONDecisionComponent : public AliHLTProcessor
+class AliHLTMUONDecisionComponent : public AliHLTMUONProcessor
 {
 public:
        AliHLTMUONDecisionComponent();
index e4efaef..1ee6a77 100644 (file)
@@ -64,7 +64,7 @@ ClassImp(AliHLTMUONHitReconstructorComponent)
 
 
 AliHLTMUONHitReconstructorComponent::AliHLTMUONHitReconstructorComponent() :
-       AliHLTProcessor(),
+       AliHLTMUONProcessor(),
        fHitRec(NULL),
        fDDL(-1),
        fLutSize(0),
@@ -408,7 +408,7 @@ int AliHLTMUONHitReconstructorComponent::DoEvent(
 
                if (not fHitRec->Run(buffer, ddlRawDataSize, block.GetArray(), nofHit))
                {
-                       HLTError("Error while processing of hit reconstruction algorithm.");
+                       HLTError("Error while processing the hit reconstruction algorithm.");
                        size = totalSize; // Must tell the framework how much buffer space was used.
                        return -EIO;
                }
index dcb8942..4ea8720 100644 (file)
@@ -13,7 +13,7 @@
 ///  @brief  Hit Reconstruction processing component for the dimuon HLT.
 ///
 
-#include "AliHLTProcessor.h"
+#include "AliHLTMUONProcessor.h"
 #include "AliHLTMUONHitReconstructor.h"
 
 #if __GNUC__ && __GNUC__ < 3
@@ -24,7 +24,7 @@
 extern "C" struct AliHLTMUONHitRecoLutRow;
 
 
-class AliHLTMUONHitReconstructorComponent : public AliHLTProcessor
+class AliHLTMUONHitReconstructorComponent : public AliHLTMUONProcessor
 {
 public:
        AliHLTMUONHitReconstructorComponent();
index 86df660..ea256ed 100644 (file)
@@ -40,7 +40,7 @@ ClassImp(AliHLTMUONMansoTrackerFSMComponent);
 
 
 AliHLTMUONMansoTrackerFSMComponent::AliHLTMUONMansoTrackerFSMComponent() :
-       AliHLTProcessor(),
+       AliHLTMUONProcessor(),
        AliHLTMUONMansoTrackerFSMCallback(),
        fTracker(NULL),
        fTrackCount(0),
@@ -300,37 +300,7 @@ int AliHLTMUONMansoTrackerFSMComponent::DoEvent(
                        specification |= blocks[n].fSpecification;
                        
                        AliHLTMUONRecHitsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-                       if (not inblock.BufferSizeOk())
-                       {
-                               size_t headerSize = sizeof(AliHLTMUONRecHitsBlockReader::HeaderType);
-                               if (blocks[n].fSize < headerSize)
-                               {
-                                       HLTError("Received a reconstructed hits data block with a size of %d bytes,"
-                                               " which is smaller than the minimum valid header size of %d bytes."
-                                               " The block must be corrupt.",
-                                               blocks[n].fSize, headerSize
-                                       );
-                                       continue;
-                               }
-                               
-                               size_t expectedWidth = sizeof(AliHLTMUONRecHitsBlockReader::ElementType);
-                               if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                               {
-                                       HLTError("Received a reconstructed hits data block with a record"
-                                               " width of %d bytes, but the expected value is %d bytes."
-                                               " The block might be corrupt.",
-                                               inblock.CommonBlockHeader().fRecordWidth, expectedWidth
-                                       );
-                                       continue;
-                               }
-                               
-                               HLTError("Received a reconstructed hits data block with a size of %d bytes,"
-                                       " but the block header claims the block should be %d bytes."
-                                       " The block might be corrupt.",
-                                       blocks[n].fSize, inblock.BytesUsed()
-                               );
-                               continue;
-                       }
+                       if (not BlockStructureOk(inblock)) continue;
                        
                        if (inblock.Nentries() != 0)
                                AddRecHits(blocks[n].fSpecification, inblock.GetArray(), inblock.Nentries());
@@ -366,37 +336,8 @@ int AliHLTMUONMansoTrackerFSMComponent::DoEvent(
                        continue;
                
                AliHLTMUONTriggerRecordsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-               if (not inblock.BufferSizeOk())
-               {
-                       size_t headerSize = sizeof(AliHLTMUONTriggerRecordsBlockReader::HeaderType);
-                       if (blocks[n].fSize < headerSize)
-                       {
-                               HLTError("Received a trigger records data block with a size of %d bytes,"
-                                       " which is smaller than the minimum valid header size of %d bytes."
-                                       " The block must be corrupt.",
-                                       blocks[n].fSize, headerSize
-                               );
-                               continue;
-                       }
-                       
-                       size_t expectedWidth = sizeof(AliHLTMUONTriggerRecordsBlockReader::ElementType);
-                       if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-                       {
-                               HLTError("Received a trigger records data block with a record"
-                                       " width of %d bytes, but the expected value is %d bytes."
-                                       " The block might be corrupt.",
-                                       inblock.CommonBlockHeader().fRecordWidth, expectedWidth
-                               );
-                               continue;
-                       }
-                       
-                       HLTError("Received a trigger records data block with a size of %d bytes,"
-                               " but the block header claims the block should be %d bytes."
-                               " The block might be corrupt.",
-                               blocks[n].fSize, inblock.BytesUsed()
-                       );
-                       continue;
-               }
+               if (not BlockStructureOk(inblock)) continue;
+               
                DebugTrace("Processing a trigger block with "
                        << inblock.Nentries() << " entries."
                );
index f42ae15..555e83e 100644 (file)
@@ -28,7 +28,7 @@
 ///          implemented as a finite state machine.
 ///
 
-#include "AliHLTProcessor.h"
+#include "AliHLTMUONProcessor.h"
 #include "AliHLTMUONDataTypes.h"
 #include "AliHLTMUONMansoTrackerFSMCallback.h"
 #include <vector>
@@ -50,7 +50,7 @@ struct AliHLTMUONRecHitStruct;
  *        implemented as a finite state machine.
  */
 class AliHLTMUONMansoTrackerFSMComponent
-       : public AliHLTProcessor, public AliHLTMUONMansoTrackerFSMCallback
+       : public AliHLTMUONProcessor, public AliHLTMUONMansoTrackerFSMCallback
 {
 public:
        AliHLTMUONMansoTrackerFSMComponent();
index 9c9035b..1ec6012 100644 (file)
@@ -55,7 +55,7 @@ ClassImp(AliHLTMUONTriggerReconstructorComponent)
 
 
 AliHLTMUONTriggerReconstructorComponent::AliHLTMUONTriggerReconstructorComponent() :
-       AliHLTProcessor(),
+       AliHLTMUONProcessor(),
        fTrigRec(NULL),
        fDDL(-1),
        fWarnForUnexpecedBlock(false),
@@ -433,7 +433,7 @@ int AliHLTMUONTriggerReconstructorComponent::DoEvent(
                        );
                if (not runOk)
                {
-                       HLTError("Error while processing of trigger DDL reconstruction algorithm.");
+                       HLTError("Error while processing the trigger DDL reconstruction algorithm.");
                        size = totalSize; // Must tell the framework how much buffer space was used.
                        return -EIO;
                }
index 9078566..ffb3a8e 100644 (file)
@@ -13,7 +13,7 @@
 /// @brief  A processing component for the dHLT trigger DDL reconstruction.
 ///
 
-#include "AliHLTProcessor.h"
+#include "AliHLTMUONProcessor.h"
 #include "AliHLTMUONDataTypes.h"
 
 #if __GNUC__ && __GNUC__ < 3
@@ -26,7 +26,7 @@ class AliHLTMUONTriggerReconstructor;
  * @class AliHLTMUONTriggerReconstructorComponent
  * @brief A processing component for the dHLT trigger DDL reconstruction.
  */
-class AliHLTMUONTriggerReconstructorComponent : public AliHLTProcessor
+class AliHLTMUONTriggerReconstructorComponent : public AliHLTMUONProcessor
 {
 public:
        AliHLTMUONTriggerReconstructorComponent();
index df3fc1e..6e88c95 100644 (file)
@@ -27,9 +27,6 @@
 ///
 
 #include "AliHLTMUONEmptyEventFilterComponent.h"
-#include "AliHLTMUONRecHitsBlockStruct.h"
-#include "AliHLTMUONTriggerRecordsBlockStruct.h"
-#include "AliHLTMUONMansoTracksBlockStruct.h"
 #include "AliHLTMUONConstants.h"
 #include "AliHLTLogging.h"
 #include "AliHLTSystem.h"
@@ -42,7 +39,7 @@ ClassImp(AliHLTMUONEmptyEventFilterComponent)
 
 
 AliHLTMUONEmptyEventFilterComponent::AliHLTMUONEmptyEventFilterComponent() :
-       AliHLTProcessor(),
+       AliHLTMUONProcessor(),
        fSendOnEmpty(false)
 {
        ///
@@ -178,50 +175,38 @@ int AliHLTMUONEmptyEventFilterComponent::DoEvent(
 
        for (AliHLTUInt32_t n = 0; n < evtData.fBlockCnt; n++)
        {
-#ifdef __DEBUG
-               char id[kAliHLTComponentDataTypefIDsize+1];
-               for (int i = 0; i < kAliHLTComponentDataTypefIDsize; i++)
-                       id[i] = blocks[n].fDataType.fID[i];
-               id[kAliHLTComponentDataTypefIDsize] = '\0';
-               char origin[kAliHLTComponentDataTypefOriginSize+1];
-               for (int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++)
-                       origin[i] = blocks[n].fDataType.fOrigin[i];
-               origin[kAliHLTComponentDataTypefOriginSize] = '\0';
-#endif // __DEBUG
-               HLTDebug("Handling block: %u, with fDataType.fID = '%s',"
-                         " fDataType.fID = '%s', fPtr = %p and fSize = %u bytes.",
-                       n, static_cast<char*>(id), static_cast<char*>(origin),
-                       blocks[n].fPtr, blocks[n].fSize
+               HLTDebug("Handling block: %u, with fDataType = '%s', fPtr = %p and fSize = %u bytes.",
+                       i, DataType2Text(blocks[n].fDataType).c_str(), blocks[n].fPtr, blocks[n].fSize
                );
 
                if (blocks[n].fDataType == AliHLTMUONConstants::TriggerRecordsBlockDataType())
                {
                        AliHLTMUONTriggerRecordsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-                       if (not BlockStructureOk(inblock, blocks[n].fSize)) continue;
+                       if (not BlockStructureOk(inblock)) continue;
                        if (inblock.Nentries() != 0) emptyEvent = false;
                }
                else if (blocks[n].fDataType == AliHLTMUONConstants::RecHitsBlockDataType())
                {
                        AliHLTMUONRecHitsBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-                       if (not BlockStructureOk(inblock, blocks[n].fSize)) continue;
+                       if (not BlockStructureOk(inblock)) continue;
                        if (inblock.Nentries() != 0) emptyEvent = false;
                }
                else if (blocks[n].fDataType == AliHLTMUONConstants::MansoTracksBlockDataType())
                {
                        AliHLTMUONMansoTracksBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-                       if (not BlockStructureOk(inblock, blocks[n].fSize)) continue;
+                       if (not BlockStructureOk(inblock)) continue;
                        if (inblock.Nentries() != 0) emptyEvent = false;
                }
                else if (blocks[n].fDataType == AliHLTMUONConstants::SinglesDecisionBlockDataType())
                {
                        AliHLTMUONSinglesDecisionBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-                       if (not BlockStructureOk(inblock, blocks[n].fSize)) continue;
+                       if (not BlockStructureOk(inblock)) continue;
                        if (inblock.Nentries() != 0) emptyEvent = false;
                }
                else if (blocks[n].fDataType == AliHLTMUONConstants::PairsDecisionBlockDataType())
                {
                        AliHLTMUONPairsDecisionBlockReader inblock(blocks[n].fPtr, blocks[n].fSize);
-                       if (not BlockStructureOk(inblock, blocks[n].fSize)) continue;
+                       if (not BlockStructureOk(inblock)) continue;
                        if (inblock.Nentries() != 0) emptyEvent = false;
                }
        }
@@ -242,51 +227,3 @@ int AliHLTMUONEmptyEventFilterComponent::DoEvent(
        return 0;
 }
 
-
-template <class BlockType>
-bool AliHLTMUONEmptyEventFilterComponent::BlockStructureOk(
-               const BlockType& inblock,
-               const char* blockName,
-               AliHLTUInt32_t blockBufferSize
-       ) const
-{
-       /// Performs basic checks to see if the input data block structure is OK,
-       /// that is that it is not corrupt, too short etc...
-
-       if (not inblock.BufferSizeOk())
-       {
-               size_t headerSize = sizeof(typename BlockType::HeaderType);
-               if (blockBufferSize < headerSize)
-               {
-                       HLTError("Received a %s data block with a size of %d bytes,"
-                               " which is smaller than the minimum valid header size of %d bytes."
-                               " The block must be corrupt.",
-                               blockName, blockBufferSize, headerSize
-                       );
-                       return false;
-               }
-               
-               size_t expectedWidth = sizeof(typename BlockType::ElementType);
-               if (inblock.CommonBlockHeader().fRecordWidth != expectedWidth)
-               {
-                       HLTError("Received a %s data block with a record"
-                               " width of %d bytes, but the expected value is %d bytes."
-                               " The block might be corrupt.",
-                               blockName,
-                               inblock.CommonBlockHeader().fRecordWidth,
-                               expectedWidth
-                       );
-                       return false;
-               }
-               
-               HLTError("Received a %s data block with a size of %d bytes,"
-                       " but the block header claims the block should be %d bytes."
-                       " The block might be corrupt.",
-                       blockName, blockBufferSize, inblock.BytesUsed()
-               );
-               return false;
-       }
-
-       return true;
-}
-
index 1d90420..a5222f1 100644 (file)
@@ -13,8 +13,7 @@
 /// @brief  Declaration of the empty event filter component.
 ///
 
-#include "AliHLTProcessor.h"
-#include "AliHLTMUONDataBlockReader.h"
+#include "AliHLTMUONProcessor.h"
 
 #if __GNUC__ && __GNUC__ < 3
 #define std
@@ -43,7 +42,7 @@
  *        blocks were empty. This is useful for collecting those events where dHLT
  *        is not finding anything but perhaps it should.
  */
-class AliHLTMUONEmptyEventFilterComponent : public AliHLTProcessor
+class AliHLTMUONEmptyEventFilterComponent : public AliHLTMUONProcessor
 {
 public:
        AliHLTMUONEmptyEventFilterComponent();
@@ -59,54 +58,6 @@ public:
        virtual AliHLTComponent* Spawn();
        
 protected:
-
-       // Method to check the block structure and log appropriate error messages.
-       template <class BlockType>
-       bool BlockStructureOk(
-                       const BlockType& inblock,
-                       const char* blockName,
-                       AliHLTUInt32_t blockBufferSize
-               ) const;
-
-       bool BlockStructureOk(
-                       const AliHLTMUONRecHitsBlockReader& inblock,
-                       AliHLTUInt32_t blockBufferSize
-               ) const
-       {
-               return BlockStructureOk(inblock, "reconstructed hits", blockBufferSize);
-       }
-
-       bool BlockStructureOk(
-                       const AliHLTMUONTriggerRecordsBlockReader& inblock,
-                       AliHLTUInt32_t blockBufferSize
-               ) const
-       {
-               return BlockStructureOk(inblock, "trigger records", blockBufferSize);
-       }
-
-       bool BlockStructureOk(
-                       const AliHLTMUONMansoTracksBlockReader& inblock,
-                       AliHLTUInt32_t blockBufferSize
-               ) const
-       {
-               return BlockStructureOk(inblock, "manso tracks", blockBufferSize);
-       }
-
-       bool BlockStructureOk(
-                       const AliHLTMUONSinglesDecisionBlockReader& inblock,
-                       AliHLTUInt32_t blockBufferSize
-               ) const
-       {
-               return BlockStructureOk(inblock, "singles decision", blockBufferSize);
-       }
-
-       bool BlockStructureOk(
-                       const AliHLTMUONPairsDecisionBlockReader& inblock,
-                       AliHLTUInt32_t blockBufferSize
-               ) const
-       {
-               return BlockStructureOk(inblock, "pairs decision", blockBufferSize);
-       }
        
        // Protected functions to implement AliHLTComponent's interface.
        // These functions provide initialization as well as the actual processing
@@ -133,7 +84,7 @@ private:
        
        bool fSendOnEmpty; //! Flag indicating if we should implement the inverse filter and only send everything if dHLT internal data blocks are empty.
 
-       ClassDef(AliHLTMUONEmptyEventFilterComponent, 0)
+       ClassDef(AliHLTMUONEmptyEventFilterComponent, 0)  // Filter component for empty dHLT events.
 };
 
 #endif // ALIHLTMUONEMPTYEVENTFILTERCOMPONENT_H
index 36b6007..47939f2 100644 (file)
@@ -12,6 +12,7 @@ CLASS_HDRS :=         OfflineInterface/AliHLTMUONAgent.h \
                OnlineAnalysis/AliHLTMUONMansoTrackerFSMComponent.h \
                OnlineAnalysis/AliHLTMUONDecisionComponent.h \
                utils/AliHLTMUONEmptyEventFilterComponent.h \
+               AliHLTMUONProcessor.h \
                AliHLTMUONRecHit.h \
                AliHLTMUONTriggerRecord.h \
                AliHLTMUONMansoTrack.h \