+//______________________________________________________________________________
+const char *AliAnalysisAlien::GetListOfFiles(const char *type)
+{
+// Get a comma-separated list of output files of the requested type.
+// Type can be (case unsensitive):
+// aod - list of aod files (std, extensions and filters)
+// out - list of output files connected to containers (but not aod's or extras)
+// ext - list of extra files registered to the manager
+// ter - list of files produced in terminate
+ static TString files;
+ files = "";
+ TString stype = type;
+ stype.ToLower();
+ TString aodfiles, extra;
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ if (!mgr) {
+ ::Error("GetListOfFiles", "Cannot call this without analysis manager");
+ return files.Data();
+ }
+ if (mgr->GetOutputEventHandler()) {
+ aodfiles = mgr->GetOutputEventHandler()->GetOutputFileName();
+ TString extraaod = mgr->GetOutputEventHandler()->GetExtraOutputs();
+ if (!extraaod.IsNull()) {
+ aodfiles += ",";
+ aodfiles += extraaod;
+ }
+ }
+ if (stype.Contains("aod")) {
+ files = aodfiles;
+ if (stype == "aod") return files.Data();
+ }
+ // Add output files that are not in the list of AOD files
+ TString outputfiles = "";
+ TIter next(mgr->GetOutputs());
+ AliAnalysisDataContainer *output;
+ const char *filename = 0;
+ while ((output=(AliAnalysisDataContainer*)next())) {
+ filename = output->GetFileName();
+ if (!(strcmp(filename, "default"))) continue;
+ if (outputfiles.Contains(filename)) continue;
+ if (aodfiles.Contains(filename)) continue;
+ if (!outputfiles.IsNull()) outputfiles += ",";
+ outputfiles += filename;
+ }
+ if (stype.Contains("out")) {
+ if (!files.IsNull()) files += ",";
+ files += outputfiles;
+ if (stype == "out") return files.Data();
+ }
+ // Add extra files registered to the analysis manager
+ TString sextra;
+ extra = mgr->GetExtraFiles();
+ if (!extra.IsNull()) {
+ extra.Strip();
+ extra.ReplaceAll(" ", ",");
+ TObjArray *fextra = extra.Tokenize(",");
+ TIter nextx(fextra);
+ TObject *obj;
+ while ((obj=nextx())) {
+ if (aodfiles.Contains(obj->GetName())) continue;
+ if (outputfiles.Contains(obj->GetName())) continue;
+ if (sextra.Contains(obj->GetName())) continue;
+ if (!sextra.IsNull()) sextra += ",";
+ sextra += obj->GetName();
+ }
+ delete fextra;
+ if (stype.Contains("ext")) {
+ if (!files.IsNull()) files += ",";
+ files += sextra;
+ }
+ }
+ if (stype == "ext") return files.Data();
+ TString termfiles;
+ if (!fTerminateFiles.IsNull()) {
+ fTerminateFiles.Strip();
+ fTerminateFiles.ReplaceAll(" ",",");
+ TObjArray *fextra = fTerminateFiles.Tokenize(",");
+ TIter nextx(fextra);
+ TObject *obj;
+ while ((obj=nextx())) {
+ if (aodfiles.Contains(obj->GetName())) continue;
+ if (outputfiles.Contains(obj->GetName())) continue;
+ if (termfiles.Contains(obj->GetName())) continue;
+ if (sextra.Contains(obj->GetName())) continue;
+ if (!termfiles.IsNull()) termfiles += ",";
+ termfiles += obj->GetName();
+ }
+ delete fextra;
+ }
+ if (stype.Contains("ter")) {
+ if (!files.IsNull() && !termfiles.IsNull()) {
+ files += ",";
+ files += termfiles;
+ }
+ }
+ return files.Data();
+}
+