def test_helloworld_multiple(self): hw = helloworld.HelloWorld() hw.SayHelloAsync() hw.SayHelloAsync() hw.SayHelloAsync() hw.SayHelloAsync() hw.Stop()
def constructor(self): """ This is called by the framework immediately after your device registers with the system. In general, you should add customization here and not in the __init__ constructor. If you have a custom port implementation you can override the specific implementation here with a statement similar to the following: self.some_port = MyPortImplementation() """ hw = helloworld.HelloWorld()
def constructor(self): """ This is called by the framework immediately after your device registers with the system. In general, you should add customization here and not in the __init__ constructor. If you have a custom port implementation you can override the specific implementation here with a statement similar to the following: self.some_port = MyPortImplementation() """ hw = helloworld.HelloWorld() self.addPropertyChangeListener('busy_state', self.busyStateChanged) self.setAllocationImpl("a_number", self.my_alloc_fn, self.my_dealloc_fn)
def main(): ops, args = options() input_files = [ 'test.root', ] ## build the chain chain = ROOT.TChain('tauPerf') for fn in input_files: chain.Add(fn) ## configure the event loop loop = pyframe.core.EventLoop('pyframe_hello_world', version='min') loop += helloworld.HelloWorld(text=ops.text) ## run the analysis loop.run(chain, 0, ops.max_events)
def analyze(config): ## build the chain chain = ROOT.TChain('tauPerf') for fn in config['input_files']: chain.Add(fn) ## configure the event loop loop = pyframe.core.EventLoop('pyframe_hello_world', version=config['version']) ### build vertices loop += pyframe.algs.ListBuilder( prefixes=['vxp_'], keys=['all_vertices'], ) ### select vertices vxp_selector = pyframe.vxp.VxpSelector(min_nTracks=3, ) loop += pyframe.selectors.SelectorAlg( 'VertexSelectorAlg', selector=vxp_selector, key_in='all_vertices', key_out='selected_vertices', ) ### require vertices loop += pyframe.filters.NObjectFilter( keys=['selected_vertices'], min_count=1, name='VertexFilter', ) ### build electrons loop += pyframe.algs.ListBuilder( prefixes=['el_'], keys=['all_electrons'], ) loop += pyframe.p4calc.AttachTLVs(keys=['all_electrons'], ) ### select electrons electron_selector = pyframe.egamma.ElectronSelector( min_pt=20.0 * GeV, allowed_etas=[(-2.47, -1.52), (-1.37, 1.37), (1.52, 2.47)], flags=['tightWithTrack'], ) loop += pyframe.selectors.SelectorAlg( name='ElectronSelectorAlg', selector=electron_selector, key_in='all_electrons', key_out='selected_electrons', ) ### run HelloWorld algorithm loop += helloworld.HelloWorld(text=config['text']) ### run HelloWorld2 algorithm loop += helloworld.HelloWorld2(key='selected_electrons') ### make some plots loop += pyframe.algs.LooperAlg( key='selected_electrons', func=pyframe.egamma.plot_kinematics, prefix='el_', dir='', ) ## run the job loop.run( chain, 0, config['max_events'], branches_on_file=config.get('branches_on_file'), do_var_log=config.get('do_var_log'), )
def test_helloworld(self): hw = helloworld.HelloWorld() hw.SayHello()
def setUp(self): self.environ = {} self.klass = helloworld.HelloWorld(self.environ)
import sys import time start = time.time() sys.setrecursionlimit(100) print('1. Number of loaded modules at start:',) print(len(sys.modules)) # Tell pava where it can find Java user-defined classes print('2. Loading Java...') pava.set_classpath([os.path.join(os.path.dirname(__file__), "pava")]) print('3. Import the Python module that contains the transpiled HelloWorld...') import helloworld print('4. Call HelloWorld.main:') print('#' * 80) helloworld.HelloWorld.main__java_lang_String____([]) hi = helloworld.HelloWorld() square = hi.square__int__(16) print(square) print('#' * 80) print('5. Number of loaded modules after loading HelloWorld:') print(len(sys.modules)) print('6. Done %.4fs.' % (time.time() - start))