From e34fc3f4095b3b1637d22fb1e9305171a3d8af6d Mon Sep 17 00:00:00 2001
From: Danilo Piparo <danilo.piparo@cern.ch>
Date: Tue, 16 Apr 2019 11:37:49 +0200
Subject: [PATCH] [TTreeProcessorMT][ROOT-9948] Do not error out with TTrees
 from remote files

this is achieved adding a special case which checks if the directory
containing the tree is a file or a proper directory.
---
 tree/treeplayer/src/TTreeProcessorMT.cxx | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tree/treeplayer/src/TTreeProcessorMT.cxx b/tree/treeplayer/src/TTreeProcessorMT.cxx
index c914bdf7793..025565dc37b 100644
--- a/tree/treeplayer/src/TTreeProcessorMT.cxx
+++ b/tree/treeplayer/src/TTreeProcessorMT.cxx
@@ -171,6 +171,14 @@ static std::string GetTreeFullPath(const TTree &tree)
 
    // Case 2: this is a TTree: we get the full path of it
    if (auto motherDir = tree.GetDirectory()) {
+      // We have 2 subcases (ROOT-9948):
+      // - 1. motherDir is a TFile
+      // - 2. motherDir is a directory
+      // If 1. we just return the name of the tree, if 2. we reconstruct the path
+      // to the file.
+      if (motherDir->InheritsFrom("TFile")) {
+         return tree.GetName();
+      }
       std::string fullPath(motherDir->GetPath());
       fullPath += "/";
       fullPath += tree.GetName();
-- 
GitLab