diff --git a/form/root_storage/root_ttree_write_container.cpp b/form/root_storage/root_ttree_write_container.cpp index 533aa90c..a46f63f9 100644 --- a/form/root_storage/root_ttree_write_container.cpp +++ b/form/root_storage/root_ttree_write_container.cpp @@ -42,8 +42,8 @@ void ROOT_TTree_Write_ContainerImp::setupWrite(std::type_info const& /* type*/) m_tree = m_tfile->Get(name().c_str()); } if (m_tree == nullptr) { + TDirectory::TContext context(m_tfile.get()); m_tree = new TTree(name().c_str(), name().c_str()); - m_tree->SetDirectory(m_tfile.get()); } if (m_tree == nullptr) { throw std::runtime_error("ROOT_TTree_Write_ContainerImp::setupWrite no tree created");