Beispiel #1
0
        /// <summary>
        /// Configure the histogram - sumw2, for example.
        /// </summary>
        /// <param name="h"></param>
        private static void ConfigureHisto(ROOTNET.Interface.NTH1 h)
        {
            // Keep track of statistics
            h.Sumw2();

            // Make sure it doesn't get associated with a file. This is ok after it comes back from
            // a query.. :-)

            h.Directory = null;
        }
Beispiel #2
0
 /// <summary>
 /// Normalize this histo and return it.
 /// </summary>
 /// <param name="histo"></param>
 /// <param name="toArea">The area the histogram should be noramlized to</param>
 /// <returns></returns>
 public static ROOTNET.Interface.NTH1 Normalize(this ROOTNET.Interface.NTH1 histo, double toArea = 1.0)
 {
     histo.Scale(toArea / histo.Integral());
     return(histo);
 }
Beispiel #3
0
 /// <summary>
 /// Reformat the name.
 /// </summary>
 /// <param name="h"></param>
 /// <param name="format">string.Format argument, arg {0} will be the old histogram name</param>
 /// <returns></returns>
 private static ROOTNET.Interface.NTH1 AppendName(ROOTNET.Interface.NTH1 h, string format)
 {
     h.Name = string.Format(format, h.Name);
     return(h);
 }
Beispiel #4
0
 /// <summary>
 /// Save a plot to a TDirectory. Return the plot so it can also be used in other
 /// places.
 ///
 /// Temp Fix: We need to set the object owner so that this object won't be cleaned up during
 /// GC, however, ROOT.NET doesn't support it yet. So instead we will just set it to null and
 /// return null for now. To be fixed when we update ROOT.NET.
 /// </summary>
 /// <param name="hist"></param>
 /// <param name="dir"></param>
 /// <returns></returns>
 public static ROOTNET.Interface.NTH1 SaveToROOTDirectory(this ROOTNET.Interface.NTH1 hist, ROOTNET.Interface.NTDirectory dir)
 {
     hist.InternalWriteObject(dir);
     return(null);
 }
Beispiel #5
0
 /// <summary>
 /// Add a histogram to a ROOT directory.
 /// </summary>
 /// <param name="dir"></param>
 /// <param name="h"></param>
 public static void Add(this ROOTNET.Interface.NTDirectory dir, ROOTNET.Interface.NTH1 h)
 {
     h.SetDirectory(dir);
 }
Beispiel #6
0
 /// <summary>
 /// Determine the maximum value for a plot, taking the size of the errors into account.
 /// This isn't perfect, but does a slightly faster job than scanning everything. May have to fix eventually.
 /// </summary>
 /// <param name="p"></param>
 /// <returns></returns>
 private static double FindPlotMaximum(ROOTNET.Interface.NTH1 p)
 {
     var b = p.GetMaximumBin();
     return p.GetBinContent(b) + p.GetBinError(b);
 }