Project

General

Profile

Bug #1640 » simulate_emr.py

Rogers, Chris, 10 March 2015 11:29

 
1
#!/usr/bin/env python
2

    
3
"""
4
Simulate the MICE experiment
5

    
6
This will simulate MICE spills through the entirety of MICE using Geant4, then
7
digitize and reconstruct TOF and tracker hits to space points.
8
"""
9

    
10
import io   #  generic python library for I/O
11

    
12
import MAUS # MAUS libraries
13

    
14
def run():
15
    """ Run the macro
16
    """
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

    
25
    # G4beamline
26
    # my_map.append(MAUS.MapPyBeamlineSimulation())
27

    
28
    # GEANT4
29
    my_map.append(MAUS.MapPyBeamMaker()) # beam construction
30
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
31

    
32
    # Pre detector set up
33
    my_map.append(MAUS.MapPyMCReconSetup())  #  geant4 simulation
34

    
35
    # EMR
36
    my_map.append(MAUS.MapCppEMRMCDigitization())
37
    my_map.append(MAUS.MapCppEMRPlaneHits())
38
    my_map.append(MAUS.MapCppEMRRecon())
39

    
40
    # Global Digits - post detector digitisation
41

    
42
    # Then construct a MAUS output component - filename comes from datacards
43
    my_output = MAUS.OutputCppRoot()
44

    
45
    # can specify datacards here or by using appropriate command line calls
46
    datacards = io.StringIO(u"")
47

    
48
    # The Go() drives all the components you pass in, then check the file
49
    # (default simulation.out) for output
50
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output, datacards)
51

    
52
if __name__ == '__main__':
53
    run()
(4-4/6)