Skip to content

Commit

Permalink
Script to test MC 22-23 production (UL-like)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianoDee committed Mar 29, 2024
1 parent f1dac78 commit 3e1901d
Show file tree
Hide file tree
Showing 9 changed files with 235 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Configuration/PyReleaseValidation/scripts/test-MC-setup_gen_sim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

############################################################################################################
### GEN-SIM-RAW-DIGI

release=$1
conditions=$2
era=$3
beamspot=$4

echo '> Running GEN,SIM + DIGI,L1,DIGI2RAW stes in ' $release

cmsDriver.py TTbar_14TeV_TuneCP5_cfi --python_filename gen_sim.py \
--eventcontent RAWSIM --customise Configuration/DataProcessing/Utils.addMonitoring \
--datatier GEN-SIM --fileout file:step1.root --conditions $conditions --beamspot $beamspot \
--step GEN,SIM --geometry DB:Extended --era $era --mc -n 10

cmsDriver.py --python_filename raw_digi.py --eventcontent RAWSIM \
--customise Configuration/DataProcessing/Utils.addMonitoring \
--datatier GEN-SIM-RAW --filein file:step1.root \
--fileout file:step2.root --conditions $conditions --step DIGI,L1,DIGI2RAW \
--geometry DB:Extended --era $era --mc -n -1

############################################################################################################
31 changes: 31 additions & 0 deletions Configuration/PyReleaseValidation/scripts/test-MC-setup_hlt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

############################################################################################################
### HLT STEP in a different release

function rel_setup()
{
scram p CMSSW $1
cd $1
eval `scram runtime -sh`
echo -e '>>>>> New current release in' $CMSSW_BASE
cd $OLDPWD
echo '>>>>> Back to workdir:' $PWD

}

release=$1
conditions=$2
era=$3
hlt=$4

rel_setup $release

echo ">>> Running HLT:${hlt} step in " $release

cmsDriver.py --python_filename hlt_"$(echo "$hlt" | tr ':' _ | tr '@' _ )".py --eventcontent RAWSIM \
--customise Configuration/DataProcessing/Utils.addMonitoring \
--datatier GEN-SIM-RAW --fileout file:step3.root \
--conditions $conditions \
--customise_commands 'process.source.bypassVersionCheck = cms.untracked.bool(True)' \
--step 'HLT:'$hlt --geometry DB:Extended --filein file:step2.root --era $era --mc -n -1
27 changes: 27 additions & 0 deletions Configuration/PyReleaseValidation/scripts/test-MC-setup_reco.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

############################################################################################################
### RECO + PAT

release=$1
conditions=$2
era=$3

#export SCRAM_ARCH=$scram_arch

echo '> Running RAW2DIGI,L1Reco,RECO,RECOSIM + PAT stes in ' $release

cmsDriver.py --python_filename step_4_cfg.py --eventcontent AODSIM \
--customise Configuration/DataProcessing/Utils.addMonitoring \
--datatier AODSIM --fileout file:step4.root \
--conditions $conditions --step RAW2DIGI,L1Reco,RECO,RECOSIM \
--geometry DB:Extended --filein file:step3.root --era $era \
--runUnscheduled --mc -n -1

cmsDriver.py --python_filename step_5_cfg.py --eventcontent MINIAODSIM \
--customise Configuration/DataProcessing/Utils.addMonitoring \
--datatier MINIAODSIM --fileout file:step5.root \
--conditions $conditions --step PAT \
--geometry DB:Extended --filein file:step4.root --era $era \
--runUnscheduled --mc -n -1
############################################################################################################
9 changes: 9 additions & 0 deletions Configuration/PyReleaseValidation/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,12 @@
</test>
<test name="test-runTheMatrix-interactive" command="test-runTheMatrix_interactive.sh">
</test>
<!-- Tests for MC production for 2022 and 2023 -->
<test name="test-MC_23_setup" command="test_mc_setup/test-MC_23_setup.sh">
</test>
<test name="test-MC_22_setup" command="test_mc_setup/test-MC_22_setup.sh">
</test>
<test name="test-MC_23_crosscheck" command="test_mc_setup/test-MC_23_setup_crosscheck.sh">
</test>
<test name="test-MC_22_crosscheck" command="test_mc_setup/test-MC_22_setup_crosscheck.sh">
</test>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

#The conditions will be changed to be the proper GT from ALCA including
#the BS smearing record from GT, for the moment we use the automatic one postEE
#that in CMSSW_12_4_19 is 124X_mcRun3_2022_realistic_postEE_v1

echo "######## TEST MC 2022 Setup"
echo ""

