]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/MUONRawStreamTracker.C
RAW QA only for calibration events
[u/mrichter/AliRoot.git] / MUON / MUONRawStreamTracker.C
... / ...
CommitLineData
1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15
16// $Id$
17
18/// \ingroup macros
19/// \file MUONRawStreamTracker.C
20/// \brief Macro for reading tracker raw data
21///
22/// \author Ch. Finck, Subatech Febuary
23///
24/// Added example routines to show how to use the interface of the high
25/// performance decoder AliMUONRawStreamTrackerHP.
26/// by Artur Szostak <artursz@iafrica.com>
27///
28/// This macro is interfaced with AliRawReader for RAW
29///
30/// There are 2 ways of reading the data:
31/// - one where each intermediate structure (block, dsp, buspatch) is looped over
32/// - and one, using an iterator, where we're directly accessing the pad informations
33/// (charge).
34///
35
36
37#if !defined(__CINT__) || defined(__MAKECINT__)
38
39// RAW includes
40#include "AliRawReader.h"
41
42// MUON includes
43#include "AliMUONRawStreamTrackerHP.h"
44#include "TStopwatch.h"
45
46#endif
47
48void MUONRawStreamTrackerExpert(TString fileName = "./", Int_t maxEvent = 1000,
49 Int_t minDDL = 0, Int_t maxDDL = 19)
50{
51 /// This routine shows how to use the decoder's expert interface.
52
53 TStopwatch timer;
54 timer.Start(kTRUE);
55
56 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
57
58 // raw stream
59 AliMUONRawStreamTrackerHP rawStream(rawReader);
60
61 // light weight interfaces to headers
62 const AliMUONRawStreamTrackerHP::AliBlockHeader* blkHeader = 0x0;
63 const AliMUONRawStreamTrackerHP::AliDspHeader* dspHeader = 0x0;
64 const AliMUONRawStreamTrackerHP::AliBusPatch* busStruct = 0x0;
65
66 // Loop over events
67 Int_t iEvent = 0;
68 Int_t dataSize;
69
70 while (rawReader->NextEvent()) {
71
72 if (iEvent == maxEvent)
73 break;
74
75 printf("Event %d\n",iEvent++);
76
77 // read DDL while < 20 DDL
78 while(rawStream.NextDDL()) {
79
80 if (rawStream.GetDDL() < minDDL || rawStream.GetDDL() > maxDDL)
81 continue;
82
83 printf("\niDDL %d\n", rawStream.GetDDL());
84
85 // loop over block structure
86 Int_t nBlock = rawStream.GetBlockCount();
87 for(Int_t iBlock = 0; iBlock < nBlock ;iBlock++){
88
89 blkHeader = rawStream.GetBlockHeader(iBlock);
90 printf("Block %d Total length %d\n",iBlock,blkHeader->GetTotalLength());
91
92 // loop over DSP structure
93 Int_t nDsp = rawStream.GetDspCount(iBlock);
94 for(Int_t iDsp = 0; iDsp < nDsp ;iDsp++){ //DSP loop
95
96 dspHeader = blkHeader->GetDspHeader(iDsp);
97 printf("Dsp %d length %d error word %d\n",iDsp,dspHeader->GetTotalLength(), dspHeader->GetErrorWord());
98
99 // loop over BusPatch structure
100 Int_t nBusPatch = rawStream.GetBusPatchCount(iBlock, iDsp);
101 for(Int_t iBusPatch = 0; iBusPatch < nBusPatch; iBusPatch++) {
102
103 busStruct = dspHeader->GetBusPatch(iBusPatch);
104
105 // loop over data
106 dataSize = busStruct->GetLength();
107 for (Int_t iData = 0; iData < dataSize; iData++) {
108
109 Int_t manuId = busStruct->GetManuId(iData);
110 Int_t channelId = busStruct->GetChannelId(iData);
111 Int_t charge = busStruct->GetCharge(iData);
112 printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
113 busStruct->GetBusPatchId(),
114 manuId,
115 channelId, charge);
116 } // iData
117 } // iBusPatch
118 } // iDsp
119 } // iBlock
120 } // NextDDL
121 }// NextEvent
122
123 delete rawReader;
124 timer.Print();
125}
126
127
128void MUONRawStreamTrackerExpert2(TString fileName = "./", Int_t maxEvent = 1000,
129 Int_t minDDL = 0, Int_t maxDDL = 19)
130{
131 /// This routine shows an alternate way to iterate over the DDL structures
132 /// compared to MUONRawStreamTrackerExpert().
133
134 TStopwatch timer;
135 timer.Start(kTRUE);
136
137 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
138
139 // raw stream
140 AliMUONRawStreamTrackerHP rawStream(rawReader);
141
142 // light weight interfaces to headers
143 const AliMUONRawStreamTrackerHP::AliBlockHeader* blkHeader = 0x0;
144 const AliMUONRawStreamTrackerHP::AliDspHeader* dspHeader = 0x0;
145 const AliMUONRawStreamTrackerHP::AliBusPatch* busStruct = 0x0;
146
147 // Loop over events
148 Int_t iEvent = 0;
149 Int_t dataSize;
150
151 while (rawReader->NextEvent()) {
152
153 if (iEvent == maxEvent)
154 break;
155
156 printf("Event %d\n",iEvent++);
157
158 // read DDL while < 20 DDL
159 while(rawStream.NextDDL()) {
160
161 if (rawStream.GetDDL() < minDDL || rawStream.GetDDL() > maxDDL)
162 continue;
163
164 printf("\niDDL %d\n", rawStream.GetDDL());
165
166 // loop over block structure
167 Int_t nBlock = rawStream.GetBlockCount();
168 for(Int_t iBlock = 0; iBlock < nBlock ;iBlock++){
169
170 blkHeader = rawStream.GetBlockHeader(iBlock);
171 printf("Block %d Total length %d\n",iBlock,blkHeader->GetTotalLength());
172
173 // loop over DSP structure
174 Int_t nDsp = rawStream.GetDspCount(iBlock);
175 for(Int_t iDsp = 0; iDsp < nDsp ;iDsp++){ //DSP loop
176
177 dspHeader = rawStream.GetDspHeader(iBlock, iDsp);
178 printf("Dsp %d length %d error word %d\n",iDsp,dspHeader->GetTotalLength(), dspHeader->GetErrorWord());
179
180 // loop over BusPatch structure
181 Int_t nBusPatch = rawStream.GetBusPatchCount(iBlock, iDsp);
182 for(Int_t iBusPatch = 0; iBusPatch < nBusPatch; iBusPatch++) {
183
184 busStruct = rawStream.GetBusPatch(iBlock, iDsp, iBusPatch);
185
186 // loop over data
187 dataSize = busStruct->GetLength();
188 for (Int_t iData = 0; iData < dataSize; iData++) {
189
190 Int_t manuId = busStruct->GetManuId(iData);
191 Int_t channelId = busStruct->GetChannelId(iData);
192 Int_t charge = busStruct->GetCharge(iData);
193 printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
194 busStruct->GetBusPatchId(),
195 manuId,
196 channelId, charge);
197 } // iData
198 } // iBusPatch
199 } // iDsp
200 } // iBlock
201 } // NextDDL
202 }// NextEvent
203
204 delete rawReader;
205 timer.Print();
206}
207
208
209void MUONRawStreamTrackerExpert3(TString fileName = "./", Int_t maxEvent = 1000,
210 Int_t minDDL = 0, Int_t maxDDL = 19)
211{
212 /// This routine shows yet another alternate way to iterate over the DDL
213 /// structures compared to MUONRawStreamTrackerExpert().
214
215 TStopwatch timer;
216 timer.Start(kTRUE);
217
218 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
219
220 // raw stream
221 AliMUONRawStreamTrackerHP rawStream(rawReader);
222
223 // light weight interfaces to headers
224 const AliMUONRawStreamTrackerHP::AliBlockHeader* blkHeader = 0x0;
225 const AliMUONRawStreamTrackerHP::AliDspHeader* dspHeader = 0x0;
226 const AliMUONRawStreamTrackerHP::AliBusPatch* busStruct = 0x0;
227
228 // Loop over events
229 Int_t iEvent = 0;
230 Int_t dataSize;
231
232 while (rawReader->NextEvent()) {
233
234 if (iEvent == maxEvent)
235 break;
236
237 printf("Event %d\n",iEvent++);
238
239 // read DDL while < 20 DDL
240 while(rawStream.NextDDL()) {
241
242 if (rawStream.GetDDL() < minDDL || rawStream.GetDDL() > maxDDL)
243 continue;
244
245 printf("\niDDL %d\n", rawStream.GetDDL());
246
247 // loop over block structure
248 Int_t iBlock = 0;
249 blkHeader = rawStream.GetFirstBlockHeader();
250 while (blkHeader != NULL)
251 {
252 printf("Block %d Total length %d\n",iBlock,blkHeader->GetTotalLength());
253
254 // loop over DSP structure
255 Int_t iDsp = 0;
256 dspHeader = blkHeader->GetFirstDspHeader();
257 while (dspHeader != NULL)
258 {
259 printf("Dsp %d length %d error word %d\n",iDsp,dspHeader->GetTotalLength(), dspHeader->GetErrorWord());
260
261 // loop over BusPatch structure
262 Int_t iBusPatch = 0;
263 busStruct = dspHeader->GetFirstBusPatch();
264 while (busStruct != NULL)
265 {
266 // loop over data
267 dataSize = busStruct->GetLength();
268 for (Int_t iData = 0; iData < dataSize; iData++) {
269
270 Int_t manuId = busStruct->GetManuId(iData);
271 Int_t channelId = busStruct->GetChannelId(iData);
272 Int_t charge = busStruct->GetCharge(iData);
273 printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
274 busStruct->GetBusPatchId(),
275 manuId,
276 channelId, charge);
277 } // iData
278 busStruct = busStruct->Next();
279 iBusPatch++;
280 } // iBusPatch
281 dspHeader = dspHeader->Next();
282 iDsp++;
283 } // iDsp
284 blkHeader = blkHeader->Next();
285 iBlock++;
286 } // iBlock
287 } // NextDDL
288 }// NextEvent
289
290 delete rawReader;
291 timer.Print();
292}
293
294
295void MUONRawStreamTrackerSimple(TString fileName = "./", Int_t maxEvent = 1000)
296{
297 /// This routine shows how to use the high performance decoder's simple interface.
298
299 TStopwatch timer;
300 timer.Start(kTRUE);
301
302 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
303
304 // raw stream
305 AliMUONRawStreamTrackerHP rawStream(rawReader);
306
307 // Loop over events
308 Int_t iEvent = 0;
309
310 while (rawReader->NextEvent()) {
311
312 if (iEvent == maxEvent)
313 break;
314
315 printf("Event %d\n",iEvent++);
316
317 Int_t busPatch;
318 UShort_t manuId, adc;
319 UChar_t manuChannel;
320
321 rawStream.First();
322
323 while ( rawStream.Next(busPatch,manuId,manuChannel,adc) )
324 {
325 printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
326 busPatch,manuId,manuChannel, adc);
327 }
328 }
329
330 delete rawReader;
331 timer.Print();
332}
333
334
335void MUONRawStreamTrackerSimple2(TString fileName = "./", Int_t maxEvent = 1000)
336{
337 /// This routine is an alternative to MUONRawStreamTrackerSimple() which is even faster.
338
339 TStopwatch timer;
340 timer.Start(kTRUE);
341
342 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
343
344 // raw stream
345 AliMUONRawStreamTrackerHP rawStream(rawReader);
346
347 // Loop over events
348 Int_t iEvent = 0;
349
350 while (rawReader->NextEvent()) {
351
352 if (iEvent == maxEvent)
353 break;
354
355 printf("Event %d\n",iEvent++);
356
357 UShort_t manuId, adc;
358 UChar_t manuChannel;
359
360 rawStream.First();
361 const AliMUONRawStreamTrackerHP::AliBusPatch* buspatch = NULL;
362 while ((buspatch = rawStream.Next()) != NULL)
363 {
364 for (UInt_t i = 0; i < buspatch->GetDataCount(); i++)
365 {
366 buspatch->GetData(i, manuId, manuChannel, adc);
367 printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
368 buspatch->GetBusPatchId(), manuId, manuChannel, adc);
369 }
370 }
371 }
372
373 delete rawReader;
374 timer.Print();
375}
376