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