Belle II Software  release-05-01-25
MaterialScan.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 from basf2 import logging, LogLevel, register_module, create_path, process
5 # Don't show all the info messages
6 logging.log_level = LogLevel.ERROR
7 
8 # We need to process one event so we need the EventInfoSetter
9 eventinfosetter = register_module('EventInfoSetter')
10 eventinfosetter.param({'runList': [1], 'evtNumList': [1]})
11 
12 # We need the geometry parameters
13 gearbox = register_module('Gearbox')
14 gearbox.param('fileName', '/geometry/Beast2_phase1.xml')
15 # as well as the geometry
16 geometry = register_module('Geometry')
17 geometry.set_log_level(LogLevel.INFO)
18 # Restrict Geometry to certain components, in this case only PXD and SVD
19 # geometry.param('components', ['PH1BPIPE'])
20 
21 # MaterialScan uses the Geant4 setup which is created by the FullSim module so
22 # we need this as well
23 simulation = register_module('FullSim')
24 
25 # And finally the MaterialScan module
26 materialscan = register_module('MaterialScan')
27 materialscan.set_log_level(LogLevel.INFO)
28 
29 # Create a detailed Materialbudget for the beampipe
30 # 1) 1000x1000 raster starting from IP looking at the acceptance
31 # 2) 2000x2000 raster of the ZX plane between Z=-50 to 60 cm and X=-16 to
32 # 16 cm, starting at Y=-16cm and scanning the next 32cm along Y
33 
34 materialscan.param({ # Filename for output File
35  # Do Spherical scan?
36  # Origin of the spherical scan
37  # Number of steps in theta
38  # Minimal theta value
39  # Maximal theta value
40  # If set to true, the scan will be done uniform in cos(theta)
41  # Number of steps in theta
42  # Minimal theta value
43  # Maximal theta value
44  # Depth of the scan: 0 for scan the whole defined geometry. Any value >0
45  # will stop the ray after reaching the given distance from the start point
46  # Split output by Material names instead of by Region
47  # Specify the names of Materials to ignore in the scan.
48  # Default is Air and Vacuum
49  # Do Planar scan?
50  # Name of the plane for scanning. One of 'XY', 'XZ', 'YX', 'YZ', 'ZX',
51  # 'ZY' or 'custom' to define the plane directly
52  # Define a custom plane for the scan, only used if planar.plane='custom'.
53  # This is a list of 9 values where the first three values specify the
54  # origin, the second 3 values specify the first axis and the last 3 values
55  # specify the second axis. In this case we scan the ZX plane but the origin
56  # is not at the IP at y=-1 to create a symmetric cut view in |y|< 1 cm
57  # Origin
58  # First axis
59  # Second axis
60  # Depth of the scan: 0 for scan the whole defined geometry. Any value >0
61  # will stop the ray after reaching the given distance from the start point
62  # Number of steps along the first axis
63  # Minimum value for the first axis
64  # Maximum value for the first axis
65  # Number of steps along the second axis
66  # Minimum value for the second axis
67  # Maximum value for the second axis
68  # Split output by Material names insted of by Region
69  # Specify the names of Materials to ignore in the scan.
70  # Default is Air and Vacuum
71  'Filename': 'MaterialScan.root',
72  'spherical': True,
73  'spherical.origin': [0, 0, 0],
74  'spherical.nTheta': 1000,
75  'spherical.minTheta': 17,
76  'spherical.maxTheta': 150,
77  'spherical.cosTheta': True,
78  'spherical.nPhi': 1000,
79  'spherical.minPhi': 0,
80  'spherical.maxPhi': 360,
81  'spherical.maxDepth': 0,
82  'spherical.splitByMaterials': False,
83  'spherical.ignored': ['Air', 'Vacuum', 'G4_AIR', 'ColdAir'],
84  'planar': True,
85  'planar.plane': 'custom',
86  'planar.custom': [
87  0,
88  -16,
89  0,
90  0,
91  0,
92  1,
93  1,
94  0,
95  0,
96  ],
97  'planar.maxDepth': 32,
98  'planar.nU': 2000,
99  'planar.minU': -50.0,
100  'planar.maxU': 60,
101  'planar.nV': 2000,
102  'planar.minV': -16,
103  'planar.maxV': 16,
104  'planar.splitByMaterials': True,
105  'planar.ignored': ['Air', 'G4_AIR', 'ColdAir'],
106 })
107 
108 # Create a path and add all modules
109 main = create_path()
110 main.add_module(eventinfosetter)
111 main.add_module(gearbox)
112 main.add_module(geometry)
113 main.add_module(simulation)
114 main.add_module(materialscan)
115 
116 # Do the MaterialScan, can take some time depending on the number of steps
117 process(main)
display.CDCDisplayRun.create_path
def create_path(self)
Definition: display.py:143