Create TH2F gamma-gamma matrix from TTree/TChain data

I think, the best for you would be to try an “analysis skeleton”. See, for example, links in: How are multiple TTree->Draw()s done?
Note: you need to generate the “analysis skeleton” for your TChain, not for your single TTrree.