16 import modularAnalysis
as ma
17 import variables
as va
19 from b2biiConversion
import convertBelleMdstToBelleIIMdst
22 os.environ[
'PGUSER'] =
'g0db'
23 os.environ[
'BELLE_POSTGRES_SERVER'] =
'can01'
24 os.environ[
'USE_GRAND_REPROCESS_DATA'] =
'1'
26 my_path = b2.create_path()
29 b2.use_central_database(
"BellePID")
32 inputfile = b2.find_file(
'b2bii_input_evtgen_exp_07_BptoD0pip-D0toKpipi0-0.mdst',
'examples',
False)
33 convertBelleMdstToBelleIIMdst(inputfile, path=my_path)
36 In this example, we add information from three types of weight tables to the track.
37 Since there are only three types of such tables, the example is quite full.
38 Each weight table contains variables listed in the example.
39 Meaning of the variables can be found in Belle documentation (see links in the body of the example).
42 ma.fillParticleList(decayString=
'pi+:all', cut=
'', path=my_path)
47 Several weight tables were produced for lepton ID correction at Belle.
48 Naming scheme for payloads is:
50 BelleLID<e|mu>_<LID cut>
52 Study was done for different cut set for electrons and muons.
53 Possible cuts for electron:
54 0.01, 0.10, 0.50, 0.60, 0.80, 0.90
56 Possible cuts for muons:
57 0.10, 0.80, 0.90, 0.95, 0.97
59 Sources of original Belle results are here:
60 https://belle.kek.jp/group/pid_joint/lid/final/
62 Here we add PID correction information that is important for
63 electrons selected with "eIDBelle>0.9" cut.
65 lid_table =
"BelleLIDe_0.90"
67 va.variables.addAlias(
'LID_ratio',
'extraInfo('+lid_table+
'_ratio)')
68 va.variables.addAlias(
'LID_ratio_stat_err',
'extraInfo('+lid_table+
'_ratio_stat_err)')
69 va.variables.addAlias(
'LID_ratio_syst_err',
'extraInfo('+lid_table+
'_ratio_syst_err)')
70 va.variables.addAlias(
'LID_ratio_syst_err_from_2photon',
'extraInfo('+lid_table+
'_ratio_syst_err_from_2photon)')
71 va.variables.addAlias(
'LID_ratio_syst_err_from_JPsi',
'extraInfo('+lid_table+
'_ratio_syst_err_from_JPsi)')
72 va.variables.addAlias(
'LID_run_bin',
'extraInfo('+lid_table+
'_run_bin)')
73 va.variables.addAlias(
'LID_kinematic_bin',
'extraInfo('+lid_table+
'_kinematic_bin)')
75 lid_weights = [
'LID_ratio',
78 'LID_ratio_syst_err_from_2photon',
79 'LID_ratio_syst_err_from_JPsi',
83 reweighter = b2.register_module(
'ParticleWeighting')
84 reweighter.param(
'tableName', lid_table)
85 reweighter.param(
'particleList',
'pi+:all')
86 my_path.add_module(reweighter)
92 Several weight tables were produced for kaon/pion ID corrections at Belle.
93 Naming scheme for payloads is:
95 BelleKID<K|Pi><Eff|Fake><Combined|Plus|Minus>_<PID cut:[1..9]>
98 - K or Pi refers to correction information obtained for kaons or pions, accordingly
99 - Eff or Fake refers to efficiency or fake rate corrections
100 - Combined, Plus or Minus refers to the charge of tracks used for the study
101 - PID cut is an integer number from 1 to 9 that correspond to "cut > 0.number"
103 Information is taken from here:
104 https://belle.kek.jp/group/pid_joint/kid/files-2006/
106 Here we add PID correction information for pion efficiency selected as kaons with
107 "kaonIDBelle>0.1" cut.
110 kid_table =
"BelleKIDPiFakePlus_1"
112 va.variables.addAlias(
'KID_eff_data',
'extraInfo('+kid_table+
'_eff_data)')
113 va.variables.addAlias(
'KID_eff_data_stat_err',
'extraInfo('+kid_table+
'_eff_data_stat_err)')
114 va.variables.addAlias(
'KID_eff_data_syst_err',
'extraInfo('+kid_table+
'_eff_data_syst_err)')
115 va.variables.addAlias(
'KID_eff_mc',
'extraInfo('+kid_table+
'_eff_mc)')
116 va.variables.addAlias(
'KID_eff_mc_stat_err',
'extraInfo('+kid_table+
'_eff_mc_stat_err)')
117 va.variables.addAlias(
'KID_fit_flag',
'extraInfo('+kid_table+
'_fit_flag)')
118 va.variables.addAlias(
'KID_kinematic_bin',
'extraInfo('+kid_table+
'_kinematic_bin)')
119 va.variables.addAlias(
'KID_ratio',
'extraInfo('+kid_table+
'_ratio)')
120 va.variables.addAlias(
'KID_ratio_stat_err',
'extraInfo('+kid_table+
'_ratio_stat_err)')
121 va.variables.addAlias(
'KID_ratio_syst_err',
'extraInfo('+kid_table+
'_ratio_syst_err)')
122 va.variables.addAlias(
'KID_run_bin',
'extraInfo('+kid_table+
'_run_bin)')
124 kid_weights = [
'KID_eff_data',
125 'KID_eff_data_stat_err',
126 'KID_eff_data_syst_err',
128 'KID_eff_mc_stat_err',
131 'KID_ratio_stat_err',
132 'KID_ratio_syst_err',
136 reweighter2 = b2.register_module(
'ParticleWeighting')
137 reweighter2.param(
'tableName', kid_table)
138 reweighter2.param(
'particleList',
'pi+:all')
139 my_path.add_module(reweighter2)
145 Several weight tables were produced for proton ID corrections at Belle.
146 Naming scheme for payloads is:
148 BellePID<Plus|Minus>_<PID cut>
151 - Plus or Minus refers to the charge of tracks used for the study
152 - PID cut can be 0.6, 0.7, 0.8 or 0.9
154 Information is taken from here:
155 https://belle.kek.jp/group/pid_joint/protonid/
157 Here we add PID correction information for proton efficiency selected with
158 "protonIDBelle>0.6" cut.
160 pid_table =
"BellePIDPlus_0.6"
162 va.variables.addAlias(
"PID_eff_data",
'extraInfo('+pid_table+
"_eff_data)")
163 va.variables.addAlias(
"PID_eff_data_stat_err",
'extraInfo('+pid_table+
"_eff_data_stat_err)")
164 va.variables.addAlias(
"PID_eff_mc",
'extraInfo('+pid_table+
"_eff_mc)")
165 va.variables.addAlias(
"PID_eff_mc_stat_err",
'extraInfo('+pid_table+
"_eff_mc_stat_err)")
166 va.variables.addAlias(
"PID_ratio",
'extraInfo('+pid_table+
"_ratio)")
167 va.variables.addAlias(
"PID_ratio_stat_err",
'extraInfo('+pid_table+
"_ratio_stat_err)")
168 va.variables.addAlias(
"PID_ratio_syst_err",
'extraInfo('+pid_table+
"_ratio_syst_err)")
169 va.variables.addAlias(
"PID_kinematic_bin",
'extraInfo('+pid_table+
"_kinematic_bin)")
170 va.variables.addAlias(
"PID_run_bin",
'extraInfo('+pid_table+
"_run_bin)")
172 pid_weights = [
"PID_eff_data",
173 "PID_eff_data_stat_err",
175 "PID_eff_mc_stat_err",
177 "PID_ratio_stat_err",
178 "PID_ratio_syst_err",
183 reweighter3 = b2.register_module(
'ParticleWeighting')
184 reweighter3.param(
'tableName', pid_table)
185 reweighter3.param(
'particleList',
'pi+:all')
186 my_path.add_module(reweighter3)
189 All weighting modules are configured.
190 Let's add some tracks and add the information from weighting tables to them.
193 pivars += kid_weights
194 pivars += lid_weights
195 pivars += pid_weights
199 output_file =
'ApplyBelleWeightsToTracks.root'
200 ma.variablesToNtuple(decayString=
'pi+:all',
203 filename=output_file,