当前位置: 首页>>代码示例>>Python>>正文


Python Looper.write方法代码示例

本文整理汇总了Python中heppy.framework.looper.Looper.write方法的典型用法代码示例。如果您正苦于以下问题:Python Looper.write方法的具体用法?Python Looper.write怎么用?Python Looper.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在heppy.framework.looper.Looper的用法示例。


在下文中一共展示了Looper.write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: runLoop

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
def runLoop( comp, outDir, config, options):
   
    if options.input is not None:
        comp.files = [options.input]

    fullName = '/'.join( [outDir, comp.name ] )
    # import pdb; pdb.set_trace()
    config.components = [comp]
    memcheck = 2 if getattr(options,'memCheck',False) else -1
    loop = Looper( fullName,
                   config,
                   options.nevents, 0,
                   nPrint = options.nprint,
                   timeReport = options.timeReport,
                   quiet = options.quiet,
                   memCheckFromEvent = memcheck,
                   stopFlag = _globalGracefulStopFlag)
    # print loop
    if options.iEvent is None:
        loop.loop()
        loop.write()
        # print loop
    else:
        # loop.InitOutput()
        iEvent = int(options.iEvent)
        loop.process( iEvent )
    return loop
开发者ID:clementhelsens,项目名称:heppy,代码行数:29,代码来源:heppy_loop.py

示例2: TestAnalysis_ee_Z

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
class TestAnalysis_ee_Z(unittest.TestCase):

    def setUp(self):
        random.seed(0xdeadbeef)
        self.outdir = tempfile.mkdtemp()
        fname = '/'.join([os.environ['HEPPY'],
                          'test/data/ee_Z_ddbar.root'])
        config.components[0].files = [fname]
        self.looper = Looper( self.outdir, config,
                              nEvents=100,
                              nPrint=0,
                              timeReport=True)
        import logging
        logging.disable(logging.CRITICAL)
        
    def tearDown(self):
        shutil.rmtree(self.outdir)
        logging.disable(logging.NOTSET)

    def test_analysis(self):
        '''Check for an almost perfect match with reference.
        Will fail if physics algorithms are modified,
        so should probably be removed from test suite,
        or better: be made optional. 
        '''
        self.looper.loop()
        self.looper.write()
        rootfile = '/'.join([self.outdir,
                            'heppy.analyzers.GlobalEventTreeProducer.GlobalEventTreeProducer_1/tree.root'])
        mean, sigma = plot(rootfile)
        self.assertAlmostEqual(mean, 90.13, 1)
        self.assertAlmostEqual(sigma, 10.54, 1)
开发者ID:jlingema,项目名称:heppy,代码行数:34,代码来源:test_analysis_ee_Z.py

示例3: TestAnalysis_ee_ZH

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
class TestAnalysis_ee_ZH(unittest.TestCase):
    def setUp(self):
        random.seed(0xDEADBEEF)
        self.outdir = tempfile.mkdtemp()
        fname = "/".join([os.environ["HEPPY"], "test/data/ee_ZH_Zmumu_Hbb.root"])
        config.components[0].files = [fname]
        self.looper = Looper(self.outdir, config, nEvents=50, nPrint=0, timeReport=True)
        import logging

        logging.disable(logging.CRITICAL)

    def tearDown(self):
        shutil.rmtree(self.outdir)
        logging.disable(logging.NOTSET)

    def test_analysis(self):
        """Check for an almost perfect match with reference.
        Will fail if physics algorithms are modified,
        so should probably be removed from test suite,
        or better: be made optional. 
        """
        self.looper.loop()
        self.looper.write()
        rootfile = "/".join([self.outdir, "heppy.analyzers.examples.zh.ZHTreeProducer.ZHTreeProducer_1/tree.root"])
        mean, sigma = plot(rootfile)
        self.assertAlmostEqual(mean, 120.7, 1)
        self.assertAlmostEqual(sigma, 20.3, 1)

    def test_analysis_sorting(self):
        self.looper.process(0)
        self.assertTrue(test_sorted(self.looper.event.rec_particles))
