5 import modularAnalysis
as ma
7 from variables
import variables
as vm
12 filenumber = sys.argv[1]
19 filelist=[b2.find_file(f
"starterkit/2021/1111540100_eph3_BGx0_{filenumber}.root",
"examples")],
26 "electronID > 0.1 and dr < 0.5 and abs(dz) < 2 and thetaInCDCAcceptance",
33 "goodFWDGamma",
"passesCut(clusterReg == 1 and clusterE > 0.075)"
36 "goodBRLGamma",
"passesCut(clusterReg == 2 and clusterE > 0.05)"
39 "goodBWDGamma",
"passesCut(clusterReg == 3 and clusterE > 0.1)"
42 "goodGamma",
"passesCut(goodFWDGamma or goodBRLGamma or goodBWDGamma)"
44 ma.fillParticleList(
"gamma:brems",
"goodGamma", path=main)
45 ma.correctBrems(
"e+:corrected",
"e+:uncorrected",
"gamma:brems", path=main)
46 vm.addAlias(
"isBremsCorrected",
"extraInfo(bremsCorrected)")
50 "J/psi:ee -> e+:corrected e-:corrected ?addbrems",
57 "B0 -> J/psi:ee K_S0:merged",
58 cut=
"Mbc > 5.2 and abs(deltaE) < 0.15",
63 ma.matchMCTruth(
"B0", path=main)
66 ma.buildRestOfEvent(
"B0", fillWithMostLikely=
True, path=main)
67 track_based_cuts =
"thetaInCDCAcceptance and pt > 0.075 and dr < 5 and abs(dz) < 10"
68 ecl_based_cuts =
"thetaInCDCAcceptance and E > 0.05"
69 roe_mask = (
"my_mask", track_based_cuts, ecl_based_cuts)
70 ma.appendROEMasks(
"B0", [roe_mask], path=main)
73 b2.set_random_seed(
"Belle II StarterKit")
74 ma.rankByHighest(
"B0", variable=
"random", numBest=1, path=main)
79 standard_vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
80 b_vars += vc.deltae_mbc
81 b_vars += standard_vars
84 roe_kinematics = [
"roeE()",
"roeM()",
"roeP()",
"roeMbc()",
"roeDeltae()"]
85 roe_multiplicities = [
88 "nROE_NeutralHadrons()",
90 b_vars += roe_kinematics + roe_multiplicities
92 for roe_variable
in roe_kinematics + roe_multiplicities:
94 roe_variable_with_mask = roe_variable.replace(
"()",
"(my_mask)")
95 b_vars.append(roe_variable_with_mask)
98 fs_vars = vc.pid + vc.track + vc.track_hits + standard_vars
99 b_vars += vu.create_aliases_for_selected(
100 fs_vars + [
"isBremsCorrected"],
101 "B0 -> [J/psi -> ^e+ ^e-] K_S0",
104 b_vars += vu.create_aliases_for_selected(
105 fs_vars,
"B0 -> J/psi [K_S0 -> ^pi+ ^pi-]", prefix=[
"pip",
"pim"]
108 jpsi_ks_vars = vc.inv_mass + standard_vars
109 b_vars += vu.create_aliases_for_selected(jpsi_ks_vars,
"B0 -> ^J/psi ^K_S0")
112 "Jpsi_M_uncorrected",
"daughter(0, daughterCombination(M,0:0,1:0))"
114 b_vars += [
"Jpsi_M_uncorrected"]
117 cmskinematics = vu.create_aliases(
118 vc.kinematics,
"useCMSFrame({variable})",
"CMS"
120 b_vars += vu.create_aliases_for_selected(
121 cmskinematics,
"^B0 -> [^J/psi -> ^e+ ^e-] [^K_S0 -> ^pi+ ^pi-]"
125 "withBremsCorrection",
126 "passesCut(passesCut(ep_isBremsCorrected == 1) or passesCut(em_isBremsCorrected == 1))",
128 b_vars += [
"withBremsCorrection"]
131 ma.variablesToNtuple(
134 filename=
"Bd2JpsiKS.root",
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)