Belle II Software  release-08-01-10
collectKinematicConstrainedMuMu.py
1 #!/usr/bin/env python
2 
3 
10 
11 import basf2
12 
13 import simulation as sim
14 import reconstruction as reco
15 import modularAnalysis as ana
16 import beamparameters as beam
17 
18 main = basf2.create_path()
19 
20 main.add_module("RootInput")
21 # main.add_module("EventInfoSetter")
22 main.add_module("Gearbox")
23 main.add_module("Geometry")
24 main.add_module("HistoManager", histoFileName="CollectorOutput.root")
25 beam.add_beamparameters(main, 'Y4S', 10.5796, vertex=[0., 0., 0.])
26 
27 # main.add_module('PairGen', pdgCode=13)
28 sim.add_simulation(main)
29 reco.add_reconstruction(main, pruneTracks=False)
30 
31 # Pre-fit with beam+vertex constraint decays for alignment
32 ana.fillParticleList('mu+:qed', 'muonID > 0.1 and useCMSFrame(p) > 2.', writeOut=True, path=main)
33 ana.reconstructDecay('Z0:mumu -> mu-:qed mu+:qed', 'InvM > 10.5296 and InvM < 10.6296', writeOut=True, path=main)
34 
35 ana.vertexRaveDaughtersUpdate('Z0:mumu', 0.0, path=main, silence_warning=True)
36 
37 ana.matchMCTruth('mu+:qed', main)
38 ana.matchMCTruth('Z0:mumu', main)
39 
40 ana.printVariableValues('Z0:mumu', ['E', 'deltaE', 'M', 'InvM', 'mcPDG', 'p', 'Ecms'], path=main)
41 ana.printVariableValues('mu+:qed', ['E', 'deltaE', 'M', 'mcPDG', 'p', 'muonID'], path=main)
42 
43 main.add_module('VariablesToEventBasedTree',
44  particleList='Z0:mumu',
45  variables=['InvM', 'Ecms',
46  'daughter(0, p)', 'daughter(1, p)'],
47  event_variables=['nTracks', 'expNum', 'runNum', 'evtNum'])
48 main.add_module(
49  'MillepedeCollector',
50  components=['beamparameters'],
51  primaryTwoBodyDecays=['Z0:mumu'], tracks=[],
52  calibrateVertex=True,
53  useGblTree=False)
54 
55 main.add_module('RootOutput')
56 main.add_module("Progress")
57 
58 basf2.print_path(main)
59 basf2.process(main)
60 print(basf2.statistics)