Skip to content

Commit

Permalink
convert to dictionary use
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkzerwas committed Jan 16, 2025
1 parent 5952b8c commit 975f7d1
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 75 deletions.
6 changes: 5 additions & 1 deletion python/Generators/Babayaga.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ def write_process(self):
# output format only hepm2 or hepmc3, the actual version is detected by the linked library, so strip the number
self.add_process_option("store", "yes")
self.add_process_option("path", ".")
self.process += self.procDB.get_run_out()

# procDB
for key in self.procDB.getDict():
self.add_process_option(key,self.procDB.getDict()[key])

if self.procinfo.eventmode == "unweighted":
self.add_process_option("mode", "unweighted")
else:
Expand Down
13 changes: 0 additions & 13 deletions python/Generators/BabayagaProcDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,3 @@ def __init__(self, process):
def write_DBInfo(self):
# choose as function of generatorDBLabel
label = self.process.get_generatorDBLabel()
if label == "11_11_11_11":
self.write_Difermion()
if label == "11_11_13_13":
self.write_Difermion()
if label == "11_11_22_22":
self.write_Diphoton()

def write_Difermion(self):
self.runout = ""

def write_Diphoton(self):
self.runout = ""

13 changes: 0 additions & 13 deletions python/Generators/KKMCProcDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,3 @@ def __init__(self, process):
def write_DBInfo(self):
# choose as function of generatorDBLabel
label = self.process.get_generatorDBLabel()
if label == "11_11_11_11":
self.write_Difermion()
if label == "11_11_13_13":
self.write_Difermion()
if label == "11_11_22_22":
self.write_Diphoton()

def write_Difermion(self):
self.runout = ""

def write_Diphoton(self):
self.runout = ""

4 changes: 3 additions & 1 deletion python/Generators/Madgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def fill_datacard(self):
if self.procinfo.get_ElectronPolarisation() != 0 or self.procinfo.get_PositronPolarisation()!= 0:
self.add_option("set polbeam1", self.procinfo.get_ElectronPolarisation()*100.)
self.add_option("set polbeam2", self.procinfo.get_PositronPolarisation()*100.)
self.run += self.procDB.get_run_out()

for key in self.procDB.getDict():
self.add_option(key, self.procDB.getDict()[key])
# if self.settings.get_block("selectors"):
self.write_selectors()
# else:
Expand Down
12 changes: 2 additions & 10 deletions python/Generators/MadgraphProcDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,9 @@ def write_DBInfo(self):
# choose as function of generatorDBLabel
if self.process.get_generatorDBLabel().startswith("11_11") and len(self.process.final) == 2 :
if abs(self.process.final[0]) <= 16:
self.runout += self.write_Difermion()
self.write_Difermion()
label = self.process.get_generatorDBLabel()
if label == "11_11_23_25":
self.runout += self.write_run_ZH()

def write_Difermion(self):
out = ""
out += f"\nset pt_min_pdg {{{self.process.final[0]}: 0 }}\n"
return out

def write_run_ZH(self):
out = ""
return out
self.rundict['set pt_min_pdg'] = f"{{{self.process.final[0]}: 0 }}"

6 changes: 5 additions & 1 deletion python/Generators/Sherpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ def write_run(self):
elif self.procinfo.get("output_format") == "hepmc3":
eoutname = "HepMC3_GenEvent[{0}.hepmc3]".format(self.GeneratorDatacardBase)
self.add_option("EVENT_OUTPUT", eoutname)
self.run += self.procDB.get_run_out()

# run settings
for key in self.procDB.getDict():
self.add_option(key,self.procDB.getDict()[key])

self.add_option("EVENT_GENERATION_MODE", self.procinfo.eventmode)
if self.gen_settings is not None:
if "run" in self.gen_settings.keys():
Expand Down
37 changes: 17 additions & 20 deletions python/Generators/SherpaProcDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def write_DBInfo(self):
self.write_Difermion()
if label == "11_11_5_5":
self.write_Difermion()
self.runout += " MASSIVE[5] 1\n"
self.rundict['MASSIVE[5]'] = 1
if label == "11_11_6_6":
self.write_Difermion()
self.runout += " MASSIVE[6] 1\n"
self.rundict['MASSIVE[6]'] = 1
if label == "11_11_12_12":
self.write_Difermion()
if label == "11_11_13_13":
Expand All @@ -32,7 +32,7 @@ def write_DBInfo(self):
self.write_Difermion()
if label == "11_11_15_15":
self.write_Difermion()
self.runout += " MASSIVE[15] 1\n"
self.rundict['MASSIVE[15]'] = 1
if label == "11_11_16_16":
self.write_Difermion()
if label=="11_11_23_23":
Expand All @@ -46,37 +46,34 @@ def write_DBInfo(self):
if label=="11_11_23_25_25":
self.write_ZH()
# the electroweak scheme is common to all implemented processes so far
self.runout += " EW_SCHEME 3;\n"
self.rundict['EW_SCHEME'] = 3


