AliAnalysysTask - Class representing a basic analysis task. Any user-defined task should derive from it and implement the Exec() virtual method. A specific user analysis task have to derive from this class. The list of specific input and output slots have to be defined in the derived class ctor: UserTask::UserTask(name, title) { DefineInput(0, TTree::Class()); DefineInput(1, TH1::Class()); DefineOutput(0, TTree::Class()); DefineOutput(1, MyObject::Class()); } An existing data contaner (AliAnalysisDataContainer) can be connected to the input/output slots of an analysis task. Containers should not be defined and connected by the derived analysis task, but from the level of AliAnalysisManager: AliAnalysisManager::ConnectInput(AliAnalysisTask *task, Int_t islot, AliAnalysisDataContainer *cont) AliAnalysisManager::ConnectOutput(AliAnalysisTask *task, Int_t islot, AliAnalysisDataContainer *cont) To connect a slot to a data container, the data types declared by both must match. The method ConnectInputData() has to be overloaded by the derived class in order to set the branch address or connect to a branch address in case the input slots are connected to trees. Example: MyAnalysisTask::ConnectInputData(Option_t *) { // One should first check if the branch address was taken by some other task char ** address = (char **)GetBranchAddress(0, "ESD"); if (address) { fESD = (AliESD*)(*address); } else { fESD = new AliESD(); SetBranchAddress(0, "ESD", &fESD); } } The method LocalInit() may be implemented to call locally (on the client) all initialization methods of the class. It is not mandatory and was created in order to minimize the complexity and readability of the analysis macro. DO NOT create in this method the histigrams or task output objects that will go in the task output containers. Use CreateOutputObjects for that. The method CreateOutputObjects() has to be implemented an will contain the objects that should be created only once per session (e.g. output histograms) void MyAnalysisTask::CreateOutputObjects() { create histograms fhPt = new TH1F("fhPt","This is the Pt distribution",15,0.1,3.1); fhPt->SetStats(kTRUE); fhPt->GetXaxis()->SetTitle("P_{T} [GeV]"); fhPt->GetYaxis()->SetTitle("#frac{dN}{dP_{T}}"); fhPt->GetXaxis()->SetTitleColor(1); fhPt->SetMarkerStyle(kFullCircle); } The method Terminate() will be called by the framework once at the end of data processing. Overload this if needed. DO NOT ASSUME that the pointers to histograms defined in CreateOutputObjects() are valid, since this is not true in case of PROOF. Restore the pointer values like: void MyAnalysisTask::Terminate(Option_t *) { fhPt = (TH1F*)GetOutputData(0); }
virtual | ~AliAnalysisTask() |
virtual void | TTask::Abort()MENU |
void | TObject::AbstractMethod(const char* method) const |
virtual void | TTask::Add(TTask* task) |
virtual void | TObject::AppendPad(Option_t* option = "") |
Bool_t | AreSlotsConnected() |
virtual void | TTask::Browse(TBrowser* b) |
Bool_t | CheckCircularDeps() |
void | CheckNotify(Bool_t init = kFALSE) |
virtual Bool_t | CheckOwnership() const |
virtual Bool_t | CheckPostData() const |
static TClass* | Class() |
virtual const char* | TObject::ClassName() const |
virtual void | TTask::CleanTasks() |
virtual void | TTask::Clear(Option_t* option = "") |
virtual TObject* | TNamed::Clone(const char* newname = "") const |
virtual Int_t | TNamed::Compare(const TObject* obj) const |
Bool_t | ConnectInput(Int_t islot, AliAnalysisDataContainer* cont) |
virtual void | ConnectInputData(Option_t* option = "") |
Bool_t | ConnectOutput(Int_t islot, AliAnalysisDataContainer* cont) |
virtual void | TTask::Continue()MENU |
virtual void | TNamed::Copy(TObject& named) const |
virtual void | CreateOutputObjects() |
virtual void | TObject::Delete(Option_t* option = "")MENU |
virtual Int_t | TObject::DistancetoPrimitive(Int_t px, Int_t py) |
virtual void | TObject::Draw(Option_t* option = "") |
virtual void | TObject::DrawClass() constMENU |
virtual TObject* | TObject::DrawClone(Option_t* option = "") constMENU |
virtual void | TObject::Dump() constMENU |
virtual void | TObject::Error(const char* method, const char* msgfmt) const |
virtual void | Exec(Option_t* option) |
virtual void | TObject::Execute(const char* method, const char* params, Int_t* error = 0) |
virtual void | TObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0) |
virtual void | TObject::ExecuteEvent(Int_t event, Int_t px, Int_t py) |
virtual void | TTask::ExecuteTask(Option_t* option = "0")MENU |
virtual void | TTask::ExecuteTasks(Option_t* option) |
virtual void | TObject::Fatal(const char* method, const char* msgfmt) const |
virtual void | TNamed::FillBuffer(char*& buffer) |
virtual TObject* | TObject::FindObject(const char* name) const |
virtual TObject* | TObject::FindObject(const TObject* obj) const |
virtual void | FinishTaskOutput() |
void | GetBranches(const char* type, TString& result) const |
Int_t | TTask::GetBreakin() const |
Int_t | TTask::GetBreakout() const |
virtual Option_t* | TObject::GetDrawOption() const |
static Long_t | TObject::GetDtorOnly() |
virtual const char* | TObject::GetIconName() const |
TObject* | GetInputData(Int_t islot) const |
AliAnalysisDataSlot* | GetInputSlot(Int_t islot) const |
TClass* | GetInputType(Int_t islot) const |
TList* | TTask::GetListOfTasks() const |
virtual const char* | TNamed::GetName() const |
Int_t | GetNinputs() const |
Int_t | GetNoutputs() const |
virtual char* | TObject::GetObjectInfo(Int_t px, Int_t py) const |
static Bool_t | TObject::GetObjectStat() |
virtual Option_t* | TObject::GetOption() const |
TObject* | GetOutputData(Int_t islot) const |
AliAnalysisDataSlot* | GetOutputSlot(Int_t islot) const |
TClass* | GetOutputType(Int_t islot) const |
TObject* | GetPublishedData() const |
virtual const char* | TNamed::GetTitle() const |
virtual UInt_t | TObject::GetUniqueID() const |
virtual Bool_t | TObject::HandleTimer(TTimer* timer) |
Bool_t | HasBranches() const |
Bool_t | HasExecuted() const |
virtual ULong_t | TNamed::Hash() const |
virtual void | TObject::Info(const char* method, const char* msgfmt) const |
virtual Bool_t | TObject::InheritsFrom(const char* classname) const |
virtual Bool_t | TObject::InheritsFrom(const TClass* cl) const |
virtual void | TObject::Inspect() constMENU |
void | TObject::InvertBit(UInt_t f) |
virtual TClass* | IsA() const |
Bool_t | TTask::IsActive() const |
Bool_t | IsChecked() const |
virtual Bool_t | TObject::IsEqual(const TObject* obj) const |
virtual Bool_t | TTask::IsFolder() const |
Bool_t | IsInitialized() const |
Bool_t | TObject::IsOnHeap() const |
Bool_t | IsOutputReady(Int_t islot) const |
Bool_t | IsPostEventLoop() const |
Bool_t | IsReady() const |
virtual Bool_t | TNamed::IsSortable() const |
Bool_t | IsUsed() const |
Bool_t | IsZombie() const |
virtual void | LocalInit() |
virtual void | TTask::ls(Option_t* option = "*") constMENU |
void | TObject::MayNotUse(const char* method) const |
virtual Bool_t | Notify() |
virtual Bool_t | NotifyBinChange() |
void | TObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const |
static void | TObject::operator delete(void* ptr) |
static void | TObject::operator delete(void* ptr, void* vp) |
static void | TObject::operator delete[](void* ptr) |
static void | TObject::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) |
AliAnalysisTask& | operator=(const AliAnalysisTask& task) |
virtual void | TObject::Paint(Option_t* option = "") |
virtual void | TObject::Pop() |
virtual void | TNamed::Print(Option_t* option = "") const |
void | PrintContainers(Option_t* option = "all", Int_t indent = 0) const |
virtual void | PrintTask(Option_t* option = "all", Int_t indent = 0) const |
Bool_t | ProducersTouched() const |
virtual Int_t | TObject::Read(const char* name) |
virtual void | TObject::RecursiveRemove(TObject* obj) |
virtual void | Reset() |
void | TObject::ResetBit(UInt_t f) |
virtual void | TObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU |
virtual void | TObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "") |
void | TTask::SetActive(Bool_t active = kTRUE)TOGGLE |
void | TObject::SetBit(UInt_t f) |
void | TObject::SetBit(UInt_t f, Bool_t set) |
void | SetBranches(const char* names) |
void | TTask::SetBreakin(Int_t breakin = 1)TOGGLE |
void | TTask::SetBreakout(Int_t breakout = 1)TOGGLE |
void | SetChecked(Bool_t flag = kTRUE) |
virtual void | TObject::SetDrawOption(Option_t* option = "")MENU |
static void | TObject::SetDtorOnly(void* obj) |
virtual void | TNamed::SetName(const char* name)MENU |
virtual void | TNamed::SetNameTitle(const char* name, const char* title) |
static void | TObject::SetObjectStat(Bool_t stat) |
void | SetPostEventLoop(Bool_t flag = kTRUE) |
virtual void | TNamed::SetTitle(const char* title = "")MENU |
virtual void | TObject::SetUniqueID(UInt_t uid) |
void | SetUsed(Bool_t flag = kTRUE) |
void | SetZombie(Bool_t flag = kTRUE) |
virtual void | ShowMembers(TMemberInspector&) |
virtual Int_t | TNamed::Sizeof() const |
virtual void | Streamer(TBuffer&) |
void | StreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b) |
virtual void | TObject::SysError(const char* method, const char* msgfmt) const |
virtual void | Terminate(Option_t* option = "") |
Bool_t | TObject::TestBit(UInt_t f) const |
Int_t | TObject::TestBits(UInt_t f) const |
virtual void | TObject::UseCurrentStyle() |
virtual void | TObject::Warning(const char* method, const char* msgfmt) const |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) |
virtual Int_t | TObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const |
void | DefineInput(Int_t islot, TClass* type) |
void | DefineOutput(Int_t islot, TClass* type) |
virtual void | TObject::DoError(int level, const char* location, const char* fmt, va_list va) const |
void | EnableBranch(Int_t islot, const char* bname) const |
char* | GetBranchAddress(Int_t islot, const char* branch) const |
void | TObject::MakeZombie() |
TFile* | OpenFile(Int_t iout, Option_t* option = "RECREATE") const |
Bool_t | PostData(Int_t iout, TObject* data, Option_t* option = "") |
Bool_t | SetBranchAddress(Int_t islot, const char* branch, void* address) const |
enum EAnalysisTaskFlags { | kTaskUsed | |
kTaskZombie | ||
kTaskChecked | ||
kTaskPostEventLoop | ||
}; | ||
enum TObject::EStatusBits { | kCanDelete | |
kMustCleanup | ||
kObjInCanvas | ||
kIsReferenced | ||
kHasUUID | ||
kCannotPick | ||
kNoContextMenu | ||
kInvalidObject | ||
}; | ||
enum TObject::[unnamed] { | kIsOnHeap | |
kNotDeleted | ||
kZombie | ||
kBitMask | ||
kSingleKey | ||
kOverwrite | ||
kWriteDelete | ||
}; |
Bool_t | TTask::fActive | true if task is active |
TString | fBranchNames | List of input branches that need to be loaded for this task |
Int_t | TTask::fBreakin | =1 if a break point set at task extry |
Int_t | TTask::fBreakout | =1 if a break point set at task exit |
Bool_t | TTask::fHasExecuted | True if task has executed |
Bool_t | fInitialized | True if Init() was called |
TObjArray* | fInputs | Array of input slots |
TString | TNamed::fName | object identifier |
Int_t | fNinputs | Number of inputs |
Int_t | fNoutputs | Number of outputs |
TString | TTask::fOption | Option specified in ExecuteTask |
Bool_t* | fOutputReady | [fNoutputs] Flags for output readyness |
TObjArray* | fOutputs | Array of output slots |
TObject* | fPublishedData | ! published data |
Bool_t | fReady | Flag if the task is ready |
TList* | TTask::fTasks | List of Tasks |
TString | TNamed::fTitle | object title |
static TTask* | TTask::fgBeginTask | pointer to task initiator |
static TTask* | TTask::fgBreakPoint | pointer to current break point |
Check if data is available from all inputs. Change the status of the task accordingly. This method is called automatically for all tasks connected to a container where the data was published.
Checks if data was posted to all outputs defined by the task. If task does not have output slots this returns always kTRUE.
Connect an input slot to a data container.
Connect an output slot to a data container.
Retreive input data for a slot if ready. Normally called by Exec() and the object has to be statically cast to the appropriate type.
Retreive output data for a slot. Normally called in UserTask::Terminate to get a valid pointer to data even in case of Proof.
Check if a branch with a given name from the specified input is connected to some address. Call this in Init() before trying to call SetBranchAddress() since the adress may be set by other task.
Connect an object address to a branch of the specified input.
Call this in ConnectInputData() to enable only the branches needed by this task. "*" will enable everything.
Optional method that is called in SlaveTerminate phase. Used for calling aditional methods just after the last event was processed ON THE WORKING NODE. The call is made also in local case. Do NOT delete output objects here since they will have to be sent for merging in PROOF mode - use class destructor for cleanup.
The method LocalInit() may be implemented to call locally (on the client) all initialization methods of the class. It is not mandatory and was created in order to minimize the complexity and readability of the analysis macro. DO NOT create in this method the histigrams or task output objects that will go in the task output containers. Use CreateOutputObjects for that.
Called once per task either in PROOF or local mode. Overload to put some task initialization and/or create your output objects here.
This method has to be called INSIDE the user redefined CreateOutputObjects method, before creating each object corresponding to the output containers that are to be written to a file. This need to be done in general for the big output objects that may not fit memory during processing. - 'option' is the file opening option. NOTE !: The method call will be ignored in PROOF mode, in which case the results have to be streamed back to the client and written just before Terminate() Example: void MyAnaTask::CreateOutputObjects() { OpenFile(0); // Will open the file for the object to be written at output #0 fAOD = new TTree("AOD for D0toKPi"); OpenFile(1); now some histos that should go in the file of the second output container fHist1 = new TH1F("my quality check hist1",...); fHist2 = new TH2F("my quality check hist2",...); }
Post output data for a given ouput slot in the corresponding data container. Published data becomes owned by the data container. If option is specified, the container connected to the output slot must have an associated file name defined. The option represents the method to open the file.
Check for illegal circular dependencies, e.g. a daughter task should not have a hierarchical parent as subtask.
Set the task execution mode - run after event loop or not. All output containers of this task will get the same type.
Get the list of branches for a given type (ESD, AOD). The list of branches requested by a task has to ve declared in the form: SetBranches("ESD:branch1,branch2,...,branchN AOD:branch1,branch2,...,branchM")
{return (AliAnalysisDataSlot*)fInputs->At(islot);}
{return (AliAnalysisDataSlot*)fOutputs->At(islot);}
Main task execution IMPLEMENT THIS !!!
{TObject::SetBit(kTaskZombie,flag);}
=== OVERLOAD THIS IF YOU WANT TO DO SOMETHING WITH THE OUTPUT
{return fHasExecuted;}