Belle II Software  release-08-01-10
masterclass.py
1 #!/usr/bin/env python3
2 
3 
10 from basf2 import Path, process, AfterConditionPath
11 from modularAnalysis import applyEventCuts
12 from sys import argv
13 
14 main = Path()
15 
16 main.add_module('RootInput')
17 # basf2 -n100 -i "/group/belle/users/kspenko/data/masterclass/exp26/sub00/*.root" masterclass.py
18 
19 # Use this only with data (hadron collections) ---------------------------------
20 event_cuts = "[SoftwareTriggerResult(software_trigger_cut&skim&accept_b_neutral)]"
21 event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_b_charged)]"
22 event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_1)]"
23 event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_2)]"
24 event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_3)]"
25 event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_4)]"
26 event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_jpsi)]"
27 event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_kshort)]"
28 applyEventCuts(event_cuts, path=main)
29 
30 trigger_skim = main.add_module("TriggerSkim", triggerLines=[
31  "software_trigger_cut&skim&accept_b_neutral",
32  "software_trigger_cut&skim&accept_b_charged",
33  "software_trigger_cut&skim&accept_dstar_1",
34  "software_trigger_cut&skim&accept_dstar_2",
35  "software_trigger_cut&skim&accept_dstar_3",
36  "software_trigger_cut&skim&accept_dstar_4",
37  # "software_trigger_cut&skim&accept_jpsi",
38  "software_trigger_cut&skim&accept_kshort",
39 ])
40 trigger_skim.param("expectedResult", 1)
41 trigger_skim.param("logicMode", "or")
42 trigger_skim.if_value("==0", Path(), AfterConditionPath.END)
43 
44 
45 # (Running on grid with custom compiled libraries) In theory this should work---------------------------
46 # mc_module = register_module(
47 # 'MasterClass',
48 # shared_lib_path='/home/belle2/kspenko/basf2/modules/Linux_x86_64/opt/libmasterclass_modules.so')
49 # mc_module = register_module(
50 # 'MasterClass',
51 # shared_lib_path='/home/belle2/kspenko/basf2/masterclass/examples/libmasterclass_modules.so')
52 # print(os.environ["LD_LIBRARY_PATH"])
53 # mc_module = register_module('MasterClass')
54 # #, shared_lib_path='./libmasterclass_modules.so')#:./libmasterclass_dataobjects.so')
55 # main.add_module(mc_module)
56 
57 masterclass = main.add_module('MasterClass')
58 if (len(argv) > 1):
59  masterclass.param('outputFileName', argv[1])
60 
61 main.add_module('Progress')
62 process(main)