Exclude an histogram from a TFile


I would like an histogram not to be automatically added to a rootfile when created. Is it possible? Also, is there a way to get rid of all the cycle numbers at the end of the histograms in the file, i.e. see only one histogram with the TBrowser?


You can prevent an histogram to be added to the current directory

-for histogram TH1* h, call h->SetDirectory(0);

-calling the static function TH1::AddDirectory(kFALSE);
None of the histograms created after this call will be added to the file.

Note that in both cases above, it is your responsability to do the bookkeeping of your histograms.

Please read the chapter about Object ownership in the Users Guide.