Belle II Software light-2406-ragdoll
B2A503-ReadDecayHash.py
1#!/usr/bin/env python3
2
3
10
11
34
35import uproot
36import basf2 as b2
37from decayHash import DecayHashMap
38import sys
39
40# read in root-file as a pandas dataframe
41data = uproot.open(b2.find_file('Jpsi_from_B2A502.root', 'examples', False))["variables"].arrays(library="pd")
42hashmap = DecayHashMap(b2.find_file('hashmap_Jpsi_from_B2A502.root', 'examples', False), removeRadiativeGammaFlag=False)
43hashmap2 = DecayHashMap(b2.find_file('hashmap_Jpsi_from_B2A502.root', 'examples', False), removeRadiativeGammaFlag=True)
44
45# get one reconstructed J/psi
46candidate42 = data.iloc[42][["extraInfo__boDecayHash__bc", "extraInfo__boDecayHashExtended__bc"]].values
47
48# print the reconstructed decay
49print("Reconstructed Decay: ")
50rec = hashmap.get_reconstructed_decay(*candidate42)
51print(rec.to_string())
52
53# print the original decay as simulated in MC
54print("Monte Carlo Decay: ")
55org = hashmap.get_original_decay(*candidate42)
56print(org.to_string())
57
58# print the original decay as simulated in MC with removed Bremsstrahlung gammas
59print("Monte Carlo Decay with removed Bremsstrahlung gammas: ")
60org2 = hashmap2.get_original_decay(*candidate42)
61print(org2.to_string())
62
63# search for a specific decay (sub-decay)
64import ROOT # noqa
65print("Search for decay:")
66search_decay = ROOT.Belle2.DecayTree('511 (-> 130 (-> -11 11 22) 443)')
67print(search_decay.to_string())
68found = hashmap.get_original_decay(data.iloc[42]["extraInfo__boDecayHash__bc"],
69 data.iloc[42]["extraInfo__boDecayHashExtended__bc"]).find_decay(search_decay)
70print("Found: ", found)
71sys.exit(0)