#include <TFile.h>
#include <TClass.h>
#include <TTree.h>
+#include <TROOT.h>
#include "AliAnalysisTask.h"
#include "AliAnalysisDataSlot.h"
fOutputReady(NULL),
fPublishedData(NULL),
fInputs(NULL),
- fOutputs(NULL)
+ fOutputs(NULL),
+ fBranchNames()
{
// Default constructor.
}
fOutputReady(NULL),
fPublishedData(NULL),
fInputs(NULL),
- fOutputs(NULL)
+ fOutputs(NULL),
+ fBranchNames()
{
// Constructor.
fInputs = new TObjArray(2);
fOutputReady(NULL),
fPublishedData(NULL),
fInputs(NULL),
- fOutputs(NULL)
+ fOutputs(NULL),
+ fBranchNames(task.fBranchNames)
{
// Copy ctor.
fInputs = new TObjArray((fNinputs)?fNinputs:2);
fOutputReady[i] = IsOutputReady(i);
fOutputs->AddAt(new AliAnalysisDataSlot(*task.GetOutputSlot(i)),i);
}
+ fBranchNames = task.fBranchNames;
return *this;
}
}
AliAnalysisDataSlot::EnableBranch(bname, tree);
}
+
+//______________________________________________________________________________
+void AliAnalysisTask::FinishTaskOutput()
+{
+// 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.
+}
//______________________________________________________________________________
void AliAnalysisTask::ConnectInputData(Option_t *)
Error("OpenFile", "No output slot for task %s with index %d", GetName(), iout);
return NULL;
}
- // We allow file opening also on the slaves (AG)
-// AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-// if (!mgr || mgr->GetAnalysisType()==AliAnalysisManager::kProofAnalysis) return;
+ // Method delegated to the analysis manager (A.G. 02/11/09)
AliAnalysisDataContainer *cont = GetOutputSlot(iout)->GetContainer();
- TFile *f = NULL;
- if (strlen(cont->GetFileName())) f = new TFile(cont->GetFileName(), option);
- if (f && !f->IsZombie()) return f;
- return NULL;
+ return AliAnalysisManager::OpenFile(cont, option);
}
//______________________________________________________________________________
return kTRUE;
}
+//______________________________________________________________________________
+Bool_t AliAnalysisTask::NotifyBinChange()
+{
+// Overload this IF you need to treat bin change in event mixing.
+ return kTRUE;
+}
+
//______________________________________________________________________________
void AliAnalysisTask::Terminate(Option_t *)
{
AliAnalysisDataContainer *cont;
for (Int_t i=0; i<indent; i++) ind += " ";
if (!dep || (dep && IsChecked())) {
+ printf("______________________________________________________________________________\n");
printf("%s\n", Form("%stask: %s ACTIVE=%i POST_LOOP=%i", ind.Data(), GetName(),IsActive(),IsPostEventLoop()));
if (dep) thistask->SetChecked(kFALSE);
else {
}
}
PrintContainers(option, indent+3);
+ if (!fBranchNames.IsNull()) printf("Requested branches: %s\n", fBranchNames.Data());
}
//______________________________________________________________________________
}
}
+//______________________________________________________________________________
+void AliAnalysisTask::GetBranches(const char *type, TString &result) const
+{
+// 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")
+ result = "";
+ if (fBranchNames.IsNull()) return;
+ Int_t index1 = fBranchNames.Index(type);
+ if (index1<0) return;
+ index1 += 1+strlen(type);
+ Int_t index2 = fBranchNames.Index(" ", index1);
+ if (index2<0) index2 = fBranchNames.Length();
+ result = fBranchNames(index1, index2-index1);
+}