Belle II Software  release-06-02-00
071_fei.py
1 #!/usr/bin/env python3
2 
3 import basf2 as b2
4 import modularAnalysis as ma
5 from variables import variables as vm
6 
7 main = b2.Path()
8 
9 ma.inputMdst(
10  "default",
11  b2.find_file("starterkit/2021/fei_skimmed_xulnu.udst.root", "examples"),
12  path=main,
13 )
14 
15 good_track = (
16  "dr < 0.5 and abs(dz) < 2 and nCDCHits > 20 and thetaInCDCAcceptance"
17 )
18 
19 ma.fillParticleList("mu-", "muonID > 0.9 and " + good_track, path=main)
20 ma.fillParticleList("pi-", "pionID > 0.5 and " + good_track, path=main)
21 
22 ma.reconstructDecay("B0:signal -> pi- mu+ ?nu", cut="", path=main)
23 
24 ma.reconstructDecay(
25  "Upsilon(4S):opposite_cp -> B0:generic anti-B0:signal", cut="", path=main
26 )
27 ma.reconstructDecay(
28  decayString="Upsilon(4S):same_cp -> B0:generic B0:signal",
29  cut="",
30  path=main,
31 )
32 # Combine the two Upsilon(4S) lists to one. Note: Duplicates are removed.
33 ma.copyLists(
34  outputListName="Upsilon(4S)",
35  inputListNames=["Upsilon(4S):opposite_cp", "Upsilon(4S):same_cp"],
36  path=main,
37 )
38 
39 ma.buildRestOfEvent("Upsilon(4S)", path=main)
40 track_based_cuts = "thetaInCDCAcceptance and pt > 0.075 and dr < 2 and abs(dz) < 4"
41 ecl_based_cuts = "thetaInCDCAcceptance and E > 0.05"
42 roe_mask = ("my_mask", track_based_cuts, ecl_based_cuts)
43 ma.appendROEMasks("Upsilon(4S)", [roe_mask], path=main)
44 
45 ma.matchMCTruth(list_name="Upsilon(4S)", path=main)
46 
47 vm.addAlias("Btag_SigProb", "daughter(0, extraInfo(SignalProbability))")
48 vm.addAlias("Btag_decayModeID", "daughter(0, extraInfo(decayModeID))")
49 vm.addAlias("Btag_Mbc", "daughter(0, Mbc)")
50 
51 vm.addAlias("Bsig_isSignal",
52  "daughter(1, isSignal)")
53 vm.addAlias("nCharged", "nROE_Charged(my_mask)")
54 
55 ma.variablesToNtuple(
56  "Upsilon(4S)",
57  variables=[
58  "Btag_SigProb",
59  "Btag_decayModeID",
60  "Btag_Mbc",
61  "Bsig_isSignal",
62  "isSignal",
63  "m2RecoilSignalSide",
64  "nCharged"
65  ],
66  filename='Upsilon4S.root',
67  path=main,
68 )
69 # Process events
70 b2.process(main)
71 print(b2.statistics)