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