示例#1
0
 def testBinCount(self):
   "Tests copying over the bin boundaries"
   Rh = TH1D("test","test",10,-5,55.332)
   h = hists.fromTH1(Rh)
   # Test the bin indices
   for bin in range(1,12):
     message="Error testing bin {0}".format(bin)
     self.assertAlmostEqual(h.bins[bin-1], Rh.GetBinLowEdge(bin),msg=message)
示例#2
0
 def testBinContentCount(self):
   "Tests that bin contents are copied"
   Rh = TH1D("test","test",10,0,10)
   Rh.FillRandom("pol0")
   h = hists.fromTH1(Rh)
   # Test the bin indices
   for bin in range(1,11):
     message="Error testing bin {0}".format(bin)
     self.assertAlmostEqual(h[bin-1], Rh.GetBinContent(bin),msg=message)
示例#3
0
 def testUnderflow(self):
   "Test that the underflow is copied"
   Rh = TH1D("test","test",1,0,1)
   Rh.Fill(-10)
   h = hists.fromTH1(Rh)
   self.assertAlmostEqual(h.underflow, 1)
示例#4
0
 def testOverflow(self):
   "Test the overflow is copied"
   Rh = TH1D("test","test",1,0,1)
   Rh.Fill(10)
   h = hists.fromTH1(Rh)
   self.assertAlmostEqual(h.overflow, 1)
示例#5
0
 def testBinCount(self):
   "Tests basic copying of bin counts"
   Rh = TH1D("test","test",10,0,10)
   h = hists.fromTH1(Rh)
   # Test the bin count is good
   self.assertEqual(h.bincount, 10)