Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a request from a 2024 campaign #3805

Merged
merged 6 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,6 @@ jobs:
python3 bin/utils/request_fragment_check.py --bypass_status --develop --bypass_runcmsgrid_patch --local --prepid GEN-Run3Summer22EEwmLHEGS-00403
python3 bin/utils/request_fragment_check.py --bypass_status --develop --bypass_runcmsgrid_patch --local --prepid TRK-Run3Summer23wmLHEGS-00002
python3 bin/utils/request_fragment_check.py --bypass_status --develop --bypass_runcmsgrid_patch --local --prepid TSG-Run3Summer23BPixGS-00007
python3 bin/utils/request_fragment_check.py --bypass_status --develop --bypass_runcmsgrid_patch --local --prepid TOP-RunIISummer20UL16wmLHEGEN-00883
python3 bin/utils/request_fragment_check.py --bypass_status --develop --bypass_runcmsgrid_patch --local --prepid TOP-RunIISummer20UL16wmLHEGEN-00883
python3 bin/utils/request_fragment_check.py --bypass_status --develop --bypass_runcmsgrid_patch --local --prepid BPH-Run3Winter24GS-00001
python3 bin/utils/request_fragment_check.py --bypass_status --develop --bypass_runcmsgrid_patch --local --prepid GEN-RunIII2024Summer24wmLHEGS-00001
96 changes: 96 additions & 0 deletions bin/utils/BPH-Run3Winter24GS-00001
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import FWCore.ParameterSet.Config as cms

from Configuration.Generator.Pythia8CommonSettings_cfi import *
from GeneratorInterface.EvtGenInterface.EvtGenSetting_cff import *
from Configuration.Generator.MCTunesRun3ECM13p6TeV.PythiaCP5Settings_cfi import *

_generator = cms.EDFilter("Pythia8GeneratorFilter",
pythiaPylistVerbosity = cms.untracked.int32(0),
pythiaHepMCVerbosity = cms.untracked.bool(False),
comEnergy = cms.double(13600.0),
maxEventsToPrint = cms.untracked.int32(0),
ExternalDecays = cms.PSet(
EvtGen130 = cms.untracked.PSet(
decay_table = cms.string('GeneratorInterface/EvtGenInterface/data/DECAY_2020_NOLONGLIFE.DEC'),
particle_property_file = cms.FileInPath('GeneratorInterface/EvtGenInterface/data/evt_2020.pdl'),
user_decay_embedded= cms.vstring (

'Define Hp 0.49',
'Define Hz 0.775',
'Define Hm 0.4',
'Define pHp 2.50',
'Define pHz 0.0',
'Define pHm -0.17',
'#',
'Alias MyB_s0 B_s0',
'Alias Myanti-B_s0 anti-B_s0',
'ChargeConj Myanti-B_s0 MyB_s0',
'Alias MyPhi phi',
'ChargeConj MyPhi MyPhi',
'#',
'Decay MyB_s0',
' 1.000 MyPhi MyPhi PVV_CPLH 0.02 1 Hp pHp Hz pHz Hm pHm;',
'#',
'Enddecay',
'Decay Myanti-B_s0',
' 1.000 MyPhi MyPhi PVV_CPLH 0.02 1 Hp pHp Hz pHz Hm pHm;',
'Enddecay',
'#',
'Decay MyPhi',
' 1.000 K+ K- VSS;',
'Enddecay',
'End'
),
list_forced_decays = cms.vstring('MyB_s0','Myanti-B_s0'),
operates_on_particles = cms.vint32(),
convertPythiaCodes = cms.untracked.bool(False)
),
parameterSets = cms.vstring('EvtGen130')
),
PythiaParameters = cms.PSet(
pythia8CommonSettingsBlock,
pythia8CP5SettingsBlock,
processParameters = cms.vstring(
'SoftQCD:nonDiffractive = on',
'PTFilter:filter = on', # this turn on the filter
'PTFilter:quarkToFilter = 5', # PDG id of q quark
'PTFilter:scaleToFilter = 1.0'),
parameterSets = cms.vstring(
'pythia8CommonSettings',
'pythia8CP5Settings',
'processParameters')
)
)

