--- /dev/null
+// $Id$
+/*
+ * Test macro for the AltroChannelSelector component
+ *
+ * Usage:
+ * aliroot -b -q altro-channel-selection.C | tee altro-channel-selection.C
+ *
+ * The first version allows to write a fake file with the list of the
+ * selected pads. Later it will be extended to use the ClusterFinder
+ * or, better, a separate component.
+ *
+ * Matthias.Richter@ift.uib.no
+ */
+{
+ // this is just a tool to switch the logging systems
+ AliHLTLogging log;
+ //log.SwitchAliLog(0);
+
+ AliHLTSystem gHLT;
+ //gHLT.SetGlobalLoggingLevel(0x3c);
+ //gHLT.SetFrameworkLog(0x3c);
+
+ // load the component library
+ gHLT.LoadComponentLibraries("libAliHLTTPC.so");
+
+ // create a dummy pad selection list
+ const char* dummySelectionList="/tmp/active-pads.dat";
+ FILE* fp = fopen(dummySelectionList, "w");
+ if (fp) {
+ UInt_t row=0;
+ UInt_t pad=0;
+
+ row=28, pad=5;
+ fwrite(&row, sizeof(UInt_t), 1, fp);
+ fwrite(&pad, sizeof(UInt_t), 1, fp);
+
+ row=28, pad=6;
+ fwrite(&row, sizeof(UInt_t), 1, fp);
+ fwrite(&pad, sizeof(UInt_t), 1, fp);
+
+ row=28, pad=7;
+ fwrite(&row, sizeof(UInt_t), 1, fp);
+ fwrite(&pad, sizeof(UInt_t), 1, fp);
+
+ row=29, pad=42;
+ fwrite(&row, sizeof(UInt_t), 1, fp);
+ fwrite(&pad, sizeof(UInt_t), 1, fp);
+
+ row=29, pad=43;
+ fwrite(&row, sizeof(UInt_t), 1, fp);
+ fwrite(&pad, sizeof(UInt_t), 1, fp);
+
+ fclose(fp);
+ } else {
+ cout << "can not open file " << dummySelectionList << " for writing" << endl;
+ return;
+ }
+
+ // direct dump switch allows to bypass the selector component
+ bool directDump=false;
+
+ // the configuration
+ int iMinSlice=0;
+ int iMaxSlice=0;
+ int iMinPart=0;
+ int iMaxPart=5;
+ TString writerInput;
+ for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
+ for (int part=iMinPart; part<=iMaxPart; part++) {
+ TString arg, publisher, selector, activepads;
+ TString selectorInput;
+
+ // raw data publisher components
+ int ddlno=768;
+ if (part>1) ddlno+=72+4*slice+(part-2);
+ else ddlno+=2*slice+part;
+ arg.Form("-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x%02x%02x%02x%02x -datafile TPC_%d.ddl", slice, slice, part, part, ddlno);
+ publisher.Form("DP_%02d_%d", slice, part);
+ AliHLTConfiguration pubconf(publisher.Data(), "FilePublisher", NULL , arg.Data());
+
+ // publisher for a dummy active pad list
+ activepads.Form("APP_%02d_%d", slice, part);
+ arg.Form("-datatype 'ACTIVPAD' 'TPC ' -dataspec 0x%02x%02x%02x%02x -datafile %s", slice, slice, part, part, dummySelectionList);
+ AliHLTConfiguration appconf(activepads.Data(), "FilePublisher", NULL , arg.Data());
+
+
+ if (selectorInput.Length()>0) selectorInput+=" ";
+ selectorInput+=publisher; selectorInput+=" ";
+ selectorInput+=activepads;
+
+ // the selector configuration
+ selector.Form("CHANNELSELECT_%02d_%d", slice, part);
+ AliHLTConfiguration channelselect(selector.Data(), "AltroChannelSelector", selectorInput.Data(), "-rawreadermode 4");
+
+ // add either the raw file directly to output or the filtered one
+ if (writerInput.Length()>0) writerInput+=" ";
+ if (directDump) {
+ writerInput+=publisher;
+ } else {
+ writerInput+=selector;
+ }
+ }
+ }
+
+ // the writer configuration
+ AliHLTConfiguration digitdump("digitdump", "TPCDigitDump" , writerInput.Data(), "-rawreadermode 4 -specfmt=_0x%08x -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
+ //AliHLTConfiguration digitdump("digitdump", "FileWriter" , writerInput.Data(), "-specfmt=_0x%08x -subdir=out_%d -blcknofmt=_0x%x -idfmt=_0x%08x");
+ gHLT.BuildTaskList("digitdump");
+ gHLT.Run();
+
+ // delete temporary file
+ TString shellcmd;
+ shellcmd.Form("rm %s", dummySelectionList);
+ gSystem->Exec(shellcmd.Data());
+}