Problem Cloning THnSparse


_ROOT Version:_6.19/01
_Platform:_linuxx8664gcc
_Compiler:_gcc version 8.3.1 20190223 (Red Hat 8.3.1-2) (GCC)


I am trying to clone a THnSparse as follows:

root [0] .L can2root_utils_cc.so 
root [1] openF("2.root");
root [2] .ls
TFile**		2.root	
 TFile*		2.root	
  KEY: THnSparseT<TArrayF>	ggTD_2;1	sparse3D
root [3] THnSparse *sparse3Dn = (THnSparseF*)gROOT->FindObject("ggTD_2")->Clone();
root [4] sparse3Dn->SetName("ggTD_1");
root [5] .ls
TFile**		2.root	
 TFile*		2.root	
  KEY: THnSparseT<TArrayF>	ggTD_2;1	sparse3D
root [6] 

But, as you can see there is no ggTD_1 which is the copy of original ggTD_2. Am I doing some silly mistake? Please note that, openF("2.root") above opens 2.root in “UPDATE” mode.

Regards,

Ajay

you have to write the new THnSparse into the file explicitly.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.