17 import modularAnalysis
as ma
23 def make_1D_bin(name, min_val, max_val):
24 return {name: [min_val, max_val]}
27 def make_2D_bin(bin_x, bin_y):
33 def make_3D_bin(bin_x, bin_y, bin_z):
35 bin_3d.update(bin_y).update(bin_z)
41 bins_x = [make_1D_bin(
"p", 0, 2),
42 make_1D_bin(
"p", 2, 3),
43 make_1D_bin(
"p", 3, 4)]
45 bins_y = [make_1D_bin(
"pz", 0, 1),
46 make_1D_bin(
"pz", 1, 5)]
67 weightInfo[
"Weight"] = float(random.randint(0, 100)) / 100
68 weightInfo[
"StatErr"] = float(random.randint(100, 200)) / 100
69 weightInfo[
"SystErr"] = float(10)
70 tableIDNotSpec.append([weightInfo, make_2D_bin(xbin, ybin)])
95 weightInfo[
"Weight"] = float(random.randint(0, 100)) / 100
96 weightInfo[
"StatErr"] = float(random.randint(100, 200)) / 100
97 weightInfo[
"SystErr"] = float(10)
98 tableIDSpec.append([[weightInfo, make_2D_bin(xbin, ybin)], binID])
101 outOfRangeWeightInfo = {}
102 outOfRangeWeightInfo[
"Weight"] = -1
103 outOfRangeWeightInfo[
"StatErr"] = -1
104 outOfRangeWeightInfo[
"SystErr"] = -1
107 addtable = b2.register_module(
'ParticleWeightingLookUpCreator')
108 addtable.param(
'tableIDSpec', tableIDSpec)
109 addtable.param(
'outOfRangeWeight', outOfRangeWeightInfo)
110 addtable.param(
'experimentHigh', 1000)
111 addtable.param(
'experimentLow', 0)
112 addtable.param(
'runHigh', 1000)
113 addtable.param(
'runLow', 0)
114 addtable.param(
'tableName',
"ParticleReweighting:TestMomentum")
116 addtable2 = b2.register_module(
'ParticleWeightingLookUpCreator')
117 addtable2.param(
'tableIDNotSpec', tableIDNotSpec)
118 addtable2.param(
'outOfRangeWeight', outOfRangeWeightInfo)
119 addtable2.param(
'experimentHigh', 1000)
120 addtable2.param(
'experimentLow', 0)
121 addtable2.param(
'runHigh', 1000)
122 addtable2.param(
'runLow', 0)
123 addtable2.param(
'tableName',
"ParticleReweighting:TestMomentum2")
125 eventinfosetter = b2.register_module(
'EventInfoSetter')
126 eventinfosetter.param(
'evtNumList', [10])
127 eventinfosetter.param(
'runList', [0])
128 eventinfosetter.param(
'expList', [0])
130 my_path = b2.create_path()
131 my_path.add_module(addtable)
132 my_path.add_module(addtable2)
133 my_path.add_module(eventinfosetter)