Trouble with 'same key double TTree' in root-file

Hi,
I’m not sure if this topic is an old one, however I did not find a similar one.
My problem is that I have a root file containing two TTree-objects with the same key-name. To be clear I only created one TTree and the file somehow wrote two into my root-file. (My foregoing algorithm opens the TFile with the option ‘recreate’, so it should not include the TTree from a previous run…)

root [1] _file0->ls()
TFile**         DATA_Xib2LK_12aLL_MagDown.root  
 TFile*         DATA_Xib2LK_12aLL_MagDown.root  
  KEY: TTree    DATA_Xib2LK_12aLL_MagDown;4     DATA_Xib2LK_12aLL_MagDown
  KEY: TTree    DATA_Xib2LK_12aLL_MagDown;3     DATA_Xib2LK_12aLL_MagDown
root [2] TTree* tree = (TTree*)_file0->Get("DATA_Xib2LK_12aLL_MagDown")
(TTree *) 0x34961f0
root [3] tree->GetEntries()
(Long64_t) 933494

In the TBrowser I can access and draw the key;4 and key;3. They have a different amount of entries:
Entries key;4 -> 933494
Entries key;3 -> 717840

So my question is, if the TTree is corrupted and has not been created incorrectly in the fist place, if accessing only the TTree with key;4 already includes the key;3 or if I have to access this in another way.

Cheers
Harald

Thanks for your link to the ‘cycle’ topics! I got the point with the cycle-number and how I can access the TTree.
However, for me, one part of my question isn’t clear yet. Is it possible that a single call of the Write() method produces split TTree’s or is it just an iteration? On the one hand under the premise that my TTree objects are iterations, it is save to use the Object with the higher cycle-number I get by calling the Get()-method. On the other hand, when the TTree is split, things get complicated.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.