X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=RALICE%2FAliJob.cxx;h=f79b9dc5c42338e69626251dfd641350221de7e0;hb=064d808ddc1fca8e6167c1a98d341ac62e85f258;hp=002bfeb191e89e81ae8da971758bf1720be0589b;hpb=9f575717e81178fc20b39eb8e381a51dfe931e7c;p=u%2Fmrichter%2FAliRoot.git diff --git a/RALICE/AliJob.cxx b/RALICE/AliJob.cxx index 002bfeb191e..f79b9dc5c42 100644 --- a/RALICE/AliJob.cxx +++ b/RALICE/AliJob.cxx @@ -23,7 +23,14 @@ // main object structure (e.g. AliEvent for event-by-event processing). // The main object structure (if needed) may be specified by the derived // top level processor class and will be stored automatically in the -// working environment (see below). +// working environment (see below). +// +// However, being designed as a base class for a user defined top level +// processor, this class can also be used as a "hook" to specify +// various sub-tasks in an (interactive) user environment. +// Usage of the memberfunction ProcessObject() allows an (interactive) +// event-by-event processing of the various specified subtasks. +// // This base class provides a working environment for the derived // (user defined) processor class and all of its subtasks. // @@ -98,12 +105,14 @@ // // It is the user's responsibility to invoke the sub-tasks via the // ExecuteTasks() statement at the appropriate location in the top level -// processor class. +// processor class if auto-execution was not explicitly selected via the +// "mode" argument of the ExecuteJob() memberfunction. // //--- Author: Nick van Eijndhoven 07-may-2005 Utrecht University //- Modified: NvE $Date$ Utrecht University /////////////////////////////////////////////////////////////////////////// +#include #include "AliJob.h" #include "Riostream.h" @@ -182,22 +191,38 @@ void AliJob::ExecuteJob(Int_t mode) { // Invokation of the top level processor via its Exec() memberfunction. // The input argument "mode" can be used to explicitly specify the -// (de)selection of the folder environment creation. +// (de)selection of the folder environment creation and automatic +// invokation of all subtasks after execution of the top level +// Exec() memberfunction. +// The latter is convenient if an AliJob instance is used directly +// by the user (e.g. in a ROOT macro) in order to provide a hook +// for event-by-event processing of various subtasks. +// An even more convenient alternative to achieve this is invokation of the +// memberfunction ProcessObject(). // // mode = -1 : Explicitly prohibit folder creation for the complete job // 0 : Folder creation selection steered by MakeFolder() // 1 : Explicitly select creation of the folder environment // for the complete job. +// -11 : Same as mode=-1 but also auto-execution of subtasks after Exec() +// 10 : Same as mode=0 but also auto-execution of subtasks after Exec() +// 11 : Same as mode=1 but also auto-execution of subtasks after Exec() // // The default is mode=0. // // Note : Before execution gROOT is set as the global working directory. if (mode<0) fMakefolder=-1; - if (mode>0) fMakefolder=1; + if (mode==1 || mode==11) fMakefolder=1; gROOT->cd(); Exec(GetName()); + + if (abs(mode)>9) + { + CleanTasks(); + ExecuteTasks(GetName()); + } } /////////////////////////////////////////////////////////////////////////// void AliJob::MakeFolder() @@ -397,3 +422,31 @@ TObjArray* AliJob::GetObjects(const char* classname) return fSelect; } /////////////////////////////////////////////////////////////////////////// +void AliJob::ProcessObject(TObject* obj) +{ +// Invokation of all user defined sub-tasks for the specified object. +// This facility is very convenient when performing a task based +// event-by-event analysis in an (interactive) user application. +// +// Note : +// ------ +// Before processing gROOT is set as the global working directory. +// The specified object will be added to the job's object list +// as main object before the processing starts. +// This will allow the various sub-tasks to access the object in the +// usual way. +// After the processing of this object has been performed, the object +// will be removed from the object list and the main object pointer will +// be set to zero. + + if (!obj) return; + + SetMainObject(obj); + + gROOT->cd(); + CleanTasks(); + ExecuteTasks(GetName()); + + RemoveObject(obj); +} +///////////////////////////////////////////////////////////////////////////