30 import modularAnalysis
as ma
38 if len(sys.argv) >= 2:
39 step = str(sys.argv[1])
42 input_file = b2.find_file(
'Bd2K0spi0_to_test.root',
'examples',
False)
44 input_file = b2.find_file(
'ccbar_sample_to_test.root',
'examples',
False)
46 sys.exit(
'Step does not match any of the available samples: `signal` or `qqbar`')
48 outfile =
'MVAExpert_fullNTuple_' + step +
'.root'
52 main = b2.create_path()
54 ma.inputMdst(environmentType=
'default',
58 ma.fillParticleList(decayString=
'gamma:all',
60 ma.fillParticleList(decayString=
'pi+:good',
61 cut=
'chiProb > 0.001 and pionID > 0.5',
63 ma.fillParticleList(decayString=
'pi-:good',
64 cut=
'chiProb > 0.001 and pionID > 0.5',
67 ma.reconstructDecay(decayString=
'K_S0 -> pi+:good pi-:good',
68 cut=
'0.480<=M<=0.516',
71 ma.reconstructDecay(decayString=
'pi0 -> gamma:all gamma:all',
72 cut=
'0.115<=M<=0.152',
75 ma.reconstructDecay(decayString=
'B0 -> K_S0 pi0',
76 cut=
'5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2',
79 ma.matchMCTruth(list_name=
'B0', path=main)
80 ma.buildRestOfEvent(target_list_name=
'B0', path=main)
84 cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
85 ma.appendROEMasks(list_name=
'B0',
86 mask_tuples=[cleanMask],
89 ma.buildContinuumSuppression(list_name=
'B0',
105 'KSFWVariables(mm2)',
106 'KSFWVariables(hso00)',
107 'KSFWVariables(hso02)',
108 'KSFWVariables(hso04)',
109 'KSFWVariables(hso10)',
110 'KSFWVariables(hso12)',
111 'KSFWVariables(hso14)',
112 'KSFWVariables(hso20)',
113 'KSFWVariables(hso22)',
114 'KSFWVariables(hso24)',
115 'KSFWVariables(hoo0)',
116 'KSFWVariables(hoo1)',
117 'KSFWVariables(hoo2)',
118 'KSFWVariables(hoo3)',
119 'KSFWVariables(hoo4)',
132 targetVar = [
'isNotContinuumEvent']
135 main.add_module(
'MVAExpert', listNames=[
'B0'], extraInfoName=
'FastBDT', identifier=
'MVAFastBDT.root')
138 expertVars = [
'extraInfo(FastBDT)',
'transformedNetworkOutput(FastBDT,0.1,1.0)']
141 ma.variablesToNtuple(decayString=
'B0',
142 variables=trainVars + targetVar + expertVars,