~chris-rogers/maus/emr_mc_digitization

« back to all changes in this revision

Viewing changes to tests/integration/test_distributed_processing/simulate_mice_json.py

  • Committer: Chris Rogers
  • Date: 2014-04-16 11:48:45 UTC
  • mfrom: (707 merge)
  • mto: This revision was merged to the branch mainline in revision 711.
  • Revision ID: chris.rogers@stfc.ac.uk-20140416114845-h3u3q7pdcxkxvovs
Update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
    # GEANT4
 
26
    my_map.append(MAUS.MapPyBeamMaker()) # beam construction
 
27
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
 
28
 
 
29
    # Pre detector set up
 
30
    my_map.append(MAUS.MapPyMCReconSetup())  #  geant4 simulation
 
31
 
 
32
    # TOF
 
33
    my_map.append(MAUS.MapCppTOFMCDigitizer())  # TOF MC Digitizer
 
34
    my_map.append(MAUS.MapCppTOFSlabHits()) # TOF MC Slab Hits
 
35
    my_map.append(MAUS.MapCppTOFSpacePoints()) # TOF Space Points
 
36
 
 
37
    # SciFi
 
38
    my_map.append(MAUS.MapCppTrackerMCDigitization()) # SciFi electronics model
 
39
#    my_map.append(MAUS.MapCppTrackerRecon()) # SciFi Recon
 
40
 
 
41
    # Global Digits - post detector digitisation
 
42
 
 
43
    # Then construct a MAUS output component - filename comes from datacards
 
44
    my_output = MAUS.OutputPyJSON()
 
45
 
 
46
    # can specify datacards here or by using appropriate command line calls
 
47
    datacards = io.StringIO(u"")
 
48
 
 
49
    # The Go() drives all the components you pass in, then check the file
 
50
    # (default simulation.out) for output
 
51
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output, datacards)
 
52
 
 
53
if __name__ == '__main__':
 
54
    run()