3 * @file extract-hltout-payload.C
4 * @brief Extraction of data blocks from HLTOUT
7 * Usage: aliroot -b -q extract-hltout-payload.C'("raw.root")' | tee extract-hltout-payload.log
10 * The macro stores all data blocks from the HLTOUT payload into separated
11 * folders for each event. The file names are derived from data type and
12 * specification of the block. Data is read from a raw reader. An input
13 * file can be specified as the first argument, default is "./" and reads
14 * ddl files through AliRawReaderFile.
16 * A selection criterion can be specified as second argument, the format
17 * of the selection string follows the arguments of the
18 * AliHLTOUTPublisherComponent except from the quote which need to be
19 * replaced by brackets due to CINT, e.g.
22 * aliroot -b -q extract-hltout-payload.C'("raw.root", "-datatype {DDL_RAW } ISDD")'
23 * aliroot -b -q extract-hltout-payload.C'("raw.root", "-origin {TPC }")'
26 * @author Matthias.Richter@ift.uib.no
29 void extract_hltout_payload(const char* input, const char* selection="", int maxEvent=-1)
31 /////////////////////////////////////////////////////////////////////////
32 /////////////////////////////////////////////////////////////////////////
34 // setup of the HLT system
35 AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
37 cerr << "fatal error: can not get HLT instance" << endl;
40 /////////////////////////////////////////////////////////////////////////
41 /////////////////////////////////////////////////////////////////////////
43 // the configuration chain
46 // the publisher configuration
47 arg.Form("%s", selection);
48 arg.ReplaceAll("{", "'");
49 arg.ReplaceAll("}", "'");
50 AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data());
52 // the writer configuration
53 arg.Form("-subdir=event_%%d -blocknofmt= -datafile hltout.dat -specfmt");
54 AliHLTConfiguration collector("sink1", "FileWriter" , "hltout-publisher", arg.Data());
56 /////////////////////////////////////////////////////////////////////////
57 /////////////////////////////////////////////////////////////////////////
59 // setup of the reconstruction
61 AliHLTReconstructor hltRec;
62 hltRec.Init("chains=sink1");
64 AliRawReader* rawreader=AliRawReader::Create(input);
68 rawreader->RewindEvents();
70 if (!rawreader->NextEvent()) {
71 cout << "no events found in " << input << endl;
76 cout << "processing event " << count++ << endl;
77 hltRec.Reconstruct(rawreader, NULL);
78 } while (rawreader->NextEvent() && (maxEvent<0 || count<maxEvent));
81 void extract_hltout_payload()
83 cerr << "==============================================================================" << endl;
84 cerr << "usage: aliroot -b -q -l extract-hltout-payload.C'(input, selection, maxEvent)'" << endl << endl;
85 cerr << "please provide input, e.g. \"raw.root\", or \"./\"" << endl;
86 cerr << "optional data type selection, e.g \"-datatype {DDL_RAW } ISDD\", " << endl;
87 cerr << " \"-origin {TPC }\", \"-typeid {DDL_RAW }\"" << endl;
88 cerr << "optional max event" << endl;
89 cerr << "==============================================================================" << endl;