Hi,
In running this code:
void test(){
//TH1::AddDirectory(kFALSE);
ROOT::EnableImplicitMT();
std::unique_ptr<TFile> inf( TFile::Open("ifile.root"));
TTree *tcrs = inf->Get<TTree>("poker_crs");
TTree *thcal= inf->Get<TTree>("poker_hcal");
tcrs->AddFriend(thcal,"hcal");
ROOT::RDataFrame d(*tcrs);
auto h1 = d.Histo1D("dene");
auto h2 = d.Histo1D("hcal.dene");
TFile *fout=new TFile("ofile.root","recreate");
//fout->cd();
//fout->mkdir("mydir");
h1->Write();
h2->Write();
//gDirectory->pwd();
fout->Close();
}
I encountered this error:
Error in TROOT::WriteTObject: The current directory (Rint) is not associated with a file. The object (dene) has not been written.
Error in TROOT::WriteTObject: The current directory (Rint) is not associated with a file. The object (hcal.dene) has not been written.
You can find the ifile.root file here: CERNBox
I have noticed that If I remove line 3 “ROOT::EnableImplicitMT();” the code works.
It seems similar to what was reported in:
https://sft.its.cern.ch/jira/browse/ROOT-10152
But this problem should have been fixed for the ROOT version (6.24/06) that I use.
Do you have any advice or suggestions?
Thanks,
Pietro
ROOT Version: 6.24/06
Platform: Linux CentOS7
Compiler: gcc (GCC) 11.2.0