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", "selection", nofEvents)' \
8 * | tee extract-hltout-payload.log
11 * selection="" -> no data type selection
12 * nofEvents=-1 -> all events
15 * The raw input file can be accessed directly from the GRID, e.g
16 * "alien:///alice/data/2010/LHC10b/000115887/raw/10000115887021.20.root"
18 * The macro stores all data blocks from the HLTOUT payload into separated
19 * folders for each event. The file names are derived from data type and
20 * specification of the block. Data is read from a raw reader. An input
21 * file can be specified as the first argument, default is "./" and reads
22 * ddl files through AliRawReaderFile.
24 * A selection criterion can be specified as second argument, the format
25 * of the selection string follows the arguments of the
26 * AliHLTOUTPublisherComponent except from the quote which need to be
27 * replaced by brackets due to CINT, e.g.
30 * aliroot -b -q extract-hltout-payload.C'("raw.root", "-datatype {DDL_RAW } ISDD")'
31 * aliroot -b -q extract-hltout-payload.C'("raw.root", "-origin {TPC }")'
34 * @author Matthias.Richter@ift.uib.no
35 * @ingroup alihlt_programs
37 void extract_hltout_payload(const char* input, const char* selection="", int maxEvent=-1)
39 /////////////////////////////////////////////////////////////////////////
40 /////////////////////////////////////////////////////////////////////////
42 // setup GRID if input is not a local file
43 TString strfile=input;
44 if (strfile.Contains("://") && !strfile.Contains("local://")) {
45 TGrid::Connect("alien");
48 /////////////////////////////////////////////////////////////////////////
49 /////////////////////////////////////////////////////////////////////////
51 // setup of the HLT system
52 AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
54 cerr << "fatal error: can not get HLT instance" << endl;
57 /////////////////////////////////////////////////////////////////////////
58 /////////////////////////////////////////////////////////////////////////
60 // the configuration chain
63 // the publisher configuration
64 arg.Form("%s", selection);
65 arg.ReplaceAll("{", "'");
66 arg.ReplaceAll("}", "'");
67 AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data());
69 // the writer configuration
70 arg.Form("-subdir=event_%%d -blocknofmt= -datafile hltout.dat -specfmt");
71 AliHLTConfiguration collector("sink1", "FileWriter" , "hltout-publisher", arg.Data());
73 /////////////////////////////////////////////////////////////////////////
74 /////////////////////////////////////////////////////////////////////////
76 // setup of the reconstruction
78 AliHLTReconstructor hltRec;
79 hltRec.Init("chains=sink1 ignore-ctp");
81 AliRawReader* rawreader=AliRawReader::Create(input);
85 rawreader->RewindEvents();
87 if (!rawreader->NextEvent()) {
88 cout << "no events found in " << input << endl;
93 cout << "processing event " << count++ << endl;
94 hltRec.Reconstruct(rawreader, NULL);
95 } while (rawreader->NextEvent() && (maxEvent<0 || count<maxEvent));
98 void extract_hltout_payload()
100 cerr << "==============================================================================" << endl;
101 cerr << "usage: aliroot -b -q -l extract-hltout-payload.C'(input, selection, maxEvent)'" << endl << endl;
102 cerr << "please provide input, e.g. \"raw.root\", or \"./\"" << endl;
103 cerr << "optional data type selection, e.g \"-datatype {DDL_RAW } ISDD\", " << endl;
104 cerr << " \"-origin {TPC }\", \"-typeid {DDL_RAW }\"" << endl;
105 cerr << "optional max event" << endl;
106 cerr << "==============================================================================" << endl;