AltroChannelSelector component moved to libAliHLTRCU
[u/mrichter/AliRoot.git] / HLT / RCU / macros / altro-channel-selection.C
CommitLineData
6098f449 1// $Id$
3dcae0cc 2/**
6098f449 3 * Test macro for the AltroChannelSelector component
4 *
5 * Usage:
6 * aliroot -b -q altro-channel-selection.C | tee altro-channel-selection.C
7 *
3dcae0cc 8 * The macro expects simulated TPC raw data in the form TPC_<ddlno>.dll in the
9 * current directory, you might need to start the macro in one of the raw<x>
10 * folders. You can easily change the sectors and readout partitions below.
11 *
12 * In order to apply the macro on real RCU v1 data (only on trailer word)
13 * you have to specify the trailer length explicitly, look for the
14 *
6098f449 15 * The first version allows to write a fake file with the list of the
3dcae0cc 16 * selected channels. Later it will be extended to use the ClusterFinder
6098f449 17 * or, better, a separate component.
18 *
3dcae0cc 19 * Please note that this macro uses also the TPC module, but this does not
20 * imply dependencies to the libAliHLTTPC.
21 *
6098f449 22 * Matthias.Richter@ift.uib.no
23 */
24{
25 // this is just a tool to switch the logging systems
26 AliHLTLogging log;
27 //log.SwitchAliLog(0);
28
29 AliHLTSystem gHLT;
30 //gHLT.SetGlobalLoggingLevel(0x3c);
31 //gHLT.SetFrameworkLog(0x3c);
32
33 // load the component library
34 gHLT.LoadComponentLibraries("libAliHLTTPC.so");
3dcae0cc 35 gHLT.LoadComponentLibraries("libAliHLTRCU.so");
6098f449 36
37 // create a dummy pad selection list
3dcae0cc 38 const char* dummySelectionList="/tmp/active-channels.dat";
6098f449 39 FILE* fp = fopen(dummySelectionList, "w");
40 if (fp) {
3dcae0cc 41 UShort_t channel=5;
42 fwrite(&channel, sizeof(UShort_t), 1, fp);
6098f449 43
3dcae0cc 44 UShort_t channel=25;
45 fwrite(&channel, sizeof(UShort_t), 1, fp);
6098f449 46
3dcae0cc 47 UShort_t channel=56;
48 fwrite(&channel, sizeof(UShort_t), 1, fp);
6098f449 49
3dcae0cc 50 UShort_t channel=78;
51 fwrite(&channel, sizeof(UShort_t), 1, fp);
6098f449 52
3dcae0cc 53 UShort_t channel=100;
54 fwrite(&channel, sizeof(UShort_t), 1, fp);
6098f449 55
56 fclose(fp);
57 } else {
58 cout << "can not open file " << dummySelectionList << " for writing" << endl;
59 return;
60 }
61
62 // direct dump switch allows to bypass the selector component
63 bool directDump=false;
64
3dcae0cc 65 // choose if you want to dump to file or translate digits to text file
66 bool textDump=true;
67
6098f449 68 // the configuration
69 int iMinSlice=0;
70 int iMaxSlice=0;
71 int iMinPart=0;
72 int iMaxPart=5;
73 TString writerInput;
74 for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
75 for (int part=iMinPart; part<=iMaxPart; part++) {
76 TString arg, publisher, selector, activepads;
77 TString selectorInput;
78
79 // raw data publisher components
80 int ddlno=768;
81 if (part>1) ddlno+=72+4*slice+(part-2);
82 else ddlno+=2*slice+part;
83 arg.Form("-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -datafile TPC_%d.ddl", slice, slice, part, part, ddlno);
84 publisher.Form("DP_%02d_%d", slice, part);
85 AliHLTConfiguration pubconf(publisher.Data(), "FilePublisher", NULL , arg.Data());
86
87 // publisher for a dummy active pad list
88 activepads.Form("APP_%02d_%d", slice, part);
3dcae0cc 89 arg.Form("-datatype 'HWADDR16' 'TPC ' -dataspec 0x%02x%02x%02x%02x -datafile %s", slice, slice, part, part, dummySelectionList);
6098f449 90 AliHLTConfiguration appconf(activepads.Data(), "FilePublisher", NULL , arg.Data());
91
92
93 if (selectorInput.Length()>0) selectorInput+=" ";
94 selectorInput+=publisher; selectorInput+=" ";
95 selectorInput+=activepads;
96
97 // the selector configuration
98 selector.Form("CHANNELSELECT_%02d_%d", slice, part);
3dcae0cc 99 AliHLTConfiguration channelselect(selector.Data(), "AltroChannelSelector", selectorInput.Data(), "");
6098f449 100
101 // add either the raw file directly to output or the filtered one
102 if (writerInput.Length()>0) writerInput+=" ";
103 if (directDump) {
104 writerInput+=publisher;
105 } else {
106 writerInput+=selector;
107 }
108 }
109 }
110
111 // the writer configuration
3dcae0cc 112 if (textDump)
113 AliHLTConfiguration digitdump("digitdump", "TPCDigitDump" , writerInput.Data(), "-specfmt=_0x%08x -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
114 else
115 AliHLTConfiguration digitdump("digitdump", "FileWriter" , writerInput.Data(), "-specfmt=_0x%08x -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
116
117 // build the ask list and execute
6098f449 118 gHLT.BuildTaskList("digitdump");
119 gHLT.Run();
120
121 // delete temporary file
122 TString shellcmd;
123 shellcmd.Form("rm %s", dummySelectionList);
124 gSystem->Exec(shellcmd.Data());
125}