from GeneratorInterface.Core.ExternalGeneratorFilter import ExternalGeneratorFilter
generator = ExternalGeneratorFilter(_generator)

generator.PythiaParameters.processParameters.extend(EvtGenExtraParticles)

bfilter = cms.EDFilter(
"PythiaFilter",
MaxEta = cms.untracked.double(9999.),
MinEta = cms.untracked.double(-9999.),
ParticleID = cms.untracked.int32(531)
)

decayfilter = cms.EDFilter(
"PythiaDauVFilter",
verbose = cms.untracked.int32(1),
NumberDaughters = cms.untracked.int32(2),
ParticleID = cms.untracked.int32(531), ## Bs0
DaughterIDs = cms.untracked.vint32(333, 333), ## Phi and Phi
MinPt = cms.untracked.vdouble(-1., -1.),
MinEta = cms.untracked.vdouble(-9999., -9999.),
MaxEta = cms.untracked.vdouble( 9999., 9999.)
)

MuFilter = cms.EDFilter(
"PythiaFilter",
ParticleID = cms.untracked.int32(13),
MinPt = cms.untracked.double(4.0),
MinEta = cms.untracked.double(-2.4),
MaxEta = cms.untracked.double(2.4)
)

ProductionFilterSequence = cms.Sequence(generator*bfilter*decayfilter*MuFilter)
155 changes: 155 additions & 0 deletions bin/utils/BPH-Run3Winter24GS-00001_get_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
#!/bin/bash

# Binds for singularity containers
# Mount /afs, /eos, /cvmfs, /etc/grid-security for xrootd
export APPTAINER_BINDPATH='/afs,/cvmfs,/cvmfs/grid.cern.ch/etc/grid-security:/etc/grid-security,/eos,/etc/pki/ca-trust,/run/user,/var/run/user'

cat <<'EndOfGenScriptFile' > BPH-Run3Winter24GS-00001_gen_script.sh
#!/bin/bash

echo "Running CMS GEN request script using cms-sw containers. Architecture: el9:x86_64"
python3 -m venv cms_gen_venv_BPH-Run3Winter24GS-00001 && source ./cms_gen_venv_BPH-Run3Winter24GS-00001/bin/activate

# Install the PdmV REST client
pip install git+https://github.com/cms-PdmV/mcm_scripts &> /dev/null

echo "Packages installed"
pip freeze
echo ""

# GEN Script begin
rm -f request_fragment_check.py
wget -q https://raw.githubusercontent.com/cms-sw/genproductions/master/bin/utils/request_fragment_check.py
chmod +x request_fragment_check.py

./request_fragment_check.py --bypass_status --prepid BPH-Run3Winter24GS-00001

# End of CMS GEN script file: BPH-Run3Winter24GS-00001_gen_script.sh
EndOfGenScriptFile
chmod +x BPH-Run3Winter24GS-00001_gen_script.sh

# Run in singularity container
singularity run --home $PWD:$PWD /cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/el9:x86_64 $(echo $(pwd)/BPH-Run3Winter24GS-00001_gen_script.sh)

GEN_ERR=$?
if [ $GEN_ERR -ne 0 ]; then
echo "GEN Checking Script returned exit code $GEN_ERR which means there are $GEN_ERR errors"
echo "Validation WILL NOT RUN"
echo "Please correct errors in the request and run validation again"
exit $GEN_ERR
fi
echo "Running VALIDATION. GEN Request Checking Script returned no errors"
# GEN Script end

# Download fragment from McM
curl -s -k https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_fragment/BPH-Run3Winter24GS-00001 --retry 3 --create-dirs -o Configuration/GenProduction/python/BPH-Run3Winter24GS-00001-fragment.py
[ -s Configuration/GenProduction/python/BPH-Run3Winter24GS-00001-fragment.py ] || exit $?;

# Check if fragment contais gridpack path ant that it is in cvmfs
if grep -q "gridpacks" Configuration/GenProduction/python/BPH-Run3Winter24GS-00001-fragment.py; then
if ! grep -q "/cvmfs/cms.cern.ch/phys_generator/gridpacks" Configuration/GenProduction/python/BPH-Run3Winter24GS-00001-fragment.py; then
echo "Gridpack inside fragment is not in cvmfs."
exit -1
fi
fi

