import ROOT # create a TChain object and add ROOT files to it chain = ROOT.TChain("tree_name") chain.Add("file1.root") chain.Add("file2.root") # loop over events in the TChain for event in chain: # do some analysis on the event print(event.variable)
import ROOT # create a TChain object and add ROOT files to it chain = ROOT.TChain("tree_name") chain.Add("file1.root") chain.Add("file2.root") # loop over events in the TChain for event in chain: # apply some filter to the event if event.variable > 10: # do some analysis on the event print(event.variable)This example filters events based on the value of a variable (`variable > 10`) before doing analysis on them. The TChain object is created and files are added to it, just like in the first example. The package/library used in these examples is Python ROOT.