21 import modularAnalysis
as ma
22 import variables
as va
26 my_path = b2.create_path()
29 ma.inputMdst(environmentType=
'default',
30 filename=b2.find_file(
'B2pi0D_D2hh_D2hhh_B2munu.root',
'examples',
False),
35 ma.fillParticleListFromMC(decayString=
'pi+:gen', cut=
'', path=my_path)
38 weight_table_id =
"ParticleReweighting:TestMomentum"
40 if not os.getenv(
'BELLE2_EXAMPLES_DATA_DIR'):
41 b2.B2FATAL(
"You need the example data installed. Run `b2install-data example` in terminal for it.")
43 db_location = os.getenv(
'BELLE2_EXAMPLES_DATA_DIR') +
'/database/'
44 b2.conditions.prepend_testing_payloads(db_location +
'database.txt')
48 va.variables.addAlias(
'Weight',
'extraInfo(' + weight_table_id +
'_Weight)')
49 va.variables.addAlias(
'StatErr',
'extraInfo(' + weight_table_id +
'_StatErr)')
50 va.variables.addAlias(
'SystErr',
'extraInfo(' + weight_table_id +
'_SystErr)')
51 va.variables.addAlias(
'binID',
'extraInfo(' + weight_table_id +
'_binID)')
55 reweighter = b2.register_module(
'ParticleWeighting')
56 reweighter.param(
'tableName', weight_table_id)
57 reweighter.param(
'particleList',
'pi+:gen')
58 my_path.add_module(reweighter)
61 pivars = [
'p',
'pz',
'Weight',
'StatErr',
'SystErr',
'binID']
64 output_file =
'B2A905-ApplyWeightsToTracks.root'
65 ma.variablesToNtuple(decayString=
'pi+:gen',