def write_Difermion(self):
self.runout = ""
# Use Gmu scheme as default
self.runout += " MASS[24] 80.419;\n"
self.runout += " WIDTH[24] 2.0476;\n"
self.rundict['MASS[24]'] = 80.419
self.rundict['WIDTH[24]'] = 2.0476

def write_ZZ(self):
self.runout = ""
# Use Gmu scheme as default
self.runout += " MASS[24] 80.419;\n"
self.runout += " WIDTH[24] 2.0476;\n"
self.rundict['MASS[24]'] = 80.419
self.rundict['WIDTH[24]'] = 2.0476

def write_WW(self):
self.runout = ""
# Use Gmu scheme as default
self.runout += " MASS[24] 80.419;\n"
self.runout += " WIDTH[24] 2.0476;\n"
self.rundict['MASS[24]'] = 80.419
self.rundict['WIDTH[24]'] = 2.0476

def write_ZH(self):
self.runout = " WIDTH[25] 0\n"
self.runout += " WIDTH[23] 0\n"
self.rundict['WIDTH[25]'] = 0
self.rundict['WIDTH[23]'] = 0

def write_Hnunu(self):
self.runout = " WIDTH[25] 0\n"
self.runout += " MASS[24] 80.419;\n"
self.runout += " WIDTH[24] 2.0476;\n"
self.rundict['WIDTH[25]'] = 0
self.rundict['MASS[24]'] = 80.419
self.rundict['WIDTH[24]'] = 2.0476

def write_ZHH(self):
self.runout = " WIDTH[25] 0\n"
self.runout += " WIDTH[23] 0\n"
self.rundict['WIDTH[25]'] = 0
self.rundict['WIDTH[23]'] = 0

5 changes: 4 additions & 1 deletion python/Generators/Whizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def write_process(self):
)
self.add_option("?hepmc_output_cross_section", "true")
self.add_option("?write_raw", "false")
self.process += self.procDB.get_run_out()

for key in self.procDB.getDict():
self.add_option(key,self.procDB.getDict()[key])

if self.procinfo.eventmode == "unweighted":
self.add_option("?unweighted", "true")
else:
Expand Down
28 changes: 13 additions & 15 deletions python/Generators/WhizardProcDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,27 @@ def write_DBInfo(self):
# choose as function of generatorDBLabel
label = self.process.get_generatorDBLabel()
if label == "11_11_12_12":
self.runout += self.write_Difermion()
self.write_Difermion()
if label == "11_11_13_13":
self.runout += self.write_Difermion()
self.write_Difermion()
if label == "11_11_14_14":
self.runout += self.write_Difermion()
self.write_Difermion()
if label == "11_11_15_15":
self.runout += self.write_Difermion()
self.write_Difermion()
if label == "11_11_16_16":
self.runout += self.write_Difermion()
self.write_Difermion()
if label == "11_11_12_12":
self.runout += self.write_Difermion()
self.write_Difermion()
elif label == "11_11_23_25":
self.runout += self.write_ZH()
self.write_ZH()

def write_Difermion(self):
self.runout += "mW = 80.419 GeV\n"
self.runout += "wW = 2.0476 GeV\n"
return self.runout
self.rundict['mW'] = "80.419 GeV"
self.rundict['wW'] = "2.0476 GeV"

def write_ZH(self):
self.runout += "?resonance_history = true\n"
self.runout += "resonance_on_shell_limit = 16\n"
self.runout += "resonance_on_shell_turnoff = 2\n"
self.runout += "resonance_on_shell_turnoff = 2\n"
return self.runout
self.rundict['?resonance_history'] = "true\n"
self.rundict['resonance_on_shell_limit'] = 16
self.rundict['resonance_on_shell_turnoff'] = 2
self.rundict['resonance_on_shell_turnoff'] = 2

0 comments on commit 975f7d1

Please sign in to comment.