开发者ID:jlingema,项目名称:heppy,代码行数:33,代码来源:test_analysis_ee_ZH.py

示例4: test_skip

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
 def test_skip(self):
     first = 10 
     loop = Looper( self.outdir, config,
                    nEvents=None,
                    firstEvent=first,
                    nPrint=0 )
     loop.loop()
     loop.write()
     # input file has 200 entries
     # we skip 10 entries, so we process 190.
     self.assertEqual(loop.nEvProcessed, self.nevents-first)
开发者ID:HEP-FCC,项目名称:heppy,代码行数:13,代码来源:test_noindexing.py

示例5: test_1

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
 def test_1(self):
     '''
     '''
     fname = '/'.join([os.environ['HEPPY'],
                       'test/data/ee_ZZ_4mu.root'])
     config.components[0].files = [fname]
     looper = Looper( self.outdir, config,
                      nEvents=50,
                      nPrint=0 )
     looper.loop()
     looper.write()
开发者ID:SDHCAL,项目名称:heppy,代码行数:13,代码来源:test_analysis_ee_ZZ_resmatch.py

示例6: TestAnalysis_ee_Z_bb

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
class TestAnalysis_ee_Z_bb(unittest.TestCase):

    def setUp(self):
        random.seed(0xdeadbeef)
        self.outdir = tempfile.mkdtemp()
        import logging
        logging.disable(logging.CRITICAL)

    def tearDown(self):
        shutil.rmtree(self.outdir)
        logging.disable(logging.NOTSET)

    def test_beff_cms(self):
        '''Check b matching probability and b tag efficiency in CMS 
        '''
        from heppy.papas.detectors.CMS import cms
        fname = '/'.join([os.environ['HEPPY'],
                          'test/data/ee_Z_bbbar.root'])
        config.components[0].files = [fname]
        for s in config.sequence:
            if hasattr( s,'detector'):
                s.detector = cms
        self.looper = Looper( self.outdir, config,
                              nEvents=500,
                              nPrint=0 )
        self.looper.loop()
        self.looper.write()
        rootfile = '/'.join([self.outdir,
                            'heppy.analyzers.JetTreeProducer.JetTreeProducer_1/jet_tree.root '])
        plotter = Plotter(rootfile)
        self.assertAlmostEqual(plotter.bfrac(), 0.867, places=2)
        self.assertAlmostEqual(plotter.beff(), 0.71, places=2)

    def test_fake_cms(self):
        '''Check fake rate in CMS
        '''
        from heppy.papas.detectors.CMS import cms
        fname = '/'.join([os.environ['HEPPY'],
                          'test/data/ee_Z_ddbar.root'])
        config.components[0].files = [fname]
        for s in config.sequence:
            if hasattr( s,'detector'):
                s.detector = cms
        self.looper = Looper( self.outdir, config,
                              nEvents=100,
                              nPrint=0 )
        self.looper.loop()
        self.looper.write()
        rootfile = '/'.join([self.outdir,
                             'heppy.analyzers.JetTreeProducer.JetTreeProducer_1/jet_tree.root '])
开发者ID:HEP-FCC,项目名称:heppy,代码行数:52,代码来源:test_analysis_ee_Z_bb.py

示例7: test_all_events_processed

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
 def test_all_events_processed(self):
     loop = Looper( self.outdir, config,
                    nEvents=None,
                    nPrint=0 )
     loop.loop()
     loop.write()
     logfile = open('/'.join([self.outdir, 'log.txt']))
     nev_processed = None
     for line in logfile:
         if line.startswith('number of events processed:'):
             nev_processed = int(line.split(':')[1])
     logfile.close()
     self.assertEqual(nev_processed, self.nevents)
     # checking the looper itself.
     self.assertEqual(loop.nEvProcessed, self.nevents)
