Newbie
1
Hi, I’m trying to delete a few histograms in my rootfile, to hadd it with another smaller rootfile with the correct histograms, this is what I do:
TFile *f = TFile::Open(“NTUP_PILEUP.pool.root.1”,“update”);
f->cd(“PileupReweighting”)
f->Delete(“pileup_TH1”);
So it’s not complaining but it doesn’t delete the histograms.
I also tried:
gDirectory->Delete(“pileup_TH1”)
TFile *f = TFile::Open("NTUP_PILEUP.pool.root.1", "update");
f->cd("PileupReweighting");
gDirectory->Delete("pileup_TH1;*"); // all "cycles"
// f->Write();
delete f;
Newbie
3
It worked, thanks a lot!
Btw what are these cycles and why do we have to delete “f”?
The “delete f;
” will “close” the opened file (and cleanup RAM).
couet
5
Also the command line tool rootrm
might be of some help in that case (surely simpler)
1 Like
system
Closed
6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.