]>
Commit | Line | Data |
---|---|---|
374136ad | 1 | // $Id$ |
2 | /** | |
3 | * @file extract-hltout-payload.C | |
2efd7a9a | 4 | * @brief Extraction of data blocks from HLTOUT |
374136ad | 5 | * |
6 | * <pre> | |
7 | * Usage: aliroot -b -q extract-hltout-payload.C'("raw.root")' | tee extract-hltout-payload.log | |
8 | * </pre> | |
9 | * | |
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. | |
15 | * | |
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. | |
20 | * | |
21 | * <pre> | |
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 }")' | |
24 | * </pre> | |
25 | * | |
26 | * @author Matthias.Richter@ift.uib.no | |
27 | * @ingroup alihlt_its | |
28 | */ | |
2efd7a9a | 29 | void extract_hltout_payload(const char* input, const char* selection="", int maxEvent=-1) |
374136ad | 30 | { |
31 | ///////////////////////////////////////////////////////////////////////// | |
32 | ///////////////////////////////////////////////////////////////////////// | |
33 | // | |
34 | // setup of the HLT system | |
35 | gSystem->Load("libHLTrec"); | |
36 | AliHLTSystem* pHLT=AliHLTReconstructorBase::GetInstance(); | |
37 | if (!pHLT) { | |
38 | cerr << "fatal error: can not get HLT instance" << endl; | |
39 | } | |
40 | ||
41 | ///////////////////////////////////////////////////////////////////////// | |
42 | ///////////////////////////////////////////////////////////////////////// | |
43 | // | |
44 | // the configuration chain | |
45 | TString arg; | |
46 | ||
47 | // the publisher configuration | |
48 | arg.Form("%s", selection); | |
49 | arg.ReplaceAll("{", "'"); | |
50 | arg.ReplaceAll("}", "'"); | |
51 | AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data()); | |
52 | ||
53 | // the writer configuration | |
54 | arg.Form("-subdir=event_%%d -blocknofmt= -datafile hltout.dat -specfmt"); | |
55 | AliHLTConfiguration collector("sink1", "FileWriter" , "hltout-publisher", arg.Data()); | |
56 | ||
57 | ///////////////////////////////////////////////////////////////////////// | |
58 | ///////////////////////////////////////////////////////////////////////// | |
59 | // | |
60 | // setup of the reconstruction | |
61 | ||
62 | AliHLTReconstructor hltRec; | |
63 | hltRec.Init("chains=sink1"); | |
64 | ||
65 | AliRawReader* rawreader=AliRawReader::Create(input); | |
66 | if (!rawreader) { | |
67 | return; | |
68 | } | |
69 | rawreader->RewindEvents(); | |
70 | int count=0; | |
71 | if (!rawreader->NextEvent()) { | |
72 | cout << "no events found in " << input << endl; | |
73 | return; | |
74 | } | |
75 | ||
76 | do { | |
77 | cout << "processing event " << count++ << endl; | |
78 | hltRec.Reconstruct(rawreader, NULL); | |
dfa01417 | 79 | } while (rawreader->NextEvent() && (maxEvent<0 || count<maxEvent)); |
374136ad | 80 | } |
2efd7a9a | 81 | |
82 | void extract_hltout_payload() | |
83 | { | |
84 | cerr << "==============================================================================" << endl; | |
85 | cerr << "usage: aliroot -b -q -l extract-hltout-payload.C'(input, selection, maxEvent)'" << endl << endl; | |
86 | cerr << "please provide input, e.g. \"raw.root\", or \"./\"" << endl; | |
87 | cerr << "optional data type selection, e.g \"-datatype {DDL_RAW } ISDD\", " << endl; | |
88 | cerr << " \"-origin {TPC }\", \"-typeid {DDL_RAW }\"" << endl; | |
89 | cerr << "optional max event" << endl; | |
90 | cerr << "==============================================================================" << endl; | |
91 | } |