开发者ID:HEP-FCC,项目名称:heppy,代码行数:17,代码来源:test_noindexing.py

示例8: runLoop

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
def runLoop( comp, outDir, config, options):
    fullName = '/'.join( [outDir, comp.name ] )
    # import pdb; pdb.set_trace()
    loop = Looper( fullName, comp, config.sequence, config.events_class,
                   options.nevents, 0,
                   nPrint = options.nprint)
    print loop
    if options.iEvent is None:
        loop.loop()
        loop.write()
        print loop
    else:
        # loop.InitOutput()
        iEvent = int(options.iEvent)
        loop.process( iEvent )
    return loop
开发者ID:xccty,项目名称:heppy,代码行数:18,代码来源:heppy_loop.py

示例9: TestAnalysis_ee_Z

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
    class TestAnalysis_ee_Z(unittest.TestCase):

        def setUp(self):
            random.seed(0xdeadbeef)
            self.outdir = tempfile.mkdtemp()
            import logging
            #Alice: I turned this off otherwise no pdebug output. Ask Colin why it is on and if this is OK
            #logging.disable(logging.CRITICAL)

        def tearDown(self):
            shutil.rmtree(self.outdir)
            logging.disable(logging.NOTSET)

        
        # NB If this test fails and If you expected the physics results to change 
        # then it means that the cpp version of papas will need to be updated.
        # Please
        # (1) take the physics_clic.txt file that is produced by this test and rename it to update
        # the required_clic_physics_dd.txt file in heppy/test/data
        # (2) notify alice to change papas cpp
        def test_z_clic(self):
            '''Check Z mass in ee->Z->ddbar (CLIC).
            Will fail if physics algorithms are modified,
            so should probably be removed from test suite,
            or better: be made optional. 
            '''
            random.seed(0xdeadbeef)
            from heppy.papas.detectors.CLIC import clic
            fname = '/'.join([os.environ['HEPPY'],
                                      'test/data/ee_Z_ddbar.root'])
            config.components[0].files = [fname]
            for s in config.sequence:
                if hasattr( s,'detector'):
                    s.detector = clic
                if hasattr(s, 'debug_filename'):
                    s.debug_filename = 'physics_clic.txt'
            self.looper = Looper( self.outdir, config,
                                  nEvents=10,
                                  nPrint=0 )            
            self.looper.loop()
            self.looper.write()
            self.assertEqual(0,os.system("source $HEPPY/test/data/pdebug_python_check.sh  physics_clic.txt $HEPPY/test/data/required_clic_physics_dd.txt"))
开发者ID:SDHCAL,项目名称:heppy,代码行数:44,代码来源:test_analysis_pdebug_clic.py

示例10: runLoop

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
def runLoop( comp, outDir, config, options):
    fullName = '/'.join( [outDir, comp.name ] )
    # import pdb; pdb.set_trace()
    config.components = [comp]
    loop = Looper( fullName,
                   config,
                   options.nevents, 0,
                   nPrint = options.nprint,
                   timeReport = True,
                   quiet=options.quiet)
    # print loop
    if options.iEvent is None:
        loop.loop()
        loop.write()
        # print loop
    else:
        # loop.InitOutput()
        iEvent = int(options.iEvent)
        loop.process( iEvent )
    return loop
开发者ID:broach1,项目名称:heppy,代码行数:22,代码来源:heppy_loop.py

示例11: test_analysis_ee_ZH_mumubb

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
 def test_analysis_ee_ZH_mumubb(self):
     '''Check for an almost perfect match with reference.
     Will fail if physics algorithms are modified,
     so should probably be removed from test suite,
     or better: be made optional. 
     '''
     from heppy.papas.detectors.CMS import cms
     for s in config.sequence:
         if hasattr( s,'detector'):
             s.detector = cms
         if hasattr(s, 'debug_filename'):
             s.debug_filename = 'physics_cms.txt'
     # import pdb; pdb.set_trace()
     fname = '/'.join([os.environ['HEPPY'],
                               'test/data/ee_ZH_Zmumu_Hbb.root'])
     config.components[0].files = [fname]
     looper = Looper( self.outdir, config,
                                   nEvents=10,
                                   nPrint=0 )
     looper.loop()
     looper.write()
     self.assertEqual(0,os.system("source $HEPPY/test/data/pdebug_python_check.sh  physics_cms.txt $HEPPY/test/data/required_cms_physics.txt"))
