コード例 #1
0
        static void Main(string[] args)
        {
            var h = new NTH1F("h1", "Hist", 100, 0.0, 10.0)
                .XaxisTitle("p_T [GeV]")
                .YaxisTitle("N/1 GeV");

            h.Fill(1.0);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: gordonwatts/ROOT.NET
 static void Main(string[] args)
 {
     var t = new NTStopwatch();
     t.Start();
     var h = new NTH1F("hi", "there", 10, 0.0, 100.0);
     for (int i = 0; i < 100000000; i++)
     {
         h.Fill(10);
     }
     t.Stop();
     h.Print();
     t.Print();
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: ha11owed/rootdotnet
        static void Main(string[] args)
        {
            var t = new NTStopwatch();

            t.Start();
            var h = new NTH1F("hi", "there", 10, 0.0, 100.0);

            for (int i = 0; i < 100000000; i++)
            {
                h.Fill(10);
            }
            t.Stop();
            h.Print();
            t.Print();
        }
コード例 #4
0
        /// <summary>
        /// Simple test to use the MSBuild guys in a special targets file.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var vs = Environment.GetEnvironmentVariables();

            foreach (var v in vs.Keys.Cast <string>().OrderBy(s => s))
            {
                Console.WriteLine(v);
            }

            var f = NTFile.Open("junk.root", "RECREATE");
            var h = new NTH1F("hi", "there", 10, 0.0, 1.0);

            h.Fill(0.5);
            f.Write();
            f.Close();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: gordonwatts/ROOT.NET
        static void Main(string[] args)
        {
            var t = new NTStopwatch();
            var h = new NTH1F("hi", "there", 10, 0.0, 100.0);
            h.Fill(4);
            var a = h.GetXaxis();

            string newname = "fork";
            t.Start();
            for (int i = 0; i < 30000; i++)
            {
                a.SetBinLabel(3, newname);
            }
            t.Stop();
            t.Print();
        }
コード例 #6
0
        static void Main(string[] args)
        {
            var t = new NTStopwatch();
            var h = new NTH1F("hi", "there", 10, 0.0, 100.0);

            h.Fill(4);
            var a = h.GetXaxis();

            string newname = "fork";

            t.Start();
            for (int i = 0; i < 30000; i++)
            {
                a.SetBinLabel(3, newname);
            }
            t.Stop();
            t.Print();
        }
コード例 #7
0
        /// <summary>
        /// Calculate the pass fraction for a bin.
        /// </summary>
        /// <param name="h">Histogram we are to examine (assume 1D)</param>
        /// <param name="passFraction">The fraction for passing - assume it is between 0 and 1.</param>
        /// <returns></returns>
        private static int CalcBinWhereFractionIs(NTH1F h, double passFraction)
        {
            var sum = Enumerable.Range(0, h.GetNbinsX() + 1).Select(b => h.GetBinContent(b)).Sum();
            var sumToPassFraction = sum * passFraction;

            var incSum = 0.0;
            foreach (var b in Enumerable.Range(0, h.GetNbinsX() + 1))
            {
                incSum += h.GetBinContent(b);
                if (incSum > sumToPassFraction)
                {
                    return b;
                }
            }

            // If we got here, then the number must have been 1, and it is the last
            // bin that we return!
            return h.GetNbinsX() + 1;
        }