Skip to content

Commit

Permalink
Merge pull request #44970 from patinkaew/scouting_nano_test_14_1_X_20…
Browse files Browse the repository at this point in the history
…24-05-13-2300

Add ScoutingMuonNoVtx and ScoutingMuonVtx in Run3Scouting Nano starting from 2024 data taking
  • Loading branch information
cmsbuild authored Jul 29, 2024
2 parents 0316a66 + bf4bc36 commit 5ef98be
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 4 deletions.
104 changes: 104 additions & 0 deletions Configuration/DataProcessing/python/Impl/hltScouting.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/env python3
"""
_hltScouting_
Scenario supporting proton collisions with input HLT scouting data
"""

from __future__ import print_function

import os
import sys

from Configuration.DataProcessing.Scenario import *
from Configuration.DataProcessing.Utils import stepSKIMPRODUCER, addMonitoring, dictIO, nanoFlavours, gtNameAndConnect
import FWCore.ParameterSet.Config as cms

import warnings

class hltScouting(Scenario):
def __init__(self):
Scenario.__init__(self)
self.recoSeq = ''
self.cbSc = 'pp'
self.isRepacked = False
self.promptCustoms = ['Configuration/DataProcessing/RecoTLR.customisePrompt']
self.promptModifiers = cms.ModifierChain()
"""
_hltScouting_
Implement configuration building for data processing for proton
collision data taking with input HLT scouting data
"""

def promptReco(self, globalTag, **args):
"""
_promptReco_
Proton collision data taking prompt reco with input HLT scouting data
"""

options = Options()
options.__dict__.update(defaultOptions.__dict__)
options.scenario = self.cbSc

if 'nThreads' in args:
options.nThreads = args['nThreads']

PhysicsSkimStep = ''
if 'PhysicsSkims' in args:
PhysicsSkimStep = stepSKIMPRODUCER(args['PhysicsSkims'])

miniAODStep = ''
nanoAODStep = ''

if 'outputs' in args:
outputs = []
for a in args['outputs']:
if a['dataTier'] in ['NANOAOD', 'NANOEDMAOD']:
if 'nanoFlavours' in args:
for nanoFlavour in args['nanoFlavours']:
if nanoFlavour != '@Scout':
warnings.warn('nanoFlavour: ' + nanoFlavour + 'is currently not supported and will be removed from outputs. Only supported nanoFlavour is @Scout')
args['nanoFlavours'] = ['@Scout']
nanoAODStep = ',NANO' + nanoFlavours(args['nanoFlavours'])
else:
nanoAODStep = ',NANO:@Scout' # default to Scouting NANO
outputs.append(a)
else:
warnings.warn('dataTier:' + str(a['dataTier']) + ' is currently not supported and will be removed from outputs')
if {output['dataTier'] for output in outputs} != {a['dataTier'] for a in args['outputs']}:
warnings.warn('The outputs will be changed from ' + str(args['outputs']) + ' to' + str(outputs))
args['outputs'] = outputs

if not 'customs' in args:
args['customs'] = []

for c in self.promptCustoms:
args['customs'].append(c)
options.customisation_file = args['customs']

options.isRepacked = args.get('repacked', self.isRepacked)

options.step = ''
options.step += self.recoSeq + PhysicsSkimStep
options.step += miniAODStep + nanoAODStep

dictIO(options, args)
options.conditions = gtNameAndConnect(globalTag, args)

process = cms.Process('HLTSCOUT', cms.ModifierChain(self.eras, self.promptModifiers))
cb = ConfigBuilder(options, process = process, with_output = True)

# Input source
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring()
)

cb.prepare()

addMonitoring(process)

