Hi Bent,
just in case this is still relevant to you: Could it be that what you are seeing are just the backup copies created by the root TTree Autosave?
If I open your file with root, and do “.ls”, this is the output I see:
TFile* first_half_tele_events.root
KEY: TTree Pixel;3 Tree of Pixel [current cycle]
KEY: TTree Pixel;2 Tree of Pixel [backup cycle]
KEY: TTree Event;2 Tree of Events [current cycle]
KEY: TTree Event;1 Tree of Events [backup cycle]
KEY: TDirectoryFile config;1 config
This is not corryvreckan-specific, but generally, usually when you have “duplicate trees seen in TBrowser” , that’s a save cycle thing; here’s my understanding on what could be causing this.
→ the keyword to search for in the root documentation to understand this is “cycle” or “namecycle” (for saved objects name;cycle)
Root begins filling the tree (e.g. “mytree”), and when the number of entries reaches the one given by ‘AutoSave’, the meta-data is flushed to the disk. mytree;1 is a snapshot of the metadata at that point. The next time a write operation is performed, the cycle number is increased, and you get mytree;2. The different cycles are kind of a crash-recovery mechanism - if your code crashes, and there was an autosave in between, you can usually recover the entries up to that point from the file.
TBrowser shows all versions of an object (a histogramm, a tree, …). That’s what you are seeing.
If you just do …->Get(“mytree”) in a macro/in cling, it automatically retrieves the one with the highest cycle number, i.e. the one that was most recently created, so in that case you don’t even notice.
If it really bothers you to see multiple versions in TBrowser, I think you could prevent that by adding the option kWriteDelete when storing the file (from TObject documentation: “write object, then delete previous key with same name”).
Although I wouldn’t really consider it a problem: mytree;2 and mytree;1 are not two completely different trees, just different namecycles for the same tree, and only the TTree metadata is duplicated between namecycles. The real data is only present once in the file, so it doesn’t use a lot of extra filespace.