]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/sampleEsdAnalysis.C
adding an example component illustrating some ESD analysis and corresponding macro...
[u/mrichter/AliRoot.git] / HLT / exa / sampleEsdAnalysis.C
1 // $Id$
2 /**
3  * @file sampleEsdAnalysis.C
4  * @brief Example macro to run the AliHLTSampleESDAnalysisComponent in
5  * AliReconstruction.
6  *
7  * The component subscribes to the output of the default HLT reconstruction
8  * chain and extracts the ESD from the input.
9  *
10  * <pre>
11  * Usage: aliroot -b -q -l \
12  *     sampleEsdAnalysis.C'("file", "cdb", minEvent, maxEvent)'
13  *
14  * Examples:
15  *     sampleEsdAnalysis.C'("alien:///alice/data/2009/.../....root")' 
16  *     sampleEsdAnalysis.C'("raw.root", "local://$PWD", minEvent, MaxEvent)'
17  *
18  * Defaults
19  *     cdb="raw://"  -> take OCDB from GRID
20  *     minEvent=-1   -> no lower event selection
21  *     maxEvent=-1   -> no upper event selection
22  *
23  * </pre>
24  *
25  * The input file can be a file on the grid, indicated by the tag
26  * 'alien://' indicates. By default also the OCDB is set to the GRID.
27  * If either the file or the OCDB is taken from the GRID, the macros
28  * connects to the Grid in the beginning.
29  *
30  * As for the OCDB it is always a good idea to use the OCDB from the
31  * Grid as this will contain all the necessary objects and the latest
32  * calibration. The special URI 'raw://' is most advisable as it selects
33  * the storage automatically from the run number. Other options are e.g.
34  * - "alien://folder=/alice/data/2010/OCDB"
35  * - "local://$ALICE_ROOT/OCDB"
36  *
37  * Note: You need a valid GRID token, if you want to access files directly
38  * from the Grid, use 'alien-token-init' of your alien installation.
39  *
40  * @author Matthias.Richter@ift.uib.no
41  * @ingroup alihlt_tutorial
42  */
43 void sampleEsdAnalysis(const char *filename,
44                        const char *cdbURI,
45                        int minEvent=-1,
46                        int maxEvent=-1)
47 {
48   // connect to the GRID if we use a file or OCDB from the GRID
49   TString struri=cdbURI;
50   TString strfile=filename;
51   if (struri.BeginsWith("raw://") ||
52       strfile.Contains("://") && !strfile.Contains("local://")) {
53     TGrid::Connect("alien");
54   }
55
56   // Set the CDB storage location
57   AliCDBManager * man = AliCDBManager::Instance();
58   man->SetDefaultStorage(cdbURI);
59   if (struri.BeginsWith("local://") && !gSystem->AccessPathName("GRP/GRP/Data")) {
60     // set specific storage for GRP entry
61     man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
62   }
63
64   //////////////////////////////////////////////////////////////////////////////////////
65   //
66   // Reconstruction settings
67   AliReconstruction rec;
68
69   if (minEvent>=0 || maxEvent>minEvent) {
70     if (minEvent<0) minEvent=0;
71     if (maxEvent<minEvent) maxEvent=minEvent;
72     rec.SetEventRange(minEvent,maxEvent);
73   }
74   rec.SetRunReconstruction("HLT ITS TPC");
75   rec.SetWriteESDfriend(kFALSE);
76   rec.SetInput(filename);
77
78   // QA options
79   rec.SetRunQA(":") ;
80   //rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
81
82   //////////////////////////////////////////////////////////////////////////////////////
83   //
84   // setup the HLT system
85   AliHLTSystem* pHLT=AliHLTPluginBase::GetInstance();
86
87   // define a configuration for the SampleESDAnalysis component
88   // arguments:
89   //  1) id of the configuartion, later used to refer to this configuration
90   //  2) id of the component to run
91   //  3) parents, here the configuration 'GLOBAL-esd-converter' of the libAliHLTGlobal
92   //  4) optional component arguments
93   AliHLTConfiguration esdanalysis("ESD-Analysis", "SampleESDAnalysis", "GLOBAL-esd-converter", "");
94
95   // set option for the HLT module in AliReconstruction
96   // arguments
97   //  - ignore-hltout : ignore the HLTOUT payload from the HLT DDLs
98   //  - libraries to be used as plugins
99   //  - loglevel=0x79 : Important, Warning, Error, Fatal
100   //  - chains=ESD-Analysis : chains to be run
101   rec.SetOption("HLT",
102                 "ignore-hltout " 
103                 "libAliHLTUtil.so libAliHLTGlobal.so libAliHLTSample.so "
104                 "loglevel=0x79 "
105                 "chains=ESD-Analysis "
106                 );
107
108   rec.SetRunPlaneEff(kFALSE);
109
110   // switch off cleanESD
111   rec.SetCleanESD(kFALSE);
112
113   AliLog::Flush();
114   rec.Run();
115
116 }
117
118 void sampleEsdAnalysis(const char *filename,
119                        int minEvent=-1,
120                        int maxEvent=-1)
121 {
122   sampleEsdAnalysis(filename, "raw://", minEvent, maxEvent, modules, hltOptions);
123 }
124
125 void sampleEsdAnalysis()
126 {
127   cout << "sampleEsdAnalysis: Run HLT component 'SampleESDAnalyis' in AliReconstruction" << endl;
128   cout << " Usage: aliroot -b -q -l \\" << endl;
129   cout << "     sampleEsdAnalysis.C'(\"file\", \"cdb\", minEvent, maxEvent)'" << endl;
130   cout << "" << endl;
131   cout << " Examples:" << endl;
132   cout << "     sampleEsdAnalysis.C'(\"alien:///alice/data/2009/.../....root\")' " << endl;
133   cout << "     sampleEsdAnalysis.C'(\"raw.root\", \"local://$PWD\", minEvent, MaxEvent)'" << endl;
134   cout << "" << endl;
135   cout << " Defaults" << endl;
136   cout << "     cdb=\"raw://\"  -> take OCDB from GRID" << endl;
137   cout << "     minEvent=-1   -> no lower event selection" << endl;
138   cout << "     maxEvent=-1   -> no upper event selection" << endl;
139 }