5 import modularAnalysis
as ma
7 import flavorTagger
as ft
8 from variables
import variables
as vm
13 filenumber = sys.argv[1]
16 b2.conditions.prepend_globaltag(ma.getAnalysisGlobaltag())
23 filelist=[b2.find_file(f
"starterkit/2021/1111540100_eph3_BGx0_{filenumber}.root",
"examples")],
30 "electronID > 0.1 and dr < 0.5 and abs(dz) < 2 and thetaInCDCAcceptance",
37 "goodFWDGamma",
"passesCut(clusterReg == 1 and clusterE > 0.075)"
40 "goodBRLGamma",
"passesCut(clusterReg == 2 and clusterE > 0.05)"
43 "goodBWDGamma",
"passesCut(clusterReg == 3 and clusterE > 0.1)"
46 "goodGamma",
"passesCut(goodFWDGamma or goodBRLGamma or goodBWDGamma)"
48 ma.fillParticleList(
"gamma:brems",
"goodGamma", path=main)
49 ma.correctBrems(
"e+:corrected",
"e+:uncorrected",
"gamma:brems", path=main)
50 vm.addAlias(
"isBremsCorrected",
"extraInfo(bremsCorrected)")
54 "J/psi:ee -> e+:corrected e-:corrected ?addbrems",
61 "B0 -> J/psi:ee K_S0:merged",
62 cut=
"Mbc > 5.2 and abs(deltaE) < 0.15",
67 ma.matchMCTruth(
"B0", path=main)
70 ma.buildRestOfEvent(
"B0", fillWithMostLikely=
True, path=main)
71 track_based_cuts =
"thetaInCDCAcceptance and pt > 0.075 and dr < 5 and abs(dz) < 10"
72 ecl_based_cuts =
"thetaInCDCAcceptance and E > 0.05"
73 roe_mask = (
"my_mask", track_based_cuts, ecl_based_cuts)
74 ma.appendROEMasks(
"B0", [roe_mask], path=main)
77 ft.flavorTagger([
"B0"], path=main)
80 b2.set_random_seed(
"Belle II StarterKit")
81 ma.rankByHighest(
"B0", variable=
"random", numBest=1, path=main)
86 standard_vars = vc.kinematics + vc.mc_kinematics + vc.mc_truth
87 b_vars += vc.deltae_mbc
88 b_vars += standard_vars
91 roe_kinematics = [
"roeE()",
"roeM()",
"roeP()",
"roeMbc()",
"roeDeltae()"]
92 roe_multiplicities = [
95 "nROE_NeutralHadrons()",
97 b_vars += roe_kinematics + roe_multiplicities
99 for roe_variable
in roe_kinematics + roe_multiplicities:
101 roe_variable_with_mask = roe_variable.replace(
"()",
"(my_mask)")
102 b_vars.append(roe_variable_with_mask)
104 b_vars += ft.flavor_tagging
107 fs_vars = vc.pid + vc.track + vc.track_hits + standard_vars
108 b_vars += vu.create_aliases_for_selected(
109 fs_vars + [
"isBremsCorrected"],
110 "B0 -> [J/psi -> ^e+ ^e-] K_S0",
113 b_vars += vu.create_aliases_for_selected(
114 fs_vars,
"B0 -> J/psi [K_S0 -> ^pi+ ^pi-]", prefix=[
"pip",
"pim"]
117 jpsi_ks_vars = vc.inv_mass + standard_vars
118 b_vars += vu.create_aliases_for_selected(jpsi_ks_vars,
"B0 -> ^J/psi ^K_S0")
121 "Jpsi_M_uncorrected",
"daughter(0, daughterCombination(M,0:0,1:0))"
123 b_vars += [
"Jpsi_M_uncorrected"]
126 cmskinematics = vu.create_aliases(
127 vc.kinematics,
"useCMSFrame({variable})",
"CMS"
129 b_vars += vu.create_aliases_for_selected(
130 cmskinematics,
"^B0 -> [^J/psi -> ^e+ ^e-] [^K_S0 -> ^pi+ ^pi-]"
134 "withBremsCorrection",
135 "passesCut(passesCut(ep_isBremsCorrected == 1) or passesCut(em_isBremsCorrected == 1))",
137 b_vars += [
"withBremsCorrection"]
140 ma.variablesToNtuple(
143 filename=
"Bd2JpsiKS.root",
def stdKshorts(prioritiseV0=True, fitter='TreeFit', path=None, updateAllDaughters=False, writeOut=False)