handle the case of simulated raw data by checking for the GRP in the working director...
[u/mrichter/AliRoot.git] / HLT / exa / recraw-local.C
CommitLineData
94430cc1 1// $Id$
2/**
3 * @file recraw-local.C
4 * @brief Run reconstruction of raw data locally
5 *
6 * <pre>
7 * Usage: aliroot -b -q -l \
dd347dca 8 * recraw-local.C'("file", "cdb", minEvent, maxEvent, modules)'
94430cc1 9 *
10 * Examples:
dd347dca 11 * recraw-local.C'("alien:///alice/data/2009/.../....root")'
94430cc1 12 * recraw-local.C'("raw://run12345")'
13 * recraw-local.C'("raw://run12345", minEvent, MaxEvent)'
14 * recraw-local.C'("raw.root", "local://$PWD", minEvent, MaxEvent)'
15 *
16 * Defaults
dd347dca 17 * cdb="raw://" -> take OCDB from GRID
18 * minEvent=-1 -> no lower event selection
19 * maxEvent=-1 -> no upper event selection
20 * modules="ALL" -> all modules
deb17658 21 * hltOption="loglevel=0x7c" -> logging level info and above
94430cc1 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 * Input files can be specified via te run number when using the tag
31 * 'raw://' followed by the string 'run12345' where the number needs
32 * to be adjusted.
deb17658 33 *
34 * As for the OCDB it is always a good idea to use the OCDB from the
35 * Grid as this will contain all the necessary objects and the latest
36 * calibration. The special URI 'raw://' is most advisable as it selects
37 * the storage automatically from the run number. Other options are e.g.
38 * - "alien://folder=/alice/data/2010/OCDB"
39 * - "local://$ALICE_ROOT/OCDB"
40 *
41 * Re-running the HLT reconstruction
42 * By specifying the hlt options, the HLT chain can be re-run instead
43 * of just extracting the online result. E.g. the following options
44 * specify to ignore the HLTOUT payload and run the two chains defined
45 * in the agents. The translation of the online configuration into
46 * an HLT offline chain is under development.
47 * <pre>
48 * ignore-hltout chains=GLOBAL-esd-converter,TPC-clusters
49 * <pre>
50 *
dd347dca 51 * Note: You need a valid GRID token, use 'alien-token-init' of your
52 * alien installation.
94430cc1 53 *
54 * @author Matthias.Richter@ift.uib.no
55 * @ingroup alihlt_qa
56 */
57void recraw_local(const char *filename,
58 const char *cdbURI,
59 int minEvent=-1,
dd347dca 60 int maxEvent=-1,
deb17658 61 const char *modules="ALL",
62 const char *hltOptions="loglevel=0x7c")
94430cc1 63{
64 // connect to the GRID if we use a file or OCDB from the GRID
65 TString struri=cdbURI;
66 TString strfile=filename;
67 if (struri.BeginsWith("raw://") ||
68 strfile.Contains("://") && !strfile.Contains("local://")) {
69 TGrid::Connect("alien");
70 }
71
72 // Set the CDB storage location
73 AliCDBManager * man = AliCDBManager::Instance();
74 man->SetDefaultStorage(cdbURI);
84d998ff 75 if (struri.BeginsWith("local://")) {
76 // set specific storage for GRP entry
77 // search in the working directory and one level above, the latter
78 // follows the standard simulation setup like e.g. in test/ppbench
79 if (!gSystem->AccessPathName("GRP/GRP/Data")) {
80 man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD");
81 } else if (!gSystem->AccessPathName("../GRP/GRP/Data")) {
82 man->SetSpecificStorage("GRP/GRP/Data", "local://$PWD/..");
83 }
84 }
94430cc1 85
86 // Reconstruction settings
87 AliReconstruction rec;
88
89 if (minEvent>=0 || maxEvent>minEvent) {
90 if (minEvent<0) minEvent=0;
91 if (maxEvent<minEvent) maxEvent=minEvent;
92 rec.SetEventRange(minEvent,maxEvent);
93 }
94
8382b388 95 TString strModules=modules;
dd347dca 96 if (modules)
97 rec.SetRunReconstruction(modules);
98 else
99 rec.SetRunReconstruction("ALL");
94430cc1 100
101 // QA options
8382b388 102 TString qaOptions="HLT TPC";
103 if (!strModules.Contains("TPC")) qaOptions.ReplaceAll("TPC", "");
104 qaOptions+=":ALL";
105 rec.SetRunQA(qaOptions) ;
dd347dca 106 //rec.SetQARefDefaultStorage("local://$ALICE_ROOT/QAref") ;
94430cc1 107
108 // AliReconstruction settings
109 rec.SetWriteESDfriend(kTRUE);
8382b388 110 rec.SetRunVertexFinder(strModules.Contains("ITS"));
94430cc1 111 rec.SetInput(filename);
deb17658 112 rec.SetOption("HLT", hltOptions);
94430cc1 113
114 rec.SetRunPlaneEff(kFALSE);
115
116 // switch off cleanESD
117 rec.SetCleanESD(kFALSE);
118
119 AliLog::Flush();
120 rec.Run();
121
122}
123
dd347dca 124void recraw_local(const char *filename,
94430cc1 125 int minEvent=-1,
dd347dca 126 int maxEvent=-1,
deb17658 127 const char *modules="ALL",
128 const char *hltOptions="loglevel=0x7f")
dd347dca 129{
deb17658 130 recraw_local(filename, "raw://", minEvent, maxEvent, modules, hltOptions);
dd347dca 131}
132
133void recraw_local()
94430cc1 134{
dd347dca 135 cout << "recraw-local: Run AliRoot reconstruction locally" << endl;
136 cout << " Usage: aliroot -b -q -l \\" << endl;
deb17658 137 cout << " recraw-local.C'(\"file\", \"cdb\", minEvent, maxEvent, modules, hltOptions)'" << endl;
dd347dca 138 cout << "" << endl;
139 cout << " Examples:" << endl;
140 cout << " recraw-local.C'(\"alien:///alice/data/2009/.../....root\")' " << endl;
141 cout << " recraw-local.C'(\"raw://run12345\")'" << endl;
142 cout << " recraw-local.C'(\"raw://run12345\", minEvent, MaxEvent)'" << endl;
143 cout << " recraw-local.C'(\"raw.root\", \"local://$PWD\", minEvent, MaxEvent)'" << endl;
144 cout << "" << endl;
145 cout << " Defaults" << endl;
146 cout << " cdb=\"raw://\" -> take OCDB from GRID" << endl;
147 cout << " minEvent=-1 -> no lower event selection" << endl;
148 cout << " maxEvent=-1 -> no upper event selection" << endl;
149 cout << " modules=\"ALL\" -> all modules" << endl;
deb17658 150 cout << " hltOption=\"loglevel=0x7c\" -> logging level info and above" << endl;
94430cc1 151}