From f67fe97c96d97d10b7078ea0a3aede5e7f71960d Mon Sep 17 00:00:00 2001 From: prasant Date: Thu, 13 Jul 2023 13:06:59 +0200 Subject: [PATCH 01/17] Add 4 Isolation variables to NanoAoD for Run3 EgammaPhotonIDMVA --- PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 4 ++++ PhysicsTools/NanoAOD/python/photons_cff.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 91302daeaed84..c60f08114e7b8 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -629,7 +629,11 @@ Plot1D('mvaID_Fall17V2_WP80', 'mvaID_WP80_Fall17V2', 2, -0.5, 1.5, 'Fall17V2 MVA ID WP80'), Plot1D('mvaID_Fall17V2_WP90', 'mvaID_WP90_Fall17V2', 2, -0.5, 1.5, 'Fall17V2 MVA ID WP90'), Plot1D('trkSumPtHollowConeDR03', 'trkSumPtHollowConeDR03', 100, 0, 8, 'Sum of track pT in a hollow cone of outer radius, inner radius'), + Plot1D('trkSumPtSolidConeDR04', 'trkSumPtSolidConeDR04', 100, 0, 8, 'Sum of track pT in a cone of dR=0.4'), + Plot1D('ecalPFClusterIso', 'ecalPFClusterIso', 100, 0, 10, 'sum pt of ecal clusters, vetoing clusters part of photon'), + Plot1D('hcalPFClusterIso', 'hcalPFClusterIso', 100, 0, 10, 'sum pt of hcal clusters, vetoing clusters part of photon'), Plot1D('pfPhoIso03', 'pfPhoIso03', 100, 0, 1, 'PF absolute isolation dR=0.3, photon component (uncorrected)'), + Plot1D('pfChargedIso', 'pfChargedIso', 100, 0, 10, 'PF absolute isolation dR=0.3, charged component with dxy,dz match to PV'), Plot1D('pfChargedIsoPFPV', 'pfChargedIsoPFPV', 100, 0, 5, 'PF absolute isolation dR=0.3, charged component (PF PV only)'), Plot1D('pfChargedIsoWorstVtx', 'pfChargedIsoWorstVtx', 100, 0, 10,'PF absolute isolation dR=0.3, charged component (Vertex with largest isolation)'), Plot1D('pdgId', 'pdgId', 1, 21.5, 22.5, 'PDG code assigned by the event reconstruction (not by MC truth)'), diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index 91055c9e3308e..39db6ad1cd495 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -229,7 +229,11 @@ def make_bitmapVID_docstring(id_modules_working_points_pset): mvaID_Fall17V2_WP90 = Var("userInt('mvaID_Fall17V2_WP90')",bool,doc="MVA ID WP90, Fall17V2"), mvaID_Fall17V2_WP80 = Var("userInt('mvaID_Fall17V2_WP80')",bool,doc="MVA ID WP80, Fall17V2"), trkSumPtHollowConeDR03 = Var("trkSumPtHollowConeDR03()",float,doc="Sum of track pT in a hollow cone of outer radius, inner radius", precision=8), + trkSumPtSolidConeDR04 = Var("trkSumPtSolidConeDR04()",float,doc="Sum of track pT in a cone of dR=0.4", precision=8), + ecalPFClusterIso = Var("ecalPFClusterIso()",float,doc="sum pt of ecal clusters, vetoing clusters part of photon", precision=8), + hcalPFClusterIso = Var("hcalPFClusterIso()",float,doc="sum pt of hcal clusters, vetoing clusters part of photon", precision=8), pfPhoIso03 = Var("photonIso()",float,doc="PF absolute isolation dR=0.3, photon component (uncorrected)"), + pfChargedIso = Var("chargedHadronIso()",float,doc="PF absolute isolation dR=0.3, charged component with dxy,dz match to PV", precision=8), pfChargedIsoPFPV = Var("chargedHadronPFPVIso()",float,doc="PF absolute isolation dR=0.3, charged component (PF PV only)"), pfChargedIsoWorstVtx = Var("chargedHadronWorstVtxIso()",float,doc="PF absolute isolation dR=0.3, charged component (Vertex with largest isolation)"), pfRelIso03_chg_quadratic = Var("userFloat('PFIsoChgQuadratic')/pt",float,doc="PF relative isolation dR=0.3, charged hadron component (with quadraticEA*rho*rho + linearEA*rho Winter22V1 corrections)"), From 72df35bcd299c9681bccc144880129e1d962f183 Mon Sep 17 00:00:00 2001 From: Ho-Fung Tsoi Date: Fri, 25 Aug 2023 01:15:30 +0200 Subject: [PATCH 02/17] remove duplicate monitoring of FB at layer1 --- DQM/L1TMonitor/src/L1TdeStage2CaloLayer1.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/DQM/L1TMonitor/src/L1TdeStage2CaloLayer1.cc b/DQM/L1TMonitor/src/L1TdeStage2CaloLayer1.cc index 3eabbf9a19452..dd2ec1f39ce84 100644 --- a/DQM/L1TMonitor/src/L1TdeStage2CaloLayer1.cc +++ b/DQM/L1TMonitor/src/L1TdeStage2CaloLayer1.cc @@ -4,6 +4,7 @@ * N. Smith */ //Modified by Bhawna Gomber +//Modified by Ho-Fung Tsoi #include "DQM/L1TMonitor/interface/L1TdeStage2CaloLayer1.h" @@ -115,10 +116,12 @@ void L1TdeStage2CaloLayer1::analyze(const edm::Event& event, const edm::EventSet etCorrelation_->Fill(dataTower.et(), emulTower.et()); + const uint32_t data_fb = dataTower.fb() & 0b1011; + const uint32_t emul_fb = emulTower.fb() & 0b1011; if (abs(dataTower.ieta_) >= 30) { - fbCorrelationHF_->Fill(dataTower.fb(), emulTower.fb()); + fbCorrelationHF_->Fill(data_fb, emul_fb); } else { - fbCorrelation_->Fill(dataTower.fb(), emulTower.fb()); + fbCorrelation_->Fill(data_fb, emul_fb); } if (dataTower.data_ == emulTower.data_) { @@ -149,7 +152,7 @@ void L1TdeStage2CaloLayer1::analyze(const edm::Event& event, const edm::EventSet erMsmThisEvent = true; updateMismatch(event, 1); } - if (dataTower.fb() != emulTower.fb()) { + if (data_fb != emul_fb) { failureOccFbMismatch_->Fill(dataTower.ieta_, dataTower.iphi_); fbMismatchByLumi_->Fill(event.id().luminosityBlock()); fbMismatchesPerBx_->Fill(event.bunchCrossing()); From c7d31e6778909850485dcf9608bc1557854e16db Mon Sep 17 00:00:00 2001 From: Dominic Date: Thu, 2 Mar 2023 18:40:03 +0100 Subject: [PATCH 03/17] Add lhe numbering to allow get correct matching between lhe and herwig events Read lhe event numbers in, if present Add HadroniserFilter to Herwig which correctly matches LHE numbers between CMSSW and herwig Add option to Herwig input fragements to use LHE numbering Change test examples to use new HadroniserFilter+ LHE numbering code style code style Call addLHEnumbers from mergeLHE.py if asked to number events and not using the DefaultLHEMerger Number events before merge (so numbers are also available to LHEReader) Include evtnum in LHEEventProduct (necesary for multithreading) --- ...S_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py | 2 +- ..._TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py | 4 +- ...34Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py | 2 +- .../Herwig7LHECommonSettings_cfi.py | 1 + .../Herwig7MGMergingSettings_cfi.py | 1 + .../python/TT_13TeV_Pow_Herwig7_cff.py | 2 +- .../python/TTbar_Pow_LHE_13TeV_cff.py | 2 +- .../plugins/Herwig7Hadronizer.cc | 53 +++++++++++++++++-- .../LHEInterface/interface/LHEEvent.h | 3 ++ .../plugins/ExternalLHEProducer.cc | 1 + .../LHEInterface/scripts/addLHEnumbers.py | 47 ++++++++++++++++ .../LHEInterface/scripts/mergeLHE.py | 17 ++++-- .../LHEInterface/src/LHEEvent.cc | 11 ++-- .../LHEInterface/src/LHEReader.cc | 6 +++ .../interface/LHEEventProduct.h | 3 ++ .../GeneratorProducts/src/classes_def.xml | 3 +- 16 files changed, 139 insertions(+), 19 deletions(-) create mode 100755 GeneratorInterface/LHEInterface/scripts/addLHEnumbers.py diff --git a/Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py b/Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py index 4e2484ee675ee..70f9aeba38725 100644 --- a/Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py +++ b/Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py @@ -6,7 +6,7 @@ from Configuration.Generator.Herwig7Settings.Herwig7MGMergingSettings_cfi import * -generator = cms.EDFilter("Herwig7GeneratorFilter", +generator = cms.EDFilter("Herwig7HadronizerFilter", herwig7CH3SettingsBlock, herwig7StableParticlesForDetectorBlock, herwig7MGMergingSettingsBlock, diff --git a/Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py b/Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py index 6e782c8fd75ba..406e77a56cd4f 100644 --- a/Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py +++ b/Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py @@ -5,7 +5,7 @@ from Configuration.Generator.Herwig7Settings.Herwig7MGMergingSettings_cfi import * -generator = cms.EDFilter("Herwig7GeneratorFilter", +generator = cms.EDFilter("Herwig7HadronizerFilter", herwig7CH3SettingsBlock, herwig7StableParticlesForDetectorBlock, herwig7MGMergingSettingsBlock, @@ -40,7 +40,7 @@ outputFile = cms.string('cmsgrid_final.lhe'), scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), generateConcurrently = cms.untracked.bool(True), - postGenerationCommand = cms.untracked.vstring('mergeLHE.py', '-i', 'thread*/cmsgrid_final.lhe', '-o', 'cmsgrid_final.lhe') + postGenerationCommand = cms.untracked.vstring('mergeLHE.py', '-n', '-i', 'thread*/cmsgrid_final.lhe', '-o', 'cmsgrid_final.lhe') ) diff --git a/Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py b/Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py index eaf6117727add..5cbb82077c701 100644 --- a/Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py +++ b/Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_LHE_13TeV_cff.py @@ -7,5 +7,5 @@ args = cms.vstring('/cvmfs/cms.cern.ch/phys_generator/gridpacks/UL/13TeV/madgraph/V5_2.6.5/dyellell01234j_5f_LO_MLM_v2/DYJets_HT-incl_slc6_amd64_gcc630_CMSSW_9_3_16_tarball.tar.xz','false','slc6_amd64_gcc630','CMSSW_9_3_16'), nEvents = cms.untracked.uint32(10), generateConcurrently = cms.untracked.bool(True), - postGenerationCommand = cms.untracked.vstring('mergeLHE.py', '-i', 'thread*/cmsgrid_final.lhe', '-o', 'cmsgrid_final.lhe'), + postGenerationCommand = cms.untracked.vstring('mergeLHE.py', '-n', '-i', 'thread*/cmsgrid_final.lhe', '-o', 'cmsgrid_final.lhe'), ) diff --git a/Configuration/Generator/python/Herwig7Settings/Herwig7LHECommonSettings_cfi.py b/Configuration/Generator/python/Herwig7Settings/Herwig7LHECommonSettings_cfi.py index 3fbc11971098d..4515982695b96 100644 --- a/Configuration/Generator/python/Herwig7Settings/Herwig7LHECommonSettings_cfi.py +++ b/Configuration/Generator/python/Herwig7Settings/Herwig7LHECommonSettings_cfi.py @@ -14,6 +14,7 @@ # set the weight option (e.g. for MC@NLO) 'set LesHouchesHandler:WeightOption VarNegWeight', + 'set LesHouchesHandler:EventNumbering LHE', 'set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LesHouchesHandler', 'create ThePEG::Cuts /Herwig/Cuts/NoCuts', diff --git a/Configuration/Generator/python/Herwig7Settings/Herwig7MGMergingSettings_cfi.py b/Configuration/Generator/python/Herwig7Settings/Herwig7MGMergingSettings_cfi.py index c78bd73a1885a..121449540d649 100644 --- a/Configuration/Generator/python/Herwig7Settings/Herwig7MGMergingSettings_cfi.py +++ b/Configuration/Generator/python/Herwig7Settings/Herwig7MGMergingSettings_cfi.py @@ -14,6 +14,7 @@ 'set LesHouchesHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler', 'set LesHouchesHandler:DecayHandler /Herwig/Decays/DecayHandler', 'set LesHouchesHandler:WeightOption VarNegWeight', + 'set LesHouchesHandler:EventNumbering LHE', 'set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LesHouchesHandler', 'create ThePEG::Cuts /Herwig/Cuts/NoCuts', 'cd /Herwig/EventHandlers', diff --git a/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py b/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py index c2ff018b3a23b..4b37ad9d1fe1b 100644 --- a/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py +++ b/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py @@ -7,7 +7,7 @@ from Configuration.Generator.Herwig7Settings.Herwig7LHEPowhegSettings_cfi import * -generator = cms.EDFilter("Herwig7GeneratorFilter", +generator = cms.EDFilter("Herwig7HadronizerFilter", herwig7CH3SettingsBlock, herwig7StableParticlesForDetectorBlock, herwig7LHECommonSettingsBlock, diff --git a/Configuration/Generator/python/TTbar_Pow_LHE_13TeV_cff.py b/Configuration/Generator/python/TTbar_Pow_LHE_13TeV_cff.py index eaf5b7b625730..d77eabec52dd8 100644 --- a/Configuration/Generator/python/TTbar_Pow_LHE_13TeV_cff.py +++ b/Configuration/Generator/python/TTbar_Pow_LHE_13TeV_cff.py @@ -7,7 +7,7 @@ outputFile = cms.string('cmsgrid_final.lhe'), scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh'), generateConcurrently = cms.untracked.bool(True), - postGenerationCommand = cms.untracked.vstring('mergeLHE.py', '-i', 'thread*/cmsgrid_final.lhe', '-o', 'cmsgrid_final.lhe'), + postGenerationCommand = cms.untracked.vstring('mergeLHE.py', '-n', '-i', 'thread*/cmsgrid_final.lhe', '-o', 'cmsgrid_final.lhe'), ) #Link to datacards: diff --git a/GeneratorInterface/Herwig7Interface/plugins/Herwig7Hadronizer.cc b/GeneratorInterface/Herwig7Interface/plugins/Herwig7Hadronizer.cc index 080b11a2606dd..e993856720cd0 100644 --- a/GeneratorInterface/Herwig7Interface/plugins/Herwig7Hadronizer.cc +++ b/GeneratorInterface/Herwig7Interface/plugins/Herwig7Hadronizer.cc @@ -63,6 +63,7 @@ class Herwig7Hadronizer : public Herwig7Interface, public gen::BaseHadronizer { unsigned int eventsToPrint; ThePEG::EventPtr thepegEvent; + bool haveEvt = false; std::shared_ptr proxy_; const std::string handlerDirectory_; @@ -101,9 +102,18 @@ bool Herwig7Hadronizer::initializeForInternalPartons() { } bool Herwig7Hadronizer::initializeForExternalPartons() { - edm::LogError("Herwig7 interface") - << "Read in of LHE files is not supported in this way. You can read them manually if necessary."; - return false; + if (currentLumiBlock == firstLumiBlock) { + std::ifstream runFile(runFileName + ".run"); + if (runFile.fail()) //required for showering of LHE files + { + initRepository(paramSettings); + } + if (!initGenerator()) { + edm::LogInfo("Generator|Herwig7Hadronizer") << "No run step for Herwig chosen. Program will be aborted."; + exit(0); + } + } + return true; } bool Herwig7Hadronizer::declareStableParticles(const std::vector& pdgIds) { return false; } @@ -141,8 +151,41 @@ bool Herwig7Hadronizer::generatePartonsAndHadronize() { } bool Herwig7Hadronizer::hadronize() { - edm::LogError("Herwig7 interface") - << "Read in of LHE files is not supported in this way. You can read them manually if necessary."; + if (!haveEvt) { + try { + thepegEvent = eg_->shoot(); + haveEvt = true; + } catch (std::exception& exc) { + edm::LogWarning("Generator|Herwig7Hadronizer") + << "EGPtr::shoot() thrown an exception, event skipped: " << exc.what(); + return false; + } + } + int evtnum = lheEvent()->evtnum(); + if (evtnum == -1) { + edm::LogError("Generator|Herwig7Hadronizer") + << "Event number not set in lhe file, needed for correctly aligning Herwig and LHE events!"; + return false; + } + if (thepegEvent->number() < evtnum) { + edm::LogError("Herwig7 interface") << "Herwig does not seem to be generating events in order, did you set " + "/Herwig/EventHandlers/FxFxLHReader:AllowedToReOpen Yes?"; + return false; + } else if (thepegEvent->number() == evtnum) { + haveEvt = false; + if (!thepegEvent) { + edm::LogWarning("Generator|Herwig7Hadronizer") << "thepegEvent not initialized"; + return false; + } + + event() = convert(thepegEvent); + if (!event().get()) { + edm::LogWarning("Generator|Herwig7Hadronizer") << "genEvent not initialized"; + return false; + } + return true; + } + edm::LogWarning("Generator|Herwig7Hadronizer") << "Event " << evtnum << " not generated (likely skipped in merging)"; return false; } diff --git a/GeneratorInterface/LHEInterface/interface/LHEEvent.h b/GeneratorInterface/LHEInterface/interface/LHEEvent.h index bddf80b87daab..ab91ae6e9922c 100644 --- a/GeneratorInterface/LHEInterface/interface/LHEEvent.h +++ b/GeneratorInterface/LHEInterface/interface/LHEEvent.h @@ -52,9 +52,11 @@ namespace lhef { int npLO() const { return npLO_; } int npNLO() const { return npNLO_; } + int evtnum() const { return evtnum_; } void setNpLO(int n) { npLO_ = n; } void setNpNLO(int n) { npNLO_ = n; } + void setEvtNum(int n) { evtnum_ = n; } void addComment(const std::string &line) { comments.push_back(line); } @@ -93,6 +95,7 @@ namespace lhef { std::vector scales_; //scale value used to exclude EWK-produced partons from matching int npLO_; //number of partons for LO process (used to steer matching/merging) int npNLO_; //number of partons for NLO process (used to steer matching/merging) + int evtnum_; //The number of the event (needed to ensure the correct LHE events are saved for MG +Herwig) }; } // namespace lhef diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index ed2db6c88c4f0..2b9d38c2c222b 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -192,6 +192,7 @@ void ExternalLHEProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe partonLevel_->weights().end(), std::bind(&LHEEventProduct::addWeight, product.get(), std::placeholders::_1)); product->setScales(partonLevel_->scales()); + product->setEvtNum(partonLevel_->evtnum()); if (nPartonMapping_.empty()) { product->setNpLO(partonLevel_->npLO()); product->setNpNLO(partonLevel_->npNLO()); diff --git a/GeneratorInterface/LHEInterface/scripts/addLHEnumbers.py b/GeneratorInterface/LHEInterface/scripts/addLHEnumbers.py new file mode 100755 index 0000000000000..0533c74e04aba --- /dev/null +++ b/GeneratorInterface/LHEInterface/scripts/addLHEnumbers.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 + +from __future__ import print_function +import logging +import argparse +import sys +import os +import re + + +def number_events(input_file, output_file=None, offset=0): + if output_file is None: + output_file = input_file + if not os.path.exists(os.path.dirname(os.path.realpath(output_file))): + os.makedirs(os.path.dirname(os.path.realpath(output_file))) + + nevent = offset + with open('tmp.txt', 'w') as fw: + with open(input_file, 'r') as ftmp: + for line in ftmp: + if re.search('\s*', line): + nevent += 1 + fw.write(' ' + str(nevent) + '\n') + fw.write(line) + if output_file is not None: + os.rename("tmp.txt", output_file) + else: + os.rename("tmp.txt", input_file) + return nevent + + +if __name__=="__main__": + + parser = argparse.ArgumentParser( + description="Add numbers to lhe") + parser.add_argument("input_file", type=str, + help="Input LHE file path.") + parser.add_argument("-o", "--output-file", default=None, type=str, + help="Output LHE file path. If not specified, output to input file") + args = parser.parse_args() + + logging.info('>>> launch addLHEnumbers.py in %s' % os.path.abspath(os.getcwd())) + + logging.info('>>> Input file: [%s]' % args.input_file) + logging.info('>>> Write to output: %s ' % args.output_file) + + number_events(args.input_file, args.output_file) \ No newline at end of file diff --git a/GeneratorInterface/LHEInterface/scripts/mergeLHE.py b/GeneratorInterface/LHEInterface/scripts/mergeLHE.py index 025079b00c34e..b61925363d2c9 100755 --- a/GeneratorInterface/LHEInterface/scripts/mergeLHE.py +++ b/GeneratorInterface/LHEInterface/scripts/mergeLHE.py @@ -9,6 +9,9 @@ import os import re +import addLHEnumbers + + class BaseLHEMerger(object): """Base class of the LHE merge schemes""" @@ -62,7 +65,7 @@ def check_header_compatibility(self): % ', '.join([str(len(lines)) for lines in self._header_lines])) assert all([ len(self._header_lines[0]) == len(lines) for lines in self._header_lines] - ), inconsistent_error_info % "line number not matches" + ), inconsistent_error_info % "line number does not match" inconsistent_lines_set = [set() for _ in self._header_lines] for line_zip in zip(*self._header_lines): if any([k in line_zip[0] for k in allow_diff_keys]): @@ -253,7 +256,7 @@ def merge(self): sign = lambda x: -1 if x < 0 else 1 for line in ftmp: event_line += 1 - if re.search('\s*', line): + if re.search('\s*', line) and not re.search('\s*', line): event_line = 0 if event_line == 1: # modify the XWGTUP appeared in the first line of the @@ -366,6 +369,8 @@ def main(argv = None): help=("Bypass the compatibility check for the headers. If true, the header and init block " "will be just a duplicate from the first input file, and events are concatenated without " "modification.")) + parser.add_argument("-n", "--number-events", action='store_true', + help=("Add a tag to number each lhe event. Needed for Herwig to find correct lhe events")) parser.add_argument("--debug", action='store_true', help="Use the debug mode.") args = parser.parse_args(argv) @@ -392,6 +397,11 @@ def main(argv = None): if not os.path.exists(os.path.dirname(os.path.realpath(args.output_file))): os.makedirs(os.path.dirname(os.path.realpath(args.output_file))) + if args.number_events: + offset = 0 + for input_file in input_files: + offset += addLHEnumbers.number_events(input_file, offset=offset) + # Check arguments assert len(input_files) > 0, 'Input LHE files should be more than 0.' if len(input_files) == 1: @@ -408,7 +418,8 @@ def main(argv = None): elif args.force_cpp_merger: lhe_merger = ExternalCppLHEMerger(input_files, args.output_file) else: - lhe_merger = DefaultLHEMerger(input_files, args.output_file, bypass_check=args.bypass_check) + lhe_merger = DefaultLHEMerger( + input_files, args.output_file, bypass_check=args.bypass_check) # Do merging lhe_merger.merge() diff --git a/GeneratorInterface/LHEInterface/src/LHEEvent.cc b/GeneratorInterface/LHEInterface/src/LHEEvent.cc index 284e85f6413ff..1231c41055a1c 100644 --- a/GeneratorInterface/LHEInterface/src/LHEEvent.cc +++ b/GeneratorInterface/LHEInterface/src/LHEEvent.cc @@ -40,7 +40,8 @@ namespace lhef { counted(false), readAttemptCounter(0), npLO_(-99), - npNLO_(-99) + npNLO_(-99), + evtnum_(-1) { hepeup.NUP = 0; @@ -106,7 +107,7 @@ namespace lhef { } LHEEvent::LHEEvent(const std::shared_ptr &runInfo, const HEPEUP &hepeup) - : runInfo(runInfo), hepeup(hepeup), counted(false), readAttemptCounter(0), npLO_(-99), npNLO_(-99) {} + : runInfo(runInfo), hepeup(hepeup), counted(false), readAttemptCounter(0), npLO_(-99), npNLO_(-99), evtnum_(-1) {} LHEEvent::LHEEvent(const std::shared_ptr &runInfo, const HEPEUP &hepeup, @@ -119,7 +120,8 @@ namespace lhef { counted(false), readAttemptCounter(0), npLO_(-99), - npNLO_(-99) {} + npNLO_(-99), + evtnum_(-1) {} LHEEvent::LHEEvent(const std::shared_ptr &runInfo, const LHEEventProduct &product) : runInfo(runInfo), @@ -132,7 +134,8 @@ namespace lhef { originalXWGTUP_(product.originalXWGTUP()), scales_(product.scales()), npLO_(product.npLO()), - npNLO_(product.npNLO()) {} + npNLO_(product.npNLO()), + evtnum_(product.evtnum()) {} LHEEvent::~LHEEvent() {} diff --git a/GeneratorInterface/LHEInterface/src/LHEReader.cc b/GeneratorInterface/LHEInterface/src/LHEReader.cc index 92a0b407e921b..76a05926a3301 100644 --- a/GeneratorInterface/LHEInterface/src/LHEReader.cc +++ b/GeneratorInterface/LHEInterface/src/LHEReader.cc @@ -141,6 +141,7 @@ namespace lhef { int npLO; int npNLO; std::vector scales; + int evtnum = -1; }; static void attributesToDom(DOMElement *dom, const Attributes &attributes) { @@ -215,6 +216,9 @@ namespace lhef { scales.push_back(scaleval); } + } else if (name == "event_num") { + const char *evtnumstr = XMLSimpleStr(attributes.getValue(XMLString::transcode("num"))); + sscanf(evtnumstr, "%d", &evtnum); } xmlEventNodes.push_back(elem); return; @@ -526,6 +530,8 @@ namespace lhef { } lheevent->setNpLO(handler->npLO); lheevent->setNpNLO(handler->npNLO); + lheevent->setEvtNum(handler->evtnum); + handler->evtnum = -1; //fill scales if (!handler->scales.empty()) { lheevent->setScales(handler->scales); diff --git a/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h b/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h index b2b8e1358b08f..ebffbd2de47c6 100644 --- a/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h +++ b/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h @@ -39,9 +39,11 @@ class LHEEventProduct { int npLO() const { return npLO_; } int npNLO() const { return npNLO_; } + int evtnum() const { return evtnum_; } void setNpLO(int n) { npLO_ = n; } void setNpNLO(int n) { npNLO_ = n; } + void setEvtNum(int n) { evtnum_ = n; } const lhef::HEPEUP &hepeup() const { return hepeup_; } const PDF *pdf() const { return pdf_.get(); } @@ -108,6 +110,7 @@ class LHEEventProduct { std::vector scales_; //scale value used to exclude EWK-produced partons from matching int npLO_; //number of partons for LO process (used to steer matching/merging) int npNLO_; //number of partons for NLO process (used to steer matching/merging) + int evtnum_; //The number of the event (needed to ensure the correct LHE events are saved for MG +Herwig) }; #endif // GeneratorEvent_LHEInterface_LHEEventProduct_h diff --git a/SimDataFormats/GeneratorProducts/src/classes_def.xml b/SimDataFormats/GeneratorProducts/src/classes_def.xml index 8713c2309ca58..ae4e6560d2c4d 100644 --- a/SimDataFormats/GeneratorProducts/src/classes_def.xml +++ b/SimDataFormats/GeneratorProducts/src/classes_def.xml @@ -209,12 +209,13 @@ - + + From c5ccbca47946cb82637252c99cf1acfdbb92f093 Mon Sep 17 00:00:00 2001 From: Huilin Qu Date: Mon, 28 Aug 2023 15:54:19 +0200 Subject: [PATCH 04/17] Fix nanoAOD_addDeepInfoAK4 in jetsAK4_Puppi_cff.py --- PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py b/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py index c892cdb953a0e..d913e04945291 100644 --- a/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py +++ b/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py @@ -160,11 +160,11 @@ def nanoAOD_addDeepInfoAK4(process,addParticleNet,addRobustParTAK4=False): jetSource = cms.InputTag('slimmedJetsPuppi'), jetCorrections = ('AK4PFPuppi', cms.vstring(['L2Relative', 'L3Absolute']), 'None'), btagDiscriminators = _btagDiscriminators, - postfix = 'WithDeepInfo', + postfix = 'PuppiWithDeepInfo', ) process.load("Configuration.StandardSequences.MagneticField_cff") - process.jetPuppiCorrFactorsNano.src="selectedUpdatedPatJetsWithDeepInfo" - process.updatedJets.jetSource="selectedUpdatedPatJetsWithDeepInfo" + process.jetPuppiCorrFactorsNano.src = "selectedUpdatedPatJetsPuppiWithDeepInfo" + process.updatedJetsPuppi.jetSource = "selectedUpdatedPatJetsPuppiWithDeepInfo" return process nanoAOD_addDeepInfoAK4_switch = cms.PSet( From c1496f58d11ff0392fd64989201fb7d121636275 Mon Sep 17 00:00:00 2001 From: Huilin Qu Date: Mon, 28 Aug 2023 18:37:40 +0200 Subject: [PATCH 05/17] Fix RobustParTAK4CvB definition. --- PhysicsTools/NanoAOD/python/jetsAK4_CHS_cff.py | 2 +- PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/jetsAK4_CHS_cff.py b/PhysicsTools/NanoAOD/python/jetsAK4_CHS_cff.py index 3d45018f7d0bc..490cbdcc98d18 100644 --- a/PhysicsTools/NanoAOD/python/jetsAK4_CHS_cff.py +++ b/PhysicsTools/NanoAOD/python/jetsAK4_CHS_cff.py @@ -146,7 +146,7 @@ float, doc="RobustParTAK4 c vs uds+g discriminator", precision=10), - btagRobustParTAK4CvB = Var("?(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')):-1", + btagRobustParTAK4CvB = Var("?(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb')):-1", float, doc="RobustParTAK4 c vs b+bb+lepb discriminator", precision=10), diff --git a/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py b/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py index d913e04945291..dd79a762e8e5d 100644 --- a/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py +++ b/PhysicsTools/NanoAOD/python/jetsAK4_Puppi_cff.py @@ -87,7 +87,7 @@ btagDeepFlavCvB = Var("?(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb'))>0?bDiscriminator('pfDeepFlavourJetTags:probc')/(bDiscriminator('pfDeepFlavourJetTags:probc')+bDiscriminator('pfDeepFlavourJetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')):-1",float,doc="DeepJet c vs b+bb+lepb discriminator",precision=10), btagDeepFlavQG = Var("?(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds'))>0?bDiscriminator('pfDeepFlavourJetTags:probg')/(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds')):-1",float,doc="DeepJet g vs uds discriminator",precision=10), btagRobustParTAK4CvL = Var("?(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfParticleTransformerAK4JetTags:probg'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfParticleTransformerAK4JetTags:probg')):-1",float,doc="RobustParTAK4 c vs uds+g discriminator",precision=10), - btagRobustParTAK4CvB = Var("?(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb')):-1",float,doc="RobustParTAK4 c vs b+bb+lepb discriminator",precision=10), + btagRobustParTAK4CvB = Var("?(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb')):-1",float,doc="RobustParTAK4 c vs b+bb+lepb discriminator",precision=10), btagRobustParTAK4QG = Var("?(bDiscriminator('pfParticleTransformerAK4JetTags:probg')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probg')/(bDiscriminator('pfParticleTransformerAK4JetTags:probg')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')):-1",float,doc="RobustParTAK4 g vs uds discriminator",precision=10), btagPNetB = Var("?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:BvsAll')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:BvsAll'):-1",float,precision=10,doc="ParticleNet b vs. udscg"), btagPNetCvL = Var("?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:CvsL')>0?bDiscriminator('pfParticleNetFromMiniAODAK4PuppiCentralDiscriminatorsJetTags:CvsL'):-1",float,precision=10,doc="ParticleNet c vs. udsg"), From 8986508feba97df48d1e534f6cdd83d135bb19dc Mon Sep 17 00:00:00 2001 From: Huilin Qu Date: Tue, 29 Aug 2023 19:54:55 +0200 Subject: [PATCH 06/17] Fix RobustParTAK4 definitions in JME Nano. --- PhysicsTools/NanoAOD/python/custom_jme_cff.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/custom_jme_cff.py b/PhysicsTools/NanoAOD/python/custom_jme_cff.py index 4a93b44f5c2e9..e378a07cbe144 100644 --- a/PhysicsTools/NanoAOD/python/custom_jme_cff.py +++ b/PhysicsTools/NanoAOD/python/custom_jme_cff.py @@ -182,13 +182,13 @@ btagDeepFlavQG = Var("?(pt>=15)&&(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds'))>0?bDiscriminator('pfDeepFlavourJetTags:probg')/(bDiscriminator('pfDeepFlavourJetTags:probg')+bDiscriminator('pfDeepFlavourJetTags:probuds')):-1",float,doc="DeepJet g vs uds discriminator",precision=10), ) ROBUSTPARTAK4VARS = cms.PSet( - btagRobustParTAK4B = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4Tags:probb')+bDiscriminator('pfDeepFlavourJetTags:probbb')+bDiscriminator('pfDeepFlavourJetTags:problepb'):-1",float,doc="DeepJet b+bb+lepb tag discriminator",precision=10), - btagRobustParTAK4C = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4Tags:probc'):-1",float,doc="DeepFlavour charm tag raw score",precision=10), - btagRobustParTAK4G = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4Tags:probg'):-1",float,doc="DeepFlavour gluon tag raw score",precision=10), - btagRobustParTAK4UDS = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4Tags:probuds'):-1",float,doc="DeepFlavour uds tag raw score",precision=10), - btagRobustParTAK4CvL = Var("?(pt>=15)&&(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfParticleTransformerAK4JetTags:probg'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfParticleTransformerAK4JetTags:probg')):-1",float,doc="DeepJet c vs uds+g discriminator",precision=10), - btagRobustParTAK4CvB = Var("?(pt>=15)&&(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb')):-1",float,doc="DeepJet c vs b+bb+lepb discriminator",precision=10), - btagRobustParTAK4QG = Var("?(pt>=15)&&(bDiscriminator('pfParticleTransformerAK4JetTags:probg')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probg')/(bDiscriminator('pfParticleTransformerAK4JetTags:probg')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')):-1",float,doc="DeepJet g vs uds discriminator",precision=10), + btagRobustParTAK4B = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb'):-1",float,doc="RobustParTAK4 b+bb+lepb tag discriminator",precision=10), + btagRobustParTAK4C = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4JetTags:probc'):-1",float,doc="RobustParTAK4 charm tag raw score",precision=10), + btagRobustParTAK4G = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4JetTags:probg'):-1",float,doc="RobustParTAK4 gluon tag raw score",precision=10), + btagRobustParTAK4UDS = Var("?(pt>=15)?bDiscriminator('pfParticleTransformerAK4JetTags:probuds'):-1",float,doc="RobustParTAK4 uds tag raw score",precision=10), + btagRobustParTAK4CvL = Var("?(pt>=15)&&(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfParticleTransformerAK4JetTags:probg'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')+bDiscriminator('pfParticleTransformerAK4JetTags:probg')):-1",float,doc="RobustParTAK4 c vs uds+g discriminator",precision=10), + btagRobustParTAK4CvB = Var("?(pt>=15)&&(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probc')/(bDiscriminator('pfParticleTransformerAK4JetTags:probc')+bDiscriminator('pfParticleTransformerAK4JetTags:probb')+bDiscriminator('pfParticleTransformerAK4JetTags:probbb')+bDiscriminator('pfParticleTransformerAK4JetTags:problepb')):-1",float,doc="RobustParTAK4 c vs b+bb+lepb discriminator",precision=10), + btagRobustParTAK4QG = Var("?(pt>=15)&&(bDiscriminator('pfParticleTransformerAK4JetTags:probg')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds'))>0?bDiscriminator('pfParticleTransformerAK4JetTags:probg')/(bDiscriminator('pfParticleTransformerAK4JetTags:probg')+bDiscriminator('pfParticleTransformerAK4JetTags:probuds')):-1",float,doc="RobustParTAK4 g vs uds discriminator",precision=10), ) PARTICLENETAK4VARS = cms.PSet( particleNetAK4_B = Var("?(pt>=15)?bDiscriminator('pfParticleNetAK4DiscriminatorsJetTags:BvsAll'):-1",float,doc="ParticleNetAK4 tagger b vs all (udsg, c) discriminator",precision=10), From 252e75a48abec521f0f686b1dc3685c3666c22a9 Mon Sep 17 00:00:00 2001 From: prasant Date: Wed, 30 Aug 2023 13:41:47 +0200 Subject: [PATCH 07/17] Fall17V2 IDs and Isolations saved only in Run2 --- PhysicsTools/NanoAOD/python/photons_cff.py | 56 ++++++++-------------- 1 file changed, 20 insertions(+), 36 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/photons_cff.py b/PhysicsTools/NanoAOD/python/photons_cff.py index 39db6ad1cd495..6999c9dd3a75e 100644 --- a/PhysicsTools/NanoAOD/python/photons_cff.py +++ b/PhysicsTools/NanoAOD/python/photons_cff.py @@ -205,29 +205,16 @@ def make_bitmapVID_docstring(id_modules_working_points_pset): "uint8", doc="cut-based ID bitmap, RunIIIWinter22V1, (0:fail, 1:loose, 2:medium, 3:tight)", ), - cutBased_Fall17V2 = Var( - "userInt('cutBasedID_Fall17V2_loose')+userInt('cutBasedID_Fall17V2_medium')+userInt('cutBasedID_Fall17V2_tight')", - "uint8", - doc="cut-based ID bitmap, Fall17V2, (0:fail, 1:loose, 2:medium, 3:tight)", - ), vidNestedWPBitmap = Var( "userInt('VIDNestedWPBitmap')", int, doc="RunIIIWinter22V1 " + _bitmapVIDForPho_docstring ), - vidNestedWPBitmap_Fall17V2 = Var( - "userInt('VIDNestedWPBitmapFall17V2')", - int, - doc="Fall17V2 " + _bitmapVIDForPhoRun2_docstring - ), electronVeto = Var("passElectronVeto()",bool,doc="pass electron veto"), pixelSeed = Var("hasPixelSeed()",bool,doc="has pixel seed"), mvaID = Var("userFloat('mvaID')",float,doc="MVA ID score, Winter22V1",precision=10), mvaID_WP90 = Var("userInt('mvaID_WP90')",bool,doc="MVA ID WP90, Winter22V1"), mvaID_WP80 = Var("userInt('mvaID_WP80')",bool,doc="MVA ID WP80, Winter22V1"), - mvaID_Fall17V2 = Var("userFloat('mvaID_Fall17V2')",float,doc="MVA ID score, Fall17V2",precision=10), - mvaID_Fall17V2_WP90 = Var("userInt('mvaID_Fall17V2_WP90')",bool,doc="MVA ID WP90, Fall17V2"), - mvaID_Fall17V2_WP80 = Var("userInt('mvaID_Fall17V2_WP80')",bool,doc="MVA ID WP80, Fall17V2"), trkSumPtHollowConeDR03 = Var("trkSumPtHollowConeDR03()",float,doc="Sum of track pT in a hollow cone of outer radius, inner radius", precision=8), trkSumPtSolidConeDR04 = Var("trkSumPtSolidConeDR04()",float,doc="Sum of track pT in a cone of dR=0.4", precision=8), ecalPFClusterIso = Var("ecalPFClusterIso()",float,doc="sum pt of ecal clusters, vetoing clusters part of photon", precision=8), @@ -238,8 +225,6 @@ def make_bitmapVID_docstring(id_modules_working_points_pset): pfChargedIsoWorstVtx = Var("chargedHadronWorstVtxIso()",float,doc="PF absolute isolation dR=0.3, charged component (Vertex with largest isolation)"), pfRelIso03_chg_quadratic = Var("userFloat('PFIsoChgQuadratic')/pt",float,doc="PF relative isolation dR=0.3, charged hadron component (with quadraticEA*rho*rho + linearEA*rho Winter22V1 corrections)"), pfRelIso03_all_quadratic = Var("userFloat('PFIsoAllQuadratic')/pt",float,doc="PF relative isolation dR=0.3, total (with quadraticEA*rho*rho + linearEA*rho Winter22V1 corrections)"), - pfRelIso03_chg_Fall17V2 = Var("userFloat('PFIsoChgFall17V2')/pt",float,doc="PF relative isolation dR=0.3, charged component (with Fall17V2 rho*EA PU corrections)"), - pfRelIso03_all_Fall17V2 = Var("userFloat('PFIsoAllFall17V2')/pt",float,doc="PF relative isolation dR=0.3, total (with Fall17V2 rho*EA PU corrections)"), hoe = Var("hadronicOverEm()",float,doc="H over E",precision=8), hoe_PUcorr = Var("userFloat('HoverEQuadratic')",float,doc="PU corrected H/E (cone-based with quadraticEA*rho*rho + linearEA*rho Winter22V1 corrections)",precision=8), isScEtaEB = Var("abs(superCluster().eta()) < 1.4442",bool,doc="is supercluster eta within barrel acceptance"), @@ -258,33 +243,32 @@ def make_bitmapVID_docstring(id_modules_working_points_pset): ) ) -# switch default IDs back to Fall17V2 in Run2, remove Winter22V1 and quadratic iso -run2_egamma.toModify(photonTable.variables, - cutBased = photonTable.variables.cutBased_Fall17V2, - cutBased_Fall17V2 = None, - vidNestedWPBitmap = photonTable.variables.vidNestedWPBitmap_Fall17V2, - vidNestedWPBitmap_Fall17V2 = None, - mvaID = photonTable.variables.mvaID_Fall17V2, - mvaID_Fall17V2 = None, - mvaID_WP90 = photonTable.variables.mvaID_Fall17V2_WP90, - mvaID_Fall17V2_WP90 = None, - mvaID_WP80 = photonTable.variables.mvaID_Fall17V2_WP80, - mvaID_Fall17V2_WP80 = None, - pfRelIso03_chg = photonTable.variables.pfRelIso03_chg_Fall17V2, - pfRelIso03_chg_Fall17V2 = None, - pfRelIso03_all = photonTable.variables.pfRelIso03_all_Fall17V2, - pfRelIso03_all_Fall17V2 = None, - pfRelIso03_chg_quadratic=None, - pfRelIso03_all_quadratic=None, - hoe_PUcorr=None) - -#these eras need to make the energy correction, hence the "New" + +#these eras need to make the energy correction, hence the "New". Also save only Fall17V2 IDS in Run2, No Run3 Winter22V1 and quadratic iso in Run2 run2_egamma.toModify( photonTable.variables, pt = Var("pt*userFloat('ecalEnergyPostCorrNew')/userFloat('ecalEnergyPreCorrNew')", float, precision=-1, doc="p_{T}"), energyErr = Var("userFloat('ecalEnergyErrPostCorrNew')",float,doc="energy error of the cluster from regression",precision=6), eCorr = Var("userFloat('ecalEnergyPostCorrNew')/userFloat('ecalEnergyPreCorrNew')",float,doc="ratio of the calibrated energy/miniaod energy"), hoe = Var("hadTowOverEm()",float,doc="H over E (Run2)",precision=8), + cutBased = Var( + "userInt('cutBasedID_Fall17V2_loose')+userInt('cutBasedID_Fall17V2_medium')+userInt('cutBasedID_Fall17V2_tight')", + "uint8", + doc="cut-based ID bitmap, Fall17V2, (0:fail, 1:loose, 2:medium, 3:tight)", + ), + vidNestedWPBitmap = Var( + "userInt('VIDNestedWPBitmapFall17V2')", + int, + doc="Fall17V2 " + _bitmapVIDForPhoRun2_docstring + ), + mvaID = Var("userFloat('mvaID_Fall17V2')",float,doc="MVA ID score, Fall17V2",precision=10), + mvaID_WP90 = Var("userInt('mvaID_Fall17V2_WP90')",bool,doc="MVA ID WP90, Fall17V2"), + mvaID_WP80 = Var("userInt('mvaID_Fall17V2_WP80')",bool,doc="MVA ID WP80, Fall17V2"), + pfRelIso03_chg = Var("userFloat('PFIsoChgFall17V2')/pt",float,doc="PF relative isolation dR=0.3, charged component (with Fall17V2rho*EA PU corrections)"), + pfRelIso03_all = Var("userFloat('PFIsoAllFall17V2')/pt",float,doc="PF relative isolation dR=0.3, total (with Fall17V2 rho*EA PU corrections)"), + pfRelIso03_chg_quadratic=None, + pfRelIso03_all_quadratic=None, + hoe_PUcorr=None ) photonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR From a87d5fbd195bc913e5273c7c0072067241e4d757 Mon Sep 17 00:00:00 2001 From: Artur Gottmann Date: Thu, 31 Aug 2023 13:29:21 +0200 Subject: [PATCH 08/17] Change the access to track reference with a more robust approach --- .../EgammaElectronProducers/plugins/LowPtGSFToTrackLinker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGSFToTrackLinker.cc b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGSFToTrackLinker.cc index c44506605c68d..cacad359f9d88 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/LowPtGSFToTrackLinker.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/LowPtGSFToTrackLinker.cc @@ -54,7 +54,7 @@ void LowPtGSFToTrackLinker::produce(edm::StreamID, edm::Event& iEvent, const edm //map Track --> GSF and fill GSF --> PackedCandidates and GSF --> Lost associations for (unsigned int igsf = 0; igsf < ngsf; ++igsf) { reco::GsfTrackRef gref(gsftracks, igsf); - reco::TrackRef trk = preid->at(gref->seedRef().castTo().index()).trackRef(); + reco::TrackRef trk = gref->seedRef().castTo()->ctfTrack(); if (trk.id() != tracks.id()) { throw cms::Exception( From 7a16c0025b03b4f1de530c485f245b51ee46b54a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 31 Aug 2023 16:15:30 +0200 Subject: [PATCH 09/17] Enable Simulation Runs for 6 inch wafers as well --- .../hgcalParametersInitialization_cfi.py | 22 +++++++++++++++++++ SimG4CMS/Calo/BuildFile.xml | 1 + SimG4CMS/Calo/interface/HGCNumberingScheme.h | 6 ++--- SimG4CMS/Calo/interface/HGCSD.h | 5 +++-- SimG4CMS/Calo/plugins/BuildFile.xml | 1 + .../plugins/HGCSensitiveDetectorBuilder.cc | 8 +++---- SimG4CMS/Calo/src/HGCNumberingScheme.cc | 2 +- SimG4CMS/Calo/src/HGCSD.cc | 12 ++++++---- .../test/HGCalTBCERN181Oct1_cfg.py | 9 +++++--- 9 files changed, 49 insertions(+), 17 deletions(-) create mode 100644 Geometry/HGCalTBCommonData/python/hgcalParametersInitialization_cfi.py diff --git a/Geometry/HGCalTBCommonData/python/hgcalParametersInitialization_cfi.py b/Geometry/HGCalTBCommonData/python/hgcalParametersInitialization_cfi.py new file mode 100644 index 0000000000000..0bc6352a9d2db --- /dev/null +++ b/Geometry/HGCalTBCommonData/python/hgcalParametersInitialization_cfi.py @@ -0,0 +1,22 @@ +import FWCore.ParameterSet.Config as cms + +hgcalTBEEParametersInitialize = cms.ESProducer('HGCalParametersESModule', + name = cms.string('HGCalEESensitive'), + nameW = cms.string('HGCalEEWafer'), + nameC = cms.string('HGCalEECell'), + nameX = cms.string('HGCalEESensitive'), + fromDD4hep = cms.bool(False), + appendToDataLabel = cms.string('') +) + +from Configuration.ProcessModifiers.dd4hep_cff import dd4hep + +dd4hep.toModify(hgcalTBEEParametersInitialize, + fromDD4hep = True) + +hgcalTBHESiParametersInitialize = hgcalTBEEParametersInitialize.clone( + name = "HGCalHESiliconSensitive", + nameW = "HGCalHEWafer", + nameC = "HGCalHECell", + nameX = "HGCalHESiliconSensitive", +) diff --git a/SimG4CMS/Calo/BuildFile.xml b/SimG4CMS/Calo/BuildFile.xml index 7b5daa8b441ab..5d2f500750ecf 100644 --- a/SimG4CMS/Calo/BuildFile.xml +++ b/SimG4CMS/Calo/BuildFile.xml @@ -14,6 +14,7 @@ + diff --git a/SimG4CMS/Calo/interface/HGCNumberingScheme.h b/SimG4CMS/Calo/interface/HGCNumberingScheme.h index c2c5746033f9c..d9f40b3c59330 100644 --- a/SimG4CMS/Calo/interface/HGCNumberingScheme.h +++ b/SimG4CMS/Calo/interface/HGCNumberingScheme.h @@ -6,7 +6,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" -#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" +#include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h" #include "G4ThreeVector.hh" @@ -14,7 +14,7 @@ class HGCNumberingScheme { public: enum HGCNumberingParameters { HGCCellSize }; - HGCNumberingScheme(const HGCalDDDConstants& hgc, std::string& name); + HGCNumberingScheme(const HGCalTBDDDConstants& hgc, std::string& name); HGCNumberingScheme() = delete; ~HGCNumberingScheme(); @@ -35,7 +35,7 @@ class HGCNumberingScheme { std::pair getLocalCoords(int cell, int layer); private: - const HGCalDDDConstants& hgcons_; + const HGCalTBDDDConstants& hgcons_; }; #endif diff --git a/SimG4CMS/Calo/interface/HGCSD.h b/SimG4CMS/Calo/interface/HGCSD.h index 609fa316407c8..9cad0ca3351d8 100644 --- a/SimG4CMS/Calo/interface/HGCSD.h +++ b/SimG4CMS/Calo/interface/HGCSD.h @@ -11,6 +11,7 @@ #include "SimG4Core/Notification/interface/BeginOfEvent.h" #include "SimG4CMS/Calo/interface/HGCNumberingScheme.h" #include "SimG4CMS/Calo/interface/HGCMouseBite.h" +#include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h" #include #include @@ -22,7 +23,7 @@ class G4Step; class HGCSD : public CaloSD, public Observer { public: HGCSD(const std::string &, - const HGCalDDDConstants *, + const HGCalTBDDDConstants *, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *); @@ -43,7 +44,7 @@ class HGCSD : public CaloSD, public Observer { uint32_t setDetUnitId(ForwardSubdetector &, int, int, int, int, G4ThreeVector &); bool isItinFidVolume(const G4ThreeVector &) { return true; } - const HGCalDDDConstants *hgcons_; + const HGCalTBDDDConstants *hgcons_; std::string nameX_; HGCalGeometryMode::GeometryMode geom_mode_; std::unique_ptr numberingScheme_; diff --git a/SimG4CMS/Calo/plugins/BuildFile.xml b/SimG4CMS/Calo/plugins/BuildFile.xml index 449edbe1206c8..74f738e52d844 100644 --- a/SimG4CMS/Calo/plugins/BuildFile.xml +++ b/SimG4CMS/Calo/plugins/BuildFile.xml @@ -10,6 +10,7 @@ + diff --git a/SimG4CMS/Calo/plugins/HGCSensitiveDetectorBuilder.cc b/SimG4CMS/Calo/plugins/HGCSensitiveDetectorBuilder.cc index 18520a5fcd1c6..6d5f05587ffa7 100644 --- a/SimG4CMS/Calo/plugins/HGCSensitiveDetectorBuilder.cc +++ b/SimG4CMS/Calo/plugins/HGCSensitiveDetectorBuilder.cc @@ -8,7 +8,7 @@ #include "SimG4Core/Notification/interface/SimActivityRegistryEnroller.h" #include "SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h" -#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" +#include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "SimG4CMS/Calo/interface/HGCSD.h" @@ -40,7 +40,7 @@ class HGCSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { const edm::ParameterSet& p, const SimTrackManager* man, SimActivityRegistry& reg) const final { - const HGCalDDDConstants* hgc = nullptr; + const HGCalTBDDDConstants* hgc = nullptr; for (int k = 0; k < num_; ++k) { if (iname.find(name1_[k]) != std::string::npos) { if (hgcons_[k].isValid()) @@ -58,8 +58,8 @@ class HGCSensitiveDetectorBuilder : public SensitiveDetectorMakerBase { const std::string name0_[nameSize_] = {"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"}; const std::string name1_[nameSize_] = {"HitsEE", "HitsHEfront", "HitsHEback"}; int num_; - std::vector> hgcToken_; - std::vector> hgcons_; + std::vector> hgcToken_; + std::vector> hgcons_; }; typedef HGCSD HGCSensitiveDetector; diff --git a/SimG4CMS/Calo/src/HGCNumberingScheme.cc b/SimG4CMS/Calo/src/HGCNumberingScheme.cc index b5a044002d024..5bf5b1cdda06d 100644 --- a/SimG4CMS/Calo/src/HGCNumberingScheme.cc +++ b/SimG4CMS/Calo/src/HGCNumberingScheme.cc @@ -15,7 +15,7 @@ //#define EDM_ML_DEBUG -HGCNumberingScheme::HGCNumberingScheme(const HGCalDDDConstants& hgc, std::string& name) : hgcons_(hgc) { +HGCNumberingScheme::HGCNumberingScheme(const HGCalTBDDDConstants& hgc, std::string& name) : hgcons_(hgc) { edm::LogVerbatim("HGCSim") << "Creating HGCNumberingScheme for " << name; } diff --git a/SimG4CMS/Calo/src/HGCSD.cc b/SimG4CMS/Calo/src/HGCSD.cc index 561adde390b25..d206c1320e842 100644 --- a/SimG4CMS/Calo/src/HGCSD.cc +++ b/SimG4CMS/Calo/src/HGCSD.cc @@ -11,7 +11,7 @@ #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" +#include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "G4LogicalVolumeStore.hh" #include "G4LogicalVolume.hh" @@ -30,7 +30,7 @@ //#define plotDebug HGCSD::HGCSD(const std::string& name, - const HGCalDDDConstants* hgc, + const HGCalTBDDDConstants* hgc, const SensitiveDetectorCatalog& clg, edm::ParameterSet const& p, const SimTrackManager* manager) @@ -196,8 +196,10 @@ uint32_t HGCSD::setDetUnitId(const G4Step* aStep) { #endif G4ThreeVector local = ((moduleLev >= 0) ? (touch->GetHistory()->GetTransform(moduleLev).TransformPoint(hitPoint)) : G4ThreeVector()); + /* if (mouseBite_->exclude(local, z, layer, wafer, 0)) id = 0; + */ } return id; } @@ -210,11 +212,13 @@ void HGCSD::update(const BeginOfJob* job) { if (dd4hep_) ++levelT_; numberingScheme_ = std::make_unique(*hgcons_, nameX_); + /* if (rejectMB_) mouseBite_ = std::make_unique(*hgcons_, angles_, mouseBiteCut_, waferRot_); + */ } else { - edm::LogError("HGCSim") << "HGCSD : Cannot find HGCalDDDConstants for " << nameX_; - throw cms::Exception("Unknown", "HGCSD") << "Cannot find HGCalDDDConstants for " << nameX_ << "\n"; + edm::LogError("HGCSim") << "HGCSD : Cannot find HGCalTBDDDConstants for " << nameX_; + throw cms::Exception("Unknown", "HGCSD") << "Cannot find HGCalTBDDDConstants for " << nameX_ << "\n"; } #ifdef EDM_ML_DEBUG edm::LogVerbatim("HGCSim") << "HGCSD::Initialized with mode " << geom_mode_ << " Slope cut " << slopeMin_ diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py index 639007bc61057..dd69c75e6f0ae 100644 --- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py +++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py @@ -10,8 +10,8 @@ process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') process.load('SimG4CMS.HGCalTestBeam.HGCalTB181Oct1XML_cfi') -process.load('Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi') -process.load('Geometry.HGCalCommonData.hgcalParametersInitialization_cfi') +process.load('Geometry.HGCalTBCommonData.hgcalTBNumberingInitialization_cfi') +process.load('Geometry.HGCalTBCommonData.hgcalTBParametersInitialization_cfi') process.load('Geometry.HcalTestBeamData.hcalTB06Parameters_cff') process.load('Configuration.StandardSequences.MagneticField_0T_cff') process.load('Configuration.StandardSequences.Generator_cff') @@ -95,6 +95,9 @@ process.VtxSmeared.MaxY = 7.5 process.g4SimHits.HGCSD.RejectMouseBite = True process.g4SimHits.HGCSD.RotatedWafer = True +process.g4SimHits.G4CheckOverlap.OutputBaseName = "2018" +process.g4SimHits.G4CheckOverlap.gdmlFlag = True +process.g4SimHits.FileNameGDML = "TBHGCal181Oct.gdml" process.g4SimHits.Watchers = cms.VPSet(cms.PSet( HGCPassive = cms.PSet( LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'), @@ -134,7 +137,7 @@ process.genfiltersummary_step, process.simulation_step, process.gunfilter_step, - process.analysis_step, +# process.analysis_step, process.endjob_step, process.FEVTDEBUGoutput_step ) From 88bcbb6d4754e88057e92179195bb358b9c16180 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 1 Sep 2023 04:26:43 +0200 Subject: [PATCH 10/17] Protect use of TTree with plotDebug flag --- SimG4CMS/Calo/interface/HGCSD.h | 7 ++++++- SimG4CMS/Calo/src/HGCSD.cc | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/SimG4CMS/Calo/interface/HGCSD.h b/SimG4CMS/Calo/interface/HGCSD.h index 9cad0ca3351d8..53fc9885aef6a 100644 --- a/SimG4CMS/Calo/interface/HGCSD.h +++ b/SimG4CMS/Calo/interface/HGCSD.h @@ -6,6 +6,8 @@ // appropriate container /////////////////////////////////////////////////////////////////////////////// +//#define plotDebug + #include "SimG4CMS/Calo/interface/CaloSD.h" #include "SimG4Core/Notification/interface/BeginOfJob.h" #include "SimG4Core/Notification/interface/BeginOfEvent.h" @@ -14,8 +16,9 @@ #include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h" #include +#ifdef plotDebug #include - +#endif class G4LogicalVolume; class G4Material; class G4Step; @@ -58,7 +61,9 @@ class HGCSD : public CaloSD, public Observer { bool dd4hep_; std::vector angles_; +#ifdef plotDebug TTree *tree_; +#endif uint32_t t_EventID_; std::vector t_Layer_, t_Parcode_; std::vector t_dEStep1_, t_dEStep2_, t_TrackE_; diff --git a/SimG4CMS/Calo/src/HGCSD.cc b/SimG4CMS/Calo/src/HGCSD.cc index d206c1320e842..26e98180b4b81 100644 --- a/SimG4CMS/Calo/src/HGCSD.cc +++ b/SimG4CMS/Calo/src/HGCSD.cc @@ -27,7 +27,6 @@ #include //#define EDM_ML_DEBUG -//#define plotDebug HGCSD::HGCSD(const std::string& name, const HGCalTBDDDConstants* hgc, @@ -42,8 +41,10 @@ HGCSD::HGCSD(const std::string& name, p.getParameter("HGCSD").getParameter("IgnoreTrackID")), hgcons_(hgc), slopeMin_(0), - levelT_(99), - tree_(nullptr) { + levelT_(99) { +#ifdef plotDebug + tree_ = nullptr; +#endif numberingScheme_.reset(nullptr); mouseBite_.reset(nullptr); From e33972030fe73001f0a06d63d6250610a1849073 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 1 Sep 2023 04:50:37 +0200 Subject: [PATCH 11/17] Code check --- SimG4CMS/Calo/interface/HGCSD.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SimG4CMS/Calo/interface/HGCSD.h b/SimG4CMS/Calo/interface/HGCSD.h index 53fc9885aef6a..c2c01bb3df080 100644 --- a/SimG4CMS/Calo/interface/HGCSD.h +++ b/SimG4CMS/Calo/interface/HGCSD.h @@ -16,7 +16,7 @@ #include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h" #include -#ifdef plotDebug +#ifdef plotDebug #include #endif class G4LogicalVolume; @@ -61,7 +61,7 @@ class HGCSD : public CaloSD, public Observer { bool dd4hep_; std::vector angles_; -#ifdef plotDebug +#ifdef plotDebug TTree *tree_; #endif uint32_t t_EventID_; From 7dc63de3b020b55211952ef4faa90d24074da64d Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 1 Sep 2023 07:43:17 +0200 Subject: [PATCH 12/17] Modify HGCMouseBite such that it can work for both standard HGCal as well as for TB setups with 6 inch wafers --- SimG4CMS/Calo/interface/HGCMouseBite.h | 8 +++++++- SimG4CMS/Calo/src/HGCMouseBite.cc | 21 +++++++++++++++++---- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/SimG4CMS/Calo/interface/HGCMouseBite.h b/SimG4CMS/Calo/interface/HGCMouseBite.h index 47a849c56e438..df517944c683f 100644 --- a/SimG4CMS/Calo/interface/HGCMouseBite.h +++ b/SimG4CMS/Calo/interface/HGCMouseBite.h @@ -2,6 +2,7 @@ #define SimG4CMS_HGCMouseBite_h #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" +#include "Geometry/HGCalTBCommonData/interface/HGCalTBDDDConstants.h" #include "G4ThreeVector.hh" #include @@ -9,10 +10,15 @@ class HGCMouseBite { public: HGCMouseBite(const HGCalDDDConstants& hgc, const std::vector& angle, double maxLength, bool waferRotate); + HGCMouseBite(const HGCalTBDDDConstants& hgc, const std::vector& angle, double maxLength, bool waferRotate); bool exclude(G4ThreeVector& point, int zside, int layer, int waferU, int waferV); private: - const HGCalDDDConstants& hgcons_; + void init(const std::vector& angle); + + const HGCalDDDConstants* hgcons_; + const HGCalTBDDDConstants* hgTBcons_; + const bool ifTB_; double cut_; bool rot_; bool modeUV_; diff --git a/SimG4CMS/Calo/src/HGCMouseBite.cc b/SimG4CMS/Calo/src/HGCMouseBite.cc index 763b734de075b..db9898ae774fc 100644 --- a/SimG4CMS/Calo/src/HGCMouseBite.cc +++ b/SimG4CMS/Calo/src/HGCMouseBite.cc @@ -7,8 +7,18 @@ //#define EDM_ML_DEBUG HGCMouseBite::HGCMouseBite(const HGCalDDDConstants& hgc, const std::vector& angle, double maxL, bool rot) - : hgcons_(hgc), cut_(maxL), rot_(rot) { - modeUV_ = hgcons_.waferHexagon8(); + : hgcons_(&hgc), hgTBcons_(nullptr), ifTB_(false), cut_(maxL), rot_(rot) { + modeUV_ = hgcons_->waferHexagon8(); + init(angle); +} + +HGCMouseBite::HGCMouseBite(const HGCalTBDDDConstants& hgc, const std::vector& angle, double maxL, bool rot) + : hgcons_(nullptr), hgTBcons_(&hgc), ifTB_(true), cut_(maxL), rot_(rot) { + modeUV_ = false; + init(angle); +} + +void HGCMouseBite::init(const std::vector& angle) { for (auto ang : angle) { projXY_.push_back(std::pair(cos(ang * CLHEP::deg), sin(ang * CLHEP::deg))); } @@ -25,8 +35,11 @@ bool HGCMouseBite::exclude(G4ThreeVector& point, int zside, int lay, int waferU, bool check(false); double dx(0), dy(0); if (point == G4ThreeVector()) { - std::pair xy = - (modeUV_ ? hgcons_.waferPosition(lay, waferU, waferV, false, false) : hgcons_.waferPosition(waferU, false)); + std::pair xy; + if (ifTB_) + xy = hgTBcons_->waferPosition(waferU, false); + else + xy = (modeUV_ ? hgcons_->waferPosition(lay, waferU, waferV, false, false) : hgcons_->waferPosition(waferU, false)); double xx = (zside > 0) ? xy.first : -xy.first; if (rot_) { dx = std::abs(point.y() - xy.second); From 7ec1006ab10721b2c0c0a294901c578f48482173 Mon Sep 17 00:00:00 2001 From: mitaylor Date: Fri, 1 Sep 2023 07:47:16 +0200 Subject: [PATCH 13/17] update centrality thresholds --- .../Configuration/python/customiseSettings.py | 4 + .../python/caloParamsHI_2023_v0_4_1_cfi.py | 128 ++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 L1Trigger/L1TCalorimeter/python/caloParamsHI_2023_v0_4_1_cfi.py diff --git a/L1Trigger/Configuration/python/customiseSettings.py b/L1Trigger/Configuration/python/customiseSettings.py index 8a7d585e2d329..5aa071788bfe2 100644 --- a/L1Trigger/Configuration/python/customiseSettings.py +++ b/L1Trigger/Configuration/python/customiseSettings.py @@ -2,6 +2,10 @@ import os.path import FWCore.ParameterSet.Config as cms +def L1TSettingsToCaloParamsHI_2023_v0_4_1(process): + process.load("L1Trigger.L1TCalorimeter.caloParamsHI_2023_v0_4_1_cfi") + return process + def L1TSettingsToCaloParams_2023_v0_4(process): process.load("L1Trigger.L1TCalorimeter.caloParams_2023_v0_4_cfi") return process diff --git a/L1Trigger/L1TCalorimeter/python/caloParamsHI_2023_v0_4_1_cfi.py b/L1Trigger/L1TCalorimeter/python/caloParamsHI_2023_v0_4_1_cfi.py new file mode 100644 index 0000000000000..70d61781b3b49 --- /dev/null +++ b/L1Trigger/L1TCalorimeter/python/caloParamsHI_2023_v0_4_1_cfi.py @@ -0,0 +1,128 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.L1TCalorimeter.caloParams_cfi import caloParamsSource +import L1Trigger.L1TCalorimeter.caloParams_cfi +caloStage2Params = L1Trigger.L1TCalorimeter.caloParams_cfi.caloParams.clone( + + # EG + egEtaCut = 24, + egHcalThreshold = 0., + egTrimmingLUTFile = "L1Trigger/L1TCalorimeter/data/egTrimmingLUT_10_v16.01.19.txt", + egHOverEcutBarrel = 1, + egHOverEcutEndcap = 1, + egBypassExtHOverE = 1, + egBypassShape = 1, + egBypassECALFG = 1, + + egMaxHOverELUTFile = "L1Trigger/L1TCalorimeter/data/HoverEIdentification_0.995_v15.12.23.txt", + egCompressShapesLUTFile = "L1Trigger/L1TCalorimeter/data/egCompressLUT_v4.txt", + egShapeIdType = "compressed", + egShapeIdLUTFile = "L1Trigger/L1TCalorimeter/data/shapeIdentification_adapt0.99_compressedieta_compressedE_compressedshape_v15.12.08.txt", #Not used any more in the current emulator version, merged with calibration LUT + + egIsolationType = "compressed", + egIsoLUTFile = "L1Trigger/L1TCalorimeter/data/EG_Iso_LUT_Flat_WP_v2_Tight1358_20p0_0p7_40p0_v1_APR23.txt", + egIsoLUTFile2 = "L1Trigger/L1TCalorimeter/data/EG_Iso_LUT_Flat_WP_v2_Loose610_10p0_0p7_40p0_v1_APR23.txt", + + egIsoVetoNrTowersPhi = 2, + egPUSParams = cms.vdouble(1,4,32), #Isolation window in firmware goes up to abs(ieta)=32 for now + egCalibrationType = "compressed", + egCalibrationVersion = 0, + egCalibrationLUTFile = "L1Trigger/L1TCalorimeter/data/EG_Calibration_LUT_correctedEtCalibLUT_v1_APR2023.txt", + + # Tau + isoTauEtaMax = 25, + tauSeedThreshold = 0., + tauIsoLUTFile = "L1Trigger/L1TCalorimeter/data/Tau_Iso_LUT_2023_calibThr1p7_V2gs_effMin0p9_eMin16_eMax60.txt", + tauIsoLUTFile2 = "L1Trigger/L1TCalorimeter/data/Tau_Iso_LUT_2023_calibThr1p7_V2gs_effMin0p9_eMin16_eMax60.txt", + tauCalibrationLUTFile = "L1Trigger/L1TCalorimeter/data/Tau_Cal_LUT_2023_calibThr1p7_V2.txt", + tauCompressLUTFile = "L1Trigger/L1TCalorimeter/data/tauCompressAllLUT_12bit_v3.txt", + tauPUSParams = [1,4,32], + + # jets + jetSeedThreshold = 4.0, + jetPUSType = "PhiRing1", + jetPUSUsePhiRing = 1, + + # Calibration options + jetCalibrationType = "LUT", + jetCompressPtLUTFile = "L1Trigger/L1TCalorimeter/data/lut_pt_compress_2017v1.txt", + jetCompressEtaLUTFile = "L1Trigger/L1TCalorimeter/data/lut_eta_compress_2017v1.txt", + jetCalibrationLUTFile = "L1Trigger/L1TCalorimeter/data/lut_calib_2023v0_ECALZS_PhiRing.txt", + + + # sums: 0=ET, 1=HT, 2=MET, 3=MHT + etSumEtaMin = [1, 1, 1, 1, 1], + etSumEtaMax = [28, 26, 28, 26, 28], + etSumEtThreshold = [0., 30., 0., 30., 0.], # only 2nd (HT) and 4th (MHT) values applied + etSumMetPUSType = "LUT", # et threshold from this LUT supercedes et threshold in line above + etSumBypassEttPUS = 1, + etSumBypassEcalSumPUS = 1, + + etSumMetPUSLUTFile = "L1Trigger/L1TCalorimeter/data/metPumLUT_2023v0_puppiMet_fit.txt", + + etSumCentralityUpper = [5.5, 37.0, 182.5, 502.5, 1244.0, 6000.0, 6000.0, 65535.0], + etSumCentralityLower = [0.0, 5.0, 28.5, 148.0, 427.0, 4662.5, 4810.5, 65535.0], + + # Layer 1 SF + layer1ECalScaleETBins = cms.vint32([3, 6, 9, 12, 15, 20, 25, 30, 35, 40, 45, 55, 70, 256]), + layer1ECalScaleFactors = cms.vdouble([ + 1.12, 1.13, 1.13, 1.12, 1.12, 1.12, 1.13, 1.12, 1.13, 1.12, 1.13, 1.13, 1.14, 1.13, 1.13, 1.13, 1.14, 1.26, 1.11, 1.20, 1.21, 1.22, 1.19, 1.20, 1.19, 0.00, 0.00, 0.00, + 1.12, 1.13, 1.13, 1.12, 1.12, 1.12, 1.13, 1.12, 1.13, 1.12, 1.13, 1.13, 1.14, 1.13, 1.13, 1.13, 1.14, 1.26, 1.11, 1.20, 1.21, 1.22, 1.19, 1.20, 1.19, 1.22, 0.00, 0.00, + 1.08, 1.09, 1.08, 1.08, 1.11, 1.08, 1.09, 1.09, 1.09, 1.09, 1.15, 1.09, 1.10, 1.10, 1.10, 1.10, 1.10, 1.23, 1.07, 1.15, 1.14, 1.16, 1.14, 1.14, 1.15, 1.14, 1.14, 0.00, + 1.06, 1.06, 1.06, 1.06, 1.06, 1.06, 1.06, 1.06, 1.07, 1.07, 1.07, 1.07, 1.07, 1.08, 1.07, 1.09, 1.08, 1.17, 1.06, 1.11, 1.10, 1.13, 1.10, 1.10, 1.11, 1.11, 1.11, 1.09, + 1.04, 1.05, 1.04, 1.05, 1.04, 1.05, 1.06, 1.06, 1.05, 1.05, 1.05, 1.06, 1.06, 1.06, 1.06, 1.06, 1.07, 1.15, 1.04, 1.09, 1.09, 1.10, 1.09, 1.09, 1.10, 1.10, 1.10, 1.08, + 1.04, 1.03, 1.04, 1.04, 1.04, 1.04, 1.04, 1.04, 1.04, 1.04, 1.04, 1.04, 1.05, 1.06, 1.04, 1.05, 1.05, 1.13, 1.03, 1.07, 1.08, 1.08, 1.08, 1.07, 1.07, 1.09, 1.08, 1.07, + 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.04, 1.04, 1.05, 1.05, 1.05, 1.05, 1.05, 1.12, 1.03, 1.06, 1.06, 1.08, 1.07, 1.07, 1.06, 1.08, 1.07, 1.06, + 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.04, 1.04, 1.04, 1.04, 1.04, 1.03, 1.10, 1.02, 1.05, 1.06, 1.06, 1.06, 1.06, 1.05, 1.06, 1.06, 1.06, + 1.02, 1.02, 1.02, 1.02, 1.02, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.04, 1.03, 1.03, 1.02, 1.07, 1.02, 1.04, 1.04, 1.05, 1.06, 1.05, 1.05, 1.06, 1.06, 1.05, + 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.09, 1.02, 1.04, 1.05, 1.05, 1.05, 1.05, 1.04, 1.05, 1.06, 1.05, + 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.03, 1.03, 1.03, 1.03, 1.03, 1.08, 1.01, 1.04, 1.04, 1.05, 1.05, 1.04, 1.04, 1.05, 1.06, 1.05, + 1.01, 1.01, 1.01, 1.01, 1.01, 1.01, 1.02, 1.01, 1.02, 1.02, 1.02, 1.02, 1.03, 1.03, 1.03, 1.03, 1.03, 1.06, 1.01, 1.04, 1.04, 1.05, 1.04, 1.03, 1.03, 1.04, 1.05, 1.04, + 1.01, 1.00, 1.01, 1.01, 1.01, 1.01, 1.01, 1.00, 1.01, 1.02, 1.01, 1.01, 1.02, 1.02, 1.02, 1.02, 1.03, 1.04, 1.01, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.03, 1.00, 1.01, + 1.02, 1.00, 1.00, 1.02, 1.00, 1.01, 1.01, 1.00, 1.00, 1.02, 1.01, 1.01, 1.02, 1.02, 1.02, 1.02, 1.02, 1.04, 1.01, 1.03, 1.03, 1.03, 1.03, 1.02, 1.02, 1.02, 1.00, 1.01 + ]), + + layer1HCalScaleETBins = cms.vint32([1, 6, 9, 12, 15, 20, 25, 30, 35, 40, 45, 55, 70, 256]), + layer1HCalScaleFactors = cms.vdouble([ + 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, # ZERO-SUPPRESS <1GeV (i.e. 0.5GeV) IN THE BARREL ONLY (ieta<=15 == eta<=1.305) + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00 + ]), + + layer1HFScaleETBins = cms.vint32([6, 9, 12, 15, 20, 25, 30, 35, 40, 45, 55, 70, 256]), + layer1HFScaleFactors = cms.vdouble([ + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, + 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00 + ]), + + # HCal FB LUT + layer1HCalFBLUTUpper = cms.vuint32([ + 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, + ]), + + layer1HCalFBLUTLower = cms.vuint32([ + 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, 0xBBBABBBA, + ]) +) From a195a9dc8135d9c0a47557c01bbf7156af3f03c5 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 1 Sep 2023 07:54:41 +0200 Subject: [PATCH 14/17] Code check --- SimG4CMS/Calo/src/HGCMouseBite.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SimG4CMS/Calo/src/HGCMouseBite.cc b/SimG4CMS/Calo/src/HGCMouseBite.cc index db9898ae774fc..a1608c3d6a27b 100644 --- a/SimG4CMS/Calo/src/HGCMouseBite.cc +++ b/SimG4CMS/Calo/src/HGCMouseBite.cc @@ -7,13 +7,13 @@ //#define EDM_ML_DEBUG HGCMouseBite::HGCMouseBite(const HGCalDDDConstants& hgc, const std::vector& angle, double maxL, bool rot) - : hgcons_(&hgc), hgTBcons_(nullptr), ifTB_(false), cut_(maxL), rot_(rot) { + : hgcons_(&hgc), hgTBcons_(nullptr), ifTB_(false), cut_(maxL), rot_(rot) { modeUV_ = hgcons_->waferHexagon8(); init(angle); } HGCMouseBite::HGCMouseBite(const HGCalTBDDDConstants& hgc, const std::vector& angle, double maxL, bool rot) - : hgcons_(nullptr), hgTBcons_(&hgc), ifTB_(true), cut_(maxL), rot_(rot) { + : hgcons_(nullptr), hgTBcons_(&hgc), ifTB_(true), cut_(maxL), rot_(rot) { modeUV_ = false; init(angle); } @@ -36,10 +36,11 @@ bool HGCMouseBite::exclude(G4ThreeVector& point, int zside, int lay, int waferU, double dx(0), dy(0); if (point == G4ThreeVector()) { std::pair xy; - if (ifTB_) + if (ifTB_) xy = hgTBcons_->waferPosition(waferU, false); else - xy = (modeUV_ ? hgcons_->waferPosition(lay, waferU, waferV, false, false) : hgcons_->waferPosition(waferU, false)); + xy = + (modeUV_ ? hgcons_->waferPosition(lay, waferU, waferV, false, false) : hgcons_->waferPosition(waferU, false)); double xx = (zside > 0) ? xy.first : -xy.first; if (rot_) { dx = std::abs(point.y() - xy.second); From e3dfd9f2d4d1303584fa9791a846401e4dff099f Mon Sep 17 00:00:00 2001 From: Andrea Date: Fri, 1 Sep 2023 09:52:44 +0200 Subject: [PATCH 15/17] Update 2023 MC GTs - 13_3_X --- Configuration/AlCa/python/autoCond.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index f2e55533d292d..a0cf408033ba8 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -76,17 +76,17 @@ # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2023 'phase1_2023_design' : '132X_mcRun3_2023_design_v1', # GlobalTag for MC production with realistic conditions for Phase1 2023 - 'phase1_2023_realistic' : '132X_mcRun3_2023_realistic_v2', + 'phase1_2023_realistic' : '132X_mcRun3_2023_realistic_v4', # GlobalTag for MC production with realistic conditions for Phase1 post BPix issue 2023 - 'phase1_2023_realistic_postBPix' : '132X_mcRun3_2023_realistic_postBPix_v1', + 'phase1_2023_realistic_postBPix' : '132X_mcRun3_2023_realistic_postBPix_v3', # GlobalTag for MC production (cosmics) with realistic conditions for Phase1 2023, Strip tracker in DECO mode - 'phase1_2023_cosmics' : '132X_mcRun3_2023cosmics_realistic_deco_v2', + 'phase1_2023_cosmics' : '132X_mcRun3_2023cosmics_realistic_deco_v3', # GlobalTag for MC production (cosmics) with perfectly aligned and calibrated detector for Phase1 2023, Strip tracker in DECO mode 'phase1_2023_cosmics_design' : '132X_mcRun3_2023cosmics_design_deco_v1', # GlobalTag for MC production with realistic conditions for Phase1 2023 detector for Heavy Ion - 'phase1_2023_realistic_hi' : '132X_mcRun3_2023_realistic_HI_v1', + 'phase1_2023_realistic_hi' : '132X_mcRun3_2023_realistic_HI_v2', # GlobalTag for MC production with realistic conditions for Phase1 2024 - 'phase1_2024_realistic' : '132X_mcRun3_2024_realistic_v1', + 'phase1_2024_realistic' : '132X_mcRun3_2024_realistic_v2', # GlobalTag for MC production with realistic conditions for Phase2 'phase2_realistic' : '131X_mcRun4_realistic_v6' } From 92da717ee2d1d1e84a59428e1f93d8179e920a42 Mon Sep 17 00:00:00 2001 From: atsatsos Date: Fri, 1 Sep 2023 17:21:53 +0200 Subject: [PATCH 16/17] Name change of jetCalibrationLUTFile --- L1Trigger/L1TCalorimeter/python/caloParams_2023_v0_4_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TCalorimeter/python/caloParams_2023_v0_4_cfi.py b/L1Trigger/L1TCalorimeter/python/caloParams_2023_v0_4_cfi.py index 307f590ce1184..94ef30ba4219d 100644 --- a/L1Trigger/L1TCalorimeter/python/caloParams_2023_v0_4_cfi.py +++ b/L1Trigger/L1TCalorimeter/python/caloParams_2023_v0_4_cfi.py @@ -43,7 +43,7 @@ jetCalibrationType = "LUT", jetCompressPtLUTFile = "L1Trigger/L1TCalorimeter/data/lut_pt_compress_2017v1.txt", jetCompressEtaLUTFile = "L1Trigger/L1TCalorimeter/data/lut_eta_compress_2017v1.txt", - jetCalibrationLUTFile = "L1Trigger/L1TCalorimeter/data/lut_calib_2023_v0_ECALZS_PhiRingPUS.txt", + jetCalibrationLUTFile = "L1Trigger/L1TCalorimeter/data/lut_calib_2023v0_ECALZS_PhiRing.txt", # sums: 0=ET, 1=HT, 2=MET, 3=MHT From 8503a8911fe5733483d28b633400214dcb6eab6b Mon Sep 17 00:00:00 2001 From: Marino Missiroli Date: Tue, 29 Aug 2023 11:57:56 +0200 Subject: [PATCH 17/17] add support for L1T EtSums of type kZDC{P,M} as trigger objects at HLT --- .../HLTReco/interface/TriggerTypeDefs.h | 3 + HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc | 87 +++++++++++++++++++ HLTrigger/HLTfilters/plugins/HLTL1TSeed.h | 11 ++- 3 files changed, 98 insertions(+), 3 deletions(-) diff --git a/DataFormats/HLTReco/interface/TriggerTypeDefs.h b/DataFormats/HLTReco/interface/TriggerTypeDefs.h index 3059315177583..8d45088ddebab 100644 --- a/DataFormats/HLTReco/interface/TriggerTypeDefs.h +++ b/DataFormats/HLTReco/interface/TriggerTypeDefs.h @@ -74,6 +74,9 @@ namespace trigger { TriggerL1Vertex = -124, // Phase-1: MuonShower TriggerL1MuShower = -125, // stage2 (introduced in Run 3) + // Phase-1: ZDC+ and ZDC- + TriggerL1ZDCP = -126, // stage2 (introduced in 2023 during Run 3) + TriggerL1ZDCM = -127, // stage2 (introduced in 2023 during Run 3) /// HLT TriggerPhoton = +81, diff --git a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc index 5c8a894c39da9..699a170d60dd6 100644 --- a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc +++ b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.cc @@ -56,6 +56,9 @@ HLTL1TSeed::HLTL1TSeed(const edm::ParameterSet& parSet) m_l1EtSumCollectionsTag(parSet.getParameter("L1EtSumInputTag")), // FIX WHEN UNPACKERS ADDED m_l1EtSumTag(m_l1EtSumCollectionsTag), m_l1EtSumToken(consumes(m_l1EtSumTag)), + m_l1EtSumZdcCollectionsTag(parSet.getParameter("L1EtSumZdcInputTag")), // FIX WHEN UNPACKERS ADDED + m_l1EtSumZdcTag(m_l1EtSumZdcCollectionsTag), + m_l1EtSumZdcToken(consumes(m_l1EtSumZdcTag)), m_l1GlobalDecision(false), m_isDebugEnabled(edm::isDebugEnabled()) { if (m_l1SeedsLogicalExpression.empty()) { @@ -104,6 +107,7 @@ void HLTL1TSeed::fillDescriptions(edm::ConfigurationDescriptions& descriptions) desc.add("L1JetInputTag", edm::InputTag("hltGtStage2Digis:Jet")); desc.add("L1TauInputTag", edm::InputTag("hltGtStage2Digis:Tau")); desc.add("L1EtSumInputTag", edm::InputTag("hltGtStage2Digis:EtSum")); + desc.add("L1EtSumZdcInputTag", edm::InputTag("hltGtStage2Digis:EtSumZDC")); descriptions.add("hltL1TSeed", desc); } @@ -131,6 +135,9 @@ bool HLTL1TSeed::hltFilter(edm::Event& iEvent, // etsum filterproduct.addCollectionTag(m_l1EtSumTag); + + // etsum (ZDC) + filterproduct.addCollectionTag(m_l1EtSumZdcTag); } // Get all the seeding from iEvent (i.e. L1TriggerObjectMapRecord) @@ -423,6 +430,36 @@ void HLTL1TSeed::dumpTriggerFilterObjectWithRefs(trigger::TriggerFilterObjectWit LogTrace("HLTL1TSeed") << "\tL1EtSum AsymHtHF: hwPt = " << obj->hwPt(); } + vector seedsL1EtSumZDCP; + filterproduct.getObjects(trigger::TriggerL1ZDCP, seedsL1EtSumZDCP); + const size_t sizeSeedsL1EtSumZDCP = seedsL1EtSumZDCP.size(); + LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCP seeds: " << sizeSeedsL1EtSumZDCP << endl << endl; + + for (size_t i = 0; i != sizeSeedsL1EtSumZDCP; i++) { + l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCP[i]); + + LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCP" + << "\t" + << "pt = " << obj->pt() << "\t" + << "eta = " << obj->eta() << "\t" + << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx(); + } + + vector seedsL1EtSumZDCM; + filterproduct.getObjects(trigger::TriggerL1ZDCM, seedsL1EtSumZDCM); + const size_t sizeSeedsL1EtSumZDCM = seedsL1EtSumZDCM.size(); + LogTrace("HLTL1TSeed") << "\n L1EtSum ZDCM seeds: " << sizeSeedsL1EtSumZDCM << endl << endl; + + for (size_t i = 0; i != sizeSeedsL1EtSumZDCM; i++) { + l1t::EtSumRef obj = l1t::EtSumRef(seedsL1EtSumZDCM[i]); + + LogTrace("HLTL1TSeed") << "\tL1EtSum ZDCM" + << "\t" + << "pt = " << obj->pt() << "\t" + << "eta = " << obj->eta() << "\t" + << "phi = " << obj->phi(); //<< "\t" << "BX = " << obj->bx(); + } + LogTrace("HLTL1TSeed") << " \n\n" << endl; } @@ -463,6 +500,8 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi std::list listAsymHt; std::list listAsymEtHF; std::list listAsymHtHF; + std::list listZDCP; + std::list listZDCM; // get handle to unpacked GT edm::Handle uGtAlgoBlocks; @@ -780,6 +819,12 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi case l1t::gtAsymmetryHtHF: { listAsymHtHF.push_back(*itObject); } break; + case l1t::gtZDCP: { + listZDCP.push_back(*itObject); + } break; + case l1t::gtZDCM: { + listZDCM.push_back(*itObject); + } break; case l1t::gtCentrality0: case l1t::gtCentrality1: case l1t::gtCentrality2: @@ -885,6 +930,12 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi listAsymHtHF.sort(); listAsymHtHF.unique(); + listZDCP.sort(); + listZDCP.unique(); + + listZDCM.sort(); + listZDCM.unique(); + // record the L1 physics objects in the HLT filterproduct // ////////////////////////////////////////////////////// @@ -1075,6 +1126,42 @@ bool HLTL1TSeed::seedsL1TriggerObjectMaps(edm::Event& iEvent, trigger::TriggerFi } // end else + // ZDCP, ZDCM + edm::Handle etsumzdcs; + iEvent.getByToken(m_l1EtSumZdcToken, etsumzdcs); + if (!etsumzdcs.isValid()) { + //!! FIXME: replace LogDebug with edm::LogWarning once unpacker of ZDC inputs to L1-uGT becomes available + //!! https://github.com/cms-sw/cmssw/pull/42634#issuecomment-1698132805 + //!! https://github.com/cms-sw/cmssw/blob/bece38936ef0ba111f4b5f4502e819595560afa6/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.cc#L76 + LogDebug("HLTL1TSeed") << "\nWarning: L1EtSumBxCollection with input tag " << m_l1EtSumZdcTag + << "\nrequested in configuration, but not found in the event." + << "\nNo etsums (ZDC) added to filterproduct."; + } else { + l1t::EtSumBxCollection::const_iterator iter; + + for (iter = etsumzdcs->begin(0); iter != etsumzdcs->end(0); ++iter) { + l1t::EtSumRef myref(etsumzdcs, etsumzdcs->key(iter)); + + switch (iter->getType()) { + case l1t::EtSum::kZDCP: + if (!listZDCP.empty()) + filterproduct.addObject(trigger::TriggerL1ZDCP, myref); + break; + case l1t::EtSum::kZDCM: + if (!listZDCM.empty()) + filterproduct.addObject(trigger::TriggerL1ZDCM, myref); + break; + default: + LogTrace("HLTL1TSeed") + << " L1EtSum (ZDC) seed of currently unsuported HLT TriggerType. l1t::EtSum type: " + << iter->getType() << "\n"; + + } // end switch + + } // end for + + } // end else + // TODO FIXME uncomment if block when JetCounts implemented // // jet counts diff --git a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h index 6bfbce673254a..e4a3788566c87 100644 --- a/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h +++ b/HLTrigger/HLTfilters/plugins/HLTL1TSeed.h @@ -120,21 +120,26 @@ class HLTL1TSeed : public HLTStreamFilter { edm::InputTag m_l1EGammaTag; edm::EDGetTokenT m_l1EGammaToken; - /// Meta InputTag for L1 Egamma collection + /// Meta InputTag for L1 Jet collection edm::InputTag m_l1JetCollectionsTag; edm::InputTag m_l1JetTag; edm::EDGetTokenT m_l1JetToken; - /// Meta InputTag for L1 Egamma collection + /// Meta InputTag for L1 Tau collection edm::InputTag m_l1TauCollectionsTag; edm::InputTag m_l1TauTag; edm::EDGetTokenT m_l1TauToken; - /// Meta InputTag for L1 Egamma collection + /// Meta InputTag for L1 EtSum collection edm::InputTag m_l1EtSumCollectionsTag; edm::InputTag m_l1EtSumTag; edm::EDGetTokenT m_l1EtSumToken; + /// Meta InputTag for L1 EtSum (ZDC) collection + edm::InputTag m_l1EtSumZdcCollectionsTag; + edm::InputTag m_l1EtSumZdcTag; + edm::EDGetTokenT m_l1EtSumZdcToken; + /// flag to pass if L1TGlobal accept bool m_l1GlobalDecision;