21import modularAnalysis
as ma
24from b2biiConversion
import convertBelleMdstToBelleIIMdst
27os.environ[
'PGUSER'] =
'g0db'
28os.environ[
'BELLE_POSTGRES_SERVER'] =
'can01'
29os.environ[
'USE_GRAND_REPROCESS_DATA'] =
'1'
31my_path = b2.create_path()
34b2.conditions.prepend_globaltag(
"BellePID")
37inputfile = b2.find_file(
'b2bii_input_evtgen_exp_07_BptoD0pip-D0toKpipi0-0.mdst',
'examples',
False)
38convertBelleMdstToBelleIIMdst(inputfile, path=my_path)
41In this example, we add information from three types of weight tables to the track.
42Since there are only three types of such tables, the example is quite full.
43Each weight table contains variables listed in the example.
44Meaning of the variables can be found in Belle documentation (see links in the body of the example).
47ma.fillParticleList(decayString=
'pi+:all', cut=
'', path=my_path)
52Several weight tables were produced for lepton ID correction at Belle.
53Naming scheme for payloads is:
55BelleLID<e|mu>_<LID cut>
57Study was done for different cut set for electrons and muons.
58Possible cuts for electron:
590.01, 0.10, 0.50, 0.60, 0.80, 0.90
61Possible cuts for muons:
620.10, 0.80, 0.90, 0.95, 0.97
64Sources of original Belle results are here:
65https://belle.kek.jp/group/pid_joint/lid/final/
67Here we add PID correction information that is important for
68electrons selected with "eIDBelle>0.9" cut.
70lid_table =
"BelleLIDe_0.90"
72va.variables.addAlias(
'LID_ratio',
'extraInfo('+lid_table+
'_ratio)')
73va.variables.addAlias(
'LID_ratio_stat_err',
'extraInfo('+lid_table+
'_ratio_stat_err)')
74va.variables.addAlias(
'LID_ratio_syst_err',
'extraInfo('+lid_table+
'_ratio_syst_err)')
75va.variables.addAlias(
'LID_ratio_syst_err_from_2photon',
'extraInfo('+lid_table+
'_ratio_syst_err_from_2photon)')
76va.variables.addAlias(
'LID_ratio_syst_err_from_JPsi',
'extraInfo('+lid_table+
'_ratio_syst_err_from_JPsi)')
77va.variables.addAlias(
'LID_run_bin',
'extraInfo('+lid_table+
'_run_bin)')
78va.variables.addAlias(
'LID_kinematic_bin',
'extraInfo('+lid_table+
'_kinematic_bin)')
80lid_weights = [
'LID_ratio',
83 'LID_ratio_syst_err_from_2photon',
84 'LID_ratio_syst_err_from_JPsi',
88reweighter = b2.register_module(
'ParticleWeighting')
89reweighter.param(
'tableName', lid_table)
90reweighter.param(
'particleList',
'pi+:all')
91my_path.add_module(reweighter)
97Several weight tables were produced for kaon/pion ID corrections at Belle.
98Naming scheme for payloads is:
100BelleKID<K|Pi><Eff|Fake><Combined|Plus|Minus>_<PID cut:[1..9]>
103 - K or Pi refers to correction information obtained for kaons or pions, accordingly
104 - Eff or Fake refers to efficiency or fake rate corrections
105 - Combined, Plus or Minus refers to the charge of tracks used for the study
106 - PID cut is an integer number from 1 to 9 that correspond to "cut > 0.number"
108Information is taken from here:
109 https://belle.kek.jp/group/pid_joint/kid/files-2006/
111Here we add PID correction information for pion efficiency selected as kaons with
112"kaonIDBelle>0.1" cut.
115kid_table =
"BelleKIDPiFakePlus_1"
117va.variables.addAlias(
'KID_eff_data',
'extraInfo('+kid_table+
'_eff_data)')
118va.variables.addAlias(
'KID_eff_data_stat_err',
'extraInfo('+kid_table+
'_eff_data_stat_err)')
119va.variables.addAlias(
'KID_eff_data_syst_err',
'extraInfo('+kid_table+
'_eff_data_syst_err)')
120va.variables.addAlias(
'KID_eff_mc',
'extraInfo('+kid_table+
'_eff_mc)')
121va.variables.addAlias(
'KID_eff_mc_stat_err',
'extraInfo('+kid_table+
'_eff_mc_stat_err)')
122va.variables.addAlias(
'KID_fit_flag',
'extraInfo('+kid_table+
'_fit_flag)')
123va.variables.addAlias(
'KID_kinematic_bin',
'extraInfo('+kid_table+
'_kinematic_bin)')
124va.variables.addAlias(
'KID_ratio',
'extraInfo('+kid_table+
'_ratio)')
125va.variables.addAlias(
'KID_ratio_stat_err',
'extraInfo('+kid_table+
'_ratio_stat_err)')
126va.variables.addAlias(
'KID_ratio_syst_err',
'extraInfo('+kid_table+
'_ratio_syst_err)')
127va.variables.addAlias(
'KID_run_bin',
'extraInfo('+kid_table+
'_run_bin)')
129kid_weights = [
'KID_eff_data',
130 'KID_eff_data_stat_err',
131 'KID_eff_data_syst_err',
133 'KID_eff_mc_stat_err',
136 'KID_ratio_stat_err',
137 'KID_ratio_syst_err',
141reweighter2 = b2.register_module(
'ParticleWeighting')
142reweighter2.param(
'tableName', kid_table)
143reweighter2.param(
'particleList',
'pi+:all')
144my_path.add_module(reweighter2)
150Several weight tables were produced for proton ID corrections at Belle.
151Naming scheme for payloads is:
153BellePID<Plus|Minus>_<PID cut>
156 - Plus or Minus refers to the charge of tracks used for the study
157 - PID cut can be 0.6, 0.7, 0.8 or 0.9
159Information is taken from here:
160 https://belle.kek.jp/group/pid_joint/protonid/
162Here we add PID correction information for proton efficiency selected with
163"protonIDBelle>0.6" cut.
165pid_table =
"BellePIDPlus_0.6"
167va.variables.addAlias(
"PID_eff_data",
'extraInfo('+pid_table+
"_eff_data)")
168va.variables.addAlias(
"PID_eff_data_stat_err",
'extraInfo('+pid_table+
"_eff_data_stat_err)")
169va.variables.addAlias(
"PID_eff_mc",
'extraInfo('+pid_table+
"_eff_mc)")
170va.variables.addAlias(
"PID_eff_mc_stat_err",
'extraInfo('+pid_table+
"_eff_mc_stat_err)")
171va.variables.addAlias(
"PID_ratio",
'extraInfo('+pid_table+
"_ratio)")
172va.variables.addAlias(
"PID_ratio_stat_err",
'extraInfo('+pid_table+
"_ratio_stat_err)")
173va.variables.addAlias(
"PID_ratio_syst_err",
'extraInfo('+pid_table+
"_ratio_syst_err)")
174va.variables.addAlias(
"PID_kinematic_bin",
'extraInfo('+pid_table+
"_kinematic_bin)")
175va.variables.addAlias(
"PID_run_bin",
'extraInfo('+pid_table+
"_run_bin)")
177pid_weights = [
"PID_eff_data",
178 "PID_eff_data_stat_err",
180 "PID_eff_mc_stat_err",
182 "PID_ratio_stat_err",
183 "PID_ratio_syst_err",
188reweighter3 = b2.register_module(
'ParticleWeighting')
189reweighter3.param(
'tableName', pid_table)
190reweighter3.param(
'particleList',
'pi+:all')
191my_path.add_module(reweighter3)
194All weighting modules are configured.
195Let's add some tracks and add the information from weighting tables to them.
204output_file =
'ApplyBelleWeightsToTracks.root'
205ma.variablesToNtuple(decayString=
'pi+:all',
208 filename=output_file,