From 9bb1b99b85d8b55734741acca678825a713951b8 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 7 Oct 2020 16:38:09 +0200 Subject: [PATCH 01/10] Sub-event aware genJet clustering for HI miniAOD --- .../python/Modifier_genJetSubEvent_cff.py | 4 + .../plugins/HiSignalGenJetProducer.cc | 138 ++++++++++++++++++ .../plugins/HiSignalParticleProducer.cc | 131 +++++++++++++++++ .../python/HiSignalGenJetProducer_cfi.py | 7 + .../python/HiSignalParticleProducer_cfi.py | 7 + 5 files changed, 287 insertions(+) create mode 100644 Configuration/Eras/python/Modifier_genJetSubEvent_cff.py create mode 100644 RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc create mode 100644 RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc create mode 100644 RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py create mode 100644 RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py diff --git a/Configuration/Eras/python/Modifier_genJetSubEvent_cff.py b/Configuration/Eras/python/Modifier_genJetSubEvent_cff.py new file mode 100644 index 0000000000000..dd720566cdebf --- /dev/null +++ b/Configuration/Eras/python/Modifier_genJetSubEvent_cff.py @@ -0,0 +1,4 @@ +import FWCore.ParameterSet.Config as cms + +genJetSubEvent = cms.Modifier() + diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc new file mode 100644 index 0000000000000..84c004698fd98 --- /dev/null +++ b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc @@ -0,0 +1,138 @@ +// -*- C++ -*- +// +// Package: HiSignalGenJetProducer +// Class: HiSignalGenJetProducer +// +/**\class HiSignalGenJetProducer HiSignalGenJetProducer.cc yetkin/HiSignalGenJetProducer/src/HiSignalGenJetProducer.cc + + Description: + + Implementation: + +*/ +// +// Original Author: Yetkin Yilmaz +// Created: Tue Jul 21 04:26:01 EDT 2009 +// +// + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/Common/interface/View.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/GeometryVector/interface/VectorUtil.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" + +#include "DataFormats/Math/interface/Point3D.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +using namespace std; +using namespace edm; + + +// +// class decleration +// + +class HiSignalGenJetProducer : public edm::EDProducer { +public: + explicit HiSignalGenJetProducer(const edm::ParameterSet&); + ~HiSignalGenJetProducer(); + + private: + virtual void produce(edm::Event&, const edm::EventSetup&) override; + // ----------member data --------------------------- + + edm::EDGetTokenT > jetSrc_; + +}; + +// +// constants, enums and typedefs +// + + +// +// static data member definitions +// + +// +// constructors and destructor +// + +HiSignalGenJetProducer::HiSignalGenJetProducer(const edm::ParameterSet& iConfig) : + jetSrc_(consumes >(iConfig.getParameter("src"))) +{ + std::string alias = (iConfig.getParameter( "src")).label(); + produces().setBranchAlias (alias); +} + +HiSignalGenJetProducer::~HiSignalGenJetProducer() +{ + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) +} + + +// +// member functions +// + +// ------------ method called to produce the data ------------ + +void +HiSignalGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + using namespace edm; + using namespace reco; + + auto jets = std::make_unique(); + + edm::Handle > genjets; + iEvent.getByToken(jetSrc_,genjets); + + int jetsize = genjets->size(); + + vector selection; + for(int ijet = 0; ijet < jetsize; ++ijet){ + selection.push_back(-1); + } + + vector selectedIndices; + vector removedIndices; + + for(int ijet = 0; ijet < jetsize; ++ijet){ + + const GenJet* jet1 = &((*genjets)[ijet]); + + const GenParticle* gencon = jet1->getGenConstituent(0); + + if(gencon == 0) throw cms::Exception("GenConstituent","GenJet is missing its constituents"); + else if(gencon->collisionId() == 0){ + jets->push_back(*jet1); + selection[ijet] = 1; + }else{ + selection[ijet] = 0; + removedIndices.push_back(ijet); + } + } + + iEvent.put(std::move(jets)); + +} + +DEFINE_FWK_MODULE(HiSignalGenJetProducer); + + diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc new file mode 100644 index 0000000000000..47ae0efbb513c --- /dev/null +++ b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc @@ -0,0 +1,131 @@ +// -*- C++ -*- +// +// Package: HiSignalParticleProducer +// Class: HiSignalParticleProducer +// +/**\class HiSignalParticleProducer HiSignalParticleProducer.cc yetkin/HiSignalParticleProducer/src/HiSignalParticleProducer.cc + Description: + Implementation: + +*/ +// +// Original Author: Yetkin Yilmaz +// Created: Tue Jul 21 04:26:01 EDT 2009 +// +// + +// system include files +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DataFormats/Common/interface/View.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/GeometryVector/interface/VectorUtil.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" + +#include "DataFormats/Math/interface/Point3D.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +using namespace std; +using namespace edm; + + +// +// class decleration +// + +class HiSignalParticleProducer : public edm::EDProducer { +public: + explicit HiSignalParticleProducer(const edm::ParameterSet&); + ~HiSignalParticleProducer(); + +private: + virtual void produce(edm::Event&, const edm::EventSetup&) override; + // ----------member data --------------------------- + + edm::EDGetTokenT > genParticleSrc_; + +}; + +// +// constants, enums and typedefs +// + + +// +// static data member definitions +// + +// +// constructors and destructor +// + +HiSignalParticleProducer::HiSignalParticleProducer(const edm::ParameterSet& iConfig) : + genParticleSrc_(consumes >(iConfig.getParameter("src"))) +{ + std::string alias = (iConfig.getParameter( "src")).label(); + produces().setBranchAlias (alias); +} + +HiSignalParticleProducer::~HiSignalParticleProducer() +{ + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) +} + + +// +// member functions +// + +// ------------ method called to produce the data ------------ + +void +HiSignalParticleProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + using namespace edm; + using namespace reco; + + auto signalGenParticles = std::make_unique(); + + edm::Handle > genParticles; + iEvent.getByToken(genParticleSrc_,genParticles); + + int genParticleSize = genParticles->size(); + + vector selection; + for(int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle){ + selection.push_back(-1); + } + + vector selectedIndices; + vector removedIndices; + + for(int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle){ + + const GenParticle* genParticle = &((*genParticles)[igenParticle]); + if(genParticle->collisionId() == 0){ + signalGenParticles->push_back(*genParticle); + selection[igenParticle] = 1; + }else{ + selection[igenParticle] = 0; + removedIndices.push_back(igenParticle); + } + } + + iEvent.put(std::move(signalGenParticles)); + +} + +DEFINE_FWK_MODULE(HiSignalParticleProducer); diff --git a/RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py b/RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py new file mode 100644 index 0000000000000..63a2d3af8e6c6 --- /dev/null +++ b/RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + + +hiSignalGenJets = cms.EDProducer('HiSignalGenJetProducer', + src = cms.InputTag('ak4HiGenJets') + ) + diff --git a/RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py b/RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py new file mode 100644 index 0000000000000..08645ffecb98e --- /dev/null +++ b/RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + + +hiSignalGenParticles = cms.EDProducer('HiSignalParticleProducer', + src = cms.InputTag('genParticles') + ) + From fb1c4968c167fb46ed1afbda37b5283bc9e9d9e3 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 7 Oct 2020 16:39:39 +0200 Subject: [PATCH 02/10] Oops, not all files were staged --- .../python/relval_standard.py | 6 ++--- .../python/relval_steps.py | 19 ++++++++++++++- .../StandardSequences/python/Eras.py | 3 ++- .../PatAlgos/plugins/PATGenJetSlimmer.cc | 3 ++- .../python/mcMatchLayer0/jetMatch_cfi.py | 6 +---- .../producersHeavyIons/heavyIonJets_cff.py | 23 ++++++++++++++----- .../PatAlgos/python/slimming/miniAOD_tools.py | 4 ++++ .../python/slimming/slimmedGenJets_cfi.py | 3 +++ .../plugins/SubEventGenJetProducer.cc | 9 ++++---- .../plugins/SubEventGenJetProducer.h | 3 ++- 10 files changed, 56 insertions(+), 23 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_standard.py b/Configuration/PyReleaseValidation/python/relval_standard.py index 4c0ddec48d777..f9fcc63844c93 100644 --- a/Configuration/PyReleaseValidation/python/relval_standard.py +++ b/Configuration/PyReleaseValidation/python/relval_standard.py @@ -700,14 +700,14 @@ workflows[148] = ['',['HydjetQ_MinBias_XeXe_5442GeV_2017','DIGIHI2017','RECOHI2017','HARVESTHI2017']] ### Run II cond., 2018 workflows[150] = ['',['HydjetQ_B12_5020GeV_2018','DIGIHI2018','RECOHI2018','HARVESTHI2018']] -workflows[158] = ['',['HydjetQ_B12_5020GeV_2018_ppReco','DIGIHI2018PPRECO','RECOHI2018PPRECO','ALCARECOHI2018PPRECO','HARVESTHI2018PPRECO']] -workflows[158.01] = ['',['HydjetQ_reminiaodPbPb2018_INPUT','REMINIAODHI2018PPRECO','HARVESTHI2018PPRECOMINIAOD']] +workflows[158] = ['',['HydjetQ_B12_5020GeV_2018_ppReco','DIGIHI2018PPRECO','RECOHI2018PPRECOMB','ALCARECOHI2018PPRECO','HARVESTHI2018PPRECO']] +workflows[158.01] = ['',['HydjetQ_reminiaodPbPb2018_INPUT','REMINIAODHI2018PPRECOMB','HARVESTHI2018PPRECOMINIAOD']] workflows[158.1] = ['',['QCD_Pt_80_120_13_HI','DIGIHI2018PPRECO','RECOHI2018PPRECO','HARVESTHI2018PPRECO']] workflows[158.2] = ['',['PhotonJets_Pt_10_13_HI','DIGIHI2018PPRECO','RECOHI2018PPRECO','HARVESTHI2018PPRECO']] workflows[158.3] = ['',['ZEEMM_13_HI','DIGIHI2018PPRECO','RECOHI2018PPRECO','HARVESTHI2018PPRECO']] # 158.0 with multiple concurrent lumi sections workflows[158.181] = ['',['HydjetQ_B12_5020GeV_2018_ppReco_ml','DIGIHI2018PPRECOml','RECOHI2018PPRECOml','ALCARECOHI2018PPRECOml','HARVESTHI2018PPRECO']] -workflows[159] = ['',['HydjetQ_B12_5020GeV_2021_ppReco','DIGIHI2021PPRECO','RECOHI2021PPRECO','ALCARECOHI2021PPRECO','HARVESTHI2021PPRECO']] +workflows[159] = ['',['HydjetQ_B12_5020GeV_2021_ppReco','DIGIHI2021PPRECO','RECOHI2021PPRECOMB','ALCARECOHI2021PPRECO','HARVESTHI2021PPRECO']] workflows[159.1] = ['',['QCD_Pt_80_120_14_HI_2021','DIGIHI2021PPRECO','RECOHI2021PPRECO','HARVESTHI2021PPRECO']] workflows[159.2] = ['',['PhotonJets_Pt_10_14_HI_2021','DIGIHI2021PPRECO','RECOHI2021PPRECO','HARVESTHI2021PPRECO']] workflows[159.3] = ['',['ZMM_14_HI_2021','DIGIHI2021PPRECO','RECOHI2021PPRECO','HARVESTHI2021PPRECO']] diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 48f983da0ea1b..3d7c2b346a3d9 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -967,6 +967,8 @@ def genS(fragment,howMuch): hiAlca2018 = {'--conditions':'auto:phase1_2018_realistic', '--era':'Run2_2018'} hiAlca2018_ppReco = {'--conditions':'auto:phase1_2018_realistic_hi', '--era':'Run2_2018_pp_on_AA'} hiAlca2021_ppReco = {'--conditions':'auto:phase1_2021_realistic_hi', '--era':'Run3_pp_on_PbPb'} +hiAlca2018_ppReco_mb = {'--conditions':'auto:phase1_2018_realistic_hi', '--era':'Run2_2018_pp_on_AA,genJetSubEvent'} +hiAlca2021_ppReco_mb = {'--conditions':'auto:phase1_2021_realistic_hi', '--era':'Run3_pp_on_PbPb,genJetSubEvent'} hiDefaults2011=merge([hiAlca2011,{'--scenario':'HeavyIons','-n':2}]) @@ -975,6 +977,8 @@ def genS(fragment,howMuch): hiDefaults2018=merge([hiAlca2018,{'--scenario':'HeavyIons','-n':2}]) hiDefaults2018_ppReco=merge([hiAlca2018_ppReco,{'-n':2}]) hiDefaults2021_ppReco=merge([hiAlca2021_ppReco,{'-n':2}]) +hiDefaults2018_ppReco_mb=merge([hiAlca2018_ppReco_mb,{'-n':2}]) +hiDefaults2021_ppReco_mb=merge([hiAlca2021_ppReco_mb,{'-n':2}]) steps['HydjetQ_B12_5020GeV_2011']=merge([{'-n':1,'--beamspot':'RealisticHI2011Collision'},hiDefaults2011,genS('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) steps['HydjetQ_B12_5020GeV_2015']=merge([{'-n':1,'--beamspot':'RealisticHICollisionFixZ2015'},hiDefaults2015,genS('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) @@ -2474,6 +2478,10 @@ def gen2021HiMix(fragment,howMuch): '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO', '--eventcontent':'RECOSIM,MINIAODSIM,DQM', },step3Up2015Defaults]) +steps['RECOHI2021PPRECOMB']=merge([hiDefaults2021_ppReco_mb,{'-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM', + '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO', + '--eventcontent':'RECOSIM,MINIAODSIM,DQM', + },step3Up2015Defaults]) steps['ALCARECOHI2021PPRECO']=merge([hiDefaults2021_ppReco,{'-s':'ALCA:TkAlMinBias+SiStripCalMinBias', '--datatier':'ALCARECO', @@ -2484,13 +2492,22 @@ def gen2021HiMix(fragment,howMuch): '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO,ALCARECO', '--eventcontent':'RECOSIM,MINIAODSIM,DQM,ALCARECO', },step3Up2015Defaults]) -steps['RECOHI2018PPRECOml']=merge([concurrentLumis,steps['RECOHI2018PPRECO']]) +steps['RECOHI2018PPRECOMB']=merge([hiDefaults2018_ppReco_mb,{'-s':'RAW2DIGI,L1Reco,RECO,ALCA:SiStripCalZeroBias+SiPixelCalZeroBias,EI,PAT,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM', + '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO,ALCARECO', + '--eventcontent':'RECOSIM,MINIAODSIM,DQM,ALCARECO', + },step3Up2015Defaults]) +steps['RECOHI2018PPRECOml']=merge([concurrentLumis,steps['RECOHI2018PPRECOMB']]) steps['REMINIAODHI2018PPRECO']=merge([{'-s':'PAT,VALIDATION:@miniAODValidation,DQM:@miniAODDQM', '--datatier':'MINIAODSIM,DQMIO', '--eventcontent':'MINIAODSIM,DQM', '-n':100, },hiDefaults2018_ppReco,step3Up2015Defaults]) +steps['REMINIAODHI2018PPRECOMB']=merge([{'-s':'PAT,VALIDATION:@miniAODValidation,DQM:@miniAODDQM', + '--datatier':'MINIAODSIM,DQMIO', + '--eventcontent':'MINIAODSIM,DQM', + '-n':100, + },hiDefaults2018_ppReco_mb,step3Up2015Defaults]) steps['ALCARECOHI2018PPRECO']=merge([hiDefaults2018_ppReco,{'-s':'ALCA:TkAlMinBias+SiStripCalMinBias', '--datatier':'ALCARECO', diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 5f5524eb6176a..2b8f78edd8c01 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -66,7 +66,8 @@ def __init__(self): 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'hcalHardcodeConditions', 'hcalSkipPacker', 'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018', - 'bParking'] + 'bParking', + 'genJetSubEvent'] internalUseModChains = ['run2_2017_noTrackingModifier'] self.pythonCfgLines = {} diff --git a/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc b/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc index 57941ba94ac1c..8005033c9dd3b 100644 --- a/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATGenJetSlimmer.cc @@ -76,6 +76,7 @@ void pat::PATGenJetSlimmer::produce(edm::Event& iEvent, const edm::EventSetup& i auto mapping = std::make_unique >(); mapping->reserve(src->size()); + unsigned nm = 0; // number of mapped jets unsigned nl = 0; // number of loose jets for (View::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) { bool selectedLoose = false; @@ -93,7 +94,7 @@ void pat::PATGenJetSlimmer::produce(edm::Event& iEvent, const edm::EventSetup& i out->push_back(*it); reco::GenJet& jet = out->back(); - mapping->push_back(it - src->begin()); + mapping->push_back(nm++); if (clearDaughters_) { jet.clearDaughters(); diff --git a/PhysicsTools/PatAlgos/python/mcMatchLayer0/jetMatch_cfi.py b/PhysicsTools/PatAlgos/python/mcMatchLayer0/jetMatch_cfi.py index 5b2c208f48e84..7a104c6646a03 100644 --- a/PhysicsTools/PatAlgos/python/mcMatchLayer0/jetMatch_cfi.py +++ b/PhysicsTools/PatAlgos/python/mcMatchLayer0/jetMatch_cfi.py @@ -30,13 +30,9 @@ from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3 (pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetGenJetMatch, - matched = 'ak4HiCleanedGenJets', maxDeltaR = 0.4, resolveByMatchQuality = True, src = "akCs4PFJets", ) -(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetPartonMatch, - matched = "cleanedPartons", - src = "akCs4PFJets", - ) +(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(patJetPartonMatch, src = "akCs4PFJets") diff --git a/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py b/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py index e142b148c6683..b3b56fb0f3c13 100644 --- a/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py +++ b/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py @@ -1,29 +1,40 @@ import FWCore.ParameterSet.Config as cms +from RecoHI.HiJetAlgos.HiSignalParticleProducer_cfi import hiSignalGenParticles from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJets from RecoHI.HiJetAlgos.HiGenCleaner_cff import hiPartons from RecoHI.HiJetAlgos.HiGenJets_cff import ak4HiGenJets from RecoHI.HiJetAlgos.HiGenCleaner_cff import heavyIonCleanedGenJets +from RecoHI.HiJetAlgos.HiSignalGenJetProducer_cfi import hiSignalGenJets allPartons = cms.EDProducer( "PartonSelector", - src = cms.InputTag('genParticles'), + src = cms.InputTag('hiSignalGenParticles'), withLeptons = cms.bool(False), ) +from Configuration.Eras.Modifier_genJetSubEvent_cff import genJetSubEvent +genJetSubEvent.toModify(allPartons,src = "genParticles") + cleanedPartons = hiPartons.clone( src = 'allPartons', ) -ak4HiGenJetsCleaned = heavyIonCleanedGenJets.clone(src = "ak4HiGenJets") +ak4HiSignalGenJets = hiSignalGenJets.clone(src = "ak4HiGenJets") -cleanedGenJetsTask = cms.Task( +hiGenJetsTask = cms.Task( + hiSignalGenParticles, genParticlesForJets, - cleanedPartons, + allPartons, ak4HiGenJets, - ak4HiGenJetsCleaned + ak4HiSignalGenJets ) +ak4HiGenJetsCleaned = heavyIonCleanedGenJets.clone(src = "ak4HiGenJets") +hiCleanedGenJetsTask_ = hiGenJetsTask.copyAndExclude([hiSignalGenParticles,ak4HiSignalGenJets]) +hiCleanedGenJetsTask_.add(cleanedPartons,ak4HiGenJetsCleaned) +genJetSubEvent.toReplaceWith(hiGenJetsTask,hiCleanedGenJetsTask_) + from RecoHI.HiJetAlgos.HiRecoPFJets_cff import PFTowers, pfEmptyCollection, ak4PFJetsForFlow, hiPuRho, hiFJRhoFlowModulation, akCs4PFJets from RecoHI.HiTracking.highPurityGeneralTracks_cfi import highPurityGeneralTracks from RecoJets.JetAssociationProducers.ak5JTA_cff import * @@ -62,5 +73,5 @@ recoJetsHIpostAODTask = cms.Task( recoPFJetsHIpostAODTask, allPartons, - cleanedGenJetsTask, + hiGenJetsTask, ) diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index b6981349253b1..c1652955fc706 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -588,6 +588,9 @@ def miniAOD_customizeMC(process): process.tauGenJetsBoosted.GenParticles = "prunedGenParticles" process.patJetPartons.particles = "genParticles" process.patJetPartonMatch.matched = "prunedGenParticles" + _hiGeneral.toModify(process.patJetPartonMatch, matched = "hiSignalGenParticles") + from Configuration.Eras.Modifier_genJetSubEvent_cff import genJetSubEvent + genJetSubEvent.toModify(process.patJetPartonMatch, matched = "cleanedPartons") process.patJetPartonMatch.mcStatus = [ 3, 23 ] process.patJetGenJetMatch.matched = "slimmedGenJets" (~_hiGeneral).toModify(process, patJetGenJetMatchAK8Puppi = dict(matched = "slimmedGenJetsAK8")) @@ -603,6 +606,7 @@ def miniAOD_customizeMC(process): from PhysicsTools.PatAlgos.producersHeavyIons.heavyIonJetSetup import removeJECsForMC _hiGeneral.toModify(process, removeJECsForMC) + _hiGeneral.toReplaceWith(task,task.copyAndExclude([process.slimmedGenJetsFlavourInfos])) def miniAOD_customizeOutput(out): diff --git a/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py b/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py index 83709c6d51c9b..afba82607a686 100644 --- a/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py +++ b/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py @@ -22,4 +22,7 @@ from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3 +(pp_on_AA_2018 | pp_on_PbPb_run3).toModify(slimmedGenJets, src = "ak4HiSignalGenJets") (pp_on_AA_2018 | pp_on_PbPb_run3).toModify(slimmedGenJetsAK8, cut = 'pt>9999', nLoose = 0) +from Configuration.Eras.Modifier_genJetSubEvent_cff import genJetSubEvent +genJetSubEvent.toModify(slimmedGenJets, src = "ak4HiGenJetsCleaned") diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc index 0e8a7b75a8418..23272547d3b4a 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc @@ -38,7 +38,7 @@ namespace { SubEventGenJetProducer::SubEventGenJetProducer(edm::ParameterSet const& conf) : VirtualJetProducer(conf) { // mapSrc_ = conf.getParameter( "srcMap"); ignoreHydro_ = conf.getUntrackedParameter("ignoreHydro", true); - produces(); + // the subjet collections are set through the config file in the "jetCollInstanceName" field. input_cand_token_ = consumes(src_); @@ -104,8 +104,7 @@ void SubEventGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& //////////////// - auto jets = std::make_unique>(); - subJets_ = jets.get(); + jets_ = std::make_unique>(); LogDebug("VirtualJetProducer") << "Inputted towers\n"; @@ -123,7 +122,7 @@ void SubEventGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& //Finalize LogDebug("SubEventJetProducer") << "Wrote jets\n"; - iEvent.put(std::move(jets)); + iEvent.put(std::move(jets_)); return; } @@ -156,7 +155,7 @@ void SubEventGenJetProducer::runAlgorithm(edm::Event& iEvent, edm::EventSetup co jet.setJetArea(jetArea); jet.setPileup(pu); - subJets_->push_back(jet); + jets_->push_back(jet); } } diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h index 3b96a6a32111d..fdec50e56f487 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h @@ -10,6 +10,7 @@ ************************************************************/ +#include #include #include "RecoJets/JetProducers/plugins/VirtualJetProducer.h" #include "DataFormats/JetReco/interface/GenJetCollection.h" @@ -24,7 +25,7 @@ namespace cms { protected: std::vector > subInputs_; - std::vector* subJets_; + std::unique_ptr> jets_; std::vector hydroTag_; std::vector nSubParticles_; bool ignoreHydro_; From b2701973f15907b56e600eb749d8b983c8bf09f6 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 7 Oct 2020 16:41:33 +0200 Subject: [PATCH 03/10] code checks and format --- .../plugins/HiSignalGenJetProducer.cc | 92 +++++++++---------- .../plugins/HiSignalParticleProducer.cc | 37 +++----- .../plugins/SubEventGenJetProducer.h | 2 +- 3 files changed, 56 insertions(+), 75 deletions(-) diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc index 84c004698fd98..bd2b1f284bc79 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc @@ -41,29 +41,26 @@ using namespace std; using namespace edm; - // // class decleration // class HiSignalGenJetProducer : public edm::EDProducer { public: - explicit HiSignalGenJetProducer(const edm::ParameterSet&); - ~HiSignalGenJetProducer(); - - private: - virtual void produce(edm::Event&, const edm::EventSetup&) override; - // ----------member data --------------------------- + explicit HiSignalGenJetProducer(const edm::ParameterSet&); + ~HiSignalGenJetProducer() override; - edm::EDGetTokenT > jetSrc_; +private: + void produce(edm::Event&, const edm::EventSetup&) override; + // ----------member data --------------------------- + edm::EDGetTokenT > jetSrc_; }; // // constants, enums and typedefs // - // // static data member definitions // @@ -72,67 +69,60 @@ class HiSignalGenJetProducer : public edm::EDProducer { // constructors and destructor // -HiSignalGenJetProducer::HiSignalGenJetProducer(const edm::ParameterSet& iConfig) : - jetSrc_(consumes >(iConfig.getParameter("src"))) -{ - std::string alias = (iConfig.getParameter( "src")).label(); - produces().setBranchAlias (alias); +HiSignalGenJetProducer::HiSignalGenJetProducer(const edm::ParameterSet& iConfig) + : jetSrc_(consumes >(iConfig.getParameter("src"))) { + std::string alias = (iConfig.getParameter("src")).label(); + produces().setBranchAlias(alias); } -HiSignalGenJetProducer::~HiSignalGenJetProducer() -{ - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) +HiSignalGenJetProducer::~HiSignalGenJetProducer() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) } - // // member functions // // ------------ method called to produce the data ------------ -void -HiSignalGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - using namespace edm; - using namespace reco; +void HiSignalGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + using namespace reco; - auto jets = std::make_unique(); + auto jets = std::make_unique(); - edm::Handle > genjets; - iEvent.getByToken(jetSrc_,genjets); + edm::Handle > genjets; + iEvent.getByToken(jetSrc_, genjets); - int jetsize = genjets->size(); + int jetsize = genjets->size(); - vector selection; - for(int ijet = 0; ijet < jetsize; ++ijet){ - selection.push_back(-1); - } + vector selection; + selection.reserve(jetsize); + for (int ijet = 0; ijet < jetsize; ++ijet) { + selection.push_back(-1); + } - vector selectedIndices; - vector removedIndices; + vector selectedIndices; + vector removedIndices; - for(int ijet = 0; ijet < jetsize; ++ijet){ + for (int ijet = 0; ijet < jetsize; ++ijet) { + const GenJet* jet1 = &((*genjets)[ijet]); - const GenJet* jet1 = &((*genjets)[ijet]); + const GenParticle* gencon = jet1->getGenConstituent(0); - const GenParticle* gencon = jet1->getGenConstituent(0); - - if(gencon == 0) throw cms::Exception("GenConstituent","GenJet is missing its constituents"); - else if(gencon->collisionId() == 0){ - jets->push_back(*jet1); - selection[ijet] = 1; - }else{ - selection[ijet] = 0; - removedIndices.push_back(ijet); - } - } - - iEvent.put(std::move(jets)); + if (gencon == nullptr) + throw cms::Exception("GenConstituent", "GenJet is missing its constituents"); + else if (gencon->collisionId() == 0) { + jets->push_back(*jet1); + selection[ijet] = 1; + } else { + selection[ijet] = 0; + removedIndices.push_back(ijet); + } + } + iEvent.put(std::move(jets)); } DEFINE_FWK_MODULE(HiSignalGenJetProducer); - - diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc index 47ae0efbb513c..c007cc802048b 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc @@ -40,7 +40,6 @@ using namespace std; using namespace edm; - // // class decleration // @@ -48,21 +47,19 @@ using namespace edm; class HiSignalParticleProducer : public edm::EDProducer { public: explicit HiSignalParticleProducer(const edm::ParameterSet&); - ~HiSignalParticleProducer(); + ~HiSignalParticleProducer() override; private: - virtual void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::Event&, const edm::EventSetup&) override; // ----------member data --------------------------- edm::EDGetTokenT > genParticleSrc_; - }; // // constants, enums and typedefs // - // // static data member definitions // @@ -71,61 +68,55 @@ class HiSignalParticleProducer : public edm::EDProducer { // constructors and destructor // -HiSignalParticleProducer::HiSignalParticleProducer(const edm::ParameterSet& iConfig) : - genParticleSrc_(consumes >(iConfig.getParameter("src"))) -{ - std::string alias = (iConfig.getParameter( "src")).label(); - produces().setBranchAlias (alias); +HiSignalParticleProducer::HiSignalParticleProducer(const edm::ParameterSet& iConfig) + : genParticleSrc_(consumes >(iConfig.getParameter("src"))) { + std::string alias = (iConfig.getParameter("src")).label(); + produces().setBranchAlias(alias); } -HiSignalParticleProducer::~HiSignalParticleProducer() -{ +HiSignalParticleProducer::~HiSignalParticleProducer() { // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) } - // // member functions // // ------------ method called to produce the data ------------ -void -HiSignalParticleProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ +void HiSignalParticleProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; using namespace reco; auto signalGenParticles = std::make_unique(); edm::Handle > genParticles; - iEvent.getByToken(genParticleSrc_,genParticles); + iEvent.getByToken(genParticleSrc_, genParticles); int genParticleSize = genParticles->size(); vector selection; - for(int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle){ + selection.reserve(genParticleSize); + for (int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle) { selection.push_back(-1); } vector selectedIndices; vector removedIndices; - for(int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle){ - + for (int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle) { const GenParticle* genParticle = &((*genParticles)[igenParticle]); - if(genParticle->collisionId() == 0){ + if (genParticle->collisionId() == 0) { signalGenParticles->push_back(*genParticle); selection[igenParticle] = 1; - }else{ + } else { selection[igenParticle] = 0; removedIndices.push_back(igenParticle); } } iEvent.put(std::move(signalGenParticles)); - } DEFINE_FWK_MODULE(HiSignalParticleProducer); diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h index fdec50e56f487..dd0d917be4a2a 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.h @@ -24,7 +24,7 @@ namespace cms { void runAlgorithm(edm::Event&, const edm::EventSetup&) override; protected: - std::vector > subInputs_; + std::vector> subInputs_; std::unique_ptr> jets_; std::vector hydroTag_; std::vector nSubParticles_; From afa1434d99572f37a406c1c66a371ccf200831f0 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 8 Oct 2020 18:15:23 +0200 Subject: [PATCH 04/10] move from era to process modifier --- .../python/genJetSubEvent_cff.py} | 0 .../python/relval_steps.py | 22 ++++++++++--------- .../StandardSequences/python/Eras.py | 3 +-- .../producersHeavyIons/heavyIonJets_cff.py | 2 +- .../PatAlgos/python/slimming/miniAOD_tools.py | 2 +- .../python/slimming/slimmedGenJets_cfi.py | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) rename Configuration/{Eras/python/Modifier_genJetSubEvent_cff.py => ProcessModifiers/python/genJetSubEvent_cff.py} (100%) diff --git a/Configuration/Eras/python/Modifier_genJetSubEvent_cff.py b/Configuration/ProcessModifiers/python/genJetSubEvent_cff.py similarity index 100% rename from Configuration/Eras/python/Modifier_genJetSubEvent_cff.py rename to Configuration/ProcessModifiers/python/genJetSubEvent_cff.py diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 3d7c2b346a3d9..53421ffa77920 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -967,8 +967,6 @@ def genS(fragment,howMuch): hiAlca2018 = {'--conditions':'auto:phase1_2018_realistic', '--era':'Run2_2018'} hiAlca2018_ppReco = {'--conditions':'auto:phase1_2018_realistic_hi', '--era':'Run2_2018_pp_on_AA'} hiAlca2021_ppReco = {'--conditions':'auto:phase1_2021_realistic_hi', '--era':'Run3_pp_on_PbPb'} -hiAlca2018_ppReco_mb = {'--conditions':'auto:phase1_2018_realistic_hi', '--era':'Run2_2018_pp_on_AA,genJetSubEvent'} -hiAlca2021_ppReco_mb = {'--conditions':'auto:phase1_2021_realistic_hi', '--era':'Run3_pp_on_PbPb,genJetSubEvent'} hiDefaults2011=merge([hiAlca2011,{'--scenario':'HeavyIons','-n':2}]) @@ -977,8 +975,6 @@ def genS(fragment,howMuch): hiDefaults2018=merge([hiAlca2018,{'--scenario':'HeavyIons','-n':2}]) hiDefaults2018_ppReco=merge([hiAlca2018_ppReco,{'-n':2}]) hiDefaults2021_ppReco=merge([hiAlca2021_ppReco,{'-n':2}]) -hiDefaults2018_ppReco_mb=merge([hiAlca2018_ppReco_mb,{'-n':2}]) -hiDefaults2021_ppReco_mb=merge([hiAlca2021_ppReco_mb,{'-n':2}]) steps['HydjetQ_B12_5020GeV_2011']=merge([{'-n':1,'--beamspot':'RealisticHI2011Collision'},hiDefaults2011,genS('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) steps['HydjetQ_B12_5020GeV_2015']=merge([{'-n':1,'--beamspot':'RealisticHICollisionFixZ2015'},hiDefaults2015,genS('Hydjet_Quenched_B12_5020GeV_cfi',U2000by1)]) @@ -2478,9 +2474,11 @@ def gen2021HiMix(fragment,howMuch): '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO', '--eventcontent':'RECOSIM,MINIAODSIM,DQM', },step3Up2015Defaults]) -steps['RECOHI2021PPRECOMB']=merge([hiDefaults2021_ppReco_mb,{'-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM', - '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO', - '--eventcontent':'RECOSIM,MINIAODSIM,DQM', +steps['RECOHI2021PPRECOMB']=merge([hiDefaults2021_ppReco,{'-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM', + '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO', + '--eventcontent':'RECOSIM,MINIAODSIM,DQM', + '--era':'Run3_pp_on_PbPb', + '--procModifiers':'genJetSubEvent', },step3Up2015Defaults]) steps['ALCARECOHI2021PPRECO']=merge([hiDefaults2021_ppReco,{'-s':'ALCA:TkAlMinBias+SiStripCalMinBias', @@ -2492,10 +2490,12 @@ def gen2021HiMix(fragment,howMuch): '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO,ALCARECO', '--eventcontent':'RECOSIM,MINIAODSIM,DQM,ALCARECO', },step3Up2015Defaults]) -steps['RECOHI2018PPRECOMB']=merge([hiDefaults2018_ppReco_mb,{'-s':'RAW2DIGI,L1Reco,RECO,ALCA:SiStripCalZeroBias+SiPixelCalZeroBias,EI,PAT,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM', +steps['RECOHI2018PPRECOMB']=merge([hiDefaults2018_ppReco,{'-s':'RAW2DIGI,L1Reco,RECO,ALCA:SiStripCalZeroBias+SiPixelCalZeroBias,EI,PAT,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM', '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO,ALCARECO', '--eventcontent':'RECOSIM,MINIAODSIM,DQM,ALCARECO', - },step3Up2015Defaults]) + '--era':'Run2_2018_pp_on_AA', + '--procModifiers':'genJetSubEvent', + },step3Up2015Defaults]) steps['RECOHI2018PPRECOml']=merge([concurrentLumis,steps['RECOHI2018PPRECOMB']]) steps['REMINIAODHI2018PPRECO']=merge([{'-s':'PAT,VALIDATION:@miniAODValidation,DQM:@miniAODDQM', @@ -2507,7 +2507,9 @@ def gen2021HiMix(fragment,howMuch): '--datatier':'MINIAODSIM,DQMIO', '--eventcontent':'MINIAODSIM,DQM', '-n':100, - },hiDefaults2018_ppReco_mb,step3Up2015Defaults]) + '--era':'Run2_2018_pp_on_AA', + '--procModifiers':'genJetSubEvent', + },hiDefaults2018_ppReco,step3Up2015Defaults]) steps['ALCARECOHI2018PPRECO']=merge([hiDefaults2018_ppReco,{'-s':'ALCA:TkAlMinBias+SiStripCalMinBias', '--datatier':'ALCARECO', diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 2b8f78edd8c01..5f5524eb6176a 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -66,8 +66,7 @@ def __init__(self): 'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'hcalHardcodeConditions', 'hcalSkipPacker', 'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018', - 'bParking', - 'genJetSubEvent'] + 'bParking'] internalUseModChains = ['run2_2017_noTrackingModifier'] self.pythonCfgLines = {} diff --git a/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py b/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py index b3b56fb0f3c13..b2404039c60b2 100644 --- a/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py +++ b/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py @@ -13,7 +13,7 @@ withLeptons = cms.bool(False), ) -from Configuration.Eras.Modifier_genJetSubEvent_cff import genJetSubEvent +from Configuration.ProcessModifiers.genJetSubEvent_cff import genJetSubEvent genJetSubEvent.toModify(allPartons,src = "genParticles") cleanedPartons = hiPartons.clone( diff --git a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py index c1652955fc706..1b50953b0423d 100644 --- a/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py +++ b/PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py @@ -589,7 +589,7 @@ def miniAOD_customizeMC(process): process.patJetPartons.particles = "genParticles" process.patJetPartonMatch.matched = "prunedGenParticles" _hiGeneral.toModify(process.patJetPartonMatch, matched = "hiSignalGenParticles") - from Configuration.Eras.Modifier_genJetSubEvent_cff import genJetSubEvent + from Configuration.ProcessModifiers.genJetSubEvent_cff import genJetSubEvent genJetSubEvent.toModify(process.patJetPartonMatch, matched = "cleanedPartons") process.patJetPartonMatch.mcStatus = [ 3, 23 ] process.patJetGenJetMatch.matched = "slimmedGenJets" diff --git a/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py b/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py index afba82607a686..020c5e9f84196 100644 --- a/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py +++ b/PhysicsTools/PatAlgos/python/slimming/slimmedGenJets_cfi.py @@ -24,5 +24,5 @@ from Configuration.Eras.Modifier_pp_on_PbPb_run3_cff import pp_on_PbPb_run3 (pp_on_AA_2018 | pp_on_PbPb_run3).toModify(slimmedGenJets, src = "ak4HiSignalGenJets") (pp_on_AA_2018 | pp_on_PbPb_run3).toModify(slimmedGenJetsAK8, cut = 'pt>9999', nLoose = 0) -from Configuration.Eras.Modifier_genJetSubEvent_cff import genJetSubEvent +from Configuration.ProcessModifiers.genJetSubEvent_cff import genJetSubEvent genJetSubEvent.toModify(slimmedGenJets, src = "ak4HiGenJetsCleaned") From 8ac453995e8d7a67a932f1ae54d023ca104165be Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 13 Oct 2020 13:47:13 +0200 Subject: [PATCH 05/10] cleanup from code review --- .../plugins/HiSignalGenJetProducer.cc | 41 +++++++------------ .../plugins/HiSignalParticleProducer.cc | 41 +++++++------------ .../plugins/SubEventGenJetProducer.cc | 1 - 3 files changed, 28 insertions(+), 55 deletions(-) diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc index bd2b1f284bc79..14fc8be6ef056 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc @@ -22,7 +22,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -32,12 +32,8 @@ #include "DataFormats/Common/interface/View.h" #include "DataFormats/JetReco/interface/GenJetCollection.h" -#include "DataFormats/GeometryVector/interface/VectorUtil.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "DataFormats/Math/interface/Point3D.h" -#include "DataFormats/Math/interface/LorentzVector.h" - using namespace std; using namespace edm; @@ -45,13 +41,15 @@ using namespace edm; // class decleration // -class HiSignalGenJetProducer : public edm::EDProducer { +class HiSignalGenJetProducer : public edm::global::EDProducer<> { public: explicit HiSignalGenJetProducer(const edm::ParameterSet&); - ~HiSignalGenJetProducer() override; + ~HiSignalGenJetProducer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions&); private: - void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; // ----------member data --------------------------- edm::EDGetTokenT > jetSrc_; @@ -75,18 +73,13 @@ HiSignalGenJetProducer::HiSignalGenJetProducer(const edm::ParameterSet& iConfig) produces().setBranchAlias(alias); } -HiSignalGenJetProducer::~HiSignalGenJetProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - // // member functions // // ------------ method called to produce the data ------------ -void HiSignalGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void HiSignalGenJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { using namespace edm; using namespace reco; @@ -97,15 +90,6 @@ void HiSignalGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& int jetsize = genjets->size(); - vector selection; - selection.reserve(jetsize); - for (int ijet = 0; ijet < jetsize; ++ijet) { - selection.push_back(-1); - } - - vector selectedIndices; - vector removedIndices; - for (int ijet = 0; ijet < jetsize; ++ijet) { const GenJet* jet1 = &((*genjets)[ijet]); @@ -115,14 +99,17 @@ void HiSignalGenJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& throw cms::Exception("GenConstituent", "GenJet is missing its constituents"); else if (gencon->collisionId() == 0) { jets->push_back(*jet1); - selection[ijet] = 1; - } else { - selection[ijet] = 0; - removedIndices.push_back(ijet); } } iEvent.put(std::move(jets)); } +void HiSignalGenJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Selects genJets from collision id = 0"); + desc.add("src", "ak4HiGenJets"); + descriptions.add("HiSignalGenJetProducer", desc); +} + DEFINE_FWK_MODULE(HiSignalGenJetProducer); diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc index c007cc802048b..2fb650b5bb076 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc @@ -20,7 +20,7 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -30,13 +30,9 @@ #include "DataFormats/Common/interface/View.h" #include "DataFormats/JetReco/interface/GenJetCollection.h" -#include "DataFormats/GeometryVector/interface/VectorUtil.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" -#include "DataFormats/Math/interface/Point3D.h" -#include "DataFormats/Math/interface/LorentzVector.h" - using namespace std; using namespace edm; @@ -44,13 +40,15 @@ using namespace edm; // class decleration // -class HiSignalParticleProducer : public edm::EDProducer { +class HiSignalParticleProducer : public edm::global::EDProducer<> { public: explicit HiSignalParticleProducer(const edm::ParameterSet&); - ~HiSignalParticleProducer() override; + ~HiSignalParticleProducer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions&); private: - void produce(edm::Event&, const edm::EventSetup&) override; + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; // ----------member data --------------------------- edm::EDGetTokenT > genParticleSrc_; @@ -74,18 +72,13 @@ HiSignalParticleProducer::HiSignalParticleProducer(const edm::ParameterSet& iCon produces().setBranchAlias(alias); } -HiSignalParticleProducer::~HiSignalParticleProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - // // member functions // // ------------ method called to produce the data ------------ -void HiSignalParticleProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void HiSignalParticleProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { using namespace edm; using namespace reco; @@ -96,27 +89,21 @@ void HiSignalParticleProducer::produce(edm::Event& iEvent, const edm::EventSetup int genParticleSize = genParticles->size(); - vector selection; - selection.reserve(genParticleSize); - for (int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle) { - selection.push_back(-1); - } - - vector selectedIndices; - vector removedIndices; - for (int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle) { const GenParticle* genParticle = &((*genParticles)[igenParticle]); if (genParticle->collisionId() == 0) { signalGenParticles->push_back(*genParticle); - selection[igenParticle] = 1; - } else { - selection[igenParticle] = 0; - removedIndices.push_back(igenParticle); } } iEvent.put(std::move(signalGenParticles)); } +void HiSignalParticleProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.setComment("Selects genParticles from collision id = 0"); + desc.add("src", "genParticles"); + descriptions.add("HiSignalParticleProducer", desc); +} + DEFINE_FWK_MODULE(HiSignalParticleProducer); diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc index 23272547d3b4a..67e50e70c6026 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc @@ -36,7 +36,6 @@ namespace { } // namespace SubEventGenJetProducer::SubEventGenJetProducer(edm::ParameterSet const& conf) : VirtualJetProducer(conf) { - // mapSrc_ = conf.getParameter( "srcMap"); ignoreHydro_ = conf.getUntrackedParameter("ignoreHydro", true); // the subjet collections are set through the config file in the "jetCollInstanceName" field. From 026246283c3affa741af82830047ed8fa69840ad Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 13 Oct 2020 13:52:45 +0200 Subject: [PATCH 06/10] remove unneeded memory include --- RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc index 67e50e70c6026..4289753cf43ce 100644 --- a/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc +++ b/RecoJets/JetProducers/plugins/SubEventGenJetProducer.cc @@ -2,8 +2,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "RecoJets/JetProducers/plugins/SubEventGenJetProducer.h" -#include - #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/isFinite.h" #include "RecoJets/JetProducers/interface/JetSpecific.h" From 8859bd0e1129f40398db620dc71d2ae47ffdd42f Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 14 Oct 2020 09:18:14 +0200 Subject: [PATCH 07/10] fix fill descriptions, range-based loop, comments cleanup --- .../plugins/HiSignalGenJetProducer.cc | 65 ++---------------- .../plugins/HiSignalParticleProducer.cc | 67 +++---------------- 2 files changed, 16 insertions(+), 116 deletions(-) diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc index 14fc8be6ef056..b466e7f425029 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc @@ -1,26 +1,6 @@ -// -*- C++ -*- -// -// Package: HiSignalGenJetProducer -// Class: HiSignalGenJetProducer -// -/**\class HiSignalGenJetProducer HiSignalGenJetProducer.cc yetkin/HiSignalGenJetProducer/src/HiSignalGenJetProducer.cc - - Description: - - Implementation: - -*/ -// -// Original Author: Yetkin Yilmaz -// Created: Tue Jul 21 04:26:01 EDT 2009 -// -// - -// system include files #include #include -// user include files #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDProducer.h" @@ -34,13 +14,6 @@ #include "DataFormats/JetReco/interface/GenJetCollection.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" -using namespace std; -using namespace edm; - -// -// class decleration -// - class HiSignalGenJetProducer : public edm::global::EDProducer<> { public: explicit HiSignalGenJetProducer(const edm::ParameterSet&); @@ -50,55 +23,31 @@ class HiSignalGenJetProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - // ----------member data --------------------------- edm::EDGetTokenT > jetSrc_; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - -// -// constructors and destructor -// - HiSignalGenJetProducer::HiSignalGenJetProducer(const edm::ParameterSet& iConfig) : jetSrc_(consumes >(iConfig.getParameter("src"))) { - std::string alias = (iConfig.getParameter("src")).label(); + std::string alias = (iConfig.getParameter("src")).label(); produces().setBranchAlias(alias); } -// -// member functions -// - -// ------------ method called to produce the data ------------ - void HiSignalGenJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { - using namespace edm; - using namespace reco; - auto jets = std::make_unique(); + auto jets = std::make_unique(); - edm::Handle > genjets; + edm::Handle > genjets; iEvent.getByToken(jetSrc_, genjets); - int jetsize = genjets->size(); - - for (int ijet = 0; ijet < jetsize; ++ijet) { - const GenJet* jet1 = &((*genjets)[ijet]); + for (const reco::GenJet &jet1 : *genjets){ - const GenParticle* gencon = jet1->getGenConstituent(0); + const reco::GenParticle* gencon = jet1.getGenConstituent(0); if (gencon == nullptr) throw cms::Exception("GenConstituent", "GenJet is missing its constituents"); else if (gencon->collisionId() == 0) { - jets->push_back(*jet1); + jets->push_back(jet1); } } @@ -108,7 +57,7 @@ void HiSignalGenJetProducer::produce(edm::StreamID, edm::Event& iEvent, const ed void HiSignalGenJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.setComment("Selects genJets from collision id = 0"); - desc.add("src", "ak4HiGenJets"); + desc.add("src", edm::InputTag("akHiGenJets")); descriptions.add("HiSignalGenJetProducer", desc); } diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc index 2fb650b5bb076..72865ddc63c10 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc @@ -1,24 +1,6 @@ -// -*- C++ -*- -// -// Package: HiSignalParticleProducer -// Class: HiSignalParticleProducer -// -/**\class HiSignalParticleProducer HiSignalParticleProducer.cc yetkin/HiSignalParticleProducer/src/HiSignalParticleProducer.cc - Description: - Implementation: - -*/ -// -// Original Author: Yetkin Yilmaz -// Created: Tue Jul 21 04:26:01 EDT 2009 -// -// - -// system include files #include #include -// user include files #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/global/EDProducer.h" @@ -33,13 +15,6 @@ #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h" -using namespace std; -using namespace edm; - -// -// class decleration -// - class HiSignalParticleProducer : public edm::global::EDProducer<> { public: explicit HiSignalParticleProducer(const edm::ParameterSet&); @@ -49,50 +24,26 @@ class HiSignalParticleProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - // ----------member data --------------------------- edm::EDGetTokenT > genParticleSrc_; }; -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - -// -// constructors and destructor -// - HiSignalParticleProducer::HiSignalParticleProducer(const edm::ParameterSet& iConfig) : genParticleSrc_(consumes >(iConfig.getParameter("src"))) { - std::string alias = (iConfig.getParameter("src")).label(); + std::string alias = (iConfig.getParameter("src")).label(); produces().setBranchAlias(alias); } -// -// member functions -// - -// ------------ method called to produce the data ------------ - void HiSignalParticleProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { - using namespace edm; - using namespace reco; - - auto signalGenParticles = std::make_unique(); - edm::Handle > genParticles; + auto signalGenParticles = std::make_unique(); + + edm::Handle > genParticles; iEvent.getByToken(genParticleSrc_, genParticles); - - int genParticleSize = genParticles->size(); - - for (int igenParticle = 0; igenParticle < genParticleSize; ++igenParticle) { - const GenParticle* genParticle = &((*genParticles)[igenParticle]); - if (genParticle->collisionId() == 0) { - signalGenParticles->push_back(*genParticle); + + for (const reco::GenParticle &genParticle : *genParticles){ + if (genParticle.collisionId() == 0) { + signalGenParticles->push_back(genParticle); } } @@ -102,7 +53,7 @@ void HiSignalParticleProducer::produce(edm::StreamID, edm::Event& iEvent, const void HiSignalParticleProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.setComment("Selects genParticles from collision id = 0"); - desc.add("src", "genParticles"); + desc.add("src", edm::InputTag("genParticles")); descriptions.add("HiSignalParticleProducer", desc); } From f189a5687421732bfb25613efd52d00058f4c329 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 14 Oct 2020 09:25:46 +0200 Subject: [PATCH 08/10] code checks --- RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc | 4 +--- RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc | 7 +++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc index b466e7f425029..a79be7043cc70 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc @@ -34,14 +34,12 @@ HiSignalGenJetProducer::HiSignalGenJetProducer(const edm::ParameterSet& iConfig) } void HiSignalGenJetProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { - auto jets = std::make_unique(); edm::Handle > genjets; iEvent.getByToken(jetSrc_, genjets); - for (const reco::GenJet &jet1 : *genjets){ - + for (const reco::GenJet& jet1 : *genjets) { const reco::GenParticle* gencon = jet1.getGenConstituent(0); if (gencon == nullptr) diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc index 72865ddc63c10..c392eaea3f5b1 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc @@ -35,13 +35,12 @@ HiSignalParticleProducer::HiSignalParticleProducer(const edm::ParameterSet& iCon } void HiSignalParticleProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup&) const { - auto signalGenParticles = std::make_unique(); - + edm::Handle > genParticles; iEvent.getByToken(genParticleSrc_, genParticles); - - for (const reco::GenParticle &genParticle : *genParticles){ + + for (const reco::GenParticle& genParticle : *genParticles) { if (genParticle.collisionId() == 0) { signalGenParticles->push_back(genParticle); } From 5db41b85afda232211dd1e2c19f117644d41ad1b Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 14 Oct 2020 19:38:14 +0200 Subject: [PATCH 09/10] indent relval_steps.py --- .../python/relval_steps.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 53421ffa77920..d3adea883c45d 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -2491,25 +2491,25 @@ def gen2021HiMix(fragment,howMuch): '--eventcontent':'RECOSIM,MINIAODSIM,DQM,ALCARECO', },step3Up2015Defaults]) steps['RECOHI2018PPRECOMB']=merge([hiDefaults2018_ppReco,{'-s':'RAW2DIGI,L1Reco,RECO,ALCA:SiStripCalZeroBias+SiPixelCalZeroBias,EI,PAT,VALIDATION:@standardValidationNoHLT+@miniAODValidation,DQM:@standardDQMFakeHLT+@miniAODDQM', - '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO,ALCARECO', - '--eventcontent':'RECOSIM,MINIAODSIM,DQM,ALCARECO', + '--datatier':'GEN-SIM-RECO,MINIAODSIM,DQMIO,ALCARECO', + '--eventcontent':'RECOSIM,MINIAODSIM,DQM,ALCARECO', '--era':'Run2_2018_pp_on_AA', '--procModifiers':'genJetSubEvent', - },step3Up2015Defaults]) + },step3Up2015Defaults]) steps['RECOHI2018PPRECOml']=merge([concurrentLumis,steps['RECOHI2018PPRECOMB']]) steps['REMINIAODHI2018PPRECO']=merge([{'-s':'PAT,VALIDATION:@miniAODValidation,DQM:@miniAODDQM', - '--datatier':'MINIAODSIM,DQMIO', - '--eventcontent':'MINIAODSIM,DQM', - '-n':100, - },hiDefaults2018_ppReco,step3Up2015Defaults]) + '--datatier':'MINIAODSIM,DQMIO', + '--eventcontent':'MINIAODSIM,DQM', + '-n':100, + },hiDefaults2018_ppReco,step3Up2015Defaults]) steps['REMINIAODHI2018PPRECOMB']=merge([{'-s':'PAT,VALIDATION:@miniAODValidation,DQM:@miniAODDQM', - '--datatier':'MINIAODSIM,DQMIO', - '--eventcontent':'MINIAODSIM,DQM', - '-n':100, + '--datatier':'MINIAODSIM,DQMIO', + '--eventcontent':'MINIAODSIM,DQM', + '-n':100, '--era':'Run2_2018_pp_on_AA', '--procModifiers':'genJetSubEvent', - },hiDefaults2018_ppReco,step3Up2015Defaults]) + },hiDefaults2018_ppReco,step3Up2015Defaults]) steps['ALCARECOHI2018PPRECO']=merge([hiDefaults2018_ppReco,{'-s':'ALCA:TkAlMinBias+SiStripCalMinBias', '--datatier':'ALCARECO', From fdbde17a165a0920340428a2b1d9ddf24aeedcdf Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 16 Oct 2020 20:58:20 +0200 Subject: [PATCH 10/10] Remove cfis and use fillDescriptions defaults --- .../PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py | 7 +++---- RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc | 2 +- RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc | 2 +- RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py | 7 ------- RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py | 7 ------- 5 files changed, 5 insertions(+), 20 deletions(-) delete mode 100644 RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py delete mode 100644 RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py diff --git a/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py b/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py index b2404039c60b2..94c9b8a1d1983 100644 --- a/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py +++ b/PhysicsTools/PatAlgos/python/producersHeavyIons/heavyIonJets_cff.py @@ -1,11 +1,12 @@ import FWCore.ParameterSet.Config as cms -from RecoHI.HiJetAlgos.HiSignalParticleProducer_cfi import hiSignalGenParticles +from RecoHI.HiJetAlgos.hiSignalParticleProducer_cfi import hiSignalParticleProducer as hiSignalGenParticles from RecoJets.Configuration.GenJetParticles_cff import genParticlesForJets from RecoHI.HiJetAlgos.HiGenCleaner_cff import hiPartons from RecoHI.HiJetAlgos.HiGenJets_cff import ak4HiGenJets from RecoHI.HiJetAlgos.HiGenCleaner_cff import heavyIonCleanedGenJets -from RecoHI.HiJetAlgos.HiSignalGenJetProducer_cfi import hiSignalGenJets +from RecoHI.HiJetAlgos.hiSignalGenJetProducer_cfi import hiSignalGenJetProducer +ak4HiSignalGenJets = hiSignalGenJetProducer.clone(src = "ak4HiGenJets") allPartons = cms.EDProducer( "PartonSelector", @@ -20,8 +21,6 @@ src = 'allPartons', ) -ak4HiSignalGenJets = hiSignalGenJets.clone(src = "ak4HiGenJets") - hiGenJetsTask = cms.Task( hiSignalGenParticles, genParticlesForJets, diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc index a79be7043cc70..e9be77cd28445 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalGenJetProducer.cc @@ -56,7 +56,7 @@ void HiSignalGenJetProducer::fillDescriptions(edm::ConfigurationDescriptions& de edm::ParameterSetDescription desc; desc.setComment("Selects genJets from collision id = 0"); desc.add("src", edm::InputTag("akHiGenJets")); - descriptions.add("HiSignalGenJetProducer", desc); + descriptions.addWithDefaultLabel(desc); } DEFINE_FWK_MODULE(HiSignalGenJetProducer); diff --git a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc index c392eaea3f5b1..1f1148cadd2f2 100644 --- a/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc +++ b/RecoHI/HiJetAlgos/plugins/HiSignalParticleProducer.cc @@ -53,7 +53,7 @@ void HiSignalParticleProducer::fillDescriptions(edm::ConfigurationDescriptions& edm::ParameterSetDescription desc; desc.setComment("Selects genParticles from collision id = 0"); desc.add("src", edm::InputTag("genParticles")); - descriptions.add("HiSignalParticleProducer", desc); + descriptions.addWithDefaultLabel(desc); } DEFINE_FWK_MODULE(HiSignalParticleProducer); diff --git a/RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py b/RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py deleted file mode 100644 index 63a2d3af8e6c6..0000000000000 --- a/RecoHI/HiJetAlgos/python/HiSignalGenJetProducer_cfi.py +++ /dev/null @@ -1,7 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -hiSignalGenJets = cms.EDProducer('HiSignalGenJetProducer', - src = cms.InputTag('ak4HiGenJets') - ) - diff --git a/RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py b/RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py deleted file mode 100644 index 08645ffecb98e..0000000000000 --- a/RecoHI/HiJetAlgos/python/HiSignalParticleProducer_cfi.py +++ /dev/null @@ -1,7 +0,0 @@ -import FWCore.ParameterSet.Config as cms - - -hiSignalGenParticles = cms.EDProducer('HiSignalParticleProducer', - src = cms.InputTag('genParticles') - ) -