79def addDarkPhotondecayChannels(P8gen, mDP, DP,conffile=os.path.expandvars('$FAIRSHIP/python/darkphotonDecaySelection.conf'), verbose=True):
80 """
81 Configures the DP decay table in Pythia8
82
83 Inputs:
84 - P8gen: an instance of ROOT.HNLPythia8Generator()
85 - conffile: a file listing the channels one wishes to activate
86 """
87 isResonant = (P8gen.GetDPId()==4900023)
88
89 allowed = DP.allowedChannels()
90
91 wanted = load(conffile=conffile, verbose=verbose)
92
93 for dec in allowed:
94 print('channel allowed:',dec)
95 if dec not in wanted:
96 print('addDarkPhotondecayChannels WARNING: channel not configured! Please add also in conf file.\t', dec)
97 quit()
98 print('channel wanted:',dec)
99
100 if allowed[dec] == 'yes' and wanted[dec] == 'yes':
101
102 BR = DP.findBranchingRatio(dec)
103
104 meMode = 0
105 if isResonant: meMode = 103
106 if 'hadrons' in dec:
107
108 print("debug readdecay table hadrons BR ",BR)
109
110 dpid = P8gen.GetDPId()
111 if mDP<3.0:
112 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} 1 -1"\
113 .format(dpid, 0.167*BR, meMode))
114 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} 2 -2"\
115 .format(dpid, 0.666*BR, meMode))
116 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} 3 -3"\
117 .format(dpid, 0.167*BR, meMode))
118 if mDP>=3.0:
119 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} 1 -1"\
120 .format(dpid, 0.1*BR, meMode))
121 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} 2 -2"\
122 .format(dpid, 0.4*BR, meMode))
123 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} 3 -3"\
124 .format(dpid, 0.1*BR, meMode))
125 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} 4 -4"\
126 .format(dpid, 0.4*BR, meMode))
127 else:
128 particles = [p for p in dec.replace('->',' ').split()]
129 children = particles[1:]
130 childrenCodes = [PDGcode(p) for p in children]
131 codes = ' '.join(str(code) for code in childrenCodes)
132 P8gen.SetParameters("{}:addChannel = 1 {:.12} {} {}"\
133 .format(P8gen.GetDPId(), BR, meMode, codes))
134 print("debug readdecay table ",particles,children,BR)
135
136