]>
Commit | Line | Data |
---|---|---|
e3a2b9c9 | 1 | #ifndef ALIMUONRAWSTREAMTRACKERHP_H |
2 | #define ALIMUONRAWSTREAMTRACKERHP_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 */ | |
6 | ||
7 | /* $Id$*/ | |
8 | ||
9 | /// | |
10 | /// \file AliMUONRawStreamTrackerHP.h | |
11 | /// \author Artur Szostak <artursz@iafrica.com> | |
12 | /// \date 29-11-2007 | |
13 | /// \brief Declaration of the high performance decoder for muon trigger chamber raw streams. | |
14 | /// | |
15 | ||
16 | #include "AliMUONVRawStreamTracker.h" | |
17 | #include "AliMUONTrackerDDLDecoder.h" | |
18 | ||
19 | class AliMUONRawStreamTrackerHP : public AliMUONVRawStreamTracker | |
20 | { | |
21 | public: | |
22 | ||
23 | /// Default constructor. | |
24 | AliMUONRawStreamTrackerHP(); | |
25 | ||
26 | /// Constructor for setting the raw reader. | |
27 | AliMUONRawStreamTrackerHP(AliRawReader* rawReader); | |
28 | ||
29 | /// Default destructor. | |
30 | virtual ~AliMUONRawStreamTrackerHP(); | |
31 | ||
32 | // The following public methods are all inherited from AliMUONVRawStreamTracker: | |
33 | ||
34 | /// Initialize iterator | |
35 | virtual void First(); | |
36 | ||
37 | /// DDL iterator | |
38 | virtual Bool_t NextDDL(); | |
39 | ||
40 | /// Whether the iteration is finished or not | |
41 | virtual Bool_t IsDone() const; | |
42 | ||
43 | /// Nothing is actually done in the AddErrorMessage method because we log | |
44 | /// the error messages as we find them in AliDecoderEventHandler::OnError(). | |
45 | virtual void AddErrorMessage() {}; | |
46 | ||
47 | /// Advance one step in the iteration. Returns false if finished. | |
48 | virtual Bool_t Next(Int_t& busPatchId, | |
49 | UShort_t& manuId, UChar_t& manuChannel, | |
50 | UShort_t& adc); | |
51 | ||
52 | /// Returns the next batch of decoded channel data. | |
53 | virtual UInt_t Next(const AliChannelInfo*& channels); | |
54 | ||
55 | /// Return maximum number of blocks per DDL allowed. | |
56 | virtual Int_t GetMaxBlock() const { return (Int_t) fDecoder.MaxBlocks(); } | |
57 | /// Return maximum number of Dsp per block allowed. | |
58 | virtual Int_t GetMaxDsp() const { return (Int_t) fDecoder.MaxDSPs(); } | |
59 | /// Return maximum number of Buspatch per Dsp allowed. | |
60 | virtual Int_t GetMaxBus() const { return (Int_t) fDecoder.MaxBusPatches(); } | |
61 | ||
62 | /// Set maximum number of blocks per DDL allowed. | |
63 | virtual void SetMaxBlock(Int_t blk) { fDecoder.MaxBlocks( (UInt_t) blk ); } | |
64 | /// Set maximum number of Dsp per block allowed. | |
65 | virtual void SetMaxDsp(Int_t dsp) { fDecoder.MaxDSPs( (UInt_t) dsp ); } | |
66 | /// Set maximum number of Buspatch per Dsp allowed. | |
67 | virtual void SetMaxBus(Int_t bus) { fDecoder.MaxBusPatches( (UInt_t) bus ); } | |
68 | ||
69 | /// Return number of the current DDL. | |
70 | virtual Int_t GetDDL() const { return fDDL - 1; } | |
71 | ||
72 | /// check error/Warning presence | |
73 | virtual Bool_t IsErrorMessage() const { return fHadError; } | |
74 | ||
75 | private: | |
76 | ||
77 | // Do not allow copying of this class. | |
78 | /// Not implemented | |
79 | AliMUONRawStreamTrackerHP(const AliMUONRawStreamTrackerHP& stream); | |
80 | /// Not implemented | |
81 | AliMUONRawStreamTrackerHP& operator = (const AliMUONRawStreamTrackerHP& stream); | |
82 | ||
83 | /// This is the custom event handler (callback interface) class which | |
84 | /// unpacks raw data words and fills an internal buffer with decoded digits | |
85 | /// as they are decoded by the high performance decoder. | |
86 | /// Any errors are logged to the parent AliMUONVRawStreamTracker, so one | |
87 | /// must set this pointer appropriately before decoding and DDL payload. | |
88 | class AliDecoderEventHandler : public AliMUONTrackerDDLDecoderEventHandler | |
89 | { | |
90 | public: | |
91 | ||
92 | /// Default constructor. | |
93 | AliDecoderEventHandler(); | |
94 | /// Default destructor. | |
95 | virtual ~AliDecoderEventHandler(); | |
96 | ||
97 | /// Sets the raw stream object which should be the parent of this class. | |
98 | void SetRawStream(AliMUONVRawStreamTracker* rawStream) { fRawStream = rawStream; } | |
99 | ||
100 | /// Return the number of channels in the buffer returned by Channels(). | |
101 | UInt_t ChannelCount() const { return fChannelCount; } | |
102 | ||
103 | /// Return the buffer of decoded channel data. | |
104 | const AliChannelInfo* Channels() const { return fChannelBuffer; } | |
105 | ||
106 | // The following methods are inherited from AliMUONTrackerDDLDecoderEventHandler: | |
107 | ||
108 | /// New buffer handler. | |
109 | void OnNewBuffer(const void* buffer, UInt_t bufferSize); | |
110 | ||
111 | /// New bus patch handler. | |
112 | void OnNewBusPatch(const AliMUONBusPatchHeaderStruct* header, const void* data); | |
113 | ||
114 | /// Raw data word handler. | |
115 | void OnData(UInt_t data); | |
116 | ||
117 | /// Error handler. | |
118 | void OnError(ErrorCode error, const void* location); | |
119 | ||
120 | private: | |
121 | ||
122 | // Do not allow copying of this class. | |
123 | /// Not implemented | |
124 | AliDecoderEventHandler(const AliDecoderEventHandler& /*obj*/); | |
125 | /// Not implemented | |
126 | AliDecoderEventHandler& operator = (const AliDecoderEventHandler& /*obj*/); | |
127 | ||
128 | Int_t fBusPatchId; //!< The bus patch ID of the current bus patch being decoded. | |
129 | UInt_t fChannelCount; //!< Number of elements in fChannelBuffer. | |
130 | UInt_t fMaxChannels; //!< Maximum number of elements that can be stored in fChannelBuffer. | |
131 | AliChannelInfo* fChannelBuffer; //!< Buffer of decoded channel structures. | |
132 | AliMUONVRawStreamTracker* fRawStream; //!< Pointer to the parent raw stream object. | |
133 | const void* fBufferStart; //!< Pointer to the start of the current DDL payload buffer. | |
134 | }; | |
135 | ||
136 | AliMUONTrackerDDLDecoder<AliDecoderEventHandler> fDecoder; //!< The decoder for the DDL payload. | |
137 | Int_t fDDL; //!< The current DDL number being handled. | |
138 | UInt_t fCurrentChannel; //!< The current channel to return by Next(). | |
139 | Int_t fBufferSize; //!< This is the buffer size in bytes of fBuffer. | |
140 | UChar_t* fBuffer; //!< This is the buffer in which we store the DDL payload read from AliRawReader. | |
141 | Bool_t fHadError; //!< Flag indicating if there was a decoding error or not. | |
142 | ||
143 | ClassDef(AliMUONRawStreamTrackerHP, 0) // High performance decoder for reading MUON raw digits from tracking chamber DDL data. | |
144 | }; | |
145 | ||
146 | #endif // ALIMUONRAWSTREAMTRACKERHP_H |