1 #ifndef AliHLTMUONTRIGGERRECONSTRUCTOR_H
2 #define AliHLTMUONTRIGGERRECONSTRUCTOR_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 */
9 /**********************************************************************
10 Created on : 16/05/2007
11 Purpose : This class is supposed to read the trigger DDL files and
12 give the output AliHLTMUONTriggerRecordStruct
13 Author : Indranil Das, HEP Division, SINP
14 Email : indra.das@saha.ac.in | indra.ehep@gmail.com
16 Artur Szostak <artursz@iafrica.com>:
17 Completely reimplemented the lookup table to a simplified format.
18 **********************************************************************/
21 /// @file AliHLTMUONTriggerReconstructor.h
22 /// @author Indranil Das <indra.das@saha.ac.in>,
23 /// Artur Szostak <artursz@iafrica.com>
25 /// @brief Declaration of the AliHLTMUONTriggerReconstructor class for processing trigger DDL data.
28 #include "AliHLTLogging.h"
29 #include "AliHLTMUONDataTypes.h"
30 #include "AliMUONTriggerDDLDecoder.h"
31 #include "AliMUONTriggerDDLDecoderEventHandler.h"
33 extern "C" struct AliHLTMUONTriggerRecordStruct;
36 class AliHLTMUONTriggerReconstructor : public AliHLTLogging
40 AliHLTMUONTriggerReconstructor();
41 virtual ~AliHLTMUONTriggerReconstructor();
44 const AliHLTUInt8_t* rawData,
45 AliHLTUInt32_t rawDataSize,
47 AliHLTMUONTriggerRecordStruct* trigRecord,
48 AliHLTUInt32_t& nofTrigRec,
49 bool suppressPartialTrigs = false
53 * Returns a pointer to the lookup table used to map between channel
54 * addresses and geometrical strip positions.
56 AliHLTMUONTriggerRecoLookupTable* LookupTableBuffer() { return fDecoder.GetHandler().LookupTableBuffer(); }
58 /// Returns the size of the lookup table.
59 size_t LookupTableSize() const { return fDecoder.GetHandler().LookupTableSize(); }
61 /// Returns true if the decoder is set to enable recovery logic if
62 /// raw data errors are found.
63 bool TryRecover() const { return fDecoder.TryRecover(); };
65 /// Sets if the decoder should enable the error recovery logic.
66 void TryRecover(bool value);
69 * Sets the DDL bit according to the DDL value given.
70 * It is used to keep the trigger record IDs unique.
72 void SetDDL(AliHLTInt32_t ddl) { fDecoder.GetHandler().SetDDL(ddl); }
76 class AliDecoderHandler : public AliMUONTriggerDDLDecoderEventHandler, public AliHLTLogging
82 /// Default destructor.
83 virtual ~AliDecoderHandler() {}
85 /// Returns a pointer to the lookup table.
86 AliHLTMUONTriggerRecoLookupTable* LookupTableBuffer() { return &fLookupTable; }
88 /// Returns the size of the lookup table.
89 size_t LookupTableSize() const { return sizeof(fLookupTable); }
92 * Returns the maximum number of trigger records that can be
93 * written to the output buffer.
95 AliHLTUInt32_t MaxOutputTrigRecs() const { return fMaxOutputTrigRecs; }
98 * Sets the maximum number of trigger records that can be
99 * written to the output buffer.
101 void MaxOutputTrigRecs(AliHLTUInt32_t n) { fMaxOutputTrigRecs = n; }
104 * Returns the number of reconstructed trigger records actually
105 * stored in the output buffer.
107 AliHLTUInt32_t OutputTrigRecsCount() const { return fOutputTrigRecsCount; }
110 * Returns the pointer to the output buffer which stores reconstructed
113 AliHLTMUONTriggerRecordStruct* OutputTrigRecs() const { return fOutputTrigRecs; }
116 * Sets the pointer to the output buffer which stores reconstructed
117 * trigger records. Also resets the number of trigger records stored.
119 void OutputTrigRecs(AliHLTMUONTriggerRecordStruct* buf)
121 fOutputTrigRecs = buf;
122 fOutputTrigRecsCount = 0;
127 * Returns the flag specifying if we should suppress partial trigger records.
129 bool SuppressPartialTriggers() const { return fSuppressPartialTriggers; }
132 * Sets the flag specifying if we should suppress partial trigger records.
134 void SuppressPartialTriggers(bool s) { fSuppressPartialTriggers = s; }
137 * Returns true if the output buffer was overflowed.
139 bool OverflowedOutputBuffer() const { return fOverflowed; }
142 * Returns true if the OnError handler method will only generate warning
143 * messages and rather than error messages.
145 bool WarnOnly() const { return fWarnOnly; }
148 * Sets the flag indicating if the OnError method should only generate
149 * warnings rather than error messages.
151 void WarnOnly(bool value) { fWarnOnly = value; }
154 * Sets the DDL bit according to the DDL value given.
156 void SetDDL(AliHLTInt32_t ddl) { fDDLBit = (ddl == 20 ? 0x00 : 0x80); }
158 // Methods inherited from AliMUONTriggerDDLDecoderEventHandler:
160 /// Called for each new buffer.
161 void OnNewBuffer(const void* buffer, UInt_t /*bufferSize*/);
163 /// Increments a counter for every new regional structure.
164 void OnNewRegionalStruct(
165 const AliMUONRegionalHeaderStruct* /*regionalStruct*/,
166 const AliMUONRegionalScalarsStruct* /*scalars*/,
173 /// Reset the counter for every new regional structure.
174 void OnEndOfRegionalStruct(
175 const AliMUONRegionalHeaderStruct* /*regionalStruct*/,
176 const AliMUONRegionalScalarsStruct* /*scalars*/,
180 // Start from -1 since we increment immediately in OnLocalStruct.
184 /// Converts a local trigger structure from the L0 into a trigger record.
186 const AliMUONLocalInfoStruct* localStruct,
187 const AliMUONLocalScalarsStruct* scalars
190 /// Logs an error message if there was a decoding problem with the DDL payload.
191 void OnError(ErrorCode code, const void* location);
194 // Do not allow copying of this class.
196 AliDecoderHandler(const AliDecoderHandler& rhs); // copy constructor
198 AliDecoderHandler& operator = (const AliDecoderHandler& rhs); // assignment operator
200 AliHLTMUONTriggerRecoLookupTable fLookupTable; ///< The lookup table used for mapping between channel addresses and geometrical information.
201 const void* fBufferStart; ///< Pointer to the start of the current DDL payload buffer.
202 AliHLTUInt32_t fMaxOutputTrigRecs; ///< Maximum number of reconstructed trigger records that can be stored in fOutputTrigRecs.
203 AliHLTUInt32_t fOutputTrigRecsCount; ///< The number of reconstructed trigger records actually stored in fOutputTrigRecs.
204 AliHLTMUONTriggerRecordStruct* fOutputTrigRecs; ///< Pointer to the output buffer of trigger records structures.
205 AliHLTInt32_t fTrigRecId; ///< A running counter for the trigger record ID.
206 AliHLTInt32_t fDDLBit; ///< The DDL bit used to generate unique trigger record IDs.
207 AliHLTInt32_t fCurrentRegional; ///< The current regional trigger structure number.
208 AliHLTInt32_t fCurrentLocal; ///< The current local trigger structure number.
209 bool fSuppressPartialTriggers; ///< Flag to indicate if we should suppres partial triggers.
210 bool fOverflowed; ///< Flag to indicate if we overflowed the output buffer.
211 bool fWarnOnly; ///< Flag indicating if the OnError method should generate warnings rather than error messages.
215 AliHLTMUONTriggerReconstructor(const AliHLTMUONTriggerReconstructor& rhs); // copy constructor
217 AliHLTMUONTriggerReconstructor& operator = (const AliHLTMUONTriggerReconstructor& rhs); // assignment operator
219 AliMUONTriggerDDLDecoder<AliDecoderHandler> fDecoder; ///< Raw DDL data decoder.
222 #endif // AliHLTMUONTRIGGERRECONSTRUCTOR_H