Skip to content

Commit a8ffdd8

Browse files
authored
Merge pull request #50886 from smuzaffar/sync-fastpu-changes
Sync FASTPU_X changes in to main CMSSW
2 parents 2e4c8ee + 7be8e1b commit a8ffdd8

41 files changed

Lines changed: 677 additions & 299 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
fastSimPU = cms.Modifier()

Configuration/PyReleaseValidation/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ The offsets currently in use are:
101101
* 0.634: ECAL phase2 Trigger Primitive + component-method based digis
102102
* 0.635: ECAL phase2 Trigger Primitive + component-method based finely-sampled waveforms
103103
* 0.91: Track DNN modifier
104+
* 0.95: Hybrid PU (FullSim signal + FastSim PU) stage2
105+
* 0.96: Hybrid PU (FullSim signal + FastSim PU) stage1+stage2
104106
* 0.97: Premixing stage1
105107
* 0.98: Premixing stage2
106108
* 0.99: Premixing stage1+stage2

Configuration/PyReleaseValidation/python/WorkFlowRunner.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ def closeCmd(i,ID):
232232
if self.noRun:
233233
cmd +=' --no_exec'
234234
# in case previous step used DAS query (either filelist of das:)
235-
# not to be applied for premixing stage1 to allow combiend stage1+stage2 workflow
236-
if inFile and not 'premix_stage1' in cmd:
235+
# not to be applied for premixing stage1 to allow combined stage1+stage2 workflow
236+
# & similar for HybridPU combined workflow
237+
if inFile and not 'premix_stage1' in cmd and not 'FASTSIM' in cmd:
237238
cmd += ' --filein '+inFile
238239
inFile=None
239240
if lumiRangeFile: #DAS query can also restrict lumi range
@@ -246,12 +247,13 @@ def closeCmd(i,ID):
246247
else:
247248
# Disable input for premix stage1 to allow combined stage1+stage2 workflow
248249
# Disable input for premix stage2 in FastSim to allow combined stage1+stage2 workflow (in FS, stage2 does also GEN)
250+
# & similar for HybridPU combined workflow
249251
# Ugly hack but works
250252
extension = '.root'
251253
if '--rntuple_out' in cmd:
252254
extension = '.rntpl'
253255
outputExtensionForStep[istep] = extension
254-
if istep!=1 and not '--filein' in cmd and not 'premix_stage1' in cmd and not ("--fast" in cmd and "premix_stage2" in cmd):
256+
if istep!=1 and not '--filein' in cmd and not 'premix_stage1' in cmd and not ("--fast" in cmd and "premix_stage2" in cmd) and not 'FASTSIM' in cmd:
255257
steps = cmd.split("-s ")[1].split(" ")[0] ## relying on the syntax: cmsDriver -s STEPS --otherFlags
256258
if "ALCA" not in steps:
257259
cmd+=' --filein file:step%s%s '%(istep-1,outputExtensionForStep[istep-1])

Configuration/PyReleaseValidation/python/relval_steps.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5233,6 +5233,14 @@ def gen2024HiMix(fragment,howMuch):
52335233
steps[k+'INPUT']={'INPUT':InputInfo(dataSet='/RelVal'+info.dataset+'/%s/GEN-SIM'%(baseDataSetReleaseBetter[s],),location='STD')}
52345234
else: #For FastSim to recycle GEN
52355235
steps[k+'INPUT']={'INPUT':InputInfo(dataSet='/RelVal'+info.dataset+'/%s/GEN'%(baseDataSetReleaseBetter[s],),location='STD')}
5236+
# this condition is checked here to avoid skipping the creation of default steps for other fragments
5237+
if 'HybridPU' in step:
5238+
# minbias fastsim for PU mixing
5239+
if not 'MinBias_14TeV' in frag:
5240+
continue
5241+
stepKey = 'HYBRID_'+key+'_'+step
5242+
howMuch = Kby(100,100)
5243+
steps[stepKey]=merge([ {'--evt_type':frag},howMuch,upgradeStepDict[step][key]])
52365244
else:
52375245
for key in [key for year in upgradeKeys for key in upgradeKeys[year]]:
52385246
k=step+'_'+key

