This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
| root:pyroot_ttree [2017/09/01 17:33] – [Creating a TTree with branches and writing it to a TFile] iwn | root:pyroot_ttree [2018/02/28 13:58] – [TChain] iwn | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ====== Handling TTree trees ====== | ====== Handling TTree trees ====== | ||
| + | |||
| + | [[https:// | ||
| [[root: | [[root: | ||
| Line 173: | Line 175: | ||
| tree.Scan(" | tree.Scan(" | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== TChain ===== | ||
| + | |||
| + | If you have a samples split into many files, each containing the same tree, you can either add the files into one big one in the command line with '' | ||
| + | |||
| + | With '' | ||
| + | <code bash> | ||
| + | hadd sample.root sample_1.root sample_2.root sample_3.root | ||
| + | </ | ||
| + | |||
| + | With '' | ||
| + | <code python> | ||
| + | chain = TChain(" | ||
| + | chain.Add(" | ||
| + | chain.Add(" | ||
| + | chain.Add(" | ||
| + | for event in chain: | ||
| + | print event.px | ||
| + | </ | ||
| + | Note it's also possible to use a glob wildcard: '' | ||