Documentation of 'jhplot.io.FileRoot' Java class.
FileRoot
jhplot.io

Class FileRoot



  • public class FileRoot
    extends java.lang.Object
    Class to read ROOT files. To get directory inside the file, use "cd()" method. You can get any objects inside a ROOT file as using keys as:

    key1 = rr.getKey("dir1")
    dir1=key1.getObject()
    key2=dir1.getKey("dir2")
    dir2=key2.getObject()
    key3=dir2.getKey("Histogram")
    h1d=H1D( key3.getObject() )

    • Constructor Summary

      Constructors 
      Constructor and Description
      FileRoot(java.lang.String file)
      Main constructor to build root file reader.
      FileRoot(java.net.URL url)
      Open file from URL
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      hep.io.root.interfaces.TDirectory cd(java.lang.String dir)
      Navigate to a directory inside the ROOT file.
      void doc()
      Show online documentation.
      java.lang.Object get(java.lang.String skey)
      Get object associated with the key name in the current directory.
      H1D getH1D(java.lang.String skey)
      Get H1D histogram associated with the key name.
      H2D getH2D(java.lang.String skey)
      Get H2D histogram associated with the key name.
      java.util.List getInfo()
      Get the StreamerInfo
      hep.io.root.interfaces.TKey getKey(int i)
      Get a key using its index.
      hep.io.root.interfaces.TKey getKey(java.lang.String skey)
      Get a key
      java.util.ArrayList<java.lang.String> getKeys()
      Return all keys of the current directory as a list.
      int getNKeys()
      Get number of objects in the current directory of a ROOT file.
      java.lang.Object getObject(int i)
      Get object associated with the key name in tthe current directory.
      java.lang.Object getObject(java.lang.String skey)
      Get object associated with the key name in the current directory.
      P1D getP1D(java.lang.String skey)
      Get P1D associated with the key name.
      hep.io.root.RootFileReader getReader()
      Returns RootFileReader
      java.lang.String getTitle()
      Get ROOT title
      int getVersion()
      Get ROOT version
      java.lang.String toString()
      Return all root objects in form of a string.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FileRoot

        public FileRoot(java.lang.String file)
        Main constructor to build root file reader.
        Parameters:
        file - Input root file
      • FileRoot

        public FileRoot(java.net.URL url)
        Open file from URL
        Parameters:
        url - Input URL file
    • Method Detail

      • cd

        public hep.io.root.interfaces.TDirectory cd(java.lang.String dir)
        Navigate to a directory inside the ROOT file.
        Parameters:
        directory - inside the file. Use the standard unix path, i.e. dir1/dir2/dir3
      • toString

        public java.lang.String toString()
        Return all root objects in form of a string. Use cd(dir) to navigate to a specific directory
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string showing all ROOT objects in the current directory
      • getKeys

        public java.util.ArrayList<java.lang.String> getKeys()
        Return all keys of the current directory as a list.
        Returns:
        a list of all keys for the current directory
      • getVersion

        public int getVersion()
        Get ROOT version
        Returns:
        ROOT version
      • getNKeys

        public int getNKeys()
        Get number of objects in the current directory of a ROOT file.
        Returns:
        number of objects
      • getTitle

        public java.lang.String getTitle()
        Get ROOT title
        Returns:
        ROOT title
      • getKey

        public hep.io.root.interfaces.TKey getKey(int i)
        Get a key using its index. Can be called after navigation to a directory using the cd() method.
        Parameters:
        i - index of this key
        Returns:
        TKey object.
      • getInfo

        public java.util.List getInfo()
        Get the StreamerInfo
        Parameters:
        streamer - info
      • getKey

        public hep.io.root.interfaces.TKey getKey(java.lang.String skey)
        Get a key
        Parameters:
        skey - key name
        Returns:
        TKey object.
      • getReader

        public hep.io.root.RootFileReader getReader()
        Returns RootFileReader
        Returns:
        RootFileReader
      • getH1D

        public H1D getH1D(java.lang.String skey)
        Get H1D histogram associated with the key name. It is assumed that this ROOT key keeps histogram (TH1).
        Parameters:
        skey - key name
        Returns:
        H1D histogram
      • getH2D

        public H2D getH2D(java.lang.String skey)
        Get H2D histogram associated with the key name. It is assumed that this ROOT key keeps histogram (TH1).
        Parameters:
        skey - key name
        Returns:
        H2D histogram
      • getP1D

        public P1D getP1D(java.lang.String skey)
        Get P1D associated with the key name. It corresponds to TGraph in ROOT. It is assumed that this ROOT key keeps histogram (TH1).
        Parameters:
        skey - key name
        Returns:
        P1D object representing TGraph inside ROOT file
      • get

        public java.lang.Object get(java.lang.String skey)
        Get object associated with the key name in the current directory. The mapping is as following:
        TGraph will be returned as P1D object
        TH1F or TH1D will be returned as H1D object
        TH2F or TH2D will be returned as H2D object
        other objects will be returned as in hep.io.root.interfaces.
        Parameters:
        skey - key name
        Returns:
        Object depending on the key.
      • getObject

        public java.lang.Object getObject(java.lang.String skey)
        Get object associated with the key name in the current directory.
        Parameters:
        skey - key name
        Returns:
        Object
      • getObject

        public java.lang.Object getObject(int i)
        Get object associated with the key name in tthe current directory.
        Parameters:
        i - key index
        Returns:
        Object
      • doc

        public void doc()
        Show online documentation.

DMelt 3.0 © DataMelt by jWork.ORG