# Dump actual test code to a BPH-Run3Winter24GS-00001_test.sh file that can be run in Singularity
cat <<'EndOfTestFile' > BPH-Run3Winter24GS-00001_test.sh
#!/bin/bash

export SCRAM_ARCH=el8_amd64_gcc12

source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_13_3_0/src ] ; then
echo release CMSSW_13_3_0 already exists
else
scram p CMSSW CMSSW_13_3_0
fi
cd CMSSW_13_3_0/src
eval `scram runtime -sh`

mv ../../Configuration .
scram b
cd ../..

# Maximum validation duration: 28800s
# Margin for validation duration: 30%
# Validation duration with margin: 28800 * (1 - 0.30) = 20160s
# Time per event for each sequence: 0.5436s
# Threads for each sequence: 1
# Time per event for single thread for each sequence: 1 * 0.5436s = 0.5436s
# Which adds up to 0.5436s per event
# Single core events that fit in validation duration: 20160s / 0.5436s = 37086
# Produced events limit in McM is 10000
# According to 0.0017 efficiency, validation should run 10000 / 0.0017 = 5882352 events to reach the limit of 10000
# Take the minimum of 37086 and 5882352, but more than 0 -> 37086
# It is estimated that this validation will produce: 37086 * 0.0017 = 63 events
EVENTS=37086


# cmsDriver command
cmsDriver.py Configuration/GenProduction/python/BPH-Run3Winter24GS-00001-fragment.py --python_filename BPH-Run3Winter24GS-00001_1_cfg.py --eventcontent RAWSIM --customise Configuration/DataProcessing/Utils.addMonitoring --datatier GEN-SIM --fileout file:BPH-Run3Winter24GS-00001.root --conditions 133X_mcRun3_2024_realistic_v10 --beamspot Realistic25ns13p6TeVEarly2023Collision --customise_commands process.source.numberEventsInLuminosityBlock="cms.untracked.uint32(58823)" --step GEN,SIM --geometry DB:Extended --era Run3_2023 --no_exec --mc -n $EVENTS || exit $? ;

# Run generated config
REPORT_NAME=BPH-Run3Winter24GS-00001_report.xml
# Run the cmsRun
cmsRun -e -j $REPORT_NAME BPH-Run3Winter24GS-00001_1_cfg.py || exit $? ;

