Belle II Software development
testEntireBKLMChain.py
1#!/usr/bin/env python
2
3
10
11
18
19import basf2
20import generators as gen
21import simulation as sim
22
23bklm_dataObjects = ['BKLMDigits',
24 'BKLMDigitOutOfRanges',
25 'KLMDigitEventInfos',
26 'BKLMHit1ds',
27 'BKLMHit2ds',
28 'BKLMTracks']
29use_KKMC = False
30
31# Create the main path
32main = basf2.create_path()
33
34# Set EventInfoSetter and add a progress bar
35main.add_module('EventInfoSetter',
36 expList=0,
37 runList=0,
38 evtNumList=1000)
39main.add_module('Progress')
40main.add_module('ProgressBar')
41
42if use_KKMC: # Use KKMC to generate generic mu+mu- events
43 gen.add_kkmc_generator(path=main,
44 finalstate='mu-mu+')
45else: # Use ParticleGun to generate 4GeV mu+ and mu-
46 main.add_module('ParticleGun',
47 nTracks=1,
48 pdgCodes=[13, -13],
49 momentumGeneration='fixed',
50 momentumParams=[4],
51 thetaGeneration='uniform',
52 thetaParams=[37, 130])
53
54# Add simulation
55main.add_module('Gearbox')
56main.add_module('Geometry',
57 components=['KLM'],
58 useDB=False)
59sim.add_simulation(path=main,
60 components=['KLM'])
61
62# Pack and unpack data
63main.add_module('KLMPacker')
64main.add_module('KLMUnpacker',
65 WriteDigitRaws=True)
66
67# Add the digit analyzer module (optional)
68main.add_module('BKLMDigitAnalyzer',
69 outputRootName='bklmHitmap')
70
71# Add the reconstruction
72main.add_module('KLMReconstructor')
73
74# Add the self-tracking
75main.add_module('BKLMTracking',
76 StudyEffiMode=True,
77 outputName='bklmEfficiency.root')
78
79# Save the dataobjects in a .root output
80main.add_module('RootOutput',
81 outputFileName='bklm_dataObjects.root',
82 branchNames=bklm_dataObjects,
83 branchNamesPersistent='FileMetaData')
84
85# Process the path
86basf2.process(main)
87print(basf2.statistics)