Belle II Software  release-05-01-25
testEntireBKLMChain.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 
14 
15 import basf2
16 import simulation as sim
17 
18 bklm_dataObjects = ['BKLMDigits',
19  'BKLMDigitOutOfRanges',
20  'KLMDigitEventInfos',
21  'BKLMHit1ds',
22  'BKLMHit2ds',
23  'BKLMTracks']
24 use_KKMC = False
25 
26 # Create the main path
27 main = basf2.create_path()
28 
29 # Set EventInfoSetter and add a progress bar
30 main.add_module('EventInfoSetter',
31  expList=0,
32  runList=0,
33  evtNumList=1000)
34 main.add_module('Progress')
35 main.add_module('ProgressBar')
36 
37 if use_KKMC: # Use KKMC to generate generic mu+mu- events
38  main.add_module('KKGenInput',
39  tauinputFile=Belle2.FileSystem.findFile('data/generators/kkmc/mu.input.dat'),
40  KKdefaultFile=Belle2.FileSystem.findFile('data/generators/kkmc/KK2f_defaults.dat'),
41  taudecaytableFile='',
42  kkmcoutputfilename='output.kkmc.dat')
43 else: # Use ParticleGun to generate 4GeV mu+ and mu-
44  main.add_module('ParticleGun',
45  nTracks=1,
46  pdgCodes=[13, -13],
47  momentumGeneration='fixed',
48  momentumParams=[4],
49  thetaGeneration='uniform',
50  thetaParams=[37, 130])
51 
52 # Add simulation
53 main.add_module('Gearbox')
54 main.add_module('Geometry',
55  components=['KLM'],
56  useDB=False)
57 sim.add_simulation(path=main,
58  components=['KLM'])
59 
60 # Pack and unpack data
61 main.add_module('KLMPacker')
62 main.add_module('KLMUnpacker',
63  WriteDigitRaws=True)
64 
65 # Add the digit analyzer module (optional)
66 main.add_module('BKLMDigitAnalyzer',
67  outputRootName='bklmHitmap')
68 
69 # Add the reconstruction
70 main.add_module('KLMReconstructor')
71 
72 # Add the self-tracking
73 main.add_module('BKLMTracking',
74  StudyEffiMode=True,
75  outputName='bklmEfficiency.root')
76 
77 # Save the dataobjects in a .root output
78 main.add_module('RootOutput',
79  outputFileName='bklm_dataObjects.root',
80  branchNames=bklm_dataObjects,
81  branchNamesPersistent='FileMetaData')
82 
83 # Process the path
84 basf2.process(main)
85 print(basf2.statistics)
basf2.process
def process(path, max_event=0)
Definition: __init__.py:25
Belle2::FileSystem::findFile
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:147