diff --git a/Configuration/Applications/python/ConfigBuilder.py b/Configuration/Applications/python/ConfigBuilder.py index 20bcf0690dbcb..c896f8107043d 100644 --- a/Configuration/Applications/python/ConfigBuilder.py +++ b/Configuration/Applications/python/ConfigBuilder.py @@ -1650,6 +1650,12 @@ def prepare_HLT(self, stepSpec = None): else: self.executeAndRemember('process.loadHltConfiguration("%s",%s)'%(stepSpec.replace(',',':'),optionsForHLTConfig)) else: + # case where HLT:something was provided (most of the cases) + if '+' in stepSpec: + # case where HLT:menu+customisation+customisation+... was provided + # the customiser allows to modify parts of the HLT menu + stepSpec, *hltcustomiser = stepSpec.rsplit('+') + self._options.customisation_file_unsch = hltcustomiser + self._options.customisation_file_unsch self.loadAndRemember('HLTrigger/Configuration/HLT_%s_cff' % stepSpec) if self._options.isMC: diff --git a/Configuration/EventContent/python/EventContent_cff.py b/Configuration/EventContent/python/EventContent_cff.py index 96303dd959a72..e4ef80989db74 100644 --- a/Configuration/EventContent/python/EventContent_cff.py +++ b/Configuration/EventContent/python/EventContent_cff.py @@ -991,3 +991,36 @@ def SwapKeepAndDrop(l): for _entry in [MINIAODEventContent, MINIAODSIMEventContent]: fastSim.toModify(_entry, outputCommands = _entry.outputCommands + fastSimEC.dropPatTrigger) +# Tau Embedding EventContent +from TauAnalysis.MCEmbeddingTools.Embedding_EventContent_cff import ( + TauEmbCleaning, + TauEmbMerge, + TauEmbNano, + TauEmbSelection, + TauEmbSimGen, + TauEmbSimHLT, + TauEmbSimReco, +) + +TauEmbeddingSelectionEventContent = RAWRECOEventContent.clone() +TauEmbeddingSelectionEventContent.outputCommands.extend(TauEmbSelection.outputCommands) + +TauEmbeddingCleaningEventContent = RAWRECOEventContent.clone() +TauEmbeddingCleaningEventContent.outputCommands.extend(TauEmbCleaning.outputCommands) + +TauEmbeddingSimGenEventContent = RAWSIMEventContent.clone() +TauEmbeddingSimGenEventContent.outputCommands.extend(TauEmbSimGen.outputCommands) + +TauEmbeddingSimHLTEventContent = RAWSIMEventContent.clone() +TauEmbeddingSimHLTEventContent.outputCommands.extend(TauEmbSimHLT.outputCommands) + +TauEmbeddingSimRecoEventContent = RAWRECOSIMHLTEventContent.clone() +TauEmbeddingSimRecoEventContent.outputCommands.extend(TauEmbSimReco.outputCommands) + +# needs to have MINIAOD in its name to be recognized by cmsDriver as a MINIAOD output so that miniAOD_customizeOutput is applied +TauEmbeddingMergeMINIAODEventContent = MINIAODSIMEventContent.clone() +TauEmbeddingMergeMINIAODEventContent.outputCommands.extend(TauEmbMerge.outputCommands) + +# needs to have NANOAOD in its name to be recognized by cmsDriver as a NANOAOD output so that NanoAODOutputModule is used +TauEmbeddingNANOAODEventContent = NANOAODSIMEventContent.clone() +TauEmbeddingNANOAODEventContent.outputCommands.extend(TauEmbNano.outputCommands) \ No newline at end of file diff --git a/Configuration/ProcessModifiers/python/tau_embedding_cleaning_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_cleaning_cff.py new file mode 100644 index 0000000000000..fb7bb5700c8ef --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_cleaning_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is to implement general changes in the RECO sequence needed for the tau embedding method. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_cleaning = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_emu_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_emu_cff.py new file mode 100644 index 0000000000000..97b8d4e669ea5 --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_emu_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier sets the correct cuts for the taus decaying into one electron and one muon. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_emu = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_etauh_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_etauh_cff.py new file mode 100644 index 0000000000000..fd0983ac0204c --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_etauh_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier sets the correct cuts for the taus decaying into one jet and one electron. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_etauh = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_merging_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_merging_cff.py new file mode 100644 index 0000000000000..216c6289abf1b --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_merging_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is to implement general changes in the RECO sequence needed for the tau embedding method. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_merging = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_mu_to_e_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_mu_to_e_cff.py new file mode 100644 index 0000000000000..55beabb57a3ba --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_mu_to_e_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is to change tau embedding method to perform mu->e embedding. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_mu_to_e = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_mu_to_mu_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_mu_to_mu_cff.py new file mode 100644 index 0000000000000..f56009611b34b --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_mu_to_mu_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is to change tau embedding method to perform mu->mu embedding. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_mu_to_mu = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_mutauh_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_mutauh_cff.py new file mode 100644 index 0000000000000..3137a950435eb --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_mutauh_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier sets the correct cuts for the taus decaying into one jet and one muon. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_mutauh = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_sim_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_sim_cff.py new file mode 100644 index 0000000000000..8cc83e5eff7f6 --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_sim_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is to implement general changes in the RECO sequence needed for the tau embedding method. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_sim = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/tau_embedding_tauhtauh_cff.py b/Configuration/ProcessModifiers/python/tau_embedding_tauhtauh_cff.py new file mode 100644 index 0000000000000..c46f866c67cfc --- /dev/null +++ b/Configuration/ProcessModifiers/python/tau_embedding_tauhtauh_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier sets the correct cuts for the taus decaying into two jets. More info can be found in TauAnalysis/MCEmbeddingTools. +tau_embedding_tauhtauh = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index cf3ceeb428ab4..bca8fe1de2cab 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -1,5 +1,5 @@ # import the definition of the steps and input files: -from Configuration.PyReleaseValidation.relval_steps import * +from Configuration.PyReleaseValidation.relval_steps import * # here only define the workflows as a combination of the steps defined above: workflows = Matrix() @@ -410,11 +410,15 @@ workflows[136.8862] = ['',['RunEGamma2018Dml2','HLTDR2_2018ml','RECODR2_2018reHLT_skimEGamma_Prompt_L1TEgDQM','HARVEST2018_L1TEgDQM_Prompt']] #### Test of tau embedding on RUN2 data #### -workflows[136.901] = ['', ['RunDoubleMuon2016C', 'TauEmbedding_Selection_2016_HIPM', 'TauEmbedding_Cleaning_2016_HIPM', 'TauEmbedding_GenPreHLT_2016_HIPM', 'TauEmbedding_GenHLT_2016_HIPM', 'TauEmbedding_GenPostHLT_2016_HIPM', 'TauEmbedding_Merging_2016_HIPM']] -workflows[136.902] = ['', ['RunDoubleMuon2016H', 'TauEmbedding_Selection_2016', 'TauEmbedding_Cleaning_2016', 'TauEmbedding_GenPreHLT_2016', 'TauEmbedding_GenHLT_2016', 'TauEmbedding_GenPostHLT_2016', 'TauEmbedding_Merging_2016']] -workflows[136.903] = ['', ['RunDoubleMuon2017B', 'TauEmbedding_Selection_2017', 'TauEmbedding_Cleaning_2017', 'TauEmbedding_GenPreHLT_2017', 'TauEmbedding_GenHLT_2017', 'TauEmbedding_GenPostHLT_2017', 'TauEmbedding_Merging_2017']] -workflows[136.904] = ['', ['RunDoubleMuon2018C', 'TauEmbedding_Selection_2018', 'TauEmbedding_Cleaning_2018', 'TauEmbedding_GenPreHLT_2018', 'TauEmbedding_GenHLT_2018', 'TauEmbedding_GenPostHLT_2018', 'TauEmbedding_Merging_2018']] - +workflows[136.901] = ['', ['RunDoubleMuon2016C', 'TauEmbedding_Selection_2016_HIPM', 'TauEmbedding_Cleaning_2016_HIPM', 'TauEmbedding_GenPreHLT_2016_HIPM', 'TauEmbedding_GenHLT_2016_HIPM', 'TauEmbedding_GenPostHLT_2016_HIPM', 'TauEmbedding_Merging_2016_HIPM', 'TauEmbedding_Nano_2016_HIPM']] +workflows[136.902] = ['', ['RunDoubleMuon2016H', 'TauEmbedding_Selection_2016', 'TauEmbedding_Cleaning_2016', 'TauEmbedding_GenPreHLT_2016', 'TauEmbedding_GenHLT_2016', 'TauEmbedding_GenPostHLT_2016', 'TauEmbedding_Merging_2016', 'TauEmbedding_Nano_2016']] +workflows[136.903] = ['', ['RunDoubleMuon2017B', 'TauEmbedding_Selection_2017', 'TauEmbedding_Cleaning_2017', 'TauEmbedding_GenPreHLT_2017', 'TauEmbedding_GenHLT_2017', 'TauEmbedding_GenPostHLT_2017', 'TauEmbedding_Merging_2017', 'TauEmbedding_Nano_2017']] +workflows[136.904] = ['', ['RunDoubleMuon2018C', 'TauEmbedding_Selection_2018', 'TauEmbedding_Cleaning_2018', 'TauEmbedding_GenPreHLT_2018', 'TauEmbedding_GenHLT_2018', 'TauEmbedding_GenPostHLT_2018', 'TauEmbedding_Merging_2018', 'TauEmbedding_Nano_2018']] +#### Test of tau embedding on RUN3 data #### +workflows[136.905] = ['', ['RunDoubleMuon2022C', 'TauEmbedding_Selection_2022', 'TauEmbedding_Cleaning_2022', 'TauEmbedding_GenPreHLT_2022', 'TauEmbedding_GenHLT_2022', 'TauEmbedding_GenPostHLT_2022', 'TauEmbedding_Merging_2022', 'TauEmbedding_Nano_2022']] +workflows[136.906] = ['', ['RunMuon2022E', 'TauEmbedding_Selection_2022_EE', 'TauEmbedding_Cleaning_2022_EE', 'TauEmbedding_GenPreHLT_2022_EE', 'TauEmbedding_GenHLT_2022_EE', 'TauEmbedding_GenPostHLT_2022_EE', 'TauEmbedding_Merging_2022_EE', 'TauEmbedding_Nano_2022_EE']] +# Input file for 2024 is not there yet, so this will be activated in the future. +# workflows[136.909] = ['', ['RunMuon2024C', 'TauEmbedding_Selection_2024', 'TauEmbedding_Cleaning_2024', 'TauEmbedding_GenPreHLT_2024', 'TauEmbedding_GenHLT_2024', 'TauEmbedding_GenPostHLT_2024', 'TauEmbedding_Merging_2024']] ### run 2021 collisions ### workflows[139.001] = ['RunMinimumBias2021',['RunMinimumBias2021','HLTDR3_2022','RECODR3_reHLT_MinBiasOffline','HARVESTD2021MB_reHLT']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index a03a3e7258f72..e0ee3406f9f26 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -706,46 +706,82 @@ mcTE_2017 = {'--conditions': 'auto:phase1_2017_realistic', '--scenario': 'pp', '--era': 'Run2_2017', '--beamspot': 'Realistic25ns13TeVEarly2017Collision'} dataTE_2018 = {'--conditions': 'auto:run2_data', '--scenario': 'pp', '--era': 'Run2_2018'} mcTE_2018 = {'--conditions': 'auto:phase1_2018_realistic', '--scenario': 'pp', '--era': 'Run2_2018', '--beamspot': 'Realistic25ns13TeVEarly2018Collision'} -embedding_selection = {'-s': 'RAW2DIGI,L1Reco,RECO,PAT', '--datatier': 'FEVT', '--eventcontent': 'FEVT', '--data': ''} -embedding_cleaning = {'-s': 'RAW2DIGI,RECO,PAT', '--data': '', '--eventcontent': 'RAWRECO', '--datatier': 'RAWRECO'} -embedding_genpreHLT = {'cfg': 'TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py', '-s': 'GEN,SIM,DIGI,L1,DIGI2RAW,RAW2DIGI', '--mc': '', '--eventcontent': 'RAWSIM', '--datatier': 'RAWSIM', '--geometry': 'DB:Extended', '--customise': 'TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_preHLT', '--customise_commands': '\"process.generator.nAttempts = cms.uint32(1000)\"'} -embedding_genHLT = {'cfg': 'TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py', '-s': 'HLT:Fake2', '--mc': '','--eventcontent': 'RAWSIM', '--datatier': 'RAWSIM','--geometry': 'DB:Extended', '--customise': 'TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_HLT'} -embedding_genpostHLT = {'cfg': 'TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py', '-s': 'RAW2DIGI,L1Reco,RECO,RECOSIM', '--mc': '', '--eventcontent': 'RAWRECOSIMHLT', '--datatier': 'RAW-RECO-SIM', '--geometry': 'DB:Extended', '--customise': 'TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_postHLT'} -embedding_merge = {'-s': 'PAT', '--data': '', '--eventcontent': 'MINIAODSIM', '--datatier': 'MINIAODSIM', '--customise': 'TauAnalysis/MCEmbeddingTools/customisers.customiseMerging'} +dataTE_2022 = {'--conditions': 'auto:run3_data', '--scenario': 'pp', '--era': 'Run3'} +mcTE_2022 = {'--conditions': 'auto:phase1_2022_realistic', '--scenario': 'pp', '--era': 'Run3', '--beamspot': 'Realistic25ns13p6TeVEarly2022Collision'} +dataTE_2022_EE = {'--conditions': 'auto:run3_data', '--scenario': 'pp', '--era': 'Run3'} +mcTE_2022_EE = {'--conditions': 'auto:phase1_2022_realistic_postEE', '--scenario': 'pp', '--era': 'Run3', '--beamspot': 'Realistic25ns13p6TeVEarly2022Collision'} +dataTE_2024 = {'--conditions': 'auto:run3_data', '--scenario': 'pp', '--era': 'Run3_2024'} +mcTE_2024 = {'--conditions': 'auto:phase1_2024_realistic', '--scenario': 'pp', '--era': 'Run3_2024', '--beamspot': 'DBrealistic'} +embedding_selection = {'-s': 'RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection', '--processName': 'SELECT', '--datatier': 'FEVT', '--eventcontent': 'TauEmbeddingSelection', '--data': ''} +embedding_cleaning = {'-s': 'USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO', '--processName': 'LHEembeddingCLEAN', '--data': '', '--eventcontent': 'TauEmbeddingCleaning', '--datatier': 'RAWRECO', '--procModifiers': 'tau_embedding_cleaning,tau_embedding_mutauh'} +embedding_genpreHLT = {'cfg': 'TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py', '-s': 'GEN,SIM,DIGI,L1,DIGI2RAW,RAW2DIGI', '--processName': 'SIMembeddingpreHLT', '--mc': '', '--eventcontent': 'TauEmbeddingSimGen', '--datatier': 'RAWSIM', '--geometry': 'DB:Extended', '--procModifiers': 'tau_embedding_sim,tau_embedding_mutauh'} +embedding_genHLT = {'-s': 'HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser', '--processName': 'SIMembeddingHLT', '--mc': '','--eventcontent': 'TauEmbeddingSimHLT', '--datatier': 'RAWSIM','--geometry': 'DB:Extended'} +embedding_genpostHLT = {'-s': 'RAW2DIGI,L1Reco,RECO,RECOSIM', '--processName': 'SIMembedding', '--mc': '', '--eventcontent': 'TauEmbeddingSimReco', '--datatier': 'RAW-RECO-SIM', '--geometry': 'DB:Extended', '--procModifiers': 'tau_embedding_sim'} +embedding_merge = {'-s': 'USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT', '--processName': 'MERGE', '--data': '', '--eventcontent': 'TauEmbeddingMergeMINIAOD', '--datatier': 'USER', '--procModifiers': 'tau_embedding_merging'} +embedding_nano = {'-s': 'NANO:@TauEmbedding', '--data': '', '--eventcontent': 'TauEmbeddingNANOAOD', '--datatier': 'NANOAODSIM'} ### Tau Embedding 2016 HIPM ### -steps['TauEmbedding_Selection_2016_HIPM'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting'}, dataTE_2016_HIPM, embedding_selection]) -steps['TauEmbedding_Cleaning_2016_HIPM'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning'}, dataTE_2016_HIPM, embedding_cleaning]) +steps['TauEmbedding_Selection_2016_HIPM'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016'}, dataTE_2016_HIPM, embedding_selection]) +steps['TauEmbedding_Cleaning_2016_HIPM'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016'}, dataTE_2016_HIPM, embedding_cleaning]) steps['TauEmbedding_GenPreHLT_2016_HIPM'] = merge([mcTE_2016_HIPM, embedding_genpreHLT]) steps['TauEmbedding_GenHLT_2016_HIPM'] = merge([mcTE_2016_HIPM, embedding_genHLT]) steps['TauEmbedding_GenPostHLT_2016_HIPM'] = merge([mcTE_2016_HIPM, embedding_genpostHLT]) steps['TauEmbedding_Merging_2016_HIPM'] = merge([dataTE_2016_HIPM, embedding_merge]) +steps['TauEmbedding_Nano_2016_HIPM'] = merge([dataTE_2016_HIPM, embedding_nano]) ### Tau Embedding 2016 ### -steps['TauEmbedding_Selection_2016'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting'}, dataTE_2016, embedding_selection]) -steps['TauEmbedding_Cleaning_2016'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning'}, dataTE_2016, embedding_cleaning]) +steps['TauEmbedding_Selection_2016'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016'}, dataTE_2016, embedding_selection]) +steps['TauEmbedding_Cleaning_2016'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016'}, dataTE_2016, embedding_cleaning]) steps['TauEmbedding_GenPreHLT_2016'] = merge([mcTE_2016, embedding_genpreHLT]) steps['TauEmbedding_GenHLT_2016'] = merge([mcTE_2016, embedding_genHLT]) steps['TauEmbedding_GenPostHLT_2016'] = merge([mcTE_2016, embedding_genpostHLT]) steps['TauEmbedding_Merging_2016'] = merge([dataTE_2016, embedding_merge]) +steps['TauEmbedding_Nano_2016'] = merge([dataTE_2016, embedding_nano]) ### Tau Embedding 2017 ### -steps['TauEmbedding_Selection_2017'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2017,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting'}, dataTE_2017, embedding_selection]) -steps['TauEmbedding_Cleaning_2017'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2017,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning'}, dataTE_2017, embedding_cleaning]) +steps['TauEmbedding_Selection_2017'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2017'}, dataTE_2017, embedding_selection]) +steps['TauEmbedding_Cleaning_2017'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2017'}, dataTE_2017, embedding_cleaning]) steps['TauEmbedding_GenPreHLT_2017'] = merge([mcTE_2017, embedding_genpreHLT]) steps['TauEmbedding_GenHLT_2017'] = merge([mcTE_2017, embedding_genHLT]) steps['TauEmbedding_GenPostHLT_2017'] = merge([mcTE_2017, embedding_genpostHLT]) steps['TauEmbedding_Merging_2017'] = merge([dataTE_2017, embedding_merge]) +steps['TauEmbedding_Nano_2017'] = merge([dataTE_2017, embedding_nano]) ### Tau Embedding 2018 ### -steps['TauEmbedding_Selection_2018'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2018,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting'}, dataTE_2018, embedding_selection]) -steps['TauEmbedding_Cleaning_2018'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2018,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning'}, dataTE_2018, embedding_cleaning]) +steps['TauEmbedding_Selection_2018'] = merge([{'--customise':'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2018'}, dataTE_2018, embedding_selection]) +steps['TauEmbedding_Cleaning_2018'] = merge([{'--customise': 'Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2018'}, dataTE_2018, embedding_cleaning]) steps['TauEmbedding_GenPreHLT_2018'] = merge([mcTE_2018, embedding_genpreHLT]) steps['TauEmbedding_GenHLT_2018'] = merge([mcTE_2018, embedding_genHLT]) steps['TauEmbedding_GenPostHLT_2018'] = merge([mcTE_2018, embedding_genpostHLT]) steps['TauEmbedding_Merging_2018'] = merge([dataTE_2018, embedding_merge]) - - +steps['TauEmbedding_Nano_2018'] = merge([dataTE_2018, embedding_nano]) + +### Tau Embedding 2022 pre EE ### +steps['TauEmbedding_Selection_2022'] = merge([dataTE_2022, embedding_selection]) +steps['TauEmbedding_Cleaning_2022'] = merge([dataTE_2022, embedding_cleaning]) +steps['TauEmbedding_GenPreHLT_2022'] = merge([mcTE_2022, embedding_genpreHLT]) +steps['TauEmbedding_GenHLT_2022'] = merge([mcTE_2022, embedding_genHLT]) +steps['TauEmbedding_GenPostHLT_2022'] = merge([mcTE_2022, embedding_genpostHLT]) +steps['TauEmbedding_Merging_2022'] = merge([dataTE_2022, embedding_merge]) +steps['TauEmbedding_Nano_2022'] = merge([dataTE_2022, embedding_nano]) + +### Tau Embedding 2022 post EE ### +steps['TauEmbedding_Selection_2022_EE'] = merge([dataTE_2022_EE, embedding_selection, {'-n': '200'}]) +steps['TauEmbedding_Cleaning_2022_EE'] = merge([dataTE_2022_EE, embedding_cleaning]) +steps['TauEmbedding_GenPreHLT_2022_EE'] = merge([mcTE_2022_EE, embedding_genpreHLT]) +steps['TauEmbedding_GenHLT_2022_EE'] = merge([mcTE_2022_EE, embedding_genHLT]) +steps['TauEmbedding_GenPostHLT_2022_EE'] = merge([mcTE_2022_EE, embedding_genpostHLT]) +steps['TauEmbedding_Merging_2022_EE'] = merge([dataTE_2022_EE, embedding_merge]) +steps['TauEmbedding_Nano_2022_EE'] = merge([dataTE_2022_EE, embedding_nano]) + +### Tau Embedding 2024 ### +steps['TauEmbedding_Selection_2024'] = merge([dataTE_2024, embedding_selection]) +steps['TauEmbedding_Cleaning_2024'] = merge([dataTE_2024, embedding_cleaning]) +steps['TauEmbedding_GenPreHLT_2024'] = merge([mcTE_2024, embedding_genpreHLT]) +steps['TauEmbedding_GenHLT_2024'] = merge([mcTE_2024, embedding_genHLT]) +steps['TauEmbedding_GenPostHLT_2024'] = merge([mcTE_2024, embedding_genpostHLT]) +steps['TauEmbedding_Merging_2024'] = merge([dataTE_2024, embedding_merge]) +steps['TauEmbedding_Nano_2024'] = merge([dataTE_2024, embedding_nano]) def gen(fragment,howMuch): global step1Defaults diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index c0db9c68197ba..197517771f6ac 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -320,3 +320,12 @@ # reconstruction_woCosmicMuonsTask = cms.Task(localrecoTask,globalrecoTask,highlevelrecoTask,logErrorHarvester) reconstruction_woCosmicMuons = cms.Sequence(reconstruction_woCosmicMuonsTask) + +## +## Modify for the tau embedding methods reco sim step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +_tau_embedding_sim_globalreco_trackingTask = globalreco_trackingTask.copyAndExclude([offlineBeamSpotTask]) +tau_embedding_sim.toReplaceWith(globalreco_trackingTask, _tau_embedding_sim_globalreco_trackingTask) +_tau_embedding_sim_reconstruction_pixelTrackingOnlyTask = reconstruction_pixelTrackingOnlyTask.copyAndExclude([offlineBeamSpotTask]) +tau_embedding_sim.toReplaceWith(reconstruction_pixelTrackingOnlyTask, _tau_embedding_sim_reconstruction_pixelTrackingOnlyTask) \ No newline at end of file diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py index 20d5d739746cb..83009fb1a458d 100644 --- a/IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py +++ b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py @@ -6,3 +6,10 @@ src = "generator:unsmeared", readDB = True ) + +## +## Set the the vertex used for the simulation to the measured vertex for the tau embedding method +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +from TauAnalysis.MCEmbeddingTools.Simulation_GEN_cfi import tau_embedding_vtx_corrected_to_input +tau_embedding_sim.toReplaceWith(VtxSmeared, tau_embedding_vtx_corrected_to_input) \ No newline at end of file diff --git a/PhysicsTools/NanoAOD/python/autoNANO.py b/PhysicsTools/NanoAOD/python/autoNANO.py index ccc4ac843427a..40313e1e19209 100644 --- a/PhysicsTools/NanoAOD/python/autoNANO.py +++ b/PhysicsTools/NanoAOD/python/autoNANO.py @@ -73,4 +73,7 @@ def expandNanoMapping(seqList, mapping, key): # NANOGEN (from MiniAOD) 'GENFromMini': {'sequence': 'PhysicsTools/NanoAOD/nanogen_cff.nanogenSequence', 'customize': 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGENFromMini'}, + # Tau embedding NanoAOD (includes Data as well as MC tables with an addition tau embedding table) + 'TauEmbedding': {'sequence': '@PHYS+PhysicsTools/NanoAOD/nano_cff.nanoSequenceFS+TauAnalysis/MCEmbeddingTools/Nano_cff.embeddingTable_seq', + 'customize': '@PHYS'}, } diff --git a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py index 078e8f2804f60..4a0fef18305f9 100644 --- a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py @@ -51,3 +51,10 @@ ) alpaka.toReplaceWith(hcalGlobalRecoTask, hcalGlobalRecoTask.copyAndAdd(hbherecoSerial)) alpaka.toReplaceWith(hcalOnlyGlobalRecoTask, hcalOnlyGlobalRecoTask.copyAndAdd(hbherecoSerial)) + +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_hbhereco_cleaner +tau_embedding_cleaning.toModify(hbhereco, cpu=tau_embedding_hbhereco_cleaner) \ No newline at end of file diff --git a/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py b/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py index ee7d135f1447d..39e9a86d9f619 100644 --- a/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalLocalRecoNZS_cff.py @@ -40,7 +40,7 @@ hfprerecoMB = RecoLocalCalo.HcalRecProducers.hfprereco_cfi.hfprereco.clone( dropZSmarkedPassed = False ) -_phase1_hfrecoMB = RecoLocalCalo.HcalRecProducers.HFPhase1Reconstructor_cfi.hfreco.clone( +_phase1_hfrecoMB = RecoLocalCalo.HcalRecProducers.HFPhase1Reconstructor_cfi._hfreco.clone( inputLabel = "hfprerecoMB", setNoiseFlags = False, algorithm = dict( diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalPreshowerRecHit_cfi.py b/RecoLocalCalo/EcalRecProducers/python/ecalPreshowerRecHit_cfi.py index efb9d6992fa18..b2be49beadb0b 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalPreshowerRecHit_cfi.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalPreshowerRecHit_cfi.py @@ -7,3 +7,9 @@ algo = cms.string("ESRecHitWorker"), ESRecoAlgo = cms.int32(0) ) +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_ecalPreshowerRecHit_cleaner +tau_embedding_cleaning.toReplaceWith(ecalPreshowerRecHit, tau_embedding_ecalPreshowerRecHit_cleaner) \ No newline at end of file diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalRecHitGPU_cfi.py b/RecoLocalCalo/EcalRecProducers/python/ecalRecHitGPU_cfi.py index 3e60b9e46f248..db04ea9a0a8d3 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalRecHitGPU_cfi.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalRecHitGPU_cfi.py @@ -64,3 +64,9 @@ recoverEEFE = cms.bool(True), ) +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_ecalRecHit_cleaner +tau_embedding_cleaning.toReplaceWith(ecalRecHitGPU, tau_embedding_ecalRecHit_cleaner) \ No newline at end of file diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py index 0ca9b166d9b15..e629d9e153c6f 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py @@ -125,3 +125,9 @@ recoverEEIsolatedChannels = False ) +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_ecalRecHit_cleaner +tau_embedding_cleaning.toReplaceWith(ecalRecHit, tau_embedding_ecalRecHit_cleaner) \ No newline at end of file diff --git a/RecoLocalCalo/HcalRecProducers/python/HFPhase1Reconstructor_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HFPhase1Reconstructor_cfi.py index 4667196efd425..a6fdbdd0a8e7e 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HFPhase1Reconstructor_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HFPhase1Reconstructor_cfi.py @@ -10,7 +10,7 @@ _slopes_S9S1_run2 = [s*c for s, c in zip(_slopes_S9S1_run1, _coeffs)] -hfreco = cms.EDProducer("HFPhase1Reconstructor", +_hfreco = cms.EDProducer("HFPhase1Reconstructor", # Label for the input HFPreRecHitCollection inputLabel = cms.InputTag("hfprereco"), @@ -213,3 +213,11 @@ verboseLevel = cms.untracked.int32(10) # verboseLevel for debugging printouts, should be > 20 to get output ) ) +# Clone the producer, so that the producer can be modified by tau embedding and the original producer can still be cloned by hcalLocalRecoNZS_cff.py +hfreco = _hfreco.clone() +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_hfreco_cleaner +tau_embedding_cleaning.toReplaceWith(hfreco, tau_embedding_hfreco_cleaner) \ No newline at end of file diff --git a/RecoLocalCalo/HcalRecProducers/python/HcalHitReconstructor_ho_cfi.py b/RecoLocalCalo/HcalRecProducers/python/HcalHitReconstructor_ho_cfi.py index 41e7188f6b66d..5f12a853e7713 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HcalHitReconstructor_ho_cfi.py +++ b/RecoLocalCalo/HcalRecProducers/python/HcalHitReconstructor_ho_cfi.py @@ -34,3 +34,9 @@ ) # horeco +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_horeco_cleaner +tau_embedding_cleaning.toReplaceWith(horeco, tau_embedding_horeco_cleaner) \ No newline at end of file diff --git a/RecoLocalMuon/CSCRecHitD/python/cscRecHitD_cfi.py b/RecoLocalMuon/CSCRecHitD/python/cscRecHitD_cfi.py index 915ed1afdaab3..07f4f9376aaa3 100644 --- a/RecoLocalMuon/CSCRecHitD/python/cscRecHitD_cfi.py +++ b/RecoLocalMuon/CSCRecHitD/python/cscRecHitD_cfi.py @@ -73,3 +73,10 @@ run2_common.toModify( csc2DRecHits, readBadChannels = False, CSCUseGasGainCorrections = False ) + +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_csc2DRecHits_cleaner +tau_embedding_cleaning.toReplaceWith(csc2DRecHits, tau_embedding_csc2DRecHits_cleaner) \ No newline at end of file diff --git a/RecoLocalMuon/CSCSegment/python/cscSegments_cfi.py b/RecoLocalMuon/CSCSegment/python/cscSegments_cfi.py index b42fcc812201c..b76c7520b667d 100644 --- a/RecoLocalMuon/CSCSegment/python/cscSegments_cfi.py +++ b/RecoLocalMuon/CSCSegment/python/cscSegments_cfi.py @@ -33,3 +33,9 @@ ) +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_cscSegments_cleaner +tau_embedding_cleaning.toReplaceWith(cscSegments, tau_embedding_cscSegments_cleaner) \ No newline at end of file diff --git a/RecoLocalMuon/DTRecHit/python/dt1DRecHits_LinearDriftFromDB_cfi.py b/RecoLocalMuon/DTRecHit/python/dt1DRecHits_LinearDriftFromDB_cfi.py index 93a1b39569cce..614be879c09bb 100644 --- a/RecoLocalMuon/DTRecHit/python/dt1DRecHits_LinearDriftFromDB_cfi.py +++ b/RecoLocalMuon/DTRecHit/python/dt1DRecHits_LinearDriftFromDB_cfi.py @@ -23,3 +23,11 @@ #dtDigiLabel = cms.InputTag("dtunpacker") dtDigiLabel = cms.InputTag("muonDTDigis") ) + +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_dt1DRecHits_cleaner, tau_embedding_dt1DCosmicRecHits_cleaner +tau_embedding_cleaning.toReplaceWith(dt1DRecHits, tau_embedding_dt1DRecHits_cleaner) +tau_embedding_cleaning.toReplaceWith(dt1DCosmicRecHits, tau_embedding_dt1DCosmicRecHits_cleaner) \ No newline at end of file diff --git a/RecoLocalMuon/DTSegment/python/dt4DSegments_MTPatternReco4D_LinearDriftFromDB_cfi.py b/RecoLocalMuon/DTSegment/python/dt4DSegments_MTPatternReco4D_LinearDriftFromDB_cfi.py index 69995240f05b0..b89fbbb7f6c43 100644 --- a/RecoLocalMuon/DTSegment/python/dt4DSegments_MTPatternReco4D_LinearDriftFromDB_cfi.py +++ b/RecoLocalMuon/DTSegment/python/dt4DSegments_MTPatternReco4D_LinearDriftFromDB_cfi.py @@ -26,3 +26,11 @@ # name of the rechit 2D collection in the event recHits2DLabel = cms.InputTag("dt2DCosmicSegments") ) + +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_dt4DSegments_cleaner, tau_embedding_dt4DCosmicSegments_cleaner +tau_embedding_cleaning.toReplaceWith(dt4DSegments, tau_embedding_dt4DSegments_cleaner) +tau_embedding_cleaning.toReplaceWith(dt4DCosmicSegments, tau_embedding_dt4DCosmicSegments_cleaner) \ No newline at end of file diff --git a/RecoLocalMuon/RPCRecHit/python/rpcRecHits_cfi.py b/RecoLocalMuon/RPCRecHit/python/rpcRecHits_cfi.py index 1b98d43426b06..85480ad12c0cf 100644 --- a/RecoLocalMuon/RPCRecHit/python/rpcRecHits_cfi.py +++ b/RecoLocalMuon/RPCRecHit/python/rpcRecHits_cfi.py @@ -16,3 +16,10 @@ #disabling DIGI2RAW,RAW2DIGI chain for Phase2 from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon phase2_muon.toModify(rpcRecHits, rpcDigiLabel = 'simMuonRPCDigis') + +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_rpcRecHits_cleaner +tau_embedding_cleaning.toReplaceWith(rpcRecHits, tau_embedding_rpcRecHits_cleaner) \ No newline at end of file diff --git a/RecoLocalTracker/SiStripClusterizer/python/SiStripClusterizer_RealData_cfi.py b/RecoLocalTracker/SiStripClusterizer/python/SiStripClusterizer_RealData_cfi.py index 82b8e07527547..a651e2403b35d 100644 --- a/RecoLocalTracker/SiStripClusterizer/python/SiStripClusterizer_RealData_cfi.py +++ b/RecoLocalTracker/SiStripClusterizer/python/SiStripClusterizer_RealData_cfi.py @@ -16,3 +16,10 @@ SiStripApprox2Clusters.inputApproxClusters = 'SiStripClusters2ApproxClusters' approxSiStripClusters.toModify(SiStripApprox2Clusters, inputApproxClusters = 'hltSiStripClusters2ApproxClusters') approxSiStripClusters.toReplaceWith(siStripClusters,SiStripApprox2Clusters) + +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_siStripClusters_cleaner +tau_embedding_cleaning.toReplaceWith(siStripClusters, tau_embedding_siStripClusters_cleaner) \ No newline at end of file diff --git a/RecoLuminosity/LumiProducer/python/bunchSpacingProducer_cfi.py b/RecoLuminosity/LumiProducer/python/bunchSpacingProducer_cfi.py index 312ccee610974..ab722567e6458 100644 --- a/RecoLuminosity/LumiProducer/python/bunchSpacingProducer_cfi.py +++ b/RecoLuminosity/LumiProducer/python/bunchSpacingProducer_cfi.py @@ -7,3 +7,13 @@ from Configuration.Eras.Modifier_run2_50ns_specific_cff import run2_50ns_specific run2_50ns_specific.toModify( bunchSpacingProducer, bunchSpacingOverride = 50) run2_50ns_specific.toModify( bunchSpacingProducer, overrideBunchSpacing = True) + +## +## Turn on bunch spacing Producer for tau embedding cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +tau_embedding_cleaning.toModify( + bunchSpacingProducer, + bunchSpacingOverride=cms.uint32(25), + overrideBunchSpacing=cms.bool(True), +) diff --git a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py index ced05c9ca46eb..f088e885f1843 100644 --- a/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py @@ -274,3 +274,15 @@ ) trackingLowPU.toReplaceWith(InitialStepPreSplittingTask, _InitialStepPreSplittingTask_LowPU_Phase2PU140) trackingPhase2PU140.toReplaceWith(InitialStepPreSplittingTask, _InitialStepPreSplittingTask_LowPU_Phase2PU140) +## +## Modify for the tau embedding methods cleaning step +## +from Configuration.ProcessModifiers.tau_embedding_cleaning_cff import tau_embedding_cleaning +from TauAnalysis.MCEmbeddingTools.Cleaning_RECO_cff import tau_embedding_siPixelClusters_cleaner +tau_embedding_cleaning.toReplaceWith(siPixelClusters, tau_embedding_siPixelClusters_cleaner) +## +## Modify for the tau embedding methods reco sim step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +from TauAnalysis.MCEmbeddingTools.Simulation_RECO_cff import tau_embedding_correct_hlt_vertices +tau_embedding_sim.toReplaceWith(firstStepPrimaryVerticesPreSplitting, tau_embedding_correct_hlt_vertices) diff --git a/RecoTracker/IterativeTracking/python/InitialStep_cff.py b/RecoTracker/IterativeTracking/python/InitialStep_cff.py index 229ad727f8c38..7557ca44c240d 100644 --- a/RecoTracker/IterativeTracking/python/InitialStep_cff.py +++ b/RecoTracker/IterativeTracking/python/InitialStep_cff.py @@ -486,3 +486,10 @@ ,initialStep ) fastSim.toReplaceWith(InitialStepTask, _InitialStepTask_fastSim) + +## +## Modify for the tau embedding methods reco sim step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +from TauAnalysis.MCEmbeddingTools.Simulation_RECO_cff import tau_embedding_correct_hlt_vertices +tau_embedding_sim.toReplaceWith(firstStepPrimaryVerticesUnsorted, tau_embedding_correct_hlt_vertices) diff --git a/RecoVertex/Configuration/python/RecoVertex_cff.py b/RecoVertex/Configuration/python/RecoVertex_cff.py index 002bde15c2974..91f4f3c55d50e 100644 --- a/RecoVertex/Configuration/python/RecoVertex_cff.py +++ b/RecoVertex/Configuration/python/RecoVertex_cff.py @@ -92,3 +92,10 @@ from Configuration.ProcessModifiers.vertex4DTrackSelMVA_cff import vertex4DTrackSelMVA vertex4DTrackSelMVA.toModify(unsortedOfflinePrimaryVertices4D, useMVACut = True) vertex4DTrackSelMVA.toModify(unsortedOfflinePrimaryVertices4DwithPID, useMVACut = True) + +## +## Modify for the tau embedding methods reco sim step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +from TauAnalysis.MCEmbeddingTools.Simulation_RECO_cff import tau_embedding_correct_hlt_vertices +tau_embedding_sim.toReplaceWith(offlinePrimaryVertices, tau_embedding_correct_hlt_vertices) \ No newline at end of file diff --git a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py index 57a495a894255..6186fa0b6e9c2 100644 --- a/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py @@ -139,6 +139,15 @@ def _modifyPixelDigitizerForRun3( digitizer ): killModules = False #done in second step ) +## +## Disable all noise for the tau embedding methods simulation step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +tau_embedding_sim.toModify(SiPixelSimBlock, + AddNoise = False, + AddNoisyPixels = False, +) + # Threshold in electrons are the Official CRAFT09 numbers: # FPix(smearing)/BPix(smearing) = 2480(160)/2730(200) diff --git a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py index b1a8ff11010fe..b4f2f06376a25 100644 --- a/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py +++ b/SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py @@ -156,3 +156,9 @@ CouplingConstantsRunIIDecW = True, #for TID and TEC APVShapeDecoFile =cms.FileInPath("SimTracker/SiStripDigitizer/data/APVShapeDeco_320.txt") ) + +## +## Disable all noise for the tau embedding methods simulation step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +tau_embedding_sim.toModify(SiStripSimBlock, Noise = False) \ No newline at end of file diff --git a/SimGeneral/MixingModule/python/castorDigitizer_cfi.py b/SimGeneral/MixingModule/python/castorDigitizer_cfi.py index 06ef707c0380a..00a6b9930d77b 100644 --- a/SimGeneral/MixingModule/python/castorDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/castorDigitizer_cfi.py @@ -18,3 +18,9 @@ timePhase = cms.double(-4.0) ) ) + +## +## Disable all noise for the tau embedding methods simulation step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +tau_embedding_sim.toModify(castorDigitizer, doNoise=False) \ No newline at end of file diff --git a/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py b/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py index a23451af1df6c..37a109e1159aa 100644 --- a/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/ecalDigitizer_cfi.py @@ -43,3 +43,9 @@ from Configuration.Eras.Modifier_phase2_ecal_devel_cff import phase2_ecal_devel from SimGeneral.MixingModule.ecalDigitizer_Ph2_cfi import ecalDigitizer_Ph2 as _ecalDigitizer_Ph2 phase2_ecal_devel.toReplaceWith(ecalDigitizer,_ecalDigitizer_Ph2) + +## +## Disable all noise for the tau embedding methods simulation step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +tau_embedding_sim.toModify(ecalDigitizer, doENoise = False, doESNoise = False) \ No newline at end of file diff --git a/SimGeneral/MixingModule/python/hcalDigitizer_cfi.py b/SimGeneral/MixingModule/python/hcalDigitizer_cfi.py index de5f5116cf2eb..8673c2d3824df 100644 --- a/SimGeneral/MixingModule/python/hcalDigitizer_cfi.py +++ b/SimGeneral/MixingModule/python/hcalDigitizer_cfi.py @@ -6,3 +6,13 @@ hcalSimBlock, accumulatorType = cms.string("HcalDigiProducer"), makeDigiSimLinks = cms.untracked.bool(False)) + +## +## Disable all noise for the tau embedding methods simulation step +## +from Configuration.ProcessModifiers.tau_embedding_sim_cff import tau_embedding_sim +tau_embedding_sim.toModify( + hcalDigitizer, + doNoise=False, + doThermalNoise=False, +) diff --git a/TauAnalysis/MCEmbeddingTools/docs/README b/TauAnalysis/MCEmbeddingTools/docs/README deleted file mode 100644 index df5d5954cfdb1..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/docs/README +++ /dev/null @@ -1,30 +0,0 @@ -The Tau Embedding runs in four steps - -1. Selection events with two muons -2. Cleaning the events from the two muons -3. Simulating the Z-> tau tau events -4. Merging the Simulated and Cleand event - - -In all of this step the RECO seqeunce hast to be runned. So just take the common CMSDriver.py commands, add the embedding customiser and save RAWRECO (and in merge step only MINIAODSIM). -The input of the first step must be RAW, and the inputs of the other samples are step before. - -1. -cmsDriver.py ... ---customise TauAnalysis/MCEmbeddingTools/customisers.customisoptions,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting \ - -2. -cmsDriver.py ... ---customise TauAnalysis/MCEmbeddingTools/customisers.customisoptions,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning \ - -3. -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ -... ---customise TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator,TauAnalysis/MCEmbeddingTools/customisers.customisoptions \ - -4. -cmsDriver.py ... ---customise TauAnalysis/MCEmbeddingTools/customisers.customisoptions,TauAnalysis/MCEmbeddingTools/customisers.customiseMerging \ - - -You can find some working examples for CMSSW_8_0_21 in this folder. diff --git a/TauAnalysis/MCEmbeddingTools/docs/README.md b/TauAnalysis/MCEmbeddingTools/docs/README.md new file mode 100644 index 0000000000000..714429ffcdfcc --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/docs/README.md @@ -0,0 +1,162 @@ +# Tau embedding method + +The Tau Embedding runs in four steps: + +1. Selection events with two muons +2. Cleaning the events from the two muons +3. Simulating the Z -> tau tau events +4. Merging the Simulated and Cleaned event + +The RECO sequence must be run through for all these steps. +The input of the first step must be RAW, and the inputs of the other samples are the outputs of the step before. + +1. **Selection** + + The FILTER step adds the code to select events with two muons suited for tau embedding and produces a collection where those muons are stored. + ```bash + cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingSelection \ + --datatier RAWRECO \ + --conditions ... \ + --era ... \ + --filein ... \ + --fileout ... + ``` + +2. **LHE and Cleaning** + + In this step two things are done: + - The LHEProducer is run to generate the LHE file for the Z -> tau tau events in the USER step. + - The energy deposits of the two muons selected in the previous step are removed from the event record. This is done by modifying the RECO sequence by replacing some producers with special cleaning producers. To achieve this the `tau_embedding_cleaning` process modifier has to be used. + + This step can be modified using the following `--procModifiers` options: + - `tau_embedding_mu_to_mu`: Muons are simulated instead of a taus. That means this method is replacing a muon with a simulated muon. This is very useful for the validation of the method and for calculating some corrections. + - `tau_embedding_mu_to_e`: Electrons are simulated instead of taus. This is used to calculate corrections. + + ```bash + cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingCleaning \ + --datatier RAWRECO \ + --procModifiers tau_embedding_cleaning,tau_embedding_mu_to_mu \ + --conditions ... \ + --era ... \ + --filein ... \ + --fileout ... + ``` + +3. **Simulation** + + This step is divided into three different steps to give the possibility to change to an older CMSSW version for the HLT step, if needed. This is needed because we want to run the same HLT menu which was used to record the data. + For all three steps the beamspot needs to be set to the one measured in the data. For the generation and HLT step the vertex is also set to the one measured in the data. + + 1. **Generation** + + The generation of the Z -> tau tau events is done with the Pythia8Hadronizer. The input is the LHE file produced in the previous step. + + This step needs to be modified using the following `--procModifiers` options to specify the final state of the taus: + - `tau_embedding_emu`: One tau decays to an electron and the other to a muon. + - `tau_embedding_etauh`: One tau decays to an electron and the other to a hadronic tau decay. + - `tau_embedding_mutauh`: One tau decays to a muon and the other to a hadronic tau decay. + - `tau_embedding_tauhtauh`: Both taus decay to hadronic tau decays. + - `tau_embedding_mu_to_e`: Must also be specified in the LHE step. Simulates electrons instead of a taus. + - `tau_embedding_mu_to_mu`: Must also be specified in the LHE step. Simulates muons instead of a taus. + + ```bash + cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ + --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --eventcontent TauEmbeddingSimGen \ + --datatier RAWSIM \ + --procModifiers tau_embedding_sim,tau_embedding_mutauh \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... + ``` + + 2. **HLT** + + The HLT needs to be run with the same menu as used for the data taking. Therefore, this steps may need to be run in an older CMSSW version, where the HLT menu is still available. + + ```bash + cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --eventcontent TauEmbeddingSimHLT \ + --datatier RAWSIM \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... + ``` + + 3. **Reconstruction** + + ```bash + cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,RECOSIM \ + --processName SIMembedding \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --eventcontent TauEmbeddingSimReco \ + --datatier RAW-RECO-SIM \ + --procModifiers tau_embedding_sim \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... + ``` + +4. **Merge** + + In the last step the simulated Z -> tau tau events are merged with the cleaned events from the second step. The output is a MINIAODSIM file. + + ```bash + cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --processName MERGE \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingMergeMINIAOD \ + --datatier USER \ + --procModifiers tau_embedding_merging \ + --inputCommands 'keep *_*_*_*' \ + --conditions ... \ + --era ... \ + --filein ... \ + --fileout ... + ``` + +5. **NanoAOD** + + If you want to create a NanoAOD file you can use the following command, so that a special table with information about the initial muons and event is included. + + ```bash + cmsDriver.py \ + --step NANO:@TauEmbedding \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingNANOAOD \ + --datatier NANOAODSIM \ + --conditions ... \ + --era ... \ + --filein ... \ + --fileout ... + ``` + +You can find some working examples for different eras and CMSSW versions in this folder and in the test folder. \ No newline at end of file diff --git a/TauAnalysis/MCEmbeddingTools/docs/cmsDriver_cmds_DATA_RUN3.sh b/TauAnalysis/MCEmbeddingTools/docs/cmsDriver_cmds_DATA_RUN3.sh new file mode 100644 index 0000000000000..8199317ee3f42 --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/docs/cmsDriver_cmds_DATA_RUN3.sh @@ -0,0 +1,162 @@ +#!/bin/bash + +# parse BASE_DIR and START_ROOT_FILE from command line arguments +set -e # Exit immediately if a command exits with a non-zero status +set -u # Treat unset variables as an error when substituting +set -o pipefail # Return the exit status of the last command in the pipeline that failed +while getopts "hb:s:" option; do + case "${option}" in + b) BASE_DIR=${OPTARG} ;; + s) START_ROOT_FILE=${OPTARG} ;; + h | *) + echo "Usage: $0 [-b BASE_DIR] [-s START_ROOT_FILE]" + exit 1 + ;; + esac +done + +#set Start root file if not done in getopts +START_ROOT_FILE=${START_ROOT_FILE:-"root://cmsdcache-kit-disk.gridka.de:1094//store/data/Run2024C/Muon0/RAW/v1/000/380/115/00000/00979445-916c-42e2-8038-428d7bd4f176.root"} + +: "${BASE_DIR:=$PWD}" # Default to current directory if not set +echo "BASE_DIR: $BASE_DIR" + +# Create directories for configs, root files, and logs +[ -d "$BASE_DIR" ] || mkdir -p "$BASE_DIR" + +EMB_CONF_DIR=$(realpath "$BASE_DIR/configs") +ROOT_FILES_DIR=$(realpath "$BASE_DIR/root_files") + +echo "EMB_CONF_DIR: $EMB_CONF_DIR" +echo "ROOT_FILES_DIR: $ROOT_FILES_DIR" +echo "START_ROOT_FILE: $START_ROOT_FILE" + +[ -d "$EMB_CONF_DIR" ] || mkdir "$EMB_CONF_DIR" +[ -d "$ROOT_FILES_DIR" ] || mkdir "$ROOT_FILES_DIR" +[ -d "$LOG_FILES_DIR" ] || mkdir "$LOG_FILES_DIR" + +# Selection +echo "################ Selection ################" +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ + --data \ + --scenario pp \ + --conditions auto:run3_data \ + --era Run3_2024 \ + --eventcontent TauEmbeddingSelection \ + --datatier RAWRECO \ + --filein $START_ROOT_FILE \ + --fileout file:$ROOT_FILES_DIR/RAWskimmed.root \ + -n 100 \ + --nThreads 10 \ + --python_filename $EMB_CONF_DIR/selection.py + +# LHE production and cleaning +echo "################ LHE production and cleaning ################" +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ + --data \ + --scenario pp \ + --conditions auto:run3_data \ + --era Run3_2024 \ + --eventcontent TauEmbeddingCleaning \ + --datatier RAWRECO \ + --procModifiers tau_embedding_cleaning,tau_embedding_mu_to_mu \ + --filein file:$ROOT_FILES_DIR/RAWskimmed.root \ + --fileout file:$ROOT_FILES_DIR/lhe_and_cleaned.root \ + -n -1 \ + --nThreads 10 \ + --python_filename $EMB_CONF_DIR/lheprodandcleaning.py + +# Simulation (MC & Detector) +echo "################ Simulation (MC & Detector) ################" +cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ + --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --era Run3_2024 \ + --conditions auto:phase1_2024_realistic \ + --eventcontent TauEmbeddingSimGen \ + --datatier RAWSIM \ + --procModifiers tau_embedding_sim,tau_embedding_mu_to_mu \ + --filein file:$ROOT_FILES_DIR/lhe_and_cleaned.root \ + --fileout file:$ROOT_FILES_DIR/simulated_and_cleaned_prehlt.root \ + -n -1 \ + --nThreads 10 \ + --python_filename $EMB_CONF_DIR/generator_preHLT.py + +# Simulation (Trigger) +echo "################ Simulation (Trigger) ################" +cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --era Run3_2024 \ + --conditions auto:phase1_2024_realistic \ + --eventcontent TauEmbeddingSimHLT \ + --datatier RAWSIM \ + --filein file:$ROOT_FILES_DIR/simulated_and_cleaned_prehlt.root \ + --fileout file:$ROOT_FILES_DIR/simulated_and_cleaned_hlt.root \ + -n -1 \ + --nThreads 10 \ + --python_filename $EMB_CONF_DIR/generator_HLT.py + +# Simulation (Reconstruction) +echo "################ Simulation (Reconstruction) ################" +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,RECOSIM \ + --processName SIMembedding \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --era Run3_2024 \ + --conditions auto:phase1_2024_realistic \ + --eventcontent TauEmbeddingSimReco \ + --datatier RAW-RECO-SIM \ + --procModifiers tau_embedding_sim \ + --filein file:$ROOT_FILES_DIR/simulated_and_cleaned_hlt.root \ + --fileout file:$ROOT_FILES_DIR/simulated_and_cleaned_posthlt.root \ + -n -1 \ + --nThreads 10 \ + --python_filename $EMB_CONF_DIR/generator_postHLT.py + +# Merging +echo "################ Merging ################" +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --processName MERGE \ + --data \ + --scenario pp \ + --conditions auto:run3_data \ + --era Run3_2024 \ + --eventcontent TauEmbeddingMergeMINIAOD \ + --datatier USER \ + --procModifiers tau_embedding_merging \ + --inputCommands 'keep *_*_*_*' \ + --filein file:$ROOT_FILES_DIR/simulated_and_cleaned_posthlt.root \ + --fileout file:$ROOT_FILES_DIR/merged.root \ + -n -1 \ + --nThreads 10 \ + --python_filename $EMB_CONF_DIR/merging.py + +# NanoAOD Production +echo "################ NanoAOD Production ################" +cmsDriver.py \ + --step NANO:@TauEmbedding \ + --data \ + --scenario pp \ + --conditions auto:run3_data \ + --era Run3_2024 \ + --eventcontent TauEmbeddingNANOAOD \ + --datatier NANOAODSIM \ + --filein file:$ROOT_FILES_DIR/merged.root \ + --fileout file:$ROOT_FILES_DIR/merged_nano.root \ + -n -1 \ + --nThreads 10 \ + --python_filename $EMB_CONF_DIR/embedding_nanoAOD.py diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h b/TauAnalysis/MCEmbeddingTools/interface/CaloCleaner.h similarity index 100% rename from TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h rename to TauAnalysis/MCEmbeddingTools/interface/CaloCleaner.h diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.h b/TauAnalysis/MCEmbeddingTools/interface/CollectionMerger.h similarity index 100% rename from TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.h rename to TauAnalysis/MCEmbeddingTools/interface/CollectionMerger.h diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.h b/TauAnalysis/MCEmbeddingTools/interface/DoubleCollectionMerger.h similarity index 100% rename from TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.h rename to TauAnalysis/MCEmbeddingTools/interface/DoubleCollectionMerger.h diff --git a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingBeamSpotOnlineProducer.h b/TauAnalysis/MCEmbeddingTools/interface/EmbeddingBeamSpotOnlineProducer.h similarity index 100% rename from TauAnalysis/MCEmbeddingTools/plugins/EmbeddingBeamSpotOnlineProducer.h rename to TauAnalysis/MCEmbeddingTools/interface/EmbeddingBeamSpotOnlineProducer.h diff --git a/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.h b/TauAnalysis/MCEmbeddingTools/interface/MuonDetCleaner.h similarity index 100% rename from TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.h rename to TauAnalysis/MCEmbeddingTools/interface/MuonDetCleaner.h diff --git a/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.h b/TauAnalysis/MCEmbeddingTools/interface/TrackMergeremb.h similarity index 100% rename from TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.h rename to TauAnalysis/MCEmbeddingTools/interface/TrackMergeremb.h diff --git a/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.h b/TauAnalysis/MCEmbeddingTools/interface/TrackerCleaner.h similarity index 100% rename from TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.h rename to TauAnalysis/MCEmbeddingTools/interface/TrackerCleaner.h diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc index af279da3cc966..be7dbe30c3a62 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.cc @@ -1,4 +1,4 @@ -#include "TauAnalysis/MCEmbeddingTools/plugins/CaloCleaner.h" +#include "TauAnalysis/MCEmbeddingTools/interface/CaloCleaner.h" #include "DataFormats/EcalRecHit/interface/EcalRecHit.h" #include "DataFormats/HcalRecHit/interface/HBHERecHit.h" diff --git a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc index 5f1629f0eaa48..28c43668eb8ab 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.cc @@ -1,4 +1,4 @@ -#include "TauAnalysis/MCEmbeddingTools/plugins/CollectionMerger.h" +#include "TauAnalysis/MCEmbeddingTools/interface/CollectionMerger.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" @@ -59,7 +59,7 @@ typedef CollectionMerger>, RPC template CollectionMerger::CollectionMerger(const edm::ParameterSet &iConfig) { - std::vector inCollections = iConfig.getParameter>("mergCollections"); + std::vector inCollections = iConfig.getParameter>("mergeCollections"); for (auto const &inCollection : inCollections) { inputs_[inCollection.instance()].push_back(consumes(inCollection)); } diff --git a/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc b/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc index 0d3e72d34f09a..846b785b94a94 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.cc @@ -1,4 +1,4 @@ -#include "TauAnalysis/MCEmbeddingTools/plugins/DoubleCollectionMerger.h" +#include "TauAnalysis/MCEmbeddingTools/interface/DoubleCollectionMerger.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/Common/interface/SortedCollection.h" @@ -18,7 +18,7 @@ typedef DoubleCollectionMerger DoubleCollectionMerger::DoubleCollectionMerger(const edm::ParameterSet &iConfig) { - std::vector inCollections = iConfig.getParameter>("mergCollections"); + std::vector inCollections = iConfig.getParameter>("mergeCollections"); for (auto const &inCollection : inCollections) { inputs1_[inCollection.instance()].push_back(consumes(inCollection)); inputs2_[inCollection.instance()].push_back(consumes(inCollection)); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingBeamSpotOnlineProducer.cc b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingBeamSpotOnlineProducer.cc index 15a8f8a40cadb..a583e5b3a0453 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingBeamSpotOnlineProducer.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingBeamSpotOnlineProducer.cc @@ -1,5 +1,5 @@ -#include "TauAnalysis/MCEmbeddingTools/plugins/EmbeddingBeamSpotOnlineProducer.h" +#include "TauAnalysis/MCEmbeddingTools/interface/EmbeddingBeamSpotOnlineProducer.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" #include "FWCore/Framework/interface/MakerMacros.h" diff --git a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc index 26935821447a7..d77bc2d3ca14b 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/EmbeddingLHEProducer.cc @@ -83,17 +83,13 @@ class EmbeddingLHEProducer : public edm::one::EDProducer> muonsCollection_; edm::EDGetTokenT vertexCollection_; int particleToEmbed_; - bool mirror_, rotate180_, InitialRecoCorrection_; static constexpr double tauMass_ = 1.77682; static constexpr double muonMass_ = 0.1057; static constexpr double elMass_ = 0.00051; @@ -101,11 +97,6 @@ class EmbeddingLHEProducer : public edm::one::EDProducer>(iConfig.getParameter("src")); vertexCollection_ = consumes(iConfig.getParameter("vertices")); particleToEmbed_ = iConfig.getParameter("particleToEmbed"); - mirror_ = iConfig.getParameter("mirror"); - InitialRecoCorrection_ = iConfig.getParameter("InitialRecoCorrection"); - rotate180_ = iConfig.getParameter("rotate180"); - studyFSRmode_ = iConfig.getUntrackedParameter("studyFSRmode", ""); write_lheout = false; std::string lhe_ouputfile = iConfig.getUntrackedParameter("lhe_outputfilename", ""); @@ -179,19 +166,14 @@ void EmbeddingLHEProducer::produce(edm::Event &iEvent, const edm::EventSetup &iS // Assuming Pt-Order for (edm::View::const_iterator muon = coll_muons.begin(); muon != coll_muons.end(); ++muon) { if (muon->charge() == 1 && !mu_plus_found) { - assign_4vector(positiveLepton, &(*muon), studyFSRmode_); + assign_4vector(positiveLepton, &(*muon)); mu_plus_found = true; } else if (muon->charge() == -1 && !mu_minus_found) { - assign_4vector(negativeLepton, &(*muon), studyFSRmode_); + assign_4vector(negativeLepton, &(*muon)); mu_minus_found = true; } else if (mu_minus_found && mu_plus_found) break; } - InitialRecoCorrection( - positiveLepton, - negativeLepton); // corrects Z mass peak to take into account smearing happening due to first muon reconstruction in the selection step - mirror(positiveLepton, negativeLepton); // if no mirror, function does nothing. - rotate180(positiveLepton, negativeLepton); // if no rotate180, function does nothing transform_mumu_to_tautau(positiveLepton, negativeLepton); // if MuonEmbedding, function does nothing. fill_lhe_from_mumu(positiveLepton, negativeLepton, hepeup, engine); @@ -349,19 +331,8 @@ void EmbeddingLHEProducer::transform_mumu_to_tautau(TLorentzVector &positiveLept return; } -void EmbeddingLHEProducer::assign_4vector(TLorentzVector &Lepton, const pat::Muon *muon, std::string FSRmode) { - if ("afterFSR" == FSRmode && muon->genParticle() != nullptr) { - const reco::GenParticle *afterFSRMuon = muon->genParticle(); - Lepton.SetPxPyPzE( - afterFSRMuon->p4().px(), afterFSRMuon->p4().py(), afterFSRMuon->p4().pz(), afterFSRMuon->p4().e()); - } else if ("beforeFSR" == FSRmode && muon->genParticle() != nullptr) { - const reco::Candidate *beforeFSRMuon = find_original_muon(muon->genParticle()); - Lepton.SetPxPyPzE( - beforeFSRMuon->p4().px(), beforeFSRMuon->p4().py(), beforeFSRMuon->p4().pz(), beforeFSRMuon->p4().e()); - } else { - Lepton.SetPxPyPzE(muon->p4().px(), muon->p4().py(), muon->p4().pz(), muon->p4().e()); - } - return; +void EmbeddingLHEProducer::assign_4vector(TLorentzVector &Lepton, const pat::Muon *muon) { + Lepton.SetPxPyPzE(muon->p4().px(), muon->p4().py(), muon->p4().pz(), muon->p4().e()); } const reco::Candidate *EmbeddingLHEProducer::find_original_muon(const reco::Candidate *muon) { @@ -373,96 +344,6 @@ const reco::Candidate *EmbeddingLHEProducer::find_original_muon(const reco::Cand return muon; } -void EmbeddingLHEProducer::rotate180(TLorentzVector &positiveLepton, TLorentzVector &negativeLepton) { - if (!rotate180_) - return; - edm::LogInfo("TauEmbedding") << "Applying 180 rotation"; - // By construction, the 3-momenta of mu-, mu+ and Z are in one plane. - // That means, one vector for perpendicular projection can be used for both leptons. - TLorentzVector Z = positiveLepton + negativeLepton; - - edm::LogInfo("TauEmbedding") << "MuMinus before. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() - << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M(); - - TVector3 Z3 = Z.Vect(); - TVector3 positiveLepton3 = positiveLepton.Vect(); - TVector3 negativeLepton3 = negativeLepton.Vect(); - - TVector3 p3_perp = positiveLepton3 - positiveLepton3.Dot(Z3) / Z3.Dot(Z3) * Z3; - p3_perp = p3_perp.Unit(); - - positiveLepton3 -= 2 * positiveLepton3.Dot(p3_perp) * p3_perp; - negativeLepton3 -= 2 * negativeLepton3.Dot(p3_perp) * p3_perp; - - positiveLepton.SetVect(positiveLepton3); - negativeLepton.SetVect(negativeLepton3); - - edm::LogInfo("TauEmbedding") << "MuMinus after. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() - << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M(); - - return; -} - -void EmbeddingLHEProducer::InitialRecoCorrection(TLorentzVector &positiveLepton, TLorentzVector &negativeLepton) { - if (!InitialRecoCorrection_) - return; - edm::LogInfo("TauEmbedding") << "Applying initial reconstruction correction"; - TLorentzVector Z = positiveLepton + negativeLepton; - edm::LogInfo("TauEmbedding") << "MuMinus before. Pt: " << negativeLepton.Pt() << " Mass: " << negativeLepton.M(); - float diLeptonMass = (positiveLepton + negativeLepton).M(); - if (diLeptonMass > 60. && diLeptonMass < 122.) { - static constexpr float zmass = 91.1876; - float correction_deviation = - 5.; // to ensure only a correction that drops corresponding to a Gaussian with mean zmass and std. dev. 5 GeV - double EmbeddingCorrection = - 1.138; // value derived by function fitting to fold embedded mass spectrum back to original selection when using mu -> mu embedding - EmbeddingCorrection /= - (EmbeddingCorrection - - (EmbeddingCorrection - 1.) * exp(-pow((diLeptonMass - zmass), 2.) / (2. * pow(correction_deviation, 2.)))); - EmbeddingCorrection = ((diLeptonMass + (EmbeddingCorrection - 1.) * zmass) / (diLeptonMass * EmbeddingCorrection)); - double correctedpositiveLeptonEnergy = - std::sqrt((pow(muonMass_, 2) / pow(EmbeddingCorrection, 2)) + pow(positiveLepton.Px(), 2) + - pow(positiveLepton.Py(), 2) + pow(positiveLepton.Pz(), 2)); - double correctednegativeLeptonEnergy = - std::sqrt((pow(muonMass_, 2) / pow(EmbeddingCorrection, 2)) + pow(negativeLepton.Px(), 2) + - pow(negativeLepton.Py(), 2) + pow(negativeLepton.Pz(), 2)); - positiveLepton.SetE(correctedpositiveLeptonEnergy); - negativeLepton.SetE(correctednegativeLeptonEnergy); - positiveLepton *= EmbeddingCorrection; - negativeLepton *= EmbeddingCorrection; - edm::LogInfo("TauEmbedding") << "MuMinus after. Pt: " << negativeLepton.Pt() << " Mass: " << negativeLepton.M(); - } - return; -} - -void EmbeddingLHEProducer::mirror(TLorentzVector &positiveLepton, TLorentzVector &negativeLepton) { - if (!mirror_) - return; - edm::LogInfo("TauEmbedding") << "Applying mirroring"; - TLorentzVector Z = positiveLepton + negativeLepton; - - edm::LogInfo("TauEmbedding") << "MuMinus before. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() - << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M(); - - TVector3 Z3 = Z.Vect(); - TVector3 positiveLepton3 = positiveLepton.Vect(); - TVector3 negativeLepton3 = negativeLepton.Vect(); - - TVector3 beam(0., 0., 1.); - TVector3 perpToZandBeam = Z3.Cross(beam).Unit(); - - positiveLepton3 -= 2 * positiveLepton3.Dot(perpToZandBeam) * perpToZandBeam; - negativeLepton3 -= 2 * negativeLepton3.Dot(perpToZandBeam) * perpToZandBeam; - - positiveLepton.SetVect(positiveLepton3); - negativeLepton.SetVect(negativeLepton3); - - edm::LogInfo("TauEmbedding") << "MuMinus after. Pt: " << negativeLepton.Pt() << " Eta: " << negativeLepton.Eta() - << " Phi: " << negativeLepton.Phi() << " Mass: " << negativeLepton.M(); - - return; -} - LHERunInfoProduct::Header EmbeddingLHEProducer::give_slha() { LHERunInfoProduct::Header slhah("slha"); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc b/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc index 2bceab1cf15ef..b9aadbd2464f8 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/MuMuForEmbeddingSelector.cc @@ -58,8 +58,6 @@ class MuMuForEmbeddingSelector : public edm::stream::EDProducer<> { edm::EDGetTokenT theBeamSpotLabel_; edm::EDGetTokenT> theMETLabel_; edm::EDGetTokenT> thePuppiMETLabel_; - bool use_zmass = false; - static constexpr double zmass = 91.1876; }; // @@ -76,11 +74,25 @@ class MuMuForEmbeddingSelector : public edm::stream::EDProducer<> { MuMuForEmbeddingSelector::MuMuForEmbeddingSelector(const edm::ParameterSet &iConfig) : ZmumuCandidates_(consumes>( iConfig.getParameter("ZmumuCandidatesCollection"))) { - use_zmass = iConfig.getParameter("use_zmass"); produces>(); - produces("oldMass"); - produces("newMass"); - produces("nPairCandidates"); + produces("ptLeadingMuon"); + produces("ptTrailingMuon"); + produces("etaLeadingMuon"); + produces("etaTrailingMuon"); + produces("phiLeadingMuon"); + produces("phiTrailingMuon"); + produces("chargeLeadingMuon"); + produces("chargeTrailingMuon"); + produces("dbLeadingMuon"); + produces("dbTrailingMuon"); + produces("massLeadingMuon"); + produces("massTrailingMuon"); + produces("vtxxLeadingMuon"); + produces("vtxyLeadingMuon"); + produces("vtxzLeadingMuon"); + produces("vtxxTrailingMuon"); + produces("vtxyTrailingMuon"); + produces("vtxzTrailingMuon"); produces("isMediumLeadingMuon"); produces("isTightLeadingMuon"); produces("isMediumTrailingMuon"); @@ -107,9 +119,6 @@ void MuMuForEmbeddingSelector::produce(edm::Event &iEvent, const edm::EventSetup iEvent.getByToken(ZmumuCandidates_, ZmumuCandidatesHandle); edm::View ZmumuCandidates = *ZmumuCandidatesHandle; const reco::CompositeCandidate *chosenZCand = nullptr; - const reco::CompositeCandidate *chosenZCand_zmass = nullptr; - const reco::CompositeCandidate *chosenZCand_largest = nullptr; - double massDifference = 9999; edm::Handle beamSpot; iEvent.getByToken(theBeamSpotLabel_, beamSpot); edm::Handle vertex; @@ -133,46 +142,46 @@ void MuMuForEmbeddingSelector::produce(edm::Event &iEvent, const edm::EventSetup for (edm::View::const_iterator iZCand = ZmumuCandidates.begin(); iZCand != ZmumuCandidates.end(); ++iZCand) { - if (std::abs(zmass - iZCand->mass()) < massDifference) { - massDifference = std::abs(zmass - iZCand->mass()); - chosenZCand_zmass = &(*iZCand); - } - } - for (edm::View::const_iterator iZCand = ZmumuCandidates.begin(); - iZCand != ZmumuCandidates.end(); - ++iZCand) { - if (chosenZCand_largest == nullptr) { - chosenZCand_largest = &(*iZCand); + if (chosenZCand == nullptr) { + chosenZCand = &(*iZCand); } else { - if (iZCand->mass() > chosenZCand_largest->mass()) { - chosenZCand_largest = &(*iZCand); + if (iZCand->mass() > chosenZCand->mass()) { + chosenZCand = &(*iZCand); } } } - if (use_zmass) { - chosenZCand = chosenZCand_zmass; - } else { - chosenZCand = chosenZCand_largest; - } + + const auto &daughter0 = chosenZCand->daughter(0)->masterClone().castTo(); + const auto &daughter1 = chosenZCand->daughter(1)->masterClone().castTo(); std::unique_ptr> prod(new edm::RefVector()); prod->reserve(2); - prod->push_back(chosenZCand->daughter(0)->masterClone().castTo()); - prod->push_back(chosenZCand->daughter(1)->masterClone().castTo()); + prod->push_back(daughter0); + prod->push_back(daughter1); iEvent.put(std::move(prod)); - iEvent.put(std::make_unique(chosenZCand_zmass->mass()), "oldMass"); - iEvent.put(std::make_unique(chosenZCand_largest->mass()), "newMass"); - iEvent.put(std::make_unique(ZmumuCandidates.size()), "nPairCandidates"); - iEvent.put(std::make_unique(chosenZCand->daughter(0)->masterClone().castTo()->isMediumMuon()), - "isMediumLeadingMuon"); - iEvent.put(std::make_unique( - chosenZCand->daughter(0)->masterClone().castTo()->isTightMuon(primaryVertex)), - "isTightLeadingMuon"); - iEvent.put(std::make_unique(chosenZCand->daughter(1)->masterClone().castTo()->isMediumMuon()), - "isMediumTrailingMuon"); - iEvent.put(std::make_unique( - chosenZCand->daughter(1)->masterClone().castTo()->isTightMuon(primaryVertex)), - "isTightTrailingMuon"); + + iEvent.put(std::make_unique(daughter0->pt()), "ptLeadingMuon"); + iEvent.put(std::make_unique(daughter1->pt()), "ptTrailingMuon"); + iEvent.put(std::make_unique(daughter0->eta()), "etaLeadingMuon"); + iEvent.put(std::make_unique(daughter1->eta()), "etaTrailingMuon"); + iEvent.put(std::make_unique(daughter0->phi()), "phiLeadingMuon"); + iEvent.put(std::make_unique(daughter1->phi()), "phiTrailingMuon"); + iEvent.put(std::make_unique(daughter0->charge()), "chargeLeadingMuon"); + iEvent.put(std::make_unique(daughter1->charge()), "chargeTrailingMuon"); + iEvent.put(std::make_unique(daughter0->dB()), "dbLeadingMuon"); + iEvent.put(std::make_unique(daughter1->dB()), "dbTrailingMuon"); + iEvent.put(std::make_unique(daughter0->mass()), "massLeadingMuon"); + iEvent.put(std::make_unique(daughter1->mass()), "massTrailingMuon"); + iEvent.put(std::make_unique(daughter0->vertex().x()), "vtxxLeadingMuon"); + iEvent.put(std::make_unique(daughter0->vertex().y()), "vtxyLeadingMuon"); + iEvent.put(std::make_unique(daughter0->vertex().z()), "vtxzLeadingMuon"); + iEvent.put(std::make_unique(daughter1->vertex().x()), "vtxxTrailingMuon"); + iEvent.put(std::make_unique(daughter1->vertex().y()), "vtxyTrailingMuon"); + iEvent.put(std::make_unique(daughter1->vertex().z()), "vtxzTrailingMuon"); + iEvent.put(std::make_unique(daughter0->isMediumMuon()), "isMediumLeadingMuon"); + iEvent.put(std::make_unique(daughter0->isTightMuon(primaryVertex)), "isTightLeadingMuon"); + iEvent.put(std::make_unique(daughter1->isMediumMuon()), "isMediumTrailingMuon"); + iEvent.put(std::make_unique(daughter1->isTightMuon(primaryVertex)), "isTightTrailingMuon"); iEvent.put(std::make_unique(met->at(0).et()), "initialMETEt"); iEvent.put(std::make_unique(met->at(0).phi()), "initialMETphi"); iEvent.put(std::make_unique(puppimet->at(0).et()), "initialPuppiMETEt"); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc b/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc index c315286497d1b..cdd6ed8e42fce 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.cc @@ -1,4 +1,4 @@ -#include "TauAnalysis/MCEmbeddingTools/plugins/MuonDetCleaner.h" +#include "TauAnalysis/MCEmbeddingTools/interface/MuonDetCleaner.h" #include "DataFormats/DTRecHit/interface/DTRecHit1DPair.h" #include "DataFormats/DTRecHit/interface/DTSLRecCluster.h" diff --git a/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.cc b/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.cc index bebe4bb7e8c08..c71e19def4ac1 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.cc @@ -1,4 +1,4 @@ -#include "TauAnalysis/MCEmbeddingTools/plugins/TrackMergeremb.h" +#include "TauAnalysis/MCEmbeddingTools/interface/TrackMergeremb.h" #include @@ -53,7 +53,7 @@ typedef TrackMergeremb PFColMerger; template TrackMergeremb::TrackMergeremb(const edm::ParameterSet &iConfig) { alias = iConfig.getParameter("@module_label"); - std::vector inCollections = iConfig.getParameter>("mergCollections"); + std::vector inCollections = iConfig.getParameter>("mergeCollections"); globalGeomToken_ = esConsumes(); for (const auto &inCollection : inCollections) { inputs_[inCollection.instance()].push_back(consumes(inCollection)); diff --git a/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc b/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc index d9a219a560fdf..7ea4e4fb528c2 100644 --- a/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc +++ b/TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.cc @@ -1,4 +1,4 @@ -#include "TauAnalysis/MCEmbeddingTools/plugins/TrackerCleaner.h" +#include "TauAnalysis/MCEmbeddingTools/interface/TrackerCleaner.h" #include "DataFormats/TrackerRecHit2D/interface/ProjectedSiStripRecHit2D.h" #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h" diff --git a/TauAnalysis/MCEmbeddingTools/python/Cleaning_RECO_cff.py b/TauAnalysis/MCEmbeddingTools/python/Cleaning_RECO_cff.py new file mode 100644 index 0000000000000..fb0d4e332ff7e --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Cleaning_RECO_cff.py @@ -0,0 +1,163 @@ +""" +This config fragment generates removes the energy deposites of LHE information for tau embedding. The selection step must be carried out beforehand. +It's normally used together with the LHE step. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingCleaning \ + --datatier RAWRECO \ + --procModifiers tau_embedding_cleaning,tau_embedding_mu_to_mu \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" + +import FWCore.ParameterSet.Config as cms +from TrackingTools.TrackAssociator.default_cfi import TrackAssociatorParameterBlock + +# Define TrackAssociatorParameters for the tau embedding cleaning modules to use the correct collections from the selection step +tau_embedding_TrackAssociatorParameters = ( + TrackAssociatorParameterBlock.TrackAssociatorParameters.clone( + CSCSegmentCollectionLabel=cms.InputTag("cscSegments", "", "SELECT"), + CaloTowerCollectionLabel=cms.InputTag("towerMaker", "", "SELECT"), + DTRecSegment4DCollectionLabel=cms.InputTag("dt4DSegments", "", "SELECT"), + EBRecHitCollectionLabel=cms.InputTag("ecalRecHit", "EcalRecHitsEB", "SELECT"), + EERecHitCollectionLabel=cms.InputTag("ecalRecHit", "EcalRecHitsEE", "SELECT"), + HBHERecHitCollectionLabel=cms.InputTag("hbhereco", "", "SELECT"), + HORecHitCollectionLabel=cms.InputTag("horeco", "", "SELECT"), + ME0HitCollectionLabel=cms.InputTag("me0RecHits", "", "SELECT"), + ME0SegmentCollectionLabel=cms.InputTag("me0Segments", "", "SELECT"), + RPCHitCollectionLabel=cms.InputTag("rpcRecHits", "", "SELECT"), + usePreshower=cms.bool(True), + preselectMuonTracks=cms.bool(True), + ) +) +# some common parameters which are used by most of the modules +common_parameters = { + "MuonCollection": cms.InputTag("selectedMuonsForEmbedding"), + "TrackAssociatorParameters": tau_embedding_TrackAssociatorParameters, + "cscDigiCollectionLabel": cms.InputTag("muonCSCDigis", "MuonCSCStripDigi"), + "digiMaxDistanceX": cms.double(25.0), + "dtDigiCollectionLabel": cms.InputTag("muonDTDigis"), +} + +# The following modules are replaced by the correspondig ColCleaner versions, which removes the energy deposites of the measured event +# The replacement is done using the tau_embedding process modifier, which is included in all the different tau embedding process modifiers. +# Each of the following tau embedding cleaner modules has a comment indicating the code where the replacment takes place. + +### Muon system modules + +# replaced in RecoLocalMuon/CSCRecHitD/python/cscRecHitD_cfi.py +tau_embedding_csc2DRecHits_cleaner = cms.EDProducer( + "CSCRecHitColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("csc2DRecHits", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalMuon/CSCSegment/python/cscSegments_cfi.py +tau_embedding_cscSegments_cleaner = cms.EDProducer( + "CSCSegmentColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("cscSegments", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalMuon/DTRecHit/python/dt1DRecHits_LinearDriftFromDB_cfi.py +tau_embedding_dt1DCosmicRecHits_cleaner = cms.EDProducer( + "DTRecHitColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("dt1DCosmicRecHits", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalMuon/DTRecHit/python/dt1DRecHits_LinearDriftFromDB_cfi.py +tau_embedding_dt1DRecHits_cleaner = cms.EDProducer( + "DTRecHitColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("dt1DRecHits", "", "SELECT")), + **common_parameters +) +# replaced in RecoLocalMuon/DTSegment/python/dt4DSegments_MTPatternReco4D_LinearDriftFromDB_cfi.py +tau_embedding_dt4DCosmicSegments_cleaner = cms.EDProducer( + "DTRecSegment4DColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("dt4DCosmicSegments", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalMuon/DTSegment/python/dt4DSegments_MTPatternReco4D_LinearDriftFromDB_cfi.py +tau_embedding_dt4DSegments_cleaner = cms.EDProducer( + "DTRecSegment4DColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("dt4DSegments", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalMuon/RPCRecHit/python/rpcRecHits_cfi.py +tau_embedding_rpcRecHits_cleaner = cms.EDProducer( + "RPCRecHitColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("rpcRecHits", "", "SELECT")), + **common_parameters +) + +### ECAL modules + +# replaced in RecoLocalCalo/EcalRecProducers/python/ecalPreshowerRecHit_cfi.py +tau_embedding_ecalPreshowerRecHit_cleaner = cms.EDProducer( + "EcalRecHitColCleaner", + oldCollection=cms.VInputTag( + cms.InputTag("ecalPreshowerRecHit", "EcalRecHitsES", "SELECT") + ), + **common_parameters +) + +# replaced in RecoLocalCalo/EcalRecProducers/python/ecalRecHitGPU_cfi.py +# and in RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py +tau_embedding_ecalRecHit_cleaner = cms.EDProducer( + "EcalRecHitColCleaner", + oldCollection=cms.VInputTag( + cms.InputTag("ecalRecHit", "EcalRecHitsEB", "SELECT"), + cms.InputTag("ecalRecHit", "EcalRecHitsEE", "SELECT"), + ), + **common_parameters +) + +### HCAL modules + +# replaced in RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py +tau_embedding_hbhereco_cleaner = cms.EDProducer( + "HBHERecHitColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("hbhereco", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalCalo/HcalRecProducers/python/HFPhase1Reconstructor_cfi.py +tau_embedding_hfreco_cleaner = cms.EDProducer( + "HFRecHitColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("hfreco", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalCalo/HcalRecProducers/python/HcalHitReconstructor_ho_cfi.py +tau_embedding_horeco_cleaner = cms.EDProducer( + "HORecHitColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("horeco", "", "SELECT")), + **common_parameters +) + +### Tracker modules + +# replaced in RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +tau_embedding_siPixelClusters_cleaner = cms.EDProducer( + "PixelColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("siPixelClusters", "", "SELECT")), + **common_parameters +) + +# replaced in RecoLocalTracker/SiStripClusterizer/python/SiStripClusterizer_RealData_cfi.py +tau_embedding_siStripClusters_cleaner = cms.EDProducer( + "StripColCleaner", + oldCollection=cms.VInputTag(cms.InputTag("siStripClusters", "", "SELECT")), + **common_parameters +) diff --git a/TauAnalysis/MCEmbeddingTools/python/EmbeddingBeamSpotOnline_cfi.py b/TauAnalysis/MCEmbeddingTools/python/EmbeddingBeamSpotOnline_cfi.py deleted file mode 100644 index 3a18d747069d5..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/EmbeddingBeamSpotOnline_cfi.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -onlineEmbeddingBeamSpotProducer = cms.EDProducer('EmbeddingBeamSpotOnlineProducer', - src = cms.InputTag('offlineBeamSpot'), -) - diff --git a/TauAnalysis/MCEmbeddingTools/python/EmbeddingHltPixelVerticesProducer_cfi.py b/TauAnalysis/MCEmbeddingTools/python/EmbeddingHltPixelVerticesProducer_cfi.py deleted file mode 100644 index a9139d00b92e4..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/EmbeddingHltPixelVerticesProducer_cfi.py +++ /dev/null @@ -1,4 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -embeddingHltPixelVertices = cms.EDProducer('EmbeddingHltPixelVerticesProducer' -) diff --git a/TauAnalysis/MCEmbeddingTools/python/EmbeddingLHEProducer_cfi.py b/TauAnalysis/MCEmbeddingTools/python/EmbeddingLHEProducer_cfi.py deleted file mode 100644 index f441f66903760..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/EmbeddingLHEProducer_cfi.py +++ /dev/null @@ -1,14 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -externalLHEProducer = cms.EDProducer("EmbeddingLHEProducer", - src = cms.InputTag("selectedMuonsForEmbedding","",""), - vertices = cms.InputTag("offlineSlimmedPrimaryVertices","","SELECT"), - particleToEmbed = cms.int32(15), - rotate180 = cms.bool(False), - mirror = cms.bool(False), - InitialRecoCorrection = cms.bool(True), - studyFSRmode = cms.untracked.string("reco") -) - -makeexternalLHEProducer = cms.Sequence( externalLHEProducer) diff --git a/TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py b/TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py deleted file mode 100644 index 2bdd19be90664..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py +++ /dev/null @@ -1,47 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * -from GeneratorInterface.ExternalDecays.TauolaSettings_cff import * - - - -generator = cms.EDFilter("Pythia8HadronizerFilter", - - maxEventsToPrint = cms.untracked.int32(1), - nAttempts = cms.uint32(1000), - HepMCFilter = cms.PSet( - filterName = cms.string('EmbeddingHepMCFilter'), - filterParameters = cms.PSet( - ElElCut = cms.string('El1.Pt > 22 && El2.Pt > 10'), - ElHadCut = cms.string('El.Pt > 28 && Had.Pt > 25'), - ElMuCut = cms.string('(El.Pt > 21 && Mu.Pt > 10) || (El.Pt > 10 && Mu.Pt > 21)'), - HadHadCut = cms.string('Had1.Pt > 35 && Had2.Pt > 30'), - MuHadCut = cms.string('Mu.Pt > 18 && Had.Pt > 25 && Mu.Eta < 2.1'), - MuMuCut = cms.string('Mu1.Pt > 17 && Mu2.Pt > 8'), - Final_States = cms.vstring('ElEl','ElHad','ElMu','HadHad','MuHad','MuMu'), - BosonPDGID = cms.int32(23), - IncludeDY = cms.bool(False) - ), - ), - pythiaPylistVerbosity = cms.untracked.int32(1), - filterEfficiency = cms.untracked.double(1.0), - pythiaHepMCVerbosity = cms.untracked.bool(False), - comEnergy = cms.double(13000.), - crossSection = cms.untracked.double(1.0), - PythiaParameters = cms.PSet( - pythia8CommonSettingsBlock, - pythia8CUEP8M1SettingsBlock, - processParameters = cms.vstring( - - 'JetMatching:merge = off', - 'Init:showChangedSettings = off', - 'Init:showChangedParticleData = off', - 'ProcessLevel:all = off', - ), - parameterSets = cms.vstring('pythia8CommonSettings', - 'pythia8CUEP8M1Settings', - 'processParameters' - ) - ) -) - diff --git a/TauAnalysis/MCEmbeddingTools/python/EmbeddingVertexCorrector_cfi.py b/TauAnalysis/MCEmbeddingTools/python/EmbeddingVertexCorrector_cfi.py deleted file mode 100644 index cba9a5c9b8509..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/EmbeddingVertexCorrector_cfi.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -VtxCorrectedToInput = cms.EDProducer("EmbeddingVertexCorrector", - src = cms.InputTag("generator","unsmeared") -) diff --git a/TauAnalysis/MCEmbeddingTools/python/Embedding_EventContent_cff.py b/TauAnalysis/MCEmbeddingTools/python/Embedding_EventContent_cff.py new file mode 100644 index 0000000000000..91096b5ea9252 --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Embedding_EventContent_cff.py @@ -0,0 +1,207 @@ +import FWCore.ParameterSet.Config as cms + +TauEmbSelection = cms.PSet( + outputCommands = cms.untracked.vstring( + 'keep *_selectedMuonsForEmbedding_*_SELECT', + 'keep *_patMuonsAfterID_*_SELECT', + 'keep *_slimmedMuons_*_SELECT', + 'keep *_slimmedMuonTrackExtras_*_SELECT', + 'keep recoVertexs_offlineSlimmedPrimaryVertices_*_SELECT', + 'keep *_firstStepPrimaryVertices_*_SELECT', + 'keep *_ecalDrivenElectronSeeds_*_SELECT' + ) +) + +TauEmbCleaning = cms.PSet( + outputCommands = cms.untracked.vstring( + 'drop *_*_*_SELECT', + 'drop recoIsoDepositedmValueMap_muIsoDepositTk_*_*', + 'drop recoIsoDepositedmValueMap_muIsoDepositTkDisplaced_*_*', + 'drop *_ctppsProtons_*_*', + 'drop *_ctppsLocalTrackLiteProducer_*_*', + 'drop *_ctppsDiamondLocalTracks_*_*', + 'drop *_ctppsDiamondRecHits_*_*', + 'drop *_ctppsDiamondRawToDigi_*_*', + 'drop *_ctppsPixelLocalTracks_*_*', + 'drop *_ctppsPixelRecHits_*_*', + 'drop *_ctppsPixelClusters_*_*', + 'drop *_ctppsPixelDigis_*_*', + 'drop *_totemRPLocalTrackFitter_*_*', + 'drop *_totemRPUVPatternFinder_*_*', + 'drop *_totemRPRecHitProducer_*_*', + 'drop *_totemRPClusterProducer_*_*', + 'drop *_totemRPRawToDigi_*_*', + 'drop *_muonSimClassifier_*_*', + 'keep *_patMuonsAfterID_*_SELECT', + 'keep *_slimmedMuons_*_SELECT', + 'keep *_selectedMuonsForEmbedding_*_SELECT', + 'keep recoVertexs_offlineSlimmedPrimaryVertices_*_SELECT', + 'keep *_firstStepPrimaryVertices_*_SELECT', + 'keep *_offlineBeamSpot_*_SELECT', + 'keep *_l1extraParticles_*_SELECT', + 'keep TrajectorySeeds_*_*_*', + 'keep recoElectronSeeds_*_*_*', + 'keep *_generalTracks_*_LHEembeddingCLEAN', + 'keep *_generalTracks_*_CLEAN', + 'keep *_cosmicsVetoTracksRaw_*_LHEembeddingCLEAN', + 'keep *_cosmicsVetoTracksRaw_*_CLEAN', + 'keep *_electronGsfTracks_*_LHEembeddingCLEAN', + 'keep *_electronGsfTracks_*_CLEAN', + 'keep *_lowPtGsfEleGsfTracks_*_LHEembeddingCLEAN', + 'keep *_lowPtGsfEleGsfTracks_*_CLEAN', + 'keep *_displacedTracks_*_LHEembeddingCLEAN', + 'keep *_displacedTracks_*_CLEAN', + 'keep *_ckfOutInTracksFromConversions_*_LHEembeddingCLEAN', + 'keep *_ckfOutInTracksFromConversions_*_CLEAN', + 'keep *_muons1stStep_*_LHEembeddingCLEAN', + 'keep *_muons1stStep_*_CLEAN', + 'keep *_displacedMuons1stStep_*_LHEembeddingCLEAN', + 'keep *_displacedMuons1stStep_*_CLEAN', + 'keep *_conversions_*_LHEembeddingCLEAN', + 'keep *_conversions_*_CLEAN', + 'keep *_allConversions_*_LHEembeddingCLEAN', + 'keep *_allConversions_*_CLEAN', + 'keep *_particleFlowTmp_*_LHEembeddingCLEAN', + 'keep *_particleFlowTmp_*_CLEAN', + 'keep *_ecalDigis_*_LHEembeddingCLEAN', + 'keep *_ecalDigis_*_CLEAN', + 'keep *_hcalDigis_*_LHEembeddingCLEAN', + 'keep *_hcalDigis_*_CLEAN', + 'keep *_ecalRecHit_*_LHEembeddingCLEAN', + 'keep *_ecalRecHit_*_CLEAN', + 'keep *_ecalPreshowerRecHit_*_LHEembeddingCLEAN', + 'keep *_ecalPreshowerRecHit_*_CLEAN', + 'keep *_hbhereco_*_LHEembeddingCLEAN', + 'keep *_hbhereco_*_CLEAN', + 'keep *_horeco_*_LHEembeddingCLEAN', + 'keep *_horeco_*_CLEAN', + 'keep *_hfreco_*_LHEembeddingCLEAN', + 'keep *_hfreco_*_CLEAN', + 'keep *_standAloneMuons_*_LHEembeddingCLEAN', + 'keep *_glbTrackQual_*_LHEembeddingCLEAN', + 'keep *_externalLHEProducer_*_LHEembedding', + 'keep *_externalLHEProducer_*_LHEembeddingCLEAN' + ) +) + +TauEmbSimGen = cms.PSet( + outputCommands = cms.untracked.vstring( + 'keep *_*_*_LHEembeddingCLEAN', + 'keep *_*_*_SELECT', + 'drop *_muonReducedTrackExtras_*_*', + 'drop *_*_uncleanedConversions_*', + 'drop *_diamondSampicLocalTracks_*_*', + 'keep *_*_unsmeared_*' + ) +) + +TauEmbSimHLT = cms.PSet( + outputCommands = cms.untracked.vstring( + 'keep *_*_*_SELECT', + 'keep *_*_*_LHEembeddingCLEAN', + 'keep *_*_unsmeared_SIMembeddingpreHLT', + 'keep DcsStatuss_hltScalersRawToDigi_*_*' + ) +) + +TauEmbSimReco = cms.PSet( + outputCommands = cms.untracked.vstring( + 'keep *_*_*_LHEembeddingCLEAN', + 'keep *_*_*_SELECT', + 'keep *_genParticles_*_SIMembedding', + 'keep *_standAloneMuons_*_SIMembedding', + 'keep *_glbTrackQual_*_SIMembedding', + 'keep *_generator_*_SIMembedding', + 'keep *_addPileupInfo_*_SIMembedding', + 'keep *_selectedMuonsForEmbedding_*_*', + 'keep *_slimmedAddPileupInfo_*_*', + 'keep *_embeddingHltPixelVertices_*_*', + 'keep *_*_vertexPosition_*', + 'keep recoMuons_muonsFromCosmics_*_*', + 'keep recoTracks_cosmicMuons1Leg_*_*', + 'keep recoMuons_muonsFromCosmics1Leg_*_*', + 'keep *_muonDTDigis_*_*', + 'keep *_muonCSCDigis_*_*', + 'keep TrajectorySeeds_*_*_*', + 'keep recoElectronSeeds_*_*_*', + 'drop recoIsoDepositedmValueMap_muIsoDepositTk_*_*', + 'drop recoIsoDepositedmValueMap_muIsoDepositTkDisplaced_*_*', + 'drop *_ctppsProtons_*_*', + 'drop *_ctppsLocalTrackLiteProducer_*_*', + 'drop *_ctppsDiamondLocalTracks_*_*', + 'drop *_ctppsDiamondRecHits_*_*', + 'drop *_ctppsDiamondRawToDigi_*_*', + 'drop *_ctppsPixelLocalTracks_*_*', + 'drop *_ctppsPixelRecHits_*_*', + 'drop *_ctppsPixelClusters_*_*', + 'drop *_ctppsPixelDigis_*_*', + 'drop *_totemRPLocalTrackFitter_*_*', + 'drop *_totemRPUVPatternFinder_*_*', + 'drop *_totemRPRecHitProducer_*_*', + 'drop *_totemRPClusterProducer_*_*', + 'drop *_totemRPRawToDigi_*_*', + 'drop *_muonSimClassifier_*_*', + 'keep *_generalTracks_*_SIMembedding', + 'keep *_cosmicsVetoTracksRaw_*_SIMembedding', + 'keep *_electronGsfTracks_*_SIMembedding', + 'keep *_lowPtGsfEleGsfTracks_*_SIMembedding', + 'keep *_displacedTracks_*_SIMembedding', + 'keep *_ckfOutInTracksFromConversions_*_SIMembedding', + 'keep *_muons1stStep_*_SIMembedding', + 'keep *_displacedMuons1stStep_*_SIMembedding', + 'keep *_conversions_*_SIMembedding', + 'keep *_allConversions_*_SIMembedding', + 'keep *_particleFlowTmp_*_SIMembedding', + 'keep *_ecalDigis_*_SIMembedding', + 'keep *_hcalDigis_*_SIMembedding', + 'keep *_ecalRecHit_*_SIMembedding', + 'keep *_ecalPreshowerRecHit_*_SIMembedding', + 'keep *_hbhereco_*_SIMembedding', + 'keep *_horeco_*_SIMembedding', + 'keep *_hfreco_*_SIMembedding', + 'keep *_offlinePrimaryVertices_*_SIMembedding', + 'keep *_*_unsmeared_SIMembeddingpreHLT', + 'keep *_hltScalersRawToDigi_*_SIMembeddingHLT' + ) +) + +TauEmbMerge = cms.PSet( + outputCommands = cms.untracked.vstring( + 'drop *_*_*_SELECT', + 'keep *_prunedGenParticles_*_MERGE', + 'keep *_generator_*_SIMembeddingpreHLT', + 'keep *_generator_*_SIMembeddingHLT', + 'keep *_generator_*_SIMembedding', + 'keep *_selectedMuonsForEmbedding_*_*', + 'keep *_unpackedPatTrigger_*_*', + 'keep patPackedGenParticles_packedGenParticles_*_*', + 'keep recoGenParticles_prunedGenParticles_*_*', + 'keep *_packedPFCandidateToGenAssociation_*_*', + 'keep *_lostTracksToGenAssociation_*_*', + 'keep LHEEventProduct_*_*_*', + 'keep GenFilterInfo_*_*_*', + 'keep GenLumiInfoHeader_generator_*_*', + 'keep GenLumiInfoProduct_*_*_*', + 'keep GenEventInfoProduct_generator_*_*', + 'keep recoGenParticles_genPUProtons_*_*', + 'keep *_slimmedGenJetsFlavourInfos_*_*', + 'keep *_slimmedGenJets__*', + 'keep *_slimmedGenJetsAK8__*', + 'keep *_slimmedGenJetsAK8SoftDropSubJets__*', + 'keep *_genMetTrue_*_*', + 'keep LHERunInfoProduct_*_*_*', + 'keep GenRunInfoProduct_*_*_*', + 'keep *_genParticles_xyz0_*', + 'keep *_genParticles_t0_*' + ) +) + +TauEmbNano = cms.PSet( + outputCommands = cms.untracked.vstring( + 'keep edmTriggerResults_*_*_SIMembeddingpreHLT', + 'keep edmTriggerResults_*_*_SIMembeddingHLT', + 'keep edmTriggerResults_*_*_SIMembedding', + 'keep edmTriggerResults_*_*_MERGE', + 'keep edmTriggerResults_*_*_NANO' + ) +) \ No newline at end of file diff --git a/TauAnalysis/MCEmbeddingTools/python/LHE_USER_cff.py b/TauAnalysis/MCEmbeddingTools/python/LHE_USER_cff.py new file mode 100644 index 0000000000000..6dd1e5d7c058a --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/LHE_USER_cff.py @@ -0,0 +1,43 @@ +""" +This config fragment generates LHE information for tau embedding. The selection step must be carried out beforehand. +It's normally used together with the cleaning step. +With `--procModifiers` one can specify wheather to simulate/embed muons (`tau_embedding_mu_to_mu`) or electrons (`tau_embedding_mu_to_e`) instead of taus. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingCleaning \ + --datatier RAWRECO \ + --procModifiers tau_embedding_cleaning,tau_embedding_mu_to_mu \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" +import FWCore.ParameterSet.Config as cms +from Configuration.ProcessModifiers.tau_embedding_mu_to_e_cff import ( + tau_embedding_mu_to_e, +) +from Configuration.ProcessModifiers.tau_embedding_mu_to_mu_cff import ( + tau_embedding_mu_to_mu, +) + +externalLHEProducer = cms.EDProducer("EmbeddingLHEProducer", + src = cms.InputTag("selectedMuonsForEmbedding","",""), + vertices = cms.InputTag("offlineSlimmedPrimaryVertices","","SELECT"), + particleToEmbed = cms.int32(15), +) +# if running mu->mu embedding simulate muon (pid=13) instead of a tau (pid=15) +tau_embedding_mu_to_mu.toModify(externalLHEProducer, particleToEmbed = cms.int32(13)) +# if running mu->e embedding simulate electron (pid=11) instead of a tau (pid=15) +tau_embedding_mu_to_e.toModify(externalLHEProducer, particleToEmbed = cms.int32(11)) + +# switch on bunch spacing override to 25ns for tau embedding in +# RecoLuminosity/LumiProducer/python/bunchSpacingProducer_cfi.py + + +embeddingLHEProducerTask = cms.Sequence(externalLHEProducer) \ No newline at end of file diff --git a/TauAnalysis/MCEmbeddingTools/python/Merging_USER_cff.py b/TauAnalysis/MCEmbeddingTools/python/Merging_USER_cff.py new file mode 100644 index 0000000000000..c8aa5e093f2b8 --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Merging_USER_cff.py @@ -0,0 +1,355 @@ +""" +This config fragment is used for the merging step of the embedding samples. +It merges the collections from the simulation step and the cleaning step. +To do this some producers which are already in the schedule are replaced with embedding merger producers and some are added to the schedule. +The collections which are merged are the collections which serve as input for particle flow producers. +The Simulation RECO step must be carried out beforehand. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --processName MERGE \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingMergeMINIAOD \ + --datatier USER \ + --inputCommands 'keep *_*_*_*' \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" + +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Reconstruction_Data_cff import * # most of the producers which are replaced here are imported in this file +from Configuration.StandardSequences.RawToDigi_cff import * # placed this here to be consistent with the older developments, don't know if this is really needed +import PhysicsTools.PatAlgos.tools.coreTools +from PhysicsTools.PatAlgos.slimming.miniAOD_tools import miniAOD_customizeMC +from Configuration.ProcessModifiers.tau_embedding_merging_cff import tau_embedding_merging + +# overriding behaviour of 'removeMCMatching', as we also use mc and need this so that nanoAODs are correctly produced +# This is needed because we now have a hybrid event which contains both simulation and reconstructed data. +PhysicsTools.PatAlgos.tools.coreTools.removeMCMatching = lambda process, names, postfix, outputModules : miniAOD_customizeMC(process) + +from PhysicsTools.PatAlgos.slimming.unpackedPatTrigger_cfi import unpackedPatTrigger + +unpackedPatTrigger.triggerResults = cms.InputTag("TriggerResults::SIMembeddingHLT") + +# In the following replace producers that produce collections which are used as input for particle flow producers +# by their corresponding merger producers. +# The merger producers merge the collections from the simulation step and the cleaning step. +# Those "toReplaceWith" modifiers need to be applied as late as possible e.g. in StandardSequences.Reconstruction_Data_cff. +# This is to avoid collisions with other modules that are cloned and modified versions from the original modules or "toModify" modifier +# calls that try to modify the original modules. They throw an exeption trying to do this on the replaced merger modules. + +# defined in RecoMuon/MuonIdentification/python/cosmics_id.py +tau_embedding_cosmicsVetoTracksRaw_merger = cms.EDProducer("TrackColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("cosmicsVetoTracksRaw", "", "SIMembedding"), + cms.InputTag("cosmicsVetoTracksRaw", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(cosmicsVetoTracksRaw, tau_embedding_cosmicsVetoTracksRaw_merger) + +# defined in RecoEgamma/EgammaElectronProducers/python/lowPtGsfElectronSequence_cff.py +tau_embedding_lowPtGsfEleGsfTracks_merger = cms.EDProducer("GsfTrackColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("lowPtGsfEleGsfTracks", "", "SIMembedding"), + cms.InputTag("lowPtGsfEleGsfTracks", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(lowPtGsfEleGsfTracks, tau_embedding_lowPtGsfEleGsfTracks_merger) + +# defined in RecoMuon/Configuration/python/MergeDisplacedTrackCollections_cff.py +tau_embedding_displacedTracks_merger = cms.EDProducer("TrackColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("displacedTracks", "", "SIMembedding"), + cms.InputTag("displacedTracks", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(displacedTracks, tau_embedding_displacedTracks_merger) + +# defined in RecoParticleFlow/PFProducer/python/particleFlow_cff.py +tau_embedding_particleFlowTmp_merger = cms.EDProducer("PFColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("particleFlowTmp", "", "SIMembedding"), + cms.InputTag("particleFlowTmp", "", "LHEembeddingCLEAN"), + cms.InputTag("particleFlowTmp", "CleanedHF", "SIMembedding"), + cms.InputTag("particleFlowTmp", "CleanedHF", "LHEembeddingCLEAN"), + cms.InputTag("particleFlowTmp", "CleanedCosmicsMuons", "SIMembedding"), + cms.InputTag("particleFlowTmp", "CleanedCosmicsMuons", "LHEembeddingCLEAN"), + cms.InputTag("particleFlowTmp", "CleanedTrackerAndGlobalMuons", "SIMembedding"), + cms.InputTag("particleFlowTmp", "CleanedTrackerAndGlobalMuons", "LHEembeddingCLEAN"), + cms.InputTag("particleFlowTmp", "CleanedFakeMuons", "SIMembedding"), + cms.InputTag("particleFlowTmp", "CleanedFakeMuons", "LHEembeddingCLEAN"), + cms.InputTag("particleFlowTmp", "CleanedPunchThroughMuons", "SIMembedding"), + cms.InputTag("particleFlowTmp", "CleanedPunchThroughMuons", "LHEembeddingCLEAN"), + cms.InputTag("particleFlowTmp", "CleanedPunchThroughNeutralHadrons", "SIMembedding"), + cms.InputTag("particleFlowTmp", "CleanedPunchThroughNeutralHadrons", "LHEembeddingCLEAN"), + cms.InputTag("particleFlowTmp", "AddedMuonsAndHadrons", "SIMembedding"), + cms.InputTag("particleFlowTmp", "AddedMuonsAndHadrons", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(particleFlowTmp, tau_embedding_particleFlowTmp_merger) + +# defined in RecoLocalCalo/EcalRecProducers/python/ecalPreshowerRecHit_cfi.py +tau_embedding_ecalPreshowerRecHit_merger = cms.EDProducer("EcalRecHitColMerger", + mergeCollections=cms.VInputTag( + cms.InputTag("ecalPreshowerRecHit", "EcalRecHitsES", "SIMembedding"), + cms.InputTag("ecalPreshowerRecHit", "EcalRecHitsES", "LHEembeddingCLEAN"), + ) +) +tau_embedding_merging.toReplaceWith(ecalPreshowerRecHit, tau_embedding_ecalPreshowerRecHit_merger) + +# defined in RecoLocalCalo/HcalRecProducers/python/HcalHitReconstructor_ho_cfi.py +tau_embedding_horeco_merger = cms.EDProducer("HORecHitColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("horeco", "", "SIMembedding"), + cms.InputTag("horeco", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(horeco, tau_embedding_horeco_merger) + +# defined in RecoLocalCalo/HcalRecProducers/python/HFPhase1Reconstructor_cfi.py +tau_embedding_hfreco_merger = cms.EDProducer("HFRecHitColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("hfreco", "", "SIMembedding"), + cms.InputTag("hfreco", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(hfreco, tau_embedding_hfreco_merger) + +# defined in RecoTracker/FinalTrackSelectors/python/MergeTrackCollections_cff.py +tau_embedding_generalTracks_merger = cms.EDProducer("TrackColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("generalTracks", "", "SIMembedding"), + cms.InputTag("generalTracks", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(generalTracks, tau_embedding_generalTracks_merger) + +# defined in TrackingTools/GsfTracking/python/GsfElectronGsfFit_cff.py +tau_embedding_electronGsfTracks_merger = cms.EDProducer("GsfTrackColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("electronGsfTracks", "", "SIMembedding"), + cms.InputTag("electronGsfTracks", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(electronGsfTracks, tau_embedding_electronGsfTracks_merger) + +# defined in RecoEgamma/EgammaPhotonProducers/python/allConversions_cfi.py +tau_embedding_allConversions_merger = cms.EDProducer("ConversionColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("allConversions", "", "SIMembedding"), + cms.InputTag("allConversions", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(allConversions, tau_embedding_allConversions_merger) + +# defined in RecoEgamma/EgammaPhotonProducers/python/ckfOutInTracksFromConversions_cfi.py +tau_embedding_ckfOutInTracksFromConversions_merger = cms.EDProducer("TrackColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("ckfOutInTracksFromConversions", "", "SIMembedding"), + cms.InputTag("ckfOutInTracksFromConversions", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(ckfOutInTracksFromConversions, tau_embedding_ckfOutInTracksFromConversions_merger) + +# defined in RecoEgamma/EgammaPhotonProducers/python/conversions_cfi.py +tau_embedding_conversions_merger = cms.EDProducer("ConversionColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("conversions", "", "SIMembedding"), + cms.InputTag("conversions", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(conversions, tau_embedding_conversions_merger) + +# defined in RecoMuon/MuonIdentification/python/muons1stStep_cfi.py +tau_embedding_muons1stStep_merger = cms.EDProducer("MuonColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("muons1stStep", "", "SIMembedding"), + cms.InputTag("muons1stStep", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(muons1stStep, tau_embedding_muons1stStep_merger) + +# defined in RecoMuon/Configuration/python/RecoMuonPPonly_cff.py +tau_embedding_displacedMuons1stStep_merger = cms.EDProducer("MuonColMerger", + mergeCollections = cms.VInputTag( + cms.InputTag("displacedMuons1stStep", "", "SIMembedding"), + cms.InputTag("displacedMuons1stStep", "", "LHEembeddingCLEAN") + ) +) +tau_embedding_merging.toReplaceWith(displacedMuons1stStep, tau_embedding_displacedMuons1stStep_merger) + +# defined in RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cfi.py +tau_embedding_ecalRecHit_merger = cms.EDProducer( + "EcalRecHitColMerger", + mergeCollections=cms.VInputTag( + cms.InputTag("ecalRecHit", "EcalRecHitsEB", "SIMembedding"), + cms.InputTag("ecalRecHit", "EcalRecHitsEB", "LHEembeddingCLEAN"), + cms.InputTag("ecalRecHit", "EcalRecHitsEE", "SIMembedding"), + cms.InputTag("ecalRecHit", "EcalRecHitsEE", "LHEembeddingCLEAN"), + ), +) +tau_embedding_merging.toModify(ecalRecHit, cpu=tau_embedding_ecalRecHit_merger) + +# defined in EventFilter/EcalRawToDigi/python/ecalDigis_cfi.py + +tau_embedding_ecalDigis_merger = cms.EDProducer( + "EcalSrFlagColMerger", + mergeCollections=cms.VInputTag( + cms.InputTag("ecalDigis", "", "SIMembedding"), + cms.InputTag("ecalDigis", "", "LHEembeddingCLEAN"), + ), +) +tau_embedding_merging.toModify(ecalDigis, cpu=tau_embedding_ecalDigis_merger) + +# defined in EventFilter/HcalRawToDigi/python/HcalRawToDigi_cfi.py +tau_embedding_hcalDigis_merger = cms.EDProducer( + "HcalDigiColMerger", + mergeCollections=cms.VInputTag( + cms.InputTag("hcalDigis", "", "SIMembedding"), + cms.InputTag("hcalDigis", "", "LHEembeddingCLEAN"), + ), +) +tau_embedding_merging.toReplaceWith(hcalDigis, tau_embedding_hcalDigis_merger) + +# defined in RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py +tau_embedding_hbhereco_merger = cms.EDProducer("HBHERecHitColMerger", + mergeCollections=cms.VInputTag( + cms.InputTag("hbhereco", "", "SIMembedding"), + cms.InputTag("hbhereco", "", "LHEembeddingCLEAN"), + ) +) +tau_embedding_merging.toModify(hbhereco, cpu=tau_embedding_hbhereco_merger) + +# create a sequence which runs some of the merge producers, which were just created. +merge_step = cms.Sequence( + ecalDigis + + hcalDigis + + generalTracks + + hbhereco + + electronGsfTracks + + ckfOutInTracksFromConversions + + allConversions + + muons1stStep + + displacedMuons1stStep +) +# add more producers which are needed by the PAT step to the sequence +from EventFilter.CTPPSRawToDigi.totemRPRawToDigi_cfi import totemRPRawToDigi + +totemRPRawToDigi.rawDataTag = cms.InputTag("rawDataCollector", "", "LHC") +merge_step += totemRPRawToDigi + +# produce local CT PPS reco +from EventFilter.CTPPSRawToDigi.ctppsDiamondRawToDigi_cfi import ctppsDiamondRawToDigi +from EventFilter.CTPPSRawToDigi.ctppsPixelDigis_cfi import ctppsPixelDigis + +ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataCollector", "", "LHC") +ctppsPixelDigis.inputLabel = cms.InputTag("rawDataCollector", "", "LHC") +merge_step += ctppsDiamondRawToDigi + ctppsPixelDigis + +from RecoPPS.Configuration.recoCTPPS_cff import recoCTPPSTask + +merge_step += cms.Sequence(recoCTPPSTask) + +# produce local calo +from RecoLocalCalo.Configuration.RecoLocalCalo_cff import ( + calolocalreco, + reducedHcalRecHitsSequence, +) + +merge_step += calolocalreco + reducedHcalRecHitsSequence + +from RecoJets.JetProducers.CaloTowerSchemeB_cfi import towerMaker + +# produce hcal towers +from RecoLocalCalo.CaloTowersCreator.calotowermaker_cfi import calotowermaker + +merge_step += calotowermaker + towerMaker + +# produce clusters +from RecoEcal.Configuration.RecoEcal_cff import ecalClusters + +merge_step += ecalClusters + +from RecoEcal.EgammaClusterProducers.particleFlowSuperClusteringSequence_cff import ( + particleFlowSuperClusteringSequence, +) + +# produce PFCluster Collections +from RecoParticleFlow.PFClusterProducer.particleFlowCluster_cff import ( + particleFlowCluster, +) + +merge_step += particleFlowCluster + particleFlowSuperClusteringSequence + +# produce muonEcalDetIds +from RecoMuon.MuonIdentification.muons1stStep_cfi import muonEcalDetIds +from RecoMuon.MuonIdentification.muonShowerInformationProducer_cff import ( + muonShowerInformation, +) + +merge_step += muonEcalDetIds + muonShowerInformation + +# muon Isolation sequences +from RecoMuon.MuonIsolationProducers.muIsolation_cff import ( + muIsolation, + muIsolationDisplaced, +) + +merge_step += muIsolation + muIsolationDisplaced + +# muon ID selection type sequences + +from RecoMuon.MuonIdentification.muonSelectionTypeValueMapProducer_cff import ( + muonSelectionTypeSequence, +) + +merge_step += muonSelectionTypeSequence + +from RecoMuon.Configuration.MergeDisplacedTrackCollections_cff import ( + displacedTracksSequence, +) + +# displaced muon reduced track extras and tracks +from RecoMuon.MuonIdentification.displacedMuonReducedTrackExtras_cfi import ( + displacedMuonReducedTrackExtras, +) + +merge_step += displacedMuonReducedTrackExtras + displacedTracksSequence + +# Other things +from RecoTracker.DeDx.dedxEstimators_cff import doAlldEdXEstimators + +merge_step += doAlldEdXEstimators + +from RecoVertex.Configuration.RecoVertex_cff import ( + unsortedOfflinePrimaryVertices, + vertexreco, +) + +merge_step += vertexreco + +unsortedOfflinePrimaryVertices.beamSpotLabel = cms.InputTag( + "offlineBeamSpot", "", "SELECT" +) +from RecoJets.JetProducers.caloJetsForTrk_cff import ak4CaloJetsForTrk + +ak4CaloJetsForTrk.srcPVs = cms.InputTag("firstStepPrimaryVertices", "", "SELECT") + +from RecoTracker.DeDx.dedxEstimators_cff import dedxHitInfo + +dedxHitInfo.clusterShapeCache = cms.InputTag("") + +from Configuration.StandardSequences.Reconstruction_cff import highlevelreco + +merge_step += highlevelreco + +from CommonTools.ParticleFlow.genForPF2PAT_cff import * + +merge_step += genForPF2PATSequence + +# total merge_step = cms.Path(ecalDigis+hcalDigis+generalTracks+hbhereco+electronGsfTracks+ckfOutInTracksFromConversions+allConversions+muons1stStep+displacedMuons1stStep+totemRPRawToDigi+ctppsDiamondRawToDigi+ctppsPixelDigis+cms.Sequence(recoCTPPSTask)+calolocalreco+reducedHcalRecHitsSequence+calotowermaker+towerMaker+ecalClusters+particleFlowCluster+particleFlowSuperClusteringSequence+muonEcalDetIds+muonShowerInformation+muIsolation+muIsolationDisplaced+muonSelectionTypeSequence+displacedMuonReducedTrackExtras+displacedTracksSequence+doAlldEdXEstimators+vertexreco+highlevelreco+genForPF2PATSequence) diff --git a/TauAnalysis/MCEmbeddingTools/python/Nano_cff.py b/TauAnalysis/MCEmbeddingTools/python/Nano_cff.py new file mode 100644 index 0000000000000..c06ae44fc2aa9 --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Nano_cff.py @@ -0,0 +1,169 @@ +""" +This config fragment is used to generate NanoAOD samples from tau embedding MiniAOD samples. +It adds an additional table with information about the initially selected muons and the initial event. + +As the tau embedding event is a hybrid event and we want to have information about the measured event and the generated tau decay, +Both, the normal NanoAOD sequence for measured events and the NanoAOD sequence for simulated events, have to run. +This and the embeddingTable_seq is configured in the autoNANO dict in PhysicsTools/NanoAOD/python/autoNANO.py +With this one can simply add `NANO:@TauEmbedding` to the `--step` parameter of the cmsDriver command, to get all the additional tables. +The merging step must be carried out beforehand. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py \ + --step NANO:@TauEmbedding \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingNANOAOD \ + --datatier NANOAODSIM \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" + +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import ExtVar + +# This table producer adds information about the initially selected muons and the initial event to the NanoAOD. +# The information comes from the `selectedMuonsForEmbedding` producer, which is created in the selection step. +embeddingTable = cms.EDProducer( + "GlobalVariablesTableProducer", + name=cms.string("TauEmbedding"), + # doc=cms.string("TauEmbedding"), + variables=cms.PSet( + ptLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "ptLeadingMuon"), + float, + doc="leading muon pt", + ), + ptTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "ptTrailingMuon"), + float, + doc="trailing muon pt", + ), + etaLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "etaLeadingMuon"), + float, + doc="leading muon eta", + ), + etaTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "etaTrailingMuon"), + float, + doc="trailing muon eta", + ), + phiLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "phiLeadingMuon"), + float, + doc="leading muon phi", + ), + phiTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "phiTrailingMuon"), + float, + doc="trailing muon phi", + ), + chargeLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "chargeLeadingMuon"), + float, + doc="leading muon charge", + ), + chargeTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "chargeTrailingMuon"), + float, + doc="trailing muon charge", + ), + dbLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "dbLeadingMuon"), + float, + doc="leading muon DB", + ), + dbTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "dbTrailingMuon"), + float, + doc="trailing muon DB", + ), + massLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "massLeadingMuon"), + float, + doc="leading muon mass", + ), + massTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "massTrailingMuon"), + float, + doc="trailing muon mass", + ), + vtxXLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "vtxxLeadingMuon"), + float, + doc="leading muon vertex X", + ), + vtxYLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "vtxyLeadingMuon"), + float, + doc="leading muon vertex Y", + ), + vtxZLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "vtxzLeadingMuon"), + float, + doc="leading muon vertex Z", + ), + vtxXTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "vtxxTrailingMuon"), + float, + doc="trailing muon vertex X", + ), + vtxYTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "vtxyTrailingMuon"), + float, + doc="trailing muon vertex Y", + ), + vtxZTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "vtxzTrailingMuon"), + float, + doc="trailing muon vertex Z", + ), + isMediumLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "isMediumLeadingMuon"), + bool, + doc="leading muon ID (medium)", + ), + isMediumTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "isMediumTrailingMuon"), + bool, + doc="trailing muon ID (medium)", + ), + isTightLeadingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "isTightLeadingMuon"), + bool, + doc="leading muon ID (tight)", + ), + isTightTrailingMuon=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "isTightTrailingMuon"), + bool, + doc="trailing muon ID (tight)", + ), + initialMETEt=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "initialMETEt"), + float, + doc="MET Et of selected event", + ), + initialMETphi=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "initialMETphi"), + float, + doc="MET phi of selected event", + ), + initialPuppiMETEt=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "initialPuppiMETEt"), + float, + doc="PuppiMET Et of selected event", + ), + initialPuppiMETphi=ExtVar( + cms.InputTag("selectedMuonsForEmbedding", "initialPuppiMETphi"), + float, + doc="PuppiMET phi of selected event", + ), + ), +) +# put all sequences and tasks together to create the embedding NanoAOD sequence +embeddingTableTask = cms.Task(embeddingTable) +embeddingTable_seq = cms.Sequence(embeddingTableTask) diff --git a/TauAnalysis/MCEmbeddingTools/python/SelectingProcedure_cff.py b/TauAnalysis/MCEmbeddingTools/python/SelectingProcedure_cff.py deleted file mode 100644 index d142fd56a9f81..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/SelectingProcedure_cff.py +++ /dev/null @@ -1,88 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from Configuration.StandardSequences.PAT_cff import * - -from PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi import patMuons -from HLTrigger.HLTfilters.triggerResultsFilter_cfi import * -from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff import run2_HLTconditions_2016 - -## Trigger requirements -doubleMuonHLTTrigger = cms.EDFilter("TriggerResultsFilter", - hltResults = cms.InputTag("TriggerResults","","HLT"), - l1tResults = cms.InputTag(""), - throw = cms.bool(False), - triggerConditions = cms.vstring("HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v* OR HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v*") # from 2017 on (up to Run 3, it seems) -) - -run2_HLTconditions_2016.toModify(doubleMuonHLTTrigger, - triggerConditions = ["HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v* OR HLT_Mu17_TrkIsoVVL_TkMu8_TrkIsoVVL_DZ_v*"]) - -## Muon selection -patMuonsAfterKinCuts = cms.EDFilter("PATMuonSelector", - src = cms.InputTag("slimmedMuons"), - cut = cms.string("pt > 8 && abs(eta) < 2.5"), - filter = cms.bool(True) -) - - -# For impact parameter (w.r.t. to PV) requirements, a vector collection is needed, therefore only dB < 0.2 required. -# The default requirements (in C++): -# 1) fabs(recoMu.muonBestTrack()->dxy(vertex->position())) < 0.2 ----> similar to dB < 0.2 -# 2) fabs(recoMu.muonBestTrack()->dz(vertex->position())) < 0.5 -patMuonsAfterTightID = cms.EDFilter("PATMuonSelector", - src = cms.InputTag("patMuonsAfterKinCuts"), - cut = cms.string( - "isPFMuon && isGlobalMuon" - " && muonID('GlobalMuonPromptTight')" - " && numberOfMatchedStations > 1" - " && innerTrack.hitPattern.trackerLayersWithMeasurement > 5" - " && innerTrack.hitPattern.numberOfValidPixelHits > 0" - " && dB < 0.2" - ), - filter = cms.bool(True) -) - -patMuonsAfterMediumID = cms.EDFilter("PATMuonSelector", - src = cms.InputTag("patMuonsAfterKinCuts"), - cut = cms.string("isMediumMuon"), - filter = cms.bool(True) -) - -patMuonsAfterLooseID = cms.EDFilter("PATMuonSelector", - src = cms.InputTag("patMuonsAfterKinCuts"), - cut = cms.string("isLooseMuon"), - filter = cms.bool(True) -) - -patMuonsAfterID = patMuonsAfterLooseID.clone() - -ZmumuCandidates = cms.EDProducer("CandViewShallowCloneCombiner", - checkCharge = cms.bool(True), - # require one of the muons with pT > 17 GeV, and an invariant mass > 20 GeV - cut = cms.string('charge = 0 & max(daughter(0).pt, daughter(1).pt) > 17 & mass > 20 & daughter(0).isGlobalMuon & daughter(1).isGlobalMuon'), - decay = cms.string("patMuonsAfterID@+ patMuonsAfterID@-") -) - - -ZmumuCandidatesFilter = cms.EDFilter("CandViewCountFilter", - src = cms.InputTag("ZmumuCandidates"), - minNumber = cms.uint32(1) - # filter = cms.bool(True) -) - -selectedMuonsForEmbedding = cms.EDProducer("MuMuForEmbeddingSelector", - ZmumuCandidatesCollection = cms.InputTag("ZmumuCandidates"), - use_zmass = cms.bool(False), - inputTagVertex = cms.InputTag("offlinePrimaryVertices"), - inputTagBeamSpot = cms.InputTag("offlineBeamSpot"), - PuppiMet = cms.InputTag("slimmedMETsPuppi"), - Met = cms.InputTag("slimmedMETs"), -) - -makePatMuonsZmumuSelection = cms.Sequence( - doubleMuonHLTTrigger - + patMuonsAfterKinCuts - + patMuonsAfterID - + ZmumuCandidates - + ZmumuCandidatesFilter - + selectedMuonsForEmbedding -) diff --git a/TauAnalysis/MCEmbeddingTools/python/Selection_FILTER_cff.py b/TauAnalysis/MCEmbeddingTools/python/Selection_FILTER_cff.py new file mode 100644 index 0000000000000..6f0930e9d1994 --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Selection_FILTER_cff.py @@ -0,0 +1,102 @@ +""" +This config fragment filters for a muon pair which can be used for tau embedding. +It selects muons based on trigger conditions, kinematic cuts, and identification criteria. +It then produces a collection of muons suitable for embedding (selectedMuonsForEmbedding), including their kinematic properties. +This is then later used in the LHE step to simulate two taus with slightly adjusted kinematics. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ + --data \ + --scenario pp \ + --eventcontent TauEmbeddingSelection \ + --datatier RAWRECO \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" + +import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run2_HLTconditions_2016_cff import ( + run2_HLTconditions_2016, +) +from Configuration.Eras.Modifier_run2_HLTconditions_2017_cff import ( + run2_HLTconditions_2017, +) +from Configuration.Eras.Modifier_run2_HLTconditions_2018_cff import ( + run2_HLTconditions_2018, +) +from Configuration.StandardSequences.PAT_cff import * +from HLTrigger.HLTfilters.triggerResultsFilter_cfi import * +from PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi import patMuons + +## Trigger requirements +doubleMuonHLTTrigger = cms.EDFilter("TriggerResultsFilter", + hltResults = cms.InputTag("TriggerResults","","HLT"), + l1tResults = cms.InputTag(""), + throw = cms.bool(False), + triggerConditions = cms.vstring("HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v*") # unprescaled trigger for 2018,22,23,24 (see https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLT2018, https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLT2022, https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLT2023, https://twiki.cern.ch/twiki/bin/view/CMS/MuonHLT2024) +) + +# change the used triggers for run2 +# Use two different triggers as the Mass8 one has a higer luminosity in 2017 according to https://cmshltinfo.app.cern.ch/summary?search=HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass&year=2017&paths=true&prescaled=true&stream-types=Physics +# probably because he was already active in earlier runs than the Mass3p8 trigger +# Both are unprescaled +run2_HLTconditions_2017.toModify(doubleMuonHLTTrigger, + triggerConditions = ["HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v* OR HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v*"]) + +# Both are unprescaled according to https://cmshltinfo.app.cern.ch/summary?search=HLT_Mu17_TrkIsoVVL_&year=2016&paths=true&prescaled=true&stream-types=Physics +run2_HLTconditions_2016.toModify(doubleMuonHLTTrigger, + triggerConditions = ["HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v* OR HLT_Mu17_TrkIsoVVL_TkMu8_TrkIsoVVL_DZ_v*"]) + +## Muon selection +patMuonsAfterKinCuts = cms.EDFilter("PATMuonSelector", + src = cms.InputTag("slimmedMuons", "", "SELECT"), + cut = cms.string("pt > 8 && abs(eta) < 2.5"), + filter = cms.bool(True) +) + +## require loose muon ID +patMuonsAfterID = cms.EDFilter("PATMuonSelector", + src = cms.InputTag("patMuonsAfterKinCuts"), + cut = cms.string("isLooseMuon"), + filter = cms.bool(True) +) + +## create Z->mumu candidates +ZmumuCandidates = cms.EDProducer("CandViewShallowCloneCombiner", + checkCharge = cms.bool(True), + # require one of the muons with pT > 17 GeV, and an invariant mass > 20 GeV + cut = cms.string('charge = 0 & max(daughter(0).pt, daughter(1).pt) > 17 & mass > 20 & daughter(0).isGlobalMuon & daughter(1).isGlobalMuon'), + decay = cms.string("patMuonsAfterID@+ patMuonsAfterID@-") +) + +## require at least one Z->mumu candidate +ZmumuCandidatesFilter = cms.EDFilter("CandViewCountFilter", + src = cms.InputTag("ZmumuCandidates"), + minNumber = cms.uint32(1) + # filter = cms.bool(True) +) + +## Create a collection of muons suitable for embedding +# The MuMuForEmbeddingSelector therefore selects the muons from the Z->mumu candidates, +# where the Z->mumu candidate mass is the highest. +selectedMuonsForEmbedding = cms.EDProducer("MuMuForEmbeddingSelector", + ZmumuCandidatesCollection = cms.InputTag("ZmumuCandidates"), + inputTagVertex = cms.InputTag("offlinePrimaryVertices"), + inputTagBeamSpot = cms.InputTag("offlineBeamSpot"), + PuppiMet = cms.InputTag("slimmedMETsPuppi", "", "SELECT"), + Met = cms.InputTag("slimmedMETs", "", "SELECT"), +) + +makePatMuonsZmumuSelection = cms.Sequence( + doubleMuonHLTTrigger + + patMuonsAfterKinCuts + + patMuonsAfterID + + ZmumuCandidates + + ZmumuCandidatesFilter + + selectedMuonsForEmbedding +) diff --git a/TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py b/TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py new file mode 100644 index 0000000000000..aaa46b517d42e --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py @@ -0,0 +1,203 @@ +""" +This config fragment is needed by the GEN step to modify pythia, which is used to simulate the hadronization of the tau leptons (or electrons/muons). The LHE and cleaning step must be carried out beforehand. +With `--procModifiers` one can specify the final states of the tau decays or if muons (`tau_embedding_mu_to_mu`) or electrons (`tau_embedding_mu_to_e`) are simulated/embedded instead of taus. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ + --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --eventcontent TauEmbeddingSimGen \ + --datatier RAWSIM \ + --procModifiers tau_embedding_sim,tau_embedding_mu_to_mu \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" + +import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run2_common_cff import run2_common +from Configuration.Eras.Modifier_run3_common_cff import run3_common +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * +from Configuration.ProcessModifiers.tau_embedding_emu_cff import tau_embedding_emu +from Configuration.ProcessModifiers.tau_embedding_etauh_cff import tau_embedding_etauh +from Configuration.ProcessModifiers.tau_embedding_mu_to_e_cff import ( + tau_embedding_mu_to_e, +) +from Configuration.ProcessModifiers.tau_embedding_mu_to_mu_cff import ( + tau_embedding_mu_to_mu, +) +from Configuration.ProcessModifiers.tau_embedding_mutauh_cff import ( + tau_embedding_mutauh, +) +from Configuration.ProcessModifiers.tau_embedding_tauhtauh_cff import ( + tau_embedding_tauhtauh, +) +from GeneratorInterface.ExternalDecays.TauolaSettings_cff import * + +# Set the the vertex used for the simulation to the measured vertex. +# replaced in IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py +tau_embedding_vtx_corrected_to_input = cms.EDProducer( + "EmbeddingVertexCorrector", src=cms.InputTag("generator", "unsmeared") +) + +# As we only want to simulate the the taus, we have to disable the noise simulation. +# Those settings can be set in the digitizers of the mixing module (SimGeneral/MixingModule/python/mixNoPU_cfi.py, because we don't have PU) +# Because the settings there are also imported, this is done by process modifiers in the following files: +# SimGeneral/MixingModule/python/SiPixelSimParameters_cfi.py +# SimGeneral/MixingModule/python/SiStripSimParameters_cfi.py +# SimGeneral/MixingModule/python/ecalDigitizer_cfi.py +# SimGeneral/MixingModule/python/hcalDigitizer_cfi.py +# SimGeneral/MixingModule/python/castorDigitizer_cfi.py # castor was removed in run3, so this is only needed for run2 + +# The generator module is expected by the GEN step to specify the event generator +generator = cms.EDFilter( + "Pythia8HadronizerFilter", + maxEventsToPrint=cms.untracked.int32(1), + nAttempts=cms.uint32(1000), + HepMCFilter=cms.PSet( + filterName=cms.string("EmbeddingHepMCFilter"), + filterParameters=cms.PSet( + ElElCut=cms.string("El1.Pt > 22 && El2.Pt > 10"), + ElHadCut=cms.string("El.Pt > 28 && Had.Pt > 25"), + ElMuCut=cms.string( + "(El.Pt > 21 && Mu.Pt > 10) || (El.Pt > 10 && Mu.Pt > 21)" + ), + HadHadCut=cms.string("Had1.Pt > 35 && Had2.Pt > 30"), + MuHadCut=cms.string("Mu.Pt > 18 && Had.Pt > 25 && Mu.Eta < 2.1"), + MuMuCut=cms.string("Mu1.Pt > 17 && Mu2.Pt > 8"), + Final_States=cms.vstring( + "ElEl", "ElHad", "ElMu", "HadHad", "MuHad", "MuMu" + ), + BosonPDGID=cms.int32(23), + IncludeDY=cms.bool(False), + ), + ), + pythiaPylistVerbosity=cms.untracked.int32(1), + filterEfficiency=cms.untracked.double(1.0), + pythiaHepMCVerbosity=cms.untracked.bool(False), + comEnergy=cms.double(13600.0), + crossSection=cms.untracked.double(1.0), + PythiaParameters=cms.PSet( + pythia8CommonSettingsBlock, + pythia8CUEP8M1SettingsBlock, + processParameters=cms.vstring( + "JetMatching:merge = off", + "Init:showChangedSettings = off", + "Init:showChangedParticleData = off", + "ProcessLevel:all = off", + ), + parameterSets=cms.vstring( + "pythia8CommonSettings", "pythia8CUEP8M1Settings", "processParameters" + ), + ), +) +# Set the correct center of mass energy for run2 +(run2_common & ~run3_common).toModify(generator, comEnergy=cms.double(13000.0)) + +## This modifier sets the correct cuts for mu->mu embedding +tau_embedding_mu_to_mu.toModify( + generator, + HepMCFilter={ + "filterParameters": { + "MuMuCut": cms.string( + "(Mu1.Pt > 17 && Mu2.Pt > 8 && Mu1.Eta < 2.5 && Mu2.Eta < 2.5)" + ), + "Final_States": cms.vstring("MuMu"), + } + }, + # disable final state radiation for mu->mu embedding + PythiaParameters={ + "processParameters": cms.vstring( + "JetMatching:merge = off", + "Init:showChangedSettings = off", + "Init:showChangedParticleData = off", + "ProcessLevel:all = off", + "PartonLevel:FSR = off", + ) + }, +) +# only one simulation needed, as the muons don't decay like taus and no wights need to be calculated. +tau_embedding_mu_to_mu.toModify(generator, nAttempts=cms.uint32(1)) + +# This modifier sets the correct cuts for mu->e embedding +tau_embedding_mu_to_e.toModify( + generator, + HepMCFilter={ + "filterParameters": { + "ElElCut": cms.string( + "(El1.Pt > 22 && El2.Pt > 10 && El1.Eta < 2.5 && El2.Eta < 2.5)" + ), + "Final_States": cms.vstring("ElEl"), + } + }, + # disable final state radiation for mu->e embedding + PythiaParameters={ + "processParameters": cms.vstring( + "JetMatching:merge = off", + "Init:showChangedSettings = off", + "Init:showChangedParticleData = off", + "ProcessLevel:all = off", + "PartonLevel:FSR = off", + ) + }, +) +# only one simulation needed, as the electrons don't decay like taus and no wights need to be calculated. +tau_embedding_mu_to_e.toModify(generator, nAttempts=cms.uint32(1)) + +# This modifier sets the correct cuts for the taus decaying into one jet and one muon +tau_embedding_mutauh.toModify( + generator, + HepMCFilter={ + "filterParameters": { + "MuHadCut": cms.string( + "(Mu.Pt > 18 && Had.Pt > 18 && Mu.Eta < 2.2 && Had.Eta < 2.4)" + ), + "Final_States": cms.vstring("MuHad"), + } + }, +) + +# This modifier sets the correct cuts for the taus decaying into one jet and one electron +tau_embedding_etauh.toModify( + generator, + HepMCFilter={ + "filterParameters": { + "ElHadCut": cms.string( + "(El.Pt > 18 && Had.Pt > 18 && El.Eta < 2.2 && Had.Eta < 2.4)" + ), + "Final_States": cms.vstring("ElHad"), + } + }, +) + +# This modifier sets the correct cuts for the taus decaying into one electron and one muon +tau_embedding_emu.toModify( + generator, + HepMCFilter={ + "filterParameters": { + "ElMuCut": cms.string( + "(El.Pt > 9 && Mu.Pt > 19 && El.Eta < 2.5 && Mu.Eta < 2.5) || El.Pt > 19 && Mu.Pt > 9 && El.Eta < 2.5 && Mu.Eta < 2.5)" + ), + "Final_States": cms.vstring("ElMu"), + } + }, +) + +# This modifier sets the correct cuts for the taus decaying into two jets +tau_embedding_tauhtauh.toModify( + generator, + HepMCFilter={ + "filterParameters": { + "HadHadCut": cms.string( + "(Had1.Pt > 20 && Had2.Pt > 20 && Had1.Eta < 2.2 && Had2.Eta < 2.2)" + ), + "Final_States": cms.vstring("HadHad"), + } + }, +) diff --git a/TauAnalysis/MCEmbeddingTools/python/Simulation_HLT_customiser_cff.py b/TauAnalysis/MCEmbeddingTools/python/Simulation_HLT_customiser_cff.py new file mode 100644 index 0000000000000..4d3d93383fbfb --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Simulation_HLT_customiser_cff.py @@ -0,0 +1,42 @@ +""" +This config fragment contains a customiser function which modifies the process. +In this modification the beamspot and the vertex is adjusted to the measured one. +The simulation GEN step must be carried out beforehand. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --eventcontent TauEmbeddingSimHLT \ + --datatier RAWSIM \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" +import FWCore.ParameterSet.Config as cms + + +def embeddingHLTCustomiser(process): + """ + Function to modify the HLT configuration for embedding. + """ + # Replace the online beam spot producer with the embedding version + process.hltOnlineBeamSpot = cms.EDProducer('EmbeddingBeamSpotOnlineProducer', src = cms.InputTag('offlineBeamSpot')) + # Replace HLT vertexing with vertex taken from LHE step + process.hltPixelVertices = cms.EDProducer('EmbeddingHltPixelVerticesProducer') + process.hltFirstStepPrimaryVerticesUnsorted = cms.EDProducer('EmbeddingHltPixelVerticesProducer') + + # Disable the original detector state filters in the HLT step. + # This is done by replacing them with one that always passes (100% efficiency). + # Those original filters have a efficiency of 0% for embedding samples, due to the fact + # that the simulation of the tau decay happens in an empty detector. + # For more info see https://github.com/cms-sw/cmssw/pull/47299#discussion_r1949023230 + process.hltPixelTrackerHVOn = cms.EDFilter("HLTBool", result = cms.bool(True)) + process.hltStripTrackerHVOn = cms.EDFilter("HLTBool", result = cms.bool(True)) + + return process \ No newline at end of file diff --git a/TauAnalysis/MCEmbeddingTools/python/Simulation_RECO_cff.py b/TauAnalysis/MCEmbeddingTools/python/Simulation_RECO_cff.py new file mode 100644 index 0000000000000..829d11695ab9d --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/python/Simulation_RECO_cff.py @@ -0,0 +1,33 @@ +""" +This config fragment is used to modify the RECO step to reconstruct the simulated taus (or electrons/muons) in the embedding samples. +The execution of a BeamSpotProducer is removed, as well as the vertex is put to the same as the measured one. +The Simulation HLT step must be carried out beforehand. +To use this config fragment, a cmsDriver command like the following can be used: +``` +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO:TauAnalysis/MCEmbeddingTools/Simulation_RECO_cff.reconstruction,RECOSIM \ + --processName SIMembedding \ + --mc \ + --beamspot DBrealistic \ + --geometry DB:Extended \ + --eventcontent TauEmbeddingSimReco \ + --datatier RAW-RECO-SIM \ + --procModifiers tau_embedding_sim \ + --era ... \ + --conditions ... \ + --filein ... \ + --fileout ... +``` +""" + +import FWCore.ParameterSet.Config as cms + +# replace the vertice producers with a custom producer that uses the measured vertex position +# The replacement is done in the following files: +# RecoTracker/IterativeTracking/python/InitialStep_cff.py +# RecoTracker/IterativeTracking/python/InitialStepPreSplitting_cff.py +# RecoVertex/Configuration/python/RecoVertex_cff.py +tau_embedding_correct_hlt_vertices = cms.EDProducer("EmbeddingHltPixelVerticesProducer") + +# remove the beam spot producer from the RECO step, as we want to use the measured one in +# Configuration/StandardSequences/python/Reconstruction_cff.py diff --git a/TauAnalysis/MCEmbeddingTools/python/customisers.py b/TauAnalysis/MCEmbeddingTools/python/customisers.py deleted file mode 100644 index 47f5d5d23fe05..0000000000000 --- a/TauAnalysis/MCEmbeddingTools/python/customisers.py +++ /dev/null @@ -1,1158 +0,0 @@ -#!/usr/bin/env python - - -# Various set of customise functions needed for embedding -import FWCore.ParameterSet.Config as cms - -from PhysicsTools.NanoAOD.common_cff import ExtVar - -################################ Customizer for skimming ########################### -### There are four different parts. -##First step is the SELECT (former SKIM) part, where we identfy the events which are good for Embedding. Need to store RAWRECO [RAW is needed for the MERG and RECO for the CLEAN step] -##Second step is the CLEAN input are PAT muons with RECO information. After this step only RAW plus some special collections needed for the MERG step must be saved -##Third step is the SIM. The input is the externalLHEProducer, which must be produced before (At the moment we do it parallel to the CLEAN step). Again only save RAW of the SELECT and only save what is need for the MERG step -##Last step is the MERG step. Which is the usally reconstruction, where the input produces are replaced by merg producer, which mix the SIM and CLEAN inputs. - -## Some comments on this approach. All steps runs the RECO sequence until the end in the moment. It would be possible to stop after the all inputs which are needed for the MERG step are generated (which happens at a very early state of the reconstruction. But with this approach we are able to get the RECO (and PAT aka miniAOD) of all four step SELECT (orginal event), SIM, CLEAN and MERGED. Therefor one only needs to SAVE the corresponding output (in cmsDriver change output to RAW -> RAW,RECO,PAT) - -####################### Some basic functions #################### -## Helper Class, which summerizes in which step which Producer (Cleaner Merger), should be loaded. It is also usefull to define which collection should be stored for the next step -## E.g What is needed for MERGE must be produce in the CLEAN and SIM step - - -class module_manipulate: - def __init__( - self, - module_name, - manipulator_name, - steps=["SELECT", "CLEAN", "SIM", "MERGE"], - instance=[""], - merge_prefix="", - ): - self.module_name = module_name - self.manipulator_name = manipulator_name - self.steps = steps - self.instance = instance - self.merger_name = manipulator_name + "ColMerger" - self.cleaner_name = manipulator_name + "ColCleaner" - self.merge_prefix = merge_prefix - - -to_bemanipulate = [] - - -to_bemanipulate.append( - module_manipulate( - module_name="siPixelClusters", - manipulator_name="Pixel", - steps=["SELECT", "CLEAN"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="siStripClusters", - manipulator_name="Strip", - steps=["SELECT", "CLEAN"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="generalTracks", manipulator_name="Track", steps=["SIM", "MERGE"] - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="cosmicsVetoTracksRaw", manipulator_name="Track", steps=["SIM", "MERGE"] - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="electronGsfTracks", - manipulator_name="GsfTrack", - steps=["SIM", "MERGE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="lowPtGsfEleGsfTracks", - manipulator_name="GsfTrack", - steps=["SIM", "MERGE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="conversionStepTracks", - manipulator_name="Track", - steps=["SIM", "MERGE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="displacedTracks", - manipulator_name="Track", - steps=["SIM", "MERGE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="ckfInOutTracksFromConversions", - manipulator_name="Track", - steps=["SIM", "MERGE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="ckfOutInTracksFromConversions", - manipulator_name="Track", - steps=["SIM", "MERGE"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="muons1stStep", manipulator_name="Muon", steps=["SIM", "MERGE"] - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="displacedMuons1stStep", manipulator_name="Muon", steps=["SIM", "MERGE"] - ) -) -# to_bemanipulate.append(module_manipulate(module_name = 'gedGsfElectronsTmp', manipulator_name = "GsfElectron", steps = ["SIM", "MERGE"])) -# to_bemanipulate.append(module_manipulate(module_name = 'gedPhotonsTmp', manipulator_name = "Photon", steps = ["SIM", "MERGE"])) -to_bemanipulate.append( - module_manipulate( - module_name="conversions", manipulator_name="Conversion", steps=["SIM", "MERGE"] - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="allConversions", - manipulator_name="Conversion", - steps=["SIM", "MERGE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="particleFlowTmp", - manipulator_name="PF", - steps=["SIM", "MERGE"], - instance=[ - "", - "CleanedHF", - "CleanedCosmicsMuons", - "CleanedTrackerAndGlobalMuons", - "CleanedFakeMuons", - "CleanedPunchThroughMuons", - "CleanedPunchThroughNeutralHadrons", - "AddedMuonsAndHadrons", - ], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="ecalDigis", manipulator_name="EcalSrFlag", steps=["SIM", "MERGE"] - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="hcalDigis", manipulator_name="HcalDigi", steps=["SIM", "MERGE"] - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="electronMergedSeeds", - manipulator_name="ElectronSeed", - steps=["SIM", "MERGE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="ecalDrivenElectronSeeds", - manipulator_name="EcalDrivenElectronSeed", - steps=["SIM", "MERGE"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="ecalRecHit", - manipulator_name="EcalRecHit", - instance=["EcalRecHitsEB", "EcalRecHitsEE"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="ecalPreshowerRecHit", - manipulator_name="EcalRecHit", - instance=["EcalRecHitsES"], - ) -) - -to_bemanipulate.append( - module_manipulate(module_name="hbheprereco", manipulator_name="HBHERecHit") -) -to_bemanipulate.append( - module_manipulate(module_name="hbhereco", manipulator_name="HBHERecHit") -) -to_bemanipulate.append( - module_manipulate(module_name="zdcreco", manipulator_name="ZDCRecHit") -) - -to_bemanipulate.append( - module_manipulate(module_name="horeco", manipulator_name="HORecHit") -) -to_bemanipulate.append( - module_manipulate(module_name="hfreco", manipulator_name="HFRecHit") -) - - -to_bemanipulate.append( - module_manipulate( - module_name="dt1DRecHits", - manipulator_name="DTRecHit", - steps=["SELECT", "CLEAN"], - ) -) -to_bemanipulate.append( - module_manipulate( - module_name="dt1DCosmicRecHits", - manipulator_name="DTRecHit", - steps=["SELECT", "CLEAN"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="dt4DSegments", - manipulator_name="DTRecSegment4D", - steps=["SELECT", "CLEAN"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="dt4DCosmicSegments", - manipulator_name="DTRecSegment4D", - steps=["SELECT", "CLEAN"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="csc2DRecHits", - manipulator_name="CSCRecHit", - steps=["SELECT", "CLEAN"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="cscSegments", - manipulator_name="CSCSegment", - steps=["SELECT", "CLEAN"], - ) -) - -to_bemanipulate.append( - module_manipulate( - module_name="rpcRecHits", - manipulator_name="RPCRecHit", - steps=["SELECT", "CLEAN"], - ) -) - - -def modify_outputModules(process, keep_drop_list=[], module_veto_list=[]): - outputModulesList = [key for key, value in process.outputModules.items()] - for outputModule in outputModulesList: - if outputModule in module_veto_list: - continue - outputModule = getattr(process, outputModule) - for add_element in keep_drop_list: - outputModule.outputCommands.extend(add_element) - return process - - -################################ Customizer for Selecting ########################### - - -def keepSelected(dataTier): - ret_vstring = cms.untracked.vstring( - # "drop *_*_*_"+dataTier, - "keep *_patMuonsAfterID_*_" + dataTier, - "keep *_slimmedMuons_*_" + dataTier, - "keep *_slimmedMuonTrackExtras_*_" + dataTier, - "keep *_selectedMuonsForEmbedding_*_" + dataTier, - "keep recoVertexs_offlineSlimmedPrimaryVertices_*_" + dataTier, - "keep *_firstStepPrimaryVertices_*_" + dataTier, - "keep *_offlineBeamSpot_*_" + dataTier, - "keep *_ecalDrivenElectronSeeds_*_" + dataTier, - ) - for akt_manimod in to_bemanipulate: - if "CLEAN" in akt_manimod.steps: - ret_vstring.append("keep *_" + akt_manimod.module_name + "_*_" + dataTier) - return ret_vstring - - -def customiseSelecting(process, reselect=False): - if reselect: - process._Process__name = "RESELECT" - dataTier = "RESELECT" - # process.source.inputCommands = cms.untracked.vstring("drop *", - # "keep *_*_*_LHC", - # "keep *_*_*_HLT", - # ) - else: - process._Process__name = "SELECT" - dataTier = "SELECT" - - process.load("TauAnalysis.MCEmbeddingTools.SelectingProcedure_cff") - process.patMuonsAfterKinCuts.src = cms.InputTag("slimmedMuons", "", dataTier) - process.selectedMuonsForEmbedding.PuppiMet = cms.InputTag( - "slimmedMETsPuppi", "", dataTier - ) - process.selectedMuonsForEmbedding.Met = cms.InputTag("slimmedMETs", "", dataTier) - process.patMuonsAfterID = process.patMuonsAfterLooseID.clone() - - process.selecting = cms.Path(process.makePatMuonsZmumuSelection) - process.schedule.insert(-1, process.selecting) - - outputModulesList = [key for key, value in process.outputModules.items()] - for outputModule in outputModulesList: - outputModule = getattr(process, outputModule) - outputModule.SelectEvents = cms.untracked.PSet( - SelectEvents=cms.vstring("selecting") - ) - outputModule.outputCommands.extend(keepSelected(dataTier)) - - process = customisoptions(process) - return modify_outputModules(process, [keepSelected(dataTier)]) - - -def customiseSelecting_Reselect(process): - return customiseSelecting(process, reselect=True) - - -################################ Customizer for cleaning ########################### - - -def keepCleaned(dataTier): - ret_vstring = cms.untracked.vstring( - # "drop *_*_*_LHEembeddingCLEAN", - # "drop *_*_*_CLEAN" - "drop *_*_*_" + dataTier, - "keep *_patMuonsAfterID_*_" + dataTier, - "keep *_slimmedMuons_*_" + dataTier, - # "keep *_slimmedMuonTrackExtras_*_" + dataTier, - "keep *_selectedMuonsForEmbedding_*_" + dataTier, - "keep recoVertexs_offlineSlimmedPrimaryVertices_*_" + dataTier, - "keep *_firstStepPrimaryVertices_*_" + dataTier, - "keep *_offlineBeamSpot_*_" + dataTier, - "keep *_l1extraParticles_*_" + dataTier, - "keep TrajectorySeeds_*_*_*", - "keep recoElectronSeeds_*_*_*", - "drop recoIsoDepositedmValueMap_muIsoDepositTk_*_*" , - "drop recoIsoDepositedmValueMap_muIsoDepositTkDisplaced_*_*", - "drop *_ctppsProtons_*_*", - "drop *_ctppsLocalTrackLiteProducer_*_*", - "drop *_ctppsDiamondLocalTracks_*_*", - "drop *_ctppsDiamondRecHits_*_*", - "drop *_ctppsDiamondRawToDigi_*_*", - "drop *_ctppsPixelLocalTracks_*_*", - "drop *_ctppsPixelRecHits_*_*", - "drop *_ctppsPixelClusters_*_*", - "drop *_ctppsPixelDigis_*_*", - "drop *_totemRPLocalTrackFitter_*_*", - "drop *_totemRPUVPatternFinder_*_*", - "drop *_totemRPRecHitProducer_*_*", - "drop *_totemRPClusterProducer_*_*", - "drop *_totemRPRawToDigi_*_*", - "drop *_muonSimClassifier_*_*", - # "keep recoPFClusters_*_*_*", - # "keep recoPFRecHits_*_*_*" - ) - - for akt_manimod in to_bemanipulate: - if "MERGE" in akt_manimod.steps: - ret_vstring.append( - "keep *_" + akt_manimod.module_name + "_*_LHEembeddingCLEAN" - ) - ret_vstring.append("keep *_" + akt_manimod.module_name + "_*_CLEAN") - ret_vstring.append("keep *_standAloneMuons_*_LHEembeddingCLEAN") - ret_vstring.append("keep *_glbTrackQual_*_LHEembeddingCLEAN") - return ret_vstring - - -def customiseCleaning(process, changeProcessname=True, reselect=False): - if changeProcessname: - process._Process__name = "CLEAN" - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - ## Needed for the Calo Cleaner, could also be put into a function wich fix the input parameters - from TrackingTools.TrackAssociator.default_cfi import TrackAssociatorParameterBlock - - TrackAssociatorParameterBlock.TrackAssociatorParameters.CSCSegmentCollectionLabel = cms.InputTag( - "cscSegments", "", dataTier - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.CaloTowerCollectionLabel = ( - cms.InputTag("towerMaker", "", dataTier) - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.DTRecSegment4DCollectionLabel = cms.InputTag( - "dt4DSegments", "", dataTier - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.EBRecHitCollectionLabel = ( - cms.InputTag("ecalRecHit", "EcalRecHitsEB", dataTier) - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.EERecHitCollectionLabel = ( - cms.InputTag("ecalRecHit", "EcalRecHitsEE", dataTier) - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.HBHERecHitCollectionLabel = cms.InputTag( - "hbhereco", "", dataTier - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.HORecHitCollectionLabel = ( - cms.InputTag("horeco", "", dataTier) - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.ME0HitCollectionLabel = ( - cms.InputTag("me0RecHits", "", dataTier) - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.ME0SegmentCollectionLabel = ( - cms.InputTag("me0Segments", "", dataTier) - ) - TrackAssociatorParameterBlock.TrackAssociatorParameters.RPCHitCollectionLabel = ( - cms.InputTag("rpcRecHits", "", dataTier) - ) - - MuonImput = cms.InputTag("selectedMuonsForEmbedding", "", "") ## This are the muon - for akt_manimod in to_bemanipulate: - if "CLEAN" in akt_manimod.steps: - oldCollections_in = cms.VInputTag() - for instance in akt_manimod.instance: - oldCollections_in.append( - cms.InputTag(akt_manimod.module_name, instance, dataTier) - ) - setattr( - process, - akt_manimod.module_name, - cms.EDProducer( - akt_manimod.cleaner_name, - MuonCollection=MuonImput, - TrackAssociatorParameters=TrackAssociatorParameterBlock.TrackAssociatorParameters, - oldCollection=oldCollections_in, - cscDigiCollectionLabel = cms.InputTag("muonCSCDigis","MuonCSCStripDigi"), - digiMaxDistanceX = cms.double(25.0), - dtDigiCollectionLabel = cms.InputTag("muonDTDigis"), - ), - ) - process.ecalPreshowerRecHit.TrackAssociatorParameters.usePreshower = cms.bool(True) - process = customisoptions(process) - return modify_outputModules( - process, [keepSelected(dataTier), keepCleaned(dataTier)], ["MINIAODoutput"] - ) - - -################################ Customizer for LHE ########################### - - -def keepLHE(): - ret_vstring = cms.untracked.vstring() - ret_vstring.append("keep *_externalLHEProducer_*_LHEembedding") - ret_vstring.append("keep *_externalLHEProducer_*_LHEembeddingCLEAN") - return ret_vstring - - -def customiseLHE(process, changeProcessname=True, reselect=False): - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - if changeProcessname: - process._Process__name = "LHEembedding" - process.load("TauAnalysis.MCEmbeddingTools.EmbeddingLHEProducer_cfi") - if reselect: - process.externalLHEProducer.vertices = cms.InputTag( - "offlineSlimmedPrimaryVertices", "", "RESELECT" - ) - process.lheproduction = cms.Path(process.makeexternalLHEProducer) - process.schedule.insert(0, process.lheproduction) - - process = customisoptions(process) - return modify_outputModules( - process, - [keepSelected(dataTier), keepCleaned(dataTier), keepLHE()], - ["MINIAODoutput"], - ) - - -def customiseLHEandCleaning(process, reselect=False): - process._Process__name = "LHEembeddingCLEAN" - process = customiseCleaning(process, changeProcessname=False, reselect=reselect) - process = customiseLHE(process, changeProcessname=False, reselect=reselect) - return process - - -def customiseLHEandCleaning_Reselect(process): - return customiseLHEandCleaning(process, reselect=True) - - -################################ Customizer for simulaton ########################### - - -def keepSimulated(process, processname="SIMembedding"): - ret_vstring = cms.untracked.vstring() - for akt_manimod in to_bemanipulate: - if "MERGE" in akt_manimod.steps: - ret_vstring.append( - "keep *_" + akt_manimod.module_name + "_*_{}".format(processname) - ) - ret_vstring.append("keep *_genParticles_*_{}".format(processname)) - ret_vstring.append("keep *_standAloneMuons_*_{}".format(processname)) - ret_vstring.append("keep *_glbTrackQual_*_{}".format(processname)) - ret_vstring.append("keep *_generator_*_{}".format(processname)) - ret_vstring.append("keep *_addPileupInfo_*_{}".format(processname)) - ret_vstring.append("keep *_selectedMuonsForEmbedding_*_*") - ret_vstring.append("keep *_slimmedAddPileupInfo_*_*") - ret_vstring.append("keep *_embeddingHltPixelVertices_*_*") - ret_vstring.append("keep *_*_vertexPosition_*") - ret_vstring.append("keep recoMuons_muonsFromCosmics_*_*") - ret_vstring.append("keep recoTracks_cosmicMuons1Leg_*_*") - ret_vstring.append("keep recoMuons_muonsFromCosmics1Leg_*_*") - ret_vstring.append("keep *_muonDTDigis_*_*") - ret_vstring.append("keep *_muonCSCDigis_*_*") - ret_vstring.append("keep TrajectorySeeds_*_*_*") - ret_vstring.append("keep recoElectronSeeds_*_*_*") - ret_vstring.append("drop recoIsoDepositedmValueMap_muIsoDepositTk_*_*") - ret_vstring.append("drop recoIsoDepositedmValueMap_muIsoDepositTkDisplaced_*_*") - ret_vstring.append("drop *_ctppsProtons_*_*") - ret_vstring.append("drop *_ctppsLocalTrackLiteProducer_*_*") - ret_vstring.append("drop *_ctppsDiamondLocalTracks_*_*") - ret_vstring.append("drop *_ctppsDiamondRecHits_*_*") - ret_vstring.append("drop *_ctppsDiamondRawToDigi_*_*") - ret_vstring.append("drop *_ctppsPixelLocalTracks_*_*") - ret_vstring.append("drop *_ctppsPixelRecHits_*_*") - ret_vstring.append("drop *_ctppsPixelClusters_*_*") - ret_vstring.append("drop *_ctppsPixelDigis_*_*") - ret_vstring.append("drop *_totemRPLocalTrackFitter_*_*") - ret_vstring.append("drop *_totemRPUVPatternFinder_*_*") - ret_vstring.append("drop *_totemRPRecHitProducer_*_*") - ret_vstring.append("drop *_totemRPClusterProducer_*_*") - ret_vstring.append("drop *_totemRPRawToDigi_*_*") - ret_vstring.append("drop *_muonSimClassifier_*_*") - - # for those two steps, the output has to be modified - # to keep the information from the cleaning step in the output file - if processname == "SIMembeddingpreHLT" or processname == "SIMembeddingHLT": - rawreco_commands = set(process.RAWRECOEventContent.outputCommands) - rawreco_commands_excl = rawreco_commands - set( - process.RAWSIMEventContent.outputCommands - ) - for entry in rawreco_commands_excl: - if ( - processname == "SIMembeddingpreHLT" - and "muonReducedTrackExtras" in entry - ): - continue - if not any( - x in entry - for x in [ - "TotemTimingLocalTrack", - "ForwardProton", - "ctppsDiamondLocalTracks", - ] - ): - ret_vstring.append(entry) - return ret_vstring - -def customiseGenerator_preHLT(process, changeProcessname=True, reselect=False): - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - if changeProcessname: - process._Process__name = "SIMembeddingpreHLT" - - ## here correct the vertex collection - - process.load("TauAnalysis.MCEmbeddingTools.EmbeddingVertexCorrector_cfi") - process.VtxSmeared = process.VtxCorrectedToInput.clone() - print( - "Correcting Vertex in genEvent to one from input. Replaced 'VtxSmeared' with the Corrector." - ) - - # Disable noise simulation - process.mix.digitizers.castor.doNoise = cms.bool(False) - - process.mix.digitizers.ecal.doESNoise = cms.bool(False) - process.mix.digitizers.ecal.doENoise = cms.bool(False) - - process.mix.digitizers.hcal.doNoise = cms.bool(False) - process.mix.digitizers.hcal.doThermalNoise = cms.bool(False) - process.mix.digitizers.hcal.doHPDNoise = cms.bool(False) - - process.mix.digitizers.pixel.AddNoisyPixels = cms.bool(False) - process.mix.digitizers.pixel.AddNoise = cms.bool(False) - - process.mix.digitizers.strip.Noise = cms.bool(False) - - process = customisoptions(process) - ##process = fix_input_tags(process) - - return modify_outputModules( - process, - [ - keepSelected(dataTier), - keepCleaned(dataTier), - keepSimulated(process, processname="SIMembeddingpreHLT"), - ], - ["AODSIMoutput"], - ) - - -def customiseGenerator_preHLT_Reselect(process): - return customiseGenerator_preHLT(process, reselect=True) - - -def customiseGenerator_HLT(process, changeProcessname=True, reselect=False): - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - if changeProcessname: - process._Process__name = "SIMembeddingHLT" - - ## here correct the vertex collection - process.load("TauAnalysis.MCEmbeddingTools.EmbeddingBeamSpotOnline_cfi") - process.hltOnlineBeamSpot = process.onlineEmbeddingBeamSpotProducer.clone() - print( - "Setting online beam spot in HLTSchedule to the one from input data. Replaced 'hltOnlineBeamSpot' with the offline beam spot." - ) - - # Replace HLT vertexing with vertex taken from LHE step - process.load("TauAnalysis.MCEmbeddingTools.EmbeddingHltPixelVerticesProducer_cfi") - process.hltPixelVertices = process.embeddingHltPixelVertices.clone() - process.offlinePrimaryVertices = process.embeddingHltPixelVertices.clone() - process.firstStepPrimaryVerticesUnsorted = process.embeddingHltPixelVertices.clone() - process.firstStepPrimaryVerticesPreSplitting = ( - process.embeddingHltPixelVertices.clone() - ) - - process = customisoptions(process) - ##process = fix_input_tags(process) - - return modify_outputModules( - process, - [ - keepSelected(dataTier), - keepCleaned(dataTier), - keepLHE(), - keepSimulated(process, processname="SIMembeddingpreHLT"), - keepSimulated(process, processname="SIMembeddingHLT"), - ], - ["AODSIMoutput"], - ) - - -def customiseGenerator_HLT_Reselect(process): - return customiseGenerator_HLT(process, reselect=True) - - -def customiseGenerator_postHLT(process, changeProcessname=True, reselect=False): - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - if changeProcessname: - process._Process__name = "SIMembedding" - - ## here correct the vertex collection - - # process.load('TauAnalysis.MCEmbeddingTools.EmbeddingVertexCorrector_cfi') - # process.VtxSmeared = process.VtxCorrectedToInput.clone() - # print "Correcting Vertex in genEvent to one from input. Replaced 'VtxSmeared' with the Corrector." - # process.load('TauAnalysis.MCEmbeddingTools.EmbeddingBeamSpotOnline_cfi') - # process.hltOnlineBeamSpot = process.onlineEmbeddingBeamSpotProducer.clone() - # print "Setting online beam spot in HLTSchedule to the one from input data. Replaced 'hltOnlineBeamSpot' with the offline beam spot." - - # Remove BeamSpot Production, use the one from selected data instead. - process.reconstruction.remove(process.offlineBeamSpot) - - process = customisoptions(process) - ##process = fix_input_tags(process) - - return modify_outputModules( - process, - [ - keepSelected(dataTier), - keepCleaned(dataTier), - keepLHE(), - keepSimulated(process, processname="SIMembeddingpreHLT"), - keepSimulated(process, processname="SIMembeddingHLT"), - keepSimulated(process, processname="SIMembedding"), - ], - ["AODSIMoutput"], - ) - - -def customiseGenerator_postHLT_Reselect(process): - return customiseGenerator_postHLT(process, reselect=True) - - -################################ Customizer for merging ########################### - - -def keepMerged(dataTier="SELECT"): - ret_vstring = cms.untracked.vstring() - ret_vstring.append("drop *_*_*_" + dataTier) - ret_vstring.append("keep *_prunedGenParticles_*_MERGE") - ret_vstring.append("keep *_generator_*_SIMembeddingpreHLT") - ret_vstring.append("keep *_generator_*_SIMembeddingHLT") - ret_vstring.append("keep *_generator_*_SIMembedding") - ret_vstring.append("keep *_selectedMuonsForEmbedding_*_*") - ret_vstring.append("keep *_unpackedPatTrigger_*_*") - ret_vstring.extend(cms.untracked.vstring( - 'keep patPackedGenParticles_packedGenParticles_*_*', - 'keep recoGenParticles_prunedGenParticles_*_*', - 'keep *_packedPFCandidateToGenAssociation_*_*', - 'keep *_lostTracksToGenAssociation_*_*', - 'keep LHEEventProduct_*_*_*', - 'keep GenFilterInfo_*_*_*', - 'keep GenLumiInfoHeader_generator_*_*', - 'keep GenLumiInfoProduct_*_*_*', - 'keep GenEventInfoProduct_generator_*_*', - 'keep recoGenParticles_genPUProtons_*_*', - 'keep *_slimmedGenJetsFlavourInfos_*_*', - 'keep *_slimmedGenJets__*', - 'keep *_slimmedGenJetsAK8__*', - 'keep *_slimmedGenJetsAK8SoftDropSubJets__*', - 'keep *_genMetTrue_*_*', - # RUN - 'keep LHERunInfoProduct_*_*_*', - 'keep GenRunInfoProduct_*_*_*', - 'keep *_genParticles_xyz0_*', - 'keep *_genParticles_t0_*')) - return ret_vstring - - -def customiseKeepPrunedGenParticles(process, reselect=False): - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - - process.keep_step = cms.Path() - - process.load("PhysicsTools.PatAlgos.slimming.genParticles_cff") - process.keep_step += process.prunedGenParticlesWithStatusOne - process.load("PhysicsTools.PatAlgos.slimming.prunedGenParticles_cfi") - process.keep_step += process.prunedGenParticles - process.load("PhysicsTools.PatAlgos.slimming.packedGenParticles_cfi") - process.keep_step += process.packedGenParticles - process.load("PhysicsTools.PatAlgos.slimming.slimmedGenJets_cfi") - process.keep_step += process.slimmedGenJets - - process.load("PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi") - process.keep_step += process.muonMatch - process.load("PhysicsTools.PatAlgos.mcMatchLayer0.electronMatch_cfi") - process.keep_step += process.electronMatch - process.load("PhysicsTools.PatAlgos.mcMatchLayer0.photonMatch_cfi") - process.keep_step += process.photonMatch - process.load("PhysicsTools.PatAlgos.mcMatchLayer0.tauMatch_cfi") - process.keep_step += process.tauMatch - process.load("PhysicsTools.JetMCAlgos.TauGenJets_cfi") - process.keep_step += process.tauGenJets - process.load("PhysicsTools.PatAlgos.mcMatchLayer0.jetFlavourId_cff") - process.keep_step += process.patJetPartons - process.load("PhysicsTools.PatAlgos.mcMatchLayer0.jetMatch_cfi") - process.keep_step += process.patJetPartonMatch - - process.muonMatch.matched = "prunedGenParticles" - process.electronMatch.matched = "prunedGenParticles" - process.electronMatch.src = cms.InputTag("reducedEgamma", "reducedGedGsfElectrons") - process.photonMatch.matched = "prunedGenParticles" - process.photonMatch.src = cms.InputTag("reducedEgamma", "reducedGedPhotons") - process.tauMatch.matched = "prunedGenParticles" - process.tauGenJets.GenParticles = "prunedGenParticles" - ##Boosted taus - # process.tauMatchBoosted.matched = "prunedGenParticles" - # process.tauGenJetsBoosted.GenParticles = "prunedGenParticles" - process.patJetPartons.particles = "prunedGenParticles" - process.patJetPartonMatch.matched = "prunedGenParticles" - process.patJetPartonMatch.mcStatus = [3, 23] - process.patJetGenJetMatch.matched = "slimmedGenJets" - process.patJetGenJetMatchAK8.matched = "slimmedGenJetsAK8" - process.patMuons.embedGenMatch = False - process.patElectrons.embedGenMatch = False - process.patPhotons.embedGenMatch = False - process.patTaus.embedGenMatch = False - process.patTausBoosted.embedGenMatch = False - process.patJets.embedGenPartonMatch = False - # also jet flavour must be switched - process.patJetFlavourAssociation.rParam = 0.4 - - process.schedule.insert(0, process.keep_step) - process = customisoptions(process) - return modify_outputModules(process, [keepMerged(dataTier)]) - - -def customiseMerging(process, changeProcessname=True, reselect=False): - - print("**** Attention: overriding behaviour of 'removeMCMatching' ****") - - from PhysicsTools.PatAlgos.slimming.miniAOD_tools import miniAOD_customizeMC - def performMCMatching(process, names, postfix, outputModules): - miniAOD_customizeMC(process) - - import PhysicsTools.PatAlgos.tools.coreTools - PhysicsTools.PatAlgos.tools.coreTools.removeMCMatching = performMCMatching - - if changeProcessname: - process._Process__name = "MERGE" - if reselect: - dataTier = "RESELECT" - else: - dataTier = "SELECT" - - process.source.inputCommands = cms.untracked.vstring() - process.source.inputCommands.append("keep *_*_*_*") - process.load("PhysicsTools.PatAlgos.slimming.unpackedPatTrigger_cfi") - process.unpackedPatTrigger.triggerResults = cms.InputTag("TriggerResults::SIMembeddingHLT") - - # process.source.inputCommands.append("drop *_*_*_SELECT") - # process.source.inputCommands.append("drop *_*_*_SIMembedding") - # process.source.inputCommands.append("drop *_*_*_LHEembeddingCLEAN") - # process.source.inputCommands.extend(keepSimulated()) - # process.source.inputCommands.extend(keepCleaned()) - - process.load('Configuration.StandardSequences.RawToDigi_cff') - process.load("Configuration.StandardSequences.Reconstruction_Data_cff") - process.merge_step = cms.Path() - # produce local CT PPS reco - process.load("RecoPPS.Configuration.recoCTPPS_cff") - process.totemRPRawToDigi.rawDataTag = cms.InputTag("rawDataCollector", "", "LHC") - process.ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataCollector", "", "LHC") - process.ctppsPixelDigis.inputLabel = cms.InputTag("rawDataCollector", "", "LHC") - process.merge_step += process.totemRPRawToDigi - process.merge_step += process.ctppsDiamondRawToDigi - process.merge_step += process.ctppsPixelDigis - process.merge_step += cms.Sequence(process.recoCTPPSTask) - # produce local Calo - process.load("RecoLocalCalo.Configuration.RecoLocalCalo_cff") - process.merge_step += process.calolocalreco - #process.merge_step += process.caloglobalreco - process.merge_step += process.reducedHcalRecHitsSequence - - # produce hcal towers - process.load("RecoLocalCalo.CaloTowersCreator.calotowermaker_cfi") - process.merge_step += process.calotowermaker - process.merge_step += process.towerMaker - - # produce clusters - process.load("RecoEcal.Configuration.RecoEcal_cff") - process.merge_step += process.ecalClusters - - # produce PFCluster Collections - process.load("RecoParticleFlow.PFClusterProducer.particleFlowCluster_cff") - process.merge_step += process.particleFlowCluster - process.load( - "RecoEcal.EgammaClusterProducers.particleFlowSuperClusteringSequence_cff" - ) - process.merge_step += process.particleFlowSuperClusteringSequence - - # muonEcalDetIds - process.load("RecoMuon.MuonIdentification.muons1stStep_cfi") - process.merge_step += process.muonEcalDetIds - process.merge_step += process.muonShowerInformation - - # muon Isolation sequences - process.load("RecoMuon.MuonIsolationProducers.muIsolation_cff") - process.merge_step += process.muIsolation - process.merge_step += process.muIsolationDisplaced - - # muon ID selection type sequences - process.load("RecoMuon.MuonIdentification.muonSelectionTypeValueMapProducer_cff") - process.merge_step += process.muonSelectionTypeSequence - - # displaced muons extras & tracks - process.load("RecoMuon.MuonIdentification.displacedMuonReducedTrackExtras_cfi") - process.merge_step += process.displacedMuonReducedTrackExtras - - process.load("RecoMuon.Configuration.MergeDisplacedTrackCollections_cff") - process.merge_step += process.displacedTracksSequence - - # Other things - process.merge_step += process.doAlldEdXEstimators - process.merge_step += process.vertexreco - process.unsortedOfflinePrimaryVertices.beamSpotLabel = cms.InputTag( - "offlineBeamSpot", "", dataTier - ) - process.ak4CaloJetsForTrk.srcPVs = cms.InputTag( - "firstStepPrimaryVertices", "", dataTier - ) - process.dedxHitInfo.clusterShapeCache = cms.InputTag("") - - # process.muons.FillDetectorBasedIsolation = cms.bool(False) - # process.muons.FillSelectorMaps = cms.bool(False) - # process.muons.FillShoweringInfo = cms.bool(False) - # process.muons.FillCosmicsIdMap = cms.bool(False) - - # process.displacedMuons.FillDetectorBasedIsolation = cms.bool(False) - # process.displacedMuons.FillSelectorMaps = cms.bool(False) - # process.displacedMuons.FillShoweringInfo = cms.bool(False) - # process.displacedMuons.FillCosmicsIdMap = cms.bool(False) - - # seed configuration needed for seedmerger - #process.load( - # "RecoEgamma.EgammaElectronProducers.ecalDrivenElectronSeedsParameters_cff" - #) - #process.ecalDrivenElectronSeeds.SeedConfiguration = cms.PSet( - # process.ecalDrivenElectronSeedsParameters - #) - - process.merge_step += process.highlevelreco - # process.merge_step.remove(process.reducedEcalRecHitsEE) - # process.merge_step.remove(process.reducedEcalRecHitsEB) - - # process.merge_step.remove(process.ak4JetTracksAssociatorExplicit) - - # process.merge_step.remove(process.cosmicsVeto) - # process.merge_step.remove(process.cosmicsVetoTrackCandidates) - # process.merge_step.remove(process.ecalDrivenGsfElectronCores) - # process.merge_step.remove(process.ecalDrivenGsfElectrons) - # process.merge_step.remove(process.gedPhotonsTmp) - # process.merge_step.remove(process.particleFlowTmp) - - # process.merge_step.remove(process.hcalnoise) - - process.load("CommonTools.ParticleFlow.genForPF2PAT_cff") - - # process.muonsFromCosmics.ShowerDigiFillerParameters.dtDigiCollectionLabel = cms.InputTag("simMuonDTDigis") - - process.merge_step += process.genForPF2PATSequence - - # Replace manipulated modules contained in merg_step with Mergers, and - # put remaining ones into a list to be sorted to avoid deadlocks - modules_to_be_ordered = {} - # prepare reco list to determine indices - reconstruction_modules_list = str(process.RawToDigi).split(",") - reconstruction_modules_list += str(process.reconstruction).split(",") - for akt_manimod in to_bemanipulate: - if "MERGE" in akt_manimod.steps: - mergCollections_in = cms.VInputTag() - for instance in akt_manimod.instance: - mergCollections_in.append( - cms.InputTag( - akt_manimod.merge_prefix + akt_manimod.module_name, - instance, - "SIMembedding", - ) - ) - mergCollections_in.append( - cms.InputTag( - akt_manimod.merge_prefix + akt_manimod.module_name, - instance, - "LHEembeddingCLEAN", - ) - ) - setattr( - process, - akt_manimod.module_name, - cms.EDProducer( - akt_manimod.merger_name, mergCollections=mergCollections_in - ), - ) - if not process.merge_step.contains(getattr(process, akt_manimod.module_name)): - modules_to_be_ordered[akt_manimod.module_name] = -1 - # Determine indices and place them in right order into the list - for name,index in modules_to_be_ordered.items(): - if name in reconstruction_modules_list: - modules_to_be_ordered[name] = reconstruction_modules_list.index(name) - else: - print("ERROR:",name,"not prepared in modules list. Please adapt 'customiseMerging'") - sys.exit(1) - - modules_ordered = sorted(list(modules_to_be_ordered.items()), key=lambda x : -x[1]) - for m in modules_ordered: - process.merge_step.insert(0, getattr(process, m[0])) - - - process.schedule.insert(0, process.merge_step) - # process.load('PhysicsTools.PatAlgos.slimming.slimmedGenJets_cfi') - process = customisoptions(process) - return modify_outputModules(process, [keepMerged(dataTier)]) - - -def customiseMerging_Reselect(process, changeProcessname=True): - return customiseMerging(process, changeProcessname=changeProcessname, reselect=True) - - -################################ Customize NanoAOD ################################ - - -def customiseNanoAOD(process): - - process.load("PhysicsTools.NanoAOD.nano_cff") - process.nanoAOD_step.insert(0, cms.Sequence(process.nanoTableTaskFS)) - - - for outputModule in process.outputModules.values(): - outputModule.outputCommands.append("keep edmTriggerResults_*_*_SIMembeddingpreHLT") - outputModule.outputCommands.append("keep edmTriggerResults_*_*_SIMembeddingHLT") - outputModule.outputCommands.append("keep edmTriggerResults_*_*_SIMembedding") - outputModule.outputCommands.append("keep edmTriggerResults_*_*_MERGE") - outputModule.outputCommands.append("keep edmTriggerResults_*_*_NANO") - outputModule.outputCommands.remove("keep edmTriggerResults_*_*_*") - - process.load("PhysicsTools.NanoAOD.l1trig_cff") - process.nanoAOD_step.insert(0, cms.Sequence(process.l1TablesTask)) - - process.embeddingTable = cms.EDProducer( - "GlobalVariablesTableProducer", - name=cms.string("TauEmbedding"), - # doc=cms.string("TauEmbedding"), - variables=cms.PSet( - nInitialPairCandidates=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "nPairCandidates"), - float, - doc="number of muons pairs suitable for selection (for internal studies only)", - ), - SelectionOldMass=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "oldMass"), - float, - doc="Mass of the Dimuon pair using the old selection algorithm (for internal studies only)", - ), - SelectionNewMass=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "newMass"), - float, - doc="Mass of the Dimuon pair using the new selection algorithm (for internal studies only)", - ), - isMediumLeadingMuon=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "isMediumLeadingMuon"), - bool, - doc="leading muon ID (medium)", - ), - isMediumTrailingMuon=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "isMediumTrailingMuon"), - bool, - doc="trailing muon ID (medium)", - ), - isTightLeadingMuon=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "isTightLeadingMuon"), - bool, - doc="leading muon ID (tight)", - ), - isTightTrailingMuon=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "isTightTrailingMuon"), - bool, - doc="trailing muon ID (tight)", - ), - initialMETEt=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "initialMETEt"), - float, - doc="MET Et of selected event", - ), - initialMETphi=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "initialMETphi"), - float, - doc="MET phi of selected event", - ), - initialPuppiMETEt=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "initialPuppiMETEt"), - float, - doc="PuppiMET Et of selected event", - ), - initialPuppiMETphi=ExtVar( - cms.InputTag("selectedMuonsForEmbedding", "initialPuppiMETphi"), - float, - doc="PuppiMET phi of selected event", - ), - ), - ) - process.embeddingTableTask = cms.Task(process.embeddingTable) - process.schedule.associate(process.embeddingTableTask) - - return process - - -################################ cross Customizers ########################### - - -################################ additional Customizer ########################### - - -def customisoptions(process): - if not hasattr(process, "options"): - process.options = cms.untracked.PSet() - process.options.emptyRunLumiMode = cms.untracked.string( - "doNotHandleEmptyRunsAndLumis" - ) - if not hasattr(process, "bunchSpacingProducer"): - process.bunchSpacingProducer = cms.EDProducer("BunchSpacingProducer") - process.bunchSpacingProducer.bunchSpacingOverride = cms.uint32(25) - process.bunchSpacingProducer.overrideBunchSpacing = cms.bool(True) - process.options.numberOfThreads = cms.untracked.uint32(1) - process.options.numberOfStreams = cms.untracked.uint32(0) - return process - - -############################### MC specific Customizer ########################### - - -def customiseFilterZToMuMu(process): - process.load("TauAnalysis.MCEmbeddingTools.DYToMuMuGenFilter_cfi") - process.ZToMuMuFilter = cms.Path(process.dYToMuMuGenFilter) - process.schedule.insert(-1, process.ZToMuMuFilter) - return process - - -def customiseFilterTTbartoMuMu(process): - process.load("TauAnalysis.MCEmbeddingTools.TTbartoMuMuGenFilter_cfi") - process.MCFilter = cms.Path(process.TTbartoMuMuGenFilter) - return customiseMCFilter(process) - - -def customiseMCFilter(process): - process.schedule.insert(-1, process.MCFilter) - outputModulesList = [key for key, value in process.outputModules.items()] - for outputModule in outputModulesList: - outputModule = getattr(process, outputModule) - outputModule.SelectEvents = cms.untracked.PSet( - SelectEvents=cms.vstring("MCFilter") - ) - return process - - -def fix_input_tags( - process, formodules=["generalTracks", "cscSegments", "dt4DSegments", "rpcRecHits"] -): - def change_tags_process(test_input): - if isinstance(test_input, cms.InputTag): - if test_input.getModuleLabel() in formodules: - test_input.setProcessName(process._Process__name) - - def search_for_tags(pset): - if isinstance(pset, dict): - for key in pset: - if isinstance(pset[key], cms.VInputTag): - for akt_inputTag in pset[key]: - change_tags_process(akt_inputTag) - elif isinstance(pset[key], cms.PSet): - search_for_tags(pset[key].__dict__) - elif isinstance(pset[key], cms.VPSet): - for akt_pset in pset[key]: - search_for_tags(akt_pset.__dict__) - else: - change_tags_process(pset[key]) - else: - print("must be python dict not a {}".format(type(pset))) - - for module in process.producers_(): - search_for_tags(getattr(process, module).__dict__) - for module in process.filters_(): - search_for_tags(getattr(process, module).__dict__) - for module in process.analyzers_(): - search_for_tags(getattr(process, module).__dict__) - - return process diff --git a/TauAnalysis/MCEmbeddingTools/test/BuildFile.xml b/TauAnalysis/MCEmbeddingTools/test/BuildFile.xml index 1fc12a955bbc7..735e65bc6cf7a 100644 --- a/TauAnalysis/MCEmbeddingTools/test/BuildFile.xml +++ b/TauAnalysis/MCEmbeddingTools/test/BuildFile.xml @@ -2,4 +2,5 @@ + diff --git a/TauAnalysis/MCEmbeddingTools/test/run_2016postVFPUL_workflow_tests.sh b/TauAnalysis/MCEmbeddingTools/test/run_2016postVFPUL_workflow_tests.sh index 44460e267c9dc..95f67d30da525 100755 --- a/TauAnalysis/MCEmbeddingTools/test/run_2016postVFPUL_workflow_tests.sh +++ b/TauAnalysis/MCEmbeddingTools/test/run_2016postVFPUL_workflow_tests.sh @@ -9,34 +9,36 @@ function die { exit $2 } -## This is a PRE SKIMED dataset -dataset="root://eoscms.cern.ch//store/group/phys_tau/embedding_test_files/2016_G-v1_RAW_preselected.root" +## This is a dataset from the CMSSW integration file catalog (IBEos) from the release validation tests (runTheMatrix.py) +dataset="root://eoscms.cern.ch//store/user/cmsbuild/store/data/Run2016H/DoubleMuon/RAW/v1/000/283/877/00000/0CEA1E63-EF9B-E611-AE44-02163E011CD4.root" echo "################ Selection ################" -cmsDriver.py RECO \ - --step RAW2DIGI,L1Reco,RECO,PAT \ +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2016 \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingSelection \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting_Reselect \ + --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016 \ --filein $dataset \ --fileout file:selection.root \ - -n -1 \ + -n 100 \ --python_filename selection.py || die 'Failure during selecting step' $? echo "################ LHE production and cleaning ################" -cmsDriver.py LHEprodandCLEAN \ - --step RAW2DIGI,RECO,PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2016 \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingCleaning \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning_Reselect \ + --procModifiers tau_embedding_cleaning,tau_embedding_mutauh \ --filein file:selection.root \ --fileout file:lhe_and_cleaned.root \ -n -1 \ @@ -44,17 +46,17 @@ cmsDriver.py LHEprodandCLEAN \ # Simulation (MC & Detector) echo "################ Simulation (MC & Detector) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ --mc \ --beamspot Realistic25ns13TeV2016Collision \ --geometry DB:Extended \ --era Run2_2016 \ --conditions auto:run2_mc \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimGen \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_preHLT_Reselect \ + --procModifiers tau_embedding_sim,tau_embedding_mutauh \ --filein file:lhe_and_cleaned.root \ --fileout file:simulated_and_cleaned_prehlt.root \ -n -1 \ @@ -62,17 +64,16 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Trigger) echo "################ Simulation (Trigger) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ - --step HLT:Fake2 \ +cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ --mc \ --beamspot Realistic25ns13TeV2016Collision \ --geometry DB:Extended \ --era Run2_2016 \ --conditions auto:run2_mc \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimHLT \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_HLT_Reselect \ --filein file:simulated_and_cleaned_prehlt.root \ --fileout file:simulated_and_cleaned_hlt.root \ -n -1 \ @@ -80,17 +81,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Reconstruction) echo "################ Simulation (Reconstruction) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py \ --step RAW2DIGI,L1Reco,RECO,RECOSIM \ + --processName SIMembedding \ --mc \ --beamspot Realistic25ns13TeV2016Collision \ --geometry DB:Extended \ --era Run2_2016 \ --conditions auto:run2_mc \ - --eventcontent RAWRECOSIMHLT \ + --eventcontent TauEmbeddingSimReco \ --datatier RAW-RECO-SIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_postHLT_Reselect \ + --procModifiers tau_embedding_sim \ --filein file:simulated_and_cleaned_hlt.root \ --fileout file:simulated_and_cleaned_posthlt.root \ -n -1 \ @@ -98,16 +99,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Merging echo "################ Merging ################" -cmsDriver.py PAT \ - --step PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --processName MERGE \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2016 \ - --eventcontent MINIAODSIM \ + --eventcontent TauEmbeddingMergeMINIAOD \ --datatier USER \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseMerging_Reselect \ + --procModifiers tau_embedding_merging \ + --inputCommands 'keep *_*_*_*' \ --filein file:simulated_and_cleaned_posthlt.root \ --fileout file:merged.root \ -n -1 \ @@ -116,13 +118,12 @@ cmsDriver.py PAT \ # NanoAOD Production echo "################ NanoAOD Production ################" cmsDriver.py \ - --step NANO \ + --step NANO:@TauEmbedding \ --data \ --conditions auto:run2_data \ - --era Run2_2016,run2_nanoAOD_106Xv2 \ - --eventcontent NANOAODSIM \ + --era Run2_2016 \ + --eventcontent TauEmbeddingNANOAOD \ --datatier NANOAODSIM \ - --customise TauAnalysis/MCEmbeddingTools/customisers.customiseNanoAOD \ --filein file:merged.root \ --fileout file:merged_nano.root \ -n -1 \ diff --git a/TauAnalysis/MCEmbeddingTools/test/run_2016preVFPUL_workflow_tests.sh b/TauAnalysis/MCEmbeddingTools/test/run_2016preVFPUL_workflow_tests.sh index 7d9ef57444afa..4aee970a7ae15 100755 --- a/TauAnalysis/MCEmbeddingTools/test/run_2016preVFPUL_workflow_tests.sh +++ b/TauAnalysis/MCEmbeddingTools/test/run_2016preVFPUL_workflow_tests.sh @@ -9,34 +9,36 @@ function die { exit $2 } -## This is a PRE SKIMED dataset -dataset="root://eoscms.cern.ch//store/group/phys_tau/embedding_test_files/2016_C-v2_RAW_preselected.root" +## This is a dataset from the CMSSW integration file catalog (IBEos) from the release validation tests (runTheMatrix.py) +dataset="root://eoscms.cern.ch//store/user/cmsbuild/store/data/Run2016C/DoubleMuon/RAW/v2/000/276/092/00000/00E35B2C-4A3F-E611-AE34-02163E014479.root" echo "################ Selection ################" -cmsDriver.py RECO \ - --step RAW2DIGI,L1Reco,RECO,PAT \ +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2016_HIPM \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingSelection \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting_Reselect \ + --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016 \ --filein $dataset \ --fileout file:selection.root \ - -n -1 \ + -n 100 \ --python_filename selection.py || die 'Failure during selecting step' $? echo "################ LHE production and cleaning ################" -cmsDriver.py LHEprodandCLEAN \ - --step RAW2DIGI,RECO,PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2016_HIPM \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingCleaning \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2016,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning_Reselect \ + --procModifiers tau_embedding_cleaning,tau_embedding_mu_to_mu \ --filein file:selection.root \ --fileout file:lhe_and_cleaned.root \ -n -1 \ @@ -44,17 +46,17 @@ cmsDriver.py LHEprodandCLEAN \ # Simulation (MC & Detector) echo "################ Simulation (MC & Detector) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ --mc \ --beamspot Realistic25ns13TeV2016Collision \ --geometry DB:Extended \ --era Run2_2016_HIPM \ --conditions auto:run2_mc_pre_vfp \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimGen \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_preHLT_Reselect \ + --procModifiers tau_embedding_sim,tau_embedding_mutauh \ --filein file:lhe_and_cleaned.root \ --fileout file:simulated_and_cleaned_prehlt.root \ -n -1 \ @@ -62,17 +64,16 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Trigger) echo "################ Simulation (Trigger) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ - --step HLT:Fake2 \ +cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ --mc \ --beamspot Realistic25ns13TeV2016Collision \ --geometry DB:Extended \ --era Run2_2016_HIPM \ --conditions auto:run2_mc_pre_vfp \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimHLT \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_HLT_Reselect \ --filein file:simulated_and_cleaned_prehlt.root \ --fileout file:simulated_and_cleaned_hlt.root \ -n -1 \ @@ -80,17 +81,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Reconstruction) echo "################ Simulation (Reconstruction) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py \ --step RAW2DIGI,L1Reco,RECO,RECOSIM \ + --processName SIMembedding \ --mc \ --beamspot Realistic25ns13TeV2016Collision \ --geometry DB:Extended \ --era Run2_2016_HIPM \ --conditions auto:run2_mc_pre_vfp \ - --eventcontent RAWRECOSIMHLT \ + --eventcontent TauEmbeddingSimReco \ --datatier RAW-RECO-SIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_postHLT_Reselect \ + --procModifiers tau_embedding_sim \ --filein file:simulated_and_cleaned_hlt.root \ --fileout file:simulated_and_cleaned_posthlt.root \ -n -1 \ @@ -98,16 +99,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Merging echo "################ Merging ################" -cmsDriver.py PAT \ - --step PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --processName MERGE \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2016_HIPM \ - --eventcontent MINIAODSIM \ + --eventcontent TauEmbeddingMergeMINIAOD \ --datatier USER \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseMerging_Reselect \ + --procModifiers tau_embedding_merging \ + --inputCommands 'keep *_*_*_*' \ --filein file:simulated_and_cleaned_posthlt.root \ --fileout file:merged.root \ -n -1 \ @@ -116,13 +118,12 @@ cmsDriver.py PAT \ # NanoAOD Production echo "################ NanoAOD Production ################" cmsDriver.py \ - --step NANO \ + --step NANO:@TauEmbedding \ --data \ --conditions auto:run2_data \ - --era Run2_2016_HIPM,run2_nanoAOD_106Xv2 \ - --eventcontent NANOAODSIM \ + --era Run2_2016_HIPM \ + --eventcontent TauEmbeddingNANOAOD \ --datatier NANOAODSIM \ - --customise TauAnalysis/MCEmbeddingTools/customisers.customiseNanoAOD \ --filein file:merged.root \ --fileout file:merged_nano.root \ -n -1 \ diff --git a/TauAnalysis/MCEmbeddingTools/test/run_2017UL_workflow_tests.sh b/TauAnalysis/MCEmbeddingTools/test/run_2017UL_workflow_tests.sh index c3a33688e0135..1f345e7c9675e 100755 --- a/TauAnalysis/MCEmbeddingTools/test/run_2017UL_workflow_tests.sh +++ b/TauAnalysis/MCEmbeddingTools/test/run_2017UL_workflow_tests.sh @@ -9,34 +9,36 @@ function die { exit $2 } -## This is a PRE SKIMED dataset -dataset="root://eoscms.cern.ch//store/group/phys_tau/embedding_test_files/2017_B-v1_RAW_preselected.root" +## This is a dataset from the CMSSW integration file catalog (IBEos) from the release validation tests (runTheMatrix.py) +dataset="root://eoscms.cern.ch//store/user/cmsbuild/store/data/Run2017B/DoubleMuon/RAW/v1/000/297/557/00000/00BD167D-E35A-E711-AE44-02163E014794.root" echo "################ Selection ################" -cmsDriver.py RECO \ - --step RAW2DIGI,L1Reco,RECO,PAT \ +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2017 \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingSelection \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2017,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting_Reselect \ + --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2017 \ --filein $dataset \ --fileout file:selection.root \ - -n -1 \ + -n 100 \ --python_filename selection.py || die 'Failure during selecting step' $? echo "################ LHE production and cleaning ################" -cmsDriver.py LHEprodandCLEAN \ - --step RAW2DIGI,RECO,PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2017 \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingCleaning \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2017,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning_Reselect \ + --procModifiers tau_embedding_cleaning,tau_embedding_mutauh \ --filein file:selection.root \ --fileout file:lhe_and_cleaned.root \ -n -1 \ @@ -44,17 +46,17 @@ cmsDriver.py LHEprodandCLEAN \ # Simulation (MC & Detector) echo "################ Simulation (MC & Detector) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ --mc \ --beamspot Realistic25ns13TeVEarly2017Collision \ --geometry DB:Extended \ --era Run2_2017 \ --conditions auto:phase1_2017_realistic \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimGen \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_preHLT_Reselect \ + --procModifiers tau_embedding_sim,tau_embedding_mutauh \ --filein file:lhe_and_cleaned.root \ --fileout file:simulated_and_cleaned_prehlt.root \ -n -1 \ @@ -62,17 +64,16 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Trigger) echo "################ Simulation (Trigger) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ - --step HLT:Fake2 \ +cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ --mc \ --beamspot Realistic25ns13TeVEarly2017Collision \ --geometry DB:Extended \ --era Run2_2017 \ --conditions auto:phase1_2017_realistic \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimHLT \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_HLT_Reselect \ --filein file:simulated_and_cleaned_prehlt.root \ --fileout file:simulated_and_cleaned_hlt.root \ -n -1 \ @@ -80,17 +81,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Reconstruction) echo "################ Simulation (Reconstruction) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py \ --step RAW2DIGI,L1Reco,RECO,RECOSIM \ + --processName SIMembedding \ --mc \ --beamspot Realistic25ns13TeVEarly2017Collision \ --geometry DB:Extended \ --era Run2_2017 \ --conditions auto:phase1_2017_realistic \ - --eventcontent RAWRECOSIMHLT \ + --eventcontent TauEmbeddingSimReco \ --datatier RAW-RECO-SIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_postHLT_Reselect \ + --procModifiers tau_embedding_sim \ --filein file:simulated_and_cleaned_hlt.root \ --fileout file:simulated_and_cleaned_posthlt.root \ -n -1 \ @@ -98,16 +99,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Merging echo "################ Merging ################" -cmsDriver.py PAT \ - --step PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --processName MERGE \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2017 \ - --eventcontent MINIAODSIM \ + --eventcontent TauEmbeddingMergeMINIAOD \ --datatier USER \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseMerging_Reselect \ + --procModifiers tau_embedding_merging \ + --inputCommands 'keep *_*_*_*' \ --filein file:simulated_and_cleaned_posthlt.root \ --fileout file:merged.root \ -n -1 \ @@ -116,13 +118,12 @@ cmsDriver.py PAT \ # NanoAOD Production echo "################ NanoAOD Production ################" cmsDriver.py \ - --step NANO \ + --step NANO:@TauEmbedding \ --data \ --conditions auto:run2_data \ - --era Run2_2017,run2_nanoAOD_106Xv2 \ - --eventcontent NANOAODSIM \ + --era Run2_2017 \ + --eventcontent TauEmbeddingNANOAOD \ --datatier NANOAODSIM \ - --customise TauAnalysis/MCEmbeddingTools/customisers.customiseNanoAOD \ --filein file:merged.root \ --fileout file:merged_nano.root \ -n -1 \ diff --git a/TauAnalysis/MCEmbeddingTools/test/run_2018UL_workflow_tests.sh b/TauAnalysis/MCEmbeddingTools/test/run_2018UL_workflow_tests.sh index 31551064a911a..1f2d43908515e 100755 --- a/TauAnalysis/MCEmbeddingTools/test/run_2018UL_workflow_tests.sh +++ b/TauAnalysis/MCEmbeddingTools/test/run_2018UL_workflow_tests.sh @@ -9,34 +9,36 @@ function die { exit $2 } -## This is a PRE SKIMED dataset -dataset="root://eoscms.cern.ch//store/group/phys_tau/embedding_test_files/2018_C-v2_RAW_preselected.root" +## This is a dataset from the CMSSW integration file catalog (IBEos) from the release validation tests (runTheMatrix.py) +dataset="root://eoscms.cern.ch//store/user/cmsbuild/store/data/Run2018C/DoubleMuon/RAW/v1/000/319/450/00000/0EA52A03-F783-E811-B448-FA163E621846.root" echo "################ Selection ################" -cmsDriver.py RECO \ - --step RAW2DIGI,L1Reco,RECO,PAT \ +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2018 \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingSelection \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2018,TauAnalysis/MCEmbeddingTools/customisers.customiseSelecting_Reselect \ + --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2018 \ --filein $dataset \ --fileout file:selection.root \ - -n -1 \ + -n 100 \ --python_filename selection.py || die 'Failure during selecting step' $? echo "################ LHE production and cleaning ################" -cmsDriver.py LHEprodandCLEAN \ - --step RAW2DIGI,RECO,PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2018 \ - --eventcontent RAWRECO \ + --eventcontent TauEmbeddingCleaning \ --datatier RAWRECO \ - --customise Configuration/DataProcessing/RecoTLR.customisePostEra_Run2_2018,TauAnalysis/MCEmbeddingTools/customisers.customiseLHEandCleaning_Reselect \ + --procModifiers tau_embedding_cleaning,tau_embedding_mutauh \ --filein file:selection.root \ --fileout file:lhe_and_cleaned.root \ -n -1 \ @@ -44,17 +46,17 @@ cmsDriver.py LHEprodandCLEAN \ # Simulation (MC & Detector) echo "################ Simulation (MC & Detector) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ --mc \ --beamspot Realistic25ns13TeVEarly2018Collision \ --geometry DB:Extended \ --era Run2_2018 \ --conditions auto:phase1_2018_realistic \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimGen \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_preHLT_Reselect \ + --procModifiers tau_embedding_sim,tau_embedding_mutauh \ --filein file:lhe_and_cleaned.root \ --fileout file:simulated_and_cleaned_prehlt.root \ -n -1 \ @@ -62,17 +64,16 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Trigger) echo "################ Simulation (Trigger) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ - --step HLT:Fake2 \ +cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ --mc \ --beamspot Realistic25ns13TeVEarly2018Collision \ --geometry DB:Extended \ --era Run2_2018 \ --conditions auto:phase1_2018_realistic \ - --eventcontent RAWSIM \ + --eventcontent TauEmbeddingSimHLT \ --datatier RAWSIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_HLT_Reselect \ --filein file:simulated_and_cleaned_prehlt.root \ --fileout file:simulated_and_cleaned_hlt.root \ -n -1 \ @@ -80,17 +81,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Simulation (Reconstruction) echo "################ Simulation (Reconstruction) ################" -cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi.py \ +cmsDriver.py \ --step RAW2DIGI,L1Reco,RECO,RECOSIM \ + --processName SIMembedding \ --mc \ --beamspot Realistic25ns13TeVEarly2018Collision \ --geometry DB:Extended \ --era Run2_2018 \ --conditions auto:phase1_2018_realistic \ - --eventcontent RAWRECOSIMHLT \ + --eventcontent TauEmbeddingSimReco \ --datatier RAW-RECO-SIM \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseGenerator_postHLT_Reselect \ + --procModifiers tau_embedding_sim \ --filein file:simulated_and_cleaned_hlt.root \ --fileout file:simulated_and_cleaned_posthlt.root \ -n -1 \ @@ -98,16 +99,17 @@ cmsDriver.py TauAnalysis/MCEmbeddingTools/python/EmbeddingPythia8Hadronizer_cfi. # Merging echo "################ Merging ################" -cmsDriver.py PAT \ - --step PAT \ +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --processName MERGE \ --data \ --scenario pp \ --conditions auto:run2_data \ --era Run2_2018 \ - --eventcontent MINIAODSIM \ + --eventcontent TauEmbeddingMergeMINIAOD \ --datatier USER \ - --customise \ - TauAnalysis/MCEmbeddingTools/customisers.customiseMerging_Reselect \ + --procModifiers tau_embedding_merging \ + --inputCommands 'keep *_*_*_*' \ --filein file:simulated_and_cleaned_posthlt.root \ --fileout file:merged.root \ -n -1 \ @@ -116,13 +118,12 @@ cmsDriver.py PAT \ # NanoAOD Production echo "################ NanoAOD Production ################" cmsDriver.py \ - --step NANO \ + --step NANO:@TauEmbedding \ --data \ --conditions auto:run2_data \ - --era Run2_2018,run2_nanoAOD_106Xv2 \ - --eventcontent NANOAODSIM \ + --era Run2_2018 \ + --eventcontent TauEmbeddingNANOAOD \ --datatier NANOAODSIM \ - --customise TauAnalysis/MCEmbeddingTools/customisers.customiseNanoAOD \ --filein file:merged.root \ --fileout file:merged_nano.root \ -n -1 \ diff --git a/TauAnalysis/MCEmbeddingTools/test/run_2022_workflow_tests.sh b/TauAnalysis/MCEmbeddingTools/test/run_2022_workflow_tests.sh new file mode 100755 index 0000000000000..cc2e89b24554f --- /dev/null +++ b/TauAnalysis/MCEmbeddingTools/test/run_2022_workflow_tests.sh @@ -0,0 +1,128 @@ +#!/bin/bash +# This script runs all the steps of the embedding workflow +# author: Christian Winter (christian.winter@cern.ch) +# TODO: move the dataset to a more persistent and for cmssw accessible place than a private EOS user folder + +# print the exit status before exiting +function die { + echo $1: status $2 + exit $2 +} + +## This is a dataset from the CMSSW integration file catalog (IBEos) from the release validation tests (runTheMatrix.py) +dataset="root://eoscms.cern.ch//store/user/cmsbuild/store/data/Run2022C/DoubleMuon/RAW/v1/000/356/381/00000/0b55fb47-4e17-49f2-a753-e625a741e44c.root" + +echo "################ Selection ################" +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,PAT,FILTER:TauAnalysis/MCEmbeddingTools/Selection_FILTER_cff.makePatMuonsZmumuSelection \ + --processName SELECT \ + --data \ + --scenario pp \ + --conditions auto:run3_data \ + --era Run3 \ + --eventcontent TauEmbeddingSelection \ + --datatier RAWRECO \ + --filein $dataset \ + --fileout file:selection.root \ + -n 100 \ + --python_filename selection.py || die 'Failure during selecting step' $? + +echo "################ LHE production and cleaning ################" +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/LHE_USER_cff.embeddingLHEProducerTask,RAW2DIGI,RECO \ + --processName LHEembeddingCLEAN \ + --data \ + --scenario pp \ + --conditions auto:run3_data \ + --era Run3 \ + --eventcontent TauEmbeddingCleaning \ + --datatier RAWRECO \ + --procModifiers tau_embedding_cleaning,tau_embedding_mutauh \ + --filein file:selection.root \ + --fileout file:lhe_and_cleaned.root \ + -n -1 \ + --python_filename lheprodandcleaning.py || die 'Failure during LHE and Cleaning step' $? + +# Simulation (MC & Detector) +echo "################ Simulation (MC & Detector) ################" +cmsDriver.py TauAnalysis/MCEmbeddingTools/python/Simulation_GEN_cfi.py \ + --step GEN,SIM,DIGI,L1,DIGI2RAW \ + --processName SIMembeddingpreHLT \ + --mc \ + --beamspot Realistic25ns13p6TeVEarly2022Collision \ + --geometry DB:Extended \ + --era Run3 \ + --conditions auto:phase1_2022_realistic_postEE \ + --eventcontent TauEmbeddingSimGen \ + --datatier RAWSIM \ + --procModifiers tau_embedding_sim,tau_embedding_mutauh \ + --filein file:lhe_and_cleaned.root \ + --fileout file:simulated_and_cleaned_prehlt.root \ + -n -1 \ + --python_filename generator_preHLT.py || die 'Failure during MC & Detector simulation step' $? + +# Simulation (Trigger) +echo "################ Simulation (Trigger) ################" +cmsDriver.py \ + --step HLT:Fake2+TauAnalysis/MCEmbeddingTools/Simulation_HLT_customiser_cff.embeddingHLTCustomiser \ + --processName SIMembeddingHLT \ + --mc \ + --beamspot Realistic25ns13p6TeVEarly2022Collision \ + --geometry DB:Extended \ + --era Run3 \ + --conditions auto:phase1_2022_realistic_postEE \ + --eventcontent TauEmbeddingSimHLT \ + --datatier RAWSIM \ + --filein file:simulated_and_cleaned_prehlt.root \ + --fileout file:simulated_and_cleaned_hlt.root \ + -n -1 \ + --python_filename generator_HLT.py || die 'Failure during Fake Trigger simulation step' $? + +# Simulation (Reconstruction) +echo "################ Simulation (Reconstruction) ################" +cmsDriver.py \ + --step RAW2DIGI,L1Reco,RECO,RECOSIM \ + --processName SIMembedding \ + --mc \ + --beamspot Realistic25ns13p6TeVEarly2022Collision \ + --geometry DB:Extended \ + --era Run3 \ + --conditions auto:phase1_2022_realistic_postEE \ + --eventcontent TauEmbeddingSimReco \ + --datatier RAW-RECO-SIM \ + --procModifiers tau_embedding_sim \ + --filein file:simulated_and_cleaned_hlt.root \ + --fileout file:simulated_and_cleaned_posthlt.root \ + -n -1 \ + --python_filename generator_postHLT.py || die 'Failure during reconstruction simulation step' $? + +# Merging +echo "################ Merging ################" +cmsDriver.py \ + --step USER:TauAnalysis/MCEmbeddingTools/Merging_USER_cff.merge_step,PAT \ + --data \ + --scenario pp \ + --conditions auto:run3_data \ + --era Run3 \ + --eventcontent TauEmbeddingMergeMINIAOD \ + --datatier USER \ + --procModifiers tau_embedding_merging \ + --inputCommands 'keep *_*_*_*' \ + --filein file:simulated_and_cleaned_posthlt.root \ + --fileout file:merged.root \ + -n -1 \ + --python_filename merging.py || die 'Failure during the merging step' $? + +# NanoAOD Production +echo "################ NanoAOD Production ################" +cmsDriver.py \ + --step NANO:@TauEmbedding \ + --data \ + --conditions auto:run3_data \ + --era Run3 \ + --eventcontent TauEmbeddingNANOAOD \ + --datatier NANOAODSIM \ + --filein file:merged.root \ + --fileout file:merged_nano.root \ + -n -1 \ + --python_filename embedding_nanoAOD.py || die 'Failure during the nanoAOD step' $?