示例#1
0
 def setUp(self):
     self.fname = create_tree()
     self.fname2 = self.fname.replace(".root", "_2.root")
     shutil.copy(self.fname, self.fname2)
     rootfile = TFile(self.fname)
     self.nevents = rootfile.Get("test_tree").GetEntries()
     self.outdir = tempfile.mkdtemp()
     logging.disable(logging.CRITICAL)
示例#2
0
 def setUp(self):
     self.fname = create_tree()
     self.fname2 = self.fname.replace('.root', '_2.root')
     shutil.copy(self.fname, self.fname2)
     rootfile = TFile(self.fname)
     self.nevents = rootfile.Get('test_tree').GetEntries()
     self.outdir = tempfile.mkdtemp()
     logging.disable(logging.CRITICAL)
示例#3
0
 def setUp(self):
     self.fname = create_tree()
     rootfile = TFile(self.fname)
     self.nevents = rootfile.Get('test_tree').GetEntries()
     self.outdir = tempfile.mkdtemp()
     logging.disable(logging.CRITICAL)
示例#4
0
from heppy.utils.testtree import create_tree
create_tree() 
示例#5
0
 def setUp(self):
     self.fname = create_tree()
     rootfile = TFile(self.fname)
     self.nevents = rootfile.Get('test_tree').GetEntries()
     self.chain = Chain(testfname, 'test_tree')
示例#6
0
from heppy.utils.testtree import create_tree

if __name__ == "__main__":

    import sys
    import pdb
    pdb.set_trace()
    if len(sys.argv) == 2:
        nentries = sys.argv[1]
        create_tree(nentries=nentries)
    else:
        create_tree()
示例#7
0
        chain = Chain(testfname)
        self.assertEqual(len(self.chain), 100)

    def test_load_1(self):
        '''Test that the chain has the correct number of entries'''
        self.assertEqual(len(self.chain), 100)

    def test_load_2(self):
        '''Test chaining of two files.'''
        tmpfile = testfname.replace('test_tree', 'test_tree_2_tmp')
        shutil.copyfile(testfname, tmpfile)
        chain = Chain(testfname.replace('.root', '*.root'), 'test_tree')
        self.assertEqual(len(chain), 200)
        os.remove(tmpfile)

    def test_iterate(self):
        '''Test iteration'''
        for ev in self.chain:
            pass
        self.assertTrue(True)

    def test_get(self):
        '''Test direct event access'''
        event = self.chain[2]
        self.assertEqual(event.var1, 2.)


if __name__ == '__main__':
    create_tree(testfname)
    unittest.main()
示例#8
0
        chain = Chain(testfname)
        self.assertEqual(len(self.chain), 100)        

    def test_load_1(self):
        '''Test that the chain has the correct number of entries'''
        self.assertEqual(len(self.chain), 100)

    def test_load_2(self):
        '''Test chaining of two files.'''
        tmpfile = testfname.replace('test_tree', 'test_tree_2_tmp')
        shutil.copyfile(testfname, tmpfile)
        chain = Chain(testfname.replace('.root', '*.root'), 'test_tree')
        self.assertEqual(len(chain), 200)
        os.remove(tmpfile)

    def test_iterate(self):
        '''Test iteration'''
        for ev in self.chain:
            pass
        self.assertTrue(True)

    def test_get(self):
        '''Test direct event access'''
        event = self.chain[2]
        self.assertEqual(event.var1, 2.)


if __name__ == '__main__':
    create_tree(testfname)
    unittest.main()
示例#9
0
from heppy.utils.testtree import create_tree

if __name__ == "__main__":
    
    import sys 
    if len(sys.argv) == 2: 
        nentries = sys.argv[1]
        create_tree(nentries=nentries) 
    else: 
        create_tree()
示例#10
0
 def setUp(self):
     self.fname = create_tree()
     rootfile = TFile(self.fname)
     self.nevents = rootfile.Get('test_tree').GetEntries()
     self.chain = Chain(testfname, 'test_tree')
示例#11
0
 def setUp(self):
     self.fname = create_tree()
     rootfile = TFile(self.fname)
     self.nevents = rootfile.Get('test_tree').GetEntries()
     self.outdir = tempfile.mkdtemp()
     logging.disable(logging.CRITICAL)
示例#12
0
 def setUp(self):
     self.fname = create_tree()
     rootfile = TFile(self.fname)
     self.events = Events(testfname, 'test_tree')
示例#13
0
 def setUp(self):
     self.fname = create_tree()
     rootfile = TFile(self.fname)
     self.events = Events(testfname, 'test_tree')
示例#14
0
 def setUp(self):
     self.fname = create_tree()
     rootfile = TFile(self.fname)
     self.nevents = rootfile.Get('test_tree').GetEntries()
     self.outdir = 'Out_test'