- Small fix in data ownership by containers
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 May 2008 16:07:49 +0000 (16:07 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 23 May 2008 16:07:49 +0000 (16:07 +0000)
ANALYSIS/AliAnalysisDataContainer.cxx
ANALYSIS/AliAnalysisManager.cxx

index 044514e..956d349 100644 (file)
@@ -76,7 +76,7 @@ AliAnalysisDataContainer::AliAnalysisDataContainer() : TNamed(),
 AliAnalysisDataContainer::AliAnalysisDataContainer(const char *name, TClass *type)
                          :TNamed(name,""),
                           fDataReady(kFALSE),
-                          fOwnedData(kTRUE),
+                          fOwnedData(kFALSE),
                           fFileName(),
                           fFile(NULL),
                           fData(NULL),
index 5a7f70b..b0bf7b7 100644 (file)
@@ -486,6 +486,7 @@ void AliAnalysisManager::ImportWrappers(TList *source)
    AliAnalysisDataWrapper   *wrap;
    Int_t icont = 0;
    while ((cont=(AliAnalysisDataContainer*)next())) {
+      wrap = 0;
       if (cont->GetProducer()->IsPostEventLoop()) continue;
       if (cont->IsSpecialOutput()) {
          if (strlen(fSpecialOutputLocation.Data())) continue;
@@ -500,9 +501,16 @@ void AliAnalysisManager::ImportWrappers(TList *source)
          // Normally we should connect data from the copied file to the
          // corresponding output container, but it is not obvious how to do this
          // automatically if several objects in file...
-         continue;
+         TFile *f = new TFile(cont->GetFileName(), "READ");
+         TObject *obj = f->Get(cont->GetName());
+         if (!obj) {
+            Error("ImportWrappers", "Could not find object %s in file %s", cont->GetName(), cont->GetFileName());
+            continue;
+         }
+         wrap = new AliAnalysisDataWrapper(obj);
+         wrap->SetDeleteData(kFALSE);
       }   
-      wrap = (AliAnalysisDataWrapper*)source->FindObject(cont->GetName());
+      if (!wrap) wrap = (AliAnalysisDataWrapper*)source->FindObject(cont->GetName());
       if (!wrap) {
          Error("ImportWrappers","Container %s not found in analysis output !", cont->GetName());
          continue;