Belle II Software development
embedding.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12import subprocess
13
14if __name__ == "__main__":
15
16 # particleList name of the skim
17 removeList = 'B+:BplusToKplusJpsiMuMu'
18 signalList = 'B+:BplusToKplusNuNu'
19
20 # example files that contain the particleList
21 inputDataForRemoveList = b2.find_file('embedding_skim_BplusToKplusJpsiMuMu_bucket17.udst.root', 'examples', False)
22 inputMCForSignalList = b2.find_file('embedding_skim_sig_71_Bplus2Kplus.udst.root', 'examples', False)
23
24 outputDataForRemoveList = 'data.root'
25 outputMCForSignalList = 'sigmc.root'
26 outputEmbedded = 'embedded_data.root'
27
28 cmd = f'basf2 udst_purge_list.py -- --listName {removeList} --charge pos --fileIn {inputDataForRemoveList}'\
29 f' --fileOut {outputDataForRemoveList}'
30 subprocess.check_call(cmd.split())
31
32 cmd = f'basf2 udst_purge_list.py -- --isSignal --listName {signalList} --charge pos --fileIn {inputMCForSignalList}'\
33 f' --fileOut {outputMCForSignalList}'
34 subprocess.check_call(cmd.split())
35
36 cmd = f'basf2 embedding_merge.py -- --filePrimary {outputDataForRemoveList} --fileSecondary {outputMCForSignalList}'\
37 f' --fileOut {outputEmbedded}'
38 subprocess.check_call(cmd.split())