$CMSSW_BASE/src/Configuration/PyReleaseValidation/test/test_mc_setup/test_MC_setup.sh \
140X_mcRun3_2022_realistic_postEE_v3 Run3 2022v14 CMSSW_12_4_19 \
124X_mcRun3_2022_realistic_postEE_v1 Realistic25ns13p6TeVEarly2022Collision
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# This setup is a standard one, where we run everything in the current IB
# with the same GT to crosscheck that, in normal conditions, everything works
# and ther's no bug or artifact in the chain itself

echo "######## TEST MC 2022 Setup - Crosscheck"
echo ""

$CMSSW_BASE/src/Configuration/PyReleaseValidation/test/test_mc_setup/test_MC_setup.sh \
140X_mcRun3_2022_realistic_postEE_v3 Run3 @relval2022 $CMSSW_VERSION \
140X_mcRun3_2022_realistic_postEE_v3 DBrealistic
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

#The conditions will be changed to be the proper GT from ALCA including
#the BS smearing record from GT, for the moment we use the automatic one postEE
#that in CMSSW_13_0_17 is 130X_mcRun3_2023_realistic_postBPix_v1

echo "######## TEST MC 2023 Setup"
echo ""

$CMSSW_BASE/src/Configuration/PyReleaseValidation/test/test_mc_setup/test_MC_setup.sh \
140X_mcRun3_2023_realistic_postBPix_v3 Run3_2023 2023v12 CMSSW_13_0_17 \
130X_mcRun3_2023_realistic_postBPix_v1 Realistic25ns13p6TeVEarly2023Collision
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# This setup is a standard one, where we run everything in the current IB
# with the same GT to crosscheck that, in normal conditions, everything works
# and ther's no bug or artifact in the chain itself

echo "######## TEST MC 2023 Setup - Crosscheck"
echo ""

$CMSSW_BASE/src/Configuration/PyReleaseValidation/test/test_mc_setup/test_MC_setup.sh \
140X_mcRun3_2023_realistic_postBPix_v3 Run3_2023 @relval2023 $CMSSW_VERSION \
140X_mcRun3_2023_realistic_postBPix_v3 DBrealistic
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/bin/bash

# This script mimics a MC chain with HLT run
# a in a different release from the current one

echo '#### MC Setup'

# this would make it run only in 14_0_X releases, need to keep?

# if [[ ! ("$CMSSW_VERSION" == *"14_0_"*) ]]; then
# echo "This is not a 14_0_X release. No need to test this. Exiting."
# exit 0
# fi

# inputs
conditions=$1
era=$2
hlt=$3
release_hlt=$4
gt_hlt=$5
beamspot=$6

base_dir=$PWD
base_cms=$CMSSW_BASE
base_arch=$SCRAM_ARCH


# to take into account changes in gcc
base_arch_no_gcc=$(echo $SCRAM_ARCH | cut -d "_" -f -2)
if [[ ! ("$CMSSW_VERSION" == $release_hlt) ]]; then
hlt_arch=$(echo $(ls -dtrh /cvmfs/cms.cern.ch/${base_arch_nogcc}*/cms/cmssw/${release_hlt} | tail -1) | cut -d "/" -f 4)
else
hlt_arch=$base_arch
fi


echo '> GT : ' $conditions
echo '> Era : ' $era
echo '> BS : ' $beamspot
echo '> HLT : ' $hlt
echo '> HLT release : ' $release_hlt
echo '> HLT GT : ' $gt_hlt
echo ' - with SCRAM_ARCH='$hlt_arch
echo ''



############################################################################################################
# setting up the temporary working dir, to be removed once done (or crashed)
tmp_dir=$(mktemp -d -t test_MC_${3}_${4}_${5}_XXXXXXX)
mkdir -p $tmp_dir

# the tmp dir cleaning
function job_clean()
{
echo '>>>>> Cleaning up and going back to base setup <<<<<'
rm -rf "$tmp_dir"

export SCRAM_ARCH=$base_arch
cd $CMSSW_BASE
eval `scram runtime -sh`

cd $base_dir
# export TEST_CLEANED_test_mc_23_workdir=0
}

trap job_clean EXIT
trap job_clean SIGINT

############################################################################################################
# GEN SIM
# Not really needed, but anyway
cd $CMSSW_BASE
eval `scram runtime -sh`
cd $tmp_dir

bash test-MC-setup_gen_sim.sh $CMSSW_VERSION $conditions $era $beamspot # Once we have the proper GT this will be DBrealistic

############################################################################################################
# HLT
export SCRAM_ARCH=$hlt_arch
bash test-MC-setup_hlt.sh $release_hlt $gt_hlt $era $hlt
export SCRAM_ARCH=$base_arch

############################################################################################################
# RECO + PAT

cd $CMSSW_BASE
eval `scram runtime -sh`
cd $tmp_dir

bash test-MC-setup_reco.sh $release_hlt $conditions $era $hlt

############################################################################################################

echo '>>>> Done (maybe)! <<<<'

0 comments on commit 3e1901d

Please sign in to comment.