开发者ID:HEP-FCC,项目名称:heppy,代码行数:24,代码来源:test_analysis_pdebug_cms.py

示例12: test_analysis_ee_ZH_mumubb

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
 def test_analysis_ee_ZH_mumubb(self):
     '''Check for an almost perfect match with reference.
     Will fail if physics algorithms are modified,
     so should probably be removed from test suite,
     or better: be made optional. 
     '''
     from heppy.papas.detectors.CMS import cms
     for s in config.sequence:
         if hasattr( s,'detector'):
             s.detector = cms
     # import pdb; pdb.set_trace()
     fname = '/'.join([os.environ['HEPPY'],
                               'test/data/ee_ZH_Zmumu_Hbb.root'])
     config.components[0].files = [fname]
     looper = Looper( self.outdir, config,
                                   nEvents=100,
                                   nPrint=0 )
     looper.loop()
     looper.write()
     rootfile = '/'.join([self.outdir,
                         'heppy.analyzers.examples.zh.ZHTreeProducer.ZHTreeProducer_1/tree.root'])
     mean, sigma = plot(rootfile)
     self.assertAlmostEqual(mean, 110.87, 1)
     self.assertAlmostEqual(sigma, 18.6, 1)
开发者ID:HEP-FCC,项目名称:heppy,代码行数:26,代码来源:test_analysis_ee_ZH.py

示例13: len

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
    if len(sys.argv)==2:
        papas.display = True
        try:
            iev = int(sys.argv[1])
        except ValueError:
            print usage
            sys.exit(1)
    elif len(sys.argv)>2: 
        print usage
        sys.exit(1)
            
        
    loop = Looper( 'looper', config,
                   nEvents=10,
                   nPrint=5,
                   timeReport=True)
    
    simulation = None
    for ana in loop.analyzers: 
        if hasattr(ana, 'display'):
            simulation = ana
    display = getattr(simulation, 'display', None)
    simulator = getattr(simulation, 'simulator', None)
    if simulator: 
        detector = simulator.detector
    if iev is not None:
        process(iev)
    else:
        loop.loop()
        loop.write()
开发者ID:jlingema,项目名称:heppy,代码行数:32,代码来源:analysis_ee_Z_cfg.py

示例14: len

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
from heppy.framework.looper import Looper

if __name__ == '__main__':
    
    import pickle
    import sys
    import os
    import imp
    if len(sys.argv) == 2 :
        cfgFileName = sys.argv[1]
        pckfile = open( cfgFileName, 'r' )
        config = pickle.load( pckfile )
        comp = config.components[0]
        events_class = config.events_class
    elif len(sys.argv) == 3 :
        cfgFileName = sys.argv[1]
        file = open( cfgFileName, 'r' )
        cfg = imp.load_source( 'cfg', cfgFileName, file)
        compFileName = sys.argv[2]
        pckfile = open( compFileName, 'r' )
        comp = pickle.load( pckfile )
        cfg.config.components=[comp]
        events_class = cfg.config.events_class
    else:
        print 'usage: looper.py <configuration_file.py> [component.pickle]'
        sys.exit(1)
    looper = Looper( 'Loop', cfg.config,nPrint = 5)
    looper.loop()
    looper.write()
开发者ID:clementhelsens,项目名称:heppy,代码行数:31,代码来源:looper.py

示例15: TestAnalysis_ee_Z

