26import modularAnalysis
as ma
47outfile =
"B2A702_output.root"
52 if sys.argv[1]
not in [
'train',
'test',
'apply_signal',
'apply_qqbar']:
53 sys.exit(
"usage:\n\tbasf2 B2A701-ContinuumSuppression_Input.py <train,test,apply_signal,apply_qqbar>")
55 step = str(sys.argv[1])
58 input_file_list = [b2.find_file(
'ccbar_sample_to_train.root',
'examples',
False),
59 b2.find_file(
'Bd2K0spi0_to_train.root',
'examples',
False)]
61 input_file_list = [b2.find_file(
'ccbar_sample_to_test.root',
'examples',
False),
62 b2.find_file(
'Bd2K0spi0_to_test.root',
'examples',
False)]
63elif step ==
'apply_signal':
64 input_file_list = [b2.find_file(
'Bd2K0spi0_to_test.root',
'examples',
False)]
65elif step ==
'apply_qqbar':
66 input_file_list = [b2.find_file(
'ccbar_sample_to_test.root',
'examples',
False)]
68 sys.exit(
'Step does not match any of the available samples: `train`, `test`, `apply_signal`or `apply_qqbar`')
69outfile = step +
'.root'
74my_path = b2.create_path()
76ma.inputMdstList(filelist=input_file_list,
79ma.fillParticleList(decayString=
'gamma:all',
82ma.fillParticleList(decayString=
'pi+:good',
83 cut=
'chiProb > 0.001 and pionID > 0.5',
85ma.fillParticleList(decayString=
'pi-:good',
86 cut=
'chiProb > 0.001 and pionID > 0.5',
89ma.reconstructDecay(decayString=
'K_S0 -> pi+:good pi-:good',
90 cut=
'0.480<=M<=0.516',
93ma.reconstructDecay(decayString=
'pi0 -> gamma:all gamma:all',
94 cut=
'0.115<=M<=0.152',
97ma.reconstructDecay(decayString=
'B0 -> K_S0 pi0',
98 cut=
'5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2',
101ma.matchMCTruth(list_name=
'B0', path=my_path)
102ma.buildRestOfEvent(target_list_name=
'B0', path=my_path)
106cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
107ma.appendROEMasks(list_name=
'B0',
108 mask_tuples=[cleanMask],
111ma.buildContinuumSuppression(list_name=
'B0',
112 roe_mask=
'cleanMask',
126 'KSFWVariables(mm2)',
127 'KSFWVariables(hso00)',
128 'KSFWVariables(hso01)',
129 'KSFWVariables(hso02)',
130 'KSFWVariables(hso03)',
131 'KSFWVariables(hso04)',
132 'KSFWVariables(hso10)',
133 'KSFWVariables(hso12)',
134 'KSFWVariables(hso14)',
135 'KSFWVariables(hso20)',
136 'KSFWVariables(hso22)',
137 'KSFWVariables(hso24)',
138 'KSFWVariables(hoo0)',
139 'KSFWVariables(hoo1)',
140 'KSFWVariables(hoo2)',
141 'KSFWVariables(hoo3)',
142 'KSFWVariables(hoo4)',
155targetVar = [
'isNotContinuumEvent']
158ma.variablesToNtuple(decayString=
'B0',
159 variables=trainVars + targetVar,