I was wondering if there there is a facility in place to store infomation about a histogram, i.e. what weights were applied when it was filled and the such. I know that I can just generate a wrapper class and add my field into it but it would be nice if there was some way that I could store a simple data structure in the histogram itself. I realize that their might be problems with this when it comes to saving a root file and that might be why it does not exist.
For those familiar with QT I think there is a similar system in place to store information.
You can add any TObject derived class in myhist.GetListOfFunctions()
I looked at that method in the TH1 class and it returns a TList. So what I am trying to do is something like:
TString tmp_string = “x-section,Luminosity,HeavyFlavor”;
and then later do
TString tmp_string = (TString) myhisto.GetUser(“weights”);
cout << "The weights used in this histogram were: " << tmp_string << endl;
Possibly this is just exactly what you told me about just now, but I guess I am still just a bit confused about it.
Using the standard TH1x classes, do, eg
and then later
TNamed *w = (TNamed*)myhisto.GetListOfFunctions()->FindObject("weights");
cout << "The weights used in this histogram were: " << w->GetTitle() << endl;