+//______________________________________________________________________________
+Bool_t AliAnalysisTask::CheckPostData() const
+{
+// Checks if data was posted to all outputs defined by the task. If task does
+// not have output slots this returns always kTRUE.
+ Bool_t dataPosted = kTRUE;
+ AliAnalysisDataContainer *coutput;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ for (Int_t islot=0; islot<fNoutputs; islot++) {
+ coutput = GetOutputSlot(islot)->GetContainer();
+ if (!coutput) continue;
+ if (coutput->IsExchange() || !mgr->GetOutputs()->FindObject(coutput) || coutput==mgr->GetCommonOutputContainer()) continue;
+ if (!coutput->GetData()) {
+ Error("CheckPostData", "Data not posted for slot #%d of task %s (%s)",
+ islot, GetName(), ClassName());
+ dataPosted = kFALSE;
+ }
+ }
+ CheckOwnership();
+ return dataPosted;
+}
+
+//______________________________________________________________________________
+Bool_t AliAnalysisTask::CheckOwnership() const
+{
+// Check ownership of containers posted on output slots (1 level only)
+ TObject *outdata;
+ for (Int_t islot=0; islot<fNoutputs; islot++) {
+ outdata = GetOutputData(islot);
+ if (outdata && outdata->InheritsFrom(TCollection::Class())) {
+ TCollection *coll = (TCollection*)outdata;
+ if (!coll->IsOwner()) {
+ Error("CheckOwnership","####### IMPORTANT! ####### \n\n\n\
+ Task %s (%s) posts a container that is not owner at output #%d. This may apply for other embedded containers. \n\n\
+ ####### FIX YOUR CODE, THIS WILL PRODUCE A FATAL ERROR IN FUTURE! ##########", GetName(), ClassName(), islot);
+ return kFALSE;
+ }
+ }
+ }
+ return kTRUE;
+}
+