9 from ROOT
import gROOT, Belle2
10 gROOT.ProcessLine(
"gErrorIgnoreLevel = 4000;")
12 from cdctrigger
import add_cdc_trigger
15 Example script for the CDC trigger.
16 The path contains a particle gun with single tracks,
17 simulation up to the CDC, CDC digitizer and trigger.
18 Last is a short python test module to demonstrate the readout of the trigger tracks.
30 particlegun_params = {
31 'pdgCodes': [-13, 13],
33 'momentumGeneration':
'inversePt',
34 'momentumParams': [0.3, 10.],
35 'thetaGeneration':
'uniform',
36 'thetaParams': [35, 123],
37 'phiGeneration':
'uniform',
38 'phiParams': [0, 360],
39 'vertexGeneration':
'uniform',
40 'xVertexParams': [0, 0.0],
41 'yVertexParams': [0, 0.0],
42 'zVertexParams': [-50.0, 50.0]}
43 bkgdir =
'/sw/belle2/bkg/'
50 basf2.set_random_seed(seed)
52 basf2.set_log_level(basf2.LogLevel.ERROR)
54 main = basf2.create_path()
56 main.add_module(
'EventInfoSetter', evtNumList=evtnum)
57 main.add_module(
'Progress')
58 main.add_module(
'Gearbox')
59 main.add_module(
'Geometry', components=[
'BeamPipe',
61 'MagneticFieldConstant4LimitedRCDC'])
62 particlegun = basf2.register_module(
'ParticleGun')
63 particlegun.param(particlegun_params)
64 main.add_module(particlegun)
65 main.add_module(
'FullSim')
67 bkgmixer = basf2.register_module(
'BeamBkgMixer')
68 bkgfiles = glob.glob(os.path.join(bkgdir,
'*[!(PXD)(ECL)]??.root'))
69 bkgmixer.param(
'backgroundFiles', bkgfiles)
70 bkgmixer.param(
'components', [
'CDC'])
71 main.add_module(bkgmixer)
72 cdcdigitizer = basf2.register_module(
'CDCDigitizer')
73 cdcdigitizer_params = {
74 'UseSimpleDigitization': simplext,
75 'DoSmearing':
not simplext}
76 cdcdigitizer.param(cdcdigitizer_params)
77 main.add_module(cdcdigitizer)
92 short test module to demonstrate the readout of the CDC trigger
97 print output values of the different stages in the CDC trigger
99 print(
"CDC trigger readout")
105 listnames = [
"2D finder",
"2D fitter",
"3D fitter",
"Neurotrigger"]
106 for i, tracks
in enumerate([tracks2Dfinder, tracks2Dfitter,
107 tracks3Dfitter, tracks3Dneuro]):
108 print(listnames[i],
"has", len(tracks),
"tracks.")
110 print(
"phi0[deg] = %.2f" % (track.getPhi0() * 180. / np.pi),
111 "pt[GeV] = %.3f" % track.getTransverseMomentum(1.5),
112 "charge = %d" % track.getChargeSign(),
113 "theta[deg] = %.2f" % (np.arctan2(1., track.getCotTheta()) * 180. / np.pi),
114 "z[cm] = %.2f" % track.getZ0())
117 print(
"phi0[deg] = %.2f" % (particle.getMomentum().Phi() * 180. / np.pi),
118 "pt[GeV] = %.3f" % particle.getMomentum().Pt(),
119 "charge = %d" % particle.getCharge(),
120 "theta[deg] = %.2f" % (particle.getMomentum().Theta() * 180. / np.pi),
121 "z[cm] = %.2f" % particle.getProductionVertex().Z())
130 print(basf2.statistics)