From 1828c83c04696d32f4de0b3b186856a6513a4640 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 11 Nov 2021 12:06:18 +0100 Subject: [PATCH 01/18] Firt skeletton of direct simulation in SimPPS - New direct simulation configuration added in SimPPS/Configuration - Added a ppsDirectSim task/sequence skeleton, with a corresponding test --- .../Configuration/python/directSimPPS_cff.py | 68 +++++++++++++++++++ .../test/test_miniAOD_cfg.py | 49 +++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 SimPPS/Configuration/python/directSimPPS_cff.py create mode 100644 SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py diff --git a/SimPPS/Configuration/python/directSimPPS_cff.py b/SimPPS/Configuration/python/directSimPPS_cff.py new file mode 100644 index 0000000000000..863118c4ee77b --- /dev/null +++ b/SimPPS/Configuration/python/directSimPPS_cff.py @@ -0,0 +1,68 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Eras import eras +# configuration for composite source of alignment, optics, ... +from CalibPPS.ESProducers.ctppsCompositeESSource_cfi import ctppsCompositeESSource as _esComp +from CalibPPS.ESProducers.ctppsBeamParametersFromLHCInfoESSource_cfi import ctppsBeamParametersFromLHCInfoESSource as _esLHCinfo +from CalibPPS.ESProducers.ppsAssociationCutsESSource_cfi import ppsAssociationCutsESSource as _esAssCuts +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry +# direct proton simulation +from Validation.CTPPS.ctppsDirectProtonSimulation_cfi import ctppsDirectProtonSimulation as _dirProtonSim + +ctppsCompositeESSource = _esComp.clone( + generateEveryNEvents = 100, +) +# beam parameters as determined by PPS +ctppsBeamParametersFromLHCInfoESSource = _esLHCinfo.clone( + lhcInfoLabel = cms.string(""), + # beam divergence (rad) + beamDivX45 = cms.double(30.e-6), + beamDivX56 = cms.double(30.e-6), + beamDivY45 = cms.double(30.e-6), + beamDivY56 = cms.double(30.e-6), + # vertex offset (cm) + vtxOffsetX45 = cms.double(0.), + vtxOffsetX56 = cms.double(0.), + vtxOffsetY45 = cms.double(0.), + vtxOffsetY56 = cms.double(0.), + vtxOffsetZ45 = cms.double(0.), + vtxOffsetZ56 = cms.double(0.), + # vertex sigma (cm) + vtxStddevX = cms.double(1.e-3), + vtxStddevY = cms.double(1.e-3), + vtxStddevZ = cms.double(5.) +) + +ppsAssociationCutsESSource = _esAssCuts.clone() + +# direct simulation +ctppsDirectProtonSimulation = _dirProtonSim.clone( + hepMCTag = cms.InputTag('beamDivergenceVtxGenerator'), + pitchStrips = cms.double(66.e-3 * 12 / 19), # effective value to reproduce real RP resolution + pitchPixelsHor = cms.double(5.e-3), + pitchPixelsVer = cms.double(80.e-3), + produceScoringPlaneHits = cms.bool(False), +) + +ppsDirectSimTask = cms.Task( + ctppsDirectProtonSimulation, +) + +ppsDirectSim = cms.Sequence(ppsDirectSimTask) + +# modify according to era + +def _modify2016(process): + from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2016 + use_single_infinite_iov_entry(process.ppsAssociationCutsESSource, p2016) + +def _modify2017(process): + from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2017 + use_single_infinite_iov_entry(process.ppsAssociationCutsESSource, p2017) + +def _modify2018(process): + from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2018 + use_single_infinite_iov_entry(process.ppsAssociationCutsESSource, p2018) + +modifyConfigurationStandardSequencesFor2016_ = eras.ctpps_2016.makeProcessModifier(_modify2016) +modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2016.makeProcessModifier(_modify2017) +modifyConfigurationStandardSequencesFor2018_ = eras.ctpps_2016.makeProcessModifier(_modify2018) diff --git a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py new file mode 100644 index 0000000000000..e8d91203eb390 --- /dev/null +++ b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_ctpps_cff import ctpps +process = cms.Process('PPS', ctpps) + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +# minimum of logs +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.threshold = cms.untracked.string('') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(100) + +# raw data source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + '/store/mc/RunIISummer20UL16MiniAODAPVv2/GGToMuMu_Pt-25_Elastic_13TeV-lpair/MINIAODSIM/106X_mcRun2_asymptotic_preVFP_v11-v1/280000/3870E880-4A47-7440-B122-C76062D2290F.root', + ), + #inputCommands = cms.untracked.vstring( + # 'drop *', + # 'keep FEDRawDataCollection_*_*_*' + #) +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1000) +) + +# PPS simulation and reconstruction chains with standard settings +process.load('SimPPS.Configuration.ppsDirectSim_cff') +process.load('RecoPPS.Configuration.recoCTPPS_cff') + +process.p = cms.Path( + process.ppsDirectSim * + process.recoCTPPS +) + +# output configuration +from RecoPPS.Configuration.RecoCTPPS_EventContent_cff import RecoCTPPSAOD +process.output = cms.OutputModule('PoolOutputModule', + fileName = cms.untracked.string('file:output.root'), + outputCommands = RecoCTPPSAOD.outputCommands +) + +process.outpath = cms.EndPath(process.output) From ef1cb85400d696d060959b7769173d205bd700fa Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Fri, 12 Nov 2021 12:17:35 +0100 Subject: [PATCH 02/18] Moving things around in direct simu - moved the simulation package to a dedicated SimPPS/DirectSimProducer subpackage - eras process modifiers now loading external condition objects - grouping of profiles by year - set default beam energy to run 3 value, and only modify run 2 accordingly - base_cff is now only containing the postfixes --- .../Configuration/python/directSimPPS_cff.py | 73 ++++--- .../DirectSimProducer/plugins/BuildFile.xml | 9 + .../plugins/PPSDirectProtonSimulation.cc | 18 +- .../python/profile_base_cff.py | 38 ++++ .../python/profiles_2016_cff.py | 49 +++++ .../python/profiles_2017_cff.py | 48 +++++ .../python/profiles_2018_cff.py | 64 +++++++ .../python/profiles_2022_cff.py | 31 +++ .../python/simPPS2016_cfi.py | 26 +++ .../python/simPPS2017_cfi.py | 25 +++ .../python/simPPS2018_cfi.py | 25 +++ .../python/simPPS2022_cfi.py | 29 +++ .../test/test_miniAOD_cfg.py | 12 +- Validation/CTPPS/python/base_cff.py | 54 ++++++ .../CTPPS/python/simu_config/base_cff.py | 181 ------------------ .../simu_config/profile_2016_postTS2_cff.py | 31 --- .../simu_config/profile_2016_preTS2_cff.py | 30 --- .../simu_config/profile_2017_postTS2_cff.py | 26 --- .../simu_config/profile_2017_preTS2_cff.py | 26 --- .../simu_config/profile_2018_TS1_TS2_cff.py | 23 --- .../simu_config/profile_2018_postTS2_cff.py | 23 --- .../simu_config/profile_2018_preTS1_cff.py | 24 --- .../simu_config/profile_2021_default_cff.py | 23 --- .../simu_config/profile_2022_default_cff.py | 24 --- .../CTPPS/python/simu_config/year_2016_cff.py | 44 ----- .../CTPPS/python/simu_config/year_2017_cff.py | 53 ----- .../CTPPS/python/simu_config/year_2018_cff.py | 57 ------ .../CTPPS/python/simu_config/year_2021_cff.py | 57 ------ .../CTPPS/python/simu_config/year_2022_cff.py | 56 ------ Validation/CTPPS/test/simu/template_cfg.py | 100 ++++++---- 30 files changed, 517 insertions(+), 762 deletions(-) create mode 100644 SimPPS/DirectSimProducer/plugins/BuildFile.xml rename Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc => SimPPS/DirectSimProducer/plugins/PPSDirectProtonSimulation.cc (97%) create mode 100644 SimPPS/DirectSimProducer/python/profile_base_cff.py create mode 100644 SimPPS/DirectSimProducer/python/profiles_2016_cff.py create mode 100644 SimPPS/DirectSimProducer/python/profiles_2017_cff.py create mode 100644 SimPPS/DirectSimProducer/python/profiles_2018_cff.py create mode 100644 SimPPS/DirectSimProducer/python/profiles_2022_cff.py create mode 100644 SimPPS/DirectSimProducer/python/simPPS2016_cfi.py create mode 100644 SimPPS/DirectSimProducer/python/simPPS2017_cfi.py create mode 100644 SimPPS/DirectSimProducer/python/simPPS2018_cfi.py create mode 100644 SimPPS/DirectSimProducer/python/simPPS2022_cfi.py create mode 100644 Validation/CTPPS/python/base_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/base_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2017_postTS2_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2017_preTS2_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2018_TS1_TS2_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2018_postTS2_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2018_preTS1_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2021_default_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/profile_2022_default_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/year_2016_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/year_2017_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/year_2018_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/year_2021_cff.py delete mode 100644 Validation/CTPPS/python/simu_config/year_2022_cff.py diff --git a/SimPPS/Configuration/python/directSimPPS_cff.py b/SimPPS/Configuration/python/directSimPPS_cff.py index 863118c4ee77b..b6d794c2b63df 100644 --- a/SimPPS/Configuration/python/directSimPPS_cff.py +++ b/SimPPS/Configuration/python/directSimPPS_cff.py @@ -1,50 +1,40 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -# configuration for composite source of alignment, optics, ... -from CalibPPS.ESProducers.ctppsCompositeESSource_cfi import ctppsCompositeESSource as _esComp from CalibPPS.ESProducers.ctppsBeamParametersFromLHCInfoESSource_cfi import ctppsBeamParametersFromLHCInfoESSource as _esLHCinfo -from CalibPPS.ESProducers.ppsAssociationCutsESSource_cfi import ppsAssociationCutsESSource as _esAssCuts -from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry -# direct proton simulation -from Validation.CTPPS.ctppsDirectProtonSimulation_cfi import ctppsDirectProtonSimulation as _dirProtonSim +from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cfi import ppsDirectProtonSimulation as _dirProtonSim -ctppsCompositeESSource = _esComp.clone( - generateEveryNEvents = 100, -) # beam parameters as determined by PPS ctppsBeamParametersFromLHCInfoESSource = _esLHCinfo.clone( - lhcInfoLabel = cms.string(""), + lhcInfoLabel = "", # beam divergence (rad) - beamDivX45 = cms.double(30.e-6), - beamDivX56 = cms.double(30.e-6), - beamDivY45 = cms.double(30.e-6), - beamDivY56 = cms.double(30.e-6), + beamDivX45 = 30.e-6, + beamDivX56 = 30.e-6, + beamDivY45 = 30.e-6, + beamDivY56 = 30.e-6, # vertex offset (cm) - vtxOffsetX45 = cms.double(0.), - vtxOffsetX56 = cms.double(0.), - vtxOffsetY45 = cms.double(0.), - vtxOffsetY56 = cms.double(0.), - vtxOffsetZ45 = cms.double(0.), - vtxOffsetZ56 = cms.double(0.), + vtxOffsetX45 = 0., + vtxOffsetX56 = 0., + vtxOffsetY45 = 0., + vtxOffsetY56 = 0., + vtxOffsetZ45 = 0., + vtxOffsetZ56 = 0., # vertex sigma (cm) - vtxStddevX = cms.double(1.e-3), - vtxStddevY = cms.double(1.e-3), - vtxStddevZ = cms.double(5.) + vtxStddevX = 1.e-3, + vtxStddevY = 1.e-3, + vtxStddevZ = 5. ) -ppsAssociationCutsESSource = _esAssCuts.clone() - # direct simulation -ctppsDirectProtonSimulation = _dirProtonSim.clone( +ppsDirectProtonSimulation = _dirProtonSim.clone( hepMCTag = cms.InputTag('beamDivergenceVtxGenerator'), - pitchStrips = cms.double(66.e-3 * 12 / 19), # effective value to reproduce real RP resolution - pitchPixelsHor = cms.double(5.e-3), - pitchPixelsVer = cms.double(80.e-3), - produceScoringPlaneHits = cms.bool(False), + pitchStrips = 66.e-3 * 12 / 19, # effective value to reproduce real RP resolution + pitchPixelsHor = 50.e-3, + pitchPixelsVer = 80.e-3, + produceScoringPlaneHits = False, ) ppsDirectSimTask = cms.Task( - ctppsDirectProtonSimulation, + ppsDirectProtonSimulation, ) ppsDirectSim = cms.Sequence(ppsDirectSimTask) @@ -52,17 +42,22 @@ # modify according to era def _modify2016(process): - from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2016 - use_single_infinite_iov_entry(process.ppsAssociationCutsESSource, p2016) + print('Process customised for 2016 PPS era') + process.load('SimPPS.DirectSimProducer.simPPS2016_cfi') def _modify2017(process): - from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2017 - use_single_infinite_iov_entry(process.ppsAssociationCutsESSource, p2017) + print('Process customised for 2017 PPS era') + process.load('SimPPS.DirectSimProducer.simPPS2017_cfi') def _modify2018(process): - from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2018 - use_single_infinite_iov_entry(process.ppsAssociationCutsESSource, p2018) + print('Process customised for 2018 PPS era') + process.load('SimPPS.DirectSimProducer.simPPS2018_cfi') + +def _modify2021(process): + print('Process customised for 2021 PPS era') + process.load('SimPPS.DirectSimProducer.simPPS2021_cfi') modifyConfigurationStandardSequencesFor2016_ = eras.ctpps_2016.makeProcessModifier(_modify2016) -modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2016.makeProcessModifier(_modify2017) -modifyConfigurationStandardSequencesFor2018_ = eras.ctpps_2016.makeProcessModifier(_modify2018) +modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2017.makeProcessModifier(_modify2017) +modifyConfigurationStandardSequencesFor2018_ = eras.ctpps_2018.makeProcessModifier(_modify2018) +modifyConfigurationStandardSequencesFor2021_ = eras.ctpps_2021.makeProcessModifier(_modify2021) diff --git a/SimPPS/DirectSimProducer/plugins/BuildFile.xml b/SimPPS/DirectSimProducer/plugins/BuildFile.xml new file mode 100644 index 0000000000000..f78d770a4d970 --- /dev/null +++ b/SimPPS/DirectSimProducer/plugins/BuildFile.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc b/SimPPS/DirectSimProducer/plugins/PPSDirectProtonSimulation.cc similarity index 97% rename from Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc rename to SimPPS/DirectSimProducer/plugins/PPSDirectProtonSimulation.cc index fe7f9ccce70d9..81b2def4610d5 100644 --- a/Validation/CTPPS/plugins/CTPPSDirectProtonSimulation.cc +++ b/SimPPS/DirectSimProducer/plugins/PPSDirectProtonSimulation.cc @@ -63,10 +63,10 @@ //---------------------------------------------------------------------------------------------------- -class CTPPSDirectProtonSimulation : public edm::stream::EDProducer<> { +class PPSDirectProtonSimulation : public edm::stream::EDProducer<> { public: - explicit CTPPSDirectProtonSimulation(const edm::ParameterSet &); - ~CTPPSDirectProtonSimulation() override {} + explicit PPSDirectProtonSimulation(const edm::ParameterSet &); + ~PPSDirectProtonSimulation() override {} static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); @@ -149,7 +149,7 @@ class CTPPSDirectProtonSimulation : public edm::stream::EDProducer<> { //---------------------------------------------------------------------------------------------------- -CTPPSDirectProtonSimulation::CTPPSDirectProtonSimulation(const edm::ParameterSet &iConfig) +PPSDirectProtonSimulation::PPSDirectProtonSimulation(const edm::ParameterSet &iConfig) : tokenLHCInfo_(esConsumes(edm::ESInputTag{"", iConfig.getParameter("lhcInfoLabel")})), tokenBeamParameters_(esConsumes()), pixelTopologyToken_(esConsumes()), @@ -209,7 +209,7 @@ CTPPSDirectProtonSimulation::CTPPSDirectProtonSimulation(const edm::ParameterSet //---------------------------------------------------------------------------------------------------- -void CTPPSDirectProtonSimulation::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { +void PPSDirectProtonSimulation::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.addUntracked("verbosity", 0); @@ -237,12 +237,12 @@ void CTPPSDirectProtonSimulation::fillDescriptions(edm::ConfigurationDescription desc.add("pitchPixelsHor", 100.e-3); desc.add("pitchPixelsVer", 150.e-3); - descriptions.add("ctppsDirectProtonSimulation", desc); + descriptions.add("ppsDirectProtonSimulation", desc); } //---------------------------------------------------------------------------------------------------- -void CTPPSDirectProtonSimulation::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { +void PPSDirectProtonSimulation::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { // get input edm::Handle hepmc_prod; iEvent.getByToken(hepMCToken_, hepmc_prod); @@ -338,7 +338,7 @@ void CTPPSDirectProtonSimulation::produce(edm::Event &iEvent, const edm::EventSe //---------------------------------------------------------------------------------------------------- -void CTPPSDirectProtonSimulation::processProton( +void PPSDirectProtonSimulation::processProton( const HepMC::GenVertex *in_vtx, const HepMC::GenParticle *in_trk, const CTPPSGeometry &geometry, @@ -688,4 +688,4 @@ void CTPPSDirectProtonSimulation::processProton( //---------------------------------------------------------------------------------------------------- -DEFINE_FWK_MODULE(CTPPSDirectProtonSimulation); +DEFINE_FWK_MODULE(PPSDirectProtonSimulation); diff --git a/SimPPS/DirectSimProducer/python/profile_base_cff.py b/SimPPS/DirectSimProducer/python/profile_base_cff.py new file mode 100644 index 0000000000000..f1cf4cf7c2645 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/profile_base_cff.py @@ -0,0 +1,38 @@ +import FWCore.ParameterSet.Config as cms + +profile_base = cms.PSet( + L_int = cms.double(1.), + # LHCInfo (default Run 3 values) + ctppsLHCInfo = cms.PSet( + xangle = cms.double(-1.), + betaStar = cms.double(-1.), + beamEnergy = cms.double(6.8e3), + xangleBetaStarHistogramFile = cms.string("CalibPPS/ESProducers/data/xangle_beta_distributions/version1.root"), + xangleBetaStarHistogramObject = cms.string("") + ), + # optics + ctppsOpticalFunctions = cms.PSet( + opticalFunctions = cms.VPSet(), + scoringPlanes = cms.VPSet() + ), + # alignment + ctppsRPAlignmentCorrectionsDataXML = cms.PSet( + MeasuredFiles = cms.vstring(), + RealFiles = cms.vstring(), + MisalignedFiles = cms.vstring() + ), + # direct simu data + ctppsDirectSimuData = cms.PSet( + empiricalAperture45 = cms.string(""), + empiricalAperture56 = cms.string(""), + timeResolutionDiamonds45 = cms.string("999"), + timeResolutionDiamonds56 = cms.string("999"), + efficienciesPerRP = cms.VPSet(), + efficienciesPerPlane = cms.VPSet() + ) +) + +def matchDirectSimOutputs(process): + process.totemRPUVPatternFinder.tagRecHit = cms.InputTag('ppsDirectProtonSimulation') + process.ctppsPixelLocalTracks.tag = cms.InputTag('ppsDirectProtonSimulation') + process.ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ppsDirectProtonSimulation') diff --git a/SimPPS/DirectSimProducer/python/profiles_2016_cff.py b/SimPPS/DirectSimProducer/python/profiles_2016_cff.py new file mode 100644 index 0000000000000..e826e8c15d068 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/profiles_2016_cff.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from SimPPS.DirectSimProducer.profile_base_cff import profile_base as _base +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2016_preTS2, optics_2016_postTS2 + +# base profile settings for 2016 +_base_2016 = _base.clone( + ctppsLHCInfo = _base.ctppsLHCInfo.clone( + beamEnergy = 6500. + ) +) + +profile_2016_preTS2 = _base_2016.clone( + L_int = 6.138092276 + 3.654039035, + ctppsLHCInfo = _base_2016.ctppsLHCInfo.clone( + xangleBetaStarHistogramObject = "2016_preTS2/h2_betaStar_vs_xangle" + ), + ctppsOpticalFunctions = _base_2016.ctppsOpticalFunctions.clone( + opticalFunctions = optics_2016_preTS2.opticalFunctions, + scoringPlanes = optics_2016_preTS2.scoringPlanes, + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2016.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/2016_preTS2.xml"], + RealFiles = ["Validation/CTPPS/alignment/2016_preTS2.xml"] + ), + ctppsDirectSimuData = _base_2016.ctppsDirectSimuData.clone( + empiricalAperture45 = "3.76296E-05+(([xi]<0.117122)*0.00712775+([xi]>=0.117122)*0.0148651)*([xi]-0.117122)", + empiricalAperture56 = "1.85954E-05+(([xi]<0.14324)*0.00475349+([xi]>=0.14324)*0.00629514)*([xi]-0.14324)" + ) +) + +profile_2016_postTS2 = _base_2016.clone( + L_int = 5.007365807, + ctppsLHCInfo = _base_2016.ctppsLHCInfo.clone( + xangleBetaStarHistogramObject = "2016_postTS2/h2_betaStar_vs_xangle" + ), + ctppsOpticalFunctions = _base_2016.ctppsOpticalFunctions.clone( + opticalFunctions = optics_2016_postTS2.opticalFunctions, + scoringPlanes = optics_2016_postTS2.scoringPlanes, + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2016.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/2016_postTS2.xml"], + RealFiles = ["Validation/CTPPS/alignment/2016_postTS2.xml"] + ), + # direct simu data + ctppsDirectSimuData = _base_2016.ctppsDirectSimuData.clone( + empiricalAperture45 = "6.10374E-05+(([xi]<0.113491)*0.00795942+([xi]>=0.113491)*0.01935)*([xi]-0.113491)", + empiricalAperture56 = "([xi]-0.110)/130.0" + ) +) diff --git a/SimPPS/DirectSimProducer/python/profiles_2017_cff.py b/SimPPS/DirectSimProducer/python/profiles_2017_cff.py new file mode 100644 index 0000000000000..8a061e8b9f1d4 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/profiles_2017_cff.py @@ -0,0 +1,48 @@ +import FWCore.ParameterSet.Config as cms +from SimPPS.DirectSimProducer.profile_base_cff import profile_base as _base +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2017 as _optics + +# base profile settings for 2017 +_base_2017 = _base.clone( + ctppsLHCInfo = _base.ctppsLHCInfo.clone( + beamEnergy = 6500. + ), + ctppsOpticalFunctions = _base.ctppsOpticalFunctions.clone( + opticalFunctions = _optics.opticalFunctions, + scoringPlanes = _optics.scoringPlanes, + ) +) + +profile_2017_preTS2 = _base_2017.clone( + L_int = 15.012899190, + ctppsLHCInfo = _base_2017.ctppsLHCInfo.clone( + xangleBetaStarHistogramObject = "2017_preTS2/h2_betaStar_vs_xangle" + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2017.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/2017_preTS2.xml"], + RealFiles = ["Validation/CTPPS/alignment/2017_preTS2.xml"] + ), + ctppsDirectSimuData = _base_2017.ctppsDirectSimuData.clone( + empiricalAperture45 = "-(8.71198E-07*[xangle]-0.000134726)+(([xi]<(0.000264704*[xangle]+0.081951))*-(4.32065E-05*[xangle]-0.0130746)+([xi]>=(0.000264704*[xangle]+0.081951))*-(0.000183472*[xangle]-0.0395241))*([xi]-(0.000264704*[xangle]+0.081951))", + empiricalAperture56 = "3.43116E-05+(([xi]<(0.000626936*[xangle]+0.061324))*0.00654394+([xi]>=(0.000626936*[xangle]+0.061324))*-(0.000145164*[xangle]-0.0272919))*([xi]-(0.000626936*[xangle]+0.061324))", + timeResolutionDiamonds45 = "2*(-0.10784+0.105194*x-0.0182611*x^2+0.00134731*x^3-3.58212E-05*x^4)", + timeResolutionDiamonds56 = "2*(0.00735552+0.0272707*x-0.00247151*x^2+8.62788E-05*x^3-7.99605E-07*x^4)" + ) +) + +profile_2017_postTS2 = _base_2017.clone( + L_int = 22.179613387, + ctppsLHCInfo = _base_2017.ctppsLHCInfo.clone( + xangleBetaStarHistogramObject = "2017_postTS2/h2_betaStar_vs_xangle" + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2017.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/2017_postTS2.xml"], + RealFiles = ["Validation/CTPPS/alignment/2017_postTS2.xml"] + ), + ctppsDirectSimuData = _base_2017.ctppsDirectSimuData.clone( + empiricalAperture45 = "-(8.92079E-07*[xangle]-0.000150214)+(([xi]<(0.000278622*[xangle]+0.0964383))*-(3.9541e-05*[xangle]-0.0115104)+([xi]>=(0.000278622*[xangle]+0.0964383))*-(0.000108249*[xangle]-0.0249303))*([xi]-(0.000278622*[xangle]+0.0964383))", + empiricalAperture56 = "4.56961E-05+(([xi]<(0.00075625*[xangle]+0.0643361))*-(3.01107e-05*[xangle]-0.00985126)+([xi]>=(0.00075625*[xangle]+0.0643361))*-(8.95437e-05*[xangle]-0.0169474))*([xi]-(0.00075625*[xangle]+0.0643361))", + timeResolutionDiamonds45 = "2*(0.0152613+0.0498784*x-0.00824168*x^2+0.000599844*x^3-1.5923E-05*x^4)", + timeResolutionDiamonds56 = "2*(-0.00458856+0.0522619*x-0.00806666*x^2+0.000558331*x^3-1.42165E-05*x^4)" + ) +) diff --git a/SimPPS/DirectSimProducer/python/profiles_2018_cff.py b/SimPPS/DirectSimProducer/python/profiles_2018_cff.py new file mode 100644 index 0000000000000..76cf74773dae6 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/profiles_2018_cff.py @@ -0,0 +1,64 @@ +import FWCore.ParameterSet.Config as cms +from SimPPS.DirectSimProducer.profile_base_cff import profile_base as _base +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2018 as _optics + +# base profile settings for 2018 +_base_2018 = _base.clone( + ctppsLHCInfo = _base.ctppsLHCInfo.clone( + beamEnergy = 6500. + ), + ctppsOpticalFunctions = _base.ctppsOpticalFunctions.clone( + opticalFunctions = _optics.opticalFunctions, + scoringPlanes = _optics.scoringPlanes, + ), + ctppsDirectSimuData = _base.ctppsDirectSimuData.clone( + empiricalAperture45 = "-(8.44219E-07*[xangle]-0.000100957)+(([xi]<(0.000247185*[xangle]+0.101599))*-(1.40289E-05*[xangle]-0.00727237)+([xi]> = (0.000247185*[xangle]+0.101599))*-(0.000107811*[xangle]-0.0261867))*([xi]-(0.000247185*[xangle]+0.101599))", + empiricalAperture56 = "-(-4.74758E-07*[xangle]+3.0881E-05)+(([xi]<(0.000727859*[xangle]+0.0722653))*-(2.43968E-05*[xangle]-0.0085461)+([xi]> = (0.000727859*[xangle]+0.0722653))*-(7.19216E-05*[xangle]-0.0148267))*([xi]-(0.000727859*[xangle]+0.0722653))" + ) +) + +profile_2018_preTS1 = _base_2018.clone( + L_int = 18.488297964, + ctppsLHCInfo = _base_2018.ctppsLHCInfo.clone( + xangleBetaStarHistogramObject = "2018_preTS1/h2_betaStar_vs_xangle" + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2018.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/2018_preTS1.xml"], + RealFiles = ["Validation/CTPPS/alignment/2018_preTS1.xml"] + ), + ctppsDirectSimuData = _base_2018.ctppsDirectSimuData.clone( + # timing not available in this period + timeResolutionDiamonds45 = "0.200", + timeResolutionDiamonds56 = "0.200" + ) +) + +profile_2018_TS1_TS2 = _base_2018.clone( + L_int = 26.812002394, + ctppsLHCInfo = _base_2018.ctppsLHCInfo.clone( + xangleBetaStarHistogramObject = "2018_TS1_TS2/h2_betaStar_vs_xangle" + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2018.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/2018_TS1_TS2.xml"], + RealFiles = ["Validation/CTPPS/alignment/2018_TS1_TS2.xml"] + ), + ctppsDirectSimuData = _base_2018.ctppsDirectSimuData.clone( + timeResolutionDiamonds45 = "2*((x<16)*(-0.171784+0.175856*x-0.0322344*x^2+0.00231489*x^3-5.7575E-05*x^4)+(x>=16)*0.105)", + timeResolutionDiamonds56 = "2*((x<16)*(-0.014943+0.102806*x-0.0209404*x^2+0.00158264*x^3-4.08241E-05*x^4)+(x>=16)*0.089)" + ) +) + +profile_2018_postTS2 = _base_2018.clone( + L_int = 10.415769561, + ctppsLHCInfo = _base_2018.ctppsLHCInfo.clone( + xangleBetaStarHistogramObject = "2018_postTS2/h2_betaStar_vs_xangle" + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2018.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/2018_postTS2.xml"], + RealFiles = ["Validation/CTPPS/alignment/2018_postTS2.xml"] + ), + ctppsDirectSimuData = _base_2018.ctppsDirectSimuData.clone( + timeResolutionDiamonds45 = "2*((x<16)*(-0.381504+0.255095*x-0.0415622*x^2+0.00275877*x^3-6.47115E-05*x^4)+(x>=16)*0.118)", + timeResolutionDiamonds56 = "2*((x<16)*(-0.279298+0.219838*x-0.0384257*x^2+0.00268906*x^3-6.60572E-05*x^4)+(x>=16)*0.099)", + ) +) diff --git a/SimPPS/DirectSimProducer/python/profiles_2022_cff.py b/SimPPS/DirectSimProducer/python/profiles_2022_cff.py new file mode 100644 index 0000000000000..05bbefd0d9587 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/profiles_2022_cff.py @@ -0,0 +1,31 @@ +import FWCore.ParameterSet.Config as cms +from SimPPS.DirectSimProducer.profile_base_cff import profile_base as _base +from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2021 as _optics + +# base profile settings for 2022 +_base_2022 = _base.clone( + ctppsOpticalFunctions = _base.ctppsOpticalFunctions.clone( + opticalFunctions = _optics.opticalFunctions, + scoringPlanes = _optics.scoringPlanes, + ), + ctppsDirectSimuData = _base.ctppsDirectSimuData.clone( + empiricalAperture45 = "1.e3*([xi] - 0.20)", + empiricalAperture56 = "1.e3*([xi] - 0.20)" + ) +) + +profile_2022_default = _base_2022.clone( + L_int = 1., + ctppsLHCInfo = _base_2022.ctppsLHCInfo.clone( + # NB: until a dedicated 2022 distributions are issued, it is OK to use 2021 ones here + xangleBetaStarHistogramObject = "2021/h2_betaStar_vs_xangle" + ), + ctppsRPAlignmentCorrectionsDataXML = _base_2022.ctppsRPAlignmentCorrectionsDataXML.clone( + MisalignedFiles = ["Validation/CTPPS/alignment/alignment_2022.xml"], + RealFiles = ["Validation/CTPPS/alignment/alignment_2022.xml"] + ), + ctppsDirectSimuData = _base_2022.ctppsDirectSimuData.clone( + timeResolutionDiamonds45 = "0.200", + timeResolutionDiamonds56 = "0.200" + ) +) diff --git a/SimPPS/DirectSimProducer/python/simPPS2016_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2016_cfi.py new file mode 100644 index 0000000000000..b6b5467b51308 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/simPPS2016_cfi.py @@ -0,0 +1,26 @@ +import FWCore.ParameterSet.Config as cms +from CalibPPS.ESProducers.ctppsCompositeESSource_cfi import ctppsCompositeESSource as _esComp +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2016 +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import ppsAssociationCutsESSource as _esAssCuts +from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry +from SimPPS.DirectSimProducer.profiles_2016_cff import profile_2016_preTS2, profile_2016_postTS2 + +ppsAssociationCutsESSource = _esAssCuts.clone() +use_single_infinite_iov_entry(ppsAssociationCutsESSource, p2016) +# geometry (using 2017 here is OK) +XMLIdealGeometryESSource_CTPPS, ctppsGeometryESModule = cloneGeometry('Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi') + +ctppsCompositeESSource = _esComp.clone( + generateEveryNEvents = 100, + periods = [profile_2016_preTS2, profile_2016_postTS2], + compactViewTag = ctppsGeometryESModule.compactViewTag, + isRun2 = ctppsGeometryESModule.isRun2 +) + +# RP ids +rpIds = cms.PSet( + rp_45_F = cms.uint32(3), + rp_45_N = cms.uint32(2), + rp_56_N = cms.uint32(102), + rp_56_F = cms.uint32(103) +) diff --git a/SimPPS/DirectSimProducer/python/simPPS2017_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2017_cfi.py new file mode 100644 index 0000000000000..15d76e88e38ae --- /dev/null +++ b/SimPPS/DirectSimProducer/python/simPPS2017_cfi.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms +from CalibPPS.ESProducers.ctppsCompositeESSource_cfi import ctppsCompositeESSource as _esComp +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2017 +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import ppsAssociationCutsESSource as _esAssCuts +from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry +from SimPPS.DirectSimProducer.profiles_2017_cff import profile_2017_preTS2, profile_2017_postTS2 + +ppsAssociationCutsESSource = _esAssCuts.clone() +use_single_infinite_iov_entry(ppsAssociationCutsESSource, p2017) +XMLIdealGeometryESSource_CTPPS, ctppsGeometryESModule = cloneGeometry('Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi') + +ctppsCompositeESSource = _esComp.clone( + generateEveryNEvents = 100, + periods = [profile_2017_preTS2, profile_2017_postTS2], + compactViewTag = ctppsGeometryESModule.compactViewTag, + isRun2 = ctppsGeometryESModule.isRun2 +) + +# RP ids +rpIds = cms.PSet( + rp_45_F = cms.uint32(23), + rp_45_N = cms.uint32(3), + rp_56_N = cms.uint32(103), + rp_56_F = cms.uint32(123) +) diff --git a/SimPPS/DirectSimProducer/python/simPPS2018_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2018_cfi.py new file mode 100644 index 0000000000000..19a2a31d6ee41 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/simPPS2018_cfi.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms +from CalibPPS.ESProducers.ctppsCompositeESSource_cfi import ctppsCompositeESSource as _esComp +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2018 +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import ppsAssociationCutsESSource as _esAssCuts +from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry +from SimPPS.DirectSimProducer.profiles_2018_cff import profile_2018_preTS1, profile_2018_TS1_TS2, profile_2018_postTS2 + +ppsAssociationCutsESSource = _esAssCuts.clone() +use_single_infinite_iov_entry(ppsAssociationCutsESSource, p2018) +XMLIdealGeometryESSource_CTPPS, ctppsGeometryESModule = cloneGeometry('Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi') + +ctppsCompositeESSource = _esComp.clone( + generateEveryNEvents = 100, + periods = [profile_2018_preTS1, profile_2018_TS1_TS2, profile_2018_postTS2], + compactViewTag = ctppsGeometryESModule.compactViewTag, + isRun2 = ctppsGeometryESModule.isRun2 +) + +# RP ids +rpIds = cms.PSet( + rp_45_F = cms.uint32(23), + rp_45_N = cms.uint32(3), + rp_56_N = cms.uint32(103), + rp_56_F = cms.uint32(123) +) diff --git a/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py new file mode 100644 index 0000000000000..454d2be14600a --- /dev/null +++ b/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py @@ -0,0 +1,29 @@ +import FWCore.ParameterSet.Config as cms +from CalibPPS.ESProducers.ctppsCompositeESSource_cfi import ctppsCompositeESSource as _esComp +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import use_single_infinite_iov_entry, p2022 +from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import ppsAssociationCutsESSource as _esAssCuts +from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry +from SimPPS.DirectSimProducer.profiles_2022_cff import profile_2022_default + +ppsAssociationCutsESSource = _esAssCuts.clone() +use_single_infinite_iov_entry(ppsAssociationCutsESSource, p2022) +XMLIdealGeometryESSource_CTPPS, _ctppsGeometryESModule = cloneGeometry('Geometry.VeryForwardGeometry.geometryRPFromDD_2022_cfi') +# not cloning the ctppsGeometryESModule, as it is replaced by the composite ES source + +ctppsCompositeESSource = _esComp.clone( + generateEveryNEvents = 100, + periods = [profile_2022_default], + # geometry (using 2017 here is OK) + compactViewTag = _ctppsGeometryESModule.compactViewTag, + isRun2 = _ctppsGeometryESModule.isRun2 +) + +# RP ids +rpIds = cms.PSet( + rp_45_F = cms.uint32(23), + rp_45_N = cms.uint32(3), + rp_56_N = cms.uint32(103), + rp_56_F = cms.uint32(123) +) + +#generator.energy = profile_2022_default.ctppsLHCInfo.beamEnergy diff --git a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py index e8d91203eb390..3b32c678ad8d7 100644 --- a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py +++ b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_ctpps_cff import ctpps -process = cms.Process('PPS', ctpps) +from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +process = cms.Process('PPS', ctpps_2016) process.load('Configuration.StandardSequences.Services_cff') process.load('Configuration.EventContent.EventContent_cff') @@ -15,6 +15,10 @@ process.MessageLogger.cerr.threshold = cms.untracked.string('') process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(100) +# global tag +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '106X_mcRun2_asymptotic_v17', '') + # raw data source process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( @@ -35,8 +39,8 @@ process.load('RecoPPS.Configuration.recoCTPPS_cff') process.p = cms.Path( - process.ppsDirectSim * - process.recoCTPPS + process.ppsDirectSim + * process.ctppsProtons ) # output configuration diff --git a/Validation/CTPPS/python/base_cff.py b/Validation/CTPPS/python/base_cff.py new file mode 100644 index 0000000000000..f9349c05440b9 --- /dev/null +++ b/Validation/CTPPS/python/base_cff.py @@ -0,0 +1,54 @@ +#---------------------------------------------------------------------------------------------------- +# utility functions + +def SetSmearingLevel1(obj): + obj.vtxStddevX = 0E-4 + obj.vtxStddevZ = 0 + + obj.beamDivX45 = 0E-6 + obj.beamDivX56 = 0E-6 + obj.beamDivY45 = 0E-6 + obj.beamDivY56 = 0E-6 + +def SetLevel1(process): + SetSmearingLevel1(process.ctppsBeamParametersFromLHCInfoESSource) + + process.ppsDirectProtonSimulation.roundToPitch = False + +def SetSmearingLevel2(obj): + obj.beamDivX45 = 0E-6 + obj.beamDivX56 = 0E-6 + obj.beamDivY45 = 0E-6 + obj.beamDivY56 = 0E-6 + +def SetLevel2(process): + SetSmearingLevel2(process.ctppsBeamParametersFromLHCInfoESSource) + + process.ppsDirectProtonSimulation.roundToPitch = False + +def SetLevel3(process): + process.ppsDirectProtonSimulation.roundToPitch = False + +def SetLevel4(process): + pass + +def SetLowTheta(process): + process.generator.theta_x_sigma = 0E-6 + process.generator.theta_y_sigma = 0E-6 + +def SetLargeTheta(process): + pass + +def UseConstantXangleBetaStar(process, xangle, betaStar): + for p in ctppsCompositeESSource.periods: + p.ctppsLHCInfo.xangle = xangle + p.ctppsLHCInfo.betaStar = betaStar + +def UseXangleBetaStarHistogram(process, f="", obj=""): + for p in ctppsCompositeESSource.periods: + p.ctppsLHCInfo.xangle = -1 # negative value indicates to use the xangle/beta* histogram + + if f: + p.ctppsLHCInfo.xangleBetaStarHistogramFile = f + if obj: + p.ctppsLHCInfo.xangleBetaStarHistogramObject = obj diff --git a/Validation/CTPPS/python/simu_config/base_cff.py b/Validation/CTPPS/python/simu_config/base_cff.py deleted file mode 100644 index f3ae25ba7903f..0000000000000 --- a/Validation/CTPPS/python/simu_config/base_cff.py +++ /dev/null @@ -1,181 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# load standard files (on top so as settings can be overwritten below) -from RecoPPS.ProtonReconstruction.ctppsProtons_cff import * - -# configuration for composite source of alignment, optics, ... -from CalibPPS.ESProducers.ctppsCompositeESSource_cfi import * -ctppsCompositeESSource.generateEveryNEvents = 100 - -profile_base = cms.PSet( - L_int = cms.double(1), - - # LHCInfo - ctppsLHCInfo = cms.PSet( - xangle = cms.double(-1), - betaStar = cms.double(-1), - beamEnergy = cms.double(0), - xangleBetaStarHistogramFile = cms.string("CalibPPS/ESProducers/data/xangle_beta_distributions/version1.root"), - xangleBetaStarHistogramObject = cms.string("") - ), - - # optics - ctppsOpticalFunctions = cms.PSet( - opticalFunctions = cms.VPSet(), - scoringPlanes = cms.VPSet() - ), - - # alignment - ctppsRPAlignmentCorrectionsDataXML = cms.PSet( - MeasuredFiles = cms.vstring(), - RealFiles = cms.vstring(), - MisalignedFiles = cms.vstring() - ), - - # direct simu data - ctppsDirectSimuData = cms.PSet( - empiricalAperture45 = cms.string(""), - empiricalAperture56 = cms.string(""), - - timeResolutionDiamonds45 = cms.string("999"), - timeResolutionDiamonds56 = cms.string("999"), - - efficienciesPerRP = cms.VPSet(), - efficienciesPerPlane = cms.VPSet() - ) -) - -# beam parameters as determined by PPS -ctppsBeamParametersFromLHCInfoESSource = cms.ESProducer("CTPPSBeamParametersFromLHCInfoESSource", - lhcInfoLabel = cms.string(""), - - # beam divergence (rad) - beamDivX45 = cms.double(30E-6), - beamDivX56 = cms.double(30E-6), - beamDivY45 = cms.double(30E-6), - beamDivY56 = cms.double(30E-6), - - # vertex offset (cm) - vtxOffsetX45 = cms.double(0.), - vtxOffsetX56 = cms.double(0.), - vtxOffsetY45 = cms.double(0.), - vtxOffsetY56 = cms.double(0.), - vtxOffsetZ45 = cms.double(0.), - vtxOffsetZ56 = cms.double(0.), - - # vertex sigma (cm) - vtxStddevX = cms.double(10E-4), - vtxStddevY = cms.double(10E-4), - vtxStddevZ = cms.double(5) -) - -# particle-data table -from SimGeneral.HepPDTESSource.pythiapdt_cfi import * - -# random seeds -RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", - sourceSeed = cms.PSet(initialSeed = cms.untracked.uint32(98765)), - generator = cms.PSet(initialSeed = cms.untracked.uint32(98766)), - beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)), - ctppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) -) - -# default source -source = cms.Source("EmptySource", - firstRun = cms.untracked.uint32(1), - numberEventsInLuminosityBlock = ctppsCompositeESSource.generateEveryNEvents -) - -# particle generator -from Configuration.Generator.randomXiThetaGunProducer_cfi import * -generator.xi_max = 0.25 -generator.theta_x_sigma = 60E-6 -generator.theta_y_sigma = 60E-6 - -# beam smearing -from IOMC.EventVertexGenerators.beamDivergenceVtxGenerator_cfi import * - -# direct simulation -from Validation.CTPPS.ctppsDirectProtonSimulation_cfi import * -ctppsDirectProtonSimulation.verbosity = 0 -ctppsDirectProtonSimulation.hepMCTag = cms.InputTag('beamDivergenceVtxGenerator') -ctppsDirectProtonSimulation.roundToPitch = True -ctppsDirectProtonSimulation.pitchStrips = 66E-3 * 12 / 19 # effective value to reproduce real RP resolution -ctppsDirectProtonSimulation.pitchPixelsHor = 50E-3 -ctppsDirectProtonSimulation.pitchPixelsVer = 80E-3 -ctppsDirectProtonSimulation.useEmpiricalApertures = True -ctppsDirectProtonSimulation.produceHitsRelativeToBeam = True -ctppsDirectProtonSimulation.produceScoringPlaneHits = False -ctppsDirectProtonSimulation.produceRecHits = True - -# local reconstruction -from CalibPPS.ESProducers.ppsTopology_cff import * - -from RecoPPS.Local.totemRPLocalReconstruction_cff import * -from RecoPPS.Local.ctppsPixelLocalReconstruction_cff import * -from RecoPPS.Local.ctppsDiamondLocalReconstruction_cff import * -from RecoPPS.Local.ctppsLocalTrackLiteProducer_cff import * - -totemRPUVPatternFinder.tagRecHit = cms.InputTag('ctppsDirectProtonSimulation') -ctppsPixelLocalTracks.tag = cms.InputTag('ctppsDirectProtonSimulation') -ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ctppsDirectProtonSimulation') - -ctppsLocalTrackLiteProducer.includeDiamonds = False - -# proton reconstruction -ctppsProtons.tagLocalTrackLite = cms.InputTag('ctppsLocalTrackLiteProducer') - -#---------------------------------------------------------------------------------------------------- -# utility functions - -def SetSmearingLevel1(obj): - obj.vtxStddevX = 0E-4 - obj.vtxStddevZ = 0 - - obj.beamDivX45 = 0E-6 - obj.beamDivX56 = 0E-6 - obj.beamDivY45 = 0E-6 - obj.beamDivY56 = 0E-6 - -def SetLevel1(process): - SetSmearingLevel1(process.ctppsBeamParametersFromLHCInfoESSource) - - process.ctppsDirectProtonSimulation.roundToPitch = False - -def SetSmearingLevel2(obj): - obj.beamDivX45 = 0E-6 - obj.beamDivX56 = 0E-6 - obj.beamDivY45 = 0E-6 - obj.beamDivY56 = 0E-6 - -def SetLevel2(process): - SetSmearingLevel2(process.ctppsBeamParametersFromLHCInfoESSource) - - process.ctppsDirectProtonSimulation.roundToPitch = False - -def SetLevel3(process): - process.ctppsDirectProtonSimulation.roundToPitch = False - -def SetLevel4(process): - pass - -def SetLowTheta(process): - process.generator.theta_x_sigma = 0E-6 - process.generator.theta_y_sigma = 0E-6 - -def SetLargeTheta(process): - pass - -def UseConstantXangleBetaStar(process, xangle, betaStar): - for p in ctppsCompositeESSource.periods: - p.ctppsLHCInfo.xangle = xangle - p.ctppsLHCInfo.betaStar = betaStar - -def UseXangleBetaStarHistogram(process, f="", obj=""): - for p in ctppsCompositeESSource.periods: - p.ctppsLHCInfo.xangle = -1 # negative value indicates to use the xangle/beta* histogram - - if f: - p.ctppsLHCInfo.xangleBetaStarHistogramFile = f - if obj: - p.ctppsLHCInfo.xangleBetaStarHistogramObject = obj diff --git a/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py deleted file mode 100644 index 82235542eb261..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2016_postTS2_cff.py +++ /dev/null @@ -1,31 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2016_cff import * - -from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2016_postTS2 as selected_optics - -alignmentFile = "Validation/CTPPS/alignment/2016_postTS2.xml" - -profile_2016_postTS2 = profile_base_2016.clone( - L_int = 5.007365807, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = cms.string("2016_postTS2/h2_betaStar_vs_xangle") - ), - - ctppsOpticalFunctions = dict( - opticalFunctions = selected_optics.opticalFunctions, - scoringPlanes = selected_optics.scoringPlanes, - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - # direct simu data - ctppsDirectSimuData = dict( - empiricalAperture45 = cms.string("6.10374E-05+(([xi]<0.113491)*0.00795942+([xi]>=0.113491)*0.01935)*([xi]-0.113491)"), - empiricalAperture56 = cms.string("([xi]-0.110)/130.0") - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py deleted file mode 100644 index faaf385087753..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2016_preTS2_cff.py +++ /dev/null @@ -1,30 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2016_cff import * - -from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2016_preTS2 as selected_optics - -alignmentFile = "Validation/CTPPS/alignment/2016_preTS2.xml" - -profile_2016_preTS2 = profile_base_2016.clone( - L_int = 6.138092276 + 3.654039035, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = cms.string("2016_preTS2/h2_betaStar_vs_xangle") - ), - - ctppsOpticalFunctions = dict( - opticalFunctions = selected_optics.opticalFunctions, - scoringPlanes = selected_optics.scoringPlanes, - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - empiricalAperture45 = cms.string("3.76296E-05+(([xi]<0.117122)*0.00712775+([xi]>=0.117122)*0.0148651)*([xi]-0.117122)"), - empiricalAperture56 = cms.string("1.85954E-05+(([xi]<0.14324)*0.00475349+([xi]>=0.14324)*0.00629514)*([xi]-0.14324)") - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2017_postTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2017_postTS2_cff.py deleted file mode 100644 index c3565b0490cf0..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2017_postTS2_cff.py +++ /dev/null @@ -1,26 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2017_cff import * - -alignmentFile = "Validation/CTPPS/alignment/2017_postTS2.xml" - -profile_2017_postTS2 = profile_base_2017.clone( - L_int = 22.179613387, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = "2017_postTS2/h2_betaStar_vs_xangle" - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - empiricalAperture45 = "-(8.92079E-07*[xangle]-0.000150214)+(([xi]<(0.000278622*[xangle]+0.0964383))*-(3.9541e-05*[xangle]-0.0115104)+([xi]>=(0.000278622*[xangle]+0.0964383))*-(0.000108249*[xangle]-0.0249303))*([xi]-(0.000278622*[xangle]+0.0964383))", - empiricalAperture56 = "4.56961E-05+(([xi]<(0.00075625*[xangle]+0.0643361))*-(3.01107e-05*[xangle]-0.00985126)+([xi]>=(0.00075625*[xangle]+0.0643361))*-(8.95437e-05*[xangle]-0.0169474))*([xi]-(0.00075625*[xangle]+0.0643361))", - - timeResolutionDiamonds45 = "2*(0.0152613+0.0498784*x-0.00824168*x^2+0.000599844*x^3-1.5923E-05*x^4)", - timeResolutionDiamonds56 = "2*(-0.00458856+0.0522619*x-0.00806666*x^2+0.000558331*x^3-1.42165E-05*x^4)" - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2017_preTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2017_preTS2_cff.py deleted file mode 100644 index 92d59fd66fc9e..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2017_preTS2_cff.py +++ /dev/null @@ -1,26 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2017_cff import * - -alignmentFile = "Validation/CTPPS/alignment/2017_preTS2.xml" - -profile_2017_preTS2 = profile_base_2017.clone( - L_int = 15.012899190, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = "2017_preTS2/h2_betaStar_vs_xangle" - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - empiricalAperture45 = "-(8.71198E-07*[xangle]-0.000134726)+(([xi]<(0.000264704*[xangle]+0.081951))*-(4.32065E-05*[xangle]-0.0130746)+([xi]>=(0.000264704*[xangle]+0.081951))*-(0.000183472*[xangle]-0.0395241))*([xi]-(0.000264704*[xangle]+0.081951))", - empiricalAperture56 = "3.43116E-05+(([xi]<(0.000626936*[xangle]+0.061324))*0.00654394+([xi]>=(0.000626936*[xangle]+0.061324))*-(0.000145164*[xangle]-0.0272919))*([xi]-(0.000626936*[xangle]+0.061324))", - - timeResolutionDiamonds45 = "2*(-0.10784+0.105194*x-0.0182611*x^2+0.00134731*x^3-3.58212E-05*x^4)", - timeResolutionDiamonds56 = "2*(0.00735552+0.0272707*x-0.00247151*x^2+8.62788E-05*x^3-7.99605E-07*x^4)" - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2018_TS1_TS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2018_TS1_TS2_cff.py deleted file mode 100644 index ad646db62d8b4..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2018_TS1_TS2_cff.py +++ /dev/null @@ -1,23 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2018_cff import * - -alignmentFile = "Validation/CTPPS/alignment/2018_TS1_TS2.xml" - -profile_2018_TS1_TS2 = profile_base_2018.clone( - L_int = 26.812002394, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = "2018_TS1_TS2/h2_betaStar_vs_xangle" - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - timeResolutionDiamonds45 = "2*((x<16)*(-0.171784+0.175856*x-0.0322344*x^2+0.00231489*x^3-5.7575E-05*x^4)+(x>=16)*0.105)", - timeResolutionDiamonds56 = "2*((x<16)*(-0.014943+0.102806*x-0.0209404*x^2+0.00158264*x^3-4.08241E-05*x^4)+(x>=16)*0.089)" - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2018_postTS2_cff.py b/Validation/CTPPS/python/simu_config/profile_2018_postTS2_cff.py deleted file mode 100644 index 0360db04a32f1..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2018_postTS2_cff.py +++ /dev/null @@ -1,23 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2018_cff import * - -alignmentFile = "Validation/CTPPS/alignment/2018_postTS2.xml" - -profile_2018_postTS2 = profile_base_2018.clone( - L_int = 10.415769561, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = "2018_postTS2/h2_betaStar_vs_xangle" - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - timeResolutionDiamonds45 = "2*((x<16)*(-0.381504+0.255095*x-0.0415622*x^2+0.00275877*x^3-6.47115E-05*x^4)+(x>=16)*0.118)", - timeResolutionDiamonds56 = "2*((x<16)*(-0.279298+0.219838*x-0.0384257*x^2+0.00268906*x^3-6.60572E-05*x^4)+(x>=16)*0.099)", - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2018_preTS1_cff.py b/Validation/CTPPS/python/simu_config/profile_2018_preTS1_cff.py deleted file mode 100644 index ffaffb5f830c6..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2018_preTS1_cff.py +++ /dev/null @@ -1,24 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2018_cff import * - -alignmentFile = "Validation/CTPPS/alignment/2018_preTS1.xml" - -profile_2018_preTS1 = profile_base_2018.clone( - L_int = 18.488297964, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = "2018_preTS1/h2_betaStar_vs_xangle" - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - # timing not available in this period - timeResolutionDiamonds45 = "0.200", - timeResolutionDiamonds56 = "0.200" - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2021_default_cff.py b/Validation/CTPPS/python/simu_config/profile_2021_default_cff.py deleted file mode 100644 index 6273e2abda4d8..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2021_default_cff.py +++ /dev/null @@ -1,23 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2021_cff import * - -alignmentFile = "Validation/CTPPS/alignment/2021.xml" - -profile_2021_default = profile_base_2021.clone( - L_int = 1, - - ctppsLHCInfo = dict( - xangleBetaStarHistogramObject = "2021/h2_betaStar_vs_xangle" - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - timeResolutionDiamonds45 = "0.200", - timeResolutionDiamonds56 = "0.200" - ) -) diff --git a/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py b/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py deleted file mode 100644 index 18aa8d5171815..0000000000000 --- a/Validation/CTPPS/python/simu_config/profile_2022_default_cff.py +++ /dev/null @@ -1,24 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.year_2022_cff import * - -alignmentFile = "Validation/CTPPS/alignment/alignment_2022.xml" - -profile_2022_default = profile_base_2022.clone( - L_int = 1, - - ctppsLHCInfo = dict( - # NB: until a dedicated 2022 distributions are issued, it is OK to use 2021 ones here - xangleBetaStarHistogramObject = "2021/h2_betaStar_vs_xangle" - ), - - ctppsRPAlignmentCorrectionsDataXML = dict( - MisalignedFiles = [alignmentFile], - RealFiles = [alignmentFile] - ), - - ctppsDirectSimuData = dict( - timeResolutionDiamonds45 = "0.200", - timeResolutionDiamonds56 = "0.200" - ) -) diff --git a/Validation/CTPPS/python/simu_config/year_2016_cff.py b/Validation/CTPPS/python/simu_config/year_2016_cff.py deleted file mode 100644 index f78408778ddec..0000000000000 --- a/Validation/CTPPS/python/simu_config/year_2016_cff.py +++ /dev/null @@ -1,44 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.base_cff import * - -import CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff as ac -ac.use_single_infinite_iov_entry(ac.ppsAssociationCutsESSource, ac.p2016) -ppsAssociationCutsESSource = ac.ppsAssociationCutsESSource - -# base profile settings for 2016 -profile_base_2016 = profile_base.clone( - ctppsLHCInfo = dict( - beamEnergy = 6500 - ) -) - -# geometry (using 2017 here is OK) -from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry -XMLIdealGeometryESSource_CTPPS, _ctppsGeometryESModule = cloneGeometry('Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi') - -ctppsCompositeESSource.compactViewTag = _ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = _ctppsGeometryESModule.isRun2 - -# local reconstruction -ctppsLocalTrackLiteProducer.includeStrips = True -ctppsLocalTrackLiteProducer.includePixels = False - -reco_local = cms.Sequence( - totemRPUVPatternFinder - * totemRPLocalTrackFitter - * ctppsLocalTrackLiteProducer -) - -# RP ids -rpIds = cms.PSet( - rp_45_F = cms.uint32(3), - rp_45_N = cms.uint32(2), - rp_56_N = cms.uint32(102), - rp_56_F = cms.uint32(103) -) - -# default list of profiles -from Validation.CTPPS.simu_config.profile_2016_preTS2_cff import profile_2016_preTS2 -from Validation.CTPPS.simu_config.profile_2016_postTS2_cff import profile_2016_postTS2 -ctppsCompositeESSource.periods = [profile_2016_postTS2, profile_2016_preTS2] diff --git a/Validation/CTPPS/python/simu_config/year_2017_cff.py b/Validation/CTPPS/python/simu_config/year_2017_cff.py deleted file mode 100644 index 04283ea7fb137..0000000000000 --- a/Validation/CTPPS/python/simu_config/year_2017_cff.py +++ /dev/null @@ -1,53 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.base_cff import * - -import CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff as ac -ac.use_single_infinite_iov_entry(ac.ppsAssociationCutsESSource, ac.p2017) -ppsAssociationCutsESSource = ac.ppsAssociationCutsESSource - -from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2017 as selected_optics - -# base profile settings for 2017 -profile_base_2017 = profile_base.clone( - ctppsLHCInfo = dict( - beamEnergy = 6500 - ), - - ctppsOpticalFunctions = dict( - opticalFunctions = selected_optics.opticalFunctions, - scoringPlanes = selected_optics.scoringPlanes, - ) -) - -# geometry -from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry -XMLIdealGeometryESSource_CTPPS, _ctppsGeometryESModule = cloneGeometry('Geometry.VeryForwardGeometry.geometryRPFromDD_2017_cfi') -ctppsCompositeESSource.compactViewTag = _ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = _ctppsGeometryESModule.isRun2 - -# local reconstruction -ctppsLocalTrackLiteProducer.includeStrips = True -ctppsLocalTrackLiteProducer.includePixels = True -ctppsLocalTrackLiteProducer.includeDiamonds = True - -reco_local = cms.Sequence( - totemRPUVPatternFinder - * totemRPLocalTrackFitter - * ctppsPixelLocalTracks - * ctppsDiamondLocalReconstruction - * ctppsLocalTrackLiteProducer -) - -# RP ids -rpIds = cms.PSet( - rp_45_F = cms.uint32(23), - rp_45_N = cms.uint32(3), - rp_56_N = cms.uint32(103), - rp_56_F = cms.uint32(123) -) - -# default list of profiles -from Validation.CTPPS.simu_config.profile_2017_preTS2_cff import profile_2017_preTS2 -from Validation.CTPPS.simu_config.profile_2017_postTS2_cff import profile_2017_postTS2 -ctppsCompositeESSource.periods = [profile_2017_postTS2, profile_2017_preTS2] diff --git a/Validation/CTPPS/python/simu_config/year_2018_cff.py b/Validation/CTPPS/python/simu_config/year_2018_cff.py deleted file mode 100644 index b34cf9f7999e1..0000000000000 --- a/Validation/CTPPS/python/simu_config/year_2018_cff.py +++ /dev/null @@ -1,57 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.base_cff import * - -import CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff as ac -ac.use_single_infinite_iov_entry(ac.ppsAssociationCutsESSource, ac.p2018) -ppsAssociationCutsESSource = ac.ppsAssociationCutsESSource - -from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2018 as selected_optics - -# base profile settings for 2018 -profile_base_2018 = profile_base.clone( - ctppsLHCInfo = dict( - beamEnergy = 6500 - ), - - ctppsOpticalFunctions = dict( - opticalFunctions = selected_optics.opticalFunctions, - scoringPlanes = selected_optics.scoringPlanes, - ), - - ctppsDirectSimuData = dict( - empiricalAperture45 = cms.string("-(8.44219E-07*[xangle]-0.000100957)+(([xi]<(0.000247185*[xangle]+0.101599))*-(1.40289E-05*[xangle]-0.00727237)+([xi]> = (0.000247185*[xangle]+0.101599))*-(0.000107811*[xangle]-0.0261867))*([xi]-(0.000247185*[xangle]+0.101599))"), - empiricalAperture56 = cms.string("-(-4.74758E-07*[xangle]+3.0881E-05)+(([xi]<(0.000727859*[xangle]+0.0722653))*-(2.43968E-05*[xangle]-0.0085461)+([xi]> = (0.000727859*[xangle]+0.0722653))*-(7.19216E-05*[xangle]-0.0148267))*([xi]-(0.000727859*[xangle]+0.0722653))") - ) -) - -# geometry -from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry -XMLIdealGeometryESSource_CTPPS, _ctppsGeometryESModule = cloneGeometry('Geometry.VeryForwardGeometry.geometryRPFromDD_2018_cfi') -ctppsCompositeESSource.compactViewTag = _ctppsGeometryESModule.compactViewTag -ctppsCompositeESSource.isRun2 = _ctppsGeometryESModule.isRun2 - -# local reconstruction -ctppsLocalTrackLiteProducer.includeStrips = False -ctppsLocalTrackLiteProducer.includePixels = True -ctppsLocalTrackLiteProducer.includeDiamonds = True - -reco_local = cms.Sequence( - ctppsPixelLocalTracks - * ctppsDiamondLocalReconstruction - * ctppsLocalTrackLiteProducer -) - -# RP ids -rpIds = cms.PSet( - rp_45_F = cms.uint32(23), - rp_45_N = cms.uint32(3), - rp_56_N = cms.uint32(103), - rp_56_F = cms.uint32(123) -) - -# default list of profiles -from Validation.CTPPS.simu_config.profile_2018_preTS1_cff import profile_2018_preTS1 -from Validation.CTPPS.simu_config.profile_2018_postTS2_cff import profile_2018_postTS2 -from Validation.CTPPS.simu_config.profile_2018_TS1_TS2_cff import profile_2018_TS1_TS2 -ctppsCompositeESSource.periods = [profile_2018_postTS2, profile_2018_preTS1, profile_2018_TS1_TS2] diff --git a/Validation/CTPPS/python/simu_config/year_2021_cff.py b/Validation/CTPPS/python/simu_config/year_2021_cff.py deleted file mode 100644 index bb27220a5c5ed..0000000000000 --- a/Validation/CTPPS/python/simu_config/year_2021_cff.py +++ /dev/null @@ -1,57 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.base_cff import * - -import CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff as ac -ac.use_single_infinite_iov_entry(ac.ppsAssociationCutsESSource, ac.p2021) -ppsAssociationCutsESSource = ac.ppsAssociationCutsESSource - -from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2021 as selected_optics - -# base profile settings for 2021 -profile_base_2021 = profile_base.clone( - ctppsLHCInfo = dict( - beamEnergy = 7000 - ), - - ctppsOpticalFunctions = dict( - opticalFunctions = selected_optics.opticalFunctions, - scoringPlanes = selected_optics.scoringPlanes, - ), - - ctppsDirectSimuData = dict( - empiricalAperture45 = cms.string("1E3*([xi] - 0.20)"), - empiricalAperture56 = cms.string("1E3*([xi] - 0.20)") - ) -) - -# adjust basic settings -generator.energy = profile_base_2021.ctppsLHCInfo.beamEnergy - -# geometry -from Geometry.VeryForwardGeometry.geometryRPFromDD_2021_cfi import * -ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -del ctppsGeometryESModule # this functionality is replaced by the composite ES source - -# local reconstruction -ctppsLocalTrackLiteProducer.includeStrips = False -ctppsLocalTrackLiteProducer.includePixels = True -ctppsLocalTrackLiteProducer.includeDiamonds = True - -reco_local = cms.Sequence( - ctppsPixelLocalTracks - * ctppsDiamondLocalReconstruction - * ctppsLocalTrackLiteProducer -) - -# RP ids -rpIds = cms.PSet( - rp_45_F = cms.uint32(23), - rp_45_N = cms.uint32(3), - rp_56_N = cms.uint32(103), - rp_56_F = cms.uint32(123) -) - -# default list of profiles -from Validation.CTPPS.simu_config.profile_2021_default_cff import profile_2021_default -ctppsCompositeESSource.periods = [profile_2021_default] diff --git a/Validation/CTPPS/python/simu_config/year_2022_cff.py b/Validation/CTPPS/python/simu_config/year_2022_cff.py deleted file mode 100644 index 8d72c09294f82..0000000000000 --- a/Validation/CTPPS/python/simu_config/year_2022_cff.py +++ /dev/null @@ -1,56 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Validation.CTPPS.simu_config.base_cff import * - -import CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff as ac -ac.use_single_infinite_iov_entry(ac.ppsAssociationCutsESSource, ac.p2022) -ppsAssociationCutsESSource = ac.ppsAssociationCutsESSource - -from CalibPPS.ESProducers.ctppsOpticalFunctions_non_DB_cff import optics_2022 as selected_optics - -# base profile settings for 2022 -profile_base_2022 = profile_base.clone( - ctppsLHCInfo = dict( - beamEnergy = 7000 - ), - - ctppsOpticalFunctions = dict( - opticalFunctions = selected_optics.opticalFunctions, - scoringPlanes = selected_optics.scoringPlanes, - ), - - ctppsDirectSimuData = dict( - empiricalAperture45 = cms.string("1E3*([xi] - 0.20)"), - empiricalAperture56 = cms.string("1E3*([xi] - 0.20)") - ) -) - -# adjust basic settings -generator.energy = profile_base_2022.ctppsLHCInfo.beamEnergy - -from Geometry.VeryForwardGeometry.geometryRPFromDD_2022_cfi import * -ctppsCompositeESSource.compactViewTag = ctppsGeometryESModule.compactViewTag -del ctppsGeometryESModule # this functionality is replaced by the composite ES source - -# local reconstruction -ctppsLocalTrackLiteProducer.includeStrips = False -ctppsLocalTrackLiteProducer.includePixels = True -ctppsLocalTrackLiteProducer.includeDiamonds = True - -reco_local = cms.Sequence( - ctppsPixelLocalTracks - * ctppsDiamondLocalReconstruction - * ctppsLocalTrackLiteProducer -) - -# RP ids -rpIds = cms.PSet( - rp_45_F = cms.uint32(23), - rp_45_N = cms.uint32(3), - rp_56_N = cms.uint32(103), - rp_56_F = cms.uint32(123) -) - -# default list of profiles -from Validation.CTPPS.simu_config.profile_2022_default_cff import profile_2022_default -ctppsCompositeESSource.periods = [profile_2022_default] diff --git a/Validation/CTPPS/test/simu/template_cfg.py b/Validation/CTPPS/test/simu/template_cfg.py index 06a9943038ec3..fcee27a4b331c 100644 --- a/Validation/CTPPS/test/simu/template_cfg.py +++ b/Validation/CTPPS/test/simu/template_cfg.py @@ -3,10 +3,6 @@ from Configuration.Eras.Era_$ERA_cff import * process = cms.Process('CTPPSTest', $ERA) -# load config -import Validation.CTPPS.simu_config.year_$CONFIG_cff as config -process.load("Validation.CTPPS.simu_config.year_$CONFIG_cff") - process.load("CondCore.CondDB.CondDB_cfi") process.CondDB.connect = 'frontier://FrontierProd/CMS_CONDITIONS' process.PoolDBESSource = cms.ESSource("PoolDBESSource", @@ -19,16 +15,56 @@ # minimal logger settings process.MessageLogger = cms.Service("MessageLogger", - statistics = cms.untracked.vstring(), - destinations = cms.untracked.vstring('cout'), - cout = cms.untracked.PSet( - threshold = cms.untracked.string('WARNING') - ) + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cout'), + cout = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) +) + +# global tag +#process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +#from Configuration.AlCa.GlobalTag import GlobalTag +#process.GlobalTag = GlobalTag(process.GlobalTag, '120X_mcRun3_2021_realistic_v6', '') +#process.load('Geometry.VeryForwardGeometry.geometryRPFromDB_cfi') + +# load config +process.load('SimPPS.Configuration.ppsDirectSim_cff') +process.load('RecoPPS.Configuration.recoCTPPS_cff') +process.load('RecoPPS.ProtonReconstruction.ctppsProtons_cff') + +# default source +process.source = cms.Source("EmptySource", + firstRun = cms.untracked.uint32(1), + numberEventsInLuminosityBlock = process.ctppsCompositeESSource.generateEveryNEvents ) +# particle generator +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +from Configuration.Generator.randomXiThetaGunProducer_cfi import generator as _gen +process.generator = _gen.clone( + xi_max = 0.25, + theta_x_sigma = 60.e-6, + theta_y_sigma = 60.e-6 +) + +# beam smearing +process.load('IOMC.EventVertexGenerators.beamDivergenceVtxGenerator_cfi') + +# random seeds +process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", + sourceSeed = cms.PSet(initialSeed = cms.untracked.uint32(98765)), + generator = cms.PSet(initialSeed = cms.untracked.uint32(98766)), + beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)), + ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) +) + +from SimPPS.DirectSimProducer.profile_base_cff import matchDirectSimOutputs +matchDirectSimOutputs(process) + # number of events process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(int($N_EVENTS)) + input = cms.untracked.int32(int($N_EVENTS)) ) # LHCInfo plotter @@ -37,40 +73,40 @@ # track distribution plotter process.ctppsTrackDistributionPlotter = cms.EDAnalyzer("CTPPSTrackDistributionPlotter", - tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), + tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), - rpId_45_F = process.rpIds.rp_45_F, - rpId_45_N = process.rpIds.rp_45_N, - rpId_56_N = process.rpIds.rp_56_N, - rpId_56_F = process.rpIds.rp_56_F, + rpId_45_F = process.rpIds.rp_45_F, + rpId_45_N = process.rpIds.rp_45_N, + rpId_56_N = process.rpIds.rp_56_N, + rpId_56_F = process.rpIds.rp_56_F, - outputFile = cms.string("$OUT_TRACKS") + outputFile = cms.string("$OUT_TRACKS") ) # reconstruction plotter process.ctppsProtonReconstructionPlotter = cms.EDAnalyzer("CTPPSProtonReconstructionPlotter", - tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), - tagRecoProtonsSingleRP = cms.InputTag("ctppsProtons", "singleRP"), - tagRecoProtonsMultiRP = cms.InputTag("ctppsProtons", "multiRP"), + tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), + tagRecoProtonsSingleRP = cms.InputTag("ctppsProtons", "singleRP"), + tagRecoProtonsMultiRP = cms.InputTag("ctppsProtons", "multiRP"), - rpId_45_F = process.rpIds.rp_45_F, - rpId_45_N = process.rpIds.rp_45_N, - rpId_56_N = process.rpIds.rp_56_N, - rpId_56_F = process.rpIds.rp_56_F, + rpId_45_F = process.rpIds.rp_45_F, + rpId_45_N = process.rpIds.rp_45_N, + rpId_56_N = process.rpIds.rp_56_N, + rpId_56_F = process.rpIds.rp_56_F, - outputFile = cms.string("$OUT_PROTONS") + outputFile = cms.string("$OUT_PROTONS") ) # processing path process.p = cms.Path( - process.generator - * process.beamDivergenceVtxGenerator - * process.ctppsDirectProtonSimulation + process.generator + * process.beamDivergenceVtxGenerator + * process.ppsDirectProtonSimulation - * process.reco_local - * process.ctppsProtons + * process.recoCTPPS + * process.ctppsProtons - * process.ctppsLHCInfoPlotter - * process.ctppsTrackDistributionPlotter - * process.ctppsProtonReconstructionPlotter + * process.ctppsLHCInfoPlotter + * process.ctppsTrackDistributionPlotter + * process.ctppsProtonReconstructionPlotter ) From 2000e61eb5710b64ff64f991be63b688e0b8787f Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 17 Nov 2021 17:22:23 +0100 Subject: [PATCH 03/18] Safer cloning of geometry XML files list --- Geometry/VeryForwardGeometry/python/commons_cff.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Geometry/VeryForwardGeometry/python/commons_cff.py b/Geometry/VeryForwardGeometry/python/commons_cff.py index d4ae12c3e3886..74f85e83d5c43 100644 --- a/Geometry/VeryForwardGeometry/python/commons_cff.py +++ b/Geometry/VeryForwardGeometry/python/commons_cff.py @@ -6,10 +6,14 @@ def cloneGeometry(mod_path): # start by importing the actual module to be cloned _geom = import_module(mod_path) # clone all geometry DDL files - totemGeomXMLFiles = copy(_geom.totemGeomXMLFiles) - ctppsDiamondGeomXMLFiles = copy(_geom.ctppsDiamondGeomXMLFiles) - ctppsUFSDGeomXMLFiles = copy(_geom.ctppsUFSDGeomXMLFiles) - ctppsPixelGeomXMLFiles = copy(_geom.ctppsPixelGeomXMLFiles) + if hasattr(_geom, 'totemGeomXMLFiles'): + totemGeomXMLFiles = copy(_geom.totemGeomXMLFiles) + if hasattr(_geom, 'ctppsDiamondGeomXMLFiles'): + ctppsDiamondGeomXMLFiles = copy(_geom.ctppsDiamondGeomXMLFiles) + if hasattr(_geom, 'ctppsUFSDGeomXMLFiles'): + ctppsUFSDGeomXMLFiles = copy(_geom.ctppsUFSDGeomXMLFiles) + if hasattr(_geom, 'ctppsPixelGeomXMLFiles'): + ctppsPixelGeomXMLFiles = copy(_geom.ctppsPixelGeomXMLFiles) # clone the ESSource and ESModule to be returned XMLIdealGeometryESSource_CTPPS = _geom.XMLIdealGeometryESSource_CTPPS.clone() ctppsGeometryESModule = _geom.ctppsGeometryESModule.clone() From d71c9c6c692b613d37c1364dc5c1cf920689587f Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 17 Nov 2021 18:12:27 +0100 Subject: [PATCH 04/18] Still moving things a bit - replaced ctpps_2021 by a new ctpps_2022 era - modified arrangement of SIM-RECO sequences loading in validation template file --- Configuration/Eras/python/Era_Phase2_cff.py | 4 +- Configuration/Eras/python/Era_Run3_cff.py | 4 +- ...2021_cff.py => Modifier_ctpps_2022_cff.py} | 2 +- .../StandardSequences/python/Eras.py | 6 ++- SimPPS/Configuration/python/GenPPS_cff.py | 4 +- SimPPS/Configuration/python/SimPPS_cff.py | 4 +- .../Configuration/python/directSimPPS_cff.py | 45 +++---------------- .../python/ppsDirectProtonSimulation_cff.py | 33 ++++++++++++++ Validation/CTPPS/test/simu/run_multiple | 2 - Validation/CTPPS/test/simu/template_cfg.py | 14 ++---- 10 files changed, 56 insertions(+), 62 deletions(-) rename Configuration/Eras/python/{Modifier_ctpps_2021_cff.py => Modifier_ctpps_2022_cff.py} (59%) create mode 100644 SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py diff --git a/Configuration/Eras/python/Era_Phase2_cff.py b/Configuration/Eras/python/Era_Phase2_cff.py index 51e9a8d63cb3e..c345cc8145a4f 100644 --- a/Configuration/Eras/python/Era_Phase2_cff.py +++ b/Configuration/Eras/python/Era_Phase2_cff.py @@ -15,7 +15,7 @@ from Configuration.Eras.Modifier_phase2_timing_cff import phase2_timing from Configuration.Eras.Modifier_phase2_timing_layer_cff import phase2_timing_layer from Configuration.Eras.Modifier_phase2_trigger_cff import phase2_trigger -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep -Phase2 = cms.ModifierChain(Run3_noMkFit.copyAndExclude([phase1Pixel,trackingPhase1,ctpps_2021,dd4hep]), phase2_common, phase2_tracker, trackingPhase2PU140, phase2_ecal, phase2_hcal, phase2_hgcal, phase2_muon, phase2_GEM, hcalHardcodeConditions, phase2_timing, phase2_timing_layer, phase2_trigger) +Phase2 = cms.ModifierChain(Run3_noMkFit.copyAndExclude([phase1Pixel,trackingPhase1,ctpps_2022,dd4hep]), phase2_common, phase2_tracker, trackingPhase2PU140, phase2_ecal, phase2_hcal, phase2_hgcal, phase2_muon, phase2_GEM, hcalHardcodeConditions, phase2_timing, phase2_timing_layer, phase2_trigger) diff --git a/Configuration/Eras/python/Era_Run3_cff.py b/Configuration/Eras/python/Era_Run3_cff.py index 49ed0932d8da8..050caf1c155d2 100644 --- a/Configuration/Eras/python/Era_Run3_cff.py +++ b/Configuration/Eras/python/Era_Run3_cff.py @@ -8,11 +8,11 @@ from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017 from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 from Configuration.ProcessModifiers.dd4hep_cff import dd4hep from Configuration.Eras.Modifier_run3_nanoAOD_devel_cff import run3_nanoAOD_devel from Configuration.Eras.Modifier_run3_egamma_cff import run3_egamma from Configuration.Eras.Modifier_run3_RPC_cff import run3_RPC -Run3 = cms.ModifierChain(Run2_2018.copyAndExclude([run2_GEM_2017, ctpps_2018]), run3_common, run3_egamma, run3_GEM, run3_HB, run3_HFSL, stage2L1Trigger_2021, ctpps_2021, dd4hep, run3_nanoAOD_devel, run3_RPC) +Run3 = cms.ModifierChain(Run2_2018.copyAndExclude([run2_GEM_2017, ctpps_2018]), run3_common, run3_egamma, run3_GEM, run3_HB, run3_HFSL, stage2L1Trigger_2021, ctpps_2022, dd4hep, run3_nanoAOD_devel, run3_RPC) diff --git a/Configuration/Eras/python/Modifier_ctpps_2021_cff.py b/Configuration/Eras/python/Modifier_ctpps_2022_cff.py similarity index 59% rename from Configuration/Eras/python/Modifier_ctpps_2021_cff.py rename to Configuration/Eras/python/Modifier_ctpps_2022_cff.py index 15c9d30d3a7e4..fe466b207b0de 100644 --- a/Configuration/Eras/python/Modifier_ctpps_2021_cff.py +++ b/Configuration/Eras/python/Modifier_ctpps_2022_cff.py @@ -1,3 +1,3 @@ import FWCore.ParameterSet.Config as cms -ctpps_2021 = cms.Modifier() +ctpps_2022 = cms.Modifier() diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 78255fada01b3..45d44b8869724 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -63,7 +63,7 @@ def __init__(self): 'stage1L1Trigger', 'fastSim', 'peripheralPbPb', 'pA_2016', 'run2_HE_2017', 'stage2L1Trigger', 'stage2L1Trigger_2017', 'stage2L1Trigger_2018', 'stage2L1Trigger_2021', - 'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018', + 'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018', 'run3_HB', 'run3_HFSL', 'run3_common', 'run3_RPC', 'phase1Pixel', 'run3_GEM', 'run2_GEM_2017', 'run2_CSC_2018', @@ -73,7 +73,9 @@ def __init__(self): 'phase2_timing_layer', 'phase2_etlV4', 'phase2_hcal', 'phase2_ecal','phase2_ecal_devel', 'phase2_trigger', 'phase2_squarePixels', 'phase2_3DPixels', - 'trackingLowPU', 'trackingPhase1', 'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2021', 'trackingPhase2PU140','highBetaStar_2018', + 'trackingLowPU', 'trackingPhase1', + 'ctpps', 'ctpps_2016', 'ctpps_2017', 'ctpps_2018', 'ctpps_2022', + 'trackingPhase2PU140','highBetaStar_2018', 'tracker_apv_vfp30_2016', 'pf_badHcalMitigationOff', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X', 'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016', 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_106Xv2', diff --git a/SimPPS/Configuration/python/GenPPS_cff.py b/SimPPS/Configuration/python/GenPPS_cff.py index 5f245626016a6..c0626c2ada206 100644 --- a/SimPPS/Configuration/python/GenPPS_cff.py +++ b/SimPPS/Configuration/python/GenPPS_cff.py @@ -15,5 +15,5 @@ #from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 #ctpps_2018.toReplaceWith(PPSTransportTask, cms.Task(LHCTransport)) -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -ctpps_2021.toReplaceWith(PPSTransportTask, cms.Task(LHCTransport)) +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 +ctpps_2022.toReplaceWith(PPSTransportTask, cms.Task(LHCTransport)) diff --git a/SimPPS/Configuration/python/SimPPS_cff.py b/SimPPS/Configuration/python/SimPPS_cff.py index 92295d09946e8..4ee9d7fd4f806 100644 --- a/SimPPS/Configuration/python/SimPPS_cff.py +++ b/SimPPS/Configuration/python/SimPPS_cff.py @@ -23,5 +23,5 @@ #from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 #ctpps_2018.toReplaceWith(ctppsDigiTask, RPixDetDigitizerTask) -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -ctpps_2021.toReplaceWith(ctppsDigiTask, RPixDetDigitizerTask) +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 +ctpps_2022.toReplaceWith(ctppsDigiTask, RPixDetDigitizerTask) diff --git a/SimPPS/Configuration/python/directSimPPS_cff.py b/SimPPS/Configuration/python/directSimPPS_cff.py index b6d794c2b63df..acaf7b87e9959 100644 --- a/SimPPS/Configuration/python/directSimPPS_cff.py +++ b/SimPPS/Configuration/python/directSimPPS_cff.py @@ -1,43 +1,12 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -from CalibPPS.ESProducers.ctppsBeamParametersFromLHCInfoESSource_cfi import ctppsBeamParametersFromLHCInfoESSource as _esLHCinfo -from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cfi import ppsDirectProtonSimulation as _dirProtonSim - -# beam parameters as determined by PPS -ctppsBeamParametersFromLHCInfoESSource = _esLHCinfo.clone( - lhcInfoLabel = "", - # beam divergence (rad) - beamDivX45 = 30.e-6, - beamDivX56 = 30.e-6, - beamDivY45 = 30.e-6, - beamDivY56 = 30.e-6, - # vertex offset (cm) - vtxOffsetX45 = 0., - vtxOffsetX56 = 0., - vtxOffsetY45 = 0., - vtxOffsetY56 = 0., - vtxOffsetZ45 = 0., - vtxOffsetZ56 = 0., - # vertex sigma (cm) - vtxStddevX = 1.e-3, - vtxStddevY = 1.e-3, - vtxStddevZ = 5. -) - -# direct simulation -ppsDirectProtonSimulation = _dirProtonSim.clone( - hepMCTag = cms.InputTag('beamDivergenceVtxGenerator'), - pitchStrips = 66.e-3 * 12 / 19, # effective value to reproduce real RP resolution - pitchPixelsHor = 50.e-3, - pitchPixelsVer = 80.e-3, - produceScoringPlaneHits = False, -) +from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cff import * -ppsDirectSimTask = cms.Task( +directSimPPSTask = cms.Task( ppsDirectProtonSimulation, ) -ppsDirectSim = cms.Sequence(ppsDirectSimTask) +directSimPPS = cms.Sequence(directSimPPSTask) # modify according to era @@ -53,11 +22,11 @@ def _modify2018(process): print('Process customised for 2018 PPS era') process.load('SimPPS.DirectSimProducer.simPPS2018_cfi') -def _modify2021(process): - print('Process customised for 2021 PPS era') - process.load('SimPPS.DirectSimProducer.simPPS2021_cfi') +def _modify2022(process): + print('Process customised for 2022 PPS era') + process.load('SimPPS.DirectSimProducer.simPPS2022_cfi') modifyConfigurationStandardSequencesFor2016_ = eras.ctpps_2016.makeProcessModifier(_modify2016) modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2017.makeProcessModifier(_modify2017) modifyConfigurationStandardSequencesFor2018_ = eras.ctpps_2018.makeProcessModifier(_modify2018) -modifyConfigurationStandardSequencesFor2021_ = eras.ctpps_2021.makeProcessModifier(_modify2021) +modifyConfigurationStandardSequencesFor2022_ = eras.ctpps_2022.makeProcessModifier(_modify2022) diff --git a/SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py b/SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py new file mode 100644 index 0000000000000..4fede99a27722 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py @@ -0,0 +1,33 @@ +import FWCore.ParameterSet.Config as cms +from CalibPPS.ESProducers.ctppsBeamParametersFromLHCInfoESSource_cfi import ctppsBeamParametersFromLHCInfoESSource as _esLHCinfo +from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cfi import ppsDirectProtonSimulation as _dirProtonSim + +# beam parameters as determined by PPS +ctppsBeamParametersFromLHCInfoESSource = _esLHCinfo.clone( + lhcInfoLabel = "", + # beam divergence (rad) + beamDivX45 = 30.e-6, + beamDivX56 = 30.e-6, + beamDivY45 = 30.e-6, + beamDivY56 = 30.e-6, + # vertex offset (cm) + vtxOffsetX45 = 0., + vtxOffsetX56 = 0., + vtxOffsetY45 = 0., + vtxOffsetY56 = 0., + vtxOffsetZ45 = 0., + vtxOffsetZ56 = 0., + # vertex sigma (cm) + vtxStddevX = 1.e-3, + vtxStddevY = 1.e-3, + vtxStddevZ = 5. +) + +# direct simulation +ppsDirectProtonSimulation = _dirProtonSim.clone( + hepMCTag = 'beamDivergenceVtxGenerator', + pitchStrips = 66.e-3 * 12 / 19, # effective value to reproduce real RP resolution + pitchPixelsHor = 50.e-3, + pitchPixelsVer = 80.e-3, + produceScoringPlaneHits = False, +) diff --git a/Validation/CTPPS/test/simu/run_multiple b/Validation/CTPPS/test/simu/run_multiple index 24f0c47648254..2bc6cc5df6d53 100755 --- a/Validation/CTPPS/test/simu/run_multiple +++ b/Validation/CTPPS/test/simu/run_multiple @@ -49,8 +49,6 @@ RunOne "2017" "Run2_2017" RunOne "2018" "Run2_2018" -RunOne "2021" "Run3" - RunOne "2022" "Run3" rc=0 diff --git a/Validation/CTPPS/test/simu/template_cfg.py b/Validation/CTPPS/test/simu/template_cfg.py index fcee27a4b331c..468ede7243c81 100644 --- a/Validation/CTPPS/test/simu/template_cfg.py +++ b/Validation/CTPPS/test/simu/template_cfg.py @@ -22,16 +22,9 @@ ) ) -# global tag -#process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -#from Configuration.AlCa.GlobalTag import GlobalTag -#process.GlobalTag = GlobalTag(process.GlobalTag, '120X_mcRun3_2021_realistic_v6', '') -#process.load('Geometry.VeryForwardGeometry.geometryRPFromDB_cfi') - -# load config -process.load('SimPPS.Configuration.ppsDirectSim_cff') +# load config (start with RECO, then direct SIM as geometry ESSource is overridden) process.load('RecoPPS.Configuration.recoCTPPS_cff') -process.load('RecoPPS.ProtonReconstruction.ctppsProtons_cff') +process.load('SimPPS.Configuration.directSimPPS_cff') # default source process.source = cms.Source("EmptySource", @@ -101,10 +94,9 @@ process.p = cms.Path( process.generator * process.beamDivergenceVtxGenerator - * process.ppsDirectProtonSimulation + * process.directSimPPS * process.recoCTPPS - * process.ctppsProtons * process.ctppsLHCInfoPlotter * process.ctppsTrackDistributionPlotter From b22c510db8a8c67c5eadfeb1c6abcbaea4a1765b Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 18 Nov 2021 10:53:28 +0100 Subject: [PATCH 05/18] Updated energy for run3 simulations --- .../Configuration/python/directSimPPS_cff.py | 2 ++ .../python/simPPS2022_cfi.py | 2 -- Validation/CTPPS/test/simu/template_cfg.py | 32 +++++++++---------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/SimPPS/Configuration/python/directSimPPS_cff.py b/SimPPS/Configuration/python/directSimPPS_cff.py index acaf7b87e9959..9a7b2b350a7ce 100644 --- a/SimPPS/Configuration/python/directSimPPS_cff.py +++ b/SimPPS/Configuration/python/directSimPPS_cff.py @@ -25,6 +25,8 @@ def _modify2018(process): def _modify2022(process): print('Process customised for 2022 PPS era') process.load('SimPPS.DirectSimProducer.simPPS2022_cfi') + if hasattr(process, 'generator'): + process.generator.energy = process.profile_2022_default.ctppsLHCInfo.beamEnergy modifyConfigurationStandardSequencesFor2016_ = eras.ctpps_2016.makeProcessModifier(_modify2016) modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2017.makeProcessModifier(_modify2017) diff --git a/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py index 454d2be14600a..e8b2fb2d81d0e 100644 --- a/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py +++ b/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py @@ -25,5 +25,3 @@ rp_56_N = cms.uint32(103), rp_56_F = cms.uint32(123) ) - -#generator.energy = profile_2022_default.ctppsLHCInfo.beamEnergy diff --git a/Validation/CTPPS/test/simu/template_cfg.py b/Validation/CTPPS/test/simu/template_cfg.py index 468ede7243c81..72a7c2e086e60 100644 --- a/Validation/CTPPS/test/simu/template_cfg.py +++ b/Validation/CTPPS/test/simu/template_cfg.py @@ -3,15 +3,13 @@ from Configuration.Eras.Era_$ERA_cff import * process = cms.Process('CTPPSTest', $ERA) +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('IOMC.EventVertexGenerators.beamDivergenceVtxGenerator_cfi') +# start with RECO, then direct SIM as geometry ESSource is overridden +process.load('RecoPPS.Configuration.recoCTPPS_cff') +process.load('SimPPS.Configuration.directSimPPS_cff') +process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cfi') process.load("CondCore.CondDB.CondDB_cfi") -process.CondDB.connect = 'frontier://FrontierProd/CMS_CONDITIONS' -process.PoolDBESSource = cms.ESSource("PoolDBESSource", - process.CondDB, - toGet = cms.VPSet(cms.PSet( - record = cms.string('CTPPSPixelAnalysisMaskRcd'), - tag = cms.string("CTPPSPixelAnalysisMask_Run3_v1_hlt") - )) -) # minimal logger settings process.MessageLogger = cms.Service("MessageLogger", @@ -22,18 +20,22 @@ ) ) -# load config (start with RECO, then direct SIM as geometry ESSource is overridden) -process.load('RecoPPS.Configuration.recoCTPPS_cff') -process.load('SimPPS.Configuration.directSimPPS_cff') - # default source process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(1), numberEventsInLuminosityBlock = process.ctppsCompositeESSource.generateEveryNEvents ) +process.CondDB.connect = 'frontier://FrontierProd/CMS_CONDITIONS' +process.PoolDBESSource = cms.ESSource("PoolDBESSource", + process.CondDB, + toGet = cms.VPSet(cms.PSet( + record = cms.string('CTPPSPixelAnalysisMaskRcd'), + tag = cms.string("CTPPSPixelAnalysisMask_Run3_v1_hlt") + )) +) + # particle generator -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') from Configuration.Generator.randomXiThetaGunProducer_cfi import generator as _gen process.generator = _gen.clone( xi_max = 0.25, @@ -41,9 +43,6 @@ theta_y_sigma = 60.e-6 ) -# beam smearing -process.load('IOMC.EventVertexGenerators.beamDivergenceVtxGenerator_cfi') - # random seeds process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", sourceSeed = cms.PSet(initialSeed = cms.untracked.uint32(98765)), @@ -61,7 +60,6 @@ ) # LHCInfo plotter -process.load("Validation.CTPPS.ctppsLHCInfoPlotter_cfi") process.ctppsLHCInfoPlotter.outputFile = "$OUT_LHCINFO" # track distribution plotter From fa041b27fc28b97d3440ef6c6e6fca8976ea116f Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 18 Nov 2021 12:05:09 +0100 Subject: [PATCH 06/18] Removing ctppsGeometryESModule from run3 recipes (loaded by default by the recoCTPPS sequence container) --- SimPPS/Configuration/python/directSimPPS_cff.py | 3 +++ SimPPS/DirectSimProducer/python/simPPS2017_cfi.py | 8 ++++---- SimPPS/DirectSimProducer/python/simPPS2018_cfi.py | 9 +-------- SimPPS/DirectSimProducer/python/simPPS2022_cfi.py | 9 +-------- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/SimPPS/Configuration/python/directSimPPS_cff.py b/SimPPS/Configuration/python/directSimPPS_cff.py index 9a7b2b350a7ce..6d7091b9dd1b3 100644 --- a/SimPPS/Configuration/python/directSimPPS_cff.py +++ b/SimPPS/Configuration/python/directSimPPS_cff.py @@ -27,6 +27,9 @@ def _modify2022(process): process.load('SimPPS.DirectSimProducer.simPPS2022_cfi') if hasattr(process, 'generator'): process.generator.energy = process.profile_2022_default.ctppsLHCInfo.beamEnergy + if hasattr(process, 'ctppsGeometryESModule'): + # replaced by the composite ESSource + delattr(process, 'ctppsGeometryESModule') modifyConfigurationStandardSequencesFor2016_ = eras.ctpps_2016.makeProcessModifier(_modify2016) modifyConfigurationStandardSequencesFor2017_ = eras.ctpps_2017.makeProcessModifier(_modify2017) diff --git a/SimPPS/DirectSimProducer/python/simPPS2017_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2017_cfi.py index 15d76e88e38ae..a006022511d59 100644 --- a/SimPPS/DirectSimProducer/python/simPPS2017_cfi.py +++ b/SimPPS/DirectSimProducer/python/simPPS2017_cfi.py @@ -18,8 +18,8 @@ # RP ids rpIds = cms.PSet( - rp_45_F = cms.uint32(23), - rp_45_N = cms.uint32(3), - rp_56_N = cms.uint32(103), - rp_56_F = cms.uint32(123) + rp_45_F = cms.uint32(23), + rp_45_N = cms.uint32(3), + rp_56_N = cms.uint32(103), + rp_56_F = cms.uint32(123) ) diff --git a/SimPPS/DirectSimProducer/python/simPPS2018_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2018_cfi.py index 19a2a31d6ee41..36cbf289f8262 100644 --- a/SimPPS/DirectSimProducer/python/simPPS2018_cfi.py +++ b/SimPPS/DirectSimProducer/python/simPPS2018_cfi.py @@ -4,6 +4,7 @@ from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import ppsAssociationCutsESSource as _esAssCuts from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry from SimPPS.DirectSimProducer.profiles_2018_cff import profile_2018_preTS1, profile_2018_TS1_TS2, profile_2018_postTS2 +from SimPPS.DirectSimProducer.simPPS2017_cfi import rpIds ppsAssociationCutsESSource = _esAssCuts.clone() use_single_infinite_iov_entry(ppsAssociationCutsESSource, p2018) @@ -15,11 +16,3 @@ compactViewTag = ctppsGeometryESModule.compactViewTag, isRun2 = ctppsGeometryESModule.isRun2 ) - -# RP ids -rpIds = cms.PSet( - rp_45_F = cms.uint32(23), - rp_45_N = cms.uint32(3), - rp_56_N = cms.uint32(103), - rp_56_F = cms.uint32(123) -) diff --git a/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py b/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py index e8b2fb2d81d0e..cf35280fb3c3e 100644 --- a/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py +++ b/SimPPS/DirectSimProducer/python/simPPS2022_cfi.py @@ -4,6 +4,7 @@ from CalibPPS.ESProducers.ppsAssociationCuts_non_DB_cff import ppsAssociationCutsESSource as _esAssCuts from Geometry.VeryForwardGeometry.commons_cff import cloneGeometry from SimPPS.DirectSimProducer.profiles_2022_cff import profile_2022_default +from SimPPS.DirectSimProducer.simPPS2017_cfi import rpIds ppsAssociationCutsESSource = _esAssCuts.clone() use_single_infinite_iov_entry(ppsAssociationCutsESSource, p2022) @@ -17,11 +18,3 @@ compactViewTag = _ctppsGeometryESModule.compactViewTag, isRun2 = _ctppsGeometryESModule.isRun2 ) - -# RP ids -rpIds = cms.PSet( - rp_45_F = cms.uint32(23), - rp_45_N = cms.uint32(3), - rp_56_N = cms.uint32(103), - rp_56_F = cms.uint32(123) -) From 264ffc4d000dd1cff386d6ddc4c991d375fbc11e Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Fri, 19 Nov 2021 00:47:54 +0100 Subject: [PATCH 07/18] New dedicated sequence for direct simulation reconstruction --- RecoPPS/Configuration/python/recoCTPPS_cff.py | 30 ++++++++++++++----- .../test/test_miniAOD_cfg.py | 21 +++++++------ Validation/CTPPS/test/simu/template_cfg.py | 3 +- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/RecoPPS/Configuration/python/recoCTPPS_cff.py b/RecoPPS/Configuration/python/recoCTPPS_cff.py index 3dd2e61d3c0b4..1f036f35c1e38 100644 --- a/RecoPPS/Configuration/python/recoCTPPS_cff.py +++ b/RecoPPS/Configuration/python/recoCTPPS_cff.py @@ -25,15 +25,29 @@ ctpps_2018.toReplaceWith( recoCTPPSTask, cms.Task( - totemRPLocalReconstructionTask , - ctppsDiamondLocalReconstructionTask , - totemTimingLocalReconstructionTask , - ctppsPixelLocalReconstructionTask , - ctppsLocalTrackLiteProducer , - ctppsProtons + totemRPLocalReconstructionTask , + ctppsDiamondLocalReconstructionTask , + totemTimingLocalReconstructionTask , + ctppsPixelLocalReconstructionTask , + ctppsLocalTrackLiteProducer , + ctppsProtons ) - ) - recoCTPPS = cms.Sequence(recoCTPPSTask) + +# reconstruction for direct simulation (RecHit-level info) + +totemRPFromRHLocalReconstructionTask = totemRPLocalReconstructionTask.copyAndExclude([totemRPClusterProducer, totemRPRecHitProducer]) +ctppsDiamondFromRHLocalReconstructionTask = ctppsDiamondLocalReconstructionTask.copyAndExclude([ctppsDiamondRecHits]) +ctppsPixelFromRHLocalReconstructionTask = ctppsPixelLocalReconstructionTask.copyAndExclude([ctppsPixelClusters, ctppsPixelRecHits]) + +recoDirectSimPPSTask = cms.Task( + totemRPFromRHLocalReconstructionTask, + ctppsDiamondFromRHLocalReconstructionTask, + ctppsPixelFromRHLocalReconstructionTask, + ctppsLocalTrackLiteProducer, + ctppsProtons +) + +recoDirectSimPPS = cms.Sequence(recoDirectSimPPSTask) diff --git a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py index 3b32c678ad8d7..ff27cfc3d6180 100644 --- a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py +++ b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py @@ -9,6 +9,9 @@ process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +# PPS simulation and reconstruction chains with standard settings +process.load('RecoPPS.Configuration.recoCTPPS_cff') +process.load('SimPPS.Configuration.directSimPPS_cff') # minimum of logs process.load('FWCore.MessageService.MessageLogger_cfi') @@ -24,23 +27,23 @@ fileNames = cms.untracked.vstring( '/store/mc/RunIISummer20UL16MiniAODAPVv2/GGToMuMu_Pt-25_Elastic_13TeV-lpair/MINIAODSIM/106X_mcRun2_asymptotic_preVFP_v11-v1/280000/3870E880-4A47-7440-B122-C76062D2290F.root', ), - #inputCommands = cms.untracked.vstring( - # 'drop *', - # 'keep FEDRawDataCollection_*_*_*' - #) ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000) ) -# PPS simulation and reconstruction chains with standard settings -process.load('SimPPS.Configuration.ppsDirectSim_cff') -process.load('RecoPPS.Configuration.recoCTPPS_cff') +process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", + beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)), + ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) +) + +from SimPPS.DirectSimProducer.profile_base_cff import matchDirectSimOutputs +matchDirectSimOutputs(process, miniAOD=True) process.p = cms.Path( - process.ppsDirectSim - * process.ctppsProtons + process.directSimPPS + * process.recoDirectSimPPS ) # output configuration diff --git a/Validation/CTPPS/test/simu/template_cfg.py b/Validation/CTPPS/test/simu/template_cfg.py index 72a7c2e086e60..cbe408b4c61ab 100644 --- a/Validation/CTPPS/test/simu/template_cfg.py +++ b/Validation/CTPPS/test/simu/template_cfg.py @@ -23,7 +23,6 @@ # default source process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(1), - numberEventsInLuminosityBlock = process.ctppsCompositeESSource.generateEveryNEvents ) process.CondDB.connect = 'frontier://FrontierProd/CMS_CONDITIONS' @@ -94,7 +93,7 @@ * process.beamDivergenceVtxGenerator * process.directSimPPS - * process.recoCTPPS + * process.recoDirectSimPPS * process.ctppsLHCInfoPlotter * process.ctppsTrackDistributionPlotter From d62ac2c7b1d43e14a742c66d5b9f179400826383 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Fri, 19 Nov 2021 00:48:53 +0100 Subject: [PATCH 08/18] Added the vertex smearing as part of the simulation sequence ; new AOD/miniAOD sequence modifiers --- SimPPS/Configuration/python/directSimPPS_cff.py | 3 ++- .../python/ppsDirectProtonSimulation_cff.py | 4 ++++ .../DirectSimProducer/python/profile_base_cff.py | 14 +++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/SimPPS/Configuration/python/directSimPPS_cff.py b/SimPPS/Configuration/python/directSimPPS_cff.py index 6d7091b9dd1b3..b917dd182621a 100644 --- a/SimPPS/Configuration/python/directSimPPS_cff.py +++ b/SimPPS/Configuration/python/directSimPPS_cff.py @@ -3,7 +3,8 @@ from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cff import * directSimPPSTask = cms.Task( - ppsDirectProtonSimulation, + beamDivergenceVtxGenerator, + ppsDirectProtonSimulation ) directSimPPS = cms.Sequence(directSimPPSTask) diff --git a/SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py b/SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py index 4fede99a27722..159197f9b9c3f 100644 --- a/SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py +++ b/SimPPS/DirectSimProducer/python/ppsDirectProtonSimulation_cff.py @@ -1,6 +1,10 @@ import FWCore.ParameterSet.Config as cms from CalibPPS.ESProducers.ctppsBeamParametersFromLHCInfoESSource_cfi import ctppsBeamParametersFromLHCInfoESSource as _esLHCinfo from SimPPS.DirectSimProducer.ppsDirectProtonSimulation_cfi import ppsDirectProtonSimulation as _dirProtonSim +from IOMC.EventVertexGenerators.beamDivergenceVtxGenerator_cfi import beamDivergenceVtxGenerator as _vtxGen + +# vertex smearing +beamDivergenceVtxGenerator = _vtxGen.clone() # beam parameters as determined by PPS ctppsBeamParametersFromLHCInfoESSource = _esLHCinfo.clone( diff --git a/SimPPS/DirectSimProducer/python/profile_base_cff.py b/SimPPS/DirectSimProducer/python/profile_base_cff.py index f1cf4cf7c2645..a54e9f3d6a4cb 100644 --- a/SimPPS/DirectSimProducer/python/profile_base_cff.py +++ b/SimPPS/DirectSimProducer/python/profile_base_cff.py @@ -32,7 +32,19 @@ ) ) -def matchDirectSimOutputs(process): +def matchDirectSimOutputs(process, AOD=False, miniAOD=False): process.totemRPUVPatternFinder.tagRecHit = cms.InputTag('ppsDirectProtonSimulation') process.ctppsPixelLocalTracks.tag = cms.InputTag('ppsDirectProtonSimulation') process.ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ppsDirectProtonSimulation') + if AOD: + process.beamDivergenceVtxGenerator.src = cms.InputTag('') + process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( + cms.InputTag('genPUProtons', 'genPUProtons'), + cms.InputTag('genParticles') + ) + elif miniAOD: + process.beamDivergenceVtxGenerator.src = cms.InputTag('') + process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( + cms.InputTag('genPUProtons', 'genPUProtons'), + cms.InputTag('prunedGenParticles') + ) From 0e3b4dff60cd41b0bd269de89e30429a8d8c97cb Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Thu, 24 Feb 2022 13:42:15 +0100 Subject: [PATCH 09/18] Vertex unshifting utility added --- SimPPS/Configuration/python/directSimPPS_cff.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/SimPPS/Configuration/python/directSimPPS_cff.py b/SimPPS/Configuration/python/directSimPPS_cff.py index b917dd182621a..893df712c5424 100644 --- a/SimPPS/Configuration/python/directSimPPS_cff.py +++ b/SimPPS/Configuration/python/directSimPPS_cff.py @@ -9,19 +9,35 @@ directSimPPS = cms.Sequence(directSimPPSTask) +def unshiftVertex(process, smearingParams): + """Undo vertex smearing using the parameters used for the sample production""" + if not hasattr(process, 'ctppsBeamParametersFromLHCInfoESSource'): + return + from importlib import import_module + _params = import_module('IOMC.EventVertexGenerators.VtxSmearedParameters_cfi') + if not hasattr(_params, smearingParams): + raise ImportError('Failed to import {} from vertex smearing parameters!'.format(smearingParams)) + _params = getattr(_params, smearingParams) + process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetX45 = cms.double(-_params.X0.value()) + process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetY45 = cms.double(-_params.Y0.value()) + process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetZ45 = cms.double(-_params.Z0.value()) + # modify according to era def _modify2016(process): print('Process customised for 2016 PPS era') process.load('SimPPS.DirectSimProducer.simPPS2016_cfi') + unshiftVertex(process, 'Realistic25ns13TeV2016CollisionVtxSmearingParameters') def _modify2017(process): print('Process customised for 2017 PPS era') process.load('SimPPS.DirectSimProducer.simPPS2017_cfi') + unshiftVertex(process, 'Realistic25ns13TeVEarly2017CollisionVtxSmearingParameters') def _modify2018(process): print('Process customised for 2018 PPS era') process.load('SimPPS.DirectSimProducer.simPPS2018_cfi') + unshiftVertex(process, 'Realistic25ns13TeVEarly2018CollisionVtxSmearingParameters') def _modify2022(process): print('Process customised for 2022 PPS era') From f2b99e80a0583969144899fe7a4ad8f6db481d67 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Fri, 29 Apr 2022 09:55:04 +0200 Subject: [PATCH 10/18] Reco: local tracks lite producer default behaviour now matches 2018/run 3, added modifiers for 2016/17 subdetectors --- .../python/ctppsLocalTrackLiteProducer_cff.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py b/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py index 379be28dca719..716011d60c167 100644 --- a/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py +++ b/RecoPPS/Local/python/ctppsLocalTrackLiteProducer_cff.py @@ -6,7 +6,24 @@ # enable the module for CTPPS era(s) from Configuration.Eras.Modifier_ctpps_cff import ctpps +from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 + ctpps.toModify( + ctppsLocalTrackLiteProducer, + includeStrips = False, + includeDiamonds = True, + includePixels = True +) + +ctpps_2016.toModify( + ctppsLocalTrackLiteProducer, + includeStrips = True, + includeDiamonds = False, + includePixels = False +) + +ctpps_2017.toModify( ctppsLocalTrackLiteProducer, includeStrips = True, includeDiamonds = True, From 1a5a9ea355a9d1f6588462ca8bf36a055dad2bc3 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 3 May 2022 12:32:58 +0200 Subject: [PATCH 11/18] Reco: moved matchDirectSimOutputs to a dedicated include file --- .../DirectSimProducer/python/matching_cff.py | 19 +++++++++++++++++++ .../python/profile_base_cff.py | 17 ----------------- .../test/test_miniAOD_cfg.py | 2 +- Validation/CTPPS/test/simu/template_cfg.py | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 SimPPS/DirectSimProducer/python/matching_cff.py diff --git a/SimPPS/DirectSimProducer/python/matching_cff.py b/SimPPS/DirectSimProducer/python/matching_cff.py new file mode 100644 index 0000000000000..d5d539fea3cc8 --- /dev/null +++ b/SimPPS/DirectSimProducer/python/matching_cff.py @@ -0,0 +1,19 @@ +import FWCore.ParameterSet.Config as cms + +def matchDirectSimOutputs(process, AOD=False, miniAOD=False): + process.totemRPUVPatternFinder.tagRecHit = cms.InputTag('ppsDirectProtonSimulation') + process.ctppsPixelLocalTracks.tag = cms.InputTag('ppsDirectProtonSimulation') + process.ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ppsDirectProtonSimulation') + process.es_prefer_geometry = cms.ESPrefer('CTPPSCompositeESSource', 'ctppsCompositeESSource') + if AOD: + process.beamDivergenceVtxGenerator.src = cms.InputTag('') + process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( + cms.InputTag('genPUProtons', 'genPUProtons'), + cms.InputTag('genParticles') + ) + elif miniAOD: + process.beamDivergenceVtxGenerator.src = cms.InputTag('') + process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( + cms.InputTag('genPUProtons', 'genPUProtons'), + cms.InputTag('prunedGenParticles') + ) diff --git a/SimPPS/DirectSimProducer/python/profile_base_cff.py b/SimPPS/DirectSimProducer/python/profile_base_cff.py index a54e9f3d6a4cb..bbbd2e27a9d1e 100644 --- a/SimPPS/DirectSimProducer/python/profile_base_cff.py +++ b/SimPPS/DirectSimProducer/python/profile_base_cff.py @@ -31,20 +31,3 @@ efficienciesPerPlane = cms.VPSet() ) ) - -def matchDirectSimOutputs(process, AOD=False, miniAOD=False): - process.totemRPUVPatternFinder.tagRecHit = cms.InputTag('ppsDirectProtonSimulation') - process.ctppsPixelLocalTracks.tag = cms.InputTag('ppsDirectProtonSimulation') - process.ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ppsDirectProtonSimulation') - if AOD: - process.beamDivergenceVtxGenerator.src = cms.InputTag('') - process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( - cms.InputTag('genPUProtons', 'genPUProtons'), - cms.InputTag('genParticles') - ) - elif miniAOD: - process.beamDivergenceVtxGenerator.src = cms.InputTag('') - process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( - cms.InputTag('genPUProtons', 'genPUProtons'), - cms.InputTag('prunedGenParticles') - ) diff --git a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py index ff27cfc3d6180..9fab50f2745dd 100644 --- a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py +++ b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py @@ -38,7 +38,7 @@ ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) ) -from SimPPS.DirectSimProducer.profile_base_cff import matchDirectSimOutputs +from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputs matchDirectSimOutputs(process, miniAOD=True) process.p = cms.Path( diff --git a/Validation/CTPPS/test/simu/template_cfg.py b/Validation/CTPPS/test/simu/template_cfg.py index cbe408b4c61ab..5ec907b08193c 100644 --- a/Validation/CTPPS/test/simu/template_cfg.py +++ b/Validation/CTPPS/test/simu/template_cfg.py @@ -50,7 +50,7 @@ ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) ) -from SimPPS.DirectSimProducer.profile_base_cff import matchDirectSimOutputs +from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputs matchDirectSimOutputs(process) # number of events From 0d910486368a25e92cf194a3cec8a9c4f918bf73 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 3 May 2022 13:02:03 +0200 Subject: [PATCH 12/18] Test: added @michael-pitt's patch for miniAOD test --- SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py index 9fab50f2745dd..33dfec28d3931 100644 --- a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py +++ b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 -process = cms.Process('PPS', ctpps_2016) +from Configuration.StandardSequences.Eras import eras +process = cms.Process('PPS', eras.Run2_2018) process.load('Configuration.StandardSequences.Services_cff') process.load('Configuration.EventContent.EventContent_cff') @@ -9,9 +9,8 @@ process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -# PPS simulation and reconstruction chains with standard settings -process.load('RecoPPS.Configuration.recoCTPPS_cff') process.load('SimPPS.Configuration.directSimPPS_cff') +process.load('RecoPPS.Configuration.recoCTPPS_cff') # minimum of logs process.load('FWCore.MessageService.MessageLogger_cfi') @@ -20,12 +19,13 @@ # global tag from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '106X_mcRun2_asymptotic_v17', '') +process.GlobalTag = GlobalTag(process.GlobalTag, '106X_upgrade2018_realistic_v16_L1v1', '') # raw data source process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring( - '/store/mc/RunIISummer20UL16MiniAODAPVv2/GGToMuMu_Pt-25_Elastic_13TeV-lpair/MINIAODSIM/106X_mcRun2_asymptotic_preVFP_v11-v1/280000/3870E880-4A47-7440-B122-C76062D2290F.root', + #'/store/mc/RunIISummer20UL16MiniAODAPVv2/GGToMuMu_Pt-25_Elastic_13TeV-lpair/MINIAODSIM/106X_mcRun2_asymptotic_preVFP_v11-v1/280000/3870E880-4A47-7440-B122-C76062D2290F.root', + '/store/mc/RunIISummer20UL18MiniAODv2/GGToMuMu_Pt-25_Elastic_13TeV-lpair/MINIAODSIM/106X_upgrade2018_realistic_v16_L1v1-v2/260000/6EC2EE65-77C0-3C43-A51B-7B94FE441894.root', ), ) From b3c3d70e7083f10140ddd88af5635cb9c087b8a2 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 May 2022 11:06:14 +0200 Subject: [PATCH 13/18] Sim: added an ESPrefer rule for LHCInfo and association cuts --- SimPPS/DirectSimProducer/python/matching_cff.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SimPPS/DirectSimProducer/python/matching_cff.py b/SimPPS/DirectSimProducer/python/matching_cff.py index d5d539fea3cc8..07c0e93b65e15 100644 --- a/SimPPS/DirectSimProducer/python/matching_cff.py +++ b/SimPPS/DirectSimProducer/python/matching_cff.py @@ -1,10 +1,14 @@ import FWCore.ParameterSet.Config as cms def matchDirectSimOutputs(process, AOD=False, miniAOD=False): + # match sources of rechits with direct simulation outputs process.totemRPUVPatternFinder.tagRecHit = cms.InputTag('ppsDirectProtonSimulation') process.ctppsPixelLocalTracks.tag = cms.InputTag('ppsDirectProtonSimulation') process.ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ppsDirectProtonSimulation') + # handle clashes between simulation and GT conditions process.es_prefer_geometry = cms.ESPrefer('CTPPSCompositeESSource', 'ctppsCompositeESSource') + process.es_prefer_lhcinfo = cms.ESPrefer('CTPPSBeamParametersFromLHCInfoESSource', 'ctppsBeamParametersFromLHCInfoESSource') + process.es_prefer_assocuts = cms.ESPrefer('PPSAssociationCutsESSource', 'ppsAssociationCutsESSource') if AOD: process.beamDivergenceVtxGenerator.src = cms.InputTag('') process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( @@ -17,3 +21,4 @@ def matchDirectSimOutputs(process, AOD=False, miniAOD=False): cms.InputTag('genPUProtons', 'genPUProtons'), cms.InputTag('prunedGenParticles') ) + return process From 4e718861b69a7795791ee4f1c5d42258813f24a0 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 May 2022 11:18:27 +0200 Subject: [PATCH 14/18] Sim: splitted the matcher functions into their two AOD/miniAOD variants - also specifying pixel topology conditions preference for safety --- .../DirectSimProducer/python/matching_cff.py | 33 +++++++++++-------- .../test/test_miniAOD_cfg.py | 4 +-- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/SimPPS/DirectSimProducer/python/matching_cff.py b/SimPPS/DirectSimProducer/python/matching_cff.py index 07c0e93b65e15..8c9855267c351 100644 --- a/SimPPS/DirectSimProducer/python/matching_cff.py +++ b/SimPPS/DirectSimProducer/python/matching_cff.py @@ -6,19 +6,26 @@ def matchDirectSimOutputs(process, AOD=False, miniAOD=False): process.ctppsPixelLocalTracks.tag = cms.InputTag('ppsDirectProtonSimulation') process.ctppsDiamondLocalTracks.recHitsTag = cms.InputTag('ppsDirectProtonSimulation') # handle clashes between simulation and GT conditions - process.es_prefer_geometry = cms.ESPrefer('CTPPSCompositeESSource', 'ctppsCompositeESSource') + process.es_prefer_composrc = cms.ESPrefer('CTPPSCompositeESSource', 'ctppsCompositeESSource') + process.es_prefer_pixtopo = cms.ESPrefer('PPSPixelTopologyESSource', 'ppsPixelTopologyESSource') process.es_prefer_lhcinfo = cms.ESPrefer('CTPPSBeamParametersFromLHCInfoESSource', 'ctppsBeamParametersFromLHCInfoESSource') process.es_prefer_assocuts = cms.ESPrefer('PPSAssociationCutsESSource', 'ppsAssociationCutsESSource') - if AOD: - process.beamDivergenceVtxGenerator.src = cms.InputTag('') - process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( - cms.InputTag('genPUProtons', 'genPUProtons'), - cms.InputTag('genParticles') - ) - elif miniAOD: - process.beamDivergenceVtxGenerator.src = cms.InputTag('') - process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( - cms.InputTag('genPUProtons', 'genPUProtons'), - cms.InputTag('prunedGenParticles') - ) + return process + +def matchDirectSimOutputsAOD(process): + matchDirectSimOutputs(process) + process.beamDivergenceVtxGenerator.src = cms.InputTag('') + process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( + cms.InputTag('genPUProtons', 'genPUProtons'), + cms.InputTag('genParticles') + ) + return process + +def matchDirectSimOutputsMiniAOD(process): + matchDirectSimOutputs(process) + process.beamDivergenceVtxGenerator.src = cms.InputTag('') + process.beamDivergenceVtxGenerator.srcGenParticle = cms.VInputTag( + cms.InputTag('genPUProtons', 'genPUProtons'), + cms.InputTag('prunedGenParticles') + ) return process diff --git a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py index 33dfec28d3931..16a4abf6e079f 100644 --- a/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py +++ b/SimPPS/DirectSimProducer/test/test_miniAOD_cfg.py @@ -38,8 +38,8 @@ ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) ) -from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputs -matchDirectSimOutputs(process, miniAOD=True) +from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsMiniAOD +matchDirectSimOutputsMiniAOD(process) process.p = cms.Path( process.directSimPPS From dc405c947c8ed8c8946828645dca5b6496c217f5 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Wed, 4 May 2022 11:56:26 +0200 Subject: [PATCH 15/18] Sim: added two customisation procedures for (mini)AOD direct simulation steering, along with rng seed --- SimPPS/Configuration/python/Utils.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 SimPPS/Configuration/python/Utils.py diff --git a/SimPPS/Configuration/python/Utils.py b/SimPPS/Configuration/python/Utils.py new file mode 100644 index 0000000000000..5b7ab305e9b1a --- /dev/null +++ b/SimPPS/Configuration/python/Utils.py @@ -0,0 +1,27 @@ +import FWCore.ParameterSet.Config as cms + +def setupPPSDirectSimAOD(process): + process.load('SimPPS.Configuration.directSimPPS_cff') + process.load('RecoPPS.Configuration.recoCTPPS_cff') + from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsAOD + matchDirectSimOutputsAOD(process) + process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", + beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)), + ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) + ) + process.directSim = cms.Path(process.directSimPPS * process.recoDirectSimPPS) + process.schedule.append(process.directSim) + return process + +def setupPPSDirectSimMiniAOD(process): + process.load('SimPPS.Configuration.directSimPPS_cff') + process.load('RecoPPS.Configuration.recoCTPPS_cff') + from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsMiniAOD + matchDirectSimOutputsMiniAOD(process) + process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", + beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)), + ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) + ) + process.directSim = cms.Path(process.directSimPPS * process.recoDirectSimPPS) + process.schedule.append(process.directSim) + return process From 76cdd5569918b7bf70229f2f46d152a702c4e76f Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 7 Jun 2022 18:09:21 +0200 Subject: [PATCH 16/18] Config: adding rng service only if not found in process attributes ; added a base setupPPSDirectSim customiser to avoid code duplication --- SimPPS/Configuration/python/Utils.py | 32 +++++++++++++++------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/SimPPS/Configuration/python/Utils.py b/SimPPS/Configuration/python/Utils.py index 5b7ab305e9b1a..e27b9d4bdf3b7 100644 --- a/SimPPS/Configuration/python/Utils.py +++ b/SimPPS/Configuration/python/Utils.py @@ -1,27 +1,29 @@ import FWCore.ParameterSet.Config as cms -def setupPPSDirectSimAOD(process): +def setupPPSDirectSim(process): process.load('SimPPS.Configuration.directSimPPS_cff') process.load('RecoPPS.Configuration.recoCTPPS_cff') + if not hasattr(process, 'RandomNumberGeneratorService'): + process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService") + if not hasattr(process.RandomNumberGeneratorService, 'beamDivergenceVtxGenerator'): + process.RandomNumberGeneratorService.beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)) + if not hasattr(process.RandomNumberGeneratorService, 'ppsDirectProtonSimulation'): + process.RandomNumberGeneratorService.ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) + process.ppsDirectSim = cms.Path(process.directSimPPS * process.recoDirectSimPPS) + process.schedule.append(process.ppsDirectSim) + + from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputs + matchDirectSimOutputs(process) + return process + +def setupPPSDirectSimAOD(process): + setupPPSDirectSim(process) from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsAOD matchDirectSimOutputsAOD(process) - process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", - beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)), - ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) - ) - process.directSim = cms.Path(process.directSimPPS * process.recoDirectSimPPS) - process.schedule.append(process.directSim) return process def setupPPSDirectSimMiniAOD(process): - process.load('SimPPS.Configuration.directSimPPS_cff') - process.load('RecoPPS.Configuration.recoCTPPS_cff') + setupPPSDirectSim(process) from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsMiniAOD matchDirectSimOutputsMiniAOD(process) - process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", - beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849)), - ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) - ) - process.directSim = cms.Path(process.directSimPPS * process.recoDirectSimPPS) - process.schedule.append(process.directSim) return process From 9edfb945b0c04baaef047409aeab9de7e24f169e Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Tue, 7 Jun 2022 18:10:38 +0200 Subject: [PATCH 17/18] Validation: simplification/sanitisation of validation template, set (x,y,z) offset to 0 --- Validation/CTPPS/test/simu/template_cfg.py | 66 ++++++++++------------ 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/Validation/CTPPS/test/simu/template_cfg.py b/Validation/CTPPS/test/simu/template_cfg.py index 5ec907b08193c..6717d3facd383 100644 --- a/Validation/CTPPS/test/simu/template_cfg.py +++ b/Validation/CTPPS/test/simu/template_cfg.py @@ -4,11 +4,8 @@ process = cms.Process('CTPPSTest', $ERA) process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('IOMC.EventVertexGenerators.beamDivergenceVtxGenerator_cfi') -# start with RECO, then direct SIM as geometry ESSource is overridden -process.load('RecoPPS.Configuration.recoCTPPS_cff') -process.load('SimPPS.Configuration.directSimPPS_cff') process.load('Validation.CTPPS.ctppsLHCInfoPlotter_cfi') +process.load('Configuration.Generator.randomXiThetaGunProducer_cfi') process.load("CondCore.CondDB.CondDB_cfi") # minimal logger settings @@ -20,6 +17,11 @@ ) ) +# particle generator +process.generator.xi_max = 0.25 +process.generator.theta_x_sigma = 60.e-6 +process.generator.theta_y_sigma = 60.e-6 + # default source process.source = cms.Source("EmptySource", firstRun = cms.untracked.uint32(1), @@ -34,14 +36,6 @@ )) ) -# particle generator -from Configuration.Generator.randomXiThetaGunProducer_cfi import generator as _gen -process.generator = _gen.clone( - xi_max = 0.25, - theta_x_sigma = 60.e-6, - theta_y_sigma = 60.e-6 -) - # random seeds process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService", sourceSeed = cms.PSet(initialSeed = cms.untracked.uint32(98765)), @@ -50,9 +44,6 @@ ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981)) ) -from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputs -matchDirectSimOutputs(process) - # number of events process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(int($N_EVENTS)) @@ -64,12 +55,6 @@ # track distribution plotter process.ctppsTrackDistributionPlotter = cms.EDAnalyzer("CTPPSTrackDistributionPlotter", tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), - - rpId_45_F = process.rpIds.rp_45_F, - rpId_45_N = process.rpIds.rp_45_N, - rpId_56_N = process.rpIds.rp_56_N, - rpId_56_F = process.rpIds.rp_56_F, - outputFile = cms.string("$OUT_TRACKS") ) @@ -78,24 +63,35 @@ tagTracks = cms.InputTag("ctppsLocalTrackLiteProducer"), tagRecoProtonsSingleRP = cms.InputTag("ctppsProtons", "singleRP"), tagRecoProtonsMultiRP = cms.InputTag("ctppsProtons", "multiRP"), - - rpId_45_F = process.rpIds.rp_45_F, - rpId_45_N = process.rpIds.rp_45_N, - rpId_56_N = process.rpIds.rp_56_N, - rpId_56_F = process.rpIds.rp_56_F, - outputFile = cms.string("$OUT_PROTONS") ) -# processing path -process.p = cms.Path( - process.generator - * process.beamDivergenceVtxGenerator - - * process.directSimPPS - * process.recoDirectSimPPS +process.generation = cms.Path(process.generator) - * process.ctppsLHCInfoPlotter +process.validation = cms.Path( + process.ctppsLHCInfoPlotter * process.ctppsTrackDistributionPlotter * process.ctppsProtonReconstructionPlotter ) + +# processing path +process.schedule = cms.Schedule( + process.generation, + process.validation +) + +from SimPPS.Configuration.Utils import setupPPSDirectSim +setupPPSDirectSim(process) + +process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetX45 = 0. +process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetY45 = 0. +process.ctppsBeamParametersFromLHCInfoESSource.vtxOffsetZ45 = 0. +process.source.numberEventsInLuminosityBlock = process.ctppsCompositeESSource.generateEveryNEvents +process.ctppsTrackDistributionPlotter.rpId_45_F = process.rpIds.rp_45_F +process.ctppsTrackDistributionPlotter.rpId_45_N = process.rpIds.rp_45_N +process.ctppsTrackDistributionPlotter.rpId_56_N = process.rpIds.rp_56_N +process.ctppsTrackDistributionPlotter.rpId_56_F = process.rpIds.rp_56_F +process.ctppsProtonReconstructionPlotter.rpId_45_F = process.rpIds.rp_45_F +process.ctppsProtonReconstructionPlotter.rpId_45_N = process.rpIds.rp_45_N +process.ctppsProtonReconstructionPlotter.rpId_56_N = process.rpIds.rp_56_N +process.ctppsProtonReconstructionPlotter.rpId_56_F = process.rpIds.rp_56_F From 88979055196fea34e1f42266149d86954e4aff00 Mon Sep 17 00:00:00 2001 From: Laurent Forthomme Date: Fri, 29 Jul 2022 17:12:00 +0200 Subject: [PATCH 18/18] More 2021->2022 PPS era modifications --- EventFilter/CTPPSRawToDigi/python/ctppsDigiToRaw_cff.py | 6 +++--- EventFilter/RawDataCollector/python/rawDataCollector_cfi.py | 4 ++-- SimGeneral/MixingModule/python/mixObjects_cfi.py | 4 ++-- SimTransport/PPSProtonTransport/python/PPSTransport_cff.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsDigiToRaw_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsDigiToRaw_cff.py index fec70961835d6..51fd91185b809 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsDigiToRaw_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsDigiToRaw_cff.py @@ -7,7 +7,7 @@ ctppsRawData = cms.Task() # The comment lines below will be included in the next PR for Run2 -#from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 +#from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 #ctpps_2016.toReplaceWith(ctppsRawData, cms.Task(ctppsTotemRawData)) #from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 @@ -16,5 +16,5 @@ #from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 #ctpps_2018.toReplaceWith(ctppsRawData, cms.Task(ctppsPixelRawData)) -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -ctpps_2021.toReplaceWith(ctppsRawData, cms.Task(ctppsPixelRawData)) +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 +ctpps_2022.toReplaceWith(ctppsRawData, cms.Task(ctppsPixelRawData)) diff --git a/EventFilter/RawDataCollector/python/rawDataCollector_cfi.py b/EventFilter/RawDataCollector/python/rawDataCollector_cfi.py index 2073d90f9f79e..1399733403726 100644 --- a/EventFilter/RawDataCollector/python/rawDataCollector_cfi.py +++ b/EventFilter/RawDataCollector/python/rawDataCollector_cfi.py @@ -36,8 +36,8 @@ run3_GEM.toModify( rawDataCollector.RawCollectionList, func = lambda list: list.append(cms.InputTag("gemPacker")) ) # For Run2 it is needed to include the general ctpps era ctpps_2016 -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -ctpps_2021.toModify(rawDataCollector.RawCollectionList, func = lambda list: list.extend([cms.InputTag("ctppsTotemRawData"),cms.InputTag("ctppsPixelRawData")]) ) +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 +ctpps_2022.toModify(rawDataCollector.RawCollectionList, func = lambda list: list.extend([cms.InputTag("ctppsTotemRawData"),cms.InputTag("ctppsPixelRawData")]) ) # Phase-2 Tracker from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker diff --git a/SimGeneral/MixingModule/python/mixObjects_cfi.py b/SimGeneral/MixingModule/python/mixObjects_cfi.py index 7e178d4ea3acf..8644ee7a254fd 100644 --- a/SimGeneral/MixingModule/python/mixObjects_cfi.py +++ b/SimGeneral/MixingModule/python/mixObjects_cfi.py @@ -305,8 +305,8 @@ ) ) -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -ctpps_2021.toModify( theMixObjects, +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 +ctpps_2022.toModify( theMixObjects, mixSH = dict( input = theMixObjects.mixSH.input + [ cms.InputTag("g4SimHits","TotemHitsRP"),cms.InputTag("g4SimHits","CTPPSPixelHits") ], subdets = theMixObjects.mixSH.subdets + [ 'TotemHitsRP', 'CTPPSPixelHits' ], diff --git a/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py b/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py index ed23c0fadb786..bdf7a80564d8f 100644 --- a/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py +++ b/SimTransport/PPSProtonTransport/python/PPSTransport_cff.py @@ -27,8 +27,8 @@ ctpps_2018.toReplaceWith(_LHCTransportPSet,_hector_2018) #ctpps_2018.toReplaceWith(_LHCTransportPSet,_opticalfunctionsTransportSetup_2018) -from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 +from Configuration.Eras.Modifier_ctpps_2022_cff import ctpps_2022 #ctpps_2021.toReplaceWith(_LHCTransportPSet, _hector_2021) # there is no LHCInfo tag for Run3 yet, force to use a nonDB propagation -ctpps_2021.toReplaceWith(_LHCTransportPSet, _opticalfunctionsTransportSetup_2021) # there is no LHCInfo tag for Run3 yet, force to use a nonDB propagation +ctpps_2022.toReplaceWith(_LHCTransportPSet, _opticalfunctionsTransportSetup_2021) # there is no LHCInfo tag for Run3 yet, force to use a nonDB propagation LHCTransport = cms.EDProducer("PPSSimTrackProducer",_commonParameters,_LHCTransportPSet)