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