Skip to content

Only return the matched parts of a regexp when making the template

Current behavior:

if a systematic named CMS_res_met_2017 is present in the file datacard.txt, and the regexp CMS_res_met_(2016|2017|2018|2022|2022EE|2023|2023BPix) is present in the systematic_master.yml file, then the template.yml file obtained with python3 systematics/check_names.py --input datacard.txt --make-template template.yml will contain:

CMS_res_met_(2016|2017|2018|2022|2022EE|2023|2023BPix):
  class: MET_resolution
  description: uncertainty on Missing Transverse Energy resolution separated by year.

Expected/desired behavior:

The template.yml file should contain:

CMS_res_met_2017:
  class: MET_resolution
  description: uncertainty on Missing Transverse Energy resolution separated by year.
Edited by Piergiulio Lenzi