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