# Parse values from BPH-Run3Winter24GS-00001_report.xml report
processedEvents=$(grep -Po "(?<=<Metric Name=\"NumberEvents\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
producedEvents=$(grep -Po "(?<=<TotalEvents>)(\d*)(?=</TotalEvents>)" $REPORT_NAME | tail -n 1)
threads=$(grep -Po "(?<=<Metric Name=\"NumberOfThreads\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
peakValueRss=$(grep -Po "(?<=<Metric Name=\"PeakValueRss\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
peakValueVsize=$(grep -Po "(?<=<Metric Name=\"PeakValueVsize\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
totalSize=$(grep -Po "(?<=<Metric Name=\"Timing-tstoragefile-write-totalMegabytes\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
totalSizeAlt=$(grep -Po "(?<=<Metric Name=\"Timing-file-write-totalMegabytes\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
totalJobTime=$(grep -Po "(?<=<Metric Name=\"TotalJobTime\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
totalJobCPU=$(grep -Po "(?<=<Metric Name=\"TotalJobCPU\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
eventThroughput=$(grep -Po "(?<=<Metric Name=\"EventThroughput\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
avgEventTime=$(grep -Po "(?<=<Metric Name=\"AvgEventTime\" Value=\")(.*)(?=\"/>)" $REPORT_NAME | tail -n 1)
if [ -z "$threads" ]; then
echo "Could not find NumberOfThreads in report, defaulting to 1"
threads=1
fi
if [ -z "$eventThroughput" ]; then
eventThroughput=$(bc -l <<< "scale=4; 1 / ($avgEventTime / $threads)")
fi
if [ -z "$totalSize" ]; then
totalSize=$totalSizeAlt
fi
if [ -z "$processedEvents" ]; then
processedEvents=$EVENTS
fi
echo "Validation report of BPH-Run3Winter24GS-00001 sequence 1/1"
echo "Processed events: $processedEvents"
echo "Produced events: $producedEvents"
echo "Threads: $threads"
echo "Peak value RSS: $peakValueRss MB"
echo "Peak value Vsize: $peakValueVsize MB"
echo "Total size: $totalSize MB"
echo "Total job time: $totalJobTime s"
echo "Total CPU time: $totalJobCPU s"
echo "Event throughput: $eventThroughput"
echo "CPU efficiency: "$(bc -l <<< "scale=2; ($totalJobCPU * 100) / ($threads * $totalJobTime)")" %"
echo "Size per event: "$(bc -l <<< "scale=4; ($totalSize * 1024 / $producedEvents)")" kB"
echo "Time per event: "$(bc -l <<< "scale=4; (1 / $eventThroughput)")" s"
echo "Filter efficiency percent: "$(bc -l <<< "scale=8; ($producedEvents * 100) / $processedEvents")" %"
echo "Filter efficiency fraction: "$(bc -l <<< "scale=10; ($producedEvents) / $processedEvents")

# End of BPH-Run3Winter24GS-00001_test.sh file
EndOfTestFile

# Make file executable
chmod +x BPH-Run3Winter24GS-00001_test.sh

if [ -e "/cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/el8:amd64" ]; then
CONTAINER_NAME="el8:amd64"
elif [ -e "/cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/el8:x86_64" ]; then
CONTAINER_NAME="el8:x86_64"
else
echo "Could not find amd64 or x86_64 for el8"
exit 1
fi
# Run in singularity container
export SINGULARITY_CACHEDIR="/tmp/$(whoami)/singularity"
singularity run --home $PWD:$PWD /cvmfs/unpacked.cern.ch/registry.hub.docker.com/cmssw/$CONTAINER_NAME $(echo $(pwd)/BPH-Run3Winter24GS-00001_test.sh)
40 changes: 40 additions & 0 deletions bin/utils/GEN-RunIII2024Summer24wmLHEGS-00001
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import FWCore.ParameterSet.Config as cms

externalLHEProducer = cms.EDProducer('ExternalLHEProducer',
args = cms.vstring('/cvmfs/cms.cern.ch/phys_generator/gridpacks/PdmV/RunIII2024Summer24/Powheg/TT/hvq_slc7_amd64_gcc10_CMSSW_12_4_8_TTtoLNu2Q_powheg-pythia8.tgz'),
nEvents = cms.untracked.uint32(5000),
numberOfParameters = cms.uint32(1),
outputFile = cms.string('cmsgrid_final.lhe'),
scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'),
generateConcurrently = cms.untracked.bool(True),
)

from Configuration.Generator.Pythia8CommonSettings_cfi import *
from Configuration.Generator.MCTunesRun3ECM13p6TeV.PythiaCP5Settings_cfi import *
from Configuration.Generator.Pythia8PowhegEmissionVetoSettings_cfi import *
from Configuration.Generator.PSweightsPythia.PythiaPSweightsSettings_cfi import *

generator = cms.EDFilter("Pythia8ConcurrentHadronizerFilter",
PythiaParameters = cms.PSet(
pythia8CommonSettingsBlock,
pythia8CP5SettingsBlock,
pythia8PowhegEmissionVetoSettingsBlock,
pythia8PSweightsSettingsBlock,
processParameters = cms.vstring(
'POWHEG:nFinal = 2',
'TimeShower:mMaxGamma = 4.0'
),
parameterSets = cms.vstring(
'pythia8CommonSettings',
'pythia8CP5Settings',
'pythia8PowhegEmissionVetoSettings',
'processParameters',
'pythia8PSweightsSettings',
)
),
comEnergy = cms.double(13600),
maxEventsToPrint = cms.untracked.int32(1),
pythiaHepMCVerbosity = cms.untracked.bool(False),
pythiaPylistVerbosity = cms.untracked.int32(1),
)

Loading