Belle II Software development
masterclass.py
1#!/usr/bin/env python3
2
3
10from basf2 import Path, process, AfterConditionPath
11from modularAnalysis import applyEventCuts
12from sys import argv
13
14main = Path()
15
16main.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) ---------------------------------
20event_cuts = "[SoftwareTriggerResult(software_trigger_cut&skim&accept_b_neutral)]"
21event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_b_charged)]"
22event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_1)]"
23event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_2)]"
24event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_3)]"
25event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_dstar_4)]"
26event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_jpsi)]"
27event_cuts += " or [SoftwareTriggerResult(software_trigger_cut&skim&accept_kshort)]"
28applyEventCuts(event_cuts, path=main)
29
30trigger_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])
40trigger_skim.param("expectedResult", 1)
41trigger_skim.param("logicMode", "or")
42trigger_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
57masterclass = main.add_module('MasterClass')
58if (len(argv) > 1):
59 masterclass.param('outputFileName', argv[1])
60
61main.add_module('Progress')
62process(main)