Wrong histogram when drawing from TChain with multiple unaliased friends


I’m having some trouble drawing histograms from a TChain with multiple unaliased friends.
I’m using pyROOT. My code:

import ROOT
import os

path1 = "/lstore/cms/bargassa/HTT/Artus_2018-08-21_fixedEmbedding/merged"
path2 = "/lstore/hpclip/t3cms/lsintra/friends/D_NN2_nn10/et"
path3 = "/lstore/hpclip/t3cms/lsintra/fakes/D_NN2_nn10"

chain1 = ROOT.TChain("et_nominal/ntuple")
chain2 = ROOT.TChain("et_nominal/ntuple")
chain3 = ROOT.TChain("et_nominal/ntuple")

nicks = [

for nick in nicks:
    chain1.Add(os.path.join(path1, nick, "{}.root".format(nick)))
    chain2.Add(os.path.join(path2, nick, "{}.root".format(nick)))
    chain3.Add(os.path.join(path3, nick, "{}.root".format(nick)))


chain1.Draw("et_max_score") # et_max_score branch only exists in chain2

Here’s what I gathered so far:
I get correct results when I:

  1. don’t add chain3 as a friend to chain1
  2. add chain2 as friend after chain3
  3. add aliases to either one of the friend tree chains
  4. work with individual TTree’s for every file/nick instead of a single TChain

I get wrong results when:
5) run code as presented above
6) tried using a TChain in which I added a single file (nick) and it didn’t work

I’m thinking this can’t be memory related because of 6) and that it is something in the friend logic (1, 2 and 3) which only affects TChains and not TTrees (4).

Keep in mind this code is only proof of concept of the problem.
I’m using a framework and I don’t want to fiddle with extensive code done by others, so I really need multiple unaliased friend TChain’s.

Any ideas of what might be the cause of it and other ideas to circumvent it?

Kind regards,

1 Like

@pcanal is this an obvious one to you?

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