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