3 * Test macro for the AltroChannelSelector component
6 * aliroot -b -q altro-channel-selection.C | tee altro-channel-selection.C
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.
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
15 * The first version allows to write a fake file with the list of the
16 * selected channels. Later it will be extended to use the ClusterFinder
17 * or, better, a separate component.
19 * Please note that this macro uses also the TPC module, but this does not
20 * imply dependencies to the libAliHLTTPC.
22 * Matthias.Richter@ift.uib.no
25 // this is just a tool to switch the logging systems
27 //log.SwitchAliLog(0);
30 //gHLT.SetGlobalLoggingLevel(0x3c);
31 //gHLT.SetFrameworkLog(0x3c);
33 // load the component library
34 gHLT.LoadComponentLibraries("libAliHLTTPC.so");
35 gHLT.LoadComponentLibraries("libAliHLTRCU.so");
37 // create a dummy pad selection list
38 const char* dummySelectionList="/tmp/active-channels.dat";
39 FILE* fp = fopen(dummySelectionList, "w");
42 fwrite(&channel, sizeof(UShort_t), 1, fp);
45 fwrite(&channel, sizeof(UShort_t), 1, fp);
48 fwrite(&channel, sizeof(UShort_t), 1, fp);
51 fwrite(&channel, sizeof(UShort_t), 1, fp);
54 fwrite(&channel, sizeof(UShort_t), 1, fp);
58 cout << "can not open file " << dummySelectionList << " for writing" << endl;
62 // direct dump switch allows to bypass the selector component
63 bool directDump=false;
65 // choose if you want to dump to file or translate digits to text file
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;
79 // raw data publisher components
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());
87 // publisher for a dummy active pad list
88 activepads.Form("APP_%02d_%d", slice, part);
89 arg.Form("-datatype 'HWADDR16' 'TPC ' -dataspec 0x%02x%02x%02x%02x -datafile %s", slice, slice, part, part, dummySelectionList);
90 AliHLTConfiguration appconf(activepads.Data(), "FilePublisher", NULL , arg.Data());
93 if (selectorInput.Length()>0) selectorInput+=" ";
94 selectorInput+=publisher; selectorInput+=" ";
95 selectorInput+=activepads;
97 // the selector configuration
98 selector.Form("CHANNELSELECT_%02d_%d", slice, part);
99 AliHLTConfiguration channelselect(selector.Data(), "AltroChannelSelector", selectorInput.Data(), "");
101 // add either the raw file directly to output or the filtered one
102 if (writerInput.Length()>0) writerInput+=" ";
104 writerInput+=publisher;
106 writerInput+=selector;
111 // the writer configuration
113 AliHLTConfiguration digitdump("digitdump", "TPCDigitDump" , writerInput.Data(), "-specfmt=_0x%08x -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
115 AliHLTConfiguration digitdump("digitdump", "FileWriter" , writerInput.Data(), "-specfmt=_0x%08x -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
117 // build the ask list and execute
118 gHLT.BuildTaskList("digitdump");
121 // delete temporary file
123 shellcmd.Form("rm %s", dummySelectionList);
124 gSystem->Exec(shellcmd.Data());