Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
16519bd
updates to run CMSSW_12_0_0_pre6
pallabidas Sep 14, 2021
76145fd
updated instructions for 12_0_0_pre6
pallabidas Sep 14, 2021
cf0ac5e
updating to 12_0_0/V6 config
pallabidas Sep 15, 2021
7ff271d
correct GRun config
pallabidas Sep 16, 2021
271c9cd
V4 HLT config
pallabidas Sep 16, 2021
c3fec5e
v6 HLT config not needed
pallabidas Sep 16, 2021
85bd995
GRun config instruction
pallabidas Sep 16, 2021
a9bbcc6
updated instructions
pallabidas Sep 16, 2021
dcf1e90
correcting config
pallabidas Sep 16, 2021
91b6003
using 12_0_0_GRun_V6 HLT config
pallabidas Sep 24, 2021
39664b7
Adding function to fitJESCs to be able to submit one HTCondor job for…
sparedes Dec 20, 2021
2491ac9
Setup + submission scripts for Dec 2021Run3Winter21_V2 corrections
sparedes Dec 20, 2021
36488aa
Merge pull request #1 from sparedes/dev_winter2021_JESCs
sparedes Dec 20, 2021
c13fa4b
Update readme.md
sparedes Dec 20, 2021
cbff538
fixing conflicts
sparedes Feb 11, 2022
282354a
Merge branch 'pallabidas-run3_12_3_X' into run3_12_3_X to fix merge c…
sparedes Feb 11, 2022
c282fd1
Update readme.md
sparedes Feb 11, 2022
ff9e9f5
Update readme.md
sparedes Feb 11, 2022
af4d66a
Changes for 12_3_X
sparedes Feb 11, 2022
a5707dc
Update readme.md
sparedes Feb 11, 2022
eb98300
updates for python 3
sparedes Feb 16, 2022
4e408cf
Merge branch 'run3_12_3_X' of github.com:sparedes/JMETriggerAnalysis …
sparedes Feb 16, 2022
9db8e87
update readme: version of JetMETAnalysis
sparedes Feb 16, 2022
3950291
Merge pull request #3 from pallabidas/run3_12_4_X
sparedes Jun 8, 2022
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
111,271 changes: 111,271 additions & 0 deletions Common/python/configs/HLT_dev_CMSSW_12_0_0_GRun_V6_configDump.py

Large diffs are not rendered by default.

86 changes: 75 additions & 11 deletions JESCorrections/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,43 @@ for the jets used in the High-Level Trigger (HLT).

Instructions to set up the CMSSW area to produce JRA NTuples, and derive JESCs:
```
scram project CMSSW_12_0_0_pre4
cd CMSSW_12_0_0_pre4/src
eval `scram runtime -sh`
git cms-merge-topic missirol:devel_hltRun3TRK_1200pre4
cmsrel CMSSW_12_3_0_pre4
cd CMSSW_12_3_0_pre4/src
cmsenv
git clone [email protected]:sparedes/JMETriggerAnalysis.git -o sparedes -b run3_12_3_X
git clone [email protected]:sparedes/JetMETAnalysis.git -o sparedes -b dev_run3

git clone https://github.com/missirol/JetMETAnalysis.git -o missirol -b devel_hlt2
git clone https://github.com/missirol/JMETriggerAnalysis.git -o missirol -b run3
scram b -j 8
# PFHC: preliminary HLT-PFHC for Run-3
cp /afs/cern.ch/work/p/pdas/public/run3/PFHC_Run3Winter21_HLT_V3.db JMETriggerAnalysis/NTuplizers/test/

scram b -j 12
```

#### Produce JRA NTuples with HLT Jets
First test your setup locally:
```bash
# First make your way to the 'test' directory
cd JMETriggerAnalysis/JESCorrections/test/
cmsRun jescJRA_cfg.py maxEvents=1000 output=test_jra_step.root
```
Note: You might want to double check that what is set in the `jescJRA_cfg.py`, such as the `.root` file matches the sample you want to use, or that the `.db` file of the PFHCs is up-to-date.

* How to run the JRA step locally and with crab
* Which samples to use, how to find them in DAS
* What to do if a sample is not available at a Tier-2 (transfer request, Rucio rule)
If the test runs sucessfuly, you can then inspect the output root file `test_jra_step.root` and make sure the contents are as expected.

Once all looks good you can submit your crab jobs.
```bash
crab submit -c crab/my_crab_submission_file.py
```
Note: You might need to change the line where the `.db` file of the PFHCs is picked up so that CRAB can find the file.

