From 0ca6fd507017cb0feef04a7b0c797d9668fd20c2 Mon Sep 17 00:00:00 2001 From: francescobrivio Date: Thu, 23 Nov 2023 09:45:02 +0100 Subject: [PATCH] Read VertexSmearing from GT in Run-1/2/3 MC --- .../python/upgradeWorkflowComponents.py | 28 +++++++++---------- .../StandardSequences/python/VtxSmeared.py | 2 ++ .../interface/BetafuncEvtVtxGenerator.h | 3 ++ .../interface/GaussEvtVtxGenerator.h | 3 ++ .../python/VtxSmearedDesign_cfi.py | 8 ++++++ .../python/VtxSmearedRealistic_cfi.py | 8 ++++++ .../src/BetafuncEvtVtxGenerator.cc | 19 +++++++++++-- .../src/GaussEvtVtxGenerator.cc | 20 +++++++++---- 8 files changed, 69 insertions(+), 22 deletions(-) create mode 100644 IOMC/EventVertexGenerators/python/VtxSmearedDesign_cfi.py create mode 100644 IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index d6dd761188b14..b8f8e06536708 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -2566,7 +2566,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2017_design', 'HLTmenu': '@relval2017', 'Era' : 'Run2_2017', - 'BeamSpot': 'GaussSigmaZ4cm', + 'BeamSpot': 'DBdesign', 'ScenToRun' : ['GenSim','Digi','RecoFakeHLT','HARVESTFakeHLT'], }, '2018' : { @@ -2574,7 +2574,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2018_realistic', 'HLTmenu': '@relval2018', 'Era' : 'Run2_2018', - 'BeamSpot': 'Realistic25ns13TeVEarly2018Collision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoFakeHLT','HARVESTFakeHLT','ALCA','Nano'], }, '2018Design' : { @@ -2582,7 +2582,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2018_design', 'HLTmenu': '@relval2018', 'Era' : 'Run2_2018', - 'BeamSpot': 'GaussSigmaZ4cm', + 'BeamSpot': 'DBdesign', 'ScenToRun' : ['GenSim','Digi','RecoFakeHLT','HARVESTFakeHLT'], }, '2021' : { @@ -2590,7 +2590,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2022_realistic', 'HLTmenu': '@relval2022', 'Era' : 'Run3', - 'BeamSpot': 'Realistic25ns13p6TeVEOY2022Collision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNanoFakeHLT','HARVESTNanoFakeHLT','ALCA'], }, '2021Design' : { @@ -2598,7 +2598,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2022_design', 'HLTmenu': '@relval2022', 'Era' : 'Run3', - 'BeamSpot': 'GaussSigmaZ4cm', + 'BeamSpot': 'DBdesign', 'ScenToRun' : ['GenSim','Digi','RecoNanoFakeHLT','HARVESTNanoFakeHLT'], }, '2023' : { @@ -2606,7 +2606,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2023_realistic', 'HLTmenu': '@relval2023', 'Era' : 'Run3_2023', - 'BeamSpot': 'Realistic25ns13p6TeVEarly2023Collision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], }, '2024' : { @@ -2614,7 +2614,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2024_realistic', 'HLTmenu': '@relval2023', 'Era' : 'Run3', - 'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], }, '2021FS' : { @@ -2622,7 +2622,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2022_realistic', 'HLTmenu': '@relval2022', 'Era' : 'Run3_FastSim', - 'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['Gen','FastSimRun3','HARVESTFastRun3'], }, '2021postEE' : { @@ -2630,7 +2630,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2022_realistic_postEE', 'HLTmenu': '@relval2022', 'Era' : 'Run3', - 'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNanoFakeHLT','HARVESTNanoFakeHLT','ALCA'], }, '2023FS' : { @@ -2638,7 +2638,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT' : 'auto:phase1_2023_realistic', 'HLTmenu': '@relval2023', 'Era' : 'Run3_2023_FastSim', - 'BeamSpot': 'Realistic25ns13p6TeVEarly2023Collision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['Gen','FastSimRun3','HARVESTFastRun3'], }, '2022HI' : { @@ -2646,7 +2646,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT':'auto:phase1_2022_realistic_hi', 'HLTmenu': '@fake2', 'Era':'Run3_pp_on_PbPb', - 'BeamSpot': 'Realistic2022PbPbCollision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], }, '2022HIRP' : { @@ -2654,7 +2654,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT':'auto:phase1_2022_realistic_hi', 'HLTmenu': '@fake2', 'Era':'Run3_pp_on_PbPb_approxSiStripClusters', - 'BeamSpot': 'Realistic2022PbPbCollision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], }, '2023HI' : { @@ -2662,7 +2662,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT':'auto:phase1_2023_realistic_hi', 'HLTmenu': '@fake2', 'Era':'Run3_pp_on_PbPb', - 'BeamSpot': 'Realistic2022PbPbCollision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], }, '2023HIRP' : { @@ -2670,7 +2670,7 @@ def condition(self, fragment, stepList, key, hasHarvest): 'GT':'auto:phase1_2023_realistic_hi', 'HLTmenu': '@fake2', 'Era':'Run3_pp_on_PbPb_approxSiStripClusters', - 'BeamSpot': 'Realistic2022PbPbCollision', + 'BeamSpot': 'DBrealistic', 'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'], } } diff --git a/Configuration/StandardSequences/python/VtxSmeared.py b/Configuration/StandardSequences/python/VtxSmeared.py index 86a670e2a013d..f3018eacc42ca 100644 --- a/Configuration/StandardSequences/python/VtxSmeared.py +++ b/Configuration/StandardSequences/python/VtxSmeared.py @@ -1,4 +1,6 @@ VtxSmeared = { + 'DBdesign': 'IOMC.EventVertexGenerators.VtxSmearedDesign_cfi', + 'DBrealistic': 'IOMC.EventVertexGenerators.VtxSmearedRealistic_cfi', 'NoSmear': 'Configuration.StandardSequences.VtxSmearedNoSmear_cff', 'BetafuncEarlyCollision': 'IOMC.EventVertexGenerators.VtxSmearedBetafuncEarlyCollision_cfi', 'BeamProfile': 'IOMC.EventVertexGenerators.VtxSmearedBeamProfile_cfi', diff --git a/IOMC/EventVertexGenerators/interface/BetafuncEvtVtxGenerator.h b/IOMC/EventVertexGenerators/interface/BetafuncEvtVtxGenerator.h index 777dd1607393a..2e1703d760548 100644 --- a/IOMC/EventVertexGenerators/interface/BetafuncEvtVtxGenerator.h +++ b/IOMC/EventVertexGenerators/interface/BetafuncEvtVtxGenerator.h @@ -20,6 +20,7 @@ ________________________________________________________________________ #include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h" #include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/ESGetToken.h" #include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h" #include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h" @@ -37,6 +38,8 @@ class BetafuncEvtVtxGenerator : public BaseEvtVtxGenerator { BetafuncEvtVtxGenerator& operator=(const BetafuncEvtVtxGenerator& rhs) = delete; ~BetafuncEvtVtxGenerator() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; /// return a new event vertex diff --git a/IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h b/IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h index 6bbea9c0821aa..b0a05ddb5b647 100644 --- a/IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h +++ b/IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h @@ -9,6 +9,7 @@ #include "IOMC/EventVertexGenerators/interface/BaseEvtVtxGenerator.h" #include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/ESGetToken.h" #include "CondFormats/DataRecord/interface/SimBeamSpotObjectsRcd.h" #include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h" @@ -26,6 +27,8 @@ class GaussEvtVtxGenerator : public BaseEvtVtxGenerator { GaussEvtVtxGenerator& operator=(const GaussEvtVtxGenerator& rhs) = delete; ~GaussEvtVtxGenerator() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; /// return a new event vertex diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedDesign_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedDesign_cfi.py new file mode 100644 index 0000000000000..028b87e24c3af --- /dev/null +++ b/IOMC/EventVertexGenerators/python/VtxSmearedDesign_cfi.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms + +# Load GaussEvtVtxGenerator and read parameters from GT (SimBeamSpotObjectRcd) +from IOMC.EventVertexGenerators.GaussEvtVtxGenerator_cfi import GaussEvtVtxGenerator +VtxSmeared = GaussEvtVtxGenerator.clone( + src = "generator:unsmeared", + readDB = True +) diff --git a/IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py new file mode 100644 index 0000000000000..20d5d739746cb --- /dev/null +++ b/IOMC/EventVertexGenerators/python/VtxSmearedRealistic_cfi.py @@ -0,0 +1,8 @@ +import FWCore.ParameterSet.Config as cms + +# Load BetafuncEvtVtxGenerator and read parameters from GT (SimBeamSpotObjectRcd) +from IOMC.EventVertexGenerators.BetafuncEvtVtxGenerator_cfi import BetafuncEvtVtxGenerator +VtxSmeared = BetafuncEvtVtxGenerator.clone( + src = "generator:unsmeared", + readDB = True +) diff --git a/IOMC/EventVertexGenerators/src/BetafuncEvtVtxGenerator.cc b/IOMC/EventVertexGenerators/src/BetafuncEvtVtxGenerator.cc index 125169fba39a5..89932a409da85 100644 --- a/IOMC/EventVertexGenerators/src/BetafuncEvtVtxGenerator.cc +++ b/IOMC/EventVertexGenerators/src/BetafuncEvtVtxGenerator.cc @@ -24,11 +24,8 @@ ________________________________________________________________________ #include "CLHEP/Random/RandGaussQ.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" #include "CLHEP/Units/GlobalPhysicalConstants.h" -//#include "CLHEP/Vector/ThreeVector.h" #include "HepMC/SimpleVector.h" -#include - BetafuncEvtVtxGenerator::BetafuncEvtVtxGenerator(const edm::ParameterSet& p) : BaseEvtVtxGenerator(p), boost_(4, 4) { readDB_ = p.getParameter("readDB"); if (!readDB_) { @@ -140,3 +137,19 @@ void BetafuncEvtVtxGenerator::sigmaZ(double s) { } TMatrixD const* BetafuncEvtVtxGenerator::GetInvLorentzBoost() const { return &boost_; } + +void BetafuncEvtVtxGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("X0", 0.0)->setComment("in cm"); + desc.add("Y0", 0.0)->setComment("in cm"); + desc.add("Z0", 0.0)->setComment("in cm"); + desc.add("SigmaZ", 0.0)->setComment("in cm"); + desc.add("BetaStar", 0.0)->setComment("in cm"); + desc.add("Emittance", 0.0)->setComment("in cm"); + desc.add("Alpha", 0.0)->setComment("in radians"); + desc.add("Phi", 0.0)->setComment("in radians"); + desc.add("TimeOffset", 0.0)->setComment("in ns"); + desc.add("src"); + desc.add("readDB"); + descriptions.add("BetafuncEvtVtxGenerator", desc); +} diff --git a/IOMC/EventVertexGenerators/src/GaussEvtVtxGenerator.cc b/IOMC/EventVertexGenerators/src/GaussEvtVtxGenerator.cc index a45a096fbfaa4..103a420b67a2b 100644 --- a/IOMC/EventVertexGenerators/src/GaussEvtVtxGenerator.cc +++ b/IOMC/EventVertexGenerators/src/GaussEvtVtxGenerator.cc @@ -1,14 +1,10 @@ - - #include "IOMC/EventVertexGenerators/interface/GaussEvtVtxGenerator.h" -#include "FWCore/Utilities/interface/Exception.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/Exception.h" #include "CLHEP/Random/RandGaussQ.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" #include "CLHEP/Units/GlobalPhysicalConstants.h" -//#include "CLHEP/Vector/ThreeVector.h" #include "HepMC/SimpleVector.h" GaussEvtVtxGenerator::GaussEvtVtxGenerator(const edm::ParameterSet& p) : BaseEvtVtxGenerator(p) { @@ -95,3 +91,17 @@ void GaussEvtVtxGenerator::sigmaZ(double s) { << "Illegal resolution in Z (negative)"; } } + +void GaussEvtVtxGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("MeanX", 0.0)->setComment("in cm"); + desc.add("MeanY", 0.0)->setComment("in cm"); + desc.add("MeanZ", 0.0)->setComment("in cm"); + desc.add("SigmaX", 0.0)->setComment("in cm"); + desc.add("SigmaY", 0.0)->setComment("in cm"); + desc.add("SigmaZ", 0.0)->setComment("in cm"); + desc.add("TimeOffset", 0.0)->setComment("in ns"); + desc.add("src"); + desc.add("readDB"); + descriptions.add("GaussEvtVtxGenerator", desc); +}