Skip to content
Snippets Groups Projects
Commit 90929ad5 authored by Christian Weber's avatar Christian Weber
Browse files

Feature: add method to convert TDir to list

parent 69ff8989
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,12 @@ import ROOT
# Functions to traverse TDirs and select TObjects
##################################################
def TDirToList(TDir): # return the contents of a TDir as a list
outputList = []
for TKey in TDir.GetListOfKeys(): outputList.append( TKey.ReadObj() ) # this is how I access the element that belongs to the current TKey
return outputList
def generateTDirContents(TDir):
# this is a python generator
# this one allows me to loop over all of the contents in a given ROOT TDir with a for loop
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment