24if __name__ ==
"__main__":
27 parser = argparse.ArgumentParser(description=
"Generate training data for computing cluster shape corrections")
28 parser.add_argument(
'--clusterkind', dest=
'clusterkind', default=0, type=int,
29 help=
'ClusterKinds 0, 1, 2, 3 are for z55, z60, z70, z85 pixels')
30 parser.add_argument(
'--momentum', dest=
'momentum', default=1.0, type=float, help=
'Momentum of particle gun')
31 parser.add_argument(
'--pdgCode', dest=
'pdgCode', default=-211, type=int, help=
'PDG code for particle gun')
32 args = parser.parse_args()
46 vertex_x = [-0.2050, -0.2]
48 vertex_z = [0.7, 0.7055]
50 if args.clusterkind == 0:
52 elif args.clusterkind == 1:
53 vertex_z = [-1.5060, -1.5]
54 elif args.clusterkind == 2:
56 vertex_z = [0.9, 0.9070]
57 elif args.clusterkind == 3:
59 vertex_z = [-2.0085, -2.0]
62 main = b2.create_path()
65 eventinfosetter = main.add_module(
"EventInfoSetter")
66 histoman = main.add_module(
68 histoFileName=f
'PXDClusterPositionCollectorOutput_kind_{args.clusterkind:d}.root')
69 gearbox = main.add_module(
"Gearbox")
70 geometry = main.add_module(
"Geometry")
71 geometry.param({
"components": [
'MagneticField',
'PXD']})
72 particlegun = main.add_module(
"ParticleGun")
73 particlegun.param({
"nTracks": 1,
74 "pdgCodes": [args.pdgCode],
75 "momentumGeneration":
'discrete',
76 "momentumParams": [args.momentum] + [1] * len([args.momentum]),
77 "thetaGeneration":
'uniformCos',
78 "thetaParams": [0, 90],
79 "phiGeneration":
'uniform',
80 "phiParams": [0, 180],
81 "xVertexGeneration":
'uniform',
82 "xVertexParams": vertex_x,
83 "yVertexGeneration":
'fixed',
84 "yVertexParams": vertex_y,
85 "zVertexGeneration":
'uniform',
86 "zVertexParams": vertex_z,
87 "independentVertices":
False,
89 main.add_module(
"FullSim")
90 pxddigi = main.add_module(
"PXDDigitizer")
91 pxdclu = main.add_module(
"PXDClusterizer")
92 main.add_module(
'PXDClusterPositionCollector', granularity=
"all", clusterKind=args.clusterkind)
93 main.add_module(
"Progress")