Project

General

Profile

Bug #820 » simulate_erit.py

Rogers, Chris, 14 December 2011 07:12

 
1
#!/usr/env python
2

    
3
import io
4
import os
5
import MAUS
6

    
7
def main():
8
    geometry_root_dir = os.getenv('ERIT_ROOT')
9

    
10
    if geometry_root_dir == '':
11
        err_msg = """
12
    To run the MAUS install of ERIT_FFAG you need to set the environment variable
13
        ERIT_ROOT
14
    to point at the root of your bzr branch.
15
    """
16
        raise EnvironmentError(err_msg)
17

    
18
    # This input generates empty spills, to be filled by the beam maker later on
19
    my_input = MAUS.InputPySpillGenerator()
20

    
21
    # Create an empty array of mappers, then populate it
22
    # with the functionality you want to use.
23
    my_map = MAUS.MapPyGroup()
24
    my_map.append(MAUS.MapPyBeamMaker()) # beam construction
25
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
26
    # can specify datacards here or by using appropriate command line calls
27
    datacards = io.StringIO(u"")
28
    # Then construct a MAUS output component - filename comes from datacards
29
    my_output = MAUS.OutputPyJSON()
30

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

    
34
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output, datacards)
35
    
36
if __name__=="__main__":
37
    main()
38

    
39

    
(3-3/5)