Project

General

Profile

Bug #1183 » run_2.py

Taylor, Ian, 04 December 2012 12:01

 
1
#!/usr/bin/env python
2

    
3
import io   #  generic python library for I/O
4
import gzip #  For compressed output # pylint: disable=W0611
5

    
6
import MAUS
7

    
8
def run():
9
    """ Run the macro
10
    """
11

    
12
    # This input reads the simulated file
13
    # my_input = MAUS.InputCppRoot()
14
    my_input = MAUS.InputPyJSON()
15

    
16
    # Create an empty array of mappers, then populate it
17
    # with the functionality you want to use.
18
    my_map = MAUS.MapPyGroup()
19
    # my_map.append(MAUS.MapCppPrint())  # Simple Print
20
    # can specify datacards here or by using appropriate command line calls
21
    #datacards = io.StringIO(u"./datacard_global")
22
    datacards = open('datacard_2', 'r')
23

    
24
    # my_reduce = MAUS.ReduceCppPatternRecognition()
25
    my_reduce = MAUS.ReducePyDoNothing()
26

    
27
    # Then construct a MAUS output component - filename comes from datacards
28
    my_output = MAUS.OutputCppRoot()
29
    # my_output = MAUS.OutputPyJSON()
30
    # my_output = MAUS.OutputPyDoNothing()
31

    
32
    # The Go() drives all the components you pass in, then check the file
33
    # (default simulation.out) for output
34

    
35
    MAUS.Go(my_input, my_map, my_reduce, my_output, datacards)
36

    
37
if __name__ == '__main__':
38
    run()
(3-3/5)