Skip to content

5 ‐ Scripts description

ebecheva edited this page Apr 19, 2024 · 46 revisions

We will present the scripts from functionalities point of view. All the scripts are in the directory https://github.com/hgc-tpg/HGCTPGValidation/tree/master/scripts

Extract the release name from the target branch name

The script extractReleaseName.sh is called in the stage Set CMSSW environment variables of the pipeline. It takes the target branch $CHANGE_TARGET as argument and returns the CMSSW release version $REF_RELEASE:

/HGCTPGValidation/scripts/extractReleaseName.sh $CHANGE_TARGET

The target branch name in hgc-tpg/cmssw.git always has the form *-CMSSW_*

The script performs three main tasks:

  1. splits the branch target name using the Internal Field Separator (IFS) (-),
  2. loops over all elements and split them using the IFS (_)
  3. if the element has “CMSSW” string then this element is the name release

Get the SCRAM_ARCH

CMSSW is based on SCRAM configuration management tool which is available for a given architecture. SCRAM_ARCH is the variable that should be set in order to use the right architecture for our CMSSW release. After getting the name release, we use the following script to extract the $SCRAM_ARCH for the most recent gcc version (if there are more than one arches)

/HGCTPGValidation/scripts/getScramArch.sh $REF_RELEASE

The main idea is to use scram list command and grep to select the lines corresponding to the CMSSW release version we want to use and get its SCRAM_ARCH.

The main steps are described bellow:

  1. scram list -c display the result in a simple lines

Every line has the form

CMSSW CMSSW_12_2_0 /cvmfs/cms.cern.ch/slc7_amd64_gcc10/cms/cmssw/CMSSW_12_2_0

  1. grep -w shows the lines that match exactly to the release name # for ex. we'll see the lines only for CMSSW_12_2_0, not for the pre-releases

  2. Write all lines into a text file

  3. Loop over all the lines in the file

For more information, please check the introductory part of the script.

Install the CMSSW environment

The script installCMSSW.sh is called in the stage Install of the pipeline. The aim is to install a working directory for the reference and the test CMSSW code.

/HGCTPGValidation/scripts/installCMSSW.sh $SCRAM_ARCH $REF_RELEASE $REMOTE $CHANGE_TARGET $CHANGE_TARGET $LABEL

The script takes as arguments the $SCRAM_ARCH, the release $REF_RELEASE extracted from the reference branch, the remote name $REMOTE, the change branch name $CHANGE_TARGET, the target branch name $CHANGE_TARGETand the label $LABEL(ref or test).

Produce data

The data are produced in the stage Produceof the pipeline. It is done separately for the reference and the test branches (${LABEL_TEST}) for a given configuration sets (${CONFIG_SUBSET}) by running the script produceData_multiconfiguration.py.

/HGCTPGValidation/scripts/produceData_multiconfiguration.py  --subsetconfig ${CONFIG_SUBSET} --label ${LABEL_TEST}

The produce process has two parts:

  • the HGCal TPG simulation run in the CMSSW working directory previously created,

and

  • the validation that creates relevent histograms from the HGCal TPG simulation data.

The list of the histograms is given in the file HGCALTriggerPrimitivesHistos.txt.

Displaying data

displayHistos.py script is called in the last stage Display of the pipeline. It takes several arguments relative to the reference and the test branches validation. The aim is to compare the histograms from both validations.

/HGCTPGValidation/scripts/displayHistos.py  --subsetconfig ${CONFIG_SUBSET}

--refdir ${REF_RELEASE}_HGCalTPGValidation_${LABEL_REF}/src

--testdir ${REF_RELEASE}_HGCalTPGValidation_${LABEL_TEST}/src

--datadir ${DATA_DIR}  --prnumber $CHANGE_ID

--prtitle "$CHANGE_TITLE (from $CHANGE_AUTHOR, $CHANGE_URL)"

Standalone validation

The validation can be run in standalone mode. The relevent script is: standalone_hgctpg_validation.sh

More details about how to run it are given at the beginning of the script.