ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tasks.C
Go to the documentation of this file.
1 // Example of TTasks.
2 // Create a hierarchy of objects derived from TTask in library Mytasks
3 // Show the tasks in a browser.
4 // To execute a Task, use the context context menu and select
5 // the item "ExecuteTask"
6 // see also other functions in the TTask context menu, such as
7 // -setting a breakpoint in one or more tasks
8 // -enabling/disabling one task, etc
9 //Author: Rene Brun
10 #ifndef __RUN_TASKS__
11 
12 void tasks()
13 {
14  TString dir = gSystem->UnixPathName(__FILE__);
15  dir.ReplaceAll("tasks.C","");
16  dir.ReplaceAll("/./","/");
17  gROOT->LoadMacro(dir +"MyTasks.cxx+");
18 
19  gROOT->ProcessLine("#define __RUN_TASKS__ 1");
20  gROOT->ProcessLine(TString("#include \"") + dir + "tasks.C\"");
21  gROOT->ProcessLine("runtasks()");
22  gROOT->ProcessLine("#undef __RUN_TASKS__");
23 }
24 
25 #else
26 
27 void runtasks()
28 //void tasks()
29 {
30  TTask *run = new MyRun("run","Process one run");
31  TTask *event = new MyEvent("event","Process one event");
32  TTask *geomInit = new MyGeomInit("geomInit","Geometry Initialisation");
33  TTask *matInit = new MyMaterialInit("matInit","Materials Initialisation");
34  TTask *tracker = new MyTracker("tracker","Tracker manager");
35  TTask *tpc = new MyRecTPC("tpc","TPC Reconstruction");
36  TTask *its = new MyRecITS("its","ITS Reconstruction");
37  TTask *muon = new MyRecMUON("muon","MUON Reconstruction");
38  TTask *phos = new MyRecPHOS("phos","PHOS Reconstruction");
39  TTask *rich = new MyRecRICH("rich","RICH Reconstruction");
40  TTask *trd = new MyRecTRD("trd","TRD Reconstruction");
41  TTask *global = new MyRecGlobal("global","Global Reconstruction");
42 
43  run->Add(geomInit);
44  run->Add(matInit);
45  run->Add(event);
46  event->Add(tracker);
47  event->Add(global);
48  tracker->Add(tpc);
49  tracker->Add(its);
50  tracker->Add(muon);
51  tracker->Add(phos);
52  tracker->Add(rich);
53  tracker->Add(trd);
54 
55  gROOT->GetListOfTasks()->Add(run);
56  gROOT->GetListOfBrowsables()->Add(run);
57  new TBrowser;
58 }
59 
60 #endif
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
TTask is a base class that can be used to build a complex tree of Tasks.
Definition: TTask.h:34
#define gROOT
Definition: TROOT.h:344
Basic string class.
Definition: TString.h:137
virtual void Add(TTask *task)
Definition: TTask.h:57
virtual const char * UnixPathName(const char *unixpathname)
Convert from a Unix pathname to a local pathname.
Definition: TSystem.cxx:1020
void tasks()
Definition: tasks.C:12
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545
void dir(char *path=0)
Definition: rootalias.C:30