]>
Commit | Line | Data |
---|---|---|
f87ff2ec | 1 | // $Id$ |
2 | /** | |
3 | * Analyze RCU RAW data ddl files. | |
4 | * | |
5 | * Usage: | |
6 | * aliroot -b -q -l check-ddl.C'("filename")' | tee check-ddl.C | |
7 | * | |
8 | * Check an RCU ddl file and print out the channel content by using | |
9 | * the AliAltroDecoder. | |
10 | * | |
11 | * \b Note: The channel data has to be read in reverse order and is: | |
12 | * - length of a bunch | |
13 | * - end time bin of the bunch | |
14 | * - bunch data | |
15 | * | |
16 | * E.g. | |
17 | * <pre> | |
18 | * ---------- channel ---------- | |
19 | * 10 314 3 300 | |
20 | * 432 3 | |
21 | * </pre> | |
22 | * means two bunches, one at 432 signal 300 and one at 314 signal 10. | |
23 | * | |
24 | * @author Matthias.Richter@ift.uib.no | |
25 | * @ingroup alihlt_rcu | |
26 | */ | |
27 | void check_ddl(const char* filename=NULL) | |
28 | { | |
29 | if (!filename) { | |
30 | cout << "usage: aliroot -b -l -q check-ddl.C'(\"filename\")'" << endl; | |
31 | return; | |
32 | } | |
33 | ||
34 | TString param=filename; | |
35 | param+="?filetype=raw"; | |
36 | TFile file(param); | |
37 | if (file.IsZombie()) { | |
38 | cout << "can not open file " << filename << endl; | |
39 | return; | |
40 | } | |
41 | ||
42 | TArrayC buffer(file.GetSize()); | |
43 | if (file.ReadBuffer(buffer.GetArray(), buffer.GetSize())) { | |
44 | cout << "error reading file " << filename << endl; | |
45 | return; | |
46 | } | |
47 | ||
48 | AliAltroDecoder decoder; | |
49 | if (decoder.SetMemory((UChar_t*)buffer.GetArray(), (UInt_t)buffer.GetSize())<0) { | |
50 | cout << "error setting up decoder " << endl; | |
51 | return; | |
52 | } | |
53 | ||
54 | if (!decoder.Decode()) { | |
55 | cout << "error decoding file " << filename << endl; | |
56 | return; | |
57 | } | |
58 | ||
59 | cout << "RCU trailer size: " << decoder.GetRCUTrailerSize() << endl; | |
60 | ||
61 | AliAltroData channel; | |
62 | while (decoder.NextChannel(&channel)) { | |
63 | cout << "---------- channel " << channel.GetHadd() << " ----------" << endl; | |
64 | decoder.PrintInfo(channel, channel.GetDataSize(), 4); | |
65 | } | |
66 | } |