Belle II Software  release-05-01-25
PXDValidationGen.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
21 """<header>
22 <input>PXDValidationTTreeOutput.root</input>
23 <input>PXDValidationTTreeSimHitOutput.root</input>
24 <input>PXDValidationTTreeDigitOutput.root</input>
25 <output>PXDValidation.root</output>
26 <contact>Peter Kodys, peter.kodys@mff.cuni.cz</contact>
27 <description>This steering file run the PXD response on an input file with own generated events.</description>
28 </header>"""
29 
30 from basf2 import *
31 from PXDValidationTTree import PXDValidationTTree
32 from PXDValidationTTreeSimHit import PXDValidationTTreeSimHit
33 from PXDValidationTTreeDigit import PXDValidationTTreeDigit
34 
35 set_log_level(LogLevel.WARNING)
36 
37 # Register necessary modules:
38 # Particle gun module
39 particlegun = register_module('ParticleGun')
40 # Create Event information
41 eventinfo = register_module('EventInfoSetter')
42 # Show progress of processing
43 progress = register_module('Progress')
44 # Load parameters
45 gearbox = register_module('Gearbox')
46 # Create geometry
47 geometry = register_module('Geometry')
48 # Run simulation
49 simulation = register_module('FullSim')
50 # PXD digitization module
51 pxddigi = register_module('PXDDigitizer')
52 # PXD clustering module
53 pxdclust = register_module('PXDClusterizer')
54 
55 # ============================================================================
56 # Set a fixed random seed for particle generation:
57 set_random_seed(3038402)
58 
59 analyze = PXDValidationTTree()
60 analyzeSimHit = PXDValidationTTreeSimHit()
61 analyzeDigit = PXDValidationTTreeDigit()
62 
63 # Set the number of events to be generate and processed (xxxx events)
64 eventinfo.param({'evtNumList': [1000], 'runList': [1]})
65 
66 # Set parameters for particlegun
67 particlegun.param({
68  # Generate 1 track
69  'nTracks': 1,
70  # Always one, no fluctuations
71  'varyNTracks': False,
72  # Generate pi+, pi-, e+ and e-
73  'pdgCodes': [211, -211, 11, -11],
74  # with a normal distributed transversal momentum
75  'momentumGeneration': 'normal',
76  # with a center of 2 GeV and a width of 0.2 GeV
77  'momentumParams': [2, 0.2],
78  # a uniform distributed phi angle,
79  'phiGeneration': 'uniform',
80  # full circle
81  'phiParams': [0, 360],
82  # Generate theta angles uniform in cos theta
83  'thetaGeneration': 'uniformCos',
84  # between 15 and 150 degree
85  'thetaParams': [15, 150],
86  # normal distributed vertex generation
87  'vertexGeneration': 'normal',
88  # around the origin with a sigma of 0.1cm in each direction
89  'xVertexParams': [0.0, 0.1],
90  'yVertexParams': [0.0, 0.1],
91  'zVertexParams': [0.0, 0.1],
92  # all one track sharing the same vertex per event
93  'independentVertices': False,
94 })
95 
96 # ============================================================================
97 # Print the parameters of the particle gun
98 print_params(particlegun)
99 
100 # Select subdetectors to be built
101 geometry.param('components', ['MagneticField', 'PXD', 'SVD'])
102 
103 pxddigi.param('statisticsFilename', 'PXDValidationDiags3.root')
104 # pxddigi.param('ElectronicEffects', True)
105 # pxddigi.param('ElectronicEffects', False)
106 # pxddigi.param('SimpleDriftModel', False)
107 # pxddigi.param('PoissonSmearing', True)
108 # pxddigi.param('NoiseSN', 1.0)
109 
110 # pxdclust.param('NoiseSN', 1.0)
111 # pxdclust.param('TanLorentz', 0.0)
112 
113 # ============================================================================
114 # create processing path
115 main = create_path()
116 main.add_module(eventinfo)
117 main.add_module(progress)
118 main.add_module(particlegun)
119 main.add_module(gearbox)
120 main.add_module(geometry)
121 main.add_module(simulation)
122 main.add_module(pxddigi)
123 main.add_module(pxdclust)
124 main.add_module(analyze)
125 main.add_module(analyzeSimHit)
126 main.add_module(analyzeDigit)
127 
128 # generate events
129 process(main)
130 
131 # show call statistics
132 print(statistics)
PXDValidationTTree
Definition: PXDValidationTTree.py:1
PXDValidationTTreeDigit
Definition: PXDValidationTTreeDigit.py:1
PXDValidationTTreeSimHit
Definition: PXDValidationTTreeSimHit.py:1