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