26 import modularAnalysis
as ma
47 outfile =
"B2A702_output.root"
51 if len(sys.argv) >= 2:
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)]
63 elif step ==
'apply_signal':
64 input_file_list = [b2.find_file(
'Bd2K0spi0_to_test.root',
'examples',
False)]
65 elif 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`')
69 outfile = step +
'.root'
74 my_path = b2.create_path()
76 ma.inputMdstList(filelist=input_file_list,
79 ma.fillParticleList(decayString=
'gamma:all',
82 ma.fillParticleList(decayString=
'pi+:good',
83 cut=
'chiProb > 0.001 and pionID > 0.5',
85 ma.fillParticleList(decayString=
'pi-:good',
86 cut=
'chiProb > 0.001 and pionID > 0.5',
89 ma.reconstructDecay(decayString=
'K_S0 -> pi+:good pi-:good',
90 cut=
'0.480<=M<=0.516',
93 ma.reconstructDecay(decayString=
'pi0 -> gamma:all gamma:all',
94 cut=
'0.115<=M<=0.152',
97 ma.reconstructDecay(decayString=
'B0 -> K_S0 pi0',
98 cut=
'5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2',
101 ma.matchMCTruth(list_name=
'B0', path=my_path)
102 ma.buildRestOfEvent(target_list_name=
'B0', path=my_path)
106 cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
107 ma.appendROEMasks(list_name=
'B0',
108 mask_tuples=[cleanMask],
111 ma.buildContinuumSuppression(list_name=
'B0',
112 roe_mask=
'cleanMask',
126 'KSFWVariables(mm2)',
127 'KSFWVariables(hso00)',
128 'KSFWVariables(hso02)',
129 'KSFWVariables(hso04)',
130 'KSFWVariables(hso10)',
131 'KSFWVariables(hso12)',
132 'KSFWVariables(hso14)',
133 'KSFWVariables(hso20)',
134 'KSFWVariables(hso22)',
135 'KSFWVariables(hso24)',
136 'KSFWVariables(hoo0)',
137 'KSFWVariables(hoo1)',
138 'KSFWVariables(hoo2)',
139 'KSFWVariables(hoo3)',
140 'KSFWVariables(hoo4)',
153 targetVar = [
'isNotContinuumEvent']
156 ma.variablesToNtuple(decayString=
'B0',
157 variables=trainVars + targetVar,