Configuration/PyReleaseValidation/python/relval_upgrade.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ def notForGenOnly(key,specialType):
8080
if 'S2' in specialType: stepList[specialType].append(stepMade)
8181
# replace for s1
8282
else: stepList[specialType][-1] = stepMade
83+
# similar hack for fastpu
84+
if 'HybridPU' in specialType:
85+
if 'GenSim' in step:
86+
s = step.replace('GenSim','GenSimFS')+'PU' # later processing requires to have PU here
87+
if step in specialWF.PU:
88+
stepMade = stepMaker(key,'HYBRID',s,specialWF.suffix)
89+
# append for combined
90+
if 'S2' in specialType: stepList[specialType].append(stepMade)
8391
else:
8492
stepList[specialType].append(stepMaker(key,frag[:-4],step,''))
8593
for specialType,specialWF in upgradeWFs.items():

Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3171,6 +3171,82 @@ def condition(self, fragment, stepList, key, hasHarvest):
31713171
offset = 0.9921,
31723172
)
31733173

3174+
class UpgradeWorkflowHybridPU(UpgradeWorkflow):
3175+
def setup_(self, step, stepName, stepDict, k, properties):
3176+
# just copy steps
3177+
stepDict[stepName][k] = merge([stepDict[step][k]])
3178+
def setupPU_(self, step, stepName, stepDict, k, properties):
3179+
# make new step for S1
3180+
# this gets inserted in relval_upgrade.py
3181+
if "GenSim" in stepName:
3182+
# go back to non-PU step version
3183+
d = merge([stepDict[self.getStepName(step)][k]])
3184+
stepNameS1 = stepName.replace('GenSim','GenSimFS')
3185+
if not stepNameS1 in stepDict: stepDict[stepNameS1] = {}
3186+
stepDict[stepNameS1][k] = merge([{
3187+
'--fast': '',
3188+
'--era': stepDict[stepName][k]['--era']+'_FastSim',
3189+
'--eventcontent': 'FASTPU',
3190+
'--processName': 'FASTSIM',
3191+
}, d])
3192+
else:
3193+
# include modifier in all subsequent steps in case any of them use PU replay
3194+
if "--procModifiers" in stepDict[stepName][k]:
3195+
stepDict[stepName][k]["--procModifiers"] += ",fastSimPU"
3196+
else:
3197+
stepDict[stepName][k]["--procModifiers"] = "fastSimPU"
3198+
3199+
if "Digi" in stepName:
3200+
stepDict[stepName][k] = merge([digiPremixLocalPileup, stepDict[stepName][k]])
3201+
elif 'S1S2' in self.suffix:
3202+
# increment inputs for subsequent steps in combined case
3203+
# also reset pileup input
3204+
digiPremixLocalPileupTmp = deepcopy(digiPremixLocalPileup)
3205+
filein = stepDict[stepName][k].get("--filein","")
3206+
m = re.search("step(?P<ind>\\d+)", filein)
3207+
if m:
3208+
digiPremixLocalPileupTmp['--filein'] = filein.replace(m.group(), "step%d"%(int(m.group("ind"))+1))
3209+
else:
3210+
digiPremixLocalPileupTmp.pop('--filein')
3211+
stepDict[stepName][k] = merge([digiPremixLocalPileupTmp, stepDict[stepName][k]])
3212+
def condition(self, fragment, stepList, key, hasHarvest):
3213+
return (fragment=='TTbar_14TeV' and 'PU' in key and key.startswith('202') and not 'FS' in key)
3214+
# stage1 is just FastSim MinBias, no separate workflow needed
3215+
# HybridPU stage2
3216+
upgradeWFs['HybridPUS2'] = UpgradeWorkflowHybridPU(
3217+
steps = [],
3218+
PU = [
3219+
'Digi',
3220+
'DigiTrigger',
3221+
],
3222+
suffix = '_HybridPUS2',
3223+
offset = 0.95,
3224+
)
3225+
# HybridPU combined stage1+stage2
3226+
upgradeWFs['HybridPUS1S2'] = UpgradeWorkflowHybridPU(
3227+
steps = [],
3228+
PU = [
3229+
'GenSim',
3230+
'GenSimHLBeamSpot',
3231+
'GenSimHLBeamSpot14',
3232+
'Digi',
3233+
'DigiTrigger',
3234+
'RecoLocal',
3235+
'Reco',
3236+
'RecoFakeHLT',
3237+
'RecoGlobal',
3238+
'RecoGlobalFakeHLT',
3239+
'RecoNano',
3240+
'RecoNanoFakeHLT',
3241+
'Nano',
3242+
'HARVESTNano',
3243+
'HARVESTNanoFakeHLT',
3244+
'ALCA',
3245+
],
3246+
suffix = '_HybridPUS1S2',
3247+
offset = 0.96,
3248+
)
3249+
31743250
class UpgradeWorkflow_Run3FStrackingOnly(UpgradeWorkflow):
31753251
def setup_(self, step, stepName, stepDict, k, properties):
31763252
if 'HARVESTFastRun3' in step:

