Skip to content

Commit

Permalink
Merge pull request #27048 from jpata/pfvalidation-10_6_X-master
Browse files Browse the repository at this point in the history
Renewed PF validation
  • Loading branch information
cmsbuild committed Jun 28, 2019
2 parents 7488a8f + 2c82951 commit acc895c
Show file tree
Hide file tree
Showing 36 changed files with 2,973 additions and 6 deletions.
3 changes: 2 additions & 1 deletion DQMOffline/Configuration/python/DQMOffline_SecondStep_cff.py
Expand Up @@ -18,6 +18,7 @@
from DQMOffline.L1Trigger.L1TriggerDqmOffline_cff import *
from DQM.HcalTasks.OfflineHarvestingSequence_pp import *
from PhysicsTools.NanoAOD.nanoDQM_cff import *
from Validation.RecoParticleFlow.DQMForPF_MiniAOD_cff import *

DQMOffline_SecondStep_PreDPG = cms.Sequence( dqmDcsInfoClient *
ecal_dqm_client_offline *
Expand Down Expand Up @@ -146,7 +147,7 @@

DQMHarvestBTag = cms.Sequence( bTagCollectorSequenceDATA )

DQMHarvestMiniAOD = cms.Sequence( dataCertificationJetMETSequence * muonQualityTests_miniAOD)
DQMHarvestMiniAOD = cms.Sequence( dataCertificationJetMETSequence * muonQualityTests_miniAOD * DQMHarvestPF )
DQMHarvestNanoAOD = cms.Sequence( nanoHarvest )

# L1 trigger sequences
Expand Down
6 changes: 4 additions & 2 deletions DQMOffline/Configuration/python/DQMOffline_cff.py
Expand Up @@ -51,7 +51,8 @@
from DQM.TrackingMonitorSource.pixelTracksMonitoring_cff import *
from DQM.SiOuterTracker.OuterTrackerSourceConfig_cff import *
# miniAOD DQM validation
from Validation.RecoParticleFlow.miniAODDQM_cff import *
from Validation.RecoParticleFlow.miniAODDQM_cff import * # On MiniAOD vs RECO
from Validation.RecoParticleFlow.DQMForPF_MiniAOD_cff import * # MiniAOD PF variables
from DQM.TrackingMonitor.tracksDQMMiniAOD_cff import *
from DQM.TrackingMonitor.trackingRecoMaterialAnalyzer_cfi import materialDumperAnalyzer
materialDumperAnalyzer.usePV = True
Expand All @@ -75,6 +76,7 @@

HLTMonitoring = cms.Sequence( OfflineHLTMonitoring )
HLTMonitoringPA = cms.Sequence( OfflineHLTMonitoringPA )

DQMOffline = cms.Sequence( DQMOfflinePreDPG *
DQMOfflinePrePOG *
HLTMonitoring *
Expand Down Expand Up @@ -175,7 +177,7 @@

from DQMOffline.Muon.miniAOD_cff import *

DQMOfflineMiniAOD = cms.Sequence(jetMETDQMOfflineRedoProductsMiniAOD*muonMonitors_miniAOD*MuonMiniAOD)
DQMOfflineMiniAOD = cms.Sequence(jetMETDQMOfflineRedoProductsMiniAOD*muonMonitors_miniAOD*MuonMiniAOD*DQMOfflinePF)

#Post sequences are automatically placed in the EndPath by ConfigBuilder if PAT is run.
#miniAOD DQM sequences need to access the filter results.
Expand Down
4 changes: 4 additions & 0 deletions DQMOffline/Configuration/python/autoDQM.py
Expand Up @@ -96,6 +96,10 @@
'PostDQMOffline',
'DQMHarvestNanoAOD'],

'pfDQM': ['DQMOfflinePF',
'PostDQMOffline',
'DQMHarvestPF'],

'standardDQM': ['DQMOffline',
'PostDQMOffline',
'dqmHarvesting'],
Expand Down
98 changes: 98 additions & 0 deletions Validation/RecoParticleFlow/Makefile
@@ -0,0 +1,98 @@
TMPDIR=test/tmp
RELVALCMD=${CMSSW_BASE}/src/Validation/RecoParticleFlow/test/run_relval.sh
DQM_MC=DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO

conf:
cd ${TMPDIR} && ${RELVALCMD} conf reco 0

dumpconf:
cd ${TMPDIR}/conf && python -c 'import step3; print step3.process.dumpPython()' > step3_dump.py
cp ${TMPDIR}/conf/step3.py test/crab/
cp ${TMPDIR}/conf/step3_dump.py test/crab/

QCD: QCD_reco QCD_dqm

QCD_reco:
cd ${TMPDIR} && ${RELVALCMD} QCD reco 0

#Need to expand the CMSSW python configuration
QCD_dumpconf:
cd ${TMPDIR}/QCD && python -c 'import step3_RAW2DIGI_L1Reco_RECO_RECOSIM_EI_PAT as step3; print step3.process.dumpPython()' > step3_dump.py
cp ${TMPDIR}/QCD/step3_dump.py crab/

QCDPU_reco:
cd ${TMPDIR} && ${RELVALCMD} QCDPU reco 0

ZMM_reco:
cd ${TMPDIR} && ${RELVALCMD} ZMM reco 0

MinBias_reco:
cd ${TMPDIR} && ${RELVALCMD} MinBias reco 0

NuGunPU_reco:
cd ${TMPDIR} && ${RELVALCMD} NuGunPU reco 0

#dqm: QCD_dqm QCDPU_dqm ZMM_dqm MinBias_dqm SN_dqm
dqm: QCD_dqm QCDPU_dqm NuGunPU_dqm

QCD_dqm:
rm -f ${TMPDIR}/QCD/DQM*.root
cd ${TMPDIR} && ${RELVALCMD} QCD dqm 0

QCDPU_dqm:
rm -f ${TMPDIR}/QCDPU/DQM*.root
cd ${TMPDIR} && ${RELVALCMD} QCDPU dqm 0

ZMM_dqm:
rm -f ${TMPDIR}/ZMM/DQM*.root
cd ${TMPDIR} && ${RELVALCMD} ZMM dqm 0

MinBias_dqm:
rm -f ${TMPDIR}/MinBias/DQM*.root
cd ${TMPDIR} && ${RELVALCMD} MinBias dqm 0

NuGunPU_dqm:
rm -f ${TMPDIR}/NuGunPU/DQM*.root
cd ${TMPDIR} && ${RELVALCMD} NuGunPU dqm 0

.PHONY: plots # Enable re-running plots

plots:
rm -Rf plots
python test/compare.py \
--sample FlatQCD_noPU:${TMPDIR}/QCD/${DQM_MC}.root:${TMPDIR}/QCD/${DQM_MC}.root \
--sample FlatQCD_PU25ns:${TMPDIR}/QCDPU/${DQM_MC}.root:${TMPDIR}/QCDPU/${DQM_MC}.root \
--sample NuGunPU:${TMPDIR}/NuGunPU/${DQM_MC}.root:${TMPDIR}/NuGunPU/${DQM_MC}.root \
--doResponsePlots --doOffsetPlots

QCD_plots:
rm -Rf plots
python test/compare.py \
--sample FlatQCD_noPU:${TMPDIR}/QCD/${DQM_MC}.root:${TMPDIR}/QCD/${DQM_MC}.root \
--doResponsePlots --doOffsetPlots

QCDPU_plots:
rm -Rf plots
python test/compare.py \
--sample FlatQCD_PU25ns:${TMPDIR}/QCDPU/${DQM_MC}.root:${TMPDIR}/QCDPU/${DQM_MC}.root \
--doResponsePlots --doOffsetPlots

NuGunPU_plots:
rm -Rf plots
python test/compare.py \
--sample NuGunPU:${TMPDIR}/NuGunPU/${DQM_MC}.root:${TMPDIR}/NuGunPU/${DQM_MC}.root \
--doResponsePlots --doOffsetPlots


plots_with_ref:
rm -Rf plots
python test/compare.py \
--sample FlatQCD_noPU:${TMPDIR}/QCD/${DQM_MC}.root:${TMPDIR}/QCD_ref/${DQM_MC}.root \
--sample FlatQCD_PU25ns:${TMPDIR}/QCDPU/${DQM_MC}.root:${TMPDIR}/QCDPU_ref/${DQM_MC}.root \
--sample NuGunPU:${TMPDIR}/NuGunPU/${DQM_MC}.root:${TMPDIR}/NuGunPU_ref/${DQM_MC}.root \
--doResponsePlots --doOffsetPlots

# --sample MinBias:${TMPDIR}/MinBias/${DQM_MC}.root:${TMPDIR}/MinBias/${DQM_MC}.root \
# --sample ZMM:${TMPDIR}/ZMM/${DQM_MC}.root:${TMPDIR}/ZMM/${DQM_MC}.root \
# --doResponsePlots --doOffsetPlots

170 changes: 170 additions & 0 deletions Validation/RecoParticleFlow/README.md
@@ -0,0 +1,170 @@

# Quickstart

Run locally on lxplus


Set up the work area
for lxplus with SLC7 (default since April 2019)

~~~
export SCRAM_ARCH=slc7_amd64_gcc700
# for SLC6 use 'slc6_amd64_gcc700' instead above
cmsrel CMSSW_10_6_0
cd CMSSW_10_6_0
cmsenv
~~~

Get the code and compile

~~~
git cms-checkout-topic jpata:pfvalidation-10_6_X-master
# 'git cms-rebase-topic jpata:pfvalidation-10_6_X-master' might be better when using 10_6_0_patchX or higher version
scram b -j4
cd $CMSSW_BASE/src/Validation/RecoParticleFlow
~~~

Activate reading files from remote locations and
using dasgoclient for creating filelists in the next step

~~~
voms-proxy-init -voms cms
~~~

Create input file lists under test/tmp/das_cache

(You can modify which datasets are being used in the end of datasets.py script)

~~~
python test/datasets.py
~~~

Proceed to RECO step, about 30 minutes

This is necessary if you need to re-reco events to test introduced changes to PF reco.

Note 1: the default era & condition is now set to 2018. Change CONDITIONS and
ERA in test/run_relval.sh when trying other era, before trying the above commands.

Note 2: the execution will fail if the destination directory (test/tmp/QCD etc.)
already exists. Rename or remove existing conflicting directories from test/tmp.

~~~
make QCD_reco
~~~

Now let's do the DQM step that takes a few minutes

~~~
make QCD_dqm
~~~

Repeat for QCDPU & NuGunPU (make QCDPU_reco, make QCDPU_dqm etc.) or use CRAB
for reco and run dqm steps as indicated below.

Next do final HTML plots (by default this just plots two identical results in
tmp/{QCD,QCDPU,NuGunPU})

You can also edit the 'make plots' part of Makefile for successfully running
'make plots' without all the data samples produced, or use the selective commands
'make QCD_plots', 'make QCDPU_plots' and 'make NuGunPU_plots'

Note: each of the provided plotting commands will first empty and remove the
plots/ -directory, so please save wanted plots somewhere else.

~~~
make plots
~~~

If you have reference DQM results in tmp/QCD_ref, tmp/QCDPU_ref,
tmp/NuGunPU_ref (i.e. reference results) etc under _tmp area, do this instead:

~~~
make plots_with_ref
~~~

The 'plots' directory can be viewed from a web browser once it is moved to e.g. /afs/cern.ch/user/f/foo/www/.
In this case the URL for the directory is 'http://cern.ch/foo/plots', where 'foo' is the username
(This requires that your personal cern web page cern.ch/username is enabled)



# Running via crab


The reco step can also be run via Crab. Prepare CRAB scripts:

~~~
make conf
make dumpconf
cd test/crab
~~~

Initialize CRAB environment if not done already:

~~~
source /cvmfs/cms.cern.ch/crab3/sh.crab
voms-proxy-init -voms cms
cmsenv
~~~

Submit jobs
Note that the datasets to run over are defined in the below script.
Modify the "samples" -list there for changing datasets to process.

~~~
python multicrab.py
~~~

Once the jobs are done, move the step3_inMINIAODSIM root files
from your GRID destination directory to test/tmp/QCD (etc) directory and proceed
with QCD_dqm etc.
Please note that any file matching 'step3\*MINIAODSIM\*.root' will
be included in the DQM step, so delete files you don't want to study.



Note that the default era, condition, and samples are now set to 2018. Change CONDITIONS and ERA in test/run_relval.sh when trying other era, before trying the above commands. Also check (and if necessary, update) input samples and conf.Site.storageSite specified in $CMSSW_BASE/src/Validation/RecoParticleFlow/crab/multicrab.py (default storage site is T2_US_Caltech, but change it to your favorite site you have access to. use crab checkwrite --site=<site> to check your permission).
Take note that the CMSSW python configuration for running the RECO sequence is dumped into `crab/step3_dump.py`.


# Running DQM steps from existing MINIAOD samples

~~~
# For example (default for 2018):
#CONDITIONS=auto:phase1_2017_realistic ERA=Run2_2017 # for 2017 scenarios
CONDITIONS=auto:phase1_2018_realistic ERA=Run2_2018 # for 2018 scenarios
#CONDITIONS=auto:phase2_realistic ERA=Phase2C8_timing_layer_bar # for phase2
#Running with 2 threads allows to use more memory on grid
NTHREADS=2 TMPDIR=tmp
cd $CMSSW_BASE/src/Validation/RecoParticleFlow
make -p tmp/QCD; cd tmp/QCD
#(or
make -p tmp/QCDPU; cd tmp/QCDPU
make -p tmp/NuGunPU; cd tmp/NuGunPU
#)
~~~

# Make a text file for input files. For example:

~~~
dasgoclient --query="file dataset=/RelValQCD_FlatPt_15_3000HS_13/CMSSW_10_6_0-106X_upgrade2018_realistic_v4-v1/MINIAODSIM" > step3_filelist.txt
#(or
dasgoclient --query="file dataset=/RelValQCD_FlatPt_15_3000HS_13/CMSSW_10_6_0-PU25ns_106X_upgrade2018_realistic_v4-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValNuGun/CMSSW_10_6_0-PU25ns_106X_upgrade2018_realistic_v4-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValQCD_Pt-15To7000_Flat_14TeV/CMSSW_10_6_0-106X_upgrade2023_realistic_v2_2023D41noPU-v2/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValQCD_Pt-15To7000_Flat_14TeV/CMSSW_10_6_0-PU25ns_106X_upgrade2023_realistic_v2_2023D41PU200-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValNuGun/CMSSW_10_6_0-PU25ns_106X_upgrade2023_realistic_v2_2023D41PU200-v1/MINIAODSIM" > step3_filelist.txt
or using the list of files from your crab output areas.
#)
cat step3_filelist.txt
cmsDriver.py step5 --conditions $CONDITIONS -s DQM:@pfDQM --datatier DQMIO --nThreads $NTHREADS --era $ERA --eventcontent DQM --filein filelist:step3_filelist.txt --fileout file:step5.root -n -1 >& step5.log &
~~~

# After step5 is completed:
~~~
cmsDriver.py step6 --conditions $CONDITIONS -s HARVESTING:@pfDQM --era $ERA --filetype DQM --filein file:step5.root --fileout file:step6.root >& step6.log &
~~~

1 change: 1 addition & 0 deletions Validation/RecoParticleFlow/bin/BuildFile.xml
Expand Up @@ -10,3 +10,4 @@
<lib name="PlotCompareUtility"/>
<lib name="HistoData"/>
</bin>
<bin name="offsetStack" file="offsetStack.cc"/>

0 comments on commit acc895c

Please sign in to comment.