Saving histogram to an existing ROOT file


after viewing a TTree with the viewer, i added labels and marks, then i tried to save in my .root file with the command htemp->Write() written in the “Command” field of the tree viewer but i got this message:

htemp->Write() Error in <TH1F::Write>: File mu0_1GeVtheta0.root is not writable (Int_t)0

what i have to do to solve this problem?


You have to open the file in update mode!:TFile *myfile = TFile::Open("mu0_1GeVtheta0.root","UPDATE");The default is to open the file read-only.


thank you!