SimCalorimetry/EcalSimProducers/interface/EcalDigiProducer.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
#include "SimDataFormats/CaloHit/interface/PCaloHit.h"
4747
#include <vector>
4848

49-
typedef EcalTDigitizer<EBDigitizerTraits> EBDigitizer;
50-
typedef EcalTDigitizer<EEDigitizerTraits> EEDigitizer;
51-
typedef CaloTDigitizer<ESOldDigitizerTraits> ESOldDigitizer;
49+
using EBDigitizer = EcalTDigitizer<EBDigitizerTraits>;
50+
using EEDigitizer = EcalTDigitizer<EEDigitizerTraits>;
51+
using ESOldDigitizer = CaloTDigitizer<ESOldDigitizerTraits>;
5252

5353
class ESDigitizer;
5454

@@ -99,7 +99,7 @@ class EcalDigiProducer : public DigiAccumulatorMixMod {
9999
virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const {}
100100
virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const {}
101101

102-
typedef edm::Handle<std::vector<PCaloHit>> HitsHandle;
102+
using HitsHandle = edm::Handle<std::vector<PCaloHit>>;
103103
void accumulateCaloHits(HitsHandle const &ebHandle,
104104
HitsHandle const &eeHandle,
105105
HitsHandle const &esHandle,
@@ -121,10 +121,10 @@ class EcalDigiProducer : public DigiAccumulatorMixMod {
121121
const std::string m_EEdigiCollection;
122122
const std::string m_ESdigiCollection;
123123
const std::string m_hitsProducerTag;
124-
125-
const edm::EDGetTokenT<std::vector<PCaloHit>> m_HitsEBToken_;
126-
const edm::EDGetTokenT<std::vector<PCaloHit>> m_HitsEEToken_;
127-
const edm::EDGetTokenT<std::vector<PCaloHit>> m_HitsESToken_;
124+
const std::string m_hitsProducerTagPU;
125+
edm::EDGetTokenT<std::vector<PCaloHit>> m_HitsEBToken_;
126+
edm::EDGetTokenT<std::vector<PCaloHit>> m_HitsEEToken_;
127+
edm::EDGetTokenT<std::vector<PCaloHit>> m_HitsESToken_;
128128

129129
const edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> m_pedestalsToken;
130130
const edm::ESGetToken<EcalIntercalibConstantsMC, EcalIntercalibConstantsMCRcd> m_icalToken;
@@ -188,9 +188,9 @@ class EcalDigiProducer : public DigiAccumulatorMixMod {
188188
std::unique_ptr<EBDigitizer> m_BarrelDigitizer;
189189
std::unique_ptr<EEDigitizer> m_EndcapDigitizer;
190190

191-
typedef CaloTSamples<float, 10> EcalSamples;
191+
using EcalSamples = CaloTSamples<float, 10>;
192192

193-
typedef EcalElectronicsSim<EcalCoder, EcalSamples, EcalDataFrame> EcalElectronicsSim_Ph1;
193+
using EcalElectronicsSim_Ph1 = EcalElectronicsSim<EcalCoder, EcalSamples, EcalDataFrame>;
194194
std::unique_ptr<EcalElectronicsSim_Ph1> m_ElectronicsSim;
195195
std::unique_ptr<EcalCoder> m_Coder;
196196

0 commit comments

Comments
 (0)