Contain utils for ROOT command line tools. More...
Functions | |
| _copyTreeSubset (sourceFile, sourcePathSplit, destFile, destPathSplit, firstEvent, lastEvent, selectionString, branchinclude, branchexclude) | |
| Copy a subset of the tree from (sourceFile,sourcePathSplit) to (destFile,destPathSplit) according to options in optDict. | |
| _copyTreeSubsets (fileName, pathSplitList, destFile, destPathSplit, first, last, selectionString, branchinclude, branchexclude) | |
| _getParser (theHelp, theEpilog) | |
| Different functions to get a parser of arguments and options. | |
| _keyListExtended (rootFile, pathSplitList, recursive=False) | |
| ROOTPRINT. | |
| _moveObjects (fileName, pathSplitList, destFile, destPathSplit, oneFile, interactive) | |
| _setBranchStatus (tree, branchSelectionString, status=0) | |
| ROOTEVENTSELECTOR. | |
| _setIgnoreLevel (level) | |
| Several utils. | |
| changeDirectory (rootFile, pathSplit) | |
| Change the current directory (ROOT.gDirectory) by the corresponding (rootFile,pathSplit). | |
| copyRootObject (sourceFile, sourcePathSplit, destFile, destPathSplit, oneSource, recursive, replace) | |
| Initialize the recursive function 'copyRootObjectRecursive', written to be as unix-like as possible. | |
| copyRootObjectRecursive (sourceFile, sourcePathSplit, destFile, destPathSplit, replace, setName="") | |
| Copy objects from a file or directory (sourceFile,sourcePathSplit) to an other file or directory (destFile,destPathSplit). | |
| createDirectory (rootFile, pathSplit) | |
| Add a directory named 'pathSplit[-1]' in (rootFile,pathSplit[:-1]). | |
| deleteObject (rootFile, pathSplit) | |
| Delete the object 'pathSplit[-1]' from (rootFile,pathSplit[:-1]). | |
| deleteRootObject (rootFile, pathSplit, interactive, recursive) | |
| Remove the object (rootFile,pathSplit) -interactive : prompt before every removal -recursive : allow directory, and ROOT file, removal. | |
| dirListSort (dirList) | |
| Sort list of directories by their names ignoring the case. | |
| fileNameListMatch (filePattern, wildcards) | |
| Get the list of fileName that match with objPattern. | |
| fileno (file_or_fd) | |
| Look for 'fileno' attribute. | |
| getArgs (parser) | |
| Set of functions to put the arguments in shape. | |
| getFromDirectory (objName) | |
| Get the object objName from the current directory. | |
| getKey (rootFile, pathSplit) | |
| Get the key of the corresponding object (rootFile,pathSplit). | |
| getKeyList (rootFile, pathSplit) | |
| Get the list of keys of the directory (rootFile,pathSplit), if (rootFile,pathSplit) is not a directory then get the key in a list. | |
| getParserFile (theHelp, theEpilog="") | |
| Get a commandline parser with the defaults of the commandline utils and a list of source files. | |
| getParserSingleFile (theHelp, theEpilog="") | |
| Get a commandline parser with the defaults of the commandline utils and a source file or not. | |
| getParserSourceDest (theHelp, theEpilog="") | |
| Get a commandline parser with the defaults of the commandline utils, a list of source files and a destination file. | |
| getSourceDestListOptDict (parser, wildcards=True) | |
| Get the list of tuples of sources, create destination name, destination pathSplit and the dictionary with options. | |
| getSourceListArgs (parser, wildcards=True) | |
| Create a list of tuples that contain source ROOT file names and lists of path in these files as well as the original arguments. | |
| getSourceListOptDict (parser, wildcards=True) | |
| Get the list of tuples and the dictionary with options. | |
| isDirectory (rootFile, pathSplit) | |
| Return True if the object, corresponding to (rootFile,pathSplit), inherits from TDirectory. | |
| isDirectoryKey (key) | |
| Return True if the object, corresponding to the key, inherits from TDirectory. | |
| isExisting (rootFile, pathSplit) | |
| Return True if the object, corresponding to (rootFile,pathSplit), exits. | |
| isTHnSparseKey (key) | |
| Return True if the object, corresponding to the key, inherits from THnSparse. | |
| isTree (rootFile, pathSplit) | |
| Return True if the object, corresponding to (rootFile,pathSplit), inherits from TTree. | |
| isTreeKey (key) | |
| Return True if the object, corresponding to the key, inherits from TTree. | |
| joinPathSplit (pathSplit) | |
| Join the pathSplit with '/'. | |
| keyClassSplitter (rootFile, pathSplitList) | |
| Return a list of directories and a list of keys corresponding to the other objects, for rootls and rootprint use. | |
| keyListSort (keyList) | |
| Sort list of keys by their names ignoring the case. | |
| manyOccurenceRemove (pathSplitList, fileName) | |
| Search for double occurence of the same pathSplit and remove them. | |
| openROOTFile (fileName, mode="read") | |
| Open the ROOT file corresponding to fileName in the corresponding mode, redirecting the output not to see missing dictionnaries. | |
| openROOTFileCompress (fileName, compress, recreate) | |
| Open a ROOT file (like openROOTFile) with the possibility to change compression settings. | |
| pathSplitListMatch (fileName, objPattern, wildcards) | |
| Get the list of pathSplit that match with objPattern. | |
| patternToFileNameAndPathSplitList (pattern, wildcards=True) | |
| Get the list of tuple containing both : | |
| patternToPathSplitList (fileName, pattern) | |
| Get the list of pathSplit of objects in the ROOT file corresponding to fileName that match with the pattern. | |
| rootEventselector (sourceList, destFileName, destPathSplit, compress=None, recreate=False, first=0, last=-1, selectionString="", branchinclude="", branchexclude="") | |
| rootMv (sourceList, destFileName, destPathSplit, compress=None, interactive=False, recreate=False) | |
| rootPrint (sourceList, directoryOption=None, divideOption=None, drawOption="", formatOption=None, outputOption=None, sizeOption=None, styleOption=None, verboseOption=False, recursiveOption=False) | |
| stderrRedirected () | |
| Redirect the output from sys.stderr to os.devnull. | |
| stdoutRedirected () | |
| Redirect the output from sys.stdout to os.devnull. | |
| streamRedirected (source=sys.stdout, destination=os.devnull) | |
| Redirect the output from source to destination. | |
| tupleListSort (tupleList) | |
| Sort list of tuples by their first elements ignoring the case. | |
Variables | |
| str | ASK_FILE_REMOVE = "remove '{0}' ? (y/n) : " |
| str | ASK_OBJECT_REMOVE = "remove '{0}' from '{1}' ? (y/n) : " |
| str | COMPRESS_HELP |
| str | DELETE_ERROR = "object {0} was not existing, so it is not deleted" |
| str | DEST_HELP = "path of the destination." |
| str | DIRECTORY_REMOVE_ERROR = "cannot remove '{0}': Is a directory" |
| str | FILE_REMOVE_ERROR = "cannot remove '{0}': Is a ROOT file" |
| format | |
| IgnoreCommandLineOptions | |
| str | INTERACTIVE_HELP = "prompt before every removal." |
| str | LOG_FORMAT = "%(levelname)s: %(message)s" |
| str | MANY_OCCURENCE_WARNING = "Several versions of '{0}' are present in '{1}'. Only the most recent will be considered." |
| str | MOVE_ERROR = "error during copy of {0}, it is not removed from {1}" |
| ROOTMV. | |
| str | OMITTING_ERROR = "{0} '{1}' will be copied but not its subdirectories (if any). Use the -r option if you need a recursive copy." |
| str | OVERWRITE_ERROR = "cannot overwrite non-directory '{0}' with directory '{1}'" |
| str | RECREATE_HELP = "recreate the destination file." |
| str | RECURSIVE_HELP = "recurse inside directories" |
| str | REPLACE_HELP = "replace object if already existing" |
| str | SOURCE_HELP = "path of the source." |
| Help strings for ROOT command line tools. | |
| str | SOURCES_HELP = "path of the source(s)." |
| str | TARGET_ERROR = "target '{0}' is not a directory" |
| Several functions shared by rootcp, rootmv and rootrm. | |
Contain utils for ROOT command line tools.
|
protected |
Copy a subset of the tree from (sourceFile,sourcePathSplit) to (destFile,destPathSplit) according to options in optDict.
Definition at line 798 of file cmdLineUtils.py.
|
protected |
Definition at line 844 of file cmdLineUtils.py.
|
protected |
Different functions to get a parser of arguments and options.
Get a commandline parser with the defaults of the commandline utils.
Definition at line 99 of file cmdLineUtils.py.
|
protected |
ROOTPRINT.
Definition at line 956 of file cmdLineUtils.py.
|
protected |
Definition at line 905 of file cmdLineUtils.py.
|
protected |
ROOTEVENTSELECTOR.
This is used by _copyTreeSubset() to turn on/off branches
Definition at line 790 of file cmdLineUtils.py.
|
protected |
Several utils.
Definition at line 147 of file cmdLineUtils.py.
| cmdLineUtils.changeDirectory | ( | rootFile, | |
| pathSplit ) |
Change the current directory (ROOT.gDirectory) by the corresponding (rootFile,pathSplit).
Definition at line 154 of file cmdLineUtils.py.
| cmdLineUtils.copyRootObject | ( | sourceFile, | |
| sourcePathSplit, | |||
| destFile, | |||
| destPathSplit, | |||
| oneSource, | |||
| recursive, | |||
| replace ) |
Initialize the recursive function 'copyRootObjectRecursive', written to be as unix-like as possible.
Definition at line 563 of file cmdLineUtils.py.
| cmdLineUtils.copyRootObjectRecursive | ( | sourceFile, | |
| sourcePathSplit, | |||
| destFile, | |||
| destPathSplit, | |||
| replace, | |||
| setName = "" ) |
Copy objects from a file or directory (sourceFile,sourcePathSplit) to an other file or directory (destFile,destPathSplit).
Definition at line 648 of file cmdLineUtils.py.
| cmdLineUtils.createDirectory | ( | rootFile, | |
| pathSplit ) |
Add a directory named 'pathSplit[-1]' in (rootFile,pathSplit[:-1]).
Definition at line 169 of file cmdLineUtils.py.
| cmdLineUtils.deleteObject | ( | rootFile, | |
| pathSplit ) |
Delete the object 'pathSplit[-1]' from (rootFile,pathSplit[:-1]).
Definition at line 633 of file cmdLineUtils.py.
| cmdLineUtils.deleteRootObject | ( | rootFile, | |
| pathSplit, | |||
| interactive, | |||
| recursive ) |
Remove the object (rootFile,pathSplit) -interactive : prompt before every removal -recursive : allow directory, and ROOT file, removal.
Definition at line 732 of file cmdLineUtils.py.
| cmdLineUtils.dirListSort | ( | dirList | ) |
Sort list of directories by their names ignoring the case.
Definition at line 284 of file cmdLineUtils.py.
| cmdLineUtils.fileNameListMatch | ( | filePattern, | |
| wildcards ) |
Get the list of fileName that match with objPattern.
Definition at line 402 of file cmdLineUtils.py.
| cmdLineUtils.fileno | ( | file_or_fd | ) |
Look for 'fileno' attribute.
Definition at line 22 of file cmdLineUtils.py.
| cmdLineUtils.getArgs | ( | parser | ) |
Set of functions to put the arguments in shape.
Get arguments corresponding to parser.
Definition at line 488 of file cmdLineUtils.py.
| cmdLineUtils.getFromDirectory | ( | objName | ) |
Get the object objName from the current directory.
Definition at line 179 of file cmdLineUtils.py.
| cmdLineUtils.getKey | ( | rootFile, | |
| pathSplit ) |
Get the key of the corresponding object (rootFile,pathSplit).
Definition at line 230 of file cmdLineUtils.py.
| cmdLineUtils.getKeyList | ( | rootFile, | |
| pathSplit ) |
Get the list of keys of the directory (rootFile,pathSplit), if (rootFile,pathSplit) is not a directory then get the key in a list.
Definition at line 258 of file cmdLineUtils.py.
| cmdLineUtils.getParserFile | ( | theHelp, | |
| theEpilog = "" ) |
Get a commandline parser with the defaults of the commandline utils and a list of source files.
Definition at line 118 of file cmdLineUtils.py.
| cmdLineUtils.getParserSingleFile | ( | theHelp, | |
| theEpilog = "" ) |
Get a commandline parser with the defaults of the commandline utils and a source file or not.
Definition at line 108 of file cmdLineUtils.py.
| cmdLineUtils.getParserSourceDest | ( | theHelp, | |
| theEpilog = "" ) |
Get a commandline parser with the defaults of the commandline utils, a list of source files and a destination file.
Definition at line 128 of file cmdLineUtils.py.
| cmdLineUtils.getSourceDestListOptDict | ( | parser, | |
| wildcards = True ) |
Get the list of tuples of sources, create destination name, destination pathSplit and the dictionary with options.
Definition at line 536 of file cmdLineUtils.py.
| cmdLineUtils.getSourceListArgs | ( | parser, | |
| wildcards = True ) |
Create a list of tuples that contain source ROOT file names and lists of path in these files as well as the original arguments.
Definition at line 495 of file cmdLineUtils.py.
| cmdLineUtils.getSourceListOptDict | ( | parser, | |
| wildcards = True ) |
Get the list of tuples and the dictionary with options.
returns: sourceList: a list of tuples with one list element per file the first tuple entry being the root file, the second a list of subdirectories, each being represented as a list itself with a string per level e.g. rootls tutorial/tmva/TMVA.root:Method_BDT/BDT turns into [('tutorials/tmva/TMVA.root', [['Method_BDT','BDT']])] vars(args): a dictionary of matched options, e.g. {'longListing': False, 'oneColumn': False, 'treeListing': False, 'recursiveListing'; False, 'FILE': ['tutorials/tmva/TMVA.root:Method_BDT/BDT'] }
Definition at line 510 of file cmdLineUtils.py.
| cmdLineUtils.isDirectory | ( | rootFile, | |
| pathSplit ) |
Return True if the object, corresponding to (rootFile,pathSplit), inherits from TDirectory.
Definition at line 238 of file cmdLineUtils.py.
| cmdLineUtils.isDirectoryKey | ( | key | ) |
Return True if the object, corresponding to the key, inherits from TDirectory.
Definition at line 194 of file cmdLineUtils.py.
| cmdLineUtils.isExisting | ( | rootFile, | |
| pathSplit ) |
Return True if the object, corresponding to (rootFile,pathSplit), exits.
Definition at line 186 of file cmdLineUtils.py.
| cmdLineUtils.isTHnSparseKey | ( | key | ) |
Return True if the object, corresponding to the key, inherits from THnSparse.
Definition at line 218 of file cmdLineUtils.py.
| cmdLineUtils.isTree | ( | rootFile, | |
| pathSplit ) |
Return True if the object, corresponding to (rootFile,pathSplit), inherits from TTree.
Definition at line 248 of file cmdLineUtils.py.
| cmdLineUtils.isTreeKey | ( | key | ) |
Return True if the object, corresponding to the key, inherits from TTree.
Definition at line 206 of file cmdLineUtils.py.
| cmdLineUtils.joinPathSplit | ( | pathSplit | ) |
Join the pathSplit with '/'.
Definition at line 341 of file cmdLineUtils.py.
| cmdLineUtils.keyClassSplitter | ( | rootFile, | |
| pathSplitList ) |
Return a list of directories and a list of keys corresponding to the other objects, for rootls and rootprint use.
Definition at line 291 of file cmdLineUtils.py.
| cmdLineUtils.keyListSort | ( | keyList | ) |
Sort list of keys by their names ignoring the case.
Definition at line 270 of file cmdLineUtils.py.
| cmdLineUtils.manyOccurenceRemove | ( | pathSplitList, | |
| fileName ) |
Search for double occurence of the same pathSplit and remove them.
Definition at line 351 of file cmdLineUtils.py.
| cmdLineUtils.openROOTFile | ( | fileName, | |
| mode = "read" ) |
Open the ROOT file corresponding to fileName in the corresponding mode, redirecting the output not to see missing dictionnaries.
Returns: theFile (TFile)
Definition at line 310 of file cmdLineUtils.py.
| cmdLineUtils.openROOTFileCompress | ( | fileName, | |
| compress, | |||
| recreate ) |
Open a ROOT file (like openROOTFile) with the possibility to change compression settings.
Definition at line 326 of file cmdLineUtils.py.
| cmdLineUtils.pathSplitListMatch | ( | fileName, | |
| objPattern, | |||
| wildcards ) |
Get the list of pathSplit that match with objPattern.
Definition at line 412 of file cmdLineUtils.py.
| cmdLineUtils.patternToFileNameAndPathSplitList | ( | pattern, | |
| wildcards = True ) |
Get the list of tuple containing both :
Definition at line 422 of file cmdLineUtils.py.
| cmdLineUtils.patternToPathSplitList | ( | fileName, | |
| pattern ) |
Get the list of pathSplit of objects in the ROOT file corresponding to fileName that match with the pattern.
Definition at line 363 of file cmdLineUtils.py.
| cmdLineUtils.rootEventselector | ( | sourceList, | |
| destFileName, | |||
| destPathSplit, | |||
| compress = None, | |||
| recreate = False, | |||
| first = 0, | |||
| last = -1, | |||
| selectionString = "", | |||
| branchinclude = "", | |||
| branchexclude = "" ) |
Definition at line 862 of file cmdLineUtils.py.
| cmdLineUtils.rootMv | ( | sourceList, | |
| destFileName, | |||
| destPathSplit, | |||
| compress = None, | |||
| interactive = False, | |||
| recreate = False ) |
Definition at line 927 of file cmdLineUtils.py.
| cmdLineUtils.rootPrint | ( | sourceList, | |
| directoryOption = None, | |||
| divideOption = None, | |||
| drawOption = "", | |||
| formatOption = None, | |||
| outputOption = None, | |||
| sizeOption = None, | |||
| styleOption = None, | |||
| verboseOption = False, | |||
| recursiveOption = False ) |
Definition at line 976 of file cmdLineUtils.py.
| cmdLineUtils.stderrRedirected | ( | ) |
Redirect the output from sys.stderr to os.devnull.
Definition at line 63 of file cmdLineUtils.py.
| cmdLineUtils.stdoutRedirected | ( | ) |
Redirect the output from sys.stdout to os.devnull.
Definition at line 56 of file cmdLineUtils.py.
| cmdLineUtils.streamRedirected | ( | source = sys.stdout, | |
| destination = os.devnull ) |
Redirect the output from source to destination.
Definition at line 33 of file cmdLineUtils.py.
| cmdLineUtils.tupleListSort | ( | tupleList | ) |
Sort list of tuples by their first elements ignoring the case.
Definition at line 277 of file cmdLineUtils.py.
Definition at line 728 of file cmdLineUtils.py.
Definition at line 729 of file cmdLineUtils.py.
| str cmdLineUtils.COMPRESS_HELP |
Definition at line 776 of file cmdLineUtils.py.
| str cmdLineUtils.DELETE_ERROR = "object {0} was not existing, so it is not deleted" |
Definition at line 630 of file cmdLineUtils.py.
| str cmdLineUtils.DEST_HELP = "path of the destination." |
Definition at line 773 of file cmdLineUtils.py.
| str cmdLineUtils.DIRECTORY_REMOVE_ERROR = "cannot remove '{0}': Is a directory" |
Definition at line 727 of file cmdLineUtils.py.
Definition at line 726 of file cmdLineUtils.py.
| cmdLineUtils.format |
Definition at line 90 of file cmdLineUtils.py.
| cmdLineUtils.IgnoreCommandLineOptions |
Definition at line 81 of file cmdLineUtils.py.
| str cmdLineUtils.INTERACTIVE_HELP = "prompt before every removal." |
Definition at line 778 of file cmdLineUtils.py.
| str cmdLineUtils.LOG_FORMAT = "%(levelname)s: %(message)s" |
Definition at line 89 of file cmdLineUtils.py.
| str cmdLineUtils.MANY_OCCURENCE_WARNING = "Several versions of '{0}' are present in '{1}'. Only the most recent will be considered." |
Definition at line 348 of file cmdLineUtils.py.
| str cmdLineUtils.MOVE_ERROR = "error during copy of {0}, it is not removed from {1}" |
ROOTMV.
Definition at line 902 of file cmdLineUtils.py.
| str cmdLineUtils.OMITTING_ERROR = "{0} '{1}' will be copied but not its subdirectories (if any). Use the -r option if you need a recursive copy." |
Definition at line 559 of file cmdLineUtils.py.
| str cmdLineUtils.OVERWRITE_ERROR = "cannot overwrite non-directory '{0}' with directory '{1}'" |
Definition at line 560 of file cmdLineUtils.py.
| str cmdLineUtils.RECREATE_HELP = "recreate the destination file." |
Definition at line 779 of file cmdLineUtils.py.
| str cmdLineUtils.RECURSIVE_HELP = "recurse inside directories" |
Definition at line 780 of file cmdLineUtils.py.
Definition at line 781 of file cmdLineUtils.py.
| str cmdLineUtils.SOURCE_HELP = "path of the source." |
Help strings for ROOT command line tools.
Definition at line 771 of file cmdLineUtils.py.
| str cmdLineUtils.SOURCES_HELP = "path of the source(s)." |
Definition at line 772 of file cmdLineUtils.py.
| str cmdLineUtils.TARGET_ERROR = "target '{0}' is not a directory" |
Several functions shared by rootcp, rootmv and rootrm.
Definition at line 558 of file cmdLineUtils.py.