]>
Commit | Line | Data |
---|---|---|
a63da6d6 | 1 | #ifndef AliHLTMUONRAWDATAHISTOCOMPONENT_H |
2 | #define AliHLTMUONRAWDATAHISTOCOMPONENT_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 AliHLTMUONRawDataHistoComponent.h | |
11 | /// @author Artur Szostak <artursz@iafrica.com> | |
12 | /// @date 30 April 2008 | |
13 | /// @brief Declaration of a component to generate basic monitoring histograms of raw data. | |
14 | /// | |
15 | ||
16 | #include "AliHLTMUONProcessor.h" | |
17 | #include "AliHLTMUONDataTypes.h" | |
7989fd8e | 18 | #include "AliMUONTrackerDDLDecoder.h" |
19 | #include "AliMUONTriggerDDLDecoder.h" | |
20 | #include "TH1D.h" | |
a63da6d6 | 21 | |
22 | /** | |
23 | * @class AliHLTMUONRawDataHistoComponent | |
24 | * @brief Dimuon HLT component for generating basic monitoring histograms for raw data. | |
25 | */ | |
26 | class AliHLTMUONRawDataHistoComponent : public AliHLTMUONProcessor | |
27 | { | |
28 | public: | |
29 | AliHLTMUONRawDataHistoComponent(); | |
30 | virtual ~AliHLTMUONRawDataHistoComponent(); | |
31 | ||
32 | // Public functions to implement the AliHLTProcessor interface. | |
33 | // These functions are required for the registration process. | |
34 | virtual const char* GetComponentID(); | |
35 | virtual void GetInputDataTypes(AliHLTComponentDataTypeList& list); | |
36 | virtual AliHLTComponentDataType GetOutputDataType(); | |
37 | virtual void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier); | |
38 | virtual AliHLTComponent* Spawn(); | |
39 | ||
40 | protected: | |
41 | ||
42 | // Protected functions to implement the AliHLTProcessor interface. | |
43 | // These functions provide initialization as well as the actual processing | |
44 | // capabilities of the component. | |
45 | virtual int DoInit(int argc, const char** argv); | |
46 | virtual bool IgnoreArgument(const char* arg) const; | |
47 | virtual int DoDeinit(); | |
48 | virtual int DoEvent( | |
49 | const AliHLTComponentEventData& evtData, | |
50 | AliHLTComponentTriggerData& trigData | |
51 | ); | |
52 | ||
53 | using AliHLTProcessor::DoEvent; | |
54 | ||
55 | private: | |
56 | ||
7989fd8e | 57 | class AliDecoderHandler : public AliHLTLogging |
58 | { | |
59 | public: | |
60 | ||
61 | AliDecoderHandler() : AliHLTLogging(), fErrorHist(NULL) {} | |
62 | virtual ~AliDecoderHandler() {} | |
63 | ||
64 | /// Returns the error codes histogram. | |
65 | TH1D* ErrorHist() const { return fErrorHist; } | |
66 | ||
67 | /// Sets the error codes histogram. | |
68 | void ErrorHist(TH1D* hist) { fErrorHist = hist; } | |
69 | ||
70 | protected: | |
71 | ||
72 | /// Fills the error histogram with the given error code. | |
73 | void FillErrorHist(Int_t code); | |
74 | ||
75 | TH1D* fErrorHist; /// Histogram of error codes found. | |
76 | ||
77 | private: | |
78 | ||
79 | // Do not allow copying of this object. | |
80 | /// Not implemented. | |
81 | AliDecoderHandler(const AliDecoderHandler& obj); | |
82 | /// Not implemented. | |
83 | AliDecoderHandler& operator = (const AliDecoderHandler& obj); | |
84 | }; | |
85 | ||
86 | class AliTrackerDecoderHandler : | |
87 | public AliMUONTrackerDDLDecoderEventHandler, public AliDecoderHandler | |
88 | { | |
89 | public: | |
90 | AliTrackerDecoderHandler() : | |
91 | AliMUONTrackerDDLDecoderEventHandler(), | |
92 | AliDecoderHandler(), | |
93 | fManuHist(NULL), | |
94 | fSignalHist(NULL) | |
95 | {} | |
96 | ||
97 | virtual ~AliTrackerDecoderHandler() {} | |
98 | ||
99 | /// Returns the signals per MANU histogram. | |
100 | TH1D* ManuHist() const { return fManuHist; } | |
101 | ||
102 | /// Sets the signals per MANU histogram. | |
103 | void ManuHist(TH1D* hist) { fManuHist = hist; } | |
104 | ||
105 | /// Returns the signals histogram. | |
106 | TH1D* SignalHist() const { return fSignalHist; } | |
107 | ||
108 | /// Sets the signals histogram. | |
109 | void SignalHist(TH1D* hist) { fSignalHist = hist; } | |
110 | ||
111 | // Methods inherited from AliMUONTrackerDDLDecoderEventHandler: | |
112 | ||
113 | /// Called for each new data word found. | |
114 | void OnData(UInt_t data, bool /*parityError*/); | |
115 | ||
116 | /// Fills the fErrorHist histogram with the error code received. | |
117 | void OnError(ErrorCode code, const void* /*location*/) { FillErrorHist(Int_t(code)); } | |
118 | ||
119 | private: | |
120 | ||
121 | // Do not allow copying of this object. | |
122 | /// Not implemented. | |
123 | AliTrackerDecoderHandler(const AliTrackerDecoderHandler& obj); | |
124 | /// Not implemented. | |
125 | AliTrackerDecoderHandler& operator = (const AliTrackerDecoderHandler& obj); | |
126 | ||
127 | TH1D* fManuHist; /// Histogram of signal distribution per MANU. | |
128 | TH1D* fSignalHist; /// Histogram of the ADC signal distribution. | |
129 | }; | |
130 | ||
131 | class AliTriggerDecoderHandler : | |
132 | public AliMUONTriggerDDLDecoderEventHandler, public AliDecoderHandler | |
133 | { | |
134 | public: | |
135 | AliTriggerDecoderHandler() : | |
136 | AliMUONTriggerDDLDecoderEventHandler(), | |
137 | AliDecoderHandler() | |
138 | {} | |
139 | ||
140 | virtual ~AliTriggerDecoderHandler() {} | |
141 | ||
142 | // Methods inherited from AliMUONTriggerDDLDecoderEventHandler: | |
143 | ||
144 | /// Fills the fErrorHist histogram with the error code received. | |
145 | void OnError(ErrorCode code, const void* /*location*/) { FillErrorHist(Int_t(code)); } | |
146 | ||
147 | private: | |
148 | ||
149 | // Do not allow copying of this object. | |
150 | /// Not implemented. | |
151 | AliTriggerDecoderHandler(const AliTriggerDecoderHandler& obj); | |
152 | /// Not implemented. | |
153 | AliTriggerDecoderHandler& operator = (const AliTriggerDecoderHandler& obj); | |
154 | }; | |
155 | ||
a63da6d6 | 156 | // Do not allow copying of this class. |
157 | AliHLTMUONRawDataHistoComponent(const AliHLTMUONRawDataHistoComponent& /*obj*/); | |
158 | AliHLTMUONRawDataHistoComponent& operator = (const AliHLTMUONRawDataHistoComponent& /*obj*/); | |
159 | ||
160 | void ProcessTrackerDDL(const AliHLTComponentBlockData* block); | |
161 | void ProcessTriggerDDL(const AliHLTComponentBlockData* block); | |
162 | void FreeObjects(); | |
163 | ||
7989fd8e | 164 | AliMUONTrackerDDLDecoder<AliTrackerDecoderHandler> fTrackerDecoder; // Raw data decoder for the tracker data. |
165 | AliMUONTriggerDDLDecoder<AliTriggerDecoderHandler> fTriggerDecoder; // Raw data decoder for the trigger data. | |
166 | ||
a63da6d6 | 167 | double fLastPublishTime; /// Timestamp for the last time we published data (seconds). |
168 | double fCurrentEventTime; /// Timestamp for the current event being processed (seconds). | |
169 | double fPublishDelay; /// Delay in second to wait between publishing data. | |
170 | TH1D* fErrorHist[22]; /// Histograms for error codes per DDL. | |
171 | TH1D* fManuHist[20]; /// Histograms for MANU distributions per DDL. | |
172 | TH1D* fSignalHist[20]; /// Histograms for signal distributions per DDL. | |
7989fd8e | 173 | bool fSuppressEmptyHists; /// Flag indicating if empty histograms should be published or not. |
174 | bool fProcessDataEventsOnly; /// Flag indicating if only data events should be processed. | |
a63da6d6 | 175 | |
176 | ClassDef(AliHLTMUONRawDataHistoComponent, 0); // Trigger decision component for the dimuon HLT. | |
177 | }; | |
178 | ||
7989fd8e | 179 | //----------------------------------------------------------------------------- |
180 | ||
181 | inline void AliHLTMUONRawDataHistoComponent::AliDecoderHandler::FillErrorHist(Int_t code) | |
182 | { | |
183 | /// Fills the error code into the error code histogram. | |
184 | ||
185 | assert(fErrorHist != NULL); | |
186 | Int_t mincode = Int_t( fErrorHist->GetXaxis()->GetBinCenter(1) ); | |
187 | Int_t maxcode = Int_t( fErrorHist->GetXaxis()->GetBinCenter(fErrorHist->GetNbinsX()) ); | |
188 | if (code < mincode or maxcode < code) | |
189 | { | |
190 | HLTError("Filling an error code which is out of range." | |
191 | " Received code %d, but expected it to be in the range [%d..%d]", | |
192 | int(code), mincode, maxcode | |
193 | ); | |
194 | } | |
195 | fErrorHist->Fill(code); | |
196 | } | |
197 | ||
198 | ||
199 | inline void AliHLTMUONRawDataHistoComponent::AliTrackerDecoderHandler::OnData( | |
200 | UInt_t data, bool /*parityError*/ | |
201 | ) | |
202 | { | |
203 | /// Fills the signals histogram and also the signal per MANU histogram. | |
204 | ||
205 | UInt_t minadc = UInt_t( fSignalHist->GetXaxis()->GetBinCenter(1) ); | |
206 | UInt_t maxadc = UInt_t( fSignalHist->GetXaxis()->GetBinCenter(fSignalHist->GetNbinsX()) ); | |
207 | UInt_t minmanu = UInt_t( fManuHist->GetXaxis()->GetBinCenter(1) ); | |
208 | UInt_t maxmanu = UInt_t( fManuHist->GetXaxis()->GetBinCenter(fManuHist->GetNbinsX()) ); | |
209 | ||
210 | UShort_t manuId; UChar_t channelId; UShort_t adc; | |
211 | UnpackADC(data, manuId, channelId, adc); | |
212 | ||
213 | if (adc < minadc or maxadc < adc) | |
214 | { | |
215 | HLTError("Filling a signal value which is out of range. Received ADC value" | |
216 | " of %d channels, but expected it to be in the range [%d..%d]", | |
217 | int(adc), minadc, maxadc | |
218 | ); | |
219 | } | |
220 | fSignalHist->Fill(adc); | |
221 | ||
222 | if (manuId < minmanu or maxmanu < manuId) | |
223 | { | |
224 | HLTError("Filling a MANU ID value which is out of range. Received" | |
225 | " value of %d, but expected it to be in the range [%d..%d]", | |
226 | int(manuId), minmanu, maxmanu | |
227 | ); | |
228 | } | |
229 | fManuHist->Fill(manuId); | |
230 | } | |
231 | ||
a63da6d6 | 232 | #endif // AliHLTMUONRAWDATAHISTOCOMPONENT_H |
7989fd8e | 233 |