org.jlab.groot.tree
Class Tree
- java.lang.Object
-
- org.jlab.groot.tree.Tree
-
- All Implemented Interfaces:
- ITree
- Direct Known Subclasses:
- RandomTree, TreeFile, TreeTextFile
public class Tree extends java.lang.Object implements ITree
-
-
Constructor Summary
Constructors Constructor and Description Tree(java.lang.String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddBranch(Branch br)voidaddBranch(java.lang.String name, java.lang.String desc, java.lang.String unit)add Branch with name description and unitsvoidconfigure()BranchgetBranch(java.lang.String name)float[]getBranchData()returns a float array containing branch data.java.util.Map<java.lang.String,Branch>getBranches()DataVectorgetDataVector(java.lang.String expression, java.lang.String tcut)returns data vector filled with values evaluated with expression given for entries that pass the given cutDataVectorgetDataVector(java.lang.String expression, java.lang.String tcut, int limit)returns data vector filled with values evaluated with expression given for entries that pass the given cut.DynamicTreegetDynamicTree()intgetEntries()java.util.List<java.lang.String>getListOfBranches()returns list of branch names.java.lang.StringgetName()returns the name of the treejavax.swing.tree.DefaultMutableTreeNodegetRootNode()java.util.List<DataVector>getScanResults()returns a list of data vectors stores after the last scan was done.TreeSelectorgetSelector()returns default tree selector.static java.util.Map<java.lang.String,javax.swing.ImageIcon>getTreeIcons()returns icons for the treebooleanhasBranch(java.lang.String name)check for branch name.static java.util.Map<java.lang.String,javax.swing.ImageIcon>initTreeIcons()initializes UIvoidprint()intreadEntry(int entry)booleanreadNext()voidreset()voidresetBranches(double number)voidscanTree(java.lang.String expression, java.lang.String tcut, int limit, boolean bothSides)Scan a tree with expressions defined in expression string, multiple expressions are separated by ":".voidsetBranchData(float[] data)Fills branches with values from the array.voidshow()java.lang.StringtoString()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
returns the name of the tree
-
addBranch
public void addBranch(Branch br)
-
addBranch
public void addBranch(java.lang.String name, java.lang.String desc, java.lang.String unit)add Branch with name description and units- Parameters:
name- name of the branchdesc- description of the branchunit- units of the branch
-
getListOfBranches
public java.util.List<java.lang.String> getListOfBranches()
returns list of branch names. User to define cuts and expressions- Specified by:
getListOfBranchesin interfaceITree- Returns:
-
getTreeIcons
public static java.util.Map<java.lang.String,javax.swing.ImageIcon> getTreeIcons()
returns icons for the tree- Returns:
-
initTreeIcons
public static java.util.Map<java.lang.String,javax.swing.ImageIcon> initTreeIcons()
initializes UI- Returns:
-
resetBranches
public void resetBranches(double number)
-
getBranchData
public float[] getBranchData()
returns a float array containing branch data.- Returns:
- float array
-
setBranchData
public void setBranchData(float[] data)
Fills branches with values from the array.- Parameters:
data- float array to fill branches
-
getBranches
public java.util.Map<java.lang.String,Branch> getBranches()
-
print
public void print()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
show
public void show()
-
getSelector
public TreeSelector getSelector()
returns default tree selector. cuts can be added to internal selector- Returns:
-
getDataVector
public DataVector getDataVector(java.lang.String expression, java.lang.String tcut)
returns data vector filled with values evaluated with expression given for entries that pass the given cut- Parameters:
expression- variables expressiontcut- cut string- Returns:
- DataVector with expression values
-
getDataVector
public DataVector getDataVector(java.lang.String expression, java.lang.String tcut, int limit)
returns data vector filled with values evaluated with expression given for entries that pass the given cut. The limit is set on variables.- Parameters:
expression- variables expressiontcut- cut stringlimit- limit the number of events to run through -1 for all events- Returns:
-
scanTree
public void scanTree(java.lang.String expression, java.lang.String tcut, int limit, boolean bothSides)Scan a tree with expressions defined in expression string, multiple expressions are separated by ":". The results are stored in internal array, and can be accessed through getScanResults() method. Number of Data vectors in the result is equal to number of expressions. If bothSides flag is ture then the tree is parsed limit/2 events from the start of the tree and last limit/2 event. This is useful to determine the limits of the variable, scanning the end portion of the tree will ensure that monotonically changing variables like indicies return boundaries that are correct.- Parameters:
expression- expression list ":" separatedtcut- cut expressionlimit- number of events to run overbothSides- flag indicating that start and end of the tree have to be sampled.
-
getScanResults
public java.util.List<DataVector> getScanResults()
returns a list of data vectors stores after the last scan was done.- Returns:
- DataVector list
-
hasBranch
public boolean hasBranch(java.lang.String name)
check for branch name.- Parameters:
name- name of the branch- Returns:
- true if branch with name exists, false otherwise
-
getRootNode
public javax.swing.tree.DefaultMutableTreeNode getRootNode()
-
getEntries
public int getEntries()
- Specified by:
getEntriesin interfaceITree
-
getDynamicTree
public DynamicTree getDynamicTree()
-
-
DMelt 3.0 © DataMelt by jWork.ORG