# 需要导入模块: from heppy.framework.looper import Looper [as 别名]
# 或者: from heppy.framework.looper.Looper import write [as 别名]
class TestAnalysis_ee_Z(unittest.TestCase):

    def setUp(self):
        random.seed(0xdeadbeef)
        self.outdir = tempfile.mkdtemp()
        import logging
        logging.disable(logging.CRITICAL)

    def tearDown(self):
        shutil.rmtree(self.outdir)
        logging.disable(logging.NOTSET)

    def test_z_1_cms(self):
        '''Check Z mass in ee->Z->ddbar (CMS).
        Will fail if physics algorithms are modified,
        so should probably be removed from test suite,
        or better: be made optional. 
        '''
        from heppy.papas.detectors.CMS import cms
        fname = '/'.join([os.environ['HEPPY'],
                                  'test/data/ee_Z_ddbar.root'])
        config.components[0].files = [fname]
        for s in config.sequence:
            if hasattr( s,'detector'):
                s.detector = cms
        self.looper = Looper( self.outdir, config,
                              nEvents=100,
                              nPrint=0 )
        self.looper.loop()
        self.looper.write()
        rootfile = '/'.join([self.outdir,
                            'heppy.analyzers.GlobalEventTreeProducer.GlobalEventTreeProducer_1/tree.root'])
        mean, sigma = plot_ee_mass(rootfile)
        self.assertAlmostEqual(mean, 83.58, 1)
        self.assertAlmostEqual(sigma, 7.06, 1)

    def test_z_ee_cms(self):
        '''Test Z->ee with CMS
        '''
        from heppy.papas.detectors.CMS import cms
        fname = '/'.join([os.environ['HEPPY'],
                                  'test/data/ee_Z_ee.root'])
        config.components[0].files = [fname]
        for s in config.sequence:
            if hasattr( s,'detector'):
                s.detector = cms
        self.looper = Looper( self.outdir, config,
                              nEvents=10,
                              nPrint=0 )
        self.looper.loop()
        self.looper.write()

    def test_z_mumu_cms(self):
        '''Test Z->mumu with CMS
        '''
        from heppy.papas.detectors.CMS import cms
        fname = '/'.join([os.environ['HEPPY'],
                                  'test/data/ee_Z_mumu.root'])
        config.components[0].files = [fname]
        for s in config.sequence:
            if hasattr( s,'detector'):
                s.detector = cms
        self.looper = Looper( self.outdir, config,
                              nEvents=10,
                              nPrint=0 )
        self.looper.loop()
        self.looper.write()


    def test_z_2_clic(self):
        '''Check Z mass in ee->Z->ddbar (CLIC).
        Will fail if physics algorithms are modified,
        so should probably be removed from test suite,
        or better: be made optional. 
        '''
        from heppy.papas.detectors.CLIC import clic
        fname = '/'.join([os.environ['HEPPY'],
                                  'test/data/ee_Z_ddbar.root'])
        config.components[0].files = [fname]
        for s in config.sequence:
            if hasattr( s,'detector'):
                s.detector = clic
        self.looper = Looper( self.outdir, config,
                              nEvents=100,
                              nPrint=0 )            
        self.looper.loop()
        self.looper.write()
        rootfile = '/'.join([self.outdir,
                            'heppy.analyzers.GlobalEventTreeProducer.GlobalEventTreeProducer_1/tree.root'])
        mean, sigma = plot_ee_mass(rootfile)
        self.assertAlmostEqual(mean, 90.15, 1)
        self.assertAlmostEqual(sigma, 3.3, 1)

    def test_z_mumu_clic(self):
        '''Check Z mass in ee->Z->mumu (CLIC).
        Will fail if physics algorithms are modified,
        so should probably be removed from test suite,
        or better: be made optional. 
        '''
        from heppy.papas.detectors.CLIC import clic
#.........这里部分代码省略.........
开发者ID:HEP-FCC,项目名称:heppy,代码行数:103,代码来源:test_analysis_ee_Z.py


注:本文中的heppy.framework.looper.Looper.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。