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