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 * @ingroup alihlt_dimuon_component
28 class AliHLTMUONProcessor : public AliHLTProcessor
31 /// Default constructor.
32 AliHLTMUONProcessor() : AliHLTProcessor() {}
34 /// Default destructor.
35 virtual ~AliHLTMUONProcessor() {}
40 * Method to check the block structure and log appropriate error messages.
41 * If a problem is found with the data block then an appropriate HLT error
42 * message is logged and the method returns false.
43 * \param block The lightweight block reader whose data block should be checked.
44 * \param name A string containing a descriptive name of the data block
45 * type. This name is used in the logged error messages.
46 * \param checkHeader Indicates if the common data block header should be checked.
47 * \returns true if the structure of the block looks OK and false otherwise.
48 * \note The BlockType should be a class deriving from AliHLTMUONDataBlockReader.
50 template <class BlockType>
51 bool BlockStructureOk(
52 const BlockType& block, const char* name,
53 bool checkHeader = true
56 /// Checks the structure of a trigger records data block.
57 bool BlockStructureOk(
58 const AliHLTMUONTriggerRecordsBlockReader& block,
59 bool checkHeader = true
62 return BlockStructureOk(block, "trigger records", checkHeader);
65 /// Checks the structure of a trigger records debug information data block.
66 bool BlockStructureOk(
67 const AliHLTMUONTrigRecsDebugBlockReader& block,
68 bool checkHeader = true
71 return BlockStructureOk(block, "trigger records debug information", checkHeader);
74 /// Checks the structure of a reconstructed hits data block.
75 bool BlockStructureOk(
76 const AliHLTMUONRecHitsBlockReader& block,
77 bool checkHeader = true
80 return BlockStructureOk(block, "reconstructed hits", checkHeader);
83 /// Checks the structure of a clusters data block.
84 bool BlockStructureOk(
85 const AliHLTMUONClustersBlockReader& block,
86 bool checkHeader = true
89 return BlockStructureOk(block, "clusters", checkHeader);
92 /// Checks the structure of a ADC channels data block.
93 bool BlockStructureOk(
94 const AliHLTMUONChannelsBlockReader& block,
95 bool checkHeader = true
98 return BlockStructureOk(block, "channels", checkHeader);
101 /// Checks the structure of a Manso tracks data block.
102 bool BlockStructureOk(
103 const AliHLTMUONMansoTracksBlockReader& block,
104 bool checkHeader = true
107 return BlockStructureOk(block, "Manso tracks", checkHeader);
110 /// Checks the structure of a Manso track candidates data block.
111 bool BlockStructureOk(
112 const AliHLTMUONMansoCandidatesBlockReader& block,
113 bool checkHeader = true
116 return BlockStructureOk(block, "Manso track candidates", checkHeader);
119 /// Checks the structure of a single track trigger decision data block.
120 bool BlockStructureOk(
121 const AliHLTMUONSinglesDecisionBlockReader& block,
122 bool checkHeader = true
125 return BlockStructureOk(block, "singles decision", checkHeader);
128 /// Checks the structure of a track pairs trigger decision data block.
129 bool BlockStructureOk(
130 const AliHLTMUONPairsDecisionBlockReader& block,
131 bool checkHeader = true
134 return BlockStructureOk(block, "pairs decision", checkHeader);
138 * Fetches the DDL and detector element store objects for MUON mapping.
139 * \param cdbPath The CDB path to use. If set to NULL and the path has
140 * not been set in the CDB manager then the default path
141 * "local://$ALICE_ROOT" is used if the 'useDefault' flag is also true.
142 * \param run The run number to use. If set to -1 and the run number has
143 * not been set in the CDB manager then a value of zero is used if
144 * the 'useDefault' flag is also true.
145 * \param useDefault If set to true then a default CDB path and run number
146 * is used if they have not been set and 'cdbPath' == NULL or
148 * \return Zero if the object could be loaded. Otherwise an error code is
149 * returned, which is compatible with the HLT framework.
150 * \note AliMpDDLStore::Instance() and AliMpDEStore::Instance() must be used
151 * to fetch the objects after this method returns a code equal to zero.
153 int FetchMappingStores(
154 const char* cdbPath = NULL, Int_t run = -1,
155 bool useDefault = true
160 // Do not allow copying of this class.
162 AliHLTMUONProcessor(const AliHLTMUONProcessor& /*obj*/);
164 AliHLTMUONProcessor& operator = (const AliHLTMUONProcessor& /*obj*/);
166 ClassDef(AliHLTMUONProcessor, 0) // Abstract base class for dHLT specific components.
169 //______________________________________________________________________________
171 template <class BlockType>
172 bool AliHLTMUONProcessor::BlockStructureOk(
173 const BlockType& block, const char* name, bool checkHeader
176 /// Performs basic checks to see if the input data block structure is OK,
177 /// that it is not corrupt, too short etc...
179 if (not block.BufferSizeOk())
181 size_t headerSize = sizeof(typename BlockType::HeaderType);
182 if (block.BufferSize() < headerSize)
184 HLTError("Received a %s data block with a size of %d bytes,"
185 " which is smaller than the minimum valid header size of %d bytes."
186 " The block must be corrupt.",
187 name, block.BufferSize(), headerSize
192 size_t expectedWidth = sizeof(typename BlockType::ElementType);
193 if (block.CommonBlockHeader().fRecordWidth != expectedWidth)
195 HLTError("Received a %s data block with a record"
196 " width of %d bytes, but the expected value is %d bytes."
197 " The block might be corrupt.",
199 block.CommonBlockHeader().fRecordWidth,
205 HLTError("Received a %s data block with a size of %d bytes,"
206 " but the block header claims the block should be %d bytes."
207 " The block might be corrupt.",
208 name, block.BufferSize(), block.BytesUsed()
215 AliHLTMUONUtils::WhyNotValid reason;
216 if (not AliHLTMUONUtils::HeaderOk(block.BlockHeader(), &reason))
218 HLTError("Received a %s data block which might be corrupt. %s",
219 name, AliHLTMUONUtils::FailureReasonToMessage(reason)
228 #endif // ALIHLTMUONPROCESSOR_H