Once the crab jobs are finished, the output `.root` files can be found in the Tier2 (T2) specified in the configuration file,
and then transferred over to `eos` for the next steps.

**Note** that in order to run the ntuple-making process on CRAB, there needs to be a copy of them on **a** T2. You can request to transfer them to your local T2 by requesting it through `rucio` (find more info in the [CMS Rucio Twiki](https://twiki.cern.ch/twiki/bin/viewauth/CMS/Rucio)):
```bash
rucio add-rule cms:/QCD_Pt-15to7000_TuneCP5_Flat_14TeV_pythia8/Run3Winter20DRMiniAOD-FlatPU0to80_110X_mcRun3_2021_realistic_v6_ext1-v1/GEN-SIM-RAW 1 T2_BE_IIHE --asynchronous --ask-approval --lifetime 5184000
```
replacing the necessary dataset name, T2 name, lifetime, etc.

#### Derive Jet Energy Scale Corrections from JRA NTuples

Expand All @@ -37,8 +59,48 @@ The `fitJESCs` script is an example of
a wrapper executing the various steps of the JESCs derivation
(caveat: the script presently includes several hard-coded parameters).

List of Run-3 HLT JESCs:
##### Run on HTCondor
The `-b` and `-j` flags can be used to run one HTCondor job for each jet collection's correction (see the submission script `test/sub_jecs.htc` for an example).

##### Sample information
The necessary samples are large QCD simulated datasets with a flat p<sub>T</sub> over a large range.
The `L1` correction needs to match jets from samples generated with and without pileup, so we will need to produce two JRANtuples.
The samples used for the latest run 3 preliminary JECs are the following:
```
# FlatPU
/QCD_Pt-15to7000_TuneCP5_Flat_14TeV_pythia8/Run3Winter20DRMiniAOD-FlatPU0to80_110X_mcRun3_2021_realistic_v6_ext1-v1/GEN-SIM-RAW
# NoPU
QCD_Pt-15to7000_TuneCP5_Flat_14TeV_pythia8/Run3Winter20DRMiniAOD-NoPU_110X_mcRun3_2021_realistic_v6_ext1-v1/GEN-SIM-RAW
```
You can find them in DAS searching for:
```
dataset=/QCD_Pt-15to7000_TuneCP5_Flat_14TeV_pythia8/Run3Winter20DRMiniAOD-*0to80_110X_mcRun3_2021_realistic_v6_ext1-v1/GEN-SIM-RAW
```
You can also find similar samples doing something like:
```
dataset=/QCD*_Pt*/*/GEN-SIM*RAW
```

##### List of Run-3 HLT JESCs:

* `Run3Winter21_V2_MC`:

- Description: preliminary HLT JESCs for Run-3 studies

- Tag of `sparedes/JMETriggerAnalysis`: `HLT_JESCs_Run3Winter21_V2`

- Tag of `sparedes/JetMETAnalysis`: `Run3Winter21_V2`

- JRA NTuples:
```
root://cms-xrd-global.cern.ch//store/group/phys_jetmet/saparede/runIII_hlt_jec/jra_ntuples/jescs_dec_PFHC_E2to500_noPU.root
root://cms-xrd-global.cern.ch//store/group/phys_jetmet/saparede/runIII_hlt_jec/jra_ntuples/jecs_dec_PFHC_E2to500_flatPU.root
```

- executable for JESCs fits (contains settings of all JESCs fits):
[`JESCorrections/test/fitJESCs`](https://github.com/sparedes/JMETriggerAnalysis/blob/HLT_JESCs_Run3Winter21_V2/JESCorrections/test/fitJESCs)


* `Run3Winter20_V2_MC`:

- Description: preliminary HLT JESCs for Run-3 studies
Expand All @@ -61,3 +123,5 @@ List of Run-3 HLT JESCs:
- JRA NTuples affected by a bug in the `rho` value saved for Calo and PFCluster (AK4 and AK8) HLT jets:
the `rho` based on PF-candidates was erronously used,
instead of the `rho` values calculated from calo-towers and PFClusters, respectively.


38 changes: 38 additions & 0 deletions JESCorrections/test/crab/sub_Run3Winter21_FlatPU.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from CRABClient.UserUtilities import config

sample_name = 'flatPU_Run3Winter21_E2to500_take7'

RAW_DSET = '/QCD_Pt15to7000_TuneCP5_14TeV-pythia8/Run3Winter21DRMiniAOD-FlatPU0to80FEVT_castor_112X_mcRun3_2021_realistic_v16-v2/GEN-SIM-DIGI-RAW'

config = config()

config.section_('General')
config.General.requestName = 'jmeTriggerNTuple_'+sample_name
config.General.transferOutputs = True
config.General.transferLogs = False

config.section_('JobType')
config.JobType.pluginName = 'Analysis'
config.JobType.psetName = 'jescJRA_cfg.py'
config.JobType.inputFiles = []
config.JobType.pyCfgParams = ['output='+sample_name+'.root']
config.JobType.maxMemoryMB = 2500
config.JobType.inputFiles = ['PFHC_Run3Winter21_E2to500.db']
config.JobType.allowUndistributedCMSSW = True

config.section_('Data')
config.Data.publication = False
config.Data.ignoreLocality = False
config.Data.splitting = 'Automatic'
config.Data.inputDataset = RAW_DSET
config.Data.outLFNDirBase = '/store/user/saparede/hlt_runIII_jesc_oct/crab_out/'+sample_name
config.Data.unitsPerJob = 2700
config.Data.totalUnits = -1

config.section_('Site')
config.Site.storageSite = 'T2_BE_IIHE'
if config.Data.ignoreLocality:
config.Site.whitelist = ['T2_CH_CERN', 'T2_DE_*']

config.section_('User')

38 changes: 38 additions & 0 deletions JESCorrections/test/crab/sub_Run3Winter21_NoPU.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from CRABClient.UserUtilities import config

sample_name = 'noPU_Run3Winter21_E2to500_take7'

RAW_DSET = '/QCD_Pt15to7000_TuneCP5_14TeV-pythia8/Run3Winter21DRMiniAOD-NoPUFEVT_castor_112X_mcRun3_2021_realistic_v16-v2/GEN-SIM-DIGI-RAW'

config = config()

config.section_('General')
config.General.requestName = 'jmeTriggerNTuple_'+sample_name
config.General.transferOutputs = True
config.General.transferLogs = False

config.section_('JobType')
config.JobType.pluginName = 'Analysis'
config.JobType.psetName = 'jescJRA_cfg.py'
config.JobType.inputFiles = []
config.JobType.pyCfgParams = ['output='+sample_name+'.root']
config.JobType.maxMemoryMB = 2500
config.JobType.inputFiles = ['PFHC_Run3Winter21_E2to500.db']
config.JobType.allowUndistributedCMSSW = True

config.section_('Data')
config.Data.publication = False
config.Data.ignoreLocality = False
config.Data.splitting = 'Automatic'
config.Data.inputDataset = RAW_DSET
config.Data.outLFNDirBase = '/store/user/saparede/hlt_runIII_jesc_oct/crab_out/'+sample_name
config.Data.unitsPerJob = 2700
config.Data.totalUnits = -1

config.section_('Site')
config.Site.storageSite = 'T2_BE_IIHE'
if config.Data.ignoreLocality:
config.Site.whitelist = ['T2_CH_CERN', 'T2_DE_*']

config.section_('User')

44 changes: 32 additions & 12 deletions JESCorrections/test/fitJESCs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,30 @@ set -euo pipefail
## -------------------------
JESC_BASE=${CMSSW_BASE}/src/JMETriggerAnalysis/JESCorrections/test

JRANTuple_NoPU=root://cms-xrd-global.cern.ch//store/group/phys_jetmet/saparede/runIII_hlt_jec/jra_ntuples/npv_fix_noPU/npvFix_noPU.root
JRANTuple_PU=root://cms-xrd-global.cern.ch//store/group/phys_jetmet/saparede/runIII_hlt_jec/jra_ntuples/npv_fix_flatPU/npvFix_flatPU.root
JRANTuple_NoPU=root://cms-xrd-global.cern.ch//store/group/phys_jetmet/saparede/runIII_hlt_jec/jra_ntuples/jescs_dec_PFHC_E2to500_noPU.root
JRANTuple_PU=root://cms-xrd-global.cern.ch//store/group/phys_jetmet/saparede/runIII_hlt_jec/jra_ntuples/jecs_dec_PFHC_E2to500_flatPU.root

ERA=Run3Winter20_V2_MC

#JET_TYPES=(
# ak4caloHLT
# ak4pfclusterHLT
# ak4pfHLT
# ak4pfchsHLT
# ak4pfpuppiHLT
# ak8caloHLT
# ak8pfclusterHLT
# ak8pfHLT
# ak8pfchsHLT
# ak8pfpuppiHLT
#)
JET_TYPES=(
ak4caloHLT
ak4pfclusterHLT
ak4pfHLT
ak4chsHLT
ak4puppiHLT
ak8caloHLT
ak8pfclusterHLT
ak8pfHLT
ak8chsHLT
ak8puppiHLT
ak8pfchsHLT
ak8pfpuppiHLT
)
## -------------------------
### -------------------------

## -------------------------
## Main
Expand All @@ -46,6 +52,8 @@ Options:
-h, --help Show this help message
-o, --output-dir Path to output directory [Default: .]
-n, --maxEvents Max number of events to process [Default: -1]
-b, --batch-mode Run on batch mode (see htc scritp)[Default: true]
-j, --jet-type Jet name for batch (e.g. ak4pfpuppiHLT)
-p, --parallelise Parallelise by jet algorithm [Default: false]
--skip-L1-PFPuppi Skip L1FastJet for PFPuppi jets [Default: false]
-d, --dry-run Enable dry-run mode [Default: false]
Expand All @@ -55,19 +63,30 @@ Options:
maxEvents=-1
paralleliseByAlgo=false
skipL1PFPuppi=false
doBatch=false
batchJetType="dummyJetType"

while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help) showHelpMsg=true; shift;;
-h|-khelp) showHelpMsg=true; shift;;
-j|--jet-type) batchJetType=$2; shift; shift;;
-o|--output-dir) outputDir=$2; shift; shift;;
-n|--maxEvents) maxEvents=$2; shift; shift;;
-p|--parallelise) paralleliseByAlgo=true; shift;;
--skip-L1-PFPuppi) skipL1PFPuppi=true; shift;;
-d|--dry-run) dryRun=true; shift;;
-b|--batch-mode) doBatch=true; shift;;
-j|--jet-type) batchJetType=$2; shift; shift;;
*) printf "%s\n" ">> ERROR -- unrecognised command-line argument: ${1}"; exit 1; shift;;
esac
done

