26 import modularAnalysis
as ma
48 outfile =
"B2A702_output.root"
52 magnetic_field =
'default'
54 if len(sys.argv) >= 2:
55 if sys.argv[1]
not in [
'train',
'test',
'apply_signal',
'apply_qqbar']:
56 sys.exit(
"usage:\n\tbasf2 B2A701-ContinuumSuppression_Input.py <train,test,apply_signal,apply_qqbar>")
58 step = str(sys.argv[1])
61 magnetic_field =
'MC10'
63 input_file_list = [b2.find_file(
'ccbar_sample_to_train.root',
'examples',
False),
64 b2.find_file(
'Bd2K0spi0_to_train.root',
'examples',
False)]
66 input_file_list = [b2.find_file(
'ccbar_sample_to_test.root',
'examples',
False),
67 b2.find_file(
'Bd2K0spi0_to_test.root',
'examples',
False)]
68 elif step ==
'apply_signal':
69 input_file_list = [b2.find_file(
'Bd2K0spi0_to_test.root',
'examples',
False)]
70 elif step ==
'apply_qqbar':
71 input_file_list = [b2.find_file(
'ccbar_sample_to_test.root',
'examples',
False)]
73 sys.exit(
'Step does not match any of the available samples: `train`, `test`, `apply_signal`or `apply_qqbar`')
74 outfile = step +
'.root'
79 my_path = b2.create_path()
81 ma.inputMdstList(environmentType=magnetic_field,
82 filelist=input_file_list,
85 ma.fillParticleList(decayString=
'gamma:all',
88 ma.fillParticleList(decayString=
'pi+:good',
89 cut=
'chiProb > 0.001 and pionID > 0.5',
91 ma.fillParticleList(decayString=
'pi-:good',
92 cut=
'chiProb > 0.001 and pionID > 0.5',
95 ma.reconstructDecay(decayString=
'K_S0 -> pi+:good pi-:good',
96 cut=
'0.480<=M<=0.516',
99 ma.reconstructDecay(decayString=
'pi0 -> gamma:all gamma:all',
100 cut=
'0.115<=M<=0.152',
103 ma.reconstructDecay(decayString=
'B0 -> K_S0 pi0',
104 cut=
'5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2',
107 ma.matchMCTruth(list_name=
'B0', path=my_path)
108 ma.buildRestOfEvent(target_list_name=
'B0', path=my_path)
112 cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
113 ma.appendROEMasks(list_name=
'B0',
114 mask_tuples=[cleanMask],
117 ma.buildContinuumSuppression(list_name=
'B0',
118 roe_mask=
'cleanMask',
132 'KSFWVariables(mm2)',
133 'KSFWVariables(hso00)',
134 'KSFWVariables(hso02)',
135 'KSFWVariables(hso04)',
136 'KSFWVariables(hso10)',
137 'KSFWVariables(hso12)',
138 'KSFWVariables(hso14)',
139 'KSFWVariables(hso20)',
140 'KSFWVariables(hso22)',
141 'KSFWVariables(hso24)',
142 'KSFWVariables(hoo0)',
143 'KSFWVariables(hoo1)',
144 'KSFWVariables(hoo2)',
145 'KSFWVariables(hoo3)',
146 'KSFWVariables(hoo4)',
159 targetVar = [
'isNotContinuumEvent']
162 ma.variablesToNtuple(decayString=
'B0',
163 variables=trainVars + targetVar,