]>
Commit | Line | Data |
---|---|---|
7541582f | 1 | #error This file is not for compilation |
2 | /** | |
3 | * @page train_setup_doc Using the TrainSetup facility | |
4 | * | |
5 | * @tableofcontents | |
6 | * | |
7 | * @section train_setup_overview Overview | |
8 | * | |
9 | * Users should define a class that derives from TrainSetup. The class | |
10 | * should implement the member function TrainSetup::CreateTasks to add | |
11 | * needed tasks to the train | |
12 | * | |
13 | * @code | |
14 | * // MyTrain.C | |
15 | * class MyTrain : public TrainSetup | |
16 | * { | |
17 | * public: | |
18 | * MyTrain(const char* name="MyTrain") | |
19 | * : TrainSetup(name), | |
20 | * fParameter(0) | |
21 | * { | |
22 | * // SetType(kAOD); // AOD input | |
23 | * // SetType(kESD); // ESD input | |
24 | * // Input unspecified - can be set later | |
25 | * } | |
26 | * protected: | |
27 | * void CreateTasks(EMode mode, Bool_t par, AliAnalysisManager* mgr) | |
28 | * { | |
29 | * AliAnalysisManager::SetCommonFileName("my_analysis.root"); | |
30 | * LoadLibrary("MyAnalysis", par, true); | |
31 | * Bool_t mc = mgr->GetMCtruthEventHandler() != 0; | |
32 | * gROOT->Macro(Form("AddTaskMyAnalysis.C(%f)",fParameter)); | |
33 | * } | |
34 | * const char* ClassName() const { return "MyTrain"; } | |
35 | * void MakeOptions(Runner& r) | |
36 | * { | |
37 | * TrainSetup::MakeOptions(r); | |
38 | * r.Add(new Option("parameter", "My parameter", "VALUE")); | |
39 | * } | |
40 | * void SetOptions(Runner& r) | |
41 | * { | |
42 | * TrainSetup::SetOptions(r); | |
43 | * Option* param = r.FindOption("parameter"); | |
44 | * if (param) fParameter = param->AsDouble(); | |
45 | * } | |
46 | * Double_t fParameter; | |
47 | * }; | |
48 | * @endcode | |
49 | * | |
50 | * @section train_setup_exec Execution of the train | |
51 | * | |
52 | * A user defined TrainSetup class can then be run like | |
53 | * | |
54 | * @code | |
55 | * Root> .x RunTrain.C("<class>", "<name>", "<options>", "<runs>", nEvents) | |
56 | * @endcode | |
57 | * | |
58 | * or using the program @b runTrain | |
59 | * | |
60 | * @verbatim | |
61 | > runTrain --class=<class> --name=<name> [<options>] | |
62 | @endverbatim | |
63 | * | |
64 | * Here, | |
65 | * | |
66 | * - <class> is the name of the user defined class deriving from | |
67 | * TrainSetup. | |
68 | * | |
69 | * - <name> is an arbitary name to give to the train. Note, an | |
70 | * @e escaped @e name will be generated from this, which replaces | |
71 | * all spaces and the like with '_' and (optionally) with the date | |
72 | * and time appended. | |
73 | * | |
74 | * - <options> is a list of options. For RunTrain this is a | |
75 | * comma separated list of options in the form | |
76 | * <option>=<value> for value options and <option> | |
77 | * for flags (booleans). For @c runTrain, the options are of the | |
78 | * traditional Unix long type: @c --<option>=<value> and | |
79 | * @c --<option>. The exact list of options for a given train | |
80 | * can be listed by passing the option @b help. | |
81 | * | |
82 | * See also ::RunTrain and ::main | |
83 | * | |
84 | * In both cases, a new sub-directory called @e escaped @e name of the | |
85 | * train is created, and various files are copied there - depending on | |
86 | * the mode of execution. | |
87 | * | |
88 | * For local analysis, no aditional files are copied there, but the | |
89 | * output will be put there. | |
90 | * | |
91 | * For PROOF analysis, the needed PAR files are copied there and | |
92 | * expanded. The output of the job may end up in this directory if so | |
93 | * instructed. | |
94 | * | |
95 | * For Grid analysis, various JDL and steering scripts are copied to | |
96 | * this directory. | |
97 | * | |
98 | * In all cases, a file named @c rerun.C (and for @b runTrain: | |
99 | * rerun.sh) is generated in this sub-directory. It contains the | |
100 | * setting used for the train and can easily be used to run merging | |
101 | * and terminate as needed. | |
102 | * | |
103 | * @section train_setup_input Specifying the input | |
104 | * @subsection train_setup_local Local data input | |
105 | * | |
106 | * For both ESD and AOD input for local jobs, one must specify the | |
107 | * root of the sub-tree that holds the data. That is, if - for | |
108 | * example - the data resides in a directory structure like | |
109 | * | |
110 | * <pre> | |
111 | * /some/directory/<run>/<seq>/AliESDs.root | |
112 | * </pre> | |
113 | * | |
114 | * then one should specify the input location like | |
115 | * | |
116 | * @code | |
117 | * train->SetDataDir("/some/directory"); | |
118 | * @endcode | |
119 | * | |
120 | * <tt>/some/directory</tt> is then search recursively for input files | |
121 | * that match the pattern given by the analysis type (ESD: | |
122 | * <tt>AliESDs.root</tt>, AOD: <tt>AliAOD.root</tt>). The found files | |
123 | * are then chained together. If MC input is specified, then the | |
124 | * companion files <tt>galice.root</tt>, <tt>Kinematics.root</tt>, and | |
125 | * <tt>TrackRefs.root</tt> must be found in the same directories as | |
126 | * the <tt>AliESDs.root</tt> files | |
127 | * | |
128 | * @subsection train_setup_proof PROOF input. | |
129 | * | |
130 | * The input data for a PROOF based analysis can be specified as per a | |
131 | * Local job, in which case the data must be available to the slaves | |
132 | * at the specified locations, or one can specify a data-set name via | |
133 | * | |
134 | * @code | |
135 | * train->SetDataSet("<data-set-name>"); | |
136 | * @endcode | |
137 | * | |
138 | * @subsection train_setup_grid_esd Grid ESD input. | |
139 | * | |
140 | * Suppose the ESD files are stored on the Grid as | |
141 | * | |
142 | * <pre> | |
143 | * /alice/data/<year>/<period>/<run>/ESDs/pass<no>/<year><run><chunk>.<part>/AliESDs.root | |
144 | * </pre> | |
145 | * | |
146 | * where <run> is zero-padded by typically 3 '0's. One should | |
147 | * specify the input location like | |
148 | * | |
149 | * @code | |
150 | * train->SetDataDir("/alice/data/<year>/<period>"); | |
151 | * train->SetDataPattern("ESDs/pass<no>/*/"); | |
152 | * train->AddRun(<run>); | |
153 | * @endcode | |
154 | * | |
155 | * If a particular kind of pass is needed, say | |
156 | * <tt>pass<no>_MUON</tt>, one should do | |
157 | * | |
158 | * @code | |
159 | * train->SetDataPattern("ESDs/pass<no>_MUON/*/"); | |
160 | * @endcode | |
161 | * | |
162 | * The AliEn analysis plug-in is then instructed to look for data files under | |
163 | * | |
164 | * <pre> | |
165 | * /alice/data/<year>/<period>/<run>/ESDs/pass<no>/ * /AliESDs.root | |
166 | * </pre> | |
167 | * | |
168 | * for each added run. | |
169 | * | |
170 | * For simulation output, the files are generally stored like | |
171 | * | |
172 | * <pre> | |
173 | * /alice/sim/<year>/<prod>/<run>/<seq>/AliESDs.root | |
174 | * </pre> | |
175 | * | |
176 | * where <run> is generally @e not zero-padded. One should | |
177 | * specify the input location like | |
178 | * | |
179 | * @code | |
180 | * train->SetDataDir("/alice/data/<year>/<period>"); | |
181 | * train->SetDataPattern("*"); | |
182 | * train->AddRun(<run>); | |
183 | * @endcode | |
184 | * | |
185 | * | |
186 | * @subsection train_setup_grid_aod Grid AOD input | |
187 | * | |
188 | * Suppose your AOD files are placed in directories like | |
189 | * | |
190 | * <pre> | |
191 | * /some/directory/<run>/<seq>/AliAOD.root | |
192 | * </pre> | |
193 | * | |
194 | * where <run> is zero-padded by typically 3 '0's. One should | |
195 | * then specify the input as | |
196 | * | |
197 | * @code | |
198 | * train->SetDataDir("/some/directory"); | |
199 | * train->SetDataPattern("*"); | |
200 | * train->AddRun(<run>); | |
201 | * @endcode | |
202 | * | |
203 | * The AliEn analysis plug-in is then instructed to look for data files under | |
204 | * | |
205 | * <pre> | |
206 | * /some/directory/<run>/ * /AliAOD.root | |
207 | * </pre> | |
208 | * | |
209 | * for each added run. | |
210 | * | |
211 | * Suppose the AODs are in | |
212 | * | |
213 | * <pre> | |
214 | * /alice/data/<year>/<period>/<run>/ESDs/pass<no>/AOD&vers>/<seq>/AliAOD.root | |
215 | * </pre> | |
216 | * | |
217 | * @code | |
218 | * train->SetDataDir("/alice/data/<year>/<period>"); | |
219 | * train->SetDataPattern("ESDs/pass<no>/AOD<vers>/*/"); | |
220 | * train->AddRun(<run>); | |
221 | * @endcode | |
222 | * | |
223 | * For simulation output, the files are generally stored like | |
224 | * | |
225 | * <pre> | |
226 | * /alice/sim/<year>/<prod>/<run>/<seq>/AliAOD.root | |
227 | * </pre> | |
228 | * | |
229 | * where <run> is generally @e not zero-padded. One should | |
230 | * should specify the input location like | |
231 | * | |
232 | * @code | |
233 | * train->SetDataDir("/alice/data/<year>/<period>"); | |
234 | * train->SetDataPattern("*"); | |
235 | * train->AddRun(<run>); | |
236 | * @endcode | |
237 | * | |
238 | * @section train_setup_other Other features | |
239 | * @subsection train_setup_options Options interface | |
240 | * | |
241 | * If the train does not depend on additional options or parameters, | |
242 | * the member functions TrainSetup::MakeOptions and | |
243 | * TrainSetup::SetOptions can be left un-overloaded in the derived | |
244 | * class. However, options defined in this way can be set through the | |
245 | * command line of the program @b runTrain, and provides a great deal | |
246 | * of flexiblity. The Option class provides means of translating the | |
247 | * passed string values to integers, doubles, booleans, and of course | |
248 | * strings. | |
249 | * | |
250 | * @subsection train_setup_aux Auxillary libraries, sources, and files | |
251 | * | |
252 | * Auxillary libraries should be loaded using | |
253 | * | |
254 | * - TrainSetup::LoadLibrary(const char*,Bool_t,Bool_t) | |
255 | * | |
256 | * where first argument is the name of the library, the econd should | |
257 | * be true if the library should be loaded as a PAR file (PROOF and | |
258 | * Grid only), and the argument should be true if the library should | |
259 | * be loaded on the PROOF slaves/Grid workers too. | |
260 | * | |
261 | * If the train needs additional files, say a script for setting up | |
262 | * the tasks, or some data file, it can be passed on the the | |
263 | * PROOF/Grid workers using the member functions | |
264 | * | |
265 | * - TrainSetup::AddExtraFile(const char*) | |
266 | * - TrainSetup::AddSource(const char*,bool) | |
267 | * | |
268 | * @subsection train_setup_overload Overloading the behaviour | |
269 | * | |
270 | * The base class TrainSetup tries to implement a sensible setup for a | |
271 | * given type of analysis, but some times a particular train needs a | |
272 | * bit of tweaking. One can therefore overload the following functions | |
273 | * | |
274 | * - TrainSetup::CreateGridHandler() | |
275 | * - TrainSetup::CreateInputHandler(EType) | |
276 | * - TrainSetup::CreateMCHandler(EType,bool) | |
277 | * - TrainSetup::CreateOutputHandler(EType) | |
278 | * - TrainSetup::CreatePhysicsSelection(Bool_t,AliAnalysisManager*) | |
279 | * - TrainSetup::CreateCentralitySelection(Bool_t,AliAnalysisManager*) | |
280 | * | |
281 | * @section train_setup_scripts Tasks defined in scripts | |
282 | * | |
283 | * A task can even be defined in a script, like for example a task like | |
284 | * | |
285 | * @include MyAnalysis.C | |
286 | * | |
287 | * Our train set-up can then use the member function | |
288 | * TrainSetup::MakeScriptPAR to make a PAR file of the script and use | |
289 | * that to make a library loaded on the workers and then generate an | |
290 | * object of our task defined in the script. | |
291 | * | |
292 | * @include MyTrain.C | |
293 | * | |
294 | * This can allow for fast development and testing of analysis tasks | |
295 | * without having to wait for official tasks and builds of all of | |
296 | * AliROOT | |
297 | */ | |
298 | // | |
299 | // EOF | |
300 | // |