ROOT » CORE » BASE » TTask

class TTask: public TNamed


 TTask is a base class that can be used to build a complex tree of Tasks.
 Each TTask derived class may contain other TTasks that can be executed
 recursively, such that a complex program can be dynamically built and executed
 by invoking the services of the top level Task or one of its subtasks.

 Use the TTask::Add function to add a subtask to an existing TTask.
 To execute a TTask, one calls the ExecuteTask function. ExecuteTask will
 call recursively:
     - the TTask::Exec function of the derived class
     - TTask::ExecuteTasks to execute for each task the list of its subtasks.
 If the top level task (see example below) is added to the list of Root
 browsable objects, the tree of tasks can be visualized by the Root browser.
 The browser can be used to start a task, set break points at the beginning
 of a task or when the task has completed. At a breakpoint, data structures
 generated by the execution up this point may be inspected asyncronously
 and then the execution can be resumed by selecting the "Continue" function
 of a task.

 A Task may be active or inactive (controlled by TTask::SetActive).
 When a task is not active, its sub tasks are not executed.

 A TTask tree may be made persistent, saving the status of all the tasks.

 The picture in the Root browser below has been generated by executing
 the following script:

{ //------------------script tasks.C---------------------------
   TTask *aliroot  = new TTask("aliroot","ALICE reconstruction main task");
   TTask *geominit = new TTask("geomInit","Initialize ALICE geometry");
   TTask *matinit  = new TTask("matInit","Initialize ALICE materials");
   TTask *physinit = new TTask("physInit","Initialize Physics processes");
   TTask *tracker  = new TTask("tracker","Track reconstruction manager");
   TTask *tpcrec   = new TTask("tpcrec","TPC reconstruction");
   TTask *itsrec   = new TTask("itsrec","ITS reconstruction");
   TTask *muonrec  = new TTask("muonRec","Muon Reconstruction");
   TTask *phosrec  = new TTask("phosRec","Phos Reconstruction");
   TTask *richrec  = new TTask("richRec","Rich Reconstruction");
   TTask *trdrec   = new TTask("trdRec","TRD Reconstruction");
   TTask *globrec  = new TTask("globRec","Global Track Reconstruction");
   TTask *pstats   = new TTask("printStats","Print Run Statistics");
   TTask *run      = new TTask("run","Process one run");
   TTask *event    = new TTask("event","Process one event");
   aliroot->Add(geominit);
   aliroot->Add(matinit);
   aliroot->Add(physinit);
   aliroot->Add(run);
   run->Add(event);
   event->Add(tracker);
   event->Add(muonrec);
   event->Add(phosrec);
   event->Add(richrec);
   event->Add(trdrec);
   event->Add(globrec);
   tracker->Add(tpcrec);
   tracker->Add(itsrec);
   run->Add(pstats);

   gROOT->GetListOfBrowsables()->Add(aliroot,"aliroot");
   new TBrowser;
} //-------------------------------------------------------------


/* */

Function Members (Methods)

public:
virtual~TTask()
virtual voidAbort()MENU
voidTObject::AbstractMethod(const char* method) const
virtual voidAdd(TTask* task)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidCleanTasks()
virtual voidClear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidContinue()MENU
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidExec(Option_t* option)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidExecuteTask(Option_t* option = "0")MENU
virtual voidExecuteTasks(Option_t* option)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Int_tGetBreakin() const
Int_tGetBreakout() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
TList*GetListOfTasks() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tIsActive() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tIsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidls(Option_t* option = "*") constMENU
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TTask&operator=(const TTask& tt)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidSetActive(Bool_t active = kTRUE)TOGGLE
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetBreakin(Int_t breakin = 1)TOGGLE
voidSetBreakout(Int_t breakout = 1)TOGGLE
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TTask()
TTask(const TTask& task)
TTask(const char* name, const char* title)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
protected:
Bool_tfActivetrue if task is active
Int_tfBreakin=1 if a break point set at task extry
Int_tfBreakout=1 if a break point set at task exit
Bool_tfHasExecutedTrue if task has executed
TStringTNamed::fNameobject identifier
TStringfOptionOption specified in ExecuteTask
TList*fTasksList of Tasks
TStringTNamed::fTitleobject title
static TTask*fgBeginTaskpointer to task initiator
static TTask*fgBreakPointpointer to current break point

Class Charts

Inheritance Chart:
TObject
TNamed
TTask

Function documentation

TTask()
 Default constructor invoked when reading a TTask object from a file.
TTask(const char* name, const char* title)
 Standard constructor.
TTask& operator=(const TTask& tt)
assignment operator (PLEASE DO NOT USE THIS IS WRONG)
TTask(const TTask& task)
 Copy constructor.
~TTask()
 Delete a task and its subtasks.
void Abort()
 Abort current tree of tasks.
 After this call, the tree of tasks is ready to be executed again.
 The application must take care of cleaning data structures created
 by previous executions.
void Browse(TBrowser* b)
 Browse the list of tasks.
 It is recommended to add the top level task to the list of
 ROOT browsables by:
    gROOT->GetListOfBrowsables()->Add(myTopLevelTask)
void CleanTasks()
 Reset tasks state: breakpoints and execute flags
 also invokes the Clear function of each task to clear all data
 structures created by a previous execution of a task.
void Clear(Option_t* option = "")
 Recursively call the Clear function of this task and its subtasks.
 The Clear function must be implemented for each derived class
 to clear all data structures created by a previous execution of a task.
 This function is automatically called by the CleanTasks function.
void Continue()
 Resume execution at the current break point.
void Exec(Option_t* option)
 Dummy Execute.
 This function must be redefined in the derived classes.
void ExecuteTask(Option_t* option = "0")
 Execute main task and its subtasks.
 When calling this function, the Exec function of the corresponding class
 is invoked, then the list of its subtasks is executed calling recursively
 all the subtasks, etc.

 The option parameter may be used to select different execution steps
 within a task. This parameter is passed also to all the subtasks.
void ExecuteTasks(Option_t* option)
 Execute all the subtasks of a task.
void ls(Option_t* option = "*") const
 List the tree of tasks.
 Indentation is used to identify the task tree.
void Add(TTask* task)
{fTasks->Add(task);}
Int_t GetBreakin() const
{ return fBreakin; }
Int_t GetBreakout() const
{ return fBreakout; }
Bool_t IsActive() const
{ return fActive; }
Bool_t IsFolder() const
{ return kTRUE; }
void SetActive(Bool_t active = kTRUE)
{ fActive = active; }
void SetBreakin(Int_t breakin = 1)
{ fBreakin = breakin; }
void SetBreakout(Int_t breakout = 1)
{ fBreakout = breakout; }
TList * GetListOfTasks() const
{ return fTasks; }