713
by Christopher Hunt
Everything |
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 |
my_input = MAUS.InputCppRoot() |
|
21 |
||
22 |
# Create an empty array of mappers, then populate it
|
|
23 |
# with the functionality you want to use.
|
|
24 |
my_map = MAUS.MapPyGroup() |
|
25 |
||
26 |
# GEANT4
|
|
27 |
# my_map.append(MAUS.MapPyBeamMaker()) # beam construction
|
|
28 |
# my_map.append(MAUS.MapCppSimulation()) # geant4 simulation
|
|
29 |
||
30 |
# Pre detector set up
|
|
31 |
# my_map.append(MAUS.MapPyMCReconSetup()) # geant4 simulation
|
|
32 |
||
33 |
# TOF
|
|
34 |
# my_map.append(MAUS.MapCppTOFMCDigitizer()) # TOF MC Digitizer
|
|
35 |
# my_map.append(MAUS.MapCppTOFSlabHits()) # TOF MC Slab Hits
|
|
36 |
# my_map.append(MAUS.MapCppTOFSpacePoints()) # TOF Space Points
|
|
37 |
||
38 |
# SciFi
|
|
39 |
my_map.append(MAUS.MapCppTrackerMCDigitization()) # SciFi electronics model |
|
40 |
my_map.append(MAUS.MapCppTrackerRecon()) # SciFi Recon |
|
41 |
||
42 |
# Global Digits - post detector digitisation
|
|
43 |
||
44 |
# Emittance Recon
|
|
45 |
# my_reduce = MAUS.ReduceCppPatternRecognition()
|
|
46 |
my_reduce = MAUS.ReducePyDoNothing() |
|
47 |
||
48 |
# Then construct a MAUS output component - filename comes from datacards
|
|
49 |
my_output = MAUS.OutputCppRoot() |
|
50 |
||
51 |
# can specify datacards here or by using appropriate command line calls
|
|
52 |
datacards = io.StringIO(u"") |
|
53 |
||
54 |
# The Go() drives all the components you pass in, then check the file
|
|
55 |
# (default simulation.out) for output
|
|
56 |
MAUS.Go(my_input, my_map, my_reduce, my_output, datacards) |
|
57 |
||
58 |
if __name__ == '__main__': |
|
59 |
run() |