20 import modularAnalysis
as ma
42 outfile =
"B2A702_output.root"
46 magnetic_field =
'default'
48 if len(sys.argv) >= 2:
49 if sys.argv[1]
not in [
'train',
'test',
'apply_signal',
'apply_qqbar']:
50 sys.exit(
"usage:\n\tbasf2 B2A701-ContinuumSuppression_Input.py <train,test,apply_signal,apply_qqbar>")
52 step = str(sys.argv[1])
54 if not os.getenv(
'BELLE2_EXAMPLES_DATA_DIR'):
55 b2.B2FATAL(
"You need the example data installed. Run `b2install-data example` in terminal for it.")
57 path = os.getenv(
'BELLE2_EXAMPLES_DATA_DIR') +
'/'
60 magnetic_field =
'MC10'
62 input_file_list = [path +
'ccbar_sample_to_train.root',
63 path +
'Bd2K0spi0_to_train.root']
65 input_file_list = [path +
'ccbar_sample_to_test.root',
66 path +
'Bd2K0spi0_to_test.root']
67 elif step ==
'apply_signal':
68 input_file_list = [path +
'Bd2K0spi0_to_test.root']
69 elif step ==
'apply_qqbar':
70 input_file_list = [path +
'ccbar_sample_to_test.root', ]
72 sys.exit(
'Step does not match any of the available samples: `train`, `test`, `apply_signal`or `apply_qqbar`')
73 outfile = step +
'.root'
78 my_path = b2.create_path()
80 ma.inputMdstList(environmentType=magnetic_field,
81 filelist=input_file_list,
84 ma.fillParticleList(decayString=
'gamma:all',
87 ma.fillParticleList(decayString=
'pi+:good',
88 cut=
'chiProb > 0.001 and pionID > 0.5',
90 ma.fillParticleList(decayString=
'pi-:good',
91 cut=
'chiProb > 0.001 and pionID > 0.5',
94 ma.reconstructDecay(decayString=
'K_S0 -> pi+:good pi-:good',
95 cut=
'0.480<=M<=0.516',
98 ma.reconstructDecay(decayString=
'pi0 -> gamma:all gamma:all',
99 cut=
'0.115<=M<=0.152',
102 ma.reconstructDecay(decayString=
'B0 -> K_S0 pi0',
103 cut=
'5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2',
106 ma.matchMCTruth(list_name=
'B0', path=my_path)
107 ma.buildRestOfEvent(target_list_name=
'B0', path=my_path)
111 cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
112 ma.appendROEMasks(list_name=
'B0',
113 mask_tuples=[cleanMask],
116 ma.buildContinuumSuppression(list_name=
'B0',
117 roe_mask=
'cleanMask',
131 'KSFWVariables(mm2)',
132 'KSFWVariables(hso00)',
133 'KSFWVariables(hso02)',
134 'KSFWVariables(hso04)',
135 'KSFWVariables(hso10)',
136 'KSFWVariables(hso12)',
137 'KSFWVariables(hso14)',
138 'KSFWVariables(hso20)',
139 'KSFWVariables(hso22)',
140 'KSFWVariables(hso24)',
141 'KSFWVariables(hoo0)',
142 'KSFWVariables(hoo1)',
143 'KSFWVariables(hoo2)',
144 'KSFWVariables(hoo3)',
145 'KSFWVariables(hoo4)',
158 targetVar = [
'isNotContinuumEvent']
161 ma.variablesToNtuple(decayString=
'B0',
162 variables=trainVars + targetVar,