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

[14_0_X] Backport of 44970 and 45820 (ScoutingNano event content changes for 2024 and T0 scenario for HLTSCOUT datatier) #45950

Merged
merged 7 commits into from
Sep 16, 2024
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 @@ -10,3 +10,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
3 changes: 1 addition & 2 deletions Configuration/DataProcessing/test/run_CfgTest_8.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ 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"
runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --miniaod --nanoaod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias --nanoFlavours=@PHYS"
runTest "${SCRAM_TEST_PATH}/RunPromptReco.py --scenario $scenario --reco --aod --dqmio --global-tag GLOBALTAG --lfn=/store/whatever --alcareco TkAlMinBias+SiStripCalMinBias --PhysicsSkim=@Muon0"
done

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_stage2L1Trigger_2024_cff import stage2L1Trigger_2024
from Configuration.Eras.Modifier_run3_scouting_nanoAOD_post2023_cff import run3_scouting_nanoAOD_post2023

Run3_2024 = cms.ModifierChain(Run3, stage2L1Trigger_2024)
Run3_2024 = cms.ModifierChain(Run3, stage2L1Trigger_2024, 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()
24 changes: 22 additions & 2 deletions Configuration/PyReleaseValidation/python/relval_nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,19 @@ def subnext(self):
steps['NANO_mcScouting13.X']=merge([{'-s':'NANO:@Scout'},
steps['NANO_mc13.3']])


##14.0 INPUT
lumis_Run2024D = {380306: [[28, 273]]}
steps['NANO_data14.0'] = merge([{'--era': 'Run3_2024', '--conditions': 'auto:run3_data_prompt'},
_NANO_data])

steps['ScoutingPFRun32024RAW14.0'] = {'INPUT': InputInfo(location='STD', ls=lumis_Run2024D,
dataSet='/ScoutingPFRun3/Run2024D-v1/HLTSCOUT')}

steps['NANO_dataRun3ScoutingPF14.0']=merge([{'-s': 'NANO:@Scout'},
steps['NANO_data14.0']])


_wfn=WFN(2500)
################
#10.6 input
Expand Down Expand Up @@ -289,8 +302,15 @@ def subnext(self):
_wfn.next()
################
#13.X workflows
workflows[_wfn()] = ['ScoutingNanodata13X',['ScoutingPFRun32022DRAW13.X', 'NANO_dataRun3ScoutingPF13.X']]
workflows[_wfn()] = ['ScoutingNANOdata13X',['ScoutingPFRun32022DRAW13.X', 'NANO_dataRun3ScoutingPF13.X']]
_wfn.subnext()
workflows[_wfn()] = ['ScoutingNanomc13X',['TTBarMINIAOD13.3','NANO_mcScouting13.X']]
workflows[_wfn()] = ['ScoutingNANOmc13X',['TTBarMINIAOD13.3','NANO_mcScouting13.X']]

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

_wfn.next()
################
#14.0 workflows
workflows[_wfn()] = ['ScoutingNANOdata140Xrun3', ['ScoutingPFRun32024RAW14.0', 'NANO_dataRun3ScoutingPF14.0']]

################
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ typedef SimpleFlatTableProducer<Run3ScoutingElectron> SimpleRun3ScoutingElectron
#include "DataFormats/Scouting/interface/Run3ScoutingTrack.h"
typedef SimpleFlatTableProducer<Run3ScoutingTrack> SimpleRun3ScoutingTrackFlatTableProducer;

#include "DataFormats/Scouting/interface/Run3ScoutingPFJet.h"
typedef SimpleFlatTableProducer<Run3ScoutingPFJet> SimpleRun3ScoutingPFJetFlatTableProducer;

#include "FWCore/Framework/interface/MakerMacros.h"
DEFINE_FWK_MODULE(SimpleRun3ScoutingVertexFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingPhotonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingMuonFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingElectronFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimpleRun3ScoutingPFJetFlatTableProducer);
25 changes: 13 additions & 12 deletions PhysicsTools/NanoAOD/python/custom_run3scouting_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@

# common tasks
particleTask = cms.Task(scoutingPFCands)
particleTableTask = cms.Task(particleScoutingTable)
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")
patTriggerScouting = patTrigger.clone(l1tAlgBlkInputTag="gtStage2DigisScouting",l1tExtBlkInputTag="gtStage2DigisScouting")

## L1 objects
from PhysicsTools.NanoAOD.l1trig_cff import *
Expand All @@ -34,22 +40,17 @@
l1TauScoutingTable.variables = cms.PSet(l1TauReducedVars)
l1EtSumScoutingTable.variables = cms.PSet(l1EtSumReducedVars)

selectedPatTriggerScouting = selectedPatTrigger.clone(src="patTriggerScouting")
slimmedPatTriggerScouting = slimmedPatTrigger.clone(src="selectedPatTriggerScouting")
unpackedPatTriggerScouting = unpackedPatTrigger.clone(patTriggerObjectsStandAlone="slimmedPatTriggerScouting")
triggerObjectTableScouting = triggerObjectTable.clone(src="unpackedPatTriggerScouting")

triggerTask = cms.Task(
gtStage2DigisScouting, l1MuScoutingTable, l1EGScoutingTable, l1TauScoutingTable, l1JetScoutingTable, l1EtSumScoutingTable,
unpackedPatTriggerScouting,triggerObjectTableScouting,l1bitsScouting
gtStage2DigisScouting, l1bitsScouting,
l1MuScoutingTable, l1EGScoutingTable, l1TauScoutingTable, l1JetScoutingTable, l1EtSumScoutingTable,
)
triggerSequence = cms.Sequence(L1TRawToDigi+patTriggerScouting+selectedPatTriggerScouting+slimmedPatTriggerScouting+cms.Sequence(triggerTask))
triggerSequence = cms.Sequence(L1TRawToDigi+cms.Sequence(triggerTask))

# MC tasks
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,primaryvertexScoutingTable,displacedvertexScoutingTableTask,jetScoutingTable,rhoScoutingTable,metScoutingTable,particleTask,ak4JetTableTask,ak8JetTableTask)

nanoSequenceCommon = cms.Sequence(triggerSequence,nanoTableTaskCommon)

Expand All @@ -58,4 +59,4 @@
nanoSequenceMC = cms.Sequence(nanoSequenceCommon + cms.Sequence(cms.Task(genJetTask,puTask)))

def nanoAOD_customizeCommon(process):
return process
return process
Loading