Hadd of already merged TString ROOT 5.34/03

Hi everybody,

I have a naive question about hadd and TString and ROOT 5.34/03 (64b)

Using distributed analysis I got already merge ROOT files containing TString like for example :

file1.root
TDirectoryFile* Lumi_4mu Lumi_4mu
KEY: TObjString physics;36 Collectable string class
KEY: TObjString physics;35 Collectable string class

KEY: TObjString physics;2 Collectable string class
KEY: TObjString physics;1 Collectable string class

file2.root
TDirectoryFile* Lumi_4mu Lumi_4mu
KEY: TObjString physics;21 Collectable string class
KEY: TObjString physics;20 Collectable string class

KEY: TObjString physics;2 Collectable string class
KEY: TObjString physics;1 Collectable string class

since the content of the TSting (xml content) cannot be merged we got cycle number (one for each TString that cannot be merge in on TString) : physics;1 … N

Now if I tried to merge file1.root and file2.root I got :
TDirectoryFile* Lumi_4mu Lumi_4mu
KEY: TObjString physics;2 Collectable string class
KEY: TObjString physics;1 Collectable string class

where I have the impression that I lost everything except the first TString of each file while I will expect to have the cycle number that increase to take into account the one coming from the new file !
I such case I will except to have :
physics;57

physics;1

Which I don’t (expect if I don’t access it correctly)

It is possible to do what I want : hadd of already merge ROOT files with TString and all cyle number ?
It seems that I am loosing most of the information ?

Is there a way to avoid that ? or maybe I need to access that in a different way ?

Thanks a lot
Cheers
Fabien

If you take a look at root.cern.ch/root/html/tutorials/io/hadd.C.html you will see a comment eventually (line 76) that says:

[quote]keep only the highest cycle number for each key[/quote].

So I think the behavior that you observe is correct as far as hadd.C is concerned. I guess the author expected you to only want the most “recent” cycle of each object.

A solution would be to provide a unique key for each TObjString when making the original files, with only one cycle each. Then hadd would include all of them. Another would be to modify hadd.C and recompile to make it include all cycles (and re-increment the cycle numbers from consecutive files in order). The former sounds easier to me.

Jean-François

Hi Jean-François,

Thanks for the explanation. I wrote my own code to do the merging of my TString and everything is working well now.

Thanks
Cheers
Fabien