]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/hltout-collect-esd.C
Adding macro to patch GRP for runs taken with HLT in mode A, for processing these...
[u/mrichter/AliRoot.git] / HLT / exa / hltout-collect-esd.C
1 // $Id$
2 /**
3  * @file hltout-collect-esd.C
4  * @brief Example for the AliHLTEsdCollectorComponent
5  *
6  * Example macro to run a small chain with the AliHLTOUTPublisherComponent
7  * and the AliHLTEsdCollectorComponent. The AliHLTOUTPublisherComponent
8  * is configured to publish all ESD objects from the HLTOUT data, the
9  * AliHLTEsdCollectorComponent writes the files using the AliHLTEsdManager.
10  *
11  * Usage: aliroot -b -q \
12  *             hltout-collect-esd.C'("raw.root","local://$ALICE_ROOT/OCDB",0,5)' | tee hltout-collect-esd.log
13  * or 
14  *  
15  *    aliroot -b -l -q \
16  *                hltout-collect-esd.C'("alien:///alice/data/2010/LHC10b/000115322/raw/10000115322040.80.root","raw://",0,5)'  | tee hltout-collect-esd.log
17  * 
18  * 
19  * The macro asumes HLTOUT raw data ddl files in order to open an
20  * AliRawReaderFile, e.g. simulated using the default AliSimulation with
21  * at least SetWriteRawData("HLT") enabled.
22  *
23  * \b Note: The example disables a few steps in the AliReconstruction,
24  * mainly because of crashes in various parts of AliRoot. This does not
25  * have any impact to the HLT features to be presented.
26  *
27  * @author Matthias.Richter@ift.uib.no
28  * @ingroup alihlt_tutorial
29  */
30 void hltout_collect_esd(const char *filename,
31                         const char *cdbURI,
32                         int minEvent=-1,
33                         int maxEvent=-1)
34 {
35   
36   // connect to the GRID if we use a file or OCDB from the GRID
37   TString struri=cdbURI;
38   TString strfile=filename;
39   if (struri.BeginsWith("raw://") ||
40       strfile.Contains("://") && !strfile.Contains("local://")) {
41     TGrid::Connect("alien");
42   }
43
44   // Set the CDB storage location
45   AliCDBManager * man = AliCDBManager::Instance();
46   man->SetDefaultStorage(cdbURI);
47   if (struri.BeginsWith("local://")) {
48     // set specific storage for GRP entry
49     // search in the working directory and one level above, the latter
50     // follows the standard simulation setup like e.g. in test/ppbench
51     if (!gSystem->AccessPathName("GRP/GRP/Data")) {
52       man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
53     } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
54       man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");
55     }
56   }
57   /////////////////////////////////////////////////////////////////////////
58   /////////////////////////////////////////////////////////////////////////
59   //
60   // setup of the HLT system
61   AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
62   if (!pHLT) {
63     cerr << "fatal error: can not get HLT instance" << endl;
64   }
65
66   /////////////////////////////////////////////////////////////////////////
67   /////////////////////////////////////////////////////////////////////////
68   //
69   // the configuration chain
70   TString arg;
71
72   // the publisher configuration
73   arg.Form("-typeid ALIESDV0");
74   AliHLTConfiguration publisher("hltout-publisher", "AliHLTOUTPublisher" , NULL, arg.Data());
75
76   // the writer configuration
77   arg.Form("");
78   AliHLTConfiguration collector("sink1", "EsdCollector"   , "hltout-publisher", arg.Data());
79
80   /////////////////////////////////////////////////////////////////////////
81   /////////////////////////////////////////////////////////////////////////
82   //
83   // setup of the reconstruction
84   AliReconstruction rec; 
85   
86   if (minEvent>=0 || maxEvent>minEvent) {
87     if (minEvent<0) minEvent=0;
88     if (maxEvent<minEvent) maxEvent=minEvent;
89     rec.SetEventRange(minEvent,maxEvent);
90   }
91
92   rec.SetInput(filename);
93   rec.SetRunLocalReconstruction("HLT");
94   rec.SetRunTracking("");
95   rec.SetFillESD("");
96   rec.SetRunQA(":");
97   rec.SetFillTriggerESD(kFALSE);
98   rec.SetRunVertexFinder(kFALSE);
99   rec.SetOption("HLT", "libAliHLTUtil.so loglevel=0x7c chains=sink1");
100   rec.Run();
101 }