30 import modularAnalysis
as ma
37 if len(sys.argv) >= 2:
38 step = str(sys.argv[1])
41 input_file = b2.find_file(
'Bd2K0spi0_to_test.root',
'examples',
False)
43 input_file = b2.find_file(
'ccbar_sample_to_test.root',
'examples',
False)
45 sys.exit(
'Step does not match any of the available samples: `signal` or `qqbar`')
47 outfile =
'MVAExpert_fullNTuple_' + step +
'.root'
51 main = b2.create_path()
53 ma.inputMdst(filename=input_file,
56 ma.fillParticleList(decayString=
'gamma:all',
58 ma.fillParticleList(decayString=
'pi+:good',
59 cut=
'chiProb > 0.001 and pionID > 0.5',
61 ma.fillParticleList(decayString=
'pi-:good',
62 cut=
'chiProb > 0.001 and pionID > 0.5',
65 ma.reconstructDecay(decayString=
'K_S0 -> pi+:good pi-:good',
66 cut=
'0.480<=M<=0.516',
69 ma.reconstructDecay(decayString=
'pi0 -> gamma:all gamma:all',
70 cut=
'0.115<=M<=0.152',
73 ma.reconstructDecay(decayString=
'B0 -> K_S0 pi0',
74 cut=
'5.2 < Mbc < 5.3 and -0.3 < deltaE < 0.2',
77 ma.matchMCTruth(list_name=
'B0', path=main)
78 ma.buildRestOfEvent(target_list_name=
'B0', path=main)
82 cleanMask = (
'cleanMask',
'nCDCHits > 0 and useCMSFrame(p)<=3.2',
'p >= 0.05 and useCMSFrame(p)<=3.2')
83 ma.appendROEMasks(list_name=
'B0',
84 mask_tuples=[cleanMask],
87 ma.buildContinuumSuppression(list_name=
'B0',
103 'KSFWVariables(mm2)',
104 'KSFWVariables(hso00)',
105 'KSFWVariables(hso02)',
106 'KSFWVariables(hso04)',
107 'KSFWVariables(hso10)',
108 'KSFWVariables(hso12)',
109 'KSFWVariables(hso14)',
110 'KSFWVariables(hso20)',
111 'KSFWVariables(hso22)',
112 'KSFWVariables(hso24)',
113 'KSFWVariables(hoo0)',
114 'KSFWVariables(hoo1)',
115 'KSFWVariables(hoo2)',
116 'KSFWVariables(hoo3)',
117 'KSFWVariables(hoo4)',
130 targetVar = [
'isNotContinuumEvent']
133 main.add_module(
'MVAExpert', listNames=[
'B0'], extraInfoName=
'FastBDT', identifier=
'MVAFastBDT.root')
136 expertVars = [
'extraInfo(FastBDT)',
'transformedNetworkOutput(FastBDT,0.1,1.0)']
139 ma.variablesToNtuple(decayString=
'B0',
140 variables=trainVars + targetVar + expertVars,