I’m using rDataFrame I am creating a new Branch computed from some values from a TH1D that I import through a local file.
When I try to make a Snapshot of the Tree with the newly added branch however the process crashes. A reduced snippet showing what I am trying to do is below.
Processing eSliceMethod_branchPrep.C+("../prod4_files/eventSelection_Prod4_mc_1GeV_all_1_14_21.root")...
Error in <TFile::WriteTObject>: Directory fit_file.root is not writable
Error in <TFile::WriteTObject>: Directory fit_file.root is not writable
Has anyone encountered this problem?
Thanks
francesca
ROOT Version: 6.22/06 Platform: Built for macosx64
I think the issue is that you open the file fit_file.root in READ mode but not in UPDATE mode. If you replace TFile f2("fit_file.root"); by TFile f2("fit_file.root", "UPDATE");, it should work. The error comes then from the line operation->Write();, which tries to write into fit_file.root, but does not have write permissions.
Hi @swunsch ,
thanks, sorry this one I missed, the operation->Write() is not essential, I forgot to take it out from the macro. unfortunately the macro crashes when doing the snapshot.
If I comment the line that does the RDF Snapshot the macro works well.
the problem is the Snapshot operations, somehow ROOT seems not to be able to save this normally to the working directory as it does when just simply opening a RDF in a macro and creating new columns without using information from a different file like I am doing now.
Ah alright, I was confused
Here is an example program which mocks your input files. Could you try to make it break with this standalone example? I wasn’t able to reproduce it!
You create the TH1D called operation in the scope of the TFile f2, but then you close the file before you call Snapshot on the dataframe. This causes your event loop, just triggered at the time of running the Snapshot, to access the already deleted histogram operation.
So I guess you should move the f2.Close()after the frame.Snapshot().