if [ "X$doBatch" = "Xtrue" ]
then
echo "running on batch mode for jet-type $batchJetType"
JET_TYPES=( $batchJetType )
fi

# print help message
if [ "X${showHelpMsg}" = "Xtrue" ]; then
usage
Expand Down Expand Up @@ -100,6 +119,7 @@ runJECWorflowForOneAlgo(){
cd ${OUTDIR}

stepN=0
stepName=""

dRgen=0.2
if [[ ${jetType} == ak8* ]]; then dRgen=0.4; fi
Expand Down
18 changes: 9 additions & 9 deletions JESCorrections/test/jescInspector_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,30 @@
if type(_mod) == cms.OutputModule:
process.__delattr__(_modname)
if opts.verbosity > 0:
print '> removed cms.OutputModule:', _modname
print('> removed cms.OutputModule:', _modname)

# remove cms.EndPath objects from HLT config-dump
for _modname in process.endpaths_():
_mod = getattr(process, _modname)
if type(_mod) == cms.EndPath:
process.__delattr__(_modname)
if opts.verbosity > 0:
print '> removed cms.EndPath:', _modname
print('> removed cms.EndPath:', _modname)

# remove selected cms.Path objects from HLT config-dump
print '-'*108
print '{:<99} | {:<4} |'.format('cms.Path', 'keep')
print '-'*108
print('-'*108)
print('{:<99} | {:<4} |'.format('cms.Path', 'keep'))
print('-'*108)
for _modname in sorted(process.paths_()):
_keepPath = _modname.startswith('MC_') and ('Jets' in _modname or 'MET' in _modname or 'AK8Calo' in _modname)
if _keepPath:
print '{:<99} | {:<4} |'.format(_modname, '+')
print('{:<99} | {:<4} |'.format(_modname, '+'))
continue
_mod = getattr(process, _modname)
if type(_mod) == cms.Path:
process.__delattr__(_modname)
print '{:<99} | {:<4} |'.format(_modname, '')
print '-'*108
print('{:<99} | {:<4} |'.format(_modname, ''))
print('-'*108)

# remove FastTimerService
if hasattr(process, 'FastTimerService'):
Expand All @@ -119,7 +119,7 @@
###

## customised JME collections
from JMETriggerAnalysis.Common.customise_hlt import *
from JMETriggerAnalysis.Common.customise_hlt import addPaths_MC_JMEPFCluster, addPaths_MC_JMEPFPuppi
process = addPaths_MC_JMEPFCluster(process)
process = addPaths_MC_JMEPFPuppi(process)

Expand Down
Loading