26def make_1D_bin(name, min_val, max_val):
27 return {name: [min_val, max_val]}
30def make_2D_bin(bin_x, bin_y):
36def make_3D_bin(bin_x, bin_y, bin_z):
38 bin_3d.update(bin_y).update(bin_z)
44bins_x = [make_1D_bin(
"p", 0, 2),
45 make_1D_bin(
"p", 2, 3),
46 make_1D_bin(
"p", 3, 4)]
48bins_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])
104outOfRangeWeightInfo = {}
105outOfRangeWeightInfo[
"Weight"] = -1
106outOfRangeWeightInfo[
"StatErr"] = -1
107outOfRangeWeightInfo[
"SystErr"] = -1
110addtable = b2.register_module(
'ParticleWeightingLookUpCreator')
111addtable.param(
'tableIDSpec', tableIDSpec)
112addtable.param(
'outOfRangeWeight', outOfRangeWeightInfo)
113addtable.param(
'experimentHigh', 1000)
114addtable.param(
'experimentLow', 0)
115addtable.param(
'runHigh', 1000)
116addtable.param(
'runLow', 0)
117addtable.param(
'tableName',
"ParticleReweighting:TestMomentum")
119addtable2 = b2.register_module(
'ParticleWeightingLookUpCreator')
120addtable2.param(
'tableIDNotSpec', tableIDNotSpec)
121addtable2.param(
'outOfRangeWeight', outOfRangeWeightInfo)
122addtable2.param(
'experimentHigh', 1000)
123addtable2.param(
'experimentLow', 0)
124addtable2.param(
'runHigh', 1000)
125addtable2.param(
'runLow', 0)
126addtable2.param(
'tableName',
"ParticleReweighting:TestMomentum2")
128eventinfosetter = b2.register_module(
'EventInfoSetter')
129eventinfosetter.param(
'evtNumList', [10])
130eventinfosetter.param(
'runList', [0])
131eventinfosetter.param(
'expList', [0])
133my_path = b2.create_path()
134my_path.add_module(addtable)
135my_path.add_module(addtable2)
136my_path.add_module(eventinfosetter)