|
8 | 8 | ALLOWED_PROCESSES = [ "ee_mumu", "gg_tt", "gg_tt01g", "gg_ttg", "gg_ttgg", "gg_ttggg", "gq_ttq", "heft_gg_bb", "nobm_pp_ttW", "pp_tt012j", "smeft_gg_tttt", "susy_gg_t1t1", "susy_gg_tt" ] |
9 | 9 | MADGRAPH_CLI = Path.cwd() / ".." / ".." / "MG5aMC" / "mg5amcnlo" / "bin" / "mg5_aMC" |
10 | 10 |
|
11 | | -def generate_dat_content(process_dir: str, rwgt_card_path: Path) -> str: |
12 | | - run_card = "set auto_convert_model True\n" |
13 | | - run_card += f"launch {process_dir}\n" |
| 11 | +PROCESSES_NON_TRIVIAL_MODELS = { |
| 12 | + "heft_gg_bb": "heft", |
| 13 | + "smeft_gg_tttt": "SMEFTsim_topU3l_MwScheme_UFO-massless", |
| 14 | + "susy_gg_t1t1": "MSSM_SLHA2", |
| 15 | + "susy_gg_tt": "MSSM_SLHA2", |
| 16 | +} |
| 17 | + |
| 18 | +def generate_dat_content(process_dir: Path, rwgt_card_path: Path, process_name: str) -> str: |
| 19 | + run_card = f"launch {process_dir}\n" |
14 | 20 | run_card += "reweight=madtrex\n" |
15 | 21 | run_card += "set nevents 10000\n" |
16 | 22 | run_card += "set iseed 489\n" |
17 | 23 | run_card += f"{rwgt_card_path}\n" |
| 24 | + # if the model of this process is not trivial, import it preventively |
| 25 | + # so that if it is still Python 2, it will be converted before the |
| 26 | + # reweighting procedure takes place |
| 27 | + if process_name in PROCESSES_NON_TRIVIAL_MODELS: |
| 28 | + model = PROCESSES_NON_TRIVIAL_MODELS[process_name] |
| 29 | + run_card = f"set auto_convert_model True\nimport model {model}\n" + run_card |
18 | 30 | return run_card |
19 | 31 |
|
20 | 32 | def is_executable(path: Path) -> bool: |
@@ -45,9 +57,9 @@ def dump_logs(stdout_log, stderr_log): |
45 | 57 |
|
46 | 58 | def main() -> int: |
47 | 59 | # Name of the directory of the process to test |
48 | | - process_dir = sys.argv[1] |
| 60 | + process_dir = Path(sys.argv[1]) |
49 | 61 | # Label for the process (must be in the allowed list) |
50 | | - process = process_dir.replace(".mad", "") |
| 62 | + process = process_dir.name.replace(".mad", "") |
51 | 63 |
|
52 | 64 | # Treat current working directory as HOME |
53 | 65 | HOME = Path.cwd() |
@@ -86,7 +98,7 @@ def main() -> int: |
86 | 98 | # Write PROCESS.dat to HOME |
87 | 99 | dat_path = HOME / f"{process}.dat" |
88 | 100 | try: |
89 | | - dat_content = generate_dat_content(process_dir, rwgt_card_path) |
| 101 | + dat_content = generate_dat_content(process_dir, rwgt_card_path, process) |
90 | 102 | dat_path.write_text(dat_content, encoding="utf-8") |
91 | 103 | except Exception as e: |
92 | 104 | print(f"ERROR: Failed to write {dat_path}: {e}", file=sys.stderr) |
|
0 commit comments