~9marusia6/maus/beamlinesimulation

« back to all changes in this revision

Viewing changes to bin/simulate_mice.py

  • Committer: justinchristensen at berkeley
  • Date: 2012-06-08 08:47:52 UTC
  • mfrom: (669.1.1 release)
  • Revision ID: justinchristensen@berkeley.edu-20120608084752-5x3f3rzflhhcewwi
new version

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.OutputCppRoot()
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()