]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/conf-sample.C
helper macro to create the HLT component configuration OCDB entries
[u/mrichter/AliRoot.git] / HLT / exa / conf-sample.C
1 // $Id$
2 /**
3  * @file conf-sample.C
4  * @brief A sample configuration macro for HLT chains in AliRoot.
5  *
6  * The macro defines a simple HLT analysis chain consisting of multiple
7  * data publishers with a processor each (just a dummy component copying
8  * the data blocks), and a common data sink.
9  *
10  * \b Note: The file publisher needs a file to read, either you replace
11  * \em some-data.dat with the path of an existing file or just create a
12  * dummy file in the current working directory. Futhermore, there has to
13  * be at least one simulated event since AliReconstruction relies on a
14  * couple of filesin the folder.
15  *
16  * Usage: from the aliroot prompt
17  * <pre>
18  {
19    AliReconstruction rec;                 // the reconstruction instance
20    rec.SetInput("./");                    // to be independent of galice.root
21    rec.SetLoadAlignFromCDB(kFALSE);
22    rec.SetFillTriggerESD(kFALSE);
23    rec.SetRunQA(":");
24    rec.SetRunVertexFinder(kFALSE);
25    rec.SetRunLocalReconstruction("HLT");  // run local rec only for HLT 
26    rec.SetRunTracking("");                // switch off tracking
27    rec.SetFillESD("HLT");                 // 
28    rec.SetOption("HLT", "libAliHLTSample.so libAliHLTUtil.so "
29                         "config=$ALICE_ROOT/HLT/exa/conf-sample.C "
30                         "chains=sink");
31    //rec.SetEventRange(0,0);
32    rec.Run();
33  }
34  * </pre>
35  *
36  * @author Matthias.Richter@ift.uib.no
37  * @ingroup alihlt_tutorial
38  */
39 {
40   /////////////////////////////////////////////////////////////////////////
41   /////////////////////////////////////////////////////////////////////////
42   //
43   // the configuration
44   const int nofPublishers=5;
45   TString writerInput;
46
47   for (int i=0; i<nofPublishers; i++) {
48     TString publisherName;
49     TString processorName;
50     TString arg;
51     publisherName.Form("fp_%d", i);
52     arg.Form("-datatype 'DUMMYDAT' 'SMPL' -datafile some-data.dat "
53              "-dataspec %d", i);
54     // The AliHLTFilePublisher (component Id \em 'FilePublisher' provides
55     // the given file (see AliHLTFilePublisher for more options) to the
56     // subsequent components in the chain.
57     AliHLTConfiguration publisher(publisherName.Data(), "FilePublisher",
58                                   NULL, arg.Data());
59
60     processorName.Form("cp_%d", i);
61     // The AliHLTDummyComponent (Id \em 'Dummy') just forwards a certain
62     // fraction of the input to the output or just repeats the input data
63     // if percentage > 100
64     AliHLTConfiguration copy(processorName.Data(), "Dummy", publisherName.Data(),
65                              "output_percentage 80");
66
67     // add all processors to the input of the data sink
68     if (!writerInput.IsNull()) writerInput+=" ";
69     writerInput+=processorName;
70   }
71
72   // The AliHLTFileWriter (Id 'FileWriter') is a data sink. It writes
73   // all incoming data blocks to files. Several options available.
74   AliHLTConfiguration sink("sink", "FileWriter", writerInput.Data(), NULL);
75 }