16 from ROOT
import gROOT, Belle2
18 from cdctrigger
import add_cdc_trigger
20 gROOT.ProcessLine(
"gErrorIgnoreLevel = 4000;")
23 Example script for the CDC trigger.
24 The path contains a particle gun with single tracks,
25 simulation up to the CDC, CDC digitizer and trigger.
26 Last is a short python test module to demonstrate the readout of the trigger tracks.
38 particlegun_params = {
39 'pdgCodes': [-13, 13],
41 'momentumGeneration':
'inversePt',
42 'momentumParams': [0.3, 10.],
43 'thetaGeneration':
'uniform',
44 'thetaParams': [35, 123],
45 'phiGeneration':
'uniform',
46 'phiParams': [0, 360],
47 'vertexGeneration':
'uniform',
48 'xVertexParams': [0, 0.0],
49 'yVertexParams': [0, 0.0],
50 'zVertexParams': [-50.0, 50.0]}
51 bkgdir =
'/sw/belle2/bkg/'
58 basf2.set_random_seed(seed)
60 basf2.set_log_level(basf2.LogLevel.ERROR)
62 main = basf2.create_path()
64 main.add_module(
'EventInfoSetter', evtNumList=evtnum)
65 main.add_module(
'Progress')
66 main.add_module(
'Gearbox')
67 main.add_module(
'Geometry', components=[
'BeamPipe',
69 'MagneticFieldConstant4LimitedRCDC'])
70 particlegun = basf2.register_module(
'ParticleGun')
71 particlegun.param(particlegun_params)
72 main.add_module(particlegun)
73 main.add_module(
'FullSim')
75 bkgmixer = basf2.register_module(
'BeamBkgMixer')
76 bkgfiles = glob.glob(os.path.join(bkgdir,
'*[!(PXD)(ECL)]??.root'))
77 bkgmixer.param(
'backgroundFiles', bkgfiles)
78 bkgmixer.param(
'components', [
'CDC'])
79 main.add_module(bkgmixer)
80 cdcdigitizer = basf2.register_module(
'CDCDigitizer')
81 cdcdigitizer_params = {
82 'UseSimpleDigitization': simplext,
83 'DoSmearing':
not simplext}
84 cdcdigitizer.param(cdcdigitizer_params)
85 main.add_module(cdcdigitizer)
100 short test module to demonstrate the readout of the CDC trigger
105 print output values of the different stages in the CDC trigger
107 print(
"CDC trigger readout")
113 listnames = [
"2D finder",
"2D fitter",
"3D fitter",
"Neurotrigger"]
114 for i, tracks
in enumerate([tracks2Dfinder, tracks2Dfitter,
115 tracks3Dfitter, tracks3Dneuro]):
116 print(listnames[i],
"has", len(tracks),
"tracks.")
118 print(
"phi0[deg] = %.2f" % (track.getPhi0() * 180. / np.pi),
119 "pt[GeV] = %.3f" % track.getTransverseMomentum(1.5),
120 "charge = %d" % track.getChargeSign(),
121 "theta[deg] = %.2f" % (np.arctan2(1., track.getCotTheta()) * 180. / np.pi),
122 "z[cm] = %.2f" % track.getZ0())
125 print(
"phi0[deg] = %.2f" % (particle.getMomentum().Phi() * 180. / np.pi),
126 "pt[GeV] = %.3f" % particle.getMomentum().Pt(),
127 "charge = %d" % particle.getCharge(),
128 "theta[deg] = %.2f" % (particle.getMomentum().Theta() * 180. / np.pi),
129 "z[cm] = %.2f" % particle.getProductionVertex().Z())
138 print(basf2.statistics)
A (simplified) python wrapper for StoreArray.
a (simplified) python wrapper for StoreObjPtr.