return process
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""
_hltScoutingEra_Run3_2024_
Scenario supporting proton collisions with input HLT scouting data for 2024
"""

import os
import sys

from Configuration.Eras.Era_Run3_2024_cff import Run3_2024
from Configuration.DataProcessing.Impl.hltScouting import hltScouting

class hltScoutingEra_Run3_2024(hltScouting):
def __init__(self):
hltScouting.__init__(self)
self.recoSeq = ''
self.cbSc = 'pp'
self.eras = Run3_2024
self.promptCustoms += ['Configuration/DataProcessing/RecoTLR.customisePostEra_Run3_2024']
"""
_hltScoutingEra_Run3_2024_
Implement configuration building for data processing for proton
collision data taking with input HLT scouting data for Era_Run3_2024
"""
1 change: 1 addition & 0 deletions Configuration/DataProcessing/test/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
<test name="TestConfigDP_10" command="run_CfgTest_10.sh"/>
<test name="TestConfigDP_11" command="run_CfgTest_11.sh"/>
<test name="TestConfigDP_12" command="run_CfgTest_12.sh"/>
<test name="TestConfigDP_13" command="run_CfgTest_13.sh"/>
17 changes: 17 additions & 0 deletions Configuration/DataProcessing/test/run_CfgTest_13.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Test suite for various ConfigDP scenarios
# run using: scram build runtests
# feel free to contribute with your favourite configuration


# Pass in name and status
function die { echo $1: status $2 ; exit $2; }

function runTest { echo $1 ; python3 $1 || die "Failure for configuration: $1" $?; }

declare -a arr=("hltScoutingEra_Run3_2024")
for scenario in "${arr[@]}"
do
runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --nanoaod --global-tag GLOBALTAG --lfn=/store/whatever --nanoFlavours=@Scout"
done
2 changes: 1 addition & 1 deletion Configuration/DataProcessing/test/run_CfgTest_8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function die { echo $1: status $2 ; exit $2; }

function runTest { echo $1 ; python3 $1 || die "Failure for configuration: $1" $?; }

declare -a arr=("ppEra_Run3" "ppEra_Run3_2023" "ppEra_Run3_2023_repacked" "ppEra_Run3_2024")
declare -a arr=("ppEra_Run3" "ppEra_Run3_2023" "ppEra_Run3_2023_repacked" "ppEra_Run3_2024" "hltScoutingEra_Run3_2024")
for scenario in "${arr[@]}"
do
runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --miniaod --nanoaod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias"
Expand Down
3 changes: 2 additions & 1 deletion Configuration/Eras/python/Era_Run3_2024_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

from Configuration.Eras.Era_Run3_cff import Run3
from Configuration.Eras.Modifier_run3_2024_L1T_cff import run3_2024_L1T
from Configuration.Eras.Modifier_run3_scouting_nanoAOD_post2023_cff import run3_scouting_nanoAOD_post2023

Run3_2024 = cms.ModifierChain(Run3, run3_2024_L1T)
Run3_2024 = cms.ModifierChain(Run3, run3_2024_L1T, run3_scouting_nanoAOD_post2023)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import FWCore.ParameterSet.Config as cms

run3_scouting_nanoAOD_post2023 = cms.Modifier()
2 changes: 1 addition & 1 deletion Configuration/PyReleaseValidation/python/relval_nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def subnext(self):
workflows[_wfn()] = ['jmeNANOdata140Xrun3', ['MuonEG2024MINIAOD14.0', 'jmeNANO_data14.0']]
workflows[_wfn()] = ['jmeNANOrePuppidata140Xrun3', ['MuonEG2024MINIAOD14.0', 'jmeNANO_rePuppi_data14.0']]
workflows[_wfn()] = ['lepTrackInfoNANOdata140Xrun3', ['MuonEG2024MINIAOD14.0', 'lepTrackInfoNANO_data14.0']]
# workflows[_wfn()] = ['ScoutingNANOdata140Xrun3', ['ScoutingPFRun32024RAW14.0', 'scoutingNANO_data14.0']]
workflows[_wfn()] = ['ScoutingNANOdata140Xrun3', ['ScoutingPFRun32024RAW14.0', 'scoutingNANO_data14.0']]

# DPG custom NANOs, data
_wfn.subnext()
Expand Down
10 changes: 9 additions & 1 deletion PhysicsTools/NanoAOD/python/custom_run3scouting_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
ak4JetTableTask = cms.Task(ak4ScoutingJets,ak4ScoutingJetParticleNetJetTagInfos,ak4ScoutingJetParticleNetJetTags,ak4ScoutingJetTable)
ak8JetTableTask = cms.Task(ak8ScoutingJets,ak8ScoutingJetsSoftDrop,ak8ScoutingJetsSoftDropMass,ak8ScoutingJetEcfNbeta1,ak8ScoutingJetNjettiness,ak8ScoutingJetParticleNetJetTagInfos,ak8ScoutingJetParticleNetJetTags,ak8ScoutingJetParticleNetMassRegressionJetTags,ak8ScoutingJetTable)

muonScoutingTableTask = cms.Task(muonScoutingTable)
displacedvertexScoutingTableTask = cms.Task(displacedvertexScoutingTable)

# from 2024, there are two scouting muon collections
from Configuration.Eras.Modifier_run3_scouting_nanoAOD_post2023_cff import run3_scouting_nanoAOD_post2023
run3_scouting_nanoAOD_post2023.toReplaceWith(muonScoutingTableTask, cms.Task(muonVtxScoutingTable, muonNoVtxScoutingTable))\
.toReplaceWith(displacedvertexScoutingTableTask, cms.Task(displacedvertexVtxScoutingTable, displacedvertexNoVtxScoutingTable))

## L1 decisions
gtStage2DigisScouting = gtStage2Digis.clone(InputLabel="hltFEDSelectorL1")
l1bitsScouting = l1bits.clone(src="gtStage2DigisScouting")
Expand Down Expand Up @@ -49,7 +57,7 @@
genJetTask = cms.Task(ak4ScoutingJetMatchGen,ak4ScoutingJetExtTable,ak8ScoutingJetMatchGen,ak8ScoutingJetExtTable)
puTask = cms.Task(puTable)

nanoTableTaskCommon = cms.Task(photonScoutingTable,muonScoutingTable,electronScoutingTable,trackScoutingTable,primaryvertexScoutingTable,displacedvertexScoutingTable,rhoScoutingTable,metScoutingTable,particleTask,particleTableTask,ak4JetTableTask,ak8JetTableTask)
nanoTableTaskCommon = cms.Task(photonScoutingTable,muonScoutingTableTask,electronScoutingTable,trackScoutingTable,primaryvertexScoutingTable,displacedvertexScoutingTableTask,rhoScoutingTable,metScoutingTable,particleTask,particleTableTask,ak4JetTableTask,ak8JetTableTask)

nanoSequenceCommon = cms.Sequence(triggerSequence,nanoTableTaskCommon)

Expand Down
26 changes: 26 additions & 0 deletions PhysicsTools/NanoAOD/python/run3scouting_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,32 @@
)
)

# from 2024, there are two scouting muon collections

# muonVtx
muonVtxScoutingTable = muonScoutingTable.clone(
src = cms.InputTag("hltScoutingMuonPackerVtx"),
name = cms.string("ScoutingMuonVtx"),
doc = cms.string("Scouting Muon Vtx information"),
)
displacedvertexVtxScoutingTable = displacedvertexScoutingTable.clone(
src = cms.InputTag("hltScoutingMuonPackerVtx", "displacedVtx"),
name = cms.string("ScoutingMuonVtxDisplacedVertex"),
doc = cms.string("Scouting Muon Vtx DisplacedVertex information"),
)

# muonNoVtx
muonNoVtxScoutingTable = muonScoutingTable.clone(
src = cms.InputTag("hltScoutingMuonPackerNoVtx"),
name = cms.string("ScoutingMuonNoVtx"),
doc = cms.string("Scouting Muon NoVtx information"),
)
displacedvertexNoVtxScoutingTable = displacedvertexScoutingTable.clone(
src = cms.InputTag("hltScoutingMuonPackerNoVtx", "displacedVtx"),
name = cms.string("ScoutingMuonNoVtxDisplacedVertex"),
doc = cms.string("Scouting Muon NoVtx DisplacedVertex information"),
)

################
# Scouting particles

Expand Down

0 comments on commit 5ef98be

Please sign in to comment.