Adding root files with information

Hi All,

I am running simulations that generate thousands of .root files. I have to store information in the root files about my simulation, this information is the same in every root file but could be different in every simulation. So when I merge the root files into one big root file with the ‘hadd’ software, I would need a method to store not just the histograms but also the information.

My problem is:
-when I set the root file titles to: “configuration xy size xy etc” and I hadd these, I lose the information.
-when is store another object like “TNamed” in the root files with the title of my information, they are not merging so I get a lot of TNamed object in my last big root file.

My question: how can I store additional information in root files without having these problems?

Thanks for your help in advance.

hadd adds histograms from a list of root files and write them to a target root file “targetfile”… The name of target file is nome computed from the names of the list of files to be merge. What do you mean exactly by “set the root file titles” ?

The question is : “How to merge these TNamed” ? by concatenating them ?

const char * myinformation = whatiwanttostore.c_str();
TFile rootFile(rootfilename1,"RECREATE",myinformation);
TFile rootFile(rootfilename2,"RECREATE",myinformation);

or

const char * myinformation = whatiwanttostore.c_str();
TFile rootFile(rootfilename1,"RECREATE");
rootFile.SetTitle(myinformation);
//...

it works because when is call .GetTitle() on one of my rootfiles I get back my informations, so its stored in my files.

and then I do

hadd targetfile rootfilename1 rootfilename2

and the targetfile doesn’t have title, but the title is the same in rootfilename1 and rootfilename2.
So this is not a solution to my problem because the files lose their TNamed titles when I add them together with ‘hadd’.

I need a way where I call hadd on my files and i have one simple information ‘string’ in my last targetrootfile. The problem is when is store additional Objects like TNamed(i could be a string or anything else) objects in my rootfiles and i do

hadd targetfile rootfilename1 rootfilename2

i have a lot of TNamed objects in my last targetfile. (And these TNamed all the same and i only need one).

So is there any way to store information in rootfiles, information which I wont lose (or i wont have a lot of same information) after i ‘hadd’ them together?
Thank you very much for your help!