1 #ifndef ALIHLTMUONPROCESSOR_H
2 #define ALIHLTMUONPROCESSOR_H
3 /* This file is property of and copyright by the ALICE HLT Project *
4 * ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
10 /// @file AliHLTMUONProcessor.h
11 /// @author Artur Szostak <artursz@iafrica.com>
13 /// @brief Declaration of a common processor component abstract interface for dHLT components.
16 #include "AliHLTProcessor.h"
17 #include "AliHLTMUONDataBlockReader.h"
18 #include "AliHLTMUONUtils.h"
21 * @class AliHLTMUONProcessor
22 * This component class is an abstract base class for dHLT components.
23 * Some common methods useful to all dHLT specific components are implemented
26 class AliHLTMUONProcessor : public AliHLTProcessor
29 /// Default constructor.
30 AliHLTMUONProcessor() : AliHLTProcessor() {}
31 /// Default destructor.
32 virtual ~AliHLTMUONProcessor() {}
37 * Method to check the block structure and log appropriate error messages.
38 * If a problem is found with the data block then an appropriate HLT error
39 * message is logged and the method returns false.
40 * \param block The lightweight block reader whose data block should be checked.
41 * \param name A string containing a descriptive name of the data block
42 * type. This name is used in the logged error messages.
43 * \returns true if the structure of the block looks OK and false otherwise.
44 * \note The BlockType should be a class deriving from AliHLTMUONDataBlockReader.
46 template <class BlockType>
47 bool BlockStructureOk(const BlockType& block, const char* name) const;
49 /// Checks the structure of a trigger records data block.
50 bool BlockStructureOk(const AliHLTMUONTriggerRecordsBlockReader& block) const
52 return BlockStructureOk(block, "trigger records");
55 /// Checks the structure of a trigger records debug information data block.
56 bool BlockStructureOk(const AliHLTMUONTrigRecsDebugBlockReader& block) const
58 return BlockStructureOk(block, "trigger records debug information");
61 /// Checks the structure of a reconstructed hits data block.
62 bool BlockStructureOk(const AliHLTMUONRecHitsBlockReader& block) const
64 return BlockStructureOk(block, "reconstructed hits");
67 /// Checks the structure of a clusters data block.
68 bool BlockStructureOk(const AliHLTMUONClustersBlockReader& block) const
70 return BlockStructureOk(block, "clusters");
73 /// Checks the structure of a ADC channels data block.
74 bool BlockStructureOk(const AliHLTMUONChannelsBlockReader& block) const
76 return BlockStructureOk(block, "channels");
79 /// Checks the structure of a Manso tracks data block.
80 bool BlockStructureOk(const AliHLTMUONMansoTracksBlockReader& block) const
82 return BlockStructureOk(block, "Manso tracks");
85 /// Checks the structure of a Manso track candidates data block.
86 bool BlockStructureOk(const AliHLTMUONMansoCandidatesBlockReader& block) const
88 return BlockStructureOk(block, "Manso track candidates");
91 /// Checks the structure of a single track trigger decision data block.
92 bool BlockStructureOk(const AliHLTMUONSinglesDecisionBlockReader& block) const
94 return BlockStructureOk(block, "singles decision");
97 /// Checks the structure of a track pairs trigger decision data block.
98 bool BlockStructureOk(const AliHLTMUONPairsDecisionBlockReader& block) const
100 return BlockStructureOk(block, "pairs decision");
105 // Do not allow copying of this class.
106 AliHLTMUONProcessor(const AliHLTMUONProcessor& /*obj*/);
107 AliHLTMUONProcessor& operator = (const AliHLTMUONProcessor& /*obj*/);
109 ClassDef(AliHLTMUONProcessor, 0) // Abstract base class for dHLT specific components.
112 //______________________________________________________________________________
114 template <class BlockType>
115 bool AliHLTMUONProcessor::BlockStructureOk(const BlockType& block, const char* name) const
117 /// Performs basic checks to see if the input data block structure is OK,
118 /// that it is not corrupt, too short etc...
120 if (not block.BufferSizeOk())
122 size_t headerSize = sizeof(typename BlockType::HeaderType);
123 if (block.BufferSize() < headerSize)
125 HLTError("Received a %s data block with a size of %d bytes,"
126 " which is smaller than the minimum valid header size of %d bytes."
127 " The block must be corrupt.",
128 name, block.BufferSize(), headerSize
133 size_t expectedWidth = sizeof(typename BlockType::ElementType);
134 if (block.CommonBlockHeader().fRecordWidth != expectedWidth)
136 HLTError("Received a %s data block with a record"
137 " width of %d bytes, but the expected value is %d bytes."
138 " The block might be corrupt.",
140 block.CommonBlockHeader().fRecordWidth,
146 HLTError("Received a %s data block with a size of %d bytes,"
147 " but the block header claims the block should be %d bytes."
148 " The block might be corrupt.",
149 name, block.BufferSize(), block.BytesUsed()
154 AliHLTMUONUtils::WhyNotValid reason;
155 if (not AliHLTMUONUtils::HeaderOk(block.BlockHeader(), &reason))
157 HLTError("Received a %s data block which might be corrupt. %s",
158 name, AliHLTMUONUtils::FailureReasonToMessage(reason)
166 #endif // ALIHLTMUONPROCESSOR_H