26 def make_1D_bin(name, min_val, max_val):
27 return {name: [min_val, max_val]}
30 def make_2D_bin(bin_x, bin_y):
36 def make_3D_bin(bin_x, bin_y, bin_z):
38 bin_3d.update(bin_y).update(bin_z)
44 bins_x = [make_1D_bin(
"p", 0, 2),
45 make_1D_bin(
"p", 2, 3),
46 make_1D_bin(
"p", 3, 4)]
48 bins_y = [make_1D_bin(
"pz", 0, 1),
49 make_1D_bin(
"pz", 1, 5)]
70 weightInfo[
"Weight"] = float(random.randint(0, 100)) / 100
71 weightInfo[
"StatErr"] = float(random.randint(100, 200)) / 100
72 weightInfo[
"SystErr"] = float(10)
73 tableIDNotSpec.append([weightInfo, make_2D_bin(xbin, ybin)])
98 weightInfo[
"Weight"] = float(random.randint(0, 100)) / 100
99 weightInfo[
"StatErr"] = float(random.randint(100, 200)) / 100
100 weightInfo[
"SystErr"] = float(10)
101 tableIDSpec.append([[weightInfo, make_2D_bin(xbin, ybin)], binID])
104 outOfRangeWeightInfo = {}
105 outOfRangeWeightInfo[
"Weight"] = -1
106 outOfRangeWeightInfo[
"StatErr"] = -1
107 outOfRangeWeightInfo[
"SystErr"] = -1
110 addtable = b2.register_module(
'ParticleWeightingLookUpCreator')
111 addtable.param(
'tableIDSpec', tableIDSpec)
112 addtable.param(
'outOfRangeWeight', outOfRangeWeightInfo)
113 addtable.param(
'experimentHigh', 1000)
114 addtable.param(
'experimentLow', 0)
115 addtable.param(
'runHigh', 1000)
116 addtable.param(
'runLow', 0)
117 addtable.param(
'tableName',
"ParticleReweighting:TestMomentum")
119 addtable2 = b2.register_module(
'ParticleWeightingLookUpCreator')
120 addtable2.param(
'tableIDNotSpec', tableIDNotSpec)
121 addtable2.param(
'outOfRangeWeight', outOfRangeWeightInfo)
122 addtable2.param(
'experimentHigh', 1000)
123 addtable2.param(
'experimentLow', 0)
124 addtable2.param(
'runHigh', 1000)
125 addtable2.param(
'runLow', 0)
126 addtable2.param(
'tableName',
"ParticleReweighting:TestMomentum2")
128 eventinfosetter = b2.register_module(
'EventInfoSetter')
129 eventinfosetter.param(
'evtNumList', [10])
130 eventinfosetter.param(
'runList', [0])
131 eventinfosetter.param(
'expList', [0])
133 my_path = b2.create_path()
134 my_path.add_module(addtable)
135 my_path.add_module(addtable2)
136 my_path.add_module(eventinfosetter)