Skip to main content

Some tools for SaS derivation from HDNA files reader to plotting

Project description

SaS utils

Package to convert file to IJazZ format, combine correction files and apply correction to parquet

HiggsDNA Reader

This script, reader_higgsdna.py, is designed to read and convert HiggsDNA parquet files into the ijazz_2p0 format. Below is a brief description of its main functions:

Functions

main()

  • Description: Entry point of the script. It reads the configuration file and calls the read_and_convert function with the appropriate parameters.
  • Usage: sas_reader_higgsdna config.yaml

read_and_convert()

  • Description: Reads and converts the HiggsDNA parquet file to the ijazz_2p0 format.
  • Parameters:
    • data_dict (dict): Dictionary containing data file information.
    • mc_dict (dict): Dictionary containing Monte Carlo (MC) file information.
    • dir_out (str): Output directory.
    • stem_out (str): Stem of the output file.
    • is_ele (bool): Flag to use GSF electron energy.
    • mc_weight (str): Name of the column containing the MC weights.
    • corrlib_scale (dict): Correction library to correct the energy scale in data.
    • corrlib_smear (dict): Correction library to smear the MC.
    • add_vars (List): Additional variables to include.
    • charge (int): Charge selection.
    • selection (str): Selection criteria.
    • reweight_selection (str): Reweighting selection criteria.
    • pileup_reweighting (bool): Flag to apply pileup reweighting.
    • do_reweight (bool): Flag to apply reweighting.
    • subyear (str): Subyear information.
    • backgrounds (list): List of background processes.
    • year (str): Year information.
    • save_dt (bool): Flag to save data.
    • save_mc (bool): Flag to save MC.

Normalisation

  • Description: Contains cross-section (XS) and luminosity (Lumi) values for different processes and years.

MC weights

  • HiggsDNA: 3 weights are saved:

    • genWeight: NLO weights from the generator
    • weight = genWeight * weight_central: NLO weights + reweight from HDNA
    • weight_central: reweight from HDNA ie Pileup,..
  • Output of the reader:

    • genWeight: NLO weights from the generator.
    • weight = genWeight * weight_central * norm * RW: NLO weights with HDNA and reader reweighting and normalization.
    • genWeight_normed = genWeight * norm: NLO weights from the generator normalized to the XS and luminosity.
    • weight_central = weight_central * RW: LO weights with HDNA and reader reweighting.

Columns

  • Description: Defines the columns for photons and electrons.

Filters

  • Description: Defines the filters for photons, electrons, and events.

Usage Example

sas_reader_higgsdna config/cms/reader_higgsdna_example.yaml

This script is essential for converting and normalizing HiggsDNA data for further analysis in the ijazz_2p0 framework using this example reader_higgsdna_example.yaml.

Combine corrlib

combine_csets():

  • Description: Combine different corrlib correction files, some files could use always the nominal scale for variations (if only one variations should be considered to avoid double counting).
  • Parameters:
    • cset_files (List[Union[str, Path]]): list of corrlib files
    • icset_fix_scale (Union[List,Tuple]): list of corrlib for which the nominal scale only should be use
    • dir_results (Union[str, Path]): directory
    • dset_name (str, optional): identfier of the datase. Defaults to 'DSET'.
    • cset_version (int, optional): version of the set of corrections. Defaults to 1.

Usage Example

Combining the 6 steps:

file_corr0=TimeDep/EGMScalesSmearing_2022preEE.v1.json.gz
file_corr1=EtaR9/EGMScalesSmearing_2022preEE.v1.json.gz
file_corr2=FineEtaR9/EGMScalesSmearing_2022.v1.json.gz
file_corr3=PT/EGMScalesSmearing_2022.v1.json.gz
file_corr4=Gain/EGMScalesSmearing_2022.v1.json.gz
file_corr5=PTsplit/EGMScalesSmearing_2022preEE.v1.json.gz
    ijazz_corrlib_combine $file_corr0 $file_corr1 $file_corr2 $file_corr3 $file_corr4 $file_corr5 -i 1 2 3 4  -v 1 -o . -d Pho_2022preEE

Create EGMScalesSmearing_Pho_2022preEE.v1.json.gz output file. Including a compound correction for scales EGMScale_Compound_Pho_2022preEE and for each step, the scale correction :EGMScale_Pho{step_name}_2022preEE and smearing correction:EGMSmearAndSyst_Pho{step_name}_2022preEE.

We use -i 1 2 3 4 because the systematics are computed in the last step (step5) and the time dependent correction does not include escale then we fix the escale for the file 1, 2, 3 and 4. Then scale = scale0 * scale1 * scale2 * scale3 * scale4 * scale5 but escale = escale5

Correct file

Apply Scale and Smearing to parquet files using this example validation_samples.yaml. Where we apply the compound scale on data and the smearing compute in the last step on MC.

sas_file_corrector config/cms/validation_samples.yaml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cms_sas_utils-0.2.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cms_sas_utils-0.2-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file cms_sas_utils-0.2.tar.gz.

File metadata

  • Download URL: cms_sas_utils-0.2.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for cms_sas_utils-0.2.tar.gz
Algorithm Hash digest
SHA256 4363d23e6afe361bace6d6f0bc6ee00167a012576da6e89e03792158d099d821
MD5 4c0b305504130b44dc4986f8d0c74a05
BLAKE2b-256 c1192f7388e064bdef6d72351477d07c8f59c76eaf4c84be15c5a2cde364594d

See more details on using hashes here.

File details

Details for the file cms_sas_utils-0.2-py3-none-any.whl.

File metadata

  • Download URL: cms_sas_utils-0.2-py3-none-any.whl
  • Upload date:
  • Size: 34.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for cms_sas_utils-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 67e25da14ec9302b39475480e3965acaa0b65700d08c22b17b806b8bfc2b13a5
MD5 fec8f72c08247aae10e8772cc1535736
BLAKE2b-256 eebb266092b56e4b69b89f08e2e2e588182c2d216a578672160877fba9724086

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page