From 407f0a024f16438a0463c7c6a10dc0c178b91cbe Mon Sep 17 00:00:00 2001 From: Huilin Qu Date: Wed, 17 Mar 2021 14:41:25 +0100 Subject: [PATCH 001/309] Add ParticleNet AK8 jet mass regression. --- .../PatAlgos/python/recoLayer0/bTagging_cff.py | 5 +++-- RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py | 13 ++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py b/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py index 8e6d3e39e9329..7231fb8196915 100644 --- a/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py +++ b/PhysicsTools/PatAlgos/python/recoLayer0/bTagging_cff.py @@ -252,9 +252,10 @@ # ----------------------------------- # setup ParticleNet AK8 from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsProbs, _pfParticleNetJetTagsMetaDiscrs, \ - _pfMassDecorrelatedParticleNetJetTagsProbs, _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs + _pfMassDecorrelatedParticleNetJetTagsProbs, _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs, \ + _pfParticleNetMassRegressionOutputs # update supportedBtagDiscr -for disc in _pfParticleNetJetTagsProbs + _pfMassDecorrelatedParticleNetJetTagsProbs: +for disc in _pfParticleNetJetTagsProbs + _pfMassDecorrelatedParticleNetJetTagsProbs + _pfParticleNetMassRegressionOutputs: supportedBtagDiscr[disc] = [["pfParticleNetTagInfos"]] # update supportedMetaDiscr for disc in _pfParticleNetJetTagsMetaDiscrs: diff --git a/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py b/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py index 6b6938cb98070..d60b42b44c057 100644 --- a/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py +++ b/RecoBTag/ONNXRuntime/python/pfParticleNet_cff.py @@ -26,12 +26,20 @@ "probQCDb", "probQCDc", "probQCDothers"], ) +pfParticleNetMassRegressionJetTags = boostedJetONNXJetTagsProducer.clone( + src = 'pfParticleNetTagInfos', + preprocess_json = 'RecoBTag/Combined/data/ParticleNetAK8/MassRegression/V01/preprocess.json', + model_path = 'RecoBTag/Combined/data/ParticleNetAK8/MassRegression/V01/particle-net.onnx', + flav_names = ["mass"], +) + from CommonTools.PileupAlgos.Puppi_cff import puppi from PhysicsTools.PatAlgos.slimming.primaryVertexAssociation_cfi import primaryVertexAssociation # This task is not used, useful only if we run it from RECO jets (RECO/AOD) pfParticleNetTask = cms.Task(puppi, primaryVertexAssociation, pfParticleNetTagInfos, - pfParticleNetJetTags, pfMassDecorrelatedParticleNetJetTags, pfParticleNetDiscriminatorsJetTags) + pfParticleNetJetTags, pfMassDecorrelatedParticleNetJetTags, pfParticleNetMassRegressionJetTags, + pfParticleNetDiscriminatorsJetTags, pfMassDecorrelatedParticleNetDiscriminatorsJetTags) # declare all the discriminators # nominal: probs @@ -47,5 +55,8 @@ _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs = ['pfMassDecorrelatedParticleNetDiscriminatorsJetTags:' + disc.name.value() for disc in pfMassDecorrelatedParticleNetDiscriminatorsJetTags.discriminators] +_pfParticleNetMassRegressionOutputs = ['pfParticleNetMassRegressionJetTags:' + flav_name + for flav_name in pfParticleNetMassRegressionJetTags.flav_names] + _pfParticleNetJetTagsAll = _pfParticleNetJetTagsProbs + _pfParticleNetJetTagsMetaDiscrs + \ _pfMassDecorrelatedParticleNetJetTagsProbs + _pfMassDecorrelatedParticleNetJetTagsMetaDiscrs From 67c1aef9724865906d443c07822d40ec546a9130 Mon Sep 17 00:00:00 2001 From: Huilin Qu Date: Wed, 17 Mar 2021 14:41:58 +0100 Subject: [PATCH 002/309] Add ParticleNet mass regression to MiniAOD. --- PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py b/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py index ac0a1227abee8..b0d9a21a4127e 100644 --- a/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py +++ b/PhysicsTools/PatAlgos/python/slimming/applyDeepBtagging_cff.py @@ -46,6 +46,7 @@ def applyDeepBtagging( process, postfix="" ) : from RecoBTag.ONNXRuntime.pfDeepBoostedJet_cff import _pfDeepBoostedJetTagsAll as pfDeepBoostedJetTagsAll from RecoBTag.ONNXRuntime.pfHiggsInteractionNet_cff import _pfHiggsInteractionNetTagsProbs as pfHiggsInteractionNetTagsProbs from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll + from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs # update slimmed jets to include particle-based deep taggers (keep same name) # make clone for DeepTags-less slimmed AK8 jets, so output name is preserved @@ -57,7 +58,7 @@ def applyDeepBtagging( process, postfix="" ) : 'pfMassIndependentDeepDoubleCvLV2JetTags:probHcc', 'pfMassIndependentDeepDoubleCvBV2JetTags:probHbb', 'pfMassIndependentDeepDoubleCvBV2JetTags:probHcc', - ) + pfDeepBoostedJetTagsAll + pfParticleNetJetTagsAll + pfHiggsInteractionNetTagsProbs + ) + pfDeepBoostedJetTagsAll + pfParticleNetJetTagsAll + pfHiggsInteractionNetTagsProbs + _pfParticleNetMassRegressionOutputs ) updateJetCollection( process, From 52973d84165b4574ef11ef6c342af47d29e794c6 Mon Sep 17 00:00:00 2001 From: Huilin Qu Date: Wed, 17 Mar 2021 14:42:30 +0100 Subject: [PATCH 003/309] Add ParticleNet mass regression to NanoAOD. --- PhysicsTools/NanoAOD/python/jets_cff.py | 1 + PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 1 + PhysicsTools/NanoAOD/python/nano_cff.py | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/python/jets_cff.py b/PhysicsTools/NanoAOD/python/jets_cff.py index fd5e00b2695b5..bd24929463915 100644 --- a/PhysicsTools/NanoAOD/python/jets_cff.py +++ b/PhysicsTools/NanoAOD/python/jets_cff.py @@ -465,6 +465,7 @@ particleNet_HccvsQCD = Var("bDiscriminator('pfParticleNetDiscriminatorsJetTags:HccvsQCD')",float,doc="ParticleNet tagger H(->cc) vs QCD discriminator",precision=10), particleNet_H4qvsQCD = Var("bDiscriminator('pfParticleNetDiscriminatorsJetTags:H4qvsQCD')",float,doc="ParticleNet tagger H(->VV->qqqq) vs QCD discriminator",precision=10), particleNet_QCD = Var("bDiscriminator('pfParticleNetJetTags:probQCDbb')+bDiscriminator('pfParticleNetJetTags:probQCDcc')+bDiscriminator('pfParticleNetJetTags:probQCDb')+bDiscriminator('pfParticleNetJetTags:probQCDc')+bDiscriminator('pfParticleNetJetTags:probQCDothers')",float,doc="ParticleNet tagger QCD(bb,cc,b,c,others) sum",precision=10), + particleNet_mass = Var("bDiscriminator('pfParticleNetMassRegressionJetTags:mass')",float,doc="ParticleNet mass regression",precision=10), particleNetMD_Xbb = Var("bDiscriminator('pfMassDecorrelatedParticleNetJetTags:probXbb')",float,doc="Mass-decorrelated ParticleNet tagger raw X->bb score. For X->bb vs QCD tagging, use Xbb/(Xbb+QCD)",precision=10), particleNetMD_Xcc = Var("bDiscriminator('pfMassDecorrelatedParticleNetJetTags:probXcc')",float,doc="Mass-decorrelated ParticleNet tagger raw X->cc score. For X->cc vs QCD tagging, use Xcc/(Xcc+QCD)",precision=10), particleNetMD_Xqq = Var("bDiscriminator('pfMassDecorrelatedParticleNetJetTags:probXqq')",float,doc="Mass-decorrelated ParticleNet tagger raw X->qq (uds) score. For X->qq vs QCD tagging, use Xqq/(Xqq+QCD). For W vs QCD tagging, use (Xcc+Xqq)/(Xcc+Xqq+QCD)",precision=10), diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index fd7601b6aa136..3405a32e95804 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -176,6 +176,7 @@ Plot1D('particleNet_TvsQCD', 'particleNet_TvsQCD', 20, 0, 1, 'ParticleNet tagger top vs QCD discriminator'), Plot1D('particleNet_WvsQCD', 'particleNet_WvsQCD', 20, 0, 1, 'ParticleNet tagger W vs QCD discriminator'), Plot1D('particleNet_ZvsQCD', 'particleNet_ZvsQCD', 20, 0, 1, 'ParticleNet tagger Z vs QCD discriminator'), + Plot1D('particleNet_mass', 'particleNet_mass', 25, 0, 250, 'ParticleNet mass regression'), Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), Plot1D('pt', 'pt', 20, 0, 800, 'pt'), Plot1D('rawFactor', 'rawFactor', 20, -0.5, 0.5, '1 - Factor to get back to raw pT'), diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index 0ebe6d9e66061..39417ae710600 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -267,7 +267,7 @@ def nanoAOD_activateVID(process): modifier.toModify(process.egmPhotonIDs, physicsObjectSrc = "slimmedPhotonsTo106X") return process -def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, jecPayload): +def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, addParticleNetMass, jecPayload): _btagDiscriminators=[] if addDeepBTag: print("Updating process to run DeepCSV btag to AK8 jets") @@ -280,6 +280,9 @@ def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubl print("Updating process to run ParticleNet before it's included in MiniAOD") from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetJetTagsAll as pfParticleNetJetTagsAll _btagDiscriminators += pfParticleNetJetTagsAll + if addParticleNetMass: + from RecoBTag.ONNXRuntime.pfParticleNet_cff import _pfParticleNetMassRegressionOutputs + _btagDiscriminators += _pfParticleNetMassRegressionOutputs if addDeepDoubleX: print("Updating process to run DeepDoubleX on datasets before 104X") _btagDiscriminators += ['pfDeepDoubleBvLJetTags:probHbb', \ @@ -341,6 +344,7 @@ def nanoAOD_customizeCommon(process): nanoAOD_addDeepDoubleX_switch = cms.untracked.bool(False), nanoAOD_addDeepDoubleXV2_switch = cms.untracked.bool(False), nanoAOD_addParticleNet_switch = cms.untracked.bool(False), + nanoAOD_addParticleNetMass_switch = cms.untracked.bool(True), jecPayload = cms.untracked.string('AK8PFPuppi') ) # deepAK8 should not run on 80X, that contains ak8PFJetsCHS jets @@ -367,6 +371,7 @@ def nanoAOD_customizeCommon(process): addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch, addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch, addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch, + addParticleNetMass=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMass_switch, jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload) (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(process, lambda p : nanoAOD_addTauIds(p)) return process From edfbf92343624d7669cab3495698f712f5a1b7be Mon Sep 17 00:00:00 2001 From: Pieter David Date: Wed, 31 Mar 2021 16:39:39 +0200 Subject: [PATCH 004/309] remove ShallowEventRun from strip gains PCL worker sequence --- .../SiStripChannelGain/interface/SiStripGainsPCLWorker.h | 3 --- .../SiStripChannelGain/src/SiStripGainsPCLWorker.cc | 6 ------ .../python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py | 5 +---- .../python/ALCARECOPromptCalibProdSiStripGains_cff.py | 5 +---- 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h b/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h index 3281c2e576e0a..1f55d8be84690 100644 --- a/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h +++ b/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h @@ -113,7 +113,6 @@ class SiStripGainsPCLWorker : public DQMGlobalEDAnalyzer > TrigTech_token_; edm::EDGetTokenT > trackchi2ndof_token_; edm::EDGetTokenT > trackp_token_; edm::EDGetTokenT > trackpt_token_; @@ -143,8 +142,6 @@ class SiStripGainsPCLWorker : public DQMGlobalEDAnalyzer gainToken_; edm::ESGetToken qualityToken_; - std::string EventPrefix_; //(""); - std::string EventSuffix_; //(""); std::string TrackPrefix_; //("track"); std::string TrackSuffix_; //(""); std::string CalibPrefix_; //("GainCalibration"); diff --git a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc index e10d14d05da40..fe6d3a06f0961 100644 --- a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc +++ b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc @@ -80,12 +80,6 @@ SiStripGainsPCLWorker::SiStripGainsPCLWorker(const edm::ParameterSet& iConfig) { gainusedTick_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "gainusedTick" + CalibSuffix_)); - edm::ParameterSet evtinfo_pset = iConfig.getUntrackedParameter("evtinfo"); - label = evtinfo_pset.getUntrackedParameter("label"); - EventPrefix_ = evtinfo_pset.getUntrackedParameter("prefix"); - EventSuffix_ = evtinfo_pset.getUntrackedParameter("suffix"); - TrigTech_token_ = consumes>(edm::InputTag(label, EventPrefix_ + "TrigTech" + EventSuffix_)); - edm::ParameterSet track_pset = iConfig.getUntrackedParameter("tracks"); label = track_pset.getUntrackedParameter("label"); TrackPrefix_ = track_pset.getUntrackedParameter("prefix"); diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py index 191c7acee4697..6b1f0aa834d3e 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py @@ -70,13 +70,11 @@ # ------------------------------------------------------------------------------ # Get the information you need from the tracks, calibTree-style to have no code difference -from CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi import shallowEventRun from CalibTracker.SiStripCommon.ShallowTracksProducer_cfi import shallowTracks from CalibTracker.SiStripCommon.ShallowGainCalibration_cfi import shallowGainCalibration -ALCARECOShallowEventRunAAG = shallowEventRun.clone() ALCARECOShallowTracksAAG = shallowTracks.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefitAAG')) ALCARECOShallowGainCalibrationAAG = shallowGainCalibration.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefitAAG')) -ALCARECOShallowSequenceAAG = cms.Sequence(ALCARECOShallowEventRunAAG*ALCARECOShallowTracksAAG*ALCARECOShallowGainCalibrationAAG) +ALCARECOShallowSequenceAAG = cms.Sequence(ALCARECOShallowTracksAAG*ALCARECOShallowGainCalibrationAAG) # ------------------------------------------------------------------------------ # This is the module actually doing the calibration @@ -86,7 +84,6 @@ ALCARECOSiStripCalibAAG.DQMdir = cms.untracked.string('AlCaReco/SiStripGainsAAG') ALCARECOSiStripCalibAAG.calibrationMode = cms.untracked.string('AagBunch') ALCARECOSiStripCalibAAG.gain.label = cms.untracked.string('ALCARECOShallowGainCalibrationAAG') -ALCARECOSiStripCalibAAG.evtinfo.label = cms.untracked.string('ALCARECOShallowEventRunAAG') ALCARECOSiStripCalibAAG.tracks.label = cms.untracked.string('ALCARECOShallowTracksAAG') # ---------------------------------------------------------------------------- diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py index 5f39af2ae57ee..2f8a1fa8123bc 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py @@ -69,13 +69,11 @@ # ------------------------------------------------------------------------------ # Get the information you need from the tracks, calibTree-style to have no code difference -from CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi import shallowEventRun from CalibTracker.SiStripCommon.ShallowTracksProducer_cfi import shallowTracks from CalibTracker.SiStripCommon.ShallowGainCalibration_cfi import shallowGainCalibration -ALCARECOShallowEventRun = shallowEventRun.clone() ALCARECOShallowTracks = shallowTracks.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefit')) ALCARECOShallowGainCalibration = shallowGainCalibration.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefit')) -ALCARECOShallowSequence = cms.Sequence(ALCARECOShallowEventRun*ALCARECOShallowTracks*ALCARECOShallowGainCalibration) +ALCARECOShallowSequence = cms.Sequence(ALCARECOShallowTracks*ALCARECOShallowGainCalibration) # ------------------------------------------------------------------------------ # This is the module actually doing the calibration @@ -85,7 +83,6 @@ ALCARECOSiStripCalib.DQMdir = cms.untracked.string('AlCaReco/SiStripGains') ALCARECOSiStripCalib.calibrationMode = cms.untracked.string('StdBunch') ALCARECOSiStripCalib.gain.label = cms.untracked.string('ALCARECOShallowGainCalibration') -ALCARECOSiStripCalib.evtinfo.label = cms.untracked.string('ALCARECOShallowEventRun') ALCARECOSiStripCalib.tracks.label = cms.untracked.string('ALCARECOShallowTracks') # ---------------------------------------------------------------------------- From 52bbb7ed3c4c8c1c815595486475f505fec76d16 Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski Date: Tue, 6 Apr 2021 15:26:00 +0200 Subject: [PATCH 005/309] clean up tau nanoAOD content --- PhysicsTools/NanoAOD/python/taus_cff.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 4d405eb622e8e..7dfbcd54fc926 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -12,9 +12,13 @@ finalTaus = cms.EDFilter("PATTauRefSelector", src = cms.InputTag("slimmedTausUpdated"), - cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || (tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum'))<2.5) || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") ) +for era in [run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: + era.toModify(finalTaus, + cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT2015') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") + ) for era in [run2_nanoAOD_94XMiniAODv1,]: era.toModify(finalTaus, cut = cms.string("pt > 18 && tauID('decayModeFindingNewDMs') && (tauID('byLooseCombinedIsolationDeltaBetaCorr3Hits') || tauID('byVLooseIsolationMVArun2v1DBoldDMwLT') || tauID('byVLooseIsolationMVArun2v1DBnewDMwLT') || tauID('byVLooseIsolationMVArun2v1DBdR03oldDMwLT') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v1') || tauID('byVVLooseIsolationMVArun2v1DBoldDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBnewDMwLT2017v2') || tauID('byVVLooseIsolationMVArun2v1DBdR03oldDMwLT2017v2') || tauID('byVVVLooseDeepTau2017v2p1VSjet'))") @@ -56,8 +60,7 @@ def _tauId8WPMask(pattern,doc): charge = Var("charge", int, doc="electric charge"), jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), decayMode = Var("decayMode()",int), - idDecayMode = Var("tauID('decayModeFinding')", bool), - idDecayModeNewDMs = Var("tauID('decayModeFindingNewDMs')", bool), + idDecayModeOldDMs = Var("tauID('decayModeFinding')", bool), leadTkPtOverTauPt = Var("leadChargedHadrCand.pt/pt ",float, doc="pt of the leading track divided by tau pt",precision=10), leadTkDeltaEta = Var("leadChargedHadrCand.eta - eta ",float, doc="eta of the leading track, minus tau eta",precision=8), @@ -130,10 +133,6 @@ def _tauId8WPMask(pattern,doc): _variablesMiniV2 = cms.PSet( _tauVarsBase, - _mvaAntiEVars, - _mvaIsoVars2015Reduced, - _mvaIsoVars2017v1, - _mvaIsoVars2017v2, _deepTauVars2017v2p1 ) _variablesMiniV1 = _variablesMiniV2.clone() @@ -158,6 +157,9 @@ def _tauId8WPMask(pattern,doc): ) for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: + era.toModify(tauTable, + variables = cms.PSet(tauTable.variables, _mvaAntiEVars, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2) + ) era.toModify(tauTable.variables, rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw2018')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category2018')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), @@ -167,6 +169,13 @@ def _tauId8WPMask(pattern,doc): idAntiEle = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2015)") ) +for era in [run2_miniAOD_80XLegacy, run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ + run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: + era.toModify(tauTable.variables, + idDecayMode = Var("tauID('decayModeFinding')", bool), + idDecayModeNewDMs = Var("tauID('decayModeFindingNewDMs')", bool), + idDecayModeOldDMs = None + ) run2_miniAOD_80XLegacy.toModify(tauTable.variables, idAntiEleDeadECal = None) for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ From fb51bd9d063e49415e0f93447fd1d229ba9d1678 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Thu, 1 Apr 2021 14:19:05 +0200 Subject: [PATCH 006/309] Strips G2 PCL without shallow tracks, first take (compiling) --- .../interface/SiStripGainsPCLWorker.h | 35 +- .../python/SiStripGainsPCLWorker_cfi.py | 14 +- .../src/SiStripGainsPCLWorker.cc | 512 ++++++++---------- ...ARECOPromptCalibProdSiStripGainsAAG_cff.py | 23 +- ...ALCARECOPromptCalibProdSiStripGains_cff.py | 21 +- 5 files changed, 256 insertions(+), 349 deletions(-) diff --git a/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h b/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h index 1f55d8be84690..c3aef2499eb5e 100644 --- a/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h +++ b/CalibTracker/SiStripChannelGain/interface/SiStripGainsPCLWorker.h @@ -13,6 +13,7 @@ // A. Di Mattia (PCL multi stream processing and monitoring) // M. Delcourt (monitoring) // M. Musich (migration to thread-safe DQMStore access) +// P. David (merge ShallowGainCalibration with SiStripGainsPCLWorker) // // Created: Wed, 12 Apr 2017 14:46:48 GMT // @@ -111,42 +112,14 @@ class SiStripGainsPCLWorker : public DQMGlobalEDAnalyzer VChargeHisto; /*!< Charge monitor plots to be output */ - //Data members for processing - - edm::EDGetTokenT > trackchi2ndof_token_; - edm::EDGetTokenT > trackp_token_; - edm::EDGetTokenT > trackpt_token_; - edm::EDGetTokenT > tracketa_token_; - edm::EDGetTokenT > trackphi_token_; - edm::EDGetTokenT > trackhitsvalid_token_; - edm::EDGetTokenT > trackalgo_token_; - edm::EDGetTokenT > trackindex_token_; - edm::EDGetTokenT > rawid_token_; - edm::EDGetTokenT > localdirx_token_; - edm::EDGetTokenT > localdiry_token_; - edm::EDGetTokenT > localdirz_token_; - edm::EDGetTokenT > firststrip_token_; - edm::EDGetTokenT > nstrips_token_; - edm::EDGetTokenT > saturation_token_; - edm::EDGetTokenT > overlapping_token_; - edm::EDGetTokenT > farfromedge_token_; - edm::EDGetTokenT > charge_token_; - edm::EDGetTokenT > path_token_; - edm::EDGetTokenT > chargeoverpath_token_; - edm::EDGetTokenT > amplitude_token_; - edm::EDGetTokenT > gainused_token_; - edm::EDGetTokenT > gainusedTick_token_; + edm::EDGetTokenT> m_tracks_token; + edm::EDGetTokenT m_association_token; edm::ESGetToken tTopoToken_; - edm::ESGetToken tkGeomToken_; + edm::ESGetToken tkGeomTokenBR_, tkGeomToken_; edm::ESGetToken gainToken_; edm::ESGetToken qualityToken_; - std::string TrackPrefix_; //("track"); - std::string TrackSuffix_; //(""); - std::string CalibPrefix_; //("GainCalibration"); - std::string CalibSuffix_; //(""); - // maps histograms index to topology std::map theTopologyMap; }; diff --git a/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py b/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py index cf71afd80c963..dff525f9166ab 100644 --- a/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py +++ b/CalibTracker/SiStripChannelGain/python/SiStripGainsPCLWorker_cfi.py @@ -12,17 +12,5 @@ DQMdir = cms.untracked.string('AlCaReco/SiStripGains'), calibrationMode = cms.untracked.string('StdBunch'), ChargeHisto = cms.untracked.vstring('TIB','TIB_layer_1','TOB','TOB_layer_1','TIDminus','TIDplus','TECminus','TECplus','TEC_thin','TEC_thick'), - gain = cms.untracked.PSet(label = cms.untracked.string('shallowGainCalibration'), - prefix = cms.untracked.string("GainCalibration"), - suffix = cms.untracked.string('') - ), - evtinfo = cms.untracked.PSet(label = cms.untracked.string('shallowEventRun'), - prefix = cms.untracked.string(""), - suffix = cms.untracked.string('') - ), - tracks = cms.untracked.PSet(label = cms.untracked.string('shallowTracks'), - prefix = cms.untracked.string("track"), - suffix = cms.untracked.string('') - ) + tracks=cms.InputTag("generalTracks",""), ) - diff --git a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc index fe6d3a06f0961..dee3eb1703419 100644 --- a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc +++ b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc @@ -50,52 +50,12 @@ SiStripGainsPCLWorker::SiStripGainsPCLWorker(const edm::ParameterSet& iConfig) { dqm_tag_.push_back("IsoMuon0T"); // statistic collection from Isolated Muon @ 0 T dqm_tag_.push_back("Harvest"); // statistic collection: Harvest - // configure token for gathering the ntuple variables - edm::ParameterSet swhallowgain_pset = iConfig.getUntrackedParameter("gain"); - - std::string label = swhallowgain_pset.getUntrackedParameter("label"); - CalibPrefix_ = swhallowgain_pset.getUntrackedParameter("prefix"); - CalibSuffix_ = swhallowgain_pset.getUntrackedParameter("suffix"); - - trackindex_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "trackindex" + CalibSuffix_)); - rawid_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "rawid" + CalibSuffix_)); - localdirx_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "localdirx" + CalibSuffix_)); - localdiry_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "localdiry" + CalibSuffix_)); - localdirz_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "localdirz" + CalibSuffix_)); - firststrip_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "firststrip" + CalibSuffix_)); - nstrips_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "nstrips" + CalibSuffix_)); - saturation_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "saturation" + CalibSuffix_)); - overlapping_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "overlapping" + CalibSuffix_)); - farfromedge_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "farfromedge" + CalibSuffix_)); - charge_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "charge" + CalibSuffix_)); - path_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "path" + CalibSuffix_)); -#ifdef ExtendedCALIBTree - chargeoverpath_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "chargeoverpath" + CalibSuffix_)); -#endif - amplitude_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "amplitude" + CalibSuffix_)); - gainused_token_ = consumes>(edm::InputTag(label, CalibPrefix_ + "gainused" + CalibSuffix_)); - gainusedTick_token_ = - consumes>(edm::InputTag(label, CalibPrefix_ + "gainusedTick" + CalibSuffix_)); - - edm::ParameterSet track_pset = iConfig.getUntrackedParameter("tracks"); - label = track_pset.getUntrackedParameter("label"); - TrackPrefix_ = track_pset.getUntrackedParameter("prefix"); - TrackSuffix_ = track_pset.getUntrackedParameter("suffix"); - - trackchi2ndof_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "chi2ndof" + TrackSuffix_)); - trackp_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "momentum" + TrackSuffix_)); - trackpt_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "pt" + TrackSuffix_)); - tracketa_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "eta" + TrackSuffix_)); - trackphi_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "phi" + TrackSuffix_)); - trackhitsvalid_token_ = - consumes>(edm::InputTag(label, TrackPrefix_ + "hitsvalid" + TrackSuffix_)); - trackalgo_token_ = consumes>(edm::InputTag(label, TrackPrefix_ + "algo" + TrackSuffix_)); + m_tracks_token = consumes>(iConfig.getParameter("tracks")); + m_association_token = consumes(iConfig.getParameter("tracks")); tTopoToken_ = esConsumes(); - tkGeomToken_ = esConsumes(); + tkGeomTokenBR_ = esConsumes(); + tkGeomToken_ = esConsumes<>(); gainToken_ = esConsumes(); qualityToken_ = esConsumes(); } @@ -108,7 +68,7 @@ void SiStripGainsPCLWorker::dqmBeginRun(edm::Run const& run, static constexpr float defaultGainTick = 690. / 640.; // fills the APV collections at each begin run - const TrackerGeometry* bareTkGeomPtr = &iSetup.getData(tkGeomToken_); + const TrackerGeometry* bareTkGeomPtr = &iSetup.getData(tkGeomTokenBR_); checkBookAPVColls(bareTkGeomPtr, histograms); const auto gainHandle = iSetup.getHandle(gainToken_); @@ -151,6 +111,63 @@ void SiStripGainsPCLWorker::dqmBeginRun(edm::Run const& run, } } +namespace { + struct HitCluster { + uint32_t det; + const SiStripCluster* strip; + const SiPixelCluster* pixel; + HitCluster(uint32_t detId, const SiStripCluster* strip, const SiPixelCluster* pixel) + : det(detId), strip(strip), pixel(pixel) {} + }; + std::vector getClusters(const TrackingRecHit* hit) { + const auto simple1d = dynamic_cast(hit); + const auto simple = dynamic_cast(hit); + const auto matched = dynamic_cast(hit); + const auto pixel = dynamic_cast(hit); + std::vector clusters; + if (matched) { + clusters.emplace_back(matched->monoId(), &matched->monoCluster(), nullptr); + clusters.emplace_back(matched->stereoId(), &matched->stereoCluster(), nullptr); + } else if (simple) { + clusters.emplace_back(simple->geographicalId().rawId(), simple->cluster().get(), nullptr); + } else if (simple1d) { + clusters.emplace_back(simple1d->geographicalId().rawId(), simple1d->cluster().get(), nullptr); + } else if (pixel) { + clusters.emplace_back(pixel->geographicalId().rawId(), nullptr, pixel->cluster().get()); + } + return clusters; + } + + bool isFarFromBorder(const TrajectoryStateOnSurface& trajState, uint32_t detId, const TrackerGeometry* tGeom) { + const auto gdu = tGeom->idToDetUnit(detId); + if ((!dynamic_cast(gdu)) && (!dynamic_cast(gdu))) { + edm::LogWarning("SiStripGainCalibTableProducer") + << "DetId " << detId << " does not seem to belong to the tracker"; + return false; + } + const auto plane = gdu->surface(); + const auto trapBounds = dynamic_cast(&plane.bounds()); + const auto rectBounds = dynamic_cast(&plane.bounds()); + + static constexpr double distFromBorder = 1.0; + double halfLength = 0.; + if (trapBounds) { + halfLength = trapBounds->parameters()[3]; + } else if (rectBounds) { + halfLength = .5 * gdu->surface().bounds().length(); + } else { + return false; + } + + const auto pos = trajState.localPosition(); + const auto posError = trajState.localError().positionError(); + if (std::abs(pos.y()) + posError.yy() >= (halfLength - distFromBorder)) + return false; + + return true; + } +} // namespace + //********************************************************************************// // ------------ method called for each event ------------ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, @@ -164,88 +181,13 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, edm::LogInfo("SiStripGainsPCLWorker") << "Processing run " << runnumber << " and event " << eventnumber << std::endl; const TrackerTopology* topo = &iSetup.getData(tTopoToken_); + const TrackerGeometry* tGeom = &iSetup.getData(tkGeomToken_); - // ***************************** - // * Event data handles - // ***************************** - - //Event data - - // Track data - Handle> handle01; - iEvent.getByToken(trackchi2ndof_token_, handle01); - auto trackchi2ndof = handle01.product(); - - Handle> handle02; - iEvent.getByToken(trackp_token_, handle02); - auto trackp = handle02.product(); - - Handle> handle03; - iEvent.getByToken(tracketa_token_, handle03); - auto tracketa = handle03.product(); - - Handle> handle04; - iEvent.getByToken(trackhitsvalid_token_, handle04); - auto trackhitsvalid = handle04.product(); - - Handle> handle05; - iEvent.getByToken(trackalgo_token_, handle05); - auto trackalgo = handle05.product(); - - // CalibTree data - Handle> handle06; - iEvent.getByToken(trackindex_token_, handle06); - auto trackindex = handle06.product(); - - Handle> handle07; - iEvent.getByToken(rawid_token_, handle07); - auto rawid = handle07.product(); - - Handle> handle08; - iEvent.getByToken(firststrip_token_, handle08); - auto firststrip = handle08.product(); - - Handle> handle09; - iEvent.getByToken(nstrips_token_, handle09); - auto nstrips = handle09.product(); - - Handle> handle10; - iEvent.getByToken(saturation_token_, handle10); - auto saturation = handle10.product(); - - Handle> handle11; - iEvent.getByToken(overlapping_token_, handle11); - auto overlapping = handle11.product(); - - Handle> handle12; - iEvent.getByToken(farfromedge_token_, handle12); - auto farfromedge = handle12.product(); - - Handle> handle13; - iEvent.getByToken(charge_token_, handle13); - auto charge = handle13.product(); - - Handle> handle14; - iEvent.getByToken(path_token_, handle14); - auto path = handle14.product(); - -#ifdef ExtendedCALIBTree - Handle> handle15; - iEvent.getByToken(chargeoverpath_token_, handle15); - auto chargeoverpath = handle15.product(); -#endif - - Handle> handle16; - iEvent.getByToken(amplitude_token_, handle16); - auto amplitude = handle16.product(); - - Handle> handle17; - iEvent.getByToken(gainused_token_, handle17); - auto gainused = handle17.product(); - - Handle> handle18; - iEvent.getByToken(gainusedTick_token_, handle18); - auto gainusedTick = handle18.product(); + // Event data handles + edm::Handle> tracks; + iEvent.getByToken(m_tracks_token, tracks); + edm::Handle trajTrackAssociations; + iEvent.getByToken(m_association_token, trajTrackAssociations); for (const auto& elem : theTopologyMap) { LogDebug("SiStripGainsPCLWorker") << elem.first << " - " << elem.second.m_string << " " @@ -257,166 +199,188 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, int elepos = statCollectionFromMode(m_calibrationMode.c_str()); - histograms.EventStats->Fill(0., 0., 1); - histograms.EventStats->Fill(1., 0., trackp->size()); - histograms.EventStats->Fill(2., 0., charge->size()); - - unsigned int FirstAmplitude = 0; - for (unsigned int i = 0; i < charge->size(); i++) { - FirstAmplitude += (*nstrips)[i]; - int TI = (*trackindex)[i]; + std::size_t nStoredClusters{0}; + for (const auto& assoc : *trajTrackAssociations) { + const auto traj = assoc.key.get(); + const auto track = assoc.val.get(); - if ((*tracketa)[TI] < MinTrackEta) - continue; - if ((*tracketa)[TI] > MaxTrackEta) - continue; - if ((*trackp)[TI] < MinTrackMomentum) - continue; - if ((*trackp)[TI] > MaxTrackMomentum) - continue; - if ((*trackhitsvalid)[TI] < MinTrackHits) - continue; - if ((*trackchi2ndof)[TI] > MaxTrackChiOverNdf) - continue; - if ((*trackalgo)[TI] > MaxTrackingIteration) + if ((track->eta() < MinTrackEta) || (track->eta() > MaxTrackEta) || (track->p() < MinTrackMomentum) || + (track->p() > MaxTrackMomentum) || (track->numberOfValidHits() < MinTrackHits) || + ((track->chi2() / track->ndof()) > MaxTrackChiOverNdf) || (track->algo() > MaxTrackingIteration)) continue; - std::shared_ptr APV = histograms.APVsColl.at( - ((*rawid)[i] << 4) | - ((*firststrip)[i] / - 128)); //works for both strip and pixel thanks to firstStrip encoding for pixel in the calibTree - - if (APV->SubDet > 2 && (*farfromedge)[i] == false) - continue; - if (APV->SubDet > 2 && (*overlapping)[i] == true) - continue; - if (APV->SubDet > 2 && (*saturation)[i] && !AllowSaturation) - continue; - if (APV->SubDet > 2 && (*nstrips)[i] > MaxNrStrips) - continue; + int iCluster{-1}; + for (const auto& meas : traj->measurements()) { + const auto& trajState = meas.updatedState(); + if (!trajState.isValid()) + continue; - int Charge = 0; - if (APV->SubDet > 2 && (useCalibration || !FirstSetOfConstants)) { - bool Saturation = false; - for (unsigned int s = 0; s < (*nstrips)[i]; s++) { - int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s]; - if (useCalibration && !FirstSetOfConstants) { - StripCharge = (int)(StripCharge * (APV->PreviousGain / APV->CalibGain)); - } else if (useCalibration) { - StripCharge = (int)(StripCharge / APV->CalibGain); - } else if (!FirstSetOfConstants) { - StripCharge = (int)(StripCharge * APV->PreviousGain); + // there can be 2 (stereo module), 1 (no stereo module), or 0 (no pixel or strip hit) clusters + auto clusters = getClusters(meas.recHit()->hit()); + nStoredClusters += clusters.size(); + for (const auto hitCluster : clusters) { + ++iCluster; + bool saturation = false; + bool overlapping = false; + unsigned int charge = 0; + int firstStrip = 0; + unsigned int nStrips = 0; + if (hitCluster.strip) { + const auto& ampls = hitCluster.strip->amplitudes(); + firstStrip = hitCluster.strip->firstStrip(); + nStrips = ampls.size(); + charge = hitCluster.strip->charge(); + saturation = std::any_of(ampls.begin(), ampls.end(), [](uint8_t amp) { return amp >= 254; }); + + overlapping = (((firstStrip % 128) == 0) || ((firstStrip / 128) != ((firstStrip + int(nStrips)) / 128)) || + (((firstStrip + int(nStrips)) % 128) == 127)); + } else if (hitCluster.pixel) { + const auto& ampls = hitCluster.pixel->pixelADC(); + const int firstRow = hitCluster.pixel->minPixelRow(); + const int firstCol = hitCluster.pixel->minPixelCol(); + firstStrip = ((firstRow / 80) << 3 | (firstCol / 52)) * 128; //Hack to save the APVId + nStrips = 0; + for (const auto amp : ampls) { + charge += amp; + if (amp >= 254) + saturation = true; + } } - if (StripCharge > 1024) { - StripCharge = 255; - Saturation = true; - } else if (StripCharge > 254) { - StripCharge = 254; - Saturation = true; - } - Charge += StripCharge; - } - if (Saturation && !AllowSaturation) - continue; - } else if (APV->SubDet > 2) { - Charge = (*charge)[i]; - } else { - Charge = (*charge)[i] / 265.0; //expected scale factor between pixel and strip charge - } + // works for both strip and pixel thanks to firstStrip encoding for pixel above, as in the calibTree + std::shared_ptr APV = histograms.APVsColl.at((hitCluster.det << 4) | (firstStrip / 128)); - double ClusterChargeOverPath = ((double)Charge) / (*path)[i]; - if (APV->SubDet > 2) { - if (Validation) { - ClusterChargeOverPath /= (*gainused)[i]; - } - if (OldGainRemoving) { - ClusterChargeOverPath *= (*gainused)[i]; - } - } + const auto farFromEdge = (hitCluster.strip ? isFarFromBorder(trajState, hitCluster.det, tGeom) : true); + if ((APV->SubDet > 2) && + ((!farFromEdge) || overlapping || (saturation && !AllowSaturation) || (nStrips > MaxNrStrips))) + continue; - // keep processing of pixel cluster charge until here - if (APV->SubDet <= 2) - continue; + int clusterCharge = 0; + if (APV->SubDet > 2) { // strip + if (useCalibration || !FirstSetOfConstants) { + saturation = false; + for (const auto origCharge : hitCluster.strip->amplitudes()) { + int stripCharge; + if (useCalibration) { + if (FirstSetOfConstants) { + stripCharge = int(origCharge / APV->CalibGain); + } else { + stripCharge = int(origCharge * (APV->PreviousGain / APV->CalibGain)); + } + } else { + if (FirstSetOfConstants) { + stripCharge = origCharge; + } else { + stripCharge = int(origCharge * APV->PreviousGain); + } + } + if (stripCharge > 1024) { + stripCharge = 255; + saturation = true; + } else if (stripCharge > 254) { + stripCharge = 254; + saturation = true; + } + clusterCharge += stripCharge; + } + if (saturation && !AllowSaturation) + continue; + } else { + clusterCharge = charge; + } + } else { // pixel + clusterCharge = charge / 265.0; //expected scale factor between pixel and strip charge + } - // real histogram for calibration - histograms.Charge_Vs_Index[elepos]->Fill(APV->Index, ClusterChargeOverPath); - LogDebug("SiStripGainsPCLWorker") << " for mode " << m_calibrationMode << "\n" - << " i " << i << " useCalibration " << useCalibration << " FirstSetOfConstants " - << FirstSetOfConstants << " APV->PreviousGain " << APV->PreviousGain - << " APV->CalibGain " << APV->CalibGain << " APV->DetId " << APV->DetId - << " APV->Index " << APV->Index << " Charge " << Charge << " Path " << (*path)[i] - << " ClusterChargeOverPath " << ClusterChargeOverPath << std::endl; - - // Fill monitoring histograms - int mCharge1 = 0; - int mCharge2 = 0; - int mCharge3 = 0; - int mCharge4 = 0; - if (APV->SubDet > 2) { - for (unsigned int s = 0; s < (*nstrips)[i]; s++) { - int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[i] + s]; - if (StripCharge > 1024) - StripCharge = 255; - else if (StripCharge > 254) - StripCharge = 254; - mCharge1 += StripCharge; - mCharge2 += StripCharge; - mCharge3 += StripCharge; - mCharge4 += StripCharge; - } - // Revome gains for monitoring - mCharge2 *= (*gainused)[i]; // remove G2 - mCharge3 *= (*gainusedTick)[i]; // remove G1 - mCharge4 *= ((*gainused)[i] * (*gainusedTick)[i]); // remove G1 and G2 - } + const auto trackDir = trajState.localDirection(); + const auto path = (10. * APV->Thickness) / std::abs(trackDir.z() / trackDir.mag()); + double ClusterChargeOverPath = ((double)clusterCharge) / path; + if (APV->SubDet > 2) { + if (Validation) { + ClusterChargeOverPath /= APV->PreviousGain; + } + if (OldGainRemoving) { + ClusterChargeOverPath *= APV->PreviousGain; + } + } else { + // keep processing of pixel cluster charge until here + continue; + } - LogDebug("SiStripGainsPCLWorker") << " full charge " << mCharge1 << " remove G2 " << mCharge2 << " remove G1 " - << mCharge3 << " remove G1*G2 " << mCharge4 << std::endl; - - auto indices = APVGain::FetchIndices(theTopologyMap, (*rawid)[i], topo); - - for (auto m : indices) - histograms.Charge_1[elepos][m]->Fill(((double)mCharge1) / (*path)[i]); - for (auto m : indices) - histograms.Charge_2[elepos][m]->Fill(((double)mCharge2) / (*path)[i]); - for (auto m : indices) - histograms.Charge_3[elepos][m]->Fill(((double)mCharge3) / (*path)[i]); - for (auto m : indices) - histograms.Charge_4[elepos][m]->Fill(((double)mCharge4) / (*path)[i]); - - if (APV->SubDet == StripSubdetector::TIB) { - histograms.Charge_Vs_PathlengthTIB[elepos]->Fill((*path)[i], Charge); // TIB - - } else if (APV->SubDet == StripSubdetector::TOB) { - histograms.Charge_Vs_PathlengthTOB[elepos]->Fill((*path)[i], Charge); // TOB - - } else if (APV->SubDet == StripSubdetector::TID) { - if (APV->Eta < 0) { - histograms.Charge_Vs_PathlengthTIDM[elepos]->Fill((*path)[i], Charge); - } // TID minus - else if (APV->Eta > 0) { - histograms.Charge_Vs_PathlengthTIDP[elepos]->Fill((*path)[i], Charge); - } // TID plus - - } else if (APV->SubDet == StripSubdetector::TEC) { - if (APV->Eta < 0) { - if (APV->Thickness < 0.04) { - histograms.Charge_Vs_PathlengthTECM1[elepos]->Fill((*path)[i], Charge); - } // TEC minus, type 1 - else if (APV->Thickness > 0.04) { - histograms.Charge_Vs_PathlengthTECM2[elepos]->Fill((*path)[i], Charge); - } // TEC minus, type 2 - } else if (APV->Eta > 0) { - if (APV->Thickness < 0.04) { - histograms.Charge_Vs_PathlengthTECP1[elepos]->Fill((*path)[i], Charge); - } // TEC plus, type 1 - else if (APV->Thickness > 0.04) { - histograms.Charge_Vs_PathlengthTECP2[elepos]->Fill((*path)[i], Charge); - } // TEC plus, type 2 + // real histogram for calibration + histograms.Charge_Vs_Index[elepos]->Fill(APV->Index, ClusterChargeOverPath); + LogDebug("SiStripGainsPCLWorker") + << " for mode " << m_calibrationMode << "\n" + << " i " << iCluster << " useCalibration " << useCalibration << " FirstSetOfConstants " + << FirstSetOfConstants << " APV->PreviousGain " << APV->PreviousGain << " APV->CalibGain " << APV->CalibGain + << " APV->DetId " << APV->DetId << " APV->Index " << APV->Index << " Charge " << clusterCharge << " Path " + << path << " ClusterChargeOverPath " << ClusterChargeOverPath << std::endl; + + // Fill monitoring histograms + int mCharge1 = 0; + for (const auto sCharge : hitCluster.strip->amplitudes()) { + if (sCharge > 254) { + mCharge1 += 254; + } else { + mCharge1 += sCharge; + } + } + // Revome gains for monitoring + int mCharge2 = mCharge1 * APV->PreviousGain; // remove G2 + int mCharge3 = mCharge1 * APV->PreviousGainTick; // remove G1 + int mCharge4 = mCharge1 * APV->PreviousGain * APV->PreviousGainTick; // remove G1 and G2 + + LogDebug("SiStripGainsPCLWorker") << " full charge " << mCharge1 << " remove G2 " << mCharge2 << " remove G1 " + << mCharge3 << " remove G1*G2 " << mCharge4 << std::endl; + + auto indices = APVGain::FetchIndices(theTopologyMap, hitCluster.det, topo); + + for (auto m : indices) + histograms.Charge_1[elepos][m]->Fill(((double)mCharge1) / path); + for (auto m : indices) + histograms.Charge_2[elepos][m]->Fill(((double)mCharge2) / path); + for (auto m : indices) + histograms.Charge_3[elepos][m]->Fill(((double)mCharge3) / path); + for (auto m : indices) + histograms.Charge_4[elepos][m]->Fill(((double)mCharge4) / path); + + if (APV->SubDet == StripSubdetector::TIB) { + histograms.Charge_Vs_PathlengthTIB[elepos]->Fill(path, clusterCharge); // TIB + + } else if (APV->SubDet == StripSubdetector::TOB) { + histograms.Charge_Vs_PathlengthTOB[elepos]->Fill(path, clusterCharge); // TOB + + } else if (APV->SubDet == StripSubdetector::TID) { + if (APV->Eta < 0) { + histograms.Charge_Vs_PathlengthTIDM[elepos]->Fill(path, clusterCharge); + } // TID minus + else if (APV->Eta > 0) { + histograms.Charge_Vs_PathlengthTIDP[elepos]->Fill(path, clusterCharge); + } // TID plus + + } else if (APV->SubDet == StripSubdetector::TEC) { + if (APV->Eta < 0) { + if (APV->Thickness < 0.04) { + histograms.Charge_Vs_PathlengthTECM1[elepos]->Fill(path, clusterCharge); + } // TEC minus, type 1 + else if (APV->Thickness > 0.04) { + histograms.Charge_Vs_PathlengthTECM2[elepos]->Fill(path, clusterCharge); + } // TEC minus, type 2 + } else if (APV->Eta > 0) { + if (APV->Thickness < 0.04) { + histograms.Charge_Vs_PathlengthTECP1[elepos]->Fill(path, clusterCharge); + } // TEC plus, type 1 + else if (APV->Thickness > 0.04) { + histograms.Charge_Vs_PathlengthTECP2[elepos]->Fill(path, clusterCharge); + } // TEC plus, type 2 + } + } } } + } - } // END OF ON-CLUSTER LOOP + histograms.EventStats->Fill(0., 0., 1); + histograms.EventStats->Fill(1., 0., tracks->size()); + histograms.EventStats->Fill(2., 0., nStoredClusters); //LogDebug("SiStripGainsPCLWorker")<<" for mode"<< m_calibrationMode // <<" entries in histogram:"<< histograms.Charge_Vs_Index[elepos].getEntries() diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py index 6b1f0aa834d3e..9dde4ff8f48f7 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGainsAAG_cff.py @@ -68,23 +68,15 @@ offlineBeamSpot + ALCARECOCalibrationTracksRefitAAG ) -# ------------------------------------------------------------------------------ -# Get the information you need from the tracks, calibTree-style to have no code difference -from CalibTracker.SiStripCommon.ShallowTracksProducer_cfi import shallowTracks -from CalibTracker.SiStripCommon.ShallowGainCalibration_cfi import shallowGainCalibration -ALCARECOShallowTracksAAG = shallowTracks.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefitAAG')) -ALCARECOShallowGainCalibrationAAG = shallowGainCalibration.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefitAAG')) -ALCARECOShallowSequenceAAG = cms.Sequence(ALCARECOShallowTracksAAG*ALCARECOShallowGainCalibrationAAG) - # ------------------------------------------------------------------------------ # This is the module actually doing the calibration -from CalibTracker.SiStripChannelGain.SiStripGainsPCLWorker_cfi import SiStripGainsPCLWorker -ALCARECOSiStripCalibAAG = SiStripGainsPCLWorker.clone() -ALCARECOSiStripCalibAAG.FirstSetOfConstants = cms.untracked.bool(False) -ALCARECOSiStripCalibAAG.DQMdir = cms.untracked.string('AlCaReco/SiStripGainsAAG') -ALCARECOSiStripCalibAAG.calibrationMode = cms.untracked.string('AagBunch') -ALCARECOSiStripCalibAAG.gain.label = cms.untracked.string('ALCARECOShallowGainCalibrationAAG') -ALCARECOSiStripCalibAAG.tracks.label = cms.untracked.string('ALCARECOShallowTracksAAG') +from CalibTracker.SiStripChannelGain.SiStripGainsPCLWorker_cfi import SiStripGainsPCLWorker +ALCARECOSiStripCalibAAG = SiStripGainsPCLWorker.clone( + tracks = cms.InputTag('ALCARECOCalibrationTracksRefitAAG'), + FirstSetOfConstants = cms.untracked.bool(False), + DQMdir = cms.untracked.string('AlCaReco/SiStripGainsAAG'), + calibrationMode = cms.untracked.string('AagBunch') + ) # ---------------------------------------------------------------------------- @@ -101,7 +93,6 @@ seqALCARECOPromptCalibProdSiStripGainsAAG = cms.Sequence( ALCARECOCalMinBiasFilterForSiStripGainsAAG * ALCARECOTrackFilterRefitAAG * - ALCARECOShallowSequenceAAG * ALCARECOSiStripCalibAAG * MEtoEDMConvertSiStripGainsAAG ) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py index 2f8a1fa8123bc..9ff51194bf1fc 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStripGains_cff.py @@ -67,23 +67,15 @@ offlineBeamSpot + ALCARECOCalibrationTracksRefit ) -# ------------------------------------------------------------------------------ -# Get the information you need from the tracks, calibTree-style to have no code difference -from CalibTracker.SiStripCommon.ShallowTracksProducer_cfi import shallowTracks -from CalibTracker.SiStripCommon.ShallowGainCalibration_cfi import shallowGainCalibration -ALCARECOShallowTracks = shallowTracks.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefit')) -ALCARECOShallowGainCalibration = shallowGainCalibration.clone(Tracks=cms.InputTag('ALCARECOCalibrationTracksRefit')) -ALCARECOShallowSequence = cms.Sequence(ALCARECOShallowTracks*ALCARECOShallowGainCalibration) - # ------------------------------------------------------------------------------ # This is the module actually doing the calibration from CalibTracker.SiStripChannelGain.SiStripGainsPCLWorker_cfi import SiStripGainsPCLWorker -ALCARECOSiStripCalib = SiStripGainsPCLWorker.clone() -ALCARECOSiStripCalib.FirstSetOfConstants = cms.untracked.bool(False) -ALCARECOSiStripCalib.DQMdir = cms.untracked.string('AlCaReco/SiStripGains') -ALCARECOSiStripCalib.calibrationMode = cms.untracked.string('StdBunch') -ALCARECOSiStripCalib.gain.label = cms.untracked.string('ALCARECOShallowGainCalibration') -ALCARECOSiStripCalib.tracks.label = cms.untracked.string('ALCARECOShallowTracks') +ALCARECOSiStripCalib = SiStripGainsPCLWorker.clone( + tracks = cms.InputTag('ALCARECOCalibrationTracksRefit'), + FirstSetOfConstants = cms.untracked.bool(False), + DQMdir = cms.untracked.string('AlCaReco/SiStripGains'), + calibrationMode = cms.untracked.string('StdBunch') + ) # ---------------------------------------------------------------------------- # **************************************************************************** @@ -102,7 +94,6 @@ seqALCARECOPromptCalibProdSiStripGains = cms.Sequence( ALCARECOCalMinBiasFilterForSiStripGains * ALCARECOTrackFilterRefit * - ALCARECOShallowSequence * ALCARECOSiStripCalib * MEtoEDMConvertSiStripGains ) From 7769b40e46a04d6821c10adb8de56bb7dacb5a16 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 12 Apr 2021 12:36:14 +0200 Subject: [PATCH 007/309] overlapping as in master branch --- CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc index dee3eb1703419..a8c2aa514f11b 100644 --- a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc +++ b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc @@ -232,7 +232,8 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, charge = hitCluster.strip->charge(); saturation = std::any_of(ampls.begin(), ampls.end(), [](uint8_t amp) { return amp >= 254; }); - overlapping = (((firstStrip % 128) == 0) || ((firstStrip / 128) != ((firstStrip + int(nStrips)) / 128)) || + overlapping = (((firstStrip % 128) == 0) || + (((firstStrip / 128) != ((firstStrip + int(nStrips)) / 128)) && ((firstStrip / 128) < 5)) || (((firstStrip + int(nStrips)) % 128) == 127)); } else if (hitCluster.pixel) { const auto& ampls = hitCluster.pixel->pixelADC(); From 9c46010448933e29e147d893201c5a8fdaa115a9 Mon Sep 17 00:00:00 2001 From: chayanit Date: Mon, 19 Apr 2021 08:24:29 +0200 Subject: [PATCH 008/309] Include new processes in upgrade matrix --- .../python/upgradeWorkflowComponents.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 8b7ccd217e6c2..d20ff4f6fd8a0 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1413,4 +1413,11 @@ def __init__(self, howMuch, dataset): ('QCD_Pt_1800_2400_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50), 'QCD_Pt_1800_2400_14')), ('DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff', UpgradeFragment(Kby(9,50),'DisplacedSUSY_14TeV')), ('GluGluTo2Jets_M_300_2000_14TeV_Exhume_cff',UpgradeFragment(Kby(9,100),'GluGluTo2Jets_14TeV')), + ('TTbarLepton_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'TTbarLepton_14TeV')), + ('QQH1252T_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'QQH1252T_14TeV')), + ('ZpEE_6000_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'ZpEE_6000_14TeV')), + ('ZpMM_6000_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'ZpMM_6000_14TeV')), + ('SMS-T1tttt_mGl-1500_mLSP-100_14TeV-pythia8_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'SMS-T1tttt_14TeV')), + ('VBFHZZ4Nu_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'VBFHZZ4Nu_14TeV')), + ('EtaBToJpsiJpsi_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_14TeV')), ]) From 234da0a1da66f6af0770aefe6851a6d69c50333e Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Mon, 19 Apr 2021 20:58:31 +0200 Subject: [PATCH 009/309] Initial changes to compile with TBB 2021.2 --- .../Utilities/bin/conddb_test_gt_perf.cpp | 6 +-- DetectorDescription/Core/interface/DDName.h | 6 ++- DetectorDescription/Core/interface/DDValue.h | 3 +- .../Core/src/StoresInstantiation.cc | 5 +- FWCore/PluginManager/bin/refresh.cc | 1 + .../interface/PluginFactoryBase.h | 4 +- FWCore/Services/plugins/InitRootHandlers.cc | 2 +- FWCore/Services/plugins/StallMonitor.cc | 4 +- FWCore/Utilities/interface/hash_combine.h | 9 ++++ FWCore/Utilities/interface/zero_allocator.h | 54 +++++++++++++++++++ HLTrigger/Timer/plugins/FastTimerService.cc | 2 +- .../TensorFlow/interface/TBBThreadPool.h | 4 +- 12 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 FWCore/Utilities/interface/zero_allocator.h diff --git a/CondCore/Utilities/bin/conddb_test_gt_perf.cpp b/CondCore/Utilities/bin/conddb_test_gt_perf.cpp index 8ee33535cc0fc..f9ddb33cb5bed 100644 --- a/CondCore/Utilities/bin/conddb_test_gt_perf.cpp +++ b/CondCore/Utilities/bin/conddb_test_gt_perf.cpp @@ -14,7 +14,7 @@ #include #include "tbb/parallel_for_each.h" -#include "tbb/task_scheduler_init.h" +#include "tbb/global_control.h" namespace cond { @@ -505,7 +505,7 @@ int cond::TestGTPerf::execute() { if (nThrF > 1) session.transaction().commit(); - tbb::task_scheduler_init init(nThrF); + tbb::global_control init(tbb::global_control::max_allowed_parallelism, nThrF); std::vector > tasks; std::string payloadTypeName; @@ -568,7 +568,7 @@ int cond::TestGTPerf::execute() { std::shared_ptr payloadPtr; - tbb::task_scheduler_init initD(nThrD); + tbb::global_control initD(tbb::global_control::max_allowed_parallelism, nThrD); std::vector > tasksD; timex.interval("setup deserialization"); diff --git a/DetectorDescription/Core/interface/DDName.h b/DetectorDescription/Core/interface/DDName.h index 53c24c87914e6..2f1b9f1e22330 100644 --- a/DetectorDescription/Core/interface/DDName.h +++ b/DetectorDescription/Core/interface/DDName.h @@ -4,18 +4,22 @@ #include #include #include + +#include "FWCore/Utilities/interface/hash_combine.h" #include #include class DDCurrentNamespace; + //! DDName is used to identify DDD entities uniquely. /** A DDName consists of a \a name and a \a namespace. Both are represented as std::string. */ class DDName { public: using id_type = int; - using Registry = tbb::concurrent_unordered_map, id_type>; + using key_type = std::pair; + using Registry = tbb::concurrent_unordered_map; using IdToName = tbb::concurrent_vector; //! Constructs a DDName with name \a name and assigns \a name to the namespace \a ns. diff --git a/DetectorDescription/Core/interface/DDValue.h b/DetectorDescription/Core/interface/DDValue.h index 42839aa8598d9..d86a6ce854013 100644 --- a/DetectorDescription/Core/interface/DDValue.h +++ b/DetectorDescription/Core/interface/DDValue.h @@ -11,6 +11,7 @@ #include "DetectorDescription/Core/interface/DDValuePair.h" #include "tbb/concurrent_unordered_map.h" #include "tbb/concurrent_vector.h" +#include "FWCore/Utilities/interface/zero_allocator.h" /** A DDValue std::maps a std::vector of DDValuePair (std::string,double) to a name. Names of DDValues are stored transiently. Furthermore, an ID is assigned std::mapping to the name. @@ -107,7 +108,7 @@ class DDValue { void init(const std::string&); - using Names = tbb::concurrent_vector>; + using Names = tbb::concurrent_vector>; static Names& names(); static Names initializeNames(); diff --git a/DetectorDescription/Core/src/StoresInstantiation.cc b/DetectorDescription/Core/src/StoresInstantiation.cc index 01fdb672bf926..9ec55e0e85810 100644 --- a/DetectorDescription/Core/src/StoresInstantiation.cc +++ b/DetectorDescription/Core/src/StoresInstantiation.cc @@ -35,6 +35,5 @@ template class DDI::Singleton, std::unique_ptr > >; template class DDI::Singleton > >; //Used internally by DDLogicalPart //The following are used by DDName -template class DDI::Singleton, int> >; -template class DDI::Singleton< - tbb::concurrent_vector, int>::const_iterator> >; +template class DDI::Singleton; +template class DDI::Singleton; diff --git a/FWCore/PluginManager/bin/refresh.cc b/FWCore/PluginManager/bin/refresh.cc index 56e0945140b7d..8f8b8dd8d0c09 100644 --- a/FWCore/PluginManager/bin/refresh.cc +++ b/FWCore/PluginManager/bin/refresh.cc @@ -22,6 +22,7 @@ #include + using namespace edmplugin; // We process DSOs by forking and processing them in the child, in bunches of diff --git a/FWCore/PluginManager/interface/PluginFactoryBase.h b/FWCore/PluginManager/interface/PluginFactoryBase.h index 67577ae3beeaa..ce61339e3dbee 100644 --- a/FWCore/PluginManager/interface/PluginFactoryBase.h +++ b/FWCore/PluginManager/interface/PluginFactoryBase.h @@ -26,7 +26,7 @@ #include #include "tbb/concurrent_unordered_map.h" #include "tbb/concurrent_vector.h" - +#include "FWCore/Utilities/interface/zero_allocator.h" #include "FWCore/Utilities/interface/Signal.h" #include "FWCore/Utilities/interface/thread_safety_macros.h" // user include files @@ -61,7 +61,7 @@ namespace edmplugin { std::atomic m_ptr; }; - typedef tbb::concurrent_vector> PMakers; + typedef tbb::concurrent_vector> PMakers; typedef tbb::concurrent_unordered_map Plugins; // ---------- const member functions --------------------- diff --git a/FWCore/Services/plugins/InitRootHandlers.cc b/FWCore/Services/plugins/InitRootHandlers.cc index 6d16975ca11f8..d7425d712b855 100644 --- a/FWCore/Services/plugins/InitRootHandlers.cc +++ b/FWCore/Services/plugins/InitRootHandlers.cc @@ -76,7 +76,7 @@ namespace edm { public: typedef tbb::concurrent_unordered_set Container_type; - ThreadTracker() : tbb::task_scheduler_observer(true) { observe(true); } + ThreadTracker() : tbb::task_scheduler_observer() { observe(); } ~ThreadTracker() override = default; void on_scheduler_entry(bool) override { diff --git a/FWCore/Services/plugins/StallMonitor.cc b/FWCore/Services/plugins/StallMonitor.cc index a1ea21a03bc67..51bae431a2294 100644 --- a/FWCore/Services/plugins/StallMonitor.cc +++ b/FWCore/Services/plugins/StallMonitor.cc @@ -24,7 +24,7 @@ #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/OStreamColumn.h" #include "FWCore/Utilities/interface/Exception.h" - +#include "FWCore/Utilities/interface/hash_combine.h" #include "tbb/concurrent_unordered_map.h" #include @@ -227,7 +227,7 @@ namespace edm { // for this purpose. using StreamID_value = decltype(std::declval().value()); using ModuleID = decltype(std::declval().id()); - tbb::concurrent_unordered_map, std::pair> + tbb::concurrent_unordered_map, std::pair, edm::StdPairHasher> stallStart_{}; std::vector moduleLabels_{}; diff --git a/FWCore/Utilities/interface/hash_combine.h b/FWCore/Utilities/interface/hash_combine.h index 775e062a2ac92..96680c37cef55 100644 --- a/FWCore/Utilities/interface/hash_combine.h +++ b/FWCore/Utilities/interface/hash_combine.h @@ -38,6 +38,15 @@ namespace edm { hash_combine(seed, args...); return seed; } + +struct StdPairHasher { + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first,a.second); + } + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first,a.second); + } +}; } // namespace edm #endif diff --git a/FWCore/Utilities/interface/zero_allocator.h b/FWCore/Utilities/interface/zero_allocator.h new file mode 100644 index 0000000000000..e7576e6bee425 --- /dev/null +++ b/FWCore/Utilities/interface/zero_allocator.h @@ -0,0 +1,54 @@ +#ifndef FWCore_Utilities_zero_allocator_h +#define FWCore_Utilities_zero_allocator_h +/* + Copyright (c) 2005-2020 Intel Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "tbb/tbb_allocator.h" + +namespace edm { + template class Allocator = tbb::tbb_allocator> + class zero_allocator : public Allocator + { + public: + using value_type = T; + using base_allocator_type = Allocator; + template struct rebind { + typedef zero_allocator other; + }; + + zero_allocator() throw() { } + zero_allocator(const zero_allocator &a) throw() : base_allocator_type( a ) { } + template + zero_allocator(const zero_allocator &a) throw() : base_allocator_type( Allocator( a ) ) { } + + T* allocate(const std::size_t n, const void *hint = 0 ) { + //T* ptr = base_allocator_type::allocate( n, hint ); + T* ptr = base_allocator_type::allocate( n ); + std::memset( static_cast(ptr), 0, n * sizeof(value_type) ); + return ptr; + } + }; + + template class B1, typename T2, template class B2> + inline bool operator==( const zero_allocator &a, const zero_allocator &b) { + return static_cast< B1 >(a) == static_cast< B2 >(b); + } + template class B1, typename T2, template class B2> + inline bool operator!=( const zero_allocator &a, const zero_allocator &b) { + return static_cast< B1 >(a) != static_cast< B2 >(b); + } +} +#endif diff --git a/HLTrigger/Timer/plugins/FastTimerService.cc b/HLTrigger/Timer/plugins/FastTimerService.cc index 223b90c8e2763..fc6e514b8e7e8 100644 --- a/HLTrigger/Timer/plugins/FastTimerService.cc +++ b/HLTrigger/Timer/plugins/FastTimerService.cc @@ -767,7 +767,7 @@ void FastTimerService::PlotsPerJob::fill_lumi(AtomicResources const& data, unsig /////////////////////////////////////////////////////////////////////////////// FastTimerService::FastTimerService(const edm::ParameterSet& config, edm::ActivityRegistry& registry) - : tbb::task_scheduler_observer(true), + : tbb::task_scheduler_observer(), // configuration callgraph_(), // job configuration diff --git a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h index 498c5c43fe763..19162c4c6ac59 100644 --- a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h +++ b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h @@ -13,9 +13,9 @@ #include "tensorflow/core/lib/core/threadpool.h" -#include "tbb/task_scheduler_init.h" #include "tbb/task_arena.h" #include "tbb/task_group.h" +#include "tbb/global_control.h" namespace tensorflow { @@ -27,7 +27,7 @@ namespace tensorflow { } explicit TBBThreadPool(int nThreads = -1) - : nThreads_(nThreads > 0 ? nThreads : tbb::task_scheduler_init::default_num_threads()), numScheduleCalled_(0) { + : nThreads_(nThreads > 0 ? nThreads : tbb::global_control::max_allowed_parallelism), numScheduleCalled_(0) { // when nThreads is zero or smaller, use the default value determined by tbb } From ffd7094b1fddb8020cfd86ea3b512fb424a30868 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Mon, 19 Apr 2021 21:08:04 +0200 Subject: [PATCH 010/309] code-checks --- DetectorDescription/Core/interface/DDName.h | 1 - FWCore/PluginManager/bin/refresh.cc | 1 - FWCore/Services/plugins/StallMonitor.cc | 4 +- FWCore/Utilities/interface/hash_combine.h | 16 +++--- FWCore/Utilities/interface/zero_allocator.h | 54 ++++++++++----------- 5 files changed, 38 insertions(+), 38 deletions(-) diff --git a/DetectorDescription/Core/interface/DDName.h b/DetectorDescription/Core/interface/DDName.h index 2f1b9f1e22330..8d9665b153dba 100644 --- a/DetectorDescription/Core/interface/DDName.h +++ b/DetectorDescription/Core/interface/DDName.h @@ -11,7 +11,6 @@ class DDCurrentNamespace; - //! DDName is used to identify DDD entities uniquely. /** A DDName consists of a \a name and a \a namespace. Both are represented as std::string. */ diff --git a/FWCore/PluginManager/bin/refresh.cc b/FWCore/PluginManager/bin/refresh.cc index 8f8b8dd8d0c09..56e0945140b7d 100644 --- a/FWCore/PluginManager/bin/refresh.cc +++ b/FWCore/PluginManager/bin/refresh.cc @@ -22,7 +22,6 @@ #include - using namespace edmplugin; // We process DSOs by forking and processing them in the child, in bunches of diff --git a/FWCore/Services/plugins/StallMonitor.cc b/FWCore/Services/plugins/StallMonitor.cc index 51bae431a2294..d750de876caa0 100644 --- a/FWCore/Services/plugins/StallMonitor.cc +++ b/FWCore/Services/plugins/StallMonitor.cc @@ -227,7 +227,9 @@ namespace edm { // for this purpose. using StreamID_value = decltype(std::declval().value()); using ModuleID = decltype(std::declval().id()); - tbb::concurrent_unordered_map, std::pair, edm::StdPairHasher> + tbb::concurrent_unordered_map, + std::pair, + edm::StdPairHasher> stallStart_{}; std::vector moduleLabels_{}; diff --git a/FWCore/Utilities/interface/hash_combine.h b/FWCore/Utilities/interface/hash_combine.h index 96680c37cef55..ba8355cf2276e 100644 --- a/FWCore/Utilities/interface/hash_combine.h +++ b/FWCore/Utilities/interface/hash_combine.h @@ -39,14 +39,14 @@ namespace edm { return seed; } -struct StdPairHasher { - std::size_t operator()(const std::pair& a) const noexcept { - return edm::hash_value(a.first,a.second); - } - std::size_t operator()(const std::pair& a) const noexcept { - return edm::hash_value(a.first,a.second); - } -}; + struct StdPairHasher { + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first, a.second); + } + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first, a.second); + } + }; } // namespace edm #endif diff --git a/FWCore/Utilities/interface/zero_allocator.h b/FWCore/Utilities/interface/zero_allocator.h index e7576e6bee425..38342636d747f 100644 --- a/FWCore/Utilities/interface/zero_allocator.h +++ b/FWCore/Utilities/interface/zero_allocator.h @@ -19,36 +19,36 @@ #include "tbb/tbb_allocator.h" namespace edm { - template class Allocator = tbb::tbb_allocator> - class zero_allocator : public Allocator - { + template class Allocator = tbb::tbb_allocator> + class zero_allocator : public Allocator { public: - using value_type = T; - using base_allocator_type = Allocator; - template struct rebind { - typedef zero_allocator other; - }; - - zero_allocator() throw() { } - zero_allocator(const zero_allocator &a) throw() : base_allocator_type( a ) { } - template - zero_allocator(const zero_allocator &a) throw() : base_allocator_type( Allocator( a ) ) { } - - T* allocate(const std::size_t n, const void *hint = 0 ) { - //T* ptr = base_allocator_type::allocate( n, hint ); - T* ptr = base_allocator_type::allocate( n ); - std::memset( static_cast(ptr), 0, n * sizeof(value_type) ); - return ptr; - } + using value_type = T; + using base_allocator_type = Allocator; + template + struct rebind { + typedef zero_allocator other; + }; + + zero_allocator() throw() {} + zero_allocator(const zero_allocator &a) throw() : base_allocator_type(a) {} + template + zero_allocator(const zero_allocator &a) throw() : base_allocator_type(Allocator(a)) {} + + T *allocate(const std::size_t n, const void *hint = nullptr) { + //T* ptr = base_allocator_type::allocate( n, hint ); + T *ptr = base_allocator_type::allocate(n); + std::memset(static_cast(ptr), 0, n * sizeof(value_type)); + return ptr; + } }; - template class B1, typename T2, template class B2> - inline bool operator==( const zero_allocator &a, const zero_allocator &b) { - return static_cast< B1 >(a) == static_cast< B2 >(b); + template class B1, typename T2, template class B2> + inline bool operator==(const zero_allocator &a, const zero_allocator &b) { + return static_cast >(a) == static_cast >(b); } - template class B1, typename T2, template class B2> - inline bool operator!=( const zero_allocator &a, const zero_allocator &b) { - return static_cast< B1 >(a) != static_cast< B2 >(b); + template class B1, typename T2, template class B2> + inline bool operator!=(const zero_allocator &a, const zero_allocator &b) { + return static_cast >(a) != static_cast >(b); } -} +} // namespace edm #endif From 84b2100c1d13877c425da7b8d2fe9ff7dd4a939f Mon Sep 17 00:00:00 2001 From: chayanit Date: Tue, 20 Apr 2021 10:46:29 +0200 Subject: [PATCH 011/309] add two more workflows for Tracking --- .../PyReleaseValidation/python/upgradeWorkflowComponents.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index d20ff4f6fd8a0..13764112de221 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1420,4 +1420,6 @@ def __init__(self, howMuch, dataset): ('SMS-T1tttt_mGl-1500_mLSP-100_14TeV-pythia8_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'SMS-T1tttt_14TeV')), ('VBFHZZ4Nu_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'VBFHZZ4Nu_14TeV')), ('EtaBToJpsiJpsi_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_14TeV')), + ('WToLNu_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(21,50),'WToLNu_14TeV')), + ('WprimeToLNu_M2000_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(21,50),'WprimeToLNu_M2000_14TeV')), ]) From 1de5243e4726155698807225efd7a4ee98028bf7 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Tue, 20 Apr 2021 15:31:08 +0200 Subject: [PATCH 012/309] Add cstring to define strstr --- FWCore/Framework/test/dependentrecord_t.cppunit.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/FWCore/Framework/test/dependentrecord_t.cppunit.cc b/FWCore/Framework/test/dependentrecord_t.cppunit.cc index 5f9576d186282..04f792a61ac2b 100644 --- a/FWCore/Framework/test/dependentrecord_t.cppunit.cc +++ b/FWCore/Framework/test/dependentrecord_t.cppunit.cc @@ -38,6 +38,7 @@ #include #include #include +#include using namespace edm::eventsetup; From fa89351877b83f12446dd2eeafd05a3c4d0794ee Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Wed, 21 Apr 2021 01:14:20 +0200 Subject: [PATCH 013/309] Some camelCase --- .../interface/HGCalValidator.h | 2 +- .../interface/HGVHistoProducerAlgo.h | 12 +- .../HGCalValidation/plugins/HGCalValidator.cc | 32 ++--- .../src/HGVHistoProducerAlgo.cc | 136 +++++++++--------- 4 files changed, 91 insertions(+), 91 deletions(-) diff --git a/Validation/HGCalValidation/interface/HGCalValidator.h b/Validation/HGCalValidation/interface/HGCalValidator.h index f617830125c1d..2ee815dacd557 100644 --- a/Validation/HGCalValidation/interface/HGCalValidator.h +++ b/Validation/HGCalValidation/interface/HGCalValidator.h @@ -75,7 +75,7 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { const edm::FileInPath cummatbudinxo_; std::vector> labelToken; - edm::EDGetTokenT> simclusters_; + edm::EDGetTokenT> simClusters_; edm::EDGetTokenT layerclusters_; std::vector>> label_mclTokens; edm::EDGetTokenT> label_cp_effic; diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index f6359fd9294b1..1831986cf53f6 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -109,7 +109,7 @@ struct HGVHistoProducerAlgoHistograms { std::unordered_map h_caloparticle_lastlayer_matchedtoRecHit; std::unordered_map h_caloparticle_layersnum_matchedtoRecHit; - //For simclusters + //For SimClusters std::unordered_map h_simclusternum_perlayer; std::unordered_map h_simclusternum_perthick; dqm::reco::MonitorElement* h_mixedhitssimcluster_zminus; @@ -244,7 +244,7 @@ class HGVHistoProducerAlgo { edm::Handle clusterHandle, const reco::CaloClusterCollection& clusters, edm::Handle> simClusterHandle, - std::vector const& simclusters, + std::vector const& simClusters, std::vector const& sCIndices, const std::vector& mask, std::unordered_map const&, @@ -281,16 +281,16 @@ class HGVHistoProducerAlgo { std::vector thicknesses, const hgcal::RecoToSimCollection& recSimColl, const hgcal::SimToRecoCollection& simRecColl) const; - void fill_simcluster_histos(const Histograms& histograms, - std::vector const& simclusters, + void fill_simCluster_histos(const Histograms& histograms, + std::vector const& simClusters, unsigned int layers, std::vector thicknesses) const; - void fill_simclusterassosiation_histos(const Histograms& histograms, + void fill_simClusterassosiation_histos(const Histograms& histograms, int count, edm::Handle clusterHandle, const reco::CaloClusterCollection& clusters, edm::Handle> simClusterHandle, - std::vector const& simclusters, + std::vector const& simClusters, std::vector const& sCIndices, const std::vector& mask, std::unordered_map const& hitMap, diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index e662bd1ff7b32..79679499234a7 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -42,7 +42,7 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) density_ = consumes(edm::InputTag("hgcalLayerClusters")); - simclusters_ = consumes>(pset.getParameter("label_scl")); + simClusters_ = consumes>(pset.getParameter("label_scl")); layerclusters_ = consumes(label_lcl); @@ -115,7 +115,7 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook.setCurrentFolder(dirName_); } - //Booking histograms concerning with simclusters + //Booking histograms concerning with simClusters if (doSimClustersPlots_) { ibook.cd(); ibook.setCurrentFolder(dirName_ + "simClusters/ClusterLevel"); @@ -147,7 +147,7 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, histoProducerAlgo_->bookSimClusterAssociationHistos( ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_); } //end of loop over masks - } //if for simcluster plots + } //if for simCluster plots //Booking histograms concerning with hgcal layer clusters if (doLayerClustersPlots_) { @@ -278,8 +278,8 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, //get collections from the event //simClusters edm::Handle> simClustersHandle; - event.getByToken(simclusters_, simClustersHandle); - std::vector const& simclusters = *simClustersHandle; + event.getByToken(simClusters_, simClustersHandle); + std::vector const& simClusters = *simClustersHandle; //Layer clusters edm::Handle clusterHandle; @@ -291,16 +291,16 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, event.getByToken(density_, densityHandle); const Density& densities = *densityHandle; - auto nSimClusters = simclusters.size(); + auto nSimClusters = simClusters.size(); std::vector sCIndices; //There shouldn't be any SimTracks from different crossings, but maybe they will be added later. //At the moment there should be one SimTrack in each SimCluster. for (unsigned int scId = 0; scId < nSimClusters; ++scId) { - if (simclusters[scId].g4Tracks()[0].eventId().event() != 0 or - simclusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0) { + if (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or + simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0) { LogDebug("HGCalValidator") << "Excluding SimClusters from event: " - << simclusters[scId].g4Tracks()[0].eventId().event() - << " with BX: " << simclusters[scId].g4Tracks()[0].eventId().bunchCrossing() + << simClusters[scId].g4Tracks()[0].eventId().event() + << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; continue; } @@ -308,11 +308,11 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, } // ############################################## - // fill simcluster histograms + // fill simCluster histograms // ############################################## if (doSimClustersPlots_) { - histoProducerAlgo_->fill_simcluster_histos( - histograms.histoProducerAlgo, simclusters, totallayers_to_monitor_, thicknesses_to_monitor_); + histoProducerAlgo_->fill_simCluster_histos( + histograms.histoProducerAlgo, simClusters, totallayers_to_monitor_, thicknesses_to_monitor_); for (unsigned int ws = 0; ws < label_clustersmask.size(); ws++) { const auto& inputClusterMask = event.get(clustersMaskTokens_[ws]); @@ -324,12 +324,12 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, event.getByToken(associatorMapRtSim, recotosimCollectionH); auto recSimColl = *recotosimCollectionH; - histoProducerAlgo_->fill_simclusterassosiation_histos(histograms.histoProducerAlgo, + histoProducerAlgo_->fill_simClusterassosiation_histos(histograms.histoProducerAlgo, ws, clusterHandle, clusters, simClustersHandle, - simclusters, + simClusters, sCIndices, inputClusterMask, *hitMap, @@ -338,7 +338,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, simRecColl); //General Info on simClusters - LogTrace("HGCalValidator") << "\n# of simclusters: " << nSimClusters << " label_clustersmask[ws].label() " + LogTrace("HGCalValidator") << "\n# of SimClusters: " << nSimClusters << ", layerClusters mask label: " << label_clustersmask[ws].label() << "\n"; } //end of loop overs masks } diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 759950175b85d..c2df41d0ba579 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -41,7 +41,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxPhi_(pset.getParameter("maxPhi")), nintPhi_(pset.getParameter("nintPhi")), - //parameters for counting mixed hits simclusters + //parameters for counting mixed hits SimClusters minMixedHitsSimCluster_(pset.getParameter("minMixedHitsSimCluster")), maxMixedHitsSimCluster_(pset.getParameter("maxMixedHitsSimCluster")), nintMixedHitsSimCluster_(pset.getParameter("nintMixedHitsSimCluster")), @@ -51,7 +51,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxMixedHitsCluster_(pset.getParameter("maxMixedHitsCluster")), nintMixedHitsCluster_(pset.getParameter("nintMixedHitsCluster")), - //parameters for the total amount of energy clustered by all layer clusters (fraction over caloparticles) + //parameters for the total amount of energy clustered by all layer clusters (fraction over CaloParticless) minEneCl_(pset.getParameter("minEneCl")), maxEneCl_(pset.getParameter("maxEneCl")), nintEneCl_(pset.getParameter("nintEneCl")), @@ -66,7 +66,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxZpos_(pset.getParameter("maxZpos")), nintZpos_(pset.getParameter("nintZpos")), - //Parameters for the total number of simclusters per layer + //Parameters for the total number of SimClusters per layer minTotNsimClsperlay_(pset.getParameter("minTotNsimClsperlay")), maxTotNsimClsperlay_(pset.getParameter("maxTotNsimClsperlay")), nintTotNsimClsperlay_(pset.getParameter("nintTotNsimClsperlay")), @@ -76,7 +76,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxTotNClsperlay_(pset.getParameter("maxTotNClsperlay")), nintTotNClsperlay_(pset.getParameter("nintTotNClsperlay")), - //Parameters for the energy clustered by layer clusters per layer (fraction over caloparticles) + //Parameters for the energy clustered by layer clusters per layer (fraction over CaloParticless) minEneClperlay_(pset.getParameter("minEneClperlay")), maxEneClperlay_(pset.getParameter("maxEneClperlay")), nintEneClperlay_(pset.getParameter("nintEneClperlay")), @@ -102,7 +102,7 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxMCLSharedEneFrac_(pset.getParameter("maxMCLSharedEneFrac")), nintMCLSharedEneFrac_(pset.getParameter("nintMCLSharedEneFrac")), - //Parameters for the total number of simclusters per thickness + //Parameters for the total number of SimClusters per thickness minTotNsimClsperthick_(pset.getParameter("minTotNsimClsperthick")), maxTotNsimClsperthick_(pset.getParameter("maxTotNsimClsperthick")), nintTotNsimClsperthick_(pset.getParameter("nintTotNsimClsperthick")), @@ -214,25 +214,25 @@ void HGVHistoProducerAlgo::bookCaloParticleHistos(DQMStore::IBooker& ibook, int pdgid, unsigned int layers) { histograms.h_caloparticle_eta[pdgid] = - ibook.book1D("N of caloparticle vs eta", "N of caloparticle vs eta", nintEta_, minEta_, maxEta_); + ibook.book1D("N of caloparticle vs eta", "N of caloParticles vs eta", nintEta_, minEta_, maxEta_); histograms.h_caloparticle_eta_Zorigin[pdgid] = ibook.book2D("Eta vs Zorigin", "Eta vs Zorigin", nintEta_, minEta_, maxEta_, nintZpos_, minZpos_, maxZpos_); histograms.h_caloparticle_energy[pdgid] = - ibook.book1D("Energy", "Energy of caloparticle", nintEne_, minEne_, maxEne_); - histograms.h_caloparticle_pt[pdgid] = ibook.book1D("Pt", "Pt of caloparticle", nintPt_, minPt_, maxPt_); - histograms.h_caloparticle_phi[pdgid] = ibook.book1D("Phi", "Phi of caloparticle", nintPhi_, minPhi_, maxPhi_); + ibook.book1D("Energy", "Energy of CaloParticles", nintEne_, minEne_, maxEne_); + histograms.h_caloparticle_pt[pdgid] = ibook.book1D("Pt", "Pt of CaloParticles", nintPt_, minPt_, maxPt_); + histograms.h_caloparticle_phi[pdgid] = ibook.book1D("Phi", "Phi of CaloParticles", nintPhi_, minPhi_, maxPhi_); histograms.h_caloparticle_selfenergy[pdgid] = ibook.book1D("SelfEnergy", "Total Energy of Hits in Sim Clusters (matched)", nintEne_, minEne_, maxEne_); histograms.h_caloparticle_energyDifference[pdgid] = ibook.book1D("EnergyDifference", "(Energy-SelfEnergy)/Energy", 300., -5., 1.); histograms.h_caloparticle_nSimClusters[pdgid] = - ibook.book1D("Num Sim Clusters", "Num Sim Clusters in caloparticle", 100, 0., 100.); + ibook.book1D("Num Sim Clusters", "Num Sim Clusters in CaloParticles", 100, 0., 100.); histograms.h_caloparticle_nHitsInSimClusters[pdgid] = - ibook.book1D("Num Hits in Sim Clusters", "Num Hits in Sim Clusters in caloparticle", 1000, 0., 1000.); + ibook.book1D("Num Hits in Sim Clusters", "Num Hits in Sim Clusters in CaloParticles", 1000, 0., 1000.); histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit[pdgid] = ibook.book1D( - "Num Rec-matched Hits in Sim Clusters", "Num Hits in Sim Clusters (matched) in caloparticle", 1000, 0., 1000.); + "Num Rec-matched Hits in Sim Clusters", "Num Hits in Sim Clusters (matched) in CaloParticles", 1000, 0., 1000.); histograms.h_caloparticle_nHits_matched_energy[pdgid] = ibook.book1D("Energy of Rec-matched Hits", "Energy of Hits in Sim Clusters (matched)", 100, 0., 10.); @@ -265,18 +265,18 @@ void HGVHistoProducerAlgo::bookCaloParticleHistos(DQMStore::IBooker& ibook, 110.); histograms.h_caloparticle_firstlayer[pdgid] = - ibook.book1D("First Layer", "First layer of the caloparticle", 2 * layers, 0., (float)2 * layers); + ibook.book1D("First Layer", "First layer of the CaloParticles", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_lastlayer[pdgid] = - ibook.book1D("Last Layer", "Last layer of the caloparticle", 2 * layers, 0., (float)2 * layers); + ibook.book1D("Last Layer", "Last layer of the CaloParticles", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_layersnum[pdgid] = - ibook.book1D("Number of Layers", "Number of layers of the caloparticle", 2 * layers, 0., (float)2 * layers); + ibook.book1D("Number of Layers", "Number of layers of the CaloParticles", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_firstlayer_matchedtoRecHit[pdgid] = ibook.book1D( - "First Layer (rec-matched hit)", "First layer of the caloparticle (matched)", 2 * layers, 0., (float)2 * layers); + "First Layer (rec-matched hit)", "First layer of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_lastlayer_matchedtoRecHit[pdgid] = ibook.book1D( - "Last Layer (rec-matched hit)", "Last layer of the caloparticle (matched)", 2 * layers, 0., (float)2 * layers); + "Last Layer (rec-matched hit)", "Last layer of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers); histograms.h_caloparticle_layersnum_matchedtoRecHit[pdgid] = ibook.book1D("Number of Layers (rec-matched hit)", - "Number of layers of the caloparticle (matched)", + "Number of layers of the CaloParticles (matched)", 2 * layers, 0., (float)2 * layers); @@ -620,14 +620,14 @@ void HGVHistoProducerAlgo::bookClusterHistos_ClusterLevel(DQMStore::IBooker& ibo //z- histograms.h_energyclustered_zminus.push_back( ibook.book1D("energyclustered_zminus", - "percent of total energy clustered by all layer clusters over caloparticles energy in z-", + "percent of total energy clustered by all layer clusters over CaloParticless energy in z-", nintEneCl_, minEneCl_, maxEneCl_)); //z+ histograms.h_energyclustered_zplus.push_back( ibook.book1D("energyclustered_zplus", - "percent of total energy clustered by all layer clusters over caloparticles energy in z+", + "percent of total energy clustered by all layer clusters over CaloParticless energy in z+", nintEneCl_, minEneCl_, maxEneCl_)); @@ -670,7 +670,7 @@ void HGVHistoProducerAlgo::bookClusterHistos_ClusterLevel(DQMStore::IBooker& ibo maxTotNClsperlay_); histograms.h_energyclustered_perlayer[ilayer] = ibook.book1D("energyclustered_perlayer" + istr1, - "percent of total energy clustered by layer clusters over caloparticles energy for layer " + istr2, + "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2, nintEneClperlay_, minEneClperlay_, maxEneClperlay_); @@ -1218,31 +1218,31 @@ void HGVHistoProducerAlgo::fill_info_histos(const Histograms& histograms, unsign void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms, int pdgid, - const CaloParticle& caloparticle, + const CaloParticle& caloParticle, std::vector const& simVertices, unsigned int layers, std::unordered_map const& hitMap) const { - const auto eta = getEta(caloparticle.eta()); + const auto eta = getEta(caloParticle.eta()); if (histograms.h_caloparticle_eta.count(pdgid)) { histograms.h_caloparticle_eta.at(pdgid)->Fill(eta); } if (histograms.h_caloparticle_eta_Zorigin.count(pdgid)) { histograms.h_caloparticle_eta_Zorigin.at(pdgid)->Fill( - simVertices.at(caloparticle.g4Tracks()[0].vertIndex()).position().z(), eta); + simVertices.at(caloParticle.g4Tracks()[0].vertIndex()).position().z(), eta); } if (histograms.h_caloparticle_energy.count(pdgid)) { - histograms.h_caloparticle_energy.at(pdgid)->Fill(caloparticle.energy()); + histograms.h_caloparticle_energy.at(pdgid)->Fill(caloParticle.energy()); } if (histograms.h_caloparticle_pt.count(pdgid)) { - histograms.h_caloparticle_pt.at(pdgid)->Fill(caloparticle.pt()); + histograms.h_caloparticle_pt.at(pdgid)->Fill(caloParticle.pt()); } if (histograms.h_caloparticle_phi.count(pdgid)) { - histograms.h_caloparticle_phi.at(pdgid)->Fill(caloparticle.phi()); + histograms.h_caloparticle_phi.at(pdgid)->Fill(caloParticle.phi()); } if (histograms.h_caloparticle_nSimClusters.count(pdgid)) { - histograms.h_caloparticle_nSimClusters.at(pdgid)->Fill(caloparticle.simClusters().size()); + histograms.h_caloparticle_nSimClusters.at(pdgid)->Fill(caloParticle.simClusters().size()); int simHits = 0; int minLayerId = 999; @@ -1255,7 +1255,7 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms float energy = 0.; std::map totenergy_layer; - for (auto const& sc : caloparticle.simClusters()) { + for (auto const& sc : caloParticle.simClusters()) { LogDebug("HGCalValidator") << " This sim cluster has " << sc->hits_and_fractions().size() << " simHits and " << sc->energy() << " energy. " << std::endl; simHits += sc->hits_and_fractions().size(); @@ -1282,7 +1282,7 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms } else { totenergy_layer.emplace(layerId, hit->energy()); } - if (caloparticle.simClusters().size() == 1) + if (caloParticle.simClusters().size() == 1) histograms.h_caloparticle_nHits_matched_energy_layer_1SimCl.at(pdgid)->Fill(layerId, hit->energy() * h_and_f.second); } else { @@ -1307,21 +1307,21 @@ void HGVHistoProducerAlgo::fill_caloparticle_histos(const Histograms& histograms histograms.h_caloparticle_nHitsInSimClusters.at(pdgid)->Fill((float)simHits); histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit.at(pdgid)->Fill((float)simHits_matched); histograms.h_caloparticle_selfenergy.at(pdgid)->Fill((float)energy); - histograms.h_caloparticle_energyDifference.at(pdgid)->Fill((float)1. - energy / caloparticle.energy()); + histograms.h_caloparticle_energyDifference.at(pdgid)->Fill((float)1. - energy / caloParticle.energy()); //Calculate sum energy per-layer auto i = totenergy_layer.begin(); double sum_energy = 0.0; while (i != totenergy_layer.end()) { sum_energy += i->second; - histograms.h_caloparticle_sum_energy_layer.at(pdgid)->Fill(i->first, sum_energy / caloparticle.energy() * 100.); + histograms.h_caloparticle_sum_energy_layer.at(pdgid)->Fill(i->first, sum_energy / caloParticle.energy() * 100.); i++; } } } -void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Histograms& histograms, - std::vector const& simclusters, +void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simCluster_histos(const Histograms& histograms, + std::vector const& simClusters, unsigned int layers, std::vector thicknesses) const { //Each event to be treated as two events: an event in +ve endcap, @@ -1330,7 +1330,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi //-z: 0->49 //+z: 50->99 - //To keep track of total num of simclusters per layer + //To keep track of total num of simClusters per layer //tnscpl[layerid] std::vector tnscpl(1000, 0); //tnscpl.clear(); tnscpl.reserve(1000); @@ -1344,16 +1344,16 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi tnscpthplus.insert(std::pair(std::to_string(*it), 0)); tnscpthminus.insert(std::pair(std::to_string(*it), 0)); } - //To keep track of the total num of simclusters with mixed thickness hits per event + //To keep track of the total num of simClusters with mixed thickness hits per event tnscpthplus.insert(std::pair("mixed", 0)); tnscpthminus.insert(std::pair("mixed", 0)); - //loop through simclusters - for (unsigned int ic = 0; ic < simclusters.size(); ++ic) { - const auto& sc = simclusters[ic]; + //loop through simClusters + for (unsigned int ic = 0; ic < simClusters.size(); ++ic) { + const auto& sc = simClusters[ic]; const auto& hitsAndFractions = sc.hits_and_fractions(); - //Auxillary variables to count the number of different kind of hits in each simcluster + //Auxillary variables to count the number of different kind of hits in each simCluster int nthhits120p = 0; int nthhits200p = 0; int nthhits300p = 0; @@ -1364,10 +1364,10 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi int nthhitsscintm = 0; //For the hits thickness of the layer cluster. double thickness = 0.; - //To keep track if we added the simcluster in a specific layer + //To keep track if we added the simCluster in a specific layer std::vector occurenceSCinlayer(1000, 0); //[layerid][0 if not added] - //loop through hits of the simcluster + //loop through hits of the simCluster for (const auto& hAndF : hitsAndFractions) { const DetId sh_detid = hAndF.first; @@ -1377,7 +1377,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi //zside that the current cluster belongs to. int zside = recHitTools_->zside(sh_detid); - //add the simcluster to the relevant layer. A simcluster may give contribution to several layers. + //add the simCluster to the relevant layer. A SimCluster may give contribution to several layers. if (occurenceSCinlayer[layerid] == 0) { tnscpl[layerid]++; } @@ -1388,7 +1388,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi } else if (sh_detid.det() == DetId::HGCalHSc) { thickness = -1; } else { - LogDebug("HGCalValidator") << "These are HGCal simclusters, you shouldn't be here !!! " << layerid << "\n"; + LogDebug("HGCalValidator") << "These are HGCal simClusters, you shouldn't be here !!! " << layerid << "\n"; continue; } @@ -1434,7 +1434,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi tnscpthminus[std::to_string((int)thickness)]++; } - } //end of loop through simclusters of the event + } //end of loop through SimClusters of the event //Per layer : Loop 0->99 for (unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) { @@ -1455,13 +1455,13 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simcluster_histos(const Hi histograms.h_mixedhitssimcluster_zminus->Fill(tnscpthminus["mixed"]); } -void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simclusterassosiation_histos( +void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simClusterassosiation_histos( const Histograms& histograms, int count, edm::Handle clusterHandle, const reco::CaloClusterCollection& clusters, edm::Handle> simClusterHandle, - std::vector const& simclusters, + std::vector const& simClusters, std::vector const& sCIndices, const std::vector& mask, std::unordered_map const& hitMap, @@ -1481,7 +1481,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simclusterassosiation_hist clusterHandle, clusters, simClusterHandle, - simclusters, + simClusters, sCIndices, mask, hitMap, @@ -1514,7 +1514,7 @@ void HGVHistoProducerAlgo::layerClusters_to_CaloParticles(const Histograms& hist std::unordered_map> detIdToLayerClusterId_Map; // The association has to be done in an all-vs-all fashion. - // For this reason we use the full set of caloParticles, with the only filter on bx + // For this reason we use the full set of CaloParticles, with the only filter on bx for (const auto& cpId : cPIndices) { const SimClusterRefVector& simClusterRefVector = cP[cpId].simClusters(); for (const auto& it_sc : simClusterRefVector) { @@ -1781,7 +1781,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( // Here we do fill the plots to compute the different metrics linked to // reco-level, namely fake-rate and merge-rate. In this loop we should *not* - // restrict only to the selected simClusters. + // restrict only to the selected SimClusters. for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) { if (mask[lcId] != 0.) { LogDebug("HGCalValidator") << "Skipping layer cluster " << lcId << " not belonging to mask" << std::endl; @@ -1810,11 +1810,11 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( } continue; } - //Loop through all simClusters linked to the layer cluster under study + //Loop through all SimClusters linked to the layer cluster under study for (const auto& scPair : scs) { LogDebug("HGCalValidator") << "layerCluster Id: \t" << lcId << "\t SC id: \t" << scPair.first.index() << "\t score \t" << scPair.second << std::endl; - //This should be filled #layerclusters in layer x #linked SimClusters + //This should be filled #layerClusters in layer x #linked SimClusters histograms.h_score_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill(scPair.second); auto const& sc_linked = std::find_if(std::begin(lcsInSimClusterMap[scPair.first]), @@ -1830,7 +1830,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( histograms.h_energy_vs_score_layercl2simcluster_perlayer[count].at(lcLayerId)->Fill( scPair.second, sc_linked->second.first / clusters[lcId].energy()); } - //Here he counts how many of the linked simclusters of the layer cluster under study have a score above a certain value. + //Here he counts how many of the linked SimClusters of the layer cluster under study have a score above a certain value. const auto assoc = std::count_if(std::begin(scs), std::end(scs), [](const auto& obj) { return obj.second < ScoreCutLCtoSC_; }); if (assoc) { @@ -1842,7 +1842,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( } const auto& best = std::min_element( std::begin(scs), std::end(scs), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - //From all simclusters he founds the one with the best (lowest) score and takes his scId + //From all SimClusters he founds the one with the best (lowest) score and takes his scId const auto& best_sc_linked = std::find_if(std::begin(lcsInSimClusterMap[best->first]), std::end(lcsInSimClusterMap[best->first]), @@ -1861,7 +1861,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( // Here we do fill the plots to compute the different metrics linked to // gen-level, namely efficiency and duplicate. In this loop we should restrict - // only to the selected simClusters. + // only to the selected SimClusters. for (const auto& scId : sCIndices) { const edm::Ref scRef(simClusterHandle, scId); const auto& lcsIt = lcsInSimClusterMap.find(scRef); @@ -1901,7 +1901,7 @@ void HGVHistoProducerAlgo::layerClusters_to_SimClusters( return lcLayerId; }; - //Loop through layer clusters linked to the simcluster under study + //Loop through layer clusters linked to the SimCluster under study for (const auto& lcPair : lcs) { auto lcId = lcPair.first.index(); if (mask[lcId] != 0.) { @@ -2004,7 +2004,7 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr //for the longitudinal depth barycenter std::vector ldbar(1000, 0.0); //ldbar.clear(); ldbar.reserve(1000); - //We need to compare with the total amount of energy coming from caloparticles + //We need to compare with the total amount of energy coming from CaloParticles double caloparteneplus = 0.; double caloparteneminus = 0.; for (const auto& cpId : cPIndices) { @@ -2017,15 +2017,15 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr } //loop through clusters of the event - for (unsigned int layerclusterIndex = 0; layerclusterIndex < clusters.size(); layerclusterIndex++) { - const std::vector> hits_and_fractions = clusters[layerclusterIndex].hitsAndFractions(); + for (unsigned int lcId = 0; lcId < clusters.size(); lcId++) { + const std::vector> hits_and_fractions = clusters[lcId].hitsAndFractions(); - const DetId seedid = clusters[layerclusterIndex].seed(); + const DetId seedid = clusters[lcId].seed(); const double seedx = recHitTools_->getPosition(seedid).x(); const double seedy = recHitTools_->getPosition(seedid).y(); - DetId maxid = findmaxhit(clusters[layerclusterIndex], hitMap); + DetId maxid = findmaxhit(clusters[lcId], hitMap); - // const DetId maxid = clusters[layerclusterIndex].max(); + // const DetId maxid = clusters[lcId].max(); double maxx = recHitTools_->getPosition(maxid).x(); double maxy = recHitTools_->getPosition(maxid).y(); @@ -2203,12 +2203,12 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr } if (histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)) { histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill( - distancebetseedandmax, clusters[layerclusterIndex].energy()); + distancebetseedandmax, clusters[lcId].energy()); } //Energy clustered per layer - tecpl[layerid] = tecpl[layerid] + clusters[layerclusterIndex].energy(); - ldbar[layerid] = ldbar[layerid] + clusters[layerclusterIndex].energy() * cummatbudg[(double)lay]; + tecpl[layerid] = tecpl[layerid] + clusters[lcId].energy(); + ldbar[layerid] = ldbar[layerid] + clusters[lcId].energy() * cummatbudg[(double)lay]; } //end of loop through clusters of the event @@ -2333,9 +2333,9 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist const HGCRecHit* hit = itcheck->second; //Since the current hit from sim cluster has a reconstructed hit with the same detid, //make a map that will connect a detid with: - //1. the caloparticles that have a simcluster with sim hits in that cell via caloparticle id. + //1. the CaloParticles that have a SimCluster with sim hits in that cell via caloparticle id. //2. the sum of all simhits fractions that contributes to that detid. - //So, keep in mind that in case of multiple caloparticles contributing in the same cell + //So, keep in mind that in case of multiple CaloParticles contributing in the same cell //the fraction is the sum over all calo particles. So, something like: //detid: (caloparticle 1, sum of hits fractions in that detid over all cp) , (caloparticle 2, sum of hits fractions in that detid over all cp), (caloparticle 3, sum of hits fractions in that detid over all cp) ... auto hit_find_it = detIdToCaloParticleId_Map.find(hitid); @@ -2838,7 +2838,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist histograms.h_denom_caloparticle_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta()); histograms.h_denom_caloparticle_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi()); - } //end of loop through caloparticles + } //end of loop through CaloParticles // Here we do fill the plots to compute the different metrics linked to // reco-level, namely fake-rate an merge-rate. In this loop we should *not* From d46605becb1f907c41b9668a187207c165953ece Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Wed, 21 Apr 2021 02:01:06 +0200 Subject: [PATCH 014/309] MultiCluster to Trackster --- ...ster.cc => PFClusterFromHGCalTrackster.cc} | 36 +- ...luster.h => PFClusterFromHGCalTrackster.h} | 27 +- .../python/particleFlowClusterHGC_cfi.py | 8 +- .../interface/HGCalValidator.h | 8 +- .../interface/HGVHistoProducerAlgo.h | 134 +-- .../HGCalValidation/plugins/HGCalValidator.cc | 65 +- .../python/HGCalValidator_cfi.py | 12 +- .../python/HGVHistoProducerAlgoBlock_cfi.py | 40 +- .../HGCalValidation/python/hgcalPlots.py | 196 ++-- .../scripts/makeHGCalValidationPlots.py | 55 +- .../src/HGVHistoProducerAlgo.cc | 933 +++++++++--------- 11 files changed, 756 insertions(+), 758 deletions(-) rename RecoParticleFlow/PFClusterProducer/plugins/{PFClusterFromHGCalMultiCluster.cc => PFClusterFromHGCalTrackster.cc} (68%) rename RecoParticleFlow/PFClusterProducer/plugins/{PFClusterFromHGCalMultiCluster.h => PFClusterFromHGCalTrackster.h} (57%) diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalMultiCluster.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc similarity index 68% rename from RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalMultiCluster.cc rename to RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc index 4d78d73b01e75..040289e9af36b 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalMultiCluster.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc @@ -1,23 +1,23 @@ -#include "PFClusterFromHGCalMultiCluster.h" +#include "PFClusterFromHGCalTrackster.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" -void PFClusterFromHGCalMultiCluster::updateEvent(const edm::Event& ev) { - ev.getByToken(clusterToken_, clusterH_); +void PFClusterFromHGCalTrackster::updateEvent(const edm::Event& ev) { ev.getByToken(tracksterToken_, trackstersH_); + ev.getByToken(clusterToken_, clusterH_); } -void PFClusterFromHGCalMultiCluster::buildClusters(const edm::Handle& input, +void PFClusterFromHGCalTrackster::buildClusters(const edm::Handle& input, const std::vector& rechitMask, const std::vector& seedable, reco::PFClusterCollection& output) { - const auto& hgcalMultiClusters = *clusterH_; auto const& hits = *input; const auto& tracksters = *trackstersH_; + const auto& clusters = *clusterH_; // for quick indexing back to hit energy std::unordered_map detIdToIndex(hits.size()); @@ -25,18 +25,18 @@ void PFClusterFromHGCalMultiCluster::buildClusters(const edm::Handle > hitsAndFractions; - hitsAndFractions.insert(hitsAndFractions.end(), hitsAndFractions_mcl.begin(), hitsAndFractions_mcl.end()); - - // Use the H&F of the clusters inside the multicluster if the latter's H&F are not stored - if (hitsAndFractions.empty()) { - for (const auto& cl : mcl) { - const auto& hAndF_temp = cl->hitsAndFractions(); - hitsAndFractions.insert(hitsAndFractions.end(), hAndF_temp.begin(), hAndF_temp.end()); - } + for (const auto lcId : tst.vertices()) { + const auto& hAndF_temp = clusters[lcId].hitsAndFractions(); + hitsAndFractions.insert(hitsAndFractions.end(), hAndF_temp.begin(), hAndF_temp.end()); } for (const auto& hAndF : hitsAndFractions) { @@ -88,5 +82,5 @@ void PFClusterFromHGCalMultiCluster::buildClusters(const edm::Handle("filterByTracksterPID"); pid_threshold_ = conf.getParameter("pid_threshold"); filter_on_categories_ = conf.getParameter >("filter_on_categories"); - clusterToken_ = - sumes.consumes >(conf.getParameter("clusterSrc")); tracksterToken_ = sumes.consumes >(conf.getParameter("tracksterSrc")); + clusterToken_ = + sumes.consumes(conf.getParameter("clusterSrc")); } - ~PFClusterFromHGCalMultiCluster() override {} - PFClusterFromHGCalMultiCluster(const PFClusterFromHGCalMultiCluster&) = delete; - PFClusterFromHGCalMultiCluster& operator=(const PFClusterFromHGCalMultiCluster&) = delete; + ~PFClusterFromHGCalTrackster() override {} + PFClusterFromHGCalTrackster(const PFClusterFromHGCalTrackster&) = delete; + PFClusterFromHGCalTrackster& operator=(const PFClusterFromHGCalTrackster&) = delete; void updateEvent(const edm::Event&) final; @@ -35,13 +34,13 @@ class PFClusterFromHGCalMultiCluster : public InitialClusteringStepBase { float pid_threshold_; std::vector filter_on_categories_; - edm::EDGetTokenT > clusterToken_; - edm::Handle > clusterH_; - edm::EDGetTokenT > tracksterToken_; edm::Handle > trackstersH_; + + edm::EDGetTokenT clusterToken_; + edm::Handle clusterH_; }; -DEFINE_EDM_PLUGIN(InitialClusteringStepFactory, PFClusterFromHGCalMultiCluster, "PFClusterFromHGCalMultiCluster"); +DEFINE_EDM_PLUGIN(InitialClusteringStepFactory, PFClusterFromHGCalTrackster, "PFClusterFromHGCalTrackster"); #endif diff --git a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py index 04dfee19e226d..c36d95eaaf0d6 100644 --- a/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py +++ b/RecoParticleFlow/PFClusterProducer/python/particleFlowClusterHGC_cfi.py @@ -44,12 +44,12 @@ updateTiming = cms.bool(False) ) -_hgcalMultiClusterMapper_HGCal = cms.PSet( - algoName = cms.string("PFClusterFromHGCalMultiCluster"), +_hgcalTracksterMapper_HGCal = cms.PSet( + algoName = cms.string("PFClusterFromHGCalTrackster"), thresholdsByDetector = cms.VPSet( ), - clusterSrc = cms.InputTag("ticlMultiClustersFromTrackstersMerge"), tracksterSrc = cms.InputTag("ticlTrackstersMerge"), + clusterSrc = cms.InputTag("hgcalLayerClusters"), filterByTracksterPID = cms.bool(False), pid_threshold = cms.double(0.8), filter_on_categories = cms.vint32([0, 1]), @@ -68,5 +68,5 @@ ) particleFlowClusterHGCalFromMultiCl = particleFlowClusterHGCal.clone( - initialClusteringStep = _hgcalMultiClusterMapper_HGCal + initialClusteringStep = _hgcalTracksterMapper_HGCal ) diff --git a/Validation/HGCalValidation/interface/HGCalValidator.h b/Validation/HGCalValidation/interface/HGCalValidator.h index 2ee815dacd557..9044b870eb999 100644 --- a/Validation/HGCalValidation/interface/HGCalValidator.h +++ b/Validation/HGCalValidation/interface/HGCalValidator.h @@ -16,7 +16,7 @@ #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "DataFormats/ParticleFlowReco/interface/PFCluster.h" #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" -#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "SimDataFormats/Vertex/interface/SimVertex.h" @@ -62,7 +62,7 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { protected: edm::ESGetToken caloGeomToken_; edm::InputTag label_lcl; - std::vector label_mcl; + std::vector label_tst; edm::InputTag associator_; edm::InputTag associatorSim_; const bool SaveGeneralInfo_; @@ -70,14 +70,14 @@ class HGCalValidator : public DQMGlobalEDAnalyzer { const bool doCaloParticleSelection_; const bool doSimClustersPlots_; const bool doLayerClustersPlots_; - const bool doMultiClustersPlots_; + const bool doTrackstersPlots_; std::vector label_clustersmask; const edm::FileInPath cummatbudinxo_; std::vector> labelToken; edm::EDGetTokenT> simClusters_; edm::EDGetTokenT layerclusters_; - std::vector>> label_mclTokens; + std::vector> label_tstTokens; edm::EDGetTokenT> label_cp_effic; edm::EDGetTokenT> label_cp_fake; edm::EDGetTokenT> simVertices_; diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index 1831986cf53f6..a41eec1bf5087 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -17,7 +17,7 @@ #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" -#include "DataFormats/ParticleFlowReco/interface/HGCalMultiCluster.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" @@ -138,54 +138,54 @@ struct HGVHistoProducerAlgoHistograms { std::vector> h_sharedenergy_simcluster2layercl_vs_eta_perlayer; std::vector> h_sharedenergy_simcluster2layercl_vs_phi_perlayer; - //For multiclusters - std::vector h_score_multicl2caloparticle; - std::vector h_score_caloparticle2multicl; - std::vector h_energy_vs_score_multicl2caloparticle; - std::vector h_energy_vs_score_caloparticle2multicl; - std::vector h_num_multicl_eta; - std::vector h_num_multicl_phi; - std::vector h_numMerge_multicl_eta; - std::vector h_numMerge_multicl_phi; - std::vector h_sharedenergy_multicl2caloparticle; - std::vector h_sharedenergy_caloparticle2multicl; - std::vector h_sharedenergy_caloparticle2multicl_assoc; - std::vector h_sharedenergy_multicl2caloparticle_vs_eta; - std::vector h_sharedenergy_multicl2caloparticle_vs_phi; - std::vector h_sharedenergy_caloparticle2multicl_vs_eta; - std::vector h_sharedenergy_caloparticle2multicl_vs_phi; - std::vector h_denom_multicl_eta; - std::vector h_denom_multicl_phi; + //For Tracksters + std::vector h_score_trackster2caloparticle; + std::vector h_score_caloparticle2trackster; + std::vector h_energy_vs_score_trackster2caloparticle; + std::vector h_energy_vs_score_caloparticle2trackster; + std::vector h_num_trackster_eta; + std::vector h_num_trackster_phi; + std::vector h_numMerge_trackster_eta; + std::vector h_numMerge_trackster_phi; + std::vector h_sharedenergy_trackster2caloparticle; + std::vector h_sharedenergy_caloparticle2trackster; + std::vector h_sharedenergy_caloparticle2trackster_assoc; + std::vector h_sharedenergy_trackster2caloparticle_vs_eta; + std::vector h_sharedenergy_trackster2caloparticle_vs_phi; + std::vector h_sharedenergy_caloparticle2trackster_vs_eta; + std::vector h_sharedenergy_caloparticle2trackster_vs_phi; + std::vector h_denom_trackster_eta; + std::vector h_denom_trackster_phi; std::vector h_num_caloparticle_eta; std::vector h_num_caloparticle_phi; - std::vector h_numDup_multicl_eta; - std::vector h_numDup_multicl_phi; + std::vector h_numDup_trackster_eta; + std::vector h_numDup_trackster_phi; std::vector h_denom_caloparticle_eta; std::vector h_denom_caloparticle_phi; - std::vector h_multiclusternum; - std::vector h_contmulticlusternum; - std::vector h_noncontmulticlusternum; - std::vector h_clusternum_in_multicluster; - std::vector> h_clusternum_in_multicluster_perlayer; - std::vector h_multiplicityOfLCinMCL; + std::vector h_tracksternum; + std::vector h_conttracksternum; + std::vector h_nonconttracksternum; + std::vector h_clusternum_in_trackster; + std::vector> h_clusternum_in_trackster_perlayer; + std::vector h_multiplicityOfLCinTST; std::vector h_multiplicity_numberOfEventsHistogram; std::vector h_multiplicity_zminus_numberOfEventsHistogram; std::vector h_multiplicity_zplus_numberOfEventsHistogram; - std::vector h_multiplicityOfLCinMCL_vs_layercluster; - std::vector h_multiplicityOfLCinMCL_vs_layercluster_zminus; - std::vector h_multiplicityOfLCinMCL_vs_layercluster_zplus; - std::vector h_multiplicityOfLCinMCL_vs_layerclusterenergy; - std::vector h_clusternum_in_multicluster_vs_layer; - std::vector h_multicluster_pt; - std::vector h_multicluster_eta; - std::vector h_multicluster_phi; - std::vector h_multicluster_energy; - std::vector h_multicluster_x; - std::vector h_multicluster_y; - std::vector h_multicluster_z; - std::vector h_multicluster_firstlayer; - std::vector h_multicluster_lastlayer; - std::vector h_multicluster_layersnum; + std::vector h_multiplicityOfLCinTST_vs_layercluster; + std::vector h_multiplicityOfLCinTST_vs_layercluster_zminus; + std::vector h_multiplicityOfLCinTST_vs_layercluster_zplus; + std::vector h_multiplicityOfLCinTST_vs_layerclusterenergy; + std::vector h_clusternum_in_trackster_vs_layer; + std::vector h_trackster_pt; + std::vector h_trackster_eta; + std::vector h_trackster_phi; + std::vector h_trackster_energy; + std::vector h_trackster_x; + std::vector h_trackster_y; + std::vector h_trackster_z; + std::vector h_trackster_firstlayer; + std::vector h_trackster_lastlayer; + std::vector h_trackster_layersnum; }; using Density = hgcal_clustering::Density; @@ -226,7 +226,7 @@ class HGVHistoProducerAlgo { unsigned int layers, std::vector thicknesses); - void bookMultiClusterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers); + void bookTracksterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers); void layerClusters_to_CaloParticles(const Histograms& histograms, edm::Handle clusterHandle, @@ -251,14 +251,15 @@ class HGVHistoProducerAlgo { unsigned int layers, const hgcal::RecoToSimCollectionWithSimClusters& recSimColl, const hgcal::SimToRecoCollectionWithSimClusters& simRecColl) const; - void multiClusters_to_CaloParticles(const Histograms& histograms, - int count, - const std::vector& multiClusters, - std::vector const& cP, - std::vector const& cPIndices, - std::vector const& cPSelectedIndices, - std::unordered_map const&, - unsigned int layers) const; + void tracksters_to_CaloParticles(const Histograms& histograms, + int count, + const ticl::TracksterCollection& Tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector const& cP, + std::vector const& cPIndices, + std::vector const& cPSelectedIndices, + std::unordered_map const&, + unsigned int layers) const; void fill_info_histos(const Histograms& histograms, unsigned int layers) const; void fill_caloparticle_histos(const Histograms& histograms, int pdgid, @@ -298,9 +299,10 @@ class HGVHistoProducerAlgo { const hgcal::RecoToSimCollectionWithSimClusters& recSimColl, const hgcal::SimToRecoCollectionWithSimClusters& simRecColl) const; void fill_cluster_histos(const Histograms& histograms, int count, const reco::CaloCluster& cluster) const; - void fill_multi_cluster_histos(const Histograms& histograms, + void fill_trackster_histos(const Histograms& histograms, int count, - const std::vector& multiClusters, + const ticl::TracksterCollection& Tracksters, + const reco::CaloClusterCollection& layerClusters, std::vector const& cP, std::vector const& cPIndices, std::vector const& cPSelectedIndices, @@ -319,9 +321,9 @@ class HGVHistoProducerAlgo { float fraction; }; - struct detIdInfoInMultiCluster { - bool operator==(const detIdInfoInMultiCluster& o) const { return multiclusterId == o.multiclusterId; }; - unsigned int multiclusterId; + struct detIdInfoInTrackster { + bool operator==(const detIdInfoInTrackster& o) const { return tracksterId == o.tracksterId; }; + unsigned int tracksterId; long unsigned int clusterId; float fraction; }; @@ -368,8 +370,8 @@ class HGVHistoProducerAlgo { int nintScore_; double minSharedEneFrac_, maxSharedEneFrac_; int nintSharedEneFrac_; - double minMCLSharedEneFrac_, maxMCLSharedEneFrac_; - int nintMCLSharedEneFrac_; + double minTSTSharedEneFrac_, maxTSTSharedEneFrac_; + int nintTSTSharedEneFrac_; double minTotNsimClsperthick_, maxTotNsimClsperthick_; int nintTotNsimClsperthick_; double minTotNClsperthick_, maxTotNClsperthick_; @@ -390,16 +392,16 @@ class HGVHistoProducerAlgo { int nintClEneperthickperlayer_; double minCellsEneDensperthick_, maxCellsEneDensperthick_; int nintCellsEneDensperthick_; - double minTotNMCLs_, maxTotNMCLs_; - int nintTotNMCLs_; - double minTotNClsinMCLs_, maxTotNClsinMCLs_; - int nintTotNClsinMCLs_; - double minTotNClsinMCLsperlayer_, maxTotNClsinMCLsperlayer_; - int nintTotNClsinMCLsperlayer_; + double minTotNTSTs_, maxTotNTSTs_; + int nintTotNTSTs_; + double minTotNClsinTSTs_, maxTotNClsinTSTs_; + int nintTotNClsinTSTs_; + double minTotNClsinTSTsperlayer_, maxTotNClsinTSTsperlayer_; + int nintTotNClsinTSTsperlayer_; double minMplofLCs_, maxMplofLCs_; int nintMplofLCs_; - double minSizeCLsinMCLs_, maxSizeCLsinMCLs_; - int nintSizeCLsinMCLs_; + double minSizeCLsinTSTs_, maxSizeCLsinTSTs_; + int nintSizeCLsinTSTs_; double minClEnepermultiplicity_, maxClEnepermultiplicity_; int nintClEnepermultiplicity_; double minX_, maxX_; diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index 79679499234a7..6f7c44243d1ba 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -11,7 +11,7 @@ using namespace edm; HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) : caloGeomToken_(esConsumes()), label_lcl(pset.getParameter("label_lcl")), - label_mcl(pset.getParameter>("label_mcl")), + label_tst(pset.getParameter>("label_tst")), associator_(pset.getUntrackedParameter("associator")), associatorSim_(pset.getUntrackedParameter("associatorSim")), SaveGeneralInfo_(pset.getUntrackedParameter("SaveGeneralInfo")), @@ -19,7 +19,7 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) doCaloParticleSelection_(pset.getUntrackedParameter("doCaloParticleSelection")), doSimClustersPlots_(pset.getUntrackedParameter("doSimClustersPlots")), doLayerClustersPlots_(pset.getUntrackedParameter("doLayerClustersPlots")), - doMultiClustersPlots_(pset.getUntrackedParameter("doMultiClustersPlots")), + doTrackstersPlots_(pset.getUntrackedParameter("doTrackstersPlots")), label_clustersmask(pset.getParameter>("LayerClustersInputMask")), cummatbudinxo_(pset.getParameter("cummatbudinxo")) { //In this way we can easily generalize to associations between other objects also. @@ -46,8 +46,8 @@ HGCalValidator::HGCalValidator(const edm::ParameterSet& pset) layerclusters_ = consumes(label_lcl); - for (auto& itag : label_mcl) { - label_mclTokens.push_back(consumes>(itag)); + for (auto& itag : label_tst) { + label_tstTokens.push_back(consumes(itag)); } associatorMapRtS = consumes(associator_); @@ -169,10 +169,10 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook, histograms.histoProducerAlgo, totallayers_to_monitor_, thicknesses_to_monitor_); } - //Booking histograms for multiclusters - for (unsigned int www = 0; www < label_mcl.size(); www++) { + //Booking histograms for Tracksters + for (unsigned int www = 0; www < label_tst.size(); www++) { ibook.cd(); - InputTag algo = label_mcl[www]; + InputTag algo = label_tst[www]; string dirName = dirName_; if (!algo.process().empty()) dirName += algo.process() + "_"; @@ -192,11 +192,11 @@ void HGCalValidator::bookHistograms(DQMStore::IBooker& ibook, ibook.setCurrentFolder(dirName); - //Booking histograms concerning for hgcal multi clusters - if (doMultiClustersPlots_) { - histoProducerAlgo_->bookMultiClusterHistos(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_); + //Booking histograms concerning for HGCal tracksters + if (doTrackstersPlots_) { + histoProducerAlgo_->bookTracksterHistos(ibook, histograms.histoProducerAlgo, totallayers_to_monitor_); } - } //end of booking multiclusters loop + } //end of booking Tracksters loop } void HGCalValidator::cpParametersAndSelection(const Histograms& histograms, @@ -374,28 +374,29 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, } // ############################################## - // fill multicluster histograms + // fill Trackster histograms // ############################################## - for (unsigned int wml = 0; wml < label_mclTokens.size(); wml++) { - if (doMultiClustersPlots_) { - edm::Handle> multiClusterHandle; - event.getByToken(label_mclTokens[wml], multiClusterHandle); - const std::vector& multiClusters = *multiClusterHandle; - - histoProducerAlgo_->fill_multi_cluster_histos(histograms.histoProducerAlgo, - wml, - multiClusters, - caloParticles, - cPIndices, - selected_cPeff, - *hitMap, - totallayers_to_monitor_); - - //General Info on multiclusters - LogTrace("HGCalValidator") << "\n# of multi clusters with " << label_mcl[wml].process() << ":" - << label_mcl[wml].label() << ":" << label_mcl[wml].instance() << ": " - << multiClusters.size() << "\n" + for (unsigned int wml = 0; wml < label_tstTokens.size(); wml++) { + if (doTrackstersPlots_) { + edm::Handle tracksterHandle; + event.getByToken(label_tstTokens[wml], tracksterHandle); + const ticl::TracksterCollection& tracksters = *tracksterHandle; + + histoProducerAlgo_->fill_trackster_histos(histograms.histoProducerAlgo, + wml, + tracksters, + clusters, + caloParticles, + cPIndices, + selected_cPeff, + *hitMap, + totallayers_to_monitor_); + + //General Info on Tracksters + LogTrace("HGCalValidator") << "\n# of Tracksters with " << label_tst[wml].process() << ":" + << label_tst[wml].label() << ":" << label_tst[wml].instance() << ": " + << tracksters.size() << "\n" << std::endl; } - } //end of loop over multicluster input labels + } //end of loop over Trackster input labels } diff --git a/Validation/HGCalValidation/python/HGCalValidator_cfi.py b/Validation/HGCalValidation/python/HGCalValidator_cfi.py index 4f415db769eaa..6c339f4312de4 100644 --- a/Validation/HGCalValidation/python/HGCalValidator_cfi.py +++ b/Validation/HGCalValidation/python/HGCalValidator_cfi.py @@ -10,8 +10,8 @@ from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, ticlIterLabelsMerge -labelMcl = [cms.InputTag("ticlMultiClustersFromTracksters"+iteration) for iteration in ticlIterLabelsMerge] -labelMcl.extend(["ticlMultiClustersFromSimTracksters"]) +labelTst = [cms.InputTag("ticlTracksters"+iteration) for iteration in ticlIterLabelsMerge] +labelTst.extend(["ticlSimTracksters"]) lcInputMask = [cms.InputTag("ticlTracksters"+iteration) for iteration in ticlIterLabels] lcInputMask.extend(["ticlSimTracksters"]) hgcalValidator = DQMEDAnalyzer( @@ -22,9 +22,9 @@ CaloParticleSelectionForEfficiency, ### reco input configuration ### - #2dlayerclusters, pfclusters, multiclusters + #2DLayerClusters, PFClusters, Tracksters label_lcl = layerClusterCaloParticleAssociation.label_lc, - label_mcl = cms.VInputTag(labelMcl), + label_tst = cms.VInputTag(labelTst), associator = cms.untracked.InputTag("layerClusterCaloParticleAssociationProducer"), @@ -40,8 +40,8 @@ doSimClustersPlots = cms.untracked.bool(True), #Layer Cluster related plots doLayerClustersPlots = cms.untracked.bool(True), - #Multi Cluster related plots - doMultiClustersPlots = cms.untracked.bool(True), + #Trackster related plots + doTrackstersPlots = cms.untracked.bool(True), #The cumulative material budget in front of each layer. To be more specific, it #is the material budget just in front of the active material (not including it). diff --git a/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py b/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py index 49210b4334f0f..7d9eb26d1ba71 100644 --- a/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py +++ b/Validation/HGCalValidation/python/HGVHistoProducerAlgoBlock_cfi.py @@ -78,10 +78,10 @@ maxSharedEneFrac = cms.double(1.), nintSharedEneFrac = cms.int32(100), - #Same as above for multiclusters - minMCLSharedEneFrac = cms.double(0.), - maxMCLSharedEneFrac = cms.double(1.0), - nintMCLSharedEneFrac = cms.int32(100), + #Same as above for tracksters + minTSTSharedEneFrac = cms.double(0.), + maxTSTSharedEneFrac = cms.double(1.0), + nintTSTSharedEneFrac = cms.int32(100), #Parameters for the total number of simclusters per thickness minTotNsimClsperthick = cms.double(0.), @@ -133,31 +133,31 @@ maxCellsEneDensperthick = cms.double(100.), nintCellsEneDensperthick = cms.int32(200), - #Parameters for the total number of multiclusters per event + #Parameters for the total number of tracksters per event #We always treet one event as two events, one in +z one in -z - minTotNMCLs = cms.double(0.), - maxTotNMCLs = cms.double(50.), - nintTotNMCLs = cms.int32(50), + minTotNTSTs = cms.double(0.), + maxTotNTSTs = cms.double(50.), + nintTotNTSTs = cms.int32(50), - #Parameters for the total number of layer clusters in multicluster - minTotNClsinMCLs = cms.double(0.), - maxTotNClsinMCLs = cms.double(400.), - nintTotNClsinMCLs = cms.int32(100), + #Parameters for the total number of layer clusters in trackster + minTotNClsinTSTs = cms.double(0.), + maxTotNClsinTSTs = cms.double(400.), + nintTotNClsinTSTs = cms.int32(100), - #Parameters for the total number of layer clusters in multicluster per layer - minTotNClsinMCLsperlayer = cms.double(0.), - maxTotNClsinMCLsperlayer = cms.double(50.), - nintTotNClsinMCLsperlayer = cms.int32(50), + #Parameters for the total number of layer clusters in trackster per layer + minTotNClsinTSTsperlayer = cms.double(0.), + maxTotNClsinTSTsperlayer = cms.double(50.), + nintTotNClsinTSTsperlayer = cms.int32(50), - #Parameters for the multiplicity of layer clusters in multicluster + #Parameters for the multiplicity of layer clusters in trackster minMplofLCs = cms.double(0.), maxMplofLCs = cms.double(20.), nintMplofLCs = cms.int32(20), #Parameters for cluster size - minSizeCLsinMCLs = cms.double(0.), - maxSizeCLsinMCLs = cms.double(50.), - nintSizeCLsinMCLs = cms.int32(50), + minSizeCLsinTSTs = cms.double(0.), + maxSizeCLsinTSTs = cms.double(50.), + nintSizeCLsinTSTs = cms.int32(50), #Parameters for the energy of a cluster per multiplicity minClEnepermultiplicity = cms.double(0.), diff --git a/Validation/HGCalValidation/python/hgcalPlots.py b/Validation/HGCalValidation/python/hgcalPlots.py index 009f55a6c05a3..ad87d8ffec734 100644 --- a/Validation/HGCalValidation/python/hgcalPlots.py +++ b/Validation/HGCalValidation/python/hgcalPlots.py @@ -1301,7 +1301,7 @@ _merges_zplus = PlotGroup("MergeRate_vs_layer", _mergeplots_zplus, ncols=1) #-------------------------------------------------------------------------------------------- -# SIMCLUSTERS +# SimClusters #-------------------------------------------------------------------------------------------- _common_sc_score = {"title": "Score SimCluster to LayerClusters in z-", @@ -1559,7 +1559,7 @@ #-------------------------------------------------------------------------------------------- # MULTICLUSTERS #-------------------------------------------------------------------------------------------- -_common_score = {#"title": "Score CaloParticle to MultiClusters", +_common_score = {#"title": "Score CaloParticle to Tracksters", "stat": False, "ymin": 0.1, "ymax": 100000, @@ -1570,11 +1570,11 @@ "ylog": True } _common_score.update(_legend_common) -_score_caloparticle_to_multiclusters = PlotGroup("ScoreCaloParticlesToMultiClusters", [ - Plot("Score_caloparticle2multicl", **_common_score) +_score_caloparticle_to_tracksters = PlotGroup("ScoreCaloParticlesToTracksters", [ + Plot("Score_caloparticle2trackster", **_common_score) ], ncols=1) -_common_score = {#"title": "Score MultiCluster to CaloParticles", +_common_score = {#"title": "Score Trackster to CaloParticles", "stat": False, "ymin": 0.1, "ymax": 100000, @@ -1585,37 +1585,37 @@ "ylog": True } _common_score.update(_legend_common) -_score_multicluster_to_caloparticles = PlotGroup("ScoreMultiClustersToCaloParticles", [ - Plot("Score_multicl2caloparticle", **_common_score) +_score_trackster_to_caloparticles = PlotGroup("ScoreTrackstersToCaloParticles", [ + Plot("Score_trackster2caloparticle", **_common_score) ], ncols=1) -_common_shared= {"title": "Shared Energy CaloParticle To Multi Cluster ", +_common_shared= {"title": "Shared Energy CaloParticle To Trackster ", "stat": False, "legend": True, "xmin": 0, "xmax": 1.0, } _common_shared.update(_legend_common) -_shared_plots = [ Plot("SharedEnergy_caloparticle2multicl", **_common_shared) ] +_shared_plots = [ Plot("SharedEnergy_caloparticle2trackster", **_common_shared) ] _common_shared["xmin"] = -4.0 _common_shared["xmax"] = 4.0 -_shared_plots.extend([Plot("SharedEnergy_caloparticle2multicl_vs_eta", xtitle="CaloParticle #eta", **_common_shared)]) -_shared_plots.extend([Plot("SharedEnergy_caloparticle2multicl_vs_phi", xtitle="CaloParticle #phi", **_common_shared)]) -_sharedEnergy_caloparticle_to_multicluster = PlotGroup("SharedEnergy_CaloParticleToMultiCluster", _shared_plots, ncols=3) +_shared_plots.extend([Plot("SharedEnergy_caloparticle2trackster_vs_eta", xtitle="CaloParticle #eta", **_common_shared)]) +_shared_plots.extend([Plot("SharedEnergy_caloparticle2trackster_vs_phi", xtitle="CaloParticle #phi", **_common_shared)]) +_sharedEnergy_caloparticle_to_trackster = PlotGroup("SharedEnergy_CaloParticleToTrackster", _shared_plots, ncols=3) -_common_shared= {"title": "Shared Energy Multi Cluster To CaloParticle ", +_common_shared= {"title": "Shared Energy Trackster To CaloParticle ", "stat": False, "legend": True, "xmin": 0, "xmax": 1.0, } _common_shared.update(_legend_common) -_shared_plots2 = [Plot("SharedEnergy_multicluster2caloparticle", **_common_shared)] +_shared_plots2 = [Plot("SharedEnergy_trackster2caloparticle", **_common_shared)] _common_shared["xmin"] = -4.0 _common_shared["xmax"] = 4.0 -_shared_plots2.extend([Plot("SharedEnergy_multicl2caloparticle_vs_eta", xtitle="MultiCluster #eta", **_common_shared)]) -_shared_plots2.extend([Plot("SharedEnergy_multicl2caloparticle_vs_phi", xtitle="MultiCluster #phi", **_common_shared)]) -_sharedEnergy_multicluster_to_caloparticle = PlotGroup("SharedEnergy_MultiClusterToCaloParticle", _shared_plots2, ncols=3) +_shared_plots2.extend([Plot("SharedEnergy_trackster2caloparticle_vs_eta", xtitle="Trackster #eta", **_common_shared)]) +_shared_plots2.extend([Plot("SharedEnergy_trackster2caloparticle_vs_phi", xtitle="Trackster #phi", **_common_shared)]) +_sharedEnergy_trackster_to_caloparticle = PlotGroup("SharedEnergy_TracksterToCaloParticle", _shared_plots2, ncols=3) _common_assoc = {#"title": "Cell Association Table", @@ -1660,96 +1660,96 @@ _common_energy_score = dict(removeEmptyBins=True, xbinlabelsize=10, xbinlabeloption="d") _common_energy_score["ymax"] = 1. _common_energy_score["xmax"] = 1.0 -_energyscore_cp2mcl = PlotOnSideGroup("Energy_vs_Score_CaloParticlesToMultiClusters", Plot("Energy_vs_Score_caloparticle2multi", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) +_energyscore_cp2mcl = PlotOnSideGroup("Energy_vs_Score_CaloParticlesToTracksters", Plot("Energy_vs_Score_caloparticle2trackster", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) _common_energy_score["ymax"] = 1. _common_energy_score["xmax"] = 1.0 -_energyscore_mcl2cp = PlotOnSideGroup("Energy_vs_Score_MultiClustersToCaloParticles", Plot("Energy_vs_Score_multi2caloparticle", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) +_energyscore_mcl2cp = PlotOnSideGroup("Energy_vs_Score_TrackstersToCaloParticles", Plot("Energy_vs_Score_trackster2caloparticle", drawStyle="COLZ", adjustMarginRight=0.1, **_common_energy_score), ncols=1) #Coming back to the usual box definition _common = {"stat": True, "drawStyle": "hist", "staty": 0.65 } -_totmulticlusternum = PlotGroup("TotalNumberofMultiClusters", [ - Plot("totmulticlusternum", xtitle="", **_common) +_tottracksternum = PlotGroup("TotalNumberofTracksters", [ + Plot("tottracksternum", xtitle="", **_common) ],ncols=1) -_multicluster_layernum_plots = [Plot("multicluster_firstlayer", xtitle="MultiCluster First Layer", **_common)] -_multicluster_layernum_plots.extend([Plot("multicluster_lastlayer", xtitle="MultiCluster Last Layer", **_common)]) -_multicluster_layernum_plots.extend([Plot("multicluster_layersnum", xtitle="MultiCluster Number of Layers", **_common)]) -_multicluster_layernum = PlotGroup("LayerNumbersOfMultiCluster", _multicluster_layernum_plots, ncols=3) +_trackster_layernum_plots = [Plot("trackster_firstlayer", xtitle="Trackster First Layer", **_common)] +_trackster_layernum_plots.extend([Plot("trackster_lastlayer", xtitle="Trackster Last Layer", **_common)]) +_trackster_layernum_plots.extend([Plot("trackster_layersnum", xtitle="Trackster Number of Layers", **_common)]) +_trackster_layernum = PlotGroup("LayerNumbersOfTrackster", _trackster_layernum_plots, ncols=3) _common["xmax"] = 50 -_clusternum_in_multicluster = PlotGroup("NumberofLayerClustersinMultiCluster",[ - Plot("clusternum_in_multicluster", xtitle="", **_common) +_clusternum_in_trackster = PlotGroup("NumberofLayerClustersinTrackster",[ + Plot("clusternum_in_trackster", xtitle="", **_common) ],ncols=1) _common = {"stat": True, "drawStyle": "hist", "staty": 0.65} _common = {"stat": True, "drawStyle": "pcolz", "staty": 0.65} -_clusternum_in_multicluster_vs_layer = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer",[ - Plot("clusternum_in_multicluster_vs_layer", xtitle="Layer number", ytitle = "<2d Layer Clusters in Multicluster>", **_common) +_clusternum_in_trackster_vs_layer = PlotGroup("NumberofLayerClustersinTracksterPerLayer",[ + Plot("clusternum_in_trackster_vs_layer", xtitle="Layer number", ytitle = "<2d Layer Clusters in Trackster>", **_common) ],ncols=1) _common["scale"] = 100. #, ztitle = "% of clusters" normalizeToUnitArea=True -_multiplicity_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlMultiClustersFromTrackstersEM/multiplicity_numberOfEventsHistogram" -_multiplicity_zminus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlMultiClustersFromTrackstersEM/multiplicity_zminus_numberOfEventsHistogram" -_multiplicity_zplus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlMultiClustersFromTrackstersEM/multiplicity_zplus_numberOfEventsHistogram" +_multiplicity_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlTrackstersMerge/multiplicity_numberOfEventsHistogram" +_multiplicity_zminus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlTrackstersMerge/multiplicity_zminus_numberOfEventsHistogram" +_multiplicity_zplus_numberOfEventsHistogram = "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/ticlTrackstersMerge/multiplicity_zplus_numberOfEventsHistogram" -_multiplicityOfLCinMCL_plots = [Plot("multiplicityOfLCinMCL", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Cluster size (n_{hit})", +_multiplicityOfLCinTST_plots = [Plot("multiplicityOfLCinTST", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Cluster size (n_{hit})", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)] -_multiplicityOfLCinMCL_plots.extend([Plot("multiplicityOfLCinMCL_vs_layerclusterenergy", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Cluster Energy (GeV)", +_multiplicityOfLCinTST_plots.extend([Plot("multiplicityOfLCinTST_vs_layerclusterenergy", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Cluster Energy (GeV)", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)]) -_multiplicityOfLCinMCL_plots.extend([Plot("multiplicityOfLCinMCL_vs_layercluster_zplus", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Layer Number", +_multiplicityOfLCinTST_plots.extend([Plot("multiplicityOfLCinTST_vs_layercluster_zplus", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Layer Number", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)]) -_multiplicityOfLCinMCL_plots.extend([Plot("multiplicityOfLCinMCL_vs_layercluster_zminus", xtitle="Layer Cluster multiplicity in Multiclusters", ytitle = "Layer Number", +_multiplicityOfLCinTST_plots.extend([Plot("multiplicityOfLCinTST_vs_layercluster_zminus", xtitle="Layer Cluster multiplicity in Tracksters", ytitle = "Layer Number", drawCommand = "colz text45", normalizeToNumberOfEvents = True, **_common)]) -_multiplicityOfLCinMCL = PlotGroup("MultiplcityofLCinMLC", _multiplicityOfLCinMCL_plots, ncols=2) +_multiplicityOfLCinTST = PlotGroup("MultiplcityofLCinTST", _multiplicityOfLCinTST_plots, ncols=2) _common = {"stat": True, "drawStyle": "hist", "staty": 0.65} #-------------------------------------------------------------------------------------------- # z- #-------------------------------------------------------------------------------------------- -_clusternum_in_multicluster_perlayer_zminus_EE = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zminus_EE", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm) +_clusternum_in_trackster_perlayer_zminus_EE = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zminus_EE", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm) ], ncols=7) -_clusternum_in_multicluster_perlayer_zminus_FH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zminus_FH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm,lastLayerFHzm) +_clusternum_in_trackster_perlayer_zminus_FH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zminus_FH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzm,lastLayerFHzm) ], ncols=7) -_clusternum_in_multicluster_perlayer_zminus_BH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zminus_BH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzm,maxlayerzm) +_clusternum_in_trackster_perlayer_zminus_BH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zminus_BH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzm,maxlayerzm) ], ncols=7) #-------------------------------------------------------------------------------------------- # z+ #-------------------------------------------------------------------------------------------- -_clusternum_in_multicluster_perlayer_zplus_EE = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zplus_EE", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(maxlayerzm,lastLayerEEzp) +_clusternum_in_trackster_perlayer_zplus_EE = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zplus_EE", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(maxlayerzm,lastLayerEEzp) ], ncols=7) -_clusternum_in_multicluster_perlayer_zplus_FH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zplus_FH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzp,lastLayerFHzp) +_clusternum_in_trackster_perlayer_zplus_FH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zplus_FH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerEEzp,lastLayerFHzp) ], ncols=7) -_clusternum_in_multicluster_perlayer_zplus_BH = PlotGroup("NumberofLayerClustersinMultiClusterPerLayer_zplus_BH", [ - Plot("clusternum_in_multicluster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzp,maxlayerzp) +_clusternum_in_trackster_perlayer_zplus_BH = PlotGroup("NumberofLayerClustersinTracksterPerLayer_zplus_BH", [ + Plot("clusternum_in_trackster_perlayer{:02d}".format(i), xtitle="", **_common) for i in range(lastLayerFHzp,maxlayerzp) ], ncols=7) #Coming back to the usual box definition _common = {"stat": True, "drawStyle": "hist", "staty": 0.65 } -#Some multiclusters quantities -_multicluster_eppe_plots = [Plot("multicluster_eta", xtitle="MultiCluster #eta", **_common)] -_multicluster_eppe_plots.extend([Plot("multicluster_phi", xtitle="MultiCluster #phi", **_common)]) -_multicluster_eppe_plots.extend([Plot("multicluster_pt", xtitle="MultiCluster p_{T}", **_common)]) -_multicluster_eppe_plots.extend([Plot("multicluster_energy", xtitle="MultiCluster Energy", **_common)]) -_multicluster_eppe = PlotGroup("EtaPhiPtEnergy", _multicluster_eppe_plots, ncols=2) +#Some tracksters quantities +_trackster_eppe_plots = [Plot("trackster_eta", xtitle="Trackster #eta", **_common)] +_trackster_eppe_plots.extend([Plot("trackster_phi", xtitle="Trackster #phi", **_common)]) +_trackster_eppe_plots.extend([Plot("trackster_pt", xtitle="Trackster p_{T}", **_common)]) +_trackster_eppe_plots.extend([Plot("trackster_energy", xtitle="Trackster Energy", **_common)]) +_trackster_eppe = PlotGroup("EtaPhiPtEnergy", _trackster_eppe_plots, ncols=2) -_multicluster_xyz_plots = [Plot("multicluster_x", xtitle="MultiCluster x", **_common)] -_multicluster_xyz_plots.extend([Plot("multicluster_y", xtitle="MultiCluster y", **_common)]) -_multicluster_xyz_plots.extend([Plot("multicluster_z", xtitle="MultiCluster z", **_common)]) -_multicluster_xyz = PlotGroup("XYZ", _multicluster_xyz_plots, ncols=3) +_trackster_xyz_plots = [Plot("trackster_x", xtitle="Trackster x", **_common)] +_trackster_xyz_plots.extend([Plot("trackster_y", xtitle="Trackster y", **_common)]) +_trackster_xyz_plots.extend([Plot("trackster_z", xtitle="Trackster z", **_common)]) +_trackster_xyz = PlotGroup("XYZ", _trackster_xyz_plots, ncols=3) #-------------------------------------------------------------------------------------------- # SIMHITS, DIGIS, RECHITS @@ -1945,21 +1945,21 @@ Plot("h_EoP_CPene_scint_calib_fraction", title="EoP_CPene_scint_calib_fraction", **_common), ]) -_ParticleFlowClusterHGCalFromMultiCl_Closest_EoverCPenergy = PlotGroup("ParticleFlowClusterHGCalFromMultiCl", [ +_ParticleFlowClusterHGCalFromTrackster_Closest_EoverCPenergy = PlotGroup("ParticleFlowClusterHGCalFromTrackster", [ Plot("hgcal_EoP_CPene_100_calib_fraction", title="hgcal_EoP_CPene_100_calib_fraction", **_common), Plot("hgcal_EoP_CPene_200_calib_fraction", title="hgcal_EoP_CPene_200_calib_fraction", **_common), Plot("hgcal_EoP_CPene_300_calib_fraction", title="hgcal_EoP_CPene_300_calib_fraction", **_common), Plot("hgcal_EoP_CPene_scint_calib_fraction", title="hgcal_EoP_CPene_scint_calib_fraction", **_common), ]) -_EcalDrivenGsfElectronsFromMultiCl_Closest_EoverCPenergy = PlotGroup("EcalDrivenGsfElectronsFromMultiCl", [ +_EcalDrivenGsfElectronsFromTrackster_Closest_EoverCPenergy = PlotGroup("EcalDrivenGsfElectronsFromTrackster", [ Plot("hgcal_ele_EoP_CPene_100_calib_fraction", title="hgcal_ele_EoP_CPene_100_calib_fraction", **_common), Plot("hgcal_ele_EoP_CPene_200_calib_fraction", title="hgcal_ele_EoP_CPene_200_calib_fraction", **_common), Plot("hgcal_ele_EoP_CPene_300_calib_fraction", title="hgcal_ele_EoP_CPene_300_calib_fraction", **_common), Plot("hgcal_ele_EoP_CPene_scint_calib_fraction", title="hgcal_ele_EoP_CPene_scint_calib_fraction", **_common), ]) -_PhotonsFromMultiCl_Closest_EoverCPenergy = PlotGroup("PhotonsFromMultiCl", [ +_PhotonsFromTrackster_Closest_EoverCPenergy = PlotGroup("PhotonsFromTrackster", [ Plot("hgcal_photon_EoP_CPene_100_calib_fraction", title="hgcal_photon_EoP_CPene_100_calib_fraction", **_common), Plot("hgcal_photon_EoP_CPene_200_calib_fraction", title="hgcal_photon_EoP_CPene_200_calib_fraction", **_common), Plot("hgcal_photon_EoP_CPene_300_calib_fraction", title="hgcal_photon_EoP_CPene_300_calib_fraction", **_common), @@ -2425,58 +2425,58 @@ def append_hgcalSimClustersPlots(collection, name_collection): def _hgcalFolders(lastDirName="hgcalLayerClusters"): return "DQMData/Run 1/HGCAL/Run summary/HGCalValidator/"+lastDirName -_multiclustersAllPlots = [ +_trackstersAllPlots = [ _efficiencies, _duplicates, _fakes, _merges, - _multicluster_eppe, - _multicluster_xyz, - _totmulticlusternum, - _score_caloparticle_to_multiclusters, - _score_multicluster_to_caloparticles, - _sharedEnergy_caloparticle_to_multicluster, - _sharedEnergy_multicluster_to_caloparticle, + _trackster_eppe, + _trackster_xyz, + _tottracksternum, + _score_caloparticle_to_tracksters, + _score_trackster_to_caloparticles, + _sharedEnergy_caloparticle_to_trackster, + _sharedEnergy_trackster_to_caloparticle, #_energyscore_cp2mcl_mcl2cp, _energyscore_cp2mcl, _energyscore_mcl2cp, - _clusternum_in_multicluster, - _clusternum_in_multicluster_vs_layer, - _clusternum_in_multicluster_perlayer_zminus_EE, - _clusternum_in_multicluster_perlayer_zminus_FH, - _clusternum_in_multicluster_perlayer_zminus_BH, - _clusternum_in_multicluster_perlayer_zplus_EE, - _clusternum_in_multicluster_perlayer_zplus_FH, - _clusternum_in_multicluster_perlayer_zplus_BH, - _multicluster_layernum, - _multiplicityOfLCinMCL, + _clusternum_in_trackster, + _clusternum_in_trackster_vs_layer, + _clusternum_in_trackster_perlayer_zminus_EE, + _clusternum_in_trackster_perlayer_zminus_FH, + _clusternum_in_trackster_perlayer_zminus_BH, + _clusternum_in_trackster_perlayer_zplus_EE, + _clusternum_in_trackster_perlayer_zplus_FH, + _clusternum_in_trackster_perlayer_zplus_BH, + _trackster_layernum, + _multiplicityOfLCinTST, ] -hgcalMultiClustersPlotter = Plotter() -def append_hgcalMultiClustersPlots(collection = 'ticlMultiClustersFromTrackstersMerge', name_collection = "MultiClustersMerge"): +hgcalTrackstersPlotter = Plotter() +def append_hgcalTrackstersPlots(collection = 'ticlTrackstersMerge', name_collection = "TrackstersMerge"): # Appending all plots for MCs - hgcalMultiClustersPlotter.append(collection, [ + hgcalTrackstersPlotter.append(collection, [ _hgcalFolders(collection) ], PlotFolder( - *_multiclustersAllPlots, + *_trackstersAllPlots, loopSubFolders=False, - purpose=PlotPurpose.Timing, page="MultiClusters", section=name_collection)) + purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection)) #We append here two PlotFolder because we want the text to be in percent #and the number of events are different in zplus and zminus - #hgcalMultiClustersPlotter.append("Multiplicity", [ + #hgcalTrackstersPlotter.append("Multiplicity", [ # dqmfolder # ], PlotFolder( - # _multiplicityOfLCinMCL_vs_layercluster_zminus, + # _multiplicityOfLCinTST_vs_layercluster_zminus, # loopSubFolders=False, # purpose=PlotPurpose.Timing, page=collection, # numberOfEventsHistogram=_multiplicity_zminus_numberOfEventsHistogram # )) # - #hgcalMultiClustersPlotter.append("Multiplicity", [ + #hgcalTrackstersPlotter.append("Multiplicity", [ # dqmfolder # ], PlotFolder( - # _multiplicityOfLCinMCL_vs_layercluster_zplus, + # _multiplicityOfLCinTST_vs_layercluster_zplus, # loopSubFolders=False, # purpose=PlotPurpose.Timing, page=collection, # numberOfEventsHistogram=_multiplicity_zplus_numberOfEventsHistogram @@ -2537,7 +2537,7 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = return hgcalCaloParticlesPlotter #================================================================================================= -def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', name_collection = "MultiClustersMerge"): +def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', name_collection = "TrackstersMerge"): grouped = {"cosAngle Beta": PlotGroup("cosAngle_Beta_per_layer",[],ncols=10), "cosAngle Beta Weighted": PlotGroup("cosAngle_Beta_Weighted_per_layer",[],ncols=10)} groupingFlag = " on Layer " @@ -2588,7 +2588,7 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam hgcalTrackstersPlotter.append(name_collection+"_TICLDebugger", [dqmfolder], PlotFolder(pg, loopSubFolders=False, - purpose=PlotPurpose.Timing, page="MultiClusters", section=name_collection) + purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection) #numberOfEventsHistogram=_multiplicity_tracksters_numberOfEventsHistogram) ) @@ -2598,7 +2598,7 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam hgcalTrackstersPlotter.append(name_collection+"_TICLDebugger", [dqmfolder], PlotFolder(grouped[group], loopSubFolders=False, - purpose=PlotPurpose.Timing, page="MultiClusters", section=name_collection) + purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection) #numberOfEventsHistogram=_multiplicity_tracksters_numberOfEventsHistogram) ) @@ -2772,26 +2772,26 @@ def append_hgcalDigisPlots(collection = "HGCalDigisV", name_collection = "Digis" purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) -hgcalHitCalibPlotter.append("ParticleFlowClusterHGCalFromMultiCl_Closest_EoverCPenergy", [ +hgcalHitCalibPlotter.append("ParticleFlowClusterHGCalFromTrackster_Closest_EoverCPenergy", [ "DQMData/Run 1/HGCalHitCalibration/Run summary", ], PlotFolder( - _ParticleFlowClusterHGCalFromMultiCl_Closest_EoverCPenergy, + _ParticleFlowClusterHGCalFromTrackster_Closest_EoverCPenergy, loopSubFolders=False, purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) -hgcalHitCalibPlotter.append("PhotonsFromMultiCl_Closest_EoverCPenergy", [ +hgcalHitCalibPlotter.append("PhotonsFromTrackster_Closest_EoverCPenergy", [ "DQMData/Run 1/HGCalHitCalibration/Run summary", ], PlotFolder( - _PhotonsFromMultiCl_Closest_EoverCPenergy, + _PhotonsFromTrackster_Closest_EoverCPenergy, loopSubFolders=False, purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) -hgcalHitCalibPlotter.append("EcalDrivenGsfElectronsFromMultiCl_Closest_EoverCPenergy", [ +hgcalHitCalibPlotter.append("EcalDrivenGsfElectronsFromTrackster_Closest_EoverCPenergy", [ "DQMData/Run 1/HGCalHitCalibration/Run summary", ], PlotFolder( - _EcalDrivenGsfElectronsFromMultiCl_Closest_EoverCPenergy, + _EcalDrivenGsfElectronsFromTrackster_Closest_EoverCPenergy, loopSubFolders=False, purpose=PlotPurpose.Timing, page=hitCalibrationLabel, section=hitCalibrationLabel )) diff --git a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py index a0b4e6f3ae62f..098cfc39a293f 100755 --- a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py +++ b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py @@ -5,28 +5,29 @@ import argparse from time import time +from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabels, ticlIterLabelsMerge + from Validation.RecoTrack.plotting.validation import SeparateValidation, SimpleValidation, SimpleSample import Validation.HGCalValidation.hgcalPlots as hgcalPlots import Validation.RecoTrack.plotting.plotting as plotting -simClustersIters = ["ClusterLevel","ticlTrackstersTrkEM","ticlTrackstersEM","ticlTrackstersTrk","ticlTrackstersHAD","ticlSimTracksters"] +simClustersIters = ["ClusterLevel","ticlSimTracksters"] +simClustersIters.extend('ticlTracksters'+iteration for iteration in ticlIterLabels) -trackstersIters = ["ticlMultiClustersFromTrackstersMerge", "ticlMultiClustersFromTrackstersMIP", - "ticlMultiClustersFromTrackstersTrk","ticlMultiClustersFromTrackstersTrkEM", - "ticlMultiClustersFromTrackstersEM", "ticlMultiClustersFromTrackstersHAD", - "ticlMultiClustersFromSimTracksters"] +trackstersIters = ['ticlTracksters'+iteration for iteration in ticlIterLabelsMerge] +trackstersIters.extend(["ticlSimTracksters"]) simClustersGeneralLabel = 'simClusters' layerClustersGeneralLabel = 'hgcalLayerClusters' -multiclustersGeneralLabel = 'hgcalMultiClusters' -trackstersGeneralLabel = 'allTiclMultiClusters' +trackstersGeneralLabel = 'hgcalTracksters' +allTrackstersLabel = 'allTiclTracksters' hitValidationLabel = 'hitValidation' hitCalibrationLabel = 'hitCalibration' caloParticlesLabel = 'caloParticles' allLabel = 'all' collection_choices = [layerClustersGeneralLabel] -collection_choices.extend([simClustersGeneralLabel]+[multiclustersGeneralLabel]+[trackstersGeneralLabel]+[hitValidationLabel]+[hitCalibrationLabel]+[allLabel]+[caloParticlesLabel]) +collection_choices.extend([simClustersGeneralLabel]+[trackstersGeneralLabel]+[allTrackstersLabel]+[hitValidationLabel]+[hitCalibrationLabel]+[allLabel]+[caloParticlesLabel]) def main(opts): @@ -62,21 +63,19 @@ def main(opts): for i_iter in simClustersIters: hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter) val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs) - #multiClusters - elif (opts.collection == multiclustersGeneralLabel): - hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter] - hgcalPlots.append_hgcalMultiClustersPlots(multiclustersGeneralLabel, "MultiClusters") - val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs) - #ticlTracksters + #tracksters elif (opts.collection == trackstersGeneralLabel): - hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter] - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") - hgcalPlots.append_hgcalMultiClustersPlots(i_iter, tracksterCollection) - val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs) + hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] + hgcalPlots.append_hgcalTrackstersPlots(trackstersGeneralLabel, "Tracksters") + val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) + #ticlTracksters + elif (opts.collection == allTrackstersLabel): + hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] + for tracksterCollection in trackstersIters : + hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) + val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) # TICLTrackstersEdges plots - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") + for tracksterCollection in trackstersIters : hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) elif (opts.collection == caloParticlesLabel): @@ -134,15 +133,13 @@ def main(opts): hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters", extendedFlag) val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) - #multiclusters - hgcmulticlus = [hgcalPlots.hgcalMultiClustersPlotter] - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") - hgcalPlots.append_hgcalMultiClustersPlots(i_iter, tracksterCollection) - val.doPlots(hgcmulticlus, plotterDrawArgs=drawArgs) + #tracksters + hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] + for tracksterCollection in trackstersIters : + hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) + val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) #TICLTrackstersEdges plots - for i_iter in trackstersIters : - tracksterCollection = i_iter.replace("ticlMultiClustersFromTracksters","ticlTracksters") + for tracksterCollection in trackstersIters : hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index c2df41d0ba579..8efaa56665c4f 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -16,8 +16,8 @@ const double ScoreCutLCtoCP_ = 0.1; const double ScoreCutCPtoLC_ = 0.1; const double ScoreCutLCtoSC_ = 0.1; const double ScoreCutSCtoLC_ = 0.1; -const double ScoreCutMCLtoCPFakeMerge_ = 0.6; -const double ScoreCutCPtoMCLEffDup_ = 0.2; +const double ScoreCutTSTtoCPFakeMerge_ = 0.6; +const double ScoreCutCPtoTSTEffDup_ = 0.2; HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) : //parameters for eta @@ -97,10 +97,10 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxSharedEneFrac_(pset.getParameter("maxSharedEneFrac")), nintSharedEneFrac_(pset.getParameter("nintSharedEneFrac")), - //Same as above for multiclusters - minMCLSharedEneFrac_(pset.getParameter("minMCLSharedEneFrac")), - maxMCLSharedEneFrac_(pset.getParameter("maxMCLSharedEneFrac")), - nintMCLSharedEneFrac_(pset.getParameter("nintMCLSharedEneFrac")), + //Same as above for Tracksters + minTSTSharedEneFrac_(pset.getParameter("minTSTSharedEneFrac")), + maxTSTSharedEneFrac_(pset.getParameter("maxTSTSharedEneFrac")), + nintTSTSharedEneFrac_(pset.getParameter("nintTSTSharedEneFrac")), //Parameters for the total number of SimClusters per thickness minTotNsimClsperthick_(pset.getParameter("minTotNsimClsperthick")), @@ -152,31 +152,31 @@ HGVHistoProducerAlgo::HGVHistoProducerAlgo(const edm::ParameterSet& pset) maxCellsEneDensperthick_(pset.getParameter("maxCellsEneDensperthick")), nintCellsEneDensperthick_(pset.getParameter("nintCellsEneDensperthick")), - //Parameters for the total number of multiclusters per event + //Parameters for the total number of Tracksters per event //We always treet one event as two events, one in +z one in -z - minTotNMCLs_(pset.getParameter("minTotNMCLs")), - maxTotNMCLs_(pset.getParameter("maxTotNMCLs")), - nintTotNMCLs_(pset.getParameter("nintTotNMCLs")), + minTotNTSTs_(pset.getParameter("minTotNTSTs")), + maxTotNTSTs_(pset.getParameter("maxTotNTSTs")), + nintTotNTSTs_(pset.getParameter("nintTotNTSTs")), - //Parameters for the total number of layer clusters in multicluster - minTotNClsinMCLs_(pset.getParameter("minTotNClsinMCLs")), - maxTotNClsinMCLs_(pset.getParameter("maxTotNClsinMCLs")), - nintTotNClsinMCLs_(pset.getParameter("nintTotNClsinMCLs")), + //Parameters for the total number of layer clusters in Trackster + minTotNClsinTSTs_(pset.getParameter("minTotNClsinTSTs")), + maxTotNClsinTSTs_(pset.getParameter("maxTotNClsinTSTs")), + nintTotNClsinTSTs_(pset.getParameter("nintTotNClsinTSTs")), - //Parameters for the total number of layer clusters in multicluster per layer - minTotNClsinMCLsperlayer_(pset.getParameter("minTotNClsinMCLsperlayer")), - maxTotNClsinMCLsperlayer_(pset.getParameter("maxTotNClsinMCLsperlayer")), - nintTotNClsinMCLsperlayer_(pset.getParameter("nintTotNClsinMCLsperlayer")), + //Parameters for the total number of layer clusters in Trackster per layer + minTotNClsinTSTsperlayer_(pset.getParameter("minTotNClsinTSTsperlayer")), + maxTotNClsinTSTsperlayer_(pset.getParameter("maxTotNClsinTSTsperlayer")), + nintTotNClsinTSTsperlayer_(pset.getParameter("nintTotNClsinTSTsperlayer")), - //Parameters for the multiplicity of layer clusters in multicluster + //Parameters for the multiplicity of layer clusters in Trackster minMplofLCs_(pset.getParameter("minMplofLCs")), maxMplofLCs_(pset.getParameter("maxMplofLCs")), nintMplofLCs_(pset.getParameter("nintMplofLCs")), //Parameters for cluster size - minSizeCLsinMCLs_(pset.getParameter("minSizeCLsinMCLs")), - maxSizeCLsinMCLs_(pset.getParameter("maxSizeCLsinMCLs")), - nintSizeCLsinMCLs_(pset.getParameter("nintSizeCLsinMCLs")), + minSizeCLsinTSTs_(pset.getParameter("minSizeCLsinTSTs")), + maxSizeCLsinTSTs_(pset.getParameter("maxSizeCLsinTSTs")), + nintSizeCLsinTSTs_(pset.getParameter("nintSizeCLsinTSTs")), //Parameters for the energy of a cluster per thickness per layer minClEnepermultiplicity_(pset.getParameter("minClEnepermultiplicity")), @@ -963,110 +963,110 @@ void HGVHistoProducerAlgo::bookClusterHistos_CellLevel(DQMStore::IBooker& ibook, } //---------------------------------------------------------------------------------------------------------------------------- -void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, +void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers) { - histograms.h_score_multicl2caloparticle.push_back(ibook.book1D( - "Score_multicl2caloparticle", "Score of Multi Cluster per CaloParticle", nintScore_, minScore_, maxScore_)); - histograms.h_score_caloparticle2multicl.push_back(ibook.book1D( - "Score_caloparticle2multicl", "Score of CaloParticle per Multi Cluster", nintScore_, minScore_, maxScore_)); - histograms.h_energy_vs_score_multicl2caloparticle.push_back( - ibook.book2D("Energy_vs_Score_multi2caloparticle", - "Energy vs Score of Multi Cluster per CaloParticle", + histograms.h_score_trackster2caloparticle.push_back(ibook.book1D( + "Score_trackster2caloparticle", "Score of Trackster per CaloParticle", nintScore_, minScore_, maxScore_)); + histograms.h_score_caloparticle2trackster.push_back(ibook.book1D( + "Score_caloparticle2trackster", "Score of CaloParticle per Trackster", nintScore_, minScore_, maxScore_)); + histograms.h_energy_vs_score_trackster2caloparticle.push_back( + ibook.book2D("Energy_vs_Score_trackster2caloparticle", + "Energy vs Score of Trackster per CaloParticle", nintScore_, minScore_, maxScore_, nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_energy_vs_score_caloparticle2multicl.push_back( - ibook.book2D("Energy_vs_Score_caloparticle2multi", - "Energy vs Score of CaloParticle per Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_energy_vs_score_caloparticle2trackster.push_back( + ibook.book2D("Energy_vs_Score_caloparticle2trackster", + "Energy vs Score of CaloParticle per Trackster", nintScore_, minScore_, maxScore_, nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - - //back to all multiclusters - histograms.h_num_multicl_eta.push_back( - ibook.book1D("Num_MultiCluster_Eta", "Num MultiCluster Eta per Multi Cluster ", nintEta_, minEta_, maxEta_)); - histograms.h_numMerge_multicl_eta.push_back(ibook.book1D( - "NumMerge_MultiCluster_Eta", "Num Merge MultiCluster Eta per Multi Cluster ", nintEta_, minEta_, maxEta_)); - histograms.h_denom_multicl_eta.push_back( - ibook.book1D("Denom_MultiCluster_Eta", "Denom MultiCluster Eta per Multi Cluster", nintEta_, minEta_, maxEta_)); - histograms.h_num_multicl_phi.push_back( - ibook.book1D("Num_MultiCluster_Phi", "Num MultiCluster Phi per Multi Cluster ", nintPhi_, minPhi_, maxPhi_)); - histograms.h_numMerge_multicl_phi.push_back(ibook.book1D( - "NumMerge_MultiCluster_Phi", "Num Merge MultiCluster Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_denom_multicl_phi.push_back( - ibook.book1D("Denom_MultiCluster_Phi", "Denom MultiCluster Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_sharedenergy_multicl2caloparticle.push_back( - ibook.book1D("SharedEnergy_multicluster2caloparticle", - "Shared Energy of Multi Cluster per Calo Particle in each layer", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + + //back to all Tracksters + histograms.h_num_trackster_eta.push_back( + ibook.book1D("Num_Trackster_Eta", "Num Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); + histograms.h_numMerge_trackster_eta.push_back(ibook.book1D( + "NumMerge_Trackster_Eta", "Num Merge Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); + histograms.h_denom_trackster_eta.push_back( + ibook.book1D("Denom_Trackster_Eta", "Denom Trackster Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_num_trackster_phi.push_back( + ibook.book1D("Num_Trackster_Phi", "Num Trackster Phi per Trackster ", nintPhi_, minPhi_, maxPhi_)); + histograms.h_numMerge_trackster_phi.push_back(ibook.book1D( + "NumMerge_Trackster_Phi", "Num Merge Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_denom_trackster_phi.push_back( + ibook.book1D("Denom_Trackster_Phi", "Denom Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_sharedenergy_trackster2caloparticle.push_back( + ibook.book1D("SharedEnergy_trackster2caloparticle", + "Shared Energy of Trackster per Calo Particle in each layer", nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_multicl2caloparticle_vs_eta.push_back( - ibook.bookProfile("SharedEnergy_multicl2caloparticle_vs_eta", - "Shared Energy of MultiCluster vs #eta per best Calo Particle in each layer", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_trackster2caloparticle_vs_eta.push_back( + ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_eta", + "Shared Energy of Trackster vs #eta per best Calo Particle in each layer", nintEta_, minEta_, maxEta_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_multicl2caloparticle_vs_phi.push_back( - ibook.bookProfile("SharedEnergy_multicl2caloparticle_vs_phi", - "Shared Energy of MultiCluster vs #phi per best Calo Particle in each layer", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_trackster2caloparticle_vs_phi.push_back( + ibook.bookProfile("SharedEnergy_trackster2caloparticle_vs_phi", + "Shared Energy of Trackster vs #phi per best Calo Particle in each layer", nintPhi_, minPhi_, maxPhi_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl.push_back( - ibook.book1D("SharedEnergy_caloparticle2multicl", - "Shared Energy of CaloParticle per Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster.push_back( + ibook.book1D("SharedEnergy_caloparticle2trackster", + "Shared Energy of CaloParticle per Trackster", nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl_assoc.push_back( - ibook.book1D("SharedEnergy_caloparticle2multicl_assoc", - "Shared Energy of Associated CaloParticle per Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_assoc.push_back( + ibook.book1D("SharedEnergy_caloparticle2trackster_assoc", + "Shared Energy of Associated CaloParticle per Trackster", nintSharedEneFrac_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl_vs_eta.push_back( - ibook.bookProfile("SharedEnergy_caloparticle2multicl_vs_eta", - "Shared Energy of CaloParticle vs #eta per best Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_vs_eta.push_back( + ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_eta", + "Shared Energy of CaloParticle vs #eta per best Trackster", nintEta_, minEta_, maxEta_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2multicl_vs_phi.push_back( - ibook.bookProfile("SharedEnergy_caloparticle2multicl_vs_phi", - "Shared Energy of CaloParticle vs #phi per best Multi Cluster", + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster_vs_phi.push_back( + ibook.bookProfile("SharedEnergy_caloparticle2trackster_vs_phi", + "Shared Energy of CaloParticle vs #phi per best Trackster", nintPhi_, minPhi_, maxPhi_, - minMCLSharedEneFrac_, - maxMCLSharedEneFrac_)); + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); histograms.h_num_caloparticle_eta.push_back( - ibook.book1D("Num_CaloParticle_Eta", "Num CaloParticle Eta per Multi Cluster", nintEta_, minEta_, maxEta_)); - histograms.h_numDup_multicl_eta.push_back( - ibook.book1D("NumDup_MultiCluster_Eta", "Num Duplicate MultiCl vs Eta", nintEta_, minEta_, maxEta_)); + ibook.book1D("Num_CaloParticle_Eta", "Num CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_numDup_trackster_eta.push_back( + ibook.book1D("NumDup_Trackster_Eta", "Num Duplicate Trackster vs Eta", nintEta_, minEta_, maxEta_)); histograms.h_denom_caloparticle_eta.push_back( - ibook.book1D("Denom_CaloParticle_Eta", "Denom CaloParticle Eta per Multi Cluster", nintEta_, minEta_, maxEta_)); + ibook.book1D("Denom_CaloParticle_Eta", "Denom CaloParticle Eta per Trackster", nintEta_, minEta_, maxEta_)); histograms.h_num_caloparticle_phi.push_back( - ibook.book1D("Num_CaloParticle_Phi", "Num CaloParticle Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_numDup_multicl_phi.push_back( - ibook.book1D("NumDup_MultiCluster_Phi", "Num Duplicate MultiCl vs Phi", nintPhi_, minPhi_, maxPhi_)); + ibook.book1D("Num_CaloParticle_Phi", "Num CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_numDup_trackster_phi.push_back( + ibook.book1D("NumDup_Trackster_Phi", "Num Duplicate Trackster vs Phi", nintPhi_, minPhi_, maxPhi_)); histograms.h_denom_caloparticle_phi.push_back( - ibook.book1D("Denom_CaloParticle_Phi", "Denom CaloParticle Phi per Multi Cluster", nintPhi_, minPhi_, maxPhi_)); + ibook.book1D("Denom_CaloParticle_Phi", "Denom CaloParticle Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); - std::unordered_map clusternum_in_multicluster_perlayer; - clusternum_in_multicluster_perlayer.clear(); + std::unordered_map clusternum_in_trackster_perlayer; + clusternum_in_trackster_perlayer.clear(); for (unsigned ilayer = 0; ilayer < 2 * layers; ++ilayer) { auto istr1 = std::to_string(ilayer); @@ -1082,54 +1082,54 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, istr2 = std::to_string(ilayer - (layers - 1)) + " in z+"; } - clusternum_in_multicluster_perlayer[ilayer] = - ibook.book1D("clusternum_in_multicluster_perlayer" + istr1, - "Number of layer clusters in multicluster for layer " + istr2, - nintTotNClsinMCLsperlayer_, - minTotNClsinMCLsperlayer_, - maxTotNClsinMCLsperlayer_); + clusternum_in_trackster_perlayer[ilayer] = + ibook.book1D("clusternum_in_trackster_perlayer" + istr1, + "Number of layer clusters in Trackster for layer " + istr2, + nintTotNClsinTSTsperlayer_, + minTotNClsinTSTsperlayer_, + maxTotNClsinTSTsperlayer_); } - histograms.h_clusternum_in_multicluster_perlayer.push_back(std::move(clusternum_in_multicluster_perlayer)); + histograms.h_clusternum_in_trackster_perlayer.push_back(std::move(clusternum_in_trackster_perlayer)); - histograms.h_multiclusternum.push_back( - ibook.book1D("totmulticlusternum", "total number of multiclusters", nintTotNMCLs_, minTotNMCLs_, maxTotNMCLs_)); + histograms.h_tracksternum.push_back( + ibook.book1D("tottracksternum", "total number of Tracksters", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_)); - histograms.h_contmulticlusternum.push_back(ibook.book1D("contmulticlusternum", - "number of multiclusters with 3 contiguous layers", - nintTotNMCLs_, - minTotNMCLs_, - maxTotNMCLs_)); + histograms.h_conttracksternum.push_back(ibook.book1D("conttracksternum", + "number of Tracksters with 3 contiguous layers", + nintTotNTSTs_, + minTotNTSTs_, + maxTotNTSTs_)); - histograms.h_noncontmulticlusternum.push_back(ibook.book1D("noncontmulticlusternum", - "number of multiclusters without 3 contiguous layers", - nintTotNMCLs_, - minTotNMCLs_, - maxTotNMCLs_)); + histograms.h_nonconttracksternum.push_back(ibook.book1D("nonconttracksternum", + "number of Tracksters without 3 contiguous layers", + nintTotNTSTs_, + minTotNTSTs_, + maxTotNTSTs_)); - histograms.h_clusternum_in_multicluster.push_back(ibook.book1D("clusternum_in_multicluster", - "total number of layer clusters in multicluster", - nintTotNClsinMCLs_, - minTotNClsinMCLs_, - maxTotNClsinMCLs_)); + histograms.h_clusternum_in_trackster.push_back(ibook.book1D("clusternum_in_trackster", + "total number of layer clusters in Trackster", + nintTotNClsinTSTs_, + minTotNClsinTSTs_, + maxTotNClsinTSTs_)); - histograms.h_clusternum_in_multicluster_vs_layer.push_back( - ibook.bookProfile("clusternum_in_multicluster_vs_layer", - "Profile of 2d layer clusters in multicluster vs layer number", + histograms.h_clusternum_in_trackster_vs_layer.push_back( + ibook.bookProfile("clusternum_in_trackster_vs_layer", + "Profile of 2d layer clusters in Trackster vs layer number", 2 * layers, 0., 2. * layers, - minTotNClsinMCLsperlayer_, - maxTotNClsinMCLsperlayer_)); + minTotNClsinTSTsperlayer_, + maxTotNClsinTSTsperlayer_)); - histograms.h_multiplicityOfLCinMCL.push_back(ibook.book2D("multiplicityOfLCinMCL", - "Multiplicity vs Layer cluster size in Multiclusters", + histograms.h_multiplicityOfLCinTST.push_back(ibook.book2D("multiplicityOfLCinTST", + "Multiplicity vs Layer cluster size in Tracksters", nintMplofLCs_, minMplofLCs_, maxMplofLCs_, - nintSizeCLsinMCLs_, - minSizeCLsinMCLs_, - maxSizeCLsinMCLs_)); + nintSizeCLsinTSTs_, + minSizeCLsinTSTs_, + maxSizeCLsinTSTs_)); histograms.h_multiplicity_numberOfEventsHistogram.push_back(ibook.book1D("multiplicity_numberOfEventsHistogram", "multiplicity numberOfEventsHistogram", @@ -1151,8 +1151,8 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, minMplofLCs_, maxMplofLCs_)); - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zminus.push_back( - ibook.book2D("multiplicityOfLCinMCL_vs_layercluster_zminus", + histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus.push_back( + ibook.book2D("multiplicityOfLCinTST_vs_layercluster_zminus", "Multiplicity vs Layer number in z-", nintMplofLCs_, minMplofLCs_, @@ -1161,8 +1161,8 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, 0., (float)layers)); - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zplus.push_back( - ibook.book2D("multiplicityOfLCinMCL_vs_layercluster_zplus", + histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus.push_back( + ibook.book2D("multiplicityOfLCinTST_vs_layercluster_zplus", "Multiplicity vs Layer number in z+", nintMplofLCs_, minMplofLCs_, @@ -1171,8 +1171,8 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, 0., (float)layers)); - histograms.h_multiplicityOfLCinMCL_vs_layerclusterenergy.push_back( - ibook.book2D("multiplicityOfLCinMCL_vs_layerclusterenergy", + histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy.push_back( + ibook.book2D("multiplicityOfLCinTST_vs_layerclusterenergy", "Multiplicity vs Layer cluster energy", nintMplofLCs_, minMplofLCs_, @@ -1181,26 +1181,26 @@ void HGVHistoProducerAlgo::bookMultiClusterHistos(DQMStore::IBooker& ibook, minClEnepermultiplicity_, maxClEnepermultiplicity_)); - histograms.h_multicluster_pt.push_back( - ibook.book1D("multicluster_pt", "Pt of the multicluster", nintPt_, minPt_, maxPt_)); - histograms.h_multicluster_eta.push_back( - ibook.book1D("multicluster_eta", "Eta of the multicluster", nintEta_, minEta_, maxEta_)); - histograms.h_multicluster_phi.push_back( - ibook.book1D("multicluster_phi", "Phi of the multicluster", nintPhi_, minPhi_, maxPhi_)); - histograms.h_multicluster_energy.push_back( - ibook.book1D("multicluster_energy", "Energy of the multicluster", nintEne_, minEne_, maxEne_)); - histograms.h_multicluster_x.push_back( - ibook.book1D("multicluster_x", "X position of the multicluster", nintX_, minX_, maxX_)); - histograms.h_multicluster_y.push_back( - ibook.book1D("multicluster_y", "Y position of the multicluster", nintY_, minY_, maxY_)); - histograms.h_multicluster_z.push_back( - ibook.book1D("multicluster_z", "Z position of the multicluster", nintZ_, minZ_, maxZ_)); - histograms.h_multicluster_firstlayer.push_back( - ibook.book1D("multicluster_firstlayer", "First layer of the multicluster", 2 * layers, 0., (float)2 * layers)); - histograms.h_multicluster_lastlayer.push_back( - ibook.book1D("multicluster_lastlayer", "Last layer of the multicluster", 2 * layers, 0., (float)2 * layers)); - histograms.h_multicluster_layersnum.push_back(ibook.book1D( - "multicluster_layersnum", "Number of layers of the multicluster", 2 * layers, 0., (float)2 * layers)); + histograms.h_trackster_pt.push_back( + ibook.book1D("trackster_pt", "Pt of the Trackster", nintPt_, minPt_, maxPt_)); + histograms.h_trackster_eta.push_back( + ibook.book1D("trackster_eta", "Eta of the Trackster", nintEta_, minEta_, maxEta_)); + histograms.h_trackster_phi.push_back( + ibook.book1D("trackster_phi", "Phi of the Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_trackster_energy.push_back( + ibook.book1D("trackster_energy", "Energy of the Trackster", nintEne_, minEne_, maxEne_)); + histograms.h_trackster_x.push_back( + ibook.book1D("trackster_x", "X position of the Trackster", nintX_, minX_, maxX_)); + histograms.h_trackster_y.push_back( + ibook.book1D("trackster_y", "Y position of the Trackster", nintY_, minY_, maxY_)); + histograms.h_trackster_z.push_back( + ibook.book1D("trackster_z", "Z position of the Trackster", nintZ_, minZ_, maxZ_)); + histograms.h_trackster_firstlayer.push_back( + ibook.book1D("trackster_firstlayer", "First layer of the Trackster", 2 * layers, 0., (float)2 * layers)); + histograms.h_trackster_lastlayer.push_back( + ibook.book1D("trackster_lastlayer", "Last layer of the Trackster", 2 * layers, 0., (float)2 * layers)); + histograms.h_trackster_layersnum.push_back(ibook.book1D( + "trackster_layersnum", "Number of layers of the Trackster", 2 * layers, 0., (float)2 * layers)); } void HGVHistoProducerAlgo::fill_info_histos(const Histograms& histograms, unsigned int layers) const { @@ -2274,28 +2274,29 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr histograms.h_longdepthbarycentre_zminus[count]->Fill(sumldbarmi / sumeneallclusmi); } -void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& histograms, +void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histograms, int count, - const std::vector& multiClusters, + const ticl::TracksterCollection& tracksters, + const reco::CaloClusterCollection& layerClusters, std::vector const& cP, std::vector const& cPIndices, std::vector const& cPSelectedIndices, std::unordered_map const& hitMap, unsigned int layers) const { - auto nMultiClusters = multiClusters.size(); + auto nTracksters = tracksters.size(); //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. auto nCaloParticles = cPIndices.size(); std::unordered_map> detIdToCaloParticleId_Map; - std::unordered_map> detIdToMultiClusterId_Map; - std::vector tracksters_fakemerge(nMultiClusters, 0); - std::vector tracksters_duplicate(nMultiClusters, 0); + std::unordered_map> detIdToTracksterId_Map; + std::vector tracksters_fakemerge(nTracksters, 0); + std::vector tracksters_duplicate(nTracksters, 0); - // this contains the ids of the caloparticles contributing with at least one hit to the multi cluster and the reconstruction error - //cpsInLayerCluster[multicluster][CPids] - //Connects a multicluster with all related caloparticles. - std::vector>> cpsInMultiCluster; - cpsInMultiCluster.resize(nMultiClusters); + // this contains the ids of the CaloParticles contributing with at least one hit to the Trackster and the reconstruction error + //cpsInLayerCluster[trackster][CPids] + //Connects a Trackster with all related CaloParticles. + std::vector>> cpsInTrackster; + cpsInTrackster.resize(nTracksters); //cPOnLayer[caloparticle][layer] //This defines a "calo particle on layer" concept. It is only filled in case @@ -2374,34 +2375,36 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist } } } // end of loop through simhits - } // end of loop through simclusters - } // end of loop through caloparticles - - //Loop through multiclusters - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions(); - if (!hits_and_fractions.empty()) { - std::unordered_map CPEnergyInMCL; + } // end of loop through SimClusters + } // end of loop through CaloParticles + + //Loop through Tracksters + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + for (const auto lcId : tracksters[tstId].vertices()) { + const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + if (hits_and_fractions.empty()) continue; + + std::unordered_map CPEnergyInTST; int maxCPId_byNumberOfHits = -1; - unsigned int maxCPNumberOfHitsInMCL = 0; + unsigned int maxCPNumberOfHitsInTST = 0; int maxCPId_byEnergy = -1; - float maxEnergySharedMCLandCP = 0.f; - float energyFractionOfMCLinCP = 0.f; - float energyFractionOfCPinMCL = 0.f; + float maxEnergySharedTSTandCP = 0.f; + float energyFractionOfTSTinCP = 0.f; + float energyFractionOfCPinTST = 0.f; //In case of matched rechit-simhit, so matched - //caloparticle-layercluster-multicluster, he counts and saves the number of + //CaloParticle-LayerCluster-Trackster, he counts and saves the number of //rechits related to the maximum energy CaloParticle out of all - //CaloParticles related to that layer cluster and multicluster. + //CaloParticles related to that layer cluster and Trackster. - std::unordered_map occurrencesCPinMCL; - unsigned int numberOfNoiseHitsInMCL = 0; - unsigned int numberOfHaloHitsInMCL = 0; - unsigned int numberOfHitsInMCL = 0; + std::unordered_map occurrencesCPinTST; + unsigned int numberOfNoiseHitsInTST = 0; + unsigned int numberOfHaloHitsInTST = 0; + unsigned int numberOfHitsInTST = 0; //number of hits related to that cluster. unsigned int numberOfHitsInLC = hits_and_fractions.size(); - numberOfHitsInMCL += numberOfHitsInLC; + numberOfHitsInTST += numberOfHitsInLC; std::unordered_map CPEnergyInLC; //hitsToCaloParticleId is a vector of ints, one for each rechit of the @@ -2444,12 +2447,12 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist //So, something like: //detid: (layer cluster 1, hit fraction) , (layer cluster 2, hit fraction), (layer cluster 3, hit fraction) ... //here comparing with the calo particle map above the - auto hit_find_in_LC = detIdToMultiClusterId_Map.find(rh_detid); - if (hit_find_in_LC == detIdToMultiClusterId_Map.end()) { - detIdToMultiClusterId_Map[rh_detid] = std::vector(); + auto hit_find_in_LC = detIdToTracksterId_Map.find(rh_detid); + if (hit_find_in_LC == detIdToTracksterId_Map.end()) { + detIdToTracksterId_Map[rh_detid] = std::vector(); } - detIdToMultiClusterId_Map[rh_detid].emplace_back( - HGVHistoProducerAlgo::detIdInfoInMultiCluster{mclId, mclId, rhFraction}); + detIdToTracksterId_Map[rh_detid].emplace_back( + HGVHistoProducerAlgo::detIdInfoInTrackster{tstId, tstId, rhFraction}); //Check whether the rechit of the layer cluster under study has a sim hit in the same cell. auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); @@ -2462,7 +2465,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist // real hit that has been marked as halo. if (rhFraction == 0.) { hitsToCaloParticleId[hitId] = -2; - numberOfHaloHitsInMCL++; + numberOfHaloHitsInTST++; } if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) { hitsToCaloParticleId[hitId] -= 1; @@ -2475,21 +2478,21 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist //So, from all layers clusters, find the rechits that are connected with a calo particle and save/calculate the //energy of that calo particle as the sum over all rechits of the rechits energy weighted //by the caloparticle's fraction related to that rechit. - CPEnergyInMCL[h.clusterId] += shared_fraction * hit->energy(); + CPEnergyInTST[h.clusterId] += shared_fraction * hit->energy(); //Same but for layer clusters for the cell association per layer CPEnergyInLC[h.clusterId] += shared_fraction * hit->energy(); //Here cPOnLayer[caloparticle][layer] describe above is set. - //Here for multi clusters with matched rechit the CP fraction times hit energy is added and saved . - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[mclId].first += + //Here for Tracksters with matched rechit the CP fraction times hit energy is added and saved . + cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hit->energy(); - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[mclId].second = FLT_MAX; - //cpsInMultiCluster[multicluster][CPids] - //Connects a multi cluster with all related caloparticles. - cpsInMultiCluster[mclId].emplace_back(h.clusterId, FLT_MAX); + cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX; + //cpsInTrackster[trackster][CPids] + //Connects a Trackster with all related CaloParticles. + cpsInTrackster[tstId].emplace_back(h.clusterId, FLT_MAX); //From all CaloParticles related to a layer cluster, he saves id and energy of the calo particle //that after simhit-rechit matching in layer has the maximum energy. if (shared_fraction > maxCPEnergyInLC) { - //energy is used only here. cpid is saved for multiclusters + //energy is used only here. cpid is saved for Tracksters maxCPEnergyInLC = CPEnergyInLC[h.clusterId]; maxCPId = h.clusterId; } @@ -2504,42 +2507,42 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist //In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle. for (auto c : hitsToCaloParticleId) { if (c < 0) { - numberOfNoiseHitsInMCL++; + numberOfNoiseHitsInTST++; } else { - occurrencesCPinMCL[c]++; + occurrencesCPinTST[c]++; } } //Below from all maximum energy CaloParticles, he saves the one with the largest amount //of related rechits. - for (auto& c : occurrencesCPinMCL) { - if (c.second > maxCPNumberOfHitsInMCL) { + for (auto& c : occurrencesCPinTST) { + if (c.second > maxCPNumberOfHitsInTST) { maxCPId_byNumberOfHits = c.first; - maxCPNumberOfHitsInMCL = c.second; + maxCPNumberOfHitsInTST = c.second; } } - //Find the CaloParticle that has the maximum energy shared with the multicluster under study. - for (auto& c : CPEnergyInMCL) { - if (c.second > maxEnergySharedMCLandCP) { + //Find the CaloParticle that has the maximum energy shared with the Trackster under study. + for (auto& c : CPEnergyInTST) { + if (c.second > maxEnergySharedTSTandCP) { maxCPId_byEnergy = c.first; - maxEnergySharedMCLandCP = c.second; + maxEnergySharedTSTandCP = c.second; } } - //The energy of the CaloParticle that found to have the maximum energy shared with the multicluster under study. + //The energy of the CaloParticle that found to have the maximum energy shared with the Trackster under study. float totalCPEnergyFromLayerCP = 0.f; if (maxCPId_byEnergy >= 0) { //Loop through all layers for (unsigned int j = 0; j < layers * 2; ++j) { totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; } - energyFractionOfCPinMCL = maxEnergySharedMCLandCP / totalCPEnergyFromLayerCP; - if (multiClusters[mclId].energy() > 0.f) { - energyFractionOfMCLinCP = maxEnergySharedMCLandCP / multiClusters[mclId].energy(); + energyFractionOfCPinTST = maxEnergySharedTSTandCP / totalCPEnergyFromLayerCP; + if (tracksters[tstId].raw_energy() > 0.f) { + energyFractionOfTSTinCP = maxEnergySharedTSTandCP / tracksters[tstId].raw_energy(); } } - LogDebug("HGCalValidator") << std::setw(12) << "multiCluster" + LogDebug("HGCalValidator") << std::setw(12) << "Trackster" << "\t" //LogDebug("HGCalValidator") << std::setw(10) << "mulcl energy" << "\t" << std::setw(5) << "nhits" @@ -2547,51 +2550,52 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" << "\t" << std::setw(8) << "nhitsCP" << "\t" << std::setw(16) << "maxCPId_byEnergy" - << "\t" << std::setw(23) << "maxEnergySharedMCLandCP" + << "\t" << std::setw(23) << "maxEnergySharedTSTandCP" << "\t" << std::setw(22) << "totalCPEnergyFromAllLayerCP" - << "\t" << std::setw(22) << "energyFractionOfMCLinCP" - << "\t" << std::setw(25) << "energyFractionOfCPinMCL" + << "\t" << std::setw(22) << "energyFractionOfTSTinCP" + << "\t" << std::setw(25) << "energyFractionOfCPinTST" << "\t" << std::endl; - LogDebug("HGCalValidator") << std::setw(12) << mclId << "\t" //LogDebug("HGCalValidator") - << std::setw(10) << multiClusters[mclId].energy() << "\t" << std::setw(5) - << numberOfHitsInMCL << "\t" << std::setw(12) << numberOfNoiseHitsInMCL << "\t" + LogDebug("HGCalValidator") << std::setw(12) << tstId << "\t" //LogDebug("HGCalValidator") + << std::setw(10) << tracksters[tstId].raw_energy() << "\t" << std::setw(5) + << numberOfHitsInTST << "\t" << std::setw(12) << numberOfNoiseHitsInTST << "\t" << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) - << maxCPNumberOfHitsInMCL << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" - << std::setw(23) << maxEnergySharedMCLandCP << "\t" << std::setw(22) - << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfMCLinCP << "\t" - << std::setw(25) << energyFractionOfCPinMCL << std::endl; - - } //end of loop through multi clusters - } - //Loop through multiclusters - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions(); - if (!hits_and_fractions.empty()) { - // find the unique caloparticles id contributing to the multi clusters - //cpsInMultiCluster[multicluster][CPids] - std::sort(cpsInMultiCluster[mclId].begin(), cpsInMultiCluster[mclId].end()); - auto last = std::unique(cpsInMultiCluster[mclId].begin(), cpsInMultiCluster[mclId].end()); - cpsInMultiCluster[mclId].erase(last, cpsInMultiCluster[mclId].end()); - - if (multiClusters[mclId].energy() == 0. && !cpsInMultiCluster[mclId].empty()) { - //Loop through all CaloParticles contributing to multicluster mclId. - for (auto& cpPair : cpsInMultiCluster[mclId]) { - //In case of a multi cluster with zero energy but related CaloParticles the score is set to 1. + << maxCPNumberOfHitsInTST << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" + << std::setw(23) << maxEnergySharedTSTandCP << "\t" << std::setw(22) + << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfTSTinCP << "\t" + << std::setw(25) << energyFractionOfCPinTST << std::endl; + + } //end of loop through Trackster's layerClusters + } //end of loop through Tracksters + //Loop through Tracksters + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + for (const auto lcId : tracksters[tstId].vertices()) { + const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + if (hits_and_fractions.empty()) continue; + // find the unique CaloParticles id contributing to the Tracksters + //cpsInTrackster[trackster][CPids] + std::sort(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); + auto last = std::unique(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); + cpsInTrackster[tstId].erase(last, cpsInTrackster[tstId].end()); + + if (tracksters[tstId].raw_energy() == 0. && !cpsInTrackster[tstId].empty()) { + //Loop through all CaloParticles contributing to Trackster tstId. + for (auto& cpPair : cpsInTrackster[tstId]) { + //In case of a Trackster with zero energy but related CaloParticles the score is set to 1. cpPair.second = 1.; - LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId << "\t CP id: \t" << cpPair.first + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" << cpPair.second << std::endl; - histograms.h_score_multicl2caloparticle[count]->Fill(cpPair.second); + histograms.h_score_trackster2caloparticle[count]->Fill(cpPair.second); } continue; } // Compute the correct normalization - float invMultiClusterEnergyWeight = 0.f; - for (auto const& haf : multiClusters[mclId].hitsAndFractions()) { - invMultiClusterEnergyWeight += + float invTracksterEnergyWeight = 0.f; + for (auto const& haf : hits_and_fractions) { + invTracksterEnergyWeight += (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy()); } - invMultiClusterEnergyWeight = 1.f / invMultiClusterEnergyWeight; + invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight; unsigned int numberOfHitsInLC = hits_and_fractions.size(); for (unsigned int i = 0; i < numberOfHitsInLC; ++i) { @@ -2606,7 +2610,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist const HGCRecHit* hit = itcheck->second; float hitEnergyWeight = hit->energy() * hit->energy(); - for (auto& cpPair : cpsInMultiCluster[mclId]) { + for (auto& cpPair : cpsInTrackster[tstId]) { float cpFraction = 0.f; if (!hitWithNoCP) { auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), @@ -2620,63 +2624,63 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist cpPair.second = 0.f; } cpPair.second += - (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invMultiClusterEnergyWeight; + (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invTracksterEnergyWeight; } } //end of loop through rechits of layer cluster - //In case of a multi cluster with some energy but none related CaloParticles print some info. - if (cpsInMultiCluster[mclId].empty()) - LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId << "\tCP id:\t-1 " + //In case of a Trackster with some energy but none related CaloParticles print some info. + if (cpsInTrackster[tstId].empty()) + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\tCP id:\t-1 " << "\t score \t-1" << "\n"; - auto score = std::min_element(std::begin(cpsInMultiCluster[mclId]), - std::end(cpsInMultiCluster[mclId]), + auto score = std::min_element(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - for (auto& cpPair : cpsInMultiCluster[mclId]) { - // LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId + for (auto& cpPair : cpsInTrackster[tstId]) { + // LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId // << "\t CP id: \t" << cpPair.first // << "\t score \t" << cpPair.second // << "\n"; - LogDebug("HGCalValidator") << "multiCluster Id: \t" << mclId << "\t CP id: \t" << cpPair.first << "\t score \t" + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" << cpPair.second << std::endl; if (cpPair.first == score->first) { - histograms.h_score_multicl2caloparticle[count]->Fill(score->second); + histograms.h_score_trackster2caloparticle[count]->Fill(score->second); } float sharedeneCPallLayers = 0.; //Loop through all layers for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[mclId]; + auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[tstId]; sharedeneCPallLayers += cp_linked.first; } //end of loop through layers LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; if (cpPair.first == score->first) { - histograms.h_sharedenergy_multicl2caloparticle[count]->Fill(sharedeneCPallLayers / - multiClusters[mclId].energy()); - histograms.h_energy_vs_score_multicl2caloparticle[count]->Fill( - score->second, sharedeneCPallLayers / multiClusters[mclId].energy()); + histograms.h_sharedenergy_trackster2caloparticle[count]->Fill(sharedeneCPallLayers / + tracksters[tstId].raw_energy()); + histograms.h_energy_vs_score_trackster2caloparticle[count]->Fill( + score->second, sharedeneCPallLayers / tracksters[tstId].raw_energy()); } } - auto assocFakeMerge = std::count_if(std::begin(cpsInMultiCluster[mclId]), - std::end(cpsInMultiCluster[mclId]), - [](const auto& obj) { return obj.second < ScoreCutMCLtoCPFakeMerge_; }); - tracksters_fakemerge[mclId] = assocFakeMerge; - } - } //end of loop through multiclusters + auto assocFakeMerge = std::count_if(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj) { return obj.second < ScoreCutTSTtoCPFakeMerge_; }); + tracksters_fakemerge[tstId] = assocFakeMerge; + } //end of loop through Trackster's layerClusters + } //end of loop through Tracksters std::unordered_map> score3d; - std::unordered_map> mclsharedenergy; - std::unordered_map> mclsharedenergyfrac; + std::unordered_map> tstSharedEnergy; + std::unordered_map> tstSharedEnergyFrac; for (unsigned int i = 0; i < nCaloParticles; ++i) { auto cpIndex = cPIndices[i]; - score3d[cpIndex].resize(nMultiClusters); - mclsharedenergy[cpIndex].resize(nMultiClusters); - mclsharedenergyfrac[cpIndex].resize(nMultiClusters); - for (unsigned int j = 0; j < nMultiClusters; ++j) { + score3d[cpIndex].resize(nTracksters); + tstSharedEnergy[cpIndex].resize(nTracksters); + tstSharedEnergyFrac[cpIndex].resize(nTracksters); + for (unsigned int j = 0; j < nTracksters; ++j) { score3d[cpIndex][j] = FLT_MAX; - mclsharedenergy[cpIndex][j] = 0.f; - mclsharedenergyfrac[cpIndex][j] = 0.f; + tstSharedEnergy[cpIndex][j] = 0.f; + tstSharedEnergyFrac[cpIndex][j] = 0.f; } } @@ -2684,86 +2688,86 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist // gen-level, namely efficiency an duplicate. In this loop we should restrict // only to the selected caloParaticles. for (const auto& cpId : cPSelectedIndices) { - //We need to keep the multiclusters ids that are related to + //We need to keep the Tracksters ids that are related to //CaloParticle under study for the final filling of the score. - std::vector cpId_mclId_related; - cpId_mclId_related.clear(); + std::vector cpId_tstId_related; + cpId_tstId_related.clear(); float CPenergy = 0.f; for (unsigned int layerId = 0; layerId < layers * 2; ++layerId) { unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size(); - //Below gives the CP energy related to multicluster per layer. + //Below gives the CP energy related to Trackster per layer. CPenergy += cPOnLayer[cpId][layerId].energy; if (CPNumberOfHits == 0) continue; - int mclWithMaxEnergyInCP = -1; - //This is the maximum energy related to multicluster per layer. - float maxEnergyMCLperlayerinCP = 0.f; - float CPEnergyFractionInMCLperlayer = 0.f; - //Remember and not confused by name. layerClusterIdToEnergyAndScore contains the multicluster id. - for (const auto& mcl : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - if (mcl.second.first > maxEnergyMCLperlayerinCP) { - maxEnergyMCLperlayerinCP = mcl.second.first; - mclWithMaxEnergyInCP = mcl.first; + int tstWithMaxEnergyInCP = -1; + //This is the maximum energy related to Trackster per layer. + float maxEnergyTSTperlayerinCP = 0.f; + float CPEnergyFractionInTSTperlayer = 0.f; + //Remember and not confused by name. layerClusterIdToEnergyAndScore contains the Trackster id. + for (const auto& tst : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { + if (tst.second.first > maxEnergyTSTperlayerinCP) { + maxEnergyTSTperlayerinCP = tst.second.first; + tstWithMaxEnergyInCP = tst.first; } } if (CPenergy > 0.f) - CPEnergyFractionInMCLperlayer = maxEnergyMCLperlayerinCP / CPenergy; + CPEnergyFractionInTSTperlayer = maxEnergyTSTperlayerinCP / CPenergy; LogDebug("HGCalValidator") << std::setw(8) << "LayerId:\t" << std::setw(12) << "caloparticle\t" << std::setw(15) << "cp total energy\t" << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) - << "CPNhitsOnLayer\t" << std::setw(18) << "mclWithMaxEnergyInCP\t" << std::setw(15) - << "maxEnergyMCLinCP\t" << std::setw(20) << "CPEnergyFractionInMCL" + << "CPNhitsOnLayer\t" << std::setw(18) << "tstWithMaxEnergyInCP\t" << std::setw(15) + << "maxEnergyTSTinCP\t" << std::setw(20) << "CPEnergyFractionInTST" << "\n"; LogDebug("HGCalValidator") << std::setw(8) << layerId << "\t" << std::setw(12) << cpId << "\t" << std::setw(15) << cP[cpId].energy() << "\t" << std::setw(15) << CPenergy << "\t" << std::setw(14) - << CPNumberOfHits << "\t" << std::setw(18) << mclWithMaxEnergyInCP << "\t" - << std::setw(15) << maxEnergyMCLperlayerinCP << "\t" << std::setw(20) - << CPEnergyFractionInMCLperlayer << "\n"; + << CPNumberOfHits << "\t" << std::setw(18) << tstWithMaxEnergyInCP << "\t" + << std::setw(15) << maxEnergyTSTperlayerinCP << "\t" << std::setw(20) + << CPEnergyFractionInTSTperlayer << "\n"; for (unsigned int i = 0; i < CPNumberOfHits; ++i) { auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[i].first; auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[i].second; - bool hitWithNoMCL = false; + bool hitWithNoTST = false; if (cpFraction == 0.f) continue; //hopefully this should never happen - auto hit_find_in_MCL = detIdToMultiClusterId_Map.find(cp_hitDetId); - if (hit_find_in_MCL == detIdToMultiClusterId_Map.end()) - hitWithNoMCL = true; + auto hit_find_in_TST = detIdToTracksterId_Map.find(cp_hitDetId); + if (hit_find_in_TST == detIdToTracksterId_Map.end()) + hitWithNoTST = true; auto itcheck = hitMap.find(cp_hitDetId); const HGCRecHit* hit = itcheck->second; float hitEnergyWeight = hit->energy() * hit->energy(); for (auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - unsigned int multiClusterId = lcPair.first; - if (std::find(std::begin(cpId_mclId_related), std::end(cpId_mclId_related), multiClusterId) == - std::end(cpId_mclId_related)) { - cpId_mclId_related.push_back(multiClusterId); + unsigned int tracksterId = lcPair.first; + if (std::find(std::begin(cpId_tstId_related), std::end(cpId_tstId_related), tracksterId) == + std::end(cpId_tstId_related)) { + cpId_tstId_related.push_back(tracksterId); } - float mclFraction = 0.f; - - if (!hitWithNoMCL) { - auto findHitIt = std::find(detIdToMultiClusterId_Map[cp_hitDetId].begin(), - detIdToMultiClusterId_Map[cp_hitDetId].end(), - HGVHistoProducerAlgo::detIdInfoInMultiCluster{multiClusterId, 0, 0.f}); - if (findHitIt != detIdToMultiClusterId_Map[cp_hitDetId].end()) - mclFraction = findHitIt->fraction; + float tstFraction = 0.f; + + if (!hitWithNoTST) { + auto findHitIt = std::find(detIdToTracksterId_Map[cp_hitDetId].begin(), + detIdToTracksterId_Map[cp_hitDetId].end(), + HGVHistoProducerAlgo::detIdInfoInTrackster{tracksterId, 0, 0.f}); + if (findHitIt != detIdToTracksterId_Map[cp_hitDetId].end()) + tstFraction = findHitIt->fraction; } //Observe here that we do not divide as before by the layer cluster energy weight. We should sum first //over all layers and divide with the total CP energy over all layers. if (lcPair.second.second == FLT_MAX) { lcPair.second.second = 0.f; } - lcPair.second.second += (mclFraction - cpFraction) * (mclFraction - cpFraction) * hitEnergyWeight; - LogDebug("HGCalValidator") << "multiClusterId:\t" << multiClusterId << "\t" - << "mclfraction,cpfraction:\t" << mclFraction << ", " << cpFraction << "\t" + lcPair.second.second += (tstFraction - cpFraction) * (tstFraction - cpFraction) * hitEnergyWeight; + LogDebug("HGCalValidator") << "TracksterId:\t" << tracksterId << "\t" + << "tstfraction,cpfraction:\t" << tstFraction << ", " << cpFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" << "currect score numerator:\t" << lcPair.second.second << "\n"; } } //end of loop through sim hits of current calo particle if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty()) - LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t MCL id:\t-1 " + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TST id:\t-1 " << "\t layer \t " << layerId << " Sub score in \t -1" << "\n"; @@ -2773,7 +2777,7 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist score3d[cpId][lcPair.first] = 0.f; } score3d[cpId][lcPair.first] += lcPair.second.second; - mclsharedenergy[cpId][lcPair.first] += lcPair.second.first; + tstSharedEnergy[cpId][lcPair.first] += lcPair.second.first; } } //end of loop through layers @@ -2790,29 +2794,29 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist } invCPEnergyWeight = 1.f / invCPEnergyWeight; - //Loop through related multiclusters here + //Loop through related Tracksters here //Will switch to vector for access because it is faster - std::vector cpId_mclId_related_vec(cpId_mclId_related.begin(), cpId_mclId_related.end()); - for (unsigned int i = 0; i < cpId_mclId_related_vec.size(); ++i) { - auto mclId = cpId_mclId_related_vec[i]; + std::vector cpId_tstId_related_vec(cpId_tstId_related.begin(), cpId_tstId_related.end()); + for (unsigned int i = 0; i < cpId_tstId_related_vec.size(); ++i) { + auto tstId = cpId_tstId_related_vec[i]; //Now time for the denominator - score3d[cpId][mclId] = score3d[cpId][mclId] * invCPEnergyWeight; - mclsharedenergyfrac[cpId][mclId] = (mclsharedenergy[cpId][mclId] / CPenergy); + score3d[cpId][tstId] = score3d[cpId][tstId] * invCPEnergyWeight; + tstSharedEnergyFrac[cpId][tstId] = (tstSharedEnergy[cpId][tstId] / CPenergy); - LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t MCL id: \t" << mclId << "\t score \t" // - << score3d[cpId][mclId] << "\t" + LogDebug("HGCalValidator") << "CP Id: \t" << cpId << "\t TST id: \t" << tstId << "\t score \t" // + << score3d[cpId][tstId] << "\t" << "invCPEnergyWeight \t" << invCPEnergyWeight << "\t" - << "shared energy:\t" << mclsharedenergy[cpId][mclId] << "\t" - << "shared energy fraction:\t" << mclsharedenergyfrac[cpId][mclId] << "\n"; + << "shared energy:\t" << tstSharedEnergy[cpId][tstId] << "\t" + << "shared energy fraction:\t" << tstSharedEnergyFrac[cpId][tstId] << "\n"; - histograms.h_score_caloparticle2multicl[count]->Fill(score3d[cpId][mclId]); + histograms.h_score_caloparticle2trackster[count]->Fill(score3d[cpId][tstId]); - histograms.h_sharedenergy_caloparticle2multicl[count]->Fill(mclsharedenergyfrac[cpId][mclId]); - histograms.h_energy_vs_score_caloparticle2multicl[count]->Fill(score3d[cpId][mclId], - mclsharedenergyfrac[cpId][mclId]); - } //end of loop through multiclusters + histograms.h_sharedenergy_caloparticle2trackster[count]->Fill(tstSharedEnergyFrac[cpId][tstId]); + histograms.h_energy_vs_score_caloparticle2trackster[count]->Fill(score3d[cpId][tstId], + tstSharedEnergyFrac[cpId][tstId]); + } //end of loop through Tracksters - auto is_assoc = [&](const auto& v) -> bool { return v < ScoreCutCPtoMCLEffDup_; }; + auto is_assoc = [&](const auto& v) -> bool { return v < ScoreCutCPtoTSTEffDup_; }; auto assocDup = std::count_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); @@ -2820,13 +2824,13 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist histograms.h_num_caloparticle_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta()); histograms.h_num_caloparticle_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi()); auto best = std::min_element(std::begin(score3d[cpId]), std::end(score3d[cpId])); - auto bestmclId = std::distance(std::begin(score3d[cpId]), best); + auto bestTstId = std::distance(std::begin(score3d[cpId]), best); - histograms.h_sharedenergy_caloparticle2multicl_vs_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta(), - multiClusters[bestmclId].energy() / CPenergy); - histograms.h_sharedenergy_caloparticle2multicl_vs_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi(), - multiClusters[bestmclId].energy() / CPenergy); - histograms.h_sharedenergy_caloparticle2multicl_assoc[count]->Fill(mclsharedenergyfrac[cpId][bestmclId]); + histograms.h_sharedenergy_caloparticle2trackster_vs_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta(), + tracksters[bestTstId].raw_energy() / CPenergy); + histograms.h_sharedenergy_caloparticle2trackster_vs_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi(), + tracksters[bestTstId].raw_energy() / CPenergy); + histograms.h_sharedenergy_caloparticle2trackster_assoc[count]->Fill(tstSharedEnergyFrac[cpId][bestTstId]); } if (assocDup >= 2) { auto match = std::find_if(std::begin(score3d[cpId]), std::end(score3d[cpId]), is_assoc); @@ -2843,47 +2847,49 @@ void HGVHistoProducerAlgo::multiClusters_to_CaloParticles(const Histograms& hist // Here we do fill the plots to compute the different metrics linked to // reco-level, namely fake-rate an merge-rate. In this loop we should *not* // restrict only to the selected caloParaticles. - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions(); - if (!hits_and_fractions.empty()) { - auto assocFakeMerge = tracksters_fakemerge[mclId]; - auto assocDuplicate = tracksters_duplicate[mclId]; + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + for (const auto lcId : tracksters[tstId].vertices()) { + const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + if (hits_and_fractions.empty()) continue; + auto assocFakeMerge = tracksters_fakemerge[tstId]; + auto assocDuplicate = tracksters_duplicate[tstId]; if (assocDuplicate) { - histograms.h_numDup_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_numDup_multicl_phi[count]->Fill(multiClusters[mclId].phi()); + histograms.h_numDup_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_numDup_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); } if (assocFakeMerge > 0) { - histograms.h_num_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_num_multicl_phi[count]->Fill(multiClusters[mclId].phi()); - auto best = std::min_element(std::begin(cpsInMultiCluster[mclId]), - std::end(cpsInMultiCluster[mclId]), + histograms.h_num_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_num_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + auto best = std::min_element(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); //This is the shared energy taking the best caloparticle in each layer float sharedeneCPallLayers = 0.; //Loop through all layers for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& best_cp_linked = cPOnLayer[best->first][j].layerClusterIdToEnergyAndScore[mclId]; + auto const& best_cp_linked = cPOnLayer[best->first][j].layerClusterIdToEnergyAndScore[tstId]; sharedeneCPallLayers += best_cp_linked.first; } //end of loop through layers - histograms.h_sharedenergy_multicl2caloparticle_vs_eta[count]->Fill( - multiClusters[mclId].eta(), sharedeneCPallLayers / multiClusters[mclId].energy()); - histograms.h_sharedenergy_multicl2caloparticle_vs_phi[count]->Fill( - multiClusters[mclId].phi(), sharedeneCPallLayers / multiClusters[mclId].energy()); + histograms.h_sharedenergy_trackster2caloparticle_vs_eta[count]->Fill( + tracksters[tstId].barycenter().eta(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); + histograms.h_sharedenergy_trackster2caloparticle_vs_phi[count]->Fill( + tracksters[tstId].barycenter().phi(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); } if (assocFakeMerge >= 2) { - histograms.h_numMerge_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_numMerge_multicl_phi[count]->Fill(multiClusters[mclId].phi()); + histograms.h_numMerge_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_numMerge_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); } - histograms.h_denom_multicl_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_denom_multicl_phi[count]->Fill(multiClusters[mclId].phi()); + histograms.h_denom_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_denom_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); } } } -void HGVHistoProducerAlgo::fill_multi_cluster_histos(const Histograms& histograms, +void HGVHistoProducerAlgo::fill_trackster_histos(const Histograms& histograms, int count, - const std::vector& multiClusters, + const ticl::TracksterCollection& tracksters, + const reco::CaloClusterCollection& layerClusters, std::vector const& cP, std::vector const& cPIndices, std::vector const& cPSelectedIndices, @@ -2892,179 +2898,178 @@ void HGVHistoProducerAlgo::fill_multi_cluster_histos(const Histograms& histogram //Each event to be treated as two events: //an event in +ve endcap, plus another event in -ve endcap. - //To keep track of total num of multiclusters - int tnmclmz = 0; //-z - int tnmclpz = 0; //+z - //To count the number of multiclusters with 3 contiguous layers per event. - int tncontmclpz = 0; //+z - int tncontmclmz = 0; //-z - //For the number of multiclusters without 3 contiguous layers per event. - int tnnoncontmclpz = 0; //+z - int tnnoncontmclmz = 0; //-z - //We want to check below the score of cont and non cont multiclusters - std::vector contmulti; - contmulti.clear(); - - //[mclId]-> vector of 2d layer clusters size + //To keep track of total num of Tracksters + int totNTstZm = 0; //-z + int totNTstZp = 0; //+z + //To count the number of Tracksters with 3 contiguous layers per event. + int totNContTstZp = 0; //+z + int totNContTstZm = 0; //-z + //For the number of Tracksters without 3 contiguous layers per event. + int totNNotContTstZp = 0; //+z + int totNNotContTstZm = 0; //-z + //We want to check below the score of cont and non cont Tracksters + std::vector contTracksters; + contTracksters.clear(); + + //[tstId]-> vector of 2d layer clusters size std::unordered_map> multiplicity; - //[mclId]-> [layer][cluster size] + //[tstId]-> [layer][cluster size] std::unordered_map> multiplicity_vs_layer; //We will need for the scale text option - // unsigned int totallcinmcls = 0; - // for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - // totallcinmcls = totallcinmcls + multiClusters[mclId].clusters().size(); + // unsigned int totalLcInTsts = 0; + // for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + // totalLcInTsts = totalLcInTsts + tracksters[tstId].vertices().size(); // } - auto nMultiClusters = multiClusters.size(); - //loop through multiclusters of the event - for (unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) { - const auto layerClusters = multiClusters[mclId].clusters(); - auto nLayerClusters = layerClusters.size(); + auto nTracksters = tracksters.size(); + //loop through Tracksters of the event + for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + auto nLayerClusters = tracksters[tstId].vertices().size(); if (nLayerClusters == 0) continue; - if (multiClusters[mclId].z() < 0.) { - tnmclmz++; + if (tracksters[tstId].barycenter().z() < 0.) { + totNTstZm++; } - if (multiClusters[mclId].z() > 0.) { - tnmclpz++; + if (tracksters[tstId].barycenter().z() > 0.) { + totNTstZp++; } - //Total number of layer clusters in multicluster - int tnlcinmcl = 0; + //Total number of layer clusters in Trackster + int tnLcInTst = 0; - //To keep track of total num of layer clusters per multicluster - //tnlcinmclperlaypz[layerid], tnlcinmclperlaymz[layerid] - std::vector tnlcinmclperlay(1000, 0); //+z + //To keep track of total num of layer clusters per Trackster + //tnLcInTstperlaypz[layerid], tnLcInTstperlaymz[layerid] + std::vector tnLcInTstperlay(1000, 0); //+z - //For the layers the multicluster expands to. Will use a set because there would be many + //For the layers the Trackster expands to. Will use a set because there would be many //duplicates and then go back to vector for random access, since they say it is faster. - std::set multicluster_layers; + std::set trackster_layers; - bool multiclusterInZplus = false; - bool multiclusterInZminus = false; + bool tracksterInZplus = false; + bool tracksterInZminus = false; //Loop through layer clusters - for (unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) { + for (const auto lcId : tracksters[tstId].vertices()) { //take the hits and their fraction of the specific layer cluster. - const std::vector>& hits_and_fractions = layerClusters[lcId]->hitsAndFractions(); + const std::vector>& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - //For the multiplicity of the 2d layer clusters in multiclusters - multiplicity[mclId].emplace_back(hits_and_fractions.size()); + //For the multiplicity of the 2d layer clusters in Tracksters + multiplicity[tstId].emplace_back(hits_and_fractions.size()); const auto firstHitDetId = hits_and_fractions[0].first; //The layer that the layer cluster belongs to int layerid = recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; - multicluster_layers.insert(layerid); - multiplicity_vs_layer[mclId].emplace_back(layerid); + trackster_layers.insert(layerid); + multiplicity_vs_layer[tstId].emplace_back(layerid); - tnlcinmclperlay[layerid]++; - tnlcinmcl++; + tnLcInTstperlay[layerid]++; + tnLcInTst++; if (recHitTools_->zside(firstHitDetId) > 0.) { - multiclusterInZplus = true; + tracksterInZplus = true; } if (recHitTools_->zside(firstHitDetId) < 0.) { - multiclusterInZminus = true; + tracksterInZminus = true; } - } //end of loop through layerclusters + } // end of loop through layerClusters - //Per layer : Loop 0->99 + // Per layer : Loop 0->99 for (unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) { - if (histograms.h_clusternum_in_multicluster_perlayer[count].count(ilayer) && tnlcinmclperlay[ilayer] != 0) { - histograms.h_clusternum_in_multicluster_perlayer[count].at(ilayer)->Fill((float)tnlcinmclperlay[ilayer]); + if (histograms.h_clusternum_in_trackster_perlayer[count].count(ilayer) && tnLcInTstperlay[ilayer] != 0) { + histograms.h_clusternum_in_trackster_perlayer[count].at(ilayer)->Fill((float)tnLcInTstperlay[ilayer]); } - //For the profile now of 2d layer cluster in multiclusters vs layer number. - if (tnlcinmclperlay[ilayer] != 0) { - histograms.h_clusternum_in_multicluster_vs_layer[count]->Fill((float)ilayer, (float)tnlcinmclperlay[ilayer]); + // For the profile now of 2d layer cluster in Tracksters vs layer number. + if (tnLcInTstperlay[ilayer] != 0) { + histograms.h_clusternum_in_trackster_vs_layer[count]->Fill((float)ilayer, (float)tnLcInTstperlay[ilayer]); } - } //end of loop over layers + } // end of loop over layers - //Looking for multiclusters with 3 contiguous layers per event. - std::vector multicluster_layers_vec(multicluster_layers.begin(), multicluster_layers.end()); - //Since we want to also check for non contiguous multiclusters - bool contimulti = false; + // Looking for Tracksters with 3 contiguous layers per event. + std::vector trackster_layers_vec(trackster_layers.begin(), trackster_layers.end()); + // Since we want to also check for non contiguous Tracksters + bool contiTrackster = false; //Observe that we start from 1 and go up to size - 1 element. - if (multicluster_layers_vec.size() >= 3) { - for (unsigned int i = 1; i < multicluster_layers_vec.size() - 1; ++i) { - if ((multicluster_layers_vec[i - 1] + 1 == multicluster_layers_vec[i]) && - (multicluster_layers_vec[i + 1] - 1 == multicluster_layers_vec[i])) { - //So, this is a multicluster with 3 contiguous layers per event - if (multiclusterInZplus) { - tncontmclpz++; + if (trackster_layers_vec.size() >= 3) { + for (unsigned int i = 1; i < trackster_layers_vec.size() - 1; ++i) { + if ((trackster_layers_vec[i - 1] + 1 == trackster_layers_vec[i]) && + (trackster_layers_vec[i + 1] - 1 == trackster_layers_vec[i])) { + //So, this is a Trackster with 3 contiguous layers per event + if (tracksterInZplus) { + totNContTstZp++; } - if (multiclusterInZminus) { - tncontmclmz++; + if (tracksterInZminus) { + totNContTstZm++; } - contimulti = true; + contiTrackster = true; break; } } } - //Count non contiguous multiclusters - if (!contimulti) { - if (multiclusterInZplus) { - tnnoncontmclpz++; + // Count non contiguous Tracksters + if (!contiTrackster) { + if (tracksterInZplus) { + totNNotContTstZp++; } - if (multiclusterInZminus) { - tnnoncontmclmz++; + if (tracksterInZminus) { + totNNotContTstZm++; } } - //Save for the score - contmulti.push_back(contimulti); + // Save for the score + contTracksters.push_back(contiTrackster); - histograms.h_clusternum_in_multicluster[count]->Fill(tnlcinmcl); + histograms.h_clusternum_in_trackster[count]->Fill(tnLcInTst); - for (unsigned int lc = 0; lc < multiplicity[mclId].size(); ++lc) { + for (unsigned int lc = 0; lc < multiplicity[tstId].size(); ++lc) { //multiplicity of the current LC - float mlp = std::count(std::begin(multiplicity[mclId]), std::end(multiplicity[mclId]), multiplicity[mclId][lc]); + float mlp = std::count(std::begin(multiplicity[tstId]), std::end(multiplicity[tstId]), multiplicity[tstId][lc]); //LogDebug("HGCalValidator") << "mlp %" << (100. * mlp)/ ((float) nLayerClusters) << std::endl; - // histograms.h_multiplicityOfLCinMCL[count]->Fill( mlp , multiplicity[mclId][lc] , 100. / (float) totallcinmcls ); - histograms.h_multiplicityOfLCinMCL[count]->Fill(mlp, multiplicity[mclId][lc]); + // histograms.h_multiplicityOfLCinTST[count]->Fill( mlp , multiplicity[tstId][lc] , 100. / (float) totalLcInTsts ); + histograms.h_multiplicityOfLCinTST[count]->Fill(mlp, multiplicity[tstId][lc]); //When we will plot with the text option we want the entries to be the same - //as the % of the current cell over the whole number of clusters. For this we need an extra histo. + //as the % of the current cell over the whole number of layerClusters. For this we need an extra histo. histograms.h_multiplicity_numberOfEventsHistogram[count]->Fill(mlp); //For the cluster multiplicity vs layer //First with the -z endcap (V10:0->49) - if (multiplicity_vs_layer[mclId][lc] < layers) { - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zminus[count]->Fill(mlp, multiplicity_vs_layer[mclId][lc]); + if (multiplicity_vs_layer[tstId][lc] < layers) { + histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus[count]->Fill(mlp, multiplicity_vs_layer[tstId][lc]); histograms.h_multiplicity_zminus_numberOfEventsHistogram[count]->Fill(mlp); } else { //Then for the +z (V10:50->99) - histograms.h_multiplicityOfLCinMCL_vs_layercluster_zplus[count]->Fill( - mlp, multiplicity_vs_layer[mclId][lc] - layers); + histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus[count]->Fill( + mlp, multiplicity_vs_layer[tstId][lc] - layers); histograms.h_multiplicity_zplus_numberOfEventsHistogram[count]->Fill(mlp); } //For the cluster multiplicity vs cluster energy - histograms.h_multiplicityOfLCinMCL_vs_layerclusterenergy[count]->Fill(mlp, layerClusters[lc]->energy()); + histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy[count]->Fill(mlp, layerClusters[tracksters[tstId].vertices(lc)].energy()); } - if (!multicluster_layers.empty()) { - histograms.h_multicluster_x[count]->Fill(multiClusters[mclId].x()); - histograms.h_multicluster_y[count]->Fill(multiClusters[mclId].y()); - histograms.h_multicluster_z[count]->Fill(multiClusters[mclId].z()); - histograms.h_multicluster_eta[count]->Fill(multiClusters[mclId].eta()); - histograms.h_multicluster_phi[count]->Fill(multiClusters[mclId].phi()); + if (!trackster_layers.empty()) { + histograms.h_trackster_x[count]->Fill(tracksters[tstId].barycenter().x()); + histograms.h_trackster_y[count]->Fill(tracksters[tstId].barycenter().y()); + histograms.h_trackster_z[count]->Fill(tracksters[tstId].barycenter().z()); + histograms.h_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); - histograms.h_multicluster_firstlayer[count]->Fill((float)*multicluster_layers.begin()); - histograms.h_multicluster_lastlayer[count]->Fill((float)*multicluster_layers.rbegin()); - histograms.h_multicluster_layersnum[count]->Fill((float)multicluster_layers.size()); + histograms.h_trackster_firstlayer[count]->Fill((float)*trackster_layers.begin()); + histograms.h_trackster_lastlayer[count]->Fill((float)*trackster_layers.rbegin()); + histograms.h_trackster_layersnum[count]->Fill((float)trackster_layers.size()); - histograms.h_multicluster_pt[count]->Fill(multiClusters[mclId].pt()); + histograms.h_trackster_pt[count]->Fill(tracksters[tstId].raw_pt()); - histograms.h_multicluster_energy[count]->Fill(multiClusters[mclId].energy()); + histograms.h_trackster_energy[count]->Fill(tracksters[tstId].raw_energy()); } - } //end of loop through multiclusters + } //end of loop through Tracksters - histograms.h_multiclusternum[count]->Fill(tnmclmz + tnmclpz); - histograms.h_contmulticlusternum[count]->Fill(tncontmclpz + tncontmclmz); - histograms.h_noncontmulticlusternum[count]->Fill(tnnoncontmclpz + tnnoncontmclmz); + histograms.h_tracksternum[count]->Fill(totNTstZm + totNTstZp); + histograms.h_conttracksternum[count]->Fill(totNContTstZp + totNContTstZm); + histograms.h_nonconttracksternum[count]->Fill(totNNotContTstZp + totNNotContTstZm); - multiClusters_to_CaloParticles(histograms, count, multiClusters, cP, cPIndices, cPSelectedIndices, hitMap, layers); + tracksters_to_CaloParticles(histograms, count, tracksters, layerClusters, cP, cPIndices, cPSelectedIndices, hitMap, layers); } double HGVHistoProducerAlgo::distance2(const double x1, From f952d8d95f281131b085a14b3b263219df803a11 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Wed, 21 Apr 2021 03:42:46 +0200 Subject: [PATCH 015/309] Remove producer --- RecoHGCal/TICL/python/EMStep_cff.py | 10 +----- RecoHGCal/TICL/python/HADStep_cff.py | 10 +----- RecoHGCal/TICL/python/MIPStep_cff.py | 10 +----- RecoHGCal/TICL/python/SimTracksters_cff.py | 8 +---- RecoHGCal/TICL/python/TrkEMStep_cff.py | 11 +----- RecoHGCal/TICL/python/TrkStep_cff.py | 10 +----- RecoHGCal/TICL/python/iterativeTICL_cff.py | 6 +--- RecoHGCal/TICL/python/ticl_iterations.py | 39 +--------------------- 8 files changed, 8 insertions(+), 96 deletions(-) diff --git a/RecoHGCal/TICL/python/EMStep_cff.py b/RecoHGCal/TICL/python/EMStep_cff.py index be4ee499fddc8..ebf67e0f971ce 100644 --- a/RecoHGCal/TICL/python/EMStep_cff.py +++ b/RecoHGCal/TICL/python/EMStep_cff.py @@ -3,7 +3,6 @@ from RecoHGCal.TICL.TICLSeedingRegions_cff import ticlSeedingGlobal, ticlSeedingGlobalHFNose from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -38,16 +37,9 @@ algo_verbosity = 0, ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersEM = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersEM" -) - ticlEMStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersEM - ,ticlTrackstersEM - ,ticlMultiClustersFromTrackstersEM) + ,ticlTrackstersEM) filteredLayerClustersHFNoseEM = filteredLayerClustersEM.clone( LayerClusters = 'hgcalLayerClustersHFNose', diff --git a/RecoHGCal/TICL/python/HADStep_cff.py b/RecoHGCal/TICL/python/HADStep_cff.py index 655fadae45f3a..9c9dc17259555 100644 --- a/RecoHGCal/TICL/python/HADStep_cff.py +++ b/RecoHGCal/TICL/python/HADStep_cff.py @@ -4,7 +4,6 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer as _ticlLayerTileProducer from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -33,16 +32,9 @@ itername = "HAD" ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersHAD = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersHAD" - ) - ticlHADStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersHAD - ,ticlTrackstersHAD - ,ticlMultiClustersFromTrackstersHAD) + ,ticlTrackstersHAD) filteredLayerClustersHFNoseHAD = _filteredLayerClustersProducer.clone( min_cluster_size = 2, # inclusive diff --git a/RecoHGCal/TICL/python/MIPStep_cff.py b/RecoHGCal/TICL/python/MIPStep_cff.py index f7e5234b3aa9c..ccccf6b30b201 100644 --- a/RecoHGCal/TICL/python/MIPStep_cff.py +++ b/RecoHGCal/TICL/python/MIPStep_cff.py @@ -3,7 +3,6 @@ from RecoHGCal.TICL.TICLSeedingRegions_cff import ticlSeedingGlobal, ticlSeedingGlobalHFNose from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -29,16 +28,9 @@ max_delta_time = -1 ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersMIP = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersMIP" -) - ticlMIPStepTask = cms.Task(ticlSeedingGlobal ,filteredLayerClustersMIP - ,ticlTrackstersMIP - ,ticlMultiClustersFromTrackstersMIP) + ,ticlTrackstersMIP) filteredLayerClustersHFNoseMIP = filteredLayerClustersMIP.clone( LayerClusters = 'hgcalLayerClustersHFNose', diff --git a/RecoHGCal/TICL/python/SimTracksters_cff.py b/RecoHGCal/TICL/python/SimTracksters_cff.py index 8aa9d1a9fd8c7..699037d1a368f 100644 --- a/RecoHGCal/TICL/python/SimTracksters_cff.py +++ b/RecoHGCal/TICL/python/SimTracksters_cff.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from RecoHGCal.TICL.trackstersFromSimClustersProducer_cfi import trackstersFromSimClustersProducer as _trackstersFromSimClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer @@ -23,9 +22,4 @@ simclusters = "mixData:MergedCaloTruth" ) -ticlMultiClustersFromSimTracksters = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlSimTracksters" -) - -ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters, ticlMultiClustersFromSimTracksters) - +ticlSimTrackstersTask = cms.Task(filteredLayerClustersSimTracksters, ticlSimTracksters) diff --git a/RecoHGCal/TICL/python/TrkEMStep_cff.py b/RecoHGCal/TICL/python/TrkEMStep_cff.py index 826e194f6f7ff..65d754f0101eb 100644 --- a/RecoHGCal/TICL/python/TrkEMStep_cff.py +++ b/RecoHGCal/TICL/python/TrkEMStep_cff.py @@ -3,7 +3,6 @@ from RecoHGCal.TICL.TICLSeedingRegions_cff import ticlSeedingTrk, ticlSeedingTrkHFNose from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -37,17 +36,9 @@ algo_verbosity = 0, ) - -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersTrkEM = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersTrkEM" -) - ticlTrkEMStepTask = cms.Task(ticlSeedingTrk ,filteredLayerClustersTrkEM - ,ticlTrackstersTrkEM - ,ticlMultiClustersFromTrackstersTrkEM) + ,ticlTrackstersTrkEM) filteredLayerClustersHFNoseTrkEM = filteredLayerClustersTrkEM.clone( LayerClusters = 'hgcalLayerClustersHFNose', diff --git a/RecoHGCal/TICL/python/TrkStep_cff.py b/RecoHGCal/TICL/python/TrkStep_cff.py index 2529264542862..b24737bb2adcc 100644 --- a/RecoHGCal/TICL/python/TrkStep_cff.py +++ b/RecoHGCal/TICL/python/TrkStep_cff.py @@ -4,7 +4,6 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer as _ticlLayerTileProducer from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer # CLUSTER FILTERING/MASKING @@ -35,15 +34,8 @@ itername = "Trk" ) -# MULTICLUSTERS - -ticlMultiClustersFromTrackstersTrk = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersTrk" -) - ticlTrkStepTask = cms.Task(ticlSeedingTrk ,filteredLayerClustersTrk - ,ticlTrackstersTrk - ,ticlMultiClustersFromTrackstersTrk) + ,ticlTrackstersTrk) diff --git a/RecoHGCal/TICL/python/iterativeTICL_cff.py b/RecoHGCal/TICL/python/iterativeTICL_cff.py index 7ea82224b5611..0fd86d3c70ff1 100644 --- a/RecoHGCal/TICL/python/iterativeTICL_cff.py +++ b/RecoHGCal/TICL/python/iterativeTICL_cff.py @@ -9,15 +9,11 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer as _pfTICLProducer from RecoHGCal.TICL.trackstersMergeProducer_cfi import trackstersMergeProducer as _trackstersMergeProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer as _multiClustersFromTrackstersProducer ticlLayerTileTask = cms.Task(ticlLayerTileProducer) ticlTrackstersMerge = _trackstersMergeProducer.clone() -ticlMultiClustersFromTrackstersMerge = _multiClustersFromTrackstersProducer.clone( - Tracksters = "ticlTrackstersMerge" -) -ticlTracksterMergeTask = cms.Task(ticlTrackstersMerge, ticlMultiClustersFromTrackstersMerge) +ticlTracksterMergeTask = cms.Task(ticlTrackstersMerge) pfTICL = _pfTICLProducer.clone() diff --git a/RecoHGCal/TICL/python/ticl_iterations.py b/RecoHGCal/TICL/python/ticl_iterations.py index 6266c07807603..61b7cfbe8ecb4 100644 --- a/RecoHGCal/TICL/python/ticl_iterations.py +++ b/RecoHGCal/TICL/python/ticl_iterations.py @@ -14,7 +14,6 @@ from RecoHGCal.TICL.ticlLayerTileProducer_cfi import ticlLayerTileProducer from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer -from RecoHGCal.TICL.multiClustersFromTrackstersProducer_cfi import multiClustersFromTrackstersProducer from RecoHGCal.TICL.ticlCandidateFromTrackstersProducer_cfi import ticlCandidateFromTrackstersProducer from RecoHGCal.TICL.pfTICLProducer_cfi import pfTICLProducer from Validation.HGCalValidation.ticlPFValidationDefault_cfi import ticlPFValidationDefault as ticlPFValidation @@ -22,7 +21,7 @@ ## withReco: requires full reco of the event to run this part ## i.e. collections of generalTracks can be accessed def TICL_iterations_withReco(process): - process.FEVTDEBUGHLTEventContent.outputCommands.extend(['keep *_multiClustersFromTracksters*_*_*', + process.FEVTDEBUGHLTEventContent.outputCommands.extend([ 'keep *_ticlCandidateFromTrackstersProducer*_*_*', 'keep *_pfTICLProducer*_*_*']) @@ -47,11 +46,6 @@ def TICL_iterations_withReco(process): min_cos_pointing = 0.9 ) - process.multiClustersFromTrackstersTrk = multiClustersFromTrackstersProducer.clone( - label = "TrkMultiClustersFromTracksterByCA", - Tracksters = "trackstersTrk" - ) - process.ticlSeedingGlobal = ticlSeedingRegionProducer.clone( algoId = 2 ) @@ -73,11 +67,6 @@ def TICL_iterations_withReco(process): out_in_dfs = False, ) - process.multiClustersFromTrackstersMIP = multiClustersFromTrackstersProducer.clone( - label = "MIPMultiClustersFromTracksterByCA", - Tracksters = "trackstersMIP" - ) - process.filteredLayerClusters = filteredLayerClustersProducer.clone( clusterFilter = "ClusterFilterByAlgoAndSize", min_cluster_size = 2, @@ -97,11 +86,6 @@ def TICL_iterations_withReco(process): min_cos_pointing = 0.9 # ~26 degrees ) - process.multiClustersFromTrackstersEM = multiClustersFromTrackstersProducer.clone( - Tracksters = "trackstersEM" - ) - - process.trackstersHAD = trackstersProducer.clone( filtered_mask = "filteredLayerClusters:algo8", seeding_regions = "ticlSeedingGlobal", @@ -111,10 +95,6 @@ def TICL_iterations_withReco(process): min_cos_pointing = 0.7 ) - process.multiClustersFromTrackstersHAD = multiClustersFromTrackstersProducer.clone( - Tracksters = "trackstersHAD" - ) - process.ticlCandidateFromTrackstersProducer = ticlCandidateFromTrackstersProducer.clone() process.pfTICLProducer = pfTICLProducer.clone() @@ -125,16 +105,12 @@ def TICL_iterations_withReco(process): process.ticlSeedingTrk, process.filteredLayerClustersTrk, process.trackstersTrk, - process.multiClustersFromTrackstersTrk, process.ticlSeedingGlobal, process.filteredLayerClustersMIP, process.trackstersMIP, - process.multiClustersFromTrackstersMIP, process.filteredLayerClusters, process.trackstersEM, - process.multiClustersFromTrackstersEM, process.trackstersHAD, - process.multiClustersFromTrackstersHAD, process.ticlCandidateFromTrackstersProducer, process.pfTICLProducer) @@ -154,8 +130,6 @@ def TICL_iterations_withReco(process): ## TICL_iterations: to be run with local HGCAL reco only ## i.e. collections of generalTracks (track-seeded iteration) NOT available def TICL_iterations(process): - process.FEVTDEBUGHLTEventContent.outputCommands.extend(['keep *_multiClustersFromTracksters*_*_*']) - process.ticlLayerTileProducer = ticlLayerTileProducer.clone() process.ticlSeedingGlobal = ticlSeedingRegionProducer.clone( @@ -177,11 +151,6 @@ def TICL_iterations(process): min_cos_theta = 0.99, # ~10 degrees ) - process.multiClustersFromTrackstersMIP = multiClustersFromTrackstersProducer.clone( - label = "MIPMultiClustersFromTracksterByCA", - Tracksters = "trackstersMIP" - ) - process.filteredLayerClusters = filteredLayerClustersProducer.clone( clusterFilter = "ClusterFilterByAlgoAndSize", min_cluster_size = 2, @@ -199,10 +168,6 @@ def TICL_iterations(process): min_cos_pointing = 0.7 ) - process.multiClustersFromTracksters = multiClustersFromTrackstersProducer.clone( - Tracksters = "tracksters" - ) - process.HGCalUncalibRecHit = HGCalUncalibRecHit process.HGCalRecHit = HGCalRecHit process.hgcalLayerClusters = hgcalLayerClusters @@ -214,10 +179,8 @@ def TICL_iterations(process): process.ticlLayerTileProducer, process.ticlSeedingGlobal, process.trackstersMIP, - process.multiClustersFromTrackstersMIP, process.filteredLayerClusters, process.tracksters, - process.multiClustersFromTracksters, process.hgcalMultiClusters) process.schedule = cms.Schedule(process.raw2digi_step,process.FEVTDEBUGHLToutput_step) process.schedule.associate(process.TICL_Task) From 4090b49a0a16d96fe92cdcebff8f0988c84e4718 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Wed, 21 Apr 2021 10:34:46 +0200 Subject: [PATCH 016/309] code-format --- .../interface/HGVHistoProducerAlgo.h | 16 +- .../HGCalValidation/plugins/HGCalValidator.cc | 4 +- .../src/HGVHistoProducerAlgo.cc | 154 +++++++++--------- 3 files changed, 84 insertions(+), 90 deletions(-) diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index a41eec1bf5087..b31e22510fd32 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -300,14 +300,14 @@ class HGVHistoProducerAlgo { const hgcal::SimToRecoCollectionWithSimClusters& simRecColl) const; void fill_cluster_histos(const Histograms& histograms, int count, const reco::CaloCluster& cluster) const; void fill_trackster_histos(const Histograms& histograms, - int count, - const ticl::TracksterCollection& Tracksters, - const reco::CaloClusterCollection& layerClusters, - std::vector const& cP, - std::vector const& cPIndices, - std::vector const& cPSelectedIndices, - std::unordered_map const&, - unsigned int layers) const; + int count, + const ticl::TracksterCollection& Tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector const& cP, + std::vector const& cPIndices, + std::vector const& cPSelectedIndices, + std::unordered_map const&, + unsigned int layers) const; double distance2(const double x1, const double y1, const double x2, const double y2) const; double distance(const double x1, const double y1, const double x2, const double y2) const; diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index 6f7c44243d1ba..e21e94739951a 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -338,8 +338,8 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, simRecColl); //General Info on simClusters - LogTrace("HGCalValidator") << "\n# of SimClusters: " << nSimClusters << ", layerClusters mask label: " - << label_clustersmask[ws].label() << "\n"; + LogTrace("HGCalValidator") << "\n# of SimClusters: " << nSimClusters + << ", layerClusters mask label: " << label_clustersmask[ws].label() << "\n"; } //end of loop overs masks } diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 8efaa56665c4f..44c71133d94dd 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -668,12 +668,12 @@ void HGVHistoProducerAlgo::bookClusterHistos_ClusterLevel(DQMStore::IBooker& ibo nintTotNClsperlay_, minTotNClsperlay_, maxTotNClsperlay_); - histograms.h_energyclustered_perlayer[ilayer] = - ibook.book1D("energyclustered_perlayer" + istr1, - "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2, - nintEneClperlay_, - minEneClperlay_, - maxEneClperlay_); + histograms.h_energyclustered_perlayer[ilayer] = ibook.book1D( + "energyclustered_perlayer" + istr1, + "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2, + nintEneClperlay_, + minEneClperlay_, + maxEneClperlay_); } //--------------------------------------------------------------------------------------------------------------------------- @@ -963,9 +963,7 @@ void HGVHistoProducerAlgo::bookClusterHistos_CellLevel(DQMStore::IBooker& ibook, } //---------------------------------------------------------------------------------------------------------------------------- -void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, - Histograms& histograms, - unsigned int layers) { +void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, Histograms& histograms, unsigned int layers) { histograms.h_score_trackster2caloparticle.push_back(ibook.book1D( "Score_trackster2caloparticle", "Score of Trackster per CaloParticle", nintScore_, minScore_, maxScore_)); histograms.h_score_caloparticle2trackster.push_back(ibook.book1D( @@ -992,14 +990,14 @@ void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, //back to all Tracksters histograms.h_num_trackster_eta.push_back( ibook.book1D("Num_Trackster_Eta", "Num Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); - histograms.h_numMerge_trackster_eta.push_back(ibook.book1D( - "NumMerge_Trackster_Eta", "Num Merge Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); + histograms.h_numMerge_trackster_eta.push_back( + ibook.book1D("NumMerge_Trackster_Eta", "Num Merge Trackster Eta per Trackster ", nintEta_, minEta_, maxEta_)); histograms.h_denom_trackster_eta.push_back( ibook.book1D("Denom_Trackster_Eta", "Denom Trackster Eta per Trackster", nintEta_, minEta_, maxEta_)); histograms.h_num_trackster_phi.push_back( ibook.book1D("Num_Trackster_Phi", "Num Trackster Phi per Trackster ", nintPhi_, minPhi_, maxPhi_)); - histograms.h_numMerge_trackster_phi.push_back(ibook.book1D( - "NumMerge_Trackster_Phi", "Num Merge Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); + histograms.h_numMerge_trackster_phi.push_back( + ibook.book1D("NumMerge_Trackster_Phi", "Num Merge Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); histograms.h_denom_trackster_phi.push_back( ibook.book1D("Denom_Trackster_Phi", "Denom Trackster Phi per Trackster", nintPhi_, minPhi_, maxPhi_)); histograms.h_sharedenergy_trackster2caloparticle.push_back( @@ -1024,12 +1022,11 @@ void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, maxPhi_, minTSTSharedEneFrac_, maxTSTSharedEneFrac_)); - histograms.h_sharedenergy_caloparticle2trackster.push_back( - ibook.book1D("SharedEnergy_caloparticle2trackster", - "Shared Energy of CaloParticle per Trackster", - nintSharedEneFrac_, - minTSTSharedEneFrac_, - maxTSTSharedEneFrac_)); + histograms.h_sharedenergy_caloparticle2trackster.push_back(ibook.book1D("SharedEnergy_caloparticle2trackster", + "Shared Energy of CaloParticle per Trackster", + nintSharedEneFrac_, + minTSTSharedEneFrac_, + maxTSTSharedEneFrac_)); histograms.h_sharedenergy_caloparticle2trackster_assoc.push_back( ibook.book1D("SharedEnergy_caloparticle2trackster_assoc", "Shared Energy of Associated CaloParticle per Trackster", @@ -1082,12 +1079,11 @@ void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, istr2 = std::to_string(ilayer - (layers - 1)) + " in z+"; } - clusternum_in_trackster_perlayer[ilayer] = - ibook.book1D("clusternum_in_trackster_perlayer" + istr1, - "Number of layer clusters in Trackster for layer " + istr2, - nintTotNClsinTSTsperlayer_, - minTotNClsinTSTsperlayer_, - maxTotNClsinTSTsperlayer_); + clusternum_in_trackster_perlayer[ilayer] = ibook.book1D("clusternum_in_trackster_perlayer" + istr1, + "Number of layer clusters in Trackster for layer " + istr2, + nintTotNClsinTSTsperlayer_, + minTotNClsinTSTsperlayer_, + maxTotNClsinTSTsperlayer_); } histograms.h_clusternum_in_trackster_perlayer.push_back(std::move(clusternum_in_trackster_perlayer)); @@ -1095,23 +1091,20 @@ void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, histograms.h_tracksternum.push_back( ibook.book1D("tottracksternum", "total number of Tracksters", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_)); - histograms.h_conttracksternum.push_back(ibook.book1D("conttracksternum", - "number of Tracksters with 3 contiguous layers", + histograms.h_conttracksternum.push_back(ibook.book1D( + "conttracksternum", "number of Tracksters with 3 contiguous layers", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_)); + + histograms.h_nonconttracksternum.push_back(ibook.book1D("nonconttracksternum", + "number of Tracksters without 3 contiguous layers", nintTotNTSTs_, minTotNTSTs_, maxTotNTSTs_)); - histograms.h_nonconttracksternum.push_back(ibook.book1D("nonconttracksternum", - "number of Tracksters without 3 contiguous layers", - nintTotNTSTs_, - minTotNTSTs_, - maxTotNTSTs_)); - histograms.h_clusternum_in_trackster.push_back(ibook.book1D("clusternum_in_trackster", - "total number of layer clusters in Trackster", - nintTotNClsinTSTs_, - minTotNClsinTSTs_, - maxTotNClsinTSTs_)); + "total number of layer clusters in Trackster", + nintTotNClsinTSTs_, + minTotNClsinTSTs_, + maxTotNClsinTSTs_)); histograms.h_clusternum_in_trackster_vs_layer.push_back( ibook.bookProfile("clusternum_in_trackster_vs_layer", @@ -1181,26 +1174,22 @@ void HGVHistoProducerAlgo::bookTracksterHistos(DQMStore::IBooker& ibook, minClEnepermultiplicity_, maxClEnepermultiplicity_)); - histograms.h_trackster_pt.push_back( - ibook.book1D("trackster_pt", "Pt of the Trackster", nintPt_, minPt_, maxPt_)); + histograms.h_trackster_pt.push_back(ibook.book1D("trackster_pt", "Pt of the Trackster", nintPt_, minPt_, maxPt_)); histograms.h_trackster_eta.push_back( ibook.book1D("trackster_eta", "Eta of the Trackster", nintEta_, minEta_, maxEta_)); histograms.h_trackster_phi.push_back( ibook.book1D("trackster_phi", "Phi of the Trackster", nintPhi_, minPhi_, maxPhi_)); histograms.h_trackster_energy.push_back( ibook.book1D("trackster_energy", "Energy of the Trackster", nintEne_, minEne_, maxEne_)); - histograms.h_trackster_x.push_back( - ibook.book1D("trackster_x", "X position of the Trackster", nintX_, minX_, maxX_)); - histograms.h_trackster_y.push_back( - ibook.book1D("trackster_y", "Y position of the Trackster", nintY_, minY_, maxY_)); - histograms.h_trackster_z.push_back( - ibook.book1D("trackster_z", "Z position of the Trackster", nintZ_, minZ_, maxZ_)); + histograms.h_trackster_x.push_back(ibook.book1D("trackster_x", "X position of the Trackster", nintX_, minX_, maxX_)); + histograms.h_trackster_y.push_back(ibook.book1D("trackster_y", "Y position of the Trackster", nintY_, minY_, maxY_)); + histograms.h_trackster_z.push_back(ibook.book1D("trackster_z", "Z position of the Trackster", nintZ_, minZ_, maxZ_)); histograms.h_trackster_firstlayer.push_back( ibook.book1D("trackster_firstlayer", "First layer of the Trackster", 2 * layers, 0., (float)2 * layers)); histograms.h_trackster_lastlayer.push_back( ibook.book1D("trackster_lastlayer", "Last layer of the Trackster", 2 * layers, 0., (float)2 * layers)); - histograms.h_trackster_layersnum.push_back(ibook.book1D( - "trackster_layersnum", "Number of layers of the Trackster", 2 * layers, 0., (float)2 * layers)); + histograms.h_trackster_layersnum.push_back( + ibook.book1D("trackster_layersnum", "Number of layers of the Trackster", 2 * layers, 0., (float)2 * layers)); } void HGVHistoProducerAlgo::fill_info_histos(const Histograms& histograms, unsigned int layers) const { @@ -2202,8 +2191,8 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr histograms.h_distancebetseedandmaxcell_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax); } if (histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)) { - histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill( - distancebetseedandmax, clusters[lcId].energy()); + histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax, + clusters[lcId].energy()); } //Energy clustered per layer @@ -2275,14 +2264,14 @@ void HGVHistoProducerAlgo::fill_generic_cluster_histos(const Histograms& histogr } void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histograms, - int count, - const ticl::TracksterCollection& tracksters, - const reco::CaloClusterCollection& layerClusters, - std::vector const& cP, - std::vector const& cPIndices, - std::vector const& cPSelectedIndices, - std::unordered_map const& hitMap, - unsigned int layers) const { + int count, + const ticl::TracksterCollection& tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector const& cP, + std::vector const& cPIndices, + std::vector const& cPSelectedIndices, + std::unordered_map const& hitMap, + unsigned int layers) const { auto nTracksters = tracksters.size(); //Consider CaloParticles coming from the hard scatterer, excluding the PU contribution. auto nCaloParticles = cPIndices.size(); @@ -2382,7 +2371,8 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { for (const auto lcId : tracksters[tstId].vertices()) { const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - if (hits_and_fractions.empty()) continue; + if (hits_and_fractions.empty()) + continue; std::unordered_map CPEnergyInTST; int maxCPId_byNumberOfHits = -1; @@ -2565,12 +2555,13 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr << std::setw(25) << energyFractionOfCPinTST << std::endl; } //end of loop through Trackster's layerClusters - } //end of loop through Tracksters + } //end of loop through Tracksters //Loop through Tracksters for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { for (const auto lcId : tracksters[tstId].vertices()) { const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - if (hits_and_fractions.empty()) continue; + if (hits_and_fractions.empty()) + continue; // find the unique CaloParticles id contributing to the Tracksters //cpsInTrackster[trackster][CPids] std::sort(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); @@ -2582,8 +2573,8 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr for (auto& cpPair : cpsInTrackster[tstId]) { //In case of a Trackster with zero energy but related CaloParticles the score is set to 1. cpPair.second = 1.; - LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first - << "\t score \t" << cpPair.second << std::endl; + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" + << cpPair.second << std::endl; histograms.h_score_trackster2caloparticle[count]->Fill(cpPair.second); } continue; @@ -2656,7 +2647,7 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; if (cpPair.first == score->first) { histograms.h_sharedenergy_trackster2caloparticle[count]->Fill(sharedeneCPallLayers / - tracksters[tstId].raw_energy()); + tracksters[tstId].raw_energy()); histograms.h_energy_vs_score_trackster2caloparticle[count]->Fill( score->second, sharedeneCPallLayers / tracksters[tstId].raw_energy()); } @@ -2666,7 +2657,7 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr [](const auto& obj) { return obj.second < ScoreCutTSTtoCPFakeMerge_; }); tracksters_fakemerge[tstId] = assocFakeMerge; } //end of loop through Trackster's layerClusters - } //end of loop through Tracksters + } //end of loop through Tracksters std::unordered_map> score3d; std::unordered_map> tstSharedEnergy; @@ -2813,7 +2804,7 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr histograms.h_sharedenergy_caloparticle2trackster[count]->Fill(tstSharedEnergyFrac[cpId][tstId]); histograms.h_energy_vs_score_caloparticle2trackster[count]->Fill(score3d[cpId][tstId], - tstSharedEnergyFrac[cpId][tstId]); + tstSharedEnergyFrac[cpId][tstId]); } //end of loop through Tracksters auto is_assoc = [&](const auto& v) -> bool { return v < ScoreCutCPtoTSTEffDup_; }; @@ -2826,10 +2817,10 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr auto best = std::min_element(std::begin(score3d[cpId]), std::end(score3d[cpId])); auto bestTstId = std::distance(std::begin(score3d[cpId]), best); - histograms.h_sharedenergy_caloparticle2trackster_vs_eta[count]->Fill(cP[cpId].g4Tracks()[0].momentum().eta(), - tracksters[bestTstId].raw_energy() / CPenergy); - histograms.h_sharedenergy_caloparticle2trackster_vs_phi[count]->Fill(cP[cpId].g4Tracks()[0].momentum().phi(), - tracksters[bestTstId].raw_energy() / CPenergy); + histograms.h_sharedenergy_caloparticle2trackster_vs_eta[count]->Fill( + cP[cpId].g4Tracks()[0].momentum().eta(), tracksters[bestTstId].raw_energy() / CPenergy); + histograms.h_sharedenergy_caloparticle2trackster_vs_phi[count]->Fill( + cP[cpId].g4Tracks()[0].momentum().phi(), tracksters[bestTstId].raw_energy() / CPenergy); histograms.h_sharedenergy_caloparticle2trackster_assoc[count]->Fill(tstSharedEnergyFrac[cpId][bestTstId]); } if (assocDup >= 2) { @@ -2850,7 +2841,8 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { for (const auto lcId : tracksters[tstId].vertices()) { const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - if (hits_and_fractions.empty()) continue; + if (hits_and_fractions.empty()) + continue; auto assocFakeMerge = tracksters_fakemerge[tstId]; auto assocDuplicate = tracksters_duplicate[tstId]; if (assocDuplicate) { @@ -2887,14 +2879,14 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } void HGVHistoProducerAlgo::fill_trackster_histos(const Histograms& histograms, - int count, - const ticl::TracksterCollection& tracksters, - const reco::CaloClusterCollection& layerClusters, - std::vector const& cP, - std::vector const& cPIndices, - std::vector const& cPSelectedIndices, - std::unordered_map const& hitMap, - unsigned int layers) const { + int count, + const ticl::TracksterCollection& tracksters, + const reco::CaloClusterCollection& layerClusters, + std::vector const& cP, + std::vector const& cPIndices, + std::vector const& cPSelectedIndices, + std::unordered_map const& hitMap, + unsigned int layers) const { //Each event to be treated as two events: //an event in +ve endcap, plus another event in -ve endcap. @@ -3044,7 +3036,8 @@ void HGVHistoProducerAlgo::fill_trackster_histos(const Histograms& histograms, histograms.h_multiplicity_zplus_numberOfEventsHistogram[count]->Fill(mlp); } //For the cluster multiplicity vs cluster energy - histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy[count]->Fill(mlp, layerClusters[tracksters[tstId].vertices(lc)].energy()); + histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy[count]->Fill( + mlp, layerClusters[tracksters[tstId].vertices(lc)].energy()); } if (!trackster_layers.empty()) { @@ -3069,7 +3062,8 @@ void HGVHistoProducerAlgo::fill_trackster_histos(const Histograms& histograms, histograms.h_conttracksternum[count]->Fill(totNContTstZp + totNContTstZm); histograms.h_nonconttracksternum[count]->Fill(totNNotContTstZp + totNNotContTstZm); - tracksters_to_CaloParticles(histograms, count, tracksters, layerClusters, cP, cPIndices, cPSelectedIndices, hitMap, layers); + tracksters_to_CaloParticles( + histograms, count, tracksters, layerClusters, cP, cPIndices, cPSelectedIndices, hitMap, layers); } double HGVHistoProducerAlgo::distance2(const double x1, From 2a1396070abbd18bf070b6b5b96dc0f459748cfe Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Wed, 21 Apr 2021 12:58:19 +0200 Subject: [PATCH 017/309] Update TICL event content --- .../python/RecoHGCal_EventContent_cff.py | 33 ++++--------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py index 62ae794e85ecc..03da7c185a178 100644 --- a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py +++ b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py @@ -1,38 +1,18 @@ import FWCore.ParameterSet.Config as cms +from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabelsMerge -#AOD content -TICL_AOD = cms.PSet( - # 13/04/2021 Felice: MultiClusters will be deprecated soon - outputCommands = cms.untracked.vstring( - 'keep *_ticlMultiClustersFromTrackstersEM_*_*', - 'keep *_ticlMultiClustersFromTrackstersHAD_*_*', - 'keep *_ticlMultiClustersFromTrackstersTrk_*_*', - 'keep *_ticlMultiClustersFromTrackstersTrkEM_*_*', - 'keep *_ticlMultiClustersFromTrackstersMIP_*_*', - 'keep *_ticlMultiClustersFromTrackstersMerge_*_*', - 'keep *_ticlMultiClustersFromSimTracksters_*_*', - ) - ) +trackstersIters = ['keep *_ticlTracksters'+iteration+'_*_*' for iteration in ticlIterLabelsMerge] +trackstersHFNoseIters = ['keep *_ticlTrackstersHFNose'+iteration+'_*_*' for iteration in ticlIterLabelsMerge] #RECO content TICL_RECO = cms.PSet( outputCommands = cms.untracked.vstring( - 'keep *_ticlTrackstersTrkEM_*_*', - 'keep *_ticlTrackstersEM_*_*', - 'keep *_ticlTrackstersHAD_*_*', - 'keep *_ticlTrackstersTrk_*_*', - 'keep *_ticlTrackstersMIP_*_*', - 'keep *_ticlTrackstersMerge_*_*', - 'keep *_ticlTrackstersHFNoseTrkEM_*_*', - 'keep *_ticlTrackstersHFNoseEM_*_*', - 'keep *_ticlTrackstersHFNoseMIP_*_*', - 'keep *_ticlTrackstersHFNoseHAD_*_*', - 'keep *_ticlTrackstersHFNoseMerge_*_*', - 'keep *_pfTICL_*_*' + trackstersIters + + trackstersHFNoseIters + + ['keep *_pfTICL_*_*'] ) ) -TICL_RECO.outputCommands.extend(TICL_AOD.outputCommands) # FEVT Content TICL_FEVT = cms.PSet( @@ -41,4 +21,3 @@ ) ) TICL_FEVT.outputCommands.extend(TICL_RECO.outputCommands) - From 38e23c7ef3b4e30a9cb3f96c45b4f3eaaa064e11 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Wed, 21 Apr 2021 13:03:51 +0200 Subject: [PATCH 018/309] Propagate event content update --- Configuration/EventContent/python/EventContent_cff.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Configuration/EventContent/python/EventContent_cff.py b/Configuration/EventContent/python/EventContent_cff.py index 15c2f93f807fb..87ae7a359c8e0 100644 --- a/Configuration/EventContent/python/EventContent_cff.py +++ b/Configuration/EventContent/python/EventContent_cff.py @@ -278,8 +278,6 @@ def SwapKeepAndDrop(l): ctpps.toModify(AODEventContent, outputCommands = AODEventContent.outputCommands + RecoCTPPSAOD.outputCommands) -phase2_hgcal.toModify(AODEventContent, - outputCommands = AODEventContent.outputCommands + TICL_AOD.outputCommands) # # # RAWAOD Data Tier definition From 1432d97bd6053de237e7ed9b1cfb187462d54674 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Thu, 22 Apr 2021 02:11:45 +0200 Subject: [PATCH 019/309] For header check --- FWCore/Utilities/interface/zero_allocator.h | 1 + 1 file changed, 1 insertion(+) diff --git a/FWCore/Utilities/interface/zero_allocator.h b/FWCore/Utilities/interface/zero_allocator.h index 38342636d747f..10158cde33890 100644 --- a/FWCore/Utilities/interface/zero_allocator.h +++ b/FWCore/Utilities/interface/zero_allocator.h @@ -17,6 +17,7 @@ */ #include "tbb/tbb_allocator.h" +#include namespace edm { template class Allocator = tbb::tbb_allocator> From c5b089ffd4cd9ebcca38c04960c78cfeeea197f1 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Thu, 22 Apr 2021 18:50:30 +0200 Subject: [PATCH 020/309] Update PostProcessor --- .../python/HGCalPostProcessor_cff.py | 4 +-- .../python/PostProcessorHGCAL_cfi.py | 26 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py b/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py index 10b1a27c50bf8..d87f588a30a75 100644 --- a/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py +++ b/Validation/HGCalValidation/python/HGCalPostProcessor_cff.py @@ -3,7 +3,7 @@ from Validation.HGCalValidation.HGCalSimHitsClient_cff import * from Validation.HGCalValidation.HGCalDigiClient_cff import * from Validation.HGCalValidation.HGCalRecHitsClient_cff import * -from Validation.HGCalValidation.PostProcessorHGCAL_cfi import postProcessorHGCALlayerclusters,postProcessorHGCALsimclusters,postProcessorHGCALmulticlusters +from Validation.HGCalValidation.PostProcessorHGCAL_cfi import postProcessorHGCALlayerclusters,postProcessorHGCALsimclusters,postProcessorHGCALTracksters hgcalPostProcessor = cms.Sequence(hgcalSimHitClientEE + hgcalSimHitClientHEF @@ -18,4 +18,4 @@ hgcalValidatorPostProcessor = cms.Sequence( postProcessorHGCALlayerclusters+ postProcessorHGCALsimclusters+ - postProcessorHGCALmulticlusters) + postProcessorHGCALTracksters) diff --git a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py index c138c5f07aa5d..0eeb62adbc314 100644 --- a/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py +++ b/Validation/HGCalValidation/python/PostProcessorHGCAL_cfi.py @@ -45,21 +45,21 @@ outputFileName = cms.untracked.string(""), verbose = cms.untracked.uint32(4)) -eff_multiclusters = ["effic_eta 'MultiCluster Efficiency vs #eta' Num_CaloParticle_Eta Denom_CaloParticle_Eta"] -eff_multiclusters.extend(["effic_phi 'MultiCluster Efficiency vs #phi' Num_CaloParticle_Phi Denom_CaloParticle_Phi"]) -eff_multiclusters.extend(["duplicate_eta 'MultiCluster Duplicate(Split) Rate vs #eta' NumDup_MultiCluster_Eta Denom_MultiCluster_Eta"]) -eff_multiclusters.extend(["duplicate_phi 'MultiCluster Duplicate(Split) Rate vs #phi' NumDup_MultiCluster_Phi Denom_MultiCluster_Phi"]) -eff_multiclusters.extend(["fake_eta 'MultiCluster Fake Rate vs #eta' Num_MultiCluster_Eta Denom_MultiCluster_Eta fake"]) -eff_multiclusters.extend(["fake_phi 'MultiCluster Fake Rate vs #phi' Num_MultiCluster_Phi Denom_MultiCluster_Phi fake"]) -eff_multiclusters.extend(["merge_eta 'MultiCluster Merge Rate vs #eta' NumMerge_MultiCluster_Eta Denom_MultiCluster_Eta"]) -eff_multiclusters.extend(["merge_phi 'MultiCluster Merge Rate vs #phi' NumMerge_MultiCluster_Phi Denom_MultiCluster_Phi"]) +eff_tracksters = ["effic_eta 'Trackster Efficiency vs #eta' Num_CaloParticle_Eta Denom_CaloParticle_Eta"] +eff_tracksters.extend(["effic_phi 'Trackster Efficiency vs #phi' Num_CaloParticle_Phi Denom_CaloParticle_Phi"]) +eff_tracksters.extend(["duplicate_eta 'Trackster Duplicate(Split) Rate vs #eta' NumDup_Trackster_Eta Denom_Trackster_Eta"]) +eff_tracksters.extend(["duplicate_phi 'Trackster Duplicate(Split) Rate vs #phi' NumDup_Trackster_Phi Denom_Trackster_Phi"]) +eff_tracksters.extend(["fake_eta 'Trackster Fake Rate vs #eta' Num_Trackster_Eta Denom_Trackster_Eta fake"]) +eff_tracksters.extend(["fake_phi 'Trackster Fake Rate vs #phi' Num_Trackster_Phi Denom_Trackster_Phi fake"]) +eff_tracksters.extend(["merge_eta 'Trackster Merge Rate vs #eta' NumMerge_Trackster_Eta Denom_Trackster_Eta"]) +eff_tracksters.extend(["merge_phi 'Trackster Merge Rate vs #phi' NumMerge_Trackster_Phi Denom_Trackster_Phi"]) -subdirsMult = ['HGCAL/HGCalValidator/hgcalMultiClusters/','HGCAL/HGCalValidator/ticlMultiClustersFromSimTracksters/'] -subdirsMult.extend('HGCAL/HGCalValidator/ticlMultiClustersFromTracksters'+iteration+'/' for iteration in ticlIterLabelsMerge) +subdirsTracksters = ['HGCAL/HGCalValidator/hgcalTracksters/','HGCAL/HGCalValidator/ticlSimTracksters/'] +subdirsTracksters.extend('HGCAL/HGCalValidator/ticlTracksters'+iteration+'/' for iteration in ticlIterLabelsMerge) -postProcessorHGCALmulticlusters = DQMEDHarvester('DQMGenericClient', - subDirs = cms.untracked.vstring(subdirsMult), - efficiency = cms.vstring(eff_multiclusters), +postProcessorHGCALTracksters = DQMEDHarvester('DQMGenericClient', + subDirs = cms.untracked.vstring(subdirsTracksters), + efficiency = cms.vstring(eff_tracksters), resolution = cms.vstring(), cumulativeDists = cms.untracked.vstring(), noFlowDists = cms.untracked.vstring(), From 6c811a361bcf6c0685a47c8da7d553878f6b60b0 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Thu, 22 Apr 2021 21:10:16 +0200 Subject: [PATCH 021/309] move StdPairHasher to its own header add comments on origin or zero allocator use tbb::global_control::active_value() to get number of threads --- DetectorDescription/Core/interface/DDName.h | 1 + FWCore/Services/plugins/StallMonitor.cc | 1 + FWCore/Utilities/interface/hash_combine.h | 8 -------- FWCore/Utilities/interface/std_pair_hasher.h | 19 +++++++++++++++++++ FWCore/Utilities/interface/zero_allocator.h | 6 ++++++ .../TensorFlow/interface/TBBThreadPool.h | 2 +- 6 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 FWCore/Utilities/interface/std_pair_hasher.h diff --git a/DetectorDescription/Core/interface/DDName.h b/DetectorDescription/Core/interface/DDName.h index 8d9665b153dba..a2fb1414e63b9 100644 --- a/DetectorDescription/Core/interface/DDName.h +++ b/DetectorDescription/Core/interface/DDName.h @@ -6,6 +6,7 @@ #include #include "FWCore/Utilities/interface/hash_combine.h" +#include "FWCore/Utilities/interface/std_pair_hasher.h" #include #include diff --git a/FWCore/Services/plugins/StallMonitor.cc b/FWCore/Services/plugins/StallMonitor.cc index d750de876caa0..6abd2be9be756 100644 --- a/FWCore/Services/plugins/StallMonitor.cc +++ b/FWCore/Services/plugins/StallMonitor.cc @@ -25,6 +25,7 @@ #include "FWCore/Utilities/interface/OStreamColumn.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/Utilities/interface/hash_combine.h" +#include "FWCore/Utilities/interface/std_pair_hasher.h" #include "tbb/concurrent_unordered_map.h" #include diff --git a/FWCore/Utilities/interface/hash_combine.h b/FWCore/Utilities/interface/hash_combine.h index ba8355cf2276e..91786a88e6e36 100644 --- a/FWCore/Utilities/interface/hash_combine.h +++ b/FWCore/Utilities/interface/hash_combine.h @@ -39,14 +39,6 @@ namespace edm { return seed; } - struct StdPairHasher { - std::size_t operator()(const std::pair& a) const noexcept { - return edm::hash_value(a.first, a.second); - } - std::size_t operator()(const std::pair& a) const noexcept { - return edm::hash_value(a.first, a.second); - } - }; } // namespace edm #endif diff --git a/FWCore/Utilities/interface/std_pair_hasher.h b/FWCore/Utilities/interface/std_pair_hasher.h new file mode 100644 index 0000000000000..fbc100615d21d --- /dev/null +++ b/FWCore/Utilities/interface/std_pair_hasher.h @@ -0,0 +1,19 @@ +#ifndef FWCore_Utilities_std_pair_hasher_h +#define FWCore_Utilities_std_pair_hasher_h +/* + tbb::hash was changed to used std::hash which does not have an implementation for std::pair. + This hasher is taken from the boost::hash implementation. +*/ +#include "FWCore/Utilities/interface/zero_allocator.h" + +namespace edm { + struct StdPairHasher { + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first, a.second); + } + std::size_t operator()(const std::pair& a) const noexcept { + return edm::hash_value(a.first, a.second); + } + }; +} // namespace edm +#endif diff --git a/FWCore/Utilities/interface/zero_allocator.h b/FWCore/Utilities/interface/zero_allocator.h index 10158cde33890..85dbfaf87a67a 100644 --- a/FWCore/Utilities/interface/zero_allocator.h +++ b/FWCore/Utilities/interface/zero_allocator.h @@ -19,6 +19,12 @@ #include "tbb/tbb_allocator.h" #include +/* Copied from tbb_2020 branch's tbb/tbb_allocator linked here + https://github.com/oneapi-src/oneTBB/blob/tbb_2020/include/tbb/tbb_allocator.h + and renamed to edm namespace because it was removed from oneapi_2021 branch's + tbb/tbb_allocator. + */ + namespace edm { template class Allocator = tbb::tbb_allocator> class zero_allocator : public Allocator { diff --git a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h index 19162c4c6ac59..4011da08b61ea 100644 --- a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h +++ b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h @@ -27,7 +27,7 @@ namespace tensorflow { } explicit TBBThreadPool(int nThreads = -1) - : nThreads_(nThreads > 0 ? nThreads : tbb::global_control::max_allowed_parallelism), numScheduleCalled_(0) { + : nThreads_(nThreads > 0 ? nThreads : tbb::global_control::active_value(tbb::global_control::max_allowed_parallelism)), numScheduleCalled_(0) { // when nThreads is zero or smaller, use the default value determined by tbb } From 7cd3a33eb2116233d4846bd5291fd157b09cb580 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Thu, 22 Apr 2021 21:53:46 +0200 Subject: [PATCH 022/309] code-format --- PhysicsTools/TensorFlow/interface/TBBThreadPool.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h index 4011da08b61ea..dceada3b0f199 100644 --- a/PhysicsTools/TensorFlow/interface/TBBThreadPool.h +++ b/PhysicsTools/TensorFlow/interface/TBBThreadPool.h @@ -27,7 +27,9 @@ namespace tensorflow { } explicit TBBThreadPool(int nThreads = -1) - : nThreads_(nThreads > 0 ? nThreads : tbb::global_control::active_value(tbb::global_control::max_allowed_parallelism)), numScheduleCalled_(0) { + : nThreads_(nThreads > 0 ? nThreads + : tbb::global_control::active_value(tbb::global_control::max_allowed_parallelism)), + numScheduleCalled_(0) { // when nThreads is zero or smaller, use the default value determined by tbb } From 16d519e74effec33f26f084051cd990fd0f63f1a Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Fri, 23 Apr 2021 10:59:50 +0200 Subject: [PATCH 023/309] Account for LC multiplicity --- .../plugins/PFClusterFromHGCalTrackster.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc index 040289e9af36b..93f0a4188050b 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc @@ -25,9 +25,7 @@ void PFClusterFromHGCalTrackster::buildClusters(const edm::Handle > hitsAndFractions; - for (const auto lcId : tst.vertices()) { - const auto& hAndF_temp = clusters[lcId].hitsAndFractions(); - hitsAndFractions.insert(hitsAndFractions.end(), hAndF_temp.begin(), hAndF_temp.end()); + for (uint8_t lcId = 0; lcId < tst.vertices().size(); ++lcId) { + const auto fraction = 1.f / tst.vertex_multiplicity(lcId); + for (const auto& cell : clusters[tst.vertices(lcId)].hitsAndFractions()) { + hitsAndFractions.emplace_back(cell.first, cell.second * fraction); + } } for (const auto& hAndF : hitsAndFractions) { From fc73f05bb299c078fd9f1cafd4bb60d4175f76df Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Fri, 23 Apr 2021 11:11:09 +0200 Subject: [PATCH 024/309] Placeholder for TICL_AOD content --- Configuration/EventContent/python/EventContent_cff.py | 2 ++ .../Configuration/python/RecoHGCal_EventContent_cff.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Configuration/EventContent/python/EventContent_cff.py b/Configuration/EventContent/python/EventContent_cff.py index 87ae7a359c8e0..15c2f93f807fb 100644 --- a/Configuration/EventContent/python/EventContent_cff.py +++ b/Configuration/EventContent/python/EventContent_cff.py @@ -278,6 +278,8 @@ def SwapKeepAndDrop(l): ctpps.toModify(AODEventContent, outputCommands = AODEventContent.outputCommands + RecoCTPPSAOD.outputCommands) +phase2_hgcal.toModify(AODEventContent, + outputCommands = AODEventContent.outputCommands + TICL_AOD.outputCommands) # # # RAWAOD Data Tier definition diff --git a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py index 03da7c185a178..e2e98bc00f52b 100644 --- a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py +++ b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py @@ -5,6 +5,11 @@ trackstersIters = ['keep *_ticlTracksters'+iteration+'_*_*' for iteration in ticlIterLabelsMerge] trackstersHFNoseIters = ['keep *_ticlTrackstersHFNose'+iteration+'_*_*' for iteration in ticlIterLabelsMerge] +#AOD content +TICL_AOD = cms.PSet( + outputCommands = cms.untracked.vstring() + ) + #RECO content TICL_RECO = cms.PSet( outputCommands = cms.untracked.vstring( @@ -13,6 +18,7 @@ ['keep *_pfTICL_*_*'] ) ) +TICL_RECO.outputCommands.extend(TICL_AOD.outputCommands) # FEVT Content TICL_FEVT = cms.PSet( From be53292bb96b7030a0b679e7937ad799c2f8281a Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Fri, 23 Apr 2021 11:35:41 +0200 Subject: [PATCH 025/309] Fix name typo --- Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h | 2 +- Validation/HGCalValidation/plugins/HGCalValidator.cc | 2 +- Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h index b31e22510fd32..7552fa82b2674 100644 --- a/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h +++ b/Validation/HGCalValidation/interface/HGVHistoProducerAlgo.h @@ -286,7 +286,7 @@ class HGVHistoProducerAlgo { std::vector const& simClusters, unsigned int layers, std::vector thicknesses) const; - void fill_simClusterassosiation_histos(const Histograms& histograms, + void fill_simClusterAssociation_histos(const Histograms& histograms, int count, edm::Handle clusterHandle, const reco::CaloClusterCollection& clusters, diff --git a/Validation/HGCalValidation/plugins/HGCalValidator.cc b/Validation/HGCalValidation/plugins/HGCalValidator.cc index e21e94739951a..a44dad1b64e3e 100644 --- a/Validation/HGCalValidation/plugins/HGCalValidator.cc +++ b/Validation/HGCalValidation/plugins/HGCalValidator.cc @@ -324,7 +324,7 @@ void HGCalValidator::dqmAnalyze(const edm::Event& event, event.getByToken(associatorMapRtSim, recotosimCollectionH); auto recSimColl = *recotosimCollectionH; - histoProducerAlgo_->fill_simClusterassosiation_histos(histograms.histoProducerAlgo, + histoProducerAlgo_->fill_simClusterAssociation_histos(histograms.histoProducerAlgo, ws, clusterHandle, clusters, diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 44c71133d94dd..7d20af3b1204b 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -1444,7 +1444,7 @@ void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simCluster_histos(const Hi histograms.h_mixedhitssimcluster_zminus->Fill(tnscpthminus["mixed"]); } -void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simClusterassosiation_histos( +void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simClusterAssociation_histos( const Histograms& histograms, int count, edm::Handle clusterHandle, From 14218f27ffa7a3f2e68e4a3302783b14ecbee0cf Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski Date: Fri, 23 Apr 2021 12:13:12 +0200 Subject: [PATCH 026/309] fix era modification --- PhysicsTools/NanoAOD/python/taus_cff.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 7dfbcd54fc926..ce5ebf105f6e7 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -155,11 +155,13 @@ def _tauId8WPMask(pattern,doc): run2_miniAOD_80XLegacy.toModify(tauTable, variables = _variables80X ) -for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ +for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv2, \ run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: era.toModify(tauTable, variables = cms.PSet(tauTable.variables, _mvaAntiEVars, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2) ) +for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ + run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: era.toModify(tauTable.variables, rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw2018')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category2018')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), From d9ee90399c0c87974704dd70207a17c2b748a7a0 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Fri, 23 Apr 2021 12:43:40 +0200 Subject: [PATCH 027/309] Decouple HFNose event content --- .../Configuration/python/RecoHGCal_EventContent_cff.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py index e2e98bc00f52b..55d60d58037c1 100644 --- a/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py +++ b/RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py @@ -3,7 +3,6 @@ from RecoHGCal.TICL.iterativeTICL_cff import ticlIterLabelsMerge trackstersIters = ['keep *_ticlTracksters'+iteration+'_*_*' for iteration in ticlIterLabelsMerge] -trackstersHFNoseIters = ['keep *_ticlTrackstersHFNose'+iteration+'_*_*' for iteration in ticlIterLabelsMerge] #AOD content TICL_AOD = cms.PSet( @@ -14,7 +13,11 @@ TICL_RECO = cms.PSet( outputCommands = cms.untracked.vstring( trackstersIters + - trackstersHFNoseIters + + ['keep *_ticlTrackstersHFNoseTrkEM_*_*', + 'keep *_ticlTrackstersHFNoseEM_*_*', + 'keep *_ticlTrackstersHFNoseMIP_*_*', + 'keep *_ticlTrackstersHFNoseHAD_*_*', + 'keep *_ticlTrackstersHFNoseMerge_*_*',] + ['keep *_pfTICL_*_*'] ) ) From c4eae6a4b6752d9e09999bc889b7d9764f326332 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Fri, 23 Apr 2021 12:44:47 +0200 Subject: [PATCH 028/309] code-format --- .../plugins/PFClusterFromHGCalTrackster.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc index 93f0a4188050b..b2608de286771 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc @@ -11,9 +11,9 @@ void PFClusterFromHGCalTrackster::updateEvent(const edm::Event& ev) { } void PFClusterFromHGCalTrackster::buildClusters(const edm::Handle& input, - const std::vector& rechitMask, - const std::vector& seedable, - reco::PFClusterCollection& output) { + const std::vector& rechitMask, + const std::vector& seedable, + reco::PFClusterCollection& output) { auto const& hits = *input; const auto& tracksters = *trackstersH_; From f85688952ad47e0a25f06cb7cf5a85cb5cce31a4 Mon Sep 17 00:00:00 2001 From: Patrick Gartung Date: Fri, 23 Apr 2021 15:53:50 +0200 Subject: [PATCH 029/309] Fix header check --- DetectorDescription/Core/interface/DDName.h | 3 +-- FWCore/Services/plugins/StallMonitor.cc | 3 +-- .../Utilities/interface/{std_pair_hasher.h => StdPairHasher.h} | 3 +-- FWCore/Utilities/interface/hash_combine.h | 1 - 4 files changed, 3 insertions(+), 7 deletions(-) rename FWCore/Utilities/interface/{std_pair_hasher.h => StdPairHasher.h} (83%) diff --git a/DetectorDescription/Core/interface/DDName.h b/DetectorDescription/Core/interface/DDName.h index a2fb1414e63b9..f977086747c5a 100644 --- a/DetectorDescription/Core/interface/DDName.h +++ b/DetectorDescription/Core/interface/DDName.h @@ -5,8 +5,7 @@ #include #include -#include "FWCore/Utilities/interface/hash_combine.h" -#include "FWCore/Utilities/interface/std_pair_hasher.h" +#include "FWCore/Utilities/interface/StdPairHasher.h" #include #include diff --git a/FWCore/Services/plugins/StallMonitor.cc b/FWCore/Services/plugins/StallMonitor.cc index 6abd2be9be756..536834e958016 100644 --- a/FWCore/Services/plugins/StallMonitor.cc +++ b/FWCore/Services/plugins/StallMonitor.cc @@ -24,8 +24,7 @@ #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/OStreamColumn.h" #include "FWCore/Utilities/interface/Exception.h" -#include "FWCore/Utilities/interface/hash_combine.h" -#include "FWCore/Utilities/interface/std_pair_hasher.h" +#include "FWCore/Utilities/interface/StdPairHasher.h" #include "tbb/concurrent_unordered_map.h" #include diff --git a/FWCore/Utilities/interface/std_pair_hasher.h b/FWCore/Utilities/interface/StdPairHasher.h similarity index 83% rename from FWCore/Utilities/interface/std_pair_hasher.h rename to FWCore/Utilities/interface/StdPairHasher.h index fbc100615d21d..b61cc5ce57346 100644 --- a/FWCore/Utilities/interface/std_pair_hasher.h +++ b/FWCore/Utilities/interface/StdPairHasher.h @@ -2,9 +2,8 @@ #define FWCore_Utilities_std_pair_hasher_h /* tbb::hash was changed to used std::hash which does not have an implementation for std::pair. - This hasher is taken from the boost::hash implementation. */ -#include "FWCore/Utilities/interface/zero_allocator.h" +#include "FWCore/Utilities/interface/hash_combine.h" namespace edm { struct StdPairHasher { diff --git a/FWCore/Utilities/interface/hash_combine.h b/FWCore/Utilities/interface/hash_combine.h index 91786a88e6e36..d2639df973c02 100644 --- a/FWCore/Utilities/interface/hash_combine.h +++ b/FWCore/Utilities/interface/hash_combine.h @@ -40,5 +40,4 @@ namespace edm { } } // namespace edm - #endif From 436e9220fa15db7302274aa581ccccec6382576c Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Tue, 13 Apr 2021 19:31:11 +0200 Subject: [PATCH 030/309] Remove an unused modifier from the test files --- .../EcalRecProducers/test/testEcalRechitProducer_cfg.py | 1 - .../EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py | 1 - .../HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py | 1 - 3 files changed, 3 deletions(-) diff --git a/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py b/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py index c70572ff3b89d..a9e3d5c1af7b3 100644 --- a/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py +++ b/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -#from Configuration.ProcessModifiers.gpu_cff import gpu process = cms.Process('RECO', eras.Run2_2018) diff --git a/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py b/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py index ffb665d7bc96a..5684e30e330b8 100644 --- a/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py +++ b/RecoLocalCalo/EcalRecProducers/test/testEcalUncalibRechitProducer_cfg.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -#from Configuration.ProcessModifiers.gpu_cff import gpu process = cms.Process('RECO', eras.Run2_2018) diff --git a/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py b/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py index 32d4104a842ef..8c7162bc076c4 100644 --- a/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py +++ b/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.StandardSequences.Eras import eras -#from Configuration.ProcessModifiers.gpu_cff import gpu process = cms.Process('RECOgpu', eras.Run2_2018) From 32ea55258e3a79426f87c207f7a514b466ff09ca Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Tue, 13 Apr 2021 23:24:26 +0200 Subject: [PATCH 031/309] Simplify the definition of the "Patatrack" workflows --- .../python/upgradeWorkflowComponents.py | 322 ++++++------------ 1 file changed, 113 insertions(+), 209 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 8b7ccd217e6c2..ff88d3b0c0546 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1,4 +1,4 @@ -from copy import deepcopy +from copy import copy, deepcopy from collections import OrderedDict import six from .MatrixUtil import merge, Kby @@ -392,246 +392,150 @@ def condition(self, fragment, stepList, key, hasHarvest): '--procModifiers': 'mlpf' } -# Patatrack workflows -class UpgradeWorkflowPatatrack(UpgradeWorkflow): +# Patatrack workflows: +# - 2018 conditions, TTbar +# - 2018 conditions, Z->mumu, +# - 2021 conditions, TTbar +# - 2021 conditions, Z->mumu, +class PatatrackWorkflow(UpgradeWorkflow): + def __init__(self, reco, harvest, **kwargs): + # adapt the parameters for the UpgradeWorkflow init method + super(PatatrackWorkflow, self).__init__( + steps = [ + 'Reco', + 'HARVEST', + 'RecoFakeHLT', + 'HARVESTFakeHLT', + 'RecoGlobal', + 'HARVESTGlobal', + ], + PU = [], + **kwargs) + self.__reco = reco + self.__reco.update({ + '--datatier': 'GEN-SIM-RECO,DQMIO', + '--eventcontent': 'RECOSIM,DQM' + }) + self.__harvest = harvest + def condition(self, fragment, stepList, key, hasHarvest): - is_2018_ttbar = ('2018' in key and fragment=="TTbar_13") - is_2021_ttbar = ('2021' in key and fragment=="TTbar_14TeV") - is_2018_zmumu = ('2018' in key and fragment=="ZMM_13") - is_2021_zmumu = ('2021' in key and fragment=="ZMM_14") - result = any((is_2018_ttbar, is_2021_ttbar, is_2018_zmumu, is_2021_zmumu)) and hasHarvest and self.condition_(fragment, stepList, key, hasHarvest) - if result: - # skip ALCA and Nano - skipList = [s for s in stepList if (("ALCA" in s) or ("Nano" in s))] - for skip in skipList: + # select only a subset of the workflows + selected = [ + ('2018' in key and fragment == "TTbar_13"), + ('2021' in key and fragment == "TTbar_14TeV"), + ('2018' in key and fragment == "ZMM_13"), + ('2021' in key and fragment == "ZMM_14"), + ] + result = any(selected) and hasHarvest + + # skip ALCA and Nano steps + for skip in copy(stepList): + if ("ALCA" in skip) or ("Nano" in skip): stepList.remove(skip) return result - def condition_(self, fragment, stepList, key, hasHarvest): - return True -class UpgradeWorkflowPatatrack_PixelOnlyCPU(UpgradeWorkflowPatatrack): def setup_(self, step, stepName, stepDict, k, properties): if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) + stepDict[stepName][k] = merge([self.__reco, stepDict[step][k]]) elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'}, stepDict[step][k]]) + stepDict[stepName][k] = merge([self.__harvest, stepDict[step][k]]) - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key -upgradeWFs['PatatrackPixelOnlyCPU'] = UpgradeWorkflowPatatrack_PixelOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackPixelOnlyCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, suffix = 'Patatrack_PixelOnlyCPU', offset = 0.501, ) -upgradeWFs['PatatrackPixelOnlyCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' -} - -upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = UpgradeWorkflowPatatrack_PixelOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], - suffix = 'Patatrack_PixelOnlyTripletsCPU', - offset = 0.505, -) - -upgradeWFs['PatatrackPixelOnlyTripletsCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU,RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' -} - -class UpgradeWorkflowPatatrack_PixelOnlyGPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackPixelOnlyGPU'] = UpgradeWorkflowPatatrack_PixelOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackPixelOnlyGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--procModifiers': 'gpu' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, suffix = 'Patatrack_PixelOnlyGPU', offset = 0.502, ) -upgradeWFs['PatatrackPixelOnlyGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu' -} +upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU,RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, + suffix = 'Patatrack_PixelOnlyTripletsCPU', + offset = 0.505, +) -upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = UpgradeWorkflowPatatrack_PixelOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', + '--procModifiers': 'gpu', + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + }, + harvest = { + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + }, suffix = 'Patatrack_PixelOnlyTripletsGPU', offset = 0.506, ) -upgradeWFs['PatatrackPixelOnlyTripletsGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' -} - -class UpgradeWorkflowPatatrack_ECALOnlyCPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@ecalOnlyValidation+@ecal'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackECALOnlyCPU'] = UpgradeWorkflowPatatrack_ECALOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackECALOnlyCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', + }, + harvest = { + '-s': 'HARVESTING:@ecalOnlyValidation+@ecal' + }, suffix = 'Patatrack_ECALOnlyCPU', offset = 0.511, ) -upgradeWFs['PatatrackECALOnlyCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', -} - -class UpgradeWorkflowPatatrack_ECALOnlyGPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@ecalOnlyValidation+@ecal'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackECALOnlyGPU'] = UpgradeWorkflowPatatrack_ECALOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackECALOnlyGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', + '--procModifiers': 'gpu' + }, + harvest = { + '-s': 'HARVESTING:@ecalOnlyValidation+@ecal' + }, suffix = 'Patatrack_ECALOnlyGPU', offset = 0.512, ) -upgradeWFs['PatatrackECALOnlyGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu' -} - -class UpgradeWorkflowPatatrack_HCALOnlyCPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackHCALOnlyCPU'] = UpgradeWorkflowPatatrack_HCALOnlyCPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackHCALOnlyCPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', + }, + harvest = { + '-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only' + }, suffix = 'Patatrack_HCALOnlyCPU', offset = 0.521, ) -upgradeWFs['PatatrackHCALOnlyCPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', -} - -class UpgradeWorkflowPatatrack_HCALOnlyGPU(UpgradeWorkflowPatatrack): - def setup_(self, step, stepName, stepDict, k, properties): - if 'Reco' in step: - stepDict[stepName][k] = merge([self.step3, stepDict[step][k]]) - elif 'HARVEST' in step: - stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only'}, stepDict[step][k]]) - - def condition_(self, fragment, stepList, key, hasHarvest): - return '2018' in key or '2021' in key - -upgradeWFs['PatatrackHCALOnlyGPU'] = UpgradeWorkflowPatatrack_HCALOnlyGPU( - steps = [ - 'Reco', - 'HARVEST', - 'RecoFakeHLT', - 'HARVESTFakeHLT', - 'RecoGlobal', - 'HARVESTGlobal', - ], - PU = [], +upgradeWFs['PatatrackHCALOnlyGPU'] = PatatrackWorkflow( + reco = { + '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', + '--procModifiers': 'gpu' + }, + harvest = { + '-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only' + }, suffix = 'Patatrack_HCALOnlyGPU', offset = 0.522, ) -upgradeWFs['PatatrackHCALOnlyGPU'].step3 = { - '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only', - '--datatier': 'GEN-SIM-RECO,DQMIO', - '--eventcontent': 'RECOSIM,DQM', - '--procModifiers': 'gpu' -} - # end of Patatrack workflows class UpgradeWorkflow_ProdLike(UpgradeWorkflow): @@ -1398,14 +1302,14 @@ def __init__(self, howMuch, dataset): ('FlatRandomPtAndDxyGunProducer_MuPt2To10_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt2To10')), ('FlatRandomPtAndDxyGunProducer_MuPt10To30_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt10To30')), ('FlatRandomPtAndDxyGunProducer_MuPt30To100_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt30To100')), - ('B0ToKstarMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(304,3030),'B0ToKstarMuMu_14TeV')), # 3.3% - ('BsToEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(223,2222),'BsToEleEle_14TeV')), # 4.5% - ('BsToJpsiGamma_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(2500,25000),'BsToJpsiGamma_14TeV')), # 0.4% + ('B0ToKstarMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(304,3030),'B0ToKstarMuMu_14TeV')), # 3.3% + ('BsToEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(223,2222),'BsToEleEle_14TeV')), # 4.5% + ('BsToJpsiGamma_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(2500,25000),'BsToJpsiGamma_14TeV')), # 0.4% ('BsToJpsiPhi_mumuKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(910,9090),'BsToJpsiPhi_mumuKK_14TeV')), # 1.1% - ('BsToMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(313,3125),'BsToMuMu_14TeV')), # 3.2% - ('BsToPhiPhi_KKKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(556,5555),'BsToPhiPhi_KKKK_14TeV')), # 1.8% + ('BsToMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(313,3125),'BsToMuMu_14TeV')), # 3.2% + ('BsToPhiPhi_KKKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(556,5555),'BsToPhiPhi_KKKK_14TeV')), # 1.8% ('TauToMuMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(18939,189393),'TauToMuMuMu_14TeV')), # effi = 5.280e-04 - ('BdToKstarEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(206,2061),'BdToKstarEleEle_14TeV')), #effi = 4.850e-02 + ('BdToKstarEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(206,2061),'BdToKstarEleEle_14TeV')), #effi = 4.850e-02 ('ZpTT_1500_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'ZpTT_1500_14')), ('BuMixing_BMuonFilter_forSTEAM_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(900,10000),'BuMixing_14')), ('Upsilon1SToMuMu_forSTEAM_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'Upsilon1SToMuMu_14')), From db8f341b070fa55b67b37f897d701a481b5b27a5 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Tue, 13 Apr 2021 23:42:40 +0200 Subject: [PATCH 032/309] Make the Pixel 'gpu' workflow use a GPU if available, and fall-back to CPU otherwise --- .../python/RecoPixelVertexing_cff.py | 21 +++++++----- .../python/PixelTracks_cff.py | 34 ++++++++++++------- .../python/PixelVertexes_cff.py | 7 ++-- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py index 424ac13a43627..4b32839e21b0e 100644 --- a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py +++ b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py @@ -6,19 +6,24 @@ # from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cff import * #from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * -recopixelvertexingTask = cms.Task(pixelTracksTask,pixelVertices) -recopixelvertexing = cms.Sequence(recopixelvertexingTask) +recopixelvertexingTask = cms.Task(pixelTracksTask, pixelVertices) from Configuration.ProcessModifiers.gpu_cff import gpu +_recopixelvertexingTask_gpu = recopixelvertexingTask.copy() from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA +_recopixelvertexingTask_gpu.add(pixelVertexCUDA) + from RecoPixelVertexing.PixelVertexFinding.pixelVertexSoA_cfi import pixelVertexSoA -from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA +_recopixelvertexingTask_gpu.add(pixelVertexSoA) -_pixelVertexingCUDATask = cms.Task(pixelTracksTask,pixelVertexCUDA,pixelVertexSoA,pixelVertices) +from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA +# this is needed because the 'pixelTrack' EDAlias does not contain the 'ushorts' collections +_pixelVertexFromSoA.TrackCollection = 'pixelTrackFromSoA' +gpu.toModify(pixelVertices, + cuda = _pixelVertexFromSoA +) -# pixelVertexSoAonCPU = pixelVertexCUDA.clone() -# pixelVertexSoAonCPU.onGPU = False; +gpu.toReplaceWith(recopixelvertexingTask, _recopixelvertexingTask_gpu) -gpu.toReplaceWith(pixelVertices,_pixelVertexFromSoA) -gpu.toReplaceWith(recopixelvertexingTask,_pixelVertexingCUDATask) +recopixelvertexing = cms.Sequence(recopixelvertexingTask) diff --git a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py index 5ff404cb603d4..244e68faba8b6 100644 --- a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py +++ b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTrackAngle_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitMatcher_cfi import * @@ -59,10 +60,12 @@ ) ) -pixelTracks = _pixelTracks.clone( - SeedingHitSets = "pixelTracksHitQuadruplets" +pixelTracks = SwitchProducerCUDA( + cpu = _pixelTracks.clone( + SeedingHitSets = "pixelTracksHitQuadruplets" + ) ) -trackingLowPU.toModify(pixelTracks, SeedingHitSets = "pixelTracksHitTriplets") +trackingLowPU.toModify(pixelTracks.cpu, SeedingHitSets = "pixelTracksHitTriplets") pixelTracksTask = cms.Task( pixelTracksTrackingRegions, @@ -79,7 +82,7 @@ # Use ntuple fit and substitute previous Fitter producer with the ntuple one from Configuration.ProcessModifiers.pixelNtupleFit_cff import pixelNtupleFit as ntupleFit -ntupleFit.toModify(pixelTracks, Fitter = "pixelNtupletsFitter") +ntupleFit.toModify(pixelTracks.cpu, Fitter = "pixelNtupletsFitter") _pixelTracksTask_ntupleFit = pixelTracksTask.copy() _pixelTracksTask_ntupleFit.replace(pixelFitterByHelixProjections, pixelNtupletsFitter) ntupleFit.toReplaceWith(pixelTracksTask, _pixelTracksTask_ntupleFit) @@ -88,15 +91,20 @@ from Configuration.ProcessModifiers.gpu_cff import gpu from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA from RecoPixelVertexing.PixelTrackFitting.pixelTrackSoA_cfi import pixelTrackSoA -from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackFromSoA -_pixelTracksGPUTask = cms.Task( - caHitNtupletCUDA, - pixelTrackSoA, - pixelTracks # FromSoA +from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as pixelTrackFromSoA +_pixelTracksTask_gpu = pixelTracksTask.copy() +_pixelTracksTask_gpu.add(caHitNtupletCUDA, pixelTrackSoA, pixelTrackFromSoA) +# this is needed (instead of simply using pixelTracks.cuda = pixelTrackFromSoA.clone()) because +# the PixelTrackProducerFromSoA produces an additional 'ushorts' collection +gpu.toModify(pixelTracks, + cuda = cms.EDAlias( + pixelTrackFromSoA = cms.VPSet( + cms.PSet(type = cms.string("recoTracks")), + cms.PSet(type = cms.string("recoTrackExtras")), + cms.PSet(type = cms.string("TrackingRecHitsOwned")) + ) + ) ) - -gpu.toReplaceWith(pixelTracksTask, _pixelTracksGPUTask) -gpu.toReplaceWith(pixelTracks,_pixelTrackFromSoA) - +gpu.toReplaceWith(pixelTracksTask, _pixelTracksTask_gpu) pixelTracksSequence = cms.Sequence(pixelTracksTask) diff --git a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py index 6f74899c00f03..a33d5c14af751 100644 --- a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py +++ b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py @@ -1,4 +1,7 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA -from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cfi import * - +from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cfi import pvClusterComparer, pixelVertices as _pixelVertices +pixelVertices = SwitchProducerCUDA( + cpu = _pixelVertices.clone() +) From 9e5d3abf4c8b094ea4a1e05fe594f00db5c518d5 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Thu, 15 Apr 2021 14:28:56 +0200 Subject: [PATCH 033/309] Remove obsolete configuration file --- .../ecalMultiFitUncalibRecHit_gpu_new_cfi.py | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_gpu_new_cfi.py diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_gpu_new_cfi.py b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_gpu_new_cfi.py deleted file mode 100644 index 84a0c6f9cbe8a..0000000000000 --- a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_gpu_new_cfi.py +++ /dev/null @@ -1,83 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from RecoLocalCalo.EcalRecProducers.ecalPulseShapeParameters_cff import * - -ecalMultiFitUncalibRecHitgpu = cms.EDProducer("EcalUncalibRecHitProducerGPUNew", - EBdigiCollection = cms.InputTag("ecalDigis","ebDigis"), - EEdigiCollection = cms.InputTag("ecalDigis","eeDigis"), - EBhitCollection = cms.string("EcalUncalibRecHitsEBgpunew"), - EBhitCollection_soa = cms.string("EcalUncalibRecHitsEBgpunew"), - EEhitCollection = cms.string('EcalUncalibRecHitsEEgpunew'), - EEhitCollection_soa = cms.string('EcalUncalibRecHitsEEgpunew'), - algo = cms.string("EcalUncalibRecHitWorkerMultiFitGPUNew"), - algoPSet = cms.PSet( - # for multifit method - EcalPulseShapeParameters = cms.PSet( ecal_pulse_shape_parameters ), - activeBXs = cms.vint32(-5,-4,-3,-2,-1,0,1,2,3,4), - ampErrorCalculation = cms.bool(True), - useLumiInfoRunHeader = cms.bool(True), - - doPrefitEB = cms.bool(False), - doPrefitEE = cms.bool(False), - prefitMaxChiSqEB = cms.double(25.), - prefitMaxChiSqEE = cms.double(10.), - - dynamicPedestalsEB = cms.bool(False), - dynamicPedestalsEE = cms.bool(False), - mitigateBadSamplesEB = cms.bool(False), - mitigateBadSamplesEE = cms.bool(False), - gainSwitchUseMaxSampleEB = cms.bool(True), - gainSwitchUseMaxSampleEE = cms.bool(False), - selectiveBadSampleCriteriaEB = cms.bool(False), - selectiveBadSampleCriteriaEE = cms.bool(False), - simplifiedNoiseModelForGainSwitch = cms.bool(True), - addPedestalUncertaintyEB = cms.double(0.), - addPedestalUncertaintyEE = cms.double(0.), - - # decide which algorithm to be use to calculate the jitter - timealgo = cms.string("RatioMethod"), - - # for ratio method - EBtimeFitParameters = cms.vdouble(-2.015452e+00, 3.130702e+00, -1.234730e+01, 4.188921e+01, -8.283944e+01, 9.101147e+01, -5.035761e+01, 1.105621e+01), - EEtimeFitParameters = cms.vdouble(-2.390548e+00, 3.553628e+00, -1.762341e+01, 6.767538e+01, -1.332130e+02, 1.407432e+02, -7.541106e+01, 1.620277e+01), - EBamplitudeFitParameters = cms.vdouble(1.138,1.652), - EEamplitudeFitParameters = cms.vdouble(1.890,1.400), - EBtimeFitLimits_Lower = cms.double(0.2), - EBtimeFitLimits_Upper = cms.double(1.4), - EEtimeFitLimits_Lower = cms.double(0.2), - EEtimeFitLimits_Upper = cms.double(1.4), - # for time error - EBtimeConstantTerm= cms.double(.6), - EEtimeConstantTerm= cms.double(1.0), - - # for kOutOfTime flag - EBtimeNconst = cms.double(28.5), - EEtimeNconst = cms.double(31.8), - outOfTimeThresholdGain12pEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain12mEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain61pEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain61mEB = cms.double(5), # times estimated precision - outOfTimeThresholdGain12pEE = cms.double(1000), # times estimated precision - outOfTimeThresholdGain12mEE = cms.double(1000), # times estimated precision - outOfTimeThresholdGain61pEE = cms.double(1000), # times estimated precision - outOfTimeThresholdGain61mEE = cms.double(1000), # times estimated precision - amplitudeThresholdEB = cms.double(10), - amplitudeThresholdEE = cms.double(10), - - ebSpikeThreshold = cms.double(1.042), - - # these are now taken from DB. Here the MC parameters for backward compatibility - ebPulseShape = cms.vdouble( 5.2e-05,-5.26e-05 , 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194 ), - eePulseShape = cms.vdouble( 5.2e-05,-5.26e-05 , 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194 ), - - # for kPoorReco flag - kPoorRecoFlagEB = cms.bool(True), - kPoorRecoFlagEE = cms.bool(False), - chi2ThreshEB_ = cms.double(65.0), - chi2ThreshEE_ = cms.double(50.0), - - # threads/blocks config - threads = cms.vint32(256, 1, 1), - runV1 = cms.bool(True), - ) -) From 68987131fe38e526a95283436198ec4f9a08877b Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Fri, 23 Apr 2021 19:50:53 +0200 Subject: [PATCH 034/309] for to for_each --- .../plugins/PFClusterFromHGCalTrackster.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc index b2608de286771..6fd9e2b5b8750 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc @@ -47,12 +47,13 @@ void PFClusterFromHGCalTrackster::buildClusters(const edm::Handle > hitsAndFractions; - for (uint8_t lcId = 0; lcId < tst.vertices().size(); ++lcId) { - const auto fraction = 1.f / tst.vertex_multiplicity(lcId); - for (const auto& cell : clusters[tst.vertices(lcId)].hitsAndFractions()) { + int iLC =0; + std::for_each(std::begin(tst.vertices()), std::end(tst.vertices()), [&](unsigned int lcId) { + const auto fraction = 1.f / tst.vertex_multiplicity(iLC++); + for (const auto& cell : clusters[lcId].hitsAndFractions()) { hitsAndFractions.emplace_back(cell.first, cell.second * fraction); } - } + }); for (const auto& hAndF : hitsAndFractions) { auto itr = detIdToIndex.find(hAndF.first); From 2ee0dc02a372bbd6209a27d207baedd44df359ce Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Fri, 23 Apr 2021 20:18:11 +0200 Subject: [PATCH 035/309] code-format --- .../PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc index 6fd9e2b5b8750..0fa3007b61138 100644 --- a/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc +++ b/RecoParticleFlow/PFClusterProducer/plugins/PFClusterFromHGCalTrackster.cc @@ -47,7 +47,7 @@ void PFClusterFromHGCalTrackster::buildClusters(const edm::Handle > hitsAndFractions; - int iLC =0; + int iLC = 0; std::for_each(std::begin(tst.vertices()), std::end(tst.vertices()), [&](unsigned int lcId) { const auto fraction = 1.f / tst.vertex_multiplicity(iLC++); for (const auto& cell : clusters[lcId].hitsAndFractions()) { From f8e5cad245b432dc7a6c9251382dc2a6e3364be5 Mon Sep 17 00:00:00 2001 From: Shilpi Date: Sat, 24 Apr 2021 01:11:53 +0200 Subject: [PATCH 036/309] HtoZZ UL ID --- .../python/ElectronMVAValueMapProducer_cfi.py | 14 ++++++ .../mvaElectronID_Summer16UL_ID_ISO_cff.py | 49 +++++++++++++++++++ .../mvaElectronID_Summer17UL_ID_ISO_cff.py | 49 +++++++++++++++++++ .../mvaElectronID_Summer18UL_ID_ISO_cff.py | 49 +++++++++++++++++++ 4 files changed, 161 insertions(+) create mode 100644 RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer16UL_ID_ISO_cff.py create mode 100644 RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer17UL_ID_ISO_cff.py create mode 100644 RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer18UL_ID_ISO_cff.py diff --git a/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py b/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py index 2ae67fe9d5ac6..0f033a38a50b5 100644 --- a/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py +++ b/RecoEgamma/ElectronIdentification/python/ElectronMVAValueMapProducer_cfi.py @@ -27,6 +27,20 @@ import mvaEleID_Fall17_iso_V2_producer_config mvaConfigsForEleProducer.append( mvaEleID_Fall17_iso_V2_producer_config ) + +# HZZ4l Run2 (Ultra)Legacy +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer16UL_ID_ISO_cff \ + import mvaEleID_Summer16UL_ID_ISO_producer_config +mvaConfigsForEleProducer.append(mvaEleID_Summer16UL_ID_ISO_producer_config) + +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer17UL_ID_ISO_cff \ + import mvaEleID_Summer17UL_ID_ISO_producer_config +mvaConfigsForEleProducer.append(mvaEleID_Summer17UL_ID_ISO_producer_config) + +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer18UL_ID_ISO_cff \ + import mvaEleID_Summer18UL_ID_ISO_producer_config +mvaConfigsForEleProducer.append( mvaEleID_Summer18UL_ID_ISO_producer_config ) + electronMVAValueMapProducer = cms.EDProducer('ElectronMVAValueMapProducer', src = cms.InputTag('slimmedElectrons'), mvaConfigurations = mvaConfigsForEleProducer diff --git a/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer16UL_ID_ISO_cff.py b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer16UL_ID_ISO_cff.py new file mode 100644 index 0000000000000..51abb6e23b173 --- /dev/null +++ b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer16UL_ID_ISO_cff.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_tools import * +from os import path + +mvaTag = "Summer16ULIdIso" + +weightFileDir = "RecoEgamma/ElectronIdentification/data/MVAWeightFiles/Summer_16UL_ID_ISO" + +mvaWeightFiles = cms.vstring( + path.join(weightFileDir, "EB1_5.weights.xml.gz"), # EB1_5 + path.join(weightFileDir, "EB2_5.weights.xml.gz"), # EB2_5 + path.join(weightFileDir, "EE_5.weights.xml.gz"), # EE_5 + path.join(weightFileDir, "EB1_10.weights.xml.gz"), # EB1_10 + path.join(weightFileDir, "EB2_10.weights.xml.gz"), # EB2_10 + path.join(weightFileDir, "EE_10.weights.xml.gz"), # EE_10 + ) + +categoryCuts = cms.vstring( + "pt < 10. & abs(superCluster.eta) < 0.800", # EB1_5 + "pt < 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_5 + "pt < 10. & abs(superCluster.eta) >= 1.479", # EE_5 + "pt >= 10. & abs(superCluster.eta) < 0.800", # EB1_10 + "pt >= 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_10 + "pt >= 10. & abs(superCluster.eta) >= 1.479", # EE_10 + ) + +mvaEleID_Summer16UL_ID_ISO_HZZ_container = EleMVARaw_WP( + idName = "mvaEleID-Summer16UL-ID-ISO-HZZ", mvaTag = mvaTag, + cutCategory0 = "1.8949071018", # EB1_5 + cutCategory1 = "1.80714210202", # EB2_5 + cutCategory2 = "1.64751528517", # EE_5 + cutCategory3 = "0.339697782473", # EB1_10 + cutCategory4 = "0.252039219555", # EB2_10 + cutCategory5 = "-0.686263559006", # EE_10 + ) + + +mvaEleID_Summer16UL_ID_ISO_producer_config = cms.PSet( + mvaName = cms.string(mvaClassName), + mvaTag = cms.string(mvaTag), + nCategories = cms.int32(6), + categoryCuts = categoryCuts, + weightFileNames = mvaWeightFiles, + variableDefinition = cms.string(mvaVariablesFile) + ) + +mvaEleID_Summer16UL_ID_ISO_HZZ = configureVIDMVAEleID( mvaEleID_Summer16UL_ID_ISO_HZZ_container ) + +mvaEleID_Summer16UL_ID_ISO_HZZ.isPOGApproved = cms.untracked.bool(True) diff --git a/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer17UL_ID_ISO_cff.py b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer17UL_ID_ISO_cff.py new file mode 100644 index 0000000000000..0de6ea8170844 --- /dev/null +++ b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer17UL_ID_ISO_cff.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_tools import * +from os import path + +mvaTag = "Summer17ULIdIso" + +weightFileDir = "RecoEgamma/ElectronIdentification/data/MVAWeightFiles/Summer_17UL_ID_ISO" + +mvaWeightFiles = cms.vstring( + path.join(weightFileDir, "EB1_5.weights.xml.gz"), # EB1_5 + path.join(weightFileDir, "EB2_5.weights.xml.gz"), # EB2_5 + path.join(weightFileDir, "EE_5.weights.xml.gz"), # EE_5 + path.join(weightFileDir, "EB1_10.weights.xml.gz"), # EB1_10 + path.join(weightFileDir, "EB2_10.weights.xml.gz"), # EB2_10 + path.join(weightFileDir, "EE_10.weights.xml.gz"), # EE_10 + ) + +categoryCuts = cms.vstring( + "pt < 10. & abs(superCluster.eta) < 0.800", # EB1_5 + "pt < 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_5 + "pt < 10. & abs(superCluster.eta) >= 1.479", # EE_5 + "pt >= 10. & abs(superCluster.eta) < 0.800", # EB1_10 + "pt >= 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_10 + "pt >= 10. & abs(superCluster.eta) >= 1.479", # EE_10 + ) + +mvaEleID_Summer17UL_ID_ISO_HZZ_container = EleMVARaw_WP( + idName = "mvaEleID-Summer17UL-ID-ISO-HZZ", mvaTag = mvaTag, + cutCategory0 = "1.54440585808", # EB1_5 + cutCategory1 = "1.50294621563", # EB2_5 + cutCategory2 = "1.77306202112", # EE_5 + cutCategory3 = "0.157262554087", # EB1_10 + cutCategory4 = "0.0273932225081", # EB2_10 + cutCategory5 = "-0.623050463489", # EE_10 + ) + + +mvaEleID_Summer17UL_ID_ISO_producer_config = cms.PSet( + mvaName = cms.string(mvaClassName), + mvaTag = cms.string(mvaTag), + nCategories = cms.int32(6), + categoryCuts = categoryCuts, + weightFileNames = mvaWeightFiles, + variableDefinition = cms.string(mvaVariablesFile) + ) + +mvaEleID_Summer17UL_ID_ISO_HZZ = configureVIDMVAEleID( mvaEleID_Summer17UL_ID_ISO_HZZ_container ) + +mvaEleID_Summer17UL_ID_ISO_HZZ.isPOGApproved = cms.untracked.bool(True) diff --git a/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer18UL_ID_ISO_cff.py b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer18UL_ID_ISO_cff.py new file mode 100644 index 0000000000000..abc002ac45086 --- /dev/null +++ b/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_Summer18UL_ID_ISO_cff.py @@ -0,0 +1,49 @@ +import FWCore.ParameterSet.Config as cms +from RecoEgamma.ElectronIdentification.Identification.mvaElectronID_tools import * +from os import path + +mvaTag = "Summer18ULIdIso" + +weightFileDir = "RecoEgamma/ElectronIdentification/data/MVAWeightFiles/Summer_18UL_ID_ISO" + +mvaWeightFiles = cms.vstring( + path.join(weightFileDir, "EB1_5.weights.xml.gz"), # EB1_5 + path.join(weightFileDir, "EB2_5.weights.xml.gz"), # EB2_5 + path.join(weightFileDir, "EE_5.weights.xml.gz"), # EE_5 + path.join(weightFileDir, "EB1_10.weights.xml.gz"), # EB1_10 + path.join(weightFileDir, "EB2_10.weights.xml.gz"), # EB2_10 + path.join(weightFileDir, "EE_10.weights.xml.gz"), # EE_10 + ) + +categoryCuts = cms.vstring( + "pt < 10. & abs(superCluster.eta) < 0.800", # EB1_5 + "pt < 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_5 + "pt < 10. & abs(superCluster.eta) >= 1.479", # EE_5 + "pt >= 10. & abs(superCluster.eta) < 0.800", # EB1_10 + "pt >= 10. & abs(superCluster.eta) >= 0.800 & abs(superCluster.eta) < 1.479", # EB2_10 + "pt >= 10. & abs(superCluster.eta) >= 1.479", # EE_10 + ) + +mvaEleID_Summer18UL_ID_ISO_HZZ_container = EleMVARaw_WP( + idName = "mvaEleID-Summer18UL-ID-ISO-HZZ", mvaTag = mvaTag, + cutCategory0 = "1.49603193295", # EB1_5 + cutCategory1 = "1.52414154008", # EB2_5 + cutCategory2 = "1.77694249574", # EE_5 + cutCategory3 = "0.199463934736", # EB1_10 + cutCategory4 = "0.076063564084", # EB2_10 + cutCategory5 = "-0.572118857519", # EE_10 + ) + + +mvaEleID_Summer18UL_ID_ISO_producer_config = cms.PSet( + mvaName = cms.string(mvaClassName), + mvaTag = cms.string(mvaTag), + nCategories = cms.int32(6), + categoryCuts = categoryCuts, + weightFileNames = mvaWeightFiles, + variableDefinition = cms.string(mvaVariablesFile) + ) + +mvaEleID_Summer18UL_ID_ISO_HZZ = configureVIDMVAEleID( mvaEleID_Summer18UL_ID_ISO_HZZ_container ) + +mvaEleID_Summer18UL_ID_ISO_HZZ.isPOGApproved = cms.untracked.bool(True) From 2020799971a0de916d195d5c312784e20a2036bb Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 24 Apr 2021 02:25:15 +0200 Subject: [PATCH 037/309] Fix 'appending' to tuple in _TypedParameterizable.clone() --- FWCore/ParameterSet/python/Mixins.py | 45 ++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/FWCore/ParameterSet/python/Mixins.py b/FWCore/ParameterSet/python/Mixins.py index ab4383d5d83bf..9786f37f0abee 100644 --- a/FWCore/ParameterSet/python/Mixins.py +++ b/FWCore/ParameterSet/python/Mixins.py @@ -171,7 +171,8 @@ def __init__(self,*arg,**kargs): if len(arg) != 0: #raise ValueError("unnamed arguments are not allowed. Please use the syntax 'name = value' when assigning arguments.") for block in arg: - if type(block).__name__ != "PSet": + # Allow __PSet for testing + if type(block).__name__ not in ["PSet", "__PSet"]: raise ValueError("Only PSets can be passed as unnamed argument blocks. This is a "+type(block).__name__) self.__setParameters(block.parameters_()) self.__setParameters(kargs) @@ -419,7 +420,7 @@ def clone(self, *args, **params): returnValue =_TypedParameterizable.__new__(type(self)) myparams = self.parameters_() if len(myparams) == 0 and len(params) and len(args): - args.append(None) + args = args + (None,) _modifyParametersFromDict(myparams, params, self._Parameterizable__raiseBadSetAttr) if self._Parameterizable__validator is not None: @@ -795,6 +796,25 @@ def __init__(self): def testUsingBlock(self): a = UsingBlock("a") self.assert_(isinstance(a, _ParameterTypeBase)) + def testConstruction(self): + class __Test(_TypedParameterizable): + pass + class __TestType(_SimpleParameterTypeBase): + def _isValid(self,value): + return True + class __PSet(_ParameterTypeBase,_Parameterizable): + def __init__(self,*arg,**args): + #need to call the inits separately + _ParameterTypeBase.__init__(self) + _Parameterizable.__init__(self,*arg,**args) + + a = __Test("MyType", __PSet(a=__TestType(1))) + self.assertEqual(a.a.value(), 1) + b = __Test("MyType", __PSet(a=__TestType(1)), __PSet(b=__TestType(2))) + self.assertEqual(b.a.value(), 1) + self.assertEqual(b.b.value(), 2) + self.assertRaises(ValueError, lambda: __Test("MyType", __PSet(a=__TestType(1)), __PSet(a=__TestType(2)))) + def testCopy(self): class __Test(_TypedParameterizable): pass @@ -805,6 +825,11 @@ def _isValid(self,value): b = a.copy() self.assertEqual(b.t.value(),1) self.assertEqual(b.u.value(),2) + + c = __Test("MyType") + self.assertEqual(len(c.parameterNames_()), 0) + d = c.copy() + self.assertEqual(len(d.parameterNames_()), 0) def testClone(self): class __Test(_TypedParameterizable): pass @@ -816,6 +841,9 @@ def __init__(self,*arg,**args): #need to call the inits separately _ParameterTypeBase.__init__(self) _Parameterizable.__init__(self,*arg,**args) + def dumpPython(self,options=PrintOptions()): + return "__PSet(\n"+_Parameterizable.dumpPython(self, options)+options.indentation()+")" + a = __Test("MyType", t=__TestType(1), u=__TestType(2), @@ -843,6 +871,19 @@ def __init__(self,*arg,**args): self.assertEqual(hasattr(c.x,"a"), False) self.assertEqual(hasattr(c.x,"c"), False) self.assertRaises(TypeError,a.clone,None,**{"v":1}) + d = a.clone(__PSet(k=__TestType(42))) + self.assertEqual(d.t.value(), 1) + self.assertEqual(d.k.value(), 42) + # TODO: following case that currently raises an exception + # will be made to work in the near future + self.assertRaises(ValueError, a.clone, __PSet(t=__TestType(42))) + + e = __Test("MyType") + self.assertEqual(len(e.parameterNames_()), 0) + f = d.clone(__PSet(a = __TestType(1)), b = __TestType(2)) + self.assertEqual(f.a.value(), 1) + self.assertEqual(f.b.value(), 2) + def testModified(self): class __TestType(_SimpleParameterTypeBase): def _isValid(self,value): From 887df186c434178ce41e036239c8f764dea8722a Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Fri, 16 Apr 2021 00:42:56 +0200 Subject: [PATCH 038/309] Make the ECAL 'gpu' workflow use a GPU if available, and fall-back to CPU otherwise EcalRawToDigi: do not declare to produce the collections that will not be put in the event. EcalCPUDigisProducer: add more dummy collections. --- .../python/RawToDigi_Repacked_cff.py | 22 ++++- .../StandardSequences/python/RawToDigi_cff.py | 2 +- .../python/SimL1EmulatorRepack_GCTGT_cff.py | 2 +- .../plugins/EcalCPUDigisProducer.cc | 82 +++++++++++-------- .../EcalRawToDigi/plugins/EcalRawToDigi.cc | 71 +++++++++------- .../EcalRawToDigi/python/ecalDigis_cff.py | 45 +++++++--- .../ecalLocalRecoSequenceCosmics_cff.py | 23 ++++-- .../python/ecalLocalRecoSequence_cff.py | 60 +------------- .../python/ecalLocalCustom.py | 13 ++- .../python/ecalMultiFitUncalibRecHit_cff.py | 24 ++++-- .../EcalRecProducers/python/ecalRecHit_cff.py | 67 +++++++++++++++ Validation/Configuration/python/ECALHCAL.py | 16 ++-- 12 files changed, 260 insertions(+), 167 deletions(-) create mode 100644 RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py diff --git a/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py b/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py index 1e6cf30d8c917..3d64a8c1c4912 100644 --- a/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_Repacked_cff.py @@ -8,9 +8,9 @@ gctDigis.inputLabel = 'rawDataRepacker' gtDigis.DaqGtInputTag = 'rawDataRepacker' gtEvmDigis.EvmGtInputTag = 'rawDataRepacker' -siPixelDigis.InputLabel = 'rawDataRepacker' +siPixelDigis.cpu.InputLabel = 'rawDataRepacker' siStripDigis.ProductLabel = 'rawDataRepacker' -ecalDigis.InputLabel = 'rawDataRepacker' +ecalDigis.cpu.InputLabel = 'rawDataRepacker' ecalPreshowerDigis.sourceTag = 'rawDataRepacker' hcalDigis.InputLabel = 'rawDataRepacker' muonCSCDigis.InputObjects = 'rawDataRepacker' @@ -18,7 +18,23 @@ muonRPCDigis.InputLabel = 'rawDataRepacker' castorDigis.InputLabel = 'rawDataRepacker' -RawToDigiTask = cms.Task(csctfDigis,dttfDigis,gctDigis,gtDigis,gtEvmDigis,siPixelDigis,siStripDigis,ecalDigis,ecalPreshowerDigis,hcalDigis,muonCSCDigis,muonDTDigis,muonRPCDigis,castorDigis,scalersRawToDigi) +RawToDigiTask = cms.Task( + csctfDigis, + dttfDigis, + gctDigis, + gtDigis, + gtEvmDigis, + siPixelDigis, + siStripDigis, + ecalDigis, + ecalPreshowerDigis, + hcalDigis, + muonCSCDigis, + muonDTDigis, + muonRPCDigis, + castorDigis, + scalersRawToDigi) + RawToDigi = cms.Sequence(RawToDigiTask) RawToDigiTask_woGCT = RawToDigiTask.copyAndExclude([gctDigis]) diff --git a/Configuration/StandardSequences/python/RawToDigi_cff.py b/Configuration/StandardSequences/python/RawToDigi_cff.py index 42fa09bd30c62..60ed421a6205f 100644 --- a/Configuration/StandardSequences/python/RawToDigi_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_cff.py @@ -75,7 +75,7 @@ scalersRawToDigi.scalersInputTag = 'rawDataCollector' siPixelDigis.cpu.InputLabel = 'rawDataCollector' -(~gpu).toModify(ecalDigis, InputLabel='rawDataCollector') +ecalDigis.cpu.InputLabel = 'rawDataCollector' ecalPreshowerDigis.sourceTag = 'rawDataCollector' hcalDigis.InputLabel = 'rawDataCollector' muonCSCDigis.InputObjects = 'rawDataCollector' diff --git a/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py b/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py index 834b4249888f3..dbcc43f08352c 100644 --- a/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py +++ b/Configuration/StandardSequences/python/SimL1EmulatorRepack_GCTGT_cff.py @@ -27,7 +27,7 @@ ## from L1Trigger.L1TCalorimeter.L1TCaloStage1_PPFromRaw_cff import * -ecalDigis.InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) +ecalDigis.cpu.InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) hcalDigis.InputLabel = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) simHcalTriggerPrimitiveDigis.InputTagFEDRaw = cms.InputTag( 'rawDataCollector', processName=cms.InputTag.skipCurrentProcess()) diff --git a/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc b/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc index 97f9828e9f5ec..d9a8b35ebb89e 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalCPUDigisProducer.cc @@ -1,4 +1,5 @@ #include +#include #include "CUDADataFormats/EcalDigi/interface/DigisCollection.h" #include "CondFormats/DataRecord/interface/EcalMappingElectronicsRcd.h" @@ -23,13 +24,19 @@ class EcalCPUDigisProducer : public edm::stream::EDProducer { public: explicit EcalCPUDigisProducer(edm::ParameterSet const& ps); - ~EcalCPUDigisProducer() override; + ~EcalCPUDigisProducer() override = default; static void fillDescriptions(edm::ConfigurationDescriptions&); private: void acquire(edm::Event const&, edm::EventSetup const&, edm::WaitingTaskWithArenaHolder) override; void produce(edm::Event&, edm::EventSetup const&) override; + template + edm::EDPutTokenT dummyProduces(ARGS&&... args) { + return (produceDummyIntegrityCollections_) ? produces(std::forward(args)...) + : edm::EDPutTokenT{}; + } + private: // input digi collections in GPU-friendly format using InputProduct = cms::cuda::Product>; @@ -43,7 +50,7 @@ class EcalCPUDigisProducer : public edm::stream::EDProducer { // whether to produce dummy integrity collections bool produceDummyIntegrityCollections_; - // dummy SRP collections + // dummy producer collections edm::EDPutTokenT ebSrFlagToken_; edm::EDPutTokenT eeSrFlagToken_; @@ -59,8 +66,15 @@ class EcalCPUDigisProducer : public edm::stream::EDProducer { // dummy integrity errors edm::EDPutTokenT integrityTTIdErrorsToken_; + edm::EDPutTokenT integrityZSXtalIdErrorsToken_; edm::EDPutTokenT integrityBlockSizeErrorsToken_; + edm::EDPutTokenT pnDiodeDigisToken_; + + // dummy TCC collections + edm::EDPutTokenT ecalTriggerPrimitivesToken_; + edm::EDPutTokenT ecalPseudoStripInputsToken_; + // FIXME better way to pass pointers from acquire to produce? std::vector> idsebtmp, idseetmp; std::vector> dataebtmp, dataeetmp; @@ -84,45 +98,41 @@ EcalCPUDigisProducer::EcalCPUDigisProducer(const edm::ParameterSet& ps) : // input digi collections in GPU-friendly format digisInEBToken_{consumes(ps.getParameter("digisInLabelEB"))}, digisInEEToken_{consumes(ps.getParameter("digisInLabelEE"))}, + // output digi collections in legacy format digisOutEBToken_{produces(ps.getParameter("digisOutLabelEB"))}, digisOutEEToken_{produces(ps.getParameter("digisOutLabelEE"))}, + // whether to produce dummy integrity collections produceDummyIntegrityCollections_{ps.getParameter("produceDummyIntegrityCollections")}, - // dummy SRP collections - ebSrFlagToken_{produceDummyIntegrityCollections_ ? produces() - : edm::EDPutTokenT{}}, - eeSrFlagToken_{produceDummyIntegrityCollections_ ? produces() - : edm::EDPutTokenT{}}, + + // dummy collections + ebSrFlagToken_{dummyProduces()}, + eeSrFlagToken_{dummyProduces()}, + // dummy integrity for xtal data - ebIntegrityGainErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainErrors") - : edm::EDPutTokenT{}}, - ebIntegrityGainSwitchErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainSwitchErrors") - : edm::EDPutTokenT{}}, - ebIntegrityChIdErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityChIdErrors") - : edm::EDPutTokenT{}}, + ebIntegrityGainErrorsToken_{dummyProduces("EcalIntegrityGainErrors")}, + ebIntegrityGainSwitchErrorsToken_{dummyProduces("EcalIntegrityGainSwitchErrors")}, + ebIntegrityChIdErrorsToken_{dummyProduces("EcalIntegrityChIdErrors")}, + // dummy integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection) - eeIntegrityGainErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainErrors") - : edm::EDPutTokenT{}}, - eeIntegrityGainSwitchErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityGainSwitchErrors") - : edm::EDPutTokenT{}}, - eeIntegrityChIdErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityChIdErrors") - : edm::EDPutTokenT{}}, + eeIntegrityGainErrorsToken_{dummyProduces("EcalIntegrityGainErrors")}, + eeIntegrityGainSwitchErrorsToken_{dummyProduces("EcalIntegrityGainSwitchErrors")}, + eeIntegrityChIdErrorsToken_{dummyProduces("EcalIntegrityChIdErrors")}, + // dummy integrity errors - integrityTTIdErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityTTIdErrors") - : edm::EDPutTokenT{}}, - integrityBlockSizeErrorsToken_{produceDummyIntegrityCollections_ - ? produces("EcalIntegrityBlockSizeErrors") - : edm::EDPutTokenT{}} {} + integrityTTIdErrorsToken_{dummyProduces("EcalIntegrityTTIdErrors")}, + integrityZSXtalIdErrorsToken_{dummyProduces("EcalIntegrityZSXtalIdErrors")}, + integrityBlockSizeErrorsToken_{dummyProduces("EcalIntegrityBlockSizeErrors")}, + + // + pnDiodeDigisToken_{dummyProduces()}, -EcalCPUDigisProducer::~EcalCPUDigisProducer() {} + // dummy TCC collections + ecalTriggerPrimitivesToken_{dummyProduces("EcalTriggerPrimitives")}, + ecalPseudoStripInputsToken_{dummyProduces("EcalPseudoStripInputs")} +// constructor body +{} void EcalCPUDigisProducer::acquire(edm::Event const& event, edm::EventSetup const& setup, @@ -176,7 +186,7 @@ void EcalCPUDigisProducer::produce(edm::Event& event, edm::EventSetup const& set event.put(digisOutEEToken_, std::move(digisEE)); if (produceDummyIntegrityCollections_) { - // dummy SRP collections + // dummy collections event.emplace(ebSrFlagToken_); event.emplace(eeSrFlagToken_); // dummy integrity for xtal data @@ -189,7 +199,13 @@ void EcalCPUDigisProducer::produce(edm::Event& event, edm::EventSetup const& set event.emplace(eeIntegrityChIdErrorsToken_); // dummy integrity errors event.emplace(integrityTTIdErrorsToken_); + event.emplace(integrityZSXtalIdErrorsToken_); event.emplace(integrityBlockSizeErrorsToken_); + // + event.emplace(pnDiodeDigisToken_); + // dummy TCC collections + event.emplace(ecalTriggerPrimitivesToken_); + event.emplace(ecalPseudoStripInputsToken_); } } diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc index b1c4c2aee087f..650e0e1911cfb 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigi.cc @@ -110,36 +110,51 @@ EcalRawToDigi::EcalRawToDigi(edm::ParameterSet const& conf) edm::InputTag dataLabel = conf.getParameter("InputLabel"); edm::InputTag fedsLabel = conf.getParameter("FedLabel"); - // Producer products : - produces("ebDigis"); - produces("eeDigis"); - produces(); - produces(); - produces(); - produces(); - produces("EcalTriggerPrimitives"); - produces("EcalPseudoStripInputs"); - - // Integrity for xtal data - produces("EcalIntegrityGainErrors"); - produces("EcalIntegrityGainSwitchErrors"); - produces("EcalIntegrityChIdErrors"); - - // Integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection) - produces("EcalIntegrityGainErrors"); - produces("EcalIntegrityGainSwitchErrors"); - produces("EcalIntegrityChIdErrors"); - - // Integrity Errors - produces("EcalIntegrityTTIdErrors"); - produces("EcalIntegrityZSXtalIdErrors"); - produces("EcalIntegrityBlockSizeErrors"); + // Producer products + if (headerUnpacking_) { + produces(); + } + + if (feUnpacking_) { + produces("ebDigis"); + produces("eeDigis"); + + // Integrity for xtal data + produces("EcalIntegrityGainErrors"); + produces("EcalIntegrityGainSwitchErrors"); + produces("EcalIntegrityChIdErrors"); + + // Integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection) + produces("EcalIntegrityGainErrors"); + produces("EcalIntegrityGainSwitchErrors"); + produces("EcalIntegrityChIdErrors"); + + // Integrity Errors + produces("EcalIntegrityTTIdErrors"); + produces("EcalIntegrityZSXtalIdErrors"); + produces("EcalIntegrityBlockSizeErrors"); + + // + produces(); + } + + if (srpUnpacking_) { + produces(); + produces(); + } + + if (tccUnpacking_) { + produces("EcalTriggerPrimitives"); + produces("EcalPseudoStripInputs"); + } // Mem channels' integrity - produces("EcalIntegrityMemTtIdErrors"); - produces("EcalIntegrityMemBlockSizeErrors"); - produces("EcalIntegrityMemChIdErrors"); - produces("EcalIntegrityMemGainErrors"); + if (memUnpacking_) { + produces("EcalIntegrityMemTtIdErrors"); + produces("EcalIntegrityMemBlockSizeErrors"); + produces("EcalIntegrityMemChIdErrors"); + produces("EcalIntegrityMemGainErrors"); + } dataToken_ = consumes(dataLabel); if (REGIONAL_) { diff --git a/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py b/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py index 00a54ad56c128..0238a62f34568 100644 --- a/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py +++ b/EventFilter/EcalRawToDigi/python/ecalDigis_cff.py @@ -1,28 +1,49 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA -# legacy raw to digi on the CPU +# ECAL unpacker running on CPU from EventFilter.EcalRawToDigi.EcalUnpackerData_cfi import ecalEBunpacker as _ecalEBunpacker -ecalDigis = _ecalEBunpacker.clone() +ecalDigis = SwitchProducerCUDA( + cpu = _ecalEBunpacker.clone() +) -ecalDigisTask = cms.Task(ecalDigis) +ecalDigisTask = cms.Task( + # ECAL unpacker running on CPU + ecalDigis +) # process modifier to run on GPUs from Configuration.ProcessModifiers.gpu_cff import gpu -# GPU-friendly EventSetup modules +# ECAL conditions used by the unpacker running on GPU from EventFilter.EcalRawToDigi.ecalElectronicsMappingGPUESProducer_cfi import ecalElectronicsMappingGPUESProducer -# raw to digi on GPUs +# ECAL unpacker running on GPU from EventFilter.EcalRawToDigi.ecalRawToDigiGPU_cfi import ecalRawToDigiGPU as _ecalRawToDigiGPU ecalDigisGPU = _ecalRawToDigiGPU.clone() -# copy the digi from the GPU to the CPU and convert to legacy format +# disable the ECAL unpacker collections that are not available in the GPU unpacker +gpu.toModify(ecalDigis.cpu, + headerUnpacking = False, + memUnpacking = False +) + +# extend the SwitchProducer to add a case to copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format from EventFilter.EcalRawToDigi.ecalCPUDigisProducer_cfi import ecalCPUDigisProducer as _ecalCPUDigisProducer -_ecalDigis_gpu = _ecalCPUDigisProducer.clone( - digisInLabelEB = ('ecalDigisGPU', 'ebDigis'), - digisInLabelEE = ('ecalDigisGPU', 'eeDigis'), - produceDummyIntegrityCollections = True +gpu.toModify(ecalDigis, + # copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format + cuda = _ecalCPUDigisProducer.clone( + digisInLabelEB = ('ecalDigisGPU', 'ebDigis'), + digisInLabelEE = ('ecalDigisGPU', 'eeDigis'), + produceDummyIntegrityCollections = True + ) ) -gpu.toReplaceWith(ecalDigis, _ecalDigis_gpu) -gpu.toReplaceWith(ecalDigisTask, cms.Task(ecalElectronicsMappingGPUESProducer, ecalDigisGPU, ecalDigis)) +gpu.toReplaceWith(ecalDigisTask, cms.Task( + # ECAL conditions used by the unpacker running on GPU + ecalElectronicsMappingGPUESProducer, + # run the ECAL unpacker on GPU + ecalDigisGPU, + # run the ECAL unpacker on CPU, or copy the ECAL digis from GPU to CPU and covert them from SoA to legacy format + ecalDigis +)) diff --git a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py index ce74351bc8c33..bf6c8896b3823 100644 --- a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py +++ b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequenceCosmics_cff.py @@ -12,14 +12,10 @@ #ECAL reconstruction from RecoLocalCalo.EcalRecProducers.ecalWeightUncalibRecHit_cfi import * from RecoLocalCalo.EcalRecProducers.ecalFixedAlphaBetaFitUncalibRecHit_cfi import * -from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import * -from RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi import * -from RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi import * -ecalLocalRecoTaskCosmics = cms.Task(ecalFixedAlphaBetaFitUncalibRecHit,ecalWeightUncalibRecHit,ecalDetIdToBeRecovered,ecalRecHit,ecalPreshowerRecHit) -ecalLocalRecoSequenceCosmics = cms.Sequence(ecalLocalRecoTaskCosmics) -ecalRecHit.EBuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEB' -ecalRecHit.EEuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEE' -ecalRecHit.ChannelStatusToBeExcluded = [ +from RecoLocalCalo.EcalRecProducers.ecalRecHit_cff import * +ecalRecHit.cpu.EBuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEB' +ecalRecHit.cpu.EEuncalibRecHitCollection = 'ecalFixedAlphaBetaFitUncalibRecHit:EcalUncalibRecHitsEE' +ecalRecHit.cpu.ChannelStatusToBeExcluded = [ 'kDAC', 'kNoLaser', 'kNoisy', @@ -32,3 +28,14 @@ 'kDeadFE', 'kNoDataNoTP' ] +from RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi import * +from RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi import * + +ecalLocalRecoTaskCosmics = cms.Task( + ecalFixedAlphaBetaFitUncalibRecHit, + ecalWeightUncalibRecHit, + ecalDetIdToBeRecovered, + ecalCalibratedRecHitTask, + ecalPreshowerRecHit +) +ecalLocalRecoSequenceCosmics = cms.Sequence(ecalLocalRecoTaskCosmics) diff --git a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py index 75ae5fc0c202f..e49aae13d365b 100644 --- a/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py +++ b/RecoLocalCalo/Configuration/python/ecalLocalRecoSequence_cff.py @@ -1,12 +1,11 @@ import FWCore.ParameterSet.Config as cms -from Configuration.ProcessModifiers.gpu_cff import gpu # TPG condition needed by ecalRecHit producer if TT recovery is ON from RecoLocalCalo.EcalRecProducers.ecalRecHitTPGConditions_cff import * # ECAL reconstruction from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cff import * -from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import * +from RecoLocalCalo.EcalRecProducers.ecalRecHit_cff import * from RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi import * from RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi import * from RecoLocalCalo.EcalRecProducers.ecalCompactTrigPrim_cfi import * @@ -20,7 +19,7 @@ ecalUncalibRecHitSequence = cms.Sequence(ecalUncalibRecHitTask) ecalRecHitNoTPTask = cms.Task( - ecalRecHit, + ecalCalibratedRecHitTask, ecalPreshowerRecHit) ecalRecHitNoTPSequence = cms.Sequence(ecalRecHitNoTPTask) @@ -44,61 +43,6 @@ ecalOnlyLocalRecoSequence = cms.Sequence(ecalOnlyLocalRecoTask) -# ECAL rechit calibrations on GPU -from RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi import ecalRechitADCToGeVConstantGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi import ecalRechitChannelStatusGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi import ecalIntercalibConstantsGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi import ecalLaserAPDPNRatiosGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi import ecalLaserAPDPNRatiosRefGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi import ecalLaserAlphasGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi import ecalLinearCorrectionsGPUESProducer -from RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi import ecalRecHitParametersGPUESProducer - -# ECAL rechits running on GPU -from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU -ecalRecHitGPU = _ecalRecHitGPU.clone( - uncalibrecHitsInLabelEB = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEB'), - uncalibrecHitsInLabelEE = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEE') -) - -# copy the rechits from GPU to CPU -from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer -ecalRecHitSoA = _ecalCPURecHitProducer.clone( - recHitsInLabelEB = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEB'), - recHitsInLabelEE = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEE') -) - -# convert the rechits from SoA to legacy format -from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitConvertGPU2CPUFormat -_ecalRecHit_gpu = _ecalRecHitConvertGPU2CPUFormat.clone( - recHitsLabelGPUEB = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEB'), - recHitsLabelGPUEE = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEE') -) -# TODO: the ECAL calibrated rechits produced on the GPU are not correct, yet. -# When they are working and validated, remove this comment and uncomment the next line: -#gpu.toReplaceWith(ecalRecHit, _ecalRecHit_gpu) - -# ECAL reconstruction on GPU -gpu.toReplaceWith(ecalRecHitNoTPTask, cms.Task( - # ECAL rechit calibrations on GPU - ecalRechitADCToGeVConstantGPUESProducer, - ecalRechitChannelStatusGPUESProducer, - ecalIntercalibConstantsGPUESProducer, - ecalLaserAPDPNRatiosGPUESProducer, - ecalLaserAPDPNRatiosRefGPUESProducer, - ecalLaserAlphasGPUESProducer, - ecalLinearCorrectionsGPUESProducer, - ecalRecHitParametersGPUESProducer, - # ECAL rechits running on GPU - ecalRecHitGPU, - # copy the rechits from GPU to CPU - ecalRecHitSoA, - # convert the rechits from SoA to legacy format - ecalRecHit, - # ECAL preshower rechit legacy module - ecalPreshowerRecHit -)) - # Phase 2 modifications from RecoLocalCalo.EcalRecProducers.ecalDetailedTimeRecHit_cfi import * _phase2_timing_ecalRecHitTask = cms.Task( ecalRecHitTask.copy() , ecalDetailedTimeRecHit ) diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py b/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py index ba84f7779a0d9..137c97ac7765a 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalLocalCustom.py @@ -1,17 +1,16 @@ - import FWCore.ParameterSet.Config as cms def configureEcalLocal25ns(process): - process.ecalMultiFitUncalibRecHit.activeBXs = [-5,-4,-3,-2,-1,0,1,2,3,4], - process.ecalMultiFitUncalibRecHit.useLumiInfoRunHeader = False + process.ecalMultiFitUncalibRecHit.cpu.activeBXs = [-5,-4,-3,-2,-1,0,1,2,3,4], + process.ecalMultiFitUncalibRecHit.cpu.useLumiInfoRunHeader = False return process def configureEcalLocal50ns(process): - process.ecalMultiFitUncalibRecHit.activeBXs = [-4,-2,0,2,4] - process.ecalMultiFitUncalibRecHit.useLumiInfoRunHeader = False + process.ecalMultiFitUncalibRecHit.cpu.activeBXs = [-4,-2,0,2,4] + process.ecalMultiFitUncalibRecHit.cpu.useLumiInfoRunHeader = False return process def configureEcalLocalNoOOTPU(process): - process.ecalMultiFitUncalibRecHit.activeBXs = [0] - process.ecalMultiFitUncalibRecHit.useLumiInfoRunHeader = False + process.ecalMultiFitUncalibRecHit.cpu.activeBXs = [0] + process.ecalMultiFitUncalibRecHit.cpu.useLumiInfoRunHeader = False return process diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py index 72a3efaae38ba..fb285456a053f 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py @@ -1,10 +1,17 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from Configuration.ProcessModifiers.gpu_cff import gpu # ECAL multifit running on CPU -from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cfi import ecalMultiFitUncalibRecHit +from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cfi import ecalMultiFitUncalibRecHit as _ecalMultiFitUncalibRecHit +ecalMultiFitUncalibRecHit = SwitchProducerCUDA( + cpu = _ecalMultiFitUncalibRecHit +) -ecalMultiFitUncalibRecHitTask = cms.Task(ecalMultiFitUncalibRecHit) +ecalMultiFitUncalibRecHitTask = cms.Task( + # ECAL multifit running on CPU + ecalMultiFitUncalibRecHit +) # ECAL conditions used by the multifit running on GPU from RecoLocalCalo.EcalRecProducers.ecalPedestalsGPUESProducer_cfi import ecalPedestalsGPUESProducer @@ -32,11 +39,12 @@ # convert the uncalibrated rechits from SoA to legacy format from RecoLocalCalo.EcalRecProducers.ecalUncalibRecHitConvertGPU2CPUFormat_cfi import ecalUncalibRecHitConvertGPU2CPUFormat as _ecalUncalibRecHitConvertGPU2CPUFormat -_ecalMultiFitUncalibRecHit_gpu = _ecalUncalibRecHitConvertGPU2CPUFormat.clone( - recHitsLabelGPUEB = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEB'), - recHitsLabelGPUEE = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEE'), +gpu.toModify(ecalMultiFitUncalibRecHit, + cuda = _ecalUncalibRecHitConvertGPU2CPUFormat.clone( + recHitsLabelGPUEB = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEB'), + recHitsLabelGPUEE = cms.InputTag('ecalMultiFitUncalibRecHitSoA', 'EcalUncalibRecHitsEE'), + ) ) -gpu.toReplaceWith(ecalMultiFitUncalibRecHit, _ecalMultiFitUncalibRecHit_gpu) gpu.toReplaceWith(ecalMultiFitUncalibRecHitTask, cms.Task( # ECAL conditions used by the multifit running on GPU @@ -48,10 +56,10 @@ ecalTimeBiasCorrectionsGPUESProducer, ecalTimeCalibConstantsGPUESProducer, ecalMultifitParametersGPUESProducer, - # ECAL multifit running on GP + # ECAL multifit running on GPU ecalMultiFitUncalibRecHitGPU, # copy the uncalibrated rechits from GPU to CPU ecalMultiFitUncalibRecHitSoA, - # convert the uncalibrated rechits legacy format + # ECAL multifit running on CPU, or convert the uncalibrated rechits from SoA to legacy format ecalMultiFitUncalibRecHit, )) diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py new file mode 100644 index 0000000000000..44420e9600690 --- /dev/null +++ b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py @@ -0,0 +1,67 @@ +import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu + +# ECAL calibrated rechit reconstruction on CPU +from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import ecalRecHit as _ecalRecHit +ecalRecHit = SwitchProducerCUDA( + cpu = _ecalRecHit +) + +ecalCalibratedRecHitTask = cms.Task( + ecalRecHit +) + +# ECAL rechit calibrations on GPU +from RecoLocalCalo.EcalRecProducers.ecalRechitADCToGeVConstantGPUESProducer_cfi import ecalRechitADCToGeVConstantGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalRechitChannelStatusGPUESProducer_cfi import ecalRechitChannelStatusGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalIntercalibConstantsGPUESProducer_cfi import ecalIntercalibConstantsGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosGPUESProducer_cfi import ecalLaserAPDPNRatiosGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLaserAPDPNRatiosRefGPUESProducer_cfi import ecalLaserAPDPNRatiosRefGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLaserAlphasGPUESProducer_cfi import ecalLaserAlphasGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalLinearCorrectionsGPUESProducer_cfi import ecalLinearCorrectionsGPUESProducer +from RecoLocalCalo.EcalRecProducers.ecalRecHitParametersGPUESProducer_cfi import ecalRecHitParametersGPUESProducer + +# ECAL rechits running on GPU +from RecoLocalCalo.EcalRecProducers.ecalRecHitGPU_cfi import ecalRecHitGPU as _ecalRecHitGPU +ecalRecHitGPU = _ecalRecHitGPU.clone( + uncalibrecHitsInLabelEB = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEB'), + uncalibrecHitsInLabelEE = cms.InputTag('ecalMultiFitUncalibRecHitGPU', 'EcalUncalibRecHitsEE') +) + +# copy the rechits from GPU to CPU +from RecoLocalCalo.EcalRecProducers.ecalCPURecHitProducer_cfi import ecalCPURecHitProducer as _ecalCPURecHitProducer +ecalRecHitSoA = _ecalCPURecHitProducer.clone( + recHitsInLabelEB = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEB'), + recHitsInLabelEE = cms.InputTag('ecalRecHitGPU', 'EcalRecHitsEE') +) + +# TODO: the ECAL calibrated rechits produced on the GPU are not correct, yet. +# When they are working and validated, remove this comment and uncomment the next lines: +# convert the rechits from SoA to legacy format +#from RecoLocalCalo.EcalRecProducers.ecalRecHitConvertGPU2CPUFormat_cfi import ecalRecHitConvertGPU2CPUFormat as _ecalRecHitFromSoA +#gpu.toModify(ecalRecHit, +# cuda = _ecalRecHitFromSoA.clone( +# recHitsLabelGPUEB = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEB'), +# recHitsLabelGPUEE = cms.InputTag('ecalRecHitSoA', 'EcalRecHitsEE') +# ) +#) + +# ECAL calibrated rechit reconstruction on GPU +gpu.toReplaceWith(ecalCalibratedRecHitTask, cms.Task( + # ECAL rechit calibrations on GPU + ecalRechitADCToGeVConstantGPUESProducer, + ecalRechitChannelStatusGPUESProducer, + ecalIntercalibConstantsGPUESProducer, + ecalLaserAPDPNRatiosGPUESProducer, + ecalLaserAPDPNRatiosRefGPUESProducer, + ecalLaserAlphasGPUESProducer, + ecalLinearCorrectionsGPUESProducer, + ecalRecHitParametersGPUESProducer, + # ECAL rechits running on GPU + ecalRecHitGPU, + # copy the rechits from GPU to CPU + ecalRecHitSoA, + # convert the rechits from SoA to legacy format + ecalRecHit +)) diff --git a/Validation/Configuration/python/ECALHCAL.py b/Validation/Configuration/python/ECALHCAL.py index 50013e0859c30..1c4e18046144b 100644 --- a/Validation/Configuration/python/ECALHCAL.py +++ b/Validation/Configuration/python/ECALHCAL.py @@ -39,21 +39,21 @@ def customise(process): process.schedule.append(process.generation_step) process.schedule.append(process.simulation_step) - process.ecalMultiFitUncalibRecHit.EBdigiCollection = cms.InputTag("simEcalDigis","ebDigis") - process.ecalMultiFitUncalibRecHit.EEdigiCollection = cms.InputTag("simEcalDigis","eeDigis") + process.ecalMultiFitUncalibRecHit.cpu.EBdigiCollection = cms.InputTag("simEcalDigis","ebDigis") + process.ecalMultiFitUncalibRecHit.cpu.EEdigiCollection = cms.InputTag("simEcalDigis","eeDigis") process.ecalPreshowerRecHit.ESdigiCollection = cms.InputTag("simEcalPreshowerDigis") delattr(process,"hbhereco") process.hbhereco = process.hbheprereco.clone() process.hcalLocalRecoSequence.replace(process.hbheprereco,process.hbhereco) - process.hbhereco.digiLabelQIE8 = cms.InputTag("simHcalUnsuppressedDigis") - process.hbhereco.digiLabelQIE11 = cms.InputTag("simHcalUnsuppressedDigis","HBHEQIE11DigiCollection") + process.hbhereco.cpu.digiLabelQIE8 = cms.InputTag("simHcalUnsuppressedDigis") + process.hbhereco.cpu.digiLabelQIE11 = cms.InputTag("simHcalUnsuppressedDigis","HBHEQIE11DigiCollection") process.horeco.digiLabel = cms.InputTag("simHcalUnsuppressedDigis") process.hfreco.digiLabel = cms.InputTag("simHcalUnsuppressedDigis") - process.ecalRecHit.recoverEBIsolatedChannels = cms.bool(False) - process.ecalRecHit.recoverEEIsolatedChannels = cms.bool(False) - process.ecalRecHit.recoverEBFE = cms.bool(False) - process.ecalRecHit.recoverEEFE = cms.bool(False) + process.ecalRecHit.cpu.recoverEBIsolatedChannels = cms.bool(False) + process.ecalRecHit.cpu.recoverEEIsolatedChannels = cms.bool(False) + process.ecalRecHit.cpu.recoverEBFE = cms.bool(False) + process.ecalRecHit.cpu.recoverEEFE = cms.bool(False) # process.local_digireco = cms.Path(process.mix * process.calDigi * process.ecalLocalRecoSequence * process.hbhereco * process.hfreco * process.horeco * (process.ecalClusters+process.caloTowersRec) * process.reducedEcalRecHitsSequence ) From a929ca9a9d78bf816c4a79b41245d78f6f613a5c Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Tue, 20 Apr 2021 12:01:35 +0200 Subject: [PATCH 039/309] Update the DQM clients workflows for ecalDigis being a SwitchProducer --- .../python/clients/beam_dqm_sourceclient-live_cfg.py | 2 +- .../python/clients/beamfake_dqm_sourceclient-live_cfg.py | 2 +- .../python/clients/beampixel_dqm_sourceclient-live_cfg.py | 4 ++-- .../python/clients/csc_dqm_sourceclient-live_cfg.py | 4 ++-- .../python/clients/ecal_dqm_sourceclient-live_cfg.py | 2 +- .../python/clients/l1t_dqm_sourceclient-live_cfg.py | 4 ++-- .../python/clients/l1temulator_dqm_sourceclient-live_cfg.py | 4 ++-- .../python/clients/l1tstage1_dqm_sourceclient-live_cfg.py | 4 ++-- .../clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py | 4 ++-- .../python/clients/l1tstage2_dqm_sourceclient-live_cfg.py | 2 +- .../clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py | 2 +- .../python/clients/scal_dqm_sourceclient-live_cfg.py | 2 +- .../python/clients/sistrip_dqm_sourceclient-live_cfg.py | 4 ++-- 13 files changed, 20 insertions(+), 20 deletions(-) diff --git a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py index 316b4cf91c64d..ba5c96c796e57 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -287,7 +287,7 @@ process.castorDigis.InputLabel = rawDataInputTag process.csctfDigis.producer = rawDataInputTag process.dttfDigis.DTTF_FED_Source = rawDataInputTag -process.ecalDigis.InputLabel = rawDataInputTag +process.ecalDigis.cpu.InputLabel = rawDataInputTag process.ecalPreshowerDigis.sourceTag = rawDataInputTag process.gctDigis.inputLabel = rawDataInputTag process.gtDigis.DaqGtInputTag = rawDataInputTag diff --git a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py index 3765c52e57290..8b6fe3516f0ac 100644 --- a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py @@ -115,7 +115,7 @@ """ process.castorDigis.InputLabel = rawDataInputTag process.csctfDigis.producer = rawDataInputTag process.dttfDigis.DTTF_FED_Source = rawDataInputTag -process.ecalDigis.InputLabel = rawDataInputTag +process.ecalDigis.cpu.InputLabel = rawDataInputTag process.ecalPreshowerDigis.sourceTag = rawDataInputTag process.gctDigis.inputLabel = rawDataInputTag process.gtDigis.DaqGtInputTag = rawDataInputTag diff --git a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py index ba03f7f75f2d6..cd21b498d7f9c 100644 --- a/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beampixel_dqm_sourceclient-live_cfg.py @@ -115,7 +115,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") - process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -168,7 +168,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py index 747ec4d01b07a..2aa8f0fc32dfe 100644 --- a/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/csc_dqm_sourceclient-live_cfg.py @@ -179,7 +179,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -204,7 +204,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py index 0c692470fc983..a68733cef810a 100644 --- a/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/ecal_dqm_sourceclient-live_cfg.py @@ -162,7 +162,7 @@ process.ecalMonitorTask.workerParameters.PresampleTask.params.doPulseMaxCheck = False elif runTypeName == 'hi_run': process.ecalMonitorTask.collectionTags.Source = "rawDataRepacker" - process.ecalDigis.InputLabel = cms.InputTag('rawDataRepacker') + process.ecalDigis.cpu.InputLabel = cms.InputTag('rawDataRepacker') elif runTypeName == 'hpu_run': if not unitTest: process.source.SelectEvents = cms.untracked.PSet(SelectEvents = cms.vstring('*')) diff --git a/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py index b2358e79a1bb6..3887c06b60772 100644 --- a/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1t_dqm_sourceclient-live_cfg.py @@ -172,7 +172,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -191,7 +191,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py index e2c9f057f04b1..c995051a63b2e 100644 --- a/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1temulator_dqm_sourceclient-live_cfg.py @@ -185,7 +185,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -207,7 +207,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py index 93df769c2dfe4..b5b25b9fc318a 100644 --- a/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage1_dqm_sourceclient-live_cfg.py @@ -182,7 +182,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -201,7 +201,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py index 4ed9c5e298890..0cb164bf2c0b4 100644 --- a/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage1emulator_dqm_sourceclient-live_cfg.py @@ -194,7 +194,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -216,7 +216,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py index 0c7f4707b6d8b..e1e87d866dcc4 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -130,7 +130,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataRepacker") process.ctppsPixelDigis.inputLabel = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.hcalDigis.InputLabel = cms.InputTag("rawDataRepacker") process.muonCSCDigis.InputObjects = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py index d2d4ecb4f630d..222cebbf0e1d1 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -128,7 +128,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataRepacker") process.ctppsPixelDigis.inputLabel = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.hcalDigis.InputLabel = cms.InputTag("rawDataRepacker") process.muonCSCDigis.InputObjects = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py index 2decc1b774251..433f9f3510d15 100644 --- a/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/scal_dqm_sourceclient-live_cfg.py @@ -90,7 +90,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataRepacker") diff --git a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py index 889fc8a978d22..3004cb47ef80b 100644 --- a/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/sistrip_dqm_sourceclient-live_cfg.py @@ -493,7 +493,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataCollector") process.csctfDigis.producer = cms.InputTag("rawDataCollector") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataCollector") -process.ecalDigis.InputLabel = cms.InputTag("rawDataCollector") +process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataCollector") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataCollector") process.gctDigis.inputLabel = cms.InputTag("rawDataCollector") process.gtDigis.DaqGtInputTag = cms.InputTag("rawDataCollector") @@ -515,7 +515,7 @@ process.castorDigis.InputLabel = cms.InputTag("rawDataRepacker") process.csctfDigis.producer = cms.InputTag("rawDataRepacker") process.dttfDigis.DTTF_FED_Source = cms.InputTag("rawDataRepacker") - process.ecalDigis.InputLabel = cms.InputTag("rawDataRepacker") + process.ecalDigis.cpu.InputLabel = cms.InputTag("rawDataRepacker") process.ecalPreshowerDigis.sourceTag = cms.InputTag("rawDataRepacker") process.gctDigis.inputLabel = cms.InputTag("rawDataRepacker") process.hcalDigis.InputLabel = cms.InputTag("rawDataRepacker") From 90a90a6448dd4f83c3b281b644deee8bc8e95043 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Wed, 21 Apr 2021 00:29:45 +0200 Subject: [PATCH 040/309] Make the SoA and/or legacy collections optional --- .../src/HcalCPURecHitsProducer.cc | 77 +++++++++++-------- 1 file changed, 47 insertions(+), 30 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc b/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc index 714ec8b7de5af..742662eac2dd9 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc @@ -15,7 +15,8 @@ class HcalCPURecHitsProducer : public edm::stream::EDProducer { public: explicit HcalCPURecHitsProducer(edm::ParameterSet const& ps); - ~HcalCPURecHitsProducer() override; + ~HcalCPURecHitsProducer() override = default; + static void fillDescriptions(edm::ConfigurationDescriptions&); private: @@ -23,11 +24,15 @@ class HcalCPURecHitsProducer : public edm::stream::EDProducer void produce(edm::Event&, edm::EventSetup const&) override; private: + const bool produceSoA_; + const bool produceLegacy_; + using IProductType = cms::cuda::Product>; - edm::EDGetTokenT recHitsM0TokenIn_; + const edm::EDGetTokenT recHitsM0TokenIn_; + using OProductType = hcal::RecHitCollection>; - edm::EDPutTokenT recHitsM0TokenOut_; - edm::EDPutTokenT recHitsLegacyTokenOut_; + const edm::EDPutTokenT recHitsM0TokenOut_; + const edm::EDPutTokenT recHitsLegacyTokenOut_; // to pass from acquire to produce OProductType tmpRecHits_; @@ -36,19 +41,25 @@ class HcalCPURecHitsProducer : public edm::stream::EDProducer void HcalCPURecHitsProducer::fillDescriptions(edm::ConfigurationDescriptions& confDesc) { edm::ParameterSetDescription desc; - desc.add("recHitsM0LabelIn", edm::InputTag{"hbheRecHitProducerGPU", "recHitsM0HBHE"}); - desc.add("recHitsM0LabelOut", "recHitsM0HBHE"); - desc.add("recHitsLegacyLabelOut", "recHitsLegacyHBHE"); + desc.add("recHitsM0LabelIn", edm::InputTag{"hbheRecHitProducerGPU"}); + desc.add("recHitsM0LabelOut", ""); + desc.add("recHitsLegacyLabelOut", ""); + desc.add("produceSoA", true); + desc.add("produceLegacy", true); confDesc.addWithDefaultLabel(desc); } HcalCPURecHitsProducer::HcalCPURecHitsProducer(const edm::ParameterSet& ps) - : recHitsM0TokenIn_{consumes(ps.getParameter("recHitsM0LabelIn"))}, - recHitsM0TokenOut_{produces(ps.getParameter("recHitsM0LabelOut"))}, - recHitsLegacyTokenOut_{produces(ps.getParameter("recHitsLegacyLabelOut"))} {} - -HcalCPURecHitsProducer::~HcalCPURecHitsProducer() {} + : produceSoA_{ps.getParameter("produceSoA")}, + produceLegacy_{ps.getParameter("produceLegacy")}, + recHitsM0TokenIn_{consumes(ps.getParameter("recHitsM0LabelIn"))}, + recHitsM0TokenOut_{produceSoA_ ? produces(ps.getParameter("recHitsM0LabelOut")) + : edm::EDPutTokenT{}}, // empty token if disabled + recHitsLegacyTokenOut_{produceLegacy_ + ? produces(ps.getParameter("recHitsLegacyLabelOut")) + : edm::EDPutTokenT{}} // empty token if disabled +{} void HcalCPURecHitsProducer::acquire(edm::Event const& event, edm::EventSetup const& setup, @@ -81,26 +92,32 @@ void HcalCPURecHitsProducer::acquire(edm::Event const& event, } void HcalCPURecHitsProducer::produce(edm::Event& event, edm::EventSetup const& setup) { - // populate the legacy collection - auto recHitsLegacy = std::make_unique(); - // did not set size with ctor as there is no setter for did - recHitsLegacy->reserve(tmpRecHits_.did.size()); - for (uint32_t i = 0; i < tmpRecHits_.did.size(); i++) { - recHitsLegacy->emplace_back(HcalDetId{tmpRecHits_.did[i]}, - tmpRecHits_.energy[i], - 0 // timeRising - ); - - // update newly pushed guy - (*recHitsLegacy)[i].setChiSquared(tmpRecHits_.chi2[i]); - (*recHitsLegacy)[i].setRawEnergy(tmpRecHits_.energyM0[i]); + if (produceLegacy_) { + // populate the legacy collection + auto recHitsLegacy = std::make_unique(); + // did not set size with ctor as there is no setter for did + recHitsLegacy->reserve(tmpRecHits_.did.size()); + for (uint32_t i = 0; i < tmpRecHits_.did.size(); i++) { + recHitsLegacy->emplace_back(HcalDetId{tmpRecHits_.did[i]}, + tmpRecHits_.energy[i], + 0 // timeRising + ); + + // update newly pushed guy + (*recHitsLegacy)[i].setChiSquared(tmpRecHits_.chi2[i]); + (*recHitsLegacy)[i].setRawEnergy(tmpRecHits_.energyM0[i]); + } + + // put the legacy collection + event.put(recHitsLegacyTokenOut_, std::move(recHitsLegacy)); } - // put a legacy format - event.put(recHitsLegacyTokenOut_, std::move(recHitsLegacy)); - - // put a new format - event.emplace(recHitsM0TokenOut_, std::move(tmpRecHits_)); + if (produceSoA_) { + // put the SoA collection + event.emplace(recHitsM0TokenOut_, std::move(tmpRecHits_)); + } + // clear the temporary collection for the next event + tmpRecHits_.resize(0); } DEFINE_FWK_MODULE(HcalCPURecHitsProducer); From 33ef05739ed403d4af6ba915a406905080dbc5ca Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Wed, 21 Apr 2021 00:32:12 +0200 Subject: [PATCH 041/309] Make the HCAL 'gpu' workflow use a GPU if available, and fall-back to CPU otherwise --- .../python/Reconstruction_cff.py | 1 + .../python/OfflineSourceSequence_pp.py | 29 +++++++------ .../python/RecoLocalCalo_Cosmics_cff.py | 31 +++++++------- .../python/hcalGlobalReco_cff.py | 25 +++++++---- .../Configuration/python/hcalLocalReco_cff.py | 42 +++++++++---------- .../python/HBHE_custom_25nsMethod.py | 4 +- .../test/make_GPUvsCPU_HCAL_rechits.py | 22 +++++----- .../python/particleFlowRecHitHBHE_cfi.py | 5 ++- 8 files changed, 85 insertions(+), 74 deletions(-) diff --git a/Configuration/StandardSequences/python/Reconstruction_cff.py b/Configuration/StandardSequences/python/Reconstruction_cff.py index e03d228a857fb..62d03776be5de 100644 --- a/Configuration/StandardSequences/python/Reconstruction_cff.py +++ b/Configuration/StandardSequences/python/Reconstruction_cff.py @@ -235,6 +235,7 @@ bunchSpacingProducer, offlineBeamSpot, hcalOnlyLocalRecoTask, + hcalOnlyGlobalRecoTask, pfClusteringHBHEHFOnlyTask ) diff --git a/DQM/HcalTasks/python/OfflineSourceSequence_pp.py b/DQM/HcalTasks/python/OfflineSourceSequence_pp.py index 0543cf3aae84d..65172a4180be0 100644 --- a/DQM/HcalTasks/python/OfflineSourceSequence_pp.py +++ b/DQM/HcalTasks/python/OfflineSourceSequence_pp.py @@ -1,36 +1,41 @@ import FWCore.ParameterSet.Config as cms #----------------- -# HCAL DQM Offline Source Sequence Definition for pp -# To be used for Offline DQM importing +# HCAL DQM Offline Source Sequence Definition for pp +# To be used for Offline DQM importing #----------------- -# import the tasks +# import the tasks from DQM.HcalTasks.DigiTask import digiTask from DQM.HcalTasks.RawTask import rawTask from DQM.HcalTasks.TPTask import tpTask from DQM.HcalTasks.RecHitTask import recHitTask, recHitPreRecoTask -# set processing type to Offine +# set processing type to Offine digiTask.ptype = cms.untracked.int32(1) tpTask.ptype = cms.untracked.int32(1) recHitTask.ptype = cms.untracked.int32(1) rawTask.ptype = cms.untracked.int32(1) recHitPreRecoTask.ptype = cms.untracked.int32(1) -# set the label for Emulator TP Task +# set the label for Emulator TP Task tpTask.tagEmul = cms.untracked.InputTag("valHcalTriggerPrimitiveDigis") hcalOfflineSourceSequence = cms.Sequence( - digiTask - +tpTask - +recHitTask - +rawTask) + digiTask + + tpTask + + recHitTask + + rawTask ) hcalOnlyOfflineSourceSequence = cms.Sequence( - digiTask - +recHitPreRecoTask - +rawTask) + digiTask + + recHitPreRecoTask + + rawTask ) + +from Configuration.Eras.Modifier_run3_HB_cff import run3_HB +_phase1_hcalOnlyOfflineSourceSequence = hcalOnlyOfflineSourceSequence.copy() +_phase1_hcalOnlyOfflineSourceSequence.replace(recHitPreRecoTask, recHitTask) +run3_HB.toReplaceWith(hcalOnlyOfflineSourceSequence, _phase1_hcalOnlyOfflineSourceSequence) from Configuration.Eras.Modifier_phase2_hcal_cff import phase2_hcal _phase2_hcalOfflineSourceSequence = hcalOfflineSourceSequence.copyAndExclude([tpTask,rawTask]) diff --git a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py index 40718749c65db..25b8fed436ae2 100644 --- a/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py +++ b/RecoLocalCalo/Configuration/python/RecoLocalCalo_Cosmics_cff.py @@ -19,23 +19,20 @@ # sequence CaloLocalReco # -def hbheCosmic(module): - return module.clone( - tsFromDB = False, - recoParamsFromDB = False, - algorithm = dict( - useMahi = False, - useM2 = False, - useM3 = False, - firstSampleShift = -1000, - samplesToAdd = 10, - correctForPhaseContainment = False, - ), - sipmQTSShift = -100, - sipmQNTStoSum = 200, - ) - -hbhereco = hbheCosmic(_hcalLocalReco_cff.hbheprereco) +hbhereco = _hcalLocalReco_cff.hbheprereco.cpu.clone( + tsFromDB = False, + recoParamsFromDB = False, + algorithm = dict( + useMahi = False, + useM2 = False, + useM3 = False, + firstSampleShift = -1000, + samplesToAdd = 10, + correctForPhaseContainment = False, + ), + sipmQTSShift = -100, + sipmQNTStoSum = 200, +) hfreco = _hcalLocalReco_cff._default_hfreco.clone( firstSample = 0, samplesToAdd = 10, ### min(10,size) in the algo diff --git a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py index fbb4c53f9f28b..30b7927d5753a 100644 --- a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py @@ -1,21 +1,30 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA -from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import * +#--- for Run 1 and Run 2 +from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import hbhereco as _phase0_hbhereco +hbhereco = SwitchProducerCUDA( + cpu = _phase0_hbhereco +) hcalGlobalRecoTask = cms.Task(hbhereco) hcalGlobalRecoSequence = cms.Sequence(hcalGlobalRecoTask) +hcalOnlyGlobalRecoTask = cms.Task() +hcalOnlyGlobalRecoSequence = cms.Sequence(hcalOnlyGlobalRecoTask) + #--- for Run 3 and later from Configuration.Eras.Modifier_run3_HB_cff import run3_HB from RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi import hbheprereco as _phase1_hbheprereco -run3_HB.toReplaceWith(hbhereco, _phase1_hbheprereco) +run3_HB.toReplaceWith(hbhereco.cpu, _phase1_hbheprereco) +run3_HB.toReplaceWith(hcalOnlyGlobalRecoTask, cms.Task(hbhereco)) #--- for Run 3 on GPU from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hcalCPURecHitsProducer -gpu.toReplaceWith(hbhereco, _hcalCPURecHitsProducer.clone( - recHitsM0LabelIn = "hbheRecHitProducerGPU", - recHitsM0LabelOut = "", - recHitsLegacyLabelOut = "" -)) +from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hbherecoFromCUDA +(run3_HB & gpu).toModify(hbhereco, + cuda = _hbherecoFromCUDA.clone( + produceSoA = False + ) +) diff --git a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py index a7bdce3b916af..4c68380d686ac 100644 --- a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py @@ -1,15 +1,18 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoLocalCalo.HcalRecAlgos.hcalRecAlgoESProd_cfi import * from RecoLocalCalo.HcalRecAlgos.hcalChannelPropertiesESProd_cfi import * hcalOOTPileupESProducer = cms.ESProducer('OOTPileupDBCompatibilityESProducer') from RecoLocalCalo.HcalRecProducers.HBHEPhase1Reconstructor_cfi import hbheprereco as _phase1_hbheprereco -hbheprereco = _phase1_hbheprereco.clone( - processQIE11 = False, - tsFromDB = True, - pulseShapeParametersQIE8 = dict( - TrianglePeakTS = 4, +hbheprereco = SwitchProducerCUDA( + cpu = _phase1_hbheprereco.clone( + processQIE11 = False, + tsFromDB = True, + pulseShapeParametersQIE8 = dict( + TrianglePeakTS = 4, + ) ) ) @@ -34,7 +37,7 @@ run2_HF_2017.toReplaceWith( hcalLocalRecoTask, _phase1_hcalLocalRecoTask ) run2_HF_2017.toReplaceWith( hfreco, _phase1_hfreco ) from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 -run2_HCAL_2017.toReplaceWith(hbheprereco, _phase1_hbheprereco) +run2_HCAL_2017.toReplaceWith(hbheprereco.cpu, _phase1_hbheprereco) _plan1_hcalLocalRecoTask = _phase1_hcalLocalRecoTask.copy() _plan1_hcalLocalRecoTask.add(hbheplan1) @@ -57,27 +60,20 @@ from Configuration.ProcessModifiers.gpu_cff import gpu from RecoLocalCalo.HcalRecProducers.hbheRecHitProducerGPUTask_cff import * -_run3_hcalLocalRecoGPUTask = _run3_hcalLocalRecoTask.copy() +_run3_hcalLocalRecoGPUTask = hcalLocalRecoTask.copy() _run3_hcalLocalRecoGPUTask.add(hbheRecHitProducerGPUTask) gpu.toReplaceWith(hcalLocalRecoTask, _run3_hcalLocalRecoGPUTask) -#--- HCAL-only workflow for Run 3 -# FIXME rename `hbheprereco` to `hbhereco` and use it from hcalGlobalRecoTask -hcalOnlyLocalRecoTask = cms.Task(hbheprereco, hfprereco, hfreco, horeco) +#--- HCAL-only workflow +hcalOnlyLocalRecoTask = hcalLocalRecoTask.copyAndExclude([zdcreco]) -#--- HCAL-only workflow for Run 3 on GPU -from Configuration.ProcessModifiers.gpu_cff import gpu - -_hcalOnlyLocalRecoGPUTask = hcalOnlyLocalRecoTask.copy() -_hcalOnlyLocalRecoGPUTask.add(hbheRecHitProducerGPUTask) -gpu.toReplaceWith(hcalOnlyLocalRecoTask, _hcalOnlyLocalRecoGPUTask) - -from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hcalCPURecHitsProducer -gpu.toReplaceWith(hbheprereco, _hcalCPURecHitsProducer.clone( - recHitsM0LabelIn = "hbheRecHitProducerGPU", - recHitsM0LabelOut = "", - recHitsLegacyLabelOut = "" -)) +#--- HCAL-only workflow for Run 2 on GPU +from RecoLocalCalo.HcalRecProducers.hcalCPURecHitsProducer_cfi import hcalCPURecHitsProducer as _hbheprerecoFromCUDA +(gpu & ~run3_HB).toModify(hbheprereco, + cuda = _hbheprerecoFromCUDA.clone( + produceSoA = False + ) +) #--- for FastSim _fastSim_hcalLocalRecoTask = hcalLocalRecoTask.copyAndExclude([zdcreco]) diff --git a/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py b/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py index 455f3df9178f2..988a4b4a2b3cc 100644 --- a/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py +++ b/RecoLocalCalo/HcalRecProducers/python/HBHE_custom_25nsMethod.py @@ -2,11 +2,11 @@ def customise_HBHE_Method1(process): if hasattr(process,'hbheprereco'): - process.hbheprereco.puCorrMethod = cms.int32(1) + process.hbheprereco.cpu.puCorrMethod = cms.int32(1) return process def customise_HBHE_Method0(process): if hasattr(process,'hbheprereco'): - process.hbheprereco.puCorrMethod = cms.int32(0) + process.hbheprereco.cpu.puCorrMethod = cms.int32(0) return process diff --git a/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py b/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py index 8c7162bc076c4..0ce9caf13fa88 100644 --- a/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py +++ b/RecoLocalCalo/HcalRecProducers/test/make_GPUvsCPU_HCAL_rechits.py @@ -59,32 +59,32 @@ #process.hbheprereco.algorithm.correctForPhaseContainment = cms.bool(False) ## do always 8 pulse -process.hbheprereco.algorithm.chiSqSwitch = cms.double(-1) +process.hbheprereco.cpu.algorithm.chiSqSwitch = cms.double(-1) ## to match hard coded setting (will be fixed on CPU) -process.hbheprereco.algorithm.nMaxItersMin = cms.int32(50) +process.hbheprereco.cpu.algorithm.nMaxItersMin = cms.int32(50) #----------------------------------------- # Final Custmization for Run3 #----------------------------------------- # we will not run arrival Time at HLT -process.hbheprereco.algorithm.calculateArrivalTime = cms.bool(False) +process.hbheprereco.cpu.algorithm.calculateArrivalTime = cms.bool(False) ## we do not need this -process.hbheprereco.algorithm.applyLegacyHBMCorrection = cms.bool(False) +process.hbheprereco.cpu.algorithm.applyLegacyHBMCorrection = cms.bool(False) # we only run Mahi at HLT -process.hbheprereco.algorithm.useM3 = cms.bool(False) +process.hbheprereco.cpu.algorithm.useM3 = cms.bool(False) # we will not have the HPD noise flags in Run3, as will be all siPM -process.hbheprereco.setLegacyFlagsQIE8 = cms.bool(False) -process.hbheprereco.setNegativeFlagsQIE8 = cms.bool(False) -process.hbheprereco.setNoiseFlagsQIE8 = cms.bool(False) -process.hbheprereco.setPulseShapeFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setLegacyFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setNegativeFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setNoiseFlagsQIE8 = cms.bool(False) +process.hbheprereco.cpu.setPulseShapeFlagsQIE8 = cms.bool(False) # for testing M0 only -##process.hbheprereco.algorithm.useMahi = cms.bool(False) +##process.hbheprereco.cpu.algorithm.useMahi = cms.bool(False) #----------------------------------------- # OUTPUT @@ -148,4 +148,4 @@ # report CUDAService messages process.MessageLogger.cerr.FwkReport.reportEvery = 100 -process.MessageLogger.categories.append("CUDAService") +process.MessageLogger.CUDAService = cms.untracked.PSet() diff --git a/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py b/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py index c8939961bd36e..815e60d3c2b5a 100644 --- a/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py +++ b/RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py @@ -56,5 +56,8 @@ # HCALonly WF particleFlowRecHitHBHEOnly = particleFlowRecHitHBHE.clone( - producers = { 0: dict(src = "hbheprereco:") } + producers = { 0: dict(src = "hbheprereco") } +) +run3_HB.toModify(particleFlowRecHitHBHEOnly, + producers = { 0: dict(src = "hbhereco") } ) From 3ead0e533a54c595cc7ff82a3fded9b7c37b597e Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Fri, 23 Apr 2021 00:07:21 +0200 Subject: [PATCH 042/309] Rework the definition of the Patatrack pixel workflows Drop the obsolete pixelNtupleFit modifier, and replace the customizePixelTracksSoAonCPU function with the pixelNtupletFit modifier. Make the "gpu" workflows autodetect if a GPU is a present, and fall back to running only on CPU otherwise. Update the name of the modules for better consistency. --- .../python/Reconstruction_cff.py | 18 +-- .../python/pixelNtupleFit_cff.py | 5 - .../python/pixelNtupletFit_cff.py | 7 + .../python/relval_steps.py | 11 +- .../python/upgradeWorkflowComponents.py | 11 +- .../StandardSequences/python/RawToDigi_cff.py | 2 +- .../StandardSequences/python/Services_cff.py | 5 +- .../python/SiPixelRawToDigiRegional_cfi.py | 2 +- .../python/SiPixelRawToDigi_cfi.py | 13 +- .../python/siPixelDigis_cff.py | 39 ++++-- .../python/RecoLocalTracker_cff.py | 20 ++- .../SiPixelClusterizerPreSplitting_cfi.py | 10 +- .../python/siPixelClustersPreSplitting_cff.py | 42 ++++-- .../python/SiPixelRecHits_cfi.py | 50 +++---- .../python/RecoPixelVertexing_cff.py | 70 +++++++--- .../python/customizePixelTracksForTriplets.py | 10 ++ .../python/customizePixelTracksSoAonCPU.py | 62 --------- .../plugins/PixelTrackDumpCUDA.cc | 2 +- .../plugins/PixelTrackProducerFromSoA.cc | 2 +- .../plugins/PixelTrackSoAFromCUDA.cc | 4 +- .../python/PixelTracks_cff.py | 124 ++++++++++++------ .../PixelTriplets/plugins/CAHitNtupletCUDA.cc | 2 +- .../plugins/PixelVertexProducerCUDA.cc | 2 +- .../python/PixelVertexes_cff.py | 6 +- .../python/customizePixelOnlyForProfiling.py | 4 +- 25 files changed, 304 insertions(+), 219 deletions(-) delete mode 100644 Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py create mode 100644 Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py create mode 100644 RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py delete mode 100644 RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py diff --git a/CalibTracker/Configuration/python/Reconstruction_cff.py b/CalibTracker/Configuration/python/Reconstruction_cff.py index f6cafe076db9e..5e20b01ceb9a2 100644 --- a/CalibTracker/Configuration/python/Reconstruction_cff.py +++ b/CalibTracker/Configuration/python/Reconstruction_cff.py @@ -1,24 +1,24 @@ import FWCore.ParameterSet.Config as cms -#local reconstruction +# local reconstruction from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import * from EventFilter.SiStripRawToDigi.SiStripDigis_cfi import * from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerPreSplitting_cfi import * from RecoLocalTracker.SiStripZeroSuppression.SiStripZeroSuppression_cfi import * from RecoLocalTracker.SiStripClusterizer.SiStripClusterizer_cfi import * -recolocal = cms.Sequence( siPixelDigis*siPixelClustersPreSplitting*siStripDigis*siStripZeroSuppression*siStripClusters) -siPixelDigis.InputLabel = 'rawDataCollector' +recolocal = cms.Sequence(siPixelDigis + siPixelClustersPreSplitting + siStripDigis + siStripZeroSuppression + siStripClusters) +siPixelDigis.cpu.InputLabel = 'rawDataCollector' -#tracking +# tracking from RecoVertex.BeamSpotProducer.BeamSpot_cff import * from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitConverter_cfi import * from RecoTracker.Configuration.RecoTracker_cff import * from RecoTracker.Configuration.RecoTrackerP5_cff import * from RecoPixelVertexing.Configuration.RecoPixelVertexing_cff import * -recotrack = cms.Sequence( offlineBeamSpot + siPixelRecHitsPreSplitting*siStripMatchedRecHits*recopixelvertexing*ckftracks) -recotrackP5 = cms.Sequence( offlineBeamSpot + siPixelRecHitsPreSplitting*siStripMatchedRecHits*recopixelvertexing*ctftracksP5) +recotrack = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ckftracks) +recotrackP5 = cms.Sequence(offlineBeamSpot + siPixelRecHitsPreSplitting + siStripMatchedRecHits + recopixelvertexing + ctftracksP5) -#Schedule -reconstruction_step = cms.Path( recolocal + recotrack ) -reconstructionP5_step = cms.Path( recolocal + recotrackP5 ) +# Schedule +reconstruction_step = cms.Path(recolocal + recotrack) +reconstructionP5_step = cms.Path(recolocal + recotrackP5) diff --git a/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py b/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py deleted file mode 100644 index db8a2ac229a02..0000000000000 --- a/Configuration/ProcessModifiers/python/pixelNtupleFit_cff.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier is for replacing the default pixel track "fitting" with eihter Riemann or BrokenLine fit - -pixelNtupleFit = cms.Modifier() diff --git a/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py b/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py new file mode 100644 index 0000000000000..94b14a4f5a6e3 --- /dev/null +++ b/Configuration/ProcessModifiers/python/pixelNtupletFit_cff.py @@ -0,0 +1,7 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is for replacing the legacy pixel tracks with the "Patatrack" pixel ntuplets, +# fishbone cleaning, and either the Broken Line fit (by default) or the Riemann fit. +# It also replaces the "gap" pixel vertices with a density-based vertex reconstruction algorithm. + +pixelNtupletFit = cms.Modifier() diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 97235248c83b6..f25b5178c1fd8 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -2187,10 +2187,13 @@ def gen2021HiMix(fragment,howMuch): } step3_pixel_ntuplet_cpu = { - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' + '--procModifiers': 'pixelNtupletFit' +} +step3_pixel_ntuplet_gpu = { + '--procModifiers': 'pixelNtupletFit,gpu' } step3_pixel_triplets = { - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' } step3_gpu = { '--procModifiers': 'gpu', @@ -2324,9 +2327,9 @@ def gen2021HiMix(fragment,howMuch): steps['RECODR2_2018reHLT_ZBPrompt']=merge([{'--conditions':'auto:run2_data','-s':'RAW2DIGI,L1Reco,RECO,EI,PAT,ALCA:SiStripCalZeroBias+SiStripCalMinBias+TkAlMinBias+EcalESAlign,DQM:@rerecoZeroBias+@ExtraHLT+@miniAODDQM'},steps['RECODR2_2018reHLT']]) steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']=merge([{'-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,DQM:@pixelTrackingOnlyDQM'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_Patatrack_PixelOnlyCPU']=merge([step3_pixel_ntuplet_cpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) -steps['RECODR2_2018reHLT_Patatrack_PixelOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyGPU']=merge([step3_pixel_ntuplet_gpu, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsCPU']=merge([step3_pixel_ntuplet_cpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) -steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_gpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) +steps['RECODR2_2018reHLT_Patatrack_PixelOnlyTripletsGPU']=merge([step3_pixel_ntuplet_gpu, step3_pixel_triplets, steps['RECODR2_2018reHLT_Prompt_pixelTrackingOnly']]) steps['RECODR2_2018reHLT_ECALOnlyCPU']=merge([{'-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,DQM:@ecalOnly'},steps['RECODR2_2018reHLT_Prompt']]) steps['RECODR2_2018reHLT_ECALOnlyGPU']=merge([step3_gpu, steps['RECODR2_2018reHLT_ECALOnlyCPU']]) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index ff88d3b0c0546..492ff70c2c91c 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -444,7 +444,7 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyCPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU' + '--procModifiers': 'pixelNtupletFit' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -456,7 +456,7 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyGPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--procModifiers': 'gpu' + '--procModifiers': 'pixelNtupletFit,gpu' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -468,7 +468,8 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksSoAonCPU,RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + '--procModifiers': 'pixelNtupletFit', + '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' @@ -480,8 +481,8 @@ def setup_(self, step, stepName, stepDict, k, properties): upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = PatatrackWorkflow( reco = { '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM', - '--procModifiers': 'gpu', - '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksSoAonCPU.customizePixelTracksForTriplets' + '--procModifiers': 'pixelNtupletFit,gpu', + '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets' }, harvest = { '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' diff --git a/Configuration/StandardSequences/python/RawToDigi_cff.py b/Configuration/StandardSequences/python/RawToDigi_cff.py index 60ed421a6205f..ef77578a7775d 100644 --- a/Configuration/StandardSequences/python/RawToDigi_cff.py +++ b/Configuration/StandardSequences/python/RawToDigi_cff.py @@ -87,7 +87,7 @@ run3_common.toReplaceWith(RawToDigiTask, RawToDigiTask.copyAndExclude([castorDigis])) from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker -# Remove siPixelDigis until we have phase1 pixel digis +# Remove siPixelDigis until we have Phase 2 pixel digis phase2_tracker.toReplaceWith(RawToDigiTask, RawToDigiTask.copyAndExclude([siPixelDigis])) # FIXME diff --git a/Configuration/StandardSequences/python/Services_cff.py b/Configuration/StandardSequences/python/Services_cff.py index ef1da8dec1d59..0949c7b8d4972 100644 --- a/Configuration/StandardSequences/python/Services_cff.py +++ b/Configuration/StandardSequences/python/Services_cff.py @@ -8,12 +8,13 @@ # DQM store service from DQMServices.Core.DQMStore_cfi import * -# load CUDA services when the "gpu" modifier is enabled +# load CUDA services when the "gpu" or "pixelNtupletFit" modifiers are enabled def _addCUDAServices(process): process.load("HeterogeneousCore.CUDAServices.CUDAService_cfi") from Configuration.ProcessModifiers.gpu_cff import gpu -modifyConfigurationStandardSequencesServicesAddCUDAServices_ = gpu.makeProcessModifier(_addCUDAServices) +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit +modifyConfigurationStandardSequencesServicesAddCUDAServices_ = (gpu | pixelNtupletFit).makeProcessModifier(_addCUDAServices) # load TritonService when SONIC workflow is enabled def _addTritonService(process): diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py index 34897891cd323..81622b3b9d1e1 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigiRegional_cfi.py @@ -3,7 +3,7 @@ from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import * ## regional seeded unpacking for specialized HLT paths -siPixelDigisRegional = siPixelDigis.clone() +siPixelDigisRegional = siPixelDigis.cpu.clone() siPixelDigisRegional.Regions = cms.PSet( inputs = cms.VInputTag( "hltL2EtCutDoublePFIsoTau45Trk5" ), deltaPhi = cms.vdouble( 0.5 ), diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py index 50c8f0fcabd3c..13fff5e0e1600 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelRawToDigi_cfi.py @@ -1,15 +1,20 @@ import FWCore.ParameterSet.Config as cms -from EventFilter.SiPixelRawToDigi.siPixelRawToDigi_cfi import siPixelRawToDigi as _siPixelRawToDigi - from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu + +# legacy pixel unpacker +from EventFilter.SiPixelRawToDigi.siPixelRawToDigi_cfi import siPixelRawToDigi as _siPixelRawToDigi siPixelDigis = SwitchProducerCUDA( cpu = _siPixelRawToDigi.clone() ) +# use the Phase 1 settings from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(siPixelDigis.cpu, UsePhase1=True) +phase1Pixel.toModify(siPixelDigis.cpu, + UsePhase1 = True +) -from Configuration.ProcessModifiers.gpu_cff import gpu +# SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA gpu.toModify(siPixelDigis, cuda = cms.EDAlias( siPixelDigiErrors = cms.VPSet( diff --git a/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py b/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py index 5c1ff74be9c69..8a84ba90b5ac0 100644 --- a/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py +++ b/EventFilter/SiPixelRawToDigi/python/siPixelDigis_cff.py @@ -1,30 +1,43 @@ import FWCore.ParameterSet.Config as cms from EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi import siPixelDigis -from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA -from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA -from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA -siPixelDigisTask = cms.Task(siPixelDigis) +siPixelDigisTask = cms.Task( + # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + siPixelDigis +) +# copy the pixel digis (except errors) and clusters to the host +from EventFilter.SiPixelRawToDigi.siPixelDigisSoAFromCUDA_cfi import siPixelDigisSoAFromCUDA as _siPixelDigisSoAFromCUDA siPixelDigisSoA = _siPixelDigisSoAFromCUDA.clone( src = "siPixelClustersPreSplittingCUDA" ) + +# copy the pixel digis errors to the host +from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsSoAFromCUDA_cfi import siPixelDigiErrorsSoAFromCUDA as _siPixelDigiErrorsSoAFromCUDA siPixelDigiErrorsSoA = _siPixelDigiErrorsSoAFromCUDA.clone( src = "siPixelClustersPreSplittingCUDA" ) + +# convert the pixel digis errors to the legacy format +from EventFilter.SiPixelRawToDigi.siPixelDigiErrorsFromSoA_cfi import siPixelDigiErrorsFromSoA as _siPixelDigiErrorsFromSoA siPixelDigiErrors = _siPixelDigiErrorsFromSoA.clone() +# use the Phase 1 settings from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel -phase1Pixel.toModify(siPixelDigiErrors, UsePhase1=True) - -siPixelDigisTaskCUDA = cms.Task( - siPixelDigisSoA, - siPixelDigiErrorsSoA, - siPixelDigiErrors +phase1Pixel.toModify(siPixelDigiErrors, + UsePhase1 = True ) + from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelDigisTask_gpu = siPixelDigisTask.copy() -_siPixelDigisTask_gpu.add(siPixelDigisTaskCUDA) -gpu.toReplaceWith(siPixelDigisTask, _siPixelDigisTask_gpu) +gpu.toReplaceWith(siPixelDigisTask, cms.Task( + # copy the pixel digis (except errors) and clusters to the host + siPixelDigisSoA, + # copy the pixel digis errors to the host + siPixelDigiErrorsSoA, + # convert the pixel digis errors to the legacy format + siPixelDigiErrors, + # SwitchProducer wrapping the legacy pixel digis producer or an alias combining the pixel digis information converted from SoA + siPixelDigisTask.copy() +)) diff --git a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py index 35a72f0edb08f..809c440effb53 100644 --- a/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py +++ b/RecoLocalTracker/Configuration/python/RecoLocalTracker_cff.py @@ -1,9 +1,7 @@ import FWCore.ParameterSet.Config as cms -# # Tracker Local Reco -# Initialize magnetic field -# + from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitConverter_cfi import * from RecoLocalTracker.SiStripRecHitConverter.SiStripRecHitMatcher_cfi import * from RecoLocalTracker.SiStripRecHitConverter.StripCPEfromTrackAngle_cfi import * @@ -13,9 +11,19 @@ from RecoLocalTracker.SiPixelRecHits.SiPixelRecHits_cfi import * from RecoLocalTracker.SubCollectionProducers.clustersummaryproducer_cfi import * -pixeltrackerlocalrecoTask = cms.Task(siPixelClustersPreSplittingTask,siPixelRecHitsPreSplittingTask) -striptrackerlocalrecoTask = cms.Task(siStripZeroSuppression,siStripClusters,siStripMatchedRecHits) -trackerlocalrecoTask = cms.Task(pixeltrackerlocalrecoTask,striptrackerlocalrecoTask,clusterSummaryProducer) +pixeltrackerlocalrecoTask = cms.Task( + siPixelClustersPreSplittingTask, + siPixelRecHitsPreSplittingTask) + +striptrackerlocalrecoTask = cms.Task( + siStripZeroSuppression, + siStripClusters, + siStripMatchedRecHits) + +trackerlocalrecoTask = cms.Task( + pixeltrackerlocalrecoTask, + striptrackerlocalrecoTask, + clusterSummaryProducer) pixeltrackerlocalreco = cms.Sequence(pixeltrackerlocalrecoTask) striptrackerlocalreco = cms.Sequence(striptrackerlocalrecoTask) diff --git a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py index b9c6862b015bf..f3675134fb84d 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/SiPixelClusterizerPreSplitting_cfi.py @@ -1,14 +1,22 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +# SiPixelGainCalibrationServiceParameters from CondTools.SiPixel.SiPixelGainCalibrationService_cfi import * + +# legacy pixel cluster producer from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizer_cfi import siPixelClusters as _siPixelClusters -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA siPixelClustersPreSplitting = SwitchProducerCUDA( cpu = _siPixelClusters.clone() ) from Configuration.ProcessModifiers.gpu_cff import gpu +# SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA gpu.toModify(siPixelClustersPreSplitting, + # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU + cpu = dict( + payloadType = 'HLT' + ), cuda = cms.EDAlias( siPixelDigisClustersPreSplitting = cms.VPSet( cms.PSet(type = cms.string("SiPixelClusteredmNewDetSetVector")) diff --git a/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py b/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py index 8bbf47e9ebf90..50e47edbcce26 100644 --- a/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py +++ b/RecoLocalTracker/SiPixelClusterizer/python/siPixelClustersPreSplitting_cff.py @@ -1,26 +1,40 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Modifier_run3_common_cff import run3_common +from Configuration.ProcessModifiers.gpu_cff import gpu +# conditions used *only* by the modules running on GPU +from CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi import siPixelROCsStatusAndMappingWrapperESProducer +from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi import siPixelGainCalibrationForHLTGPU + +# SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizerPreSplitting_cfi import siPixelClustersPreSplitting -from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA -from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA -from CalibTracker.SiPixelESProducers.siPixelROCsStatusAndMappingWrapperESProducer_cfi import * -from CalibTracker.SiPixelESProducers.siPixelGainCalibrationForHLTGPU_cfi import * -siPixelClustersPreSplittingTask = cms.Task(siPixelClustersPreSplitting) +siPixelClustersPreSplittingTask = cms.Task( + # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + siPixelClustersPreSplitting +) +# reconstruct the pixel digis and clusters on the gpu +from RecoLocalTracker.SiPixelClusterizer.siPixelRawToClusterCUDA_cfi import siPixelRawToClusterCUDA as _siPixelRawToClusterCUDA siPixelClustersPreSplittingCUDA = _siPixelRawToClusterCUDA.clone() -from Configuration.Eras.Modifier_run3_common_cff import run3_common + run3_common.toModify(siPixelClustersPreSplittingCUDA, - isRun2=False + # use the pixel channel calibrations scheme for Run 3 + isRun2 = False ) +# convert the pixel digis (except errors) and clusters to the legacy format +from RecoLocalTracker.SiPixelClusterizer.siPixelDigisClustersFromSoA_cfi import siPixelDigisClustersFromSoA as _siPixelDigisClustersFromSoA siPixelDigisClustersPreSplitting = _siPixelDigisClustersFromSoA.clone() -siPixelClustersPreSplittingTaskCUDA = cms.Task( + +gpu.toReplaceWith(siPixelClustersPreSplittingTask, cms.Task( + # conditions used *only* by the modules running on GPU + siPixelROCsStatusAndMappingWrapperESProducer, + siPixelGainCalibrationForHLTGPU, + # reconstruct the pixel digis and clusters on the gpu siPixelClustersPreSplittingCUDA, + # convert the pixel digis (except errors) and clusters to the legacy format siPixelDigisClustersPreSplitting, -) - -from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelClustersPreSplittingTask_gpu = siPixelClustersPreSplittingTask.copy() -_siPixelClustersPreSplittingTask_gpu.add(siPixelClustersPreSplittingTaskCUDA) -gpu.toReplaceWith(siPixelClustersPreSplittingTask, _siPixelClustersPreSplittingTask_gpu) + # SwitchProducer wrapping the legacy pixel cluster producer or an alias for the pixel clusters information converted from SoA + siPixelClustersPreSplittingTask.copy() +)) diff --git a/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py b/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py index eb9dbad4934cd..8430b19f1e9be 100644 --- a/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py +++ b/RecoLocalTracker/SiPixelRecHits/python/SiPixelRecHits_cfi.py @@ -1,44 +1,46 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +from Configuration.ProcessModifiers.gpu_cff import gpu +# legacy pixel rechit producer siPixelRecHits = cms.EDProducer("SiPixelRecHitConverter", src = cms.InputTag("siPixelClusters"), CPE = cms.string('PixelCPEGeneric'), VerboseLevel = cms.untracked.int32(0) ) -_siPixelRecHitsPreSplitting = siPixelRecHits.clone( - src = 'siPixelClustersPreSplitting' -) - -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA +# SwitchProducer wrapping the legacy pixel rechit producer siPixelRecHitsPreSplitting = SwitchProducerCUDA( - cpu = _siPixelRecHitsPreSplitting.clone() + cpu = siPixelRecHits.clone( + src = 'siPixelClustersPreSplitting' + ) ) +# convert the pixel rechits from legacy to SoA format +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy as siPixelRecHitsPreSplittingSoA - -from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA -from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA - -gpu.toModify(siPixelRecHitsPreSplitting, - cuda = _siPixelRecHitFromCUDA.clone() +siPixelRecHitsPreSplittingTask = cms.Task( + # SwitchProducer wrapping the legacy pixel rechit producer + siPixelRecHitsPreSplitting, + # convert the pixel rechits from legacy to SoA format + siPixelRecHitsPreSplittingSoA ) - -siPixelRecHitsPreSplittingTask = cms.Task(siPixelRecHitsPreSplitting) - +# reconstruct the pixel rechits on the gpu +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitCUDA_cfi import siPixelRecHitCUDA as _siPixelRecHitCUDA siPixelRecHitsPreSplittingCUDA = _siPixelRecHitCUDA.clone( beamSpot = "offlineBeamSpotToCUDA" ) -siPixelRecHitsPreSplittingLegacy = _siPixelRecHitFromCUDA.clone() -siPixelRecHitsPreSplittingTaskCUDA = cms.Task( - siPixelRecHitsPreSplittingCUDA, - siPixelRecHitsPreSplittingLegacy, +# transfer the pixel rechits to the host and convert them from SoA +from RecoLocalTracker.SiPixelRecHits.siPixelRecHitFromCUDA_cfi import siPixelRecHitFromCUDA as _siPixelRecHitFromCUDA +gpu.toModify(siPixelRecHitsPreSplitting, + cuda = _siPixelRecHitFromCUDA.clone() ) -from Configuration.ProcessModifiers.gpu_cff import gpu -_siPixelRecHitsPreSplittingTask_gpu = siPixelRecHitsPreSplittingTask.copy() -_siPixelRecHitsPreSplittingTask_gpu.add(siPixelRecHitsPreSplittingTaskCUDA) -gpu.toReplaceWith(siPixelRecHitsPreSplittingTask, _siPixelRecHitsPreSplittingTask_gpu) +gpu.toReplaceWith(siPixelRecHitsPreSplittingTask, cms.Task( + # reconstruct the pixel rechits on the gpu + siPixelRecHitsPreSplittingCUDA, + # SwitchProducer wrapping the legacy pixel rechit producer or the transfer of the pixel rechits to the host and the conversion from SoA + siPixelRecHitsPreSplittingTask.copy() +)) diff --git a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py index 4b32839e21b0e..391055bd870e8 100644 --- a/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py +++ b/RecoPixelVertexing/Configuration/python/RecoPixelVertexing_cff.py @@ -1,29 +1,67 @@ import FWCore.ParameterSet.Config as cms +from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA from RecoPixelVertexing.PixelTrackFitting.PixelTracks_cff import * -# -# for STARTUP ONLY use try and use Offline 3D PV from pixelTracks, with adaptive vertex -# from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cff import * -#from RecoVertex.PrimaryVertexProducer.OfflinePixel3DPrimaryVertices_cfi import * -recopixelvertexingTask = cms.Task(pixelTracksTask, pixelVertices) -from Configuration.ProcessModifiers.gpu_cff import gpu -_recopixelvertexingTask_gpu = recopixelvertexingTask.copy() +# legacy pixel vertex reconsruction using the divisive vertex finder +pixelVerticesTask = cms.Task( + pixelVertices +) -from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA -_recopixelvertexingTask_gpu.add(pixelVertexCUDA) +# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit -from RecoPixelVertexing.PixelVertexFinding.pixelVertexSoA_cfi import pixelVertexSoA -_recopixelvertexingTask_gpu.add(pixelVertexSoA) +# build the pixel vertices in SoA format on the CPU +from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA as _pixelVertexCUDA +pixelVerticesSoA = SwitchProducerCUDA( + cpu = _pixelVertexCUDA.clone( + pixelTrackSrc = "pixelTracksSoA", + onGPU = False + ) +) +# convert the pixel vertices from SoA to legacy format from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA as _pixelVertexFromSoA -# this is needed because the 'pixelTrack' EDAlias does not contain the 'ushorts' collections -_pixelVertexFromSoA.TrackCollection = 'pixelTrackFromSoA' -gpu.toModify(pixelVertices, - cuda = _pixelVertexFromSoA +pixelNtupletFit.toReplaceWith(pixelVertices, _pixelVertexFromSoA.clone( + src = "pixelVerticesSoA" +)) + +pixelNtupletFit.toReplaceWith(pixelVerticesTask, cms.Task( + # build the pixel vertices in SoA format on the CPU + pixelVerticesSoA, + # convert the pixel vertices from SoA to legacy format + pixelVertices +)) + + +# "Patatrack" sequence running on the GPU +from Configuration.ProcessModifiers.gpu_cff import gpu + +# build pixel vertices in SoA format on the GPU +pixelVerticesCUDA = _pixelVertexCUDA.clone( + pixelTrackSrc = "pixelTracksCUDA", + onGPU = True ) -gpu.toReplaceWith(recopixelvertexingTask, _recopixelvertexingTask_gpu) +# transfer the pixel vertices in SoA format to the CPU +from RecoPixelVertexing.PixelVertexFinding.pixelVertexSoA_cfi import pixelVertexSoA as _pixelVertexSoA +gpu.toModify(pixelVerticesSoA, + cuda = _pixelVertexSoA.clone( + src = cms.InputTag("pixelVerticesCUDA") + ) +) +(pixelNtupletFit & gpu).toReplaceWith(pixelVerticesTask, cms.Task( + # build pixel vertices in SoA format on the GPU + pixelVerticesCUDA, + # transfer the pixel vertices in SoA format to the CPU and convert them to legacy format + pixelVerticesTask.copy() +)) + +# Tasks and Sequences +recopixelvertexingTask = cms.Task( + pixelTracksTask, + pixelVerticesTask +) recopixelvertexing = cms.Sequence(recopixelvertexingTask) diff --git a/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py b/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py new file mode 100644 index 0000000000000..51abcd3ea7982 --- /dev/null +++ b/RecoPixelVertexing/Configuration/python/customizePixelTracksForTriplets.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +def customizePixelTracksForTriplets(process): + + from HLTrigger.Configuration.common import producers_by_type + for producer in producers_by_type(process, 'CAHitNtupletCUDA'): + producer.includeJumpingForwardDoublets = True + producer.minHitsPerNtuplet = 3 + + return process diff --git a/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py b/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py deleted file mode 100644 index 1661cac832b8b..0000000000000 --- a/RecoPixelVertexing/Configuration/python/customizePixelTracksSoAonCPU.py +++ /dev/null @@ -1,62 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -def customizePixelTracksSoAonCPU(process): - - process.CUDAService = cms.Service('CUDAService', - enabled = cms.untracked.bool(False) - ) - - # ensure the same results when running on GPU (which supports only the 'HLT' payload) and CPU - process.siPixelClustersPreSplitting.cpu.payloadType = cms.string('HLT') - - from RecoLocalTracker.SiPixelRecHits.siPixelRecHitSoAFromLegacy_cfi import siPixelRecHitSoAFromLegacy - process.siPixelRecHitsPreSplitting = siPixelRecHitSoAFromLegacy.clone( - convertToLegacy = True - ) - - from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA - process.pixelTrackSoA = caHitNtupletCUDA.clone( - onGPU = False, - pixelRecHitSrc = 'siPixelRecHitsPreSplitting' - ) - - from RecoPixelVertexing.PixelVertexFinding.pixelVertexCUDA_cfi import pixelVertexCUDA - process.pixelVertexSoA = pixelVertexCUDA.clone( - onGPU = False, - pixelTrackSrc = 'pixelTrackSoA' - ) - - from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA - process.pixelTracks = pixelTrackProducerFromSoA.clone( - pixelRecHitLegacySrc = 'siPixelRecHitsPreSplitting' - ) - - from RecoPixelVertexing.PixelVertexFinding.pixelVertexFromSoA_cfi import pixelVertexFromSoA - process.pixelVertices = pixelVertexFromSoA.clone() - - process.reconstruction_step += process.siPixelRecHitsPreSplitting + process.pixelTrackSoA + process.pixelVertexSoA - - return process - - -def customizePixelTracksForTriplets(process): - - from HLTrigger.Configuration.common import producers_by_type - for producer in producers_by_type(process, 'CAHitNtupletCUDA'): - producer.includeJumpingForwardDoublets = True - producer.minHitsPerNtuplet = 3 - - return process - - -def customizePixelTracksSoAonCPUForProfiling(process): - - process = customizePixelTracksSoAonCPU(process) - - process.siPixelRecHitSoAFromLegacy.convertToLegacy = False - - process.TkSoA = cms.Path(process.offlineBeamSpot + process.siPixelDigis + process.siPixelClustersPreSplitting + process.siPixelRecHitSoAFromLegacy + process.pixelTrackSoA + process.pixelVertexSoA) - - process.schedule = cms.Schedule(process.TkSoA) - - return process diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc index 2f0965be50eb8..04cc57db5876c 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackDumpCUDA.cc @@ -54,7 +54,7 @@ void PixelTrackDumpCUDA::fillDescriptions(edm::ConfigurationDescriptions& descri edm::ParameterSetDescription desc; desc.add("onGPU", true); - desc.add("pixelTrackSrc", edm::InputTag("caHitNtupletCUDA")); + desc.add("pixelTrackSrc", edm::InputTag("pixelTracksCUDA")); desc.add("pixelVertexSrc", edm::InputTag("pixelVertexCUDA")); descriptions.add("pixelTrackDumpCUDA", desc); } diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc index 94c490e948575..60225eceebc00 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducerFromSoA.cc @@ -82,7 +82,7 @@ PixelTrackProducerFromSoA::PixelTrackProducerFromSoA(const edm::ParameterSet &iC void PixelTrackProducerFromSoA::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { edm::ParameterSetDescription desc; desc.add("beamSpot", edm::InputTag("offlineBeamSpot")); - desc.add("trackSrc", edm::InputTag("pixelTrackSoA")); + desc.add("trackSrc", edm::InputTag("pixelTracksSoA")); desc.add("pixelRecHitLegacySrc", edm::InputTag("siPixelRecHitsPreSplittingLegacy")); desc.add("minNumberOfHits", 0); diff --git a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc index 2de8ec6c335b5..ad2da317e8ba6 100644 --- a/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc +++ b/RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackSoAFromCUDA.cc @@ -46,8 +46,8 @@ PixelTrackSoAFromCUDA::PixelTrackSoAFromCUDA(const edm::ParameterSet& iConfig) void PixelTrackSoAFromCUDA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add("src", edm::InputTag("caHitNtupletCUDA")); - descriptions.add("pixelTrackSoA", desc); + desc.add("src", edm::InputTag("pixelTracksCUDA")); + descriptions.add("pixelTracksSoA", desc); } void PixelTrackSoAFromCUDA::acquire(edm::Event const& iEvent, diff --git a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py index 244e68faba8b6..ec9bb133a6c58 100644 --- a/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py +++ b/RecoPixelVertexing/PixelTrackFitting/python/PixelTracks_cff.py @@ -24,9 +24,11 @@ import RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi from RecoTracker.FinalTrackSelectors.trackAlgoPriorityOrder_cfi import trackAlgoPriorityOrder +# Eras from Configuration.Eras.Modifier_trackingLowPU_cff import trackingLowPU +from Configuration.Eras.Modifier_run3_common_cff import run3_common -# SEEDING LAYERS +# seeding layers from RecoTracker.IterativeTracking.InitialStep_cff import initialStepSeedLayers, initialStepHitDoublets, _initialStepCAHitQuadruplets # TrackingRegion @@ -34,7 +36,7 @@ trackingLowPU.toReplaceWith(pixelTracksTrackingRegions, _globalTrackingRegionFromBeamSpot.clone()) -# Pixel Quadruplets Tracking +# Pixel quadruplets tracking pixelTracksSeedLayers = initialStepSeedLayers.clone( BPix = dict(HitProducer = "siPixelRecHitsPreSplitting"), FPix = dict(HitProducer = "siPixelRecHitsPreSplitting") @@ -51,22 +53,10 @@ SeedComparitorPSet = dict(clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting') ) -# for trackingLowPU -pixelTracksHitTriplets = _pixelTripletHLTEDProducer.clone( - doublets = "pixelTracksHitDoublets", - produceSeedingHitSets = True, - SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( - clusterShapeCacheSrc = "siPixelClusterShapeCachePreSplitting" - ) +pixelTracks = _pixelTracks.clone( + SeedingHitSets = "pixelTracksHitQuadruplets" ) -pixelTracks = SwitchProducerCUDA( - cpu = _pixelTracks.clone( - SeedingHitSets = "pixelTracksHitQuadruplets" - ) -) -trackingLowPU.toModify(pixelTracks.cpu, SeedingHitSets = "pixelTracksHitTriplets") - pixelTracksTask = cms.Task( pixelTracksTrackingRegions, pixelFitterByHelixProjections, @@ -76,35 +66,91 @@ pixelTracksHitQuadruplets, pixelTracks ) + +pixelTracksSequence = cms.Sequence(pixelTracksTask) + + +# Pixel triplets for trackingLowPU +pixelTracksHitTriplets = _pixelTripletHLTEDProducer.clone( + doublets = "pixelTracksHitDoublets", + produceSeedingHitSets = True, + SeedComparitorPSet = RecoPixelVertexing.PixelLowPtUtilities.LowPtClusterShapeSeedComparitor_cfi.LowPtClusterShapeSeedComparitor.clone( + clusterShapeCacheSrc = "siPixelClusterShapeCachePreSplitting" + ) +) + +trackingLowPU.toModify(pixelTracks, + SeedingHitSets = "pixelTracksHitTriplets" +) + _pixelTracksTask_lowPU = pixelTracksTask.copy() _pixelTracksTask_lowPU.replace(pixelTracksHitQuadruplets, pixelTracksHitTriplets) trackingLowPU.toReplaceWith(pixelTracksTask, _pixelTracksTask_lowPU) -# Use ntuple fit and substitute previous Fitter producer with the ntuple one -from Configuration.ProcessModifiers.pixelNtupleFit_cff import pixelNtupleFit as ntupleFit -ntupleFit.toModify(pixelTracks.cpu, Fitter = "pixelNtupletsFitter") -_pixelTracksTask_ntupleFit = pixelTracksTask.copy() -_pixelTracksTask_ntupleFit.replace(pixelFitterByHelixProjections, pixelNtupletsFitter) -ntupleFit.toReplaceWith(pixelTracksTask, _pixelTracksTask_ntupleFit) +# "Patatrack" pixel ntuplets, fishbone cleaning, Broken Line fit, and density-based vertex reconstruction +from Configuration.ProcessModifiers.pixelNtupletFit_cff import pixelNtupletFit -from Configuration.ProcessModifiers.gpu_cff import gpu -from RecoPixelVertexing.PixelTriplets.caHitNtupletCUDA_cfi import caHitNtupletCUDA -from RecoPixelVertexing.PixelTrackFitting.pixelTrackSoA_cfi import pixelTrackSoA -from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as pixelTrackFromSoA -_pixelTracksTask_gpu = pixelTracksTask.copy() -_pixelTracksTask_gpu.add(caHitNtupletCUDA, pixelTrackSoA, pixelTrackFromSoA) -# this is needed (instead of simply using pixelTracks.cuda = pixelTrackFromSoA.clone()) because -# the PixelTrackProducerFromSoA produces an additional 'ushorts' collection -gpu.toModify(pixelTracks, - cuda = cms.EDAlias( - pixelTrackFromSoA = cms.VPSet( - cms.PSet(type = cms.string("recoTracks")), - cms.PSet(type = cms.string("recoTrackExtras")), - cms.PSet(type = cms.string("TrackingRecHitsOwned")) - ) +from RecoPixelVertexing.PixelTriplets.pixelTracksCUDA_cfi import pixelTracksCUDA as _pixelTracksCUDA + +# SwitchProducer providing the pixel tracks in SoA format on the CPU +pixelTracksSoA = SwitchProducerCUDA( + # build pixel ntuplets and pixel tracks in SoA format on the CPU + cpu = _pixelTracksCUDA.clone( + pixelRecHitSrc = "siPixelRecHitsPreSplittingSoA", + idealConditions = False, + onGPU = False ) ) -gpu.toReplaceWith(pixelTracksTask, _pixelTracksTask_gpu) +# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows +run3_common.toModify(pixelTracksSoA.cpu, + idealConditions = True +) -pixelTracksSequence = cms.Sequence(pixelTracksTask) +# convert the pixel tracks from SoA to legacy format +from RecoPixelVertexing.PixelTrackFitting.pixelTrackProducerFromSoA_cfi import pixelTrackProducerFromSoA as _pixelTrackProducerFromSoA +pixelNtupletFit.toReplaceWith(pixelTracks, _pixelTrackProducerFromSoA.clone( + pixelRecHitLegacySrc = "siPixelRecHitsPreSplitting", +)) + +pixelNtupletFit.toReplaceWith(pixelTracksTask, cms.Task( + #pixelTracksTrackingRegions, + #pixelFitterByHelixProjections, + #pixelTrackFilterByKinematics, + #pixelTracksSeedLayers, + #pixelTracksHitDoublets, + #pixelTracksHitQuadruplets, + # build the pixel ntuplets and the pixel tracks in SoA format on the GPU + pixelTracksSoA, + # convert the pixel tracks from SoA to legacy format + pixelTracks +)) + + +# "Patatrack" sequence running on GPU +from Configuration.ProcessModifiers.gpu_cff import gpu + +# build the pixel ntuplets and pixel tracks in SoA format on the GPU +pixelTracksCUDA = _pixelTracksCUDA.clone( + pixelRecHitSrc = "siPixelRecHitsPreSplittingCUDA", + idealConditions = False, + onGPU = True +) +# use quality cuts tuned for Run 2 ideal conditions for all Run 3 workflows +run3_common.toModify(pixelTracksCUDA, + idealConditions = True +) + +# SwitchProducer providing the pixel tracks in SoA format on the CPU +from RecoPixelVertexing.PixelTrackFitting.pixelTracksSoA_cfi import pixelTracksSoA as _pixelTracksSoA +gpu.toModify(pixelTracksSoA, + # transfer the pixel tracks in SoA format to the host + cuda = _pixelTracksSoA.clone() +) + +(pixelNtupletFit & gpu).toReplaceWith(pixelTracksTask, cms.Task( + # build the pixel ntuplets and pixel tracks in SoA format on the GPU + pixelTracksCUDA, + # transfer the pixel tracks in SoA format to the CPU, and convert them to legacy format + pixelTracksTask.copy() +)) diff --git a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc index beba54c33f513..ee295d8f5253c 100644 --- a/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc +++ b/RecoPixelVertexing/PixelTriplets/plugins/CAHitNtupletCUDA.cc @@ -61,7 +61,7 @@ void CAHitNtupletCUDA::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("pixelRecHitSrc", edm::InputTag("siPixelRecHitsPreSplittingCUDA")); CAHitNtupletGeneratorOnGPU::fillDescriptions(desc); - descriptions.add("caHitNtupletCUDA", desc); + descriptions.add("pixelTracksCUDA", desc); } void CAHitNtupletCUDA::produce(edm::StreamID streamID, edm::Event& iEvent, const edm::EventSetup& es) const { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc b/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc index e2c2bc76c8612..2989403fa4214 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/PixelVertexProducerCUDA.cc @@ -85,7 +85,7 @@ void PixelVertexProducerCUDA::fillDescriptions(edm::ConfigurationDescriptions& d desc.add("chi2max", 9.); // max normalized distance to cluster desc.add("PtMin", 0.5); - desc.add("pixelTrackSrc", edm::InputTag("caHitNtupletCUDA")); + desc.add("pixelTrackSrc", edm::InputTag("pixelTracksCUDA")); auto label = "pixelVertexCUDA"; descriptions.add(label, desc); diff --git a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py index a33d5c14af751..d47ce2eb339b4 100644 --- a/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py +++ b/RecoPixelVertexing/PixelVertexFinding/python/PixelVertexes_cff.py @@ -1,7 +1,3 @@ import FWCore.ParameterSet.Config as cms -from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA -from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cfi import pvClusterComparer, pixelVertices as _pixelVertices -pixelVertices = SwitchProducerCUDA( - cpu = _pixelVertices.clone() -) +from RecoPixelVertexing.PixelVertexFinding.PixelVertexes_cfi import * diff --git a/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py b/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py index 24774bbda649c..045738b37dde1 100644 --- a/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py +++ b/RecoTracker/Configuration/python/customizePixelOnlyForProfiling.py @@ -6,7 +6,7 @@ def customizePixelOnlyForProfilingGPUOnly(process): process.consumer = cms.EDAnalyzer("GenericConsumer", - eventProducts = cms.untracked.vstring('caHitNtupletCUDA', 'pixelVertexCUDA') + eventProducts = cms.untracked.vstring('pixelTracksCUDA', 'pixelVertexCUDA') ) process.consume_step = cms.EndPath(process.consumer) @@ -28,7 +28,7 @@ def customizePixelOnlyForProfilingGPUWithHostCopy(process): #? process.siPixelRecHitSoAFromLegacy.convertToLegacy = False process.consumer = cms.EDAnalyzer("GenericConsumer", - eventProducts = cms.untracked.vstring('pixelTrackSoA', 'pixelVertexSoA') + eventProducts = cms.untracked.vstring('pixelTracksSoA', 'pixelVertexSoA') ) process.consume_step = cms.EndPath(process.consumer) From bdb19a4a6d1e4ccee3332688b12674921ab48cd9 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 26 Apr 2021 11:03:56 +0200 Subject: [PATCH 043/309] Fix 'overlapping' --- CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc index a8c2aa514f11b..19f1a36c6123b 100644 --- a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc +++ b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc @@ -232,9 +232,7 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, charge = hitCluster.strip->charge(); saturation = std::any_of(ampls.begin(), ampls.end(), [](uint8_t amp) { return amp >= 254; }); - overlapping = (((firstStrip % 128) == 0) || - (((firstStrip / 128) != ((firstStrip + int(nStrips)) / 128)) && ((firstStrip / 128) < 5)) || - (((firstStrip + int(nStrips)) % 128) == 127)); + overlapping = (((firstStrip % 128) == 0) || ((firstStrip / 128) != ((firstStrip + int(nStrips)) / 128))); } else if (hitCluster.pixel) { const auto& ampls = hitCluster.pixel->pixelADC(); const int firstRow = hitCluster.pixel->minPixelRow(); From c4735ecf188a9e2aef047ae7e834f02e3219a035 Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski Date: Mon, 26 Apr 2021 13:51:54 +0200 Subject: [PATCH 044/309] avoid parameter collisions in temporary PSets --- PhysicsTools/NanoAOD/python/taus_cff.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index ce5ebf105f6e7..69d2575517e2b 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -148,6 +148,9 @@ def _tauId8WPMask(pattern,doc): tauTable.variables = _variablesMiniV2 +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(tauTable, + variables = cms.PSet(tauTable.variables, _mvaAntiEVars, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2) + ) for era in [run2_nanoAOD_94XMiniAODv1,]: era.toModify(tauTable, variables = _variablesMiniV1 @@ -155,11 +158,6 @@ def _tauId8WPMask(pattern,doc): run2_miniAOD_80XLegacy.toModify(tauTable, variables = _variables80X ) -for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv2, \ - run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: - era.toModify(tauTable, - variables = cms.PSet(tauTable.variables, _mvaAntiEVars, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2) - ) for era in [run2_nanoAOD_92X, run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, \ run2_nanoAOD_94X2016, run2_nanoAOD_102Xv1, run2_nanoAOD_106Xv1]: era.toModify(tauTable.variables, From 760741afea43f649166521f0f4927f30e7ccdc73 Mon Sep 17 00:00:00 2001 From: Pieter David Date: Mon, 26 Apr 2021 15:23:43 +0200 Subject: [PATCH 045/309] Count actually used clusters --- CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc index 19f1a36c6123b..d1510a53ad69d 100644 --- a/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc +++ b/CalibTracker/SiStripChannelGain/src/SiStripGainsPCLWorker.cc @@ -217,7 +217,6 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, // there can be 2 (stereo module), 1 (no stereo module), or 0 (no pixel or strip hit) clusters auto clusters = getClusters(meas.recHit()->hit()); - nStoredClusters += clusters.size(); for (const auto hitCluster : clusters) { ++iCluster; bool saturation = false; @@ -304,6 +303,7 @@ void SiStripGainsPCLWorker::dqmAnalyze(edm::Event const& iEvent, // keep processing of pixel cluster charge until here continue; } + ++nStoredClusters; // real histogram for calibration histograms.Charge_Vs_Index[elepos]->Fill(APV->Index, ClusterChargeOverPath); From 96962a9c47807df136f8bdc2d23054e49677f10d Mon Sep 17 00:00:00 2001 From: swozniewski Date: Mon, 26 Apr 2021 18:28:38 +0200 Subject: [PATCH 046/309] Add boosted taus to NanoAOD (#150) * Merge pull request #33150 from cms-tau-pog/CMSSW_11_3_X_tau-pog_tauIDtoolsDev Updates to tauID python tool * Initial working commit of boosted taus in CMSSW_11_3 NanoAOD * Remove 2015 anti-E for 10_6v2 era compatibility in boosted taus * Initial working commit of boosted taus in CMSSW_11_3 NanoAOD * Remove 2015 anti-E for 10_6v2 era compatibility in boosted taus * Remove commented boosted tau nanoAOD code * Remove main nanoAOD config comments * Remove leading charged hadronic candidate dxy and dz * Update boosted tau configuration to remove excess ID variables * Fix removal of boosted tau vars base * Remove boosted tau sequences from previous eras * Remove redundant decay mode information * some polishing * change Gen information for boosted taus * Update nanoDQM for boosted taus Co-authored-by: cmsbuild Co-authored-by: Andrew Loeliger Co-authored-by: Andrew David Loeliger --- .../NanoAOD/python/boostedTaus_cff.py | 114 ++++++++++++++++++ PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 34 ++++++ PhysicsTools/NanoAOD/python/nano_cff.py | 31 ++++- 3 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 PhysicsTools/NanoAOD/python/boostedTaus_cff.py diff --git a/PhysicsTools/NanoAOD/python/boostedTaus_cff.py b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py new file mode 100644 index 0000000000000..1fd782154d61e --- /dev/null +++ b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py @@ -0,0 +1,114 @@ +import FWCore.ParameterSet.Config as cms +from PhysicsTools.NanoAOD.common_cff import * + +##################### Updated tau collection with MVA-based tau-Ids rerun ####### +# Used only in some eras +from PhysicsTools.NanoAOD.taus_updatedMVAIds_cff import * + +##################### User floats producers, selectors ########################## + + +finalBoostedTaus = cms.EDFilter("PATTauRefSelector", + src = cms.InputTag("slimmedTausBoostedNewID"), + cut = cms.string("pt > 40 && tauID('decayModeFindingNewDMs') && (tauID('byVVLooseIsolationMVArun2017v2DBoldDMwLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBnewDMwLT2017'))") +) + + +##################### Tables for final output and docs ########################## +def _tauIdWPMask(pattern, choices, doc=""): + return Var(" + ".join(["%d * tauID('%s')" % (pow(2,i), pattern % c) for (i,c) in enumerate(choices)]), "uint8", + doc=doc+": bitmask "+", ".join(["%d = %s" % (pow(2,i),c) for (i,c) in enumerate(choices)])) +def _tauId2WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("Loose","Tight"),doc=doc) +def _tauId3WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("Loose","Medium","Tight"),doc=doc) +def _tauId4WPMask(pattern,doc): + return _tauIdWPMask(pattern, choices=("VLoose", "Loose", "Medium", "Tight"), doc=doc) +def _tauId5WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight"),doc=doc) +def _tauId6WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) +def _tauId7WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) +def _tauId8WPMask(pattern,doc): + return _tauIdWPMask(pattern,choices=("VVVLoose","VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) + +boostedTauTable = cms.EDProducer("SimpleCandidateFlatTableProducer", + src = cms.InputTag("finalBoostedTaus"), + cut = cms.string(""), #we should not filter on cross linked collections + name= cms.string("boostedTau"), + doc = cms.string("slimmedBoostedTaus after basic selection (" + finalBoostedTaus.cut.value()+")"), + singleton = cms.bool(False), # the number of entries is variable + extension = cms.bool(False), # this is the main table for the taus + variables = cms.PSet() # PSet defined below in era dependent way +) +_boostedTauVarsBase = cms.PSet(P4Vars, + charge = Var("charge", int, doc="electric charge"), + jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"), + decayMode = Var("decayMode()",int), + leadTkPtOverTauPt = Var("leadChargedHadrCand.pt/pt ",float, doc="pt of the leading track divided by tau pt",precision=10), + leadTkDeltaEta = Var("leadChargedHadrCand.eta - eta ",float, doc="eta of the leading track, minus tau eta",precision=8), + leadTkDeltaPhi = Var("deltaPhi(leadChargedHadrCand.phi, phi) ",float, doc="phi of the leading track, minus tau phi",precision=8), + + rawIso = Var( "tauID('byCombinedIsolationDeltaBetaCorrRaw3Hits')", float, doc = "combined isolation (deltaBeta corrections)", precision=10), + rawIsodR03 = Var( "(tauID('chargedIsoPtSumdR03')+max(0.,tauID('neutralIsoPtSumdR03')-0.072*tauID('puCorrPtSum')))", float, doc = "combined isolation (deltaBeta corrections, dR=0.3)", precision=10), + chargedIso = Var( "tauID('chargedIsoPtSum')", float, doc = "charged isolation", precision=10), + neutralIso = Var( "tauID('neutralIsoPtSum')", float, doc = "neutral (photon) isolation", precision=10), + puCorr = Var( "tauID('puCorrPtSum')", float, doc = "pileup correction", precision=10), + photonsOutsideSignalCone = Var( "tauID('photonPtSumOutsideSignalCone')", float, doc = "sum of photons outside signal cone", precision=10), + idAntiMu = _tauId2WPMask("againstMuon%s3", doc= "Anti-muon discriminator V3: "), + #MVA 2017 v2 variables + rawMVAoldDM2017v2=Var("tauID('byIsolationMVArun2017v2DBoldDMwLTraw2017')",float, doc="byIsolationMVArun2017v2DBoldDMwLT raw output discriminator (2017v2)",precision=10), + rawMVAnewDM2017v2 = Var("tauID('byIsolationMVArun2017v2DBnewDMwLTraw2017')",float,doc='byIsolationMVArun2017v2DBnewDMwLT raw output discriminator (2017v2)',precision=10), + rawMVAoldDMdR032017v2 = Var("tauID('byIsolationMVArun2017v2DBoldDMdR0p3wLTraw2017')",float,doc='byIsolationMVArun2017v2DBoldDMdR0p3wLT raw output discriminator (2017v2)'), + idMVAnewDM2017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBnewDMwLT2017", doc="IsolationMVArun2017v2DBnewDMwLT ID working point (2017v2)"), + idMVAoldDM2017v2=_tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMwLT2017",doc="IsolationMVArun2017v2DBoldDMwLT ID working point (2017v2)"), + idMVAoldDMdR032017v2 = _tauId7WPMask("by%sIsolationMVArun2017v2DBoldDMdR0p3wLT2017",doc="IsolationMVArun2017v2DBoldDMdR0p3wLT ID working point (2017v2)"), + rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), + rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), + idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2018)"), +) + +boostedTauTable.variables = _boostedTauVarsBase + + +boostedTausMCMatchLepTauForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR + src = boostedTauTable.src, # final reco collection + matched = cms.InputTag("finalGenParticles"), # final mc-truth particle collection + mcPdgId = cms.vint32(11,13), # one or more PDG ID (11 = electron, 13 = muon); absolute values (see below) + checkCharge = cms.bool(False), # True = require RECO and MC objects to have the same charge + mcStatus = cms.vint32(), # PYTHIA status code (1 = stable, 2 = shower, 3 = hard scattering) + maxDeltaR = cms.double(0.3), # Minimum deltaR for the match + maxDPtRel = cms.double(0.5), # Minimum deltaPt/Pt for the match + resolveAmbiguities = cms.bool(True), # Forbid two RECO objects to match to the same GEN object + resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first +) + +#This requires genVisTaus in taus_cff.py +boostedTausMCMatchHadTauForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR + src = boostedTauTable.src, # final reco collection + matched = cms.InputTag("genVisTaus"), # generator level hadronic tau decays + mcPdgId = cms.vint32(15), # one or more PDG ID (15 = tau); absolute values (see below) + checkCharge = cms.bool(False), # True = require RECO and MC objects to have the same charge + mcStatus = cms.vint32(), # CV: no *not* require certain status code for matching (status code corresponds to decay mode for hadronic tau decays) + maxDeltaR = cms.double(0.3), # Maximum deltaR for the match + maxDPtRel = cms.double(1.), # Maximum deltaPt/Pt for the match + resolveAmbiguities = cms.bool(True), # Forbid two RECO objects to match to the same GEN object + resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first +) + +boostedTauMCTable = cms.EDProducer("CandMCMatchTableProducer", + src = boostedTauTable.src, + mcMap = cms.InputTag("boostedTausMCMatchLepTauForTable"), + mcMapVisTau = cms.InputTag("boostedTausMCMatchHadTauForTable"), + objName = boostedTauTable.name, + objType = cms.string("Tau"), + branchName = cms.string("genPart"), + docString = cms.string("MC matching to status==2 taus"), +) + + +boostedTauSequence = cms.Sequence(finalBoostedTaus) +boostedTauTables = cms.Sequence(boostedTauTable) +boostedTauMC = cms.Sequence(boostedTausMCMatchLepTauForTable + boostedTausMCMatchHadTauForTable + boostedTauMCTable) + diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 31584ec78caa1..c3976434c991e 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -801,5 +801,39 @@ Plot1D('pt', 'pt', 40, 0, 400, 'pt'), ) ), + boostedTau = cms.PSet( + sels = cms.PSet(), + plots = cms.VPSet( + Count1D('_size', 7, -0.5, 6.5, "slimmedBoostedTaus after basic selection (pt > 40 && tauID('decayModeFindingNewDMs') && (tauID('byVVLooseIsolationMVArun2017v2DBoldDMwLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBnewDMwLT2017')))"), + Plot1D('charge', 'charge', 3, -1.5, 1.5, 'electric charge'), + Plot1D('chargedIso', 'chargedIso', 20, 0, 200, 'charged isolation'), + Plot1D('decayMode', 'decayMode', 12, -0.5, 11.5, 'decayMode()'), + Plot1D('eta', 'eta', 20, -3, 3, 'eta'), + Plot1D('genPartFlav', 'genPartFlav', 6, -0.5, 5.5, 'Flavour of genParticle for MC matching to status==2 taus: 1 = prompt electron, 2 = prompt muon, 3 = tau->e decay, 4 = tau->mu decay, 5 = hadronic tau decay, 0 = unknown or unmatched'), + NoPlot('genPartIdx'), + Plot1D('idAntiEle2018', 'idAntiEle2018', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6 (2018): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), + Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2017v2DBoldDMdR0p3wLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + NoPlot('jetIdx'), + Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), + Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), + Plot1D('leadTkPtOverTauPt', 'leadTkPtOverTauPt', 20, 0, 2, 'pt of the leading track divided by tau pt'), + Plot1D('mass', 'mass', 20, 0, 5, 'mass'), + Plot1D('neutralIso', 'neutralIso', 20, 0, 200, 'neutral (photon) isolation'), + Plot1D('phi', 'phi', 20, -3.14159, 3.14159, 'phi'), + Plot1D('photonsOutsideSignalCone', 'photonsOutsideSignalCone', 20, 0, 30, 'sum of photons outside signal cone'), + Plot1D('pt', 'pt', 20, 0, 200, 'pt'), + Plot1D('puCorr', 'puCorr', 20, 0, 90, 'pileup correction'), + Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'), + Plot1D('rawAntiEleCat2018', 'rawAntiEleCat2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 category (2018)'), + Plot1D('rawIso', 'rawIso', 20, 0, 200, 'combined isolation (deltaBeta corrections)'), + Plot1D('rawIsodR03', 'rawIsodR03', 20, 0, 200, 'combined isolation (deltaBeta corrections, dR=0.3)'), + Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2017v2DBnewDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2017v2DBoldDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2017v2DBoldDMdR0p3wLT raw output discriminator (2017v2)'), + ) + ), ) ) diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index fdba88878d652..47e64218584a8 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -5,6 +5,7 @@ from PhysicsTools.NanoAOD.jets_cff import * from PhysicsTools.NanoAOD.muons_cff import * from PhysicsTools.NanoAOD.taus_cff import * +from PhysicsTools.NanoAOD.boostedTaus_cff import * from PhysicsTools.NanoAOD.electrons_cff import * from PhysicsTools.NanoAOD.photons_cff import * from PhysicsTools.NanoAOD.globals_cff import * @@ -105,22 +106,28 @@ (run2_miniAOD_80XLegacy | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toModify(l1bits, storeUnprefireableBit=False) nanoSequenceCommon = cms.Sequence( - nanoMetadata + jetSequence + muonSequence + tauSequence + electronSequence+photonSequence+vertexSequence+ + nanoMetadata + jetSequence + muonSequence + tauSequence + boostedTauSequence + electronSequence+photonSequence+vertexSequence+ isoTrackSequence + jetLepSequence + # must be after all the leptons linkedObjects + - jetTables + muonTables + tauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + isoTrackTables + jetTables + muonTables + tauTables + boostedTauTables + electronTables + photonTables + globalTables +vertexTables+ metTables+simpleCleanerTable + isoTrackTables ) +#remove boosted tau from previous eras +(run2_miniAOD_80XLegacy | run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toReplaceWith(nanoSequenceCommon, nanoSequenceCommon.copyAndExclude([boostedTauSequence, boostedTauTables])) + nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTables + l1bits) nanoSequenceOnlyData = cms.Sequence(protonTables + lhcInfoTable) nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim) -nanoSequenceFS = cms.Sequence(genParticleSequence + genVertexTables + particleLevelSequence + nanoSequenceCommon + jetMC + muonMC + electronMC + photonMC + tauMC + metMC + ttbarCatMCProducers + globalTablesMC + btagWeightTable + genWeightsTable + genVertexTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable ) +nanoSequenceFS = cms.Sequence(genParticleSequence + genVertexTables + particleLevelSequence + nanoSequenceCommon + jetMC + muonMC + electronMC + photonMC + tauMC + boostedTauMC + metMC + ttbarCatMCProducers + globalTablesMC + btagWeightTable + genWeightsTable + genVertexTable + genParticleTables + particleLevelTables + lheInfoTable + ttbarCategoryTable ) (run2_nanoAOD_92X | run2_miniAOD_80XLegacy | run2_nanoAOD_94X2016 | run2_nanoAOD_94X2016 | \ run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | \ run2_nanoAOD_102Xv1).toReplaceWith(nanoSequenceFS, nanoSequenceFS.copyAndExclude([genVertexTable, genVertexT0Table])) +#remove boosted tau from previous eras +(run2_miniAOD_80XLegacy | run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toReplaceWith(nanoSequenceFS, nanoSequenceFS.copyAndExclude([boostedTauMC])) + # GenVertex only stored in newer MiniAOD nanoSequenceMC = nanoSequenceFS.copy() nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim) @@ -141,6 +148,23 @@ def nanoAOD_addTauIds(process): process.rerunMvaIsolationSequence) return process +def nanoAOD_addBoostedTauIds(process): + updatedBoostedTauName = "slimmedTausBoostedNewID" + boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug=False, + originalTauName = "slimmedTausBoosted", + updatedTauName = updatedBoostedTauName, + postfix="Boosted", + toKeep = [ "2017v2", "dR0p32017v2", "newDM2017v2","againstEle2018",]) + boostedTauIdEmbedder.runTauID() + process.boostedTauSequence.insert(process.boostedTauSequence.index(process.finalBoostedTaus), + process.rerunMvaIsolationSequenceBoosted) + + process.boostedTauSequence.insert(process.boostedTauSequence.index(process.finalBoostedTaus), + getattr(process, updatedBoostedTauName)) + + return process + + from PhysicsTools.PatAlgos.tools.jetTools import updateJetCollection def nanoAOD_addDeepInfo(process,addDeepBTag,addDeepFlavour): _btagDiscriminators=[] @@ -371,6 +395,7 @@ def nanoAOD_customizeCommon(process): addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch, jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload) (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(process, lambda p : nanoAOD_addTauIds(p)) + (~(run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94X2016 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1)).toModify(process, lambda p : nanoAOD_addBoostedTauIds(p)) return process def nanoAOD_customizeData(process): From 4a58f7ad85eeaf63b625ea917a506931a15e83e2 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 27 Apr 2021 09:03:32 +0200 Subject: [PATCH 047/309] Remove loop on LCs --- .../src/HGVHistoProducerAlgo.cc | 67 +++++++++---------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 7d20af3b1204b..51f47aa606f9d 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -2839,42 +2839,39 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr // reco-level, namely fake-rate an merge-rate. In this loop we should *not* // restrict only to the selected caloParaticles. for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { - for (const auto lcId : tracksters[tstId].vertices()) { - const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - if (hits_and_fractions.empty()) - continue; - auto assocFakeMerge = tracksters_fakemerge[tstId]; - auto assocDuplicate = tracksters_duplicate[tstId]; - if (assocDuplicate) { - histograms.h_numDup_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); - histograms.h_numDup_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); - } - if (assocFakeMerge > 0) { - histograms.h_num_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); - histograms.h_num_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); - auto best = std::min_element(std::begin(cpsInTrackster[tstId]), - std::end(cpsInTrackster[tstId]), - [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - - //This is the shared energy taking the best caloparticle in each layer - float sharedeneCPallLayers = 0.; - //Loop through all layers - for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& best_cp_linked = cPOnLayer[best->first][j].layerClusterIdToEnergyAndScore[tstId]; - sharedeneCPallLayers += best_cp_linked.first; - } //end of loop through layers - histograms.h_sharedenergy_trackster2caloparticle_vs_eta[count]->Fill( - tracksters[tstId].barycenter().eta(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); - histograms.h_sharedenergy_trackster2caloparticle_vs_phi[count]->Fill( - tracksters[tstId].barycenter().phi(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); - } - if (assocFakeMerge >= 2) { - histograms.h_numMerge_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); - histograms.h_numMerge_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); - } - histograms.h_denom_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); - histograms.h_denom_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + if (tracksters[tstId].vertices().empty()) + continue; + auto assocFakeMerge = tracksters_fakemerge[tstId]; + auto assocDuplicate = tracksters_duplicate[tstId]; + if (assocDuplicate) { + histograms.h_numDup_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_numDup_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + } + if (assocFakeMerge > 0) { + histograms.h_num_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_num_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); + auto best = std::min_element(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); + + //This is the shared energy taking the best caloparticle in each layer + float sharedeneCPallLayers = 0.; + //Loop through all layers + for (unsigned int j = 0; j < layers * 2; ++j) { + auto const& best_cp_linked = cPOnLayer[best->first][j].layerClusterIdToEnergyAndScore[tstId]; + sharedeneCPallLayers += best_cp_linked.first; + } //end of loop through layers + histograms.h_sharedenergy_trackster2caloparticle_vs_eta[count]->Fill( + tracksters[tstId].barycenter().eta(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); + histograms.h_sharedenergy_trackster2caloparticle_vs_phi[count]->Fill( + tracksters[tstId].barycenter().phi(), sharedeneCPallLayers / tracksters[tstId].raw_energy()); + } + if (assocFakeMerge >= 2) { + histograms.h_numMerge_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_numMerge_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); } + histograms.h_denom_trackster_eta[count]->Fill(tracksters[tstId].barycenter().eta()); + histograms.h_denom_trackster_phi[count]->Fill(tracksters[tstId].barycenter().phi()); } } From 48dc2dbfc3f0660643ab1e9cf50f2ccb1732965f Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 27 Apr 2021 14:47:02 +0200 Subject: [PATCH 048/309] Take LC-independent code out of LC loops --- .../src/HGVHistoProducerAlgo.cc | 153 +++++++++--------- 1 file changed, 78 insertions(+), 75 deletions(-) diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 51f47aa606f9d..2c627522199a8 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -2369,29 +2369,29 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr //Loop through Tracksters for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { - for (const auto lcId : tracksters[tstId].vertices()) { - const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - if (hits_and_fractions.empty()) - continue; + if (tracksters[tstId].vertices().empty()) + continue; - std::unordered_map CPEnergyInTST; - int maxCPId_byNumberOfHits = -1; - unsigned int maxCPNumberOfHitsInTST = 0; - int maxCPId_byEnergy = -1; - float maxEnergySharedTSTandCP = 0.f; - float energyFractionOfTSTinCP = 0.f; - float energyFractionOfCPinTST = 0.f; + std::unordered_map CPEnergyInTST; + int maxCPId_byNumberOfHits = -1; + unsigned int maxCPNumberOfHitsInTST = 0; + int maxCPId_byEnergy = -1; + float maxEnergySharedTSTandCP = 0.f; + float energyFractionOfTSTinCP = 0.f; + float energyFractionOfCPinTST = 0.f; - //In case of matched rechit-simhit, so matched - //CaloParticle-LayerCluster-Trackster, he counts and saves the number of - //rechits related to the maximum energy CaloParticle out of all - //CaloParticles related to that layer cluster and Trackster. + //In case of matched rechit-simhit, so matched + //CaloParticle-LayerCluster-Trackster, he counts and saves the number of + //rechits related to the maximum energy CaloParticle out of all + //CaloParticles related to that layer cluster and Trackster. - std::unordered_map occurrencesCPinTST; - unsigned int numberOfNoiseHitsInTST = 0; - unsigned int numberOfHaloHitsInTST = 0; - unsigned int numberOfHitsInTST = 0; + std::unordered_map occurrencesCPinTST; + unsigned int numberOfNoiseHitsInTST = 0; + unsigned int numberOfHaloHitsInTST = 0; + unsigned int numberOfHitsInTST = 0; + for (const auto lcId : tracksters[tstId].vertices()) { + const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); //number of hits related to that cluster. unsigned int numberOfHitsInLC = hits_and_fractions.size(); numberOfHitsInTST += numberOfHitsInLC; @@ -2556,29 +2556,32 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } //end of loop through Trackster's layerClusters } //end of loop through Tracksters + //Loop through Tracksters for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { + if (tracksters[tstId].vertices().empty()) + continue; + + // find the unique CaloParticles id contributing to the Tracksters + //cpsInTrackster[trackster][CPids] + std::sort(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); + auto last = std::unique(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); + cpsInTrackster[tstId].erase(last, cpsInTrackster[tstId].end()); + + if (tracksters[tstId].raw_energy() == 0. && !cpsInTrackster[tstId].empty()) { + //Loop through all CaloParticles contributing to Trackster tstId. + for (auto& cpPair : cpsInTrackster[tstId]) { + //In case of a Trackster with zero energy but related CaloParticles the score is set to 1. + cpPair.second = 1.; + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" + << cpPair.second << std::endl; + histograms.h_score_trackster2caloparticle[count]->Fill(cpPair.second); + } + continue; + } + for (const auto lcId : tracksters[tstId].vertices()) { const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); - if (hits_and_fractions.empty()) - continue; - // find the unique CaloParticles id contributing to the Tracksters - //cpsInTrackster[trackster][CPids] - std::sort(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); - auto last = std::unique(cpsInTrackster[tstId].begin(), cpsInTrackster[tstId].end()); - cpsInTrackster[tstId].erase(last, cpsInTrackster[tstId].end()); - - if (tracksters[tstId].raw_energy() == 0. && !cpsInTrackster[tstId].empty()) { - //Loop through all CaloParticles contributing to Trackster tstId. - for (auto& cpPair : cpsInTrackster[tstId]) { - //In case of a Trackster with zero energy but related CaloParticles the score is set to 1. - cpPair.second = 1.; - LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" - << cpPair.second << std::endl; - histograms.h_score_trackster2caloparticle[count]->Fill(cpPair.second); - } - continue; - } // Compute the correct normalization float invTracksterEnergyWeight = 0.f; @@ -2618,46 +2621,46 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invTracksterEnergyWeight; } } //end of loop through rechits of layer cluster + } //end of loop through Trackster's layerClusters - //In case of a Trackster with some energy but none related CaloParticles print some info. - if (cpsInTrackster[tstId].empty()) - LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\tCP id:\t-1 " - << "\t score \t-1" - << "\n"; + //In case of a Trackster with some energy but none related CaloParticles print some info. + if (cpsInTrackster[tstId].empty()) + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\tCP id:\t-1 " + << "\t score \t-1" + << "\n"; - auto score = std::min_element(std::begin(cpsInTrackster[tstId]), - std::end(cpsInTrackster[tstId]), - [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); - for (auto& cpPair : cpsInTrackster[tstId]) { - // LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId - // << "\t CP id: \t" << cpPair.first - // << "\t score \t" << cpPair.second - // << "\n"; - LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" - << cpPair.second << std::endl; - if (cpPair.first == score->first) { - histograms.h_score_trackster2caloparticle[count]->Fill(score->second); - } - float sharedeneCPallLayers = 0.; - //Loop through all layers - for (unsigned int j = 0; j < layers * 2; ++j) { - auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[tstId]; - sharedeneCPallLayers += cp_linked.first; - } //end of loop through layers - LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; - if (cpPair.first == score->first) { - histograms.h_sharedenergy_trackster2caloparticle[count]->Fill(sharedeneCPallLayers / - tracksters[tstId].raw_energy()); - histograms.h_energy_vs_score_trackster2caloparticle[count]->Fill( - score->second, sharedeneCPallLayers / tracksters[tstId].raw_energy()); - } + auto score = std::min_element(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); + for (auto& cpPair : cpsInTrackster[tstId]) { + // LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId + // << "\t CP id: \t" << cpPair.first + // << "\t score \t" << cpPair.second + // << "\n"; + LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" + << cpPair.second << std::endl; + if (cpPair.first == score->first) { + histograms.h_score_trackster2caloparticle[count]->Fill(score->second); } - auto assocFakeMerge = std::count_if(std::begin(cpsInTrackster[tstId]), - std::end(cpsInTrackster[tstId]), - [](const auto& obj) { return obj.second < ScoreCutTSTtoCPFakeMerge_; }); - tracksters_fakemerge[tstId] = assocFakeMerge; - } //end of loop through Trackster's layerClusters - } //end of loop through Tracksters + float sharedeneCPallLayers = 0.; + //Loop through all layers + for (unsigned int j = 0; j < layers * 2; ++j) { + auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[tstId]; + sharedeneCPallLayers += cp_linked.first; + } //end of loop through layers + LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; + if (cpPair.first == score->first) { + histograms.h_sharedenergy_trackster2caloparticle[count]->Fill(sharedeneCPallLayers / + tracksters[tstId].raw_energy()); + histograms.h_energy_vs_score_trackster2caloparticle[count]->Fill( + score->second, sharedeneCPallLayers / tracksters[tstId].raw_energy()); + } + } + auto assocFakeMerge = std::count_if(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj) { return obj.second < ScoreCutTSTtoCPFakeMerge_; }); + tracksters_fakemerge[tstId] = assocFakeMerge; + } //end of loop through Tracksters std::unordered_map> score3d; std::unordered_map> tstSharedEnergy; From ba31018c23cad5f7e4c1c5c13900df74289bab4f Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Sat, 24 Apr 2021 03:10:31 +0200 Subject: [PATCH 049/309] Remove confusing use of None from _TypedParameterizable constructor --- FWCore/ParameterSet/python/Mixins.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/FWCore/ParameterSet/python/Mixins.py b/FWCore/ParameterSet/python/Mixins.py index 9786f37f0abee..6d8a9ab2c42e6 100644 --- a/FWCore/ParameterSet/python/Mixins.py +++ b/FWCore/ParameterSet/python/Mixins.py @@ -387,7 +387,6 @@ def __init__(self,type_,*arg,**kargs): # arg = arg[1:] #else: # del args['type_'] - arg = tuple([x for x in arg if x != None]) super(_TypedParameterizable,self).__init__(*arg,**kargs) saveOrigin(self, 1) def _place(self,name,proc): @@ -398,11 +397,7 @@ def type_(self): def copy(self): returnValue =_TypedParameterizable.__new__(type(self)) params = self.parameters_() - args = list() - if len(params) == 0: - args.append(None) - returnValue.__init__(self.__type,*args, - **params) + returnValue.__init__(self.__type,**params) returnValue._isModified = self._isModified return returnValue def clone(self, *args, **params): @@ -419,8 +414,6 @@ def clone(self, *args, **params): """ returnValue =_TypedParameterizable.__new__(type(self)) myparams = self.parameters_() - if len(myparams) == 0 and len(params) and len(args): - args = args + (None,) _modifyParametersFromDict(myparams, params, self._Parameterizable__raiseBadSetAttr) if self._Parameterizable__validator is not None: @@ -870,7 +863,7 @@ def dumpPython(self,options=PrintOptions()): self.assertEqual(hasattr(b,"w"), False) self.assertEqual(hasattr(c.x,"a"), False) self.assertEqual(hasattr(c.x,"c"), False) - self.assertRaises(TypeError,a.clone,None,**{"v":1}) + self.assertRaises(TypeError,a.clone,**{"v":1}) d = a.clone(__PSet(k=__TestType(42))) self.assertEqual(d.t.value(), 1) self.assertEqual(d.k.value(), 42) From 109fbc4e79c5d3b36f374508365c144d6ae49311 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Tue, 27 Apr 2021 17:45:10 +0200 Subject: [PATCH 050/309] Always clone() a module used in a SwitchProducer --- RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py | 2 +- RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py | 8 +++++--- .../python/ecalMultiFitUncalibRecHit_cff.py | 2 +- RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py index 30b7927d5753a..c876f79eb5422 100644 --- a/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalGlobalReco_cff.py @@ -4,7 +4,7 @@ #--- for Run 1 and Run 2 from RecoLocalCalo.HcalRecProducers.HBHEIsolatedNoiseReflagger_cfi import hbhereco as _phase0_hbhereco hbhereco = SwitchProducerCUDA( - cpu = _phase0_hbhereco + cpu = _phase0_hbhereco.clone() ) hcalGlobalRecoTask = cms.Task(hbhereco) hcalGlobalRecoSequence = cms.Sequence(hcalGlobalRecoTask) diff --git a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py index 4c68380d686ac..45b3e511c6874 100644 --- a/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py +++ b/RecoLocalCalo/Configuration/python/hcalLocalReco_cff.py @@ -34,10 +34,12 @@ _phase1_hcalLocalRecoTask.add(hfprereco) from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 -run2_HF_2017.toReplaceWith( hcalLocalRecoTask, _phase1_hcalLocalRecoTask ) -run2_HF_2017.toReplaceWith( hfreco, _phase1_hfreco ) +run2_HF_2017.toReplaceWith(hcalLocalRecoTask, _phase1_hcalLocalRecoTask) +run2_HF_2017.toReplaceWith(hfreco, _phase1_hfreco) from Configuration.Eras.Modifier_run2_HCAL_2017_cff import run2_HCAL_2017 -run2_HCAL_2017.toReplaceWith(hbheprereco.cpu, _phase1_hbheprereco) +run2_HCAL_2017.toModify(hbheprereco, + cpu = _phase1_hbheprereco.clone() +) _plan1_hcalLocalRecoTask = _phase1_hcalLocalRecoTask.copy() _plan1_hcalLocalRecoTask.add(hbheplan1) diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py index fb285456a053f..81c0a71986c78 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalMultiFitUncalibRecHit_cff.py @@ -5,7 +5,7 @@ # ECAL multifit running on CPU from RecoLocalCalo.EcalRecProducers.ecalMultiFitUncalibRecHit_cfi import ecalMultiFitUncalibRecHit as _ecalMultiFitUncalibRecHit ecalMultiFitUncalibRecHit = SwitchProducerCUDA( - cpu = _ecalMultiFitUncalibRecHit + cpu = _ecalMultiFitUncalibRecHit.clone() ) ecalMultiFitUncalibRecHitTask = cms.Task( diff --git a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py index 44420e9600690..71247d33d6063 100644 --- a/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py +++ b/RecoLocalCalo/EcalRecProducers/python/ecalRecHit_cff.py @@ -5,7 +5,7 @@ # ECAL calibrated rechit reconstruction on CPU from RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi import ecalRecHit as _ecalRecHit ecalRecHit = SwitchProducerCUDA( - cpu = _ecalRecHit + cpu = _ecalRecHit.clone() ) ecalCalibratedRecHitTask = cms.Task( From 0a4cd4492427914a19b11ff586c100347612e333 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Sun, 25 Apr 2021 12:18:18 +0200 Subject: [PATCH 051/309] Remove duplicated code --- .../scripts/makeHGCalValidationPlots.py | 97 ++++++------------- 1 file changed, 32 insertions(+), 65 deletions(-) diff --git a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py index 098cfc39a293f..1998fac75496a 100755 --- a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py +++ b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py @@ -12,22 +12,18 @@ import Validation.RecoTrack.plotting.plotting as plotting simClustersIters = ["ClusterLevel","ticlSimTracksters"] -simClustersIters.extend('ticlTracksters'+iteration for iteration in ticlIterLabels) - trackstersIters = ['ticlTracksters'+iteration for iteration in ticlIterLabelsMerge] trackstersIters.extend(["ticlSimTracksters"]) -simClustersGeneralLabel = 'simClusters' -layerClustersGeneralLabel = 'hgcalLayerClusters' -trackstersGeneralLabel = 'hgcalTracksters' -allTrackstersLabel = 'allTiclTracksters' -hitValidationLabel = 'hitValidation' -hitCalibrationLabel = 'hitCalibration' -caloParticlesLabel = 'caloParticles' +hitLabel = 'recHits' +layerClustersLabel = 'layerClusters' +trackstersLabel = 'tracksters' +trackstersEdgesLabel = 'trackstersEdges' +simLabel = 'simulation' allLabel = 'all' -collection_choices = [layerClustersGeneralLabel] -collection_choices.extend([simClustersGeneralLabel]+[trackstersGeneralLabel]+[allTrackstersLabel]+[hitValidationLabel]+[hitCalibrationLabel]+[allLabel]+[caloParticlesLabel]) +collection_choices = [allLabel] +collection_choices.extend([hitLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersEdgesLabel]+[simLabel]) def main(opts): @@ -53,32 +49,34 @@ def main(opts): htmlReport = val.createHtmlReport(validationName=opts.html_validation_name[0]) #layerClusters - if (opts.collection == layerClustersGeneralLabel): + def plot_LC(): hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters", extendedFlag) val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) + #simClusters - elif (opts.collection == simClustersGeneralLabel): + def plot_SC(): hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter] for i_iter in simClustersIters: hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter) val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs) + #tracksters - elif (opts.collection == trackstersGeneralLabel): - hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] - hgcalPlots.append_hgcalTrackstersPlots(trackstersGeneralLabel, "Tracksters") - val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) - #ticlTracksters - elif (opts.collection == allTrackstersLabel): + def plot_Tst(): hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] for tracksterCollection in trackstersIters : hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) - # TICLTrackstersEdges plots + + #trackstersEdges + def plot_TstEdges(): + plot_Tst() for tracksterCollection in trackstersIters : hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) - elif (opts.collection == caloParticlesLabel): + + #caloParticles + def plot_CP(): particletypes = {"pion-":"-211", "pion+":"211", "pion0": "111", "muon-": "-13", "muon+":"13", "electron-": "-11", "electron+": "11", "photon": "22", @@ -88,61 +86,30 @@ def main(opts): for i_part, i_partID in particletypes.iteritems() : hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID, i_part) val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs) + #hitValidation - elif (opts.collection == hitValidationLabel): + def plot_hitVal(): hgchit = [hgcalPlots.hgcalHitPlotter] hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits") hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits") hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis") val.doPlots(hgchit, plotterDrawArgs=drawArgs) - #hitCalibration - elif (opts.collection == hitCalibrationLabel): - hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter] - val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) - elif (opts.collection == allLabel): - #caloparticles - particletypes = {"pion-":"-211", "pion+":"211", "pion0": "111", - "muon-": "-13", "muon+":"13", - "electron-": "-11", "electron+": "11", "photon": "22", - "kaon0L": "310", "kaon0S": "130", - "kaon-": "-321", "kaon+": "321"} - hgcaloPart = [hgcalPlots.hgcalCaloParticlesPlotter] - for i_part, i_partID in particletypes.iteritems() : - hgcalPlots.append_hgcalCaloParticlesPlots(sample.files(), i_partID, i_part) - val.doPlots(hgcaloPart, plotterDrawArgs=drawArgs) - #hits - hgchit = [hgcalPlots.hgcalHitPlotter] - hgcalPlots.append_hgcalHitsPlots('HGCalSimHitsV', "Simulated Hits") - hgcalPlots.append_hgcalHitsPlots('HGCalRecHitsV', "Reconstruced Hits") - hgcalPlots.append_hgcalDigisPlots('HGCalDigisV', "Digis") - val.doPlots(hgchit, plotterDrawArgs=drawArgs) - - #calib + #hitCalibration + def plot_hitCal(): hgchitcalib = [hgcalPlots.hgcalHitCalibPlotter] val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) - #simClusters - hgcsimclus = [hgcalPlots.hgcalSimClustersPlotter] - for i_iter in simClustersIters : - hgcalPlots.append_hgcalSimClustersPlots(i_iter, i_iter) - val.doPlots(hgcsimclus, plotterDrawArgs=drawArgs) - - #layer clusters - hgclayclus = [hgcalPlots.hgcalLayerClustersPlotter] - hgcalPlots.append_hgcalLayerClustersPlots("hgcalLayerClusters", "Layer Clusters", extendedFlag) - val.doPlots(hgclayclus, plotterDrawArgs=drawArgs) - #tracksters - hgctrackster = [hgcalPlots.hgcalTrackstersPlotter] - for tracksterCollection in trackstersIters : - hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) - val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) - #TICLTrackstersEdges plots - for tracksterCollection in trackstersIters : - hgctracksters = [hgcalPlots.create_hgcalTrackstersPlotter(sample.files(), tracksterCollection, tracksterCollection)] - val.doPlots(hgctracksters, plotterDrawArgs=drawArgs) + plotDict = {hitLabel:[plot_hitVal, plot_hitCal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP]} + if (opts.collection != allLabel): + for task in plotDict[opts.collection]: + task() + else: + for label in plotDict: + for task in plotDict[label]: + task() if opts.no_html: print("Plots created into directory '%s'." % opts.outputDir) @@ -172,7 +139,7 @@ def main(opts): help="Sample name for HTML page generation (default 'Sample')") parser.add_argument("--html-validation-name", type=str, default=["",""], nargs="+", help="Validation name for HTML page generation (enters to element) (default '')") - parser.add_argument("--collection", choices=collection_choices, default=layerClustersGeneralLabel, + parser.add_argument("--collection", choices=collection_choices, default=layerClustersLabel, help="Choose output plots collections among possible choices") parser.add_argument("--extended", action="store_true", default = False, help="Include extended set of plots (e.g. bunch of distributions; default off)") From 07ab2b156404928416768ab0bda6ed7732627b67 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Tue, 27 Apr 2021 01:04:33 +0200 Subject: [PATCH 052/309] Discard None objects --- .../HGCalValidation/python/hgcalPlots.py | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/Validation/HGCalValidation/python/hgcalPlots.py b/Validation/HGCalValidation/python/hgcalPlots.py index ad87d8ffec734..3efce5df299fc 100644 --- a/Validation/HGCalValidation/python/hgcalPlots.py +++ b/Validation/HGCalValidation/python/hgcalPlots.py @@ -2505,7 +2505,7 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = name = obj.GetName() fileName = TString(name) fileName.ReplaceAll(" ","_") - pg= PlotGroup(fileName.Data(),[ + pg = PlotGroup(fileName.Data(),[ Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), drawCommand = "", @@ -2514,7 +2514,7 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = ncols=1) if name in list_2D_histos : - pg= PlotOnSideGroup(plotName.Data(), + pg = PlotOnSideGroup(plotName.Data(), Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), drawCommand = "COLZ", @@ -2576,7 +2576,7 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam drawCommand = "COLZ", **_common), ncols=1) - else: + elif obj.InheritsFrom("TH1"): pg = PlotGroup(plotName.Data(), [Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), @@ -2585,12 +2585,13 @@ def create_hgcalTrackstersPlotter(files, collection = 'ticlTrackstersMerge', nam ], ncols=1, legendDh=-0.03 * len(files)) - hgcalTrackstersPlotter.append(name_collection+"_TICLDebugger", - [dqmfolder], PlotFolder(pg, - loopSubFolders=False, - purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection) - #numberOfEventsHistogram=_multiplicity_tracksters_numberOfEventsHistogram) - ) + if (pg is not None): + hgcalTrackstersPlotter.append(name_collection+"_TICLDebugger", + [dqmfolder], PlotFolder(pg, + loopSubFolders=False, + purpose=PlotPurpose.Timing, page="Tracksters", section=name_collection) + #numberOfEventsHistogram=_multiplicity_tracksters_numberOfEventsHistogram) + ) key = keys.After(key) @@ -2623,29 +2624,32 @@ def append_hgcalCaloParticlesPlots(files, collection = '-211', name_collection = name = obj.GetName() plotName = TString(name) plotName.ReplaceAll(" ","_") - pg= PlotGroup(plotName.Data(),[ - Plot(name, - xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), - drawCommand = "", # may want to customize for TH2 (colz, etc.) - normalizeToNumberOfEvents = True, **_common_Calo) - ], - ncols=1) + pg = None if obj.InheritsFrom("TH2"): - pg= PlotOnSideGroup(plotName.Data(), + pg = PlotOnSideGroup(plotName.Data(), Plot(name, xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), drawCommand = "COLZ", normalizeToNumberOfEvents = True, **_common_Calo), ncols=1) + elif obj.InheritsFrom("TH1"): + pg = PlotGroup(plotName.Data(),[ + Plot(name, + xtitle=obj.GetXaxis().GetTitle(), ytitle=obj.GetYaxis().GetTitle(), + drawCommand = "", # may want to customize for TH2 (colz, etc.) + normalizeToNumberOfEvents = True, **_common_Calo) + ], + ncols=1) - hgcalCaloParticlesPlotter.append("CaloParticles_"+name_collection, [ - dqmfolder - ], PlotFolder( - pg, - loopSubFolders=False, - purpose=PlotPurpose.Timing, page="CaloParticles", section=name_collection) - ) + if (pg is not None): + hgcalCaloParticlesPlotter.append("CaloParticles_"+name_collection, [ + dqmfolder + ], PlotFolder( + pg, + loopSubFolders=False, + purpose=PlotPurpose.Timing, page="CaloParticles", section=name_collection) + ) key = keys.After(key) From ad06d7898affbe9dd78964f046eb2dd04d8309b9 Mon Sep 17 00:00:00 2001 From: Andrea Bocci <andrea.bocci@cern.ch> Date: Tue, 27 Apr 2021 18:39:26 +0200 Subject: [PATCH 053/309] Move the implementation of the gpuVertexFinder kernels to gpuVertexFinder.cc --- .../plugins/gpuVertexFinder.cc | 193 +++++++++++++++++- .../plugins/gpuVertexFinder.cu | 2 +- .../plugins/gpuVertexFinderImpl.h | 192 ----------------- 3 files changed, 193 insertions(+), 194 deletions(-) delete mode 100644 RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc index 084763385bdb4..d685ced488233 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cc @@ -1 +1,192 @@ -#include "gpuVertexFinderImpl.h" +#ifndef RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h +#define RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h + +#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" + +#include "gpuClusterTracksByDensity.h" +#include "gpuClusterTracksDBSCAN.h" +#include "gpuClusterTracksIterative.h" +#include "gpuFitVertices.h" +#include "gpuSortByPt2.h" +#include "gpuSplitVertices.h" + +#undef PIXVERTEX_DEBUG_PRODUCE + +namespace gpuVertexFinder { + + // reject outlier tracks that contribute more than this to the chi2 of the vertex fit + constexpr float maxChi2ForFirstFit = 50.f; + constexpr float maxChi2ForFinalFit = 5000.f; + + // split vertices with a chi2/NDoF greater than this + constexpr float maxChi2ForSplit = 9.f; + + __global__ void loadTracks(TkSoA const* ptracks, ZVertexSoA* soa, WorkSpace* pws, float ptMin) { + assert(ptracks); + assert(soa); + auto const& tracks = *ptracks; + auto const& fit = tracks.stateAtBS; + auto const* quality = tracks.qualityData(); + + auto first = blockIdx.x * blockDim.x + threadIdx.x; + for (int idx = first, nt = TkSoA::stride(); idx < nt; idx += gridDim.x * blockDim.x) { + auto nHits = tracks.nHits(idx); + if (nHits == 0) + break; // this is a guard: maybe we need to move to nTracks... + + // initialize soa... + soa->idv[idx] = -1; + + if (nHits < 4) + continue; // no triplets + if (quality[idx] != pixelTrack::Quality::loose) + continue; + + auto pt = tracks.pt(idx); + + if (pt < ptMin) + continue; + + auto& data = *pws; + auto it = atomicAdd(&data.ntrks, 1); + data.itrk[it] = idx; + data.zt[it] = tracks.zip(idx); + data.ezt2[it] = fit.covariance(idx)(14); + data.ptt2[it] = pt * pt; + } + } + +// #define THREE_KERNELS +#ifndef THREE_KERNELS + __global__ void vertexFinderOneKernel(gpuVertexFinder::ZVertices* pdata, + gpuVertexFinder::WorkSpace* pws, + int minT, // min number of neighbours to be "seed" + float eps, // max absolute distance to cluster + float errmax, // max error to be "seed" + float chi2max // max normalized distance to cluster, + ) { + clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); + __syncthreads(); + fitVertices(pdata, pws, maxChi2ForFirstFit); + __syncthreads(); + splitVertices(pdata, pws, maxChi2ForSplit); + __syncthreads(); + fitVertices(pdata, pws, maxChi2ForFinalFit); + __syncthreads(); + sortByPt2(pdata, pws); + } +#else + __global__ void vertexFinderKernel1(gpuVertexFinder::ZVertices* pdata, + gpuVertexFinder::WorkSpace* pws, + int minT, // min number of neighbours to be "seed" + float eps, // max absolute distance to cluster + float errmax, // max error to be "seed" + float chi2max // max normalized distance to cluster, + ) { + clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); + __syncthreads(); + fitVertices(pdata, pws, maxChi2ForFirstFit); + } + + __global__ void vertexFinderKernel2(gpuVertexFinder::ZVertices* pdata, gpuVertexFinder::WorkSpace* pws) { + fitVertices(pdata, pws, maxChi2ForFinalFit); + __syncthreads(); + sortByPt2(pdata, pws); + } +#endif + +#ifdef __CUDACC__ + ZVertexHeterogeneous Producer::makeAsync(cudaStream_t stream, TkSoA const* tksoa, float ptMin) const { +#ifdef PIXVERTEX_DEBUG_PRODUCE + std::cout << "producing Vertices on GPU" << std::endl; +#endif // PIXVERTEX_DEBUG_PRODUCE + ZVertexHeterogeneous vertices(cms::cuda::make_device_unique<ZVertexSoA>(stream)); +#else + ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const { +#ifdef PIXVERTEX_DEBUG_PRODUCE + std::cout << "producing Vertices on CPU" << std::endl; +#endif // PIXVERTEX_DEBUG_PRODUCE + ZVertexHeterogeneous vertices(std::make_unique<ZVertexSoA>()); +#endif + assert(tksoa); + auto* soa = vertices.get(); + assert(soa); + +#ifdef __CUDACC__ + auto ws_d = cms::cuda::make_device_unique<WorkSpace>(stream); +#else + auto ws_d = std::make_unique<WorkSpace>(); +#endif + +#ifdef __CUDACC__ + init<<<1, 1, 0, stream>>>(soa, ws_d.get()); + auto blockSize = 128; + auto numberOfBlocks = (TkSoA::stride() + blockSize - 1) / blockSize; + loadTracks<<<numberOfBlocks, blockSize, 0, stream>>>(tksoa, soa, ws_d.get(), ptMin); + cudaCheck(cudaGetLastError()); +#else + init(soa, ws_d.get()); + loadTracks(tksoa, soa, ws_d.get(), ptMin); +#endif + +#ifdef __CUDACC__ + // Running too many thread lead to problems when printf is enabled. + constexpr int maxThreadsForPrint = 1024 - 256; + constexpr int numBlocks = 1024; + constexpr int threadsPerBlock = 128; + + if (oneKernel_) { + // implemented only for density clustesrs +#ifndef THREE_KERNELS + vertexFinderOneKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); +#else + vertexFinderKernel1<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + cudaCheck(cudaGetLastError()); + // one block per vertex... + splitVerticesKernel<<<numBlocks, threadsPerBlock, 0, stream>>>(soa, ws_d.get(), maxChi2ForSplit); + cudaCheck(cudaGetLastError()); + vertexFinderKernel2<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); +#endif + } else { // five kernels + if (useDensity_) { + clusterTracksByDensityKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useDBSCAN_) { + clusterTracksDBSCAN<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useIterative_) { + clusterTracksIterative<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); + } + cudaCheck(cudaGetLastError()); + fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFirstFit); + cudaCheck(cudaGetLastError()); + // one block per vertex... + splitVerticesKernel<<<numBlocks, threadsPerBlock, 0, stream>>>(soa, ws_d.get(), maxChi2ForSplit); + cudaCheck(cudaGetLastError()); + fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFinalFit); + cudaCheck(cudaGetLastError()); + sortByPt2Kernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); + } + cudaCheck(cudaGetLastError()); +#else // __CUDACC__ + if (useDensity_) { + clusterTracksByDensity(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useDBSCAN_) { + clusterTracksDBSCAN(soa, ws_d.get(), minT, eps, errmax, chi2max); + } else if (useIterative_) { + clusterTracksIterative(soa, ws_d.get(), minT, eps, errmax, chi2max); + } +#ifdef PIXVERTEX_DEBUG_PRODUCE + std::cout << "found " << (*ws_d).nvIntermediate << " vertices " << std::endl; +#endif // PIXVERTEX_DEBUG_PRODUCE + fitVertices(soa, ws_d.get(), maxChi2ForFirstFit); + // one block per vertex! + splitVertices(soa, ws_d.get(), maxChi2ForSplit); + fitVertices(soa, ws_d.get(), maxChi2ForFinalFit); + sortByPt2(soa, ws_d.get()); +#endif + + return vertices; + } + +} // namespace gpuVertexFinder + +#endif // RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu index 084763385bdb4..9674eac7d8784 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinder.cu @@ -1 +1 @@ -#include "gpuVertexFinderImpl.h" +#include "gpuVertexFinder.cc" diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h deleted file mode 100644 index d685ced488233..0000000000000 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuVertexFinderImpl.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h -#define RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h - -#include "HeterogeneousCore/CUDAUtilities/interface/cudaCheck.h" - -#include "gpuClusterTracksByDensity.h" -#include "gpuClusterTracksDBSCAN.h" -#include "gpuClusterTracksIterative.h" -#include "gpuFitVertices.h" -#include "gpuSortByPt2.h" -#include "gpuSplitVertices.h" - -#undef PIXVERTEX_DEBUG_PRODUCE - -namespace gpuVertexFinder { - - // reject outlier tracks that contribute more than this to the chi2 of the vertex fit - constexpr float maxChi2ForFirstFit = 50.f; - constexpr float maxChi2ForFinalFit = 5000.f; - - // split vertices with a chi2/NDoF greater than this - constexpr float maxChi2ForSplit = 9.f; - - __global__ void loadTracks(TkSoA const* ptracks, ZVertexSoA* soa, WorkSpace* pws, float ptMin) { - assert(ptracks); - assert(soa); - auto const& tracks = *ptracks; - auto const& fit = tracks.stateAtBS; - auto const* quality = tracks.qualityData(); - - auto first = blockIdx.x * blockDim.x + threadIdx.x; - for (int idx = first, nt = TkSoA::stride(); idx < nt; idx += gridDim.x * blockDim.x) { - auto nHits = tracks.nHits(idx); - if (nHits == 0) - break; // this is a guard: maybe we need to move to nTracks... - - // initialize soa... - soa->idv[idx] = -1; - - if (nHits < 4) - continue; // no triplets - if (quality[idx] != pixelTrack::Quality::loose) - continue; - - auto pt = tracks.pt(idx); - - if (pt < ptMin) - continue; - - auto& data = *pws; - auto it = atomicAdd(&data.ntrks, 1); - data.itrk[it] = idx; - data.zt[it] = tracks.zip(idx); - data.ezt2[it] = fit.covariance(idx)(14); - data.ptt2[it] = pt * pt; - } - } - -// #define THREE_KERNELS -#ifndef THREE_KERNELS - __global__ void vertexFinderOneKernel(gpuVertexFinder::ZVertices* pdata, - gpuVertexFinder::WorkSpace* pws, - int minT, // min number of neighbours to be "seed" - float eps, // max absolute distance to cluster - float errmax, // max error to be "seed" - float chi2max // max normalized distance to cluster, - ) { - clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); - __syncthreads(); - fitVertices(pdata, pws, maxChi2ForFirstFit); - __syncthreads(); - splitVertices(pdata, pws, maxChi2ForSplit); - __syncthreads(); - fitVertices(pdata, pws, maxChi2ForFinalFit); - __syncthreads(); - sortByPt2(pdata, pws); - } -#else - __global__ void vertexFinderKernel1(gpuVertexFinder::ZVertices* pdata, - gpuVertexFinder::WorkSpace* pws, - int minT, // min number of neighbours to be "seed" - float eps, // max absolute distance to cluster - float errmax, // max error to be "seed" - float chi2max // max normalized distance to cluster, - ) { - clusterTracksByDensity(pdata, pws, minT, eps, errmax, chi2max); - __syncthreads(); - fitVertices(pdata, pws, maxChi2ForFirstFit); - } - - __global__ void vertexFinderKernel2(gpuVertexFinder::ZVertices* pdata, gpuVertexFinder::WorkSpace* pws) { - fitVertices(pdata, pws, maxChi2ForFinalFit); - __syncthreads(); - sortByPt2(pdata, pws); - } -#endif - -#ifdef __CUDACC__ - ZVertexHeterogeneous Producer::makeAsync(cudaStream_t stream, TkSoA const* tksoa, float ptMin) const { -#ifdef PIXVERTEX_DEBUG_PRODUCE - std::cout << "producing Vertices on GPU" << std::endl; -#endif // PIXVERTEX_DEBUG_PRODUCE - ZVertexHeterogeneous vertices(cms::cuda::make_device_unique<ZVertexSoA>(stream)); -#else - ZVertexHeterogeneous Producer::make(TkSoA const* tksoa, float ptMin) const { -#ifdef PIXVERTEX_DEBUG_PRODUCE - std::cout << "producing Vertices on CPU" << std::endl; -#endif // PIXVERTEX_DEBUG_PRODUCE - ZVertexHeterogeneous vertices(std::make_unique<ZVertexSoA>()); -#endif - assert(tksoa); - auto* soa = vertices.get(); - assert(soa); - -#ifdef __CUDACC__ - auto ws_d = cms::cuda::make_device_unique<WorkSpace>(stream); -#else - auto ws_d = std::make_unique<WorkSpace>(); -#endif - -#ifdef __CUDACC__ - init<<<1, 1, 0, stream>>>(soa, ws_d.get()); - auto blockSize = 128; - auto numberOfBlocks = (TkSoA::stride() + blockSize - 1) / blockSize; - loadTracks<<<numberOfBlocks, blockSize, 0, stream>>>(tksoa, soa, ws_d.get(), ptMin); - cudaCheck(cudaGetLastError()); -#else - init(soa, ws_d.get()); - loadTracks(tksoa, soa, ws_d.get(), ptMin); -#endif - -#ifdef __CUDACC__ - // Running too many thread lead to problems when printf is enabled. - constexpr int maxThreadsForPrint = 1024 - 256; - constexpr int numBlocks = 1024; - constexpr int threadsPerBlock = 128; - - if (oneKernel_) { - // implemented only for density clustesrs -#ifndef THREE_KERNELS - vertexFinderOneKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); -#else - vertexFinderKernel1<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - cudaCheck(cudaGetLastError()); - // one block per vertex... - splitVerticesKernel<<<numBlocks, threadsPerBlock, 0, stream>>>(soa, ws_d.get(), maxChi2ForSplit); - cudaCheck(cudaGetLastError()); - vertexFinderKernel2<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); -#endif - } else { // five kernels - if (useDensity_) { - clusterTracksByDensityKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useDBSCAN_) { - clusterTracksDBSCAN<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useIterative_) { - clusterTracksIterative<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), minT, eps, errmax, chi2max); - } - cudaCheck(cudaGetLastError()); - fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFirstFit); - cudaCheck(cudaGetLastError()); - // one block per vertex... - splitVerticesKernel<<<numBlocks, threadsPerBlock, 0, stream>>>(soa, ws_d.get(), maxChi2ForSplit); - cudaCheck(cudaGetLastError()); - fitVerticesKernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get(), maxChi2ForFinalFit); - cudaCheck(cudaGetLastError()); - sortByPt2Kernel<<<1, maxThreadsForPrint, 0, stream>>>(soa, ws_d.get()); - } - cudaCheck(cudaGetLastError()); -#else // __CUDACC__ - if (useDensity_) { - clusterTracksByDensity(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useDBSCAN_) { - clusterTracksDBSCAN(soa, ws_d.get(), minT, eps, errmax, chi2max); - } else if (useIterative_) { - clusterTracksIterative(soa, ws_d.get(), minT, eps, errmax, chi2max); - } -#ifdef PIXVERTEX_DEBUG_PRODUCE - std::cout << "found " << (*ws_d).nvIntermediate << " vertices " << std::endl; -#endif // PIXVERTEX_DEBUG_PRODUCE - fitVertices(soa, ws_d.get(), maxChi2ForFirstFit); - // one block per vertex! - splitVertices(soa, ws_d.get(), maxChi2ForSplit); - fitVertices(soa, ws_d.get(), maxChi2ForFinalFit); - sortByPt2(soa, ws_d.get()); -#endif - - return vertices; - } - -} // namespace gpuVertexFinder - -#endif // RecoPixelVertexing_PixelVertexFinding_plugins_gpuVertexFinderImpl_h From 353404a77ecf9b44540a5513c359b322bf9c6cdb Mon Sep 17 00:00:00 2001 From: Jeongeun Lee <jeongeun.lee@cern.ch> Date: Tue, 27 Apr 2021 18:44:03 +0200 Subject: [PATCH 054/309] replace EDProducer with clone from the default cfipython --- .../python/hltL2MuonIsolationsCR_cfi.py | 3 ++- RecoMuon/L2MuonProducer/python/L2Muons_cfi.py | 5 +++-- RecoMuon/L3MuonProducer/python/L3Muons_cfi.py | 4 ++-- RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py | 7 ++++--- RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py | 3 ++- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py index face0beacc966..fe8554f2d4c1a 100644 --- a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py +++ b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms +import RecoMuon.L2MuonIsolationProducer.hltL2MuonIsolations_cfi as _mod -hltL2MuonIsolationsCR = cms.EDProducer("L2MuonIsolationProducer", +hltL2MuonIsolationsCR = _mod.hltL2MuonIsolations.clone( StandAloneCollectionLabel = cms.InputTag("L2Muons","UpdatedAtVtx"), IsolatorPSet = cms.PSet( ComponentName = cms.string( "CutsIsolatorWithCorrection" ), diff --git a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py index ec2289a64a1fc..f85e3fc19677e 100644 --- a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py +++ b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py @@ -1,9 +1,10 @@ import FWCore.ParameterSet.Config as cms - # The services from RecoMuon.TrackingTools.MuonServiceProxy_cff import * from RecoMuon.TrackingTools.MuonTrackLoader_cff import * -L2Muons = cms.EDProducer("L2MuonProducer", +import RecoMuon.L2MuonProducer.L2MuonProducer_cfi as _mod + +L2Muons = _mod.L2MuonProducer.clone( MuonTrackLoaderForSTA, MuonServiceProxy, InputObjects = cms.InputTag("L2MuonSeeds"), diff --git a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py index 5af41e2a5130c..ad93c9a0ca978 100644 --- a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py +++ b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py @@ -1,11 +1,11 @@ import FWCore.ParameterSet.Config as cms - +import RecoMuon.L3MuonProducer.L3MuonProducer_cfi as _mod #this is a dump of the latest configuration of that module #this is not the actual configuration of HLT #changing this file will not change the behavior of HLT #see the actual configuration in confDB -L3Muons = cms.EDProducer("L3MuonProducer", +L3Muons = _mod.L3MuonProducer.clone( ServiceParameters = cms.PSet( Propagators = cms.untracked.vstring('SmartPropagatorAny', 'SteppingHelixPropagatorAny', diff --git a/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py b/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py index cc8d977f6a2fb..d9ed3b69f633a 100644 --- a/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py +++ b/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py @@ -1,4 +1,5 @@ import FWCore.ParameterSet.Config as cms +import PhysicsTools.IsolationAlgos.CITKPFIsolationSumProducerForPUPPI_cfi as _mod IsoConeDefinitions = cms.VPSet( cms.PSet( isolationAlgo = cms.string('MuonPFIsolationWithConeVeto'), @@ -21,20 +22,20 @@ miniAODVertexCodes = cms.vuint32(2,3) ), ) -muonIsolationAODPUPPI = cms.EDProducer( "CITKPFIsolationSumProducerForPUPPI", +muonIsolationAODPUPPI = _mod.CITKPFIsolationSumProducerForPUPPI.clone( srcToIsolate = cms.InputTag("muons"), srcForIsolationCone = cms.InputTag(''), isolationConeDefinitions = IsoConeDefinitions ) -muonIsolationMiniAODPUPPI = cms.EDProducer( "CITKPFIsolationSumProducerForPUPPI", +muonIsolationMiniAODPUPPI = _mod.CITKPFIsolationSumProducerForPUPPI.clone( srcToIsolate = cms.InputTag("slimmedMuons"), srcForIsolationCone = cms.InputTag('packedPFCandidates'), puppiValueMap = cms.InputTag(''), isolationConeDefinitions = IsoConeDefinitions ) -muonIsolationMiniAODPUPPINoLeptons = cms.EDProducer( "CITKPFIsolationSumProducerForPUPPI", +muonIsolationMiniAODPUPPINoLeptons = _mod.CITKPFIsolationSumProducerForPUPPI.clone( srcToIsolate = cms.InputTag("slimmedMuons"), srcForIsolationCone = cms.InputTag('packedPFCandidates'), puppiValueMap = cms.InputTag(''), diff --git a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py index c6fc60c850e48..3ad65c9c53971 100644 --- a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py +++ b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py @@ -3,8 +3,9 @@ from RecoMuon.MuonSeedGenerator.ptSeedParameterization_cfi import * from RecoMuon.MuonSeedGenerator.MuonSeedPtScale_cfi import * +import RecoMuon.MuonSeedGenerator.produceMuons_cfi as _mod # module standAloneMuonSeeds = MuonSeedGenerator { -ancientMuonSeed = cms.EDProducer("MuonSeedGenerator", +ancientMuonSeed = _mod.produceMuons.clone( ptSeedParameterization, dphiScale, beamSpotTag = cms.InputTag("offlineBeamSpot"), From 2cae018287803ea3324a38ece7e4357bf2da1995 Mon Sep 17 00:00:00 2001 From: hyunyong <antilogy33@gmail.com> Date: Wed, 28 Apr 2021 05:01:50 +0900 Subject: [PATCH 055/309] remove hard-coded dphi value --- .../GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc index ac8293935be87..106605e9a5fb0 100644 --- a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc +++ b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc @@ -166,7 +166,7 @@ GEMEtaPartition* GEMGeometryBuilderFromCondDB::buildEtaPartition(const RecoIdeal float ti = convertMmToCm(*(shapeStart + 3)); float nstrip = *(shapeStart + 4); float npad = *(shapeStart + 5); - //float dphi = *(shapeStart + 6); + float dphi = *(shapeStart + 6); std::vector<float> pars; pars.emplace_back(be); @@ -174,8 +174,7 @@ GEMEtaPartition* GEMGeometryBuilderFromCondDB::buildEtaPartition(const RecoIdeal pars.emplace_back(ap); pars.emplace_back(nstrip); pars.emplace_back(npad); - //pars.emplace_back(dphi); - pars.emplace_back(0.17715); //temporary input for PR + pars.emplace_back(dphi); RCPBoundPlane surf(boundPlane(rgeo, gid, detId)); GEMEtaPartitionSpecs* e_p_specs = new GEMEtaPartitionSpecs(GeomDetEnumerators::GEM, name, pars); From 20532eaf31cc14957a13d20ae9dfe63bf631b1ad Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Mon, 12 Apr 2021 13:28:07 +0200 Subject: [PATCH 056/309] add WToLNu and WprimeToLNu at 14 TeV, fix WM --- .../python/WM_14TeV_TuneCUETP8M1_cfi.py | 2 +- .../python/WToLNu_14TeV_TuneCUETP8M1_cfi.py | 28 +++++++++++++++++ ...primeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py | 30 +++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py create mode 100644 Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py diff --git a/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py index fbd32220020da..d573eab43c769 100644 --- a/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py @@ -15,7 +15,7 @@ processParameters = cms.vstring( 'WeakSingleBoson:ffbar2W = on', '24:onMode = off', - '24:onIfAny = 12 13', + '24:onIfAny = 13 14', ), parameterSets = cms.vstring('pythia8CommonSettings', 'pythia8CUEP8M1Settings', diff --git a/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py new file mode 100644 index 0000000000000..8c8ad57838f5c --- /dev/null +++ b/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaPylistVerbosity = cms.untracked.int32(0), + filterEfficiency = cms.untracked.double(1.0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + crossSection = cms.untracked.double(51360.0), # 17120.0 x 3 + comEnergy = cms.double(14000.0), + maxEventsToPrint = cms.untracked.int32(0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CUEP8M1SettingsBlock, + processParameters = cms.vstring( + 'WeakSingleBoson:ffbar2W = on', + '24:onMode = off', + '24:onIfAny = 11 12', + '24:onIfAny = 13 14', + '24:onIfAny = 15 16', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CUEP8M1Settings', + 'processParameters', + ) + ) + ) + diff --git a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py new file mode 100644 index 0000000000000..ab1128b8ae80b --- /dev/null +++ b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py @@ -0,0 +1,30 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaHepMCVerbosity = cms.untracked.bool(False), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(1), + filterEfficiency = cms.untracked.double(1.), + crossSection = cms.untracked.double(1.), + comEnergy = cms.double(14000.0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CUEP8M1SettingsBlock, + processParameters = cms.vstring( + 'NewGaugeBoson:ffbar2Wprime = on', + '34:m0 = 2000 ', + '34:onMode = off', + '34:onIfAny = 11 12', + '34:onIfAny = 13 14', + '34:onIfAny = 15 16', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CUEP8M1Settings', + 'processParameters', + ) + ) + ) + +ProductionFilterSequence = cms.Sequence(generator) From 4bae7703a1dd9739197cf794f53554ad90669427 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Tue, 13 Apr 2021 13:33:19 +0200 Subject: [PATCH 057/309] add TuneCP5 ones fix --- .../python/WToLNu_14TeV_TuneCP5_cfi.py | 29 ++++++++++++++++++ .../python/WToLNu_14TeV_TuneCUETP8M1_cfi.py | 5 ++-- .../WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py | 30 +++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 Configuration/Generator/python/WToLNu_14TeV_TuneCP5_cfi.py create mode 100644 Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py diff --git a/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_cfi.py new file mode 100644 index 0000000000000..0ab27b9359f09 --- /dev/null +++ b/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_cfi.py @@ -0,0 +1,29 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaPylistVerbosity = cms.untracked.int32(0), + filterEfficiency = cms.untracked.double(1.0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + crossSection = cms.untracked.double(51360.0), # 17120.0 x 3 + comEnergy = cms.double(14000.0), + maxEventsToPrint = cms.untracked.int32(0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'WeakSingleBoson:ffbar2W = on', + '24:onMode = off', + '24:onIfAny = 11 12', + '24:onIfAny = 13 14', + '24:onIfAny = 15 16', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) + +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py index 8c8ad57838f5c..cdf673c0ae8d1 100644 --- a/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py @@ -22,7 +22,8 @@ parameterSets = cms.vstring('pythia8CommonSettings', 'pythia8CUEP8M1Settings', 'processParameters', - ) - ) + ) ) + ) +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py new file mode 100644 index 0000000000000..5f3c2c32ba905 --- /dev/null +++ b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py @@ -0,0 +1,30 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.Generator.Pythia8CommonSettings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * + +generator = cms.EDFilter("Pythia8GeneratorFilter", + pythiaHepMCVerbosity = cms.untracked.bool(False), + maxEventsToPrint = cms.untracked.int32(0), + pythiaPylistVerbosity = cms.untracked.int32(1), + filterEfficiency = cms.untracked.double(1.), + crossSection = cms.untracked.double(1.), + comEnergy = cms.double(14000.0), + PythiaParameters = cms.PSet( + pythia8CommonSettingsBlock, + pythia8CP5SettingsBlock, + processParameters = cms.vstring( + 'NewGaugeBoson:ffbar2Wprime = on', + '34:m0 = 2000 ', + '34:onMode = off', + '34:onIfAny = 11 12', + '34:onIfAny = 13 14', + '34:onIfAny = 15 16', + ), + parameterSets = cms.vstring('pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters', + ) + ) + ) + +ProductionFilterSequence = cms.Sequence(generator) From 0aba87284289a7ab780307063bc07caf721bcf68 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Wed, 28 Apr 2021 09:45:42 +0200 Subject: [PATCH 058/309] remove old W and W' CUETP8M1 tune configs --- ...UETP8M1_cfi.py => WM_14TeV_TuneCP5_cfi.py} | 5 ++-- .../python/WToLNu_14TeV_TuneCUETP8M1_cfi.py | 29 ------------------ ...primeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py | 30 ------------------- 3 files changed, 3 insertions(+), 61 deletions(-) rename Configuration/Generator/python/{WM_14TeV_TuneCUETP8M1_cfi.py => WM_14TeV_TuneCP5_cfi.py} (87%) delete mode 100644 Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py delete mode 100644 Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py diff --git a/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py similarity index 87% rename from Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py rename to Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py index d573eab43c769..001c036ddca6d 100644 --- a/Configuration/Generator/python/WM_14TeV_TuneCUETP8M1_cfi.py +++ b/Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * generator = cms.EDFilter("Pythia8GeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), @@ -11,7 +11,7 @@ maxEventsToPrint = cms.untracked.int32(0), PythiaParameters = cms.PSet( pythia8CommonSettingsBlock, - pythia8CUEP8M1SettingsBlock, + pythia8CP5SettingsBlock, processParameters = cms.vstring( 'WeakSingleBoson:ffbar2W = on', '24:onMode = off', @@ -24,3 +24,4 @@ ) ) +ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py deleted file mode 100644 index cdf673c0ae8d1..0000000000000 --- a/Configuration/Generator/python/WToLNu_14TeV_TuneCUETP8M1_cfi.py +++ /dev/null @@ -1,29 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * - -generator = cms.EDFilter("Pythia8GeneratorFilter", - pythiaPylistVerbosity = cms.untracked.int32(0), - filterEfficiency = cms.untracked.double(1.0), - pythiaHepMCVerbosity = cms.untracked.bool(False), - crossSection = cms.untracked.double(51360.0), # 17120.0 x 3 - comEnergy = cms.double(14000.0), - maxEventsToPrint = cms.untracked.int32(0), - PythiaParameters = cms.PSet( - pythia8CommonSettingsBlock, - pythia8CUEP8M1SettingsBlock, - processParameters = cms.vstring( - 'WeakSingleBoson:ffbar2W = on', - '24:onMode = off', - '24:onIfAny = 11 12', - '24:onIfAny = 13 14', - '24:onIfAny = 15 16', - ), - parameterSets = cms.vstring('pythia8CommonSettings', - 'pythia8CUEP8M1Settings', - 'processParameters', - ) - ) - ) - -ProductionFilterSequence = cms.Sequence(generator) diff --git a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py deleted file mode 100644 index ab1128b8ae80b..0000000000000 --- a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCUETP8M1_cfi.py +++ /dev/null @@ -1,30 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CUEP8M1Settings_cfi import * - -generator = cms.EDFilter("Pythia8GeneratorFilter", - pythiaHepMCVerbosity = cms.untracked.bool(False), - maxEventsToPrint = cms.untracked.int32(0), - pythiaPylistVerbosity = cms.untracked.int32(1), - filterEfficiency = cms.untracked.double(1.), - crossSection = cms.untracked.double(1.), - comEnergy = cms.double(14000.0), - PythiaParameters = cms.PSet( - pythia8CommonSettingsBlock, - pythia8CUEP8M1SettingsBlock, - processParameters = cms.vstring( - 'NewGaugeBoson:ffbar2Wprime = on', - '34:m0 = 2000 ', - '34:onMode = off', - '34:onIfAny = 11 12', - '34:onIfAny = 13 14', - '34:onIfAny = 15 16', - ), - parameterSets = cms.vstring('pythia8CommonSettings', - 'pythia8CUEP8M1Settings', - 'processParameters', - ) - ) - ) - -ProductionFilterSequence = cms.Sequence(generator) From bbb17baf002ae74665d12738285a64f27ba84a66 Mon Sep 17 00:00:00 2001 From: Jeongeun Lee <jeongeun.lee@cern.ch> Date: Wed, 28 Apr 2021 10:47:06 +0200 Subject: [PATCH 059/309] remove duplicated parameters and cleanup type specifications --- .../python/hltL2MuonIsolationsCR_cfi.py | 66 +++----- RecoMuon/L2MuonProducer/python/L2Muons_cfi.py | 83 +++------- RecoMuon/L3MuonProducer/python/L3Muons_cfi.py | 148 +++++------------- .../python/muonIsolationPUPPI_cff.py | 18 +-- .../python/ancientMuonSeed_cfi.py | 4 - 5 files changed, 88 insertions(+), 231 deletions(-) diff --git a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py index fe8554f2d4c1a..df8c565b28ec8 100644 --- a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py +++ b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py @@ -2,77 +2,49 @@ import RecoMuon.L2MuonIsolationProducer.hltL2MuonIsolations_cfi as _mod hltL2MuonIsolationsCR = _mod.hltL2MuonIsolations.clone( - StandAloneCollectionLabel = cms.InputTag("L2Muons","UpdatedAtVtx"), - IsolatorPSet = cms.PSet( - ComponentName = cms.string( "CutsIsolatorWithCorrection" ), - ConeSizes = cms.vdouble(0.24, 0.24, 0.24, 0.24, 0.24, + StandAloneCollectionLabel = "L2Muons:UpdatedAtVtx", + IsolatorPSet = dict( + ConeSizes = [0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, - 0.24), - Thresholds = cms.vdouble(5.5, 5.5, 5.9, 5.7, 5.1, + 0.24], + Thresholds = [5.5, 5.5, 5.9, 5.7, 5.1, 4.9, 5.0, 5.0, 5.1, 5.0, 4.8, 4.8, 4.7, 4.7, 3.5, 3.1, 3.5, 3.9, 3.7, 3.7, 3.5, 3.5, 3.2, 3.3, 3.4, - 3.4), - EtaBounds = cms.vdouble(0.0435, 0.1305, 0.2175, 0.3045, 0.3915, + 3.4], + EtaBounds = [0.0435, 0.1305, 0.2175, 0.3045, 0.3915, 0.4785, 0.5655, 0.6525, 0.7395, 0.8265, 0.9135, 1.0005, 1.0875, 1.1745, 1.2615, 1.3485, 1.4355, 1.5225, 1.6095, 1.6965, 1.785, 1.88, 1.9865, 2.1075, 2.247, - 2.411), - ConeSizesRel = cms.vdouble(0.24, 0.24, 0.24, 0.24, 0.24, + 2.411], + ConeSizesRel = [0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, 0.24, - 0.24), -#some mild nonsense numbers - ThresholdsRel = cms.vdouble(0.155, 0.155, 0.159, 0.157, 0.151, + 0.24], + #some mild nonsense numbers + ThresholdsRel = [0.155, 0.155, 0.159, 0.157, 0.151, 0.149, 0.150, 0.150, 0.151, 0.150, 0.148, 0.148, 0.147, 0.147, 0.135, 0.131, 0.135, 0.139, 0.137, 0.137, 0.135, 0.135, 0.132, 0.133, 0.134, - 0.134), - EtaBoundsRel = cms.vdouble(0.0435, 0.1305, 0.2175, 0.3045, 0.3915, + 0.134], + EtaBoundsRel = [0.0435, 0.1305, 0.2175, 0.3045, 0.3915, 0.4785, 0.5655, 0.6525, 0.7395, 0.8265, 0.9135, 1.0005, 1.0875, 1.1745, 1.2615, 1.3485, 1.4355, 1.5225, 1.6095, 1.6965, 1.785, 1.88, 1.9865, 2.1075, 2.247, - 2.411), - CutAbsoluteIso = cms.bool(True), - CutRelativeIso = cms.bool(False), - UseRhoCorrection = cms.bool(False), - RhoSrc = cms.InputTag('hltKT6CaloJets','rho'), - RhoMax = cms.double(9.9999999E7), - RhoScaleBarrel = cms.double(1.0), - RhoScaleEndcap = cms.double(1.0), - EffAreaSFBarrel = cms.double(1.0), - EffAreaSFEndcap = cms.double(1.0), -#only one should be on - ReturnAbsoluteSum = cms.bool(True), - ReturnRelativeSum = cms.bool(False), - AndOrCuts = cms.bool(True) + 2.411], + UseRhoCorrection = False, + RhoSrc = 'hltKT6CaloJets:rho', + RhoMax = 9.9999999E7, ), - WriteIsolatorFloat = cms.bool(False), # OutputMuIsoDeposits = cms.bool(True), - ExtractorPSet = cms.PSet( - DR_Veto_H = cms.double(0.1), - Vertex_Constraint_Z = cms.bool(False), - Threshold_H = cms.double(0.5), - ComponentName = cms.string('CaloExtractor'), - Threshold_E = cms.double(0.2), - DR_Max = cms.double(1.0), - DR_Veto_E = cms.double(0.07), - Weight_E = cms.double(1.5), - Vertex_Constraint_XY = cms.bool(False), - DepositLabel = cms.untracked.string('EcalPlusHcal'), - CaloTowerCollectionLabel = cms.InputTag("towerMaker"), - Weight_H = cms.double(1.0) - ) + ExtractorPSet = dict() ) - - - diff --git a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py index f85e3fc19677e..68a3b26609e53 100644 --- a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py +++ b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py @@ -7,74 +7,29 @@ L2Muons = _mod.L2MuonProducer.clone( MuonTrackLoaderForSTA, MuonServiceProxy, - InputObjects = cms.InputTag("L2MuonSeeds"), - MuonTrajectoryBuilder = cms.string("StandAloneMuonTrajectoryBuilder"), - DoSeedRefit = cms.bool(False), - SeedTransformerParameters = cms.PSet( - Fitter = cms.string("hltESPKFFittingSmootherForL2Muon"), - MuonRecHitBuilder = cms.string("hltESPMuonTransientTrackingRecHitBuilder"), - NMinRecHits = cms.uint32(2), - UseSubRecHits = cms.bool(False), - Propagator = cms.string("hltESPFastSteppingHelixPropagatorAny"), - RescaleError = cms.double(100.0) - ), - L2TrajBuilderParameters = cms.PSet( - DoRefit = cms.bool(False), - FilterParameters = cms.PSet( - NumberOfSigma = cms.double(3.0), - FitDirection = cms.string('insideOut'), - DTRecSegmentLabel = cms.InputTag("dt4DSegments"), - MaxChi2 = cms.double(1000.0), - MuonTrajectoryUpdatorParameters = cms.PSet( - MaxChi2 = cms.double(25.0), - RescaleError = cms.bool(False), - RescaleErrorFactor = cms.double(100.0), - Granularity = cms.int32(0), - ExcludeRPCFromFit = cms.bool(False), - UseInvalidHits = cms.bool(True), - ), - EnableRPCMeasurement = cms.bool(True), - CSCRecSegmentLabel = cms.InputTag("cscSegments"), - EnableDTMeasurement = cms.bool(True), - RPCRecSegmentLabel = cms.InputTag("rpcRecHits"), - Propagator = cms.string('SteppingHelixPropagatorL2Any'), - EnableGEMMeasurement = cms.bool(False), - GEMRecSegmentLabel = cms.InputTag("gemRecHits"), - EnableME0Measurement = cms.bool(False), - ME0RecSegmentLabel = cms.InputTag("me0Segments"), - EnableCSCMeasurement = cms.bool(True) + InputObjects = "L2MuonSeeds", + MuonTrajectoryBuilder = "StandAloneMuonTrajectoryBuilder", + SeedTransformerParameters = dict(), + L2TrajBuilderParameters = dict( + FilterParameters = dict( + DTRecSegmentLabel = "dt4DSegments", + MuonTrajectoryUpdatorParameters = dict(), + CSCRecSegmentLabel = "cscSegments", + RPCRecSegmentLabel = "rpcRecHits", + Propagator = 'SteppingHelixPropagatorL2Any', ), # a precise propagation direction can be choosen accordingly with the # above seed position - SeedPropagator = cms.string('SteppingHelixPropagatorL2Any'), - NavigationType = cms.string('Standard'), - DoBackwardFilter = cms.bool(True), + SeedPropagator = 'SteppingHelixPropagatorL2Any', # where you want the seed (in,out) - SeedPosition = cms.string('in'), - BWFilterParameters = cms.PSet( - NumberOfSigma = cms.double(3.0), - BWSeedType = cms.string('fromGenerator'), - FitDirection = cms.string('outsideIn'), - DTRecSegmentLabel = cms.InputTag("dt4DSegments"), - MaxChi2 = cms.double(100.0), - MuonTrajectoryUpdatorParameters = cms.PSet( - MaxChi2 = cms.double(25.0), - RescaleError = cms.bool(False), - RescaleErrorFactor = cms.double(100.0), - Granularity = cms.int32(2), - ExcludeRPCFromFit = cms.bool( False ), - UseInvalidHits = cms.bool( True ), - ), - EnableRPCMeasurement = cms.bool(True), - CSCRecSegmentLabel = cms.InputTag("cscSegments"), - EnableDTMeasurement = cms.bool(True), - RPCRecSegmentLabel = cms.InputTag("rpcRecHits"), - Propagator = cms.string('SteppingHelixPropagatorL2Any'), - EnableGEMMeasurement = cms.bool(False), - GEMRecSegmentLabel = cms.InputTag("gemRecHits"), - EnableME0Measurement = cms.bool(False), - ME0RecSegmentLabel = cms.InputTag("me0Segments"), - EnableCSCMeasurement = cms.bool(True) + BWFilterParameters = dict( + DTRecSegmentLabel = "dt4DSegments", + MuonTrajectoryUpdatorParameters = dict( + Granularity = 2, + ), + CSCRecSegmentLabel = "cscSegments", + RPCRecSegmentLabel = "rpcRecHits", + Propagator = 'SteppingHelixPropagatorL2Any', ), ) ) diff --git a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py index ad93c9a0ca978..679e0cc1d1d96 100644 --- a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py +++ b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py @@ -6,123 +6,57 @@ #see the actual configuration in confDB L3Muons = _mod.L3MuonProducer.clone( - ServiceParameters = cms.PSet( - Propagators = cms.untracked.vstring('SmartPropagatorAny', + ServiceParameters = dict( + Propagators = ['SmartPropagatorAny', 'SteppingHelixPropagatorAny', 'SmartPropagator', - 'SteppingHelixPropagatorOpposite'), - RPCLayers = cms.bool(True), - UseMuonNavigation = cms.untracked.bool(True) + 'SteppingHelixPropagatorOpposite'], ), - MuonCollectionLabel = cms.InputTag("hltL2Muons","UpdatedAtVtx"), - TrackLoaderParameters = cms.PSet( - PutTkTrackIntoEvent = cms.untracked.bool(True), - VertexConstraint = cms.bool(False), - MuonSeededTracksInstance = cms.untracked.string('L2Seeded'), - Smoother = cms.string('KFSmootherForMuonTrackLoader'), - MuonUpdatorAtVertexParameters = cms.PSet( - MaxChi2 = cms.double(1000000.0), - Propagator = cms.string('SteppingHelixPropagatorOpposite'), - BeamSpotPositionErrors = cms.vdouble(0.1, 0.1, 5.3) + TrackLoaderParameters = dict( + PutTkTrackIntoEvent = True, + Smoother = 'KFSmootherForMuonTrackLoader', + MuonUpdatorAtVertexParameters = dict( + Propagator = 'SteppingHelixPropagatorOpposite', ), - SmoothTkTrack = cms.untracked.bool(False), - DoSmoothing = cms.bool(True), - beamSpot = cms.InputTag("hltOfflineBeamSpot") + DoSmoothing = True, + beamSpot = "hltOfflineBeamSpot" ), - L3TrajBuilderParameters = cms.PSet( - ScaleTECxFactor = cms.double(-1.0), - TrackerRecHitBuilder = cms.string('WithTrackAngle'), - MuonTrackingRegionBuilder = cms.PSet( - EtaR_UpperLimit_Par1 = cms.double(0.25), - Eta_fixed = cms.double(0.2), - OnDemand = cms.double(-1.0), - Rescale_Dz = cms.double(3.0), - Eta_min = cms.double(0.05), - Rescale_phi = cms.double(3.0), - EtaR_UpperLimit_Par2 = cms.double(0.15), + L3TrajBuilderParameters = dict( + TrackerRecHitBuilder = 'WithTrackAngle', + MuonTrackingRegionBuilder = dict( + #Eta_fixed = cms.double(0.2), # please check, default type is cms.bool(True) + Rescale_Dz = 3.0, + Eta_min = 0.05, DeltaZ_Region = cms.double(15.9), - Rescale_eta = cms.double(3.0), - PhiR_UpperLimit_Par2 = cms.double(0.2), - vertexCollection = cms.InputTag("pixelVertices"), - Phi_fixed = cms.double(0.2), - DeltaR = cms.double(0.2), - EscapePt = cms.double(1.5), + #Phi_fixed = cms.double(0.2), # please check, default type is cms.bool(False) + DeltaR = 0.2, + EscapePt = 1.5, UseFixedRegion = cms.bool(False), - PhiR_UpperLimit_Par1 = cms.double(0.6), - Phi_min = cms.double(0.05), - UseVertex = cms.bool(False), - beamSpot = cms.InputTag("hltOfflineBeamSpot") + Phi_min = 0.05, + beamSpot = "hltOfflineBeamSpot" ), - TrackerPropagator = cms.string('SteppingHelixPropagatorAny'), - GlobalMuonTrackMatcher = cms.PSet( - Pt_threshold1 = cms.double(0.0), - DeltaDCut_3 = cms.double(15.0), - MinP = cms.double(2.5), - MinPt = cms.double(1.0), - Chi2Cut_1 = cms.double(50.0), - Pt_threshold2 = cms.double(999999999.0), - LocChi2Cut = cms.double(0.001), - Eta_threshold = cms.double(1.2), - Quality_3 = cms.double(7.0), - Quality_2 = cms.double(15.0), - Chi2Cut_2 = cms.double(50.0), - Chi2Cut_3 = cms.double(200.0), - DeltaDCut_1 = cms.double(40.0), - DeltaRCut_2 = cms.double(0.2), - DeltaRCut_3 = cms.double(1.0), - DeltaDCut_2 = cms.double(10.0), - DeltaRCut_1 = cms.double(0.1), - Quality_1 = cms.double(20.0), - Propagator = cms.string('SmartPropagator') + GlobalMuonTrackMatcher = dict( + Propagator = 'SmartPropagator' ), - ScaleTECyFactor = cms.double(-1.0), - tkTrajLabel = cms.InputTag("hltL3TkTracksFromL2"), - tkTrajBeamSpot = cms.InputTag("hltOfflineBeamSpot"), # add a filter for L3 trajectory - tkTrajMaxChi2 = cms.double(999), # add a filter for L3 trajectory - tkTrajMaxDXYBeamSpot = cms.double(999), # add a filter for L3 trajectory - tkTrajVertex = cms.InputTag("pixelVertices"), # add a filter for L3 trajectory - tkTrajUseVertex = cms.bool(False), # add a filter for L3 trajectory - MuonRecHitBuilder = cms.string('MuonRecHitBuilder'), - RefitRPCHits = cms.bool(True), - TrackTransformer = cms.PSet( - DoPredictionsOnly = cms.bool(False), - Fitter = cms.string('L3MuKFFitter'), - TrackerRecHitBuilder = cms.string('WithTrackAngle'), - Smoother = cms.string('KFSmootherForMuonTrackLoader'), - MuonRecHitBuilder = cms.string('MuonRecHitBuilder'), - RefitDirection = cms.string('insideOut'), - RefitRPCHits = cms.bool(True), - Propagator = cms.string('SmartPropagatorAny') + tkTrajLabel = "hltL3TkTracksFromL2", + tkTrajBeamSpot = "hltOfflineBeamSpot", # add a filter for L3 trajectory + tkTrajMaxChi2 = 999, # add a filter for L3 trajectory + tkTrajMaxDXYBeamSpot = 999, # add a filter for L3 trajectory + tkTrajVertex = "pixelVertices", # add a filter for L3 trajectory + tkTrajUseVertex = False, # add a filter for L3 trajectory + MuonRecHitBuilder = 'MuonRecHitBuilder', + TrackTransformer = dict( + Fitter = 'L3MuKFFitter', + TrackerRecHitBuilder = 'WithTrackAngle', + Smoother = 'KFSmootherForMuonTrackLoader', + MuonRecHitBuilder = 'MuonRecHitBuilder', + Propagator = 'SmartPropagatorAny' ), - PtCut = cms.double(1.0), - PCut = cms.double(2.5), - GlbRefitterParameters = cms.PSet( - TrackerSkipSection = cms.int32(-1), - DoPredictionsOnly = cms.bool(False), - PropDirForCosmics = cms.bool(False), - HitThreshold = cms.int32(1), - MuonHitsOption = cms.int32(1), - Chi2CutRPC = cms.double(1.0), - Fitter = cms.string('L3MuKFFitter'), - TrackerRecHitBuilder = cms.string('WithTrackAngle'), - MuonRecHitBuilder = cms.string('MuonRecHitBuilder'), - RefitDirection = cms.string('insideOut'), - CSCRecSegmentLabel = cms.InputTag("hltCscSegments"), - Chi2CutCSC = cms.double(150.0), - Chi2CutDT = cms.double(10.0), - Chi2CutGEM = cms.double(1.0), - Chi2CutME0 = cms.double(1.0), - RefitRPCHits = cms.bool(True), - SkipStation = cms.int32(-1), - Propagator = cms.string('SmartPropagatorAny'), - DTRecSegmentLabel = cms.InputTag("hltDt4DSegments"), - GEMRecHitLabel = cms.InputTag("gemRecHits"), - ME0RecHitLabel = cms.InputTag("me0Segments"), - TrackerSkipSystem = cms.int32(-1) + GlbRefitterParameters = dict( + Fitter = 'L3MuKFFitter', + TrackerRecHitBuilder = 'WithTrackAngle', + MuonRecHitBuilder = 'MuonRecHitBuilder', + Propagator = 'SmartPropagatorAny', ) ) ) - - - - diff --git a/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py b/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py index d9ed3b69f633a..182ea65e68250 100644 --- a/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py +++ b/RecoMuon/MuonIsolation/python/muonIsolationPUPPI_cff.py @@ -23,22 +23,22 @@ ) muonIsolationAODPUPPI = _mod.CITKPFIsolationSumProducerForPUPPI.clone( - srcToIsolate = cms.InputTag("muons"), - srcForIsolationCone = cms.InputTag(''), + srcToIsolate = "muons", + srcForIsolationCone = '', isolationConeDefinitions = IsoConeDefinitions ) muonIsolationMiniAODPUPPI = _mod.CITKPFIsolationSumProducerForPUPPI.clone( - srcToIsolate = cms.InputTag("slimmedMuons"), - srcForIsolationCone = cms.InputTag('packedPFCandidates'), - puppiValueMap = cms.InputTag(''), + srcToIsolate = "slimmedMuons", + srcForIsolationCone = 'packedPFCandidates', + puppiValueMap = '', isolationConeDefinitions = IsoConeDefinitions ) muonIsolationMiniAODPUPPINoLeptons = _mod.CITKPFIsolationSumProducerForPUPPI.clone( - srcToIsolate = cms.InputTag("slimmedMuons"), - srcForIsolationCone = cms.InputTag('packedPFCandidates'), - puppiValueMap = cms.InputTag(''), - usePUPPINoLepton = cms.bool(True), + srcToIsolate = "slimmedMuons", + srcForIsolationCone = 'packedPFCandidates', + puppiValueMap = '', + usePUPPINoLepton = True, isolationConeDefinitions = IsoConeDefinitions ) diff --git a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py index 3ad65c9c53971..f4c8a3ab20d5a 100644 --- a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py +++ b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py @@ -4,7 +4,6 @@ from RecoMuon.MuonSeedGenerator.MuonSeedPtScale_cfi import * import RecoMuon.MuonSeedGenerator.produceMuons_cfi as _mod -# module standAloneMuonSeeds = MuonSeedGenerator { ancientMuonSeed = _mod.produceMuons.clone( ptSeedParameterization, dphiScale, @@ -13,9 +12,6 @@ CSCRecSegmentLabel = cms.InputTag("cscSegments"), DTRecSegmentLabel = cms.InputTag("dt4DSegments"), ME0RecSegmentLabel = cms.InputTag("me0Segments"), - EnableDTMeasurement = cms.bool(True), - EnableCSCMeasurement = cms.bool(True), - EnableME0Measurement = cms.bool(False), # places where it's OK to have single-segment seeds crackEtas = cms.vdouble(0.2, 1.6, 1.7), crackWindow = cms.double(0.04), From 2e26ba4a08a70154e5bb324e3528e0be0e2ed888 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Wed, 28 Apr 2021 11:43:58 +0200 Subject: [PATCH 060/309] fix --- Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py index 001c036ddca6d..d6f2fd727959d 100644 --- a/Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py +++ b/Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py @@ -18,7 +18,7 @@ '24:onIfAny = 13 14', ), parameterSets = cms.vstring('pythia8CommonSettings', - 'pythia8CUEP8M1Settings', + 'pythia8CP5Settings', 'processParameters', ) ) From 632300909a62f7cd475367d2bdb38c57dddf9c01 Mon Sep 17 00:00:00 2001 From: Patrick Gartung <gartung@fnal.gov> Date: Wed, 28 Apr 2021 15:05:58 +0200 Subject: [PATCH 061/309] FWCore/Framework: Add cmsRunGP which links against Google perftools profiler library. --- FWCore/Framework/bin/BuildFile.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/FWCore/Framework/bin/BuildFile.xml b/FWCore/Framework/bin/BuildFile.xml index ddd3e9852e0a2..4dd924fbc4590 100644 --- a/FWCore/Framework/bin/BuildFile.xml +++ b/FWCore/Framework/bin/BuildFile.xml @@ -85,3 +85,18 @@ <use name="FWCore/ParameterSet"/> <use name="FWCore/PyDevParameterSet"/> </bin> + +<bin name="cmsRunGP" file="cmsRun.cpp"> + <use name="tbb"/> + <use name="boost"/> + <use name="boost_program_options"/> + <use name="jemalloc"/> + <use name="gperf"/> + <use name="FWCore/Framework"/> + <use name="FWCore/MessageLogger"/> + <use name="FWCore/PluginManager"/> + <use name="FWCore/ServiceRegistry"/> + <use name="FWCore/Utilities"/> + <use name="FWCore/ParameterSet"/> + <use name="FWCore/ParameterSetReader"/> +</bin> From a09f99ba36b7c52cbc33587e06243e4087e1f787 Mon Sep 17 00:00:00 2001 From: Patrick Gartung <gartung@fnal.gov> Date: Wed, 28 Apr 2021 16:39:37 +0200 Subject: [PATCH 062/309] Remove unneeded #include <cstring> --- FWCore/Framework/test/dependentrecord_t.cppunit.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/FWCore/Framework/test/dependentrecord_t.cppunit.cc b/FWCore/Framework/test/dependentrecord_t.cppunit.cc index 04f792a61ac2b..5f9576d186282 100644 --- a/FWCore/Framework/test/dependentrecord_t.cppunit.cc +++ b/FWCore/Framework/test/dependentrecord_t.cppunit.cc @@ -38,7 +38,6 @@ #include <memory> #include <string> #include <vector> -#include <cstring> using namespace edm::eventsetup; From 1435f32c0226f5de9fc16e8e425628bb52cbf6e3 Mon Sep 17 00:00:00 2001 From: Patrick Gartung <gartung@fnal.gov> Date: Wed, 28 Apr 2021 10:25:27 -0500 Subject: [PATCH 063/309] Update HLTrigger/Timer/plugins/FastTimerService.cc Co-authored-by: Andrea Bocci <andrea.bocci@cern.ch> --- HLTrigger/Timer/plugins/FastTimerService.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/HLTrigger/Timer/plugins/FastTimerService.cc b/HLTrigger/Timer/plugins/FastTimerService.cc index fc6e514b8e7e8..626fb774e0112 100644 --- a/HLTrigger/Timer/plugins/FastTimerService.cc +++ b/HLTrigger/Timer/plugins/FastTimerService.cc @@ -767,8 +767,7 @@ void FastTimerService::PlotsPerJob::fill_lumi(AtomicResources const& data, unsig /////////////////////////////////////////////////////////////////////////////// FastTimerService::FastTimerService(const edm::ParameterSet& config, edm::ActivityRegistry& registry) - : tbb::task_scheduler_observer(), - // configuration + : // configuration callgraph_(), // job configuration concurrent_lumis_(0), From b06f594a8753331576caf105d937641ac5be9823 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Wed, 28 Apr 2021 19:10:45 +0200 Subject: [PATCH 064/309] renaming --- ...u_14TeV_TuneCP5_cfi.py => WToLNu_14TeV_TuneCP5_pythia8_cfi.py} | 0 ..._14TeV_TuneCP5_cfi.py => WToMuNu_14TeV_TuneCP5_pythia8_cfi.py} | 0 ...eCP5_cfi.py => WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename Configuration/Generator/python/{WToLNu_14TeV_TuneCP5_cfi.py => WToLNu_14TeV_TuneCP5_pythia8_cfi.py} (100%) rename Configuration/Generator/python/{WM_14TeV_TuneCP5_cfi.py => WToMuNu_14TeV_TuneCP5_pythia8_cfi.py} (100%) rename Configuration/Generator/python/{WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py => WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py} (100%) diff --git a/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py similarity index 100% rename from Configuration/Generator/python/WToLNu_14TeV_TuneCP5_cfi.py rename to Configuration/Generator/python/WToLNu_14TeV_TuneCP5_pythia8_cfi.py diff --git a/Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py similarity index 100% rename from Configuration/Generator/python/WM_14TeV_TuneCP5_cfi.py rename to Configuration/Generator/python/WToMuNu_14TeV_TuneCP5_pythia8_cfi.py diff --git a/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py b/Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py similarity index 100% rename from Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_cfi.py rename to Configuration/Generator/python/WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi.py From 27ca903ef4715e14cb04573b6d96df64d308dcde Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Wed, 28 Apr 2021 14:24:21 -0500 Subject: [PATCH 065/309] EMTF and uGMT shower triggers --- DataFormats/CSCDigi/interface/CSCConstants.h | 6 + .../python/L1Trigger_EventContent_cff.py | 10 ++ .../L1TMuon/plugins/L1TMuonShowerProducer.cc | 112 +++++++++++++++++ L1Trigger/L1TMuon/python/simDigis_cff.py | 1 + .../L1TMuon/python/simGmtStage2Digis_cfi.py | 4 + .../interface/SectorProcessorShower.h | 41 +++++++ .../plugins/L1TMuonEndCapShowerProducer.cc | 54 +++++++++ .../plugins/L1TMuonEndCapShowerProducer.h | 41 +++++++ .../python/simEmtfShowers_cfi.py | 9 ++ .../src/SectorProcessorShower.cc | 113 ++++++++++++++++++ 10 files changed, 391 insertions(+) create mode 100644 L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc create mode 100644 L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h create mode 100644 L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc create mode 100644 L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h create mode 100644 L1Trigger/L1TMuonEndCap/python/simEmtfShowers_cfi.py create mode 100644 L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc diff --git a/DataFormats/CSCDigi/interface/CSCConstants.h b/DataFormats/CSCDigi/interface/CSCConstants.h index 58160a61896c8..ae4711879a6ee 100644 --- a/DataFormats/CSCDigi/interface/CSCConstants.h +++ b/DataFormats/CSCDigi/interface/CSCConstants.h @@ -109,6 +109,12 @@ class CSCConstants { MAX_LCTS_PER_CSC = 2, // An MPC receives up to 18 LCTs from 9 CSCs in the trigger sector MAX_LCTS_PER_MPC = 18, + /* + An EMTF sector processor receives LCTs from 5 MPCS + or 45 chambers when not considering overlapping EMTF SPs + 18 CSCs in ME1; 9 x 3 CSCs in ME2,3,4 + */ + MAX_CSCS_PER_EMTF_SP_NO_OVERLAP = 45, // Reference BX for LCTs in simulation and firmware LCT_CENTRAL_BX = 8, /* diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 9556312d0d146..7925f99205179 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -115,6 +115,16 @@ def _appendStage2Digis(obj): stage2L1Trigger.toModify(L1TriggerAOD, func=_appendStage2Digis) stage2L1Trigger.toModify(L1TriggerFEVTDEBUG, func=_appendStage2Digis) +## Run-3 EMTF and GMT showers +def _appendRun3ShowerDigis(obj): + run3ShowerDigis = [ + "keep *_simEmtfShowers_*_*", + 'keep *_simGmtShowerDigis_*_*', + ] + obj.outputCommands += run3ShowerDigis +stage2L1Trigger.toModify(L1TriggerFEVTDEBUG, func=_appendRun3ShowerDigis) + + # adding HGCal L1 trigger digis def _appendHGCalDigis(obj): l1HGCalDigis = [ diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc new file mode 100644 index 0000000000000..d47251b1c748f --- /dev/null +++ b/L1Trigger/L1TMuon/plugins/L1TMuonShowerProducer.cc @@ -0,0 +1,112 @@ +// system include files +#include <memory> +#include <fstream> + +// user include files +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" +#include "DataFormats/L1Trigger/interface/MuonShower.h" + +using namespace l1t; + +class L1TMuonShowerProducer : public edm::stream::EDProducer<> { +public: + explicit L1TMuonShowerProducer(const edm::ParameterSet&); + ~L1TMuonShowerProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + edm::InputTag showerInputTag_; + edm::EDGetTokenT<l1t::RegionalMuonShowerBxCollection> showerInputToken_; + int bxMin_; + int bxMax_; + unsigned minNominalShowers_; + unsigned minTwoLooseShowers_; +}; + +L1TMuonShowerProducer::L1TMuonShowerProducer(const edm::ParameterSet& iConfig) + : showerInputTag_(iConfig.getParameter<edm::InputTag>("showerInput")), + showerInputToken_(consumes<l1t::RegionalMuonShowerBxCollection>(showerInputTag_)), + bxMin_(iConfig.getParameter<int>("bxMin")), + bxMax_(iConfig.getParameter<int>("bxMax")), + minNominalShowers_(iConfig.getParameter<unsigned>("minNominalShowers")), + minTwoLooseShowers_(iConfig.getParameter<unsigned>("minTwoLooseShowers")) { + produces<MuonShowerBxCollection>(); +} + +L1TMuonShowerProducer::~L1TMuonShowerProducer() {} + +// ------------ method called to produce the data ------------ +void L1TMuonShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + std::unique_ptr<MuonShowerBxCollection> outShowers(new MuonShowerBxCollection()); + + Handle<l1t::RegionalMuonShowerBxCollection> emtfShowers; + iEvent.getByToken(showerInputToken_, emtfShowers); + outShowers->setBXRange(bxMin_, bxMax_); + + /* + Check each sector for a valid EMTF shower. A valid EMTF shower + can either be in-time or out-of-time. The minimal implementation + only considers the "at least 1-nominal shower" case. + */ + unsigned nNominalInTime = 0; + unsigned nNominalOutOfTime = 0; + unsigned nTwoLooseInTime = 0; + unsigned nTwoLooseOutOfTime = 0; + for (size_t i = 0; i < emtfShowers->size(0); ++i) { + auto shower = emtfShowers->at(0, i); + if (shower.isValid()) { + // nominal + if (shower.isOneNominalInTime()) + nNominalInTime++; + if (shower.isOneNominalOutOfTime()) + nNominalOutOfTime++; + // two loose + if (shower.isTwoLooseInTime()) + nTwoLooseInTime++; + if (shower.isTwoLooseOutOfTime()) + nTwoLooseOutOfTime++; + } + } + + const bool isOneNominalInTime(nNominalInTime >= minNominalShowers_); + const bool isOneNominalOutOfTime(nNominalOutOfTime >= minNominalShowers_); + const bool isTwoLooseInTime(nTwoLooseInTime >= minTwoLooseShowers_); + const bool isTwoLooseOutOfTime(nTwoLooseOutOfTime >= minTwoLooseShowers_); + + // Check for at least one nominal shower + const bool acceptCondition(isOneNominalInTime or isOneNominalOutOfTime or isTwoLooseInTime or isTwoLooseOutOfTime); + if (acceptCondition) { + MuonShower outShower(isOneNominalInTime, isOneNominalOutOfTime, isTwoLooseInTime, isTwoLooseOutOfTime); + outShowers->push_back(0, outShower); + } + iEvent.put(std::move(outShowers)); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void L1TMuonShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add<edm::InputTag>("showerInput", edm::InputTag("simEmtfShowers", "EMTF")); + desc.add<int32_t>("bxMin", 0); + desc.add<int32_t>("bxMax", 0); + desc.add<uint32_t>("minNominalShowers", 1); + desc.add<uint32_t>("minTwoLooseShowers", 0); + descriptions.add("simGmtShowerDigisDef", desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TMuonShowerProducer); diff --git a/L1Trigger/L1TMuon/python/simDigis_cff.py b/L1Trigger/L1TMuon/python/simDigis_cff.py index d52e32d4d41ea..449f97b61965e 100644 --- a/L1Trigger/L1TMuon/python/simDigis_cff.py +++ b/L1Trigger/L1TMuon/python/simDigis_cff.py @@ -77,6 +77,7 @@ from L1Trigger.L1TMuonBarrel.simKBmtfStubs_cfi import * from L1Trigger.L1TMuonBarrel.simKBmtfDigis_cfi import * from L1Trigger.L1TMuonEndCap.simEmtfDigis_cfi import * +from L1Trigger.L1TMuonEndCap.simEmtfShowers_cfi import * from L1Trigger.L1TMuonOverlap.simOmtfDigis_cfi import * from L1Trigger.L1TMuon.simGmtCaloSumDigis_cfi import * from L1Trigger.L1TMuon.simGmtStage2Digis_cfi import * diff --git a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py index 25385e675f480..e0daa3580ffd4 100644 --- a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py +++ b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py @@ -20,6 +20,10 @@ emtfCancelMode = cms.string("coordinate") # 'tracks' or 'coordinate' ) +# Muon shower trigger +from L1Trigger.L1TMuon.simGmtShowerDigisDef_cfi import simGmtShowerDigisDef +simGmtShowerDigis = simGmtShowerDigisDef.clone() + from CondCore.CondDB.CondDB_cfi import CondDB CondDB.connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") l1ugmtdb = cms.ESSource("PoolDBESSource", diff --git a/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h new file mode 100644 index 0000000000000..b5c76daedf305 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h @@ -0,0 +1,41 @@ +#ifndef L1Trigger_L1TMuonEndCap_SectorProcessorShower_h +#define L1Trigger_L1TMuonEndCap_SectorProcessorShower_h + +/* + This class executes the trigger logic for the EMTF shower trigger. + In the basic mode, the EMTF shower sector processor will find any valid + CSC shower and send a trigger to the uGMT. In a possible extension, the + EMTF shower sector processor can also trigger on two loose showers - to + enhance the sensitivity to long-lived particles that produce multiple + smaller showers, instead of a single large shower. + */ + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/L1TMuon/interface/RegionalMuonShower.h" +#include "DataFormats/CSCDigi/interface/CSCShowerDigiCollection.h" +#include "L1Trigger/L1TMuonEndCap/interface/Common.h" + +#include <vector> + +class SectorProcessorShower { +public: + explicit SectorProcessorShower() {} + ~SectorProcessorShower() {} + + void configure(const edm::ParameterSet&, int endcap, int sector); + + void process(const CSCShowerDigiCollection& showers, l1t::RegionalMuonShowerBxCollection& out_showers) const; + +private: + int select_shower(const CSCDetId&, const CSCShowerDigi&) const; + int get_index_shower(int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const; + bool is_in_sector_csc(int tp_endcap, int tp_sector) const; + + int verbose_, endcap_, sector_; + bool enableOneNominalShower_; + bool enableTwoLooseShowers_; + unsigned nNominalShowers_; + unsigned nLooseShowers_; +}; + +#endif diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc new file mode 100644 index 0000000000000..63f987a3e8d1b --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc @@ -0,0 +1,54 @@ +#include "L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h" +#include "L1Trigger/L1TMuonEndCap/interface/Common.h" + +L1TMuonEndCapShowerProducer::L1TMuonEndCapShowerProducer(const edm::ParameterSet& iConfig) + : config_(iConfig), + tokenCSCShower_(consumes<CSCShowerDigiCollection>(iConfig.getParameter<edm::InputTag>("CSCShowerInput"))), + sector_processors_shower_() { + // Make output products + produces<l1t::RegionalMuonShowerBxCollection>("EMTF"); +} + +L1TMuonEndCapShowerProducer::~L1TMuonEndCapShowerProducer() {} + +void L1TMuonEndCapShowerProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // Create pointers to output products + auto out_showers = std::make_unique<l1t::RegionalMuonShowerBxCollection>(); + out_showers->clear(); + out_showers->setBXRange(0, 0); + + edm::Handle<CSCShowerDigiCollection> showersH; + iEvent.getByToken(tokenCSCShower_, showersH); + const CSCShowerDigiCollection& showers = *showersH.product(); + + // ___________________________________________________________________________ + // Run the sector processors + + for (int endcap = emtf::MIN_ENDCAP; endcap <= emtf::MAX_ENDCAP; ++endcap) { + for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) { + const int es = (endcap - emtf::MIN_ENDCAP) * (emtf::MAX_TRIGSECTOR - emtf::MIN_TRIGSECTOR + 1) + + (sector - emtf::MIN_TRIGSECTOR); + + sector_processors_shower_.at(es).configure(config_, endcap, sector); + sector_processors_shower_.at(es).process(showers, *out_showers); + } + } + + // Fill the output products + iEvent.put(std::move(out_showers), "EMTF"); +} + +void L1TMuonEndCapShowerProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + // these are different shower selections that can be enabled + desc.add<bool>("enableOneNominalShowers", true); + desc.add<bool>("enableTwoLooseShowers", false); + desc.add<unsigned>("nLooseShowers", 2); + desc.add<unsigned>("nNominalShowers", 1); + desc.add<edm::InputTag>("CSCShowerInput", edm::InputTag("simCscTriggerPrimitiveDigis")); + descriptions.add("simEmtfShowersDef", desc); + descriptions.setComment("This is the generic cfi file for the EMTF shower producer"); +} + +// Define this as a plug-in +DEFINE_FWK_MODULE(L1TMuonEndCapShowerProducer); diff --git a/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h new file mode 100644 index 0000000000000..722750baaca47 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h @@ -0,0 +1,41 @@ +#ifndef L1Trigger_L1TMuonEndCap_L1TMuonEndCapShowerProducer_h +#define L1Trigger_L1TMuonEndCap_L1TMuonEndCapShowerProducer_h + +/* + This EDProducer produces EMTF showers from showers in the CSC local trigger. + These showers could indicate the passage of a long-lived particle decaying + in the endcap muon system. + + The logic is executed in the SectorProcessorShower class. Multiple options + are defined: "OneNominal", "TwoLoose" + */ + +// system include files +#include <memory> + +// user include files +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h" + +// Class declaration +class L1TMuonEndCapShowerProducer : public edm::stream::EDProducer<> { +public: + explicit L1TMuonEndCapShowerProducer(const edm::ParameterSet&); + ~L1TMuonEndCapShowerProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + const edm::ParameterSet& config_; + edm::EDGetToken tokenCSCShower_; + emtf::sector_array<SectorProcessorShower> sector_processors_shower_; +}; + +#endif diff --git a/L1Trigger/L1TMuonEndCap/python/simEmtfShowers_cfi.py b/L1Trigger/L1TMuonEndCap/python/simEmtfShowers_cfi.py new file mode 100644 index 0000000000000..836e5c6c50203 --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/python/simEmtfShowers_cfi.py @@ -0,0 +1,9 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.L1TMuonEndCap.simEmtfShowersDef_cfi import simEmtfShowersDef + +## producer for simulation +simEmtfShowers = simEmtfShowersDef.clone() + +## producer for re-emulation on unpacked CSC shower data +simEmtfShowersData = simEmtfShowers.clone() diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc new file mode 100644 index 0000000000000..dd855674fa8fa --- /dev/null +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessorShower.cc @@ -0,0 +1,113 @@ +#include "L1Trigger/L1TMuonEndCap/interface/SectorProcessorShower.h" +#include "DataFormats/CSCDigi/interface/CSCConstants.h" + +void SectorProcessorShower::configure(const edm::ParameterSet& pset, int endcap, int sector) { + emtf_assert(emtf::MIN_ENDCAP <= endcap && endcap <= emtf::MAX_ENDCAP); + emtf_assert(emtf::MIN_TRIGSECTOR <= sector && sector <= emtf::MAX_TRIGSECTOR); + + endcap_ = endcap; + sector_ = sector; + + enableTwoLooseShowers_ = pset.getParameter<bool>("enableTwoLooseShowers"); + enableOneNominalShower_ = pset.getParameter<bool>("enableOneNominalShowers"); + nLooseShowers_ = pset.getParameter<unsigned>("nLooseShowers"); + nNominalShowers_ = pset.getParameter<unsigned>("nNominalShowers"); +} + +void SectorProcessorShower::process(const CSCShowerDigiCollection& in_showers, + l1t::RegionalMuonShowerBxCollection& out_showers) const { + // reset + std::vector<CSCShowerDigi> selected_showers; + + // shower selection + auto chamber = in_showers.begin(); + auto chend = in_showers.end(); + for (; chamber != chend; ++chamber) { + auto digi = (*chamber).second.first; + auto dend = (*chamber).second.second; + for (; digi != dend; ++digi) { + // Returns CSC "link" index (0 - 45) + int selected_shower = select_shower((*chamber).first, *digi); + + // index is valid + if (selected_shower >= 0) { + // 18 in ME1; 9x3 in ME2,3,4 + emtf_assert(selected_shower < CSCConstants::MAX_CSCS_PER_EMTF_SP_NO_OVERLAP); + + // shower is valid + if (digi->isValid()) { + selected_showers.emplace_back(*digi); + } + } + } + } + + // Shower recognition logic: at least one nominal shower (see DN-20-033, section 5.2) + const unsigned nLooseInTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isLooseInTime(); })); + const unsigned nNominalInTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalInTime(); })); + const unsigned nLooseOutOfTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isLooseOutTime(); })); + const unsigned nNominalOutOfTime(std::count_if( + selected_showers.begin(), selected_showers.end(), [](CSCShowerDigi p) { return p.isNominalOutTime(); })); + + const bool hasTwoLooseInTime(nLooseInTime >= nLooseShowers_); + const bool hasOneNominalInTime(nNominalInTime >= nNominalShowers_); + const bool hasTwoLooseOutOfTime(nLooseOutOfTime >= nLooseShowers_); + const bool hasOneNominalOutOfTime(nNominalOutOfTime >= nNominalShowers_); + + const bool acceptLoose(enableTwoLooseShowers_ and (hasTwoLooseInTime or hasTwoLooseOutOfTime)); + const bool acceptNominal(enableOneNominalShower_ and (hasOneNominalInTime or hasOneNominalOutOfTime)); + // trigger condition + const bool accept(acceptLoose or acceptNominal); + + if (accept) { + // shower output + l1t::RegionalMuonShower out_shower( + hasOneNominalInTime, hasOneNominalOutOfTime, hasTwoLooseInTime, hasTwoLooseOutOfTime); + out_shower.setEndcap(endcap_); + out_shower.setSector(sector_); + out_showers.push_back(0, out_shower); + } +} + +// shower selection +int SectorProcessorShower::select_shower(const CSCDetId& tp_detId, const CSCShowerDigi& shower) const { + int selected = -1; + + int tp_endcap = tp_detId.endcap(); + int tp_sector = tp_detId.triggerSector(); + int tp_station = tp_detId.station(); + int tp_chamber = tp_detId.chamber(); + int tp_csc_ID = shower.getCSCID(); + + // station 1 --> subsector 1 or 2 + // station 2,3,4 --> subsector 0 + int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2); + + // Check if the chamber belongs to this sector processor at this BX. + selected = get_index_shower(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID); + return selected; +} + +int SectorProcessorShower::get_index_shower( + int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const { + int selected = -1; + + // shower trigger does not considers overlaps + if (is_in_sector_csc(tp_endcap, tp_sector)) { + if (tp_station == 1) { // ME1: 0 - 8, 9 - 17 + selected = (tp_subsector - 1) * 9 + (tp_csc_ID - 1); + } else { // ME2,3,4: 18 - 26, 27 - 35, 36 - 44 + selected = (tp_station)*9 + (tp_csc_ID - 1); + } + } + + emtf_assert(selected != -1); + return selected; +} + +bool SectorProcessorShower::is_in_sector_csc(int tp_endcap, int tp_sector) const { + return ((endcap_ == tp_endcap) && (sector_ == tp_sector)); +} From a8a14833773a15a9574a353108c12dabc6495e19 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Wed, 28 Apr 2021 14:53:29 -0500 Subject: [PATCH 066/309] Specify keep command to only run-3 eras --- L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 7925f99205179..4859ff3b4ef0b 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -122,8 +122,9 @@ def _appendRun3ShowerDigis(obj): 'keep *_simGmtShowerDigis_*_*', ] obj.outputCommands += run3ShowerDigis -stage2L1Trigger.toModify(L1TriggerFEVTDEBUG, func=_appendRun3ShowerDigis) +from Configuration.Eras.Modifier_run3_common_cff import run3_common +(stage2L1Trigger & run3_common).toModify(L1TriggerFEVTDEBUG, func=_appendRun3ShowerDigis) # adding HGCal L1 trigger digis def _appendHGCalDigis(obj): From 023311bc6634b0e035d4ed1e26fdcb976a4f8bf7 Mon Sep 17 00:00:00 2001 From: Thomas Reis <thomas.reis@cern.ch> Date: Wed, 28 Apr 2021 23:06:04 +0200 Subject: [PATCH 067/309] Remove begin() from EcalCondObjectContainer class. --- .../plugins/EcalTPGParamBuilder.cc | 47 +++++++++++++++---- .../interface/EcalCondObjectContainer.h | 2 - .../src/EcalIntercalibConstantsGPU.cc | 3 +- .../src/EcalLaserAPDPNRatiosRefGPU.cc | 3 +- .../EcalObjects/src/EcalLaserAlphasGPU.cc | 3 +- 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc index 789682fb420e5..de79927352a08 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc @@ -577,10 +577,16 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup.get<EcalPedestalsRcd>().get(pedHandle); pedMap = pedHandle.product()->getMap(); + const auto& pedMapEB = pedMap.barrelItems(); + const auto& pedMapEE = pedMap.endcapItems(); EcalPedestalsMapIterator pedIter; int nPed = 0; - for (pedIter = pedMap.begin(); pedIter != pedMap.end() && nPed < 10; ++pedIter, nPed++) { - EcalPedestals::Item aped = (*pedIter); + for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); + ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; + } + for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; } } else if (m_write_ped == 0) { @@ -653,10 +659,16 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedMap = peds.getMap(); + const auto& pedMapEB = pedMap.barrelItems(); + const auto& pedMapEE = pedMap.endcapItems(); EcalPedestalsMapIterator pedIter; int nPed = 0; - for (pedIter = pedMap.begin(); pedIter != pedMap.end() && nPed < 10; ++pedIter, nPed++) { - EcalPedestals::Item aped = (*pedIter); + for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); + ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; + } + for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; } @@ -721,10 +733,16 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& pedMap = peds.getMap(); + const auto& pedMapEB = pedMap.barrelItems(); + const auto& pedMapEE = pedMap.endcapItems(); EcalPedestalsMapIterator pedIter; int nPed = 0; - for (pedIter = pedMap.begin(); pedIter != pedMap.end() && nPed < 10; ++pedIter, nPed++) { - EcalPedestals::Item aped = (*pedIter); + for (pedIter = pedMapEB.begin(); pedIter != pedMapEB.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); + ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; + } + for (pedIter = pedMapEE.begin(); pedIter != pedMapEE.end() && nPed < 10; ++pedIter, ++nPed) { + const auto aped = (*pedIter); ss << aped.mean_x12 << ", " << aped.mean_x6 << ", " << aped.mean_x1 << "\n"; } } @@ -738,9 +756,14 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup.get<EcalIntercalibConstantsRcd>().get(pIntercalib); const EcalIntercalibConstants* intercalib = pIntercalib.product(); const EcalIntercalibConstantMap& calibMap = intercalib->getMap(); + const auto& calibMapEB = calibMap.barrelItems(); + const auto& calibMapEE = calibMap.endcapItems(); EcalIntercalibConstantMap::const_iterator calIter; int nCal = 0; - for (calIter = calibMap.begin(); calIter != calibMap.end() && nCal < 10; ++calIter, nCal++) { + for (calIter = calibMapEB.begin(); calIter != calibMapEB.end() && nCal < 10; ++calIter, ++nCal) { + ss << (*calIter) << "\n"; + } + for (calIter = calibMapEE.begin(); calIter != calibMapEE.end() && nCal < 10; ++calIter, ++nCal) { ss << (*calIter) << "\n"; } edm::LogInfo("TopInfo") << ss.str(); @@ -770,10 +793,16 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& ESHandle<EcalGainRatios> pRatio; evtSetup.get<EcalGainRatiosRcd>().get(pRatio); const EcalGainRatioMap& gainMap = pRatio.product()->getMap(); + const auto& gainMapEB = gainMap.barrelItems(); + const auto& gainMapEE = gainMap.endcapItems(); EcalGainRatioMap::const_iterator gainIter; int nGain = 0; - for (gainIter = gainMap.begin(); gainIter != gainMap.end() && nGain < 10; ++gainIter, nGain++) { - const EcalMGPAGainRatio& aGain = (*gainIter); + for (gainIter = gainMapEB.begin(); gainIter != gainMapEB.end() && nGain < 10; ++gainIter, ++nGain) { + const auto aGain = (*gainIter); + ss << aGain.gain12Over6() << ", " << aGain.gain6Over1() * aGain.gain12Over6() << "\n"; + } + for (gainIter = gainMapEE.begin(); gainIter != gainMapEE.end() && nGain < 10; ++gainIter, ++nGain) { + const auto aGain = (*gainIter); ss << aGain.gain12Over6() << ", " << aGain.gain6Over1() * aGain.gain12Over6() << "\n"; } edm::LogInfo("TopInfo") << ss.str(); diff --git a/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h b/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h index e6556c5ab8962..1466cca86783b 100644 --- a/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h +++ b/CondFormats/EcalObjects/interface/EcalCondObjectContainer.h @@ -71,8 +71,6 @@ class EcalCondObjectContainer { return ee_.end(); } - inline const_iterator begin() const { return eb_.begin(); } - inline const_iterator end() const { return ee_.end(); } inline void setValue(const uint32_t id, const Item &item) { (*this)[id] = item; } diff --git a/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc b/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc index c1e462a8c5a75..d85b1e1eb7420 100644 --- a/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc +++ b/CondFormats/EcalObjects/src/EcalIntercalibConstantsGPU.cc @@ -5,7 +5,8 @@ EcalIntercalibConstantsGPU::EcalIntercalibConstantsGPU(EcalIntercalibConstants const& values) { values_.reserve(values.size()); - std::copy(values.begin(), values.end(), values_.begin()); + values_.insert(values_.end(), values.barrelItems().begin(), values.barrelItems().end()); + values_.insert(values_.end(), values.endcapItems().begin(), values.endcapItems().end()); offset_ = values.barrelItems().size(); } diff --git a/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc b/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc index ed06c6591597d..7cc7117ba48de 100644 --- a/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc +++ b/CondFormats/EcalObjects/src/EcalLaserAPDPNRatiosRefGPU.cc @@ -5,7 +5,8 @@ EcalLaserAPDPNRatiosRefGPU::EcalLaserAPDPNRatiosRefGPU(EcalLaserAPDPNRatiosRef const& values) { values_.reserve(values.size()); - std::copy(values.begin(), values.end(), values_.begin()); + values_.insert(values_.end(), values.barrelItems().begin(), values.barrelItems().end()); + values_.insert(values_.end(), values.endcapItems().begin(), values.endcapItems().end()); offset_ = values.barrelItems().size(); } diff --git a/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc b/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc index b16742f4964c8..538c0438829bc 100644 --- a/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc +++ b/CondFormats/EcalObjects/src/EcalLaserAlphasGPU.cc @@ -5,7 +5,8 @@ EcalLaserAlphasGPU::EcalLaserAlphasGPU(EcalLaserAlphas const& values) { values_.reserve(values.size()); - std::copy(values.begin(), values.end(), values_.begin()); + values_.insert(values_.end(), values.barrelItems().begin(), values.barrelItems().end()); + values_.insert(values_.end(), values.endcapItems().begin(), values.endcapItems().end()); offset_ = values.barrelItems().size(); } From f0842b8e259d90e57cdf4f4eafee293db4e448af Mon Sep 17 00:00:00 2001 From: Thomas Reis <thomas.reis@cern.ch> Date: Thu, 29 Apr 2021 01:23:40 +0200 Subject: [PATCH 068/309] Make EcalTPGParamBuilder a one module and move to esConsumes. --- .../plugins/EcalTPGParamBuilder.cc | 67 +++++++------------ .../plugins/EcalTPGParamBuilder.h | 40 ++++++++--- 2 files changed, 56 insertions(+), 51 deletions(-) diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc index de79927352a08..a71e02e4214d1 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.cc @@ -1,25 +1,13 @@ #include "EcalTPGParamBuilder.h" #include "EcalTPGDBApp.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" -#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "DataFormats/EcalDetId/interface/EBDetId.h" #include "DataFormats/EcalDetId/interface/EEDetId.h" -#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" -#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" #include "CondFormats/EcalObjects/interface/EcalMGPAGainRatio.h" -#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" -#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" -#include "CondFormats/EcalObjects/interface/EcalTPGPedestals.h" -#include "CondFormats/DataRecord/interface/EcalTPGPedestalsRcd.h" //modif-alex-27-july-2015 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h" @@ -51,7 +39,21 @@ double oneOverEtResolEt(double* x, double* par) { } EcalTPGParamBuilder::EcalTPGParamBuilder(edm::ParameterSet const& pSet) - : xtal_LSB_EB_(0), xtal_LSB_EE_(0), nSample_(5), complement2_(7), useDBShape_(true) { + : theEndcapGeometryToken_(esConsumes(edm::ESInputTag("", "EcalEndcap"))), + theBarrelGeometryToken_(esConsumes(edm::ESInputTag("", "EcalBarrel"))), + eTTmapToken_(esConsumes()), + ecalmappingToken_(esConsumes()), + ecalLaserAlphasToken_(esConsumes()), + ecalLaserAPDPNRatiosToken_(esConsumes()), + ecalPedestalsToken_(esConsumes()), + ecalIntercalibConstantsToken_(esConsumes()), + ecalGainRatiosToken_(esConsumes()), + ecalADCToGeVConstantToken_(esConsumes()), + xtal_LSB_EB_(0), + xtal_LSB_EE_(0), + nSample_(5), + complement2_(7), + useDBShape_(true) { ped_conf_id_ = 0; lin_conf_id_ = 0; lut_conf_id_ = 0; @@ -392,27 +394,18 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& using namespace std; // geometry - ESHandle<CaloGeometry> theGeometry; - ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle; - evtSetup.get<CaloGeometryRecord>().get(theGeometry); - evtSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap", theEndcapGeometry_handle); - evtSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel", theBarrelGeometry_handle); - evtSetup.get<IdealGeometryRecord>().get(eTTmap_); - theEndcapGeometry_ = theEndcapGeometry_handle.product(); - theBarrelGeometry_ = theBarrelGeometry_handle.product(); + eTTmap_ = &evtSetup.getData(eTTmapToken_); + theEndcapGeometry_ = &evtSetup.getData(theEndcapGeometryToken_); + theBarrelGeometry_ = &evtSetup.getData(theBarrelGeometryToken_); // electronics mapping - ESHandle<EcalElectronicsMapping> ecalmapping; - evtSetup.get<EcalMappingRcd>().get(ecalmapping); - theMapping_ = ecalmapping.product(); + theMapping_ = &evtSetup.getData(ecalmappingToken_); // get record for alpha std::ostringstream ss; ss << "EcalLaserDbAnalyzer::analyze\n"; - edm::ESHandle<EcalLaserAlphas> handle; - evtSetup.get<EcalLaserAlphasRcd>().get(handle); + const EcalLaserAlphaMap& laserAlphaMap = evtSetup.getData(ecalLaserAlphasToken_).getMap(); // map of apdpns ss << "EcalLaserDbAnalyzer::analyze-> got EcalLaserDbRecord: \n"; - const EcalLaserAlphaMap& laserAlphaMap = handle.product()->getMap(); // map of apdpns //modif-alex-27-july-2015-+ Jean june 2016 beg // use alpha to check @@ -482,9 +475,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& edm::LogInfo("TopInfo") << "INFO: READING transparency correction tag" << "\n"; // std::cout << "new feature, read a tag" << std::endl; - ESHandle<EcalLaserAPDPNRatios> pAPDPNRatios; - evtSetup.get<EcalLaserAPDPNRatiosRcd>().get(pAPDPNRatios); - const EcalLaserAPDPNRatios* lratio = pAPDPNRatios.product(); + const EcalLaserAPDPNRatios* lratio = &evtSetup.getData(ecalLaserAPDPNRatiosToken_); // std::cout << " laser map size " << lratio->getLaserMap().size() << std::endl; EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap::const_iterator itratio; @@ -573,9 +564,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& if (m_write_ped == 1) { ss << "Getting the pedestals from offline DB...\n"; - ESHandle<EcalPedestals> pedHandle; - evtSetup.get<EcalPedestalsRcd>().get(pedHandle); - pedMap = pedHandle.product()->getMap(); + pedMap = evtSetup.getData(ecalPedestalsToken_).getMap(); const auto& pedMapEB = pedMap.barrelItems(); const auto& pedMapEE = pedMap.endcapItems(); @@ -752,9 +741,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // Intercalib constants ss << "Getting intercalib from offline DB...\n"; - ESHandle<EcalIntercalibConstants> pIntercalib; - evtSetup.get<EcalIntercalibConstantsRcd>().get(pIntercalib); - const EcalIntercalibConstants* intercalib = pIntercalib.product(); + const EcalIntercalibConstants* intercalib = &evtSetup.getData(ecalIntercalibConstantsToken_); const EcalIntercalibConstantMap& calibMap = intercalib->getMap(); const auto& calibMapEB = calibMap.barrelItems(); const auto& calibMapEE = calibMap.endcapItems(); @@ -790,9 +777,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // Gain Ratios ss << "Getting the gain ratios from offline DB...\n"; - ESHandle<EcalGainRatios> pRatio; - evtSetup.get<EcalGainRatiosRcd>().get(pRatio); - const EcalGainRatioMap& gainMap = pRatio.product()->getMap(); + const EcalGainRatioMap& gainMap = evtSetup.getData(ecalGainRatiosToken_).getMap(); const auto& gainMapEB = gainMap.barrelItems(); const auto& gainMapEE = gainMap.endcapItems(); EcalGainRatioMap::const_iterator gainIter; @@ -810,9 +795,7 @@ void EcalTPGParamBuilder::analyze(const edm::Event& evt, const edm::EventSetup& // ADCtoGeV ss << "Getting the ADC to GeV from offline DB...\n"; - ESHandle<EcalADCToGeVConstant> pADCToGeV; - evtSetup.get<EcalADCToGeVConstantRcd>().get(pADCToGeV); - const EcalADCToGeVConstant* ADCToGeV = pADCToGeV.product(); + const EcalADCToGeVConstant* ADCToGeV = &evtSetup.getData(ecalADCToGeVConstantToken_); xtal_LSB_EB_ = ADCToGeV->getEBValue(); xtal_LSB_EE_ = ADCToGeV->getEEValue(); ss << "xtal_LSB_EB_ = " << xtal_LSB_EB_ << "\n"; diff --git a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h index 434a8aa982799..0484a330031f5 100644 --- a/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h +++ b/CalibCalorimetry/EcalTPGTools/plugins/EcalTPGParamBuilder.h @@ -1,5 +1,5 @@ -#ifndef ECALTPGPARAMBUILDER_H -#define ECALTPGPARAMBUILDER_H +#ifndef CalibCalorimetry_EcalTPGTools_EcalTPGParamBuilder_h +#define CalibCalorimetry_EcalTPGTools_EcalTPGParamBuilder_h //Author: Pascal Paganini - LLR //Date: 2006/07/10 15:58:06 $ @@ -9,17 +9,30 @@ // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/Framework/interface/ESHandle.h" +#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h" - +#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h" +#include "Geometry/EcalMapping/interface/EcalMappingRcd.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + +#include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h" +#include "CondFormats/DataRecord/interface/EcalIntercalibConstantsRcd.h" +#include "CondFormats/DataRecord/interface/EcalGainRatiosRcd.h" +#include "CondFormats/DataRecord/interface/EcalLaserAlphasRcd.h" +#include "CondFormats/DataRecord/interface/EcalLaserAPDPNRatiosRcd.h" +#include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h" +#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h" #include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h" #include "CondFormats/EcalObjects/interface/EcalGainRatios.h" +#include "CondFormats/EcalObjects/interface/EcalLaserAPDPNRatios.h" #include "CondFormats/EcalObjects/interface/EcalPedestals.h" #include "OnlineDB/EcalCondDB/interface/all_monitoring_types.h" #include "OnlineDB/EcalCondDB/interface/all_fe_config_types.h" @@ -36,8 +49,6 @@ #include <map> #include <iostream> -class CaloSubdetectorGeometry; -class EcalElectronicsMapping; class EcalTPGDBApp; class coeffStruc { @@ -56,15 +67,15 @@ class linStruc { int shift_[3]; }; -class EcalTPGParamBuilder : public edm::EDAnalyzer { +class EcalTPGParamBuilder : public edm::one::EDAnalyzer<> { public: explicit EcalTPGParamBuilder(edm::ParameterSet const& pSet); ~EcalTPGParamBuilder() override; void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override; void beginJob() override; - bool checkIfOK(EcalPedestals::Item item); private: + bool checkIfOK(EcalPedestals::Item item); bool computeLinearizerParam( double theta, double gainRatio, double calibCoeff, std::string subdet, int& mult, int& shift); void create_header(); @@ -93,11 +104,22 @@ class EcalTPGParamBuilder : public edm::EDAnalyzer { std::string getDet(int tcc); std::pair<std::string, int> getCrate(int tcc); + edm::ESGetToken<CaloSubdetectorGeometry, EcalEndcapGeometryRecord> theEndcapGeometryToken_; + edm::ESGetToken<CaloSubdetectorGeometry, EcalBarrelGeometryRecord> theBarrelGeometryToken_; const CaloSubdetectorGeometry* theEndcapGeometry_; const CaloSubdetectorGeometry* theBarrelGeometry_; - edm::ESHandle<EcalTrigTowerConstituentsMap> eTTmap_; + edm::ESGetToken<EcalTrigTowerConstituentsMap, IdealGeometryRecord> eTTmapToken_; + const EcalTrigTowerConstituentsMap* eTTmap_; + edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> ecalmappingToken_; const EcalElectronicsMapping* theMapping_; + edm::ESGetToken<EcalLaserAlphas, EcalLaserAlphasRcd> ecalLaserAlphasToken_; + edm::ESGetToken<EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcd> ecalLaserAPDPNRatiosToken_; + edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> ecalPedestalsToken_; + edm::ESGetToken<EcalIntercalibConstants, EcalIntercalibConstantsRcd> ecalIntercalibConstantsToken_; + edm::ESGetToken<EcalGainRatios, EcalGainRatiosRcd> ecalGainRatiosToken_; + edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> ecalADCToGeVConstantToken_; + bool useTransverseEnergy_; double xtal_LSB_EB_, xtal_LSB_EE_; double Et_sat_EB_, Et_sat_EE_; From 7330fe5de1befe9f2bf91a6d0f3f8b6d21b44041 Mon Sep 17 00:00:00 2001 From: chayanit <chayanit.asawatangtrakuldee@cern.ch> Date: Thu, 29 Apr 2021 08:53:58 +0200 Subject: [PATCH 069/309] update file name of GEN fragment --- .../python/upgradeWorkflowComponents.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 13764112de221..39fa103b99ba1 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1328,7 +1328,7 @@ def __init__(self, howMuch, dataset): ('PhotonJet_Pt_10_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'PhotonJets_Pt_10_14TeV')), ('QQH1352T_Tauola_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'QQH1352T_Tauola_14TeV')), ('MinBias_14TeV_pythia8_TuneCP5_cfi', UpgradeFragment(Kby(90,100),'MinBias_14TeV')), - ('WM_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'WM_14TeV')), + ('WToMuNu_14TeV_TuneCP5_pythia8_cfi', UpgradeFragment(Kby(9,100),'WToMuNu_14TeV')), ('ZMM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(18,100),'ZMM_13')), ('QCDForPF_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(50,100),'QCD_FlatPt_15_3000HS_14')), ('DYToLL_M-50_14TeV_pythia8_cff', UpgradeFragment(Kby(9,100),'DYToLL_M_50_14TeV')), @@ -1413,13 +1413,13 @@ def __init__(self, howMuch, dataset): ('QCD_Pt_1800_2400_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50), 'QCD_Pt_1800_2400_14')), ('DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff', UpgradeFragment(Kby(9,50),'DisplacedSUSY_14TeV')), ('GluGluTo2Jets_M_300_2000_14TeV_Exhume_cff',UpgradeFragment(Kby(9,100),'GluGluTo2Jets_14TeV')), - ('TTbarLepton_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'TTbarLepton_14TeV')), - ('QQH1252T_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'QQH1252T_14TeV')), - ('ZpEE_6000_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'ZpEE_6000_14TeV')), - ('ZpMM_6000_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'ZpMM_6000_14TeV')), - ('SMS-T1tttt_mGl-1500_mLSP-100_14TeV-pythia8_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'SMS-T1tttt_14TeV')), - ('VBFHZZ4Nu_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'VBFHZZ4Nu_14TeV')), - ('EtaBToJpsiJpsi_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_14TeV')), - ('WToLNu_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(21,50),'WToLNu_14TeV')), - ('WprimeToLNu_M2000_14TeV_TuneCP5_cfi',UpgradeFragment(Kby(21,50),'WprimeToLNu_M2000_14TeV')), + ('TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'TTbarToDilepton_14TeV')), + ('QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'QQToHToTauTau_14TeV')), + ('ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'ZpToEE_m6000_14TeV')), + ('ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'ZpToMM_m6000_14TeV')), + ('SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'SMS-T1tttt_14TeV')), + ('VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'VBFHZZ4Nu_14TeV')), + ('EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_14TeV')), + ('WToLNu_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WToLNu_14TeV')), + ('WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WprimeToLNu_M2000_14TeV')), ]) From e20409eb86ed70ef589bd9d8fe8d4a718a2e5542 Mon Sep 17 00:00:00 2001 From: Bruno Alves <balves16@hotmail.com> Date: Thu, 29 Apr 2021 10:49:40 +0200 Subject: [PATCH 070/309] update configuration files for testing --- .../test/sourceFromRawCmggpu_cff.py | 110 +----------------- .../test/testEcalRechitProducer_cfg.py | 17 +-- 2 files changed, 5 insertions(+), 122 deletions(-) diff --git a/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py b/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py index e993a7573b689..262fdf259ac83 100644 --- a/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py +++ b/RecoLocalCalo/EcalRecProducers/test/sourceFromRawCmggpu_cff.py @@ -1,3 +1,4 @@ +import os, glob import FWCore.ParameterSet.Config as cms # input @@ -26,6 +27,7 @@ outputAdler32Recheck = cms.untracked.bool( False ), ) +prefix = '/data/store/data/Run2018D/EphemeralHLTPhysics/FED/v1/run323775/' source = cms.Source( "FedRawDataInputSource", runNumber = cms.untracked.uint32( 321177 ), getLSFromFilename = cms.untracked.bool(True), @@ -42,110 +44,6 @@ fileListMode = cms.untracked.bool( True ), # False fileNames = cms.untracked.vstring( - #'/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0142_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0143_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0144_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0145_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0146_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0147_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0148_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0149_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0150_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0151_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0152_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0153_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0154_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0155_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0156_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0157_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0158_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0159_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0160_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0161_index000004.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000000.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000001.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000002.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000003.raw', - '/data/patatrack/store/raw/Run2018D/JetHT/RAW/v1/000/321/177/00000/run321177_ls0162_index000004.raw', + ("file:{}".format(f) for f in glob.glob(os.path.join(prefix,'*raw'))) ), -) \ No newline at end of file +) diff --git a/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py b/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py index c70572ff3b89d..14d1d5dd11eb1 100644 --- a/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py +++ b/RecoLocalCalo/EcalRecProducers/test/testEcalRechitProducer_cfg.py @@ -7,26 +7,15 @@ # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') -#process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('HeterogeneousCore.CUDAServices.CUDAService_cfi') -#process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.GeometryRecoDB_cff') process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff') -#process.load('Configuration.StandardSequences.RawToDigi_Data_cff') -#process.load('Configuration.StandardSequences.Reconstruction_Data_cff') -#process.load('DQMOffline.Configuration.DQMOffline_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - - - - - # Other statements from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '102X_dataRun2_HLT_v2', '') - +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1000) @@ -312,10 +301,6 @@ wantSummary = cms.untracked.bool(True) ) -# report CUDAService messages -process.MessageLogger.categories.append("CUDAService") - - # #process.DependencyGraph = cms.Service("DependencyGraph") From aaf3a0ec957b20af50b071970e937e770e831b16 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen <matti.kortelainen@cern.ch> Date: Thu, 29 Apr 2021 22:40:02 +0200 Subject: [PATCH 071/309] Fix typo --- FWCore/ParameterSet/python/Mixins.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FWCore/ParameterSet/python/Mixins.py b/FWCore/ParameterSet/python/Mixins.py index 6d8a9ab2c42e6..f754e54a61a7e 100644 --- a/FWCore/ParameterSet/python/Mixins.py +++ b/FWCore/ParameterSet/python/Mixins.py @@ -873,9 +873,11 @@ def dumpPython(self,options=PrintOptions()): e = __Test("MyType") self.assertEqual(len(e.parameterNames_()), 0) - f = d.clone(__PSet(a = __TestType(1)), b = __TestType(2)) + f = e.clone(__PSet(a = __TestType(1)), b = __TestType(2)) self.assertEqual(f.a.value(), 1) self.assertEqual(f.b.value(), 2) + g = e.clone() + self.assertEqual(len(g.parameterNames_()), 0) def testModified(self): class __TestType(_SimpleParameterTypeBase): From 9c6d3c4c95b48df2bb396e699e5337dbcec2de19 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Wed, 28 Apr 2021 12:55:06 +0200 Subject: [PATCH 072/309] Apply LC multiplicity --- .../src/HGVHistoProducerAlgo.cc | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index 2c627522199a8..f03232dea756f 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -2367,6 +2367,16 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } // end of loop through SimClusters } // end of loop through CaloParticles + auto apply_LCMultiplicity = [](const ticl::Trackster& trackster, + const std::vector<std::pair<DetId, float>>& hitsAndFractions) { + auto hits_and_fractions_norm = hitsAndFractions; + int iLC = 0; + for (auto& haf : hits_and_fractions_norm) { + haf.second /= trackster.vertex_multiplicity(iLC++); + } + return hits_and_fractions_norm; + }; + //Loop through Tracksters for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { if (tracksters[tstId].vertices().empty()) @@ -2391,9 +2401,10 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr unsigned int numberOfHitsInTST = 0; for (const auto lcId : tracksters[tstId].vertices()) { - const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + const auto hits_and_fractions_norm = + apply_LCMultiplicity(tracksters[tstId], layerClusters[lcId].hitsAndFractions()); //number of hits related to that cluster. - unsigned int numberOfHitsInLC = hits_and_fractions.size(); + unsigned int numberOfHitsInLC = hits_and_fractions_norm.size(); numberOfHitsInTST += numberOfHitsInLC; std::unordered_map<unsigned, float> CPEnergyInLC; @@ -2417,14 +2428,14 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr std::vector<int> hitsToCaloParticleId(numberOfHitsInLC); //det id of the first hit just to make the lcLayerId variable //which maps the layers in -z: 0->51 and in +z: 52->103 - const auto firstHitDetId = hits_and_fractions[0].first; + const auto firstHitDetId = hits_and_fractions_norm[0].first; int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; //Loop though the hits of the layer cluster under study for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { - DetId rh_detid = hits_and_fractions[hitId].first; - auto rhFraction = hits_and_fractions[hitId].second; + DetId rh_detid = hits_and_fractions_norm[hitId].first; + auto rhFraction = hits_and_fractions_norm[hitId].second; //Since the hit is belonging to the layer cluster, it must also be in the rechits map. std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid); @@ -2580,21 +2591,24 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr continue; } + std::vector<std::pair<DetId, float>> hits_and_fractions_norm; + // Compute the correct normalization + float invTracksterEnergyWeight = 0.f; for (const auto lcId : tracksters[tstId].vertices()) { - const auto& hits_and_fractions = layerClusters[lcId].hitsAndFractions(); + hits_and_fractions_norm = apply_LCMultiplicity(tracksters[tstId], layerClusters[lcId].hitsAndFractions()); - // Compute the correct normalization - float invTracksterEnergyWeight = 0.f; - for (auto const& haf : hits_and_fractions) { + for (auto const& haf : hits_and_fractions_norm) { invTracksterEnergyWeight += (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy()); } - invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight; + } + invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight; - unsigned int numberOfHitsInLC = hits_and_fractions.size(); + for ([[maybe_unused]] const auto lcId : tracksters[tstId].vertices()) { + unsigned int numberOfHitsInLC = hits_and_fractions_norm.size(); for (unsigned int i = 0; i < numberOfHitsInLC; ++i) { - DetId rh_detid = hits_and_fractions[i].first; - float rhFraction = hits_and_fractions[i].second; + DetId rh_detid = hits_and_fractions_norm[i].first; + float rhFraction = hits_and_fractions_norm[i].second; bool hitWithNoCP = false; auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); From 3132e55be209f22bbea546afe4d48f11df2c8e73 Mon Sep 17 00:00:00 2001 From: Patrick Gartung <gartung@fnal.gov> Date: Fri, 30 Apr 2021 03:55:38 +0200 Subject: [PATCH 073/309] Revert "Remove unneeded #include <cstring>" This reverts commit a09f99ba36b7c52cbc33587e06243e4087e1f787. --- FWCore/Framework/test/dependentrecord_t.cppunit.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/FWCore/Framework/test/dependentrecord_t.cppunit.cc b/FWCore/Framework/test/dependentrecord_t.cppunit.cc index 5f9576d186282..04f792a61ac2b 100644 --- a/FWCore/Framework/test/dependentrecord_t.cppunit.cc +++ b/FWCore/Framework/test/dependentrecord_t.cppunit.cc @@ -38,6 +38,7 @@ #include <memory> #include <string> #include <vector> +#include <cstring> using namespace edm::eventsetup; From 80db57bd56a6fd21ea59de1ea85d9e7aa3c96a75 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 23 Apr 2021 17:32:02 +0200 Subject: [PATCH 074/309] shorten syntax for default error list vectors --- .../SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 93d3f023d44e8..6c371974816e1 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -114,17 +114,11 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add<bool>("IncludeErrors", true); desc.add<bool>("UseQualityInfo", false); { - std::vector<int> temp1; - temp1.reserve(1); - temp1.push_back(29); - desc.add<std::vector<int>>("ErrorList", temp1) + desc.add<std::vector<int>>("ErrorList", std::vector<int>{29}) ->setComment("## ErrorList: list of error codes used by tracking to invalidate modules"); } { - std::vector<int> temp1; - temp1.reserve(1); - temp1.push_back(40); - desc.add<std::vector<int>>("UserErrorList", temp1) + desc.add<std::vector<int>>("UserErrorList", std::vector<int>{40}) ->setComment("## UserErrorList: list of error codes used by Pixel experts for investigation"); } desc.add<edm::InputTag>("InputLabel", edm::InputTag("siPixelRawData")); From 86147b15c5c4d7079813624985a0cea8757651c3 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 23 Apr 2021 17:32:50 +0200 Subject: [PATCH 075/309] get rid of unnecessary debug variable --- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc | 4 +--- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 6c371974816e1..3c06d17dd25dc 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -144,7 +144,6 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript // ----------------------------------------------------------------------------- void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { const uint32_t dummydetid = 0xffffffff; - debug = edm::MessageDrop::instance()->debugEnabled; // initialize cabling map or update if necessary if (recordWatcher.check(es)) { @@ -205,8 +204,7 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { if (regions_ && !regions_->mayUnpackFED(fedId)) continue; - if (debug) - LogDebug("SiPixelRawToDigi") << " PRODUCE DIGI FOR FED: " << fedId << endl; + LogDebug("SiPixelRawToDigi") << " PRODUCE DIGI FOR FED: " << fedId << endl; PixelDataFormatter::Errors errors; diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index c475479cc7303..53b87a2989dcb 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -49,7 +49,6 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { std::unique_ptr<edm::CPUTimer> theTimer; bool includeErrors; bool useQuality; - bool debug; std::vector<int> tkerrorlist; std::vector<int> usererrorlist; std::vector<unsigned int> fedIds; From fee18a662589a2a2bdfda6ece242321531be26ec Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 23 Apr 2021 17:35:20 +0200 Subject: [PATCH 076/309] remove cablingMapLabel from members --- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc | 2 +- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 3c06d17dd25dc..1c972ca1fff8f 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -91,7 +91,7 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) edm::LogInfo("SiPixelRawToDigi") << " Using phase1"; //CablingMap could have a label //Tav - cablingMapLabel = config_.getParameter<std::string>("CablingMapLabel"); + auto cablingMapLabel = config_.getParameter<std::string>("CablingMapLabel"); tCablingMap = esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd>(edm::ESInputTag("", cablingMapLabel)); } diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index 53b87a2989dcb..aedfd281d5239 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -61,6 +61,5 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { int nwords; bool usePilotBlade; bool usePhase1; - std::string cablingMapLabel; }; #endif From 94a42c5ebedb4a3b7a11ba6ba9172c7a75ee9df7 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 23 Apr 2021 17:37:41 +0200 Subject: [PATCH 077/309] remove unused label --- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h | 1 - 1 file changed, 1 deletion(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index aedfd281d5239..9f9f7a959a1cc 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -54,7 +54,6 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { std::vector<unsigned int> fedIds; edm::ESWatcher<SiPixelFedCablingMapRcd> recordWatcher; edm::ESWatcher<SiPixelQualityRcd> qualityWatcher; - edm::InputTag label; edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> tSiPixelQuality; edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> tCablingMap; int ndigis; From 363d6269d0be1c86344df4acfa5c6403bff86b2b Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 23 Apr 2021 17:40:24 +0200 Subject: [PATCH 078/309] remove timer I know it might be breaking, that's why this is an atomic commit and can be reversed easily -> git rebase --- .../plugins/SiPixelRawToDigi.cc | 38 +------------------ .../plugins/SiPixelRawToDigi.h | 5 --- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 1c972ca1fff8f..5baecd36e24c7 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -35,14 +35,11 @@ #include "EventFilter/SiPixelRawToDigi/interface/PixelUnpackingRegions.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "TH1D.h" -#include "TFile.h" - using namespace std; // ----------------------------------------------------------------------------- SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) - : config_(conf), badPixelInfo_(nullptr), regions_(nullptr), hCPU(nullptr), hDigi(nullptr) { + : config_(conf), badPixelInfo_(nullptr), regions_(nullptr) { includeErrors = config_.getParameter<bool>("IncludeErrors"); useQuality = config_.getParameter<bool>("UseQualityInfo"); @@ -54,10 +51,6 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) tSiPixelQuality = esConsumes<SiPixelQuality, SiPixelQualityRcd>(); } - //start counters - ndigis = 0; - nwords = 0; - // Products produces<edm::DetSetVector<PixelDigi>>(); if (includeErrors) { @@ -72,14 +65,6 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) regions_ = new PixelUnpackingRegions(config_, consumesCollector()); } - // Timing - bool timing = config_.getUntrackedParameter<bool>("Timing", false); - if (timing) { - theTimer = std::make_unique<edm::CPUTimer>(); - hCPU = new TH1D("hCPU", "hCPU", 100, 0., 0.050); - hDigi = new TH1D("hDigi", "hDigi", 50, 0., 15000.); - } - // Control the usage of pilot-blade data, FED=40 usePilotBlade = config_.getParameter<bool>("UsePilotBlade"); if (usePilotBlade) @@ -98,15 +83,8 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) // ----------------------------------------------------------------------------- SiPixelRawToDigi::~SiPixelRawToDigi() { edm::LogInfo("SiPixelRawToDigi") << " HERE ** SiPixelRawToDigi destructor!"; - if (regions_) delete regions_; - - if (theTimer) { - TFile rootFile("analysis.root", "RECREATE", "my histograms"); - hCPU->Write(); - hDigi->Write(); - } } void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -131,7 +109,6 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add<edm::ParameterSetDescription>("Regions", psd0) ->setComment("## Empty Regions PSet means complete unpacking"); } - desc.addUntracked<bool>("Timing", false); desc.add<bool>("UsePilotBlade", false)->setComment("## Use pilot blades"); desc.add<bool>("UsePhase1", false)->setComment("## Use phase1"); desc.add<std::string>("CablingMapLabel", "")->setComment("CablingMap label"); //Tav @@ -182,8 +159,6 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { if (useQuality) formatter.setQualityStatus(useQuality, badPixelInfo_); - if (theTimer) - theTimer->start(); bool errorsInEvent = false; PixelDataFormatter::DetErrors nodeterrors; @@ -292,17 +267,6 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { if (errorsInEvent) LogDebug("SiPixelRawToDigi") << "Error words were stored in this event"; - if (theTimer) { - theTimer->stop(); - LogDebug("SiPixelRawToDigi") << "TIMING IS: (real)" << theTimer->realTime(); - ndigis += formatter.nDigis(); - nwords += formatter.nWords(); - LogDebug("SiPixelRawToDigi") << " (Words/Digis) this ev: " << formatter.nWords() << "/" << formatter.nDigis() - << "--- all :" << nwords << "/" << ndigis; - hCPU->Fill(theTimer->realTime()); - hDigi->Fill(formatter.nDigis()); - } - ev.put(std::move(collection)); if (includeErrors) { ev.put(std::move(errorcollection)); diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index 9f9f7a959a1cc..0fe3d6a63c4ab 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -17,7 +17,6 @@ #include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Utilities/interface/CPUTimer.h" #include "FWCore/Utilities/interface/ESGetToken.h" class SiPixelFedCablingTree; @@ -45,8 +44,6 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { const SiPixelQuality* badPixelInfo_; PixelUnpackingRegions* regions_; edm::EDGetTokenT<FEDRawDataCollection> tFEDRawDataCollection; - TH1D *hCPU, *hDigi; - std::unique_ptr<edm::CPUTimer> theTimer; bool includeErrors; bool useQuality; std::vector<int> tkerrorlist; @@ -56,8 +53,6 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { edm::ESWatcher<SiPixelQualityRcd> qualityWatcher; edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> tSiPixelQuality; edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> tCablingMap; - int ndigis; - int nwords; bool usePilotBlade; bool usePhase1; }; From e3abd2b6476701d4e343360ffc50bf552f73985c Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Mon, 26 Apr 2021 11:24:44 +0200 Subject: [PATCH 079/309] Move unpacking of FED error collections to PixelDataFormatter --- .../interface/PixelDataFormatter.h | 16 +++- .../plugins/SiPixelDigiErrorsFromSoA.cc | 76 +++--------------- .../plugins/SiPixelRawToDigi.cc | 78 +++--------------- .../src/PixelDataFormatter.cc | 80 ++++++++++++++++++- 4 files changed, 110 insertions(+), 140 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h index 189763dc6fd46..2000d108147f0 100644 --- a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h +++ b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h @@ -38,6 +38,7 @@ #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" #include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/DetId/interface/DetIdCollection.h" #include "EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h" #include "EventFilter/SiPixelRawToDigi/interface/ErrorCheckerPhase0.h" #include "FWCore/Utilities/interface/typedefs.h" @@ -70,7 +71,7 @@ class PixelDataFormatter { typedef cms_uint32_t Word32; typedef cms_uint64_t Word64; - PixelDataFormatter(const SiPixelFedCabling* map, bool phase1 = false); + PixelDataFormatter(const SiPixelFedCablingTree* map, bool phase1 = false); void setErrorStatus(bool ErrorStatus); void setQualityStatus(bool QualityStatus, const SiPixelQuality* QualityInfo); @@ -84,13 +85,22 @@ class PixelDataFormatter { void formatRawData(unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, const BadChannels& badChannels); - cms_uint32_t linkId(cms_uint32_t word32) { return (word32 >> LINK_shift) & LINK_mask; } + void unpackFEDErrors(Errors& errors, + std::vector<int> const& tkerrorlist, + std::vector<int> const& usererrorlist, + edm::DetSetVector<SiPixelRawDataError>& errorcollection, + DetIdCollection& tkerror_detidcollection, + DetIdCollection& usererror_detidcollection, + edmNew::DetSetVector<PixelFEDChannel>& disabled_channelcollection, + DetErrors& nodeterrors); + + cms_uint32_t getLinkId(cms_uint32_t word32) { return (word32 >> LINK_shift) & LINK_mask; } private: mutable int theDigiCounter; mutable int theWordCounter; - SiPixelFedCabling const* theCablingTree; + SiPixelFedCablingTree const* theCablingTree; const SiPixelFrameReverter* theFrameReverter; const SiPixelQuality* badPixelInfo; const std::set<unsigned int>* modulesToUnpack; diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc index d09e703c36a00..9e2bf3d5820e9 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiErrorsFromSoA.cc @@ -104,72 +104,16 @@ void SiPixelDigiErrorsFromSoA::produce(edm::Event& iEvent, const edm::EventSetup } } - constexpr uint32_t dummydetid = 0xffffffff; - typedef PixelDataFormatter::Errors::iterator IE; - for (auto& error : errors) { - uint32_t errordetid = error.first; - if (errordetid == dummydetid) { // errors given dummy detId must be sorted by Fed - nodeterrors.insert(nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end()); - } else { - edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(errordetid); - errorDetSet.data.insert(errorDetSet.data.end(), error.second.begin(), error.second.end()); - // Fill detid of the detectors where there is error AND the error number is listed - // in the configurable error list in the job option cfi. - // Code needs to be here, because there can be a set of errors for each - // entry in the for loop over PixelDataFormatter::Errors - - std::vector<PixelFEDChannel> disabledChannelsDetSet; - - for (auto const& aPixelError : errorDetSet) { - // For the time being, we extend the error handling functionality with ErrorType 25 - // In the future, we should sort out how the usage of tkerrorlist can be generalized - if (aPixelError.getType() == 25) { - int fedId = aPixelError.getFedId(); - const sipixelobjects::PixelFEDCabling* fed = cabling_->fed(fedId); - if (fed) { - cms_uint32_t linkId = formatter.linkId(aPixelError.getWord32()); - const sipixelobjects::PixelFEDLink* link = fed->link(linkId); - if (link) { - // The "offline" 0..15 numbering is fixed by definition, also, the FrameConversion depends on it - // in contrast, the ROC-in-channel numbering is determined by hardware --> better to use the "offline" scheme - PixelFEDChannel ch = {fed->id(), linkId, 25, 0}; - for (unsigned int iRoc = 1; iRoc <= link->numberOfROCs(); iRoc++) { - const sipixelobjects::PixelROC* roc = link->roc(iRoc); - if (roc->idInDetUnit() < ch.roc_first) - ch.roc_first = roc->idInDetUnit(); - if (roc->idInDetUnit() > ch.roc_last) - ch.roc_last = roc->idInDetUnit(); - } - disabledChannelsDetSet.push_back(ch); - } - } - } else { - // fill list of detIds to be turned off by tracking - if (!tkerrorlist_.empty()) { - auto it_find = std::find(tkerrorlist_.begin(), tkerrorlist_.end(), aPixelError.getType()); - if (it_find != tkerrorlist_.end()) { - tkerror_detidcollection.push_back(errordetid); - } - } - } - - // fill list of detIds with errors to be studied - if (!usererrorlist_.empty()) { - auto it_find = std::find(usererrorlist_.begin(), usererrorlist_.end(), aPixelError.getType()); - if (it_find != usererrorlist_.end()) { - usererror_detidcollection.push_back(errordetid); - } - } - - } // loop on DetSet of errors - - if (!disabledChannelsDetSet.empty()) { - disabled_channelcollection.insert(errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); - } - - } // if error assigned to a real DetId - } // loop on errors in event for this FED - + formatter.unpackFEDErrors(errors, + tkerrorlist_, + usererrorlist_, + errorcollection, + tkerror_detidcollection, + usererror_detidcollection, + disabled_channelcollection, + nodeterrors); + + const uint32_t dummydetid = 0xffffffff; edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(dummydetid); errorDetSet.data = nodeterrors; diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 5baecd36e24c7..502b588c735d0 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -191,74 +191,16 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { //pack errors into collection if (includeErrors) { - typedef PixelDataFormatter::Errors::iterator IE; - for (IE is = errors.begin(); is != errors.end(); is++) { - uint32_t errordetid = is->first; - if (errordetid == dummydetid) { // errors given dummy detId must be sorted by Fed - nodeterrors.insert(nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end()); - } else { - edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection->find_or_insert(errordetid); - errorDetSet.data.insert(errorDetSet.data.end(), is->second.begin(), is->second.end()); - // Fill detid of the detectors where there is error AND the error number is listed - // in the configurable error list in the job option cfi. - // Code needs to be here, because there can be a set of errors for each - // entry in the for loop over PixelDataFormatter::Errors - - std::vector<PixelFEDChannel> disabledChannelsDetSet; - - for (auto const& aPixelError : errorDetSet) { - // For the time being, we extend the error handling functionality with ErrorType 25 - // In the future, we should sort out how the usage of tkerrorlist can be generalized - if (usePhase1 && aPixelError.getType() == 25) { - assert(aPixelError.getFedId() == fedId); - const sipixelobjects::PixelFEDCabling* fed = cabling_->fed(fedId); - if (fed) { - cms_uint32_t linkId = formatter.linkId(aPixelError.getWord32()); - const sipixelobjects::PixelFEDLink* link = fed->link(linkId); - if (link) { - // The "offline" 0..15 numbering is fixed by definition, also, the FrameConversion depends on it - // in contrast, the ROC-in-channel numbering is determined by hardware --> better to use the "offline" scheme - PixelFEDChannel ch = {fed->id(), linkId, 25, 0}; - for (unsigned int iRoc = 1; iRoc <= link->numberOfROCs(); iRoc++) { - const sipixelobjects::PixelROC* roc = link->roc(iRoc); - if (roc->idInDetUnit() < ch.roc_first) - ch.roc_first = roc->idInDetUnit(); - if (roc->idInDetUnit() > ch.roc_last) - ch.roc_last = roc->idInDetUnit(); - } - disabledChannelsDetSet.push_back(ch); - } - } - } else { - // fill list of detIds to be turned off by tracking - if (!tkerrorlist.empty()) { - std::vector<int>::iterator it_find = - find(tkerrorlist.begin(), tkerrorlist.end(), aPixelError.getType()); - if (it_find != tkerrorlist.end()) { - tkerror_detidcollection->push_back(errordetid); - } - } - } - - // fill list of detIds with errors to be studied - if (!usererrorlist.empty()) { - std::vector<int>::iterator it_find = - find(usererrorlist.begin(), usererrorlist.end(), aPixelError.getType()); - if (it_find != usererrorlist.end()) { - usererror_detidcollection->push_back(errordetid); - } - } - - } // loop on DetSet of errors - - if (!disabledChannelsDetSet.empty()) { - disabled_channelcollection->insert( - errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); - } - } // if error assigned to a real DetId - } // loop on errors in event for this FED - } // if errors to be included in the event - } // loop on FED data to be unpacked + formatter.unpackFEDErrors(errors, + tkerrorlist, + usererrorlist, + *errorcollection.get(), + *tkerror_detidcollection.get(), + *usererror_detidcollection.get(), + *disabled_channelcollection.get(), + nodeterrors); + } // if errors to be included in the event + } // loop on FED data to be unpacked if (includeErrors) { edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection->find_or_insert(dummydetid); diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 74514b5bdf4dd..47baa6c0fc866 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -54,7 +54,7 @@ namespace { //const bool DANEK = false; } // namespace -PixelDataFormatter::PixelDataFormatter(const SiPixelFedCabling* map, bool phase) +PixelDataFormatter::PixelDataFormatter(const SiPixelFedCablingTree* map, bool phase) : theDigiCounter(0), theWordCounter(0), theCablingTree(map), @@ -332,11 +332,11 @@ void PixelDataFormatter::formatRawData(unsigned int lvl1_ID, } else if (detBadChannels != badChannels.end()) { auto badChannel = std::find_if(detBadChannels->second.begin(), detBadChannels->second.end(), [&](const PixelFEDChannel& ch) { - return (int(ch.fed) == fedId && ch.link == linkId(words[fedId].back())); + return (int(ch.fed) == fedId && ch.link == getLinkId(words[fedId].back())); }); if (badChannel != detBadChannels->second.end()) { LogError("FormatDataException") << " while marked bad, found digi for FED " << fedId << " Link " - << linkId(words[fedId].back()) << " on module " << rawId << endl + << getLinkId(words[fedId].back()) << " on module " << rawId << endl << print(digi) << endl; } } // if (fedId) @@ -520,3 +520,77 @@ std::string PixelDataFormatter::print(const Word64& word) const { str << "word64: " << reinterpret_cast<const bitset<64>&>(word); return str.str(); } + +void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors& errors, + std::vector<int> const& tkerrorlist, + std::vector<int> const& usererrorlist, + edm::DetSetVector<SiPixelRawDataError>& errorcollection, + DetIdCollection& tkerror_detidcollection, + DetIdCollection& usererror_detidcollection, + edmNew::DetSetVector<PixelFEDChannel>& disabled_channelcollection, + DetErrors& nodeterrors) { + const uint32_t dummydetid = 0xffffffff; + for (auto& error : errors) { + uint32_t errordetid = error.first; + if (errordetid == dummydetid) { // errors given dummy detId must be sorted by Fed + nodeterrors.insert(nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end()); + } else { + edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(errordetid); + errorDetSet.data.insert(errorDetSet.data.end(), error.second.begin(), error.second.end()); + // Fill detid of the detectors where there is error AND the error number is listed + // in the configurable error list in the job option cfi. + // Code needs to be here, because there can be a set of errors for each + // entry in the for loop over PixelDataFormatter::Errors + + std::vector<PixelFEDChannel> disabledChannelsDetSet; + + for (auto const& aPixelError : errorDetSet) { + // For the time being, we extend the error handling functionality with ErrorType 25 + // In the future, we should sort out how the usage of tkerrorlist can be generalized + if (aPixelError.getType() == 25) { + int fedId = aPixelError.getFedId(); + const sipixelobjects::PixelFEDCabling* fed = theCablingTree->fed(fedId); + if (fed) { + cms_uint32_t linkId = getLinkId(aPixelError.getWord32()); + const sipixelobjects::PixelFEDLink* link = fed->link(linkId); + if (link) { + // The "offline" 0..15 numbering is fixed by definition, also, the FrameConversion depends on it + // in contrast, the ROC-in-channel numbering is determined by hardware --> better to use the "offline" scheme + PixelFEDChannel ch = {fed->id(), linkId, 25, 0}; + for (unsigned int iRoc = 1; iRoc <= link->numberOfROCs(); iRoc++) { + const sipixelobjects::PixelROC* roc = link->roc(iRoc); + if (roc->idInDetUnit() < ch.roc_first) + ch.roc_first = roc->idInDetUnit(); + if (roc->idInDetUnit() > ch.roc_last) + ch.roc_last = roc->idInDetUnit(); + } + disabledChannelsDetSet.push_back(ch); + } + } + } else { + // fill list of detIds to be turned off by tracking + if (!tkerrorlist.empty()) { + auto it_find = std::find(tkerrorlist.begin(), tkerrorlist.end(), aPixelError.getType()); + if (it_find != tkerrorlist.end()) { + tkerror_detidcollection.push_back(errordetid); + } + } + } + + // fill list of detIds with errors to be studied + if (!usererrorlist.empty()) { + auto it_find = std::find(usererrorlist.begin(), usererrorlist.end(), aPixelError.getType()); + if (it_find != usererrorlist.end()) { + usererror_detidcollection.push_back(errordetid); + } + } + + } // loop on DetSet of errors + + if (!disabledChannelsDetSet.empty()) { + disabled_channelcollection.insert(errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); + } + + } // if error assigned to a real DetId + } // loop on errors in event for this FED +} \ No newline at end of file From f6c459d077ede1868d6f6d4060b6cb9cacea3715 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Mon, 26 Apr 2021 11:36:14 +0200 Subject: [PATCH 080/309] take errors with const reference --- EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h | 2 +- EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h index 2000d108147f0..6e9fcd953f061 100644 --- a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h +++ b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h @@ -85,7 +85,7 @@ class PixelDataFormatter { void formatRawData(unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, const BadChannels& badChannels); - void unpackFEDErrors(Errors& errors, + void unpackFEDErrors(Errors const& errors, std::vector<int> const& tkerrorlist, std::vector<int> const& usererrorlist, edm::DetSetVector<SiPixelRawDataError>& errorcollection, diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 47baa6c0fc866..2cc4cc4c67b60 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -521,7 +521,7 @@ std::string PixelDataFormatter::print(const Word64& word) const { return str.str(); } -void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors& errors, +void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors const& errors, std::vector<int> const& tkerrorlist, std::vector<int> const& usererrorlist, edm::DetSetVector<SiPixelRawDataError>& errorcollection, @@ -533,7 +533,7 @@ void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors& errors, for (auto& error : errors) { uint32_t errordetid = error.first; if (errordetid == dummydetid) { // errors given dummy detId must be sorted by Fed - nodeterrors.insert(nodeterrors.end(), errors[errordetid].begin(), errors[errordetid].end()); + nodeterrors.insert(nodeterrors.end(), error.second.begin(), error.second.end()); } else { edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(errordetid); errorDetSet.data.insert(errorDetSet.data.end(), error.second.begin(), error.second.end()); From e714478ffece77485e16c7f954f8bdcc2cd8f0d0 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Mon, 26 Apr 2021 11:41:24 +0200 Subject: [PATCH 081/309] remove obsolete stuff from PixelDataFormatter --- .../interface/PixelDataFormatter.h | 7 -- .../src/PixelDataFormatter.cc | 117 +----------------- 2 files changed, 2 insertions(+), 122 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h index 6e9fcd953f061..f356786293658 100644 --- a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h +++ b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h @@ -126,13 +126,6 @@ class PixelDataFormatter { const PixelDigi& digi, std::map<int, std::vector<Word32> >& words) const; - int word2digi(const int fedId, - const SiPixelFrameConverter* converter, - const bool includeError, - const bool useQuality, - const Word32& word, - Digis& digis) const; - std::string print(const PixelDigi& digi) const; std::string print(const Word64& word) const; diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 2cc4cc4c67b60..10df21fed1712 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -40,18 +40,6 @@ namespace { constexpr int COL_bits1_l1 = 6; constexpr int ROW_bits1_l1 = 7; - // Moved to the header file, keep commented out unti the final version is done/ - // constexpr int ADC_shift = 0; - // constexpr int PXID_shift = ADC_shift + ADC_bits; - // constexpr int DCOL_shift = PXID_shift + PXID_bits; - // constexpr int ROC_shift = DCOL_shift + DCOL_bits; - // constexpr int LINK_shift = ROC_shift + ROC_bits; - // constexpr PixelDataFormatter::Word32 LINK_mask = ~(~PixelDataFormatter::Word32(0) << LINK_bits); - // constexpr PixelDataFormatter::Word32 ROC_mask = ~(~PixelDataFormatter::Word32(0) << ROC_bits); - // constexpr PixelDataFormatter::Word32 DCOL_mask = ~(~PixelDataFormatter::Word32(0) << DCOL_bits); - // constexpr PixelDataFormatter::Word32 PXID_mask = ~(~PixelDataFormatter::Word32(0) << PXID_bits); - // constexpr PixelDataFormatter::Word32 ADC_mask = ~(~PixelDataFormatter::Word32(0) << ADC_bits); - //const bool DANEK = false; } // namespace PixelDataFormatter::PixelDataFormatter(const SiPixelFedCablingTree* map, bool phase) @@ -186,8 +174,6 @@ void PixelDataFormatter::interpretRawData( int nlink = (ww >> LINK_shift) & LINK_mask; int nroc = (ww >> ROC_shift) & ROC_mask; - //if(DANEK) cout<<" fed, link, roc "<<fedId<<" "<<nlink<<" "<<nroc<<endl; - if ((nlink != link) | (nroc != roc)) { // new roc link = nlink; roc = nroc; @@ -210,9 +196,6 @@ void PixelDataFormatter::interpretRawData( else layer = 0; - //if(DANEK) cout<<" rocp "<<rocp->print()<<" layer "<<rocp->bpixLayerPhase1(rawId)<<" " - // <<layer<<" phase1 "<<phase1<<" rawid "<<rawId<<endl; - if (useQualityInfo & (nullptr != badPixelInfo)) { short rocInDet = (short)rocp->idInDetUnit(); skipROC = badPixelInfo->IsRocBad(rawId, rocInDet); @@ -239,11 +222,8 @@ void PixelDataFormatter::interpretRawData( // for l1 roc use the roc column and row index instead of dcol and pixel index. int col = (ww >> COL_shift) & COL_mask; int row = (ww >> ROW_shift) & ROW_mask; - //if(DANEK) cout<<" layer 1: raw2digi "<<link<<" "<<roc<<" " - // <<col<<" "<<row<<" "<<adc<<endl; LocalPixel::RocRowCol localCR = {row, col}; // build pixel - //if(DANEK)cout<<localCR.rocCol<<" "<<localCR.rocRow<<endl; if UNLIKELY (!localCR.valid()) { LogDebug("PixelDataFormatter::interpretRawData") << "status #3"; errorsInEvent = true; @@ -251,16 +231,12 @@ void PixelDataFormatter::interpretRawData( continue; } local = std::make_unique<LocalPixel>(localCR); // local pixel coordinate - //if(DANEK) cout<<local->dcol()<<" "<<local->pxid()<<" "<<local->rocCol()<<" "<<local->rocRow()<<endl; } else { // phase0 and phase1 except bpix layer 1 int dcol = (ww >> DCOL_shift) & DCOL_mask; int pxid = (ww >> PXID_shift) & PXID_mask; - //if(DANEK) cout<<" raw2digi "<<link<<" "<<roc<<" " - //<<dcol<<" "<<pxid<<" "<<adc<<" "<<layer<<endl; LocalPixel::DcolPxid localDP = {dcol, pxid}; - //if(DANEK) cout<<localDP.dcol<<" "<<localDP.pxid<<endl; if UNLIKELY (!localDP.valid()) { LogDebug("PixelDataFormatter::interpretRawData") << "status #3"; @@ -269,31 +245,14 @@ void PixelDataFormatter::interpretRawData( continue; } local = std::make_unique<LocalPixel>(localDP); // local pixel coordinate - //if(DANEK) cout<<local->dcol()<<" "<<local->pxid()<<" "<<local->rocCol()<<" "<<local->rocRow()<<endl; } GlobalPixel global = rocp->toGlobal(*local); // global pixel coordinate (in module) (*detDigis).data.emplace_back(global.row, global.col, adc); - //if(DANEK) cout<<global.row<<" "<<global.col<<" "<<adc<<endl; LogTrace("") << (*detDigis).data.back(); } } -// I do not know what this was for or if it is needed? d.k. 10.14 -// Keep it commented out until we are sure that it is not needed. -// void doVectorize(int const * __restrict__ w, int * __restrict__ row, int * __restrict__ col, int * __restrict__ valid, int N, PixelROC const * rocp) { -// for (int i=0; i<N; ++i) { -// auto ww = w[i]; -// int dcol = (ww >> DCOL_shift) & DCOL_mask; -// int pxid = (ww >> PXID_shift) & PXID_mask; -// // int adc = (ww >> ADC_shift) & ADC_mask; -// LocalPixel::DcolPxid local = { dcol, pxid }; -// valid[i] = local.valid(); -// GlobalPixel global = rocp->toGlobal( LocalPixel(local) ); -// row[i]=global.row; col[i]=global.col; -// } -// } - void PixelDataFormatter::formatRawData(unsigned int lvl1_ID, RawData& fedRawData, const Digis& digis, @@ -308,7 +267,6 @@ void PixelDataFormatter::formatRawData(unsigned int lvl1_ID, bool barrel = PixelModuleName::isBarrel(rawId); if (barrel) layer = PixelROC::bpixLayerPhase1(rawId); - //if(DANEK) cout<<" layer "<<layer<<" "<<phase1<<endl; BadChannels::const_iterator detBadChannels = badChannels.find(rawId); @@ -401,9 +359,7 @@ void PixelDataFormatter::formatRawData(unsigned int lvl1_ID, int PixelDataFormatter::digi2word(cms_uint32_t detId, const PixelDigi& digi, std::map<int, vector<Word32> >& words) const { - LogDebug("PixelDataFormatter") - // <<" detId: " << detId - << print(digi); + LogDebug("PixelDataFormatter") << print(digi); DetectorIndex detector = {detId, digi.row(), digi.column()}; ElectronicIndex cabling; @@ -411,9 +367,6 @@ int PixelDataFormatter::digi2word(cms_uint32_t detId, if (fedId < 0) return fedId; - //if(DANEK) cout<<" digi2raw "<<detId<<" "<<digi.column()<<" "<<digi.row()<<" "<<digi.adc()<<" " - // <<cabling.link<<" "<<cabling.roc<<" "<<cabling.dcol<<" "<<cabling.pxid<<endl; - Word32 word = (cabling.link << LINK_shift) | (cabling.roc << ROC_shift) | (cabling.dcol << DCOL_shift) | (cabling.pxid << PXID_shift) | (digi.adc() << ADC_shift); words[fedId].push_back(word); @@ -424,9 +377,7 @@ int PixelDataFormatter::digi2word(cms_uint32_t detId, int PixelDataFormatter::digi2wordPhase1Layer1(cms_uint32_t detId, const PixelDigi& digi, std::map<int, vector<Word32> >& words) const { - LogDebug("PixelDataFormatter") - // <<" detId: " << detId - << print(digi); + LogDebug("PixelDataFormatter") << print(digi); DetectorIndex detector = {detId, digi.row(), digi.column()}; ElectronicIndex cabling; @@ -437,10 +388,6 @@ int PixelDataFormatter::digi2wordPhase1Layer1(cms_uint32_t detId, int col = ((cabling.dcol) * 2) + ((cabling.pxid) % 2); int row = LocalPixel::numRowsInRoc - ((cabling.pxid) / 2); - //if(DANEK) cout<<" layer 1: digi2raw "<<detId<<" "<<digi.column()<<" "<<digi.row()<<" "<<digi.adc()<<" " - // <<cabling.link<<" "<<cabling.roc<<" "<<cabling.dcol<<" "<<cabling.pxid<<" " - // <<col<<" "<<row<<endl; - Word32 word = (cabling.link << LINK_shift) | (cabling.roc << ROC_shift) | (col << COL_shift) | (row << ROW_shift) | (digi.adc() << ADC_shift); words[fedId].push_back(word); @@ -449,66 +396,6 @@ int PixelDataFormatter::digi2wordPhase1Layer1(cms_uint32_t detId, return fedId; } -// obsolete... -int PixelDataFormatter::word2digi(const int fedId, - const SiPixelFrameConverter* converter, - const bool includeErrors, - const bool useQuality, - const Word32& word, - Digis& digis) const { - // do not interpret false digis - if (word == 0) - return 0; - - ElectronicIndex cabling; - cabling.dcol = (word >> DCOL_shift) & DCOL_mask; - cabling.pxid = (word >> PXID_shift) & PXID_mask; - cabling.link = (word >> LINK_shift) & LINK_mask; - cabling.roc = (word >> ROC_shift) & ROC_mask; - int adc = (word >> ADC_shift) & ADC_mask; - - if (debug) { - LocalPixel::DcolPxid pixel = {cabling.dcol, cabling.pxid}; - LocalPixel local(pixel); - LogTrace("") << " link: " << cabling.link << ", roc: " << cabling.roc << " rocRow: " << local.rocRow() - << ", rocCol:" << local.rocCol() << " (dcol: " << cabling.dcol << ", pxid:" << cabling.pxid - << "), adc:" << adc; - } - - if (!converter) - return 0; - - DetectorIndex detIdx; - int status = converter->toDetector(cabling, detIdx); - if (status) - return status; - - // exclude ROC(raw) based on bad ROC list bad in SiPixelQuality - // enable: process.siPixelDigis.UseQualityInfo = True - // 20-10-2010 A.Y. - if (useQuality && badPixelInfo) { - CablingPathToDetUnit path = {static_cast<unsigned int>(fedId), - static_cast<unsigned int>(cabling.link), - static_cast<unsigned int>(cabling.roc)}; - const PixelROC* roc = theCablingTree->findItem(path); - short rocInDet = (short)roc->idInDetUnit(); - bool badROC = badPixelInfo->IsRocBad(detIdx.rawId, rocInDet); - if (badROC) - return 0; - } - - if (modulesToUnpack && modulesToUnpack->find(detIdx.rawId) == modulesToUnpack->end()) - return 0; - - digis[detIdx.rawId].emplace_back(detIdx.row, detIdx.col, adc); - - theDigiCounter++; - - if (debug) - LogTrace("") << digis[detIdx.rawId].back(); - return 0; -} - std::string PixelDataFormatter::print(const PixelDigi& digi) const { ostringstream str; str << " DIGI: row: " << digi.row() << ", col: " << digi.column() << ", adc: " << digi.adc(); From bba3554d4f89b2b88786ea2678e4dfbabf667f5a Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Mon, 26 Apr 2021 13:09:15 +0200 Subject: [PATCH 082/309] use own typedefs --- .../src/PixelDataFormatter.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 10df21fed1712..6c85f1f357d81 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -39,7 +39,6 @@ namespace { // Special for layer 1 bpix rocs 6/9/16 d.k. THIS STAYS. constexpr int COL_bits1_l1 = 6; constexpr int ROW_bits1_l1 = 7; - } // namespace PixelDataFormatter::PixelDataFormatter(const SiPixelFedCablingTree* map, bool phase) @@ -69,25 +68,25 @@ PixelDataFormatter::PixelDataFormatter(const SiPixelFedCablingTree* map, bool ph if (phase1) { // for phase 1 LINK_shift = ROC_shift + ROC_bits1; - LINK_mask = ~(~PixelDataFormatter::Word32(0) << LINK_bits1); - ROC_mask = ~(~PixelDataFormatter::Word32(0) << ROC_bits1); + LINK_mask = ~(~Word32(0) << LINK_bits1); + ROC_mask = ~(~Word32(0) << ROC_bits1); // special for layer 1 ROC ROW_shift = ADC_shift + ADC_bits; COL_shift = ROW_shift + ROW_bits1_l1; - COL_mask = ~(~PixelDataFormatter::Word32(0) << COL_bits1_l1); - ROW_mask = ~(~PixelDataFormatter::Word32(0) << ROW_bits1_l1); + COL_mask = ~(~Word32(0) << COL_bits1_l1); + ROW_mask = ~(~Word32(0) << ROW_bits1_l1); maxROCIndex = 8; } else { // for phase 0 LINK_shift = ROC_shift + ROC_bits; - LINK_mask = ~(~PixelDataFormatter::Word32(0) << LINK_bits); - ROC_mask = ~(~PixelDataFormatter::Word32(0) << ROC_bits); + LINK_mask = ~(~Word32(0) << LINK_bits); + ROC_mask = ~(~Word32(0) << ROC_bits); maxROCIndex = 25; } - DCOL_mask = ~(~PixelDataFormatter::Word32(0) << DCOL_bits); - PXID_mask = ~(~PixelDataFormatter::Word32(0) << PXID_bits); - ADC_mask = ~(~PixelDataFormatter::Word32(0) << ADC_bits); + DCOL_mask = ~(~Word32(0) << DCOL_bits); + PXID_mask = ~(~Word32(0) << PXID_bits); + ADC_mask = ~(~Word32(0) << ADC_bits); if (phase1) { errorcheck = std::unique_ptr<ErrorCheckerBase>(new ErrorChecker()); From 3aafe7167dfd0fcf3b8fb6e55e90e67a2bd5374a Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Mon, 26 Apr 2021 13:24:50 +0200 Subject: [PATCH 083/309] apply naming convention for SiPixelRawToDigi members --- .../plugins/SiPixelRawToDigi.cc | 62 +++++++++---------- .../plugins/SiPixelRawToDigi.h | 24 +++---- .../src/PixelDataFormatter.cc | 2 +- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 502b588c735d0..e5bb08f69c887 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -1,7 +1,7 @@ // Skip FED40 pilot-blade // Include parameter driven interface to SiPixelQuality for study purposes // exclude ROC(raw) based on bad ROC list in SiPixelQuality -// enabled by: process.siPixelDigis.UseQualityInfo = True (BY DEFAULT NOT USED) +// enabled by: process.siPixelDigis.useQuality_Info = True (BY DEFAULT NOT USED) // 20-10-2010 Andrew York (Tennessee) // Jan 2016 Tamas Almos Vami (Tav) (Wigner RCP) -- Cabling Map label option // Jul 2017 Viktor Veszpremi -- added PixelFEDChannel @@ -40,20 +40,20 @@ using namespace std; // ----------------------------------------------------------------------------- SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) : config_(conf), badPixelInfo_(nullptr), regions_(nullptr) { - includeErrors = config_.getParameter<bool>("IncludeErrors"); - useQuality = config_.getParameter<bool>("UseQualityInfo"); + includeErrors_ = config_.getParameter<bool>("IncludeErrors"); + useQuality_ = config_.getParameter<bool>("UseQualityInfo"); - tkerrorlist = config_.getParameter<std::vector<int>>("ErrorList"); - usererrorlist = config_.getParameter<std::vector<int>>("UserErrorList"); + tkerrorlist_ = config_.getParameter<std::vector<int>>("ErrorList"); + usererrorlist_ = config_.getParameter<std::vector<int>>("UserErrorList"); - tFEDRawDataCollection = consumes<FEDRawDataCollection>(config_.getParameter<edm::InputTag>("InputLabel")); - if (useQuality) { - tSiPixelQuality = esConsumes<SiPixelQuality, SiPixelQualityRcd>(); + fedRawDataCollectionToken_ = consumes<FEDRawDataCollection>(config_.getParameter<edm::InputTag>("InputLabel")); + if (useQuality_) { + siPixelQualityToken_ = esConsumes<SiPixelQuality, SiPixelQualityRcd>(); } // Products produces<edm::DetSetVector<PixelDigi>>(); - if (includeErrors) { + if (includeErrors_) { produces<edm::DetSetVector<SiPixelRawDataError>>(); produces<DetIdCollection>(); produces<DetIdCollection>("UserErrorModules"); @@ -66,18 +66,18 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) } // Control the usage of pilot-blade data, FED=40 - usePilotBlade = config_.getParameter<bool>("UsePilotBlade"); - if (usePilotBlade) + usePilotBlade_ = config_.getParameter<bool>("UsePilotBlade"); + if (usePilotBlade_) edm::LogInfo("SiPixelRawToDigi") << " Use pilot blade data (FED 40)"; // Control the usage of phase1 - usePhase1 = config_.getParameter<bool>("UsePhase1"); - if (usePhase1) + usePhase1_ = config_.getParameter<bool>("UsePhase1"); + if (usePhase1_) edm::LogInfo("SiPixelRawToDigi") << " Using phase1"; //CablingMap could have a label //Tav auto cablingMapLabel = config_.getParameter<std::string>("CablingMapLabel"); - tCablingMap = esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd>(edm::ESInputTag("", cablingMapLabel)); + cablingMapToken_ = esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd>(edm::ESInputTag("", cablingMapLabel)); } // ----------------------------------------------------------------------------- @@ -123,17 +123,17 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { const uint32_t dummydetid = 0xffffffff; // initialize cabling map or update if necessary - if (recordWatcher.check(es)) { + if (recordWatcher_.check(es)) { // cabling map, which maps online address (fed->link->ROC->local pixel) to offline (DetId->global pixel) - edm::ESHandle<SiPixelFedCablingMap> cablingMap = es.getHandle(tCablingMap); - fedIds = cablingMap->fedIds(); + edm::ESHandle<SiPixelFedCablingMap> cablingMap = es.getHandle(cablingMapToken_); + fedIds_ = cablingMap->fedIds(); cabling_ = cablingMap->cablingTree(); LogDebug("map version:") << cabling_->version(); } // initialize quality record or update if necessary - if (qualityWatcher.check(es) && useQuality) { + if (qualityWatcher_.check(es) && useQuality_) { // quality info for dead pixel modules or ROCs - edm::ESHandle<SiPixelQuality> qualityInfo = es.getHandle(tSiPixelQuality); + edm::ESHandle<SiPixelQuality> qualityInfo = es.getHandle(siPixelQualityToken_); badPixelInfo_ = qualityInfo.product(); if (!badPixelInfo_) { edm::LogError("SiPixelQualityNotPresent") @@ -142,7 +142,7 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { } edm::Handle<FEDRawDataCollection> buffers; - ev.getByToken(tFEDRawDataCollection, buffers); + ev.getByToken(fedRawDataCollectionToken_, buffers); // create product (digis & errors) auto collection = std::make_unique<edm::DetSetVector<PixelDigi>>(); @@ -152,12 +152,12 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { auto usererror_detidcollection = std::make_unique<DetIdCollection>(); auto disabled_channelcollection = std::make_unique<edmNew::DetSetVector<PixelFEDChannel>>(); - PixelDataFormatter formatter(cabling_.get(), usePhase1); // for phase 1 & 0 + PixelDataFormatter formatter(cabling_.get(), usePhase1_); // for phase 1 & 0 - formatter.setErrorStatus(includeErrors); + formatter.setErrorStatus(includeErrors_); - if (useQuality) - formatter.setQualityStatus(useQuality, badPixelInfo_); + if (useQuality_) + formatter.setQualityStatus(useQuality_, badPixelInfo_); bool errorsInEvent = false; PixelDataFormatter::DetErrors nodeterrors; @@ -170,10 +170,10 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { << regions_->nForwardModules() << " " << regions_->nModules(); } - for (auto aFed = fedIds.begin(); aFed != fedIds.end(); ++aFed) { + for (auto aFed = fedIds_.begin(); aFed != fedIds_.end(); ++aFed) { int fedId = *aFed; - if (!usePilotBlade && (fedId == 40)) + if (!usePilotBlade_ && (fedId == 40)) continue; // skip pilot blade data if (regions_ && !regions_->mayUnpackFED(fedId)) @@ -190,10 +190,10 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { formatter.interpretRawData(errorsInEvent, fedId, fedRawData, *collection, errors); //pack errors into collection - if (includeErrors) { + if (includeErrors_) { formatter.unpackFEDErrors(errors, - tkerrorlist, - usererrorlist, + tkerrorlist_, + usererrorlist_, *errorcollection.get(), *tkerror_detidcollection.get(), *usererror_detidcollection.get(), @@ -202,7 +202,7 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { } // if errors to be included in the event } // loop on FED data to be unpacked - if (includeErrors) { + if (includeErrors_) { edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection->find_or_insert(dummydetid); errorDetSet.data = nodeterrors; } @@ -210,7 +210,7 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { LogDebug("SiPixelRawToDigi") << "Error words were stored in this event"; ev.put(std::move(collection)); - if (includeErrors) { + if (includeErrors_) { ev.put(std::move(errorcollection)); ev.put(std::move(tkerror_detidcollection)); ev.put(std::move(usererror_detidcollection), "UserErrorModules"); diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index 0fe3d6a63c4ab..e78074c9f4957 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -43,17 +43,17 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { std::unique_ptr<SiPixelFedCablingTree> cabling_; const SiPixelQuality* badPixelInfo_; PixelUnpackingRegions* regions_; - edm::EDGetTokenT<FEDRawDataCollection> tFEDRawDataCollection; - bool includeErrors; - bool useQuality; - std::vector<int> tkerrorlist; - std::vector<int> usererrorlist; - std::vector<unsigned int> fedIds; - edm::ESWatcher<SiPixelFedCablingMapRcd> recordWatcher; - edm::ESWatcher<SiPixelQualityRcd> qualityWatcher; - edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> tSiPixelQuality; - edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> tCablingMap; - bool usePilotBlade; - bool usePhase1; + std::vector<int> tkerrorlist_; + std::vector<int> usererrorlist_; + std::vector<unsigned int> fedIds_; + edm::ESWatcher<SiPixelFedCablingMapRcd> recordWatcher_; + edm::ESWatcher<SiPixelQualityRcd> qualityWatcher_; + edm::EDGetTokenT<FEDRawDataCollection> fedRawDataCollectionToken_; + edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> siPixelQualityToken_; + edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> cablingMapToken_; + bool includeErrors_; + bool useQuality_; + bool usePilotBlade_; + bool usePhase1_; }; #endif diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 6c85f1f357d81..13f2561a3cee7 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -479,4 +479,4 @@ void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors const& error } // if error assigned to a real DetId } // loop on errors in event for this FED -} \ No newline at end of file +} From 478931c228edf37d84cd5f2577e597c7187ff1b0 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Mon, 26 Apr 2021 13:33:11 +0200 Subject: [PATCH 084/309] use initializer list and make members const --- .../plugins/SiPixelRawToDigi.cc | 22 ++++++++++--------- .../plugins/SiPixelRawToDigi.h | 14 ++++++------ 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index e5bb08f69c887..a2d70b400d201 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -39,14 +39,18 @@ using namespace std; // ----------------------------------------------------------------------------- SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) - : config_(conf), badPixelInfo_(nullptr), regions_(nullptr) { - includeErrors_ = config_.getParameter<bool>("IncludeErrors"); - useQuality_ = config_.getParameter<bool>("UseQualityInfo"); - - tkerrorlist_ = config_.getParameter<std::vector<int>>("ErrorList"); - usererrorlist_ = config_.getParameter<std::vector<int>>("UserErrorList"); - - fedRawDataCollectionToken_ = consumes<FEDRawDataCollection>(config_.getParameter<edm::InputTag>("InputLabel")); + : config_(conf), + badPixelInfo_(nullptr), + regions_(nullptr), + tkerrorlist_(config_.getParameter<std::vector<int>>("ErrorList")), + usererrorlist_(config_.getParameter<std::vector<int>>("UserErrorList")), + fedRawDataCollectionToken_(consumes<FEDRawDataCollection>(config_.getParameter<edm::InputTag>("InputLabel"))), + includeErrors_(config_.getParameter<bool>("IncludeErrors")), + useQuality_(config_.getParameter<bool>("UseQualityInfo")), + usePilotBlade_(config_.getParameter<bool>("UsePilotBlade")), + usePhase1_(config_.getParameter<bool>("UsePhase1")) + +{ if (useQuality_) { siPixelQualityToken_ = esConsumes<SiPixelQuality, SiPixelQualityRcd>(); } @@ -66,12 +70,10 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) } // Control the usage of pilot-blade data, FED=40 - usePilotBlade_ = config_.getParameter<bool>("UsePilotBlade"); if (usePilotBlade_) edm::LogInfo("SiPixelRawToDigi") << " Use pilot blade data (FED 40)"; // Control the usage of phase1 - usePhase1_ = config_.getParameter<bool>("UsePhase1"); if (usePhase1_) edm::LogInfo("SiPixelRawToDigi") << " Using phase1"; diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index e78074c9f4957..97e4f3a4f5c20 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -43,17 +43,17 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { std::unique_ptr<SiPixelFedCablingTree> cabling_; const SiPixelQuality* badPixelInfo_; PixelUnpackingRegions* regions_; - std::vector<int> tkerrorlist_; - std::vector<int> usererrorlist_; + const std::vector<int> tkerrorlist_; + const std::vector<int> usererrorlist_; std::vector<unsigned int> fedIds_; edm::ESWatcher<SiPixelFedCablingMapRcd> recordWatcher_; edm::ESWatcher<SiPixelQualityRcd> qualityWatcher_; - edm::EDGetTokenT<FEDRawDataCollection> fedRawDataCollectionToken_; + const edm::EDGetTokenT<FEDRawDataCollection> fedRawDataCollectionToken_; edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> siPixelQualityToken_; edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> cablingMapToken_; - bool includeErrors_; - bool useQuality_; - bool usePilotBlade_; - bool usePhase1_; + const bool includeErrors_; + const bool useQuality_; + const bool usePilotBlade_; + const bool usePhase1_; }; #endif From eedeaa127bdd34d277b7d0a12fd8316ca3414967 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Mon, 26 Apr 2021 16:39:55 +0200 Subject: [PATCH 085/309] Use EDPutTokens in SiPixelRawData - also, add Timing as an optional - manage header includes to minimize dependency --- .../plugins/SiPixelRawToDigi.cc | 63 ++++++++----------- .../plugins/SiPixelRawToDigi.h | 28 +++++++-- 2 files changed, 50 insertions(+), 41 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index a2d70b400d201..c556c5623be9e 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -18,22 +18,13 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" - -#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" - -#include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "DataFormats/DetId/interface/DetIdCollection.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h" -#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelUnpackingRegions.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" using namespace std; @@ -44,7 +35,10 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) regions_(nullptr), tkerrorlist_(config_.getParameter<std::vector<int>>("ErrorList")), usererrorlist_(config_.getParameter<std::vector<int>>("UserErrorList")), - fedRawDataCollectionToken_(consumes<FEDRawDataCollection>(config_.getParameter<edm::InputTag>("InputLabel"))), + fedRawDataCollectionToken_{consumes<FEDRawDataCollection>(config_.getParameter<edm::InputTag>("InputLabel"))}, + cablingMapToken_{esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd>( + edm::ESInputTag("", config_.getParameter<std::string>("CablingMapLabel")))}, + siPixelDigiCollectionToken_{produces<edm::DetSetVector<PixelDigi>>()}, includeErrors_(config_.getParameter<bool>("IncludeErrors")), useQuality_(config_.getParameter<bool>("UseQualityInfo")), usePilotBlade_(config_.getParameter<bool>("UsePilotBlade")), @@ -56,12 +50,11 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) } // Products - produces<edm::DetSetVector<PixelDigi>>(); if (includeErrors_) { - produces<edm::DetSetVector<SiPixelRawDataError>>(); - produces<DetIdCollection>(); - produces<DetIdCollection>("UserErrorModules"); - produces<edmNew::DetSetVector<PixelFEDChannel>>(); + errorPutToken_ = produces<edm::DetSetVector<SiPixelRawDataError>>(); + tkErrorPutToken_ = produces<DetIdCollection>(); + userErrorPutToken_ = produces<DetIdCollection>("UserErrorModules"); + disabledChannelPutToken_ = produces<edmNew::DetSetVector<PixelFEDChannel>>(); } // regions @@ -76,10 +69,6 @@ SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) // Control the usage of phase1 if (usePhase1_) edm::LogInfo("SiPixelRawToDigi") << " Using phase1"; - - //CablingMap could have a label //Tav - auto cablingMapLabel = config_.getParameter<std::string>("CablingMapLabel"); - cablingMapToken_ = esConsumes<SiPixelFedCablingMap, SiPixelFedCablingMapRcd>(edm::ESInputTag("", cablingMapLabel)); } // ----------------------------------------------------------------------------- @@ -114,7 +103,9 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add<bool>("UsePilotBlade", false)->setComment("## Use pilot blades"); desc.add<bool>("UsePhase1", false)->setComment("## Use phase1"); desc.add<std::string>("CablingMapLabel", "")->setComment("CablingMap label"); //Tav - desc.addOptional<bool>("CheckPixelOrder"); // never used, kept for back-compatibility + // unused options, kept for back-compatibility + desc.addOptional<bool>("CheckPixelOrder"); + desc.addOptional<bool>("Timing"); descriptions.add("siPixelRawToDigi", desc); } @@ -147,12 +138,12 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { ev.getByToken(fedRawDataCollectionToken_, buffers); // create product (digis & errors) - auto collection = std::make_unique<edm::DetSetVector<PixelDigi>>(); + auto collection = edm::DetSetVector<PixelDigi>(); // collection->reserve(8*1024); - auto errorcollection = std::make_unique<edm::DetSetVector<SiPixelRawDataError>>(); - auto tkerror_detidcollection = std::make_unique<DetIdCollection>(); - auto usererror_detidcollection = std::make_unique<DetIdCollection>(); - auto disabled_channelcollection = std::make_unique<edmNew::DetSetVector<PixelFEDChannel>>(); + auto errorcollection = edm::DetSetVector<SiPixelRawDataError>{}; + auto tkerror_detidcollection = DetIdCollection{}; + auto usererror_detidcollection = DetIdCollection{}; + auto disabled_channelcollection = edmNew::DetSetVector<PixelFEDChannel>{}; PixelDataFormatter formatter(cabling_.get(), usePhase1_); // for phase 1 & 0 @@ -189,34 +180,34 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { const FEDRawData& fedRawData = buffers->FEDData(fedId); //convert data to digi and strip off errors - formatter.interpretRawData(errorsInEvent, fedId, fedRawData, *collection, errors); + formatter.interpretRawData(errorsInEvent, fedId, fedRawData, collection, errors); //pack errors into collection if (includeErrors_) { formatter.unpackFEDErrors(errors, tkerrorlist_, usererrorlist_, - *errorcollection.get(), - *tkerror_detidcollection.get(), - *usererror_detidcollection.get(), - *disabled_channelcollection.get(), + errorcollection, + tkerror_detidcollection, + usererror_detidcollection, + disabled_channelcollection, nodeterrors); } // if errors to be included in the event } // loop on FED data to be unpacked if (includeErrors_) { - edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection->find_or_insert(dummydetid); + edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(dummydetid); errorDetSet.data = nodeterrors; } if (errorsInEvent) LogDebug("SiPixelRawToDigi") << "Error words were stored in this event"; - ev.put(std::move(collection)); + ev.emplace(siPixelDigiCollectionToken_, std::move(collection)); if (includeErrors_) { - ev.put(std::move(errorcollection)); - ev.put(std::move(tkerror_detidcollection)); - ev.put(std::move(usererror_detidcollection), "UserErrorModules"); - ev.put(std::move(disabled_channelcollection)); + ev.emplace(errorPutToken_, std::move(errorcollection)); + ev.emplace(tkErrorPutToken_, std::move(tkerror_detidcollection)); + ev.emplace(userErrorPutToken_, std::move(usererror_detidcollection)); + ev.emplace(disabledChannelPutToken_, std::move(disabled_channelcollection)); } } // declare this as a framework plugin diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index 97e4f3a4f5c20..69b72cb326c33 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -10,14 +10,23 @@ #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" #include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" + +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/DetId/interface/DetIdCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/Utilities/interface/ESGetToken.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" +#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" +#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" class SiPixelFedCablingTree; class SiPixelFedCabling; @@ -48,9 +57,18 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { std::vector<unsigned int> fedIds_; edm::ESWatcher<SiPixelFedCablingMapRcd> recordWatcher_; edm::ESWatcher<SiPixelQualityRcd> qualityWatcher_; + // always consumed const edm::EDGetTokenT<FEDRawDataCollection> fedRawDataCollectionToken_; + const edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> cablingMapToken_; + // consume only if pixel quality is used -> useQuality_ edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> siPixelQualityToken_; - edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> cablingMapToken_; + // always produced + edm::EDPutTokenT<edm::DetSetVector<PixelDigi>> siPixelDigiCollectionToken_; + // produce only if error collections are included -> includeErrors_ + edm::EDPutTokenT<edm::DetSetVector<SiPixelRawDataError>> errorPutToken_; + edm::EDPutTokenT<DetIdCollection> tkErrorPutToken_; + edm::EDPutTokenT<DetIdCollection> userErrorPutToken_; + edm::EDPutTokenT<edmNew::DetSetVector<PixelFEDChannel>> disabledChannelPutToken_; const bool includeErrors_; const bool useQuality_; const bool usePilotBlade_; From ffdbb76c9a5424c93f490ac617b47de4e0e6dcb0 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Tue, 27 Apr 2021 09:00:37 +0200 Subject: [PATCH 086/309] remove Timing from HLT menus extra validation: ran addOnTests.py and unittests locally --- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc | 4 +--- .../SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py | 1 - EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py | 1 - HLTrigger/Configuration/python/customizeHLTforCMSSW.py | 9 +++++++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index c556c5623be9e..d16639614d279 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -103,9 +103,7 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add<bool>("UsePilotBlade", false)->setComment("## Use pilot blades"); desc.add<bool>("UsePhase1", false)->setComment("## Use phase1"); desc.add<std::string>("CablingMapLabel", "")->setComment("CablingMap label"); //Tav - // unused options, kept for back-compatibility - desc.addOptional<bool>("CheckPixelOrder"); - desc.addOptional<bool>("Timing"); + desc.addOptional<bool>("CheckPixelOrder"); // unused option, kept for back-compatibility descriptions.add("siPixelRawToDigi", desc); } diff --git a/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py b/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py index bb78b3ee8c6ea..0c5946f226a11 100644 --- a/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py +++ b/EventFilter/SiPixelRawToDigi/python/SiPixelDigiToRaw_cfi.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms siPixelRawData = cms.EDProducer("SiPixelDigiToRaw", - Timing = cms.untracked.bool(False), InputLabel = cms.InputTag("simSiPixelDigis"), ## Use phase1 UsePhase1 = cms.bool(False), diff --git a/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py b/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py index 8cfcdf2944364..84fc26136d1aa 100644 --- a/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py +++ b/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py @@ -273,7 +273,6 @@ #process.source.lumisToProcess = cms.untracked.VLuminosityBlockRange('205718:49-205718:734') process.d = cms.EDAnalyzer("SiPixelRawDumper", - Timing = cms.untracked.bool(False), IncludeErrors = cms.untracked.bool(True), # In 2012, label = rawDataCollector, extension = _LHC # InputLabel = cms.untracked.string('rawDataCollector'), diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index b5499e80b4306..72c7c184f63b5 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -151,6 +151,14 @@ def customiseFor33495(process): return process +def customizeFor33526(process): + """ Customize HLT menu to remove deprecated parameters for the pixel raw to digi step""" + for producer in producers_by_type(process, "SiPixelRawToDigi"): + if hasattr(producer, "Timing"): + del producer.Timing + + return process + # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): @@ -158,6 +166,7 @@ def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) process = customiseFor33495(process) + process = customizeFor33526(process) process = customizeFor33543(process) return process From c147a247988842b5229b2b9020fc67d6ef0b864d Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Tue, 27 Apr 2021 12:50:39 +0200 Subject: [PATCH 087/309] remove unused variable CheckPixelOrder --- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc | 1 - EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py | 1 - EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py | 1 - HLTrigger/Configuration/python/customizeHLTforCMSSW.py | 6 +++--- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index d16639614d279..7d333e661a6c0 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -103,7 +103,6 @@ void SiPixelRawToDigi::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add<bool>("UsePilotBlade", false)->setComment("## Use pilot blades"); desc.add<bool>("UsePhase1", false)->setComment("## Use phase1"); desc.add<std::string>("CablingMapLabel", "")->setComment("CablingMap label"); //Tav - desc.addOptional<bool>("CheckPixelOrder"); // unused option, kept for back-compatibility descriptions.add("siPixelRawToDigi", desc); } diff --git a/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py b/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py index 5a82f804ee8fe..b457b7f840843 100644 --- a/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py +++ b/EventFilter/SiPixelRawToDigi/test/runHotPixels_cfg.py @@ -78,7 +78,6 @@ # In 2012, extension = _LHC InputLabel = cms.untracked.string('rawDataCollector'), # InputLabel = cms.untracked.string('siPixelRawData'), - CheckPixelOrder = cms.untracked.bool(False) ) process.p = cms.Path(process.hltfilter*process.dumper) diff --git a/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py b/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py index 84fc26136d1aa..17c420cca4488 100644 --- a/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py +++ b/EventFilter/SiPixelRawToDigi/test/runRawDumper_cfg.py @@ -283,7 +283,6 @@ # old # InputLabel = cms.untracked.string('siPixelRawData'), # InputLabel = cms.untracked.string('source'), - CheckPixelOrder = cms.untracked.bool(False), # 0 - nothing, 1 - error , 2- data, 3-headers, 4-hex Verbosity = cms.untracked.int32(1), # threshold, print fed/channel num of errors if tot_errors > events * PrintThreshold, default 0,001 diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 72c7c184f63b5..3485f90b5b4b0 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -150,19 +150,19 @@ def customiseFor33495(process): del producer.DoLorentz return process - def customizeFor33526(process): """ Customize HLT menu to remove deprecated parameters for the pixel raw to digi step""" for producer in producers_by_type(process, "SiPixelRawToDigi"): if hasattr(producer, "Timing"): del producer.Timing + if hasattr(producer, "CheckPixelOrder"): + del producer.CheckPixelOrder return process - # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): - + # add call to action function in proper order: newest last! # process = customiseFor12718(process) process = customiseFor33495(process) From a0ef64769ea2fbe745e219c25d0d2cfdcc09c413 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Wed, 28 Apr 2021 08:57:40 +0200 Subject: [PATCH 088/309] use range-based for loop for map iteration, increase readibility best c++17 feature --- .../src/PixelDataFormatter.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 13f2561a3cee7..2988219d17d47 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -415,14 +415,13 @@ void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors const& error DetIdCollection& usererror_detidcollection, edmNew::DetSetVector<PixelFEDChannel>& disabled_channelcollection, DetErrors& nodeterrors) { - const uint32_t dummydetid = 0xffffffff; - for (auto& error : errors) { - uint32_t errordetid = error.first; - if (errordetid == dummydetid) { // errors given dummy detId must be sorted by Fed - nodeterrors.insert(nodeterrors.end(), error.second.begin(), error.second.end()); + const uint32_t dummyDetId = 0xffffffff; + for (const auto& [errorDetId, rawErrorsVec] : errors) { + if (errorDetId == dummyDetId) { // errors given dummy detId must be sorted by Fed + nodeterrors.insert(nodeterrors.end(), rawErrorsVec.begin(), rawErrorsVec.end()); } else { - edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(errordetid); - errorDetSet.data.insert(errorDetSet.data.end(), error.second.begin(), error.second.end()); + edm::DetSet<SiPixelRawDataError>& errorDetSet = errorcollection.find_or_insert(errorDetId); + errorDetSet.data.insert(errorDetSet.data.end(), rawErrorsVec.begin(), rawErrorsVec.end()); // Fill detid of the detectors where there is error AND the error number is listed // in the configurable error list in the job option cfi. // Code needs to be here, because there can be a set of errors for each @@ -458,7 +457,7 @@ void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors const& error if (!tkerrorlist.empty()) { auto it_find = std::find(tkerrorlist.begin(), tkerrorlist.end(), aPixelError.getType()); if (it_find != tkerrorlist.end()) { - tkerror_detidcollection.push_back(errordetid); + tkerror_detidcollection.push_back(errorDetId); } } } @@ -467,14 +466,14 @@ void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors const& error if (!usererrorlist.empty()) { auto it_find = std::find(usererrorlist.begin(), usererrorlist.end(), aPixelError.getType()); if (it_find != usererrorlist.end()) { - usererror_detidcollection.push_back(errordetid); + usererror_detidcollection.push_back(errorDetId); } } } // loop on DetSet of errors if (!disabledChannelsDetSet.empty()) { - disabled_channelcollection.insert(errordetid, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); + disabled_channelcollection.insert(errorDetId, disabledChannelsDetSet.data(), disabledChannelsDetSet.size()); } } // if error assigned to a real DetId From 9e2a0c7828f5ea719b8a255b092cb4bf848ab2b1 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Wed, 28 Apr 2021 09:05:37 +0200 Subject: [PATCH 089/309] make put token const --- EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h index 69b72cb326c33..9ca5792f800a9 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h @@ -63,7 +63,7 @@ class SiPixelRawToDigi : public edm::stream::EDProducer<> { // consume only if pixel quality is used -> useQuality_ edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> siPixelQualityToken_; // always produced - edm::EDPutTokenT<edm::DetSetVector<PixelDigi>> siPixelDigiCollectionToken_; + const edm::EDPutTokenT<edm::DetSetVector<PixelDigi>> siPixelDigiCollectionToken_; // produce only if error collections are included -> includeErrors_ edm::EDPutTokenT<edm::DetSetVector<SiPixelRawDataError>> errorPutToken_; edm::EDPutTokenT<DetIdCollection> tkErrorPutToken_; From 7c8282f21f4373f7bddae4bdf6606b8ff3498d46 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 30 Apr 2021 07:16:21 +0200 Subject: [PATCH 090/309] fix phase 1 condition --- EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h | 1 - EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h index f356786293658..6a27de20b202a 100644 --- a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h +++ b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h @@ -107,7 +107,6 @@ class PixelDataFormatter { bool includeErrors; bool useQualityInfo; - bool debug; int allDetDigis; int hasDetDigis; std::unique_ptr<ErrorCheckerBase> errorcheck; diff --git a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc index 2988219d17d47..5557f8061446e 100644 --- a/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc +++ b/EventFilter/SiPixelRawToDigi/src/PixelDataFormatter.cc @@ -432,7 +432,7 @@ void PixelDataFormatter::unpackFEDErrors(PixelDataFormatter::Errors const& error for (auto const& aPixelError : errorDetSet) { // For the time being, we extend the error handling functionality with ErrorType 25 // In the future, we should sort out how the usage of tkerrorlist can be generalized - if (aPixelError.getType() == 25) { + if (phase1 && aPixelError.getType() == 25) { int fedId = aPixelError.getFedId(); const sipixelobjects::PixelFEDCabling* fed = theCablingTree->fed(fedId); if (fed) { From 7e2e909629dab21c3b8ef4758bf5048292274a3b Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 30 Apr 2021 07:24:17 +0200 Subject: [PATCH 091/309] remove header for plugin SiPixelRawToDigi --- .../plugins/SiPixelRawToDigi.cc | 78 +++++++++++++++++-- .../plugins/SiPixelRawToDigi.h | 77 ------------------ 2 files changed, 73 insertions(+), 82 deletions(-) delete mode 100644 EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 7d333e661a6c0..0c68cc0d91cd2 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -6,8 +6,6 @@ // Jan 2016 Tamas Almos Vami (Tav) (Wigner RCP) -- Cabling Map label option // Jul 2017 Viktor Veszpremi -- added PixelFEDChannel -#include "SiPixelRawToDigi.h" - #include <memory> #include "DataFormats/Common/interface/Handle.h" @@ -16,18 +14,88 @@ #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" +#include "DataFormats/Common/interface/DetSetVector.h" +#include "DataFormats/Common/interface/DetSetVectorNew.h" +#include "DataFormats/DetId/interface/DetIdCollection.h" +#include "DataFormats/FEDRawData/interface/FEDRawData.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" -#include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" +#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" +#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" +#include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelUnpackingRegions.h" using namespace std; +class SiPixelFedCablingTree; +class SiPixelFedCabling; +class SiPixelQuality; +class TH1D; +class PixelUnpackingRegions; + +/** \class SiPixelRawToDigi + * Plug-in module that performs Raw data to digi conversion + * for pixel subdetector + */ + +class SiPixelRawToDigi : public edm::stream::EDProducer<> { +public: + /// ctor + explicit SiPixelRawToDigi(const edm::ParameterSet&); + + /// dtor + ~SiPixelRawToDigi() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + /// get data, convert to digis attach againe to Event + void produce(edm::Event&, const edm::EventSetup&) override; + +private: + edm::ParameterSet config_; + std::unique_ptr<SiPixelFedCablingTree> cabling_; + const SiPixelQuality* badPixelInfo_; + PixelUnpackingRegions* regions_; + const std::vector<int> tkerrorlist_; + const std::vector<int> usererrorlist_; + std::vector<unsigned int> fedIds_; + edm::ESWatcher<SiPixelFedCablingMapRcd> recordWatcher_; + edm::ESWatcher<SiPixelQualityRcd> qualityWatcher_; + // always consumed + const edm::EDGetTokenT<FEDRawDataCollection> fedRawDataCollectionToken_; + const edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> cablingMapToken_; + // consume only if pixel quality is used -> useQuality_ + edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> siPixelQualityToken_; + // always produced + const edm::EDPutTokenT<edm::DetSetVector<PixelDigi>> siPixelDigiCollectionToken_; + // produce only if error collections are included -> includeErrors_ + edm::EDPutTokenT<edm::DetSetVector<SiPixelRawDataError>> errorPutToken_; + edm::EDPutTokenT<DetIdCollection> tkErrorPutToken_; + edm::EDPutTokenT<DetIdCollection> userErrorPutToken_; + edm::EDPutTokenT<edmNew::DetSetVector<PixelFEDChannel>> disabledChannelPutToken_; + const bool includeErrors_; + const bool useQuality_; + const bool usePilotBlade_; + const bool usePhase1_; +}; + // ----------------------------------------------------------------------------- SiPixelRawToDigi::SiPixelRawToDigi(const edm::ParameterSet& conf) : config_(conf), diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h deleted file mode 100644 index 9ca5792f800a9..0000000000000 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef SiPixelRawToDigi_H -#define SiPixelRawToDigi_H - -/** \class SiPixelRawToDigi_H - * Plug-in module that performs Raw data to digi conversion - * for pixel subdetector - */ - -#include "FWCore/Framework/interface/ESWatcher.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ConsumesCollector.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - -#include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" -#include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelQuality.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" - -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/Common/interface/DetSetVectorNew.h" -#include "DataFormats/DetId/interface/DetIdCollection.h" -#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" -#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" -#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" - -class SiPixelFedCablingTree; -class SiPixelFedCabling; -class SiPixelQuality; -class TH1D; -class PixelUnpackingRegions; - -class SiPixelRawToDigi : public edm::stream::EDProducer<> { -public: - /// ctor - explicit SiPixelRawToDigi(const edm::ParameterSet&); - - /// dtor - ~SiPixelRawToDigi() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - /// get data, convert to digis attach againe to Event - void produce(edm::Event&, const edm::EventSetup&) override; - -private: - edm::ParameterSet config_; - std::unique_ptr<SiPixelFedCablingTree> cabling_; - const SiPixelQuality* badPixelInfo_; - PixelUnpackingRegions* regions_; - const std::vector<int> tkerrorlist_; - const std::vector<int> usererrorlist_; - std::vector<unsigned int> fedIds_; - edm::ESWatcher<SiPixelFedCablingMapRcd> recordWatcher_; - edm::ESWatcher<SiPixelQualityRcd> qualityWatcher_; - // always consumed - const edm::EDGetTokenT<FEDRawDataCollection> fedRawDataCollectionToken_; - const edm::ESGetToken<SiPixelFedCablingMap, SiPixelFedCablingMapRcd> cablingMapToken_; - // consume only if pixel quality is used -> useQuality_ - edm::ESGetToken<SiPixelQuality, SiPixelQualityRcd> siPixelQualityToken_; - // always produced - const edm::EDPutTokenT<edm::DetSetVector<PixelDigi>> siPixelDigiCollectionToken_; - // produce only if error collections are included -> includeErrors_ - edm::EDPutTokenT<edm::DetSetVector<SiPixelRawDataError>> errorPutToken_; - edm::EDPutTokenT<DetIdCollection> tkErrorPutToken_; - edm::EDPutTokenT<DetIdCollection> userErrorPutToken_; - edm::EDPutTokenT<edmNew::DetSetVector<PixelFEDChannel>> disabledChannelPutToken_; - const bool includeErrors_; - const bool useQuality_; - const bool usePilotBlade_; - const bool usePhase1_; -}; -#endif From 64d828b400c67c5145190f855b75579c99654aac Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Fri, 30 Apr 2021 09:16:13 +0200 Subject: [PATCH 092/309] remove unnecessary header includes, forward declarations --- .../interface/PixelDataFormatter.h | 1 - .../SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc | 16 +++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h index 6a27de20b202a..cd5b02c5d848c 100644 --- a/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h +++ b/EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h @@ -37,7 +37,6 @@ #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" -#include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/DetId/interface/DetIdCollection.h" #include "EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h" #include "EventFilter/SiPixelRawToDigi/interface/ErrorCheckerPhase0.h" diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index 0c68cc0d91cd2..ffe3b246782e6 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -1,7 +1,7 @@ // Skip FED40 pilot-blade // Include parameter driven interface to SiPixelQuality for study purposes // exclude ROC(raw) based on bad ROC list in SiPixelQuality -// enabled by: process.siPixelDigis.useQuality_Info = True (BY DEFAULT NOT USED) +// enabled by: process.siPixelDigis.useQualityInfo = True (BY DEFAULT NOT USED) // 20-10-2010 Andrew York (Tennessee) // Jan 2016 Tamas Almos Vami (Tav) (Wigner RCP) -- Cabling Map label option // Jul 2017 Viktor Veszpremi -- added PixelFEDChannel @@ -34,7 +34,6 @@ #include "DataFormats/DetId/interface/DetIdCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" -#include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" #include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h" @@ -42,14 +41,6 @@ #include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelUnpackingRegions.h" -using namespace std; - -class SiPixelFedCablingTree; -class SiPixelFedCabling; -class SiPixelQuality; -class TH1D; -class PixelUnpackingRegions; - /** \class SiPixelRawToDigi * Plug-in module that performs Raw data to digi conversion * for pixel subdetector @@ -194,8 +185,7 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { edm::ESHandle<SiPixelQuality> qualityInfo = es.getHandle(siPixelQualityToken_); badPixelInfo_ = qualityInfo.product(); if (!badPixelInfo_) { - edm::LogError("SiPixelQualityNotPresent") - << " Configured to use SiPixelQuality, but SiPixelQuality not present" << endl; + edm::LogError("SiPixelQualityNotPresent") << "Configured to use SiPixelQuality, but SiPixelQuality not present"; } } @@ -237,7 +227,7 @@ void SiPixelRawToDigi::produce(edm::Event& ev, const edm::EventSetup& es) { if (regions_ && !regions_->mayUnpackFED(fedId)) continue; - LogDebug("SiPixelRawToDigi") << " PRODUCE DIGI FOR FED: " << fedId << endl; + LogDebug("SiPixelRawToDigi") << "PRODUCE DIGI FOR FED:" << fedId; PixelDataFormatter::Errors errors; From 435e38b5046f8c688a51f37d30fcde3ceedb8bbe Mon Sep 17 00:00:00 2001 From: Giacomo Govi <giacomo.govi@cern.ch> Date: Fri, 30 Apr 2021 16:53:52 +0200 Subject: [PATCH 093/309] Fix for bug concerning lock cleaning up at session closing time --- CondCore/CondDB/src/IOVEditor.cc | 3 +- CondCore/CondDB/src/SessionImpl.cc | 16 +++--- .../test/stubs/LumiBasedUpdateAnalyzer.cc | 53 ++++++++++++------- .../test/stubs/LumiBasedUpdateAnalyzer.h | 7 ++- 4 files changed, 48 insertions(+), 31 deletions(-) diff --git a/CondCore/CondDB/src/IOVEditor.cc b/CondCore/CondDB/src/IOVEditor.cc index 68ebf1f8c848d..c779d9bc79fa3 100644 --- a/CondCore/CondDB/src/IOVEditor.cc +++ b/CondCore/CondDB/src/IOVEditor.cc @@ -97,8 +97,7 @@ namespace cond { tag, m_session->sessionHash, cond::auth::COND_SESSION_HASH_CODE, cond::auth::COND_DBTAG_LOCK_ACCESS_CODE); if (!mylock) cond::throwException( - "Tag \"" + tag + "\" can't be accessed for update, because it has been locked by an other session. \"" + - m_session->principalName + "\".", + "Tag \"" + tag + "\" can't be accessed for update, because it has been locked by an other session.", "IOVEditor::load"); } } diff --git a/CondCore/CondDB/src/SessionImpl.cc b/CondCore/CondDB/src/SessionImpl.cc index 512e2b22ce2ad..fa8c92cbb98c9 100644 --- a/CondCore/CondDB/src/SessionImpl.cc +++ b/CondCore/CondDB/src/SessionImpl.cc @@ -43,15 +43,15 @@ namespace cond { SessionImpl::~SessionImpl() { close(); } void SessionImpl::close() { - if (coralSession.get()) { - if (coralSession->transaction().isActive()) { - coralSession->transaction().rollback(); - } + if( isActive() ) { + if(coralSession->transaction().isActive()){ + rollbackTransaction(); + } if (!lockedTags.empty()) { - coralSession->transaction().start(true); - releaseTagLocks(); - coralSession->transaction().commit(); - } + startTransaction(false); + releaseTagLocks(); + commitTransaction(); + } coralSession.reset(); } transaction.reset(); diff --git a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc index eb90ceb74ff9a..f1411b74f634a 100644 --- a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc +++ b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc @@ -9,26 +9,35 @@ #include <iostream> LumiBasedUpdateAnalyzer::LumiBasedUpdateAnalyzer(const edm::ParameterSet& iConfig) - : m_record(iConfig.getParameter<std::string>("record")) {} + : m_record(iConfig.getParameter<std::string>("record")), m_ret(-2) {} + LumiBasedUpdateAnalyzer::~LumiBasedUpdateAnalyzer() { - std::cout << "LumiBasedUpdateAnalyzer::~LumiBasedUpdateAnalyzer" << std::endl; } -void LumiBasedUpdateAnalyzer::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { - std::cout << "LumiBasedUpdateAnalyzer::analyze " << std::endl; + +void LumiBasedUpdateAnalyzer::beginJob() { edm::Service<cond::service::OnlineDBOutputService> mydbservice; if (!mydbservice.isAvailable()) { - std::cout << "Service is unavailable" << std::endl; return; } - mydbservice->logger().start(); - if (!m_tagLocks) { - mydbservice->lockRecords(); - m_tagLocks = true; + mydbservice->lockRecords(); +} + +void LumiBasedUpdateAnalyzer::endJob() { + edm::Service<cond::service::OnlineDBOutputService> mydbservice; + if (mydbservice.isAvailable()) { + mydbservice->releaseLocks(); } +} + +void LumiBasedUpdateAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) { + edm::Service<cond::service::OnlineDBOutputService> mydbservice; + if (!mydbservice.isAvailable()) { + return; + } + mydbservice->logger().start(); ::sleep(2); - //unsigned int irun = evt.id().run(); - unsigned int irun = evt.getLuminosityBlock().run(); - unsigned int lumiId = evt.getLuminosityBlock().luminosityBlock(); + unsigned int irun = lumiSeg.getRun().run(); + unsigned int lumiId = lumiSeg.luminosityBlock(); std::string tag = mydbservice->tag(m_record); std::cout << "tag " << tag << std::endl; std::cout << "run " << irun << std::endl; @@ -39,20 +48,26 @@ void LumiBasedUpdateAnalyzer::analyze(const edm::Event& evt, const edm::EventSet mybeamspot.SetType(int(lumiId)); std::cout << mybeamspot.GetBeamType() << std::endl; mydbservice->logger().logDebug() << "BeamType: " << mybeamspot.GetBeamType(); - int ret = 0; + m_ret = 0; try { mydbservice->writeForNextLumisection(&mybeamspot, m_record); } catch (const std::exception& e) { std::cout << "Error:" << e.what() << std::endl; mydbservice->logger().logError() << e.what(); - ret = -1; + m_ret = -1; } - mydbservice->logger().end(ret); } -void LumiBasedUpdateAnalyzer::endJob() { - if (m_tagLocks) { - edm::Service<cond::service::OnlineDBOutputService> mydbservice; - mydbservice->releaseLocks(); + +void LumiBasedUpdateAnalyzer::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup) { + edm::Service<cond::service::OnlineDBOutputService> mydbservice; + if (mydbservice.isAvailable()) { + mydbservice->logger().logInfo() << "EndLuminosityBlock"; + mydbservice->logger().end(m_ret); } } + +void LumiBasedUpdateAnalyzer::analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) { + std::cout << "LumiBasedUpdateAnalyzer::analyze " << std::endl; +} + DEFINE_FWK_MODULE(LumiBasedUpdateAnalyzer); diff --git a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h index 390eed9a1658d..855a0a2818bdb 100644 --- a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h +++ b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.h @@ -17,12 +17,15 @@ class LumiBasedUpdateAnalyzer : public edm::EDAnalyzer { public: explicit LumiBasedUpdateAnalyzer(const edm::ParameterSet& iConfig); virtual ~LumiBasedUpdateAnalyzer(); - virtual void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup); + virtual void beginJob(); virtual void endJob(); + virtual void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context); + virtual void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& iSetup); + virtual void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup); private: std::string m_record; - bool m_tagLocks; + int m_ret; // ----------member data --------------------------- }; #endif From 307539b6e138f5d85e8de593ca8e9b4dd53e709d Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Sat, 1 May 2021 03:44:09 +0200 Subject: [PATCH 094/309] Remove overlaps in the V1 geometry of HGCal --- Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc | 7 ++++--- Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc index 9ecf0e67a30e7..d0e2b945e1a1a 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc @@ -116,8 +116,8 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { static constexpr double tol = 0.00001; static const double sqrt3 = std::sqrt(3.0); - double rM = 0.5 * (waferSize_ + waferSepar_); - double RM = 2.0 * rM / sqrt3; +//double rM = 0.5 * (waferSize_ + waferSepar_); +//double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize_; double R = 2.0 * r / sqrt3; std::string parentName = parent().name().name(); @@ -127,7 +127,8 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { // First the mother std::string mother = parentName + tags_[k]; std::vector<std::pair<double, double> > wxy = - HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, rM, RM, 0.0, 0.0); + HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, r, R, 0.0, 0.0); +// HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, rM, RM, 0.0, 0.0); std::vector<double> xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc index aaa5994645947..0aeebb0d4baf8 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc @@ -69,8 +69,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext static constexpr double tol = 0.00001 * dd4hep::mm; static const double sqrt3 = std::sqrt(3.0); - double rM = 0.5 * (waferSize + waferSepar); - double RM = 2.0 * rM / sqrt3; +//double rM = 0.5 * (waferSize + waferSepar); +//double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize; double R = 2.0 * r / sqrt3; @@ -79,7 +79,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext // First the mother std::string mother = parentName + tags[k]; std::vector<std::pair<double, double>> wxy = - HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, rM, RM, 0.0, 0.0); + HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, r, R, 0.0, 0.0); +// HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, rM, RM, 0.0, 0.0); std::vector<double> xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); From 97145a24ea2e6e3fe368490c9b20ff6f35f4dab8 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Sat, 1 May 2021 03:56:57 +0200 Subject: [PATCH 095/309] Code check --- Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc | 6 +++--- Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc index d0e2b945e1a1a..1602ee8629eeb 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc @@ -116,8 +116,8 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { static constexpr double tol = 0.00001; static const double sqrt3 = std::sqrt(3.0); -//double rM = 0.5 * (waferSize_ + waferSepar_); -//double RM = 2.0 * rM / sqrt3; + //double rM = 0.5 * (waferSize_ + waferSepar_); + //double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize_; double R = 2.0 * r / sqrt3; std::string parentName = parent().name().name(); @@ -128,7 +128,7 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { std::string mother = parentName + tags_[k]; std::vector<std::pair<double, double> > wxy = HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, r, R, 0.0, 0.0); -// HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, rM, RM, 0.0, 0.0); + // HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, rM, RM, 0.0, 0.0); std::vector<double> xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc index 0aeebb0d4baf8..a441f6bffb1c2 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc @@ -69,8 +69,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext static constexpr double tol = 0.00001 * dd4hep::mm; static const double sqrt3 = std::sqrt(3.0); -//double rM = 0.5 * (waferSize + waferSepar); -//double RM = 2.0 * rM / sqrt3; + //double rM = 0.5 * (waferSize + waferSepar); + //double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize; double R = 2.0 * r / sqrt3; @@ -80,7 +80,7 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext std::string mother = parentName + tags[k]; std::vector<std::pair<double, double>> wxy = HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, r, R, 0.0, 0.0); -// HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, rM, RM, 0.0, 0.0); + // HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, rM, RM, 0.0, 0.0); std::vector<double> xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); From 1308d082802275ddc0e3e302d11d23371e0eddb8 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Sat, 1 May 2021 14:47:31 +0200 Subject: [PATCH 096/309] Clang check --- Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc | 3 --- Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc index 1602ee8629eeb..669a144a41cc5 100644 --- a/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/DDHGCalWaferP.cc @@ -116,8 +116,6 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { static constexpr double tol = 0.00001; static const double sqrt3 = std::sqrt(3.0); - //double rM = 0.5 * (waferSize_ + waferSepar_); - //double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize_; double R = 2.0 * r / sqrt3; std::string parentName = parent().name().name(); @@ -128,7 +126,6 @@ void DDHGCalWaferP::execute(DDCompactView& cpv) { std::string mother = parentName + tags_[k]; std::vector<std::pair<double, double> > wxy = HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, r, R, 0.0, 0.0); - // HGCalWaferMask::waferXY(partialTypes_[k], orientations_[k], 1, rM, RM, 0.0, 0.0); std::vector<double> xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); diff --git a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc index a441f6bffb1c2..5ec648d2be8f1 100644 --- a/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc +++ b/Geometry/HGCalCommonData/plugins/dd4hep/DDHGCalWaferP.cc @@ -25,8 +25,8 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext const auto& material = args.value<std::string>("ModuleMaterial"); const auto& thick = args.value<double>("ModuleThickness"); const auto& waferSize = args.value<double>("WaferSize"); - const auto& waferSepar = args.value<double>("SensorSeparation"); #ifdef EDM_ML_DEBUG + const auto& waferSepar = args.value<double>("SensorSeparation"); edm::LogVerbatim("HGCalGeom") << "DDHGCalWaferP: Module " << parentName << " made of " << material << " T " << cms::convert2mm(thick) << " Wafer 2r " << cms::convert2mm(waferSize) << " Half Separation " << cms::convert2mm(waferSepar); @@ -69,8 +69,6 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext static constexpr double tol = 0.00001 * dd4hep::mm; static const double sqrt3 = std::sqrt(3.0); - //double rM = 0.5 * (waferSize + waferSepar); - //double RM = 2.0 * rM / sqrt3; double r = 0.5 * waferSize; double R = 2.0 * r / sqrt3; @@ -80,7 +78,6 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext std::string mother = parentName + tags[k]; std::vector<std::pair<double, double>> wxy = HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, r, R, 0.0, 0.0); - // HGCalWaferMask::waferXY(partialTypes[k], orientations[k], 1, rM, RM, 0.0, 0.0); std::vector<double> xM, yM; for (unsigned int i = 0; i < (wxy.size() - 1); ++i) { xM.emplace_back(wxy[i].first); From c73d262c499e26d0f6284f61921f3cbde13321a8 Mon Sep 17 00:00:00 2001 From: David <David.Lange@cern.ch> Date: Sat, 1 May 2021 16:55:02 +0200 Subject: [PATCH 097/309] apply futurize stage1; use six.iteritems; use python3 for matplotlib --- Validation/Geometry/test/MaterialBudget.py | 1 + .../Geometry/test/MaterialBudgetHGCal.py | 60 ++++++++++--------- .../test/runMaterialMapForReco_fromReco.py | 3 +- ...FromVertexUpToInFrontOfMuonStations_cfg.py | 7 ++- Validation/Geometry/test/runP_HGCal_cfg.py | 7 ++- 5 files changed, 42 insertions(+), 36 deletions(-) diff --git a/Validation/Geometry/test/MaterialBudget.py b/Validation/Geometry/test/MaterialBudget.py index 3cc55383e9c99..5fce383d89e71 100644 --- a/Validation/Geometry/test/MaterialBudget.py +++ b/Validation/Geometry/test/MaterialBudget.py @@ -2,6 +2,7 @@ # Pure trick to start ROOT in batch mode, pass this only option to it # and the rest of the command line options to this code. +from __future__ import print_function import six import sys oldargv = sys.argv[:] diff --git a/Validation/Geometry/test/MaterialBudgetHGCal.py b/Validation/Geometry/test/MaterialBudgetHGCal.py index 9ab3860283d99..185a9f0dc03b2 100644 --- a/Validation/Geometry/test/MaterialBudgetHGCal.py +++ b/Validation/Geometry/test/MaterialBudgetHGCal.py @@ -1,11 +1,13 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # Pure trick to start ROOT in batch mode, pass this only option to it # and the rest of the command line options to this code. +from __future__ import print_function import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt +import six from array import array oldargv = sys.argv[:] @@ -101,7 +103,7 @@ def createPlots_(plot, compounddetectorname): hist_X0_elements = OrderedDict() prof_X0_elements = OrderedDict() - for subDetector,color in DETECTORS.iteritems(): + for subDetector,color in six.iteritems(DETECTORS): subDetectorFilename = "matbdg_%s.root" % subDetector if not checkFile_(subDetectorFilename): print("Error opening file: %s" % subDetectorFilename) @@ -115,7 +117,7 @@ def createPlots_(plot, compounddetectorname): hist_X0_detectors[subDetector] = prof_X0_XXX.ProjectionX() # category profiles - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): prof_X0_elements[label] = subDetectorFile.Get("%d" % (num + plots[plot].plotNumber)) hist_X0_elements[label] = assignOrAddIfExists_(hist_X0_elements.setdefault(label, None), prof_X0_elements[label]) @@ -128,10 +130,10 @@ def createPlots_(plot, compounddetectorname): cumulative_matbdg.SetDirectory(0) # colors - for det, color in DETECTORS.iteritems(): + for det, color in six.iteritems(DETECTORS): setColorIfExists_(hist_X0_detectors, det, color) - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): hist_X0_elements[label].SetFillColor(color) # First Plot: BeamPipe + Tracker + ECAL + HCal + HGCal + MB + MGNT @@ -139,7 +141,7 @@ def createPlots_(plot, compounddetectorname): stackTitle_SubDetectors = "Material Budget;%s;%s" % ( plots[plot].abscissa,plots[plot].ordinate) stack_X0_SubDetectors = THStack("stack_X0",stackTitle_SubDetectors) - for det, histo in hist_X0_detectors.iteritems(): + for det, histo in six.iteritems(hist_X0_detectors): stack_X0_SubDetectors.Add(histo) cumulative_matbdg.Add(histo, 1) @@ -162,7 +164,7 @@ def createPlots_(plot, compounddetectorname): theLegend_SubDetectors.SetFillStyle(0) theLegend_SubDetectors.SetBorderSize(0) - for det, histo in hist_X0_detectors.iteritems(): + for det, histo in six.iteritems(hist_X0_detectors): theLegend_SubDetectors.AddEntry(histo, det, "f") theLegend_SubDetectors.Draw() @@ -249,7 +251,7 @@ def createPlots2D_(plot, compounddetectorname): hist_X0_elements = OrderedDict() prof_X0_elements = OrderedDict() - for subDetector,color in DETECTORS.iteritems(): + for subDetector,color in six.iteritems(DETECTORS): subDetectorFilename = "matbdg_%s.root" % subDetector if not checkFile_(subDetectorFilename): print("Error opening file: %s" % subDetectorFilename) @@ -262,7 +264,7 @@ def createPlots2D_(plot, compounddetectorname): #hist_X0_detectors[subDetector] = prof_X0_XXX hist_X0_detectors[subDetector] = prof_X0_XXX.ProjectionXY("_pxy","B") - print subDetector + print(subDetector) # First Plot: BeamPipe + Tracker + ECAL + HCal + HGCal + MB + MGNT @@ -321,12 +323,12 @@ def createPlots2D_(plot, compounddetectorname): # colors - for det, color in DETECTORS.iteritems(): + for det, color in six.iteritems(DETECTORS): hist_X0_detectors[det].SetMarkerColor(color) hist_X0_detectors[det].SetFillColor(color) - for det, histo in hist_X0_detectors.iteritems(): - print det + for det, histo in six.iteritems(hist_X0_detectors): + print(det) histo.Draw("same") # Legenda @@ -336,7 +338,7 @@ def createPlots2D_(plot, compounddetectorname): theLegend_SubDetectors.SetFillStyle(0) theLegend_SubDetectors.SetBorderSize(0) - for det, histo in hist_X0_detectors.iteritems(): + for det, histo in six.iteritems(hist_X0_detectors): theLegend_SubDetectors.AddEntry(histo, det, "f") #theLegend_SubDetectors.AddEntry(hgbound1, "HGCal Eta Boundaries [1.3, 3.0]", "l") @@ -403,7 +405,7 @@ def createPlotsReco_(reco_file, label, debug=False): for s in sPREF: hs = THStack("hs",""); histos = [] - for det, color in sDETS.iteritems(): + for det, color in six.iteritems(sDETS): layer_number = 0 while True: layer_number += 1 @@ -506,7 +508,7 @@ def createCompoundPlots(detector, plot): # get TProfiles prof_X0_elements = OrderedDict() hist_X0_elements = OrderedDict() - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): #print label, num, color, leg prof_X0_elements[label] = theDetectorFile.Get("%d" % (num + plots[plot].plotNumber)) hist_X0_elements[label] = prof_X0_elements[label].ProjectionX() @@ -527,7 +529,7 @@ def createCompoundPlots(detector, plot): print("*** Open file... %s" % subDetectorFilename) # subdetector profiles - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): prof_X0_elements[label] = subDetectorFile.Get("%d" % (num + plots[plot].plotNumber)) hist_X0_elements[label].Add(prof_X0_elements[label].ProjectionX("B_%s" % prof_X0_elements[label].GetName()) , +1.000) @@ -537,7 +539,7 @@ def createCompoundPlots(detector, plot): plots[plot].abscissa, plots[plot].ordinate) stack_X0 = THStack("stack_X0", stackTitle); - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): stack_X0.Add(hist_X0_elements[label]) # canvas @@ -557,7 +559,7 @@ def createCompoundPlots(detector, plot): if plot == "x_vs_phi" or plot == "l_vs_phi": theLegend = TLegend(0.65, 0.30, 0.89, 0.70) if plot == "x_vs_R" or plot == "l_vs_R": theLegend = TLegend(0.75, 0.60, 0.95, 0.90) - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): theLegend.AddEntry(hist_X0_elements[label], leg, "f") theLegend.Draw(); @@ -630,8 +632,8 @@ def create2DPlots(detector, plot, plotnum, plotmat, dosingledetector = True): # get TProfiles #prof2d_X0_det_total = theDetectorFile.Get('%s' % plots[plot].plotNumber) prof2d_X0_det_total = theDetectorFile.Get('%s' % plotnum) - print "==================================================================" - print plotnum + print("==================================================================") + print(plotnum) # histos prof2d_X0_det_total.__class__ = TProfile2D @@ -903,7 +905,7 @@ def GetSiliconZValuesFromXML(): layersmaxZ = np.asarray(layersmaxZ) layersmaxZ = 10. * layersmaxZ # in mm - print "Total number of layers from XML " , layersmaxZ.size - 1 # Minus 1 for the EE front input by hand. + print("Total number of layers from XML " , layersmaxZ.size - 1) # Minus 1 for the EE front input by hand. return layersmaxZ @@ -978,30 +980,30 @@ def GetSiliconZValuesFromXML(): #Function to help filling the twiki with all these plots #First I loop through labels to put the hide button in twiki #All HGCal - print "---+++ Results: Plots for individual material in all HGCal" - for label, [num, color, leg] in hist_label_to_num.iteritems(): + print("---+++ Results: Plots for individual material in all HGCal") + for label, [num, color, leg] in six.iteritems(hist_label_to_num): for p in ["x_vs_z_vs_Rsum", "l_vs_z_vs_Rsum", "x_vs_z_vs_Rsumcos", "l_vs_z_vs_Rsumcos", "x_vs_z_vs_Rloc", "l_vs_z_vs_Rloc"]: TwikiPrintout(p, leg, "all") #Z+ - print "---+++ Results: Plots for individual material in Z+ Endcap" - for label, [num, color, leg] in hist_label_to_num.iteritems(): + print("---+++ Results: Plots for individual material in Z+ Endcap") + for label, [num, color, leg] in six.iteritems(hist_label_to_num): for p in ["x_vs_z_vs_Rsum", "l_vs_z_vs_Rsum", "x_vs_z_vs_Rsumcos", "l_vs_z_vs_Rsumcos", "x_vs_z_vs_Rloc", "l_vs_z_vs_Rloc"]: TwikiPrintout(p, leg, "zplus") #Z- - print "---+++ Results: Plots for individual material in Z- Endcap" - for label, [num, color, leg] in hist_label_to_num.iteritems(): + print("---+++ Results: Plots for individual material in Z- Endcap") + for label, [num, color, leg] in six.iteritems(hist_label_to_num): for p in ["x_vs_z_vs_Rsum", "l_vs_z_vs_Rsum", "x_vs_z_vs_Rsumcos", "l_vs_z_vs_Rsumcos", "x_vs_z_vs_Rloc", "l_vs_z_vs_Rloc"]: TwikiPrintout(p, leg, "zminus") #Below is the silicon position from the xml geometry file #Should we put them on top of plots like the eta values? - print GetSiliconZValuesFromXML() + print(GetSiliconZValuesFromXML()) for p in required_2Dplots: #First the total create2DPlots(args.detector, p, plots[p].plotNumber, "") #Then, the rest - for label, [num, color, leg] in hist_label_to_num.iteritems(): + for label, [num, color, leg] in six.iteritems(hist_label_to_num): #print label, num, color, leg create2DPlots(args.detector, p, num + plots[p].plotNumber, leg) diff --git a/Validation/Geometry/test/runMaterialMapForReco_fromReco.py b/Validation/Geometry/test/runMaterialMapForReco_fromReco.py index 9992485bed95b..c3e801061359e 100644 --- a/Validation/Geometry/test/runMaterialMapForReco_fromReco.py +++ b/Validation/Geometry/test/runMaterialMapForReco_fromReco.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Auto generated configuration file # using: # Revision: 1.19 @@ -93,7 +94,7 @@ process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') if options.fromLocalXML: - print "Loading material from local XMLs" + print("Loading material from local XMLs") process.load('Configuration.Geometry.GeometryExtended2016Reco_cff') else: process.load('Configuration.StandardSequences.GeometryRecoDB_cff') diff --git a/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py b/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py index 676f4dad0c57d..82579b3ef0d6f 100644 --- a/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py +++ b/Validation/Geometry/test/runP_FromVertexUpToInFrontOfMuonStations_cfg.py @@ -1,3 +1,4 @@ +from __future__ import print_function # In order to produce what you need (or in a loop) #time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label=BeamPipe #time cmsRun runP_FromVertexUpToInFrontOfMuonStations_cfg.py geom=Extended2023D41 label=Tracker @@ -58,9 +59,9 @@ # Option validation if options.label not in _ALLOWED_LABELS: - print "\n*** Error, '%s' not registered as a valid components to monitor." % options.label - print "Allowed components:", _ALLOWED_LABELS - print + print("\n*** Error, '%s' not registered as a valid components to monitor." % options.label) + print("Allowed components:", _ALLOWED_LABELS) + print() raise RuntimeError("Unknown label") _components = _LABELS2COMPS[options.label] diff --git a/Validation/Geometry/test/runP_HGCal_cfg.py b/Validation/Geometry/test/runP_HGCal_cfg.py index bc184ffe5f120..640f861a316ae 100644 --- a/Validation/Geometry/test/runP_HGCal_cfg.py +++ b/Validation/Geometry/test/runP_HGCal_cfg.py @@ -1,3 +1,4 @@ +from __future__ import print_function # In order to produce everything that you need in one go, use the command: # # for t in {'BeamPipe','Tracker','PixBar','PixFwdMinus','PixFwdPlus','TIB','TOB','TIDB','TIDF','TEC','TkStrct','InnerServices'}; do cmsRun runP_Tracker_cfg.py geom=XYZ label=$t >& /dev/null &; done @@ -47,9 +48,9 @@ # Option validation if options.label not in _ALLOWED_LABELS: - print "\n*** Error, '%s' not registered as a valid components to monitor." % options.label - print "Allowed components:", _ALLOWED_LABELS - print + print("\n*** Error, '%s' not registered as a valid components to monitor." % options.label) + print("Allowed components:", _ALLOWED_LABELS) + print() raise RuntimeError("Unknown label") _components = _LABELS2COMPS[options.label] From 896e046bd4f22869c69faeba3fa7bc39525f5562 Mon Sep 17 00:00:00 2001 From: Konstantinos Theofilatos <konstantinos.theofilatos@gmail.com> Date: Sat, 1 May 2021 22:12:51 +0200 Subject: [PATCH 098/309] renaming H7's cffs and cfgs --- ...Standalone_DYLO_cff.py => DYToLL_TuneCH3_13TeV_herwig7_cff.py} | 0 ...oee_cff.py => PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cff.py} | 0 ...Standalone_DYLO_cfg.py => DYToLL_TuneCH3_13TeV_herwig7_cfg.py} | 0 ...oee_cfg.py => PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cfg.py} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename GeneratorInterface/Herwig7Interface/python/{Herwig7_Standalone_DYLO_cff.py => DYToLL_TuneCH3_13TeV_herwig7_cff.py} (100%) rename GeneratorInterface/Herwig7Interface/python/{Herwig7_Matchbox_ppToee_cff.py => PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cff.py} (100%) rename GeneratorInterface/Herwig7Interface/test/{Herwig7_Standalone_DYLO_cfg.py => DYToLL_TuneCH3_13TeV_herwig7_cfg.py} (100%) rename GeneratorInterface/Herwig7Interface/test/{Herwig7_Matchbox_ppToee_cfg.py => PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cfg.py} (100%) diff --git a/GeneratorInterface/Herwig7Interface/python/Herwig7_Standalone_DYLO_cff.py b/GeneratorInterface/Herwig7Interface/python/DYToLL_TuneCH3_13TeV_herwig7_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/Herwig7_Standalone_DYLO_cff.py rename to GeneratorInterface/Herwig7Interface/python/DYToLL_TuneCH3_13TeV_herwig7_cff.py diff --git a/GeneratorInterface/Herwig7Interface/python/Herwig7_Matchbox_ppToee_cff.py b/GeneratorInterface/Herwig7Interface/python/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/Herwig7_Matchbox_ppToee_cff.py rename to GeneratorInterface/Herwig7Interface/python/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cff.py diff --git a/GeneratorInterface/Herwig7Interface/test/Herwig7_Standalone_DYLO_cfg.py b/GeneratorInterface/Herwig7Interface/test/DYToLL_TuneCH3_13TeV_herwig7_cfg.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/test/Herwig7_Standalone_DYLO_cfg.py rename to GeneratorInterface/Herwig7Interface/test/DYToLL_TuneCH3_13TeV_herwig7_cfg.py diff --git a/GeneratorInterface/Herwig7Interface/test/Herwig7_Matchbox_ppToee_cfg.py b/GeneratorInterface/Herwig7Interface/test/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cfg.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/test/Herwig7_Matchbox_ppToee_cfg.py rename to GeneratorInterface/Herwig7Interface/test/PPToEE_LO_TuneCH3_13TeV_herwig7_matchbox_cfg.py From 90429cbe3bebd2422995f84642b515b983faa49b Mon Sep 17 00:00:00 2001 From: Konstantinos Theofilatos <konstantinos.theofilatos@gmail.com> Date: Sat, 1 May 2021 22:19:55 +0200 Subject: [PATCH 099/309] moving h7_cff to Configuration/Generators --- .../python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py | 0 .../python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {GeneratorInterface/Herwig7Interface => Configuration/Generator}/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py (100%) rename {GeneratorInterface/Herwig7Interface => Configuration/Generator}/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py (100%) diff --git a/GeneratorInterface/Herwig7Interface/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py b/Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py rename to Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py diff --git a/GeneratorInterface/Herwig7Interface/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py b/Configuration/Generator/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py similarity index 100% rename from GeneratorInterface/Herwig7Interface/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py rename to Configuration/Generator/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py From 2aa615e8ddab4b002ba3bfcfdc25a670ff70b171 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Sun, 2 May 2021 17:53:17 +0200 Subject: [PATCH 100/309] Remove reference of DDD from plugins/dd4hep/DDEcalEndcapAlgo.cc --- .../interface/DDEcalEndcapTrapX.h | 53 ++++ .../plugins/dd4hep/DDEcalEndcapAlgo.cc | 19 +- .../EcalCommonData/src/DDEcalEndcapTrap.cc | 45 ++- .../EcalCommonData/src/DDEcalEndcapTrapX.cc | 274 ++++++++++++++++++ 4 files changed, 364 insertions(+), 27 deletions(-) create mode 100644 Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h create mode 100644 Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc diff --git a/Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h b/Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h new file mode 100644 index 0000000000000..0f3ba7d035c1a --- /dev/null +++ b/Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h @@ -0,0 +1,53 @@ +#ifndef Geometry_EcalCommonDatao_DDEcalEndcapTrapX_h +#define Geometry_EcalCommonDatao_DDEcalEndcapTrapX_h + +#include <vector> +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DetectorDescription/DDCMS/interface/DDRotationMatrix.h" +#include "DetectorDescription/DDCMS/interface/DDTranslation.h" + +// Define Endcap Supercrystal class + +class DDEcalEndcapTrapX { +public: + DDEcalEndcapTrapX(const int hand, const double front, const double rear, const double length); + DDEcalEndcapTrapX() = delete; + + void rotate(const DDRotationMatrix& rot); + void translate(const DDTranslation& trans); + + void rotateX(const double angle); + void rotateY(const double angle); + void translate(); + void moveto(const DDTranslation& frontCentre, const DDTranslation& rearCentre); + double elevationAngle(const DDTranslation& trans); + double polarAngle(const DDTranslation& trans); + double elevationAngle(); + double polarAngle(); + DDTranslation cornerPos(const int icorner); + void cornerPos(const int icorner, const DDTranslation& cc); + DDTranslation centrePos(); + DDTranslation fcentrePos(); + DDTranslation rcentrePos(); + void calculateCorners(); + void calculateCentres(); + DDRotationMatrix rotation() { return m_rotation; } + void print(); + +private: + DDRotationMatrix m_rotation; + DDTranslation m_translation; + + double m_centre[4]; + double m_fcentre[4]; + double m_rcentre[4]; + double m_corners[25]; + double m_front; + double m_rear; + double m_length; + + int m_hand; + int m_update; +}; + +#endif diff --git a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc index e8efe7e37608c..1df77ee052546 100644 --- a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc +++ b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc @@ -4,7 +4,7 @@ #include "DetectorDescription/DDCMS/interface/DDutils.h" #include "DataFormats/Math/interface/angle_units.h" // Header files for endcap supercrystal geometry -#include "Geometry/EcalCommonData/interface/DDEcalEndcapTrap.h" +#include "Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h" #include <CLHEP/Geometry/Transform3D.h> #include <string> @@ -12,9 +12,6 @@ using namespace angle_units::operators; -using DDTranslation = ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >; -using DDRotation = ROOT::Math::Rotation3D; - //#define EDM_ML_DEBUG namespace { @@ -77,7 +74,7 @@ namespace { double zFront; }; - const DDRotation& myrot(cms::DDNamespace& ns, const std::string& nam, const DDRotation& r) { + const DDRotationMatrix& myrot(cms::DDNamespace& ns, const std::string& nam, const DDRotationMatrix& r) { ns.addRotation(nam, r); return ns.rotation(ns.prepend(nam)); } @@ -308,10 +305,10 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext const CLHEP::HepRotationZ cutm(ffived); - DDRotation cutRot(5 != iSCType ? DDRotation() + DDRotationMatrix cutRot(5 != iSCType ? DDRotationMatrix() : myrot(ns, "EECry5Rot", - DDRotation(cutm.xx(), + DDRotationMatrix(cutm.xx(), cutm.xy(), cutm.xz(), cutm.yx(), @@ -390,9 +387,9 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext if (imax > 0) { // Loop over crystals in this row for (int irow(imin); irow <= imax; ++irow) { - // Create crystal as a DDEcalEndcapTrap object and calculate rotation and + // Create crystal as a DDEcalEndcapTrapX object and calculate rotation and // translation required to position it in the SC. - DDEcalEndcapTrap crystal(1, ee.crysFront, ee.crysRear, ee.crysLength); + DDEcalEndcapTrapX crystal(1, ee.crysFront, ee.crysRear, ee.crysLength); crystal.moveto(ee.cryFCtr[icol - 1][irow - 1], ee.cryRCtr[icol - 1][irow - 1]); @@ -434,9 +431,9 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext } } - // Create SC as a DDEcalEndcapTrap object and calculate rotation and + // Create SC as a DDEcalEndcapTrapX object and calculate rotation and // translation required to position it in the endcap. - DDEcalEndcapTrap scrys(1, ee.sCEFront, ee.sCERear, ee.sCELength); + DDEcalEndcapTrapX scrys(1, ee.sCEFront, ee.sCERear, ee.sCELength); scrys.moveto(ee.scrFCtr[icol - 1][irow - 1], ee.scrRCtr[icol - 1][irow - 1]); scrys.translate(DDTranslation(0., 0., -ee.zOff)); diff --git a/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc b/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc index d8890fe61370f..3d3f1447c0d69 100644 --- a/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc +++ b/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc @@ -7,6 +7,8 @@ #include "CLHEP/Geometry/Transform3D.h" #include "CLHEP/Vector/EulerAngles.h" +//#define EDM_ML_DEBUG + // Implementation of DDEcalEndcapTrap class DDEcalEndcapTrap::DDEcalEndcapTrap(const int hand, const double front, const double rear, const double length) { @@ -87,8 +89,7 @@ void DDEcalEndcapTrap::rotate(const DDTranslation& frontCentre, const DDTranslat // // Rotate supercrystal to bring front and rear face centres to specified points // - edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented" - << std::endl; + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::rotate(DDTranslation,DDTranslation) - not yet implemented"; } void DDEcalEndcapTrap::rotate(const DDRotationMatrix& rot) { @@ -98,12 +99,18 @@ void DDEcalEndcapTrap::rotate(const DDRotationMatrix& rot) { int icorner; DDTranslation cc; - // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::rotate - rotation " << rot; +#endif for (icorner = 1; icorner <= 8; icorner++) { cc = cornerPos(icorner); - // edm::LogInfo("EcalGeom") << " Corner (orig) " << icorner << cc << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (orig) " << icorner << cc; +#endif cc = rot * cc; - // edm::LogInfo("EcalGeom") << " Corner (rot) " << icorner << cc << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (rot) " << icorner << cc; +#endif cornerPos(icorner, cc); } m_rotation = rot * m_rotation; @@ -111,7 +118,9 @@ void DDEcalEndcapTrap::rotate(const DDRotationMatrix& rot) { } void DDEcalEndcapTrap::translate() { - // edm::LogInfo("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented" << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrap::translate() not yet implemented"; +#endif translate(-1. * centrePos()); } @@ -141,16 +150,20 @@ void DDEcalEndcapTrap::moveto(const DDTranslation& frontCentre, const DDTranslat double targetPhi = polarAngle(frontCentre - rearCentre); // Rotate to correct angle (X then Y) - // edm::LogInfo("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl; - // edm::LogInfo("EcalGeom") << "moveto: rearCentre " << rearCentre << std::endl; - // edm::LogInfo("EcalGeom") << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl; - // edm::LogInfo("EcalGeom") << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl + << "moveto: rearCentre " << rearCentre << std::endl + << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl + << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi; +#endif rotateX(targetTheta - currentTheta); rotateY(targetPhi - currentPhi); // Translate SC to final position DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre); - // edm::LogInfo("EcalGeom") << "moveto: translation " << targetCentre-centrePos() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre-centrePos(); +#endif translate(targetCentre - centrePos()); } @@ -274,12 +287,12 @@ void DDEcalEndcapTrap::print() { // // Print SC coordinates for debugging // - edm::LogInfo("EcalGeom") << "Endcap supercrystal" << std::endl; + edm::LogVerbatim("EcalGeom") << "Endcap supercrystal"; for (int ic = 1; ic <= 8; ic++) { DDTranslation cc = cornerPos(ic); - edm::LogInfo("EcalGeom") << "Corner " << ic << " " << cc << std::endl; + edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc; } - edm::LogInfo("EcalGeom") << " Centre " << centrePos() << std::endl; - edm::LogInfo("EcalGeom") << " fCentre " << fcentrePos() << std::endl; - edm::LogInfo("EcalGeom") << " rCentre " << rcentrePos() << std::endl; + edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl + << " fCentre " << fcentrePos() << std::endl + << " rCentre " << rcentrePos(); } diff --git a/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc b/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc new file mode 100644 index 0000000000000..5ce0b1803b831 --- /dev/null +++ b/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc @@ -0,0 +1,274 @@ +#include "Geometry/EcalCommonData/interface/DDEcalEndcapTrapX.h" +#include "CLHEP/Geometry/Transform3D.h" + +//#define EDM_ML_DEBUG +// Implementation of DDEcalEndcapTrapX class + +DDEcalEndcapTrapX::DDEcalEndcapTrapX(const int hand, const double front, const double rear, const double length) { + // + // Initialise corners of supercrystal. + + // Start out with bottom surface on (x,z) plane, front face in (x,y) plane. + + double xsign; + + if (hand == 2) { + xsign = -1.; + } else { + xsign = 1.; + } + + m_hand = hand; + m_front = front; + m_rear = rear; + m_length = length; + + int icorner; + icorner = 1; + m_corners[3 * icorner - 3] = xsign * front; + m_corners[3 * icorner - 2] = front; + m_corners[3 * icorner - 1] = 0.; + icorner = 2; + m_corners[3 * icorner - 3] = xsign * front; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = 0.; + icorner = 3; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = 0.; + icorner = 4; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = front; + m_corners[3 * icorner - 1] = 0.; + + icorner = 5; + m_corners[3 * icorner - 3] = xsign * rear; + m_corners[3 * icorner - 2] = rear; + m_corners[3 * icorner - 1] = length; + icorner = 6; + m_corners[3 * icorner - 3] = xsign * rear; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = length; + icorner = 7; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = 0.; + m_corners[3 * icorner - 1] = length; + icorner = 8; + m_corners[3 * icorner - 3] = 0.; + m_corners[3 * icorner - 2] = rear; + m_corners[3 * icorner - 1] = length; + + calculateCentres(); + + // Move centre of SC to (0,0,0) + + translate(); + + // Rotate into standard position (face centres on z axis) + + // this->rotate(); + + calculateCentres(); +} + +void DDEcalEndcapTrapX::rotate(const DDRotationMatrix& rot) { + // + // Rotate supercrystal by specified rotation about (0,0,0) + // + + int icorner; + DDTranslation cc; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrapX::rotate - rotation " << rot; +#endif + for (icorner = 1; icorner <= 8; icorner++) { + cc = cornerPos(icorner); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (orig) " << icorner << cc; +#endif + cc = rot * cc; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << " Corner (rot) " << icorner << cc; +#endif + cornerPos(icorner, cc); + } + m_rotation = rot * m_rotation; + calculateCentres(); +} + +void DDEcalEndcapTrapX::translate() { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "DDEcalEndcapTrapX::translate() not yet implemented"; +#endif + translate(-1. * centrePos()); +} + +void DDEcalEndcapTrapX::translate(const DDTranslation& trans) { + // + // Translate supercrystal by specified amount + // + + DDTranslation tcorner; + for (int icorner = 1; icorner <= 8; icorner++) { + tcorner = cornerPos(icorner) + trans; + cornerPos(icorner, tcorner); + } + calculateCentres(); + m_translation = trans + m_translation; +} + +void DDEcalEndcapTrapX::moveto(const DDTranslation& frontCentre, const DDTranslation& rearCentre) { + // + // Rotate (about X then about Y) and translate supercrystal to bring axis joining front and rear face centres parallel to line connecting specified points + // + + // Get azimuthal and polar angles of current axis and target axis + double currentTheta = elevationAngle(); + double currentPhi = polarAngle(); + double targetTheta = elevationAngle(frontCentre - rearCentre); + double targetPhi = polarAngle(frontCentre - rearCentre); + + // Rotate to correct angle (X then Y) +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl << "moveto: rearCentre " << rearCentre << std::endl << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl; +#endif + rotateX(targetTheta - currentTheta); + rotateY(targetPhi - currentPhi); + + // Translate SC to final position + DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre-centrePos(); +#endif + translate(targetCentre - centrePos()); +} + +void DDEcalEndcapTrapX::rotateX(const double angle) { + // + // Rotate SC through given angle about X axis + // + + const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(1., 0., 0.), angle); + + rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz())); +} + +void DDEcalEndcapTrapX::rotateY(const double angle) { + // + // Rotate SC through given angle about Y axis + // + const CLHEP::HepRotation tmp(CLHEP::Hep3Vector(0., 1., 0.), angle); + + rotate(DDRotationMatrix(tmp.xx(), tmp.xy(), tmp.xz(), tmp.yx(), tmp.yy(), tmp.yz(), tmp.zx(), tmp.zy(), tmp.zz())); +} + +void DDEcalEndcapTrapX::calculateCentres() { + // + // Calculate crystal centre and front & rear face centres + // + + int ixyz, icorner; + + for (ixyz = 0; ixyz < 3; ixyz++) { + m_centre[ixyz] = 0; + m_fcentre[ixyz] = 0; + m_rcentre[ixyz] = 0; + } + + for (icorner = 1; icorner <= 4; icorner++) { + for (ixyz = 0; ixyz < 3; ixyz++) { + m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz]; + m_fcentre[ixyz] = m_fcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz]; + } + } + for (icorner = 5; icorner <= 8; icorner++) { + for (ixyz = 0; ixyz < 3; ixyz++) { + m_centre[ixyz] = m_centre[ixyz] + 0.125 * m_corners[3 * icorner - 3 + ixyz]; + m_rcentre[ixyz] = m_rcentre[ixyz] + 0.25 * m_corners[3 * icorner - 3 + ixyz]; + } + } +} + +DDTranslation DDEcalEndcapTrapX::cornerPos(const int icorner) { + // + // Return specified corner as a Translation + // + return DDTranslation(m_corners[3 * icorner - 3], m_corners[3 * icorner - 2], m_corners[3 * icorner - 1]); +} + +void DDEcalEndcapTrapX::cornerPos(const int icorner, const DDTranslation& cornerxyz) { + // + // Save position of specified corner. + // + for (int ixyz = 0; ixyz < 3; ixyz++) { + m_corners[3 * icorner - 3 + ixyz] = (0 == ixyz ? cornerxyz.x() : (1 == ixyz ? cornerxyz.y() : cornerxyz.z())); + ; + } +} + +DDTranslation DDEcalEndcapTrapX::centrePos() { + // + // Return SC centre as a Translation + // + return DDTranslation(m_centre[0], m_centre[1], m_centre[2]); +} + +DDTranslation DDEcalEndcapTrapX::fcentrePos() { + // + // Return SC front face centre as a Translation + // + return DDTranslation(m_fcentre[0], m_fcentre[1], m_fcentre[2]); +} + +DDTranslation DDEcalEndcapTrapX::rcentrePos() { + // + // Return SC rear face centre as a Translation + // + return DDTranslation(m_rcentre[0], m_rcentre[1], m_rcentre[2]); +} + +double DDEcalEndcapTrapX::elevationAngle(const DDTranslation& trans) { + // + // Return elevation angle (out of x-z plane) of a given translation (seen as a vector from the origin). + // + double sintheta = trans.y() / trans.r(); + return asin(sintheta); +} + +double DDEcalEndcapTrapX::elevationAngle() { + // + // Return elevation angle (out of x-z plane) of SC in current position. + // + DDTranslation current = fcentrePos() - rcentrePos(); + return elevationAngle(current); +} + +double DDEcalEndcapTrapX::polarAngle(const DDTranslation& trans) { + // + // Return polar angle (from x to z) of a given translation (seen as a vector from the origin). + // + double tanphi = trans.x() / trans.z(); + return atan(tanphi); +} + +double DDEcalEndcapTrapX::polarAngle() { + // + // Return elevation angle (out of x-z plane) of SC in current position. + // + DDTranslation current = fcentrePos() - rcentrePos(); + return polarAngle(current); +} + +void DDEcalEndcapTrapX::print() { + // + // Print SC coordinates for debugging + // + edm::LogVerbatim("EcalGeom") << "Endcap supercrystal"; + for (int ic = 1; ic <= 8; ic++) { + DDTranslation cc = cornerPos(ic); + edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc << std::endl; + } + edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl + << " fCentre " << fcentrePos() << std::endl + << " rCentre " << rcentrePos(); +} From 8a39f7b431f002802b0833bb09875d420af350eb Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Sun, 2 May 2021 18:06:11 +0200 Subject: [PATCH 101/309] Code check --- .../plugins/dd4hep/DDEcalEndcapAlgo.cc | 22 +++++++++---------- .../EcalCommonData/src/DDEcalEndcapTrap.cc | 14 +++++++----- .../EcalCommonData/src/DDEcalEndcapTrapX.cc | 13 +++++++---- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc index 1df77ee052546..b612ed4406a08 100644 --- a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc +++ b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalEndcapAlgo.cc @@ -306,17 +306,17 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext const CLHEP::HepRotationZ cutm(ffived); DDRotationMatrix cutRot(5 != iSCType ? DDRotationMatrix() - : myrot(ns, - "EECry5Rot", - DDRotationMatrix(cutm.xx(), - cutm.xy(), - cutm.xz(), - cutm.yx(), - cutm.yy(), - cutm.yz(), - cutm.zx(), - cutm.zy(), - cutm.zz()))); + : myrot(ns, + "EECry5Rot", + DDRotationMatrix(cutm.xx(), + cutm.xy(), + cutm.xz(), + cutm.yx(), + cutm.yy(), + cutm.yz(), + cutm.zx(), + cutm.zy(), + cutm.zz()))); dd4hep::Solid eeCutEnv = dd4hep::SubtractionSolid(ee.envName + std::to_string(iSCType), ns.solid(ee.envName + std::to_string(iSCType) + "Tmp"), diff --git a/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc b/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc index 3d3f1447c0d69..6e8b2ba626315 100644 --- a/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc +++ b/Geometry/EcalCommonData/src/DDEcalEndcapTrap.cc @@ -152,9 +152,11 @@ void DDEcalEndcapTrap::moveto(const DDTranslation& frontCentre, const DDTranslat // Rotate to correct angle (X then Y) #ifdef EDM_ML_DEBUG edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl - << "moveto: rearCentre " << rearCentre << std::endl - << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl - << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi; + << "moveto: rearCentre " << rearCentre << std::endl + << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " + << targetTheta - currentTheta << std::endl + << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " + << " " << targetPhi - currentPhi; #endif rotateX(targetTheta - currentTheta); rotateY(targetPhi - currentPhi); @@ -162,7 +164,7 @@ void DDEcalEndcapTrap::moveto(const DDTranslation& frontCentre, const DDTranslat // Translate SC to final position DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre-centrePos(); + edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre - centrePos(); #endif translate(targetCentre - centrePos()); } @@ -293,6 +295,6 @@ void DDEcalEndcapTrap::print() { edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc; } edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl - << " fCentre " << fcentrePos() << std::endl - << " rCentre " << rcentrePos(); + << " fCentre " << fcentrePos() << std::endl + << " rCentre " << rcentrePos(); } diff --git a/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc b/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc index 5ce0b1803b831..7473b7043d6b7 100644 --- a/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc +++ b/Geometry/EcalCommonData/src/DDEcalEndcapTrapX.cc @@ -130,7 +130,12 @@ void DDEcalEndcapTrapX::moveto(const DDTranslation& frontCentre, const DDTransla // Rotate to correct angle (X then Y) #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl << "moveto: rearCentre " << rearCentre << std::endl << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " << targetTheta-currentTheta << std::endl << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " << " " << targetPhi-currentPhi << std::endl; + edm::LogVerbatim("EcalGeom") << "moveto: frontCentre " << frontCentre << std::endl + << "moveto: rearCentre " << rearCentre << std::endl + << "moveto: X rotation: " << targetTheta << " " << currentTheta << " " + << targetTheta - currentTheta << std::endl + << "moveto: Y rotation: " << targetPhi << " " << currentPhi << " " + << " " << targetPhi - currentPhi << std::endl; #endif rotateX(targetTheta - currentTheta); rotateY(targetPhi - currentPhi); @@ -138,7 +143,7 @@ void DDEcalEndcapTrapX::moveto(const DDTranslation& frontCentre, const DDTransla // Translate SC to final position DDTranslation targetCentre = 0.5 * (frontCentre + rearCentre); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre-centrePos(); + edm::LogVerbatim("EcalGeom") << "moveto: translation " << targetCentre - centrePos(); #endif translate(targetCentre - centrePos()); } @@ -269,6 +274,6 @@ void DDEcalEndcapTrapX::print() { edm::LogVerbatim("EcalGeom") << "Corner " << ic << " " << cc << std::endl; } edm::LogVerbatim("EcalGeom") << " Centre " << centrePos() << std::endl - << " fCentre " << fcentrePos() << std::endl - << " rCentre " << rcentrePos(); + << " fCentre " << fcentrePos() << std::endl + << " rCentre " << rcentrePos(); } From 06a32e92d5e08d2c396f11eff2e49fd74e75ac83 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Sun, 2 May 2021 19:56:36 +0200 Subject: [PATCH 102/309] Move vertices loop inside lambda --- .../src/HGVHistoProducerAlgo.cc | 400 +++++++++--------- 1 file changed, 190 insertions(+), 210 deletions(-) diff --git a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc index f03232dea756f..11cdacabd372a 100644 --- a/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc +++ b/Validation/HGCalValidation/src/HGVHistoProducerAlgo.cc @@ -1556,7 +1556,7 @@ void HGVHistoProducerAlgo::layerClusters_to_CaloParticles(const Histograms& hist for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { DetId rh_detid = hits_and_fractions[hitId].first; - auto rhFraction = hits_and_fractions[hitId].second; + const auto rhFraction = hits_and_fractions[hitId].second; std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid); const HGCRecHit* hit = itcheck->second; @@ -2367,13 +2367,15 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr } // end of loop through SimClusters } // end of loop through CaloParticles - auto apply_LCMultiplicity = [](const ticl::Trackster& trackster, - const std::vector<std::pair<DetId, float>>& hitsAndFractions) { - auto hits_and_fractions_norm = hitsAndFractions; - int iLC = 0; - for (auto& haf : hits_and_fractions_norm) { - haf.second /= trackster.vertex_multiplicity(iLC++); - } + auto apply_LCMultiplicity = [](const ticl::Trackster& trackster, const reco::CaloClusterCollection& layerClusters) { + std::vector<std::pair<DetId, float>> hits_and_fractions_norm; + int lcInTst = 0; + std::for_each(std::begin(trackster.vertices()), std::end(trackster.vertices()), [&](unsigned int idx) { + const auto fraction = 1.f / trackster.vertex_multiplicity(lcInTst++); + for (const auto& cell : layerClusters[idx].hitsAndFractions()) { + hits_and_fractions_norm.emplace_back(cell.first, cell.second * fraction); + } + }); return hits_and_fractions_norm; }; @@ -2398,175 +2400,166 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr std::unordered_map<unsigned, unsigned> occurrencesCPinTST; unsigned int numberOfNoiseHitsInTST = 0; unsigned int numberOfHaloHitsInTST = 0; - unsigned int numberOfHitsInTST = 0; - for (const auto lcId : tracksters[tstId].vertices()) { - const auto hits_and_fractions_norm = - apply_LCMultiplicity(tracksters[tstId], layerClusters[lcId].hitsAndFractions()); - //number of hits related to that cluster. - unsigned int numberOfHitsInLC = hits_and_fractions_norm.size(); - numberOfHitsInTST += numberOfHitsInLC; - std::unordered_map<unsigned, float> CPEnergyInLC; - - //hitsToCaloParticleId is a vector of ints, one for each rechit of the - //layer cluster under study. If negative, there is no simhit from any CaloParticle related. - //If positive, at least one CaloParticle has been found with matched simhit. - //In more detail: - // 1. hitsToCaloParticleId[hitId] = -3 - // TN: These represent Halo Cells(N) that have not been - // assigned to any CaloParticle (hence the T). - // 2. hitsToCaloParticleId[hitId] = -2 - // FN: There represent Halo Cells(N) that have been assigned - // to a CaloParticle (hence the F, since those should have not been marked as halo) - // 3. hitsToCaloParticleId[hitId] = -1 - // FP: These represent Real Cells(P) that have not been - // assigned to any CaloParticle (hence the F, since these are fakes) - // 4. hitsToCaloParticleId[hitId] >= 0 - // TP There represent Real Cells(P) that have been assigned - // to a CaloParticle (hence the T) - - std::vector<int> hitsToCaloParticleId(numberOfHitsInLC); - //det id of the first hit just to make the lcLayerId variable - //which maps the layers in -z: 0->51 and in +z: 52->103 - const auto firstHitDetId = hits_and_fractions_norm[0].first; - int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) + - layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; - - //Loop though the hits of the layer cluster under study - for (unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) { - DetId rh_detid = hits_and_fractions_norm[hitId].first; - auto rhFraction = hits_and_fractions_norm[hitId].second; - - //Since the hit is belonging to the layer cluster, it must also be in the rechits map. - std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid); - const HGCRecHit* hit = itcheck->second; + const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters); + const auto numberOfHitsInTST = tst_hitsAndFractions.size(); + + //hitsToCaloParticleId is a vector of ints, one for each rechit of the + //layer cluster under study. If negative, there is no simhit from any CaloParticle related. + //If positive, at least one CaloParticle has been found with matched simhit. + //In more detail: + // 1. hitsToCaloParticleId[hitId] = -3 + // TN: These represent Halo Cells(N) that have not been + // assigned to any CaloParticle (hence the T). + // 2. hitsToCaloParticleId[hitId] = -2 + // FN: There represent Halo Cells(N) that have been assigned + // to a CaloParticle (hence the F, since those should have not been marked as halo) + // 3. hitsToCaloParticleId[hitId] = -1 + // FP: These represent Real Cells(P) that have not been + // assigned to any CaloParticle (hence the F, since these are fakes) + // 4. hitsToCaloParticleId[hitId] >= 0 + // TP There represent Real Cells(P) that have been assigned + // to a CaloParticle (hence the T) + + std::vector<int> hitsToCaloParticleId(numberOfHitsInTST); + //Det id of the first hit just to make the lcLayerId variable + //which maps the layers in -z: 0->51 and in +z: 52->103 + const auto firstHitDetId = tst_hitsAndFractions[0].first; + int lcLayerId = + recHitTools_->getLayerWithOffset(firstHitDetId) + layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1; - //Make a map that will connect a detid (that belongs to a rechit of the layer cluster under study, - //no need to save others) with: - //1. the layer clusters that have rechits in that detid - //2. the fraction of the rechit of each layer cluster that contributes to that detid. - //So, something like: - //detid: (layer cluster 1, hit fraction) , (layer cluster 2, hit fraction), (layer cluster 3, hit fraction) ... - //here comparing with the calo particle map above the - auto hit_find_in_LC = detIdToTracksterId_Map.find(rh_detid); - if (hit_find_in_LC == detIdToTracksterId_Map.end()) { - detIdToTracksterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>(); - } - detIdToTracksterId_Map[rh_detid].emplace_back( - HGVHistoProducerAlgo::detIdInfoInTrackster{tstId, tstId, rhFraction}); + //Loop through the hits of the trackster under study + for (unsigned int hitId = 0; hitId < numberOfHitsInTST; hitId++) { + const auto rh_detid = tst_hitsAndFractions[hitId].first; + const auto rhFraction = tst_hitsAndFractions[hitId].second; + + //Since the hit is belonging to the layer cluster, it must also be in the rechits map. + std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid); + const HGCRecHit* hit = itcheck->second; - //Check whether the rechit of the layer cluster under study has a sim hit in the same cell. - auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); + //Make a map that will connect a detid (that belongs to a rechit of the layer cluster under study, + //no need to save others) with: + //1. the layer clusters that have rechits in that detid + //2. the fraction of the rechit of each layer cluster that contributes to that detid. + //So, something like: + //detid: (layer cluster 1, hit fraction) , (layer cluster 2, hit fraction), (layer cluster 3, hit fraction) ... + //here comparing with the calo particle map above the + auto hit_find_in_LC = detIdToTracksterId_Map.find(rh_detid); + if (hit_find_in_LC == detIdToTracksterId_Map.end()) { + detIdToTracksterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>(); + } + detIdToTracksterId_Map[rh_detid].emplace_back( + HGVHistoProducerAlgo::detIdInfoInTrackster{tstId, tstId, rhFraction}); - // if the fraction is zero or the hit does not belong to any calo - // particle, set the caloparticleId for the hit to -1 this will - // contribute to the number of noise hits + //Check whether the rechit of the layer cluster under study has a sim hit in the same cell. + auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); - // MR Remove the case in which the fraction is 0, since this could be a - // real hit that has been marked as halo. - if (rhFraction == 0.) { - hitsToCaloParticleId[hitId] = -2; - numberOfHaloHitsInTST++; - } - if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) { - hitsToCaloParticleId[hitId] -= 1; - } else { - auto maxCPEnergyInLC = 0.f; - auto maxCPId = -1; - for (auto& h : hit_find_in_CP->second) { - auto shared_fraction = std::min(rhFraction, h.fraction); - //We are in the case where there are calo particles with simhits connected via detid with the rechit under study - //So, from all layers clusters, find the rechits that are connected with a calo particle and save/calculate the - //energy of that calo particle as the sum over all rechits of the rechits energy weighted - //by the caloparticle's fraction related to that rechit. - CPEnergyInTST[h.clusterId] += shared_fraction * hit->energy(); - //Same but for layer clusters for the cell association per layer - CPEnergyInLC[h.clusterId] += shared_fraction * hit->energy(); - //Here cPOnLayer[caloparticle][layer] describe above is set. - //Here for Tracksters with matched rechit the CP fraction times hit energy is added and saved . - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].first += - shared_fraction * hit->energy(); - cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX; - //cpsInTrackster[trackster][CPids] - //Connects a Trackster with all related CaloParticles. - cpsInTrackster[tstId].emplace_back(h.clusterId, FLT_MAX); - //From all CaloParticles related to a layer cluster, he saves id and energy of the calo particle - //that after simhit-rechit matching in layer has the maximum energy. - if (shared_fraction > maxCPEnergyInLC) { - //energy is used only here. cpid is saved for Tracksters - maxCPEnergyInLC = CPEnergyInLC[h.clusterId]; - maxCPId = h.clusterId; - } + // if the fraction is zero or the hit does not belong to any calo + // particle, set the caloparticleId for the hit to -1 this will + // contribute to the number of noise hits + + // MR Remove the case in which the fraction is 0, since this could be a + // real hit that has been marked as halo. + if (rhFraction == 0.) { + hitsToCaloParticleId[hitId] = -2; + numberOfHaloHitsInTST++; + } + if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) { + hitsToCaloParticleId[hitId] -= 1; + } else { + auto maxCPEnergyInTST = 0.f; + auto maxCPId = -1; + for (const auto& h : hit_find_in_CP->second) { + auto shared_fraction = std::min(rhFraction, h.fraction); + //We are in the case where there are calo particles with simhits connected via detid with the rechit under study + //So, from all layers clusters, find the rechits that are connected with a calo particle and save/calculate the + //energy of that calo particle as the sum over all rechits of the rechits energy weighted + //by the caloparticle's fraction related to that rechit. + CPEnergyInTST[h.clusterId] += shared_fraction * hit->energy(); + //Here cPOnLayer[caloparticle][layer] describe above is set. + //Here for Tracksters with matched rechit the CP fraction times hit energy is added and saved . + cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].first += + shared_fraction * hit->energy(); + cPOnLayer[h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX; + //cpsInTrackster[trackster][CPids] + //Connects a Trackster with all related CaloParticles. + cpsInTrackster[tstId].emplace_back(h.clusterId, FLT_MAX); + //From all CaloParticles related to a layer cluster, he saves id and energy of the calo particle + //that after simhit-rechit matching in layer has the maximum energy. + if (shared_fraction > maxCPEnergyInTST) { + //energy is used only here. cpid is saved for Tracksters + maxCPEnergyInTST = CPEnergyInTST[h.clusterId]; + maxCPId = h.clusterId; } - //Keep in mind here maxCPId could be zero. So, below ask for negative not including zero to count noise. - hitsToCaloParticleId[hitId] = maxCPId; } + //Keep in mind here maxCPId could be zero. So, below ask for negative not including zero to count noise. + hitsToCaloParticleId[hitId] = maxCPId; + } - } //end of loop through rechits of the layer cluster. + } //end of loop through rechits of the layer cluster. - //Loop through all rechits to count how many of them are noise and how many are matched. - //In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle. - for (auto c : hitsToCaloParticleId) { - if (c < 0) { - numberOfNoiseHitsInTST++; - } else { - occurrencesCPinTST[c]++; - } + //Loop through all rechits to count how many of them are noise and how many are matched. + //In case of matched rechit-simhit, he counts and saves the number of rechits related to the maximum energy CaloParticle. + for (auto c : hitsToCaloParticleId) { + if (c < 0) { + numberOfNoiseHitsInTST++; + } else { + occurrencesCPinTST[c]++; } + } - //Below from all maximum energy CaloParticles, he saves the one with the largest amount - //of related rechits. - for (auto& c : occurrencesCPinTST) { - if (c.second > maxCPNumberOfHitsInTST) { - maxCPId_byNumberOfHits = c.first; - maxCPNumberOfHitsInTST = c.second; - } + //Below from all maximum energy CaloParticles, he saves the one with the largest amount + //of related rechits. + for (auto& c : occurrencesCPinTST) { + if (c.second > maxCPNumberOfHitsInTST) { + maxCPId_byNumberOfHits = c.first; + maxCPNumberOfHitsInTST = c.second; } + } - //Find the CaloParticle that has the maximum energy shared with the Trackster under study. - for (auto& c : CPEnergyInTST) { - if (c.second > maxEnergySharedTSTandCP) { - maxCPId_byEnergy = c.first; - maxEnergySharedTSTandCP = c.second; - } + //Find the CaloParticle that has the maximum energy shared with the Trackster under study. + for (auto& c : CPEnergyInTST) { + if (c.second > maxEnergySharedTSTandCP) { + maxCPId_byEnergy = c.first; + maxEnergySharedTSTandCP = c.second; } - //The energy of the CaloParticle that found to have the maximum energy shared with the Trackster under study. - float totalCPEnergyFromLayerCP = 0.f; - if (maxCPId_byEnergy >= 0) { - //Loop through all layers - for (unsigned int j = 0; j < layers * 2; ++j) { - totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; - } - energyFractionOfCPinTST = maxEnergySharedTSTandCP / totalCPEnergyFromLayerCP; - if (tracksters[tstId].raw_energy() > 0.f) { - energyFractionOfTSTinCP = maxEnergySharedTSTandCP / tracksters[tstId].raw_energy(); - } + } + //The energy of the CaloParticle that found to have the maximum energy shared with the Trackster under study. + float totalCPEnergyFromLayerCP = 0.f; + if (maxCPId_byEnergy >= 0) { + //Loop through all layers + for (unsigned int j = 0; j < layers * 2; ++j) { + totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][j].energy; + } + energyFractionOfCPinTST = maxEnergySharedTSTandCP / totalCPEnergyFromLayerCP; + if (tracksters[tstId].raw_energy() > 0.f) { + energyFractionOfTSTinCP = maxEnergySharedTSTandCP / tracksters[tstId].raw_energy(); } + } + + LogDebug("HGCalValidator") << std::setw(12) << "Trackster" + << "\t" //LogDebug("HGCalValidator") + << std::setw(10) << "mulcl energy" + << "\t" << std::setw(5) << "nhits" + << "\t" << std::setw(12) << "noise hits" + << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" + << "\t" << std::setw(8) << "nhitsCP" + << "\t" << std::setw(16) << "maxCPId_byEnergy" + << "\t" << std::setw(23) << "maxEnergySharedTSTandCP" + << "\t" << std::setw(22) << "totalCPEnergyFromAllLayerCP" + << "\t" << std::setw(22) << "energyFractionOfTSTinCP" + << "\t" << std::setw(25) << "energyFractionOfCPinTST" + << "\t" << std::endl; + LogDebug("HGCalValidator") << std::setw(12) << tstId << "\t" //LogDebug("HGCalValidator") + << std::setw(10) << tracksters[tstId].raw_energy() << "\t" << std::setw(5) + << numberOfHitsInTST << "\t" << std::setw(12) << numberOfNoiseHitsInTST << "\t" + << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) + << maxCPNumberOfHitsInTST << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" + << std::setw(23) << maxEnergySharedTSTandCP << "\t" << std::setw(22) + << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfTSTinCP << "\t" + << std::setw(25) << energyFractionOfCPinTST << std::endl; - LogDebug("HGCalValidator") << std::setw(12) << "Trackster" - << "\t" //LogDebug("HGCalValidator") - << std::setw(10) << "mulcl energy" - << "\t" << std::setw(5) << "nhits" - << "\t" << std::setw(12) << "noise hits" - << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" - << "\t" << std::setw(8) << "nhitsCP" - << "\t" << std::setw(16) << "maxCPId_byEnergy" - << "\t" << std::setw(23) << "maxEnergySharedTSTandCP" - << "\t" << std::setw(22) << "totalCPEnergyFromAllLayerCP" - << "\t" << std::setw(22) << "energyFractionOfTSTinCP" - << "\t" << std::setw(25) << "energyFractionOfCPinTST" - << "\t" << std::endl; - LogDebug("HGCalValidator") << std::setw(12) << tstId << "\t" //LogDebug("HGCalValidator") - << std::setw(10) << tracksters[tstId].raw_energy() << "\t" << std::setw(5) - << numberOfHitsInTST << "\t" << std::setw(12) << numberOfNoiseHitsInTST << "\t" - << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) - << maxCPNumberOfHitsInTST << "\t" << std::setw(16) << maxCPId_byEnergy << "\t" - << std::setw(23) << maxEnergySharedTSTandCP << "\t" << std::setw(22) - << totalCPEnergyFromLayerCP << "\t" << std::setw(22) << energyFractionOfTSTinCP << "\t" - << std::setw(25) << energyFractionOfCPinTST << std::endl; - - } //end of loop through Trackster's layerClusters - } //end of loop through Tracksters + } //end of loop through Tracksters //Loop through Tracksters for (unsigned int tstId = 0; tstId < nTracksters; ++tstId) { @@ -2591,51 +2584,45 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr continue; } - std::vector<std::pair<DetId, float>> hits_and_fractions_norm; + const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters); + ; // Compute the correct normalization float invTracksterEnergyWeight = 0.f; - for (const auto lcId : tracksters[tstId].vertices()) { - hits_and_fractions_norm = apply_LCMultiplicity(tracksters[tstId], layerClusters[lcId].hitsAndFractions()); - - for (auto const& haf : hits_and_fractions_norm) { - invTracksterEnergyWeight += - (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy()); - } + for (const auto& haf : tst_hitsAndFractions) { + invTracksterEnergyWeight += + (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy()); } invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight; - for ([[maybe_unused]] const auto lcId : tracksters[tstId].vertices()) { - unsigned int numberOfHitsInLC = hits_and_fractions_norm.size(); - for (unsigned int i = 0; i < numberOfHitsInLC; ++i) { - DetId rh_detid = hits_and_fractions_norm[i].first; - float rhFraction = hits_and_fractions_norm[i].second; - bool hitWithNoCP = false; - - auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); - if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) - hitWithNoCP = true; - auto itcheck = hitMap.find(rh_detid); - const HGCRecHit* hit = itcheck->second; - float hitEnergyWeight = hit->energy() * hit->energy(); + for (unsigned int i = 0; i < tst_hitsAndFractions.size(); ++i) { + const auto rh_detid = tst_hitsAndFractions[i].first; + const auto rhFraction = tst_hitsAndFractions[i].second; + bool hitWithNoCP = false; - for (auto& cpPair : cpsInTrackster[tstId]) { - float cpFraction = 0.f; - if (!hitWithNoCP) { - auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), - detIdToCaloParticleId_Map[rh_detid].end(), - HGVHistoProducerAlgo::detIdInfoInCluster{cpPair.first, 0.f}); - if (findHitIt != detIdToCaloParticleId_Map[rh_detid].end()) { - cpFraction = findHitIt->fraction; - } - } - if (cpPair.second == FLT_MAX) { - cpPair.second = 0.f; + auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid); + if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) + hitWithNoCP = true; + auto itcheck = hitMap.find(rh_detid); + const HGCRecHit* hit = itcheck->second; + float hitEnergyWeight = hit->energy() * hit->energy(); + + for (auto& cpPair : cpsInTrackster[tstId]) { + float cpFraction = 0.f; + if (!hitWithNoCP) { + auto findHitIt = std::find(detIdToCaloParticleId_Map[rh_detid].begin(), + detIdToCaloParticleId_Map[rh_detid].end(), + HGVHistoProducerAlgo::detIdInfoInCluster{cpPair.first, 0.f}); + if (findHitIt != detIdToCaloParticleId_Map[rh_detid].end()) { + cpFraction = findHitIt->fraction; } - cpPair.second += - (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invTracksterEnergyWeight; } - } //end of loop through rechits of layer cluster - } //end of loop through Trackster's layerClusters + if (cpPair.second == FLT_MAX) { + cpPair.second = 0.f; + } + cpPair.second += + (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invTracksterEnergyWeight; + } + } //end of loop through rechits of trackster //In case of a Trackster with some energy but none related CaloParticles print some info. if (cpsInTrackster[tstId].empty()) @@ -2643,27 +2630,20 @@ void HGVHistoProducerAlgo::tracksters_to_CaloParticles(const Histograms& histogr << "\t score \t-1" << "\n"; - auto score = std::min_element(std::begin(cpsInTrackster[tstId]), - std::end(cpsInTrackster[tstId]), - [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); + const auto score = std::min_element(std::begin(cpsInTrackster[tstId]), + std::end(cpsInTrackster[tstId]), + [](const auto& obj1, const auto& obj2) { return obj1.second < obj2.second; }); for (auto& cpPair : cpsInTrackster[tstId]) { - // LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId - // << "\t CP id: \t" << cpPair.first - // << "\t score \t" << cpPair.second - // << "\n"; LogDebug("HGCalValidator") << "Trackster Id: \t" << tstId << "\t CP id: \t" << cpPair.first << "\t score \t" << cpPair.second << std::endl; - if (cpPair.first == score->first) { - histograms.h_score_trackster2caloparticle[count]->Fill(score->second); - } float sharedeneCPallLayers = 0.; - //Loop through all layers for (unsigned int j = 0; j < layers * 2; ++j) { auto const& cp_linked = cPOnLayer[cpPair.first][j].layerClusterIdToEnergyAndScore[tstId]; sharedeneCPallLayers += cp_linked.first; - } //end of loop through layers + } LogDebug("HGCalValidator") << "sharedeneCPallLayers " << sharedeneCPallLayers << std::endl; if (cpPair.first == score->first) { + histograms.h_score_trackster2caloparticle[count]->Fill(score->second); histograms.h_sharedenergy_trackster2caloparticle[count]->Fill(sharedeneCPallLayers / tracksters[tstId].raw_energy()); histograms.h_energy_vs_score_trackster2caloparticle[count]->Fill( From 44593b5febad618660faf06ffe81919eb5a45e95 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 3 May 2021 01:46:57 +0200 Subject: [PATCH 103/309] Remove the HCAL option in the validation codes in HGCalValidation/test --- .../HGCalValidation/test/HGCGeometryCheck.cc | 55 +--- .../HGCalValidation/test/HGCHitValidation.cc | 238 +++++------------- .../HGCalValidation/test/HGCalDigiStudy.cc | 140 ++--------- .../HGCalValidation/test/HGCalRecHitStudy.cc | 141 +++-------- .../HGCalValidation/test/HGCalWaferStudy.cc | 4 - 5 files changed, 125 insertions(+), 453 deletions(-) diff --git a/Validation/HGCalValidation/test/HGCGeometryCheck.cc b/Validation/HGCalValidation/test/HGCGeometryCheck.cc index 96c2cd3a25bb4..a3335b9db0f14 100644 --- a/Validation/HGCalValidation/test/HGCGeometryCheck.cc +++ b/Validation/HGCalValidation/test/HGCGeometryCheck.cc @@ -9,10 +9,7 @@ #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/HcalCommonData/interface/HcalCellType.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/Event.h" @@ -26,7 +23,6 @@ #include "FWCore/Utilities/interface/EDGetToken.h" #include "SimDataFormats/ValidationFormats/interface/PHGCalValidInfo.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include <TH2.h> @@ -50,12 +46,10 @@ class HGCGeometryCheck : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o private: edm::EDGetTokenT<PHGCalValidInfo> g4Token_; std::vector<std::string> geometrySource_; - edm::ESGetToken<HcalDDDSimConstants, HcalSimNumberingRecord> tok_hrndc_; std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> > tok_hgcGeom_; //HGCal geometry scheme std::vector<const HGCalDDDConstants *> hgcGeometry_; - const HcalDDDSimConstants *hcons_; //histogram related stuff TH2F *heedzVsZ, *hefdzVsZ, *hebdzVsZ; @@ -65,19 +59,13 @@ class HGCGeometryCheck : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o static constexpr double mmTocm_ = 0.1; }; -HGCGeometryCheck::HGCGeometryCheck(const edm::ParameterSet &cfg) : hcons_(nullptr) { +HGCGeometryCheck::HGCGeometryCheck(const edm::ParameterSet &cfg) { usesResource(TFileService::kSharedResource); g4Token_ = consumes<PHGCalValidInfo>(cfg.getParameter<edm::InputTag>("g4Source")); geometrySource_ = cfg.getUntrackedParameter<std::vector<std::string> >("geometrySource"); - tok_hrndc_ = esConsumes<HcalDDDSimConstants, HcalSimNumberingRecord, edm::Transition::BeginRun>(); for (const auto &name : geometrySource_) { - if (name == "HCAL") - tok_hgcGeom_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", "HGCalHEScintillatorSensitive"})); - else - tok_hgcGeom_.emplace_back( - esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + tok_hgcGeom_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); } edm::LogVerbatim("HGCalValid") << "HGCGeometryCheck:: use information from " @@ -116,23 +104,12 @@ void HGCGeometryCheck::beginJob() { void HGCGeometryCheck::beginRun(const edm::Run &, const edm::EventSetup &iSetup) { //initiating hgc geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - edm::ESHandle<HcalDDDSimConstants> pHRNDC = iSetup.getHandle(tok_hrndc_); - if (pHRNDC.isValid()) { - hcons_ = &(*pHRNDC); - hgcGeometry_.push_back(nullptr); - edm::LogVerbatim("HGCalValid") << "Initialize geometry for " << geometrySource_[i]; - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for " << geometrySource_[i]; - } + edm::ESHandle<HGCalDDDConstants> hgcGeom = iSetup.getHandle(tok_hgcGeom_[i]); + if (hgcGeom.isValid()) { + hgcGeometry_.push_back(hgcGeom.product()); + edm::LogVerbatim("HGCalValid") << "Initialize geometry for " << geometrySource_[i]; } else { - edm::ESHandle<HGCalDDDConstants> hgcGeom = iSetup.getHandle(tok_hgcGeom_[i]); - if (hgcGeom.isValid()) { - hgcGeometry_.push_back(hgcGeom.product()); - edm::LogVerbatim("HGCalValid") << "Initialize geometry for " << geometrySource_[i]; - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i]; - } + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i]; } } } @@ -199,26 +176,8 @@ void HGCGeometryCheck::analyze(const edm::Event &iEvent, const edm::EventSetup & hebzVsLayer->Fill(layer, zz); hebrVsLayer->Fill(layer, rr); } - - } else if (hitDet.at(i) == (unsigned int)(DetId::Hcal)) { - int subdet, zside, depth, eta, phi, lay; - HcalTestNumbering::unpackHcalIndex(hitIdx.at(i), subdet, zside, depth, eta, phi, lay); - HcalCellType::HcalCell cell = hcons_->cell(subdet, zside, lay, eta, phi); - double zp = cell.rz / 10; //mm --> cm - if (zside == 0) - zp = -zp; -#ifdef EDM_ML_DEBUG - edm::LogVerbatim("HGCalValid") << "Info[" << i << "] Detector Information " << hitDet[i] << ":" << subdet << ":" - << zside << ":" << depth << ":" << eta << ":" << phi << ":" << lay << " z " << zp - << ":" << zz << " R " << rr; -#endif - hebdzVsZ->Fill(zp, (zz - zp)); - hebzVsLayer->Fill(lay, zz); - hebrVsLayer->Fill(lay, rr); } - } //end G4 hits - } else { edm::LogWarning("HGCalValid") << "No PHGCalInfo " << std::endl; } diff --git a/Validation/HGCalValidation/test/HGCHitValidation.cc b/Validation/HGCalValidation/test/HGCHitValidation.cc index 3a5793a28dd38..e9778e9056812 100644 --- a/Validation/HGCalValidation/test/HGCHitValidation.cc +++ b/Validation/HGCalValidation/test/HGCHitValidation.cc @@ -20,21 +20,11 @@ #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/HcalCommonData/interface/HcalCellType.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" @@ -56,7 +46,6 @@ #include "SimG4CMS/Calo/interface/HGCNumberingScheme.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include <TH1.h> @@ -99,12 +88,9 @@ class HGCHitValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o //HGC Geometry std::vector<const HGCalDDDConstants *> hgcCons_; std::vector<const HGCalGeometry *> hgcGeometry_; - const HcalDDDSimConstants *hcCons_; - const HcalDDDRecConstants *hcConr_; - const CaloSubdetectorGeometry *hcGeometry_; std::vector<std::string> geometrySource_; std::vector<int> ietaExcludeBH_; - bool ifHCAL_, ifHcalG_, makeTree_; + bool makeTree_; edm::InputTag eeSimHitSource, fhSimHitSource, bhSimHitSource; edm::EDGetTokenT<std::vector<PCaloHit>> eeSimHitToken_; @@ -113,10 +99,6 @@ class HGCHitValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o edm::EDGetTokenT<HGCeeRecHitCollection> eeRecHitToken_; edm::EDGetTokenT<HGChefRecHitCollection> fhRecHitToken_; edm::EDGetTokenT<HGChebRecHitCollection> bhRecHitTokeng_; - edm::EDGetTokenT<HBHERecHitCollection> bhRecHitTokenh_; - edm::ESGetToken<HcalDDDSimConstants, HcalSimNumberingRecord> tok_hcals_; - edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcalr_; - edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_caloG_; std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord>> tok_hgcal_; std::vector<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>> tok_hgcalg_; @@ -141,8 +123,7 @@ class HGCHitValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o TH1F *hefEnSim_, *heeEnRec_, *heeEnSim_; }; -HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) - : hcCons_(nullptr), hcConr_(nullptr), hcGeometry_(nullptr), ifHcalG_(false) { +HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) { usesResource(TFileService::kSharedResource); geometrySource_ = cfg.getUntrackedParameter<std::vector<std::string>>("geometrySource"); @@ -160,26 +141,10 @@ HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) eeRecHitToken_ = consumes<HGCeeRecHitCollection>(eeRecHitSource); fhRecHitToken_ = consumes<HGChefRecHitCollection>(fhRecHitSource); ietaExcludeBH_ = cfg.getParameter<std::vector<int>>("ietaExcludeBH"); - ifHCAL_ = cfg.getParameter<bool>("ifHCAL"); - if (ifHCAL_) - bhRecHitTokenh_ = consumes<HBHERecHitCollection>(bhRecHitSource); - else - bhRecHitTokeng_ = consumes<HGChebRecHitCollection>(bhRecHitSource); - tok_hcals_ = esConsumes<HcalDDDSimConstants, HcalSimNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{}); - tok_hcalr_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{}); - tok_caloG_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{}); + bhRecHitTokeng_ = consumes<HGChebRecHitCollection>(bhRecHitSource); for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - tok_hgcal_.emplace_back( - esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{})); - tok_hgcalg_.emplace_back( - esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{})); - } else { - tok_hgcal_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", geometrySource_[i]})); - tok_hgcalg_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", geometrySource_[i]})); - } + tok_hgcal_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", geometrySource_[i]})); + tok_hgcalg_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", geometrySource_[i]})); } makeTree_ = cfg.getUntrackedParameter<bool>("makeTree", true); @@ -203,7 +168,7 @@ HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) hefEnSim_ = heeEnRec_ = heeEnSim_ = nullptr; edm::LogVerbatim("HGCalValid") << "MakeTree Flag set to " << makeTree_ << " and use " << geometrySource_.size() - << " Geometry sources and HCAL flag " << ifHCAL_; + << " Geometry sources"; for (auto const &s : geometrySource_) edm::LogVerbatim("HGCalValid") << " " << s; edm::LogVerbatim("HGCalValid") << "SimHit labels: " << eeSimHitSource << " " << fhSimHitSource << " " @@ -228,7 +193,6 @@ void HGCHitValidation::fillDescriptions(edm::ConfigurationDescriptions &descript desc.add<edm::InputTag>("fhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEFRecHits")); desc.add<edm::InputTag>("bhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEBRecHits")); desc.add<std::vector<int>>("ietaExcludeBH", etas); - desc.add<bool>("ifHCAL", false); descriptions.add("hgcHitAnalysis", desc); } @@ -304,46 +268,18 @@ void HGCHitValidation::beginJob() { void HGCHitValidation::beginRun(edm::Run const &iRun, edm::EventSetup const &iSetup) { //initiating hgc Geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - edm::LogVerbatim("HGCalValid") << "Tries to initialize HcalGeometry " - << " and HcalDDDSimConstants for " << i; - ifHcalG_ = true; - edm::ESHandle<HcalDDDSimConstants> pHSNDC = iSetup.getHandle(tok_hcals_); - if (pHSNDC.isValid()) { - hcCons_ = pHSNDC.product(); - hgcCons_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDSimConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle<HcalDDDRecConstants> pHRNDC = iSetup.getHandle(tok_hcalr_); - if (pHRNDC.isValid()) { - hcConr_ = pHRNDC.product(); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDRecConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle<CaloGeometry> caloG = iSetup.getHandle(tok_caloG_); - if (caloG.isValid()) { - const CaloGeometry *geo = caloG.product(); - hcGeometry_ = geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); - hgcGeometry_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for " << geometrySource_[i] << std::endl; - } + edm::LogVerbatim("HGCalValid") << "Tries to initialize HGCalGeometry and HGCalDDDConstants for " << i; + edm::ESHandle<HGCalDDDConstants> hgcCons = iSetup.getHandle(tok_hgcal_[i]); + if (hgcCons.isValid()) { + hgcCons_.push_back(hgcCons.product()); } else { - edm::LogVerbatim("HGCalValid") << "Tries to initialize HGCalGeometry " - << " and HGCalDDDConstants for " << i; - edm::ESHandle<HGCalDDDConstants> hgcCons = iSetup.getHandle(tok_hgcal_[i]); - if (hgcCons.isValid()) { - hgcCons_.push_back(hgcCons.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; - } - edm::ESHandle<HGCalGeometry> hgcGeom = iSetup.getHandle(tok_hgcalg_[i]); - if (hgcGeom.isValid()) { - hgcGeometry_.push_back(hgcGeom.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; - } + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; + } + edm::ESHandle<HGCalGeometry> hgcGeom = iSetup.getHandle(tok_hgcalg_[i]); + if (hgcGeom.isValid()) { + hgcGeometry_.push_back(hgcGeom.product()); + } else { + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; } } } @@ -388,44 +324,10 @@ void HGCHitValidation::analyze(const edm::Event &iEvent, const edm::EventSetup & edm::Handle<std::vector<PCaloHit>> bhSimHits; iEvent.getByToken(bhSimHitToken_, bhSimHits); if (bhSimHits.isValid()) { - if (ifHcalG_) { - for (std::vector<PCaloHit>::const_iterator simHit = bhSimHits->begin(); simHit != bhSimHits->end(); ++simHit) { - int subdet, z, depth, eta, phi, lay; - HcalTestNumbering::unpackHcalIndex(simHit->id(), subdet, z, depth, eta, phi, lay); - - if (subdet == static_cast<int>(HcalEndcap)) { - HcalCellType::HcalCell cell = hcCons_->cell(subdet, z, lay, eta, phi); - double zp = cell.rz / 10; - - HcalDDDRecConstants::HcalID idx = hcConr_->getHCID(subdet, eta, phi, lay, depth); - int sign = (z == 0) ? (-1) : (1); - zp *= sign; - HcalDetId id = HcalDetId(HcalEndcap, sign * idx.eta, idx.phi, idx.depth); - - float energy = simHit->energy(); - float energySum(0); - if (bhHitRefs.count(id.rawId()) != 0) - energySum = std::get<0>(bhHitRefs[id.rawId()]); - energySum += energy; - if (!makeTree_) - hebEnSim_->Fill(energy); - if (std::find(ietaExcludeBH_.begin(), ietaExcludeBH_.end(), idx.eta) == ietaExcludeBH_.end()) { - bhHitRefs[id.rawId()] = std::make_tuple(energySum, cell.eta, cell.phi, zp); - edm::LogVerbatim("HGCalValid") << "Accept " << id << std::endl; - } else { - edm::LogVerbatim("HGCalValid") << "Rejected cell " << idx.eta << "," << id << std::endl; - } - } - } - } else { - analyzeHGCalSimHit(bhSimHits, 2, hebEnSim_, bhHitRefs); - } + analyzeHGCalSimHit(bhSimHits, 2, hebEnSim_, bhHitRefs); for (std::map<unsigned int, HGCHitTuple>::iterator itr = bhHitRefs.begin(); itr != bhHitRefs.end(); ++itr) { int idx = std::distance(bhHitRefs.begin(), itr); - edm::LogVerbatim("HGCalValid") << "BHHit[" << idx << "] " << std::hex << itr->first << std::dec << "; Energy " - << std::get<0>(itr->second) << "; Position" - << " (" << std::get<1>(itr->second) << ", " << std::get<2>(itr->second) << ", " - << std::get<3>(itr->second) << ")"; + edm::LogVerbatim("HGCalValid") << "BHHit[" << idx << "] " << std::hex << itr->first << std::dec << "; Energy " << std::get<0>(itr->second) << "; Position (" << std::get<1>(itr->second) << ", " << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ")"; } } else { edm::LogWarning("HGCalValid") << "No BH SimHit Found " << std::endl; @@ -514,24 +416,13 @@ void HGCHitValidation::analyze(const edm::Event &iEvent, const edm::EventSetup & } //accessing BH Rechit information - if (ifHCAL_) { - edm::Handle<HBHERecHitCollection> bhRecHit; - iEvent.getByToken(bhRecHitTokenh_, bhRecHit); - if (bhRecHit.isValid()) { - const HBHERecHitCollection *theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogWarning("HGCalValid") << "No BH RecHit Found " << std::endl; - } + edm::Handle<HGChebRecHitCollection> bhRecHit; + iEvent.getByToken(bhRecHitTokeng_, bhRecHit); + if (bhRecHit.isValid()) { + const HGChebRecHitCollection *theHits = (bhRecHit.product()); + analyzeHGCalRecHit(theHits, bhHitRefs); } else { - edm::Handle<HGChebRecHitCollection> bhRecHit; - iEvent.getByToken(bhRecHitTokeng_, bhRecHit); - if (bhRecHit.isValid()) { - const HGChebRecHitCollection *theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogWarning("HGCalValid") << "No BH RecHit Found " << std::endl; - } + edm::LogWarning("HGCalValid") << "No BH RecHit Found " << std::endl; } if (makeTree_) { @@ -646,48 +537,45 @@ template <class T1> void HGCHitValidation::analyzeHGCalRecHit(T1 const &theHits, std::map<unsigned int, HGCHitTuple> const &hitRefs) { for (auto it = theHits->begin(); it != theHits->end(); ++it) { DetId id = it->id(); - bool ok = (ifHCAL_) ? (id.subdetId() == (int)(HcalEndcap)) : true; - if (ok) { - double energy = it->energy(); - if (!makeTree_) - hebEnRec_->Fill(energy); - GlobalPoint xyz = (ifHcalG_ ? (hcGeometry_->getGeometry(id)->getPosition()) : (hgcGeometry_[2]->getPosition(id))); - - std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(id.rawId()); - if (itr != hitRefs.end()) { - float ang3 = xyz.phi().value(); // returns the phi in radians - double fac = sinh(std::get<1>(itr->second)); - double pT = std::get<3>(itr->second) / fac; - double xp = pT * cos(std::get<2>(itr->second)); - double yp = pT * sin(std::get<2>(itr->second)); - if (makeTree_) { - hebRecX_->push_back(xyz.x()); - hebRecY_->push_back(xyz.y()); - hebRecZ_->push_back(xyz.z()); - hebRecEnergy_->push_back(energy); - hebSimX_->push_back(xp); - hebSimY_->push_back(yp); - hebSimZ_->push_back(std::get<3>(itr->second)); - hebSimEnergy_->push_back(std::get<0>(itr->second)); - hebSimEta_->push_back(std::get<1>(itr->second)); - hebRecEta_->push_back(xyz.eta()); - hebSimPhi_->push_back(std::get<2>(itr->second)); - hebRecPhi_->push_back(ang3); - hebDetID_->push_back(itr->first); - } else { - hebRecVsSimX_->Fill(xp, xyz.x()); - hebRecVsSimY_->Fill(yp, xyz.y()); - hebRecVsSimZ_->Fill(std::get<3>(itr->second), xyz.z()); - hebdEtaVsEta_->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); - hebdPhiVsPhi_->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); - hebdzVsZ_->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); - hebEnSimRec_->Fill(std::get<0>(itr->second), energy); - } - edm::LogVerbatim("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" - << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " - << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" - << energy << ", " << xyz.eta() << ", " << ang3 << ", " << xyz.z() << ")"; + double energy = it->energy(); + if (!makeTree_) + hebEnRec_->Fill(energy); + GlobalPoint xyz = hgcGeometry_[2]->getPosition(id); + + std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(id.rawId()); + if (itr != hitRefs.end()) { + float ang3 = xyz.phi().value(); // returns the phi in radians + double fac = sinh(std::get<1>(itr->second)); + double pT = std::get<3>(itr->second) / fac; + double xp = pT * cos(std::get<2>(itr->second)); + double yp = pT * sin(std::get<2>(itr->second)); + if (makeTree_) { + hebRecX_->push_back(xyz.x()); + hebRecY_->push_back(xyz.y()); + hebRecZ_->push_back(xyz.z()); + hebRecEnergy_->push_back(energy); + hebSimX_->push_back(xp); + hebSimY_->push_back(yp); + hebSimZ_->push_back(std::get<3>(itr->second)); + hebSimEnergy_->push_back(std::get<0>(itr->second)); + hebSimEta_->push_back(std::get<1>(itr->second)); + hebRecEta_->push_back(xyz.eta()); + hebSimPhi_->push_back(std::get<2>(itr->second)); + hebRecPhi_->push_back(ang3); + hebDetID_->push_back(itr->first); + } else { + hebRecVsSimX_->Fill(xp, xyz.x()); + hebRecVsSimY_->Fill(yp, xyz.y()); + hebRecVsSimZ_->Fill(std::get<3>(itr->second), xyz.z()); + hebdEtaVsEta_->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); + hebdPhiVsPhi_->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); + hebdzVsZ_->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); + hebEnSimRec_->Fill(std::get<0>(itr->second), energy); } + edm::LogVerbatim("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" + << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " + << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" + << energy << ", " << xyz.eta() << ", " << ang3 << ", " << xyz.z() << ")"; } } } diff --git a/Validation/HGCalValidation/test/HGCalDigiStudy.cc b/Validation/HGCalValidation/test/HGCalDigiStudy.cc index 4d29fd598c75a..86c67467a0940 100644 --- a/Validation/HGCalValidation/test/HGCalDigiStudy.cc +++ b/Validation/HGCalValidation/test/HGCalDigiStudy.cc @@ -9,23 +9,13 @@ #include "TH2D.h" #include "TH1D.h" -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" -#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" -#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" -#include "CondFormats/HcalObjects/interface/HcalQIEShape.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/ForwardDetId/interface/HFNoseDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" -#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" @@ -43,10 +33,6 @@ #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" @@ -81,15 +67,12 @@ class HGCalDigiStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one // ----------member data --------------------------- const std::string nameDetector_; const edm::InputTag source_; - const bool ifNose_, ifHCAL_, ifLayer_; + const bool ifNose_, ifLayer_; const int verbosity_, SampleIndx_, nbinR_, nbinZ_, nbinEta_, nLayers_; const double rmin_, rmax_, zmin_, zmax_, etamin_, etamax_; edm::EDGetToken digiSource_; - edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_caloGeom_; edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> tok_hgcGeom_; - edm::ESGetToken<HcalDbService, HcalDbRecord> tok_cond_; const HGCalGeometry* hgcGeom_; - const HcalGeometry* hcGeom_; int layers_, layerFront_, geomType_; TH1D *h_Charge_, *h_ADC_, *h_LayZp_, *h_LayZm_; TH2D *h_RZ_, *h_EtaPhi_; @@ -101,7 +84,6 @@ HGCalDigiStudy::HGCalDigiStudy(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter<std::string>("detectorName")), source_(iConfig.getParameter<edm::InputTag>("digiSource")), ifNose_(iConfig.getUntrackedParameter<bool>("ifNose", false)), - ifHCAL_(iConfig.getUntrackedParameter<bool>("ifHCAL", false)), ifLayer_(iConfig.getUntrackedParameter<bool>("ifLayer", false)), verbosity_(iConfig.getUntrackedParameter<int>("verbosity", 0)), SampleIndx_(iConfig.getUntrackedParameter<int>("sampleIndex", 5)), @@ -114,30 +96,20 @@ HGCalDigiStudy::HGCalDigiStudy(const edm::ParameterSet& iConfig) zmin_(iConfig.getUntrackedParameter<double>("zMin", 300.0)), zmax_(iConfig.getUntrackedParameter<double>("zMax", 600.0)), etamin_(iConfig.getUntrackedParameter<double>("etaMin", 1.0)), - etamax_(iConfig.getUntrackedParameter<double>("etaMax", 3.0)), - hcGeom_(nullptr) { + etamax_(iConfig.getUntrackedParameter<double>("etaMax", 3.0)) { usesResource(TFileService::kSharedResource); if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive") || (nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { digiSource_ = consumes<HGCalDigiCollection>(source_); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - digiSource_ = consumes<QIE11DigiCollection>(source_); - else - digiSource_ = consumes<HGCalDigiCollection>(source_); } else { throw cms::Exception("BadHGCDigiSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " << "\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\", " - << "or \"HCal\"!"; + << "\"HGCalHEScintillatorSensitive\", or \"HGCalHFNoseSensitive\",!"; } edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: request for Digi " << "collection " << source_ << " for " << nameDetector_; - tok_caloGeom_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>(); - tok_hgcGeom_ = - esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); - tok_cond_ = esConsumes<HcalDbService, HcalDbRecord>(); + tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); } void HGCalDigiStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -145,7 +117,6 @@ void HGCalDigiStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptio desc.add<std::string>("detectorName", "HGCalEESensitive"); desc.add<edm::InputTag>("digiSource", edm::InputTag("simHGCalUnsuppressedDigis", "EE")); desc.addUntracked<bool>("ifNose", false); - desc.addUntracked<bool>("ifHCAL", false); desc.addUntracked<bool>("ifLayer", false); desc.addUntracked<int>("verbosity", 0); desc.addUntracked<int>("sampleIndex", 0); @@ -211,7 +182,7 @@ void HGCalDigiStudy::beginJob() { hname << "LY_" << nameDetector_; title << "Layer number for " << nameDetector_; h_Ly_ = fs->make<TH1D>(hname.str().c_str(), title.str().c_str(), 200, 0, 100); - if ((nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HCal")) { + if (nameDetector_ == "HGCalHEScintillatorSensitive") { hname.str(""); title.str(""); hname << "IR_" << nameDetector_; @@ -247,36 +218,21 @@ void HGCalDigiStudy::beginJob() { } void HGCalDigiStudy::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (nameDetector_ == "HCal") { - edm::ESHandle<CaloGeometry> geom = iSetup.getHandle(tok_caloGeom_); - if (!geom.isValid()) - edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: Cannot get " - << "valid Geometry Object for " << nameDetector_; - hcGeom_ = static_cast<const HcalGeometry*>((geom.product())->getSubdetectorGeometry(DetId::Hcal, HcalBarrel)); - hgcGeom_ = nullptr; - layers_ = hcGeom_->topology().maxDepthHE(); - layerFront_ = 40; + edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); + if (!geom.isValid()) + edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: Cannot get " + << "valid Geometry Object for " << nameDetector_; + hgcGeom_ = geom.product(); + layerFront_ = hgcGeom_->topology().dddConstants().firstLayer(); + layers_ = hgcGeom_->topology().dddConstants().layers(true); + if (hgcGeom_->topology().waferHexagon8()) + geomType_ = 1; + else if (hgcGeom_->topology().tileTrapezoid()) + geomType_ = 2; + else geomType_ = 0; - } else { - edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); - if (!geom.isValid()) - edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: Cannot get " - << "valid Geometry Object for " << nameDetector_; - hgcGeom_ = geom.product(); - layerFront_ = 0; - layers_ = hgcGeom_->topology().dddConstants().layers(true); - if (hgcGeom_->topology().waferHexagon8()) - geomType_ = 1; - else if (hgcGeom_->topology().tileTrapezoid()) - geomType_ = 2; - else - geomType_ = 0; - if (nameDetector_ == "HGCalHFNoseSensitive") { - geomType_ = 3; - } else if (nameDetector_ != "HGCalEESensitive") { - layerFront_ = 28; - } - } + if (nameDetector_ == "HGCalHFNoseSensitive") + geomType_ = 3; edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: gets Geometry for " << nameDetector_ << " of type " << geomType_ << " with " << layers_ << " layers and front layer " << layerFront_; } @@ -371,63 +327,7 @@ void HGCalDigiStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } } else { edm::LogVerbatim("HGCalValidation") - << "DigiCollection handle " << source_ << " does not exist for " << nameDetector_ << " !!!"; - } - } else if ((nameDetector_ == "HCal") && (!ifHCAL_)) { - //HGCalBH - edm::Handle<HGCalDigiCollection> theHGCBHDigiContainer; - iEvent.getByToken(digiSource_, theHGCBHDigiContainer); - if (theHGCBHDigiContainer.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theHGCBHDigiContainer->size() << " element(s)"; - for (const auto& it : *(theHGCBHDigiContainer.product())) { - ntot++; - nused++; - HcalDetId detId = it.id(); - int layer = detId.depth(); - const HGCSample& hgcSample = it.sample(SampleIndx_); - uint16_t adc = hgcSample.data(); - double charge = adc; - // uint16_t gain = hgcSample.toa(); - // double charge = adc*gain; - digiValidation(detId, hcGeom_, layer, adc, charge); - } - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle " << source_ << " does not exist for " - << nameDetector_ << " !!!"; - } - } else if (nameDetector_ == "HCal") { - //HE - edm::Handle<QIE11DigiCollection> theHEDigiContainer; - iEvent.getByToken(digiSource_, theHEDigiContainer); - if (theHEDigiContainer.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << theHEDigiContainer->size() << " element(s)"; - edm::ESHandle<HcalDbService> conditions = iSetup.getHandle(tok_cond_); - - for (const auto& it : *(theHEDigiContainer.product())) { - QIE11DataFrame df(it); - HcalDetId detId = (df.id()); - ntot++; - if (detId.subdet() == HcalEndcap) { - nused++; - HcalCalibrations calibrations = conditions->getHcalCalibrations(detId); - const HcalQIECoder* channelCoder = conditions->getHcalCoder(detId); - const HcalQIEShape* shape = conditions->getHcalShape(channelCoder); - HcalCoderDb coder(*channelCoder, *shape); - CaloSamples tool; - coder.adc2fC(df, tool); - int layer = detId.depth(); - uint16_t adc = (df)[SampleIndx_].adc(); - int capid = (df)[SampleIndx_].capid(); - double charge = (tool[SampleIndx_] - calibrations.pedestal(capid)); - digiValidation(detId, hcGeom_, layer, adc, charge); - } - } - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle " << source_ << " does not exist for " - << nameDetector_ << " !!!"; + << "DigiCollection handle " << source_ << " does not exist for " << nameDetector_ << " !!!"; } } else { edm::LogWarning("HGCalValidation") << "invalid detector name !! " << nameDetector_ << " source " << source_; diff --git a/Validation/HGCalValidation/test/HGCalRecHitStudy.cc b/Validation/HGCalValidation/test/HGCalRecHitStudy.cc index f5d0e61809b12..4be4bbef94fdf 100644 --- a/Validation/HGCalValidation/test/HGCalRecHitStudy.cc +++ b/Validation/HGCalValidation/test/HGCalRecHitStudy.cc @@ -26,17 +26,10 @@ #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "TH1D.h" #include "TH2D.h" @@ -78,11 +71,9 @@ class HGCalRecHitStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o // ----------member data --------------------------- const std::string nameDetector_; edm::EDGetToken recHitSource_; - edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcaldd_; edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> tok_hgcaldd_; - edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_caloGeom_; edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> tok_hgcGeom_; - const bool ifNose_, ifHCAL_, ifLayer_; + const bool ifNose_, ifLayer_; const int verbosity_, nbinR_, nbinZ_, nbinEta_, nLayers_; const double rmin_, rmax_, zmin_, zmax_, etamin_, etamax_; unsigned int layers_; @@ -98,7 +89,6 @@ class HGCalRecHitStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o HGCalRecHitStudy::HGCalRecHitStudy(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter<std::string>("detectorName")), ifNose_(iConfig.getUntrackedParameter<bool>("ifNose", false)), - ifHCAL_(iConfig.getUntrackedParameter<bool>("ifHCAL", false)), ifLayer_(iConfig.getUntrackedParameter<bool>("ifLayer", false)), verbosity_(iConfig.getUntrackedParameter<int>("verbosity", 0)), nbinR_(iConfig.getUntrackedParameter<int>("nBinR", 300)), @@ -119,25 +109,15 @@ HGCalRecHitStudy::HGCalRecHitStudy(const edm::ParameterSet& iConfig) if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive") || (nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { recHitSource_ = consumes<HGCRecHitCollection>(temp); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - recHitSource_ = consumes<HBHERecHitCollection>(temp); - else - recHitSource_ = consumes<HGCRecHitCollection>(temp); } else { throw cms::Exception("BadHGCRecHitSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " - << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", or \"HCal\"!"; + << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", or " + << "\"HGCalHEScintillatorSensitive\"!"; } edm::LogVerbatim("HGCalValidation") << "Initialize HGCalRecHitStudy for " << nameDetector_ << " with i/p tag " << temp - << " Flag " << ifHCAL_ << ":" << ifNose_ << ":" << verbosity_; - tok_hcaldd_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(); - tok_caloGeom_ = esConsumes<CaloGeometry, CaloGeometryRecord>(); - if (nameDetector_ != "HCal") { - tok_hgcaldd_ = esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", nameDetector_}); - tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameDetector_}); - } + << " Flag " << ifNose_ << ":" << verbosity_; + tok_hgcaldd_ = esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); + tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameDetector_}); } void HGCalRecHitStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -145,7 +125,6 @@ void HGCalRecHitStudy::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add<std::string>("detectorName", "HGCalEESensitive"); desc.add<edm::InputTag>("source", edm::InputTag("HGCalRecHit", "HGCEERecHits")); desc.addUntracked<bool>("ifNose", false); - desc.addUntracked<bool>("ifHCAL", false); desc.addUntracked<bool>("ifLayer", false); desc.addUntracked<int>("verbosity", 0); desc.addUntracked<int>("nBinR", 300); @@ -167,76 +146,32 @@ void HGCalRecHitStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& bool ok(true); unsigned int ntot(0), nused(0); - if (nameDetector_ == "HCal") { - edm::ESHandle<CaloGeometry> geom = iSetup.getHandle(tok_caloGeom_); - if (!geom.isValid()) - edm::LogWarning("HGCalValidation") << "Cannot get valid HGCalGeometry Object for " << nameDetector_; - const CaloGeometry* geom0 = geom.product(); - - if (ifHCAL_) { - edm::Handle<HBHERecHitCollection> hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - if (detId.subdetId() == static_cast<int>(HcalEndcap)) { - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } - } else { - ok = false; - edm::LogWarning("HGCalValidation") << "HBHERecHitCollection Handle does not exist !!!"; - } - } else { - edm::Handle<HGCRecHitCollection> hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogWarning("HGCalValidation") << "HGChebRecHitCollection Handle does not exist !!!"; - } + edm::Handle<HGCRecHitCollection> hbhecoll; + iEvent.getByToken(recHitSource_, hbhecoll); + edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); + if (!geom.isValid()) + edm::LogWarning("HGCalValidation") << "Cannot get valid HGCalGeometry Object for " << nameDetector_; + const HGCalGeometry* geom0 = geom.product(); + + edm::Handle<HGCRecHitCollection> theRecHitContainers; + iEvent.getByToken(recHitSource_, theRecHitContainers); + if (theRecHitContainers.isValid()) { + if (verbosity_ > 0) + edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; + for (const auto& it : *(theRecHitContainers.product())) { + ntot++; + nused++; + DetId detId = it.id(); + int layer = (ifNose_ ? HFNoseDetId(detId).layer() + : ((detId.det() == DetId::Forward) + ? HGCalDetId(detId).layer() + : ((detId.det() == DetId::HGCalHSc) ? HGCScintillatorDetId(detId).layer() + : HGCSiliconDetId(detId).layer()))); + recHitValidation(detId, layer, geom0, &it); } } else { - edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); - if (!geom.isValid()) - edm::LogWarning("HGCalValidation") << "Cannot get valid HGCalGeometry Object for " << nameDetector_; - const HGCalGeometry* geom0 = geom.product(); - - edm::Handle<HGCRecHitCollection> theRecHitContainers; - iEvent.getByToken(recHitSource_, theRecHitContainers); - if (theRecHitContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; - for (const auto& it : *(theRecHitContainers.product())) { - ntot++; - nused++; - DetId detId = it.id(); - int layer = (ifNose_ ? HFNoseDetId(detId).layer() - : ((detId.det() == DetId::Forward) - ? HGCalDetId(detId).layer() - : ((detId.det() == DetId::HGCalHSc) ? HGCScintillatorDetId(detId).layer() - : HGCSiliconDetId(detId).layer()))); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogWarning("HGCalValidation") << "HGCRecHitCollection Handle does not exist !!!"; - } + ok = false; + edm::LogWarning("HGCalValidation") << "HGCRecHitCollection Handle does not exist !!!"; } if (ok) fillHitsInfo(); @@ -311,17 +246,11 @@ void HGCalRecHitStudy::fillHitsInfo(HitsInfo& hits) { } void HGCalRecHitStudy::beginRun(edm::Run const&, edm::EventSetup const& iSetup) { - if (nameDetector_ == "HCal") { - edm::ESHandle<HcalDDDRecConstants> pHRNDC = iSetup.getHandle(tok_hcaldd_); - const HcalDDDRecConstants* hcons = &(*pHRNDC); - layers_ = hcons->getMaxDepth(1); - } else { - edm::ESHandle<HGCalDDDConstants> pHGDC = iSetup.getHandle(tok_hgcaldd_); - const HGCalDDDConstants& hgcons_ = (*pHGDC); - layers_ = hgcons_.layers(true); - firstLayer_ = hgcons_.firstLayer(); - } - + edm::ESHandle<HGCalDDDConstants> pHGDC = iSetup.getHandle(tok_hgcaldd_); + const HGCalDDDConstants& hgcons_ = (*pHGDC); + layers_ = hgcons_.layers(true); + firstLayer_ = hgcons_.firstLayer(); + edm::LogVerbatim("HGCalValidation") << "Finds " << layers_ << " layers for " << nameDetector_; edm::Service<TFileService> fs; diff --git a/Validation/HGCalValidation/test/HGCalWaferStudy.cc b/Validation/HGCalValidation/test/HGCalWaferStudy.cc index 3b7fd5b8ea168..9e69155eeb0ca 100644 --- a/Validation/HGCalValidation/test/HGCalWaferStudy.cc +++ b/Validation/HGCalValidation/test/HGCalWaferStudy.cc @@ -13,7 +13,6 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -27,13 +26,10 @@ #include "FWCore/Utilities/interface/transform.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" From b8de443842aa32aa65d437ac12862742d744654e Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 3 May 2021 02:05:53 +0200 Subject: [PATCH 104/309] Code check --- .../HGCalValidation/test/HGCGeometryCheck.cc | 3 +- .../HGCalValidation/test/HGCHitValidation.cc | 56 ++++++++++--------- .../HGCalValidation/test/HGCalDigiStudy.cc | 14 +++-- .../HGCalValidation/test/HGCalRecHitStudy.cc | 13 +++-- 4 files changed, 47 insertions(+), 39 deletions(-) diff --git a/Validation/HGCalValidation/test/HGCGeometryCheck.cc b/Validation/HGCalValidation/test/HGCGeometryCheck.cc index a3335b9db0f14..2070cdf6ac662 100644 --- a/Validation/HGCalValidation/test/HGCGeometryCheck.cc +++ b/Validation/HGCalValidation/test/HGCGeometryCheck.cc @@ -65,7 +65,8 @@ HGCGeometryCheck::HGCGeometryCheck(const edm::ParameterSet &cfg) { g4Token_ = consumes<PHGCalValidInfo>(cfg.getParameter<edm::InputTag>("g4Source")); geometrySource_ = cfg.getUntrackedParameter<std::vector<std::string> >("geometrySource"); for (const auto &name : geometrySource_) { - tok_hgcGeom_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + tok_hgcGeom_.emplace_back( + esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); } edm::LogVerbatim("HGCalValid") << "HGCGeometryCheck:: use information from " diff --git a/Validation/HGCalValidation/test/HGCHitValidation.cc b/Validation/HGCalValidation/test/HGCHitValidation.cc index e9778e9056812..d7633c7e80401 100644 --- a/Validation/HGCalValidation/test/HGCHitValidation.cc +++ b/Validation/HGCalValidation/test/HGCHitValidation.cc @@ -143,8 +143,10 @@ HGCHitValidation::HGCHitValidation(const edm::ParameterSet &cfg) { ietaExcludeBH_ = cfg.getParameter<std::vector<int>>("ietaExcludeBH"); bhRecHitTokeng_ = consumes<HGChebRecHitCollection>(bhRecHitSource); for (size_t i = 0; i < geometrySource_.size(); i++) { - tok_hgcal_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", geometrySource_[i]})); - tok_hgcalg_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", geometrySource_[i]})); + tok_hgcal_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( + edm::ESInputTag{"", geometrySource_[i]})); + tok_hgcalg_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>( + edm::ESInputTag{"", geometrySource_[i]})); } makeTree_ = cfg.getUntrackedParameter<bool>("makeTree", true); @@ -327,7 +329,9 @@ void HGCHitValidation::analyze(const edm::Event &iEvent, const edm::EventSetup & analyzeHGCalSimHit(bhSimHits, 2, hebEnSim_, bhHitRefs); for (std::map<unsigned int, HGCHitTuple>::iterator itr = bhHitRefs.begin(); itr != bhHitRefs.end(); ++itr) { int idx = std::distance(bhHitRefs.begin(), itr); - edm::LogVerbatim("HGCalValid") << "BHHit[" << idx << "] " << std::hex << itr->first << std::dec << "; Energy " << std::get<0>(itr->second) << "; Position (" << std::get<1>(itr->second) << ", " << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ")"; + edm::LogVerbatim("HGCalValid") << "BHHit[" << idx << "] " << std::hex << itr->first << std::dec << "; Energy " + << std::get<0>(itr->second) << "; Position (" << std::get<1>(itr->second) << ", " + << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ")"; } } else { edm::LogWarning("HGCalValid") << "No BH SimHit Found " << std::endl; @@ -550,32 +554,32 @@ void HGCHitValidation::analyzeHGCalRecHit(T1 const &theHits, std::map<unsigned i double xp = pT * cos(std::get<2>(itr->second)); double yp = pT * sin(std::get<2>(itr->second)); if (makeTree_) { - hebRecX_->push_back(xyz.x()); - hebRecY_->push_back(xyz.y()); - hebRecZ_->push_back(xyz.z()); - hebRecEnergy_->push_back(energy); - hebSimX_->push_back(xp); - hebSimY_->push_back(yp); - hebSimZ_->push_back(std::get<3>(itr->second)); - hebSimEnergy_->push_back(std::get<0>(itr->second)); - hebSimEta_->push_back(std::get<1>(itr->second)); - hebRecEta_->push_back(xyz.eta()); - hebSimPhi_->push_back(std::get<2>(itr->second)); - hebRecPhi_->push_back(ang3); - hebDetID_->push_back(itr->first); + hebRecX_->push_back(xyz.x()); + hebRecY_->push_back(xyz.y()); + hebRecZ_->push_back(xyz.z()); + hebRecEnergy_->push_back(energy); + hebSimX_->push_back(xp); + hebSimY_->push_back(yp); + hebSimZ_->push_back(std::get<3>(itr->second)); + hebSimEnergy_->push_back(std::get<0>(itr->second)); + hebSimEta_->push_back(std::get<1>(itr->second)); + hebRecEta_->push_back(xyz.eta()); + hebSimPhi_->push_back(std::get<2>(itr->second)); + hebRecPhi_->push_back(ang3); + hebDetID_->push_back(itr->first); } else { - hebRecVsSimX_->Fill(xp, xyz.x()); - hebRecVsSimY_->Fill(yp, xyz.y()); - hebRecVsSimZ_->Fill(std::get<3>(itr->second), xyz.z()); - hebdEtaVsEta_->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); - hebdPhiVsPhi_->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); - hebdzVsZ_->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); - hebEnSimRec_->Fill(std::get<0>(itr->second), energy); + hebRecVsSimX_->Fill(xp, xyz.x()); + hebRecVsSimY_->Fill(yp, xyz.y()); + hebRecVsSimZ_->Fill(std::get<3>(itr->second), xyz.z()); + hebdEtaVsEta_->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); + hebdPhiVsPhi_->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); + hebdzVsZ_->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); + hebEnSimRec_->Fill(std::get<0>(itr->second), energy); } edm::LogVerbatim("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" - << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " - << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" - << energy << ", " << xyz.eta() << ", " << ang3 << ", " << xyz.z() << ")"; + << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " + << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" + << energy << ", " << xyz.eta() << ", " << ang3 << ", " << xyz.z() << ")"; } } } diff --git a/Validation/HGCalValidation/test/HGCalDigiStudy.cc b/Validation/HGCalValidation/test/HGCalDigiStudy.cc index 86c67467a0940..d66feb6b01f95 100644 --- a/Validation/HGCalValidation/test/HGCalDigiStudy.cc +++ b/Validation/HGCalValidation/test/HGCalDigiStudy.cc @@ -96,7 +96,7 @@ HGCalDigiStudy::HGCalDigiStudy(const edm::ParameterSet& iConfig) zmin_(iConfig.getUntrackedParameter<double>("zMin", 300.0)), zmax_(iConfig.getUntrackedParameter<double>("zMax", 600.0)), etamin_(iConfig.getUntrackedParameter<double>("etaMin", 1.0)), - etamax_(iConfig.getUntrackedParameter<double>("etaMax", 3.0)) { + etamax_(iConfig.getUntrackedParameter<double>("etaMax", 3.0)) { usesResource(TFileService::kSharedResource); if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive") || @@ -109,7 +109,8 @@ HGCalDigiStudy::HGCalDigiStudy(const edm::ParameterSet& iConfig) } edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: request for Digi " << "collection " << source_ << " for " << nameDetector_; - tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); + tok_hgcGeom_ = + esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); } void HGCalDigiStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -221,7 +222,7 @@ void HGCalDigiStudy::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { edm::ESHandle<HGCalGeometry> geom = iSetup.getHandle(tok_hgcGeom_); if (!geom.isValid()) edm::LogVerbatim("HGCalValidation") << "HGCalDigiStudy: Cannot get " - << "valid Geometry Object for " << nameDetector_; + << "valid Geometry Object for " << nameDetector_; hgcGeom_ = geom.product(); layerFront_ = hgcGeom_->topology().dddConstants().firstLayer(); layers_ = hgcGeom_->topology().dddConstants().layers(true); @@ -252,8 +253,9 @@ void HGCalDigiStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iS ntot++; nused++; DetId detId = it.id(); - int layer = ((geomType_ == 0) ? (HGCalDetId(detId).layer()) - : (geomType_ == 1) ? HGCSiliconDetId(detId).layer() : HFNoseDetId(detId).layer()); + int layer = ((geomType_ == 0) ? (HGCalDetId(detId).layer()) + : (geomType_ == 1) ? HGCSiliconDetId(detId).layer() + : HFNoseDetId(detId).layer()); const HGCSample& hgcSample = it.sample(SampleIndx_); uint16_t adc = hgcSample.data(); double charge = adc; @@ -327,7 +329,7 @@ void HGCalDigiStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& iS } } else { edm::LogVerbatim("HGCalValidation") - << "DigiCollection handle " << source_ << " does not exist for " << nameDetector_ << " !!!"; + << "DigiCollection handle " << source_ << " does not exist for " << nameDetector_ << " !!!"; } } else { edm::LogWarning("HGCalValidation") << "invalid detector name !! " << nameDetector_ << " source " << source_; diff --git a/Validation/HGCalValidation/test/HGCalRecHitStudy.cc b/Validation/HGCalValidation/test/HGCalRecHitStudy.cc index 4be4bbef94fdf..ea776a4c775a1 100644 --- a/Validation/HGCalValidation/test/HGCalRecHitStudy.cc +++ b/Validation/HGCalValidation/test/HGCalRecHitStudy.cc @@ -116,7 +116,8 @@ HGCalRecHitStudy::HGCalRecHitStudy(const edm::ParameterSet& iConfig) } edm::LogVerbatim("HGCalValidation") << "Initialize HGCalRecHitStudy for " << nameDetector_ << " with i/p tag " << temp << " Flag " << ifNose_ << ":" << verbosity_; - tok_hgcaldd_ = esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); + tok_hgcaldd_ = + esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_}); tok_hgcGeom_ = esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameDetector_}); } @@ -163,10 +164,10 @@ void HGCalRecHitStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& nused++; DetId detId = it.id(); int layer = (ifNose_ ? HFNoseDetId(detId).layer() - : ((detId.det() == DetId::Forward) - ? HGCalDetId(detId).layer() - : ((detId.det() == DetId::HGCalHSc) ? HGCScintillatorDetId(detId).layer() - : HGCSiliconDetId(detId).layer()))); + : ((detId.det() == DetId::Forward) + ? HGCalDetId(detId).layer() + : ((detId.det() == DetId::HGCalHSc) ? HGCScintillatorDetId(detId).layer() + : HGCSiliconDetId(detId).layer()))); recHitValidation(detId, layer, geom0, &it); } } else { @@ -250,7 +251,7 @@ void HGCalRecHitStudy::beginRun(edm::Run const&, edm::EventSetup const& iSetup) const HGCalDDDConstants& hgcons_ = (*pHGDC); layers_ = hgcons_.layers(true); firstLayer_ = hgcons_.firstLayer(); - + edm::LogVerbatim("HGCalValidation") << "Finds " << layers_ << " layers for " << nameDetector_; edm::Service<TFileService> fs; From b58d8ea2db676afd0487157728762b4bb62c48b4 Mon Sep 17 00:00:00 2001 From: David <David.Lange@cern.ch> Date: Mon, 3 May 2021 08:55:58 +0200 Subject: [PATCH 105/309] move to python3 --- Validation/Geometry/test/genHGCalPlots.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/Geometry/test/genHGCalPlots.sh b/Validation/Geometry/test/genHGCalPlots.sh index 8a3992a4fb3b3..cbff3dab95fd2 100755 --- a/Validation/Geometry/test/genHGCalPlots.sh +++ b/Validation/Geometry/test/genHGCalPlots.sh @@ -10,5 +10,5 @@ mkdir $TEST_DIR && cd $TEST_DIR cmsRun ${VGEO_DIR}/test/single_neutrino_cfg.py nEvents=1 >$TEST_DIR/single_neutrino_cfg.log 2>&1 python ${VGEO_DIR}/test/runP_HGCal_cfg.py geom=${geom} label=HGCal >$TEST_DIR/runP_HGCal_cfg_${geom}.log 2>&1 -python ${VGEO_DIR}/test/MaterialBudgetHGCal.py -s -d HGCal +python3 ${VGEO_DIR}/test/MaterialBudgetHGCal.py -s -d HGCal From 9d39a77180049cf240c17310fbfce53c8cd1e210 Mon Sep 17 00:00:00 2001 From: Giacomo Govi <giacomo.govi@cern.ch> Date: Mon, 3 May 2021 10:34:56 +0200 Subject: [PATCH 106/309] Fixes for code-checks/code-format --- CondCore/CondDB/src/SessionImpl.cc | 14 +++++++------- .../test/stubs/LumiBasedUpdateAnalyzer.cc | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/CondCore/CondDB/src/SessionImpl.cc b/CondCore/CondDB/src/SessionImpl.cc index fa8c92cbb98c9..da610956a4776 100644 --- a/CondCore/CondDB/src/SessionImpl.cc +++ b/CondCore/CondDB/src/SessionImpl.cc @@ -43,15 +43,15 @@ namespace cond { SessionImpl::~SessionImpl() { close(); } void SessionImpl::close() { - if( isActive() ) { - if(coralSession->transaction().isActive()){ - rollbackTransaction(); - } + if (isActive()) { + if (coralSession->transaction().isActive()) { + rollbackTransaction(); + } if (!lockedTags.empty()) { - startTransaction(false); - releaseTagLocks(); + startTransaction(false); + releaseTagLocks(); commitTransaction(); - } + } coralSession.reset(); } transaction.reset(); diff --git a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc index f1411b74f634a..903ff5dd17387 100644 --- a/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc +++ b/CondCore/DBOutputService/test/stubs/LumiBasedUpdateAnalyzer.cc @@ -9,10 +9,9 @@ #include <iostream> LumiBasedUpdateAnalyzer::LumiBasedUpdateAnalyzer(const edm::ParameterSet& iConfig) - : m_record(iConfig.getParameter<std::string>("record")), m_ret(-2) {} + : m_record(iConfig.getParameter<std::string>("record")), m_ret(-2) {} -LumiBasedUpdateAnalyzer::~LumiBasedUpdateAnalyzer() { -} +LumiBasedUpdateAnalyzer::~LumiBasedUpdateAnalyzer() {} void LumiBasedUpdateAnalyzer::beginJob() { edm::Service<cond::service::OnlineDBOutputService> mydbservice; @@ -21,7 +20,7 @@ void LumiBasedUpdateAnalyzer::beginJob() { } mydbservice->lockRecords(); } - + void LumiBasedUpdateAnalyzer::endJob() { edm::Service<cond::service::OnlineDBOutputService> mydbservice; if (mydbservice.isAvailable()) { @@ -29,7 +28,8 @@ void LumiBasedUpdateAnalyzer::endJob() { } } -void LumiBasedUpdateAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) { +void LumiBasedUpdateAnalyzer::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, + const edm::EventSetup& context) { edm::Service<cond::service::OnlineDBOutputService> mydbservice; if (!mydbservice.isAvailable()) { return; From 41ea0b03a509737b21677967f6fed28840733b1d Mon Sep 17 00:00:00 2001 From: chayanit <chayanit.asawatangtrakuldee@cern.ch> Date: Mon, 3 May 2021 13:25:51 +0200 Subject: [PATCH 107/309] update more workflows for Phase2 L1T --- .../PyReleaseValidation/python/upgradeWorkflowComponents.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 39fa103b99ba1..4782ead66a3ab 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1422,4 +1422,8 @@ def __init__(self, howMuch, dataset): ('EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_14TeV')), ('WToLNu_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WToLNu_14TeV')), ('WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WprimeToLNu_M2000_14TeV')), + ('DoubleMuFlatPt1p5To8_cfi', UpgradeFragment(Kby(9,100),'SingleMuFlatPt1p5To8')), + ('DoubleElectronFlatPt1p5To8_cfi', UpgradeFragment(Kby(9,100),'SingleElectronFlatPt1p5To8')), + ('DoubleMuFlatPt1p5To8Dxy100GunProducer_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt1p5To8Dxy100')), + ('DoubleMuFlatPt2To100Dxy100GunProducer_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt2To100Dxy100')), ]) From ba4840d294e12716b6b939195cd2bb68eaed6523 Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Fri, 5 Feb 2021 12:57:13 +0000 Subject: [PATCH 108/309] Port of changes that improve emulator-FW agreement. Digitise eta and phi of input candidates and synchronise bin edge effects with FW. (cherry picked from commit 1b2169a02a371e847d2bec036ef12d53e5b8d146) --- .../plugins/Phase1L1TJetProducer.cc | 208 ++++++++++++++++-- .../python/Phase1L1TJetProducer_cfi.py | 30 ++- 2 files changed, 222 insertions(+), 16 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc index 27630b94c17d6..0ba3fcab1ba74 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc @@ -25,6 +25,7 @@ Description: Produces jets with a phase-1 like sliding window algorithm using a // // Original Simone Bologna // Created: Mon Jul 02 2018 +// Modified 2020 Emyr Clement // #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -66,9 +67,9 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { /// Finds the seeds in the caloGrid, seeds are saved in a vector that contain the index in the TH2F of each seed std::vector<std::tuple<int, int>> findSeeds(float seedThreshold) const; - std::vector<reco::CaloJet> _buildJetsFromSeedsWithPUSubtraction(const std::vector<std::tuple<int, int>>& seeds, + std::vector<reco::CaloJet> buildJetsFromSeedsWithPUSubtraction(const std::vector<std::tuple<int, int>>& seeds, bool killZeroPt) const; - std::vector<reco::CaloJet> _buildJetsFromSeeds(const std::vector<std::tuple<int, int>>& seeds) const; + std::vector<reco::CaloJet> buildJetsFromSeeds(const std::vector<std::tuple<int, int>>& seeds) const; void subtract9x9Pileup(reco::CaloJet& jet) const; @@ -79,7 +80,23 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { // <3 handy method to fill the calogrid with whatever type template <class Container> - void fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives); + void fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives, const unsigned int regionIndex); + + // Digitise the eta and phi coordinates of input candidates + // This converts the quantities to integers to reduce precision + // And takes account of bin edge effects i.e. makes sure the + // candidate ends up in the correct (i.e. same behaviour as the firmware) bin of caloGrid_ + std::pair<float, float> getCandidateDigiEtaPhi( const float eta, const float phi, const unsigned int regionIndex ) const; + + // Sorts the input candidates into the PF regions they arrive in + // Truncates the inputs. Takes the first N candidates as they are provided, without any sorting (this may be needed in the future and/or provided in this way from emulation of layer 1) + template <class Handle > + std::vector< std::vector< reco::CandidatePtr > > prepareInputsIntoRegions( const Handle triggerPrimitives ); + + unsigned int getRegionIndex( const unsigned int phiRegion, const unsigned int etaRegion ) const; + std::pair< double, double> regionEtaPhiLowEdges( const unsigned int regionIndex ) const; + std::pair< double, double> regionEtaPhiUpEdges( const unsigned int regionIndex ) const; + edm::EDGetTokenT<edm::View<reco::Candidate>> inputCollectionTag_; // histogram containing our clustered inputs @@ -93,9 +110,22 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { unsigned int jetIEtaSize_; unsigned int jetIPhiSize_; double seedPtThreshold_; + double philsb_; + double etalsb_; bool puSubtraction_; bool vetoZeroPt_; - + // Eta and phi edges of input PF regions + std::vector< double > etaRegionEdges_; + std::vector< double > phiRegionEdges_; + // Maximum number of candidates per input PF region + unsigned int maxInputsPerRegion_; + // LUT for sin and cos phi, to match that used in firmware + std::vector<double> sinPhi_; + std::vector<double> cosPhi_; + // input eta cut for met calculation + double metAbsEtaCut_; + // input eta cut for metHF calculation + double metHFAbsEtaCut_; std::string outputCollectionName_; }; @@ -111,8 +141,17 @@ Phase1L1TJetProducer::Phase1L1TJetProducer(const edm::ParameterSet& iConfig) jetIEtaSize_(iConfig.getParameter<unsigned int>("jetIEtaSize")), jetIPhiSize_(iConfig.getParameter<unsigned int>("jetIPhiSize")), seedPtThreshold_(iConfig.getParameter<double>("seedPtThreshold")), + philsb_(iConfig.getParameter<double>("philsb")), + etalsb_(iConfig.getParameter<double>("etalsb")), puSubtraction_(iConfig.getParameter<bool>("puSubtraction")), vetoZeroPt_(iConfig.getParameter<bool>("vetoZeroPt")), + etaRegionEdges_(iConfig.getParameter<std::vector<double> >("etaRegions")), + phiRegionEdges_(iConfig.getParameter<std::vector<double> >("phiRegions")), + maxInputsPerRegion_(iConfig.getParameter<unsigned int>("maxInputsPerRegion")), + sinPhi_(iConfig.getParameter<std::vector<double> >("sinPhi")), + cosPhi_(iConfig.getParameter<std::vector<double> >("cosPhi")), + metAbsEtaCut_(iConfig.getParameter<double>("metAbsEtaCut")), + metHFAbsEtaCut_(iConfig.getParameter<double>("metHFAbsEtaCut")), outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")) { caloGrid_ = std::make_unique<TH2F>("caloGrid", "Calorimeter grid", nBinsEta_, etaBinning_.data(), nBinsPhi_, phiLow_, phiUp_); @@ -146,13 +185,21 @@ float Phase1L1TJetProducer::getTowerEnergy(int iEta, int iPhi) const { void Phase1L1TJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { edm::Handle<edm::View<reco::Candidate>> inputCollectionHandle; iEvent.getByToken(inputCollectionTag_, inputCollectionHandle); - // dumping the data + + // sort inputs into PF regions +std::vector< std::vector< reco::CandidatePtr > > inputsInRegions = prepareInputsIntoRegions<>( inputCollectionHandle ); + + // histogramming the data caloGrid_->Reset(); - fillCaloGrid<>(*(caloGrid_), *inputCollectionHandle); + for (unsigned int iInputRegion = 0; iInputRegion < inputsInRegions.size(); ++iInputRegion ) { + fillCaloGrid<>(*(caloGrid_), inputsInRegions[iInputRegion], iInputRegion); + } - const auto& seedsVector = findSeeds(seedPtThreshold_); // seedPtThreshold = 6 - auto l1jetVector = puSubtraction_ ? _buildJetsFromSeedsWithPUSubtraction(seedsVector, vetoZeroPt_) - : _buildJetsFromSeeds(seedsVector); + // find the seeds + const auto& seedsVector = findSeeds(seedPtThreshold_); // seedPtThreshold = 5 + // build jets from the seeds + auto l1jetVector = puSubtraction_ ? buildJetsFromSeedsWithPUSubtraction(seedsVector, vetoZeroPt_) + : buildJetsFromSeeds(seedsVector); // sort by pt std::sort(l1jetVector.begin(), l1jetVector.end(), [](const reco::CaloJet& jet1, const reco::CaloJet& jet2) { @@ -162,6 +209,8 @@ void Phase1L1TJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS auto l1jetVectorPtr = std::make_unique<std::vector<reco::CaloJet>>(l1jetVector); iEvent.put(std::move(l1jetVectorPtr), outputCollectionName_); + // calculate METs + return; } @@ -287,7 +336,7 @@ reco::CaloJet Phase1L1TJetProducer::buildJetFromSeed(const std::tuple<int, int>& return jet; } -std::vector<reco::CaloJet> Phase1L1TJetProducer::_buildJetsFromSeedsWithPUSubtraction( +std::vector<reco::CaloJet> Phase1L1TJetProducer::buildJetsFromSeedsWithPUSubtraction( const std::vector<std::tuple<int, int>>& seeds, bool killZeroPt) const { // For each seed take a grid centered on the seed of the size specified by the user // Sum the pf in the grid, that will be the pt of the l1t jet. Eta and phi of the jet is taken from the seed. @@ -303,7 +352,7 @@ std::vector<reco::CaloJet> Phase1L1TJetProducer::_buildJetsFromSeedsWithPUSubtra return jets; } -std::vector<reco::CaloJet> Phase1L1TJetProducer::_buildJetsFromSeeds( +std::vector<reco::CaloJet> Phase1L1TJetProducer::buildJetsFromSeeds( const std::vector<std::tuple<int, int>>& seeds) const { // For each seed take a grid centered on the seed of the size specified by the user // Sum the pf in the grid, that will be the pt of the l1t jet. Eta and phi of the jet is taken from the seed. @@ -316,15 +365,72 @@ std::vector<reco::CaloJet> Phase1L1TJetProducer::_buildJetsFromSeeds( } template <class Container> -void Phase1L1TJetProducer::fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives) { +void Phase1L1TJetProducer::fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives, const unsigned int regionIndex) { //Filling the calo grid with the primitives for (const auto& primitiveIterator : triggerPrimitives) { - caloGrid.Fill(static_cast<float>(primitiveIterator.eta()), - static_cast<float>(primitiveIterator.phi()), - static_cast<float>(primitiveIterator.pt())); + + // Get digitised (floating point with reduced precision) eta and phi + std::pair<float, float> digi_EtaPhi = getCandidateDigiEtaPhi( primitiveIterator->eta(), primitiveIterator->phi(), regionIndex ); + + caloGrid.Fill(static_cast<float>(digi_EtaPhi.first), + static_cast<float>(digi_EtaPhi.second), + static_cast<float>(primitiveIterator->pt())); + } +} + +std::pair<float, float> Phase1L1TJetProducer::getCandidateDigiEtaPhi( const float eta, const float phi, const unsigned int regionIndex ) const { + + std::pair< double, double > regionLowEdges = regionEtaPhiLowEdges( regionIndex ); + + int digitisedEta = floor( ( eta - regionLowEdges.second ) / etalsb_ ); + int digitisedPhi = floor( ( phi - regionLowEdges.first ) / philsb_ ); + + // If eta or phi is on a bin edge + // Put in bin above, to match behaviour of HLS + // Unless it's on the last bin of this pf region + TAxis* etaAxis = caloGrid_->GetXaxis(); + std::pair< double, double > regionUpEdges = regionEtaPhiUpEdges( regionIndex ); + int digiEtaEdgeLastBinUp = floor( ( regionUpEdges.second - regionLowEdges.second ) / etalsb_ ); + // If the digi eta is outside the last bin of this pf region + // Set the digitised quantity so it would be in the last bin + // These cases could be avoided by sorting input candidates based on digitised eta/phi + if ( digitisedEta >= digiEtaEdgeLastBinUp ) { + digitisedEta = digiEtaEdgeLastBinUp-1; } + else { + for ( int i = 0; i < etaAxis->GetNbins(); ++i ) { + if ( etaAxis->GetBinUpEdge(i) < regionLowEdges.second ) continue; + int digiEdgeBinUp = floor( ( etaAxis->GetBinUpEdge(i) - regionLowEdges.second ) / etalsb_ ); + if ( digiEdgeBinUp == digitisedEta ){ + digitisedEta += 1; + } + } + } + + // Similar for phi + TAxis* phiAxis = caloGrid_->GetYaxis(); + int digiPhiEdgeLastBinUp = floor( ( regionUpEdges.first - regionLowEdges.first ) / philsb_ ); + if ( digitisedPhi >= digiPhiEdgeLastBinUp ) { + digitisedPhi = digiPhiEdgeLastBinUp-1; + } + else { + for ( int i = 0; i < phiAxis->GetNbins(); ++i ) { + if ( phiAxis->GetBinUpEdge(i) < regionLowEdges.first ) continue; + int digiEdgeBinUp = floor( ( phiAxis->GetBinUpEdge(i) - regionLowEdges.first ) / philsb_ ); + if ( digiEdgeBinUp == digitisedPhi ){ + digitisedPhi += 1; + } + } + } + + // Convert digitised eta and phi back to floating point quantities with reduced precision + float floatDigitisedEta = ( digitisedEta + 0.5 ) * etalsb_ + regionLowEdges.second; + float floatDigitisedPhi = ( digitisedPhi + 0.5 ) * philsb_ + regionLowEdges.first; + + return std::pair<float, float> {floatDigitisedEta, floatDigitisedPhi}; } + void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add<edm::InputTag>("inputCollectionTag", edm::InputTag("l1pfCandidates", "Puppi")); @@ -335,10 +441,82 @@ void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add<unsigned int>("jetIEtaSize", 7); desc.add<unsigned int>("jetIPhiSize", 7); desc.add<double>("seedPtThreshold", 5); + desc.add<double>("philsb", 0.0043633231), + desc.add<double>("etalsb", 0.0043633231), desc.add<bool>("puSubtraction", false); desc.add<string>("outputCollectionName", "UncalibratedPhase1L1TJetFromPfCandidates"); desc.add<bool>("vetoZeroPt", true); + desc.add<std::vector<double> >("etaRegions"); + desc.add<std::vector<double> >("phiRegions"); + desc.add<unsigned int>("maxInputsPerRegion", 18); + desc.add<std::vector<double> >("sinPhi"); + desc.add<std::vector<double> >("cosPhi"); + desc.add<double>("metAbsEtaCut", 3); + desc.add<double>("metHFAbsEtaCut", 5); descriptions.add("Phase1L1TJetProducer", desc); } +template <class Handle > +std::vector< std::vector< edm::Ptr< reco::Candidate > > > Phase1L1TJetProducer::prepareInputsIntoRegions( const Handle triggerPrimitives ) +{ + + std::vector< std::vector< reco::CandidatePtr > > inputsInRegions{ etaRegionEdges_.size() * ( phiRegionEdges_.size() - 1 ) }; + + for ( unsigned int i = 0; i < triggerPrimitives->size(); ++i ) { + + reco::CandidatePtr tp( triggerPrimitives, i ); + + // Which phi region does this tp belong to + auto it_phi = phiRegionEdges_.begin(); + if ( tp->phi() >= phiRegionEdges_.front() && tp->phi() < phiRegionEdges_.back()) { + it_phi = std::upper_bound (phiRegionEdges_.begin(), phiRegionEdges_.end(), tp->phi()) - 1; + } + + // Which eta region does this tp belong to + auto it_eta = etaRegionEdges_.begin(); + if ( tp->eta() >= etaRegionEdges_.front() && tp->eta() < etaRegionEdges_.back() ) { + it_eta = std::upper_bound (etaRegionEdges_.begin(), etaRegionEdges_.end(), tp->eta()) - 1; + } + + if ( it_phi != phiRegionEdges_.end() && it_eta != etaRegionEdges_.end() ) { + auto phiRegion = it_phi - phiRegionEdges_.begin(); + auto etaRegion = it_eta - etaRegionEdges_.begin(); + + inputsInRegions[ getRegionIndex( phiRegion, etaRegion ) ].emplace_back( tp ); + } + } + + // Truncate inputs in each pf region + for ( auto& inputs : inputsInRegions ) { + if ( inputs.size() > maxInputsPerRegion_ ) { + inputs.resize( maxInputsPerRegion_ ); + } + } + + return inputsInRegions; +} + +unsigned int Phase1L1TJetProducer::getRegionIndex( const unsigned int phiRegion, const unsigned int etaRegion ) const { + return etaRegion * ( phiRegionEdges_.size() - 1 ) + phiRegion; +} + +std::pair< double, double> Phase1L1TJetProducer::regionEtaPhiLowEdges( const unsigned int regionIndex ) const { + unsigned int phiRegion = regionIndex % ( phiRegionEdges_.size() - 1 ); + unsigned int etaRegion = ( regionIndex - phiRegion ) / ( phiRegionEdges_.size() - 1 ); + return std::pair< double, double > { phiRegionEdges_.at( phiRegion ), etaRegionEdges_.at( etaRegion ) }; +} + +std::pair< double, double> Phase1L1TJetProducer::regionEtaPhiUpEdges( const unsigned int regionIndex ) const { + unsigned int phiRegion = regionIndex % ( phiRegionEdges_.size() - 1 ); + unsigned int etaRegion = ( regionIndex - phiRegion ) / ( phiRegionEdges_.size() - 1 ); + if ( phiRegion == phiRegionEdges_.size()-1 ) { + return std::pair< double, double > { phiRegionEdges_.at( phiRegion ), etaRegionEdges_.at( etaRegion + 1 ) }; + } + else if ( etaRegion == etaRegionEdges_.size()-1 ) { + return std::pair< double, double > { phiRegionEdges_.at( phiRegion + 1), etaRegionEdges_.at( etaRegion ) }; + } + + return std::pair< double, double > { phiRegionEdges_.at( phiRegion + 1 ), etaRegionEdges_.at( etaRegion + 1 ) }; +} + DEFINE_FWK_MODULE(Phase1L1TJetProducer); diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py index 93e5841d8bfcd..789e98acf451f 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py @@ -14,6 +14,24 @@ 3.0, 3.083, 3.167, 3.25, 3.333, 3.417, 3.5, 3.583, 3.667, 3.75, 3.833, 3.917, 4.0, 4.083, 4.167, 4.25, 4.333, 4.417, 4.5, 4.583, 4.667, 4.75, 4.833, 4.917, 5.0) +sinPhi = cms.vdouble(0.04374, 0.13087, 0.21701, 0.30149, 0.38365, 0.46289, 0.53858, 0.61015, 0.67705, 0.73877, + 0.79484, 0.84483, 0.88835, 0.92508, 0.95473, 0.97707, 0.99194, 0.99922, 0.99885, 0.99084, + 0.97525, 0.9522, 0.92186, 0.88446, 0.8403, 0.78971, 0.73308, 0.67084, 0.60347, 0.53148, + 0.45542, 0.37588, 0.29346, 0.2088, 0.12253, 0.03534, -0.05213, -0.1392, -0.22521, -0.30949, + -0.3914, -0.47032, -0.54564, -0.61679, -0.68322, -0.74441, -0.79992, -0.8493, -0.89218, + -0.92824, -0.9572, -0.97883, -0.99297, -0.99952, -0.99841, -0.98967, -0.97336, -0.94959, + -0.91857, -0.88051, -0.83572, -0.78453, -0.72734, -0.66458, -0.59674, -0.52434, -0.44792, + -0.36807, -0.28541, -0.20057, -0.11419, -0.02693) +cosPhi = cms.vdouble(0.99904, 0.9914, 0.97617, 0.95347, 0.92348, 0.88642, 0.84257, 0.79229, 0.73593, 0.67395, + 0.60681, 0.53503, 0.45916, 0.37977, 0.29747, 0.2129, 0.1267, 0.03954, -0.04794, -0.13504, + -0.22111, -0.30549, -0.38753, -0.46661, -0.54212, -0.61348, -0.68014, -0.7416, -0.79739, -0.84707, + -0.89028, -0.92667, -0.95597, -0.97796, -0.99246, -0.99938, -0.99864, -0.99026, -0.97431, -0.9509, + -0.92022, -0.88249, -0.83802, -0.78713, -0.73022, -0.66772, -0.60011, -0.52791, -0.45167, + -0.37198, -0.28944, -0.20468, -0.11836, -0.03113, 0.05633, 0.14337, 0.2293, 0.31349, + 0.39527, 0.47403, 0.54916, 0.62009, 0.68628, 0.74721, 0.80243, 0.85151, 0.89407, + 0.9298, 0.95841, 0.97968, 0.99346, 0.99964) + + Phase1L1TJetProducer = cms.EDProducer('Phase1L1TJetProducer', inputCollectionTag = cms.InputTag("l1pfCandidates", "Puppi"), etaBinning = caloEtaSegmentation, @@ -22,8 +40,18 @@ phiUp = cms.double(pi), jetIEtaSize = cms.uint32(7), jetIPhiSize = cms.uint32(7), + # trimmedGrid = cms.bool(False), seedPtThreshold = cms.double(5), # GeV puSubtraction = cms.bool(False), + philsb = cms.double(0.0043633231), + etalsb = cms.double(0.0043633231), outputCollectionName = cms.string("UncalibratedPhase1L1TJetFromPfCandidates"), - vetoZeroPt = cms.bool(True) + vetoZeroPt = cms.bool(True), + etaRegions = cms.vdouble( -5., -4.5, -4., -3.5, -3., -2.5, -1.5, -0.75, 0, 0.75, 1.5, 2.5, 3., 3.5, 4., 4.5, 5. ), + phiRegions = cms.vdouble( -3.5, -2.8, -2.1, -1.4, -0.7, 0, 0.7, 1.4, 2.1, 2.8, 3.5 ),#, 4.2, 4.9, 5.6, 6.3 ), + maxInputsPerRegion = cms.uint32( 18 ), + sinPhi = sinPhi, + cosPhi = cosPhi, + metAbsEtaCut = cms.double(3), + metHFAbsEtaCut = cms.double(5), ) From 26141cee37d3dfcff2733b5ae9173bfef3ec53ee Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Fri, 5 Feb 2021 13:15:48 +0000 Subject: [PATCH 109/309] Add option to produce trimmed jets. (cherry picked from commit 0f935a1476e512223d6024ed617b7b95086236ad) --- .../plugins/Phase1L1TJetProducer.cc | 35 +++++++++++++++++++ .../python/Phase1L1TJetProducer_cfi.py | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc index 0ba3fcab1ba74..072145b5770bc 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc @@ -97,6 +97,12 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { std::pair< double, double> regionEtaPhiLowEdges( const unsigned int regionIndex ) const; std::pair< double, double> regionEtaPhiUpEdges( const unsigned int regionIndex ) const; + // Determine if this tower should be trimmed or not + // Used only when trimmedGrid_ option is set to true + // Trim means removing 3 towers in each corner of the square grid + // giving a cross shaped grid, which is a bit more circular in shape than a square + bool trimTower( const int etaIndex, const int phiIndex ) const; + edm::EDGetTokenT<edm::View<reco::Candidate>> inputCollectionTag_; // histogram containing our clustered inputs @@ -109,6 +115,7 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { double phiUp_; unsigned int jetIEtaSize_; unsigned int jetIPhiSize_; + bool trimmedGrid_; double seedPtThreshold_; double philsb_; double etalsb_; @@ -140,6 +147,7 @@ Phase1L1TJetProducer::Phase1L1TJetProducer(const edm::ParameterSet& iConfig) phiUp_(iConfig.getParameter<double>("phiUp")), jetIEtaSize_(iConfig.getParameter<unsigned int>("jetIEtaSize")), jetIPhiSize_(iConfig.getParameter<unsigned int>("jetIPhiSize")), + trimmedGrid_(iConfig.getParameter<bool>("trimmedGrid")), seedPtThreshold_(iConfig.getParameter<double>("seedPtThreshold")), philsb_(iConfig.getParameter<double>("philsb")), etalsb_(iConfig.getParameter<double>("etalsb")), @@ -285,6 +293,11 @@ std::vector<std::tuple<int, int>> Phase1L1TJetProducer::findSeeds(float seedThre // Scanning through the grid centered on the seed for (int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) { for (int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) { + + if ( trimmedGrid_ ) { + if ( trimTower( etaIndex, phiIndex ) ) continue; + } + if ((etaIndex == 0) && (phiIndex == 0)) continue; if (phiIndex > 0) { @@ -322,6 +335,9 @@ reco::CaloJet Phase1L1TJetProducer::buildJetFromSeed(const std::tuple<int, int>& // Scanning through the grid centered on the seed for (int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) { for (int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) { + if ( trimmedGrid_ ) { + if ( trimTower( etaIndex, phiIndex ) ) continue; + } ptSum += getTowerEnergy(iEta + etaIndex, iPhi + phiIndex); } } @@ -440,6 +456,7 @@ void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add<double>("phiUp", M_PI); desc.add<unsigned int>("jetIEtaSize", 7); desc.add<unsigned int>("jetIPhiSize", 7); + desc.add<bool>("trimmedGrid", false); desc.add<double>("seedPtThreshold", 5); desc.add<double>("philsb", 0.0043633231), desc.add<double>("etalsb", 0.0043633231), @@ -519,4 +536,22 @@ std::pair< double, double> Phase1L1TJetProducer::regionEtaPhiUpEdges( const unsi return std::pair< double, double > { phiRegionEdges_.at( phiRegion + 1 ), etaRegionEdges_.at( etaRegion + 1 ) }; } +bool Phase1L1TJetProducer::trimTower( const int etaIndex, const int phiIndex ) const +{ + int etaHalfSize = jetIEtaSize_/2; + int phiHalfSize = jetIPhiSize_/2; + + if ( etaIndex == -etaHalfSize || etaIndex == etaHalfSize ) { + if ( phiIndex <= -phiHalfSize+1 || phiIndex >= phiHalfSize-1 ) { + return true; + } + } + else if ( etaIndex == -etaHalfSize+1 || etaIndex == etaHalfSize-1 ) { + if ( phiIndex == -phiHalfSize || phiIndex == phiHalfSize ) { + return true; + } + } + + return false; +} DEFINE_FWK_MODULE(Phase1L1TJetProducer); diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py index 789e98acf451f..83b327b3116eb 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py @@ -40,7 +40,7 @@ phiUp = cms.double(pi), jetIEtaSize = cms.uint32(7), jetIPhiSize = cms.uint32(7), - # trimmedGrid = cms.bool(False), + trimmedGrid = cms.bool(False), seedPtThreshold = cms.double(5), # GeV puSubtraction = cms.bool(False), philsb = cms.double(0.0043633231), From eb8a7b7a3c4e56b93a566c0166568083de28a371 Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Fri, 5 Feb 2021 13:45:04 +0000 Subject: [PATCH 110/309] Add MET calculation to jet finder. (cherry picked from commit 06318657e8c280839bd16013968ebf439e0daacc) --- .../plugins/Phase1L1TJetProducer.cc | 45 ++++++++++++++++++- .../python/Phase1L1TJetProducer_cfi.py | 1 + 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc index 072145b5770bc..9f8fb8f429f3e 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc @@ -5,7 +5,7 @@ // /**\class Phase1L1TJetProducer Phase1L1TJetProducer.cc L1Trigger/L1CaloTrigger/plugin/Phase1L1TJetProducer.cc -Description: Produces jets with a phase-1 like sliding window algorithm using a collection of reco::Candidates in input. +Description: Produces jets with a phase-1 like sliding window algorithm using a collection of reco::Candidates in input. Also calculates MET from the histogram used to find the jets. *** INPUT PARAMETERS *** * etaBinning: vdouble with eta binning (allows non-homogeneous binning in eta) @@ -42,7 +42,7 @@ Description: Produces jets with a phase-1 like sliding window algorithm using a #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Math/interface/LorentzVector.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" #include "TH2F.h" @@ -97,6 +97,14 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { std::pair< double, double> regionEtaPhiLowEdges( const unsigned int regionIndex ) const; std::pair< double, double> regionEtaPhiUpEdges( const unsigned int regionIndex ) const; + // computes MET + // Takes grid used by jet finder and projects to 1D histogram of phi, bin contents are total pt in that phi bin + // the phi bin index is used to retrieve the sin-cos value from the LUT emulator + // the pt of the input is multiplied by that sin cos value to obtain px and py that is added to the total event px & py + // after all the inputs have been processed we compute the total pt of the event, and set that as MET + l1t::EtSum computeMET( const double etaCut, l1t::EtSum::EtSumType sumType ) const; + + // Determine if this tower should be trimmed or not // Used only when trimmedGrid_ option is set to true // Trim means removing 3 towers in each corner of the square grid @@ -117,6 +125,7 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { unsigned int jetIPhiSize_; bool trimmedGrid_; double seedPtThreshold_; + double ptlsb_; double philsb_; double etalsb_; bool puSubtraction_; @@ -149,6 +158,7 @@ Phase1L1TJetProducer::Phase1L1TJetProducer(const edm::ParameterSet& iConfig) jetIPhiSize_(iConfig.getParameter<unsigned int>("jetIPhiSize")), trimmedGrid_(iConfig.getParameter<bool>("trimmedGrid")), seedPtThreshold_(iConfig.getParameter<double>("seedPtThreshold")), + ptlsb_(iConfig.getParameter<double>("ptlsb")), philsb_(iConfig.getParameter<double>("philsb")), etalsb_(iConfig.getParameter<double>("etalsb")), puSubtraction_(iConfig.getParameter<bool>("puSubtraction")), @@ -166,6 +176,7 @@ Phase1L1TJetProducer::Phase1L1TJetProducer(const edm::ParameterSet& iConfig) caloGrid_->GetXaxis()->SetTitle("#eta"); caloGrid_->GetYaxis()->SetTitle("#phi"); produces<std::vector<reco::CaloJet>>(outputCollectionName_).setBranchAlias(outputCollectionName_); + produces< std::vector<l1t::EtSum> >( outputCollectionName_ + "MET" ).setBranchAlias(outputCollectionName_ + "MET"); } Phase1L1TJetProducer::~Phase1L1TJetProducer() {} @@ -218,6 +229,12 @@ std::vector< std::vector< reco::CandidatePtr > > inputsInRegions = prepareInputs iEvent.put(std::move(l1jetVectorPtr), outputCollectionName_); // calculate METs + l1t::EtSum lMET = computeMET( metAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEt ); + l1t::EtSum lMETHF = computeMET( metHFAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEtHF); + std::unique_ptr< std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0)); + lSumVectorPtr -> push_back(lMET); + lSumVectorPtr -> push_back(lMETHF); + iEvent.put(std::move(lSumVectorPtr), this -> outputCollectionName_+"MET"); return; } @@ -458,6 +475,7 @@ void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add<unsigned int>("jetIPhiSize", 7); desc.add<bool>("trimmedGrid", false); desc.add<double>("seedPtThreshold", 5); + desc.add<double>("ptlsb", 0.25), desc.add<double>("philsb", 0.0043633231), desc.add<double>("etalsb", 0.0043633231), desc.add<bool>("puSubtraction", false); @@ -536,6 +554,29 @@ std::pair< double, double> Phase1L1TJetProducer::regionEtaPhiUpEdges( const unsi return std::pair< double, double > { phiRegionEdges_.at( phiRegion + 1 ), etaRegionEdges_.at( etaRegion + 1 ) }; } + +l1t::EtSum Phase1L1TJetProducer::computeMET( const double etaCut, l1t::EtSum::EtSumType sumType ) const { + const auto lowEtaBin = caloGrid_->GetXaxis()->FindBin( -1.0 * etaCut ); + const auto highEtaBin = caloGrid_->GetXaxis()->FindBin( etaCut ) - 1; + const auto phiProjection = caloGrid_->ProjectionY( "temp", lowEtaBin, highEtaBin ); + + // Use digitised quantities when summing to improve agreement with firmware + int totalDigiPx{0}; + int totalDigiPy{0}; + + for ( int i = 1; i < phiProjection->GetNbinsX()+1; ++i ) { + double pt = phiProjection->GetBinContent( i ); + totalDigiPx += trunc( floor( pt / ptlsb_ ) * cosPhi_[i-1] ); + totalDigiPy += trunc( floor( pt / ptlsb_ ) * sinPhi_[i-1] ); + } + + double lMET = floor( sqrt(totalDigiPx * totalDigiPx + totalDigiPy * totalDigiPy) ) * ptlsb_; + + math::PtEtaPhiMLorentzVector lMETVector( lMET, 0, acos(totalDigiPx / ( lMET / ptlsb_ )), 0 ); + l1t::EtSum lMETSum(lMETVector, sumType, 0, 0, 0, 0 ); + return lMETSum; +} + bool Phase1L1TJetProducer::trimTower( const int etaIndex, const int phiIndex ) const { int etaHalfSize = jetIEtaSize_/2; diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py index 83b327b3116eb..fd843a11b2458 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py @@ -43,6 +43,7 @@ trimmedGrid = cms.bool(False), seedPtThreshold = cms.double(5), # GeV puSubtraction = cms.bool(False), + ptlsb = cms.double(0.25), philsb = cms.double(0.0043633231), etalsb = cms.double(0.0043633231), outputCollectionName = cms.string("UncalibratedPhase1L1TJetFromPfCandidates"), From dbca0f9af19446ecc4b174b3529e0e34013c8cbb Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Fri, 5 Feb 2021 16:04:22 +0000 Subject: [PATCH 111/309] Add producer for HT and MHT (cherry picked from commit 19fa96ff11e1cbae4b8652b0e55bb7dbac4627e7) --- DataFormats/L1Trigger/src/classes_def.xml | 1 + .../plugins/Phase1L1TJetSumsProducer.cc | 231 ++++++++++++++++++ .../L1CaloTrigger/python/Phase1L1TJets_cff.py | 4 +- 3 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 8fc148869af6f..adfdea7d99e3a 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -56,6 +56,7 @@ </class> <class name="l1t::EtSumBxCollection"/> <class name="std::vector<l1t::EtSum>"/> + <class name="edm::Wrapper<std::vector<l1t::EtSum>>"/> <class name="edm::Wrapper<l1t::EtSumBxCollection>"/> <class name="l1t::EtSumRef"/> <class name="edm::Wrapper<l1t::EtSumRef>"/> diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc new file mode 100644 index 0000000000000..e7b6fd0722d18 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc @@ -0,0 +1,231 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: Phase1L1TJetSumsProducer +// +/**\class Phase1L1TJetSumsProducer Phase1L1TJetSumsProducer.cc L1Trigger/L1CaloTrigger/plugin/Phase1L1TJetSumsProducer.cc + +Description: Computes HT and MHT from phase-1-like jets + +*** INPUT PARAMETERS *** + * etaBinning: vdouble with eta binning (allows non-homogeneous binning in eta) + * nBinsPhi: uint32, number of bins in phi + * phiLow: double, min phi (typically -pi) + * phiUp: double, max phi (typically +pi) + * jetIEtaSize: uint32, jet cluster size in ieta + * jetIPhiSize: uint32, jet cluster size in iphi + * seedPtThreshold: double, threshold of the seed tower + * puSubtraction: bool, runs chunky doughnut pile-up subtraction, 9x9 jet only + * outputCollectionName: string, tag for the output collection + * vetoZeroPt: bool, controls whether jets with 0 pt should be save. + It matters if PU is ON, as you can get negative or zero pt jets after it. + * outputSumsCollectionName: string, tag for the output collection containing MET and HT + * inputCollectionTag: inputtag, collection of reco::candidates used as input to the algo + * htPtThreshold: double, threshold for computing ht + +*/ +// +// Original Simone Bologna +// + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/one/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/Common/interface/View.h" +#include "DataFormats/Candidate/interface/Candidate.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/Event.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include <cmath> + +class Phase1L1TJetSumsProducer : public edm::one::EDProducer<edm::one::SharedResources> { + public: + explicit Phase1L1TJetSumsProducer(const edm::ParameterSet&); + ~Phase1L1TJetSumsProducer(); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + + private: + virtual void produce(edm::Event&, const edm::EventSetup&); + + // computes ht, adds jet pt to ht only if the pt of the jet is above the ht calculation threshold + l1t::EtSum computeHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const; + + // computes MHT + // adds jet pt to mht only if the pt of the jet is above the mht calculation threshold + // performs some calculations with digitised/integer quantities to ensure agreement with firmware + l1t::EtSum computeMHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const; + + edm::EDGetTokenT<std::vector<reco::CaloJet> > inputJetCollectionTag_; + + // holds the sin and cos for HLs LUT emulation + std::vector<double> sinPhi_; + std::vector<double> cosPhi_; + unsigned int nBinsPhi_; + + // lower phi value + double phiLow_; + // higher phi value + double phiUp_; + // lower eta value + double etaLow_; + // higher eta value + double etaUp_; + // size of a phi bin + double phiStep_; + // threshold for ht calculation + double htPtThreshold_; + // threshold for ht calculation + double mhtPtThreshold_; + // jet eta cut for ht calculation + double htAbsEtaCut_; + // jet eta cut for mht calculation + double mhtAbsEtaCut_; + // LSB of pt quantity + double ptlsb_; + // label of sums + std::string outputCollectionName_; + +}; + +// initialises plugin configuration and prepares ROOT file for saving the sums +Phase1L1TJetSumsProducer::Phase1L1TJetSumsProducer(const edm::ParameterSet& iConfig): + inputJetCollectionTag_{consumes<std::vector<reco::CaloJet> >(iConfig.getParameter<edm::InputTag>("inputJetCollectionTag"))}, + sinPhi_(iConfig.getParameter<std::vector<double> >("sinPhi")), + cosPhi_(iConfig.getParameter<std::vector<double> >("cosPhi")), + nBinsPhi_(iConfig.getParameter<unsigned int>("nBinsPhi")), + phiLow_(iConfig.getParameter<double>("phiLow")), + phiUp_(iConfig.getParameter<double>("phiUp")), + etaLow_(iConfig.getParameter<double>("etaLow")), + etaUp_(iConfig.getParameter<double>("etaUp")), + htPtThreshold_(iConfig.getParameter<double>("htPtThreshold")), + mhtPtThreshold_(iConfig.getParameter<double>("mhtPtThreshold")), + htAbsEtaCut_(iConfig.getParameter<double>("htAbsEtaCut")), + mhtAbsEtaCut_(iConfig.getParameter<double>("mhtAbsEtaCut")), + ptlsb_(iConfig.getParameter<double>("ptlsb")), + outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")) +{ + phiStep_ = ( phiUp_ - phiLow_ ) / nBinsPhi_; + produces< std::vector<l1t::EtSum> >( outputCollectionName_ ).setBranchAlias(outputCollectionName_); +} + +Phase1L1TJetSumsProducer::~Phase1L1TJetSumsProducer() +{ +} + +void Phase1L1TJetSumsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + edm::Handle < std::vector<reco::CaloJet> > jetCollectionHandle; + iEvent.getByToken(inputJetCollectionTag_, jetCollectionHandle); + + // computing sums and storing them in sum object + l1t::EtSum lHT = computeHT(jetCollectionHandle); + l1t::EtSum lMHT = computeMHT(jetCollectionHandle); + + //packing sums in vector for event saving + std::unique_ptr< std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0)); + lSumVectorPtr -> push_back(lHT); + lSumVectorPtr -> push_back(lMHT); + iEvent.put(std::move(lSumVectorPtr), outputCollectionName_ ); + + return; + +} + +l1t::EtSum Phase1L1TJetSumsProducer::computeHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const +{ + double lHT = 0; + for (const auto & jet: *inputJets) + { + double lJetPt = jet.pt(); + double lJetPhi = jet.phi(); + double lJetEta = jet.eta(); + if + ( + (lJetPhi < phiLow_) || + (lJetPhi >= phiUp_) || + (lJetEta < etaLow_)|| + (lJetEta >= etaUp_) + ) continue; + + lHT += (lJetPt >= htPtThreshold_ && std::fabs( lJetEta ) < htAbsEtaCut_ ) ? lJetPt : 0; + } + + reco::Candidate::PolarLorentzVector lHTVector; + lHTVector.SetPt(lHT); + lHTVector.SetEta(0); + lHTVector.SetPhi(0); + l1t::EtSum lHTSum(lHTVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); + return lHTSum; +} + +l1t::EtSum Phase1L1TJetSumsProducer::computeMHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const +{ + + int lTotalJetPx = 0; + int lTotalJetPy = 0; + + std::vector<unsigned int> jetPtInPhiBins(nBinsPhi_, 0); + + for (const auto & jet: *inputJets) + { + double lJetPhi = jet.phi(); + + if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_)) continue; + + unsigned int iPhi = ( lJetPhi - phiLow_ ) / phiStep_; + + if ( jet.pt() >= mhtPtThreshold_ && std::fabs( jet.eta() ) < mhtAbsEtaCut_ ) { + unsigned int digiJetPt = floor( jet.pt() / ptlsb_ ); + jetPtInPhiBins[iPhi] += digiJetPt; + } + } + + for ( unsigned int iPhi = 0; iPhi < jetPtInPhiBins.size(); ++iPhi ) { + + unsigned int digiJetPtSum = jetPtInPhiBins[iPhi]; + + // retrieving sin cos from LUT emulator + double lSinPhi = sinPhi_[iPhi]; + double lCosPhi = cosPhi_[iPhi]; + + // checking if above threshold + lTotalJetPx += trunc( digiJetPtSum * lCosPhi ); + lTotalJetPy += trunc( digiJetPtSum * lSinPhi ); + } + + double lMHT = floor( sqrt(lTotalJetPx * lTotalJetPx + lTotalJetPy * lTotalJetPy) ) * ptlsb_; + math::PtEtaPhiMLorentzVector lMHTVector( lMHT, 0, acos(lTotalJetPx / ( lMHT / ptlsb_ )), 0 ); + l1t::EtSum lMHTSum(lMHTVector, l1t::EtSum::EtSumType::kMissingHt, 0, 0, 0, 0 ); + + return lMHTSum; + +} + +void Phase1L1TJetSumsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add<edm::InputTag>("inputJetCollectionTag", edm::InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates")); + desc.add<std::vector<double> >("sinPhi"); + desc.add<std::vector<double> >("cosPhi"); + desc.add<unsigned int>("nBinsPhi", 72); + desc.add<double>("phiLow", -M_PI); + desc.add<double>("phiUp", M_PI); + desc.add<double>("etaLow", -3); + desc.add<double>("etaUp", 3); + desc.add<double>("htPtThreshold", 30); + desc.add<double>("mhtPtThreshold", 30); + desc.add<double>("htAbsEtaCut", 3); + desc.add<double>("mhtAbsEtaCut", 3); + desc.add<double>("ptlsb", 0.25), + desc.add<string>("outputCollectionName", "Sums"); + descriptions.add("Phase1L1TJetSumsProducer", desc); +} + +// creates the plugin for later use in python +DEFINE_FWK_MODULE(Phase1L1TJetSumsProducer); diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py index 054ecd7280c0d..cc6bed4bd06ab 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_cff.py @@ -2,8 +2,10 @@ from L1Trigger.L1CaloTrigger.Phase1L1TJetProducer_cfi import Phase1L1TJetProducer from L1Trigger.L1CaloTrigger.Phase1L1TJetCalibrator_cfi import Phase1L1TJetCalibrator +from L1Trigger.L1CaloTrigger.Phase1L1TJetSumsProducer_cfi import Phase1L1TJetSumsProducer Phase1L1TJetsSequence = cms.Sequence( Phase1L1TJetProducer + - Phase1L1TJetCalibrator + Phase1L1TJetCalibrator + + Phase1L1TJetSumsProducer ) From 866e9326528e60be8f146f05e478cd04ab6884b3 Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Fri, 5 Feb 2021 16:05:10 +0000 Subject: [PATCH 112/309] Add config files for 9x9 and trimmed 9x9 jets. (cherry picked from commit e7f4abec4b00fb5fb90590025d347a86a4efd3bc) --- .../Phase1L1TJetCalibrator_9x9Jets_cfi.py | 783 ++++++++++++++++++ .../python/Phase1L1TJetSumsProducer_cfi.py | 25 + .../python/Phase1L1TJets_9x9_cff.py | 25 + .../python/Phase1L1TJets_9x9trimmed_cff.py | 28 + 4 files changed, 861 insertions(+) create mode 100644 L1Trigger/L1CaloTrigger/python/Phase1L1TJetCalibrator_9x9Jets_cfi.py create mode 100644 L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py create mode 100644 L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py create mode 100644 L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9trimmed_cff.py diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetCalibrator_9x9Jets_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetCalibrator_9x9Jets_cfi.py new file mode 100644 index 0000000000000..61769a9d24c97 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetCalibrator_9x9Jets_cfi.py @@ -0,0 +1,783 @@ +import FWCore.ParameterSet.Config as cms +calibration = cms.VPSet( + cms.PSet( + etaMax = cms.double(0.435), + etaMin = cms.double(0), + l1tCalibrationFactors = cms.vdouble( + 1.26146717329, 1.26146717329, 1.26146717329, 1.26146717329, 1.26146717329, + 1.26146717329, 1.26146717329, 1.24623228894, 1.22774013608, 1.20864472626, + 1.18983620186, 1.17220606581, 1.1583247683, 1.14631058894, 1.13609994066, + 1.12752496855, 1.12089178748, 1.11699447611, 1.11526653347, 1.11555762523, + 1.09853049091, 1.09683531526, 1.09514972072, 1.09326684356, 1.09162970037, + 1.08995375793, 1.08825706983, 1.08670271417, 1.08475374607, 1.08288456528, + 1.0811741799, 1.07928109805, 1.07818965233, 1.07651502479, 1.07449932258, + 1.07285243919, 1.0707178513, 1.06924419003, 1.06772074029, 1.06611812413, + 1.0648425894, 1.06246808088, 1.06156200302, 1.0592770589, 1.05752747574, + 1.0562094913, 1.05403560794, 1.05239347578, 1.0505342996, 1.04819572369, + 1.04813853787, 1.04508846408, 1.04554414394, 1.04558937184, 1.04582193656, + 1.04620801277, 1.04629403559, 1.04678402565, 1.04693513867, 1.04707997811, + 1.04729707852, 1.04761924239, 1.04814409297, 1.04817625354, 1.04827738829, + 1.04862435571, 1.04899633011, 1.04928518739, 1.04948410793, 1.04953664235, + 1.05003438124, 1.05022255911, 1.05079418764, 1.05080587637, 1.0509830576, + 1.05107821919, 1.05138802599, 1.05180619558, 1.05197881611, 1.05212175371, + 1.05264782037, 1.05296283034, 1.05308910042, 1.05374518535, 1.05502979799, + 1.0565958427, 1.057764105, 1.0588840728, 1.06031846417, 1.06116441033, + 1.06276845969, 1.06379817554, 1.06450339465, 1.0661557688, 1.06662936414, + 1.06836012995, 1.06997205086, 1.07041209892, 1.07169696027, 1.07258808631, + 1.07293155402, 1.07354286066, 1.07463205829, 1.07708654714, 1.07781843344, + 1.07822325122, 1.07846301946, 1.07932205225, 1.0808090032, 1.08141472035, + 1.08181938516, 1.08304678146, 1.08314137081, 1.08365386745, 1.08384051114, + 1.08474353214, 1.08568646733 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.8924070115, 15.5860038298, 18.0893326776, 20.9564367755, + 23.9770832376, 27.0624635982, 30.5728737338, 34.0912004568, 37.5058618916, + 41.28259481, 45.3408244209, 49.3133175961, 53.093074924, 56.9139697296, + 60.8674434948, 65.0370376256, 69.1457997754, 72.9170868064, 76.9300170371, + 80.9502314594, 84.7098877358, 88.5948271577, 92.6954597315, 96.7404154687, + 100.547576625, 104.423162547, 108.159029626, 112.184798836, 116.572342591, + 120.685724144, 124.826571081, 128.2561768, 131.43475045, 135.675413589, + 139.884195127, 144.229591592, 148.375933576, 151.819999288, 155.412250741, + 158.71961599, 162.913984762, 166.683800103, 170.350694444, 174.986884782, + 178.511914168, 182.524519011, 186.909611243, 190.93306449, 195.756821106, + 198.509859211, 201.441789801, 207.652012822, 211.327924084, 213.366505054, + 217.906400994, 221.370899319, 225.597969342, 230.302703785, 232.47455073, + 235.130646041, 239.088036491, 245.303851371, 249.391477266, 250.369664834, + 253.658062256, 258.934016204, 263.783528944, 267.363086105, 269.208388119, + 273.246568362, 278.280167959, 283.856006586, 288.136679844, 289.522701901, + 291.521289472, 294.493149718, 299.835403885, 304.170916706, 306.486639748, + 311.396126928, 317.568367117, 320.80670045, 326.54801202, 340.789819604, + 361.709366349, 381.775076142, 398.567250891, 417.312413581, 434.046668715, + 452.025958872, 471.353842702, 484.085661524, 501.386857761, 516.988283156, + 533.164985739, 557.695289505, 572.753662147, 585.411908484, 601.380390144, + 610.440455386, 617.447066221, 629.926215437, 655.931555782, 679.314767255, + 687.656469243, 692.386763225, 700.450313755, 717.666313573, 733.02335672, + 740.43804395, 752.41492308, 762.116313664, 766.571413729, 771.702054536, + 779.698558007, 793.245106025, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(0.783), + etaMin = cms.double(0.435), + l1tCalibrationFactors = cms.vdouble( + 1.27440254712, 1.27440254712, 1.27440254712, 1.27440254712, 1.27440254712, + 1.27440254712, 1.27440254712, 1.26237861784, 1.23951156915, 1.21936711031, + 1.20113175263, 1.18314392239, 1.16741650703, 1.1532578472, 1.14251404461, + 1.13200827803, 1.12427897706, 1.11860055115, 1.11471654207, 1.11309371657, + 1.1035823547, 1.10196181856, 1.10027074608, 1.09833277227, 1.09643569091, + 1.09479603469, 1.09254753293, 1.0910773106, 1.08944340405, 1.08705077883, + 1.08537639048, 1.08421015427, 1.08256687333, 1.07995863059, 1.07902607265, + 1.07655905818, 1.07503735031, 1.07301389635, 1.07165575749, 1.06929921168, + 1.06821092927, 1.06616199123, 1.06487780021, 1.06328778675, 1.0601816044, + 1.05917489441, 1.05866746046, 1.05722684059, 1.05413790801, 1.05293443771, + 1.05073793986, 1.05074440903, 1.05156882707, 1.05163408963, 1.05181488861, + 1.05200189767, 1.05217943685, 1.05254100206, 1.05307882377, 1.05386936932, + 1.05395003667, 1.0542087993, 1.05432475605, 1.05494245045, 1.05517112014, + 1.05525094335, 1.0557115483, 1.05594207892, 1.05625830743, 1.05696698354, + 1.05725628851, 1.05743196571, 1.05751284882, 1.05781632022, 1.05799531513, + 1.05839650856, 1.05904363259, 1.05904762922, 1.05949497688, 1.05993791442, + 1.06013251385, 1.06028823516, 1.06060327995, 1.06148490738, 1.0633070629, + 1.06449096664, 1.06670714728, 1.06801525532, 1.06985663341, 1.07108256509, + 1.07206439709, 1.0740254986, 1.07557580148, 1.07619628328, 1.07858299527, + 1.07945640742, 1.08120547417, 1.08132667522, 1.0830354305, 1.08433727452, + 1.08550593118, 1.08573737565, 1.08856278526, 1.08898559663, 1.09085721249, + 1.09115172941, 1.09275835574, 1.09276976832, 1.09444259455, 1.09563540181, + 1.09592154537, 1.09651685067, 1.0973090816, 1.09896312764, 1.09908156772, + 1.0999610622, 1.10120919691 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.5166014072, 15.373411826, 17.8203160866, 20.5214351446, + 23.7435311152, 26.9752802487, 30.159287011, 33.795645223, 37.5316299794, + 41.1721803568, 44.9660370105, 48.902377368, 52.876112172, 56.6808679777, + 60.5654106611, 64.6237707464, 68.5221021533, 72.5227681626, 76.5042056448, + 80.2180681472, 83.8258362025, 87.532675527, 91.5948377827, 95.8875954562, + 99.8464322114, 104.198630369, 108.361173199, 111.835770689, 116.342857134, + 120.895256769, 124.074901486, 127.219726204, 131.978656674, 135.94204146, + 139.747342798, 144.212107373, 148.180373794, 151.965549722, 156.12357104, + 159.979529336, 163.491167779, 167.222095949, 170.439328244, 175.696001155, + 180.29975505, 181.994607597, 184.175155894, 189.245297056, 194.049985541, + 198.340003157, 201.321048531, 206.218215217, 211.461904271, 212.912166551, + 215.079990584, 217.228601695, 220.406029412, 225.706926541, 233.536191247, + 238.671033554, 240.671600092, 242.880158901, 247.204225898, 252.192611789, + 254.010838342, 257.196068218, 261.26955259, 264.492096592, 270.532782577, + 276.414783911, 279.155342625, 280.667483589, 282.932830907, 285.776439406, + 289.196011843, 295.374690785, 299.212331303, 301.872509758, 307.119762288, + 310.877341827, 312.94209744, 315.716746046, 322.769813223, 338.705641346, + 356.423056004, 376.462815601, 397.234622991, 415.797381365, 433.875800387, + 446.888140191, 464.233497952, 484.92936658, 497.723755857, 515.447857308, + 534.662705108, 550.119335237, 561.142507879, 571.928088666, 589.672261866, + 604.233147494, 612.485204409, 630.501998671, 649.646690452, 663.169816605, + 675.936788044, 687.141937495, 696.678498096, 706.605234297, 723.494993391, + 732.211782606, 737.406954657, 745.584955357, 760.003068783, 770.449925926, + 776.331653061, 788.871688149, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.131), + etaMin = cms.double(0.783), + l1tCalibrationFactors = cms.vdouble( + 1.28877882208, 1.28877882208, 1.28877882208, 1.28877882208, 1.28877882208, + 1.28877882208, 1.28877882208, 1.27694835829, 1.25297836741, 1.23044531865, + 1.20855235448, 1.1893282309, 1.1725504389, 1.159203929, 1.14569587541, + 1.13380083086, 1.12771359895, 1.12132733429, 1.11801327984, 1.1164039178, + 1.09801792847, 1.09588518489, 1.09370961881, 1.09201093419, 1.09011871384, + 1.08808881147, 1.08571111049, 1.0844474359, 1.0816414337, 1.07974691293, + 1.07795760075, 1.07551422323, 1.07375791565, 1.07236983191, 1.07058218311, + 1.06770191716, 1.06603119504, 1.06362972852, 1.06219040348, 1.05951643702, + 1.05780511343, 1.05549894379, 1.05456596784, 1.05183218447, 1.04998506398, + 1.04777908115, 1.04555637855, 1.04371561533, 1.04114340237, 1.0397345442, + 1.03703721093, 1.0370020161, 1.03697403511, 1.03684016386, 1.03681653914, + 1.03674288479, 1.03673045853, 1.03669821954, 1.03660261509, 1.03654890521, + 1.03647824831, 1.03641370002, 1.03638368584, 1.0363474327, 1.03626689773, + 1.0362274515, 1.03612736074, 1.03606484142, 1.03601160822, 1.0359745858, + 1.03591575182, 1.03585836866, 1.03576558282, 1.03572050093, 1.03570445277, + 1.03564801105, 1.03564340833, 1.03559278773, 1.03548525195, 1.03540543085, + 1.03537311338, 1.035353379, 1.03531268737, 1.03509757281, 1.03481844747, + 1.03460188756, 1.03436873742, 1.03404872284, 1.03382849525, 1.03352709651, + 1.03339139385, 1.03316615269, 1.03281524483, 1.03254783724, 1.0322983399, + 1.03220214395, 1.03198001329, 1.03179532519, 1.03149961876, 1.03119032511, + 1.03108787294, 1.03084032788, 1.03073682524, 1.03031711785, 1.03026374639, + 1.03000361434, 1.02980821858, 1.02966151075, 1.02953728147, 1.0295357024, + 1.02913791337, 1.02909523261, 1.0288898051, 1.02885866633, 1.02866419809, + 1.02857281869, 1.02854490374 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.5223180803, 15.3157792118, 17.7207146184, 20.4619302345, + 23.3867043945, 26.6674195508, 30.0148453856, 33.5181156442, 37.2034564252, + 41.0654706777, 45.0242304428, 48.9215289734, 52.6171619736, 56.4669723943, + 60.8532828285, 64.6431610877, 68.2511806135, 72.1165788509, 75.9507576219, + 80.178753144, 84.4601989805, 88.7755810919, 92.6561916984, 96.2529914483, + 100.18155266, 104.59639146, 108.243744657, 112.320102165, 117.028341441, + 120.718221713, 124.957859738, 129.164438975, 132.313992074, 135.494937852, + 140.170515382, 144.728974276, 148.807847754, 152.654944304, 156.774988123, + 161.167476996, 165.191565276, 168.436028198, 172.108806818, 176.697230616, + 180.756987451, 185.192942943, 189.263079284, 193.683299739, 197.670906127, + 200.669569599, 203.481912923, 205.680557963, 211.313340235, 216.794515892, + 220.180022472, 223.175800166, 224.730240575, 229.17944849, 234.375886398, + 238.704099822, 243.409511328, 246.700474731, 249.00671039, 253.071170975, + 257.246757399, 262.102924202, 267.762080987, 271.790500732, 274.931577111, + 278.267572043, 282.312161533, 287.538343865, 292.336417173, 294.463865342, + 296.986658469, 299.111127436, 301.033009752, 306.537168829, 313.057563733, + 316.96021075, 318.771719474, 320.874665805, 329.777234102, 346.977773204, + 364.228613586, 379.879425057, 399.130666101, 417.932176338, 436.085818382, + 451.29782338, 463.859392071, 483.910533029, 505.429149973, 523.418477617, + 535.449297178, 546.527701523, 560.68580979, 577.404502376, 598.459717959, + 612.789297808, 624.969903015, 637.187066993, 655.395825055, 671.859917095, + 682.770467826, 698.623748975, 710.529639449, 719.958794038, 724.337177101, + 738.235987456, 753.565219085, 762.199884396, 770.432864923, 778.284440936, + 788.232511997, 792.384194735, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.305), + etaMin = cms.double(1.131), + l1tCalibrationFactors = cms.vdouble( + 1.30464904899, 1.30464904899, 1.30464904899, 1.30464904899, 1.30464904899, + 1.30464904899, 1.30464904899, 1.28753966966, 1.26184241946, 1.23615743701, + 1.21112716928, 1.18830854051, 1.16922129671, 1.15162104151, 1.13926988997, + 1.12013893675, 1.11315074529, 1.10421726948, 1.09857786941, 1.08796490485, + 1.08552778022, 1.08306838599, 1.08021288693, 1.07781388228, 1.07524586684, + 1.07202146179, 1.07155192888, 1.06803593019, 1.0650691697, 1.0625137133, + 1.05970398098, 1.05913981338, 1.05484331908, 1.05247891606, 1.04987962874, + 1.04909722507, 1.04389372917, 1.04368102591, 1.0422637752, 1.0370645451, + 1.03592014765, 1.03435988683, 1.03031862795, 1.02680188551, 1.02408943242, + 1.02282610293, 1.02225324386, 1.01840036238, 0.989241976704, 0.98936641432, + 0.989446855212, 0.98951480633, 0.989647898182, 0.989701958582, 0.989706514106, + 0.989820263437, 0.989821771034, 0.989943716755, 0.990074385744, 0.990085628723, + 0.990095337335, 0.990197326453, 0.990412605548, 0.990427287837, 0.990488988094, + 0.99062322091, 0.990637873057, 0.990783650663, 0.99080168294, 0.990822418393, + 0.990869793135, 0.991049950613, 0.991105067801, 0.991109415833, 0.991144130522, + 0.991182618547, 0.991221896221, 0.991348588885, 0.991390279742, 0.991508569063, + 0.991561035644, 0.991706459406, 0.991709328176, 0.991771803291, 0.992203832104, + 0.992607250874, 0.992961331312, 0.993424404998, 0.993474148563, 0.993704249848, + 0.994181954878, 0.994342287962, 0.994860595811, 0.994943125569, 0.99513621193, + 0.995791648606, 0.995861005306, 0.996071614139, 0.996576493061, 0.996769080865, + 0.99717703025, 0.997283342352, 0.997320725972, 0.997392435524, 0.997393456879, + 0.997724128794, 0.9983288294, 0.998396228241, 0.998558386961, 0.99871575569, + 0.998740910223, 0.998767733861, 0.998828447311, 0.998932961763, 0.999586369087, + 0.99979063868, 0.999822861843 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.7762473951, 15.5332882685, 17.7177050482, 20.5318058753, + 23.6984819534, 26.8528548618, 30.4115268065, 34.1183239417, 37.9102526851, + 41.9771903896, 46.1951438026, 50.2953206763, 54.3412175936, 58.0533034892, + 62.7880145798, 67.2857005426, 70.9603292709, 75.2703501199, 79.2421638597, + 83.2352443262, 87.3871418906, 91.8937910264, 96.3492341157, 100.560911672, + 105.4724697, 108.604664727, 111.984110281, 117.481026109, 122.163470824, + 126.712766881, 129.573592546, 133.695085969, 139.343050191, 143.551904358, + 146.4193363, 151.494950739, 156.0875, 157.469584309, 163.079886507, + 168.458828671, 170.752185315, 175.501873127, 181.910517332, 187.192429336, + 190.563608433, 192.12056492, 195.873276157, 200.366441748, 205.180843606, + 211.088590075, 215.367527804, 221.164675131, 226.561278527, 228.251490056, + 231.662853692, 234.986329234, 238.546150662, 245.830387931, 249.922471264, + 250.526618005, 253.747462754, 262.89600735, 269.527027681, 271.729546239, + 277.379347826, 281.6725, 286.29855042, 291.022068119, 292.139949738, + 294.103932039, 300.664906542, 307.449137311, 309.163838612, 310.2902264, + 312.401053339, 314.643455616, 319.429270833, 324.284671053, 328.897757787, + 333.821566464, 339.527806653, 343.803875892, 345.688090636, 359.947291667, + 384.037727273, 405.880493053, 429.443430116, 444.230702504, 452.300130761, + 472.709983897, 491.10804551, 510.676904206, 528.002275641, 535.9497669, + 560.417237991, 581.316919192, 589.389827419, 610.021177686, 630.132884972, + 647.449593726, 662.278511184, 666.422029703, 669.567771084, 671.664993307, + 681.229489664, 708.201297293, 727.581529851, 734.200905797, 743.414596273, + 748.677721088, 750.176530612, 752.700694444, 757.465101224, 779.320051941, + 804.051478495, 810.870833333, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.479), + etaMin = cms.double(1.305), + l1tCalibrationFactors = cms.vdouble( + 1.49402222179, 1.49402222179, 1.49402222179, 1.49402222179, 1.49402222179, + 1.49402222179, 1.49402222179, 1.49402222179, 1.47291221879, 1.44067526904, + 1.411205428, 1.3790606936, 1.35626109444, 1.32763245033, 1.30702937763, + 1.29039880276, 1.2769964355, 1.26383930097, 1.25651331227, 1.24922145017, + 1.24848514467, 1.25017146805, 1.26970714471, 1.26829421131, 1.2655539554, + 1.26351627994, 1.26218918978, 1.26008701808, 1.25872051661, 1.25553057705, + 1.25531916062, 1.25231191618, 1.25098985677, 1.25092649727, 1.24631095309, + 1.24491550742, 1.24463699336, 1.24089920022, 1.23818713652, 1.23797504425, + 1.23762209646, 1.2357981512, 1.22994667174, 1.22918782752, 1.2288766297, + 1.22661112186, 1.22335120944, 1.2222374654, 1.21863915082, 1.21627578407, + 1.21531079011, 1.21316997355, 1.21159701937, 1.20973271047, 1.20822352112, + 1.20808119953, 1.20712941377, 1.21601638464, 1.21449875865, 1.2128657327, + 1.2125648381, 1.2109969654, 1.21095095908, 1.20763240272, 1.20752194607, + 1.20715412726, 1.20339192426, 1.20316452215, 1.19908630242, 1.19856391893, + 1.19711998156, 1.19710976017, 1.19697659596, 1.19693795887, 1.19237829632, + 1.19185381308, 1.19110119575, 1.19056500802, 1.18847825696, 1.1856511587, + 1.18562060063, 1.17851535013, 1.17823027895, 1.17742187998, 1.17067824059, + 1.16493911336, 1.16357145785, 1.1500930073, 1.14923508822, 1.13766740107, + 1.13594359689, 1.12975025424, 1.12340048965, 1.11872349781, 1.11766570258, + 1.1029557049, 1.09804762317, 1.09571573203, 1.08638808459, 1.08507723903, + 1.08354390779, 1.08218176765, 1.07784354968, 1.07131903088, 1.05973674136, + 1.05896743969, 1.0508941418, 1.04895873762, 1.04534850219, 1.03661916912, + 1.0363330056, 1.03616346044, 1.03608676144, 1.03173422477, 1.02442109082, + 1.01944146354, 1.01859650582 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 12.6732940885, 14.0822469238, 16.0351992264, 18.533035159, + 21.4040329809, 24.2413122912, 27.0941591248, 30.3228808559, 33.4579112263, + 36.5410985835, 39.9175328544, 43.2085508359, 46.7155207753, 50.4991283112, + 53.856301359, 57.0602265701, 60.6020503279, 64.0753510179, 68.3166558302, + 72.2444890811, 75.2333861985, 78.6940353936, 81.7003273087, 85.6517013971, + 90.1974595599, 93.3987216924, 96.661346018, 99.961466543, 104.296497204, + 107.53257168, 110.594828706, 114.713759425, 116.03185691, 120.483399419, + 126.202298261, 127.794915554, 131.616059028, 137.752499071, 140.534562021, + 141.072145181, 143.143256833, 150.445710948, 156.734820295, 157.752865961, + 160.204362204, 165.461286653, 169.622414766, 174.105501125, 179.777487488, + 182.944113735, 185.899004129, 189.432312233, 192.70254897, 195.912119398, + 197.483378752, 198.524320323, 202.308928058, 207.324072464, 211.758643892, + 214.480654762, 217.110961838, 219.382511317, 224.118164062, 228.94453125, + 229.617708333, 235.430751812, 241.046157513, 247.106359649, 253.581750769, + 256.34936537, 258.396107129, 258.597923681, 258.839735591, 265.311884405, + 272.467866122, 274.265396862, 276.079401776, 279.771212121, 286.6875, + 290.709677419, 300.753393266, 311.155338654, 312.694407895, 323.323970985, + 340.893579208, 350.896440929, 371.792471042, 391.971042471, 409.460196929, + 428.168092588, 439.311549189, 456.966087393, 472.486347955, 480.558113227, + 502.751426025, 530.364052288, 540.554380342, 556.965287579, 571.939063803, + 575.942268669, 580.017671131, 588.040977328, 603.330378727, 628.815877093, + 646.200854701, 658.646894491, 672.734234234, 680.539772727, 697.907828283, + 710.597222222, 711.238636364, 711.585227273, 717.819416996, 734.238955119, + 751.541129032, 759.739285714, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.653), + etaMin = cms.double(1.479), + l1tCalibrationFactors = cms.vdouble( + 1.42596303316, 1.42596303316, 1.42596303316, 1.42596303316, 1.42596303316, + 1.42596303316, 1.42596303316, 1.42596303316, 1.4177466629, 1.3995618494, + 1.38276766283, 1.36931683062, 1.35471035569, 1.34046255312, 1.32941184468, + 1.3200455296, 1.30948382237, 1.30681144426, 1.29825728374, 1.29404806931, + 1.29165391765, 1.29030779607, 1.29083243576, 1.27396085005, 1.2718551659, + 1.26738255058, 1.26670434297, 1.26318102804, 1.26166765764, 1.25786412703, + 1.25518057962, 1.2530501746, 1.25083737691, 1.24869400501, 1.24550511467, + 1.24178608904, 1.24042240626, 1.23648242831, 1.23493825442, 1.2342084223, + 1.23053562244, 1.22893151286, 1.22377063054, 1.22034488227, 1.2189599762, + 1.21777849227, 1.21430917685, 1.21153741107, 1.20889147869, 1.20688285726, + 1.20338743284, 1.20096161619, 1.19672737216, 1.19202941837, 1.19004800954, + 1.18746316629, 1.18655348217, 1.18312435414, 1.2078909264, 1.20650658231, + 1.20582228539, 1.20537671722, 1.2049862715, 1.20476513856, 1.20105971422, + 1.19989656052, 1.19785505378, 1.19710626467, 1.19676963305, 1.19462529476, + 1.19282384753, 1.19154278626, 1.1900948274, 1.18954891892, 1.18914968595, + 1.18716610868, 1.18495727793, 1.18196604297, 1.18192678954, 1.17969476053, + 1.17965050907, 1.17895360889, 1.17527559787, 1.1706607414, 1.16483173896, + 1.15823552842, 1.14819433249, 1.14213524047, 1.13251935285, 1.12815142061, + 1.12191024514, 1.11085417981, 1.10484148389, 1.09826582928, 1.0895403454, + 1.0769799347, 1.07350817324, 1.06670957019, 1.06226444487, 1.05723223376, + 1.0482595789, 1.04499468512, 1.03683454016, 1.025456056, 1.02167918917, + 1.01487166026, 1.01290550623, 1.01098880941, 0.986266161192, 0.982622683842, + 0.982314921628, 0.97851685144, 0.969837554507, 0.968857319337, 0.963060466121, + 0.961712306729, 0.936251542713 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 12.685246952, 14.2020094702, 16.2454279268, 18.4570790339, + 21.1373272484, 24.0711882608, 27.0820591121, 30.0028435266, 32.9840363303, + 36.1993781266, 39.2042073033, 42.2602760673, 45.7316358924, 49.1357169678, + 52.2647120658, 55.8647436347, 58.5356962906, 61.5291305064, 65.6115998363, + 68.7852077001, 72.1760839599, 75.8652500891, 79.0593559025, 81.8557422467, + 86.158418801, 89.527423993, 92.275519088, 95.5698701527, 99.0475022401, + 103.290513469, 106.439181353, 109.279945377, 112.129190662, 115.616870088, + 120.135139319, 123.45959276, 126.928564758, 130.515590803, 132.002952756, + 134.882587759, 138.33406251, 142.758849213, 148.375117414, 151.521628111, + 153.200230026, 156.242184166, 160.324295949, 163.867856555, 166.912266376, + 170.512304528, 174.385218076, 178.741372283, 184.583666075, 188.952445129, + 191.939099333, 194.224769217, 197.062661499, 202.978632479, 208.439765991, + 211.111679147, 212.571043719, 213.650862069, 214.440793754, 219.512442241, + 225.800830439, 229.940057283, 233.544079516, 234.946038538, 238.150526944, + 243.247011145, 247.228463203, 250.753340051, 253.328673501, 254.549443975, + 257.627146678, 263.04217524, 269.75872195, 273.67298341, 276.606633772, + 279.546739719, 280.504031385, 286.154786036, 296.866079896, 310.35565294, + 326.40439696, 347.893724986, 368.689296081, 388.935527359, 406.997410523, + 420.700423425, 443.042011475, 465.088489103, 481.347946019, 501.111313869, + 528.604755931, 549.312346814, 562.577829768, 577.100536021, 589.341722273, + 607.430789179, 623.237140805, 637.994032486, 663.23065883, 682.805723566, + 696.47681781, 707.809146027, 712.824342105, 747.232446809, 783.870908347, + 788.974437148, 794.277642276, 810.39375, 822.870265152, 831.623737374, + 840.852430556, 875.479567308, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.83), + etaMin = cms.double(1.653), + l1tCalibrationFactors = cms.vdouble( + 1.28436707004, 1.28436707004, 1.28436707004, 1.28436707004, 1.28436707004, + 1.28436707004, 1.28436707004, 1.27860218313, 1.26114748386, 1.24471548932, + 1.23270424679, 1.2176463909, 1.20808675984, 1.19869392953, 1.1936775499, + 1.18744907855, 1.18433575975, 1.18260381979, 1.18295019864, 1.18491560081, + 1.18809316262, 1.18172024138, 1.18097131001, 1.17918745502, 1.17764940709, + 1.17688881581, 1.17504482963, 1.17248725691, 1.17129302591, 1.17004602745, + 1.1693666084, 1.16756409321, 1.16526063859, 1.16417855306, 1.16338089054, + 1.16187070953, 1.16019586336, 1.15840088317, 1.15626975454, 1.15472336309, + 1.15277251156, 1.15246623852, 1.15140593602, 1.1487970247, 1.14747602274, + 1.14638703449, 1.14512379243, 1.14247008702, 1.14113527821, 1.14044553287, + 1.1383875885, 1.1362425234, 1.13472903282, 1.13376714195, 1.13369814816, + 1.13350729029, 1.16282574417, 1.15866607792, 1.1571074204, 1.15511734699, + 1.15296938865, 1.14945591442, 1.14546738724, 1.14533339505, 1.14012295605, + 1.13927325429, 1.13750627088, 1.13378322433, 1.13171236291, 1.1286109126, + 1.12546123624, 1.12353248187, 1.12272791593, 1.12206079073, 1.11242790976, + 1.11158955611, 1.10975128919, 1.10808940983, 1.10614764171, 1.10457082693, + 1.10456528268, 1.0898943432, 1.08474469459, 1.08098903788, 1.07264937986, + 1.05568600919, 1.04193743035, 1.02564328415, 1.02145534312, 0.999803345141, + 0.98600256732, 0.975181807318, 0.953065655597, 0.948568657631, 0.92718714575, + 0.917282051972, 0.912089302025, 0.91014768072, 0.881521878237, 0.859430480658, + 0.847000750016, 0.835921402493, 0.828394647755, 0.805581771714, 0.80323037479, + 0.777498864082, 0.772467852877, 0.763114519703, 0.753840438847, 0.744731491356, + 0.737491553318, 0.717291473065, 0.715629958029, 0.701675695843, 0.695798790437, + 0.681716394464, 0.677915256402 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.7634866136, 15.6328013015, 17.7753080392, 20.3849274482, + 23.5230630809, 26.6159799854, 29.5849918302, 32.8058836317, 36.3551255626, + 39.6586540788, 43.2891715395, 47.0457162843, 50.5748804671, 53.7537486235, + 57.0903993284, 60.7800647992, 64.3406024724, 68.0650146493, 71.4916076649, + 74.644158805, 78.7362044271, 82.2255472682, 85.2770231354, 89.2792188034, + 92.0485965047, 95.1865655713, 100.489520051, 105.009655946, 107.950824978, + 110.271753676, 113.261963412, 118.208795089, 122.287660256, 124.55236204, + 127.332829028, 131.170118167, 135.350530522, 140.080667464, 144.511307162, + 148.724750804, 151.444112084, 153.090548725, 157.511181119, 162.245901639, + 165.149433932, 167.98337766, 172.702477093, 177.507799446, 179.946962191, + 183.257351475, 188.321095571, 192.72888715, 195.711202161, 196.953201763, + 197.266268454, 202.700189394, 210.834895833, 214.863790761, 217.364080113, + 220.279566498, 224.268378227, 229.553978798, 232.458535806, 236.224001452, + 240.493726516, 242.337334893, 246.205383427, 250.287531857, 253.93172923, + 258.336015088, 261.914067782, 263.839852462, 264.876745306, 272.133704557, + 279.511304302, 281.397140688, 283.863199301, 286.40218059, 288.881228885, + 289.99609375, 300.336538462, 314.301306801, 320.575617396, 329.097476964, + 346.924946684, 368.563318777, 389.730182927, 404.16101626, 422.366770833, + 447.345333473, 464.692652854, 487.898641496, 506.649168399, 524.882098391, + 546.92534949, 557.562667068, 562.589250605, 584.12579584, 619.859041826, + 644.181204029, 660.744730248, 673.853821998, 695.22987368, 712.959581843, + 732.745639535, 754.419642857, 764.554258242, 777.678365385, 790.630288462, + 802.149038462, 821.482142857, 836.884920635, 847.887152778, 861.859375, + 875.921875, 888.521875, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(1.93), + etaMin = cms.double(1.83), + l1tCalibrationFactors = cms.vdouble( + 1.2075501775, 1.2075501775, 1.2075501775, 1.2075501775, 1.2075501775, + 1.2075501775, 1.2075501775, 1.20133355605, 1.19530708945, 1.1903774073, + 1.18470031348, 1.17981636403, 1.17466612498, 1.17013138415, 1.16570649395, + 1.16262296754, 1.15961379695, 1.1567798582, 1.15461512052, 1.15166019705, + 1.15059363693, 1.14781934175, 1.1468890285, 1.14439368656, 1.1401875604, + 1.13984882528, 1.13572729329, 1.13486154989, 1.13303702319, 1.12825443539, + 1.12724956215, 1.12465904179, 1.12162552813, 1.12147167362, 1.12055227448, + 1.11576929423, 1.11397531519, 1.11305961492, 1.10776036523, 1.10688504821, + 1.1049969562, 1.10395365658, 1.1004820424, 1.10020941695, 1.09364390424, + 1.09317323804, 1.09263618254, 1.08730605402, 1.08462991715, 1.08438007388, + 1.08214472159, 1.08209582567, 1.07713798478, 1.06280435801, 1.06125183068, + 1.06112183264, 1.06039791195, 1.06008868406, 1.05691560019, 1.0565842396, + 1.05634385411, 1.05575454385, 1.0537213763, 1.05344424321, 1.05312642297, + 1.05270479117, 1.05177723394, 1.05040270302, 1.04838541277, 1.04816948872, + 1.04767671633, 1.04649582963, 1.04631815897, 1.04547121251, 1.04486369542, + 1.04344015331, 1.04328394209, 1.04310709983, 1.04295802389, 1.03991666934, + 1.03829941334, 1.03817848315, 1.0372602046, 1.03498791406, 1.02967074065, + 1.02645904098, 1.02456252935, 1.02028571289, 1.01532132205, 1.00708648081, + 1.00557866056, 1.00227921875, 0.998369858075, 0.990255818748, 0.989183194449, + 0.98548744733, 0.978667289452, 0.977142200594, 0.967587781957, 0.966301554612, + 0.96164692143, 0.961353555121, 0.959804877641, 0.958874784431, 0.956874521799, + 0.948352201413, 0.947703706372, 0.947132960055, 0.945451349391, 0.944535445859, + 0.94373366214, 0.934967051729, 0.93335906675, 0.927113925719, 0.924216523587, + 0.919275945565 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.1553016676, 16.2664390716, 18.850560812, 21.4525843899, + 24.2848068147, 27.54630177, 31.3476954248, 35.0449062766, 38.2354125974, + 41.5290770126, 45.0155066897, 48.5944191332, 52.3320360328, 56.1346401629, + 59.6217196328, 62.7708486989, 66.1328716295, 69.3619089373, 73.3173162311, + 76.8510115304, 81.249183365, 85.3190875777, 88.0806578066, 93.4830038621, + 97.1468149946, 100.742431072, 104.762891529, 106.931635726, 112.25791923, + 116.923444288, 119.821848062, 124.355627455, 126.925104108, 127.79030074, + 132.387237762, 137.68921183, 139.873602642, 144.883745186, 149.86133302, + 152.089037698, 154.452160494, 158.091829657, 161.110224719, 166.622746479, + 172.294917532, 173.107285995, 177.837079228, 184.291279354, 186.650039706, + 188.653464364, 190.494896589, 194.531045752, 199.945492662, 205.024103774, + 208.991538462, 211.005099068, 213.441287879, 221.652661483, 229.916224533, + 231.264415323, 233.220857558, 239.404722354, 244.852465986, 246.255380037, + 247.999025468, 251.180445151, 256.608823529, 264.606818182, 269.872790404, + 271.543913399, 275.490441176, 278.693951613, 281.110023041, 284.53968254, + 289.328968254, 293.054064039, 293.839412025, 294.607934858, 302.131045519, + 313.116159539, 317.21484375, 319.665322581, 327.188760081, 345.084895833, + 365.196180556, 377.241463795, 391.79831766, 413.58930336, 444.713405239, + 467.686831812, 479.022469636, 496.020996641, 524.372458629, 546.03482906, + 557.278761808, 582.075514874, 601.753804348, 627.879545455, 653.442045455, + 667.450735294, 679.118235294, 683.461818182, 689.306818182, 696.216666667, + 721.029166667, 742.654166667, 745.529166667, 750.840277778, 756.965277778, + 761.015625, 783.578125, 808.041666667, 826.55952381, 848.117857143, + 866.6, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.043), + etaMin = cms.double(1.93), + l1tCalibrationFactors = cms.vdouble( + 1.2042309243, 1.2042309243, 1.2042309243, 1.2042309243, 1.2042309243, + 1.2042309243, 1.2036640024, 1.19524481612, 1.18325954566, 1.17368692683, + 1.16506130726, 1.15388106163, 1.14598632447, 1.13983893861, 1.13173200239, + 1.12546585042, 1.11919443175, 1.11241946353, 1.10679191353, 1.10277852463, + 1.11490627601, 1.11335120331, 1.11096141728, 1.1100935654, 1.10764450009, + 1.10624839945, 1.10429555791, 1.10156835063, 1.09955747398, 1.09789752189, + 1.09641249383, 1.09381679019, 1.09212245543, 1.09111912485, 1.08977982989, + 1.08630997483, 1.08401046173, 1.08083468198, 1.08080770014, 1.07993240947, + 1.07653702393, 1.07631811434, 1.07301303878, 1.07283358668, 1.07001112188, + 1.06715409534, 1.0655999551, 1.06480464407, 1.06127745288, 1.06095399959, + 1.0595969905, 0.984257510274, 0.984200634859, 0.98372269169, 0.98276381661, + 0.98266206775, 0.982472890781, 0.98197300242, 0.981690492126, 0.981228789794, + 0.980704442874, 0.980684026587, 0.979800102722, 0.979593434658, 0.979151401752, + 0.978667991619, 0.978456340039, 0.97838130467, 0.977422760752, 0.977354967521, + 0.977290768842, 0.977152281231, 0.976393403414, 0.976162511198, 0.975933603237, + 0.975769076539, 0.975703772172, 0.975379887997, 0.974640979874, 0.974534324589, + 0.973636260808, 0.972439925244, 0.972186024592, 0.97169810365, 0.969210446816, + 0.967673923531, 0.964817552461, 0.963418429289, 0.961590054487, 0.960059426291, + 0.957463919289, 0.957075193291, 0.95355179413, 0.952130925316, 0.949695436177, + 0.948922486673, 0.94612010092, 0.945132832372, 0.943722360083, 0.942093889524, + 0.940692364001, 0.939819564434, 0.936657595081, 0.935648076104, 0.933290760148, + 0.932922673767, 0.932487858551, 0.929229710674, 0.928871233299, 0.927770557843, + 0.924947493401, 0.924880802499, 0.924463019827, 0.921416182608, 0.918224719831, + 0.917399847078 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.774327423, 16.7467039494, 19.3220519597, 21.9668153648, + 24.8434771127, 28.3182127012, 31.5913687934, 35.0924952038, 38.9535281293, + 42.3917608897, 46.3696188172, 50.4144256002, 53.5857932878, 57.0301456325, + 60.7164859952, 64.1946035834, 68.1349803463, 72.2419874509, 75.7665473847, + 79.6012507013, 83.4598320886, 87.4613764276, 90.7658249374, 94.1304045289, + 98.0308235506, 101.427888328, 106.175187062, 110.981354838, 114.704931512, + 117.895103426, 122.034473158, 126.386157219, 129.122586641, 131.498874511, + 136.377129554, 142.229400591, 147.783370605, 151.032154249, 151.947391963, + 156.279435613, 159.945666315, 163.520289331, 167.054887874, 170.099940784, + 175.861043525, 180.335596527, 182.718808205, 187.103422578, 191.009398855, + 192.714008621, 197.379894037, 200.976387994, 203.864313553, 211.622877431, + 217.350058724, 218.921006636, 222.641837284, 226.866651348, 230.885267621, + 236.209758809, 239.151383574, 244.034660107, 249.923663227, 253.426533491, + 258.423761872, 262.176971925, 263.725030637, 269.306175595, 274.848214286, + 275.560947205, 276.655417251, 281.501031508, 286.845614257, 289.328453717, + 291.452931141, 292.693978162, 294.795527307, 300.534417344, 305.100309876, + 310.525614754, 321.835, 329.666018519, 333.671723647, 349.739316239, + 371.469175627, 395.190026541, 418.168941192, 435.596858199, 453.734879032, + 476.015277778, 492.129607046, 513.254389509, 539.952560241, 560.776209677, + 578.101209677, 597.407386364, 617.870847902, 630.818223443, 647.22797619, + 663.589417989, 675.87037037, 697.657407407, 720.182705026, 738.363016917, + 753.079706478, 757.415232794, 777.356578947, 796.885714286, 804.764880952, + 825.952380952, 841.556547619, 844.172619048, 862.880952381, 896.566666667, + 918.254166667, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.172), + etaMin = cms.double(2.043), + l1tCalibrationFactors = cms.vdouble( + 1.2157935489, 1.2157935489, 1.2157935489, 1.2157935489, 1.2157935489, + 1.2157935489, 1.2131670386, 1.19252693905, 1.16613128795, 1.14891680382, + 1.13585884458, 1.11956017752, 1.10976982201, 1.10285725152, 1.09763906728, + 1.09602675736, 1.09773310507, 1.10102752345, 1.10591456862, 1.12056604454, + 1.09024831793, 1.0866258585, 1.08397193938, 1.08121891991, 1.07860560959, + 1.07354275531, 1.06972453158, 1.06917647609, 1.06336781577, 1.06252684817, + 1.05814049533, 1.05375938581, 1.04843010939, 1.04614697071, 1.04491970624, + 1.0411245951, 1.03745844809, 1.03489726734, 1.03360755376, 1.02882103269, + 1.02188125281, 1.02178616775, 1.01439480032, 1.01409606035, 1.01341880324, + 1.00827791468, 1.00542136086, 0.998511182345, 0.994448442251, 1.04477728911, + 1.04421248637, 1.04392479755, 1.04274630788, 1.04272994051, 1.04168658376, + 1.04135777469, 1.03965139823, 1.03957385755, 1.03896194302, 1.03828897643, + 1.03719007928, 1.03617088577, 1.03571879048, 1.03499873182, 1.0346382378, + 1.03177687804, 1.03176555727, 1.03159294818, 1.03108256137, 1.03015878893, + 1.02995488679, 1.02899017097, 1.02649853162, 1.02628818447, 1.02560062889, + 1.02505812439, 1.02504298404, 1.02401015146, 1.0238655626, 1.0238353063, + 1.02376716185, 1.02349302901, 1.01992907169, 1.01735550261, 1.01183126604, + 1.00598039495, 1.00503085618, 1.00325705789, 0.997956898494, 0.994701643546, + 0.994616268066, 0.988149085989, 0.986924650126, 0.984155654984, 0.978759764732, + 0.97776008685, 0.972914253171, 0.9716143493, 0.961266323588, 0.959651973391, + 0.957930376835, 0.957798054327, 0.953759936411, 0.952946229034, 0.949084679396, + 0.947113174765, 0.943899628142, 0.939131455009, 0.934865194838, 0.930798559139, + 0.928294697889, 0.902970907566, 0.902468994604 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.5720423979, 16.5824805021, 19.0934145429, 22.0784007761, + 25.1490151046, 28.497403927, 31.9362849912, 35.7593269258, 39.7393275631, + 42.9558645787, 46.7338248946, 50.7967533731, 54.2877761449, 58.0901293351, + 62.2284810254, 66.2495543993, 69.6790156787, 72.5465787405, 76.7862415377, + 81.6681494869, 85.8291480655, 89.4707953394, 92.6079807459, 95.7216043282, + 100.175428087, 105.328360356, 107.861739865, 111.55, 115.408212058, + 118.441180371, 123.528191168, 129.162300109, 133.579135466, 135.615923077, + 138.529979381, 142.85911125, 146.472298535, 148.706644144, 152.232164977, + 159.0359375, 163.117669753, 167.461419753, 171.923333333, 172.489621212, + 175.865395022, 180.505628882, 186.17243083, 192.539079823, 197.591920732, + 201.834787736, 204.170204403, 208.186827957, 211.46016129, 214.363295455, + 218.122369529, 223.697798564, 228.584873138, 230.473648649, 233.993604651, + 238.847658705, 244.6502079, 248.680831266, 251.891969086, 254.852163462, + 263.678492485, 271.548254836, 272.052134146, 273.923214286, 277.852120536, + 280.94140625, 284.142857143, 293.611607143, 301.01375, 303.473571429, + 306.843344156, 308.371022727, 311.241964286, 314.467532468, 314.946524064, + 315.216094771, 316.153769841, 326.668290043, 343.482159091, 365.66625, + 396.828571429, 415.458422175, 422.919055292, 442.298295455, 465.736013986, + 474.887733888, 492.838588589, 513.909920635, 524.85, 547.217857143, + 564.738636364, 580.752525253, 597.588888889, 629.498611111, 662.269764957, + 671.408653846, 676.4875, 687.9125, 701.204166667, 714.012121212, + 729.991883117, 744.196428571, 766.0625, 790.8125, 813.640625, + 831.640625, 907.875, 978.625, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.322), + etaMin = cms.double(2.172), + l1tCalibrationFactors = cms.vdouble( + 1.27175839461, 1.27175839461, 1.27175839461, 1.27175839461, 1.27175839461, + 1.27175839461, 1.27175839461, 1.25215773409, 1.22958887764, 1.20467102121, + 1.18331005838, 1.16118964804, 1.14659600623, 1.13536255747, 1.12227110191, + 1.11136706147, 1.10575962446, 1.10196633526, 1.10080589724, 1.10257943107, + 1.0895166152, 1.08712811776, 1.08506891006, 1.08334188412, 1.07944257634, + 1.07931511022, 1.07630099342, 1.07361351611, 1.07140563288, 1.06922569703, + 1.06658310837, 1.06465192235, 1.06420654338, 1.06188411668, 1.05901973065, + 1.05528665699, 1.05300137798, 1.051994328, 1.05135284213, 1.04907816509, + 1.04583953913, 1.04219906506, 1.04019715537, 1.03946927527, 1.03680516372, + 1.03482472473, 1.03422230477, 1.0290706971, 1.02587253395, 1.04189050346, + 1.04062098834, 1.03935940395, 1.03844770162, 1.03554348618, 1.03344374769, + 1.03259309389, 1.03096624127, 1.03091664154, 1.0307058552, 1.02970686067, + 1.02797665766, 1.02297895874, 1.0225585419, 1.02255209792, 1.02200274202, + 1.01925034359, 1.01836955561, 1.01481130761, 1.01304746603, 1.0125551422, + 1.01159949029, 1.0101101956, 1.009911649, 1.00887160684, 1.00769969245, + 1.00576601578, 1.00232319829, 1.00190642009, 1.00161081362, 1.00153977401, + 0.999733338201, 0.991799358109, 0.990838727914, 0.988553070499, 0.979019416267, + 0.972596120228, 0.965820586276, 0.961922937946, 0.95947715169, 0.938855080551, + 0.935398002383, 0.930922826071, 0.917969221694, 0.913373875384, 0.905540501267, + 0.903909529794, 0.891888232267, 0.890539229272, 0.886803191571, 0.874256627624, + 0.868131613929, 0.865423598775, 0.854669607728, 0.85255321933, 0.849689435029, + 0.842563274095, 0.832262530564, 0.825380568291, 0.819209002123, 0.812060641311, + 0.807167788133, 0.799199511816, 0.777177232542, 0.768504480086 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 13.8611374939, 16.0113120701, 18.5774916373, 21.1920554612, + 24.1752187507, 27.0444032168, 30.4197485207, 34.1362264284, 37.630227696, + 41.3788405138, 45.3845868193, 49.2170575261, 52.3470983693, 55.8753769944, + 60.2185652965, 64.1891998797, 67.746979597, 71.9226859348, 76.0177144871, + 79.2426623888, 82.8780435994, 86.9768023638, 90.4659856164, 95.6509032122, + 99.3617550597, 102.256863911, 107.511137313, 112.022430505, 116.066001586, + 120.510173128, 124.725110598, 126.915221292, 129.465877728, 134.245757114, + 140.325610632, 145.871791188, 148.905819269, 150.425018615, 153.112392871, + 158.193147611, 164.532545265, 169.732253692, 172.247876799, 175.373748474, + 179.653909058, 182.034128838, 187.336722065, 195.031408476, 200.278290307, + 204.364974552, 207.927915687, 210.987176147, 216.358711473, 223.402604167, + 227.555769231, 231.043269231, 233.403153153, 233.769689611, 235.47265625, + 239.314453125, 248.785087719, 256.411981659, 257.012858852, 257.795239106, + 262.443004352, 267.557315064, 273.805992313, 281.29771353, 284.473639456, + 286.511904762, 289.953571429, 292.329487179, 294.073005698, 297.186700337, + 301.558333333, 309.126638002, 314.559657218, 315.562456446, 316.078571429, + 318.721428571, 332.432674772, 344.953309693, 349.522996357, 366.160632113, + 388.622678491, 407.202214452, 422.226483586, 431.155916807, 463.627740925, + 497.523125651, 508.689085624, 533.222976718, 557.926026958, 575.421506352, + 588.744137931, 607.961964286, 626.782873377, 633.940909091, 656.861363636, + 683.14469697, 695.578645833, 714.528645833, 732.645833333, 739.65625, + 753.71875, 778.25, 802.4375, 820.8125, 839.5625, + 856.5125, 874.616666667, 916.833333333, 960.041666667, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.5), + etaMin = cms.double(2.322), + l1tCalibrationFactors = cms.vdouble( + 1.52098890483, 1.52098890483, 1.52098890483, 1.52098890483, 1.52098890483, + 1.52098890483, 1.52098890483, 1.52098890483, 1.51895546826, 1.46136782786, + 1.41340180478, 1.35573588879, 1.31548728533, 1.2660316752, 1.24305402297, + 1.20796926099, 1.18988784161, 1.17884713219, 1.17592060458, 1.17998100319, + 1.20630819302, 1.20702059628, 1.16461440063, 1.1627843218, 1.15462180385, + 1.14998530406, 1.14403998714, 1.14283512108, 1.13526703393, 1.13059271226, + 1.12854192667, 1.11889321097, 1.11775202034, 1.1054171342, 1.10277511289, + 1.09594837096, 1.0913309999, 1.08820170399, 1.07970532444, 1.07452255879, + 1.06815095029, 1.0610340945, 1.05826841645, 1.05159167139, 1.04828178929, + 1.04695109923, 1.040946783, 1.03753240119, 1.03143269275, 1.01975938867, + 1.01717478622, 1.01699522985, 1.01689154612, 1.01658655876, 1.01575891227, + 1.01298629449, 1.01236640909, 1.01165960029, 1.00992588245, 1.00974364973, + 1.0092096141, 1.0091517754, 1.00820583884, 1.00643626079, 1.00571818371, + 1.00528017329, 1.0050951432, 1.00493058446, 1.00347528251, 1.00215164281, + 1.00202838906, 0.999594624288, 0.998682402719, 0.99802438797, 0.997853420087, + 0.997793406637, 0.997477519847, 0.9948799271, 0.993917034924, 0.992918147191, + 0.992749818395, 0.99256051789, 0.992049160684, 0.990263478702, 0.984112026821, + 0.978946943439, 0.977244896076, 0.970657922256, 0.966699455759, 0.963014448433, + 0.957912516057, 0.956213356451, 0.947912641797, 0.944214889997, 0.939896603289, + 0.932799639357, 0.930035262422, 0.920920793695, 0.917125860352, 0.915876952158, + 0.915867590189, 0.915004674903, 0.901780409368, 0.896212297563, 0.891688206722, + 0.889600164796, 0.887412692301, 0.860715584811 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 12.3465412359, 13.9372836782, 15.8932447157, 17.9567741799, + 20.2201934345, 22.1859464929, 24.7687444772, 28.3358498854, 31.553573754, + 34.3379949843, 37.4578756454, 40.6769264758, 44.1823241936, 47.422092709, + 50.849889017, 54.8346440435, 58.3587018402, 61.9463616926, 65.3145012856, + 70.0209069248, 73.199696694, 77.0267305735, 81.5382115009, 85.589096942, + 90.7776736182, 95.0674221357, 97.9660252463, 101.522481012, 106.485414746, + 109.211696977, 113.95454215, 118.328647842, 123.791696575, 129.863165046, + 133.701694304, 138.34100796, 141.481418919, 146.194335938, 151.739706308, + 156.423718585, 161.891789075, 165.898056245, 169.725907519, 173.774372943, + 175.655608281, 178.629136668, 182.447370065, 186.304274383, 193.50925215, + 202.982657241, 208.175298886, 208.887454356, 209.914983165, 212.762784091, + 221.814990942, 230.344820487, 233.680550699, 239.816809117, 244.634116809, + 246.435042735, 247.923202614, 250.447012138, 257.274677579, 263.529431997, + 266.43620283, 268.002724359, 268.881701632, 272.954545455, 279.941686603, + 283.579635863, 290.008791832, 298.421663279, 302.369735663, 304.45406106, + 305.034821429, 305.979953917, 313.305366005, 322.257554945, 327.190092166, + 330.124844913, 331.024038462, 332.785714286, 338.561199723, 358.517672937, + 386.971033654, 404.237179487, 425.078409091, 451.592992424, 470.811111111, + 492.904265873, 510.004369301, 535.147226444, 565.315178571, 585.470043103, + 614.171605603, 638.966145833, 668.833333333, 701.291666667, 713.973484848, + 717.137175325, 719.330357143, 754.75, 802.0, 827.375, + 844.0, 854.75, 927.375, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(2.964), + etaMin = cms.double(2.5), + l1tCalibrationFactors = cms.vdouble( + 1.3918486761, 1.3918486761, 1.3918486761, 1.3918486761, 1.3918486761, + 1.3918486761, 1.3918486761, 1.3918486761, 1.36703547997, 1.31736470956, + 1.26434084266, 1.21404966543, 1.17272244317, 1.12964733287, 1.09922572696, + 1.07489413214, 1.04575625838, 1.03614621508, 1.0189580814, 0.986964784102, + 0.982458030641, 0.978031042361, 0.974273380329, 0.971371999377, 0.96837697535, + 0.964571949947, 0.959066324787, 0.954816960611, 0.951051733139, 0.947034095561, + 0.943943667589, 0.938609460085, 0.937019169869, 0.932068478426, 0.928858927549, + 0.926316705707, 0.920620507742, 0.917363382195, 0.913676796538, 0.913073182723, + 0.90574749251, 0.900207435866, 0.894934151475, 0.910472072588, 0.910358697956, + 0.909635081259, 0.908573398308, 0.90826193476, 0.907612137329, 0.905710315215, + 0.90469219147, 0.90441181284, 0.904047558298, 0.903685516587, 0.902896006391, + 0.900438172704, 0.900210427796, 0.899854579435, 0.899045004048, 0.898129764354, + 0.897823164358, 0.89675805585, 0.895325000445, 0.893395983258, 0.893215118042, + 0.893140210389, 0.891265616092, 0.890965233319, 0.890412121542, 0.890372676695, + 0.888807907347, 0.887953767739, 0.887495255962, 0.886434140358, 0.885443967903, + 0.883245786048, 0.882202319982, 0.881358584844, 0.881034970476, 0.880334968579, + 0.878047857587, 0.877560128555, 0.875956745243, 0.875620944741, 0.870531125372, + 0.866385311313, 0.861266229338, 0.859959502058, 0.853992060055, 0.848393476744, + 0.84511718603, 0.843056740086, 0.839164575537, 0.837340755606, 0.835467151152, + 0.83475709971, 0.816664565995, 0.811494584033, 0.810888989616, 0.808659504987, + 0.802552720798, 0.797094894576, 0.794851952293, 0.792773492445 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 14.9280984166, 15.5184273833, 16.4023808425, 18.0557795913, + 20.1991457662, 22.7308290002, 25.8917360906, 29.6875539525, 33.7956696286, + 38.015162488, 42.6730248745, 47.2635724398, 52.0970691846, 56.9054288356, + 61.1308154962, 66.3128316967, 70.8061386875, 75.9997818499, 81.2539330218, + 85.4687663551, 91.0077784091, 96.0823460483, 100.211021404, 103.866853328, + 108.082954136, 113.855653548, 119.903847585, 124.872977098, 129.69843373, + 134.105507709, 139.328868627, 143.622128658, 147.677604774, 152.737039207, + 156.303197637, 161.411102918, 166.962255873, 171.267428462, 173.927396399, + 178.843646708, 186.820542503, 193.524925513, 199.719612493, 202.960729245, + 205.293021006, 210.267791371, 214.09408939, 216.772660819, 223.882795699, + 232.019278639, 235.637579431, 237.433861643, 239.457699535, 242.666520144, + 251.715303709, 259.198717949, 260.824911348, 264.072386095, 268.878615098, + 272.283293909, 276.105584931, 283.066764706, 292.435241935, 298.314468126, + 299.027183937, 304.459507042, 310.520120724, 312.898399015, 314.549568966, + 319.019741379, 325.760075758, 329.41780303, 333.652272727, 339.3682247, + 348.252632734, 357.285544397, 362.544265328, 365.797106237, 368.649431818, + 376.973076923, 384.70521978, 390.532142857, 395.935714286, 411.054304029, + 436.789566755, 462.60637027, 480.512006162, 500.781612903, 533.010555556, + 557.740555556, 572.611470588, 589.198529412, 605.12622549, 615.429166667, + 622.628571429, 675.022321429, 739.84375, 755.9375, 763.8375, + 787.066666667, 819.291666667, 840.75, 852.791666667, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(3.489), + etaMin = cms.double(2.964), + l1tCalibrationFactors = cms.vdouble( + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 26.2286936937, 25.0883854167, 21.5503612231, 19.2925423089, + 21.3457232423, 22.8334014207, 23.9319267237, 26.6239039363, 30.3986741142, + 33.7250755974, 37.8195972328, 42.1978424806, 52.2604512363, 80.2692022114, + 122.67241995, 166.87206295, 199.54597288, 226.44949301, 245.655374, + 257.034237337, 257.866298241, 287.3217783, 347.484176974, 307.774717514, + 272.791666667, 304.614583333, 366.880208333, 406.911458333, 296.145833333, + 209.0, 217.875, 211.25, 178.5, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(4.191), + etaMin = cms.double(3.489), + l1tCalibrationFactors = cms.vdouble( + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 22.5440519958, 20.5700369268, 18.940228544, 19.656022303, + 21.0931801845, 23.113990869, 26.3227763633, 30.3817638115, 35.043540285, + 39.4982579153, 43.4506655731, 48.6407605324, 59.5995676838, 82.7690755527, + 114.280107948, 142.242281862, 162.02662341, 183.956841939, 210.824209207, + 229.926842684, 227.643518519, 238.016534392, 247.125, 298.946428571, + 271.65625, 243.03125, 326.625, float('inf') + ) + ), + cms.PSet( + etaMax = cms.double(5.191), + etaMin = cms.double(4.191), + l1tCalibrationFactors = cms.vdouble( + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0 + ), + l1tPtBins = cms.vdouble( + -float('inf'), 20.1275528907, 18.8347289263, 19.1060971818, 20.3123157733, + 21.92154214, 24.441478902, 27.4055129042, 30.8574386517, 34.6682463198, + 39.247933023, 43.9824249801, 47.9520354357, 57.1837291686, 77.2409768212, + 102.910275424, 131.248104371, 147.631578947, 175.0, 199.875, + float('inf') + ) + ) +) + +Phase1L1TJetCalibrator = cms.EDProducer('Phase1L1TJetCalibrator', + inputCollectionTag = cms.InputTag("Phase1L1TJetProducer", "UncalibratedPhase1L1TJetFromPfCandidates", ""), + absEtaBinning = cms.vdouble([p.etaMin.value() for p in calibration] + [calibration[-1].etaMax.value()]), + calibration = calibration, + outputCollectionName = cms.string("Phase1L1TJetFromPfCandidates") +) \ No newline at end of file diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py new file mode 100644 index 0000000000000..d150ab3bcb013 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms +from math import pi + +sinPhi = cms.vdouble( + -0.0353352962792, -0.122533930843, -0.208795013406, -0.293458528818, -0.375876685504, -0.455418871948, -0.531476481737, -0.603467570232, -0.670841307236, -0.733082191603, -0.789713995522, -0.840303408309, -0.884463351833, -0.921855942186, -0.952195074957, -0.975248614326, -0.990840169216, -0.998850442928, -0.999218145922, -0.99194046477, -0.977073083675, -0.954729758418, -0.925081445966, -0.888354996422, -0.844831417308, -0.794843723474, -0.738774389082, -0.677052421152, -0.610150077076, -0.538579251202, -0.462887558141, -0.383654142772, -0.301485248985, -0.217009581095, -0.130873493387, -0.0437360446299, 0.0437360446299, 0.130873493387, 0.217009581095, 0.301485248985, 0.383654142772, 0.462887558141, 0.538579251202, 0.610150077076, 0.677052421152, 0.738774389082, 0.794843723474, 0.844831417308, 0.888354996422, 0.925081445966, 0.954729758418, 0.977073083675, 0.99194046477, 0.999218145922, 0.998850442928, 0.990840169216, 0.975248614326, 0.952195074957, 0.921855942186, 0.884463351833, 0.840303408309, 0.789713995522, 0.733082191603, 0.670841307236, 0.603467570232, 0.531476481737, 0.455418871948, 0.375876685504, 0.293458528818, 0.208795013406, 0.122533930843, 0.0353352962792 ) + +cosPhi = cms.vdouble( -0.999375513427, -0.992464324695, -0.977959427777, -0.955971804952, -0.926669691581, -0.890277288868, -0.847073048421, -0.797387541713, -0.741600930761, -0.680140059366, -0.613475187173, -0.542116391547, -0.466609664777, -0.387532736497, -0.305490653258, -0.2211111491, -0.135039842524, -0.0479352966351, 0.039536019772, 0.126704831606, 0.212904178348, 0.297474517214, 0.379768769555, 0.459157271892, 0.535032593708, 0.606814185113, 0.673952818851, 0.735934792636, 0.792285859677, 0.842574857312, 0.886417005995, 0.923476853383, 0.953470841004, 0.976169473869, 0.991399076421, 0.999043121392, 0.999043121392, 0.991399076421, 0.976169473869, 0.953470841004, 0.923476853383, 0.886417005995, 0.842574857312, 0.792285859677, 0.735934792636, 0.673952818851, 0.606814185113, 0.535032593708, 0.459157271892, 0.379768769555, 0.297474517214, 0.212904178348, 0.126704831606, 0.039536019772, -0.0479352966351, -0.135039842524, -0.2211111491, -0.305490653258, -0.387532736497, -0.466609664777, -0.542116391547, -0.613475187173, -0.680140059366, -0.741600930761, -0.797387541713, -0.847073048421, -0.890277288868, -0.926669691581, -0.955971804952, -0.977959427777, -0.992464324695, -0.999375513427 ) + + +Phase1L1TJetSumsProducer = cms.EDProducer('Phase1L1TJetSumsProducer', + inputJetCollectionTag = cms.InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates"), + nBinsPhi = cms.uint32(72), + phiLow = cms.double(-pi), + phiUp = cms.double(pi), + etaLow = cms.double(-5), + etaUp = cms.double(5), + sinPhi = sinPhi, + cosPhi = cosPhi, + htPtThreshold = cms.double(30), + htAbsEtaCut = cms.double(2.4), + mhtPtThreshold = cms.double(30), + mhtAbsEtaCut = cms.double(2.4), + ptlsb = cms.double(0.25), + outputCollectionName = cms.string("Sums"), +) diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py new file mode 100644 index 0000000000000..c0f2891eacc5b --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9_cff.py @@ -0,0 +1,25 @@ +import FWCore.ParameterSet.Config as cms +from math import pi + +from L1Trigger.L1CaloTrigger.Phase1L1TJetProducer_cfi import Phase1L1TJetProducer +from L1Trigger.L1CaloTrigger.Phase1L1TJetCalibrator_9x9Jets_cfi import Phase1L1TJetCalibrator as Phase1L1TJetCalibrator9x9 +from L1Trigger.L1CaloTrigger.Phase1L1TJetSumsProducer_cfi import Phase1L1TJetSumsProducer + +Phase1L1TJetProducer9x9 = Phase1L1TJetProducer.clone( + jetIEtaSize = cms.uint32(9), + jetIPhiSize = cms.uint32(9), + outputCollectionName = cms.string("UncalibratedPhase1L1TJetFromPfCandidates") +) + +Phase1L1TJetCalibrator9x9.inputCollectionTag = cms.InputTag("Phase1L1TJetProducer9x9", "UncalibratedPhase1L1TJetFromPfCandidates", "") +Phase1L1TJetCalibrator9x9.outputCollectionName = cms.string("Phase1L1TJetFromPfCandidates") + +Phase1L1TJetSumsProducer9x9 = Phase1L1TJetSumsProducer.clone( + inputJetCollectionTag = cms.InputTag("Phase1L1TJetCalibrator9x9", "Phase1L1TJetFromPfCandidates"), +) + +Phase1L1TJetsSequence9x9 = cms.Sequence( + Phase1L1TJetProducer9x9 + + Phase1L1TJetCalibrator9x9 + + Phase1L1TJetSumsProducer9x9 +) \ No newline at end of file diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9trimmed_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9trimmed_cff.py new file mode 100644 index 0000000000000..6348fdc643d0c --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_9x9trimmed_cff.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms +from math import pi + +from L1Trigger.L1CaloTrigger.Phase1L1TJetProducer_cfi import Phase1L1TJetProducer +from L1Trigger.L1CaloTrigger.Phase1L1TJetCalibrator_9x9Jets_cfi import Phase1L1TJetCalibrator as Phase1L1TJetCalibrator9x9 +from L1Trigger.L1CaloTrigger.Phase1L1TJetSumsProducer_cfi import Phase1L1TJetSumsProducer + +Phase1L1TJetProducer9x9trimmed = Phase1L1TJetProducer.clone( + jetIEtaSize = cms.uint32(9), + jetIPhiSize = cms.uint32(9), + trimmedGrid = cms.bool(True), + outputCollectionName = cms.string("UncalibratedPhase1L1TJetFromPfCandidates") +) + +Phase1L1TJetCalibrator9x9trimmed = Phase1L1TJetCalibrator9x9.clone( + inputCollectionTag = cms.InputTag("Phase1L1TJetProducer9x9trimmed", "UncalibratedPhase1L1TJetFromPfCandidates", ""), + outputCollectionName = cms.string("Phase1L1TJetFromPfCandidates") + ) + +Phase1L1TJetSumsProducer9x9trimmed = Phase1L1TJetSumsProducer.clone( + inputJetCollectionTag = cms.InputTag("Phase1L1TJetCalibrator9x9trimmed", "Phase1L1TJetFromPfCandidates"), +) + +Phase1L1TJetsSequence9x9trimmed = cms.Sequence( + Phase1L1TJetProducer9x9trimmed + + Phase1L1TJetCalibrator9x9trimmed + + Phase1L1TJetSumsProducer9x9trimmed +) \ No newline at end of file From 84a0e8eed64060496a7a07403a1b9d0794725c15 Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Fri, 5 Feb 2021 20:11:58 +0000 Subject: [PATCH 113/309] Add back check that input candidates are within the histogram boundaries. (cherry picked from commit c8de5eca919e967cb2aa14bdc69682a1da1a1ac6) --- .../L1CaloTrigger/plugins/Phase1L1TJetProducer.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc index 9f8fb8f429f3e..9062cef43e9cd 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc @@ -501,22 +501,20 @@ std::vector< std::vector< edm::Ptr< reco::Candidate > > > Phase1L1TJetProducer:: reco::CandidatePtr tp( triggerPrimitives, i ); + if ( tp->phi() < phiRegionEdges_.front() || tp->phi() >= phiRegionEdges_.back() + || tp->eta() < etaRegionEdges_.front() || tp->eta() >= etaRegionEdges_.back() ) continue; + // Which phi region does this tp belong to auto it_phi = phiRegionEdges_.begin(); - if ( tp->phi() >= phiRegionEdges_.front() && tp->phi() < phiRegionEdges_.back()) { - it_phi = std::upper_bound (phiRegionEdges_.begin(), phiRegionEdges_.end(), tp->phi()) - 1; - } + it_phi = std::upper_bound (phiRegionEdges_.begin(), phiRegionEdges_.end(), tp->phi()) - 1; // Which eta region does this tp belong to auto it_eta = etaRegionEdges_.begin(); - if ( tp->eta() >= etaRegionEdges_.front() && tp->eta() < etaRegionEdges_.back() ) { - it_eta = std::upper_bound (etaRegionEdges_.begin(), etaRegionEdges_.end(), tp->eta()) - 1; - } + it_eta = std::upper_bound (etaRegionEdges_.begin(), etaRegionEdges_.end(), tp->eta()) - 1; if ( it_phi != phiRegionEdges_.end() && it_eta != etaRegionEdges_.end() ) { auto phiRegion = it_phi - phiRegionEdges_.begin(); auto etaRegion = it_eta - etaRegionEdges_.begin(); - inputsInRegions[ getRegionIndex( phiRegion, etaRegion ) ].emplace_back( tp ); } } From 4884535ba6c09ebd6c0fe3fc07372b7d87e55987 Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Fri, 5 Feb 2021 20:13:37 +0000 Subject: [PATCH 114/309] Add 9x9 and trimmed 9x9 sequence to test config. (cherry picked from commit 7189024f903959730858bc240ffc775398f6096b) --- .../test/test_Phase1L1TJets_cfg.py | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py b/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py index 9ef8f23e607a6..8e606b032564a 100644 --- a/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py +++ b/L1Trigger/L1CaloTrigger/test/test_Phase1L1TJets_cfg.py @@ -18,18 +18,34 @@ #) ) +# Loads 7x7 sequence process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_cff') +# Load 9x9 sequence +process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_9x9_cff') + +# Load trimmed 9x9 sequence +process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_9x9trimmed_cff') + +# AK4 PF jets +process.load('L1Trigger.Phase2L1ParticleFlow.l1pfJetMet_cff') +process.l1PFJets = cms.Sequence( process.ak4PFL1Puppi + process.ak4PFL1PuppiCorrected ) + + process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string('myOutputFile.root'), outputCommands = cms.untracked.vstring( "drop *", - "keep *_Phase1L1TJetProducer_*_*", + "keep *_Phase1L1TJetProducer*_*_*", + "keep *_Phase1L1TJetSumsProducer*_*_*", "keep *_ak4GenJetsNoNu_*_*", - "keep *_Phase1L1TJetCalibrator_*_*", + "keep *_Phase1L1TJetCalibrator*_*_*", + "keep *_ak4PFL1Puppi*_*_*", + "keep *_l1PFMetPuppi*_*_*", + "keep *_genMetTrue_*_*" ), ) -process.p = cms.Path(process.Phase1L1TJetsSequence) +process.p = cms.Path(process.Phase1L1TJetsSequence * process.Phase1L1TJetsSequence9x9 * process.Phase1L1TJetsSequence9x9trimmed * process.l1PFJets * process.l1PFMetPuppi ) process.e = cms.EndPath(process.out) From 5a26d296b0dac500bc3ab4b1729c6cf8925160ff Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Mon, 8 Feb 2021 10:14:07 +0000 Subject: [PATCH 115/309] Put common sin and cos LUT into config fragment. (cherry picked from commit 01e732f54fd6066caac6df27b8ef1de54e930748) --- .../python/Phase1L1TJetProducer_cfi.py | 20 ++----------------- .../python/Phase1L1TJetSumsProducer_cfi.py | 6 +----- .../python/Phase1L1TJets_sincosLUT_cff.py | 6 ++++++ 3 files changed, 9 insertions(+), 23 deletions(-) create mode 100644 L1Trigger/L1CaloTrigger/python/Phase1L1TJets_sincosLUT_cff.py diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py index fd843a11b2458..345d0f6217454 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py @@ -1,6 +1,8 @@ import FWCore.ParameterSet.Config as cms from math import pi +from Phase1L1TJets_sincosLUT_cff import sinPhi, cosPhi + caloEtaSegmentation = cms.vdouble( -5.0, -4.917, -4.833, -4.75, -4.667, -4.583, -4.5, -4.417, -4.333, -4.25, -4.167, -4.083, -4.0, -3.917, -3.833, -3.75, -3.667, -3.583, -3.5, -3.417, @@ -14,24 +16,6 @@ 3.0, 3.083, 3.167, 3.25, 3.333, 3.417, 3.5, 3.583, 3.667, 3.75, 3.833, 3.917, 4.0, 4.083, 4.167, 4.25, 4.333, 4.417, 4.5, 4.583, 4.667, 4.75, 4.833, 4.917, 5.0) -sinPhi = cms.vdouble(0.04374, 0.13087, 0.21701, 0.30149, 0.38365, 0.46289, 0.53858, 0.61015, 0.67705, 0.73877, - 0.79484, 0.84483, 0.88835, 0.92508, 0.95473, 0.97707, 0.99194, 0.99922, 0.99885, 0.99084, - 0.97525, 0.9522, 0.92186, 0.88446, 0.8403, 0.78971, 0.73308, 0.67084, 0.60347, 0.53148, - 0.45542, 0.37588, 0.29346, 0.2088, 0.12253, 0.03534, -0.05213, -0.1392, -0.22521, -0.30949, - -0.3914, -0.47032, -0.54564, -0.61679, -0.68322, -0.74441, -0.79992, -0.8493, -0.89218, - -0.92824, -0.9572, -0.97883, -0.99297, -0.99952, -0.99841, -0.98967, -0.97336, -0.94959, - -0.91857, -0.88051, -0.83572, -0.78453, -0.72734, -0.66458, -0.59674, -0.52434, -0.44792, - -0.36807, -0.28541, -0.20057, -0.11419, -0.02693) -cosPhi = cms.vdouble(0.99904, 0.9914, 0.97617, 0.95347, 0.92348, 0.88642, 0.84257, 0.79229, 0.73593, 0.67395, - 0.60681, 0.53503, 0.45916, 0.37977, 0.29747, 0.2129, 0.1267, 0.03954, -0.04794, -0.13504, - -0.22111, -0.30549, -0.38753, -0.46661, -0.54212, -0.61348, -0.68014, -0.7416, -0.79739, -0.84707, - -0.89028, -0.92667, -0.95597, -0.97796, -0.99246, -0.99938, -0.99864, -0.99026, -0.97431, -0.9509, - -0.92022, -0.88249, -0.83802, -0.78713, -0.73022, -0.66772, -0.60011, -0.52791, -0.45167, - -0.37198, -0.28944, -0.20468, -0.11836, -0.03113, 0.05633, 0.14337, 0.2293, 0.31349, - 0.39527, 0.47403, 0.54916, 0.62009, 0.68628, 0.74721, 0.80243, 0.85151, 0.89407, - 0.9298, 0.95841, 0.97968, 0.99346, 0.99964) - - Phase1L1TJetProducer = cms.EDProducer('Phase1L1TJetProducer', inputCollectionTag = cms.InputTag("l1pfCandidates", "Puppi"), etaBinning = caloEtaSegmentation, diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py index d150ab3bcb013..dbffdf113c042 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py @@ -1,11 +1,7 @@ import FWCore.ParameterSet.Config as cms from math import pi -sinPhi = cms.vdouble( - -0.0353352962792, -0.122533930843, -0.208795013406, -0.293458528818, -0.375876685504, -0.455418871948, -0.531476481737, -0.603467570232, -0.670841307236, -0.733082191603, -0.789713995522, -0.840303408309, -0.884463351833, -0.921855942186, -0.952195074957, -0.975248614326, -0.990840169216, -0.998850442928, -0.999218145922, -0.99194046477, -0.977073083675, -0.954729758418, -0.925081445966, -0.888354996422, -0.844831417308, -0.794843723474, -0.738774389082, -0.677052421152, -0.610150077076, -0.538579251202, -0.462887558141, -0.383654142772, -0.301485248985, -0.217009581095, -0.130873493387, -0.0437360446299, 0.0437360446299, 0.130873493387, 0.217009581095, 0.301485248985, 0.383654142772, 0.462887558141, 0.538579251202, 0.610150077076, 0.677052421152, 0.738774389082, 0.794843723474, 0.844831417308, 0.888354996422, 0.925081445966, 0.954729758418, 0.977073083675, 0.99194046477, 0.999218145922, 0.998850442928, 0.990840169216, 0.975248614326, 0.952195074957, 0.921855942186, 0.884463351833, 0.840303408309, 0.789713995522, 0.733082191603, 0.670841307236, 0.603467570232, 0.531476481737, 0.455418871948, 0.375876685504, 0.293458528818, 0.208795013406, 0.122533930843, 0.0353352962792 ) - -cosPhi = cms.vdouble( -0.999375513427, -0.992464324695, -0.977959427777, -0.955971804952, -0.926669691581, -0.890277288868, -0.847073048421, -0.797387541713, -0.741600930761, -0.680140059366, -0.613475187173, -0.542116391547, -0.466609664777, -0.387532736497, -0.305490653258, -0.2211111491, -0.135039842524, -0.0479352966351, 0.039536019772, 0.126704831606, 0.212904178348, 0.297474517214, 0.379768769555, 0.459157271892, 0.535032593708, 0.606814185113, 0.673952818851, 0.735934792636, 0.792285859677, 0.842574857312, 0.886417005995, 0.923476853383, 0.953470841004, 0.976169473869, 0.991399076421, 0.999043121392, 0.999043121392, 0.991399076421, 0.976169473869, 0.953470841004, 0.923476853383, 0.886417005995, 0.842574857312, 0.792285859677, 0.735934792636, 0.673952818851, 0.606814185113, 0.535032593708, 0.459157271892, 0.379768769555, 0.297474517214, 0.212904178348, 0.126704831606, 0.039536019772, -0.0479352966351, -0.135039842524, -0.2211111491, -0.305490653258, -0.387532736497, -0.466609664777, -0.542116391547, -0.613475187173, -0.680140059366, -0.741600930761, -0.797387541713, -0.847073048421, -0.890277288868, -0.926669691581, -0.955971804952, -0.977959427777, -0.992464324695, -0.999375513427 ) - +from Phase1L1TJets_sincosLUT_cff import sinPhi, cosPhi Phase1L1TJetSumsProducer = cms.EDProducer('Phase1L1TJetSumsProducer', inputJetCollectionTag = cms.InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates"), diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_sincosLUT_cff.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_sincosLUT_cff.py new file mode 100644 index 0000000000000..f71656b1d13b7 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJets_sincosLUT_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +sinPhi = cms.vdouble( + -0.0353352962792, -0.122533930843, -0.208795013406, -0.293458528818, -0.375876685504, -0.455418871948, -0.531476481737, -0.603467570232, -0.670841307236, -0.733082191603, -0.789713995522, -0.840303408309, -0.884463351833, -0.921855942186, -0.952195074957, -0.975248614326, -0.990840169216, -0.998850442928, -0.999218145922, -0.99194046477, -0.977073083675, -0.954729758418, -0.925081445966, -0.888354996422, -0.844831417308, -0.794843723474, -0.738774389082, -0.677052421152, -0.610150077076, -0.538579251202, -0.462887558141, -0.383654142772, -0.301485248985, -0.217009581095, -0.130873493387, -0.0437360446299, 0.0437360446299, 0.130873493387, 0.217009581095, 0.301485248985, 0.383654142772, 0.462887558141, 0.538579251202, 0.610150077076, 0.677052421152, 0.738774389082, 0.794843723474, 0.844831417308, 0.888354996422, 0.925081445966, 0.954729758418, 0.977073083675, 0.99194046477, 0.999218145922, 0.998850442928, 0.990840169216, 0.975248614326, 0.952195074957, 0.921855942186, 0.884463351833, 0.840303408309, 0.789713995522, 0.733082191603, 0.670841307236, 0.603467570232, 0.531476481737, 0.455418871948, 0.375876685504, 0.293458528818, 0.208795013406, 0.122533930843, 0.0353352962792 ) + +cosPhi = cms.vdouble( -0.999375513427, -0.992464324695, -0.977959427777, -0.955971804952, -0.926669691581, -0.890277288868, -0.847073048421, -0.797387541713, -0.741600930761, -0.680140059366, -0.613475187173, -0.542116391547, -0.466609664777, -0.387532736497, -0.305490653258, -0.2211111491, -0.135039842524, -0.0479352966351, 0.039536019772, 0.126704831606, 0.212904178348, 0.297474517214, 0.379768769555, 0.459157271892, 0.535032593708, 0.606814185113, 0.673952818851, 0.735934792636, 0.792285859677, 0.842574857312, 0.886417005995, 0.923476853383, 0.953470841004, 0.976169473869, 0.991399076421, 0.999043121392, 0.999043121392, 0.991399076421, 0.976169473869, 0.953470841004, 0.923476853383, 0.886417005995, 0.842574857312, 0.792285859677, 0.735934792636, 0.673952818851, 0.606814185113, 0.535032593708, 0.459157271892, 0.379768769555, 0.297474517214, 0.212904178348, 0.126704831606, 0.039536019772, -0.0479352966351, -0.135039842524, -0.2211111491, -0.305490653258, -0.387532736497, -0.466609664777, -0.542116391547, -0.613475187173, -0.680140059366, -0.741600930761, -0.797387541713, -0.847073048421, -0.890277288868, -0.926669691581, -0.955971804952, -0.977959427777, -0.992464324695, -0.999375513427 ) \ No newline at end of file From 848f86b9d0299a7550a6e314c4d8ee62e263a769 Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Mon, 8 Feb 2021 10:39:31 +0000 Subject: [PATCH 116/309] Improve some comments. Remove somewhat redundant eta selection. (cherry picked from commit 341ac430be89137c25a16cbdfd7db4165d829f27) --- .../plugins/Phase1L1TJetProducer.cc | 23 ++++++++++++-- .../plugins/Phase1L1TJetSumsProducer.cc | 30 +++++-------------- .../python/Phase1L1TJetSumsProducer_cfi.py | 2 -- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc index 9062cef43e9cd..b3e7ff84bf8a4 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc @@ -14,8 +14,14 @@ Description: Produces jets with a phase-1 like sliding window algorithm using a * phiUp: double, max phi (typically +pi) * jetIEtaSize: uint32, jet cluster size in ieta * jetIPhiSize: uint32, jet cluster size in iphi + * trimmedGrid: Flag (bool) to remove three bins in each corner of grid in jet finding * seedPtThreshold: double, threshold of the seed tower + * pt/eta/philsb : lsb of quantities used in firmware implementation * puSubtraction: bool, runs chunky doughnut pile-up subtraction, 9x9 jet only + * eta/phiRegionEdges: Boundaries of the input (PF) regions + * maxInputsPerRegion: Truncate number of inputes per input (PF) region + * sin/cosPhi: Value of sin/cos phi in the middle of each bin of the grid. + * met{HF}AbsETaCut: Eta selection of input candidates for calculation of MET * outputCollectionName: string, tag for the output collection * vetoZeroPt: bool, controls whether jets with 0 pt should be save. It matters if PU is ON, as you can get negative or zero pt jets after it. @@ -67,15 +73,24 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { /// Finds the seeds in the caloGrid, seeds are saved in a vector that contain the index in the TH2F of each seed std::vector<std::tuple<int, int>> findSeeds(float seedThreshold) const; + // Calculates the pt sum of the bins around the seeds + // And applies some PU mitigation + // Warning - not used for some time, so user beware std::vector<reco::CaloJet> buildJetsFromSeedsWithPUSubtraction(const std::vector<std::tuple<int, int>>& seeds, bool killZeroPt) const; + + // Calculates the pt sum of the bins around the seeds std::vector<reco::CaloJet> buildJetsFromSeeds(const std::vector<std::tuple<int, int>>& seeds) const; + // Used by buildJetsFromSeedsWithPUSubtraction + // Implementation of pileup mitigation + // Warning - not used for some time, so user beware void subtract9x9Pileup(reco::CaloJet& jet) const; /// Get the energy of a certain tower while correctly handling phi periodicity in case of overflow float getTowerEnergy(int iEta, int iPhi) const; + // Implementation of pt sum of bins around one seed reco::CaloJet buildJetFromSeed(const std::tuple<int, int>& seed) const; // <3 handy method to fill the calogrid with whatever type @@ -93,8 +108,11 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { template <class Handle > std::vector< std::vector< reco::CandidatePtr > > prepareInputsIntoRegions( const Handle triggerPrimitives ); + // Converts phi and eta (PF) region indices to a single index unsigned int getRegionIndex( const unsigned int phiRegion, const unsigned int etaRegion ) const; + // From the single index, calculated by getRegionIndex, provides the lower eta and phi boundaries of the input (PF) region index std::pair< double, double> regionEtaPhiLowEdges( const unsigned int regionIndex ) const; + // From the single index, calculated by getRegionIndex, provides the upper eta and phi boundaries of the input (PF) region index std::pair< double, double> regionEtaPhiUpEdges( const unsigned int regionIndex ) const; // computes MET @@ -206,7 +224,7 @@ void Phase1L1TJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS iEvent.getByToken(inputCollectionTag_, inputCollectionHandle); // sort inputs into PF regions -std::vector< std::vector< reco::CandidatePtr > > inputsInRegions = prepareInputsIntoRegions<>( inputCollectionHandle ); + std::vector< std::vector< reco::CandidatePtr > > inputsInRegions = prepareInputsIntoRegions<>( inputCollectionHandle ); // histogramming the data caloGrid_->Reset(); @@ -421,6 +439,7 @@ std::pair<float, float> Phase1L1TJetProducer::getCandidateDigiEtaPhi( const floa // If eta or phi is on a bin edge // Put in bin above, to match behaviour of HLS // Unless it's on the last bin of this pf region + // Then it is placed in the last bin, not the overflow TAxis* etaAxis = caloGrid_->GetXaxis(); std::pair< double, double > regionUpEdges = regionEtaPhiUpEdges( regionIndex ); int digiEtaEdgeLastBinUp = floor( ( regionUpEdges.second - regionLowEdges.second ) / etalsb_ ); @@ -519,7 +538,7 @@ std::vector< std::vector< edm::Ptr< reco::Candidate > > > Phase1L1TJetProducer:: } } - // Truncate inputs in each pf region + // Truncate number of inputs in each pf region for ( auto& inputs : inputsInRegions ) { if ( inputs.size() > maxInputsPerRegion_ ) { inputs.resize( maxInputsPerRegion_ ); diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc index e7b6fd0722d18..40d4115959a9b 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc @@ -8,20 +8,16 @@ Description: Computes HT and MHT from phase-1-like jets *** INPUT PARAMETERS *** + * sin/cosPhi: Value of sin/cos phi in the middle of each bin of the grid. * etaBinning: vdouble with eta binning (allows non-homogeneous binning in eta) * nBinsPhi: uint32, number of bins in phi * phiLow: double, min phi (typically -pi) * phiUp: double, max phi (typically +pi) - * jetIEtaSize: uint32, jet cluster size in ieta - * jetIPhiSize: uint32, jet cluster size in iphi - * seedPtThreshold: double, threshold of the seed tower - * puSubtraction: bool, runs chunky doughnut pile-up subtraction, 9x9 jet only + * {m}htPtThreshold: Minimum jet pt for HT/MHT calculation + * {m}htAbsEtaCut: + * pt/eta/philsb : lsb of quantities used in firmware implementation * outputCollectionName: string, tag for the output collection - * vetoZeroPt: bool, controls whether jets with 0 pt should be save. - It matters if PU is ON, as you can get negative or zero pt jets after it. - * outputSumsCollectionName: string, tag for the output collection containing MET and HT - * inputCollectionTag: inputtag, collection of reco::candidates used as input to the algo - * htPtThreshold: double, threshold for computing ht + * inputCollectionTag: tag for input jet collection */ // @@ -73,10 +69,6 @@ class Phase1L1TJetSumsProducer : public edm::one::EDProducer<edm::one::SharedRes double phiLow_; // higher phi value double phiUp_; - // lower eta value - double etaLow_; - // higher eta value - double etaUp_; // size of a phi bin double phiStep_; // threshold for ht calculation @@ -102,8 +94,6 @@ Phase1L1TJetSumsProducer::Phase1L1TJetSumsProducer(const edm::ParameterSet& iCon nBinsPhi_(iConfig.getParameter<unsigned int>("nBinsPhi")), phiLow_(iConfig.getParameter<double>("phiLow")), phiUp_(iConfig.getParameter<double>("phiUp")), - etaLow_(iConfig.getParameter<double>("etaLow")), - etaUp_(iConfig.getParameter<double>("etaUp")), htPtThreshold_(iConfig.getParameter<double>("htPtThreshold")), mhtPtThreshold_(iConfig.getParameter<double>("mhtPtThreshold")), htAbsEtaCut_(iConfig.getParameter<double>("htAbsEtaCut")), @@ -130,8 +120,8 @@ void Phase1L1TJetSumsProducer::produce(edm::Event& iEvent, const edm::EventSetup //packing sums in vector for event saving std::unique_ptr< std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0)); - lSumVectorPtr -> push_back(lHT); - lSumVectorPtr -> push_back(lMHT); + lSumVectorPtr->push_back(lHT); + lSumVectorPtr->push_back(lMHT); iEvent.put(std::move(lSumVectorPtr), outputCollectionName_ ); return; @@ -149,9 +139,7 @@ l1t::EtSum Phase1L1TJetSumsProducer::computeHT(const edm::Handle < std::vector<r if ( (lJetPhi < phiLow_) || - (lJetPhi >= phiUp_) || - (lJetEta < etaLow_)|| - (lJetEta >= etaUp_) + (lJetPhi >= phiUp_) ) continue; lHT += (lJetPt >= htPtThreshold_ && std::fabs( lJetEta ) < htAbsEtaCut_ ) ? lJetPt : 0; @@ -216,8 +204,6 @@ void Phase1L1TJetSumsProducer::fillDescriptions(edm::ConfigurationDescriptions& desc.add<unsigned int>("nBinsPhi", 72); desc.add<double>("phiLow", -M_PI); desc.add<double>("phiUp", M_PI); - desc.add<double>("etaLow", -3); - desc.add<double>("etaUp", 3); desc.add<double>("htPtThreshold", 30); desc.add<double>("mhtPtThreshold", 30); desc.add<double>("htAbsEtaCut", 3); diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py index dbffdf113c042..d48f3cd5e4448 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetSumsProducer_cfi.py @@ -8,8 +8,6 @@ nBinsPhi = cms.uint32(72), phiLow = cms.double(-pi), phiUp = cms.double(pi), - etaLow = cms.double(-5), - etaUp = cms.double(5), sinPhi = sinPhi, cosPhi = cosPhi, htPtThreshold = cms.double(30), From 2454be2dc27e9140f80547936954025f3c3956dc Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Mon, 8 Feb 2021 10:41:50 +0000 Subject: [PATCH 117/309] Code checks (cherry picked from commit dda20a720e7bf19431f7df1b6e47d1f38fc97f72) --- L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc index 40d4115959a9b..c0044b17d6f64 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc @@ -43,12 +43,12 @@ Description: Computes HT and MHT from phase-1-like jets class Phase1L1TJetSumsProducer : public edm::one::EDProducer<edm::one::SharedResources> { public: explicit Phase1L1TJetSumsProducer(const edm::ParameterSet&); - ~Phase1L1TJetSumsProducer(); + ~Phase1L1TJetSumsProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - virtual void produce(edm::Event&, const edm::EventSetup&); + void produce(edm::Event&, const edm::EventSetup&) override; // computes ht, adds jet pt to ht only if the pt of the jet is above the ht calculation threshold l1t::EtSum computeHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const; From 607d5462c66c71996dacb84ff0ede6181930a59d Mon Sep 17 00:00:00 2001 From: Emyr <emyr.clement@bristol.ac.uk> Date: Mon, 8 Feb 2021 10:42:38 +0000 Subject: [PATCH 118/309] Code quality (cherry picked from commit 8217bc2818c347213a31aaafce46147009f5f63b) --- .../plugins/Phase1L1TJetProducer.cc | 254 +++++++++--------- .../plugins/Phase1L1TJetSumsProducer.cc | 186 ++++++------- 2 files changed, 211 insertions(+), 229 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc index b3e7ff84bf8a4..ba5685517b2a8 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetProducer.cc @@ -77,7 +77,7 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { // And applies some PU mitigation // Warning - not used for some time, so user beware std::vector<reco::CaloJet> buildJetsFromSeedsWithPUSubtraction(const std::vector<std::tuple<int, int>>& seeds, - bool killZeroPt) const; + bool killZeroPt) const; // Calculates the pt sum of the bins around the seeds std::vector<reco::CaloJet> buildJetsFromSeeds(const std::vector<std::tuple<int, int>>& seeds) const; @@ -99,36 +99,36 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { // Digitise the eta and phi coordinates of input candidates // This converts the quantities to integers to reduce precision - // And takes account of bin edge effects i.e. makes sure the + // And takes account of bin edge effects i.e. makes sure the // candidate ends up in the correct (i.e. same behaviour as the firmware) bin of caloGrid_ - std::pair<float, float> getCandidateDigiEtaPhi( const float eta, const float phi, const unsigned int regionIndex ) const; + std::pair<float, float> getCandidateDigiEtaPhi(const float eta, + const float phi, + const unsigned int regionIndex) const; // Sorts the input candidates into the PF regions they arrive in // Truncates the inputs. Takes the first N candidates as they are provided, without any sorting (this may be needed in the future and/or provided in this way from emulation of layer 1) - template <class Handle > - std::vector< std::vector< reco::CandidatePtr > > prepareInputsIntoRegions( const Handle triggerPrimitives ); + template <class Handle> + std::vector<std::vector<reco::CandidatePtr>> prepareInputsIntoRegions(const Handle triggerPrimitives); // Converts phi and eta (PF) region indices to a single index - unsigned int getRegionIndex( const unsigned int phiRegion, const unsigned int etaRegion ) const; + unsigned int getRegionIndex(const unsigned int phiRegion, const unsigned int etaRegion) const; // From the single index, calculated by getRegionIndex, provides the lower eta and phi boundaries of the input (PF) region index - std::pair< double, double> regionEtaPhiLowEdges( const unsigned int regionIndex ) const; + std::pair<double, double> regionEtaPhiLowEdges(const unsigned int regionIndex) const; // From the single index, calculated by getRegionIndex, provides the upper eta and phi boundaries of the input (PF) region index - std::pair< double, double> regionEtaPhiUpEdges( const unsigned int regionIndex ) const; + std::pair<double, double> regionEtaPhiUpEdges(const unsigned int regionIndex) const; // computes MET // Takes grid used by jet finder and projects to 1D histogram of phi, bin contents are total pt in that phi bin // the phi bin index is used to retrieve the sin-cos value from the LUT emulator // the pt of the input is multiplied by that sin cos value to obtain px and py that is added to the total event px & py // after all the inputs have been processed we compute the total pt of the event, and set that as MET - l1t::EtSum computeMET( const double etaCut, l1t::EtSum::EtSumType sumType ) const; - + l1t::EtSum computeMET(const double etaCut, l1t::EtSum::EtSumType sumType) const; // Determine if this tower should be trimmed or not // Used only when trimmedGrid_ option is set to true // Trim means removing 3 towers in each corner of the square grid // giving a cross shaped grid, which is a bit more circular in shape than a square - bool trimTower( const int etaIndex, const int phiIndex ) const; - + bool trimTower(const int etaIndex, const int phiIndex) const; edm::EDGetTokenT<edm::View<reco::Candidate>> inputCollectionTag_; // histogram containing our clustered inputs @@ -149,8 +149,8 @@ class Phase1L1TJetProducer : public edm::one::EDProducer<> { bool puSubtraction_; bool vetoZeroPt_; // Eta and phi edges of input PF regions - std::vector< double > etaRegionEdges_; - std::vector< double > phiRegionEdges_; + std::vector<double> etaRegionEdges_; + std::vector<double> phiRegionEdges_; // Maximum number of candidates per input PF region unsigned int maxInputsPerRegion_; // LUT for sin and cos phi, to match that used in firmware @@ -181,11 +181,11 @@ Phase1L1TJetProducer::Phase1L1TJetProducer(const edm::ParameterSet& iConfig) etalsb_(iConfig.getParameter<double>("etalsb")), puSubtraction_(iConfig.getParameter<bool>("puSubtraction")), vetoZeroPt_(iConfig.getParameter<bool>("vetoZeroPt")), - etaRegionEdges_(iConfig.getParameter<std::vector<double> >("etaRegions")), - phiRegionEdges_(iConfig.getParameter<std::vector<double> >("phiRegions")), + etaRegionEdges_(iConfig.getParameter<std::vector<double>>("etaRegions")), + phiRegionEdges_(iConfig.getParameter<std::vector<double>>("phiRegions")), maxInputsPerRegion_(iConfig.getParameter<unsigned int>("maxInputsPerRegion")), - sinPhi_(iConfig.getParameter<std::vector<double> >("sinPhi")), - cosPhi_(iConfig.getParameter<std::vector<double> >("cosPhi")), + sinPhi_(iConfig.getParameter<std::vector<double>>("sinPhi")), + cosPhi_(iConfig.getParameter<std::vector<double>>("cosPhi")), metAbsEtaCut_(iConfig.getParameter<double>("metAbsEtaCut")), metHFAbsEtaCut_(iConfig.getParameter<double>("metHFAbsEtaCut")), outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")) { @@ -194,7 +194,7 @@ Phase1L1TJetProducer::Phase1L1TJetProducer(const edm::ParameterSet& iConfig) caloGrid_->GetXaxis()->SetTitle("#eta"); caloGrid_->GetYaxis()->SetTitle("#phi"); produces<std::vector<reco::CaloJet>>(outputCollectionName_).setBranchAlias(outputCollectionName_); - produces< std::vector<l1t::EtSum> >( outputCollectionName_ + "MET" ).setBranchAlias(outputCollectionName_ + "MET"); + produces<std::vector<l1t::EtSum>>(outputCollectionName_ + "MET").setBranchAlias(outputCollectionName_ + "MET"); } Phase1L1TJetProducer::~Phase1L1TJetProducer() {} @@ -224,19 +224,19 @@ void Phase1L1TJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS iEvent.getByToken(inputCollectionTag_, inputCollectionHandle); // sort inputs into PF regions - std::vector< std::vector< reco::CandidatePtr > > inputsInRegions = prepareInputsIntoRegions<>( inputCollectionHandle ); + std::vector<std::vector<reco::CandidatePtr>> inputsInRegions = prepareInputsIntoRegions<>(inputCollectionHandle); // histogramming the data caloGrid_->Reset(); - for (unsigned int iInputRegion = 0; iInputRegion < inputsInRegions.size(); ++iInputRegion ) { + for (unsigned int iInputRegion = 0; iInputRegion < inputsInRegions.size(); ++iInputRegion) { fillCaloGrid<>(*(caloGrid_), inputsInRegions[iInputRegion], iInputRegion); } // find the seeds const auto& seedsVector = findSeeds(seedPtThreshold_); // seedPtThreshold = 5 // build jets from the seeds - auto l1jetVector = puSubtraction_ ? buildJetsFromSeedsWithPUSubtraction(seedsVector, vetoZeroPt_) - : buildJetsFromSeeds(seedsVector); + auto l1jetVector = + puSubtraction_ ? buildJetsFromSeedsWithPUSubtraction(seedsVector, vetoZeroPt_) : buildJetsFromSeeds(seedsVector); // sort by pt std::sort(l1jetVector.begin(), l1jetVector.end(), [](const reco::CaloJet& jet1, const reco::CaloJet& jet2) { @@ -247,12 +247,12 @@ void Phase1L1TJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS iEvent.put(std::move(l1jetVectorPtr), outputCollectionName_); // calculate METs - l1t::EtSum lMET = computeMET( metAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEt ); - l1t::EtSum lMETHF = computeMET( metHFAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEtHF); - std::unique_ptr< std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0)); - lSumVectorPtr -> push_back(lMET); - lSumVectorPtr -> push_back(lMETHF); - iEvent.put(std::move(lSumVectorPtr), this -> outputCollectionName_+"MET"); + l1t::EtSum lMET = computeMET(metAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEt); + l1t::EtSum lMETHF = computeMET(metHFAbsEtaCut_, l1t::EtSum::EtSumType::kMissingEtHF); + std::unique_ptr<std::vector<l1t::EtSum>> lSumVectorPtr(new std::vector<l1t::EtSum>(0)); + lSumVectorPtr->push_back(lMET); + lSumVectorPtr->push_back(lMETHF); + iEvent.put(std::move(lSumVectorPtr), this->outputCollectionName_ + "MET"); return; } @@ -328,9 +328,9 @@ std::vector<std::tuple<int, int>> Phase1L1TJetProducer::findSeeds(float seedThre // Scanning through the grid centered on the seed for (int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) { for (int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) { - - if ( trimmedGrid_ ) { - if ( trimTower( etaIndex, phiIndex ) ) continue; + if (trimmedGrid_) { + if (trimTower(etaIndex, phiIndex)) + continue; } if ((etaIndex == 0) && (phiIndex == 0)) @@ -370,8 +370,9 @@ reco::CaloJet Phase1L1TJetProducer::buildJetFromSeed(const std::tuple<int, int>& // Scanning through the grid centered on the seed for (int etaIndex = -etaHalfSize; etaIndex <= etaHalfSize; etaIndex++) { for (int phiIndex = -phiHalfSize; phiIndex <= phiHalfSize; phiIndex++) { - if ( trimmedGrid_ ) { - if ( trimTower( etaIndex, phiIndex ) ) continue; + if (trimmedGrid_) { + if (trimTower(etaIndex, phiIndex)) + continue; } ptSum += getTowerEnergy(iEta + etaIndex, iPhi + phiIndex); } @@ -416,12 +417,14 @@ std::vector<reco::CaloJet> Phase1L1TJetProducer::buildJetsFromSeeds( } template <class Container> -void Phase1L1TJetProducer::fillCaloGrid(TH2F& caloGrid, const Container& triggerPrimitives, const unsigned int regionIndex) { +void Phase1L1TJetProducer::fillCaloGrid(TH2F& caloGrid, + const Container& triggerPrimitives, + const unsigned int regionIndex) { //Filling the calo grid with the primitives for (const auto& primitiveIterator : triggerPrimitives) { - // Get digitised (floating point with reduced precision) eta and phi - std::pair<float, float> digi_EtaPhi = getCandidateDigiEtaPhi( primitiveIterator->eta(), primitiveIterator->phi(), regionIndex ); + std::pair<float, float> digi_EtaPhi = + getCandidateDigiEtaPhi(primitiveIterator->eta(), primitiveIterator->phi(), regionIndex); caloGrid.Fill(static_cast<float>(digi_EtaPhi.first), static_cast<float>(digi_EtaPhi.second), @@ -429,60 +432,60 @@ void Phase1L1TJetProducer::fillCaloGrid(TH2F& caloGrid, const Container& trigger } } -std::pair<float, float> Phase1L1TJetProducer::getCandidateDigiEtaPhi( const float eta, const float phi, const unsigned int regionIndex ) const { +std::pair<float, float> Phase1L1TJetProducer::getCandidateDigiEtaPhi(const float eta, + const float phi, + const unsigned int regionIndex) const { + std::pair<double, double> regionLowEdges = regionEtaPhiLowEdges(regionIndex); - std::pair< double, double > regionLowEdges = regionEtaPhiLowEdges( regionIndex ); - - int digitisedEta = floor( ( eta - regionLowEdges.second ) / etalsb_ ); - int digitisedPhi = floor( ( phi - regionLowEdges.first ) / philsb_ ); + int digitisedEta = floor((eta - regionLowEdges.second) / etalsb_); + int digitisedPhi = floor((phi - regionLowEdges.first) / philsb_); // If eta or phi is on a bin edge // Put in bin above, to match behaviour of HLS // Unless it's on the last bin of this pf region // Then it is placed in the last bin, not the overflow TAxis* etaAxis = caloGrid_->GetXaxis(); - std::pair< double, double > regionUpEdges = regionEtaPhiUpEdges( regionIndex ); - int digiEtaEdgeLastBinUp = floor( ( regionUpEdges.second - regionLowEdges.second ) / etalsb_ ); + std::pair<double, double> regionUpEdges = regionEtaPhiUpEdges(regionIndex); + int digiEtaEdgeLastBinUp = floor((regionUpEdges.second - regionLowEdges.second) / etalsb_); // If the digi eta is outside the last bin of this pf region // Set the digitised quantity so it would be in the last bin // These cases could be avoided by sorting input candidates based on digitised eta/phi - if ( digitisedEta >= digiEtaEdgeLastBinUp ) { - digitisedEta = digiEtaEdgeLastBinUp-1; - } - else { - for ( int i = 0; i < etaAxis->GetNbins(); ++i ) { - if ( etaAxis->GetBinUpEdge(i) < regionLowEdges.second ) continue; - int digiEdgeBinUp = floor( ( etaAxis->GetBinUpEdge(i) - regionLowEdges.second ) / etalsb_ ); - if ( digiEdgeBinUp == digitisedEta ){ + if (digitisedEta >= digiEtaEdgeLastBinUp) { + digitisedEta = digiEtaEdgeLastBinUp - 1; + } else { + for (int i = 0; i < etaAxis->GetNbins(); ++i) { + if (etaAxis->GetBinUpEdge(i) < regionLowEdges.second) + continue; + int digiEdgeBinUp = floor((etaAxis->GetBinUpEdge(i) - regionLowEdges.second) / etalsb_); + if (digiEdgeBinUp == digitisedEta) { digitisedEta += 1; } - } + } } // Similar for phi TAxis* phiAxis = caloGrid_->GetYaxis(); - int digiPhiEdgeLastBinUp = floor( ( regionUpEdges.first - regionLowEdges.first ) / philsb_ ); - if ( digitisedPhi >= digiPhiEdgeLastBinUp ) { - digitisedPhi = digiPhiEdgeLastBinUp-1; - } - else { - for ( int i = 0; i < phiAxis->GetNbins(); ++i ) { - if ( phiAxis->GetBinUpEdge(i) < regionLowEdges.first ) continue; - int digiEdgeBinUp = floor( ( phiAxis->GetBinUpEdge(i) - regionLowEdges.first ) / philsb_ ); - if ( digiEdgeBinUp == digitisedPhi ){ + int digiPhiEdgeLastBinUp = floor((regionUpEdges.first - regionLowEdges.first) / philsb_); + if (digitisedPhi >= digiPhiEdgeLastBinUp) { + digitisedPhi = digiPhiEdgeLastBinUp - 1; + } else { + for (int i = 0; i < phiAxis->GetNbins(); ++i) { + if (phiAxis->GetBinUpEdge(i) < regionLowEdges.first) + continue; + int digiEdgeBinUp = floor((phiAxis->GetBinUpEdge(i) - regionLowEdges.first) / philsb_); + if (digiEdgeBinUp == digitisedPhi) { digitisedPhi += 1; } - } + } } // Convert digitised eta and phi back to floating point quantities with reduced precision - float floatDigitisedEta = ( digitisedEta + 0.5 ) * etalsb_ + regionLowEdges.second; - float floatDigitisedPhi = ( digitisedPhi + 0.5 ) * philsb_ + regionLowEdges.first; + float floatDigitisedEta = (digitisedEta + 0.5) * etalsb_ + regionLowEdges.second; + float floatDigitisedPhi = (digitisedPhi + 0.5) * philsb_ + regionLowEdges.first; - return std::pair<float, float> {floatDigitisedEta, floatDigitisedPhi}; + return std::pair<float, float>{floatDigitisedEta, floatDigitisedPhi}; } - void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add<edm::InputTag>("inputCollectionTag", edm::InputTag("l1pfCandidates", "Puppi")); @@ -494,120 +497,113 @@ void Phase1L1TJetProducer::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add<unsigned int>("jetIPhiSize", 7); desc.add<bool>("trimmedGrid", false); desc.add<double>("seedPtThreshold", 5); - desc.add<double>("ptlsb", 0.25), - desc.add<double>("philsb", 0.0043633231), - desc.add<double>("etalsb", 0.0043633231), - desc.add<bool>("puSubtraction", false); + desc.add<double>("ptlsb", 0.25), desc.add<double>("philsb", 0.0043633231), desc.add<double>("etalsb", 0.0043633231), + desc.add<bool>("puSubtraction", false); desc.add<string>("outputCollectionName", "UncalibratedPhase1L1TJetFromPfCandidates"); desc.add<bool>("vetoZeroPt", true); - desc.add<std::vector<double> >("etaRegions"); - desc.add<std::vector<double> >("phiRegions"); + desc.add<std::vector<double>>("etaRegions"); + desc.add<std::vector<double>>("phiRegions"); desc.add<unsigned int>("maxInputsPerRegion", 18); - desc.add<std::vector<double> >("sinPhi"); - desc.add<std::vector<double> >("cosPhi"); + desc.add<std::vector<double>>("sinPhi"); + desc.add<std::vector<double>>("cosPhi"); desc.add<double>("metAbsEtaCut", 3); desc.add<double>("metHFAbsEtaCut", 5); descriptions.add("Phase1L1TJetProducer", desc); } -template <class Handle > -std::vector< std::vector< edm::Ptr< reco::Candidate > > > Phase1L1TJetProducer::prepareInputsIntoRegions( const Handle triggerPrimitives ) -{ - - std::vector< std::vector< reco::CandidatePtr > > inputsInRegions{ etaRegionEdges_.size() * ( phiRegionEdges_.size() - 1 ) }; +template <class Handle> +std::vector<std::vector<edm::Ptr<reco::Candidate>>> Phase1L1TJetProducer::prepareInputsIntoRegions( + const Handle triggerPrimitives) { + std::vector<std::vector<reco::CandidatePtr>> inputsInRegions{etaRegionEdges_.size() * (phiRegionEdges_.size() - 1)}; - for ( unsigned int i = 0; i < triggerPrimitives->size(); ++i ) { + for (unsigned int i = 0; i < triggerPrimitives->size(); ++i) { + reco::CandidatePtr tp(triggerPrimitives, i); - reco::CandidatePtr tp( triggerPrimitives, i ); - - if ( tp->phi() < phiRegionEdges_.front() || tp->phi() >= phiRegionEdges_.back() - || tp->eta() < etaRegionEdges_.front() || tp->eta() >= etaRegionEdges_.back() ) continue; + if (tp->phi() < phiRegionEdges_.front() || tp->phi() >= phiRegionEdges_.back() || + tp->eta() < etaRegionEdges_.front() || tp->eta() >= etaRegionEdges_.back()) + continue; // Which phi region does this tp belong to auto it_phi = phiRegionEdges_.begin(); - it_phi = std::upper_bound (phiRegionEdges_.begin(), phiRegionEdges_.end(), tp->phi()) - 1; + it_phi = std::upper_bound(phiRegionEdges_.begin(), phiRegionEdges_.end(), tp->phi()) - 1; // Which eta region does this tp belong to auto it_eta = etaRegionEdges_.begin(); - it_eta = std::upper_bound (etaRegionEdges_.begin(), etaRegionEdges_.end(), tp->eta()) - 1; + it_eta = std::upper_bound(etaRegionEdges_.begin(), etaRegionEdges_.end(), tp->eta()) - 1; - if ( it_phi != phiRegionEdges_.end() && it_eta != etaRegionEdges_.end() ) { + if (it_phi != phiRegionEdges_.end() && it_eta != etaRegionEdges_.end()) { auto phiRegion = it_phi - phiRegionEdges_.begin(); auto etaRegion = it_eta - etaRegionEdges_.begin(); - inputsInRegions[ getRegionIndex( phiRegion, etaRegion ) ].emplace_back( tp ); + inputsInRegions[getRegionIndex(phiRegion, etaRegion)].emplace_back(tp); } } // Truncate number of inputs in each pf region - for ( auto& inputs : inputsInRegions ) { - if ( inputs.size() > maxInputsPerRegion_ ) { - inputs.resize( maxInputsPerRegion_ ); + for (auto& inputs : inputsInRegions) { + if (inputs.size() > maxInputsPerRegion_) { + inputs.resize(maxInputsPerRegion_); } } return inputsInRegions; } -unsigned int Phase1L1TJetProducer::getRegionIndex( const unsigned int phiRegion, const unsigned int etaRegion ) const { - return etaRegion * ( phiRegionEdges_.size() - 1 ) + phiRegion; +unsigned int Phase1L1TJetProducer::getRegionIndex(const unsigned int phiRegion, const unsigned int etaRegion) const { + return etaRegion * (phiRegionEdges_.size() - 1) + phiRegion; } -std::pair< double, double> Phase1L1TJetProducer::regionEtaPhiLowEdges( const unsigned int regionIndex ) const { - unsigned int phiRegion = regionIndex % ( phiRegionEdges_.size() - 1 ); - unsigned int etaRegion = ( regionIndex - phiRegion ) / ( phiRegionEdges_.size() - 1 ); - return std::pair< double, double > { phiRegionEdges_.at( phiRegion ), etaRegionEdges_.at( etaRegion ) }; +std::pair<double, double> Phase1L1TJetProducer::regionEtaPhiLowEdges(const unsigned int regionIndex) const { + unsigned int phiRegion = regionIndex % (phiRegionEdges_.size() - 1); + unsigned int etaRegion = (regionIndex - phiRegion) / (phiRegionEdges_.size() - 1); + return std::pair<double, double>{phiRegionEdges_.at(phiRegion), etaRegionEdges_.at(etaRegion)}; } -std::pair< double, double> Phase1L1TJetProducer::regionEtaPhiUpEdges( const unsigned int regionIndex ) const { - unsigned int phiRegion = regionIndex % ( phiRegionEdges_.size() - 1 ); - unsigned int etaRegion = ( regionIndex - phiRegion ) / ( phiRegionEdges_.size() - 1 ); - if ( phiRegion == phiRegionEdges_.size()-1 ) { - return std::pair< double, double > { phiRegionEdges_.at( phiRegion ), etaRegionEdges_.at( etaRegion + 1 ) }; - } - else if ( etaRegion == etaRegionEdges_.size()-1 ) { - return std::pair< double, double > { phiRegionEdges_.at( phiRegion + 1), etaRegionEdges_.at( etaRegion ) }; +std::pair<double, double> Phase1L1TJetProducer::regionEtaPhiUpEdges(const unsigned int regionIndex) const { + unsigned int phiRegion = regionIndex % (phiRegionEdges_.size() - 1); + unsigned int etaRegion = (regionIndex - phiRegion) / (phiRegionEdges_.size() - 1); + if (phiRegion == phiRegionEdges_.size() - 1) { + return std::pair<double, double>{phiRegionEdges_.at(phiRegion), etaRegionEdges_.at(etaRegion + 1)}; + } else if (etaRegion == etaRegionEdges_.size() - 1) { + return std::pair<double, double>{phiRegionEdges_.at(phiRegion + 1), etaRegionEdges_.at(etaRegion)}; } - return std::pair< double, double > { phiRegionEdges_.at( phiRegion + 1 ), etaRegionEdges_.at( etaRegion + 1 ) }; + return std::pair<double, double>{phiRegionEdges_.at(phiRegion + 1), etaRegionEdges_.at(etaRegion + 1)}; } - -l1t::EtSum Phase1L1TJetProducer::computeMET( const double etaCut, l1t::EtSum::EtSumType sumType ) const { - const auto lowEtaBin = caloGrid_->GetXaxis()->FindBin( -1.0 * etaCut ); - const auto highEtaBin = caloGrid_->GetXaxis()->FindBin( etaCut ) - 1; - const auto phiProjection = caloGrid_->ProjectionY( "temp", lowEtaBin, highEtaBin ); +l1t::EtSum Phase1L1TJetProducer::computeMET(const double etaCut, l1t::EtSum::EtSumType sumType) const { + const auto lowEtaBin = caloGrid_->GetXaxis()->FindBin(-1.0 * etaCut); + const auto highEtaBin = caloGrid_->GetXaxis()->FindBin(etaCut) - 1; + const auto phiProjection = caloGrid_->ProjectionY("temp", lowEtaBin, highEtaBin); // Use digitised quantities when summing to improve agreement with firmware int totalDigiPx{0}; int totalDigiPy{0}; - for ( int i = 1; i < phiProjection->GetNbinsX()+1; ++i ) { - double pt = phiProjection->GetBinContent( i ); - totalDigiPx += trunc( floor( pt / ptlsb_ ) * cosPhi_[i-1] ); - totalDigiPy += trunc( floor( pt / ptlsb_ ) * sinPhi_[i-1] ); + for (int i = 1; i < phiProjection->GetNbinsX() + 1; ++i) { + double pt = phiProjection->GetBinContent(i); + totalDigiPx += trunc(floor(pt / ptlsb_) * cosPhi_[i - 1]); + totalDigiPy += trunc(floor(pt / ptlsb_) * sinPhi_[i - 1]); } - double lMET = floor( sqrt(totalDigiPx * totalDigiPx + totalDigiPy * totalDigiPy) ) * ptlsb_; + double lMET = floor(sqrt(totalDigiPx * totalDigiPx + totalDigiPy * totalDigiPy)) * ptlsb_; - math::PtEtaPhiMLorentzVector lMETVector( lMET, 0, acos(totalDigiPx / ( lMET / ptlsb_ )), 0 ); - l1t::EtSum lMETSum(lMETVector, sumType, 0, 0, 0, 0 ); + math::PtEtaPhiMLorentzVector lMETVector(lMET, 0, acos(totalDigiPx / (lMET / ptlsb_)), 0); + l1t::EtSum lMETSum(lMETVector, sumType, 0, 0, 0, 0); return lMETSum; } -bool Phase1L1TJetProducer::trimTower( const int etaIndex, const int phiIndex ) const -{ - int etaHalfSize = jetIEtaSize_/2; - int phiHalfSize = jetIPhiSize_/2; +bool Phase1L1TJetProducer::trimTower(const int etaIndex, const int phiIndex) const { + int etaHalfSize = jetIEtaSize_ / 2; + int phiHalfSize = jetIPhiSize_ / 2; - if ( etaIndex == -etaHalfSize || etaIndex == etaHalfSize ) { - if ( phiIndex <= -phiHalfSize+1 || phiIndex >= phiHalfSize-1 ) { + if (etaIndex == -etaHalfSize || etaIndex == etaHalfSize) { + if (phiIndex <= -phiHalfSize + 1 || phiIndex >= phiHalfSize - 1) { return true; } - } - else if ( etaIndex == -etaHalfSize+1 || etaIndex == etaHalfSize-1 ) { - if ( phiIndex == -phiHalfSize || phiIndex == phiHalfSize ) { + } else if (etaIndex == -etaHalfSize + 1 || etaIndex == etaHalfSize - 1) { + if (phiIndex == -phiHalfSize || phiIndex == phiHalfSize) { return true; - } + } } return false; diff --git a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc index c0044b17d6f64..5806141fd2e06 100644 --- a/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/Phase1L1TJetSumsProducer.cc @@ -41,108 +41,98 @@ Description: Computes HT and MHT from phase-1-like jets #include <cmath> class Phase1L1TJetSumsProducer : public edm::one::EDProducer<edm::one::SharedResources> { - public: - explicit Phase1L1TJetSumsProducer(const edm::ParameterSet&); - ~Phase1L1TJetSumsProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - private: - void produce(edm::Event&, const edm::EventSetup&) override; - - // computes ht, adds jet pt to ht only if the pt of the jet is above the ht calculation threshold - l1t::EtSum computeHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const; - - // computes MHT - // adds jet pt to mht only if the pt of the jet is above the mht calculation threshold - // performs some calculations with digitised/integer quantities to ensure agreement with firmware - l1t::EtSum computeMHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const; - - edm::EDGetTokenT<std::vector<reco::CaloJet> > inputJetCollectionTag_; - - // holds the sin and cos for HLs LUT emulation - std::vector<double> sinPhi_; - std::vector<double> cosPhi_; - unsigned int nBinsPhi_; - - // lower phi value - double phiLow_; - // higher phi value - double phiUp_; - // size of a phi bin - double phiStep_; - // threshold for ht calculation - double htPtThreshold_; - // threshold for ht calculation - double mhtPtThreshold_; - // jet eta cut for ht calculation - double htAbsEtaCut_; - // jet eta cut for mht calculation - double mhtAbsEtaCut_; - // LSB of pt quantity - double ptlsb_; - // label of sums - std::string outputCollectionName_; - +public: + explicit Phase1L1TJetSumsProducer(const edm::ParameterSet&); + ~Phase1L1TJetSumsProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + // computes ht, adds jet pt to ht only if the pt of the jet is above the ht calculation threshold + l1t::EtSum computeHT(const edm::Handle<std::vector<reco::CaloJet> > inputJets) const; + + // computes MHT + // adds jet pt to mht only if the pt of the jet is above the mht calculation threshold + // performs some calculations with digitised/integer quantities to ensure agreement with firmware + l1t::EtSum computeMHT(const edm::Handle<std::vector<reco::CaloJet> > inputJets) const; + + edm::EDGetTokenT<std::vector<reco::CaloJet> > inputJetCollectionTag_; + + // holds the sin and cos for HLs LUT emulation + std::vector<double> sinPhi_; + std::vector<double> cosPhi_; + unsigned int nBinsPhi_; + + // lower phi value + double phiLow_; + // higher phi value + double phiUp_; + // size of a phi bin + double phiStep_; + // threshold for ht calculation + double htPtThreshold_; + // threshold for ht calculation + double mhtPtThreshold_; + // jet eta cut for ht calculation + double htAbsEtaCut_; + // jet eta cut for mht calculation + double mhtAbsEtaCut_; + // LSB of pt quantity + double ptlsb_; + // label of sums + std::string outputCollectionName_; }; // initialises plugin configuration and prepares ROOT file for saving the sums -Phase1L1TJetSumsProducer::Phase1L1TJetSumsProducer(const edm::ParameterSet& iConfig): - inputJetCollectionTag_{consumes<std::vector<reco::CaloJet> >(iConfig.getParameter<edm::InputTag>("inputJetCollectionTag"))}, - sinPhi_(iConfig.getParameter<std::vector<double> >("sinPhi")), - cosPhi_(iConfig.getParameter<std::vector<double> >("cosPhi")), - nBinsPhi_(iConfig.getParameter<unsigned int>("nBinsPhi")), - phiLow_(iConfig.getParameter<double>("phiLow")), - phiUp_(iConfig.getParameter<double>("phiUp")), - htPtThreshold_(iConfig.getParameter<double>("htPtThreshold")), - mhtPtThreshold_(iConfig.getParameter<double>("mhtPtThreshold")), - htAbsEtaCut_(iConfig.getParameter<double>("htAbsEtaCut")), - mhtAbsEtaCut_(iConfig.getParameter<double>("mhtAbsEtaCut")), - ptlsb_(iConfig.getParameter<double>("ptlsb")), - outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")) -{ - phiStep_ = ( phiUp_ - phiLow_ ) / nBinsPhi_; - produces< std::vector<l1t::EtSum> >( outputCollectionName_ ).setBranchAlias(outputCollectionName_); +Phase1L1TJetSumsProducer::Phase1L1TJetSumsProducer(const edm::ParameterSet& iConfig) + : inputJetCollectionTag_{consumes<std::vector<reco::CaloJet> >( + iConfig.getParameter<edm::InputTag>("inputJetCollectionTag"))}, + sinPhi_(iConfig.getParameter<std::vector<double> >("sinPhi")), + cosPhi_(iConfig.getParameter<std::vector<double> >("cosPhi")), + nBinsPhi_(iConfig.getParameter<unsigned int>("nBinsPhi")), + phiLow_(iConfig.getParameter<double>("phiLow")), + phiUp_(iConfig.getParameter<double>("phiUp")), + htPtThreshold_(iConfig.getParameter<double>("htPtThreshold")), + mhtPtThreshold_(iConfig.getParameter<double>("mhtPtThreshold")), + htAbsEtaCut_(iConfig.getParameter<double>("htAbsEtaCut")), + mhtAbsEtaCut_(iConfig.getParameter<double>("mhtAbsEtaCut")), + ptlsb_(iConfig.getParameter<double>("ptlsb")), + outputCollectionName_(iConfig.getParameter<std::string>("outputCollectionName")) { + phiStep_ = (phiUp_ - phiLow_) / nBinsPhi_; + produces<std::vector<l1t::EtSum> >(outputCollectionName_).setBranchAlias(outputCollectionName_); } -Phase1L1TJetSumsProducer::~Phase1L1TJetSumsProducer() -{ -} +Phase1L1TJetSumsProducer::~Phase1L1TJetSumsProducer() {} -void Phase1L1TJetSumsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - edm::Handle < std::vector<reco::CaloJet> > jetCollectionHandle; +void Phase1L1TJetSumsProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle<std::vector<reco::CaloJet> > jetCollectionHandle; iEvent.getByToken(inputJetCollectionTag_, jetCollectionHandle); - + // computing sums and storing them in sum object l1t::EtSum lHT = computeHT(jetCollectionHandle); l1t::EtSum lMHT = computeMHT(jetCollectionHandle); //packing sums in vector for event saving - std::unique_ptr< std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0)); + std::unique_ptr<std::vector<l1t::EtSum> > lSumVectorPtr(new std::vector<l1t::EtSum>(0)); lSumVectorPtr->push_back(lHT); lSumVectorPtr->push_back(lMHT); - iEvent.put(std::move(lSumVectorPtr), outputCollectionName_ ); + iEvent.put(std::move(lSumVectorPtr), outputCollectionName_); return; - } -l1t::EtSum Phase1L1TJetSumsProducer::computeHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const -{ +l1t::EtSum Phase1L1TJetSumsProducer::computeHT(const edm::Handle<std::vector<reco::CaloJet> > inputJets) const { double lHT = 0; - for (const auto & jet: *inputJets) - { + for (const auto& jet : *inputJets) { double lJetPt = jet.pt(); double lJetPhi = jet.phi(); double lJetEta = jet.eta(); - if - ( - (lJetPhi < phiLow_) || - (lJetPhi >= phiUp_) - ) continue; + if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_)) + continue; - lHT += (lJetPt >= htPtThreshold_ && std::fabs( lJetEta ) < htAbsEtaCut_ ) ? lJetPt : 0; + lHT += (lJetPt >= htPtThreshold_ && std::fabs(lJetEta) < htAbsEtaCut_) ? lJetPt : 0; } reco::Candidate::PolarLorentzVector lHTVector; @@ -153,52 +143,49 @@ l1t::EtSum Phase1L1TJetSumsProducer::computeHT(const edm::Handle < std::vector<r return lHTSum; } -l1t::EtSum Phase1L1TJetSumsProducer::computeMHT(const edm::Handle < std::vector<reco::CaloJet> > inputJets) const -{ - +l1t::EtSum Phase1L1TJetSumsProducer::computeMHT(const edm::Handle<std::vector<reco::CaloJet> > inputJets) const { int lTotalJetPx = 0; int lTotalJetPy = 0; std::vector<unsigned int> jetPtInPhiBins(nBinsPhi_, 0); - for (const auto & jet: *inputJets) - { + for (const auto& jet : *inputJets) { double lJetPhi = jet.phi(); - if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_)) continue; + if ((lJetPhi < phiLow_) || (lJetPhi >= phiUp_)) + continue; - unsigned int iPhi = ( lJetPhi - phiLow_ ) / phiStep_; + unsigned int iPhi = (lJetPhi - phiLow_) / phiStep_; - if ( jet.pt() >= mhtPtThreshold_ && std::fabs( jet.eta() ) < mhtAbsEtaCut_ ) { - unsigned int digiJetPt = floor( jet.pt() / ptlsb_ ); + if (jet.pt() >= mhtPtThreshold_ && std::fabs(jet.eta()) < mhtAbsEtaCut_) { + unsigned int digiJetPt = floor(jet.pt() / ptlsb_); jetPtInPhiBins[iPhi] += digiJetPt; } } - for ( unsigned int iPhi = 0; iPhi < jetPtInPhiBins.size(); ++iPhi ) { - + for (unsigned int iPhi = 0; iPhi < jetPtInPhiBins.size(); ++iPhi) { unsigned int digiJetPtSum = jetPtInPhiBins[iPhi]; // retrieving sin cos from LUT emulator double lSinPhi = sinPhi_[iPhi]; double lCosPhi = cosPhi_[iPhi]; - + // checking if above threshold - lTotalJetPx += trunc( digiJetPtSum * lCosPhi ); - lTotalJetPy += trunc( digiJetPtSum * lSinPhi ); + lTotalJetPx += trunc(digiJetPtSum * lCosPhi); + lTotalJetPy += trunc(digiJetPtSum * lSinPhi); } - double lMHT = floor( sqrt(lTotalJetPx * lTotalJetPx + lTotalJetPy * lTotalJetPy) ) * ptlsb_; - math::PtEtaPhiMLorentzVector lMHTVector( lMHT, 0, acos(lTotalJetPx / ( lMHT / ptlsb_ )), 0 ); - l1t::EtSum lMHTSum(lMHTVector, l1t::EtSum::EtSumType::kMissingHt, 0, 0, 0, 0 ); + double lMHT = floor(sqrt(lTotalJetPx * lTotalJetPx + lTotalJetPy * lTotalJetPy)) * ptlsb_; + math::PtEtaPhiMLorentzVector lMHTVector(lMHT, 0, acos(lTotalJetPx / (lMHT / ptlsb_)), 0); + l1t::EtSum lMHTSum(lMHTVector, l1t::EtSum::EtSumType::kMissingHt, 0, 0, 0, 0); return lMHTSum; - } void Phase1L1TJetSumsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.add<edm::InputTag>("inputJetCollectionTag", edm::InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates")); + desc.add<edm::InputTag>("inputJetCollectionTag", + edm::InputTag("Phase1L1TJetCalibrator", "Phase1L1TJetFromPfCandidates")); desc.add<std::vector<double> >("sinPhi"); desc.add<std::vector<double> >("cosPhi"); desc.add<unsigned int>("nBinsPhi", 72); @@ -208,8 +195,7 @@ void Phase1L1TJetSumsProducer::fillDescriptions(edm::ConfigurationDescriptions& desc.add<double>("mhtPtThreshold", 30); desc.add<double>("htAbsEtaCut", 3); desc.add<double>("mhtAbsEtaCut", 3); - desc.add<double>("ptlsb", 0.25), - desc.add<string>("outputCollectionName", "Sums"); + desc.add<double>("ptlsb", 0.25), desc.add<string>("outputCollectionName", "Sums"); descriptions.add("Phase1L1TJetSumsProducer", desc); } From 0ff88d12b56a24f9c95a0703c5b514c0bfefbb7b Mon Sep 17 00:00:00 2001 From: Konstantinos Theofilatos <konstantinos.theofilatos@gmail.com> Date: Mon, 3 May 2021 14:39:43 +0200 Subject: [PATCH 119/309] new names for madgraph/amcatnlo --- ..._TuneCH3_13TeV_madgraphMLM_herwig7_cff.py} | 0 ...TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py} | 0 ...S_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py | 264 ++++++++++++++++++ ..._TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py | 259 +++++++++++++++++ 4 files changed, 523 insertions(+) rename Configuration/Generator/python/{DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py => DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py} (100%) rename Configuration/Generator/python/{DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py => DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py} (100%) create mode 100644 GeneratorInterface/Herwig7Interface/test/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py create mode 100644 GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py diff --git a/Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py b/Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py similarity index 100% rename from Configuration/Generator/python/DYToll01234Jets_5f_LO_MLM_Madgraph_Herwig_13TeV_cff.py rename to Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py diff --git a/Configuration/Generator/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py b/Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py similarity index 100% rename from Configuration/Generator/python/DYToll012Jets_5f_NLO_FXFX_Madgraph_Herwig_13TeV_cff.py rename to Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py diff --git a/GeneratorInterface/Herwig7Interface/test/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py b/GeneratorInterface/Herwig7Interface/test/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py new file mode 100644 index 0000000000000..7450a6fdc2835 --- /dev/null +++ b/GeneratorInterface/Herwig7Interface/test/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cfg.py @@ -0,0 +1,264 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py --conditions auto:run2_mc -s LHE,GEN --datatier LHE,GEN -n 10 --eventcontent LHE,RAWSIM --no_exec +import FWCore.ParameterSet.Config as cms + + + +process = cms.Process('GEN') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff.py nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.LHEoutput = cms.OutputModule("PoolOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('LHE'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff_py_LHE_GEN.root'), + outputCommands = process.LHEEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +process.RAWSIMoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(1), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN'), + filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(20971520), + fileName = cms.untracked.string('DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff_py_LHE_GEN_inRAWSIM.root'), + outputCommands = process.RAWSIMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + +process.generator = cms.EDFilter("Herwig7GeneratorFilter", + configFiles = cms.vstring(), + crossSection = cms.untracked.double(-1), + dataLocation = cms.string('${HERWIGPATH:-6}'), + eventHandlers = cms.string('/Herwig/EventHandlers'), + filterEfficiency = cms.untracked.double(1.0), + generatorModule = cms.string('/Herwig/Generators/EventGenerator'), + herwig7CH3AlphaS = cms.vstring( + 'cd /Herwig/Shower', + 'set AlphaQCD:AlphaIn 0.118', + 'cd /' + ), + herwig7CH3MPISettings = cms.vstring( + 'set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.4712', + 'set /Herwig/UnderlyingEvent/MPIHandler:pTmin0 3.04', + 'set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.284', + 'set /Herwig/UnderlyingEvent/MPIHandler:Power 0.1362' + ), + herwig7CH3PDF = cms.vstring( + 'cd /Herwig/Partons', + 'create ThePEG::LHAPDF PDFSet_nnlo ThePEGLHAPDF.so', + 'set PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118.LHgrid', + 'set PDFSet_nnlo:RemnantHandler HadronRemnants', + 'set /Herwig/Particles/p+:PDF PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB PDFSet_nnlo', + 'create ThePEG::LHAPDF PDFSet_lo ThePEGLHAPDF.so', + 'set PDFSet_lo:PDFName NNPDF31_lo_as_0130.LHgrid', + 'set PDFSet_lo:RemnantHandler HadronRemnants', + 'set /Herwig/Shower/ShowerHandler:PDFARemnant PDFSet_lo', + 'set /Herwig/Shower/ShowerHandler:PDFBRemnant PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:FirstPDF PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:SecondPDF PDFSet_lo', + 'cd /' + ), + herwig7StableParticlesForDetector = cms.vstring( + 'set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm', + 'set /Herwig/Decays/DecayHandler:LifeTimeOption Average' + ), + hw_mg_merging_settings = cms.vstring( + 'cd /Herwig/EventHandlers', + 'library HwFxFx.so', + 'create Herwig::FxFxEventHandler LesHouchesHandler', + 'set LesHouchesHandler:PartonExtractor /Herwig/Partons/PPExtractor', + 'set LesHouchesHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler', + 'set LesHouchesHandler:DecayHandler /Herwig/Decays/DecayHandler', + 'set LesHouchesHandler:WeightOption VarNegWeight', + 'set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LesHouchesHandler', + 'create ThePEG::Cuts /Herwig/Cuts/NoCuts', + 'cd /Herwig/EventHandlers', + 'create Herwig::FxFxFileReader FxFxLHReader', + 'insert LesHouchesHandler:FxFxReaders[0] FxFxLHReader', + 'cd /Herwig/Shower', + 'library HwFxFxHandler.so', + 'create Herwig::FxFxHandler FxFxHandler', + 'set /Herwig/Shower/FxFxHandler:SplittingGenerator /Herwig/Shower/SplittingGenerator', + 'set /Herwig/Shower/FxFxHandler:KinematicsReconstructor /Herwig/Shower/KinematicsReconstructor', + 'set /Herwig/Shower/FxFxHandler:PartnerFinder /Herwig/Shower/PartnerFinder', + 'set /Herwig/EventHandlers/LesHouchesHandler:CascadeHandler /Herwig/Shower/FxFxHandler', + 'set /Herwig/Partons/PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118', + 'set /Herwig/Partons/RemnantDecayer:AllowTop Yes', + 'set /Herwig/Partons/PDFSet_nnlo:RemnantHandler /Herwig/Partons/HadronRemnants', + 'set /Herwig/Particles/p+:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:FileName cmsgrid_final.lhe', + 'set /Herwig/EventHandlers/FxFxLHReader:WeightWarnings false', + 'set /Herwig/EventHandlers/FxFxLHReader:AllowedToReOpen No', + 'set /Herwig/EventHandlers/FxFxLHReader:InitPDFs 0', + 'set /Herwig/EventHandlers/FxFxLHReader:Cuts /Herwig/Cuts/NoCuts', + 'set /Herwig/EventHandlers/FxFxLHReader:MomentumTreatment RescaleEnergy', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes', + 'set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes', + 'set /Herwig/Shower/PartnerFinder:PartnerMethod Random', + 'set /Herwig/Shower/PartnerFinder:ScaleChoice Partner', + 'set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost', + 'set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General', + 'set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity', + 'set /Herwig/Shower/ShowerHandler:SpinCorrelations Yes', + 'cd /Herwig/Shower', + 'set /Herwig/Shower/FxFxHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler', + 'set /Herwig/Shower/FxFxHandler:RemDecayer /Herwig/Partons/RemnantDecayer', + 'set /Herwig/Shower/FxFxHandler:ShowerAlpha AlphaQCD', + 'set FxFxHandler:HeavyQVeto Yes', + 'set FxFxHandler:HardProcessDetection Automatic', + 'set FxFxHandler:drjmin 0', + 'cd /Herwig/Shower', + 'set FxFxHandler:VetoIsTurnedOff VetoingIsOn', + 'set FxFxHandler:ETClus 20*GeV', + 'set FxFxHandler:RClus 1.0', + 'set FxFxHandler:EtaClusMax 10', + 'set FxFxHandler:RClusFactor 1.5' + ), + hw_user_settings = cms.vstring( + 'set FxFxHandler:MergeMode TreeMG5', + 'set FxFxHandler:njetsmax 4' + ), + parameterSets = cms.vstring( + 'herwig7CH3PDF', + 'herwig7CH3AlphaS', + 'herwig7CH3MPISettings', + 'herwig7StableParticlesForDetector', + 'hw_mg_merging_settings', + 'hw_user_settings' + ), + repository = cms.string('${HERWIGPATH}/HerwigDefaults.rpo'), + run = cms.string('InterfaceMatchboxTest'), + runModeList = cms.untracked.string('read,run'), + seed = cms.untracked.int32(12345) +) + + +process.externalLHEProducer = cms.EDProducer("ExternalLHEProducer", + 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), + numberOfParameters = cms.uint32(4), + outputFile = cms.string('cmsgrid_final.lhe'), + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.lhe_step = cms.Path(process.externalLHEProducer) +process.generation_step = cms.Path(process.pgen) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.LHEoutput_step = cms.EndPath(process.LHEoutput) +process.RAWSIMoutput_step = cms.EndPath(process.RAWSIMoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.lhe_step,process.generation_step,process.genfiltersummary_step,process.endjob_step,process.LHEoutput_step,process.RAWSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + if path in ['lhe_step']: continue + getattr(process,path).insert(0, process.ProductionFilterSequence) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py b/GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py new file mode 100644 index 0000000000000..52d0f5a028b83 --- /dev/null +++ b/GeneratorInterface/Herwig7Interface/test/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cfg.py @@ -0,0 +1,259 @@ +# Auto generated configuration file +# using: +# Revision: 1.19 +# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v +# with command line options: Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py --conditions auto:run2_mc -s LHE,GEN --datatier LHE,GEN -n 10 --eventcontent LHE,RAWSIM --no_exec +import FWCore.ParameterSet.Config as cms + + + +process = cms.Process('GEN') + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRealistic50ns13TeVCollision_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + deleteNonConsumedUnscheduledModules = cms.untracked.bool(True), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + allowAnyLabel_=cms.required.untracked.uint32 + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff.py nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.LHEoutput = cms.OutputModule("PoolOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('LHE'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff_py_LHE_GEN.root'), + outputCommands = process.LHEEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +process.RAWSIMoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + compressionAlgorithm = cms.untracked.string('LZMA'), + compressionLevel = cms.untracked.int32(1), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN'), + filterName = cms.untracked.string('') + ), + eventAutoFlushCompressedSize = cms.untracked.int32(20971520), + fileName = cms.untracked.string('DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff_py_LHE_GEN_inRAWSIM.root'), + outputCommands = process.RAWSIMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '') + +process.generator = cms.EDFilter("Herwig7GeneratorFilter", + configFiles = cms.vstring(), + crossSection = cms.untracked.double(-1), + dataLocation = cms.string('${HERWIGPATH:-6}'), + eventHandlers = cms.string('/Herwig/EventHandlers'), + filterEfficiency = cms.untracked.double(1.0), + generatorModule = cms.string('/Herwig/Generators/EventGenerator'), + herwig7CH3AlphaS = cms.vstring( + 'cd /Herwig/Shower', + 'set AlphaQCD:AlphaIn 0.118', + 'cd /' + ), + herwig7CH3MPISettings = cms.vstring( + 'set /Herwig/Hadronization/ColourReconnector:ReconnectionProbability 0.4712', + 'set /Herwig/UnderlyingEvent/MPIHandler:pTmin0 3.04', + 'set /Herwig/UnderlyingEvent/MPIHandler:InvRadius 1.284', + 'set /Herwig/UnderlyingEvent/MPIHandler:Power 0.1362' + ), + herwig7CH3PDF = cms.vstring( + 'cd /Herwig/Partons', + 'create ThePEG::LHAPDF PDFSet_nnlo ThePEGLHAPDF.so', + 'set PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118.LHgrid', + 'set PDFSet_nnlo:RemnantHandler HadronRemnants', + 'set /Herwig/Particles/p+:PDF PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB PDFSet_nnlo', + 'create ThePEG::LHAPDF PDFSet_lo ThePEGLHAPDF.so', + 'set PDFSet_lo:PDFName NNPDF31_lo_as_0130.LHgrid', + 'set PDFSet_lo:RemnantHandler HadronRemnants', + 'set /Herwig/Shower/ShowerHandler:PDFARemnant PDFSet_lo', + 'set /Herwig/Shower/ShowerHandler:PDFBRemnant PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:FirstPDF PDFSet_lo', + 'set /Herwig/Partons/MPIExtractor:SecondPDF PDFSet_lo', + 'cd /' + ), + herwig7StableParticlesForDetector = cms.vstring( + 'set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm', + 'set /Herwig/Decays/DecayHandler:LifeTimeOption Average' + ), + hw_mg_merging_settings = cms.vstring( + 'cd /Herwig/EventHandlers', + 'library HwFxFx.so', + 'create Herwig::FxFxEventHandler LesHouchesHandler', + 'set LesHouchesHandler:PartonExtractor /Herwig/Partons/PPExtractor', + 'set LesHouchesHandler:HadronizationHandler /Herwig/Hadronization/ClusterHadHandler', + 'set LesHouchesHandler:DecayHandler /Herwig/Decays/DecayHandler', + 'set LesHouchesHandler:WeightOption VarNegWeight', + 'set /Herwig/Generators/EventGenerator:EventHandler /Herwig/EventHandlers/LesHouchesHandler', + 'create ThePEG::Cuts /Herwig/Cuts/NoCuts', + 'cd /Herwig/EventHandlers', + 'create Herwig::FxFxFileReader FxFxLHReader', + 'insert LesHouchesHandler:FxFxReaders[0] FxFxLHReader', + 'cd /Herwig/Shower', + 'library HwFxFxHandler.so', + 'create Herwig::FxFxHandler FxFxHandler', + 'set /Herwig/Shower/FxFxHandler:SplittingGenerator /Herwig/Shower/SplittingGenerator', + 'set /Herwig/Shower/FxFxHandler:KinematicsReconstructor /Herwig/Shower/KinematicsReconstructor', + 'set /Herwig/Shower/FxFxHandler:PartnerFinder /Herwig/Shower/PartnerFinder', + 'set /Herwig/EventHandlers/LesHouchesHandler:CascadeHandler /Herwig/Shower/FxFxHandler', + 'set /Herwig/Partons/PDFSet_nnlo:PDFName NNPDF31_nnlo_as_0118', + 'set /Herwig/Partons/RemnantDecayer:AllowTop Yes', + 'set /Herwig/Partons/PDFSet_nnlo:RemnantHandler /Herwig/Partons/HadronRemnants', + 'set /Herwig/Particles/p+:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Particles/pbar-:PDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:FirstPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Partons/PPExtractor:SecondPDF /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:FileName cmsgrid_final.lhe', + 'set /Herwig/EventHandlers/FxFxLHReader:WeightWarnings false', + 'set /Herwig/EventHandlers/FxFxLHReader:AllowedToReOpen No', + 'set /Herwig/EventHandlers/FxFxLHReader:InitPDFs 0', + 'set /Herwig/EventHandlers/FxFxLHReader:Cuts /Herwig/Cuts/NoCuts', + 'set /Herwig/EventHandlers/FxFxLHReader:MomentumTreatment RescaleEnergy', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFA /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/EventHandlers/FxFxLHReader:PDFB /Herwig/Partons/PDFSet_nnlo', + 'set /Herwig/Shower/ShowerHandler:MaxPtIsMuF Yes', + 'set /Herwig/Shower/ShowerHandler:RestrictPhasespace Yes', + 'set /Herwig/Shower/PartnerFinder:PartnerMethod Random', + 'set /Herwig/Shower/PartnerFinder:ScaleChoice Partner', + 'set /Herwig/Shower/KinematicsReconstructor:InitialInitialBoostOption LongTransBoost', + 'set /Herwig/Shower/KinematicsReconstructor:ReconstructionOption General', + 'set /Herwig/Shower/KinematicsReconstructor:InitialStateReconOption Rapidity', + 'set /Herwig/Shower/ShowerHandler:SpinCorrelations Yes', + 'cd /Herwig/Shower', + 'set /Herwig/Shower/FxFxHandler:MPIHandler /Herwig/UnderlyingEvent/MPIHandler', + 'set /Herwig/Shower/FxFxHandler:RemDecayer /Herwig/Partons/RemnantDecayer', + 'set /Herwig/Shower/FxFxHandler:ShowerAlpha AlphaQCD', + 'set FxFxHandler:HeavyQVeto Yes', + 'set FxFxHandler:HardProcessDetection Automatic', + 'set FxFxHandler:drjmin 0', + 'cd /Herwig/Shower', + 'set FxFxHandler:VetoIsTurnedOff VetoingIsOn', + 'set FxFxHandler:ETClus 20*GeV', + 'set FxFxHandler:RClus 1.0', + 'set FxFxHandler:EtaClusMax 10', + 'set FxFxHandler:RClusFactor 1.5' + ), + hw_user_settings = cms.vstring( + 'set FxFxHandler:MergeMode FxFx', + 'set FxFxHandler:njetsmax 2' + ), + parameterSets = cms.vstring( + 'herwig7CH3PDF', + 'herwig7CH3AlphaS', + 'herwig7CH3MPISettings', + 'herwig7StableParticlesForDetector', + 'hw_mg_merging_settings', + 'hw_user_settings' + ), + repository = cms.string('${HERWIGPATH}/HerwigDefaults.rpo'), + run = cms.string('InterfaceMatchboxTest'), + runModeList = cms.untracked.string('read,run'), + seed = cms.untracked.int32(12345) +) + + +process.externalLHEProducer = cms.EDProducer("ExternalLHEProducer", + args = cms.vstring('/cvmfs/cms.cern.ch/phys_generator/gridpacks/2017/13TeV/madgraph/V5_2.6.1/DYellell012j_5f_NLO_FXFX/dyellell012j_5f_NLO_FXFX_slc7_amd64_gcc700_CMSSW_10_6_4_tarball.tar.xz'), + nEvents = cms.untracked.uint32(10), + numberOfParameters = cms.uint32(1), + outputFile = cms.string('cmsgrid_final.lhe'), + scriptName = cms.FileInPath('GeneratorInterface/LHEInterface/data/run_generic_tarball_cvmfs.sh') +) + + +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.lhe_step = cms.Path(process.externalLHEProducer) +process.generation_step = cms.Path(process.pgen) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.LHEoutput_step = cms.EndPath(process.LHEoutput) +process.RAWSIMoutput_step = cms.EndPath(process.RAWSIMoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.lhe_step,process.generation_step,process.genfiltersummary_step,process.endjob_step,process.LHEoutput_step,process.RAWSIMoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + if path in ['lhe_step']: continue + getattr(process,path).insert(0, process.ProductionFilterSequence) + + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion From 05ec716341bc5fa2a8fbd567301899ab458a6ef3 Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski <sebastian.wozniewski@kit.edu> Date: Mon, 3 May 2021 15:00:12 +0200 Subject: [PATCH 120/309] reuse objects from std taus and remove unnecessary import --- .../NanoAOD/python/boostedTaus_cff.py | 54 +++---------------- 1 file changed, 7 insertions(+), 47 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/boostedTaus_cff.py b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py index 1fd782154d61e..5ca520e9ad7e1 100644 --- a/PhysicsTools/NanoAOD/python/boostedTaus_cff.py +++ b/PhysicsTools/NanoAOD/python/boostedTaus_cff.py @@ -1,9 +1,8 @@ import FWCore.ParameterSet.Config as cms from PhysicsTools.NanoAOD.common_cff import * -##################### Updated tau collection with MVA-based tau-Ids rerun ####### -# Used only in some eras -from PhysicsTools.NanoAOD.taus_updatedMVAIds_cff import * +##################### Import reusable funtions and objects from std taus ######## +from PhysicsTools.NanoAOD.taus_cff import _tauId2WPMask,_tauId5WPMask,_tauId7WPMask,tausMCMatchLepTauForTable,tausMCMatchHadTauForTable,tauMCTable ##################### User floats producers, selectors ########################## @@ -13,26 +12,6 @@ cut = cms.string("pt > 40 && tauID('decayModeFindingNewDMs') && (tauID('byVVLooseIsolationMVArun2017v2DBoldDMwLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBoldDMdR0p3wLT2017') || tauID('byVVLooseIsolationMVArun2017v2DBnewDMwLT2017'))") ) - -##################### Tables for final output and docs ########################## -def _tauIdWPMask(pattern, choices, doc=""): - return Var(" + ".join(["%d * tauID('%s')" % (pow(2,i), pattern % c) for (i,c) in enumerate(choices)]), "uint8", - doc=doc+": bitmask "+", ".join(["%d = %s" % (pow(2,i),c) for (i,c) in enumerate(choices)])) -def _tauId2WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("Loose","Tight"),doc=doc) -def _tauId3WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("Loose","Medium","Tight"),doc=doc) -def _tauId4WPMask(pattern,doc): - return _tauIdWPMask(pattern, choices=("VLoose", "Loose", "Medium", "Tight"), doc=doc) -def _tauId5WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight"),doc=doc) -def _tauId6WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) -def _tauId7WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) -def _tauId8WPMask(pattern,doc): - return _tauIdWPMask(pattern,choices=("VVVLoose","VVLoose","VLoose","Loose","Medium","Tight","VTight","VVTight"),doc=doc) - boostedTauTable = cms.EDProducer("SimpleCandidateFlatTableProducer", src = cms.InputTag("finalBoostedTaus"), cut = cms.string(""), #we should not filter on cross linked collections @@ -72,39 +51,20 @@ def _tauId8WPMask(pattern,doc): boostedTauTable.variables = _boostedTauVarsBase -boostedTausMCMatchLepTauForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR - src = boostedTauTable.src, # final reco collection - matched = cms.InputTag("finalGenParticles"), # final mc-truth particle collection - mcPdgId = cms.vint32(11,13), # one or more PDG ID (11 = electron, 13 = muon); absolute values (see below) - checkCharge = cms.bool(False), # True = require RECO and MC objects to have the same charge - mcStatus = cms.vint32(), # PYTHIA status code (1 = stable, 2 = shower, 3 = hard scattering) - maxDeltaR = cms.double(0.3), # Minimum deltaR for the match - maxDPtRel = cms.double(0.5), # Minimum deltaPt/Pt for the match - resolveAmbiguities = cms.bool(True), # Forbid two RECO objects to match to the same GEN object - resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first +boostedTausMCMatchLepTauForTable = tausMCMatchLepTauForTable.clone( + src = boostedTauTable.src ) #This requires genVisTaus in taus_cff.py -boostedTausMCMatchHadTauForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR - src = boostedTauTable.src, # final reco collection - matched = cms.InputTag("genVisTaus"), # generator level hadronic tau decays - mcPdgId = cms.vint32(15), # one or more PDG ID (15 = tau); absolute values (see below) - checkCharge = cms.bool(False), # True = require RECO and MC objects to have the same charge - mcStatus = cms.vint32(), # CV: no *not* require certain status code for matching (status code corresponds to decay mode for hadronic tau decays) - maxDeltaR = cms.double(0.3), # Maximum deltaR for the match - maxDPtRel = cms.double(1.), # Maximum deltaPt/Pt for the match - resolveAmbiguities = cms.bool(True), # Forbid two RECO objects to match to the same GEN object - resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first +boostedTausMCMatchHadTauForTable = tausMCMatchHadTauForTable.clone( + src = boostedTauTable.src ) -boostedTauMCTable = cms.EDProducer("CandMCMatchTableProducer", +boostedTauMCTable = tauMCTable.clone( src = boostedTauTable.src, mcMap = cms.InputTag("boostedTausMCMatchLepTauForTable"), mcMapVisTau = cms.InputTag("boostedTausMCMatchHadTauForTable"), objName = boostedTauTable.name, - objType = cms.string("Tau"), - branchName = cms.string("genPart"), - docString = cms.string("MC matching to status==2 taus"), ) From 9516b7b30604e2d59d00a6906424693df227e4c9 Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski <sebastian.wozniewski@kit.edu> Date: Mon, 3 May 2021 16:37:49 +0200 Subject: [PATCH 121/309] restore MVA2017v2 for 94XMiniAODv1 and further clean up --- PhysicsTools/NanoAOD/python/taus_cff.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/taus_cff.py b/PhysicsTools/NanoAOD/python/taus_cff.py index 69d2575517e2b..df37243ad7cf0 100644 --- a/PhysicsTools/NanoAOD/python/taus_cff.py +++ b/PhysicsTools/NanoAOD/python/taus_cff.py @@ -109,14 +109,6 @@ def _tauId8WPMask(pattern,doc): idMVAoldDM2017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBoldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2017v2)"), idMVAoldDMdR032017v2 = _tauId7WPMask( "by%sIsolationMVArun2v1DBdR03oldDMwLT2017v2", doc="IsolationMVArun2v1DBoldDMdR0p3wLT ID working point (2017v2)") ) -_mvaAntiEVars = cms.PSet( - rawAntiEle2018 = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2018)", precision=10), - rawAntiEleCat2018 = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2018)"), - idAntiEle2018 = _tauId5WPMask("againstElectron%sMVA6", doc= "Anti-electron MVA discriminator V6 (2018)"), - rawAntiEle = Var("tauID('againstElectronMVA6Raw2015')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10), - rawAntiEleCat = Var("tauID('againstElectronMVA6category2015')", int, doc="Anti-electron MVA discriminator V6 category (2015"), - idAntiEle = _tauId5WPMask("againstElectron%sMVA62015", doc= "Anti-electron MVA discriminator V6 (2015)"), -) _mvaAntiEVars2015 = cms.PSet( rawAntiEle = Var("tauID('againstElectronMVA6Raw')", float, doc= "Anti-electron MVA discriminator V6 raw output discriminator (2015)", precision=10), rawAntiEleCat = Var("tauID('againstElectronMVA6category')", int, doc="Anti-electron MVA discriminator V6 category (2015"), @@ -135,7 +127,10 @@ def _tauId8WPMask(pattern,doc): _tauVarsBase, _deepTauVars2017v2p1 ) -_variablesMiniV1 = _variablesMiniV2.clone() +_variablesMiniV1 = cms.PSet( + _variablesMiniV2, + _mvaIsoVars2017v2 +) _variablesMiniV1.rawMVAoldDM = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2015)",precision=10) _variablesMiniV1.rawMVAoldDM2017v1 = Var( "tauID('byIsolationMVArun2v1DBoldDMwLTraw2017v1')",float, doc="byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)",precision=10) _variablesMiniV1.idMVAoldDM = _tauId6WPMask( "by%sIsolationMVArun2v1DBoldDMwLT", doc="IsolationMVArun2v1DBoldDMwLT ID working point (2015)") @@ -149,7 +144,7 @@ def _tauId8WPMask(pattern,doc): tauTable.variables = _variablesMiniV2 (run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(tauTable, - variables = cms.PSet(tauTable.variables, _mvaAntiEVars, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2) + variables = cms.PSet(tauTable.variables, _mvaIsoVars2015Reduced, _mvaIsoVars2017v1, _mvaIsoVars2017v2) ) for era in [run2_nanoAOD_94XMiniAODv1,]: era.toModify(tauTable, From 19854681a5ab70c2f4adddc0abddda10e9483617 Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski <sebastian.wozniewski@kit.edu> Date: Mon, 3 May 2021 16:46:48 +0200 Subject: [PATCH 122/309] clean up DQM --- PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index c1bff0f3f2fdf..ab1af3ba6ab3e 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -724,16 +724,10 @@ Plot1D('idAntiEle2018', 'idAntiEle2018', 32, -0.5, 31.5, 'Anti-electron MVA discriminator V6 (2018): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight'), Plot1D('idAntiEleDeadECal', 'idAntiEleDeadECal', 2, -0.5, 1.5, "tauID('againstElectronDeadECAL')"), Plot1D('idAntiMu', 'idAntiMu', 4, -0.5, 3.5, 'Anti-muon discriminator V3: : bitmask 1 = Loose, 2 = Tight'), - Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), - Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), + Plot1D('idDecayModeOldDMs', 'idDecayModeOldDMs', 2, -0.5, 1.5, "tauID('decayModeFinding')"), Plot1D('idDeepTau2017v2p1VSe', 'idDeepTau2017v2p1VSe', 256, -0.5, 255.5, 'byDeepTau2017v2p1VSe ID working points (deepTau2017v2p1): bitmask 1 = VVVLoose, 2 = VVLoose, 4 = VLoose, 8 = Loose, 16 = Medium, 32 = Tight, 64 = VTight, 128 = VVTight'), Plot1D('idDeepTau2017v2p1VSjet', 'idDeepTau2017v2p1VSjet', 256, -0.5, 255.5, 'byDeepTau2017v2p1VSjet ID working points (deepTau2017v2p1): bitmask 1 = VVVLoose, 2 = VVLoose, 4 = VLoose, 8 = Loose, 16 = Medium, 32 = Tight, 64 = VTight, 128 = VVTight'), Plot1D('idDeepTau2017v2p1VSmu', 'idDeepTau2017v2p1VSmu', 16, -0.5, 15.5, 'byDeepTau2017v2p1VSmu ID working points (deepTau2017v2p1): bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight'), - Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), - Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), - Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), NoPlot('jetIdx'), Plot1D('leadTkDeltaEta', 'leadTkDeltaEta', 20, -0.1, 0.1, 'eta of the leading track, minus tau eta'), Plot1D('leadTkDeltaPhi', 'leadTkDeltaPhi', 20, -0.1, 0.1, 'phi of the leading track, minus tau phi'), @@ -744,20 +738,11 @@ Plot1D('photonsOutsideSignalCone', 'photonsOutsideSignalCone', 20, 0, 30, 'sum of photons outside signal cone'), Plot1D('pt', 'pt', 20, 0, 200, 'pt'), Plot1D('puCorr', 'puCorr', 20, 0, 90, 'pileup correction'), - Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), - Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'), - Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'), - Plot1D('rawAntiEleCat2018', 'rawAntiEleCat2018', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category (2018)'), Plot1D('rawDeepTau2017v2p1VSe', 'rawDeepTau2017v2p1VSe', 20, 0, 1, 'byDeepTau2017v2p1VSe raw output discriminator (deepTau2017v2p1)'), Plot1D('rawDeepTau2017v2p1VSjet', 'rawDeepTau2017v2p1VSjet', 20, 0, 1, 'byDeepTau2017v2p1VSjet raw output discriminator (deepTau2017v2p1)'), Plot1D('rawDeepTau2017v2p1VSmu', 'rawDeepTau2017v2p1VSmu', 20, 0, 1, 'byDeepTau2017v2p1VSmu raw output discriminator (deepTau2017v2p1)'), Plot1D('rawIso', 'rawIso', 20, 0, 200, 'combined isolation (deltaBeta corrections)'), Plot1D('rawIsodR03', 'rawIsodR03', 20, 0, 200, 'combined isolation (deltaBeta corrections, dR=0.3)'), - Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)'), - Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator'), - Plot1D('rawMVAoldDM2017v1', 'rawMVAoldDM2017v1', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)'), - Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'), - Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)'), ) ), TkMET = cms.PSet( From a31342c7237369aa10dbe83a7f6b440f9d7a7c90 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 3 May 2021 17:03:46 +0200 Subject: [PATCH 123/309] Get rid of HCAL option from most of the code in Validation/HGCalValidation/plugins --- .../plugins/HGCalDigiClient.cc | 15 +- .../plugins/HGCalDigiValidation.cc | 126 ++----------- .../plugins/HGCalRecHitValidation.cc | 139 ++++----------- .../plugins/HGCalRecHitsClient.cc | 25 +-- .../plugins/HGCalSimHitStudy.cc | 165 ++++++------------ .../plugins/HGCalSimHitValidation.cc | 98 +++-------- .../plugins/HGCalSimHitsClient.cc | 15 +- 7 files changed, 133 insertions(+), 450 deletions(-) diff --git a/Validation/HGCalValidation/plugins/HGCalDigiClient.cc b/Validation/HGCalValidation/plugins/HGCalDigiClient.cc index 6fc6092794243..e12854c9d6d3b 100644 --- a/Validation/HGCalValidation/plugins/HGCalDigiClient.cc +++ b/Validation/HGCalValidation/plugins/HGCalDigiClient.cc @@ -14,16 +14,13 @@ #include "DQMServices/Core/interface/DQMEDHarvester.h" #include "DQMServices/Core/interface/DQMStore.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" class HGCalDigiClient : public DQMEDHarvester { private: const std::string nameDetector_; const int verbosity_; - const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcal_; const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> tok_hgcal_; int layers_; @@ -34,24 +31,18 @@ class HGCalDigiClient : public DQMEDHarvester { void beginRun(const edm::Run &run, const edm::EventSetup &c) override; void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override; void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig); - int digisEndjob(const std::vector<MonitorElement *> &hcalMEs); + int digisEndjob(const std::vector<MonitorElement *> &hgcalMEs); }; HGCalDigiClient::HGCalDigiClient(const edm::ParameterSet &iConfig) : nameDetector_(iConfig.getParameter<std::string>("DetectorName")), verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)), - tok_hcal_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{})), tok_hgcal_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( edm::ESInputTag{"", nameDetector_})) {} void HGCalDigiClient::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants *hcons = &iSetup.getData(tok_hcal_); - layers_ = hcons->getMaxDepth(1); - } else { - const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); - layers_ = hgcons->layers(true); - } + const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); + layers_ = hgcons->layers(true); } void HGCalDigiClient::dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) { runClient_(ib, ig); } diff --git a/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc b/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc index c47927f2ec933..0440a49baa70d 100644 --- a/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc @@ -6,23 +6,13 @@ #include <string> #include <vector> -#include "CalibFormats/HcalObjects/interface/HcalDbService.h" -#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h" -#include "CalibFormats/HcalObjects/interface/HcalCoderDb.h" -#include "CalibFormats/HcalObjects/interface/HcalCalibrations.h" -#include "CondFormats/HcalObjects/interface/HcalQIEShape.h" - #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/ForwardDetId/interface/HFNoseDetId.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" -#include "DataFormats/HcalDigi/interface/HBHEDataFrame.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "DQMServices/Core/interface/DQMStore.h" @@ -38,9 +28,6 @@ #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" @@ -79,13 +66,10 @@ class HGCalDigiValidation : public DQMEDAnalyzer { // ----------member data --------------------------- const std::string nameDetector_; - const bool ifNose_, ifHCAL_; + const bool ifNose_; const int verbosity_, SampleIndx_; - const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcalc_; const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> tok_hgcalc_; - const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_hcalg_; const edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> tok_hgcalg_; - const edm::ESGetToken<HcalDbService, HcalDbRecord> tok_cond_; int layers_, firstLayer_; edm::EDGetToken digiSource_; @@ -105,30 +89,20 @@ class HGCalDigiValidation : public DQMEDAnalyzer { HGCalDigiValidation::HGCalDigiValidation(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter<std::string>("DetectorName")), ifNose_(iConfig.getParameter<bool>("ifNose")), - ifHCAL_(iConfig.getParameter<bool>("ifHCAL")), verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)), SampleIndx_(iConfig.getUntrackedParameter<int>("SampleIndx", 0)), - tok_hcalc_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{})), tok_hgcalc_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( edm::ESInputTag{"", nameDetector_})), - tok_hcalg_(esConsumes<CaloGeometry, CaloGeometryRecord>()), tok_hgcalg_(esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", nameDetector_})), - tok_cond_(esConsumes<HcalDbService, HcalDbRecord>()), firstLayer_(1) { auto temp = iConfig.getParameter<edm::InputTag>("DigiSource"); if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive") || (nameDetector_ == "HGCalHEScintillatorSensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { digiSource_ = consumes<HGCalDigiCollection>(temp); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - digiSource_ = consumes<QIE11DigiCollection>(temp); - else - digiSource_ = consumes<HGCalDigiCollection>(temp); } else { throw cms::Exception("BadHGCDigiSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " - << "\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\", " - << "or \"HCal\"!"; + << "\"HGCalEESensitive\", \"HGCalHESiliconSensitive\", or " + << "\"HGCalHEScintillatorSensitive\", \"HGCalHFNoseSensitive\"!"; } } @@ -137,7 +111,6 @@ void HGCalDigiValidation::fillDescriptions(edm::ConfigurationDescriptions& descr desc.add<std::string>("DetectorName", "HGCalEESensitive"); desc.add<edm::InputTag>("DigiSource", edm::InputTag("hgcalDigis", "EE")); desc.add<bool>("ifNose", false); - desc.add<bool>("ifHCAL", false); desc.addUntracked<int>("Verbosity", 0); desc.addUntracked<int>("SampleIndx", 2); // central bx descriptions.add("hgcalDigiValidationEEDefault", desc); @@ -147,20 +120,14 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent, const edm::EventSetu OccupancyMap_plus_.clear(); OccupancyMap_minus_.clear(); - const HGCalGeometry* geom0(nullptr); - const CaloGeometry* geom1(nullptr); int geomType(0); - if (nameDetector_ == "HCal") { - geom1 = &iSetup.getData(tok_hcalg_); - } else { - geom0 = &iSetup.getData(tok_hgcalg_); - if (geom0->topology().waferHexagon8()) - geomType = 1; - else if (geom0->topology().tileTrapezoid()) - geomType = 2; - if (nameDetector_ == "HGCalHFNoseSensitive") - geomType = 3; - } + const HGCalGeometry* geom0 = &iSetup.getData(tok_hgcalg_); + if (geom0->topology().waferHexagon8()) + geomType = 1; + else if (geom0->topology().tileTrapezoid()) + geomType = 2; + if (nameDetector_ == "HGCalHFNoseSensitive") + geomType = 3; unsigned int ntot(0), nused(0); if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHFNoseSensitive")) { @@ -219,68 +186,6 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent, const edm::EventSetu edm::LogVerbatim("HGCalValidation") << "DigiCollection handle does not " << "exist for " << nameDetector_; } - } else if ((nameDetector_ == "HCal") && (!ifHCAL_)) { - //HGCalBH - edm::Handle<HGCalDigiCollection> theHGCBHDigiContainers; - iEvent.getByToken(digiSource_, theHGCBHDigiContainers); - if (theHGCBHDigiContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theHGCBHDigiContainers->size() << " element(s)"; - for (const auto& it : *(theHGCBHDigiContainers.product())) { - ntot++; - nused++; - HcalDetId detId = it.id(); - int layer = detId.depth(); - const HGCSample& hgcSample = it.sample(SampleIndx_); - uint16_t gain = hgcSample.toa(); - uint16_t adc = hgcSample.data(); - double charge = gain; - bool totmode = hgcSample.mode(); - bool zerothreshold = hgcSample.threshold(); - digiValidation(detId, geom1, layer, adc, charge, totmode, zerothreshold); - } - fillDigiInfo(); - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle does not " - << "exist for " << nameDetector_; - } - } else if (nameDetector_ == "HCal") { - //HE - edm::Handle<QIE11DigiCollection> theHEDigiContainers; - iEvent.getByToken(digiSource_, theHEDigiContainers); - if (theHEDigiContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theHEDigiContainers->size() << " element(s)"; - const HcalDbService* conditions = &iSetup.getData(tok_cond_); - - for (const auto& it : *(theHEDigiContainers.product())) { - QIE11DataFrame df(it); - HcalDetId detId = (df.id()); - ntot++; - if (detId.subdet() == HcalEndcap) { - nused++; - HcalCalibrations calibrations = conditions->getHcalCalibrations(detId); - const HcalQIECoder* channelCoder = conditions->getHcalCoder(detId); - const HcalQIEShape* shape = conditions->getHcalShape(channelCoder); - HcalCoderDb coder(*channelCoder, *shape); - CaloSamples tool; - coder.adc2fC(df, tool); - int layer = detId.depth(); - uint16_t adc = (df)[SampleIndx_].adc(); - int capid = (df)[SampleIndx_].capid(); - double charge = (tool[SampleIndx_] - calibrations.pedestal(capid)); - bool totmode = false; - bool zerothreshold = false; - digiValidation(detId, geom1, layer, adc, charge, totmode, zerothreshold); - } - } - fillDigiInfo(); - } else { - edm::LogWarning("HGCalValidation") << "DigiCollection handle does not " - << "exist for " << nameDetector_; - } } else { edm::LogWarning("HGCalValidation") << "invalid detector name !! " << nameDetector_; } @@ -356,14 +261,9 @@ void HGCalDigiValidation::fillDigiInfo() { } void HGCalDigiValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants* hcons = &iSetup.getData(tok_hcalc_); - layers_ = hcons->getMaxDepth(1); - } else { - const HGCalDDDConstants* hgcons = &iSetup.getData(tok_hgcalc_); - layers_ = hgcons->layers(true); - firstLayer_ = hgcons->firstLayer(); - } + const HGCalDDDConstants* hgcons = &iSetup.getData(tok_hgcalc_); + layers_ = hgcons->layers(true); + firstLayer_ = hgcons->firstLayer(); if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << "current DQM directory: " diff --git a/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc index 2e962851ef802..63d0b3044b365 100644 --- a/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc @@ -8,9 +8,6 @@ #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/DetId/interface/DetId.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" @@ -27,11 +24,8 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "CLHEP/Units/GlobalSystemOfUnits.h" #include "TVector3.h" @@ -69,12 +63,9 @@ class HGCalRecHitValidation : public DQMEDAnalyzer { // ----------member data --------------------------- std::string nameDetector_; - edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_; edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> geometry_token_; - edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> pHRNDCToken_; edm::ESGetToken<HGCalGeometry, IdealGeometryRecord> geometry_beginRun_token_; edm::EDGetToken recHitSource_; - bool ifHCAL_; int verbosity_; unsigned int layers_; int firstLayer_; @@ -92,27 +83,19 @@ class HGCalRecHitValidation : public DQMEDAnalyzer { HGCalRecHitValidation::HGCalRecHitValidation(const edm::ParameterSet& iConfig) : nameDetector_(iConfig.getParameter<std::string>("DetectorName")), - caloGeomToken_(esConsumes<CaloGeometry, CaloGeometryRecord>()), geometry_token_(esConsumes(edm::ESInputTag("", nameDetector_))), - pHRNDCToken_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord>()), geometry_beginRun_token_(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>( edm::ESInputTag("", nameDetector_))), - ifHCAL_(iConfig.getParameter<bool>("ifHCAL")), verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)), firstLayer_(1) { auto temp = iConfig.getParameter<edm::InputTag>("RecHitSource"); if (nameDetector_ == "HGCalEESensitive" || nameDetector_ == "HGCalHESiliconSensitive" || nameDetector_ == "HGCalHEScintillatorSensitive") { recHitSource_ = consumes<HGCRecHitCollection>(temp); - } else if (nameDetector_ == "HCal") { - if (ifHCAL_) - recHitSource_ = consumes<HBHERecHitCollection>(temp); - else - recHitSource_ = consumes<HGChebRecHitCollection>(temp); } else { throw cms::Exception("BadHGCRecHitSource") << "HGCal DetectorName given as " << nameDetector_ << " must be: " - << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", " - << "\"HGCalHEScintillatorSensitive\", or \"HCal\"!"; + << "\"HGCalHESiliconSensitive\", \"HGCalHESiliconSensitive\", or " + << "\"HGCalHEScintillatorSensitive\"!"; } } @@ -120,7 +103,6 @@ void HGCalRecHitValidation::fillDescriptions(edm::ConfigurationDescriptions& des edm::ParameterSetDescription desc; desc.add<std::string>("DetectorName", "HGCalEESensitive"); desc.add<edm::InputTag>("RecHitSource", edm::InputTag("HGCalRecHit", "HGCEERecHits")); - desc.add<bool>("ifHCAL", false); desc.addUntracked<int>("Verbosity", 0); descriptions.add("hgcalRecHitValidationEE", desc); } @@ -131,82 +113,30 @@ void HGCalRecHitValidation::analyze(const edm::Event& iEvent, const edm::EventSe bool ok(true); unsigned int ntot(0), nused(0); - if (nameDetector_ == "HCal") { - edm::ESHandle<CaloGeometry> geom = iSetup.getHandle(caloGeomToken_); - if (!geom.isValid()) { - edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; - } else { - const CaloGeometry* geom0 = geom.product(); - if (ifHCAL_) { - edm::Handle<HBHERecHitCollection> hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - if (detId.subdetId() == HcalEndcap) { - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } - } else { - ok = false; - edm::LogVerbatim("HGCalValidation") << "HBHERecHitCollection " - << "Handle does not exist !!!"; - } - } else { - edm::Handle<HGChebRecHitCollection> hbhecoll; - iEvent.getByToken(recHitSource_, hbhecoll); - if (hbhecoll.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hbhecoll->size() << " element(s)"; - for (const auto& it : *(hbhecoll.product())) { - DetId detId = it.id(); - ntot++; - nused++; - int layer = HcalDetId(detId).depth(); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogVerbatim("HGCalValidation") << "HGChebRecHitCollection " - << "Handle does not exist !!!"; - } - } - } + edm::ESHandle<HGCalGeometry> geomHandle = iSetup.getHandle(geometry_token_); + if (!geomHandle.isValid()) { + edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " + << "Object for " << nameDetector_; } else { - edm::ESHandle<HGCalGeometry> geomHandle = iSetup.getHandle(geometry_token_); - if (!geomHandle.isValid()) { - edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; - } else { - const HGCalGeometry* geom0 = geomHandle.product(); - int geomType = ((geom0->topology().waferHexagon8()) ? 1 : ((geom0->topology().tileTrapezoid()) ? 2 : 0)); - - edm::Handle<HGCRecHitCollection> theRecHitContainers; - iEvent.getByToken(recHitSource_, theRecHitContainers); - if (theRecHitContainers.isValid()) { - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") - << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; - for (const auto& it : *(theRecHitContainers.product())) { - ntot++; - nused++; - DetId detId = it.id(); - int layer = ((geomType == 0) - ? HGCalDetId(detId).layer() - : ((geomType == 1) ? HGCSiliconDetId(detId).layer() : HGCScintillatorDetId(detId).layer())); - recHitValidation(detId, layer, geom0, &it); - } - } else { - ok = false; - edm::LogVerbatim("HGCalValidation") << "HGCRecHitCollection Handle " - << "does not exist !!!"; + const HGCalGeometry* geom0 = geomHandle.product(); + int geomType = ((geom0->topology().waferHexagon8()) ? 1 : ((geom0->topology().tileTrapezoid()) ? 2 : 0)); + + edm::Handle<HGCRecHitCollection> theRecHitContainers; + iEvent.getByToken(recHitSource_, theRecHitContainers); + if (theRecHitContainers.isValid()) { + if (verbosity_ > 0) + edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; + for (const auto& it : *(theRecHitContainers.product())) { + ntot++; + nused++; + DetId detId = it.id(); + int layer = ((geomType == 0) ? HGCalDetId(detId).layer() : ((geomType == 1) ? HGCSiliconDetId(detId).layer() : HGCScintillatorDetId(detId).layer())); + recHitValidation(detId, layer, geom0, &it); } + } else { + ok = false; + edm::LogVerbatim("HGCalValidation") << "HGCRecHitCollection Handle " + << "does not exist !!!"; } } if (ok) @@ -277,20 +207,15 @@ void HGCalRecHitValidation::fillHitsInfo(HitsInfo& hits) { } void HGCalRecHitValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants& hcons = iSetup.getData(pHRNDCToken_); - layers_ = hcons.getMaxDepth(1); + edm::ESHandle<HGCalGeometry> geomHandle = iSetup.getHandle(geometry_beginRun_token_); + if (!geomHandle.isValid()) { + edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " + << "Object for " << nameDetector_; } else { - edm::ESHandle<HGCalGeometry> geomHandle = iSetup.getHandle(geometry_beginRun_token_); - if (!geomHandle.isValid()) { - edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; - } else { - const HGCalGeometry* geom = geomHandle.product(); - const HGCalDDDConstants& hgcons_ = geom->topology().dddConstants(); - layers_ = hgcons_.layers(true); - firstLayer_ = hgcons_.firstLayer(); - } + const HGCalGeometry* geom = geomHandle.product(); + const HGCalDDDConstants& hgcons_ = geom->topology().dddConstants(); + layers_ = hgcons_.layers(true); + firstLayer_ = hgcons_.firstLayer(); } } diff --git a/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc b/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc index 1b53010405676..6ac1a3f162044 100644 --- a/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc +++ b/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc @@ -17,16 +17,15 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" class HGCalRecHitsClient : public DQMEDHarvester { private: //member data - std::string nameDetector_; - int verbosity_; + const std::string nameDetector_; + const int verbosity_; + const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> ddc_token_; unsigned int layers_; public: @@ -37,25 +36,17 @@ class HGCalRecHitsClient : public DQMEDHarvester { void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override; virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig); - int recHitsEndjob(const std::vector<MonitorElement *> &hcalMEs); + int recHitsEndjob(const std::vector<MonitorElement *> &hgcalMEs); }; HGCalRecHitsClient::HGCalRecHitsClient(const edm::ParameterSet &iConfig) : nameDetector_(iConfig.getParameter<std::string>("DetectorName")), - verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)) {} + verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)), + ddc_token_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_})) {} void HGCalRecHitsClient::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) { - if (nameDetector_ == "HCal") { - edm::ESHandle<HcalDDDRecConstants> pHRNDC; - iSetup.get<HcalRecNumberingRecord>().get(pHRNDC); - const HcalDDDRecConstants *hcons = &(*pHRNDC); - layers_ = hcons->getMaxDepth(1); - } else { - edm::ESHandle<HGCalDDDConstants> pHGDC; - iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC); - const HGCalDDDConstants &hgcons_ = (*pHGDC); - layers_ = hgcons_.layers(true); - } + const HGCalDDDConstants& hgcons_ = iSetup.getData(ddc_token_); + layers_ = hgcons_.layers(true); } void HGCalRecHitsClient::dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) { runClient_(ib, ig); } diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc b/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc index 229bc5f7df33a..76f271edde6d0 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc @@ -13,7 +13,6 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" @@ -25,11 +24,8 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" @@ -74,11 +70,8 @@ class HGCalSimHitStudy : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::o const double etamin_, etamax_; const int nbinR_, nbinZ_, nbinEta_, nLayers_, verbosity_; const bool ifNose_, ifLayer_; - edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hrndc_; std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> > tok_hgcGeom_; std::vector<const HGCalDDDConstants*> hgcons_; - const HcalDDDRecConstants* hcons_; - std::vector<bool> heRebuild_; std::vector<edm::EDGetTokenT<edm::PCaloHitContainer> > tok_hits_; std::vector<int> layers_, layerFront_; @@ -106,21 +99,10 @@ HGCalSimHitStudy::HGCalSimHitStudy(const edm::ParameterSet& iConfig) ifLayer_(iConfig.getUntrackedParameter<bool>("ifLayer", false)) { usesResource(TFileService::kSharedResource); - for (auto const& name : nameDetectors_) { - if (name == "HCal") { - heRebuild_.emplace_back(true); - tok_hrndc_ = esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(); - tok_hgcGeom_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( - edm::ESInputTag{"", "HGCalHEScintillatorSensitive"})); - } else { - heRebuild_.emplace_back(false); - tok_hgcGeom_.emplace_back( - esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); - } - } - for (auto const& source : caloHitSources_) { + for (auto const& name : nameDetectors_) + tok_hgcGeom_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + for (auto const& source : caloHitSources_) tok_hits_.emplace_back(consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", source))); - } } void HGCalSimHitStudy::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -154,20 +136,7 @@ void HGCalSimHitStudy::analyze(const edm::Event& iEvent, const edm::EventSetup& if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << " PcalohitItr = " << theCaloHitContainers->size(); std::vector<PCaloHit> caloHits; - if (heRebuild_[k]) { - for (auto const& hit : *(theCaloHitContainers.product())) { - unsigned int id = hit.id(); - HcalDetId hid = HcalHitRelabeller::relabel(id, hcons_); - if (hid.subdet() != static_cast<int>(HcalEndcap)) { - caloHits.emplace_back(hit); - caloHits.back().setID(hid.rawId()); - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << "Hit[" << caloHits.size() << "] " << hid; - } - } - } else { - caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); - } + caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); analyzeHits(k, nameDetectors_[k], caloHits); } else if (verbosity_ > 0) { edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not " @@ -191,73 +160,53 @@ void HGCalSimHitStudy::analyzeHits(int ih, std::string const& name, std::vector< int cell, sector, sector2(0), layer, zside; int subdet(0), cell2(0), type(0); HepGeom::Point3D<float> gcoord; - if (heRebuild_[ih]) { - HcalDetId detId = HcalDetId(id); - subdet = detId.subdet(); - cell = detId.ietaAbs(); - sector = detId.iphi(); - layer = detId.depth(); + std::pair<float, float> xy; + if (ifNose_) { + HFNoseDetId detId = HFNoseDetId(id); + subdet = detId.subdetId(); + cell = detId.cellU(); + cell2 = detId.cellV(); + sector = detId.waferU(); + sector2 = detId.waferV(); + type = detId.type(); + layer = detId.layer(); zside = detId.zside(); - std::pair<double, double> etaphi = hcons_->getEtaPhi(subdet, zside * cell, sector); - double rz = hcons_->getRZ(subdet, zside * cell, layer); - if (verbosity_ > 2) - edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":" << zside << ":" << cell << ":" << sector << ":" - << layer << " o/p " << etaphi.first << ":" << etaphi.second << ":" << rz; - gcoord = HepGeom::Point3D<float>(rz * cos(etaphi.second) / cosh(etaphi.first), - rz * sin(etaphi.second) / cosh(etaphi.first), - rz * tanh(etaphi.first)); + xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); + h_W2_[ih]->Fill(sector2); + h_C2_[ih]->Fill(cell2); + } else if (hgcons_[ih]->waferHexagon8()) { + HGCSiliconDetId detId = HGCSiliconDetId(id); + subdet = static_cast<int>(detId.det()); + cell = detId.cellU(); + cell2 = detId.cellV(); + sector = detId.waferU(); + sector2 = detId.waferV(); + type = detId.type(); + layer = detId.layer(); + zside = detId.zside(); + xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); + h_W2_[ih]->Fill(sector2); + h_C2_[ih]->Fill(cell2); + } else if (hgcons_[ih]->tileTrapezoid()) { + HGCScintillatorDetId detId = HGCScintillatorDetId(id); + subdet = static_cast<int>(detId.det()); + sector = detId.ieta(); + cell = detId.iphi(); + type = detId.type(); + layer = detId.layer(); + zside = detId.zside(); + xy = hgcons_[ih]->locateCellTrap(layer, sector, cell, false); } else { - std::pair<float, float> xy; - if (ifNose_) { - HFNoseDetId detId = HFNoseDetId(id); - subdet = detId.subdetId(); - cell = detId.cellU(); - cell2 = detId.cellV(); - sector = detId.waferU(); - sector2 = detId.waferV(); - type = detId.type(); - layer = detId.layer(); - zside = detId.zside(); - xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); - h_W2_[ih]->Fill(sector2); - h_C2_[ih]->Fill(cell2); - - } else if (hgcons_[ih]->waferHexagon8()) { - HGCSiliconDetId detId = HGCSiliconDetId(id); - subdet = static_cast<int>(detId.det()); - cell = detId.cellU(); - cell2 = detId.cellV(); - sector = detId.waferU(); - sector2 = detId.waferV(); - type = detId.type(); - layer = detId.layer(); - zside = detId.zside(); - xy = hgcons_[ih]->locateCell(layer, sector, sector2, cell, cell2, false, true); - h_W2_[ih]->Fill(sector2); - h_C2_[ih]->Fill(cell2); - } else if (hgcons_[ih]->tileTrapezoid()) { - HGCScintillatorDetId detId = HGCScintillatorDetId(id); - subdet = static_cast<int>(detId.det()); - sector = detId.ieta(); - cell = detId.iphi(); - type = detId.type(); - layer = detId.layer(); - zside = detId.zside(); - xy = hgcons_[ih]->locateCellTrap(layer, sector, cell, false); - } else { - HGCalTestNumbering::unpackHexagonIndex(id, subdet, zside, layer, sector, type, cell); - xy = hgcons_[ih]->locateCell(cell, layer, sector, false); - } - double zp = hgcons_[ih]->waferZ(layer, false); - if (zside < 0) - zp = -zp; - double xp = (zp < 0) ? -xy.first : xy.first; - gcoord = HepGeom::Point3D<float>(xp, xy.second, zp); - if (verbosity_ > 2) - edm::LogVerbatim("HGCalValidation") - << "i/p " << subdet << ":" << zside << ":" << layer << ":" << sector << ":" << sector2 << ":" << cell << ":" - << cell2 << " o/p " << xy.first << ":" << xy.second << ":" << zp; + HGCalTestNumbering::unpackHexagonIndex(id, subdet, zside, layer, sector, type, cell); + xy = hgcons_[ih]->locateCell(cell, layer, sector, false); } + double zp = hgcons_[ih]->waferZ(layer, false); + if (zside < 0) + zp = -zp; + double xp = (zp < 0) ? -xy.first : xy.first; + gcoord = HepGeom::Point3D<float>(xp, xy.second, zp); + if (verbosity_ > 2) + edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":" << zside << ":" << layer << ":" << sector << ":" << sector2 << ":" << cell << ":" << cell2 << " o/p " << xy.first << ":" << xy.second << ":" << zp; nused++; double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light; if (verbosity_ > 1) @@ -329,19 +278,9 @@ void HGCalSimHitStudy::analyzeHits(int ih, std::string const& name, std::vector< // ------------ method called when starting to processes a run ------------ void HGCalSimHitStudy::beginRun(const edm::Run&, const edm::EventSetup& iSetup) { for (unsigned int k = 0; k < nameDetectors_.size(); ++k) { - if (heRebuild_[k]) { - hcons_ = &iSetup.getData(tok_hrndc_); - layers_.emplace_back(hcons_->getMaxDepth(1)); - hgcons_.emplace_back(nullptr); - layerFront_.emplace_back(40); - } else { - hgcons_.emplace_back(&iSetup.getData(tok_hgcGeom_[k])); - layers_.emplace_back(hgcons_.back()->layers(false)); - if (k == 0) - layerFront_.emplace_back(0); - else - layerFront_.emplace_back(28); - } + hgcons_.emplace_back(&iSetup.getData(tok_hgcGeom_[k])); + layers_.emplace_back(hgcons_.back()->layers(false)); + layerFront_.emplace_back(hgcons_.back()->firstLayer()); if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << nameDetectors_[k] << " defined with " << layers_.back() << " Layers with " << layerFront_.back() << " in front"; @@ -460,7 +399,7 @@ void HGCalSimHitStudy::beginJob() { name << "LY_" << nameDetectors_[ih]; title << "Layer number for " << nameDetectors_[ih]; h_Ly_.emplace_back(fs->make<TH1D>(name.str().c_str(), title.str().c_str(), 200, 0, 100)); - if ((nameDetectors_[ih] == "HGCalHEScintillatorSensitive") || heRebuild_[ih]) { + if (nameDetectors_[ih] == "HGCalHEScintillatorSensitive") { name.str(""); title.str(""); name << "IR_" << nameDetectors_[ih]; diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc index 22fd33818b5ec..a121f956a8575 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc @@ -10,7 +10,6 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/ForwardDetId/interface/HGCSiliconDetId.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" #include "DetectorDescription/Core/interface/DDCompactView.h" #include "DetectorDescription/Core/interface/DDSpecifics.h" @@ -33,12 +32,9 @@ #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" @@ -91,17 +87,15 @@ class HGCalSimHitValidation : public DQMEDAnalyzer { // ----------member data --------------------------- const std::string nameDetector_, caloHitSource_; const HGCalDDDConstants* hgcons_; - const HcalDDDRecConstants* hcons_; const std::vector<double> times_; const int verbosity_; - const bool testNumber_, fromDDD_; - const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcal_; + const bool fromDDD_; const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> tok_hgcal_; const edm::ESGetToken<DDCompactView, IdealGeometryRecord> tok_cpv_; const edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> tok_cpvc_; edm::EDGetTokenT<edm::PCaloHitContainer> tok_hits_; edm::EDGetTokenT<edm::HepMCProduct> tok_hepMC_; - bool heRebuild_, symmDet_; + bool symmDet_; unsigned int layers_; int firstLayer_; std::map<uint32_t, HepGeom::Transform3D> transMap_; @@ -119,16 +113,13 @@ HGCalSimHitValidation::HGCalSimHitValidation(const edm::ParameterSet& iConfig) caloHitSource_(iConfig.getParameter<std::string>("CaloHitSource")), times_(iConfig.getParameter<std::vector<double> >("TimeSlices")), verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)), - testNumber_(iConfig.getUntrackedParameter<bool>("TestNumber", true)), fromDDD_(iConfig.getUntrackedParameter<bool>("fromDDD", true)), - tok_hcal_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{})), tok_hgcal_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( edm::ESInputTag{"", nameDetector_})), tok_cpv_(esConsumes<DDCompactView, IdealGeometryRecord, edm::Transition::BeginRun>()), tok_cpvc_(esConsumes<cms::DDCompactView, IdealGeometryRecord, edm::Transition::BeginRun>()), symmDet_(true), firstLayer_(1) { - heRebuild_ = (nameDetector_ == "HCal") ? true : false; tok_hepMC_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared")); tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", caloHitSource_)); nTimes_ = (times_.size() > maxTime_) ? maxTime_ : times_.size(); @@ -172,17 +163,6 @@ void HGCalSimHitValidation::analyze(const edm::Event& iEvent, const edm::EventSe edm::LogVerbatim("HGCalValidation") << " PcalohitItr = " << theCaloHitContainers->size(); std::vector<PCaloHit> caloHits; caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end()); - if (heRebuild_ && testNumber_) { - for (unsigned int i = 0; i < caloHits.size(); ++i) { - unsigned int id_ = caloHits[i].id(); - HcalDetId hid = HcalHitRelabeller::relabel(id_, hcons_); - if (hid.subdet() != int(HcalEndcap)) - hid = HcalDetId(HcalEmpty, hid.ieta(), hid.iphi(), hid.depth()); - caloHits[i].setID(hid.rawId()); - if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << "Hit[" << i << "] " << hid; - } - } analyzeHits(caloHits); } else if (verbosity_ > 0) { edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not exist!"; @@ -206,17 +186,7 @@ void HGCalSimHitValidation::analyzeHits(std::vector<PCaloHit>& hits) { uint32_t id_ = hits[i].id(); int cell, sector, subsector(0), layer, zside; int subdet(0), cell2(0), type(0); - if (heRebuild_) { - HcalDetId detId = HcalDetId(id_); - subdet = detId.subdet(); - if (subdet != static_cast<int>(HcalEndcap)) - continue; - cell = detId.ietaAbs(); - sector = detId.iphi(); - subsector = 1; - layer = detId.depth(); - zside = detId.zside(); - } else if (hgcons_->waferHexagon8()) { + if (hgcons_->waferHexagon8()) { HGCSiliconDetId detId = HGCSiliconDetId(id_); subdet = ForwardEmpty; cell = detId.cellU(); @@ -226,8 +196,6 @@ void HGCalSimHitValidation::analyzeHits(std::vector<PCaloHit>& hits) { type = detId.type(); layer = detId.layer(); zside = detId.zside(); - } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) { - HGCalTestNumbering::unpackSquareIndex(id_, zside, layer, sector, subsector, cell); } else if (hgcons_->tileTrapezoid()) { HGCScintillatorDetId detId = HGCScintillatorDetId(id_); subdet = ForwardEmpty; @@ -248,36 +216,19 @@ void HGCalSimHitValidation::analyzeHits(std::vector<PCaloHit>& hits) { << " energyem = " << hits[i].energyEM() << " energyhad = " << hits[i].energyHad() << " time = " << time; HepGeom::Point3D<float> gcoord; - if (heRebuild_) { - std::pair<double, double> etaphi = hcons_->getEtaPhi(subdet, zside * cell, sector); - double rz = hcons_->getRZ(subdet, zside * cell, layer); - if (verbosity_ > 2) - edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":" << zside << ":" << cell << ":" << sector << ":" - << layer << " o/p " << etaphi.first << ":" << etaphi.second << ":" << rz; - gcoord = HepGeom::Point3D<float>(rz * cos(etaphi.second) / cosh(etaphi.first), - rz * sin(etaphi.second) / cosh(etaphi.first), - rz * tanh(etaphi.first)); - } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) { - std::pair<float, float> xy = hgcons_->locateCell(cell, layer, subsector, false); - const HepGeom::Point3D<float> lcoord(xy.first, xy.second, 0); - int subs = (symmDet_ ? 0 : subsector); - id_ = HGCalTestNumbering::packSquareIndex(zside, layer, sector, subs, 0); - gcoord = (transMap_[id_] * lcoord); + std::pair<float, float> xy; + if (hgcons_->waferHexagon8()) { + xy = hgcons_->locateCell(layer, sector, subsector, cell, cell2, false, true); + } else if (hgcons_->tileTrapezoid()) { + xy = hgcons_->locateCellTrap(layer, sector, cell, false); } else { - std::pair<float, float> xy; - if (hgcons_->waferHexagon8()) { - xy = hgcons_->locateCell(layer, sector, subsector, cell, cell2, false, true); - } else if (hgcons_->tileTrapezoid()) { - xy = hgcons_->locateCellTrap(layer, sector, cell, false); - } else { - xy = hgcons_->locateCell(cell, layer, sector, false); - } - double zp = hgcons_->waferZ(layer, false); - if (zside < 0) - zp = -zp; - float xp = (zp < 0) ? -xy.first : xy.first; - gcoord = HepGeom::Point3D<float>(xp, xy.second, zp); + xy = hgcons_->locateCell(cell, layer, sector, false); } + double zp = hgcons_->waferZ(layer, false); + if (zside < 0) + zp = -zp; + float xp = (zp < 0) ? -xy.first : xy.first; + gcoord = HepGeom::Point3D<float>(xp, xy.second, zp); double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light; if (verbosity_ > 1) edm::LogVerbatim("HGCalValidation") @@ -466,20 +417,15 @@ bool HGCalSimHitValidation::defineGeometry(const cms::DDCompactView* ddViewH) { // ------------ method called when starting to processes a run ------------ void HGCalSimHitValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup& iSetup) { - if (heRebuild_) { - hcons_ = &iSetup.getData(tok_hcal_); - layers_ = hcons_->getMaxDepth(1); + hgcons_ = &iSetup.getData(tok_hgcal_); + layers_ = hgcons_->layers(false); + firstLayer_ = hgcons_->firstLayer(); + if (fromDDD_) { + const DDCompactView* pDD = &iSetup.getData(tok_cpv_); + defineGeometry(pDD); } else { - hgcons_ = &iSetup.getData(tok_hgcal_); - layers_ = hgcons_->layers(false); - firstLayer_ = hgcons_->firstLayer(); - if (fromDDD_) { - const DDCompactView* pDD = &iSetup.getData(tok_cpv_); - defineGeometry(pDD); - } else { - const cms::DDCompactView* pDD = &iSetup.getData(tok_cpvc_); - defineGeometry(pDD); - } + const cms::DDCompactView* pDD = &iSetup.getData(tok_cpvc_); + defineGeometry(pDD); } if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with " << layers_ << " Layers with first at " diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc b/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc index 4d2432c1ad775..1c835f929030d 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitsClient.cc @@ -18,9 +18,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" class HGCalSimHitsClient : public DQMEDHarvester { @@ -28,7 +26,6 @@ class HGCalSimHitsClient : public DQMEDHarvester { //member data const std::string nameDetector_; const int nTimes_, verbosity_; - const edm::ESGetToken<HcalDDDRecConstants, HcalRecNumberingRecord> tok_hcal_; const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> tok_hgcal_; unsigned int layers_; @@ -39,25 +36,19 @@ class HGCalSimHitsClient : public DQMEDHarvester { void beginRun(const edm::Run &run, const edm::EventSetup &c) override; void dqmEndJob(DQMStore::IBooker &ib, DQMStore::IGetter &ig) override; virtual void runClient_(DQMStore::IBooker &ib, DQMStore::IGetter &ig); - int simHitsEndjob(const std::vector<MonitorElement *> &hcalMEs); + int simHitsEndjob(const std::vector<MonitorElement *> &hgcalMEs); }; HGCalSimHitsClient::HGCalSimHitsClient(const edm::ParameterSet &iConfig) : nameDetector_(iConfig.getParameter<std::string>("DetectorName")), nTimes_(iConfig.getParameter<int>("TimeSlices")), verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)), - tok_hcal_(esConsumes<HcalDDDRecConstants, HcalRecNumberingRecord, edm::Transition::BeginRun>(edm::ESInputTag{})), tok_hgcal_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( edm::ESInputTag{"", nameDetector_})) {} void HGCalSimHitsClient::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) { - if (nameDetector_ == "HCal") { - const HcalDDDRecConstants *hcons = &iSetup.getData(tok_hcal_); - layers_ = hcons->getMaxDepth(1); - } else { - const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); - layers_ = hgcons->layers(true); - } + const HGCalDDDConstants *hgcons = &iSetup.getData(tok_hgcal_); + layers_ = hgcons->layers(true); if (verbosity_ > 0) edm::LogVerbatim("HGCalValidation") << "Initialize HGCalSimHitsClient for " << nameDetector_ << " : " << layers_; } From 2b5f12a0ab60bd253dd14ff576cb5e2b10e92643 Mon Sep 17 00:00:00 2001 From: Victor <vshang@wisc.edu> Date: Wed, 4 Nov 2020 06:16:42 -0600 Subject: [PATCH 124/309] Added Phase2Jet code to L1Trigger and minimum necessary files to test. Compiles correctly but still need to test that code is working (cherry picked from commit 6e20d4181667915bf7c8170e8b9238b72db01047) --- .../plugins/L1CaloJetHTTProducer.cc | 141 ++ .../plugins/L1CaloJetProducer.cc | 1508 +++++++++++++++++ .../plugins/L1TowerCalibrator.cc | 584 +++++++ .../python/L1CaloJetHTTProducer_cfi.py | 10 + .../python/L1CaloJetProducer_cfi.py | 164 ++ .../python/test_L1CaloJets_cfg.py | 100 ++ .../python/L1TrackletTracks_cff.py | 13 + 7 files changed, 2520 insertions(+) create mode 100644 L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc create mode 100644 L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc create mode 100644 L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc create mode 100644 L1Trigger/L1CaloTrigger/python/L1CaloJetHTTProducer_cfi.py create mode 100644 L1Trigger/L1CaloTrigger/python/L1CaloJetProducer_cfi.py create mode 100644 L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py create mode 100644 L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc new file mode 100644 index 0000000000000..feae97457b151 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc @@ -0,0 +1,141 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: L1CaloJetHTTProducer +// +/**\class L1CaloJetHTTProducer L1CaloJetHTTProducer.cc + +Description: +Use the L1CaloJetProducer collections to calculate +HTT energy sum for CaloJets + +Implementation: +[Notes on implementation] +*/ +// +// Original Author: Tyler Ruggles +// Created: Fri Mar 22 2019 +// $Id$ +// +// + + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include <iostream> + +// Run2/PhaseI output formats +#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" +#include "DataFormats/L1Trigger/interface/Jet.h" +// GenJets if needed +#include "DataFormats/JetReco/interface/GenJet.h" +#include "DataFormats/JetReco/interface/GenJetCollection.h" + + +class L1CaloJetHTTProducer : public edm::EDProducer { + public: + explicit L1CaloJetHTTProducer(const edm::ParameterSet&); + + private: + virtual void produce(edm::Event&, const edm::EventSetup&); + + double EtaMax; + double PtMin; + + edm::EDGetTokenT<BXVector<l1t::Jet>> bxvCaloJetsToken_; + edm::Handle<BXVector<l1t::Jet>> bxvCaloJetsHandle; + + // Gen jet collections are only loaded and used if requested + // (use_gen_jets == true) + edm::EDGetTokenT<std::vector<reco::GenJet>> genJetsToken_; + edm::Handle<std::vector<reco::GenJet>> genJetsHandle; + + bool debug; + + bool use_gen_jets; + +}; + +L1CaloJetHTTProducer::L1CaloJetHTTProducer(const edm::ParameterSet& iConfig) : + EtaMax(iConfig.getParameter<double>("EtaMax")), + PtMin(iConfig.getParameter<double>("PtMin")), + bxvCaloJetsToken_(consumes<BXVector<l1t::Jet>>(iConfig.getParameter<edm::InputTag>("BXVCaloJetsInputTag"))), + genJetsToken_(consumes<std::vector<reco::GenJet>>(iConfig.getParameter<edm::InputTag>("genJets"))), + debug(iConfig.getParameter<bool>("debug")), + use_gen_jets(iConfig.getParameter<bool>("use_gen_jets")) + +{ + + + produces< float >("CaloJetHTT"); + + +} + +void L1CaloJetHTTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + + + // Output collections + std::unique_ptr< float > CaloJetHTT(new float); + + *CaloJetHTT = 0.; + + + // CaloJet HTT for L1 collections + if (!use_gen_jets) + { + iEvent.getByToken(bxvCaloJetsToken_,bxvCaloJetsHandle); + + + if (bxvCaloJetsHandle.isValid()) + { + for(const auto& caloJet : *bxvCaloJetsHandle.product()) + { + if (caloJet.pt() < PtMin) continue; + if ( fabs(caloJet.eta()) > EtaMax) continue; + *CaloJetHTT += float(caloJet.pt()); + } + } + + if (debug) + { + printf("BXV L1CaloJetCollection JetHTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); + } + } + + // CaloJet HTT for gen jets + if (use_gen_jets) + { + iEvent.getByToken(genJetsToken_,genJetsHandle); + + + if (genJetsHandle.isValid()) + { + for(const auto& genJet : *genJetsHandle.product()) + { + if (genJet.pt() < PtMin) continue; + if ( fabs(genJet.eta()) > EtaMax) continue; + *CaloJetHTT += float(genJet.pt()); + } + } + + if (debug) + { + printf("Gen Jets HTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); + } + } + + + iEvent.put(std::move(CaloJetHTT),"CaloJetHTT"); + +} + + + +DEFINE_FWK_MODULE(L1CaloJetHTTProducer); diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc new file mode 100644 index 0000000000000..0d03761def06e --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc @@ -0,0 +1,1508 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: L1CaloJetProducer +// +/**\class L1CaloJetProducer L1CaloJetProducer.cc + +Description: +Beginning with HCAL TPs, create HCAL jet, then +take L1EG crystal clusters from L1EGammaCrystalsProducer.cc +and clusters them within fixed number of trigger towers + +Implementation: +[Notes on implementation] +*/ +// +// Original Author: Tyler Ruggles +// Created: Tue Aug 29 2018 +// $Id$ +// +// + + +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Math/interface/deltaPhi.h" + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include <iostream> + +#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h" +//#include "DataFormats/L1TCalorimeterPhase2/interface/CaloCrystalCluster.h" +#include "DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h" +#include "DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h" +#include "DataFormats/L1THGCal/interface/HGCalTower.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" + +#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" + +#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h" + +// For pT calibrations +#include "TF1.h" + +// Run2/PhaseI output formats +#include "DataFormats/L1Trigger/interface/Tau.h" +#include "DataFormats/L1Trigger/interface/Jet.h" + + +class L1CaloJetProducer : public edm::EDProducer { + public: + explicit L1CaloJetProducer(const edm::ParameterSet&); + + private: + virtual void produce(edm::Event&, const edm::EventSetup&); + //bool cluster_passes_base_cuts(float &cluster_pt, float &cluster_eta, float &iso, float &e2x5, float &e5x5) const; + int ecalXtal_diPhi( int &iPhi_1, int &iPhi_2 ) const; + int tower_diPhi( int &iPhi_1, int &iPhi_2 ) const; + int tower_diEta( int &iEta_1, int &iEta_2 ) const; + float get_deltaR( reco::Candidate::PolarLorentzVector &p4_1, + reco::Candidate::PolarLorentzVector &p4_2) const; + float get_hcal_calibration( float &jet_pt, float &ecal_pt, + float &ecal_L1EG_jet_pt, float &jet_eta ) const; + float get_tau_pt_calibration( float &tau_pt, float &ecal_pt, + float &l1EG_pt, float &n_L1EGs, float &tau_eta ) const; + int loose_iso_tau_wp( float &tau_pt, float &tau_iso_et, float &tau_eta ) const; + + double HcalTpEtMin; + double EcalTpEtMin; + double HGCalHadTpEtMin; + double HGCalEmTpEtMin; + double HFTpEtMin; + double EtMinForSeedHit; + double EtMinForCollection; + double EtMinForTauCollection; + + // For fetching jet calibrations + std::vector< double > jetPtBins; + std::vector< double > emFractionBinsBarrel; + std::vector< double > absEtaBinsBarrel; + std::vector< double > jetCalibrationsBarrel; + std::vector< double > emFractionBinsHGCal; + std::vector< double > absEtaBinsHGCal; + std::vector< double > jetCalibrationsHGCal; + std::vector< double > emFractionBinsHF; + std::vector< double > absEtaBinsHF; + std::vector< double > jetCalibrationsHF; + + // For fetching tau calibrations + std::vector< double > tauPtBins; + std::vector< double > tauAbsEtaBinsBarrel; + std::vector< double > tauCalibrationsBarrel; + std::vector< edm::ParameterSet > tauL1egInfoBarrel; + std::vector< double > tauAbsEtaBinsHGCal; + std::vector< double > tauCalibrationsHGCal; + std::vector< edm::ParameterSet > tauL1egInfoHGCal; + + // For storing jet calibrations + std::vector< std::vector< std::vector< double >>> calibrationsBarrel; + std::vector< std::vector< std::vector< double >>> calibrationsHGCal; + std::vector< std::vector< std::vector< double >>> calibrationsHF; + + // For storing tau calibration info + std::map< double, std::vector< double >> tauL1egInfoMapBarrel; + std::map< double, std::vector< double >> tauL1egInfoMapHGCal; + std::vector< double > tauL1egValuesBarrel; // To preserve ordering + std::vector< double > tauL1egValuesHGCal; // To preserve ordering + std::vector< std::vector< std::vector< std::vector< double >>>> tauPtCalibrationsBarrel; + std::vector< std::vector< std::vector< std::vector< double >>>> tauPtCalibrationsHGCal; + + bool debug; + edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowerToken_; + edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle; + + + + // TF1s defining tau isolation thresholds + TF1 isoTauBarrel = TF1( "isoTauBarrelFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); + TF1 isoTauHGCal = TF1( "isoTauHGCalFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); + + + class l1CaloJetObj + { + public: + bool barrelSeeded = true; // default to barrel seeded + reco::Candidate::PolarLorentzVector jetCluster; + reco::Candidate::PolarLorentzVector hcalJetCluster; + reco::Candidate::PolarLorentzVector ecalJetCluster; + reco::Candidate::PolarLorentzVector seedTower; + //reco::Candidate::PolarLorentzVector leadingL1EG; + reco::Candidate::PolarLorentzVector l1egJetCluster; + float jetClusterET = 0.; + float hcalJetClusterET = 0.; + float ecalJetClusterET = 0.; + float seedTowerET = 0.; + float leadingL1EGET = 0.; + float l1egJetClusterET = 0.; + + // For decay mode related checks with CaloTaus + std::vector< std::vector< float > > associated_l1EGs_; + + int seed_iEta = -99; + int seed_iPhi = -99; + + float hcal_seed = 0.; + //float hcal_3x3 = 0.; + float hcal_3x5 = 0.; + //float hcal_5x5 = 0.; + //float hcal_5x7 = 0.; + float hcal_7x7 = 0.; + //float hcal_2x3 = 0.; + //float hcal_2x3_1 = 0.; + //float hcal_2x3_2 = 0.; + //float hcal_2x2 = 0.; + //float hcal_2x2_1 = 0.; + //float hcal_2x2_2 = 0.; + //float hcal_2x2_3 = 0.; + //float hcal_2x2_4 = 0.; + float hcal_nHits = 0.; + + float ecal_seed = 0.; + //float ecal_3x3 = 0.; + float ecal_3x5 = 0.; + //float ecal_5x5 = 0.; + //float ecal_5x7 = 0.; + float ecal_7x7 = 0.; + //float ecal_2x3 = 0.; + //float ecal_2x3_1 = 0.; + //float ecal_2x3_2 = 0.; + //float ecal_2x2 = 0.; + //float ecal_2x2_1 = 0.; + //float ecal_2x2_2 = 0.; + //float ecal_2x2_3 = 0.; + //float ecal_2x2_4 = 0.; + float ecal_nHits = 0.; + + float l1eg_seed = 0.; + //float l1eg_3x3 = 0.; + float l1eg_3x5 = 0.; + //float l1eg_5x5 = 0.; + //float l1eg_5x7 = 0.; + float l1eg_7x7 = 0.; + //float l1eg_2x3 = 0.; + //float l1eg_2x3_1 = 0.; + //float l1eg_2x3_2 = 0.; + //float l1eg_2x2 = 0.; + //float l1eg_2x2_1 = 0.; + //float l1eg_2x2_2 = 0.; + //float l1eg_2x2_3 = 0.; + //float l1eg_2x2_4 = 0.; + float l1eg_nHits = 0.; + float n_l1eg_HoverE_LessThreshold = 0.; + + float l1eg_nL1EGs = 0.; + float l1eg_nL1EGs_standaloneSS = 0.; + float l1eg_nL1EGs_standaloneIso = 0.; + float l1eg_nL1EGs_trkMatchSS = 0.; + float l1eg_nL1EGs_trkMatchIso = 0.; + + float total_seed = 0.; + //float total_3x3 = 0.; + float total_3x5 = 0.; + //float total_5x5 = 0.; + //float total_5x7 = 0.; + float total_7x7 = 0.; + //float total_2x3 = 0.; + //float total_2x3_1 = 0.; + //float total_2x3_2 = 0.; + //float total_2x2 = 0.; + //float total_2x2_1 = 0.; + //float total_2x2_2 = 0.; + //float total_2x2_3 = 0.; + //float total_2x2_4 = 0.; + float total_nHits = 0.; + + void Init() + { + SetJetClusterP4( 0., 0., 0., 0. ); + SetHcalJetClusterP4( 0., 0., 0., 0. ); + SetEcalJetClusterP4( 0., 0., 0., 0. ); + SetSeedP4( 0., 0., 0., 0. ); + //SetLeadingL1EGP4( 0., 0., 0., 0. ); + SetL1EGJetP4( 0., 0., 0., 0. ); + } + + void SetJetClusterP4( double pt, double eta, double phi, double mass ) + { + this->jetCluster.SetPt( pt ); + this->jetCluster.SetEta( eta ); + this->jetCluster.SetPhi( phi ); + this->jetCluster.SetM( mass ); + } + void SetHcalJetClusterP4( double pt, double eta, double phi, double mass ) + { + this->hcalJetCluster.SetPt( pt ); + this->hcalJetCluster.SetEta( eta ); + this->hcalJetCluster.SetPhi( phi ); + this->hcalJetCluster.SetM( mass ); + } + void SetEcalJetClusterP4( double pt, double eta, double phi, double mass ) + { + this->ecalJetCluster.SetPt( pt ); + this->ecalJetCluster.SetEta( eta ); + this->ecalJetCluster.SetPhi( phi ); + this->ecalJetCluster.SetM( mass ); + } + void SetSeedP4( double pt, double eta, double phi, double mass ) + { + this->seedTower.SetPt( pt ); + this->seedTower.SetEta( eta ); + this->seedTower.SetPhi( phi ); + this->seedTower.SetM( mass ); + } + //void SetLeadingL1EGP4( double pt, double eta, double phi, double mass ) + //{ + // this->leadingL1EG.SetPt( pt ); + // this->leadingL1EG.SetEta( eta ); + // this->leadingL1EG.SetPhi( phi ); + // this->leadingL1EG.SetM( mass ); + //} + void SetL1EGJetP4( double pt, double eta, double phi, double mass ) + { + this->l1egJetCluster.SetPt( pt ); + this->l1egJetCluster.SetEta( eta ); + this->l1egJetCluster.SetPhi( phi ); + this->l1egJetCluster.SetM( mass ); + } + }; + + + + + + class simpleL1obj + { + public: + bool stale = false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters + bool associated_with_tower = false; // L1EGs become associated with a tower to find highest ET total for seeding jets + bool passesStandaloneSS = false; // Store whether any of the portions of a WP are passed + bool passesStandaloneIso = false; // Store whether any of the portions of a WP are passed + bool passesTrkMatchSS = false; // Store whether any of the portions of a WP are passed + bool passesTrkMatchIso = false; // Store whether any of the portions of a WP are passed + reco::Candidate::PolarLorentzVector p4; + + void SetP4( double pt, double eta, double phi, double mass ) + { + this->p4.SetPt( pt ); + this->p4.SetEta( eta ); + this->p4.SetPhi( phi ); + this->p4.SetM( mass ); + } + inline float pt() const{return p4.pt();}; + inline float eta() const{return p4.eta();}; + inline float phi() const{return p4.phi();}; + inline float M() const{return p4.M();}; + inline reco::Candidate::PolarLorentzVector GetP4() const{return p4;}; + }; + + + + class SimpleCaloHit + { + public: + int towerIEta = -99; + int towerIPhi = -99; + float towerEta = -99; + float towerPhi = -99; + float ecalTowerEt=0.; + float hcalTowerEt=0.; + float l1egTowerEt=0.; + float total_tower_et=0.; + //float total_tower_plus_L1EGs_et=0.; + bool stale=false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters + bool isBarrel=true; // Defaults to a barrel hit + + // L1EG info + int nL1eg = 0; + int l1egTrkSS = 0; + int l1egTrkIso = 0; + int l1egStandaloneSS = 0; + int l1egStandaloneIso = 0; + }; +}; + +L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet& iConfig) : + HcalTpEtMin(iConfig.getParameter<double>("HcalTpEtMin")), // Should default to 0 MeV + EcalTpEtMin(iConfig.getParameter<double>("EcalTpEtMin")), // Should default to 0 MeV + HGCalHadTpEtMin(iConfig.getParameter<double>("HGCalHadTpEtMin")), // Should default to 0 MeV + HGCalEmTpEtMin(iConfig.getParameter<double>("HGCalEmTpEtMin")), // Should default to 0 MeV + HFTpEtMin(iConfig.getParameter<double>("HFTpEtMin")), // Should default to 0 MeV + EtMinForSeedHit(iConfig.getParameter<double>("EtMinForSeedHit")), // Should default to 2.5 GeV + EtMinForCollection(iConfig.getParameter<double>("EtMinForCollection")), // Testing 10 GeV + EtMinForTauCollection(iConfig.getParameter<double>("EtMinForTauCollection")), // Testing 10 GeV + jetPtBins(iConfig.getParameter<std::vector<double>>("jetPtBins")), + emFractionBinsBarrel(iConfig.getParameter<std::vector<double>>("emFractionBinsBarrel")), + absEtaBinsBarrel(iConfig.getParameter<std::vector<double>>("absEtaBinsBarrel")), + jetCalibrationsBarrel(iConfig.getParameter<std::vector<double>>("jetCalibrationsBarrel")), + emFractionBinsHGCal(iConfig.getParameter<std::vector<double>>("emFractionBinsHGCal")), + absEtaBinsHGCal(iConfig.getParameter<std::vector<double>>("absEtaBinsHGCal")), + jetCalibrationsHGCal(iConfig.getParameter<std::vector<double>>("jetCalibrationsHGCal")), + emFractionBinsHF(iConfig.getParameter<std::vector<double>>("emFractionBinsHF")), + absEtaBinsHF(iConfig.getParameter<std::vector<double>>("absEtaBinsHF")), + jetCalibrationsHF(iConfig.getParameter<std::vector<double>>("jetCalibrationsHF")), + tauPtBins(iConfig.getParameter<std::vector<double>>("tauPtBins")), + tauAbsEtaBinsBarrel(iConfig.getParameter<std::vector<double>>("tauAbsEtaBinsBarrel")), + tauCalibrationsBarrel(iConfig.getParameter<std::vector<double>>("tauCalibrationsBarrel")), + tauL1egInfoBarrel(iConfig.getParameter<std::vector<edm::ParameterSet>>("tauL1egInfoBarrel")), + tauAbsEtaBinsHGCal(iConfig.getParameter<std::vector<double>>("tauAbsEtaBinsHGCal")), + tauCalibrationsHGCal(iConfig.getParameter<std::vector<double>>("tauCalibrationsHGCal")), + tauL1egInfoHGCal(iConfig.getParameter<std::vector<edm::ParameterSet>>("tauL1egInfoHGCal")), + debug(iConfig.getParameter<bool>("debug")), + l1TowerToken_(consumes< l1tp2::CaloTowerCollection >(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))) + +{ + if (debug) printf("L1CaloJetProducer setup\n"); + produces<l1tp2::CaloJetsCollection>("L1CaloJetsNoCuts"); + //produces<l1tp2::CaloJetsCollection>("L1CaloJetsWithCuts"); + //produces<l1extra::L1JetParticleCollection>("L1CaloClusterCollectionWithCuts"); + produces< BXVector<l1t::Jet> >("L1CaloJetCollectionBXV"); + produces< BXVector<l1t::Tau> >("L1CaloTauCollectionBXV"); + + + if(debug) printf("\nHcalTpEtMin = %f\nEcalTpEtMin = %f\n", HcalTpEtMin, EcalTpEtMin); + //for( unsigned int i = 0; i < emFractionBins.size(); i++) + //{ + // printf("\n emFrac: %f", emFractionBins.at(i)); + //} + //for( unsigned int i = 0; i < absEtaBins.size(); i++) + //{ + // printf("\n absEta: %f", absEtaBins.at(i)); + //} + //for( unsigned int i = 0; i < jetPtBins.size(); i++) + //{ + // printf("\n jetPt: %f", jetPtBins.at(i)); + //} + + // Fill the calibration 3D vector + // Dimension 1 is AbsEta bin + // Dimension 2 is EM Fraction bin + // Dimension 3 is jet pT bin which is filled with the actual callibration value + // size()-1 b/c the inputs have lower and upper bounds + // Do Barrel, then HGCal, then HF + int index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsBarrel.at(index) ); + for( unsigned int abs_eta = 0; abs_eta < absEtaBinsBarrel.size()-1; abs_eta++) + { + std::vector< std::vector< double >> em_bins; + for( unsigned int em_frac = 0; em_frac < emFractionBinsBarrel.size()-1; em_frac++) + { + std::vector< double > pt_bin_calibs; + for( unsigned int pt = 0; pt < jetPtBins.size()-1; pt++) + { + //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); + //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsBarrel.at(em_frac), absEtaBinsBarrel.at(abs_eta), jetPtBins.at(pt), jetCalibrationsBarrel.at(index)); + pt_bin_calibs.push_back( jetCalibrationsBarrel.at(index) ); + index++; + } + em_bins.push_back( pt_bin_calibs ); + } + calibrationsBarrel.push_back( em_bins ); + } + if(debug) printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(jetCalibrationsBarrel.size())); + + index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHGCal.at(index) ); + for( unsigned int abs_eta = 0; abs_eta < absEtaBinsHGCal.size()-1; abs_eta++) + { + std::vector< std::vector< double >> em_bins; + for( unsigned int em_frac = 0; em_frac < emFractionBinsHGCal.size()-1; em_frac++) + { + std::vector< double > pt_bin_calibs; + for( unsigned int pt = 0; pt < jetPtBins.size()-1; pt++) + { + //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); + //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHGCal.at(em_frac), absEtaBinsHGCal.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHGCal.at(index)); + pt_bin_calibs.push_back( jetCalibrationsHGCal.at(index) ); + index++; + } + em_bins.push_back( pt_bin_calibs ); + } + calibrationsHGCal.push_back( em_bins ); + } + if(debug) printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(jetCalibrationsHGCal.size())); + + index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHF.at(index) ); + for( unsigned int abs_eta = 0; abs_eta < absEtaBinsHF.size()-1; abs_eta++) + { + std::vector< std::vector< double >> em_bins; + for( unsigned int em_frac = 0; em_frac < emFractionBinsHF.size()-1; em_frac++) + { + std::vector< double > pt_bin_calibs; + for( unsigned int pt = 0; pt < jetPtBins.size()-1; pt++) + { + //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); + //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHF.at(em_frac), absEtaBinsHF.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHF.at(index)); + pt_bin_calibs.push_back( jetCalibrationsHF.at(index) ); + index++; + } + em_bins.push_back( pt_bin_calibs ); + } + calibrationsHF.push_back( em_bins ); + } + if(debug) printf("\nLoading HF calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(jetCalibrationsHF.size())); + + + // Load Tau L1EG-base calibration info into maps + for( auto& first : tauL1egInfoBarrel ) + { + if(debug) + { + printf( "barrel l1egCount = %f\n", first.getParameter<double>("l1egCount") ); + for ( auto& em_frac : first.getParameter<std::vector<double>>("l1egEmFractions") ) + { + printf(" - EM = %.3f\n", em_frac ); + } + } + double l1egCount = first.getParameter<double>("l1egCount"); + std::vector<double> l1egEmFractions = first.getParameter<std::vector<double>>("l1egEmFractions"); + tauL1egInfoMapBarrel[ l1egCount ] = l1egEmFractions; + tauL1egValuesBarrel.push_back( l1egCount ); + } + std::sort(tauL1egValuesBarrel.begin(), tauL1egValuesBarrel.end()); + for( auto& first : tauL1egInfoHGCal ) + { + if(debug) + { + printf( "hgcal l1egCount = %f\n", first.getParameter<double>("l1egCount") ); + for ( auto& em_frac : first.getParameter<std::vector<double>>("l1egEmFractions") ) + { + printf(" - EM = %.3f\n", em_frac ); + } + } + double l1egCount = first.getParameter<double>("l1egCount"); + std::vector<double> l1egEmFractions = first.getParameter<std::vector<double>>("l1egEmFractions"); + tauL1egInfoMapHGCal[ l1egCount ] = l1egEmFractions; + tauL1egValuesHGCal.push_back( l1egCount ); + } + std::sort(tauL1egValuesHGCal.begin(), tauL1egValuesHGCal.end()); + // Fill the calibration 4D vector + // Dimension 1 is AbsEta bin + // Dimension 2 is L1EG count + // Dimension 3 is EM Fraction bin + // Dimension 4 is tau pT bin which is filled with the actual callibration value + // size()-1 b/c the inputs have lower and upper bounds (except L1EG b/c that is a cound) + // Do Barrel, then HGCal + // + // Note to future developers: be very concious of the order in which the calibrations are printed + // out in tool which makse the cfg files. You need to match that exactly when loading them and + // using the calibrations below. + index = 0; + for( unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsBarrel.size()-1; abs_eta++) + { + std::vector< std::vector< std::vector< double >>> l1eg_bins; + for( auto &l1eg_info : tauL1egInfoMapBarrel ) + { + std::vector< std::vector< double >> em_bins; + for( unsigned int em_frac = 0; em_frac < l1eg_info.second.size()-1; em_frac++) + { + //printf("\nBarrel l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsBarrel.at(abs_eta)); + std::vector< double > pt_bin_calibs; + for( unsigned int pt = 0; pt < tauPtBins.size()-1; pt++) + { + //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsBarrel.at(index)); + pt_bin_calibs.push_back( tauCalibrationsBarrel.at(index) ); + index++; + } + em_bins.push_back( pt_bin_calibs ); + } + l1eg_bins.push_back( em_bins ); + } + tauPtCalibrationsBarrel.push_back( l1eg_bins ); + } + if(debug) printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(tauCalibrationsBarrel.size())); + + index = 0; + for( unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsHGCal.size()-1; abs_eta++) + { + std::vector< std::vector< std::vector< double >>> l1eg_bins; + for( const auto &l1eg_info : tauL1egInfoMapHGCal ) + { + std::vector< std::vector< double >> em_bins; + for( unsigned int em_frac = 0; em_frac < l1eg_info.second.size()-1; em_frac++) + { + //printf("\nHGCal l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsHGCal.at(abs_eta)); + std::vector< double > pt_bin_calibs; + for( unsigned int pt = 0; pt < tauPtBins.size()-1; pt++) + { + //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsHGCal.at(index)); + pt_bin_calibs.push_back( tauCalibrationsHGCal.at(index) ); + index++; + } + em_bins.push_back( pt_bin_calibs ); + } + l1eg_bins.push_back( em_bins ); + } + tauPtCalibrationsHGCal.push_back( l1eg_bins ); + } + if(debug) printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(tauCalibrationsHGCal.size())); + + + + isoTauBarrel.SetParameter( 0, 0.25 ); + isoTauBarrel.SetParameter( 1, 0.85 ); + isoTauBarrel.SetParameter( 2, 0.094 ); + isoTauHGCal.SetParameter( 0, 0.34 ); + isoTauHGCal.SetParameter( 1, 0.35 ); + isoTauHGCal.SetParameter( 2, 0.051 ); + + if (debug) printf("\nL1CaloJetProducer end\n"); +} + +void L1CaloJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + + //printf("begin L1CaloJetProducer\n"); + + // Output collections + std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsNoCuts (new l1tp2::CaloJetsCollection ); + //std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsWithCuts( new l1tp2::CaloJetsCollection ); + //std::unique_ptr<l1extra::L1JetParticleCollection> L1CaloClusterCollectionWithCuts( new l1extra::L1JetParticleCollection ); + std::unique_ptr<BXVector<l1t::Jet>> L1CaloJetCollectionBXV(new l1t::JetBxCollection); + std::unique_ptr<BXVector<l1t::Tau>> L1CaloTauCollectionBXV(new l1t::TauBxCollection); + + + + + // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc + std::vector< SimpleCaloHit > l1CaloTowers; + + iEvent.getByToken(l1TowerToken_,l1CaloTowerHandle); + for (auto& hit : *l1CaloTowerHandle.product()) + { + + SimpleCaloHit l1Hit; + l1Hit.ecalTowerEt = hit.ecalTowerEt(); + l1Hit.hcalTowerEt = hit.hcalTowerEt(); + l1Hit.l1egTowerEt = hit.l1egTowerEt(); + // Add min ET thresholds for tower ET + if (l1Hit.ecalTowerEt < EcalTpEtMin) l1Hit.ecalTowerEt = 0.0; + if (l1Hit.hcalTowerEt < HcalTpEtMin) l1Hit.hcalTowerEt = 0.0; + l1Hit.total_tower_et = l1Hit.ecalTowerEt + l1Hit.hcalTowerEt + l1Hit.l1egTowerEt; + l1Hit.towerIEta = hit.towerIEta(); + l1Hit.towerIPhi = hit.towerIPhi(); + l1Hit.nL1eg = hit.nL1eg(); + l1Hit.l1egTrkSS = hit.l1egTrkSS(); + l1Hit.l1egTrkIso = hit.l1egTrkIso(); + l1Hit.l1egStandaloneSS = hit.l1egStandaloneSS(); + l1Hit.l1egStandaloneIso = hit.l1egStandaloneIso(); + l1Hit.isBarrel = hit.isBarrel(); + + // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is + // returning towers with minimal ECAL energy, and no HCAL energy with these + // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. + // Skip these for the time being until the upstream code has been debugged + if ((int)l1Hit.towerIEta == -1016 && (int)l1Hit.towerIPhi == -962) continue; + + l1Hit.towerEta = hit.towerEta(); + l1Hit.towerPhi = hit.towerPhi(); + l1CaloTowers.push_back( l1Hit ); + if (debug) printf("Tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et %f total_et %f\n", (int)l1Hit.towerIEta, (int)l1Hit.towerIPhi, l1Hit.towerEta, l1Hit.towerPhi, l1Hit.ecalTowerEt, l1Hit.hcalTowerEt, l1Hit.total_tower_et); + } + + + + + // Sort the ECAL+HCAL+L1EGs tower sums based on total ET + std::sort(begin(l1CaloTowers), end(l1CaloTowers), [](const SimpleCaloHit& a, + SimpleCaloHit& b){return a.total_tower_et > b.total_tower_et;}); + + + + /************************************************************************** + * Begin with making CaloJets in 9x9 grid based on all energy not included in L1EG Objs. + * For reference, Run-I used 12x12 grid and Stage-2/Phase-I used 9x9 grid. + * We plan to further study this choice and possibly move towards a more circular shape + * Create jetCluster within 9x9 of highest ET seed tower. + * 9 trigger towers contains all of an ak-0.4 jets, but overshoots on the corners. + ******************************************************************************/ + + // Experimental parameters, don't want to bother with hardcoding them in data format + std::map<std::string, float> params; + + std::vector< l1CaloJetObj > l1CaloJetObjs; + + // Count the number of unused HCAL TPs so we can stop while loop after done. + // Clustering can also stop once there are no seed hits >= EtMinForSeedHit + int n_towers = l1CaloTowers.size(); + int n_stale = 0; + bool caloJetClusteringFinished = false; + while (!caloJetClusteringFinished && n_towers != n_stale) + { + + l1CaloJetObj caloJetObj; + caloJetObj.Init(); + + // First find highest ET ECAL+HCAL+L1EGs tower and use to seed the 9x9 Jet + int cnt = 0; + for (auto &l1CaloTower : l1CaloTowers) + { + + cnt++; + if (l1CaloTower.stale) continue; // skip l1CaloTowers which are already used + + if (caloJetObj.jetClusterET == 0.0) // this is the first l1CaloTower to seed the jet + { + // Check if the leading unused tower has ET < min for seeding a jet. + // If so, stop jet clustering + if (l1CaloTower.total_tower_et < EtMinForSeedHit) + { + caloJetClusteringFinished = true; + continue; + } + l1CaloTower.stale = true; + n_stale++; + + // Set seed location needed for delta iEta/iPhi, eta/phi comparisons later + if (l1CaloTower.isBarrel) caloJetObj.barrelSeeded = true; + else caloJetObj.barrelSeeded = false; + + // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together + reco::Candidate::PolarLorentzVector hcalP4( l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector ecalP4( l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector l1egP4( l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector totalP4( l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + + if (hcalP4.pt() > 0) + { + caloJetObj.hcal_nHits++; + caloJetObj.hcalJetCluster += hcalP4; + caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; + } + if (ecalP4.pt() > 0) + { + caloJetObj.ecal_nHits++; + caloJetObj.ecalJetCluster += ecalP4; + caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; + } + if (l1egP4.pt() > 0) + { + caloJetObj.l1eg_nHits++; + caloJetObj.l1egJetCluster += l1egP4; + caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; + caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; + + caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; + caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; + caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; + caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; + + if (l1CaloTower.isBarrel) + { + // For decay mode related checks with CaloTaus + // only applicable in the barrel at the moment: + // l1eg pt, HCAL ET, ECAL ET, dEta, dPhi, trkSS, trkIso, standaloneSS, standaloneIso + std::vector< float > l1EG_info = {float(l1egP4.pt()), float(hcalP4.pt()), float(ecalP4.pt()), 0., 0., float(l1CaloTower.l1egTrkSS), + float(l1CaloTower.l1egTrkIso), float(l1CaloTower.l1egStandaloneSS), float(l1CaloTower.l1egStandaloneIso)}; + if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) + { + caloJetObj.n_l1eg_HoverE_LessThreshold++; + } + caloJetObj.associated_l1EGs_.push_back( l1EG_info ); + } + + } + if (totalP4.pt() > 0) + { + caloJetObj.total_nHits++; + caloJetObj.jetCluster += totalP4; + caloJetObj.jetClusterET += l1CaloTower.total_tower_et; + caloJetObj.seedTower += totalP4; + caloJetObj.seedTowerET += l1CaloTower.total_tower_et; + } + + + caloJetObj.seed_iEta = l1CaloTower.towerIEta; + caloJetObj.seed_iPhi = l1CaloTower.towerIPhi; + + + if (debug) printf(" -- hit %i, seeding input p4 pt %f eta %f phi %f\n", cnt, l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi); + if (debug) printf(" -- hit %i, seeding input2 p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); + if (debug) printf(" -- hit %i, seeding reslt tot p4 pt %f eta %f phi %f\n", cnt, caloJetObj.jetClusterET, caloJetObj.jetCluster.eta(), caloJetObj.jetCluster.phi()); + + // Need to add the seed energy to the dR rings + caloJetObj.hcal_seed += hcalP4.pt(); + //caloJetObj.hcal_3x3 += hcalP4.pt(); + caloJetObj.hcal_3x5 += hcalP4.pt(); + //caloJetObj.hcal_5x5 += hcalP4.pt(); + //caloJetObj.hcal_5x7 += hcalP4.pt(); + caloJetObj.hcal_7x7 += hcalP4.pt(); + caloJetObj.ecal_seed += ecalP4.pt(); + //caloJetObj.ecal_3x3 += ecalP4.pt(); + caloJetObj.ecal_3x5 += ecalP4.pt(); + //caloJetObj.ecal_5x5 += ecalP4.pt(); + //caloJetObj.ecal_5x7 += ecalP4.pt(); + caloJetObj.ecal_7x7 += ecalP4.pt(); + caloJetObj.l1eg_seed += l1egP4.pt(); + //caloJetObj.l1eg_3x3 += l1egP4.pt(); + caloJetObj.l1eg_3x5 += l1egP4.pt(); + //caloJetObj.l1eg_5x5 += l1egP4.pt(); + //caloJetObj.l1eg_5x7 += l1egP4.pt(); + caloJetObj.l1eg_7x7 += l1egP4.pt(); + caloJetObj.total_seed += totalP4.pt(); + //caloJetObj.total_3x3 += totalP4.pt(); + caloJetObj.total_3x5 += totalP4.pt(); + //caloJetObj.total_5x5 += totalP4.pt(); + //caloJetObj.total_5x7 += totalP4.pt(); + caloJetObj.total_7x7 += totalP4.pt(); + + // Some discrimination vars, 2x2s and 2x3 including central seed + //caloJetObj.hcal_2x3 += hcalP4.pt(); + //caloJetObj.hcal_2x3_1 += hcalP4.pt(); + //caloJetObj.hcal_2x3_2 += hcalP4.pt(); + //caloJetObj.ecal_2x3 += ecalP4.pt(); + //caloJetObj.ecal_2x3_1 += ecalP4.pt(); + //caloJetObj.ecal_2x3_2 += ecalP4.pt(); + //caloJetObj.l1eg_2x3 += l1egP4.pt(); + //caloJetObj.l1eg_2x3_1 += l1egP4.pt(); + //caloJetObj.l1eg_2x3_2 += l1egP4.pt(); + //caloJetObj.total_2x3 += totalP4.pt(); + //caloJetObj.total_2x3_1 += totalP4.pt(); + //caloJetObj.total_2x3_2 += totalP4.pt(); + + //caloJetObj.hcal_2x2 += hcalP4.pt(); + //caloJetObj.hcal_2x2_1 += hcalP4.pt(); + //caloJetObj.hcal_2x2_2 += hcalP4.pt(); + //caloJetObj.hcal_2x2_3 += hcalP4.pt(); + //caloJetObj.hcal_2x2_4 += hcalP4.pt(); + //caloJetObj.ecal_2x2 += ecalP4.pt(); + //caloJetObj.ecal_2x2_1 += ecalP4.pt(); + //caloJetObj.ecal_2x2_2 += ecalP4.pt(); + //caloJetObj.ecal_2x2_3 += ecalP4.pt(); + //caloJetObj.ecal_2x2_4 += ecalP4.pt(); + //caloJetObj.l1eg_2x2 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_1 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_2 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_3 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_4 += l1egP4.pt(); + //caloJetObj.total_2x2 += totalP4.pt(); + //caloJetObj.total_2x2_1 += totalP4.pt(); + //caloJetObj.total_2x2_2 += totalP4.pt(); + //caloJetObj.total_2x2_3 += totalP4.pt(); + //caloJetObj.total_2x2_4 += totalP4.pt(); + continue; + } + + // Unused l1CaloTowers which are not the initial seed + // Depending on seed and tower locations calculate iEta/iPhi or eta/phi comparisons. + // The defaults of 99 will automatically fail comparisons for the incorrect regions. + int hit_iPhi = 99; + int d_iEta = 99; + int d_iPhi = 99; + float d_eta = 99; + float d_phi = 99; + if ( caloJetObj.barrelSeeded && l1CaloTower.isBarrel ) // use iEta/iPhi comparisons + { + hit_iPhi = l1CaloTower.towerIPhi; + d_iEta = tower_diEta( caloJetObj.seed_iEta, l1CaloTower.towerIEta ); + d_iPhi = tower_diPhi( caloJetObj.seed_iPhi, hit_iPhi ); + } + else // either seed or tower are in HGCal or HF, use eta/phi + { + d_eta = caloJetObj.seedTower.eta() - l1CaloTower.towerEta; + d_phi = reco::deltaPhi( caloJetObj.seedTower.phi(), l1CaloTower.towerPhi ); + } + + // 7x7 HCAL Trigger Towers + // If seeded in barrel and hit is barrel then we can compare iEta/iPhi, else need to use eta/phi + // in HGCal / transition region + if ( (abs( d_iEta ) <= 3 && abs( d_iPhi ) <= 3) || + ( fabs( d_eta ) < 0.3 && fabs( d_phi ) < 0.3 ) ) + { + + l1CaloTower.stale = true; + n_stale++; + + // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together + reco::Candidate::PolarLorentzVector hcalP4( l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector ecalP4( l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector l1egP4( l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector totalP4( l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + + if (hcalP4.pt() > 0) + { + caloJetObj.hcal_nHits++; + caloJetObj.hcalJetCluster += hcalP4; + caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; + } + if (ecalP4.pt() > 0) + { + caloJetObj.ecal_nHits++; + caloJetObj.ecalJetCluster += ecalP4; + caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; + } + if (l1egP4.pt() > 0) + { + caloJetObj.l1eg_nHits++; + caloJetObj.l1egJetCluster += l1egP4; + caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; + caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; + } + if (totalP4.pt() > 0) + { + caloJetObj.total_nHits++; + caloJetObj.jetCluster += totalP4; + caloJetObj.jetClusterET += l1CaloTower.total_tower_et; + } + + + if (debug) printf(" ---- hit %i input p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); + if (debug) printf(" ---- hit %i resulting p4 pt %f eta %f phi %f\n", cnt, caloJetObj.jetClusterET, caloJetObj.jetCluster.eta(), caloJetObj.jetCluster.phi()); + + + + if ( (abs( d_iEta ) == 0 && abs( d_iPhi ) == 0) || + ( fabs( d_eta ) < 0.043 && fabs( d_phi ) < 0.043 ) ) + { + caloJetObj.hcal_seed += hcalP4.pt(); + caloJetObj.ecal_seed += ecalP4.pt(); + caloJetObj.l1eg_seed += l1egP4.pt(); + caloJetObj.total_seed += totalP4.pt(); + } + //if ( (abs( d_iEta ) <= 1 && abs( d_iPhi ) <= 1) || + // ( fabs( d_eta ) < 0.13 && fabs( d_phi ) < 0.13 ) ) + //{ + // caloJetObj.hcal_3x3 += hcalP4.pt(); + // caloJetObj.ecal_3x3 += ecalP4.pt(); + // caloJetObj.l1eg_3x3 += l1egP4.pt(); + // caloJetObj.total_3x3 += totalP4.pt(); + //} + if ( (abs( d_iEta ) <= 1 && abs( d_iPhi ) <= 2) || + ( fabs( d_eta ) < 0.13 && fabs( d_phi ) < 0.22 ) ) + { + caloJetObj.hcal_3x5 += hcalP4.pt(); + caloJetObj.ecal_3x5 += ecalP4.pt(); + caloJetObj.l1eg_3x5 += l1egP4.pt(); + caloJetObj.total_3x5 += totalP4.pt(); + + // Do this for 3x5 only + if (l1egP4.pt() > 0) + { + caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; + caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; + caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; + caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; + + // For decay mode related checks with CaloTaus + // only applicable in the barrel at the moment: + // l1eg pt, HCAL ET, ECAL ET, d_iEta, d_iPhi, trkSS, trkIso, standaloneSS, standaloneIso + std::vector< float > l1EG_info = {float(l1egP4.pt()), float(hcalP4.pt()), float(ecalP4.pt()), + float(d_iEta), float(d_iPhi), float(l1CaloTower.l1egTrkSS), float(l1CaloTower.l1egTrkIso), + float(l1CaloTower.l1egStandaloneSS), float(l1CaloTower.l1egStandaloneIso)}; + if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) + { + caloJetObj.n_l1eg_HoverE_LessThreshold++; + } + caloJetObj.associated_l1EGs_.push_back( l1EG_info ); + } + + } + //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 2) || + // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.22 ) ) + //{ + // caloJetObj.hcal_5x5 += hcalP4.pt(); + // caloJetObj.ecal_5x5 += ecalP4.pt(); + // caloJetObj.l1eg_5x5 += l1egP4.pt(); + // caloJetObj.total_5x5 += totalP4.pt(); + //} + //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 3) || + // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.3 ) ) + //{ + // caloJetObj.hcal_5x7 += hcalP4.pt(); + // caloJetObj.ecal_5x7 += ecalP4.pt(); + // caloJetObj.l1eg_5x7 += l1egP4.pt(); + // caloJetObj.total_5x7 += totalP4.pt(); + //} + if ( (abs( d_iEta ) <= 3 && abs( d_iPhi ) <= 3) || + ( fabs( d_eta ) < 0.3 && fabs( d_phi ) < 0.3 ) ) + { + caloJetObj.hcal_7x7 += hcalP4.pt(); + caloJetObj.ecal_7x7 += ecalP4.pt(); + caloJetObj.l1eg_7x7 += l1egP4.pt(); + caloJetObj.total_7x7 += totalP4.pt(); + } + + //// Some discrimination vars, 2x2s and 2x3s including central seed + //// Barrel first, 2x3 + //if ( ( d_iEta == 0 || d_iEta == 1 ) && abs(d_iPhi) <= 1 ) + //{ + // caloJetObj.hcal_2x3_1 += hcalP4.pt(); + // caloJetObj.ecal_2x3_1 += ecalP4.pt(); + // caloJetObj.l1eg_2x3_1 += l1egP4.pt(); + // caloJetObj.total_2x3_1 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && abs(d_iPhi) <= 1 ) + //{ + // caloJetObj.hcal_2x3_2 += hcalP4.pt(); + // caloJetObj.ecal_2x3_2 += ecalP4.pt(); + // caloJetObj.l1eg_2x3_2 += l1egP4.pt(); + // caloJetObj.total_2x3_2 += totalP4.pt(); + //} + //// HGCal / HF + //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.13 ) + //{ + // caloJetObj.hcal_2x3 += hcalP4.pt(); + // caloJetObj.ecal_2x3 += ecalP4.pt(); + // caloJetObj.l1eg_2x3 += l1egP4.pt(); + // caloJetObj.total_2x3 += totalP4.pt(); + //} + + //// Now 2x2 Barrel first + //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) + //{ + // caloJetObj.hcal_2x2_1 += hcalP4.pt(); + // caloJetObj.ecal_2x2_1 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_1 += l1egP4.pt(); + // caloJetObj.total_2x2_1 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) + //{ + // caloJetObj.hcal_2x2_2 += hcalP4.pt(); + // caloJetObj.ecal_2x2_2 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_2 += l1egP4.pt(); + // caloJetObj.total_2x2_2 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) + //{ + // caloJetObj.hcal_2x2_3 += hcalP4.pt(); + // caloJetObj.ecal_2x2_3 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_3 += l1egP4.pt(); + // caloJetObj.total_2x2_3 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) + //{ + // caloJetObj.hcal_2x2_4 += hcalP4.pt(); + // caloJetObj.ecal_2x2_4 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_4 += l1egP4.pt(); + // caloJetObj.total_2x2_4 += totalP4.pt(); + //} + //// HGCal / HF + //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.087 ) + //{ + // caloJetObj.hcal_2x2 += hcalP4.pt(); + // caloJetObj.ecal_2x2 += ecalP4.pt(); + // caloJetObj.l1eg_2x2 += l1egP4.pt(); + // caloJetObj.total_2x2 += totalP4.pt(); + //} + } + } + + if (caloJetObj.jetClusterET > 0.0) + { + l1CaloJetObjs.push_back( caloJetObj ); + } + + } // end while loop of HCAL TP clustering + + + + + // Sort JetClusters so we can begin with the highest pt for next step of jet clustering + std::sort(begin(l1CaloJetObjs), end(l1CaloJetObjs), [](const l1CaloJetObj& a, + const l1CaloJetObj& b){return a.jetClusterET > b.jetClusterET;}); + + + + /************************************************************************** + * Progress to adding L1EGs built from ECAL TPs 9x9 grid. + * Recall, for 9x9 trigger towers gives diameter 0.78 + ******************************************************************************/ + + + // Cluster together the L1EGs around existing HCAL Jet + // Cluster within dEta/dPhi 0.4 which is very close to 0.39 = 9x9/2 + //std::cout << " - Input L1EGs: " << crystalClustersVect.size() << std::endl; + for (auto &caloJetObj : l1CaloJetObjs) + { + + + + + params["seed_pt"] = caloJetObj.seedTowerET; + params["seed_eta"] = caloJetObj.seedTower.eta(); + params["seed_phi"] = caloJetObj.seedTower.phi(); + params["seed_iEta"] = caloJetObj.seed_iEta; + params["seed_iPhi"] = caloJetObj.seed_iPhi; + params["seed_energy"] = caloJetObj.seedTower.energy(); + + params["hcal_pt"] = caloJetObj.hcalJetClusterET; + params["hcal_seed"] = caloJetObj.hcal_seed; + //params["hcal_3x3"] = caloJetObj.hcal_3x3; + params["hcal_3x5"] = caloJetObj.hcal_3x5; + //params["hcal_5x5"] = caloJetObj.hcal_5x5; + //params["hcal_5x7"] = caloJetObj.hcal_5x7; + params["hcal_7x7"] = caloJetObj.hcal_7x7; + //params["hcal_2x3"] = std::max( caloJetObj.hcal_2x3, std::max( caloJetObj.hcal_2x3_1, caloJetObj.hcal_2x3_2 )); + //params["hcal_2x2"] = std::max( caloJetObj.hcal_2x2, std::max( caloJetObj.hcal_2x2_1, std::max( caloJetObj.hcal_2x2_2, std::max( caloJetObj.hcal_2x2_3, caloJetObj.hcal_2x2_4 )))); + params["hcal_nHits"] = caloJetObj.hcal_nHits; + + params["ecal_pt"] = caloJetObj.ecalJetClusterET; + params["ecal_seed"] = caloJetObj.ecal_seed; + //params["ecal_3x3"] = caloJetObj.ecal_3x3; + params["ecal_3x5"] = caloJetObj.ecal_3x5; + //params["ecal_5x5"] = caloJetObj.ecal_5x5; + //params["ecal_5x7"] = caloJetObj.ecal_5x7; + params["ecal_7x7"] = caloJetObj.ecal_7x7; + //params["ecal_2x3"] = std::max( caloJetObj.ecal_2x3, std::max( caloJetObj.ecal_2x3_1, caloJetObj.ecal_2x3_2 )); + //params["ecal_2x2"] = std::max( caloJetObj.ecal_2x2, std::max( caloJetObj.ecal_2x2_1, std::max( caloJetObj.ecal_2x2_2, std::max( caloJetObj.ecal_2x2_3, caloJetObj.ecal_2x2_4 )))); + params["ecal_nHits"] = caloJetObj.ecal_nHits; + + params["l1eg_pt"] = caloJetObj.l1egJetClusterET; + params["l1eg_seed"] = caloJetObj.l1eg_seed; + //params["l1eg_3x3"] = caloJetObj.l1eg_3x3; + params["l1eg_3x5"] = caloJetObj.l1eg_3x5; + //params["l1eg_5x5"] = caloJetObj.l1eg_5x5; + //params["l1eg_5x7"] = caloJetObj.l1eg_5x7; + params["l1eg_7x7"] = caloJetObj.l1eg_7x7; + //params["l1eg_2x3"] = std::max( caloJetObj.l1eg_2x3, std::max( caloJetObj.l1eg_2x3_1, caloJetObj.l1eg_2x3_2 )); + //params["l1eg_2x2"] = std::max( caloJetObj.l1eg_2x2, std::max( caloJetObj.l1eg_2x2_1, std::max( caloJetObj.l1eg_2x2_2, std::max( caloJetObj.l1eg_2x2_3, caloJetObj.l1eg_2x2_4 )))); + params["l1eg_nHits"] = caloJetObj.l1eg_nHits; + params["l1eg_nL1EGs"] = caloJetObj.l1eg_nL1EGs; + params["l1eg_nL1EGs_standaloneSS"] = caloJetObj.l1eg_nL1EGs_standaloneSS; + params["l1eg_nL1EGs_standaloneIso"] = caloJetObj.l1eg_nL1EGs_standaloneIso; + params["l1eg_nL1EGs_trkMatchSS"] = caloJetObj.l1eg_nL1EGs_trkMatchSS; + params["l1eg_nL1EGs_trkMatchIso"] = caloJetObj.l1eg_nL1EGs_trkMatchIso; + + params["total_et"] = caloJetObj.jetClusterET; + params["total_seed"] = caloJetObj.total_seed; + //params["total_3x3"] = caloJetObj.total_3x3; + params["total_3x5"] = caloJetObj.total_3x5; + //params["total_5x5"] = caloJetObj.total_5x5; + //params["total_5x7"] = caloJetObj.total_5x7; + params["total_7x7"] = caloJetObj.total_7x7; + //params["total_2x3"] = std::max( caloJetObj.total_2x3, std::max( caloJetObj.total_2x3_1, caloJetObj.total_2x3_2 )); + //params["total_2x2"] = std::max( caloJetObj.total_2x2, std::max( caloJetObj.total_2x2_1, std::max( caloJetObj.total_2x2_2, std::max( caloJetObj.total_2x2_3, caloJetObj.total_2x2_4 )))); + params["total_nHits"] = caloJetObj.total_nHits; + //params["total_nTowers"] = total_nTowers; + + + //// return -9 for energy and dR values for ecalJet as defaults + float hovere = -9; + if (caloJetObj.ecalJetClusterET > 0.0) + { + hovere = caloJetObj.hcalJetClusterET / ( caloJetObj.ecalJetClusterET + caloJetObj.l1egJetClusterET ); + } + + + params["jet_pt"] = caloJetObj.jetClusterET; + params["jet_eta"] = caloJetObj.jetCluster.eta(); + params["jet_phi"] = caloJetObj.jetCluster.phi(); + params["jet_mass"] = caloJetObj.jetCluster.mass(); + params["jet_energy"] = caloJetObj.jetCluster.energy(); + + // Calibrations + params["hcal_calibration"] = get_hcal_calibration( + params["jet_pt"], + params["ecal_pt"], + params["l1eg_pt"], + params["jet_eta"] ); + params["hcal_pt_calibration"] = params["hcal_pt"] * params["hcal_calibration"]; + params["jet_pt_calibration"] = params["hcal_pt_calibration"] + + params["ecal_pt"] + params["l1eg_pt"]; + + // Tau Vars + // The tau pT calibration is applied as a SF to the total raw pT + // in contrast to the jet calibration above + params["tau_pt_calibration_value"] = get_tau_pt_calibration( + params["total_3x5"], + params["ecal_3x5"], + params["l1eg_3x5"], + caloJetObj.n_l1eg_HoverE_LessThreshold, + params["jet_eta"] ); + params["tau_pt"] = params["total_3x5"] * params["tau_pt_calibration_value"]; + params["n_l1eg_HoverE_LessThreshold"] = caloJetObj.n_l1eg_HoverE_LessThreshold; + // Currently, applying the tau_pt calibration to the isolation region as well... + // One could switch to using the calibrated jet_pt instead for the iso region... + // This should be revisited - FIXME? + params["tau_total_iso_et"] = params["jet_pt"] * params["tau_pt_calibration_value"]; + params["tau_iso_et"] = (params["jet_pt"] * params["tau_pt_calibration_value"]) - params["tau_pt"]; + params["loose_iso_tau_wp"] = float(loose_iso_tau_wp( params["tau_pt"], params["tau_iso_et"], params["jet_eta"] )); + + float calibratedPt = -1; + float ECalIsolation = -1; // Need to loop over 7x7 crystals of unclustered energy + float totalPtPUcorr = -1; + l1tp2::CaloJet caloJet(caloJetObj.jetCluster, calibratedPt, hovere, ECalIsolation, totalPtPUcorr); + caloJet.setExperimentalParams(params); + caloJet.associated_l1EGs() = caloJetObj.associated_l1EGs_; + + // Only store jets passing ET threshold + if (params["jet_pt_calibration"] >= EtMinForCollection) + { + L1CaloJetsNoCuts->push_back( caloJet ); + //L1CaloJetsWithCuts->push_back( caloJet ); + reco::Candidate::PolarLorentzVector jet_p4 = reco::Candidate::PolarLorentzVector( + params["jet_pt_calibration"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M() ); + L1CaloJetCollectionBXV->push_back( 0, l1t::Jet( jet_p4 ) ); + + if (debug) printf("Made a Jet, eta %f phi %f pt %f calibrated pt %f\n", caloJetObj.jetCluster.eta(), caloJetObj.jetCluster.phi(), caloJetObj.jetClusterET, params["jet_pt_calibration"] ); + + } + + // Only store taus passing ET threshold + if (params["tau_pt"] >= EtMinForTauCollection) + { + short int tau_ieta = caloJetObj.seed_iEta; + short int tau_iphi = caloJetObj.seed_iPhi; + short int raw_et = params["total_3x5"]; + short int iso_et = params["tau_iso_et"]; + bool hasEM = false; + if (params["l1eg_3x5"] > 0. || params["ecal_3x5"] > 0.) + { + hasEM = true; + } + int tau_qual = int(params["loose_iso_tau_wp"]); + + reco::Candidate::PolarLorentzVector tau_p4 = reco::Candidate::PolarLorentzVector( + params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M() ); + l1t::Tau l1Tau = l1t::Tau( tau_p4, params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), tau_qual, iso_et ); + l1Tau.setTowerIEta(tau_ieta); + l1Tau.setTowerIPhi(tau_iphi); + l1Tau.setRawEt(raw_et); + l1Tau.setIsoEt(iso_et); + l1Tau.setHasEM(hasEM); + l1Tau.setIsMerged(false); + L1CaloTauCollectionBXV->push_back( 0, l1Tau ); + + if (debug) printf("Made a Tau, eta %f phi %f pt %i calibrated pt %f\n", l1Tau.eta(), l1Tau.phi(), l1Tau.rawEt(), l1Tau.pt() ); + + + } + + + } // end jetClusters loop + + + iEvent.put(std::move(L1CaloJetsNoCuts),"L1CaloJetsNoCuts"); + //iEvent.put(std::move(L1CaloJetsWithCuts), "L1CaloJetsWithCuts" ); + //iEvent.put(std::move(L1CaloClusterCollectionWithCuts), "L1CaloClusterCollectionWithCuts" ); + iEvent.put(std::move(L1CaloJetCollectionBXV),"L1CaloJetCollectionBXV"); + iEvent.put(std::move(L1CaloTauCollectionBXV),"L1CaloTauCollectionBXV"); + + //printf("end L1CaloJetProducer\n"); +} + + + + + + + + + + +int +L1CaloJetProducer::ecalXtal_diPhi( int &iPhi_1, int &iPhi_2 ) const +{ + // We shouldn't compare integer indices in endcap, the map is not linear + // Logic from EBDetId::distancePhi() without the abs() + int PI = 180; + int result = iPhi_1 - iPhi_2; + while (result > PI) result -= 2*PI; + while (result <= -PI) result += 2*PI; + return result; +} + + +int +L1CaloJetProducer::tower_diPhi( int &iPhi_1, int &iPhi_2 ) const +{ + // 360 Crystals in full, 72 towers, half way is 36 + int PI = 36; + int result = iPhi_1 - iPhi_2; + while (result > PI) result -= 2*PI; + while (result <= -PI) result += 2*PI; + return result; +} + + +// Added b/c of the iEta jump from +1 to -1 across the barrel mid point +int +L1CaloJetProducer::tower_diEta( int &iEta_1, int &iEta_2 ) const +{ + // On same side of barrel + if (iEta_1 * iEta_2 > 0) return iEta_1 - iEta_2; + else return iEta_1 - iEta_2 - 1; +} + + +float +L1CaloJetProducer::get_deltaR( reco::Candidate::PolarLorentzVector &p4_1, + reco::Candidate::PolarLorentzVector &p4_2) const +{ + // Check that pt is > 0 for both or else reco::deltaR returns bogus values + if (p4_1.pt() > 0 && p4_2.pt() > 0) + { + return reco::deltaR( p4_1, p4_2 ); + } + else return -1; +} + + +// Apply calibrations to HCAL energy based on EM Fraction, Jet Eta, Jet pT +float +L1CaloJetProducer::get_hcal_calibration( float &jet_pt, float &ecal_pt, + float &ecal_L1EG_jet_pt, float &jet_eta ) const +{ + + float em_frac = (ecal_L1EG_jet_pt + ecal_pt) / jet_pt; + float abs_eta = fabs( jet_eta ); + float tmp_jet_pt = jet_pt; + if (tmp_jet_pt > 499) tmp_jet_pt = 499; + + // Different indices sizes in different calo regions. + // Barrel... + size_t em_index = 0; + size_t eta_index = 0; + size_t pt_index = 0; + float calib = 1.0; + if (abs_eta <= 1.5) + { + // Start loop checking 2nd value + for( unsigned int i = 1; i < emFractionBinsBarrel.size(); i++) + { + if(em_frac <= emFractionBinsBarrel.at(i)) break; + em_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < absEtaBinsBarrel.size(); i++) + { + if(abs_eta <= absEtaBinsBarrel.at(i)) break; + eta_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < jetPtBins.size(); i++) + { + if(tmp_jet_pt <= jetPtBins.at(i)) break; + pt_index++; + } + //printf("Barrel calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); + calib = calibrationsBarrel[ eta_index ][ em_index ][ pt_index ]; + } // end Barrel + else if (abs_eta <= 3.0) // HGCal + { + // Start loop checking 2nd value + for( unsigned int i = 1; i < emFractionBinsHGCal.size(); i++) + { + if(em_frac <= emFractionBinsHGCal.at(i)) break; + em_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < absEtaBinsHGCal.size(); i++) + { + if(abs_eta <= absEtaBinsHGCal.at(i)) break; + eta_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < jetPtBins.size(); i++) + { + if(tmp_jet_pt <= jetPtBins.at(i)) break; + pt_index++; + } + //printf("HGCal calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); + calib = calibrationsHGCal[ eta_index ][ em_index ][ pt_index ]; + } // end HGCal + else // HF + { + // Start loop checking 2nd value + for( unsigned int i = 1; i < emFractionBinsHF.size(); i++) + { + if(em_frac <= emFractionBinsHF.at(i)) break; + em_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < absEtaBinsHF.size(); i++) + { + if(abs_eta <= absEtaBinsHF.at(i)) break; + eta_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < jetPtBins.size(); i++) + { + if(tmp_jet_pt <= jetPtBins.at(i)) break; + pt_index++; + } + //printf("HF calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); + calib = calibrationsHF[ eta_index ][ em_index ][ pt_index ]; + } // end HF + + //printf(" - jet pt %f index %i\n", jet_pt, int(pt_index)); + //printf(" --- calibration: %f\n", calibrations[ em_index ][ eta_index ][ pt_index ] ); + + if(calib > 5 && debug) + { + printf(" - l1eg %f, ecal %f, jet %f, em frac %f index %i\n", ecal_L1EG_jet_pt, ecal_pt, jet_pt, em_frac, int(em_index)); + printf(" - eta %f, abs eta %f index %i\n", jet_eta, abs_eta, int(eta_index)); + printf(" - jet pt %f tmp_jet_pt %f index %i\n", jet_pt, tmp_jet_pt, int(pt_index)); + printf(" --- calibration: %f\n\n", calib ); + } + return calib; +} + + + +// Apply calibrations to tau pT based on L1EG info, EM Fraction, Tau Eta, Tau pT +float +L1CaloJetProducer::get_tau_pt_calibration( float &tau_pt, float &ecal_pt, + float &l1EG_pt, float &n_L1EGs, float &tau_eta ) const +{ + + float em_frac = (l1EG_pt + ecal_pt) / tau_pt; + float abs_eta = fabs( tau_eta ); + float tmp_tau_pt = tau_pt; + if (tmp_tau_pt > 199) tmp_tau_pt = 199; + + // Different indices sizes in different calo regions. + // Barrel... + size_t em_index = 0; + size_t eta_index = 0; + size_t n_L1EG_index = 0; + size_t pt_index = 0; + float calib = 1.0; + // HERE + if (abs_eta <= 1.5) + { + // Start loop checking 1st value + for( unsigned int i = 0; i < tauL1egValuesBarrel.size(); i++) + { + if(n_L1EGs == tauL1egValuesBarrel.at(i)) break; + if(tauL1egValuesBarrel.at(i) == tauL1egValuesBarrel.back()) break; // to preven incrementing on last one + n_L1EG_index++; + } + + // Find key value pair matching n L1EGs + for( auto &l1eg_info : tauL1egInfoMapBarrel ) + { + if(l1eg_info.first != double(n_L1EG_index)) continue; + // Start loop checking 2nd value + for( unsigned int i = 1; i < l1eg_info.second.size(); i++) + { + if(em_frac <= l1eg_info.second.at(i)) break; + em_index++; + } + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < tauAbsEtaBinsBarrel.size(); i++) + { + if(abs_eta <= tauAbsEtaBinsBarrel.at(i)) break; + eta_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < tauPtBins.size(); i++) + { + if(tmp_tau_pt <= tauPtBins.at(i)) break; + pt_index++; + } + //printf("Barrel tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); + calib = tauPtCalibrationsBarrel[ eta_index ][ n_L1EG_index ][ em_index ][ pt_index ]; + } // end Barrel + else if (abs_eta <= 3.0) // HGCal + { + // Start loop checking 1st value + for( unsigned int i = 0; i < tauL1egValuesHGCal.size(); i++) + { + if(n_L1EGs == tauL1egValuesHGCal.at(i)) break; + if(tauL1egValuesHGCal.at(i) == tauL1egValuesHGCal.back()) break; // to preven incrementing on last one + n_L1EG_index++; + } + + // Find key value pair matching n L1EGs + for( auto &l1eg_info : tauL1egInfoMapHGCal ) + { + if(l1eg_info.first != double(n_L1EG_index)) continue; + // Start loop checking 2nd value + for( unsigned int i = 1; i < l1eg_info.second.size(); i++) + { + if(em_frac <= l1eg_info.second.at(i)) break; + em_index++; + } + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < tauAbsEtaBinsHGCal.size(); i++) + { + if(abs_eta <= tauAbsEtaBinsHGCal.at(i)) break; + eta_index++; + } + + // Start loop checking 2nd value + for( unsigned int i = 1; i < tauPtBins.size(); i++) + { + if(tmp_tau_pt <= tauPtBins.at(i)) break; + pt_index++; + } + //printf("HGCal tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); + calib = tauPtCalibrationsHGCal[ eta_index ][ n_L1EG_index ][ em_index ][ pt_index ]; + } // end HGCal + else return calib; + + //printf(" - tau pt %f index %i\n", tau_pt, int(pt_index)); + //printf(" --- calibration: %f\n", calib ); + + if(calib > 5 && debug) + { + printf(" - l1eg %f, ecal %f, tau %f, em frac %f index %i\n", l1EG_pt, ecal_pt, tau_pt, em_frac, int(em_index)); + printf(" - eta %f, abs eta %f index %i\n", tau_eta, abs_eta, int(eta_index)); + printf(" - tau pt %f tmp_tau_pt %f index %i\n", tau_pt, tmp_tau_pt, int(pt_index)); + printf(" --- calibration: %f\n\n", calib ); + } + return calib; +} + + + + +// Loose IsoTau WP +int +L1CaloJetProducer::loose_iso_tau_wp( float &tau_pt, float &tau_iso_et, float &tau_eta ) const +{ + // Fully relaxed above 100 GeV pT + if (tau_pt > 100) + { + return 1; + } + // Split by barrel and HGCal + // with Barrel first + if (fabs(tau_eta) < 1.5) + { + if (isoTauBarrel.Eval(tau_pt) >= (tau_iso_et / tau_pt)) + { + return 1; + } + else + { + return 0; + } + } + // HGCal + if (fabs(tau_eta) < 3.0) + { + if (isoTauHGCal.Eval(tau_pt) >= (tau_iso_et / tau_pt)) + { + return 1; + } + else + { + return 0; + } + } + // Beyond HGCal + return 0; +} + + +DEFINE_FWK_MODULE(L1CaloJetProducer); diff --git a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc new file mode 100644 index 0000000000000..02ebab69dd404 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc @@ -0,0 +1,584 @@ +// -*- C++ -*- +// +// Package: L1CaloTrigger +// Class: L1TowerCalibrator +// +/**\class L1TowerCalibrator L1TowerCalibrator.cc + +Description: +Take the calibrated unclustered ECAL energy and total HCAL +energy associated with the L1CaloTower collection output +from L1EGammaCrystalsEmulatorProducer: l1CaloTowerCollection, "L1CaloTowerCollection" + +as well as HGCal Tower level inputs: +BXVector<l1t::HGCalTower> "hgcalTriggerPrimitiveDigiProducer" "tower" "HLT" + +and HCAL HF inputs from: +edm::SortedCollection<HcalTriggerPrimitiveDigi,edm::StrictWeakOrdering<HcalTriggerPrimitiveDigi> > "simHcalTriggerPrimitiveDigis" "" "HLT" + + +Implement PU-based calibrations which scale down the ET +in the towers based on mapping nTowers with ECAL(HCAL) ET <= defined PU threshold. +This value has been shown to be similar between TTbar, QCD, and minBias samples. +This allows a prediction of nvtx. Which can be mapped to the total minBias +energy in an eta slice of the detector. Subtract the total estimated minBias energy +per eta slice divided by nTowers in that eta slice from each trigger tower in +that eta slice. + +This is all ECAL / HCAL specific or EM vs. Hadronic for HGCal. + +Implementation: +[Notes on implementation] +*/ +// +// Original Author: Tyler Ruggles +// Created: Thu Nov 15 2018 +// $Id$ +// +// + + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include <iostream> + +#include "DataFormats/L1TCalorimeterPhase2/interface/CaloTower.h" +#include "DataFormats/L1THGCal/interface/HGCalTower.h" +#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" + +#include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h" +#include "CalibFormats/CaloTPG/interface/CaloTPGRecord.h" + +#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h" + +#include "TFile.h" +#include "TF1.h" + + +class L1TowerCalibrator : public edm::EDProducer { + public: + explicit L1TowerCalibrator(const edm::ParameterSet&); + + private: + virtual void produce(edm::Event&, const edm::EventSetup&); + + double HcalTpEtMin; + double EcalTpEtMin; + double HGCalHadTpEtMin; + double HGCalEmTpEtMin; + double HFTpEtMin; + double puThreshold; + double puThresholdL1eg; + double puThresholdHcalMin; + double puThresholdHcalMax; + double puThresholdEcalMin; + double puThresholdEcalMax; + double puThresholdHGCalEMMin; + double puThresholdHGCalEMMax; + double puThresholdHGCalHadMin; + double puThresholdHGCalHadMax; + double puThresholdHFMin; + double puThresholdHFMax; + double barrelSF; + double hgcalSF; + double hfSF; + bool debug; + bool skipCalibrations; + + edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowerToken_; + edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle; + + edm::EDGetTokenT<l1t::HGCalTowerBxCollection> hgcalTowersToken_; + edm::Handle<l1t::HGCalTowerBxCollection> hgcalTowersHandle; + l1t::HGCalTowerBxCollection hgcalTowers; + + edm::EDGetTokenT<HcalTrigPrimDigiCollection> hcalToken_; + edm::Handle<HcalTrigPrimDigiCollection> hcalTowerHandle; + edm::ESHandle<CaloTPGTranscoder> decoder_; + + // nHits to nvtx functions + std::vector<edm::ParameterSet> nHits_to_nvtx_params; + std::map< std::string, TF1 > nHits_to_nvtx_funcs; + + // nvtx to PU subtraction functions + std::vector<edm::ParameterSet> nvtx_to_PU_sub_params; + std::map< std::string, TF1 > ecal_nvtx_to_PU_sub_funcs; + std::map< std::string, TF1 > hcal_nvtx_to_PU_sub_funcs; + std::map< std::string, TF1 > hgcalEM_nvtx_to_PU_sub_funcs; + std::map< std::string, TF1 > hgcalHad_nvtx_to_PU_sub_funcs; + std::map< std::string, TF1 > hf_nvtx_to_PU_sub_funcs; + std::map< std::string, std::map< std::string, TF1 > > all_nvtx_to_PU_sub_funcs; + +}; + +L1TowerCalibrator::L1TowerCalibrator(const edm::ParameterSet& iConfig) : + HcalTpEtMin(iConfig.getParameter<double>("HcalTpEtMin")), + EcalTpEtMin(iConfig.getParameter<double>("EcalTpEtMin")), + HGCalHadTpEtMin(iConfig.getParameter<double>("HGCalHadTpEtMin")), + HGCalEmTpEtMin(iConfig.getParameter<double>("HGCalEmTpEtMin")), + HFTpEtMin(iConfig.getParameter<double>("HFTpEtMin")), + puThreshold(iConfig.getParameter<double>("puThreshold")), + puThresholdL1eg(iConfig.getParameter<double>("puThresholdL1eg")), + puThresholdHcalMin(iConfig.getParameter<double>("puThresholdHcalMin")), + puThresholdHcalMax(iConfig.getParameter<double>("puThresholdHcalMax")), + puThresholdEcalMin(iConfig.getParameter<double>("puThresholdEcalMin")), + puThresholdEcalMax(iConfig.getParameter<double>("puThresholdEcalMax")), + puThresholdHGCalEMMin(iConfig.getParameter<double>("puThresholdHGCalEMMin")), + puThresholdHGCalEMMax(iConfig.getParameter<double>("puThresholdHGCalEMMax")), + puThresholdHGCalHadMin(iConfig.getParameter<double>("puThresholdHGCalHadMin")), + puThresholdHGCalHadMax(iConfig.getParameter<double>("puThresholdHGCalHadMax")), + puThresholdHFMin(iConfig.getParameter<double>("puThresholdHFMin")), + puThresholdHFMax(iConfig.getParameter<double>("puThresholdHFMax")), + barrelSF(iConfig.getParameter<double>("barrelSF")), + hgcalSF(iConfig.getParameter<double>("hgcalSF")), + hfSF(iConfig.getParameter<double>("hfSF")), + debug(iConfig.getParameter<bool>("debug")), + skipCalibrations(iConfig.getParameter<bool>("skipCalibrations")), + l1TowerToken_(consumes< l1tp2::CaloTowerCollection >(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))), + hgcalTowersToken_(consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("L1HgcalTowersInputTag"))), + hcalToken_(consumes<HcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalDigis"))), + nHits_to_nvtx_params(iConfig.getParameter< std::vector<edm::ParameterSet> >("nHits_to_nvtx_params")), + nvtx_to_PU_sub_params(iConfig.getParameter< std::vector<edm::ParameterSet> >("nvtx_to_PU_sub_params")) +{ + + + // Initialize the nHits --> nvtx functions + for ( uint i = 0; i < nHits_to_nvtx_params.size(); i++ ) + { + edm::ParameterSet * pset = &nHits_to_nvtx_params.at(i); + std::string calo = pset->getParameter< std::string >("fit"); + nHits_to_nvtx_funcs[ calo.c_str() ] = TF1( calo.c_str(), "[0] + [1] * x"); + nHits_to_nvtx_funcs[ calo.c_str() ].SetParameter( 0, pset->getParameter< std::vector<double> >("params").at(0) ); + nHits_to_nvtx_funcs[ calo.c_str() ].SetParameter( 1, pset->getParameter< std::vector<double> >("params").at(1) ); + + if(debug) + { + printf("nHits_to_nvtx_params[%i]\n \ + fit: %s \n \ + p1: %f \n \ + p2 %f \n", i, calo.c_str(), + nHits_to_nvtx_funcs[ calo.c_str() ].GetParameter( 0 ), + nHits_to_nvtx_funcs[ calo.c_str() ].GetParameter( 1 ) ); + } + } + + + + + // Initialize the nvtx --> PU subtraction functions + all_nvtx_to_PU_sub_funcs[ "ecal" ] = ecal_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs[ "hcal" ] = hcal_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs[ "hgcalEM" ] = hgcalEM_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs[ "hgcalHad" ] = hgcalHad_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs[ "hf" ] = hf_nvtx_to_PU_sub_funcs; + + for ( uint i = 0; i < nvtx_to_PU_sub_params.size(); i++ ) + { + edm::ParameterSet * pset = &nvtx_to_PU_sub_params.at(i); + std::string calo = pset->getParameter< std::string >("calo"); + std::string iEta = pset->getParameter< std::string >("iEta"); + double p1 = pset->getParameter< std::vector<double> >("params").at(0); + double p2 = pset->getParameter< std::vector<double> >("params").at(1); + + all_nvtx_to_PU_sub_funcs[ calo.c_str() ][ iEta.c_str() ] = TF1( calo.c_str(), "[0] + [1] * x"); + all_nvtx_to_PU_sub_funcs[ calo.c_str() ][ iEta.c_str() ].SetParameter( 0, p1 ); + all_nvtx_to_PU_sub_funcs[ calo.c_str() ][ iEta.c_str() ].SetParameter( 1, p2 ); + + if(debug) + { + printf("nvtx_to_PU_sub_params[%i]\n \ + sub detector: %s \n \ + iEta: %s \n \ + p1: %f \n \ + p2 %f \n", i, calo.c_str(), iEta.c_str(), p1, p2 ); + } + } + + + + // Our two outputs, calibrated towers and estimated nvtx for fun + produces< l1tp2::CaloTowerCollection >("L1CaloTowerCalibratedCollection"); + produces< double >("EstimatedNvtx"); + +} + +void L1TowerCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) +{ + + + + // Estimated number of vertices used for calibration estimattion + std::unique_ptr< double > EstimatedNvtx(new double); + // Calibrated output collection + std::unique_ptr< l1tp2::CaloTowerCollection > L1CaloTowerCalibratedCollection(new l1tp2::CaloTowerCollection); + + + + + + + // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc + iEvent.getByToken(l1TowerToken_,l1CaloTowerHandle); + + // HGCal info + iEvent.getByToken(hgcalTowersToken_,hgcalTowersHandle); + hgcalTowers = (*hgcalTowersHandle.product()); + + // HF Tower info + iEvent.getByToken(hcalToken_,hcalTowerHandle); + + // Barrel ECAL (unclustered) and HCAL + for (auto& hit : *l1CaloTowerHandle.product()) + { + + l1tp2::CaloTower l1Hit; + l1Hit.setEcalTowerEt(hit.ecalTowerEt()); + l1Hit.setHcalTowerEt(hit.hcalTowerEt()); + l1Hit.setL1egTowerEt(hit.l1egTowerEt()); + // Add min ET thresholds for tower ET + if (l1Hit.ecalTowerEt() < EcalTpEtMin) l1Hit.setEcalTowerEt(0.0); + if (l1Hit.hcalTowerEt() < HcalTpEtMin) l1Hit.setHcalTowerEt(0.0); + l1Hit.setTowerIEta(hit.towerIEta()); + l1Hit.setTowerIPhi(hit.towerIPhi()); + l1Hit.setTowerEta(hit.towerEta()); + l1Hit.setTowerPhi(hit.towerPhi()); + l1Hit.setIsBarrel(hit.isBarrel()); + l1Hit.setNL1eg(hit.nL1eg()); + l1Hit.setL1egTrkSS(hit.l1egTrkSS()); + l1Hit.setL1egTrkIso(hit.l1egTrkIso()); + l1Hit.setL1egStandaloneSS(hit.l1egStandaloneSS()); + l1Hit.setL1egStandaloneIso(hit.l1egStandaloneIso()); + + // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is + // returning towers with minimal ECAL energy, and no HCAL energy with these + // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. + // Skip these for the time being until the upstream code has been debugged + if ((int)l1Hit.towerIEta() == -1016 && (int)l1Hit.towerIPhi() == -962) continue; + + + (*L1CaloTowerCalibratedCollection).push_back( l1Hit ); + if (debug) printf("Barrel tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", (int)l1Hit.towerIEta(), (int)l1Hit.towerIPhi(), l1Hit.towerEta(), l1Hit.towerPhi(), l1Hit.ecalTowerEt(), l1Hit.hcalTowerEt()); + } + + // Loop over HGCalTowers and create L1CaloTowers for them and add to collection + // This iterator is taken from the PF P2 group + // https://github.com/p2l1pfp/cmssw/blob/170808db68038d53794bc65fdc962f8fc337a24d/L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFCaloProducer.cc#L278-L289 + for (auto it = hgcalTowers.begin(0), ed = hgcalTowers.end(0); it != ed; ++it) + { + // skip lowest ET towers + if (it->etEm() < HGCalEmTpEtMin && it->etHad() < HGCalHadTpEtMin) continue; + + l1tp2::CaloTower l1Hit; + // Set energies normally, but need to zero if below threshold + if (it->etEm() < HGCalEmTpEtMin) l1Hit.setEcalTowerEt(0.); + else l1Hit.setEcalTowerEt(it->etEm()); + + if (it->etHad() < HGCalHadTpEtMin) l1Hit.setHcalTowerEt(0.); + else l1Hit.setHcalTowerEt(it->etHad()); + + l1Hit.setTowerEta(it->eta()); + l1Hit.setTowerPhi(it->phi()); + l1Hit.setTowerIEta(-98); // -98 mean HGCal + l1Hit.setTowerIPhi(-98); + l1Hit.setIsBarrel(false); + (*L1CaloTowerCalibratedCollection).push_back( l1Hit ); + if (debug) printf("HGCal tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", (int)l1Hit.towerIEta(), (int)l1Hit.towerIPhi(), l1Hit.towerEta(), l1Hit.towerPhi(), l1Hit.ecalTowerEt(), l1Hit.hcalTowerEt()); + } + + + // Loop over Hcal HF tower inputs and create L1CaloTowers and add to + // L1CaloTowerCalibratedCollection collection + iSetup.get<CaloTPGRecord>().get(decoder_); + for (const auto & hit : *hcalTowerHandle.product()) { + HcalTrigTowerDetId id = hit.id(); + double et = decoder_->hcaletValue(hit.id(), hit.t0()); + if (et < HFTpEtMin) continue; + // Only doing HF so skip outside range + if ( abs(id.ieta()) < l1t::CaloTools::kHFBegin ) continue; + if ( abs(id.ieta()) > l1t::CaloTools::kHFEnd ) continue; + + l1tp2::CaloTower l1Hit; + l1Hit.setEcalTowerEt(0.); + l1Hit.setHcalTowerEt(et); + l1Hit.setTowerEta(l1t::CaloTools::towerEta(id.ieta())); + l1Hit.setTowerPhi(l1t::CaloTools::towerPhi(id.ieta(), id.iphi())); + l1Hit.setTowerIEta(id.ieta()); + l1Hit.setTowerIPhi(id.iphi()); + l1Hit.setIsBarrel(false); + (*L1CaloTowerCalibratedCollection).push_back( l1Hit ); + + if (debug) printf("HCAL HF tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", (int)l1Hit.towerIEta(), (int)l1Hit.towerIPhi(), l1Hit.towerEta(), l1Hit.towerPhi(), l1Hit.ecalTowerEt(), l1Hit.hcalTowerEt()); + } + + + + // N Tower totals + // For mapping to estimated nvtx in event + int i_ecal_hits_leq_threshold = 0; + int i_hgcalEM_hits_leq_threshold = 0; + int i_hcal_hits_leq_threshold = 0; + int i_hgcalHad_hits_leq_threshold = 0; + int i_hf_hits_leq_threshold = 0; + + + // Loop over the collection containing all hits + // and calculate the number of hits falling into the + // "less than or equal" nTowers variable which maps to + // estimated number of vertices + for (auto &l1CaloTower : (*L1CaloTowerCalibratedCollection) ) + { + + + // Barrel ECAL + if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) + { + if(l1CaloTower.ecalTowerEt() <= puThresholdEcalMax && l1CaloTower.ecalTowerEt() >= puThresholdEcalMin) + { + i_ecal_hits_leq_threshold++; + } + } + + + // HGCal EM + if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) + { + if(l1CaloTower.ecalTowerEt() <= puThresholdHGCalEMMax && l1CaloTower.ecalTowerEt() >= puThresholdHGCalEMMin) + { + i_hgcalEM_hits_leq_threshold++; + } + } + + + // Barrel HCAL + if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF + { + if(l1CaloTower.hcalTowerEt() <= puThresholdHcalMax && l1CaloTower.hcalTowerEt() >= puThresholdHcalMin) + { + i_hcal_hits_leq_threshold++; + } + } + + + // HGCal Had + if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) + { + if(l1CaloTower.hcalTowerEt() <= puThresholdHGCalHadMax && l1CaloTower.hcalTowerEt() >= puThresholdHGCalHadMin) + { + i_hgcalHad_hits_leq_threshold++; + } + } + + // HF + if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF + { + if(l1CaloTower.hcalTowerEt() <= puThresholdHFMax && l1CaloTower.hcalTowerEt() >= puThresholdHFMin) + { + i_hf_hits_leq_threshold++; + } + } + } + + + + // For each subdetector, map to the estimated number of vertices + double ecal_nvtx = nHits_to_nvtx_funcs[ "ecal" ].Eval( i_ecal_hits_leq_threshold ); + double hcal_nvtx = nHits_to_nvtx_funcs[ "hcal" ].Eval( i_hcal_hits_leq_threshold ); + double hgcalEM_nvtx = nHits_to_nvtx_funcs[ "hgcalEM" ].Eval( i_hgcalEM_hits_leq_threshold ); + double hgcalHad_nvtx = nHits_to_nvtx_funcs[ "hgcalHad" ].Eval( i_hgcalHad_hits_leq_threshold ); + double hf_nvtx = nHits_to_nvtx_funcs[ "hf" ].Eval( i_hf_hits_leq_threshold ); + // Make sure all values are >= 0 + if (ecal_nvtx < 0) ecal_nvtx = 0; + if (hcal_nvtx < 0) hcal_nvtx = 0; + if (hgcalEM_nvtx < 0) hgcalEM_nvtx = 0; + if (hgcalHad_nvtx < 0) hgcalHad_nvtx = 0; + if (hf_nvtx < 0) hf_nvtx = 0; + // Best estimate is avg of all except HF. + // This is b/c HF currently has such poor prediction power, it only degrades the avg result + // NEW, with 10_3_X, hgcal and HF has the best results based on the values I took... + // skip ECAL and HCAL + //*EstimatedNvtx = ( ecal_nvtx + hcal_nvtx + hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx ) / 3.; + *EstimatedNvtx = ( hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx ) / 3.; + + + + + if(debug) + { + double lumi = iEvent.eventAuxiliary().luminosityBlock(); + double event = iEvent.eventAuxiliary().event(); + + printf("L1TowerCalibrater: lumi %.0f evt %.0f nTowers for subdetecters \ + \nECAL: %i --> nvtx = %.1f \ + \nHGCal EM: %i --> nvtx = %.1f \ + \nHCAL: %i --> nvtx = %.1f \ + \nHGCal Had: %i --> nvtx = %.1f \ + \nHCAL HF: %i --> nvtx = %.1f \ + \nEstimated Nvtx = %.1f\n", lumi, event, + i_ecal_hits_leq_threshold, ecal_nvtx, + i_hgcalEM_hits_leq_threshold, hgcalEM_nvtx, + i_hcal_hits_leq_threshold, hcal_nvtx, + i_hgcalHad_hits_leq_threshold, hgcalHad_nvtx, + i_hf_hits_leq_threshold, hf_nvtx, + *EstimatedNvtx ); + } + + + + + // Use estimated number of vertices to subtract off PU contributions + // to each and every hit. In cases where the energy would go negative, + // limit this to zero. + if (!skipCalibrations) // skipCalibrations simply passes the towers through + { + for (auto &l1CaloTower : (*L1CaloTowerCalibratedCollection) ) + { + + // Barrel ECAL eta slices + if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) + { + if( abs(l1CaloTower.towerIEta()) <= 3 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er1to3" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er4to6" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er7to9" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er10to12" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er13to15" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er16to18" ].Eval( *EstimatedNvtx ) * barrelSF); + } + } + + + // HGCal EM eta slices + if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) + { + if( abs(l1CaloTower.towerEta()) <= 1.8 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er1p4to1p8" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er1p8to2p1" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er2p1to2p4" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er2p4to2p7" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7 ) + { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er2p7to3p1" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + } + + // Barrel HCAL eta slices + if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF + { + if( abs(l1CaloTower.towerIEta()) <= 3 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er1to3" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er4to6" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er7to9" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er10to12" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er13to15" ].Eval( *EstimatedNvtx ) * barrelSF); + } + if( abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er16to18" ].Eval( *EstimatedNvtx ) * barrelSF); + } + } + + // HGCal Had eta slices + if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) + { + if( abs(l1CaloTower.towerEta()) <= 1.8 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er1p4to1p8" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er1p8to2p1" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er2p1to2p4" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er2p4to2p7" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + if( abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er2p7to3p1" ].Eval( *EstimatedNvtx ) * hgcalSF); + } + } + + // HF eta slices + if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF + { + if( abs(l1CaloTower.towerIEta()) <= 33 && abs(l1CaloTower.towerIEta()) >= 29 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hf" ][ "er29to33" ].Eval( *EstimatedNvtx ) * hfSF); + } + if( abs(l1CaloTower.towerIEta()) <= 37 && abs(l1CaloTower.towerIEta()) >= 34 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hf" ][ "er34to37" ].Eval( *EstimatedNvtx ) * hfSF); + } + if( abs(l1CaloTower.towerIEta()) <= 41 && abs(l1CaloTower.towerIEta()) >= 38 ) + { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hf" ][ "er38to41" ].Eval( *EstimatedNvtx ) * hfSF); + } + } + + + // Make sure none are negative + if(l1CaloTower.ecalTowerEt() < 0.) l1CaloTower.setEcalTowerEt(0.); + if(l1CaloTower.hcalTowerEt() < 0.) l1CaloTower.setHcalTowerEt(0.); + } + } + + + + iEvent.put(std::move(EstimatedNvtx),"EstimatedNvtx"); + iEvent.put(std::move(L1CaloTowerCalibratedCollection),"L1CaloTowerCalibratedCollection"); +} + + + +DEFINE_FWK_MODULE(L1TowerCalibrator); diff --git a/L1Trigger/L1CaloTrigger/python/L1CaloJetHTTProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/L1CaloJetHTTProducer_cfi.py new file mode 100644 index 0000000000000..11650c362daf3 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/L1CaloJetHTTProducer_cfi.py @@ -0,0 +1,10 @@ +import FWCore.ParameterSet.Config as cms + +L1CaloJetHTTProducer = cms.EDProducer("L1CaloJetHTTProducer", + EtaMax = cms.double(2.4), + PtMin = cms.double(30.0), + BXVCaloJetsInputTag = cms.InputTag("L1CaloJetProducer","L1CaloJetCollectionBXV"), + genJets = cms.InputTag("ak4GenJetsNoNu", "", "HLT"), + debug = cms.bool(False), + use_gen_jets = cms.bool(False), +) diff --git a/L1Trigger/L1CaloTrigger/python/L1CaloJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/L1CaloJetProducer_cfi.py new file mode 100644 index 0000000000000..3e839133f18ca --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/L1CaloJetProducer_cfi.py @@ -0,0 +1,164 @@ +import FWCore.ParameterSet.Config as cms + +L1CaloJetProducer = cms.EDProducer("L1CaloJetProducer", + debug = cms.bool(False), + HcalTpEtMin = cms.double(0.5), + EcalTpEtMin = cms.double(0.5), + HGCalHadTpEtMin = cms.double(0.5), + HGCalEmTpEtMin = cms.double(0.5), + HFTpEtMin = cms.double(0.5), + EtMinForSeedHit = cms.double(2.5), # was 2.5 + EtMinForCollection = cms.double(10), + EtMinForTauCollection = cms.double(10), + l1CaloTowers = cms.InputTag("L1TowerCalibrationProducer","L1CaloTowerCalibratedCollection"), + L1CrystalClustersInputTag = cms.InputTag("L1EGammaClusterEmuProducer", "L1EGXtalClusterEmulator"), + #L1HgcalTowersInputTag = cms.InputTag("hgcalTriggerPrimitiveDigiProducer","tower"), + #hcalDigis = cms.InputTag("simHcalTriggerPrimitiveDigis"), + + # Calibrations derived 18 April 2019 on 10_3_X MTD QCD sample + jetPtBins = cms.vdouble([ 0.0,5.0,7.5,10.0,12.5,15.0,17.5,20.0,22.5,25.0,27.5,30.0,35.0,40.0,45.0,50.0,55.0,60.0,65.0,70.0,75.0,80.0,85.0,90.0,95.0,100.0,110.0,120.0,130.0,140.0,150.0,160.0,170.0,180.0,190.0,200.0,225.0,250.0,275.0,300.0,325.0,400.0,500.0]), + emFractionBinsBarrel = cms.vdouble([ 0.00,0.31,0.40,0.47,0.53,0.58,0.63,0.69,0.76,0.84,1.05]), + absEtaBinsBarrel = cms.vdouble([ 0.00,0.30,0.60,1.00,1.50]), + jetCalibrationsBarrel = cms.vdouble([ + 1.640, 1.626, 1.617, 1.608, 1.599, 1.591, 1.583, 1.574, 1.566, 1.559, 1.551, 1.540, 1.525, 1.512, 1.498, 1.486, 1.474, 1.462, 1.451, 1.441, 1.431, 1.421, 1.412, 1.404, 1.396, 1.385, 1.372, 1.360, 1.350, 1.341, 1.334, 1.329, 1.325, 1.322, 1.320, 1.320, 1.325, 1.336, 1.352, 1.373, 1.428, 1.553, + 1.855, 1.839, 1.829, 1.819, 1.809, 1.800, 1.790, 1.781, 1.771, 1.762, 1.753, 1.740, 1.723, 1.706, 1.690, 1.674, 1.659, 1.645, 1.631, 1.617, 1.604, 1.591, 1.579, 1.568, 1.556, 1.540, 1.520, 1.501, 1.484, 1.469, 1.454, 1.441, 1.430, 1.419, 1.410, 1.396, 1.382, 1.374, 1.370, 1.372, 1.386, 1.443, + 1.993, 1.978, 1.967, 1.957, 1.947, 1.937, 1.927, 1.918, 1.908, 1.898, 1.889, 1.875, 1.857, 1.839, 1.822, 1.805, 1.789, 1.773, 1.757, 1.742, 1.727, 1.713, 1.699, 1.685, 1.672, 1.653, 1.629, 1.606, 1.584, 1.564, 1.545, 1.527, 1.511, 1.495, 1.481, 1.459, 1.434, 1.414, 1.400, 1.392, 1.391, 1.431, + 2.155, 2.135, 2.123, 2.110, 2.097, 2.085, 2.073, 2.061, 2.049, 2.037, 2.026, 2.009, 1.987, 1.965, 1.944, 1.924, 1.905, 1.885, 1.867, 1.849, 1.832, 1.815, 1.798, 1.783, 1.767, 1.745, 1.717, 1.691, 1.666, 1.643, 1.622, 1.602, 1.583, 1.566, 1.550, 1.525, 1.495, 1.470, 1.451, 1.437, 1.422, 1.424, + 2.305, 2.284, 2.271, 2.257, 2.244, 2.231, 2.218, 2.205, 2.193, 2.180, 2.168, 2.150, 2.126, 2.103, 2.081, 2.059, 2.037, 2.017, 1.996, 1.976, 1.957, 1.938, 1.920, 1.902, 1.884, 1.859, 1.827, 1.797, 1.768, 1.741, 1.715, 1.691, 1.668, 1.647, 1.627, 1.595, 1.556, 1.523, 1.497, 1.477, 1.451, 1.446, + 2.555, 2.528, 2.510, 2.492, 2.474, 2.457, 2.440, 2.423, 2.406, 2.390, 2.373, 2.349, 2.318, 2.288, 2.258, 2.229, 2.201, 2.174, 2.148, 2.122, 2.097, 2.072, 2.049, 2.026, 2.004, 1.971, 1.930, 1.892, 1.856, 1.822, 1.790, 1.761, 1.733, 1.707, 1.683, 1.645, 1.600, 1.563, 1.535, 1.515, 1.493, 1.505, + 2.850, 2.815, 2.792, 2.770, 2.747, 2.725, 2.703, 2.682, 2.661, 2.640, 2.619, 2.589, 2.549, 2.511, 2.473, 2.437, 2.401, 2.367, 2.334, 2.301, 2.270, 2.239, 2.209, 2.181, 2.153, 2.112, 2.062, 2.014, 1.969, 1.927, 1.888, 1.852, 1.818, 1.787, 1.758, 1.712, 1.658, 1.616, 1.585, 1.563, 1.544, 1.576, + 3.386, 3.325, 3.286, 3.248, 3.210, 3.174, 3.138, 3.103, 3.069, 3.036, 3.004, 2.956, 2.896, 2.838, 2.783, 2.730, 2.680, 2.632, 2.586, 2.543, 2.501, 2.461, 2.423, 2.387, 2.352, 2.303, 2.242, 2.187, 2.136, 2.090, 2.047, 2.008, 1.973, 1.940, 1.910, 1.863, 1.806, 1.760, 1.721, 1.688, 1.636, 1.572, + 4.450, 4.344, 4.276, 4.210, 4.146, 4.083, 4.022, 3.962, 3.904, 3.847, 3.792, 3.712, 3.610, 3.513, 3.420, 3.333, 3.250, 3.171, 3.096, 3.025, 2.958, 2.894, 2.833, 2.776, 2.721, 2.645, 2.552, 2.468, 2.393, 2.325, 2.265, 2.210, 2.162, 2.118, 2.079, 2.021, 1.956, 1.908, 1.873, 1.849, 1.822, 1.818, + 6.912, 6.764, 6.667, 6.571, 6.477, 6.384, 6.293, 6.203, 6.114, 6.027, 5.941, 5.814, 5.650, 5.491, 5.336, 5.187, 5.042, 4.903, 4.767, 4.637, 4.511, 4.389, 4.272, 4.159, 4.050, 3.894, 3.700, 3.522, 3.359, 3.210, 3.076, 2.954, 2.846, 2.750, 2.667, 2.549, 2.438, 2.390, 2.400, 2.463, 2.731, 3.577, + 1.536, 1.527, 1.521, 1.515, 1.509, 1.503, 1.497, 1.491, 1.486, 1.480, 1.475, 1.467, 1.457, 1.447, 1.437, 1.428, 1.419, 1.411, 1.403, 1.395, 1.388, 1.380, 1.374, 1.367, 1.361, 1.353, 1.342, 1.333, 1.325, 1.319, 1.313, 1.309, 1.305, 1.303, 1.302, 1.302, 1.307, 1.317, 1.333, 1.354, 1.409, 1.544, + 1.740, 1.730, 1.723, 1.716, 1.709, 1.702, 1.696, 1.689, 1.683, 1.676, 1.670, 1.661, 1.648, 1.636, 1.624, 1.613, 1.602, 1.590, 1.580, 1.569, 1.559, 1.549, 1.539, 1.530, 1.521, 1.507, 1.490, 1.474, 1.459, 1.445, 1.432, 1.420, 1.409, 1.399, 1.389, 1.375, 1.360, 1.350, 1.345, 1.346, 1.363, 1.439, + 1.869, 1.858, 1.851, 1.843, 1.836, 1.829, 1.822, 1.815, 1.808, 1.801, 1.795, 1.785, 1.771, 1.758, 1.746, 1.733, 1.721, 1.709, 1.697, 1.686, 1.674, 1.663, 1.652, 1.642, 1.631, 1.616, 1.597, 1.578, 1.560, 1.543, 1.527, 1.512, 1.498, 1.485, 1.472, 1.452, 1.427, 1.408, 1.393, 1.383, 1.377, 1.407, + 2.010, 1.997, 1.988, 1.980, 1.971, 1.963, 1.954, 1.946, 1.938, 1.930, 1.922, 1.910, 1.894, 1.879, 1.864, 1.849, 1.834, 1.820, 1.806, 1.792, 1.779, 1.766, 1.753, 1.740, 1.728, 1.709, 1.686, 1.664, 1.642, 1.622, 1.603, 1.584, 1.567, 1.550, 1.534, 1.509, 1.478, 1.451, 1.430, 1.414, 1.396, 1.407, + 2.171, 2.155, 2.144, 2.134, 2.123, 2.113, 2.103, 2.093, 2.083, 2.073, 2.063, 2.049, 2.030, 2.012, 1.994, 1.976, 1.959, 1.942, 1.925, 1.909, 1.893, 1.877, 1.862, 1.847, 1.833, 1.812, 1.785, 1.759, 1.734, 1.710, 1.688, 1.667, 1.646, 1.627, 1.609, 1.579, 1.542, 1.509, 1.482, 1.459, 1.426, 1.401, + 2.366, 2.345, 2.332, 2.319, 2.306, 2.293, 2.280, 2.268, 2.255, 2.243, 2.231, 2.213, 2.189, 2.166, 2.144, 2.122, 2.100, 2.079, 2.058, 2.038, 2.018, 1.999, 1.980, 1.962, 1.944, 1.918, 1.884, 1.853, 1.822, 1.794, 1.766, 1.741, 1.716, 1.693, 1.671, 1.636, 1.591, 1.554, 1.522, 1.497, 1.461, 1.441, + 2.680, 2.647, 2.626, 2.605, 2.584, 2.564, 2.544, 2.525, 2.506, 2.487, 2.469, 2.442, 2.407, 2.373, 2.340, 2.309, 2.278, 2.249, 2.221, 2.193, 2.167, 2.142, 2.117, 2.093, 2.070, 2.038, 1.996, 1.958, 1.922, 1.888, 1.857, 1.828, 1.801, 1.775, 1.751, 1.713, 1.666, 1.626, 1.592, 1.563, 1.516, 1.459, + 3.093, 3.051, 3.023, 2.995, 2.969, 2.942, 2.916, 2.890, 2.865, 2.840, 2.816, 2.780, 2.733, 2.688, 2.644, 2.602, 2.561, 2.522, 2.484, 2.447, 2.411, 2.376, 2.343, 2.311, 2.280, 2.235, 2.178, 2.126, 2.077, 2.031, 1.988, 1.949, 1.912, 1.878, 1.846, 1.796, 1.735, 1.685, 1.646, 1.614, 1.571, 1.543, + 4.080, 3.996, 3.941, 3.888, 3.836, 3.785, 3.735, 3.686, 3.638, 3.591, 3.546, 3.479, 3.393, 3.312, 3.233, 3.159, 3.087, 3.019, 2.953, 2.891, 2.831, 2.774, 2.720, 2.668, 2.618, 2.548, 2.462, 2.383, 2.312, 2.247, 2.188, 2.134, 2.086, 2.042, 2.003, 1.943, 1.875, 1.825, 1.788, 1.763, 1.738, 1.747, + 6.659, 6.494, 6.387, 6.282, 6.179, 6.078, 5.978, 5.881, 5.785, 5.691, 5.599, 5.463, 5.289, 5.122, 4.961, 4.806, 4.657, 4.514, 4.378, 4.246, 4.121, 4.001, 3.886, 3.776, 3.671, 3.522, 3.341, 3.177, 3.030, 2.899, 2.783, 2.682, 2.594, 2.519, 2.456, 2.373, 2.311, 2.307, 2.355, 2.447, 2.743, 3.536, + 1.519, 1.512, 1.507, 1.502, 1.498, 1.493, 1.488, 1.484, 1.479, 1.475, 1.471, 1.464, 1.456, 1.448, 1.440, 1.433, 1.425, 1.418, 1.412, 1.405, 1.399, 1.393, 1.387, 1.381, 1.376, 1.369, 1.359, 1.351, 1.344, 1.337, 1.332, 1.327, 1.323, 1.320, 1.318, 1.317, 1.319, 1.326, 1.339, 1.356, 1.404, 1.530, + 1.719, 1.710, 1.705, 1.699, 1.693, 1.688, 1.682, 1.677, 1.671, 1.666, 1.661, 1.653, 1.642, 1.632, 1.622, 1.613, 1.603, 1.594, 1.584, 1.575, 1.567, 1.558, 1.550, 1.541, 1.533, 1.522, 1.507, 1.492, 1.479, 1.466, 1.454, 1.443, 1.432, 1.422, 1.413, 1.399, 1.382, 1.369, 1.361, 1.356, 1.359, 1.401, + 1.860, 1.851, 1.844, 1.838, 1.832, 1.826, 1.820, 1.814, 1.808, 1.802, 1.796, 1.787, 1.775, 1.764, 1.753, 1.742, 1.731, 1.720, 1.710, 1.699, 1.689, 1.679, 1.669, 1.660, 1.650, 1.636, 1.618, 1.601, 1.584, 1.568, 1.553, 1.538, 1.524, 1.511, 1.498, 1.478, 1.451, 1.428, 1.410, 1.394, 1.374, 1.373, + 1.993, 1.982, 1.974, 1.967, 1.960, 1.953, 1.946, 1.938, 1.931, 1.924, 1.917, 1.907, 1.894, 1.880, 1.867, 1.854, 1.841, 1.828, 1.816, 1.804, 1.792, 1.780, 1.768, 1.757, 1.746, 1.729, 1.708, 1.687, 1.667, 1.648, 1.629, 1.612, 1.595, 1.578, 1.563, 1.537, 1.504, 1.475, 1.451, 1.430, 1.402, 1.388, + 2.146, 2.131, 2.122, 2.113, 2.104, 2.095, 2.086, 2.077, 2.068, 2.059, 2.051, 2.038, 2.021, 2.004, 1.988, 1.972, 1.957, 1.941, 1.926, 1.911, 1.897, 1.883, 1.869, 1.855, 1.842, 1.822, 1.797, 1.773, 1.749, 1.727, 1.706, 1.685, 1.665, 1.647, 1.629, 1.599, 1.561, 1.527, 1.497, 1.472, 1.431, 1.389, + 2.336, 2.319, 2.307, 2.296, 2.285, 2.273, 2.262, 2.251, 2.240, 2.230, 2.219, 2.203, 2.182, 2.162, 2.142, 2.122, 2.103, 2.084, 2.065, 2.047, 2.029, 2.012, 1.994, 1.978, 1.961, 1.937, 1.906, 1.876, 1.848, 1.820, 1.794, 1.769, 1.745, 1.722, 1.700, 1.665, 1.618, 1.578, 1.543, 1.512, 1.465, 1.420, + 2.594, 2.571, 2.556, 2.541, 2.526, 2.511, 2.497, 2.482, 2.468, 2.453, 2.439, 2.419, 2.391, 2.364, 2.338, 2.312, 2.287, 2.262, 2.238, 2.214, 2.191, 2.168, 2.146, 2.124, 2.103, 2.072, 2.032, 1.993, 1.957, 1.922, 1.889, 1.857, 1.827, 1.799, 1.772, 1.728, 1.672, 1.625, 1.585, 1.552, 1.507, 1.482, + 3.016, 2.982, 2.959, 2.937, 2.915, 2.893, 2.872, 2.851, 2.830, 2.809, 2.788, 2.758, 2.718, 2.679, 2.641, 2.604, 2.568, 2.533, 2.499, 2.465, 2.432, 2.400, 2.369, 2.339, 2.309, 2.266, 2.211, 2.160, 2.111, 2.064, 2.020, 1.979, 1.940, 1.904, 1.870, 1.815, 1.749, 1.694, 1.651, 1.618, 1.580, 1.590, + 4.054, 3.966, 3.909, 3.854, 3.800, 3.747, 3.696, 3.646, 3.597, 3.549, 3.503, 3.435, 3.348, 3.266, 3.187, 3.112, 3.041, 2.974, 2.909, 2.848, 2.790, 2.734, 2.681, 2.631, 2.583, 2.516, 2.434, 2.360, 2.292, 2.232, 2.178, 2.128, 2.084, 2.045, 2.009, 1.955, 1.895, 1.850, 1.817, 1.794, 1.769, 1.766, + 6.752, 6.570, 6.452, 6.337, 6.224, 6.113, 6.004, 5.898, 5.795, 5.693, 5.594, 5.449, 5.263, 5.085, 4.915, 4.752, 4.597, 4.449, 4.308, 4.173, 4.045, 3.923, 3.808, 3.697, 3.593, 3.446, 3.269, 3.110, 2.969, 2.846, 2.738, 2.644, 2.564, 2.497, 2.442, 2.372, 2.323, 2.327, 2.374, 2.459, 2.718, 3.371, + 1.615, 1.605, 1.599, 1.593, 1.587, 1.581, 1.575, 1.570, 1.564, 1.558, 1.553, 1.545, 1.534, 1.524, 1.514, 1.504, 1.494, 1.485, 1.476, 1.468, 1.460, 1.452, 1.444, 1.437, 1.429, 1.419, 1.407, 1.395, 1.385, 1.375, 1.367, 1.360, 1.353, 1.348, 1.344, 1.339, 1.336, 1.340, 1.349, 1.364, 1.410, 1.537, + 1.867, 1.856, 1.849, 1.841, 1.834, 1.827, 1.820, 1.813, 1.806, 1.799, 1.792, 1.782, 1.768, 1.755, 1.742, 1.730, 1.718, 1.705, 1.694, 1.682, 1.671, 1.660, 1.649, 1.638, 1.628, 1.613, 1.594, 1.575, 1.558, 1.542, 1.526, 1.512, 1.498, 1.485, 1.474, 1.455, 1.433, 1.417, 1.406, 1.401, 1.404, 1.458, + 2.037, 2.025, 2.017, 2.009, 2.001, 1.993, 1.985, 1.977, 1.970, 1.962, 1.954, 1.943, 1.928, 1.914, 1.899, 1.885, 1.871, 1.858, 1.844, 1.831, 1.818, 1.805, 1.793, 1.781, 1.769, 1.751, 1.728, 1.707, 1.686, 1.666, 1.647, 1.629, 1.612, 1.596, 1.580, 1.555, 1.524, 1.498, 1.477, 1.462, 1.445, 1.461, + 2.206, 2.192, 2.183, 2.174, 2.165, 2.156, 2.148, 2.139, 2.130, 2.122, 2.113, 2.101, 2.084, 2.068, 2.052, 2.037, 2.021, 2.006, 1.992, 1.977, 1.963, 1.949, 1.935, 1.922, 1.908, 1.889, 1.864, 1.840, 1.817, 1.795, 1.773, 1.753, 1.733, 1.714, 1.696, 1.666, 1.628, 1.593, 1.562, 1.536, 1.492, 1.444, + 2.401, 2.385, 2.375, 2.365, 2.355, 2.346, 2.336, 2.326, 2.317, 2.307, 2.298, 2.284, 2.265, 2.247, 2.229, 2.212, 2.195, 2.178, 2.161, 2.144, 2.128, 2.112, 2.097, 2.081, 2.066, 2.044, 2.015, 1.988, 1.961, 1.935, 1.910, 1.886, 1.862, 1.840, 1.818, 1.782, 1.735, 1.692, 1.653, 1.618, 1.559, 1.487, + 2.637, 2.620, 2.609, 2.599, 2.588, 2.577, 2.567, 2.556, 2.546, 2.536, 2.525, 2.510, 2.490, 2.470, 2.451, 2.432, 2.413, 2.394, 2.376, 2.357, 2.339, 2.322, 2.304, 2.287, 2.270, 2.245, 2.213, 2.182, 2.151, 2.122, 2.093, 2.065, 2.038, 2.012, 1.986, 1.944, 1.887, 1.835, 1.787, 1.742, 1.665, 1.561, + 2.952, 2.935, 2.924, 2.913, 2.902, 2.891, 2.879, 2.868, 2.858, 2.847, 2.836, 2.820, 2.798, 2.777, 2.756, 2.736, 2.715, 2.695, 2.675, 2.655, 2.635, 2.616, 2.597, 2.578, 2.559, 2.531, 2.495, 2.459, 2.424, 2.390, 2.357, 2.325, 2.293, 2.262, 2.233, 2.182, 2.114, 2.050, 1.992, 1.938, 1.844, 1.721, + 3.403, 3.388, 3.378, 3.368, 3.359, 3.349, 3.339, 3.330, 3.320, 3.311, 3.301, 3.287, 3.268, 3.249, 3.231, 3.213, 3.194, 3.176, 3.158, 3.140, 3.123, 3.105, 3.088, 3.070, 3.053, 3.028, 2.994, 2.961, 2.928, 2.896, 2.865, 2.834, 2.803, 2.773, 2.743, 2.692, 2.621, 2.554, 2.488, 2.425, 2.307, 2.120, + 4.386, 4.363, 4.347, 4.332, 4.317, 4.302, 4.287, 4.272, 4.258, 4.243, 4.229, 4.208, 4.180, 4.153, 4.127, 4.101, 4.075, 4.051, 4.026, 4.003, 3.979, 3.956, 3.934, 3.912, 3.891, 3.860, 3.821, 3.783, 3.747, 3.712, 3.680, 3.649, 3.620, 3.592, 3.566, 3.524, 3.471, 3.427, 3.390, 3.361, 3.323, 3.312, + 6.918, 6.864, 6.829, 6.794, 6.759, 6.724, 6.690, 6.656, 6.623, 6.589, 6.556, 6.507, 6.443, 6.380, 6.319, 6.258, 6.199, 6.142, 6.085, 6.030, 5.976, 5.923, 5.872, 5.821, 5.773, 5.702, 5.612, 5.528, 5.449, 5.376, 5.308, 5.245, 5.189, 5.138, 5.092, 5.027, 4.964, 4.939, 4.953, 5.005, 5.233, 6.041, + ]), + emFractionBinsHGCal = cms.vdouble([ 0.00,0.55,0.67,0.77,1.05]), + absEtaBinsHGCal = cms.vdouble([ 1.50,1.90,2.40,3.00]), + jetCalibrationsHGCal = cms.vdouble([ + 1.395, 1.394, 1.394, 1.394, 1.394, 1.394, 1.393, 1.393, 1.393, 1.393, 1.393, 1.393, 1.392, 1.392, 1.392, 1.391, 1.391, 1.391, 1.390, 1.390, 1.390, 1.389, 1.389, 1.389, 1.388, 1.388, 1.387, 1.387, 1.386, 1.385, 1.385, 1.384, 1.383, 1.383, 1.382, 1.381, 1.379, 1.378, 1.376, 1.374, 1.371, 1.365, + 1.575, 1.574, 1.574, 1.574, 1.574, 1.574, 1.573, 1.573, 1.573, 1.573, 1.572, 1.572, 1.572, 1.571, 1.571, 1.570, 1.570, 1.569, 1.569, 1.569, 1.568, 1.568, 1.567, 1.567, 1.566, 1.566, 1.565, 1.564, 1.563, 1.562, 1.561, 1.560, 1.559, 1.559, 1.558, 1.556, 1.554, 1.552, 1.549, 1.547, 1.543, 1.535, + 1.846, 1.845, 1.845, 1.844, 1.844, 1.843, 1.843, 1.842, 1.842, 1.841, 1.841, 1.840, 1.839, 1.839, 1.838, 1.837, 1.836, 1.835, 1.834, 1.833, 1.832, 1.831, 1.830, 1.829, 1.829, 1.827, 1.825, 1.824, 1.822, 1.820, 1.818, 1.816, 1.814, 1.813, 1.811, 1.808, 1.803, 1.799, 1.794, 1.790, 1.780, 1.765, + 3.377, 3.355, 3.341, 3.326, 3.312, 3.298, 3.283, 3.269, 3.255, 3.242, 3.228, 3.207, 3.180, 3.154, 3.128, 3.102, 3.077, 3.051, 3.027, 3.002, 2.979, 2.955, 2.932, 2.909, 2.886, 2.853, 2.811, 2.769, 2.729, 2.691, 2.654, 2.618, 2.584, 2.551, 2.519, 2.467, 2.400, 2.341, 2.291, 2.248, 2.186, 2.149, + 1.085, 1.087, 1.088, 1.089, 1.090, 1.091, 1.092, 1.093, 1.094, 1.095, 1.097, 1.098, 1.100, 1.103, 1.105, 1.107, 1.109, 1.111, 1.113, 1.116, 1.118, 1.120, 1.122, 1.124, 1.126, 1.130, 1.134, 1.138, 1.143, 1.147, 1.151, 1.156, 1.160, 1.164, 1.169, 1.176, 1.187, 1.198, 1.209, 1.220, 1.242, 1.280, + 61.559, 11.087, 4.083, 1.971, 1.335, 1.145, 1.090, 1.074, 1.072, 1.072, 1.074, 1.078, 1.083, 1.088, 1.093, 1.098, 1.103, 1.108, 1.112, 1.117, 1.122, 1.127, 1.132, 1.137, 1.142, 1.149, 1.159, 1.169, 1.179, 1.189, 1.199, 1.209, 1.218, 1.228, 1.238, 1.255, 1.280, 1.305, 1.329, 1.354, 1.403, 1.490, + 89.821, 15.567, 5.416, 2.387, 1.485, 1.218, 1.140, 1.119, 1.115, 1.116, 1.118, 1.123, 1.129, 1.135, 1.141, 1.147, 1.153, 1.159, 1.165, 1.171, 1.178, 1.184, 1.190, 1.196, 1.202, 1.211, 1.223, 1.236, 1.248, 1.260, 1.272, 1.284, 1.297, 1.309, 1.321, 1.342, 1.373, 1.403, 1.434, 1.464, 1.525, 1.632, + 83.760, 19.529, 8.102, 3.961, 2.461, 1.918, 1.721, 1.650, 1.624, 1.615, 1.612, 1.611, 1.611, 1.611, 1.612, 1.612, 1.613, 1.613, 1.614, 1.614, 1.615, 1.616, 1.616, 1.617, 1.617, 1.618, 1.619, 1.620, 1.621, 1.622, 1.623, 1.624, 1.625, 1.626, 1.628, 1.629, 1.632, 1.635, 1.637, 1.640, 1.645, 1.655, + 1.262, 1.261, 1.260, 1.259, 1.259, 1.258, 1.257, 1.256, 1.256, 1.255, 1.254, 1.253, 1.252, 1.250, 1.249, 1.247, 1.246, 1.244, 1.243, 1.242, 1.240, 1.239, 1.237, 1.236, 1.234, 1.232, 1.229, 1.226, 1.223, 1.221, 1.218, 1.215, 1.212, 1.209, 1.206, 1.201, 1.194, 1.186, 1.179, 1.172, 1.157, 1.132, + 1.328, 1.327, 1.326, 1.326, 1.325, 1.325, 1.324, 1.324, 1.323, 1.323, 1.322, 1.322, 1.321, 1.320, 1.319, 1.318, 1.317, 1.316, 1.315, 1.314, 1.313, 1.312, 1.311, 1.310, 1.309, 1.308, 1.306, 1.304, 1.302, 1.300, 1.298, 1.296, 1.294, 1.292, 1.290, 1.287, 1.282, 1.277, 1.272, 1.267, 1.257, 1.240, + 1.463, 1.461, 1.460, 1.459, 1.458, 1.457, 1.456, 1.455, 1.454, 1.453, 1.452, 1.451, 1.449, 1.447, 1.445, 1.443, 1.440, 1.438, 1.436, 1.434, 1.432, 1.430, 1.428, 1.426, 1.424, 1.421, 1.417, 1.413, 1.409, 1.405, 1.401, 1.397, 1.393, 1.389, 1.385, 1.377, 1.367, 1.357, 1.347, 1.337, 1.316, 1.281, + 44.899, 14.731, 7.692, 4.568, 3.180, 2.562, 2.285, 2.159, 2.101, 2.072, 2.057, 2.043, 2.031, 2.021, 2.011, 2.001, 1.991, 1.982, 1.972, 1.962, 1.952, 1.942, 1.932, 1.922, 1.912, 1.897, 1.878, 1.858, 1.838, 1.818, 1.798, 1.779, 1.759, 1.739, 1.719, 1.685, 1.635, 1.586, 1.536, 1.487, 1.387, 1.214, + ]), + emFractionBinsHF = cms.vdouble([ 0.00,1.05]), + absEtaBinsHF = cms.vdouble([ 3.00,3.60,6.00]), + jetCalibrationsHF = cms.vdouble([ + 3.223, 2.140, 1.683, 1.364, 1.142, 0.987, 0.879, 0.804, 0.752, 0.716, 0.691, 0.667, 0.651, 0.644, 0.641, 0.641, 0.641, 0.642, 0.644, 0.645, 0.647, 0.648, 0.650, 0.651, 0.653, 0.655, 0.658, 0.662, 0.665, 0.668, 0.671, 0.674, 0.677, 0.681, 0.684, 0.689, 0.697, 0.705, 0.713, 0.721, 0.736, 0.764, + 2.598, 1.813, 1.462, 1.206, 1.019, 0.883, 0.783, 0.711, 0.658, 0.620, 0.592, 0.564, 0.543, 0.532, 0.526, 0.524, 0.523, 0.524, 0.524, 0.525, 0.526, 0.527, 0.528, 0.529, 0.530, 0.532, 0.534, 0.536, 0.538, 0.541, 0.543, 0.545, 0.547, 0.549, 0.552, 0.556, 0.561, 0.567, 0.572, 0.578, 0.589, 0.608, + ]), + + # Testing tau calibrations derived for March workshop, 20 March 2019 + tauPtBins = cms.vdouble([ 0.0,5.0,7.5,10.0,12.5,15.0,20.0,25.0,30.0,35.0,40.0,45.0,50.0,55.0,60.0,70.0,80.0,100.0,150.0,200.0]), + tauAbsEtaBinsBarrel = cms.vdouble([ 0.00,0.30,0.60,1.00,1.50]), + tauL1egInfoBarrel = cms.VPSet( + cms.PSet( + l1egCount = cms.double( 0.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.091, 0.317, 1.05]), + ), + cms.PSet( + l1egCount = cms.double( 1.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.634, 0.888, 1.05]), + ), + cms.PSet( + l1egCount = cms.double( 2.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.821, 0.957, 1.05]), + ), + ), + tauCalibrationsBarrel = cms.vdouble([ + 1.917, 1.714, 1.605, 1.514, 1.437, 1.344, 1.252, 1.188, 1.142, 1.110, 1.087, 1.071, 1.059, 1.051, 1.044, 1.038, 1.034, 1.032, 1.032, + 1.856, 1.729, 1.655, 1.589, 1.530, 1.453, 1.369, 1.301, 1.248, 1.205, 1.170, 1.143, 1.121, 1.103, 1.084, 1.066, 1.050, 1.037, 1.034, + 2.053, 1.884, 1.788, 1.702, 1.627, 1.530, 1.426, 1.345, 1.282, 1.233, 1.194, 1.164, 1.141, 1.122, 1.102, 1.084, 1.070, 1.059, 1.057, + 1.783, 1.659, 1.588, 1.524, 1.466, 1.391, 1.309, 1.244, 1.191, 1.149, 1.116, 1.089, 1.068, 1.050, 1.031, 1.013, 0.998, 0.986, 0.983, + 1.896, 1.713, 1.613, 1.527, 1.453, 1.362, 1.270, 1.202, 1.152, 1.115, 1.088, 1.069, 1.054, 1.044, 1.033, 1.024, 1.018, 1.015, 1.014, + 1.936, 1.677, 1.544, 1.437, 1.350, 1.249, 1.156, 1.095, 1.055, 1.028, 1.011, 1.000, 0.992, 0.987, 0.983, 0.980, 0.978, 0.978, 0.978, + 1.850, 1.683, 1.590, 1.509, 1.439, 1.351, 1.258, 1.188, 1.135, 1.096, 1.065, 1.043, 1.025, 1.012, 0.999, 0.987, 0.979, 0.973, 0.972, + 2.066, 1.784, 1.638, 1.517, 1.418, 1.301, 1.189, 1.114, 1.063, 1.029, 1.006, 0.990, 0.979, 0.972, 0.965, 0.961, 0.958, 0.957, 0.957, + 1.074, 1.063, 1.056, 1.050, 1.043, 1.034, 1.022, 1.011, 1.001, 0.992, 0.983, 0.974, 0.966, 0.959, 0.949, 0.937, 0.921, 0.895, 0.874, + 2.053, 1.757, 1.609, 1.489, 1.394, 1.285, 1.186, 1.123, 1.083, 1.057, 1.040, 1.029, 1.022, 1.018, 1.014, 1.012, 1.010, 1.010, 1.010, + 1.733, 1.628, 1.567, 1.513, 1.463, 1.399, 1.328, 1.270, 1.224, 1.187, 1.157, 1.133, 1.114, 1.098, 1.081, 1.064, 1.050, 1.038, 1.035, + 2.009, 1.852, 1.762, 1.682, 1.611, 1.518, 1.417, 1.337, 1.274, 1.224, 1.184, 1.153, 1.128, 1.108, 1.086, 1.066, 1.049, 1.036, 1.033, + 1.806, 1.669, 1.591, 1.522, 1.461, 1.382, 1.296, 1.230, 1.177, 1.136, 1.103, 1.078, 1.058, 1.043, 1.025, 1.010, 0.998, 0.988, 0.986, + 1.944, 1.725, 1.609, 1.512, 1.431, 1.334, 1.239, 1.173, 1.126, 1.094, 1.071, 1.056, 1.045, 1.037, 1.030, 1.024, 1.021, 1.019, 1.019, + 1.900, 1.631, 1.496, 1.389, 1.304, 1.208, 1.122, 1.068, 1.034, 1.012, 0.999, 0.990, 0.984, 0.981, 0.978, 0.976, 0.975, 0.975, 0.975, + 1.682, 1.577, 1.516, 1.460, 1.409, 1.342, 1.266, 1.203, 1.152, 1.109, 1.075, 1.046, 1.022, 1.003, 0.980, 0.958, 0.937, 0.918, 0.913, + 1.928, 1.693, 1.569, 1.466, 1.381, 1.280, 1.183, 1.116, 1.070, 1.038, 1.016, 1.001, 0.991, 0.984, 0.977, 0.973, 0.970, 0.969, 0.969, + 1.067, 1.058, 1.052, 1.047, 1.041, 1.033, 1.023, 1.014, 1.005, 0.997, 0.989, 0.981, 0.974, 0.968, 0.959, 0.948, 0.933, 0.908, 0.886, + 1.883, 1.663, 1.548, 1.453, 1.375, 1.282, 1.193, 1.133, 1.091, 1.063, 1.044, 1.031, 1.022, 1.016, 1.010, 1.006, 1.004, 1.003, 1.003, + 1.688, 1.595, 1.541, 1.492, 1.448, 1.390, 1.325, 1.271, 1.228, 1.193, 1.164, 1.140, 1.121, 1.105, 1.087, 1.070, 1.055, 1.041, 1.037, + 2.251, 2.020, 1.891, 1.779, 1.682, 1.561, 1.434, 1.339, 1.267, 1.213, 1.173, 1.142, 1.119, 1.102, 1.084, 1.069, 1.058, 1.051, 1.050, + 1.799, 1.654, 1.572, 1.501, 1.438, 1.359, 1.275, 1.211, 1.162, 1.125, 1.096, 1.074, 1.057, 1.044, 1.030, 1.019, 1.009, 1.003, 1.002, + 1.780, 1.630, 1.547, 1.475, 1.413, 1.335, 1.254, 1.193, 1.148, 1.114, 1.089, 1.070, 1.056, 1.045, 1.034, 1.025, 1.018, 1.014, 1.013, + 1.750, 1.549, 1.445, 1.359, 1.288, 1.205, 1.126, 1.072, 1.036, 1.012, 0.995, 0.984, 0.976, 0.971, 0.966, 0.963, 0.961, 0.960, 0.960, + 1.736, 1.610, 1.537, 1.472, 1.414, 1.339, 1.257, 1.192, 1.141, 1.100, 1.067, 1.041, 1.021, 1.005, 0.986, 0.970, 0.956, 0.945, 0.942, + 1.961, 1.712, 1.582, 1.474, 1.386, 1.281, 1.181, 1.114, 1.068, 1.036, 1.015, 1.001, 0.991, 0.984, 0.978, 0.974, 0.971, 0.970, 0.970, + 1.065, 1.056, 1.051, 1.046, 1.040, 1.033, 1.023, 1.014, 1.005, 0.997, 0.989, 0.982, 0.974, 0.968, 0.958, 0.946, 0.930, 0.900, 0.872, + 2.047, 1.810, 1.683, 1.575, 1.485, 1.375, 1.266, 1.188, 1.133, 1.094, 1.066, 1.046, 1.032, 1.022, 1.012, 1.005, 1.000, 0.998, 0.997, + 2.022, 1.861, 1.768, 1.686, 1.613, 1.519, 1.418, 1.338, 1.275, 1.226, 1.187, 1.157, 1.133, 1.114, 1.093, 1.074, 1.059, 1.047, 1.045, + 2.503, 2.236, 2.087, 1.956, 1.843, 1.699, 1.548, 1.434, 1.347, 1.281, 1.231, 1.192, 1.164, 1.142, 1.118, 1.099, 1.084, 1.074, 1.072, + 2.253, 2.007, 1.872, 1.755, 1.654, 1.529, 1.401, 1.305, 1.235, 1.182, 1.143, 1.115, 1.093, 1.078, 1.061, 1.048, 1.039, 1.033, 1.033, + 2.228, 2.010, 1.888, 1.782, 1.690, 1.574, 1.453, 1.361, 1.292, 1.239, 1.200, 1.170, 1.147, 1.130, 1.112, 1.097, 1.085, 1.078, 1.077, + 2.527, 2.136, 1.934, 1.769, 1.633, 1.475, 1.326, 1.226, 1.159, 1.114, 1.084, 1.064, 1.051, 1.042, 1.034, 1.028, 1.025, 1.024, 1.024, + 2.097, 1.908, 1.801, 1.706, 1.622, 1.514, 1.398, 1.308, 1.238, 1.183, 1.140, 1.106, 1.080, 1.060, 1.038, 1.018, 1.002, 0.991, 0.988, + 2.479, 2.106, 1.912, 1.753, 1.623, 1.470, 1.326, 1.229, 1.163, 1.120, 1.090, 1.070, 1.057, 1.048, 1.040, 1.034, 1.031, 1.029, 1.029, + 2.097, 1.906, 1.796, 1.699, 1.612, 1.500, 1.378, 1.281, 1.205, 1.145, 1.098, 1.060, 1.031, 1.007, 0.981, 0.958, 0.939, 0.923, 0.920, + ]), + tauAbsEtaBinsHGCal = cms.vdouble([ 1.50,1.90,2.40,3.00]), + tauL1egInfoHGCal = cms.VPSet( + cms.PSet( + l1egCount = cms.double( 0.0 ), + l1egEmFractions = cms.vdouble([ 0.0, 0.473, 0.72, 0.894, 1.05]), + ), + ), + tauCalibrationsHGCal = cms.vdouble([ + 1.665, 1.556, 1.495, 1.443, 1.398, 1.342, 1.285, 1.242, 1.211, 1.188, 1.170, 1.158, 1.148, 1.141, 1.134, 1.128, 1.124, 1.122, 1.121, + 1.646, 1.525, 1.459, 1.402, 1.353, 1.293, 1.231, 1.186, 1.153, 1.129, 1.112, 1.099, 1.089, 1.082, 1.075, 1.069, 1.065, 1.063, 1.063, + 1.826, 1.630, 1.528, 1.444, 1.376, 1.294, 1.218, 1.166, 1.130, 1.107, 1.091, 1.080, 1.072, 1.067, 1.063, 1.060, 1.058, 1.057, 1.057, + 2.031, 1.762, 1.624, 1.514, 1.424, 1.321, 1.226, 1.164, 1.124, 1.098, 1.081, 1.069, 1.062, 1.057, 1.053, 1.050, 1.049, 1.048, 1.048, + 1.396, 1.328, 1.291, 1.259, 1.232, 1.198, 1.164, 1.139, 1.120, 1.107, 1.097, 1.089, 1.084, 1.080, 1.076, 1.073, 1.071, 1.070, 1.070, + 1.242, 1.214, 1.197, 1.182, 1.168, 1.149, 1.128, 1.111, 1.097, 1.085, 1.075, 1.067, 1.060, 1.055, 1.048, 1.042, 1.036, 1.030, 1.029, + 1.491, 1.368, 1.305, 1.253, 1.211, 1.161, 1.115, 1.084, 1.064, 1.050, 1.041, 1.035, 1.031, 1.028, 1.026, 1.024, 1.023, 1.023, 1.023, + 1.348, 1.289, 1.255, 1.225, 1.199, 1.165, 1.127, 1.098, 1.075, 1.057, 1.043, 1.031, 1.022, 1.016, 1.008, 1.001, 0.995, 0.991, 0.990, + 1.422, 1.373, 1.345, 1.320, 1.297, 1.266, 1.232, 1.205, 1.183, 1.165, 1.150, 1.138, 1.128, 1.120, 1.111, 1.102, 1.095, 1.088, 1.086, + 1.350, 1.322, 1.304, 1.288, 1.272, 1.250, 1.224, 1.201, 1.180, 1.162, 1.146, 1.132, 1.119, 1.108, 1.093, 1.078, 1.061, 1.038, 1.026, + 1.440, 1.373, 1.334, 1.300, 1.270, 1.231, 1.189, 1.155, 1.129, 1.108, 1.092, 1.079, 1.069, 1.061, 1.053, 1.045, 1.038, 1.033, 1.032, + 1.356, 1.317, 1.293, 1.271, 1.250, 1.221, 1.186, 1.156, 1.129, 1.105, 1.085, 1.067, 1.051, 1.037, 1.019, 1.000, 0.980, 0.954, 0.941, + ]), +) + diff --git a/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py b/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py new file mode 100644 index 0000000000000..747b9027ea9b2 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py @@ -0,0 +1,100 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.StandardSequences.Eras import eras + +process = cms.Process('REPR',eras.Phase2C4) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2023D35Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2023D35_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.MessageLogger.categories = cms.untracked.vstring('L1CaloJets', 'FwkReport') +process.MessageLogger.cerr.FwkReport = cms.untracked.PSet( + reportEvery = cms.untracked.int32(1) +) + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) ) +#process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.source = cms.Source("PoolSource", + # dasgoclient --query="dataset dataset=/*/*PhaseIIMTDTDRAutumn18DR*/FEVT" + fileNames = cms.untracked.vstring('root://cms-xrd-global.cern.ch//store/mc/PhaseIIMTDTDRAutumn18DR/VBFHToTauTau_M125_14TeV_powheg_pythia8/FEVT/PU200_103X_upgrade2023_realistic_v2-v1/280000/EFC8271A-8026-6A43-AF18-4CB7609B3348.root'), + inputCommands = cms.untracked.vstring( + "keep *", + "drop l1tEMTFHitExtras_simEmtfDigis_CSC_HLT", + "drop l1tEMTFHitExtras_simEmtfDigis_RPC_HLT", + "drop l1tEMTFTrackExtras_simEmtfDigis__HLT", + "drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT", + "drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT", + "drop l1tEMTFHit2016s_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016s_simEmtfDigis__HLT", + ) +) + +# All this stuff just runs the various EG algorithms that we are studying + +# ---- Global Tag : +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '103X_upgrade2023_realistic_v2', '') + +# Add HCAL Transcoder +process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') +process.load('CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi') + + +process.L1simulation_step = cms.Path(process.SimL1Emulator) + + + +### Based on: L1Trigger/L1TCommon/test/reprocess_test_10_4_0_mtd5.py +### This code is a portion of what is imported and excludes the 'schedule' portion +### of the two lines below. It makes the test script run! +### from L1Trigger.Configuration.customiseUtils import L1TrackTriggerTracklet +### process = L1TrackTriggerTracklet(process) +process.load('L1Trigger.TrackFindingTracklet.L1TrackletTracks_cff') +process.L1TrackTriggerTracklet_step = cms.Path(process.L1TrackletTracksWithAssociators) + + + + +# -------------------------------------------------------------------------------------------- +# +# ---- Load the L1CaloJet sequence designed to accompany process named "REPR" + +process.load('L1Trigger.L1CaloTrigger.L1CaloJets_cff') +process.l1CaloJets = cms.Path(process.l1CaloJetsSequence) + + + +process.Out = cms.OutputModule( "PoolOutputModule", + fileName = cms.untracked.string( "l1caloJetTest.root" ), + fastCloning = cms.untracked.bool( False ), + outputCommands = cms.untracked.vstring( + "keep *_L1EGammaClusterEmuProducer_*_*", + "keep *_L1CaloJetProducer_*_*", + "keep *_L1CaloJetHTTProducer_*_*", + "keep *_TriggerResults_*_*", + "keep *_simHcalTriggerPrimitiveDigis_*_*", + "keep *_EcalEBTrigPrimProducer_*_*", + "keep *_hgcalTowerProducer_*_*" + ) +) + +process.end = cms.EndPath( process.Out ) + + + +#dump_file = open("dump_file.py", "w") +#dump_file.write(process.dumpPython()) + + diff --git a/L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py b/L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py new file mode 100644 index 0000000000000..7825e7c70a0ee --- /dev/null +++ b/L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +from RecoVertex.BeamSpotProducer.BeamSpot_cfi import * + +from L1Trigger.TrackFindingTracklet.Tracklet_cfi import * + +from SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff import * +TTClusterAssociatorFromPixelDigis.digiSimLinks = cms.InputTag("simSiPixelDigis","Tracker") +TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag(cms.InputTag("TTTracksFromTracklet", "Level1TTTracks") ) + +L1TrackletTracks = cms.Sequence(offlineBeamSpot*TTTracksFromTracklet) +L1TrackletTracksWithAssociators = cms.Sequence(offlineBeamSpot*TTTracksFromTracklet*TrackTriggerAssociatorTracks) + From 5e7f14cdde851633c18789cd2a054de0a0fa2470 Mon Sep 17 00:00:00 2001 From: Victor <vshang@wisc.edu> Date: Mon, 9 Nov 2020 01:50:04 -0600 Subject: [PATCH 125/309] Modified test_L1CaloJets_cfg.py to run Phase2 Jet code without errors by adding modified L1CaloJets_cff.py and adding name to L1CaloTowers in L1EGammaCrystalsEmulatorProducer.cc (cherry picked from commit d5b8025517664334453a6279e577ac9e458806db) --- .../L1EGammaCrystalsEmulatorProducer.cc | 4 +- .../L1CaloTrigger/python/L1CaloJets_cff.py | 48 +++++++++++++++++++ .../python/test_L1CaloJets_cfg.py | 18 +++---- .../python/L1TrackletTracks_cff.py | 13 ----- .../python/Tracklet_cfi.py | 1 - 5 files changed, 60 insertions(+), 24 deletions(-) create mode 100644 L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py delete mode 100644 L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py diff --git a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc index fc5693620355a..afca168ac2840 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc @@ -344,7 +344,7 @@ L1EGCrystalClusterEmulatorProducer::L1EGCrystalClusterEmulatorProducer(const edm calib_(iConfig.getParameter<edm::ParameterSet>("calib")) { produces<l1tp2::CaloCrystalClusterCollection>(); produces<BXVector<l1t::EGamma> >(); - produces<l1tp2::CaloTowerCollection>(); + produces<l1tp2::CaloTowerCollection>("L1CaloTowerCollection"); } L1EGCrystalClusterEmulatorProducer::~L1EGCrystalClusterEmulatorProducer() {} @@ -1173,7 +1173,7 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: iEvent.put(std::move(L1EGXtalClusters)); iEvent.put(std::move(L1EGammas)); - iEvent.put(std::move(L1CaloTowers)); + iEvent.put(std::move(L1CaloTowers),"L1CaloTowerCollection"); } bool L1EGCrystalClusterEmulatorProducer::passes_iso(float pt, float iso) { diff --git a/L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py b/L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py new file mode 100644 index 0000000000000..a138f4093e7f4 --- /dev/null +++ b/L1Trigger/L1CaloTrigger/python/L1CaloJets_cff.py @@ -0,0 +1,48 @@ +import FWCore.ParameterSet.Config as cms + +# This cff file is based off of the L1T Phase-2 Menu group using +# the process name "REPR" + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the L1EGCrystal clusters using Emulator + +from L1Trigger.L1CaloTrigger.L1EGammaCrystalsEmulatorProducer_cfi import * +L1EGammaClusterEmuProducer.ecalTPEB = cms.InputTag("simEcalEBTriggerPrimitiveDigis","","") + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the calibrated tower collection combining Barrel, HGCal, HF + +from L1Trigger.L1CaloTrigger.L1TowerCalibrationProducer_cfi import * +L1TowerCalibrationProducer.L1HgcalTowersInputTag = cms.InputTag("hgcalTowerProducer","HGCalTowerProcessor","") +L1TowerCalibrationProducer.l1CaloTowers = cms.InputTag("L1EGammaClusterEmuProducer","L1CaloTowerCollection","") + + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the L1CaloJets + +from L1Trigger.L1CaloTrigger.L1CaloJetProducer_cfi import * +L1CaloJetProducer.l1CaloTowers = cms.InputTag("L1TowerCalibrationProducer","L1CaloTowerCalibratedCollection","") +L1CaloJetProducer.L1CrystalClustersInputTag = cms.InputTag("L1EGammaClusterEmuProducer", "L1EGXtalClusterEmulator","") + + + +# -------------------------------------------------------------------------------------------- +# +# ---- Produce the CaloJet HTT Sums + +from L1Trigger.L1CaloTrigger.L1CaloJetHTTProducer_cfi import * + + + +l1CaloJetsSequence = cms.Sequence( + L1EGammaClusterEmuProducer * + L1TowerCalibrationProducer * + L1CaloJetProducer * + L1CaloJetHTTProducer +) diff --git a/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py b/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py index 747b9027ea9b2..498aa095642cc 100644 --- a/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py +++ b/L1Trigger/L1CaloTrigger/python/test_L1CaloJets_cfg.py @@ -2,7 +2,7 @@ from Configuration.StandardSequences.Eras import eras -process = cms.Process('REPR',eras.Phase2C4) +process = cms.Process('REPR',eras.Phase2C9) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -10,8 +10,8 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryExtended2023D35Reco_cff') -process.load('Configuration.Geometry.GeometryExtended2023D35_cff') +process.load('Configuration.Geometry.GeometryExtended2026D41Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D41_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.SimL1Emulator_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') @@ -26,8 +26,9 @@ #process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.source = cms.Source("PoolSource", - # dasgoclient --query="dataset dataset=/*/*PhaseIIMTDTDRAutumn18DR*/FEVT" - fileNames = cms.untracked.vstring('root://cms-xrd-global.cern.ch//store/mc/PhaseIIMTDTDRAutumn18DR/VBFHToTauTau_M125_14TeV_powheg_pythia8/FEVT/PU200_103X_upgrade2023_realistic_v2-v1/280000/EFC8271A-8026-6A43-AF18-4CB7609B3348.root'), + # dasgoclient --query="dataset dataset=/VBFHToTauTau*/Phase2HLTTDR*/FEVT" + #fileNames = cms.untracked.vstring('root://cms-xrd-global.cern.ch//store/mc/PhaseIIMTDTDRAutumn18DR/VBFHToTauTau_M125_14TeV_powheg_pythia8/FEVT/PU200_103X_upgrade2023_realistic_v2-v1/280000/EFC8271A-8026-6A43-AF18-4CB7609B3348.root'), + fileNames = cms.untracked.vstring('root://cms-xrd-global.cern.ch//store/mc/Phase2HLTTDRSummer20ReRECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/FEVT/PU200_111X_mcRun4_realistic_T15_v1-v1/120000/084C8B72-BC64-DE46-801F-D971D5A34F62.root'), inputCommands = cms.untracked.vstring( "keep *", "drop l1tEMTFHitExtras_simEmtfDigis_CSC_HLT", @@ -45,7 +46,8 @@ # ---- Global Tag : from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, '103X_upgrade2023_realistic_v2', '') +#process.GlobalTag = GlobalTag(process.GlobalTag, '103X_upgrade2023_realistic_v2', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') # Add HCAL Transcoder process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') @@ -61,8 +63,8 @@ ### of the two lines below. It makes the test script run! ### from L1Trigger.Configuration.customiseUtils import L1TrackTriggerTracklet ### process = L1TrackTriggerTracklet(process) -process.load('L1Trigger.TrackFindingTracklet.L1TrackletTracks_cff') -process.L1TrackTriggerTracklet_step = cms.Path(process.L1TrackletTracksWithAssociators) +process.load('L1Trigger.TrackFindingTracklet.L1HybridEmulationTracks_cff') +process.L1TrackTriggerTracklet_step = cms.Path(process.L1HybridTracksWithAssociators) diff --git a/L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py b/L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py deleted file mode 100644 index 7825e7c70a0ee..0000000000000 --- a/L1Trigger/TrackFindingTracklet/python/L1TrackletTracks_cff.py +++ /dev/null @@ -1,13 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from RecoVertex.BeamSpotProducer.BeamSpot_cfi import * - -from L1Trigger.TrackFindingTracklet.Tracklet_cfi import * - -from SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff import * -TTClusterAssociatorFromPixelDigis.digiSimLinks = cms.InputTag("simSiPixelDigis","Tracker") -TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag(cms.InputTag("TTTracksFromTracklet", "Level1TTTracks") ) - -L1TrackletTracks = cms.Sequence(offlineBeamSpot*TTTracksFromTracklet) -L1TrackletTracksWithAssociators = cms.Sequence(offlineBeamSpot*TTTracksFromTracklet*TrackTriggerAssociatorTracks) - diff --git a/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py b/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py index cab518307ffb2..122e5f3f2b9f1 100644 --- a/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py +++ b/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py @@ -38,4 +38,3 @@ TrackQuality =cms.bool(False), TrackQualityPSet = cms.PSet(TrackQualityParams) ) - From cf43572a2ef558f6647eb5060de75d3fac08723e Mon Sep 17 00:00:00 2001 From: Victor <vshang@wisc.edu> Date: Sun, 15 Nov 2020 21:16:17 -0600 Subject: [PATCH 126/309] Made associated_l1EGs const in CaloJet.h to be consistent with experimentalParams. Also modified L1CaloJetProducer to work with L1EGRateStudies plotting code (cherry picked from commit 9f24a9ca36825fe2c1abe5f058c7982e24fe3a69) --- DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h | 2 +- L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h b/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h index d25ad2f686aca..5be863ec51179 100644 --- a/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h +++ b/DataFormats/L1TCalorimeterPhase2/interface/CaloJet.h @@ -20,7 +20,7 @@ namespace l1tp2 { inline float hovere() const { return hovere_; }; inline float isolation() const { return iso_; }; inline float puCorrPt() const { return puCorrPt_; }; - std::vector<std::vector<float>>& associated_l1EGs() { return associated_l1EGs_; }; + const std::vector<std::vector<float>>& associated_l1EGs() const { return associated_l1EGs_; }; void setExperimentalParams(const std::map<std::string, float>& params) { experimentalParams_ = params; }; void setAssociated_l1EGs(const std::vector<std::vector<float>> l1EGs) { associated_l1EGs_ = l1EGs; }; diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc index 0d03761def06e..a2c8b94faf080 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc @@ -1130,7 +1130,7 @@ void L1CaloJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu float totalPtPUcorr = -1; l1tp2::CaloJet caloJet(caloJetObj.jetCluster, calibratedPt, hovere, ECalIsolation, totalPtPUcorr); caloJet.setExperimentalParams(params); - caloJet.associated_l1EGs() = caloJetObj.associated_l1EGs_; + caloJet.setAssociated_l1EGs(caloJetObj.associated_l1EGs_); // Only store jets passing ET threshold if (params["jet_pt_calibration"] >= EtMinForCollection) From 788ed6d761db459bd0d304f1d8c3a8abd6c64998 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 3 May 2021 19:25:49 +0200 Subject: [PATCH 127/309] Code Check --- .../plugins/HGCalDigiValidation.cc | 2 +- .../plugins/HGCalRecHitValidation.cc | 21 +++++++++++-------- .../plugins/HGCalRecHitsClient.cc | 5 +++-- .../plugins/HGCalSimHitStudy.cc | 7 +++++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc b/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc index 0440a49baa70d..38313251b65ed 100644 --- a/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalDigiValidation.cc @@ -121,7 +121,7 @@ void HGCalDigiValidation::analyze(const edm::Event& iEvent, const edm::EventSetu OccupancyMap_minus_.clear(); int geomType(0); - const HGCalGeometry* geom0 = &iSetup.getData(tok_hgcalg_); + const HGCalGeometry* geom0 = &iSetup.getData(tok_hgcalg_); if (geom0->topology().waferHexagon8()) geomType = 1; else if (geom0->topology().tileTrapezoid()) diff --git a/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc index 63d0b3044b365..d608f88b0f19e 100644 --- a/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalRecHitValidation.cc @@ -116,7 +116,7 @@ void HGCalRecHitValidation::analyze(const edm::Event& iEvent, const edm::EventSe edm::ESHandle<HGCalGeometry> geomHandle = iSetup.getHandle(geometry_token_); if (!geomHandle.isValid()) { edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; + << "Object for " << nameDetector_; } else { const HGCalGeometry* geom0 = geomHandle.product(); int geomType = ((geom0->topology().waferHexagon8()) ? 1 : ((geom0->topology().tileTrapezoid()) ? 2 : 0)); @@ -125,18 +125,21 @@ void HGCalRecHitValidation::analyze(const edm::Event& iEvent, const edm::EventSe iEvent.getByToken(recHitSource_, theRecHitContainers); if (theRecHitContainers.isValid()) { if (verbosity_ > 0) - edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; + edm::LogVerbatim("HGCalValidation") + << nameDetector_ << " with " << theRecHitContainers->size() << " element(s)"; for (const auto& it : *(theRecHitContainers.product())) { - ntot++; - nused++; - DetId detId = it.id(); - int layer = ((geomType == 0) ? HGCalDetId(detId).layer() : ((geomType == 1) ? HGCSiliconDetId(detId).layer() : HGCScintillatorDetId(detId).layer())); - recHitValidation(detId, layer, geom0, &it); + ntot++; + nused++; + DetId detId = it.id(); + int layer = ((geomType == 0) + ? HGCalDetId(detId).layer() + : ((geomType == 1) ? HGCSiliconDetId(detId).layer() : HGCScintillatorDetId(detId).layer())); + recHitValidation(detId, layer, geom0, &it); } } else { ok = false; edm::LogVerbatim("HGCalValidation") << "HGCRecHitCollection Handle " - << "does not exist !!!"; + << "does not exist !!!"; } } if (ok) @@ -210,7 +213,7 @@ void HGCalRecHitValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup& edm::ESHandle<HGCalGeometry> geomHandle = iSetup.getHandle(geometry_beginRun_token_); if (!geomHandle.isValid()) { edm::LogVerbatim("HGCalValidation") << "Cannot get valid HGCalGeometry " - << "Object for " << nameDetector_; + << "Object for " << nameDetector_; } else { const HGCalGeometry* geom = geomHandle.product(); const HGCalDDDConstants& hgcons_ = geom->topology().dddConstants(); diff --git a/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc b/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc index 6ac1a3f162044..efe8f48e673bd 100644 --- a/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc +++ b/Validation/HGCalValidation/plugins/HGCalRecHitsClient.cc @@ -42,10 +42,11 @@ class HGCalRecHitsClient : public DQMEDHarvester { HGCalRecHitsClient::HGCalRecHitsClient(const edm::ParameterSet &iConfig) : nameDetector_(iConfig.getParameter<std::string>("DetectorName")), verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)), - ddc_token_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", nameDetector_})) {} + ddc_token_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>( + edm::ESInputTag{"", nameDetector_})) {} void HGCalRecHitsClient::beginRun(const edm::Run &run, const edm::EventSetup &iSetup) { - const HGCalDDDConstants& hgcons_ = iSetup.getData(ddc_token_); + const HGCalDDDConstants &hgcons_ = iSetup.getData(ddc_token_); layers_ = hgcons_.layers(true); } diff --git a/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc b/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc index 76f271edde6d0..7d697779d7419 100644 --- a/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc +++ b/Validation/HGCalValidation/plugins/HGCalSimHitStudy.cc @@ -100,7 +100,8 @@ HGCalSimHitStudy::HGCalSimHitStudy(const edm::ParameterSet& iConfig) usesResource(TFileService::kSharedResource); for (auto const& name : nameDetectors_) - tok_hgcGeom_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + tok_hgcGeom_.emplace_back( + esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); for (auto const& source : caloHitSources_) tok_hits_.emplace_back(consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", source))); } @@ -206,7 +207,9 @@ void HGCalSimHitStudy::analyzeHits(int ih, std::string const& name, std::vector< double xp = (zp < 0) ? -xy.first : xy.first; gcoord = HepGeom::Point3D<float>(xp, xy.second, zp); if (verbosity_ > 2) - edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":" << zside << ":" << layer << ":" << sector << ":" << sector2 << ":" << cell << ":" << cell2 << " o/p " << xy.first << ":" << xy.second << ":" << zp; + edm::LogVerbatim("HGCalValidation") + << "i/p " << subdet << ":" << zside << ":" << layer << ":" << sector << ":" << sector2 << ":" << cell << ":" + << cell2 << " o/p " << xy.first << ":" << xy.second << ":" << zp; nused++; double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light; if (verbosity_ > 1) From 79de2abbc5e43351b6e5764adec8b691b006c56d Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 3 May 2021 21:50:36 +0200 Subject: [PATCH 128/309] Update some of the remaining validation classes in Validation/HGCalValidation --- .../plugins/HGCalBHValidation.cc | 170 ++++--------- .../plugins/HGCalHitValidation.cc | 228 ++++++------------ .../python/hgcalHitValidation_cff.py | 21 ++ .../python/hgcalHitValidation_cfi.py | 22 -- .../test/python/protoHGCalSimWatcher_cfg.py | 29 ++- .../test/python/protoSimValid_cfg.py | 39 +-- .../test/python/protoValid_cfg.py | 64 +++-- .../test/python/standalone_fromRECO.py | 16 +- 8 files changed, 231 insertions(+), 358 deletions(-) create mode 100644 Validation/HGCalValidation/python/hgcalHitValidation_cff.py delete mode 100644 Validation/HGCalValidation/python/hgcalHitValidation_cfi.py diff --git a/Validation/HGCalValidation/plugins/HGCalBHValidation.cc b/Validation/HGCalValidation/plugins/HGCalBHValidation.cc index f8d84f9e6246d..cb8978a80b5ef 100644 --- a/Validation/HGCalValidation/plugins/HGCalBHValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalBHValidation.cc @@ -7,9 +7,6 @@ // user include files #include "CommonTools/UtilAlgos/interface/TFileService.h" -#include "CondFormats/GeometryObjects/interface/HcalParameters.h" -#include "DataFormats/HcalDetId/interface/HcalDetId.h" -#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h" #include "DataFormats/HGCDigi/interface/HGCDigiCollections.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -21,10 +18,8 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ServiceRegistry/interface/Service.h" -#include "Geometry/Records/interface/HcalParametersRcd.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "DataFormats/ForwardDetId/interface/HGCScintillatorDetId.h" // Root objects @@ -51,15 +46,13 @@ class HGCalBHValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm:: private: edm::Service<TFileService> fs_; - const std::string g4Label_, hcalHits_; - const edm::InputTag hcalDigis_; - const int iSample_, geomType_; + const std::string g4Label_, hits_; + const edm::InputTag digis_; + const int iSample_; const double threshold_; - const bool ifHCAL_; - const edm::ESGetToken<HcalParameters, HcalParametersRcd> parToken_; - edm::EDGetTokenT<edm::PCaloHitContainer> tok_hits_; - edm::EDGetToken tok_hbhe_; - int etaMax_; + const edm::EDGetTokenT<edm::PCaloHitContainer> tok_hits_; + const edm::EDGetToken tok_digi_; + const int etaMax_; TH1D *hsimE1_, *hsimE2_, *hsimTm_; TH1D *hsimLn_, *hdigEn_, *hdigLn_; @@ -68,46 +61,32 @@ class HGCalBHValidation : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm:: }; HGCalBHValidation::HGCalBHValidation(const edm::ParameterSet& ps) - : g4Label_(ps.getUntrackedParameter<std::string>("ModuleLabel", "g4SimHits")), - hcalHits_((ps.getUntrackedParameter<std::string>("HitCollection", "HcalHits"))), - hcalDigis_(ps.getUntrackedParameter<edm::InputTag>("DigiCollection")), - iSample_(ps.getUntrackedParameter<int>("Sample", 5)), - geomType_(ps.getUntrackedParameter<int>("GeometryType", 0)), - threshold_(ps.getUntrackedParameter<double>("Threshold", 12.0)), - ifHCAL_(ps.getUntrackedParameter<bool>("ifHCAL", false)), - parToken_(esConsumes<HcalParameters, HcalParametersRcd, edm::Transition::BeginRun>(edm::ESInputTag{})), + : g4Label_(ps.getParameter<std::string>("ModuleLabel")), + hits_((ps.getParameter<std::string>("HitCollection"))), + digis_(ps.getParameter<edm::InputTag>("DigiCollection")), + iSample_(ps.getParameter<int>("Sample")), + threshold_(ps.getParameter<double>("Threshold")), + tok_hits_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hits_))), + tok_digi_(consumes<HGCalDigiCollection>(digis_)), etaMax_(100) { usesResource(TFileService::kSharedResource); - tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hcalHits_)); - if (ifHCAL_) - tok_hbhe_ = consumes<QIE11DigiCollection>(hcalDigis_); - else - tok_hbhe_ = consumes<HGCalDigiCollection>(hcalDigis_); - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Input for SimHit:" << edm::InputTag(g4Label_, hcalHits_) - << " Digits:" << hcalDigis_ << " Sample: " << iSample_ << " Threshold " + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Input for SimHit:" << edm::InputTag(g4Label_, hits_) + << " Digits:" << digis_ << " Sample: " << iSample_ << " Threshold " << threshold_; } void HGCalBHValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - desc.addUntracked<std::string>("ModuleLabel", "g4SimHits"); - desc.addUntracked<std::string>("HitCollection", "HGCHitsHEback"); - desc.addUntracked<edm::InputTag>("DigiCollection", edm::InputTag("simHGCalUnsuppressedDigis", "HEback")); - desc.addUntracked<int>("Sample", 5); - desc.addUntracked<int>("GeometryType", 1); - desc.addUntracked<double>("Threshold", 15.0); - desc.addUntracked<bool>("ifHCAL", false); + desc.add<std::string>("ModuleLabel", "g4SimHits"); + desc.add<std::string>("HitCollection", "HGCHitsHEback"); + desc.add<edm::InputTag>("DigiCollection", edm::InputTag("simHGCalUnsuppressedDigis", "HEback")); + desc.add<int>("Sample", 5); + desc.add<double>("Threshold", 15.0); descriptions.add("hgcalBHAnalysis", desc); } void HGCalBHValidation::beginRun(edm::Run const&, edm::EventSetup const& es) { - if (geomType_ == 0) { - std::string label; - const HcalParameters* hpar = &es.getData(parToken_); - const std::vector<int> etaM = hpar->etaMax; - etaMax_ = etaM[1]; - } edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation::Maximum Number of" << " eta sectors:" << etaMax_ << "\nHitsValidationHcal::Booking the Histograms"; @@ -131,38 +110,28 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation:Run = " << e.id().run() << " Event = " << e.id().event(); //SimHits - edm::Handle<edm::PCaloHitContainer> hitsHcal; - e.getByToken(tok_hits_, hitsHcal); + edm::Handle<edm::PCaloHitContainer> hitsHE; + e.getByToken(tok_hits_, hitsHE); edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: PCaloHitContainer" - << " obtained with flag " << hitsHcal.isValid(); - if (hitsHcal.isValid()) { - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: PCaloHit buffer " << hitsHcal->size(); + << " obtained with flag " << hitsHE.isValid(); + if (hitsHE.isValid()) { + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: PCaloHit buffer " << hitsHE->size(); unsigned i(0); std::map<unsigned int, double> map_try; - for (edm::PCaloHitContainer::const_iterator it = hitsHcal->begin(); it != hitsHcal->end(); ++it) { + for (edm::PCaloHitContainer::const_iterator it = hitsHE->begin(); it != hitsHE->end(); ++it) { double energy = it->energy(); double time = it->time(); unsigned int id = it->id(); - int subdet(0), z(0), depth(0), eta(0), phi(0), lay(0); - bool hbhe(false), bh(false); - if (geomType_ == 0) { - HcalTestNumbering::unpackHcalIndex(id, subdet, z, depth, eta, phi, lay); - if (z == 0) - eta = -eta; - hbhe = ((subdet == static_cast<int>(HcalEndcap)) || (subdet == static_cast<int>(HcalBarrel))); - bh = (subdet == static_cast<int>(HcalEndcap)); - } else { - hbhe = bh = (DetId(id).det() == DetId::HGCalHSc); - if (bh) { - eta = HGCScintillatorDetId(id).ieta(); - phi = HGCScintillatorDetId(id).iphi(); - lay = HGCScintillatorDetId(id).layer(); - } + int eta(0), phi(0), lay(0); + bool bh = (DetId(id).det() == DetId::HGCalHSc); + if (bh) { + eta = HGCScintillatorDetId(id).ieta(); + phi = HGCScintillatorDetId(id).iphi(); + lay = HGCScintillatorDetId(id).layer(); } double eta1 = (eta >= 0) ? (eta + 0.1) : (eta - 0.1); - if (hbhe) - hsi2Oc_->Fill(eta1, (phi - 0.1), energy); if (bh) { + hsi2Oc_->Fill(eta1, (phi - 0.1), energy); hsimE1_->Fill(energy); hsimTm_->Fill(time, energy); hsimOc_->Fill(eta1, (phi - 0.1), energy); @@ -174,9 +143,7 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { ensum += energy; map_try[id] = ensum; ++i; - edm::LogVerbatim("HGCalValidation") - << "HGCalBHHit[" << i << "] ID " << std::hex << " " << id << std::dec << " SubDet " << subdet << " depth " - << depth << " Eta " << eta << " Phi " << phi << " layer " << lay << " E " << energy << " time " << time; + edm::LogVerbatim("HGCalValidation") << "HGCalBHHit[" << i << "] ID " << std::hex << " " << id << std::dec << " " << HGCScintillatorDetId(id) << " E " << energy << " time " << time; } } for (std::map<unsigned int, double>::iterator itr = map_try.begin(); itr != map_try.end(); ++itr) { @@ -186,57 +153,22 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { //Digits unsigned int kount(0); - if ((geomType_ == 0) && ifHCAL_) { - edm::Handle<QIE11DigiCollection> hbhecoll; - e.getByToken(tok_hbhe_, hbhecoll); - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: " - << "HBHEQIE11DigiCollection obtained " - << "with flag " << hbhecoll.isValid(); - if (hbhecoll.isValid()) { - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HBHEDigit " - << "buffer " << hbhecoll->size(); - for (QIE11DigiCollection::const_iterator it = hbhecoll->begin(); it != hbhecoll->end(); ++it) { - QIE11DataFrame df(*it); - HcalDetId cell(df.id()); - bool hbhe = - ((cell.subdetId() == static_cast<int>(HcalEndcap)) || (cell.subdetId() == static_cast<int>(HcalBarrel))); - if (hbhe) { - bool bh = (cell.subdetId() == static_cast<int>(HcalEndcap)); - int depth = cell.depth(); - double energy = df[iSample_].adc(); - analyzeDigi(cell, energy, bh, depth, kount); - } - } - } - } else { - edm::Handle<HGCalDigiCollection> hbhecoll; - e.getByToken(tok_hbhe_, hbhecoll); - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: " - << "HGCalDigiCollection obtained with" - << " flag " << hbhecoll.isValid(); - if (hbhecoll.isValid()) { - edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HGCalDigi " - << "buffer " << hbhecoll->size(); - for (HGCalDigiCollection::const_iterator it = hbhecoll->begin(); it != hbhecoll->end(); ++it) { - HGCalDataFrame df(*it); - double energy = df[iSample_].data(); - if (geomType_ == 0) { - HcalDetId cell(df.id()); - bool hbhe = - ((cell.subdetId() == static_cast<int>(HcalEndcap)) || (cell.subdetId() == static_cast<int>(HcalBarrel))); - if (hbhe) { - bool bh = (cell.subdetId() == static_cast<int>(HcalEndcap)); - int depth = cell.depth(); - analyzeDigi(cell, energy, bh, depth, kount); - } - } else { - bool bh = (DetId(df.id()).det() == DetId::HGCalHSc); - if (bh) { - HGCScintillatorDetId cell(df.id()); - int depth = cell.layer(); - analyzeDigi(cell, energy, bh, depth, kount); - } - } + edm::Handle<HGCalDigiCollection> hecoll; + e.getByToken(tok_digi_, hecoll); + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: " + << "HGCalDigiCollection obtained with" + << " flag " << hecoll.isValid(); + if (hecoll.isValid()) { + edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HGCalDigi " + << "buffer " << hecoll->size(); + for (HGCalDigiCollection::const_iterator it = hecoll->begin(); it != hecoll->end(); ++it) { + HGCalDataFrame df(*it); + double energy = df[iSample_].data(); + bool bh = (DetId(df.id()).det() == DetId::HGCalHSc); + if (bh) { + HGCScintillatorDetId cell(df.id()); + int depth = cell.layer(); + analyzeDigi(cell, energy, bh, depth, kount); } } } @@ -257,7 +189,7 @@ void HGCalBHValidation::analyzeDigi( hdi3Oc_->Fill(eta1, depth); ++kount; edm::LogVerbatim("HGCalValidation") - << "HGCalBHDigit[" << kount << "] ID " << cell << " E " << energy << ":" << (energy > threshold_); + << "HGCalBHDigit[" << kount << "] ID " << cell << " E " << energy << ":" << (energy > threshold_); } } } diff --git a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc index 8cee8099afcfd..3054699f1a1ca 100644 --- a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc @@ -17,16 +17,8 @@ #include "Geometry/HGCalCommonData/interface/HGCalGeometryMode.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDSimConstants.h" -#include "Geometry/HcalCommonData/interface/HcalDDDRecConstants.h" -#include "Geometry/HcalCommonData/interface/HcalCellType.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/Records/interface/HcalSimNumberingRecord.h" -#include "Geometry/Records/interface/HcalRecNumberingRecord.h" #include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" -#include "DataFormats/HcalRecHit/interface/HBHERecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" @@ -47,7 +39,6 @@ #include "SimG4CMS/Calo/interface/HGCNumberingScheme.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" -#include "DataFormats/HcalDetId/interface/HcalTestNumbering.h" #include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" #include <cmath> @@ -74,20 +65,13 @@ class HGCalHitValidation : public DQMEDAnalyzer { int idet, MonitorElement* hist, std::map<unsigned int, HGCHitTuple>&); - template <class T1> - void analyzeHGCalRecHit(T1 const& theHits, std::map<unsigned int, HGCHitTuple> const& hitRefs); private: //HGC Geometry std::vector<const HGCalDDDConstants*> hgcCons_; std::vector<const HGCalGeometry*> hgcGeometry_; - const HcalDDDSimConstants* hcCons_; - const HcalDDDRecConstants* hcConr_; - const CaloSubdetectorGeometry* hcGeometry_; std::vector<std::string> geometrySource_; std::vector<int> ietaExcludeBH_; - bool ifHCAL_; - bool ifHCALsim_; edm::InputTag eeSimHitSource, fhSimHitSource, bhSimHitSource; edm::EDGetTokenT<std::vector<PCaloHit>> eeSimHitToken_; @@ -95,8 +79,7 @@ class HGCalHitValidation : public DQMEDAnalyzer { edm::EDGetTokenT<std::vector<PCaloHit>> bhSimHitToken_; edm::EDGetTokenT<HGCeeRecHitCollection> eeRecHitToken_; edm::EDGetTokenT<HGChefRecHitCollection> fhRecHitToken_; - edm::EDGetTokenT<HGChebRecHitCollection> bhRecHitTokeng_; - edm::EDGetTokenT<HBHERecHitCollection> bhRecHitTokenh_; + edm::EDGetTokenT<HGChebRecHitCollection> bhRecHitToken_; //histogram related stuff MonitorElement *heedzVsZ, *heedyVsY, *heedxVsX; @@ -114,23 +97,17 @@ class HGCalHitValidation : public DQMEDAnalyzer { }; HGCalHitValidation::HGCalHitValidation(const edm::ParameterSet& cfg) { - geometrySource_ = cfg.getUntrackedParameter<std::vector<std::string>>("geometrySource"); + geometrySource_ = cfg.getParameter<std::vector<std::string>>("geometrySource"); eeSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("eeSimHitSource")); fhSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("fhSimHitSource")); bhSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("bhSimHitSource")); eeRecHitToken_ = consumes<HGCeeRecHitCollection>(cfg.getParameter<edm::InputTag>("eeRecHitSource")); fhRecHitToken_ = consumes<HGChefRecHitCollection>(cfg.getParameter<edm::InputTag>("fhRecHitSource")); + bhRecHitToken_ = consumes<HGChebRecHitCollection>(cfg.getParameter<edm::InputTag>("bhRecHitSource")); ietaExcludeBH_ = cfg.getParameter<std::vector<int>>("ietaExcludeBH"); - ifHCAL_ = cfg.getParameter<bool>("ifHCAL"); - ifHCALsim_ = cfg.getParameter<bool>("ifHCALsim"); - if (ifHCAL_) - bhRecHitTokenh_ = consumes<HBHERecHitCollection>(cfg.getParameter<edm::InputTag>("bhRecHitSource")); - else - bhRecHitTokeng_ = consumes<HGChebRecHitCollection>(cfg.getParameter<edm::InputTag>("bhRecHitSource")); #ifdef EDM_ML_DEBUG - edm::LogInfo("HGCalValid") << "Exclude the following " << ietaExcludeBH_.size() << " ieta values from BH plots (BH " - << ifHCAL_ << ") "; + edm::LogInfo("HGCalValid") << "Exclude the following " << ietaExcludeBH_.size() << " ieta values from BH plots"; for (unsigned int k = 0; k < ietaExcludeBH_.size(); ++k) edm::LogInfo("HGCalValid") << " [" << k << "] " << ietaExcludeBH_[k]; #endif @@ -139,11 +116,20 @@ HGCalHitValidation::HGCalHitValidation(const edm::ParameterSet& cfg) { HGCalHitValidation::~HGCalHitValidation() {} void HGCalHitValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); + std::vector<std::string> source = {"HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive"}; + desc.add<std::vector<std::string>>("geometrySource", source); + desc.add<edm::InputTag>("eeSimHitSource", edm::InputTag("g4SimHits","HGCHitsEE")); + desc.add<edm::InputTag>("fhSimHitSource", edm::InputTag("g4SimHits","HGCHitsHEfront")); + desc.add<edm::InputTag>("bhSimHitSource", edm::InputTag("g4SimHits","HGCHitsHEback")); + desc.add<edm::InputTag>("eeRecHitSource", edm::InputTag("HGCalRecHit","HGCEERecHits")); + desc.add<edm::InputTag>("fhRecHitSource", edm::InputTag("HGCalRecHit","HGCHEFRecHits")); + desc.add<edm::InputTag>("bhRecHitSource", edm::InputTag("HGCalRecHit","HGCHEBRecHits")); + std::vector<int> dummy; + desc.add<std::vector<int>>("ietaExcludeBH", dummy); + descriptions.add("hgcalHitValidation", desc); } void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, edm::EventSetup const&) { @@ -178,7 +164,7 @@ void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, hefEnRec = iB.book1D("hefEnRec", "", 1000, 0, 10); hefEnSim = iB.book1D("hefEnSim", "", 1000, 0, 0.01); hefEnSimRec = iB.book2D("hefEnSimRec", "", 200, 0, 0.001, 200, 0, 0.5); - + hebEnRec = iB.book1D("hebEnRec", "", 1000, 0, 15); hebEnSim = iB.book1D("hebEnSim", "", 1000, 0, 0.01); hebEnSimRec = iB.book2D("hebEnSimRec", "", 200, 0, 0.02, 200, 0, 4); @@ -187,46 +173,19 @@ void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, void HGCalHitValidation::dqmBeginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { //initiating hgc Geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - if (geometrySource_[i].find("Hcal") != std::string::npos) { - edm::ESHandle<HcalDDDSimConstants> pHSNDC; - iSetup.get<HcalSimNumberingRecord>().get(pHSNDC); - if (pHSNDC.isValid()) { - hcCons_ = pHSNDC.product(); - hgcCons_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDSimConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle<HcalDDDRecConstants> pHRNDC; - iSetup.get<HcalRecNumberingRecord>().get(pHRNDC); - if (pHRNDC.isValid()) { - hcConr_ = pHRNDC.product(); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDRecConstants: " << geometrySource_[i] << std::endl; - } - edm::ESHandle<CaloGeometry> caloG; - iSetup.get<CaloGeometryRecord>().get(caloG); - if (caloG.isValid()) { - const CaloGeometry* geo = caloG.product(); - hcGeometry_ = geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); - hgcGeometry_.push_back(nullptr); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for " << geometrySource_[i] << std::endl; - } + edm::ESHandle<HGCalDDDConstants> hgcCons; + iSetup.get<IdealGeometryRecord>().get(geometrySource_[i], hgcCons); + if (hgcCons.isValid()) { + hgcCons_.push_back(hgcCons.product()); } else { - edm::ESHandle<HGCalDDDConstants> hgcCons; - iSetup.get<IdealGeometryRecord>().get(geometrySource_[i], hgcCons); - if (hgcCons.isValid()) { - hgcCons_.push_back(hgcCons.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; - } - edm::ESHandle<HGCalGeometry> hgcGeom; - iSetup.get<IdealGeometryRecord>().get(geometrySource_[i], hgcGeom); - if (hgcGeom.isValid()) { - hgcGeometry_.push_back(hgcGeom.product()); - } else { - edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; - } + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; + } + edm::ESHandle<HGCalGeometry> hgcGeom; + iSetup.get<IdealGeometryRecord>().get(geometrySource_[i], hgcGeom); + if (hgcGeom.isValid()) { + hgcGeometry_.push_back(hgcGeom.product()); + } else { + edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for " << geometrySource_[i] << std::endl; } } } @@ -237,7 +196,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup //Accesing ee simhits edm::Handle<std::vector<PCaloHit>> eeSimHits; iEvent.getByToken(eeSimHitToken_, eeSimHits); - + if (eeSimHits.isValid()) { analyzeHGCalSimHit(eeSimHits, 0, heeEnSim, eeHitRefs); #ifdef EDM_ML_DEBUG @@ -251,7 +210,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No EE SimHit Found "; } - + //Accesing fh simhits edm::Handle<std::vector<PCaloHit>> fhSimHits; iEvent.getByToken(fhSimHitToken_, fhSimHits); @@ -268,43 +227,12 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No FH SimHit Found "; } - + //Accessing bh simhits edm::Handle<std::vector<PCaloHit>> bhSimHits; iEvent.getByToken(bhSimHitToken_, bhSimHits); if (bhSimHits.isValid()) { - if (ifHCALsim_) { - for (std::vector<PCaloHit>::const_iterator simHit = bhSimHits->begin(); simHit != bhSimHits->end(); ++simHit) { - int subdet, z, depth, eta, phi, lay; - HcalTestNumbering::unpackHcalIndex(simHit->id(), subdet, z, depth, eta, phi, lay); - - if (subdet == static_cast<int>(HcalEndcap)) { - HcalCellType::HcalCell cell = hcCons_->cell(subdet, z, lay, eta, phi); - double zp = cell.rz / 10; - - HcalDDDRecConstants::HcalID idx = hcConr_->getHCID(subdet, eta, phi, lay, depth); - int sign = (z == 0) ? (-1) : (1); - zp *= sign; - HcalDetId id = HcalDetId(HcalEndcap, sign * idx.eta, idx.phi, idx.depth); - - float energy = simHit->energy(); - float energySum(energy); - if (bhHitRefs.count(id.rawId()) != 0) - energySum += std::get<0>(bhHitRefs[id.rawId()]); - hebEnSim->Fill(energy); - if (std::find(ietaExcludeBH_.begin(), ietaExcludeBH_.end(), idx.eta) == ietaExcludeBH_.end()) { - bhHitRefs[id.rawId()] = std::make_tuple(energySum, cell.eta, cell.phi, zp); -#ifdef EDM_ML_DEBUG - edm::LogInfo("HGCalValid") << "Accept " << id << std::endl; - } else { - edm::LogInfo("HGCalValid") << "Reject " << id << std::endl; -#endif - } - } - } - } else { - analyzeHGCalSimHit(bhSimHits, 2, hebEnSim, bhHitRefs); - } + analyzeHGCalSimHit(bhSimHits, 2, hebEnSim, bhHitRefs); #ifdef EDM_ML_DEBUG for (std::map<unsigned int, HGCHitTuple>::iterator itr = bhHitRefs.begin(); itr != bhHitRefs.end(); ++itr) { int idx = std::distance(bhHitRefs.begin(), itr); @@ -346,7 +274,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No EE RecHit Found "; } - + //accessing FH Rechit information edm::Handle<HGChefRecHitCollection> fhRecHit; iEvent.getByToken(fhRecHitToken_, fhRecHit); @@ -358,7 +286,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId()); if (itr != fhHitRefs.end()) { GlobalPoint xyz = hgcGeometry_[1]->getPosition(it->id()); - + hefRecVsSimX->Fill(std::get<1>(itr->second), xyz.x()); hefRecVsSimY->Fill(std::get<2>(itr->second), xyz.y()); hefRecVsSimZ->Fill(std::get<3>(itr->second), xyz.z()); @@ -377,26 +305,41 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No FH RecHit Found "; } - + //accessing BH Rechit information - if (ifHCAL_) { - edm::Handle<HBHERecHitCollection> bhRecHit; - iEvent.getByToken(bhRecHitTokenh_, bhRecHit); - if (bhRecHit.isValid()) { - const HBHERecHitCollection* theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogVerbatim("HGCalValid") << "No BH RecHit Found "; + edm::Handle<HGChebRecHitCollection> bhRecHit; + iEvent.getByToken(bhRecHitToken_, bhRecHit); + if (bhRecHit.isValid()) { + const HGChebRecHitCollection* theHits = (bhRecHit.product()); + for (auto it = theHits->begin(); it != theHits->end(); ++it) { + double energy = it->energy(); + hebEnRec->Fill(energy); + std::map<unsigned int, HGCHitTuple>::const_iterator itr = bhHitRefs.find(it->id().rawId()); + GlobalPoint xyz = hgcGeometry_[2]->getPosition(it->id()); + if (itr != bhHitRefs.end()) { + float ang3 = xyz.phi().value(); // returns the phi in radians + double fac = sinh(std::get<1>(itr->second)); + double pT = std::get<3>(itr->second) / fac; + double xp = pT * cos(std::get<2>(itr->second)); + double yp = pT * sin(std::get<2>(itr->second)); + hebRecVsSimX->Fill(xp, xyz.x()); + hebRecVsSimY->Fill(yp, xyz.y()); + hebRecVsSimZ->Fill(std::get<3>(itr->second), xyz.z()); + hebdEtaVsEta->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); + hebdPhiVsPhi->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); + hebdzVsZ->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); + hebEnSimRec->Fill(std::get<0>(itr->second), energy); + +#ifdef EDM_ML_DEBUG + edm::LogInfo("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" + << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " + << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" + << energy << ", " << xyz.x() << ", " << xyz.y() << ", " << xyz.z() << ")\n"; +#endif + } } } else { - edm::Handle<HGChebRecHitCollection> bhRecHit; - iEvent.getByToken(bhRecHitTokeng_, bhRecHit); - if (bhRecHit.isValid()) { - const HGChebRecHitCollection* theHits = (bhRecHit.product()); - analyzeHGCalRecHit(theHits, bhHitRefs); - } else { - edm::LogVerbatim("HGCalValid") << "No BH RecHit Found "; - } + edm::LogVerbatim("HGCalValid") << "No BH RecHit Found "; } } @@ -436,41 +379,6 @@ void HGCalHitValidation::analyzeHGCalSimHit(edm::Handle<std::vector<PCaloHit>> c } } -template <class T1> -void HGCalHitValidation::analyzeHGCalRecHit(T1 const& theHits, std::map<unsigned int, HGCHitTuple> const& hitRefs) { - for (auto it = theHits->begin(); it != theHits->end(); ++it) { - DetId id = it->id(); - if (id.det() == DetId::Hcal and id.subdetId() == (int)(HcalEndcap)) { - double energy = it->energy(); - hebEnRec->Fill(energy); - GlobalPoint xyz = hcGeometry_->getGeometry(id)->getPosition(); - - std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(id.rawId()); - if (itr != hitRefs.end()) { - float ang3 = xyz.phi().value(); // returns the phi in radians - double fac = sinh(std::get<1>(itr->second)); - double pT = std::get<3>(itr->second) / fac; - double xp = pT * cos(std::get<2>(itr->second)); - double yp = pT * sin(std::get<2>(itr->second)); - hebRecVsSimX->Fill(xp, xyz.x()); - hebRecVsSimY->Fill(yp, xyz.y()); - hebRecVsSimZ->Fill(std::get<3>(itr->second), xyz.z()); - hebdEtaVsEta->Fill(std::get<1>(itr->second), (xyz.eta() - std::get<1>(itr->second))); - hebdPhiVsPhi->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); - hebdzVsZ->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); - hebEnSimRec->Fill(std::get<0>(itr->second), energy); - -#ifdef EDM_ML_DEBUG - edm::LogInfo("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" - << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " - << std::get<2>(itr->second) << ", " << std::get<3>(itr->second) << ") Rec (" - << energy << ", " << xyz.x() << ", " << xyz.y() << ", " << xyz.z() << ")\n"; -#endif - } - } - } -} - //define this as a plug-in #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(HGCalHitValidation); diff --git a/Validation/HGCalValidation/python/hgcalHitValidation_cff.py b/Validation/HGCalValidation/python/hgcalHitValidation_cff.py new file mode 100644 index 0000000000000..a7184b58da9fe --- /dev/null +++ b/Validation/HGCalValidation/python/hgcalHitValidation_cff.py @@ -0,0 +1,21 @@ +import FWCore.ParameterSet.Config as cms + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +hgcalHitValidation = DQMEDAnalyzer('HGCalHitValidation', + geometrySource = cms.vstring("HGCalEESensitive", + "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive"), + eeSimHitSource = cms.InputTag("g4SimHits","HGCHitsEE"), + fhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEfront"), + bhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEback"), + eeRecHitSource = cms.InputTag("HGCalRecHit","HGCEERecHits"), + fhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEFRecHits"), + bhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEBRecHits"), + ietaExcludeBH = cms.vint32([]), +) + +from Validation.HGCalValidation.hgcalHitCalibration_cfi import hgcalHitCalibration +from Validation.HGCalValidation.caloparticlevalidation_cfi import caloparticlevalidation + +hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration+caloparticlevalidation) diff --git a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py b/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py deleted file mode 100644 index b3f8fb313cded..0000000000000 --- a/Validation/HGCalValidation/python/hgcalHitValidation_cfi.py +++ /dev/null @@ -1,22 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer -hgcalHitValidation = DQMEDAnalyzer('HGCalHitValidation', - geometrySource = cms.untracked.vstring("HGCalEESensitive", - "HGCalHESiliconSensitive", - "HGCalHEScintillatorSensitive"), - eeSimHitSource = cms.InputTag("g4SimHits","HGCHitsEE"), - fhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEfront"), - bhSimHitSource = cms.InputTag("g4SimHits","HGCHitsHEback"), - eeRecHitSource = cms.InputTag("HGCalRecHit","HGCEERecHits"), - fhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEFRecHits"), - bhRecHitSource = cms.InputTag("HGCalRecHit","HGCHEBRecHits"), - ietaExcludeBH = cms.vint32([]), - ifHCAL = cms.bool(False), - ifHCALsim = cms.bool(False), - ) - -from Validation.HGCalValidation.hgcalHitCalibration_cfi import hgcalHitCalibration -from Validation.HGCalValidation.caloparticlevalidation_cfi import caloparticlevalidation - -hgcalHitValidationSequence = cms.Sequence(hgcalHitValidation+hgcalHitCalibration+caloparticlevalidation) diff --git a/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py b/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py index afff0638dcca9..6a00250412ea9 100644 --- a/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py +++ b/Validation/HGCalValidation/test/python/protoHGCalSimWatcher_cfg.py @@ -1,29 +1,29 @@ ############################################################################### # Way to use this: -# cmsRun protoVHGCalSimWatcher_cfg.py geometry=D71 +# cmsRun protoHGCalSimWatcher_cfg.py geometry=D77 # -# Options for geometry D49, D68, D70, D71 +# Options for geometry D49, D68, D77, D83, D84 # ############################################################################### import FWCore.ParameterSet.Config as cms import os, sys, imp, re import FWCore.ParameterSet.VarParsing as VarParsing -############################################################ +#################################################################### ### SETUP OPTIONS options = VarParsing.VarParsing('standard') options.register('geometry', "D71", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D49, D68, D70, D71") + "geometry of operations: D49, D68, D84, D77, D83") ### get and parse the command line arguments options.parseArguments() print(options) -############################################################ +#################################################################### # Use the options if (options.geometry == "D49"): @@ -36,16 +36,21 @@ process = cms.Process('PROD',Phase2C12) process.load('Configuration.Geometry.GeometryExtended2026D68_cff') process.load('Configuration.Geometry.GeometryExtended2026D68Reco_cff') -elif (options.geometry == "D70"): +elif (options.geometry == "D83"): + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D83_cff') + process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') +elif (options.geometry == "D84"): from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D70_cff') - process.load('Configuration.Geometry.GeometryExtended2026D70Reco_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84Reco_cff') else: - from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 - process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D71_cff') - process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff') + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D77_cff') + process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') diff --git a/Validation/HGCalValidation/test/python/protoSimValid_cfg.py b/Validation/HGCalValidation/test/python/protoSimValid_cfg.py index d38f81c7bd083..af4eb29b09f9c 100644 --- a/Validation/HGCalValidation/test/python/protoSimValid_cfg.py +++ b/Validation/HGCalValidation/test/python/protoSimValid_cfg.py @@ -1,8 +1,8 @@ ############################################################################### # Way to use this: -# cmsRun protoSimValid_cfg.py geometry=D71 type=hgcalBHValidation +# cmsRun protoSimValid_cfg.py geometry=D77 type=hgcalBHValidation # -# Options for geometry D49, D68, D70, D71 +# Options for geometry D49, D68, D77, D83, D84 # type hgcalBHValidation, hgcalSiliconValidation # ############################################################################### @@ -14,10 +14,10 @@ ### SETUP OPTIONS options = VarParsing.VarParsing('standard') options.register('geometry', - "D71", + "D77", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D49, D68, D70, D71") + "geometry of operations: D49, D68, D77, D83, D84") options.register ('type', "hgcalBHValidation", VarParsing.VarParsing.multiplicity.singleton, @@ -50,24 +50,33 @@ fileName = 'hgcSilValidD68.root' else: fileName = 'hgcBHValidD68.root' -elif (options.geometry == "D70"): +elif (options.geometry == "D83"): + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D83_cff') + process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') + if (options.type == "hgcalSiliconValidation"): + fileName = 'hgcSilValidD83.root' + else: + fileName = 'hgcBHValidD83.root' +elif (options.geometry == "D84"): from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D70_cff') - process.load('Configuration.Geometry.GeometryExtended2026D70Reco_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84Reco_cff') if (options.type == "hgcalSiliconValidation"): - fileName = 'hgcSilValidD70.root' + fileName = 'hgcSilValidD84.root' else: - fileName = 'hgcBHValidD70.root' + fileName = 'hgcBHValidD84.root' else: - from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 - process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D71_cff') - process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff') + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D77_cff') + process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') if (options.type == "hgcalSiliconValidation"): - fileName = 'hgcSilValidD71.root' + fileName = 'hgcSilValidD77.root' else: - fileName = 'hgcBHValidD71.root' + fileName = 'hgcBHValidD77.root' # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') diff --git a/Validation/HGCalValidation/test/python/protoValid_cfg.py b/Validation/HGCalValidation/test/python/protoValid_cfg.py index 9efe6d5e0f00a..75fa6ebdeccaf 100644 --- a/Validation/HGCalValidation/test/python/protoValid_cfg.py +++ b/Validation/HGCalValidation/test/python/protoValid_cfg.py @@ -1,8 +1,8 @@ ############################################################################### # Way to use this: -# cmsRun protoValid_cfg.py geometry=D71 type=hgcalSimHitStudy defaultInput=1 +# cmsRun protoValid_cfg.py geometry=D77 type=hgcalSimHitStudy defaultInput=1 # -# Options for geometry D49, D68, D70, D71 +# Options for geometry D49, D68, D77, D83, D84 # type hgcalGeomCheck, hgcalSimHitStudy, hgcalDigiStudy, # hgcalRecHitStudy, hgcalSiliconValidation # defaultInput 1, 0 @@ -16,10 +16,10 @@ ### SETUP OPTIONS options = VarParsing.VarParsing('standard') options.register('geometry', - "D71", + "D83", VarParsing.VarParsing.multiplicity.singleton, VarParsing.VarParsing.varType.string, - "geometry of operations: D49, D68, D70, D71") + "geometry of operations: D49, D68, D77, D83, D84") options.register('type', "hgcalGeomCheck", VarParsing.VarParsing.multiplicity.singleton, @@ -75,42 +75,60 @@ fileName = 'hgcSilValidD68.root' else: fileName = 'hgcGeomCheckD68.root' -elif (options.geometry == "D70"): +elif (options.geometry == "D83"): + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D83_cff') + process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') + if (options.type == "hgcalSimHitStudy"): + fileName = 'hgcSimHitD83.root' + elif (options.type == "hgcalDigiStudy"): + fileName = 'hgcDigiD83.root' + elif (options.type == "hgcalRecHitStudy"): + fileName = 'hgcRecHitD83.root' + elif (options.type == "hgcalSiliconValidation"): + if (options.defaultInput == 0): + fileName = 'hgcDigValidD83.root' + else: + fileName = 'hgcSilValidD83.root' + else: + fileName = 'hgcGeomCheckD83.root' +elif (options.geometry == "D84"): from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D70_cff') - process.load('Configuration.Geometry.GeometryExtended2026D70Reco_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84_cff') + process.load('Configuration.Geometry.GeometryExtended2026D84Reco_cff') if (options.type == "hgcalSimHitStudy"): - fileName = 'hgcSimHitD70.root' + fileName = 'hgcSimHitD84.root' elif (options.type == "hgcalDigiStudy"): - fileName = 'hgcDigiD70.root' + fileName = 'hgcDigiD84.root' elif (options.type == "hgcalRecHitStudy"): - fileName = 'hgcRecHitD70.root' + fileName = 'hgcRecHitD84.root' elif (options.type == "hgcalSiliconValidation"): if (options.defaultInput == 0): - fileName = 'hgcDigValidD70.root' + fileName = 'hgcDigValidD84.root' else: - fileName = 'hgcSilValidD70.root' + fileName = 'hgcSilValidD84.root' else: - fileName = 'hgcGeomCheckD70.root' + fileName = 'hgcGeomCheckD84.root' else: - from Configuration.Eras.Era_Phase2C11_cff import Phase2C11 - process = cms.Process('PROD',Phase2C11) - process.load('Configuration.Geometry.GeometryExtended2026D71_cff') - process.load('Configuration.Geometry.GeometryExtended2026D71Reco_cff') + from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 + process = cms.Process('PROD',Phase2C11M9) + process.load('Configuration.Geometry.GeometryExtended2026D77_cff') + process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') if (options.type == "hgcalSimHitStudy"): - fileName = 'hgcSimHitD71.root' + fileName = 'hgcSimHitD77.root' elif (options.type == "hgcalDigiStudy"): - fileName = 'hgcDigiD71.root' + fileName = 'hgcDigiD77.root' elif (options.type == "hgcalRecHitStudy"): - fileName = 'hgcRecHitD71.root' + fileName = 'hgcRecHitD77.root' elif (options.type == "hgcalSiliconValidation"): if (options.defaultInput == 0): - fileName = 'hgcDigValidD71.root' + fileName = 'hgcDigValidD77.root' else: - fileName = 'hgcSilValidD71.root' + fileName = 'hgcSilValidD77.root' else: - fileName = 'hgcGeomCheckD71.root' + fileName = 'hgcGeomCheckD77.root' process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") process.load("Configuration.StandardSequences.MagneticField_cff") diff --git a/Validation/HGCalValidation/test/python/standalone_fromRECO.py b/Validation/HGCalValidation/test/python/standalone_fromRECO.py index ef5c90850dbc5..cf1f6ce3c7177 100644 --- a/Validation/HGCalValidation/test/python/standalone_fromRECO.py +++ b/Validation/HGCalValidation/test/python/standalone_fromRECO.py @@ -1,14 +1,13 @@ import FWCore.ParameterSet.Config as cms - -from Configuration.Eras.Era_Phase2_cff import Phase2 -process = cms.Process('HGCAL',Phase2) +from Configuration.Eras.Era_Phase2C11M9_cff import Phase2C11M9 +process = cms.Process('HGCAL',Phase2C11M9) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.Geometry.GeometryExtended2023D17Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D83Reco_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.maxEvents = cms.untracked.PSet( @@ -22,7 +21,7 @@ ) process.options = cms.untracked.PSet( - + SkipEvent = cms.untracked.vstring('ProductNotFound') ) # Production Info @@ -45,10 +44,13 @@ # Additional output definition from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T21', '') process.load("Validation.HGCalValidation.hgcalHitValidation_cfi") -process.dqmoffline_step = cms.EndPath(process.hgcalHitValidationSequece) +process.load("Validation.HGCalValidation.hgcalHitCalibration_cfi") +process.load("Validation.HGCalValidation.caloparticlevalidation_cfi") + +process.dqmoffline_step = cms.EndPath(process.hgcalHitValidation+process.hgcalHitCalibration+process.caloparticlevalidation) process.DQMoutput_step = cms.EndPath(process.DQMoutput) # Schedule definition From 84d94bf3a7405024986c0bef810b638351528395 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 3 May 2021 22:06:01 +0200 Subject: [PATCH 129/309] Code check --- .../plugins/HGCalBHValidation.cc | 23 ++++++------- .../plugins/HGCalHitValidation.cc | 32 +++++++++---------- 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Validation/HGCalValidation/plugins/HGCalBHValidation.cc b/Validation/HGCalValidation/plugins/HGCalBHValidation.cc index cb8978a80b5ef..ed212051e4108 100644 --- a/Validation/HGCalValidation/plugins/HGCalBHValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalBHValidation.cc @@ -125,9 +125,9 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { int eta(0), phi(0), lay(0); bool bh = (DetId(id).det() == DetId::HGCalHSc); if (bh) { - eta = HGCScintillatorDetId(id).ieta(); - phi = HGCScintillatorDetId(id).iphi(); - lay = HGCScintillatorDetId(id).layer(); + eta = HGCScintillatorDetId(id).ieta(); + phi = HGCScintillatorDetId(id).iphi(); + lay = HGCScintillatorDetId(id).layer(); } double eta1 = (eta >= 0) ? (eta + 0.1) : (eta - 0.1); if (bh) { @@ -143,7 +143,8 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { ensum += energy; map_try[id] = ensum; ++i; - edm::LogVerbatim("HGCalValidation") << "HGCalBHHit[" << i << "] ID " << std::hex << " " << id << std::dec << " " << HGCScintillatorDetId(id) << " E " << energy << " time " << time; + edm::LogVerbatim("HGCalValidation") << "HGCalBHHit[" << i << "] ID " << std::hex << " " << id << std::dec << " " + << HGCScintillatorDetId(id) << " E " << energy << " time " << time; } } for (std::map<unsigned int, double>::iterator itr = map_try.begin(); itr != map_try.end(); ++itr) { @@ -156,19 +157,19 @@ void HGCalBHValidation::analyze(const edm::Event& e, const edm::EventSetup&) { edm::Handle<HGCalDigiCollection> hecoll; e.getByToken(tok_digi_, hecoll); edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation.: " - << "HGCalDigiCollection obtained with" - << " flag " << hecoll.isValid(); + << "HGCalDigiCollection obtained with" + << " flag " << hecoll.isValid(); if (hecoll.isValid()) { edm::LogVerbatim("HGCalValidation") << "HGCalBHValidation: HGCalDigi " - << "buffer " << hecoll->size(); + << "buffer " << hecoll->size(); for (HGCalDigiCollection::const_iterator it = hecoll->begin(); it != hecoll->end(); ++it) { HGCalDataFrame df(*it); double energy = df[iSample_].data(); bool bh = (DetId(df.id()).det() == DetId::HGCalHSc); if (bh) { - HGCScintillatorDetId cell(df.id()); - int depth = cell.layer(); - analyzeDigi(cell, energy, bh, depth, kount); + HGCScintillatorDetId cell(df.id()); + int depth = cell.layer(); + analyzeDigi(cell, energy, bh, depth, kount); } } } @@ -189,7 +190,7 @@ void HGCalBHValidation::analyzeDigi( hdi3Oc_->Fill(eta1, depth); ++kount; edm::LogVerbatim("HGCalValidation") - << "HGCalBHDigit[" << kount << "] ID " << cell << " E " << energy << ":" << (energy > threshold_); + << "HGCalBHDigit[" << kount << "] ID " << cell << " E " << energy << ":" << (energy > threshold_); } } } diff --git a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc index 3054699f1a1ca..d8f76294093f0 100644 --- a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc @@ -117,16 +117,14 @@ HGCalHitValidation::~HGCalHitValidation() {} void HGCalHitValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - std::vector<std::string> source = {"HGCalEESensitive", - "HGCalHESiliconSensitive", - "HGCalHEScintillatorSensitive"}; + std::vector<std::string> source = {"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"}; desc.add<std::vector<std::string>>("geometrySource", source); - desc.add<edm::InputTag>("eeSimHitSource", edm::InputTag("g4SimHits","HGCHitsEE")); - desc.add<edm::InputTag>("fhSimHitSource", edm::InputTag("g4SimHits","HGCHitsHEfront")); - desc.add<edm::InputTag>("bhSimHitSource", edm::InputTag("g4SimHits","HGCHitsHEback")); - desc.add<edm::InputTag>("eeRecHitSource", edm::InputTag("HGCalRecHit","HGCEERecHits")); - desc.add<edm::InputTag>("fhRecHitSource", edm::InputTag("HGCalRecHit","HGCHEFRecHits")); - desc.add<edm::InputTag>("bhRecHitSource", edm::InputTag("HGCalRecHit","HGCHEBRecHits")); + desc.add<edm::InputTag>("eeSimHitSource", edm::InputTag("g4SimHits", "HGCHitsEE")); + desc.add<edm::InputTag>("fhSimHitSource", edm::InputTag("g4SimHits", "HGCHitsHEfront")); + desc.add<edm::InputTag>("bhSimHitSource", edm::InputTag("g4SimHits", "HGCHitsHEback")); + desc.add<edm::InputTag>("eeRecHitSource", edm::InputTag("HGCalRecHit", "HGCEERecHits")); + desc.add<edm::InputTag>("fhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEFRecHits")); + desc.add<edm::InputTag>("bhRecHitSource", edm::InputTag("HGCalRecHit", "HGCHEBRecHits")); std::vector<int> dummy; desc.add<std::vector<int>>("ietaExcludeBH", dummy); descriptions.add("hgcalHitValidation", desc); @@ -164,7 +162,7 @@ void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, hefEnRec = iB.book1D("hefEnRec", "", 1000, 0, 10); hefEnSim = iB.book1D("hefEnSim", "", 1000, 0, 0.01); hefEnSimRec = iB.book2D("hefEnSimRec", "", 200, 0, 0.001, 200, 0, 0.5); - + hebEnRec = iB.book1D("hebEnRec", "", 1000, 0, 15); hebEnSim = iB.book1D("hebEnSim", "", 1000, 0, 0.01); hebEnSimRec = iB.book2D("hebEnSimRec", "", 200, 0, 0.02, 200, 0, 4); @@ -196,7 +194,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup //Accesing ee simhits edm::Handle<std::vector<PCaloHit>> eeSimHits; iEvent.getByToken(eeSimHitToken_, eeSimHits); - + if (eeSimHits.isValid()) { analyzeHGCalSimHit(eeSimHits, 0, heeEnSim, eeHitRefs); #ifdef EDM_ML_DEBUG @@ -210,7 +208,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No EE SimHit Found "; } - + //Accesing fh simhits edm::Handle<std::vector<PCaloHit>> fhSimHits; iEvent.getByToken(fhSimHitToken_, fhSimHits); @@ -227,7 +225,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No FH SimHit Found "; } - + //Accessing bh simhits edm::Handle<std::vector<PCaloHit>> bhSimHits; iEvent.getByToken(bhSimHitToken_, bhSimHits); @@ -274,7 +272,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No EE RecHit Found "; } - + //accessing FH Rechit information edm::Handle<HGChefRecHitCollection> fhRecHit; iEvent.getByToken(fhRecHitToken_, fhRecHit); @@ -286,7 +284,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId()); if (itr != fhHitRefs.end()) { GlobalPoint xyz = hgcGeometry_[1]->getPosition(it->id()); - + hefRecVsSimX->Fill(std::get<1>(itr->second), xyz.x()); hefRecVsSimY->Fill(std::get<2>(itr->second), xyz.y()); hefRecVsSimZ->Fill(std::get<3>(itr->second), xyz.z()); @@ -305,7 +303,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup } else { edm::LogVerbatim("HGCalValid") << "No FH RecHit Found "; } - + //accessing BH Rechit information edm::Handle<HGChebRecHitCollection> bhRecHit; iEvent.getByToken(bhRecHitToken_, bhRecHit); @@ -329,7 +327,7 @@ void HGCalHitValidation::analyze(const edm::Event& iEvent, const edm::EventSetup hebdPhiVsPhi->Fill(std::get<2>(itr->second), (ang3 - std::get<2>(itr->second))); hebdzVsZ->Fill(std::get<3>(itr->second), (xyz.z() - std::get<3>(itr->second))); hebEnSimRec->Fill(std::get<0>(itr->second), energy); - + #ifdef EDM_ML_DEBUG edm::LogInfo("HGCalValid") << "BHHit: " << std::hex << id.rawId() << std::dec << " Sim (" << std::get<0>(itr->second) << ", " << std::get<1>(itr->second) << ", " From 87f95fe1b5cceb1892dc542e24db4fd89e4ffdf0 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 15:31:17 -0500 Subject: [PATCH 130/309] use quality assignment --- .../interface/CSCMotherboard.h | 34 +---- .../interface/LCTQualityAssignment.h | 3 +- .../src/CSCGEMMotherboard.cc | 8 +- .../src/CSCMotherboard.cc | 116 +----------------- .../src/LCTQualityAssignment.cc | 2 +- 5 files changed, 14 insertions(+), 149 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h index 7051e84e109ea..9cae9e38ca1fc 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboard.h @@ -122,6 +122,9 @@ class CSCMotherboard : public CSCBaseboard { static const unsigned int def_match_trig_enable, def_match_trig_window_size; static const unsigned int def_tmb_l1a_window_size; + /* quality assignment */ + std::unique_ptr<LCTQualityAssignment> qualityAssignment_; + /* quality control */ std::unique_ptr<LCTQualityControl> qualityControl_; @@ -141,37 +144,6 @@ class CSCMotherboard : public CSCBaseboard { // CLCT pattern number: encodes the pattern number itself unsigned int encodePattern(const int clctPattern) const; - // 4-bit LCT quality number.Made by TMB lookup tables and used for MPC sorting. - enum class LCT_Quality : unsigned int { - INVALID = 0, - NO_CLCT = 1, - NO_ALCT = 2, - CLCT_LAYER_TRIGGER = 3, - LOW_QUALITY = 4, - MARGINAL_ANODE_CATHODE = 5, - HQ_ANODE_MARGINAL_CATHODE = 6, - HQ_CATHODE_MARGINAL_ANODE = 7, - HQ_ACCEL_ALCT = 8, - HQ_RESERVED_1 = 9, - HQ_RESERVED_2 = 10, - HQ_PATTERN_2_3 = 11, - HQ_PATTERN_4_5 = 12, - HQ_PATTERN_6_7 = 13, - HQ_PATTERN_8_9 = 14, - HQ_PATTERN_10 = 15 - }; - - enum class LCT_QualityRun3 : unsigned int { - INVALID = 0, - LowQ = 1, - MedQ = 2, - HighQ = 3, - }; - - LCT_Quality findQuality(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const; - - LCT_QualityRun3 findQualityRun3(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const; - /** Dump TMB/MPC configuration parameters. */ void dumpConfigParams() const; diff --git a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h index 5b90f0eaaad54..a87a9304435c4 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h @@ -57,7 +57,7 @@ class LCTQualityAssignment { }; // constructor - LCTQualityAssignment(bool isRun3, unsigned station); + LCTQualityAssignment(unsigned station); // quality for all LCTs in Run-1 and Run-2 unsigned findQualityRun2(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const; @@ -72,7 +72,6 @@ class LCTQualityAssignment { unsigned findQualityGEMv2(const CSCALCTDigi&, const CSCCLCTDigi&, int gemlayer) const; private: - bool isRun3_; unsigned station_; }; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 8f2157fb98b07..9698e05d00667 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -130,9 +130,9 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct if (alct.isValid() and clct.isValid() and gem1.isValid() and not gem2.isValid()) { pattern = encodePattern(clct.getPattern()); if (runCCLUT_) { - quality = static_cast<unsigned int>(findQualityGEMv2(alct, clct, 1)); + quality = qualityAssignment_->findQualityGEMv2(alct, clct, 1); } else { - quality = static_cast<unsigned int>(findQualityGEMv1(alct, clct, 1)); + quality = qualityAssignment_->findQualityGEMv1(alct, clct, 1); } bx = alct.getBX(); keyStrip = clct.getKeyStrip(); @@ -154,9 +154,9 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct } else if (alct.isValid() and clct.isValid() and not gem1.isValid() and gem2.isValid()) { pattern = encodePattern(clct.getPattern()); if (runCCLUT_) { - quality = static_cast<unsigned int>(findQualityGEMv2(alct, clct, 2)); + quality = qualityAssignment_->findQualityGEMv2(alct, clct, 2); } else { - quality = static_cast<unsigned int>(findQualityGEMv1(alct, clct, 2)); + quality = qualityAssignment_->findQualityGEMv1(alct, clct, 2); } bx = alct.getBX(); keyStrip = clct.getKeyStrip(); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc index fba66a7432d0e..76282679800eb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc @@ -51,6 +51,9 @@ CSCMotherboard::CSCMotherboard(unsigned endcap, config_dumped = true; } + // quality assignment + qualityAssignment_ = std::make_unique<LCTQualityAssignment>(station); + // quality control of stubs qualityControl_ = std::make_unique<LCTQualityControl>(endcap, station, sector, subsector, chamber, conf); @@ -387,9 +390,9 @@ CSCCorrelatedLCTDigi CSCMotherboard::constructLCTs(const CSCALCTDigi& aLCT, // LCT quality number unsigned int quality; if (runCCLUT_) { - quality = static_cast<unsigned int>(findQualityRun3(aLCT, cLCT)); + quality = qualityAssignment_->findQualityRun3(aLCT, cLCT); } else { - quality = static_cast<unsigned int>(findQuality(aLCT, cLCT)); + quality = qualityAssignment_->findQualityRun2(aLCT, cLCT); } // Bunch crossing: get it from cathode LCT if anode LCT is not there. @@ -438,115 +441,6 @@ unsigned int CSCMotherboard::encodePattern(const int ptn) const { return pattern; } -// 4-bit LCT quality number. -CSCMotherboard::LCT_Quality CSCMotherboard::findQuality(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const { - // Either ALCT or CLCT is invalid - if (!(aLCT.isValid()) || !(cLCT.isValid())) { - // No CLCT - if (aLCT.isValid() && !(cLCT.isValid())) - return LCT_Quality::NO_CLCT; - - // No ALCT - else if (!(aLCT.isValid()) && cLCT.isValid()) - return LCT_Quality::NO_ALCT; - - // No ALCT and no CLCT - else - return LCT_Quality::INVALID; - } - // Both ALCT and CLCT are valid - else { - const int pattern(cLCT.getPattern()); - - // Layer-trigger in CLCT - if (pattern == 1) - return LCT_Quality::CLCT_LAYER_TRIGGER; - - // Multi-layer pattern in CLCT - else { - // ALCT quality is the number of layers hit minus 3. - const bool a4(aLCT.getQuality() >= 1); - - // CLCT quality is the number of layers hit. - const bool c4(cLCT.getQuality() >= 4); - - // quality = 4; "reserved for low-quality muons in future" - - // marginal anode and cathode - if (!a4 && !c4) - return LCT_Quality::MARGINAL_ANODE_CATHODE; - - // HQ anode, but marginal cathode - else if (a4 && !c4) - return LCT_Quality::HQ_ANODE_MARGINAL_CATHODE; - - // HQ cathode, but marginal anode - else if (!a4 && c4) - return LCT_Quality::HQ_CATHODE_MARGINAL_ANODE; - - // HQ muon, but accelerator ALCT - else if (a4 && c4) { - if (aLCT.getAccelerator()) - return LCT_Quality::HQ_ACCEL_ALCT; - - else { - // quality = 9; "reserved for HQ muons with future patterns - // quality = 10; "reserved for HQ muons with future patterns - - // High quality muons are determined by their CLCT pattern - if (pattern == 2 || pattern == 3) - return LCT_Quality::HQ_PATTERN_2_3; - - else if (pattern == 4 || pattern == 5) - return LCT_Quality::HQ_PATTERN_4_5; - - else if (pattern == 6 || pattern == 7) - return LCT_Quality::HQ_PATTERN_6_7; - - else if (pattern == 8 || pattern == 9) - return LCT_Quality::HQ_PATTERN_8_9; - - else if (pattern == 10) - return LCT_Quality::HQ_PATTERN_10; - - else { - edm::LogWarning("CSCMotherboard") - << "findQuality: Unexpected CLCT pattern id = " << pattern << " in " << theCSCName_; - return LCT_Quality::INVALID; - } - } - } - } - } - return LCT_Quality::INVALID; -} - -// 2-bit LCT quality number for Run-3 -CSCMotherboard::LCT_QualityRun3 CSCMotherboard::findQualityRun3(const CSCALCTDigi& aLCT, - const CSCCLCTDigi& cLCT) const { - // Run-3 definition - if (!(aLCT.isValid()) and !(cLCT.isValid())) { - return LCT_QualityRun3::INVALID; - } - // use number of layers on each as indicator - else { - bool a4 = (aLCT.getQuality() >= 1); - bool a5 = (aLCT.getQuality() >= 1); - bool a6 = (aLCT.getQuality() >= 1); - - bool c4 = (cLCT.getQuality() >= 4); - bool c5 = (cLCT.getQuality() >= 4); - bool c6 = (cLCT.getQuality() >= 4); - if (a6 or c6) - return LCT_QualityRun3::HighQ; - else if (a5 or c5) - return LCT_QualityRun3::MedQ; - else if (a4 or c4) - return LCT_QualityRun3::LowQ; - } - return LCT_QualityRun3::INVALID; -} - void CSCMotherboard::checkConfigParameters() { // Make sure that the parameter values are within the allowed range. diff --git a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc index 71d5027c1fced..412d4ae312e31 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityAssignment.cc @@ -5,7 +5,7 @@ #include "DataFormats/CSCDigi/interface/CSCCLCTDigi.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" -LCTQualityAssignment::LCTQualityAssignment(bool isRun3, unsigned station) : isRun3_(isRun3), station_(station) {} +LCTQualityAssignment::LCTQualityAssignment(unsigned station) : station_(station) {} // 4-bit LCT quality number. unsigned LCTQualityAssignment::findQualityRun2(const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT) const { From 929425839aaaf6b19701ecc5f98c72393cde5faa Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 16:02:00 -0500 Subject: [PATCH 131/309] GEM-CSC luts based on D80 --- .../{test => plugins}/GEMCSCLUTAnalyzer.cc | 162 +++++++++++++++--- .../CSCTriggerPrimitives/test/BuildFile.xml | 7 - .../test/runGEMCSCLUTAnalyzer_cfg.py | 2 +- 3 files changed, 139 insertions(+), 32 deletions(-) rename L1Trigger/CSCTriggerPrimitives/{test => plugins}/GEMCSCLUTAnalyzer.cc (72%) delete mode 100644 L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml diff --git a/L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc similarity index 72% rename from L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc index 1c4a19470c5bc..a1745ba31891a 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc @@ -55,6 +55,9 @@ class GEMCSCLUTAnalyzer : public edm::one::EDAnalyzer<> { void cscEsToGemPadLUT( const CSCLayer*, const GEMEtaPartition*, int minH, int maxH, std::vector<std::pair<int, int>>&) const; + // create LUT: pad->HS + void gemPadToCscHsLUT(const CSCLayer*, const GEMEtaPartition*, std::vector<int>&) const; + // create LUT: pad->ES void gemPadToCscEsLUT(const CSCLayer*, const GEMEtaPartition*, std::vector<int>&) const; @@ -132,7 +135,10 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { std::vector<std::pair<int, int>> cscEsToGemPadME1b; std::vector<int> gemPadToCscEsME1a; std::vector<int> gemPadToCscEsME1b; - std::vector<std::pair<int, int>> gemRollToCscWg; + std::vector<int> gemPadToCscHsME1a; + std::vector<int> gemPadToCscHsME1b; + std::vector<std::pair<int, int>> gemRollL1ToCscWg; + std::vector<std::pair<int, int>> gemRollL2ToCscWg; gemRollToEtaLimitsLUT(gemChamber_l1, gemRollEtaLimits_l1); gemRollToEtaLimitsLUT(gemChamber_l2, gemRollEtaLimits_l2); @@ -141,14 +147,27 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2); cscEsToGemPadLUT(keyLayerME1a, randRoll, 2, 94, cscEsToGemPadME1a); cscEsToGemPadLUT(keyLayerME1b, randRoll, 4, 124, cscEsToGemPadME1b); + gemPadToCscHsLUT(keyLayerME1a, randRoll, gemPadToCscHsME1a); + gemPadToCscHsLUT(keyLayerME1b, randRoll, gemPadToCscHsME1b); gemPadToCscEsLUT(keyLayerME1a, randRoll, gemPadToCscEsME1a); gemPadToCscEsLUT(keyLayerME1b, randRoll, gemPadToCscEsME1b); - gemRollToCscWgLUT(keyLayerME1b, gemChamber_l1, gemRollToCscWg); + gemRollToCscWgLUT(keyLayerME1b, gemChamber_l1, gemRollL1ToCscWg); + gemRollToCscWgLUT(keyLayerME1b, gemChamber_l2, gemRollL2ToCscWg); const std::string oddeven(id.chamber() % 2 == 0 ? "_even" : "_odd"); std::ofstream ofos; // simulation LUTs + ofos.open("GEMCSCLUT_pad_hs_ME1a" + oddeven + ".txt"); + for (const auto& p : gemPadToCscHsME1a) + ofos << p << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_pad_hs_ME1b" + oddeven + ".txt"); + for (const auto& p : gemPadToCscHsME1b) + ofos << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME1a" + oddeven + ".txt"); for (const auto& p : gemPadToCscEsME1a) ofos << p << std::endl; @@ -159,17 +178,37 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { ofos << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME11" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) + ofos << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) + ofos << p.second << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) ofos << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME11" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME11" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) ofos << p.second << std::endl; ofos.close(); // firmware LUTs + ofos.open("GEMCSCLUT_pad_hs_ME1a" + oddeven + ".mem"); + for (const auto& p : gemPadToCscHsME1a) + ofos << std::hex << p << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_pad_hs_ME1b" + oddeven + ".mem"); + for (const auto& p : gemPadToCscHsME1b) + ofos << std::hex << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME1a" + oddeven + ".mem"); for (const auto& p : gemPadToCscEsME1a) ofos << std::hex << p << std::endl; @@ -180,13 +219,23 @@ void GEMCSCLUTAnalyzer::generateLUTsME11(const CSCDetId& id) const { ofos << std::hex << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME11" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) ofos << std::hex << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME11" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) + ofos << std::hex << p.second << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) + ofos << std::hex << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME11" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) ofos << std::hex << p.second << std::endl; ofos.close(); } @@ -209,8 +258,10 @@ void GEMCSCLUTAnalyzer::generateLUTsME21(const CSCDetId& csc_id) const { std::vector<std::pair<int, int>> cscWgToGemRoll_l1; std::vector<std::pair<int, int>> cscWgToGemRoll_l2; std::vector<std::pair<int, int>> cscEsToGemPad; + std::vector<int> gemPadToCscHs; std::vector<int> gemPadToCscEs; - std::vector<std::pair<int, int>> gemRollToCscWg; + std::vector<std::pair<int, int>> gemRollL1ToCscWg; + std::vector<std::pair<int, int>> gemRollL2ToCscWg; gemRollToEtaLimitsLUT(gemChamber_l1, gemRollEtaLimits_l1); gemRollToEtaLimitsLUT(gemChamber_l2, gemRollEtaLimits_l2); @@ -218,41 +269,74 @@ void GEMCSCLUTAnalyzer::generateLUTsME21(const CSCDetId& csc_id) const { cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l1, cscWgToGemRoll_l1); cscWgToRollLUT(cscWGToEtaLimits, gemRollEtaLimits_l2, cscWgToGemRoll_l2); cscEsToGemPadLUT(keyLayer, randRoll, 4, 155, cscEsToGemPad); + gemPadToCscHsLUT(keyLayer, randRoll, gemPadToCscHs); gemPadToCscEsLUT(keyLayer, randRoll, gemPadToCscEs); - gemRollToCscWgLUT(keyLayer, gemChamber_l1, gemRollToCscWg); + gemRollToCscWgLUT(keyLayer, gemChamber_l1, gemRollL1ToCscWg); + gemRollToCscWgLUT(keyLayer, gemChamber_l2, gemRollL2ToCscWg); const std::string oddeven(csc_id.chamber() % 2 == 0 ? "_even" : "_odd"); std::ofstream ofos; // simulation LUTs + ofos.open("GEMCSCLUT_pad_hs_ME21" + oddeven + ".txt"); + for (const auto& p : gemPadToCscHs) + ofos << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME21" + oddeven + ".txt"); for (const auto& p : gemPadToCscEs) ofos << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME21" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) + ofos << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) ofos << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME21" + oddeven + ".txt"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL1ToCscWg) ofos << p.second << std::endl; ofos.close(); + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME21" + oddeven + ".txt"); + for (const auto& p : gemRollL2ToCscWg) + ofos << p.second << std::endl; + ofos.close(); + + // firmware LUTs + ofos.open("GEMCSCLUT_pad_hs_ME21" + oddeven + ".mem"); + for (const auto& p : gemPadToCscHs) + ofos << std::hex << p << std::endl; + ofos.close(); + ofos.open("GEMCSCLUT_pad_es_ME21" + oddeven + ".mem"); for (const auto& p : gemPadToCscEs) ofos << std::hex << p << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_min_wg_ME21" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_min_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) + ofos << std::hex << p.first << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_min_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) ofos << std::hex << p.first << std::endl; ofos.close(); - ofos.open("GEMCSCLUT_roll_max_wg_ME21" + oddeven + ".mem"); - for (const auto& p : gemRollToCscWg) + ofos.open("GEMCSCLUT_roll_l1_max_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL1ToCscWg) + ofos << std::hex << p.second << std::endl; + ofos.close(); + + ofos.open("GEMCSCLUT_roll_l2_max_wg_ME21" + oddeven + ".mem"); + for (const auto& p : gemRollL2ToCscWg) ofos << std::hex << p.second << std::endl; ofos.close(); } @@ -327,6 +411,23 @@ void GEMCSCLUTAnalyzer::cscEsToGemPadLUT(const CSCLayer* keyLayer, } } +void GEMCSCLUTAnalyzer::gemPadToCscHsLUT(const CSCLayer* keyLayer, + const GEMEtaPartition* randRoll, + std::vector<int>& lut) const { + int offset(0); + if (keyLayer->id().ring() == 4) + offset = 64; + const int nGEMPads(randRoll->npads()); + const CSCLayerGeometry* keyLayerGeometry(keyLayer->geometry()); + for (int i = 0; i < nGEMPads; ++i) { + const LocalPoint lpGEM(randRoll->centreOfPad(i)); + const GlobalPoint gp(randRoll->toGlobal(lpGEM)); + const LocalPoint lpCSC(keyLayer->toLocal(gp)); + const float strip(keyLayerGeometry->strip(lpCSC)); + lut.push_back(int((strip + offset) * 2)); + } +} + void GEMCSCLUTAnalyzer::gemPadToCscEsLUT(const CSCLayer* keyLayer, const GEMEtaPartition* randRoll, std::vector<int>& lut) const { @@ -360,15 +461,28 @@ void GEMCSCLUTAnalyzer::gemRollToCscWgLUT(const CSCLayer* keyLayer, const LocalPoint lp_csc_bottom(keyLayer->toLocal(gp_bottom)); const int wire_top(keyLayerGeometry->nearestWire(lp_csc_top)); - const int wg_top(keyLayerGeometry->wireGroup(wire_top)); - const int wire_bottom(keyLayerGeometry->nearestWire(lp_csc_bottom)); - const int wg_bottom(keyLayerGeometry->wireGroup(wire_bottom)); + int wg_top(keyLayerGeometry->wireGroup(wire_top)); + int wg_bottom(keyLayerGeometry->wireGroup(wire_bottom)); + + // override for cases when the function "wireGroup" fails to provide the + // wiregroup number + const int GEM_layer = roll->id().layer(); + const int GEM_roll = roll->id().roll(); + if (roll->isGE21() and GEM_layer == 1) { + // L1 - max + if (GEM_roll == 10) + wg_top = 45; + // L1 - min + if (GEM_roll == 4) + wg_bottom = 80; + if (GEM_roll == 9) + wg_bottom = 46; + } lut.emplace_back(wg_bottom, wg_top); } } - //define this as a plug-in #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(GEMCSCLUTAnalyzer); diff --git a/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml b/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml deleted file mode 100644 index 31bb9be6c7f7c..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml +++ /dev/null @@ -1,7 +0,0 @@ -<use name="Geometry/GEMGeometry"/> -<use name="Geometry/CSCGeometry"/> -<use name="Geometry/Records"/> -<use name="FWCore/Framework"/> -<flags EDM_PLUGIN="1"/> -<library file="GEMCSCLUTAnalyzer.cc" name="GEMCSCLUTAnalyzer"> -</library> diff --git a/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py index ab9a7f8718b0f..a603837a00310 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runGEMCSCLUTAnalyzer_cfg.py @@ -5,7 +5,7 @@ process.load('Configuration.StandardSequences.MagneticField_cff') process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") -process.load('Configuration.Geometry.GeometryExtended2026D74Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D80Reco_cff') from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') From 0cba446de20b4ed6693168a4617559874e0ceccc Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 16:02:53 -0500 Subject: [PATCH 132/309] Use quality functions in LCTQualityAssignment --- .../interface/CSCBaseboard.h | 2 + .../interface/CSCGEMMotherboard.h | 13 -- .../src/CSCGEMMotherboard.cc | 113 ------------------ 3 files changed, 2 insertions(+), 126 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h index a0c1e0be34f39..e085ea4d98844 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCBaseboard.h @@ -9,6 +9,8 @@ #include "DataFormats/CSCDigi/interface/CSCConstants.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCPatternBank.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/LCTQualityAssignment.h" #include "CondFormats/CSCObjects/interface/CSCDBL1TPParameters.h" class CSCBaseboard { diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h index 31b38c3606c1c..c2d71efdd1fe2 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h @@ -181,19 +181,6 @@ class CSCGEMMotherboard : public CSCUpgradeMotherboard { void processGEMPads(const GEMPadDigiCollection* pads); void processGEMCoPads(); - enum LCT_QualityRun3 { - INVALID = 0, - CLCT_2GEM = 3, - ALCT_2GEM = 4, - ALCTCLCT = 5, - ALCTCLCT_1GEM = 6, - ALCTCLCT_2GEM = 7, - }; - - // quality of the LCT when you take into account max 2 GEM layers - CSCMotherboard::LCT_Quality findQualityGEMv1(const CSCALCTDigi&, const CSCCLCTDigi&, int gemlayer) const; - LCT_QualityRun3 findQualityGEMv2(const CSCALCTDigi&, const CSCCLCTDigi&, int gemlayer) const; - // print available trigger pads void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart); void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 9698e05d00667..5ec3ab20621c8 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -371,119 +371,6 @@ void CSCGEMMotherboard::printGEMTriggerCoPads(int bx_start, int bx_stop, enum CS } } -CSCMotherboard::LCT_Quality CSCGEMMotherboard::findQualityGEMv1(const CSCALCTDigi& aLCT, - const CSCCLCTDigi& cLCT, - int gemlayers) const { - // Either ALCT or CLCT is invalid - if (!(aLCT.isValid()) || !(cLCT.isValid())) { - // No CLCT - if (aLCT.isValid() && !(cLCT.isValid())) - return LCT_Quality::NO_CLCT; - - // No ALCT - else if (!(aLCT.isValid()) && cLCT.isValid()) - return LCT_Quality::NO_ALCT; - - // No ALCT and no CLCT - else - return LCT_Quality::INVALID; - } - // Both ALCT and CLCT are valid - else { - const int pattern(cLCT.getPattern()); - - // Layer-trigger in CLCT - if (pattern == 1) - return LCT_Quality::CLCT_LAYER_TRIGGER; - - // Multi-layer pattern in CLCT - else { - // ALCT quality is the number of layers hit minus 3. - bool a4 = false; - - // Case of ME11 with GEMs: require 4 layers for ALCT - if (theStation == 1) - a4 = aLCT.getQuality() >= 1; - - // Case of ME21 with GEMs: require 4 layers for ALCT+GEM - if (theStation == 2) - a4 = aLCT.getQuality() + gemlayers >= 1; - - // CLCT quality is the number of layers hit. - const bool c4((cLCT.getQuality() >= 4) or (cLCT.getQuality() >= 3 and gemlayers >= 1)); - - // quality = 4; "reserved for low-quality muons in future" - - // marginal anode and cathode - if (!a4 && !c4) - return LCT_Quality::MARGINAL_ANODE_CATHODE; - - // HQ anode, but marginal cathode - else if (a4 && !c4) - return LCT_Quality::HQ_ANODE_MARGINAL_CATHODE; - - // HQ cathode, but marginal anode - else if (!a4 && c4) - return LCT_Quality::HQ_CATHODE_MARGINAL_ANODE; - - // HQ muon, but accelerator ALCT - else if (a4 && c4) { - if (aLCT.getAccelerator()) - return LCT_Quality::HQ_ACCEL_ALCT; - - else { - // quality = 9; "reserved for HQ muons with future patterns - // quality = 10; "reserved for HQ muons with future patterns - - // High quality muons are determined by their CLCT pattern - if (pattern == 2 || pattern == 3) - return LCT_Quality::HQ_PATTERN_2_3; - - else if (pattern == 4 || pattern == 5) - return LCT_Quality::HQ_PATTERN_4_5; - - else if (pattern == 6 || pattern == 7) - return LCT_Quality::HQ_PATTERN_6_7; - - else if (pattern == 8 || pattern == 9) - return LCT_Quality::HQ_PATTERN_8_9; - - else if (pattern == 10) - return LCT_Quality::HQ_PATTERN_10; - - else { - edm::LogWarning("CSCGEMMotherboard") - << "findQualityGEMv1: Unexpected CLCT pattern id = " << pattern << " in " << theCSCName_; - return LCT_Quality::INVALID; - } - } - } - } - } - return LCT_Quality::INVALID; -} - -CSCGEMMotherboard::LCT_QualityRun3 CSCGEMMotherboard::findQualityGEMv2(const CSCALCTDigi& aLCT, - const CSCCLCTDigi& cLCT, - int gemlayers) const { - // ALCT and CLCT invalid - if (!(aLCT.isValid()) and !(cLCT.isValid())) { - return LCT_QualityRun3::INVALID; - } else if (!aLCT.isValid() && cLCT.isValid() and gemlayers == 2) { - return LCT_QualityRun3::CLCT_2GEM; - } else if (aLCT.isValid() && !cLCT.isValid() and gemlayers == 2) { - return LCT_QualityRun3::ALCT_2GEM; - } else if (aLCT.isValid() && cLCT.isValid()) { - if (gemlayers == 0) - return LCT_QualityRun3::ALCTCLCT; - else if (gemlayers == 1) - return LCT_QualityRun3::ALCTCLCT_1GEM; - else if (gemlayers == 2) - return LCT_QualityRun3::ALCTCLCT_2GEM; - } - return LCT_QualityRun3::INVALID; -} - template <> const matchesBX<GEMPadDigi>& CSCGEMMotherboard::getPads<GEMPadDigi>() const { return pads_; From 110e042d389d0208bab5d0091b4b5ecbfad9c8ab Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 16:07:44 -0500 Subject: [PATCH 133/309] Code format --- L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc index a1745ba31891a..69495374e627e 100644 --- a/L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc @@ -308,7 +308,6 @@ void GEMCSCLUTAnalyzer::generateLUTsME21(const CSCDetId& csc_id) const { ofos << p.second << std::endl; ofos.close(); - // firmware LUTs ofos.open("GEMCSCLUT_pad_hs_ME21" + oddeven + ".mem"); for (const auto& p : gemPadToCscHs) From 10868c043078840f605c274dc09f61e9178fbf67 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Tue, 4 May 2021 00:08:00 +0200 Subject: [PATCH 134/309] Use ESGetToken --- .../HGCalValidation/plugins/HGCalHitValidation.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc index d8f76294093f0..42abd34ea7e75 100644 --- a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc @@ -80,6 +80,8 @@ class HGCalHitValidation : public DQMEDAnalyzer { edm::EDGetTokenT<HGCeeRecHitCollection> eeRecHitToken_; edm::EDGetTokenT<HGChefRecHitCollection> fhRecHitToken_; edm::EDGetTokenT<HGChebRecHitCollection> bhRecHitToken_; + std::vector<edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord>> tok_ddd_; + std::vector<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>> tok_geom_; //histogram related stuff MonitorElement *heedzVsZ, *heedyVsY, *heedxVsX; @@ -106,6 +108,11 @@ HGCalHitValidation::HGCalHitValidation(const edm::ParameterSet& cfg) { bhRecHitToken_ = consumes<HGChebRecHitCollection>(cfg.getParameter<edm::InputTag>("bhRecHitSource")); ietaExcludeBH_ = cfg.getParameter<std::vector<int>>("ietaExcludeBH"); + for (const auto& name : geometrySource_) { + tok_ddd_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + tok_geom_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + } + #ifdef EDM_ML_DEBUG edm::LogInfo("HGCalValid") << "Exclude the following " << ietaExcludeBH_.size() << " ieta values from BH plots"; for (unsigned int k = 0; k < ietaExcludeBH_.size(); ++k) @@ -171,15 +178,13 @@ void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, void HGCalHitValidation::dqmBeginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { //initiating hgc Geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - edm::ESHandle<HGCalDDDConstants> hgcCons; - iSetup.get<IdealGeometryRecord>().get(geometrySource_[i], hgcCons); + edm::ESHandle<HGCalDDDConstants> hgcCons= iSetup.getHandle(tok_ddd_[i]); if (hgcCons.isValid()) { hgcCons_.push_back(hgcCons.product()); } else { edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for " << geometrySource_[i] << std::endl; } - edm::ESHandle<HGCalGeometry> hgcGeom; - iSetup.get<IdealGeometryRecord>().get(geometrySource_[i], hgcGeom); + edm::ESHandle<HGCalGeometry> hgcGeom = iSetup.getHandle(tok_geom_[i]); if (hgcGeom.isValid()) { hgcGeometry_.push_back(hgcGeom.product()); } else { From b6c494518693a60cb9fd7e234a96ab3e9c707741 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Tue, 4 May 2021 00:15:37 +0200 Subject: [PATCH 135/309] Code check --- Validation/HGCalValidation/plugins/HGCalHitValidation.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc index 42abd34ea7e75..9fa1d203597b6 100644 --- a/Validation/HGCalValidation/plugins/HGCalHitValidation.cc +++ b/Validation/HGCalValidation/plugins/HGCalHitValidation.cc @@ -109,8 +109,10 @@ HGCalHitValidation::HGCalHitValidation(const edm::ParameterSet& cfg) { ietaExcludeBH_ = cfg.getParameter<std::vector<int>>("ietaExcludeBH"); for (const auto& name : geometrySource_) { - tok_ddd_.emplace_back(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); - tok_geom_.emplace_back(esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + tok_ddd_.emplace_back( + esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); + tok_geom_.emplace_back( + esConsumes<HGCalGeometry, IdealGeometryRecord, edm::Transition::BeginRun>(edm::ESInputTag{"", name})); } #ifdef EDM_ML_DEBUG @@ -178,7 +180,7 @@ void HGCalHitValidation::bookHistograms(DQMStore::IBooker& iB, edm::Run const&, void HGCalHitValidation::dqmBeginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { //initiating hgc Geometry for (size_t i = 0; i < geometrySource_.size(); i++) { - edm::ESHandle<HGCalDDDConstants> hgcCons= iSetup.getHandle(tok_ddd_[i]); + edm::ESHandle<HGCalDDDConstants> hgcCons = iSetup.getHandle(tok_ddd_[i]); if (hgcCons.isValid()) { hgcCons_.push_back(hgcCons.product()); } else { From 31af37af8878f2eeae04dda04445df6726cdd236 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Tue, 4 May 2021 00:58:35 +0200 Subject: [PATCH 136/309] Update Validation/Configuration/python/hgcalSimValid_cff.py --- Validation/Configuration/python/hgcalSimValid_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/Configuration/python/hgcalSimValid_cff.py b/Validation/Configuration/python/hgcalSimValid_cff.py index 3ac4142386bb0..680caacb61ff6 100644 --- a/Validation/Configuration/python/hgcalSimValid_cff.py +++ b/Validation/Configuration/python/hgcalSimValid_cff.py @@ -9,7 +9,7 @@ from Validation.HGCalValidation.simhitValidation_cff import * from Validation.HGCalValidation.digiValidation_cff import * from Validation.HGCalValidation.rechitValidation_cff import * -from Validation.HGCalValidation.hgcalHitValidation_cfi import * +from Validation.HGCalValidation.hgcalHitValidation_cff import * from RecoHGCal.TICL.SimTracksters_cff import * from Validation.HGCalValidation.HGCalValidator_cfi import hgcalValidator From 33e224d4fa16df1fe68c64676757941aafef1084 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 20:09:49 -0500 Subject: [PATCH 137/309] Use LUTs and CSCALCTCrossCLCT helper class --- .../interface/CSCGEMMotherboardME11.h | 7 -- .../interface/CSCMotherboardME11.h | 6 -- .../interface/CSCUpgradeMotherboard.h | 10 ++- .../interface/CSCUpgradeMotherboardLUT.h | 20 ----- .../src/CSCGEMMotherboardME11.cc | 9 --- .../src/CSCMotherboardME11.cc | 9 --- .../src/CSCUpgradeMotherboard.cc | 10 ++- .../src/CSCUpgradeMotherboardLUT.cc | 78 ------------------- 8 files changed, 17 insertions(+), 132 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h index ae0b3cb8ee826..87f904bcbb75c 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboardME11.h @@ -40,7 +40,6 @@ class CSCGEMMotherboardME11 : public CSCGEMMotherboard { /* access to the LUTs needed for matching */ const CSCGEMMotherboardLUTME11* getLUT() const override { return tmbLUT_.get(); } std::unique_ptr<CSCGEMMotherboardLUTME11> tmbLUT_; - std::unique_ptr<CSCMotherboardLUTME11> cscTmbLUT_; /* readout the LCTs in a sector of ME11 */ std::vector<CSCCorrelatedLCTDigi> readoutLCTsME11(enum CSCPart me1ab) const; @@ -52,12 +51,6 @@ class CSCGEMMotherboardME11 : public CSCGEMMotherboard { void sortLCTs(std::vector<CSCCorrelatedLCTDigi>&, bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const; - /* check if an ALCT cross a CLCT in an ME11 sector */ - bool doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const; - - /* does wiregroup cross halfstrip or not */ - bool doesWiregroupCrossStrip(int key_wg, int key_hs) const override; - /* correlate a pair of ALCTs and a pair of CLCTs with matched pads or copads the output is up to two LCTs in a sector of ME11 */ void correlateLCTsGEM(const CSCALCTDigi& bestALCT, diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h index b4cdd210adfca..bd3f278b1ada3 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCMotherboardME11.h @@ -50,20 +50,14 @@ class CSCMotherboardME11 : public CSCUpgradeMotherboard { std::vector<CSCCorrelatedLCTDigi> readoutLCTs(int me1ab) const; private: - std::unique_ptr<CSCMotherboardLUTME11> cscTmbLUT_; - /** labels for ME1a and ME1B */ enum { ME1B = 1, ME1A = 4 }; - bool doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const; - void correlateLCTsME11(const CSCALCTDigi& bestALCT, const CSCALCTDigi& secondALCT, const CSCCLCTDigi& bestCLCT, const CSCCLCTDigi& secondCLCT, CSCCorrelatedLCTDigi& lct1, CSCCorrelatedLCTDigi& lct2) const; - - bool ignoreAlctCrossClct; }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h index b8eed0c0ecd40..4392387681a71 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboard.h @@ -14,6 +14,7 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeAnodeLCTProcessor.h" #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeCathodeLCTProcessor.h" #include "L1Trigger/CSCTriggerPrimitives/interface/LCTContainer.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCALCTCrossCLCT.h" // generic container type namespace { @@ -82,6 +83,9 @@ class CSCUpgradeMotherboard : public CSCMotherboard { CSCCorrelatedLCTDigi& lct1, CSCCorrelatedLCTDigi& lct2) const; + // special cases for ME1/1 (when GEMs are not used) + bool doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const; + Parity theParity; void setPrefIndex(); @@ -105,8 +109,10 @@ class CSCUpgradeMotherboard : public CSCMotherboard { // debug gem matching bool debug_matching; - // check look-up-tables - bool debug_luts; + // ignore unphysical ALCT-CLCT matches + bool ignoreAlctCrossClct; + + std::unique_ptr<CSCALCTCrossCLCT> cscOverlap_; }; template <class S> diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h index ca12f1cc83d52..0dbefe9857b45 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h @@ -11,26 +11,6 @@ enum CSCPart { ME1B = 1, ME1A = 4, ME21 = 21, ME1Ag, ME11, ME31, ME41 }; enum Parity { Even = 0, Odd = 1 }; -class CSCMotherboardLUTME11 { -public: - CSCMotherboardLUTME11(); - ~CSCMotherboardLUTME11() {} - bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c, int theEndcap, bool gangedME1a = false) const; - bool doesWiregroupCrossStrip(int wg, int keystrip, int theEndcap, bool gangedME1a = false) const; - -private: - // LUT for which ME1/1 wire group can cross which ME1/a halfstrip - // 1st index: WG number - // 2nd index: inclusive HS range - //with "ag" a modified LUT for ganged ME1a - std::vector<std::vector<double> > lut_wg_vs_hs_me1a; - std::vector<std::vector<double> > lut_wg_vs_hs_me1ag; - // LUT for which ME1/1 wire group can cross which ME1/b halfstrip - // 1st index: WG number - // 2nd index: inclusive HS range - std::vector<std::vector<double> > lut_wg_vs_hs_me1b; -}; - class CSCGEMMotherboardLUT { public: CSCGEMMotherboardLUT(); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc index 917f0181ecde7..b18b0f217c0eb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboardME11.cc @@ -31,7 +31,6 @@ CSCGEMMotherboardME11::CSCGEMMotherboardME11(unsigned endcap, // set LUTs tmbLUT_ = std::make_unique<CSCGEMMotherboardLUTME11>(); - cscTmbLUT_ = std::make_unique<CSCMotherboardLUTME11>(); } CSCGEMMotherboardME11::~CSCGEMMotherboardME11() {} @@ -484,14 +483,6 @@ void CSCGEMMotherboardME11::sortLCTs(std::vector<CSCCorrelatedLCTDigi>& LCTs, } } -bool CSCGEMMotherboardME11::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const { - return cscTmbLUT_->doesALCTCrossCLCT(a, c, theEndcap, gangedME1a_); -} - -bool CSCGEMMotherboardME11::doesWiregroupCrossStrip(int key_wg, int key_strip) const { - return cscTmbLUT_->doesWiregroupCrossStrip(key_wg, key_strip, theEndcap, gangedME1a_); -} - void CSCGEMMotherboardME11::correlateLCTsGEM(const CSCALCTDigi& bALCT, const CSCALCTDigi& sALCT, const CSCCLCTDigi& bCLCT, diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc index 341806811086f..ee87ddbb160ca 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCMotherboardME11.cc @@ -26,11 +26,6 @@ CSCMotherboardME11::CSCMotherboardME11(unsigned endcap, if (!runME11Up_) edm::LogError("CSCMotherboardME11|SetupError") << "+++ TMB constructed while runME11Up_ is not set! +++\n"; - - cscTmbLUT_ = std::make_unique<CSCMotherboardLUTME11>(); - - // ignore unphysical ALCT-CLCT matches - ignoreAlctCrossClct = tmbParams_.getParameter<bool>("ignoreAlctCrossClct"); } CSCMotherboardME11::~CSCMotherboardME11() {} @@ -273,10 +268,6 @@ std::vector<CSCCorrelatedLCTDigi> CSCMotherboardME11::getLCTs1a() const { return tmpV; } -bool CSCMotherboardME11::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const { - return cscTmbLUT_->doesALCTCrossCLCT(a, c, theEndcap, gangedME1a_); -} - void CSCMotherboardME11::correlateLCTsME11(const CSCALCTDigi& bALCT, const CSCALCTDigi& sALCT, const CSCCLCTDigi& bCLCT, diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc index a75d808e2e77c..acd2dc6da43c5 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc @@ -41,9 +41,13 @@ CSCUpgradeMotherboard::CSCUpgradeMotherboard(unsigned endcap, tmb_cross_bx_algo = tmbParams_.getParameter<unsigned int>("tmbCrossBxAlgorithm"); max_lcts = tmbParams_.getParameter<unsigned int>("maxLCTs"); debug_matching = tmbParams_.getParameter<bool>("debugMatching"); - debug_luts = tmbParams_.getParameter<bool>("debugLUTs"); setPrefIndex(); + + // ignore unphysical ALCT-CLCT matches + ignoreAlctCrossClct = tmbParams_.getParameter<bool>("ignoreAlctCrossClct"); + const edm::ParameterSet me11luts(tmbParams_.getParameter<edm::ParameterSet>("wgCrossHsME11Params")); + cscOverlap_ = std::make_unique<CSCALCTCrossCLCT>(endcap, station, theRing, gangedME1a_, me11luts); } void CSCUpgradeMotherboard::run(const CSCWireDigiCollection* wiredc, const CSCComparatorDigiCollection* compdc) { @@ -235,6 +239,10 @@ void CSCUpgradeMotherboard::correlateLCTs(const CSCALCTDigi& bALCT, } } +bool CSCUpgradeMotherboard::doesALCTCrossCLCT(const CSCALCTDigi& a, const CSCCLCTDigi& c) const { + return cscOverlap_->doesALCTCrossCLCT(a, c, ignoreAlctCrossClct); +} + //readout LCTs std::vector<CSCCorrelatedLCTDigi> CSCUpgradeMotherboard::readoutLCTs() const { std::vector<CSCCorrelatedLCTDigi> result; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc index 70c137c7defbb..05d3a2c795479 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboardLUT.cc @@ -1,84 +1,6 @@ #include "L1Trigger/CSCTriggerPrimitives/interface/CSCUpgradeMotherboardLUT.h" #include "DataFormats/CSCDigi/interface/CSCConstants.h" -CSCMotherboardLUTME11::CSCMotherboardLUTME11() { - // Keep in mind that ME1A is considered an extension of ME1B - // This means that ME1A half-strips start at 128 and end at 223 - lut_wg_vs_hs_me1a = {{128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 223}, - {128, 223}, {128, 223}, {128, 223}, {128, 223}, {128, 205}, {128, 189}, {128, 167}, {128, 150}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}}; - // When the half-strips are triple-ganged, (Run-1) - // ME1A half-strips go from 128 to 159 - lut_wg_vs_hs_me1ag = {{128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, - {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 159}, {128, 150}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}}; - // ME1B half-strips start at 0 and end at 127 - lut_wg_vs_hs_me1b = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, - {-1, -1}, {-1, -1}, {100, 127}, {73, 127}, {47, 127}, {22, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 127}, - {0, 127}, {0, 127}, {0, 127}, {0, 127}, {0, 105}, {0, 93}, {0, 78}, {0, 63}}; -} - -bool CSCMotherboardLUTME11::doesALCTCrossCLCT(const CSCALCTDigi &a, - const CSCCLCTDigi &c, - int theEndcap, - bool gangedME1a) const { - if (!c.isValid() || !a.isValid()) - return false; - int key_hs = c.getKeyStrip(); - int key_wg = a.getKeyWG(); - return doesWiregroupCrossStrip(key_wg, key_hs, theEndcap, gangedME1a); -} - -bool CSCMotherboardLUTME11::doesWiregroupCrossStrip(int key_wg, int key_hs, int theEndcap, bool gangedME1a) const { - // ME1/a half-strip starts at 128 - if (key_hs > CSCConstants::MAX_HALF_STRIP_ME1B) { - if (!gangedME1a) { - // wrap around ME11 HS number for -z endcap - if (theEndcap == 2) { - // first subtract 128 - key_hs -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - // flip the HS - key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED - key_hs; - // then add 128 again - key_hs += 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - } - if (key_hs >= lut_wg_vs_hs_me1a[key_wg][0] && key_hs <= lut_wg_vs_hs_me1a[key_wg][1]) - return true; - return false; - } else { - // wrap around ME11 HS number for -z endcap - if (theEndcap == 2) { - // first subtract 128 - key_hs -= 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - // flip the HS - key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - key_hs; - // then add 128 again - key_hs += 1 + CSCConstants::MAX_HALF_STRIP_ME1B; - } - if (key_hs >= lut_wg_vs_hs_me1ag[key_wg][0] && key_hs <= lut_wg_vs_hs_me1ag[key_wg][1]) - return true; - return false; - } - } - // ME1/b half-strip ends at 127 - if (key_hs <= CSCConstants::MAX_HALF_STRIP_ME1B) { - if (theEndcap == 2) - key_hs = CSCConstants::MAX_HALF_STRIP_ME1B - key_hs; - if (key_hs >= lut_wg_vs_hs_me1b[key_wg][0] && key_hs <= lut_wg_vs_hs_me1b[key_wg][1]) - return true; - } - return false; -} - CSCGEMMotherboardLUT::CSCGEMMotherboardLUT() : lut_wg_eta_odd(0), lut_wg_eta_even(0), From f0cdbcdba290a59c987de19c4766c26fa782b313 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 20:10:44 -0500 Subject: [PATCH 138/309] Bugfix: region should be int --- .../CSCTriggerPrimitives/interface/GEMCoPadProcessor.h | 9 +++++---- L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h index f22689c74b90d..b57c1ea4cc228 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h @@ -17,10 +17,11 @@ class GEMCoPadProcessor { public: /** Normal constructor. */ - GEMCoPadProcessor(unsigned region, unsigned station, unsigned chamber, const edm::ParameterSet& copad); - - /** Default constructor. Used for testing. */ - GEMCoPadProcessor(); + GEMCoPadProcessor(int region, + unsigned station, + unsigned chamber, + const edm::ParameterSet& copad, + const edm::ParameterSet& luts); /** Clear copad vector */ void clear(); diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc index 941f8740937d8..a1957aa88f464 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc @@ -8,7 +8,7 @@ // Constructors -- //---------------- -GEMCoPadProcessor::GEMCoPadProcessor(unsigned region, unsigned station, unsigned chamber, const edm::ParameterSet& copad) +GEMCoPadProcessor::GEMCoPadProcessor(int region, unsigned station, unsigned chamber, const edm::ParameterSet& copad, const edm::ParameterSet& luts) : theRegion(region), theStation(station), theChamber(chamber) { // Verbosity level, set to 0 (no print) by default. infoV = copad.getParameter<unsigned int>("verbosity"); From d6987a5422db1e75e4038bb07f64c02d484ce116 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 20:13:22 -0500 Subject: [PATCH 139/309] New procedures for Run-3 GEM-CSC trigger --- .../interface/GEMCoPadProcessor.h | 76 +++- .../interface/GEMInternalCluster.h | 18 +- .../python/params/tmbParams.py | 1 - .../src/CSCGEMMotherboard.cc | 3 +- .../src/GEMCoPadProcessor.cc | 406 +++++++++++++++++- .../src/GEMInternalCluster.cc | 6 +- 6 files changed, 477 insertions(+), 33 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h index b57c1ea4cc228..69243fea120c4 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h @@ -11,6 +11,8 @@ #include "DataFormats/GEMDigi/interface/GEMPadDigiCollection.h" #include "DataFormats/GEMDigi/interface/GEMPadDigiClusterCollection.h" #include "DataFormats/GEMDigi/interface/GEMCoPadDigi.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h" +#include "L1Trigger/CSCTriggerPrimitives/interface/CSCLUTReader.h" #include <vector> @@ -30,12 +32,8 @@ class GEMCoPadProcessor { a collection of pad digis. */ std::vector<GEMCoPadDigi> run(const GEMPadDigiCollection*); - /** Runs the CoPad processor code. Called in normal running -- gets info from - a collection of pad digi clusters. */ - std::vector<GEMCoPadDigi> run(const GEMPadDigiClusterCollection*); - - /** Maximum number of time bins. */ - enum { MAX_CoPad_BINS = 3 }; + /** Runs the CoPad processor code. */ + std::vector<GEMInternalCluster> run(const GEMPadDigiClusterCollection*); /** Returns vector of CoPads in the read-out time window, if any. */ const std::vector<GEMCoPadDigi>& readoutCoPads() const; @@ -44,22 +42,78 @@ class GEMCoPadProcessor { void declusterize(const GEMPadDigiClusterCollection*, GEMPadDigiCollection&) const; private: + // put coincidence clusters in GEMInternalCluster vector + void addCoincidenceClusters(const GEMPadDigiClusterCollection*); + + // put single clusters in GEMInternalCluster vector who are not + // part of any coincidence cluster + void addSingleClusters(const GEMPadDigiClusterCollection*); + + // translate the cluster central pad numbers into 1/8-strip number, + // and roll numbers into min and max wiregroup numbers + // for matching with CSC trigger primitives + void doCoordinateConversion(); + /** Chamber id (trigger-type labels). */ const int theRegion; const int theStation; const int theChamber; + bool isEven_; - /** Verbosity level: 0: no print (default). - * 1: print only CoPads found. - * 2: info at every step of the algorithm. - * 3: add special-purpose prints. */ - unsigned int infoV; unsigned int maxDeltaPad_; unsigned int maxDeltaBX_; unsigned int maxDeltaRoll_; // output collection std::vector<GEMCoPadDigi> gemCoPadV; + std::vector<GEMInternalCluster> clusters_; + + // strings to paths of LUTs + std::vector<std::string> padToHsME1aFiles_; + std::vector<std::string> padToHsME1bFiles_; + std::vector<std::string> padToHsME21Files_; + + std::vector<std::string> padToEsME1aFiles_; + std::vector<std::string> padToEsME1bFiles_; + std::vector<std::string> padToEsME21Files_; + + std::vector<std::string> rollToMaxWgME11Files_; + std::vector<std::string> rollToMinWgME11Files_; + std::vector<std::string> rollToMaxWgME21Files_; + std::vector<std::string> rollToMinWgME21Files_; + + // unique pointers to the luts + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_hs_ME1a_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_hs_ME1a_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_hs_ME1b_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_hs_ME1b_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_hs_ME21_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_hs_ME21_odd_; + + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_es_ME1a_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_es_ME1a_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_es_ME1b_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_es_ME1b_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_es_ME21_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_pad_es_ME21_odd_; + + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_max_wg_ME11_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_max_wg_ME11_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_min_wg_ME11_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_min_wg_ME11_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_max_wg_ME21_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_max_wg_ME21_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_min_wg_ME21_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l1_min_wg_ME21_odd_; + + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_max_wg_ME11_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_max_wg_ME11_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_min_wg_ME11_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_min_wg_ME11_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_max_wg_ME21_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_max_wg_ME21_odd_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_min_wg_ME21_even_; + std::unique_ptr<CSCLUTReader> GEMCSCLUT_roll_l2_min_wg_ME21_odd_; }; #endif diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h index c50929a28a1b6..c5ad10b6ea3d6 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMInternalCluster.h @@ -28,8 +28,10 @@ class GEMInternalCluster { int layer1_size() const { return layer1_size_; } int layer2_pad() const { return layer2_pad_; } int layer2_size() const { return layer2_size_; } - int min_wg() const { return min_wg_; } - int max_wg() const { return max_wg_; } + int layer1_min_wg() const { return layer1_min_wg_; } + int layer1_max_wg() const { return layer1_max_wg_; } + int layer2_min_wg() const { return layer2_min_wg_; } + int layer2_max_wg() const { return layer2_max_wg_; } bool isCoincidence() const { return isCoincidence_; } // first and last 1/2-strips @@ -103,8 +105,10 @@ class GEMInternalCluster { void set_layer2_middle_es_me1a(const int es) { layer2_middle_es_me1a_ = es; } // set the corresponding wiregroup numbers - void set_min_wg(const int wg) { min_wg_ = wg; } - void set_max_wg(const int wg) { max_wg_ = wg; } + void set_layer1_min_wg(const int wg) { layer1_min_wg_ = wg; } + void set_layer1_max_wg(const int wg) { layer1_max_wg_ = wg; } + void set_layer2_min_wg(const int wg) { layer2_min_wg_ = wg; } + void set_layer2_max_wg(const int wg) { layer2_max_wg_ = wg; } bool has_cluster(const GEMPadDigiCluster& cluster) const; @@ -172,8 +176,10 @@ class GEMInternalCluster { int layer2_middle_es_me1a_; // corresponding min and max wiregroup - int min_wg_; - int max_wg_; + int layer1_min_wg_; + int layer1_max_wg_; + int layer2_min_wg_; + int layer2_max_wg_; // flag to signal if it is a coincidence bool isCoincidence_; diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py index 4dc7d0d5bb788..019f8cf4b120f 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/tmbParams.py @@ -62,7 +62,6 @@ ignoreAlctCrossClct = cms.bool(True), ## run in debug mode - debugLUTs = cms.bool(False), debugMatching = cms.bool(False), ) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 5ec3ab20621c8..95590287d1a34 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -16,9 +16,10 @@ CSCGEMMotherboard::CSCGEMMotherboard(unsigned endcap, // super chamber has layer=0! gemId = GEMDetId(theRegion, 1, theStation, 0, theChamber, 0).rawId(); + const edm::ParameterSet gemcscluts(conf.getParameter<edm::ParameterSet>("gemcscParams")); const edm::ParameterSet coPadParams(station == 1 ? conf.getParameter<edm::ParameterSet>("copadParamGE11") : conf.getParameter<edm::ParameterSet>("copadParamGE21")); - coPadProcessor = std::make_unique<GEMCoPadProcessor>(theRegion, theStation, theChamber, coPadParams); + coPadProcessor = std::make_unique<GEMCoPadProcessor>(theRegion, theStation, theChamber, coPadParams, gemcscluts); maxDeltaPadL1_ = (theParity ? tmbParams_.getParameter<int>("maxDeltaPadL1Even") : tmbParams_.getParameter<int>("maxDeltaPadL1Odd")); diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc index a1957aa88f464..c725f6176a735 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc @@ -10,18 +10,57 @@ GEMCoPadProcessor::GEMCoPadProcessor(int region, unsigned station, unsigned chamber, const edm::ParameterSet& copad, const edm::ParameterSet& luts) : theRegion(region), theStation(station), theChamber(chamber) { - // Verbosity level, set to 0 (no print) by default. - infoV = copad.getParameter<unsigned int>("verbosity"); + isEven_ = theChamber % 2 == 0; maxDeltaPad_ = copad.getParameter<unsigned int>("maxDeltaPad"); maxDeltaRoll_ = copad.getParameter<unsigned int>("maxDeltaRoll"); maxDeltaBX_ = copad.getParameter<unsigned int>("maxDeltaBX"); -} -GEMCoPadProcessor::GEMCoPadProcessor() : theRegion(1), theStation(1), theChamber(1) { - infoV = 0; - maxDeltaPad_ = 0; - maxDeltaRoll_ = 0; - maxDeltaBX_ = 0; + padToHsME1aFiles_ = luts.getParameter<std::vector<std::string>>("padToHsME1aFiles"); + padToHsME1bFiles_ = luts.getParameter<std::vector<std::string>>("padToHsME1bFiles"); + padToHsME21Files_ = luts.getParameter<std::vector<std::string>>("padToHsME21Files"); + + padToEsME1aFiles_ = luts.getParameter<std::vector<std::string>>("padToEsME1aFiles"); + padToEsME1bFiles_ = luts.getParameter<std::vector<std::string>>("padToEsME1bFiles"); + padToEsME21Files_ = luts.getParameter<std::vector<std::string>>("padToEsME21Files"); + + rollToMaxWgME11Files_ = luts.getParameter<std::vector<std::string>>("rollToMaxWgME11Files"); + rollToMinWgME11Files_ = luts.getParameter<std::vector<std::string>>("rollToMinWgME11Files"); + rollToMaxWgME21Files_ = luts.getParameter<std::vector<std::string>>("rollToMaxWgME21Files"); + rollToMinWgME21Files_ = luts.getParameter<std::vector<std::string>>("rollToMinWgME21Files"); + + GEMCSCLUT_pad_hs_ME1a_even_ = std::make_unique<CSCLUTReader>(padToHsME1aFiles_[0]); + GEMCSCLUT_pad_hs_ME1a_odd_ = std::make_unique<CSCLUTReader>(padToHsME1aFiles_[1]); + GEMCSCLUT_pad_hs_ME1b_even_ = std::make_unique<CSCLUTReader>(padToHsME1bFiles_[0]); + GEMCSCLUT_pad_hs_ME1b_odd_ = std::make_unique<CSCLUTReader>(padToHsME1bFiles_[1]); + GEMCSCLUT_pad_hs_ME21_even_ = std::make_unique<CSCLUTReader>(padToHsME21Files_[0]); + GEMCSCLUT_pad_hs_ME21_odd_ = std::make_unique<CSCLUTReader>(padToHsME21Files_[1]); + + GEMCSCLUT_pad_es_ME1a_even_ = std::make_unique<CSCLUTReader>(padToEsME1aFiles_[0]); + GEMCSCLUT_pad_es_ME1a_odd_ = std::make_unique<CSCLUTReader>(padToEsME1aFiles_[1]); + GEMCSCLUT_pad_es_ME1b_even_ = std::make_unique<CSCLUTReader>(padToEsME1bFiles_[0]); + GEMCSCLUT_pad_es_ME1b_odd_ = std::make_unique<CSCLUTReader>(padToEsME1bFiles_[1]); + GEMCSCLUT_pad_es_ME21_even_ = std::make_unique<CSCLUTReader>(padToEsME21Files_[0]); + GEMCSCLUT_pad_es_ME21_odd_ = std::make_unique<CSCLUTReader>(padToEsME21Files_[1]); + + GEMCSCLUT_roll_l1_min_wg_ME11_even_ = std::make_unique<CSCLUTReader>(rollToMinWgME11Files_[0]); + GEMCSCLUT_roll_l1_min_wg_ME11_odd_ = std::make_unique<CSCLUTReader>(rollToMinWgME11Files_[1]); + GEMCSCLUT_roll_l2_min_wg_ME11_even_ = std::make_unique<CSCLUTReader>(rollToMinWgME11Files_[2]); + GEMCSCLUT_roll_l2_min_wg_ME11_odd_ = std::make_unique<CSCLUTReader>(rollToMinWgME11Files_[3]); + + GEMCSCLUT_roll_l1_max_wg_ME11_even_ = std::make_unique<CSCLUTReader>(rollToMaxWgME11Files_[0]); + GEMCSCLUT_roll_l1_max_wg_ME11_odd_ = std::make_unique<CSCLUTReader>(rollToMaxWgME11Files_[1]); + GEMCSCLUT_roll_l2_max_wg_ME11_even_ = std::make_unique<CSCLUTReader>(rollToMaxWgME11Files_[2]); + GEMCSCLUT_roll_l2_max_wg_ME11_odd_ = std::make_unique<CSCLUTReader>(rollToMaxWgME11Files_[3]); + + GEMCSCLUT_roll_l1_min_wg_ME21_even_ = std::make_unique<CSCLUTReader>(rollToMinWgME21Files_[0]); + GEMCSCLUT_roll_l1_min_wg_ME21_odd_ = std::make_unique<CSCLUTReader>(rollToMinWgME21Files_[1]); + GEMCSCLUT_roll_l2_min_wg_ME21_even_ = std::make_unique<CSCLUTReader>(rollToMinWgME21Files_[2]); + GEMCSCLUT_roll_l2_min_wg_ME21_odd_ = std::make_unique<CSCLUTReader>(rollToMinWgME21Files_[3]); + + GEMCSCLUT_roll_l1_max_wg_ME21_even_ = std::make_unique<CSCLUTReader>(rollToMaxWgME21Files_[0]); + GEMCSCLUT_roll_l1_max_wg_ME21_odd_ = std::make_unique<CSCLUTReader>(rollToMaxWgME21Files_[1]); + GEMCSCLUT_roll_l2_max_wg_ME21_even_ = std::make_unique<CSCLUTReader>(rollToMaxWgME21Files_[2]); + GEMCSCLUT_roll_l2_max_wg_ME21_odd_ = std::make_unique<CSCLUTReader>(rollToMaxWgME21Files_[3]); } void GEMCoPadProcessor::clear() { gemCoPadV.clear(); } @@ -88,10 +127,353 @@ std::vector<GEMCoPadDigi> GEMCoPadProcessor::run(const GEMPadDigiCollection* in_ return gemCoPadV; } -std::vector<GEMCoPadDigi> GEMCoPadProcessor::run(const GEMPadDigiClusterCollection* in_clusters) { - std::unique_ptr<GEMPadDigiCollection> out_pads(new GEMPadDigiCollection()); - declusterize(in_clusters, *out_pads); - return run(out_pads.get()); +std::vector<GEMInternalCluster> GEMCoPadProcessor::run(const GEMPadDigiClusterCollection* in_clusters) { + // Step 1: clear the GEMInternalCluster vector + clear(); + + // Step 2: put coincidence clusters in GEMInternalCluster vector + addCoincidenceClusters(in_clusters); + + // Step 3: put single clusters in GEMInternalCluster vector who are not + // part of any coincidence cluster + addSingleClusters(in_clusters); + + // Step 4: translate the cluster central pad numbers into 1/8-strip number for matching with CSC trigger primitives + doCoordinateConversion(); + + // Step 5: return the vector with internal clusters + return clusters_; +} + +void GEMCoPadProcessor::addCoincidenceClusters(const GEMPadDigiClusterCollection* in_clusters) { + // Build coincidences + for (auto det_range = in_clusters->begin(); det_range != in_clusters->end(); ++det_range) { + const GEMDetId& id = (*det_range).first; + + // coincidence pads are not built for ME0 + if (id.isME0()) + continue; + + // same chamber (no restriction on the roll number) + if (id.region() != theRegion or id.station() != theStation or id.chamber() != theChamber) + continue; + + // all coincidences detIDs will have layer=1 + if (id.layer() != 1) + continue; + + // find all corresponding ids with layer 2 and same roll that differs at most maxDeltaRoll_ + for (unsigned int roll = id.roll() - maxDeltaRoll_; roll <= id.roll() + maxDeltaRoll_; ++roll) { + GEMDetId co_id(id.region(), id.ring(), id.station(), 2, id.chamber(), roll); + + auto co_clusters_range = in_clusters->get(co_id); + + // empty range = no possible coincidence pads + if (co_clusters_range.first == co_clusters_range.second) + continue; + + // now let's correlate the pads in two layers of this partition + const auto& pads_range = (*det_range).second; + for (auto p = pads_range.first; p != pads_range.second; ++p) { + // ignore 16-partition GE2/1 pads + if (id.isGE21() and p->nPartitions() == GEMPadDigi::GE21SplitStrip) + continue; + + // only consider valid pads + if (!p->isValid()) + continue; + + for (auto co_p = co_clusters_range.first; co_p != co_clusters_range.second; ++co_p) { + // only consider valid clusters + if (!co_p->isValid()) + continue; + + // check the match in BX + if ((unsigned)std::abs(p->bx() - co_p->bx()) > maxDeltaBX_) + continue; + + // check the match in pad + int cl1f = p->pads().front(); + int cl1b = p->pads().back(); + int cl2f = co_p->pads().front(); + int cl2b = co_p->pads().back(); + + unsigned deltaFF = std::abs(cl1f - cl2f); + unsigned deltaFB = std::abs(cl1f - cl2b); + unsigned deltaBF = std::abs(cl1b - cl2f); + unsigned deltaBB = std::abs(cl1b - cl2b); + + std::vector<unsigned> v{deltaFF, deltaFB, deltaBF, deltaBB}; + + if (*std::min_element(v.begin(), v.end()) > maxDeltaPad_) + continue; + + // make a new coincidence + clusters_.emplace_back(id, *p, *co_p); + } + } + } + } +} + +void GEMCoPadProcessor::addSingleClusters(const GEMPadDigiClusterCollection* in_clusters) { + // first get the collection of coincidences + const std::vector<GEMInternalCluster> coincidences = clusters_; + + // now start add single clusters + for (auto det_range = in_clusters->begin(); det_range != in_clusters->end(); ++det_range) { + const GEMDetId& id = (*det_range).first; + + // coincidence pads are not built for ME0 + if (id.isME0()) + continue; + + // same chamber (no restriction on the roll number) + if (id.region() != theRegion or id.station() != theStation or id.chamber() != theChamber) + continue; + + const auto& clusters_range = (*det_range).second; + for (auto p = clusters_range.first; p != clusters_range.second; ++p) { + // only consider valid clusters + if (p->isValid()) + continue; + + // ignore 16-partition GE2/1 pads + if (id.isGE21() and p->nPartitions() == GEMPadDigiCluster::GE21SplitStrip) + continue; + + // ignore clusters already contained in a coincidence cluster + if (std::find_if(std::begin(coincidences), std::end(coincidences), [p](const GEMInternalCluster& q) { + return q.has_cluster(*p); + }) != std::end(coincidences)) + continue; + + // put the single clusters into the collection + if (id.layer() == 1) + clusters_.emplace_back(id, *p, GEMPadDigiCluster()); + else + clusters_.emplace_back(id, GEMPadDigiCluster(), *p); + } + } +} + +void GEMCoPadProcessor::doCoordinateConversion() { + // loop on clusters + for (auto& cluster : clusters_) { + + // starting coordinates + const int layer1_first_pad = cluster.layer1_pad(); + const int layer2_first_pad = cluster.layer2_pad(); + const int layer1_last_pad = layer1_first_pad + cluster.layer1_size() - 1; + const int layer2_last_pad = layer2_first_pad + cluster.layer2_size() - 1; + + // calculate the 1/2-strip + int layer1_pad_to_first_hs = -1; + int layer1_pad_to_last_hs = -1; + + int layer2_pad_to_first_hs = -1; + int layer2_pad_to_last_hs = -1; + + int layer1_pad_to_first_hs_me1a = -1; + int layer1_pad_to_last_hs_me1a = -1; + + int layer2_pad_to_first_hs_me1a = -1; + int layer2_pad_to_last_hs_me1a = -1; + + if (theStation == 1) { + if (isEven_) { + // ME1/b + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_even_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer1_first_pad); + layer2_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer2_first_pad); + layer1_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer1_last_pad); + layer2_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_even_->lookup(layer2_last_pad); + } else { + // ME1/b + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME1b_odd_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_hs_me1a = GEMCSCLUT_pad_hs_ME1a_odd_->lookup(layer2_last_pad); + } + } + + // ME2/1 + if (theStation == 2) { + if (isEven_) { + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_even_->lookup(layer2_last_pad); + } else { + layer1_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_hs = GEMCSCLUT_pad_hs_ME21_odd_->lookup(layer2_last_pad); + } + } + + // middle 1/2-strip + int layer1_middle_hs = 0.5 * (layer1_pad_to_first_hs + layer1_pad_to_last_hs); + int layer2_middle_hs = 0.5 * (layer2_pad_to_first_hs + layer2_pad_to_last_hs); + int layer1_middle_hs_me1a = 0.5 * (layer1_pad_to_first_hs_me1a + layer1_pad_to_last_hs_me1a); + int layer2_middle_hs_me1a = 0.5 * (layer2_pad_to_first_hs_me1a + layer2_pad_to_last_hs_me1a); + + // set the values + cluster.set_layer1_first_hs(layer1_pad_to_first_hs); + cluster.set_layer2_first_hs(layer2_pad_to_first_hs); + cluster.set_layer1_last_hs(layer1_pad_to_last_hs); + cluster.set_layer2_last_hs(layer2_pad_to_last_hs); + + // middle 1/2-strip + cluster.set_layer1_middle_hs(layer1_middle_hs); + cluster.set_layer2_middle_hs(layer2_middle_hs); + + if (theStation == 1) { + cluster.set_layer1_first_hs_me1a(layer1_pad_to_first_hs_me1a); + cluster.set_layer2_first_hs_me1a(layer2_pad_to_first_hs_me1a); + cluster.set_layer1_last_hs_me1a(layer1_pad_to_last_hs_me1a); + cluster.set_layer2_last_hs_me1a(layer2_pad_to_last_hs_me1a); + + // middle 1/2-strip + cluster.set_layer1_middle_hs_me1a(layer1_middle_hs_me1a); + cluster.set_layer2_middle_hs_me1a(layer2_middle_hs_me1a); + } + + + // calculate the 1/8-strips + int layer1_pad_to_first_es = -1; + int layer1_pad_to_last_es = -1; + + int layer2_pad_to_first_es = -1; + int layer2_pad_to_last_es = -1; + + int layer1_pad_to_first_es_me1a = -1; + int layer1_pad_to_last_es_me1a = -1; + + int layer2_pad_to_first_es_me1a = -1; + int layer2_pad_to_last_es_me1a = -1; + + if (theStation == 1) { + if (isEven_) { + // ME1/b + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_even_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer1_first_pad); + layer2_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer2_first_pad); + layer1_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer1_last_pad); + layer2_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_even_->lookup(layer2_last_pad); + } else { + // ME1/b + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME1b_odd_->lookup(layer2_last_pad); + // ME1/a + layer1_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_es_me1a = GEMCSCLUT_pad_es_ME1a_odd_->lookup(layer2_last_pad); + } + } + + // ME2/1 + if (theStation == 2) { + if (isEven_) { + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME21_even_->lookup(layer2_last_pad); + } else { + layer1_pad_to_first_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer1_first_pad); + layer2_pad_to_first_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer2_first_pad); + layer1_pad_to_last_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer1_last_pad); + layer2_pad_to_last_es = GEMCSCLUT_pad_es_ME21_odd_->lookup(layer2_last_pad); + } + } + + // middle 1/8-strip + int layer1_middle_es = 0.5 * (layer1_pad_to_first_es + layer1_pad_to_last_es); + int layer2_middle_es = 0.5 * (layer2_pad_to_first_es + layer2_pad_to_last_es); + int layer1_middle_es_me1a = 0.5 * (layer1_pad_to_first_es_me1a + layer1_pad_to_last_es_me1a); + int layer2_middle_es_me1a = 0.5 * (layer2_pad_to_first_es_me1a + layer2_pad_to_last_es_me1a); + + // set the values + cluster.set_layer1_first_es(layer1_pad_to_first_es); + cluster.set_layer2_first_es(layer2_pad_to_first_es); + cluster.set_layer1_last_es(layer1_pad_to_last_es); + cluster.set_layer2_last_es(layer2_pad_to_last_es); + + // middle 1/8-strip + cluster.set_layer1_middle_es(layer1_middle_es); + cluster.set_layer2_middle_es(layer2_middle_es); + + if (theStation == 1) { + cluster.set_layer1_first_es_me1a(layer1_pad_to_first_es_me1a); + cluster.set_layer2_first_es_me1a(layer2_pad_to_first_es_me1a); + cluster.set_layer1_last_es_me1a(layer1_pad_to_last_es_me1a); + cluster.set_layer2_last_es_me1a(layer2_pad_to_last_es_me1a); + + // middle 1/8-strip + cluster.set_layer1_middle_es_me1a(layer1_middle_es_me1a); + cluster.set_layer2_middle_es_me1a(layer2_middle_es_me1a); + } + + // calculate the wiregroups + const int roll = cluster.roll(); + + int roll_l1_to_min_wg = -1; + int roll_l1_to_max_wg = -1; + int roll_l2_to_min_wg = -1; + int roll_l2_to_max_wg = -1; + + // ME1/1 + if (theStation == 1) { + if (isEven_) { + roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME11_even_->lookup(roll); + roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME11_even_->lookup(roll); + roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME11_even_->lookup(roll); + roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME11_even_->lookup(roll); + } else { + roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME11_odd_->lookup(roll); + roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME11_odd_->lookup(roll); + roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME11_odd_->lookup(roll); + roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME11_odd_->lookup(roll); + } + } + + // ME2/1 + if (theStation == 2) { + if (isEven_) { + roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME21_even_->lookup(roll); + roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME21_even_->lookup(roll); + roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME21_even_->lookup(roll); + roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME21_even_->lookup(roll); + } else { + roll_l1_to_min_wg = GEMCSCLUT_roll_l1_min_wg_ME21_odd_->lookup(roll); + roll_l1_to_max_wg = GEMCSCLUT_roll_l1_max_wg_ME21_odd_->lookup(roll); + roll_l2_to_min_wg = GEMCSCLUT_roll_l2_min_wg_ME21_odd_->lookup(roll); + roll_l2_to_max_wg = GEMCSCLUT_roll_l2_max_wg_ME21_odd_->lookup(roll); + } + } + + // set the values + cluster.set_layer1_min_wg(roll_l1_to_min_wg); + cluster.set_layer1_max_wg(roll_l1_to_max_wg); + cluster.set_layer2_min_wg(roll_l2_to_min_wg); + cluster.set_layer2_max_wg(roll_l2_to_max_wg); + } } const std::vector<GEMCoPadDigi>& GEMCoPadProcessor::readoutCoPads() const { return gemCoPadV; } diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc index 68fd1896e6d63..a0f08a90b8551 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMInternalCluster.cc @@ -32,8 +32,10 @@ GEMInternalCluster::GEMInternalCluster(const GEMDetId& id, layer1_last_es_me1a_ = -1; layer2_first_es_me1a_ = -1; layer2_last_es_me1a_ = -1; - min_wg_ = -1; - max_wg_ = -1; + layer1_min_wg_ = -1; + layer1_max_wg_ = -1; + layer2_min_wg_ = -1; + layer2_max_wg_ = -1; } bool GEMInternalCluster::has_cluster(const GEMPadDigiCluster& cluster) const { From baa05f88af56b84a28971df743d8ab6311a39885 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 20:15:40 -0500 Subject: [PATCH 140/309] Code format --- .../CSCTriggerPrimitives/interface/GEMCoPadProcessor.h | 7 ++----- L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h index 69243fea120c4..ef6ba9881dce1 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h @@ -19,11 +19,8 @@ class GEMCoPadProcessor { public: /** Normal constructor. */ - GEMCoPadProcessor(int region, - unsigned station, - unsigned chamber, - const edm::ParameterSet& copad, - const edm::ParameterSet& luts); + GEMCoPadProcessor( + int region, unsigned station, unsigned chamber, const edm::ParameterSet& copad, const edm::ParameterSet& luts); /** Clear copad vector */ void clear(); diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc index c725f6176a735..6c512583ee0d3 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc @@ -8,7 +8,8 @@ // Constructors -- //---------------- -GEMCoPadProcessor::GEMCoPadProcessor(int region, unsigned station, unsigned chamber, const edm::ParameterSet& copad, const edm::ParameterSet& luts) +GEMCoPadProcessor::GEMCoPadProcessor( + int region, unsigned station, unsigned chamber, const edm::ParameterSet& copad, const edm::ParameterSet& luts) : theRegion(region), theStation(station), theChamber(chamber) { isEven_ = theChamber % 2 == 0; maxDeltaPad_ = copad.getParameter<unsigned int>("maxDeltaPad"); @@ -260,7 +261,6 @@ void GEMCoPadProcessor::addSingleClusters(const GEMPadDigiClusterCollection* in_ void GEMCoPadProcessor::doCoordinateConversion() { // loop on clusters for (auto& cluster : clusters_) { - // starting coordinates const int layer1_first_pad = cluster.layer1_pad(); const int layer2_first_pad = cluster.layer2_pad(); @@ -348,7 +348,6 @@ void GEMCoPadProcessor::doCoordinateConversion() { cluster.set_layer2_middle_hs_me1a(layer2_middle_hs_me1a); } - // calculate the 1/8-strips int layer1_pad_to_first_es = -1; int layer1_pad_to_last_es = -1; From ec8acb5c968f7e82f0e28cc0e32a441afb7bd03d Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 20:37:40 -0500 Subject: [PATCH 141/309] Move to processor --- .../interface/GEMCoPadProcessor.h | 3 +-- .../src/CSCGEMMotherboard.cc | 5 +---- .../src/GEMCoPadProcessor.cc | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h index ef6ba9881dce1..877ec498248bc 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/GEMCoPadProcessor.h @@ -19,8 +19,7 @@ class GEMCoPadProcessor { public: /** Normal constructor. */ - GEMCoPadProcessor( - int region, unsigned station, unsigned chamber, const edm::ParameterSet& copad, const edm::ParameterSet& luts); + GEMCoPadProcessor(int region, unsigned station, unsigned chamber, const edm::ParameterSet& conf); /** Clear copad vector */ void clear(); diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 95590287d1a34..209335138edcb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -16,10 +16,7 @@ CSCGEMMotherboard::CSCGEMMotherboard(unsigned endcap, // super chamber has layer=0! gemId = GEMDetId(theRegion, 1, theStation, 0, theChamber, 0).rawId(); - const edm::ParameterSet gemcscluts(conf.getParameter<edm::ParameterSet>("gemcscParams")); - const edm::ParameterSet coPadParams(station == 1 ? conf.getParameter<edm::ParameterSet>("copadParamGE11") - : conf.getParameter<edm::ParameterSet>("copadParamGE21")); - coPadProcessor = std::make_unique<GEMCoPadProcessor>(theRegion, theStation, theChamber, coPadParams, gemcscluts); + coPadProcessor = std::make_unique<GEMCoPadProcessor>(theRegion, theStation, theChamber, conf); maxDeltaPadL1_ = (theParity ? tmbParams_.getParameter<int>("maxDeltaPadL1Even") : tmbParams_.getParameter<int>("maxDeltaPadL1Odd")); diff --git a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc index 6c512583ee0d3..58f2383d603fa 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc @@ -8,9 +8,12 @@ // Constructors -- //---------------- -GEMCoPadProcessor::GEMCoPadProcessor( - int region, unsigned station, unsigned chamber, const edm::ParameterSet& copad, const edm::ParameterSet& luts) +GEMCoPadProcessor::GEMCoPadProcessor(int region, unsigned station, unsigned chamber, const edm::ParameterSet& conf) : theRegion(region), theStation(station), theChamber(chamber) { + const edm::ParameterSet luts(conf.getParameter<edm::ParameterSet>("gemcscParams")); + const edm::ParameterSet copad(station == 1 ? conf.getParameter<edm::ParameterSet>("copadParamGE11") + : conf.getParameter<edm::ParameterSet>("copadParamGE21")); + isEven_ = theChamber % 2 == 0; maxDeltaPad_ = copad.getParameter<unsigned int>("maxDeltaPad"); maxDeltaRoll_ = copad.getParameter<unsigned int>("maxDeltaRoll"); @@ -64,7 +67,10 @@ GEMCoPadProcessor::GEMCoPadProcessor( GEMCSCLUT_roll_l2_max_wg_ME21_odd_ = std::make_unique<CSCLUTReader>(rollToMaxWgME21Files_[3]); } -void GEMCoPadProcessor::clear() { gemCoPadV.clear(); } +void GEMCoPadProcessor::clear() { + gemCoPadV.clear(); + clusters_.clear(); +} std::vector<GEMCoPadDigi> GEMCoPadProcessor::run(const GEMPadDigiCollection* in_pads) { clear(); @@ -218,9 +224,6 @@ void GEMCoPadProcessor::addCoincidenceClusters(const GEMPadDigiClusterCollection } void GEMCoPadProcessor::addSingleClusters(const GEMPadDigiClusterCollection* in_clusters) { - // first get the collection of coincidences - const std::vector<GEMInternalCluster> coincidences = clusters_; - // now start add single clusters for (auto det_range = in_clusters->begin(); det_range != in_clusters->end(); ++det_range) { const GEMDetId& id = (*det_range).first; @@ -244,9 +247,9 @@ void GEMCoPadProcessor::addSingleClusters(const GEMPadDigiClusterCollection* in_ continue; // ignore clusters already contained in a coincidence cluster - if (std::find_if(std::begin(coincidences), std::end(coincidences), [p](const GEMInternalCluster& q) { + if (std::find_if(std::begin(clusters_), std::end(clusters_), [p](const GEMInternalCluster& q) { return q.has_cluster(*p); - }) != std::end(coincidences)) + }) != std::end(clusters_)) continue; // put the single clusters into the collection From 8bf4688e56403c41eef042a44f6dc27a3c7b98cb Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 3 May 2021 21:00:59 -0500 Subject: [PATCH 142/309] Bugfix --- L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc index acd2dc6da43c5..8ba1923e7be18 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCUpgradeMotherboard.cc @@ -46,7 +46,7 @@ CSCUpgradeMotherboard::CSCUpgradeMotherboard(unsigned endcap, // ignore unphysical ALCT-CLCT matches ignoreAlctCrossClct = tmbParams_.getParameter<bool>("ignoreAlctCrossClct"); - const edm::ParameterSet me11luts(tmbParams_.getParameter<edm::ParameterSet>("wgCrossHsME11Params")); + const edm::ParameterSet me11luts(conf.getParameter<edm::ParameterSet>("wgCrossHsME11Params")); cscOverlap_ = std::make_unique<CSCALCTCrossCLCT>(endcap, station, theRing, gangedME1a_, me11luts); } From 49a663ba3213346b23f35824caff8a056e3e1fa7 Mon Sep 17 00:00:00 2001 From: Jeongeun Lee <jeongeun.lee@cern.ch> Date: Tue, 4 May 2021 06:54:11 +0200 Subject: [PATCH 143/309] update - remove deprecated parameter - drop type spec --- .../python/hltL2MuonIsolationsCR_cfi.py | 1 - RecoMuon/L2MuonProducer/python/L2Muons_cfi.py | 1 + RecoMuon/L3MuonProducer/python/L3Muons_cfi.py | 3 --- RecoMuon/L3MuonProducer/src/L3MuonProducer.cc | 1 - RecoMuon/L3MuonProducer/test/newL3.py | 3 --- .../plugins/MuonSeedGenerator.cc | 10 +++++++ .../python/ancientMuonSeed_cfi.py | 27 ++++++++++--------- 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py index df8c565b28ec8..95b1ee8e6bf09 100644 --- a/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py +++ b/RecoMuon/L2MuonIsolationProducer/python/hltL2MuonIsolationsCR_cfi.py @@ -45,6 +45,5 @@ RhoSrc = 'hltKT6CaloJets:rho', RhoMax = 9.9999999E7, ), -# OutputMuIsoDeposits = cms.bool(True), ExtractorPSet = dict() ) diff --git a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py index 68a3b26609e53..2d18d6d42b720 100644 --- a/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py +++ b/RecoMuon/L2MuonProducer/python/L2Muons_cfi.py @@ -22,6 +22,7 @@ # above seed position SeedPropagator = 'SteppingHelixPropagatorL2Any', # where you want the seed (in,out) + SeedPosition = 'in', BWFilterParameters = dict( DTRecSegmentLabel = "dt4DSegments", MuonTrajectoryUpdatorParameters = dict( diff --git a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py index 679e0cc1d1d96..ce2da1b28ec18 100644 --- a/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py +++ b/RecoMuon/L3MuonProducer/python/L3Muons_cfi.py @@ -24,13 +24,10 @@ L3TrajBuilderParameters = dict( TrackerRecHitBuilder = 'WithTrackAngle', MuonTrackingRegionBuilder = dict( - #Eta_fixed = cms.double(0.2), # please check, default type is cms.bool(True) Rescale_Dz = 3.0, Eta_min = 0.05, DeltaZ_Region = cms.double(15.9), - #Phi_fixed = cms.double(0.2), # please check, default type is cms.bool(False) DeltaR = 0.2, - EscapePt = 1.5, UseFixedRegion = cms.bool(False), Phi_min = 0.05, beamSpot = "hltOfflineBeamSpot" diff --git a/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc b/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc index 8a32ac1828428..9ebc80f4e5c49 100644 --- a/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc +++ b/RecoMuon/L3MuonProducer/src/L3MuonProducer.cc @@ -265,7 +265,6 @@ void L3MuonProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptio psd1.add<double>("EtaR_UpperLimit_Par1", 0.25); psd1.add<double>("EtaR_UpperLimit_Par2", 0.15); psd1.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot")); - psd1.add<double>("EscapePt", 3.0); psd1.add<bool>("Pt_fixed", false); psd0.add<edm::ParameterSetDescription>("MuonTrackingRegionBuilder", psd1); } diff --git a/RecoMuon/L3MuonProducer/test/newL3.py b/RecoMuon/L3MuonProducer/test/newL3.py index 201391b1af739..6c4ccd70fb5d6 100644 --- a/RecoMuon/L3MuonProducer/test/newL3.py +++ b/RecoMuon/L3MuonProducer/test/newL3.py @@ -125,7 +125,6 @@ def producers_by_type(process, type): Rescale_eta = cms.double( 3.0 ), Rescale_phi = cms.double( 3.0 ), Rescale_Dz = cms.double( 4.0 ), - EscapePt = cms.double( 3.0 ), EtaR_UpperLimit_Par1 = cms.double( 0.25 ), EtaR_UpperLimit_Par2 = cms.double( 0.15 ), PhiR_UpperLimit_Par1 = cms.double( 0.6 ), @@ -346,7 +345,6 @@ def producers_by_type(process, type): Rescale_eta = cms.double( 3.0 ), Rescale_phi = cms.double( 3.0 ), Rescale_Dz = cms.double( 4.0 ), - EscapePt = cms.double( 3.0 ), EtaR_UpperLimit_Par1 = cms.double( 0.25 ), EtaR_UpperLimit_Par2 = cms.double( 0.15 ), PhiR_UpperLimit_Par1 = cms.double( 0.6 ), @@ -840,7 +838,6 @@ def producers_by_type(process, type): Rescale_eta = cms.double( 3.0 ), Rescale_phi = cms.double( 3.0 ), Rescale_Dz = cms.double( 4.0 ), #Normally 4 - EscapePt = cms.double( 3.0 ), #Normally 1.5 but it should be at least 8 for us EtaR_UpperLimit_Par1 = cms.double( 0.25 ), #Normally 0.25 EtaR_UpperLimit_Par2 = cms.double( 0.15 ), #Normally 0.15 PhiR_UpperLimit_Par1 = cms.double( 0.6 ), #Normally 0.6 diff --git a/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc b/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc index 82d117e468bf1..573c47fc595b8 100644 --- a/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc +++ b/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc @@ -107,8 +107,18 @@ void MuonSeedGenerator::produce(edm::Event& event, const edm::EventSetup& eSetup void MuonSeedGenerator::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.setAllowAnything(); + desc.add<edm::InputTag>("beamSpotTag", edm::InputTag("offlineBeamSpot")); + desc.add<bool>("scaleDT", true); + desc.add<edm::InputTag>("CSCRecSegmentLabel", edm::InputTag("cscSegments")); + desc.add<edm::InputTag>("DTRecSegmentLabel", edm::InputTag("dt4DSegments")); + desc.add<edm::InputTag>("ME0RecSegmentLabel", edm::InputTag("me0Segments")); desc.add<bool>("EnableDTMeasurement", true); desc.add<bool>("EnableCSCMeasurement", true); desc.add<bool>("EnableME0Measurement", false); + desc.add<std::vector<double>>("crackEtas", {0.2, 1.6, 1.7}); + desc.add<double>("crackWindow", 0.04); + desc.add<double>("deltaPhiSearchWindow", 0.25); + desc.add<double>("deltaEtaSearchWindow", 0.2); + desc.add<double>("deltaEtaCrackSearchWindow", 0.25); descriptions.add("produceMuons", desc); } diff --git a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py index f4c8a3ab20d5a..2bda3dc625d74 100644 --- a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py +++ b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py @@ -1,23 +1,26 @@ import FWCore.ParameterSet.Config as cms -from RecoMuon.MuonSeedGenerator.ptSeedParameterization_cfi import * -from RecoMuon.MuonSeedGenerator.MuonSeedPtScale_cfi import * +from RecoMuon.MuonSeedGenerator.ptSeedParameterization_cfi import ptSeedParameterization +from RecoMuon.MuonSeedGenerator.MuonSeedPtScale_cfi import dphiScale import RecoMuon.MuonSeedGenerator.produceMuons_cfi as _mod ancientMuonSeed = _mod.produceMuons.clone( ptSeedParameterization, dphiScale, - beamSpotTag = cms.InputTag("offlineBeamSpot"), - scaleDT = cms.bool(True), - CSCRecSegmentLabel = cms.InputTag("cscSegments"), - DTRecSegmentLabel = cms.InputTag("dt4DSegments"), - ME0RecSegmentLabel = cms.InputTag("me0Segments"), + beamSpotTag = "offlineBeamSpot", + scaleDT = True, + CSCRecSegmentLabel = "cscSegments", + DTRecSegmentLabel = "dt4DSegments", + ME0RecSegmentLabel = "me0Segments", + EnableDTMeasurement = True, + EnableCSCMeasurement = True, + EnableME0Measurement = False, # places where it's OK to have single-segment seeds - crackEtas = cms.vdouble(0.2, 1.6, 1.7), - crackWindow = cms.double(0.04), - deltaPhiSearchWindow = cms.double(0.25), - deltaEtaSearchWindow = cms.double(0.2), - deltaEtaCrackSearchWindow = cms.double(0.25), + crackEtas = [0.2, 1.6, 1.7], + crackWindow = 0.04, + deltaPhiSearchWindow = 0.25, + deltaEtaSearchWindow = 0.2, + deltaEtaCrackSearchWindow = 0.25, ) # phase2 ME0 From 6509a1fd3e397d2b22fce0596b8595338271c26e Mon Sep 17 00:00:00 2001 From: Andrea <perrotta@cern.ch> Date: Tue, 4 May 2021 09:11:05 +0200 Subject: [PATCH 144/309] Fix typo in the fillDescriptions --- .../PFClusterProducer/interface/HGCRecHitNavigator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h b/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h index 08895e7a6623f..c1cdc0e0fc22f 100644 --- a/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h +++ b/RecoParticleFlow/PFClusterProducer/interface/HGCRecHitNavigator.h @@ -34,8 +34,8 @@ class HGCRecHitNavigator : public PFRecHitNavigatorBase { desc.add<edm::ParameterSetDescription>("hgchef", deschef); edm::ParameterSetDescription descheb; - deschef.add<std::string>("name", "PFRecHitHGCHENavigator"); - deschef.add<std::string>("topologySource", "HGCalHEScintillatorSensitive"); + descheb.add<std::string>("name", "PFRecHitHGCHENavigator"); + descheb.add<std::string>("topologySource", "HGCalHEScintillatorSensitive"); desc.add<edm::ParameterSetDescription>("hgcheb", descheb); descriptions.add("navigator", desc); From 954ad0971998caf01a03d4d0e1b73fc6c82d1801 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Tue, 4 May 2021 09:41:15 +0200 Subject: [PATCH 145/309] scram code format --- .../plugins/L1CaloJetHTTProducer.cc | 139 +- .../plugins/L1CaloJetProducer.cc | 2667 ++++++++--------- .../L1EGammaCrystalsEmulatorProducer.cc | 2 +- .../plugins/L1TowerCalibrator.cc | 966 +++--- 4 files changed, 1834 insertions(+), 1940 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc index feae97457b151..6067ec5f74a2a 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc @@ -19,7 +19,6 @@ HTT energy sum for CaloJets // // - #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -36,106 +35,86 @@ HTT energy sum for CaloJets #include "DataFormats/JetReco/interface/GenJet.h" #include "DataFormats/JetReco/interface/GenJetCollection.h" - class L1CaloJetHTTProducer : public edm::EDProducer { - public: - explicit L1CaloJetHTTProducer(const edm::ParameterSet&); - - private: - virtual void produce(edm::Event&, const edm::EventSetup&); +public: + explicit L1CaloJetHTTProducer(const edm::ParameterSet&); - double EtaMax; - double PtMin; +private: + void produce(edm::Event&, const edm::EventSetup&) override; - edm::EDGetTokenT<BXVector<l1t::Jet>> bxvCaloJetsToken_; - edm::Handle<BXVector<l1t::Jet>> bxvCaloJetsHandle; + double EtaMax; + double PtMin; - // Gen jet collections are only loaded and used if requested - // (use_gen_jets == true) - edm::EDGetTokenT<std::vector<reco::GenJet>> genJetsToken_; - edm::Handle<std::vector<reco::GenJet>> genJetsHandle; + edm::EDGetTokenT<BXVector<l1t::Jet>> bxvCaloJetsToken_; + edm::Handle<BXVector<l1t::Jet>> bxvCaloJetsHandle; - bool debug; + // Gen jet collections are only loaded and used if requested + // (use_gen_jets == true) + edm::EDGetTokenT<std::vector<reco::GenJet>> genJetsToken_; + edm::Handle<std::vector<reco::GenJet>> genJetsHandle; - bool use_gen_jets; + bool debug; + bool use_gen_jets; }; -L1CaloJetHTTProducer::L1CaloJetHTTProducer(const edm::ParameterSet& iConfig) : - EtaMax(iConfig.getParameter<double>("EtaMax")), - PtMin(iConfig.getParameter<double>("PtMin")), - bxvCaloJetsToken_(consumes<BXVector<l1t::Jet>>(iConfig.getParameter<edm::InputTag>("BXVCaloJetsInputTag"))), - genJetsToken_(consumes<std::vector<reco::GenJet>>(iConfig.getParameter<edm::InputTag>("genJets"))), - debug(iConfig.getParameter<bool>("debug")), - use_gen_jets(iConfig.getParameter<bool>("use_gen_jets")) +L1CaloJetHTTProducer::L1CaloJetHTTProducer(const edm::ParameterSet& iConfig) + : EtaMax(iConfig.getParameter<double>("EtaMax")), + PtMin(iConfig.getParameter<double>("PtMin")), + bxvCaloJetsToken_(consumes<BXVector<l1t::Jet>>(iConfig.getParameter<edm::InputTag>("BXVCaloJetsInputTag"))), + genJetsToken_(consumes<std::vector<reco::GenJet>>(iConfig.getParameter<edm::InputTag>("genJets"))), + debug(iConfig.getParameter<bool>("debug")), + use_gen_jets(iConfig.getParameter<bool>("use_gen_jets")) { - - - produces< float >("CaloJetHTT"); - - + produces<float>("CaloJetHTT"); } -void L1CaloJetHTTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - +void L1CaloJetHTTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // Output collections + std::unique_ptr<float> CaloJetHTT(new float); - // Output collections - std::unique_ptr< float > CaloJetHTT(new float); + *CaloJetHTT = 0.; - *CaloJetHTT = 0.; + // CaloJet HTT for L1 collections + if (!use_gen_jets) { + iEvent.getByToken(bxvCaloJetsToken_, bxvCaloJetsHandle); - - // CaloJet HTT for L1 collections - if (!use_gen_jets) - { - iEvent.getByToken(bxvCaloJetsToken_,bxvCaloJetsHandle); - - - if (bxvCaloJetsHandle.isValid()) - { - for(const auto& caloJet : *bxvCaloJetsHandle.product()) - { - if (caloJet.pt() < PtMin) continue; - if ( fabs(caloJet.eta()) > EtaMax) continue; - *CaloJetHTT += float(caloJet.pt()); - } - } - - if (debug) - { - printf("BXV L1CaloJetCollection JetHTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); - } + if (bxvCaloJetsHandle.isValid()) { + for (const auto& caloJet : *bxvCaloJetsHandle.product()) { + if (caloJet.pt() < PtMin) + continue; + if (fabs(caloJet.eta()) > EtaMax) + continue; + *CaloJetHTT += float(caloJet.pt()); + } } - // CaloJet HTT for gen jets - if (use_gen_jets) - { - iEvent.getByToken(genJetsToken_,genJetsHandle); - - - if (genJetsHandle.isValid()) - { - for(const auto& genJet : *genJetsHandle.product()) - { - if (genJet.pt() < PtMin) continue; - if ( fabs(genJet.eta()) > EtaMax) continue; - *CaloJetHTT += float(genJet.pt()); - } - } - - if (debug) - { - printf("Gen Jets HTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); - } + if (debug) { + printf("BXV L1CaloJetCollection JetHTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); + } + } + + // CaloJet HTT for gen jets + if (use_gen_jets) { + iEvent.getByToken(genJetsToken_, genJetsHandle); + + if (genJetsHandle.isValid()) { + for (const auto& genJet : *genJetsHandle.product()) { + if (genJet.pt() < PtMin) + continue; + if (fabs(genJet.eta()) > EtaMax) + continue; + *CaloJetHTT += float(genJet.pt()); + } } + if (debug) { + printf("Gen Jets HTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); + } + } - iEvent.put(std::move(CaloJetHTT),"CaloJetHTT"); - + iEvent.put(std::move(CaloJetHTT), "CaloJetHTT"); } - - DEFINE_FWK_MODULE(L1CaloJetHTTProducer); diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc index a2c8b94faf080..92af0cccf1f1a 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc @@ -20,7 +20,6 @@ and clusters them within fixed number of trigger towers // // - #include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/Math/interface/deltaPhi.h" @@ -52,571 +51,540 @@ and clusters them within fixed number of trigger towers #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/Jet.h" - class L1CaloJetProducer : public edm::EDProducer { - public: - explicit L1CaloJetProducer(const edm::ParameterSet&); - - private: - virtual void produce(edm::Event&, const edm::EventSetup&); - //bool cluster_passes_base_cuts(float &cluster_pt, float &cluster_eta, float &iso, float &e2x5, float &e5x5) const; - int ecalXtal_diPhi( int &iPhi_1, int &iPhi_2 ) const; - int tower_diPhi( int &iPhi_1, int &iPhi_2 ) const; - int tower_diEta( int &iEta_1, int &iEta_2 ) const; - float get_deltaR( reco::Candidate::PolarLorentzVector &p4_1, - reco::Candidate::PolarLorentzVector &p4_2) const; - float get_hcal_calibration( float &jet_pt, float &ecal_pt, - float &ecal_L1EG_jet_pt, float &jet_eta ) const; - float get_tau_pt_calibration( float &tau_pt, float &ecal_pt, - float &l1EG_pt, float &n_L1EGs, float &tau_eta ) const; - int loose_iso_tau_wp( float &tau_pt, float &tau_iso_et, float &tau_eta ) const; - - double HcalTpEtMin; - double EcalTpEtMin; - double HGCalHadTpEtMin; - double HGCalEmTpEtMin; - double HFTpEtMin; - double EtMinForSeedHit; - double EtMinForCollection; - double EtMinForTauCollection; - - // For fetching jet calibrations - std::vector< double > jetPtBins; - std::vector< double > emFractionBinsBarrel; - std::vector< double > absEtaBinsBarrel; - std::vector< double > jetCalibrationsBarrel; - std::vector< double > emFractionBinsHGCal; - std::vector< double > absEtaBinsHGCal; - std::vector< double > jetCalibrationsHGCal; - std::vector< double > emFractionBinsHF; - std::vector< double > absEtaBinsHF; - std::vector< double > jetCalibrationsHF; - - // For fetching tau calibrations - std::vector< double > tauPtBins; - std::vector< double > tauAbsEtaBinsBarrel; - std::vector< double > tauCalibrationsBarrel; - std::vector< edm::ParameterSet > tauL1egInfoBarrel; - std::vector< double > tauAbsEtaBinsHGCal; - std::vector< double > tauCalibrationsHGCal; - std::vector< edm::ParameterSet > tauL1egInfoHGCal; - - // For storing jet calibrations - std::vector< std::vector< std::vector< double >>> calibrationsBarrel; - std::vector< std::vector< std::vector< double >>> calibrationsHGCal; - std::vector< std::vector< std::vector< double >>> calibrationsHF; - - // For storing tau calibration info - std::map< double, std::vector< double >> tauL1egInfoMapBarrel; - std::map< double, std::vector< double >> tauL1egInfoMapHGCal; - std::vector< double > tauL1egValuesBarrel; // To preserve ordering - std::vector< double > tauL1egValuesHGCal; // To preserve ordering - std::vector< std::vector< std::vector< std::vector< double >>>> tauPtCalibrationsBarrel; - std::vector< std::vector< std::vector< std::vector< double >>>> tauPtCalibrationsHGCal; - - bool debug; - edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowerToken_; - edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle; - - - - // TF1s defining tau isolation thresholds - TF1 isoTauBarrel = TF1( "isoTauBarrelFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); - TF1 isoTauHGCal = TF1( "isoTauHGCalFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); - - - class l1CaloJetObj - { - public: - bool barrelSeeded = true; // default to barrel seeded - reco::Candidate::PolarLorentzVector jetCluster; - reco::Candidate::PolarLorentzVector hcalJetCluster; - reco::Candidate::PolarLorentzVector ecalJetCluster; - reco::Candidate::PolarLorentzVector seedTower; - //reco::Candidate::PolarLorentzVector leadingL1EG; - reco::Candidate::PolarLorentzVector l1egJetCluster; - float jetClusterET = 0.; - float hcalJetClusterET = 0.; - float ecalJetClusterET = 0.; - float seedTowerET = 0.; - float leadingL1EGET = 0.; - float l1egJetClusterET = 0.; - - // For decay mode related checks with CaloTaus - std::vector< std::vector< float > > associated_l1EGs_; - - int seed_iEta = -99; - int seed_iPhi = -99; - - float hcal_seed = 0.; - //float hcal_3x3 = 0.; - float hcal_3x5 = 0.; - //float hcal_5x5 = 0.; - //float hcal_5x7 = 0.; - float hcal_7x7 = 0.; - //float hcal_2x3 = 0.; - //float hcal_2x3_1 = 0.; - //float hcal_2x3_2 = 0.; - //float hcal_2x2 = 0.; - //float hcal_2x2_1 = 0.; - //float hcal_2x2_2 = 0.; - //float hcal_2x2_3 = 0.; - //float hcal_2x2_4 = 0.; - float hcal_nHits = 0.; - - float ecal_seed = 0.; - //float ecal_3x3 = 0.; - float ecal_3x5 = 0.; - //float ecal_5x5 = 0.; - //float ecal_5x7 = 0.; - float ecal_7x7 = 0.; - //float ecal_2x3 = 0.; - //float ecal_2x3_1 = 0.; - //float ecal_2x3_2 = 0.; - //float ecal_2x2 = 0.; - //float ecal_2x2_1 = 0.; - //float ecal_2x2_2 = 0.; - //float ecal_2x2_3 = 0.; - //float ecal_2x2_4 = 0.; - float ecal_nHits = 0.; - - float l1eg_seed = 0.; - //float l1eg_3x3 = 0.; - float l1eg_3x5 = 0.; - //float l1eg_5x5 = 0.; - //float l1eg_5x7 = 0.; - float l1eg_7x7 = 0.; - //float l1eg_2x3 = 0.; - //float l1eg_2x3_1 = 0.; - //float l1eg_2x3_2 = 0.; - //float l1eg_2x2 = 0.; - //float l1eg_2x2_1 = 0.; - //float l1eg_2x2_2 = 0.; - //float l1eg_2x2_3 = 0.; - //float l1eg_2x2_4 = 0.; - float l1eg_nHits = 0.; - float n_l1eg_HoverE_LessThreshold = 0.; - - float l1eg_nL1EGs = 0.; - float l1eg_nL1EGs_standaloneSS = 0.; - float l1eg_nL1EGs_standaloneIso = 0.; - float l1eg_nL1EGs_trkMatchSS = 0.; - float l1eg_nL1EGs_trkMatchIso = 0.; - - float total_seed = 0.; - //float total_3x3 = 0.; - float total_3x5 = 0.; - //float total_5x5 = 0.; - //float total_5x7 = 0.; - float total_7x7 = 0.; - //float total_2x3 = 0.; - //float total_2x3_1 = 0.; - //float total_2x3_2 = 0.; - //float total_2x2 = 0.; - //float total_2x2_1 = 0.; - //float total_2x2_2 = 0.; - //float total_2x2_3 = 0.; - //float total_2x2_4 = 0.; - float total_nHits = 0.; - - void Init() - { - SetJetClusterP4( 0., 0., 0., 0. ); - SetHcalJetClusterP4( 0., 0., 0., 0. ); - SetEcalJetClusterP4( 0., 0., 0., 0. ); - SetSeedP4( 0., 0., 0., 0. ); - //SetLeadingL1EGP4( 0., 0., 0., 0. ); - SetL1EGJetP4( 0., 0., 0., 0. ); - } - - void SetJetClusterP4( double pt, double eta, double phi, double mass ) - { - this->jetCluster.SetPt( pt ); - this->jetCluster.SetEta( eta ); - this->jetCluster.SetPhi( phi ); - this->jetCluster.SetM( mass ); - } - void SetHcalJetClusterP4( double pt, double eta, double phi, double mass ) - { - this->hcalJetCluster.SetPt( pt ); - this->hcalJetCluster.SetEta( eta ); - this->hcalJetCluster.SetPhi( phi ); - this->hcalJetCluster.SetM( mass ); - } - void SetEcalJetClusterP4( double pt, double eta, double phi, double mass ) - { - this->ecalJetCluster.SetPt( pt ); - this->ecalJetCluster.SetEta( eta ); - this->ecalJetCluster.SetPhi( phi ); - this->ecalJetCluster.SetM( mass ); - } - void SetSeedP4( double pt, double eta, double phi, double mass ) - { - this->seedTower.SetPt( pt ); - this->seedTower.SetEta( eta ); - this->seedTower.SetPhi( phi ); - this->seedTower.SetM( mass ); - } - //void SetLeadingL1EGP4( double pt, double eta, double phi, double mass ) - //{ - // this->leadingL1EG.SetPt( pt ); - // this->leadingL1EG.SetEta( eta ); - // this->leadingL1EG.SetPhi( phi ); - // this->leadingL1EG.SetM( mass ); - //} - void SetL1EGJetP4( double pt, double eta, double phi, double mass ) - { - this->l1egJetCluster.SetPt( pt ); - this->l1egJetCluster.SetEta( eta ); - this->l1egJetCluster.SetPhi( phi ); - this->l1egJetCluster.SetM( mass ); - } - }; - - - - - - class simpleL1obj - { - public: - bool stale = false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters - bool associated_with_tower = false; // L1EGs become associated with a tower to find highest ET total for seeding jets - bool passesStandaloneSS = false; // Store whether any of the portions of a WP are passed - bool passesStandaloneIso = false; // Store whether any of the portions of a WP are passed - bool passesTrkMatchSS = false; // Store whether any of the portions of a WP are passed - bool passesTrkMatchIso = false; // Store whether any of the portions of a WP are passed - reco::Candidate::PolarLorentzVector p4; - - void SetP4( double pt, double eta, double phi, double mass ) - { - this->p4.SetPt( pt ); - this->p4.SetEta( eta ); - this->p4.SetPhi( phi ); - this->p4.SetM( mass ); - } - inline float pt() const{return p4.pt();}; - inline float eta() const{return p4.eta();}; - inline float phi() const{return p4.phi();}; - inline float M() const{return p4.M();}; - inline reco::Candidate::PolarLorentzVector GetP4() const{return p4;}; - }; - - - - class SimpleCaloHit - { - public: - int towerIEta = -99; - int towerIPhi = -99; - float towerEta = -99; - float towerPhi = -99; - float ecalTowerEt=0.; - float hcalTowerEt=0.; - float l1egTowerEt=0.; - float total_tower_et=0.; - //float total_tower_plus_L1EGs_et=0.; - bool stale=false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters - bool isBarrel=true; // Defaults to a barrel hit - - // L1EG info - int nL1eg = 0; - int l1egTrkSS = 0; - int l1egTrkIso = 0; - int l1egStandaloneSS = 0; - int l1egStandaloneIso = 0; - }; -}; - -L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet& iConfig) : - HcalTpEtMin(iConfig.getParameter<double>("HcalTpEtMin")), // Should default to 0 MeV - EcalTpEtMin(iConfig.getParameter<double>("EcalTpEtMin")), // Should default to 0 MeV - HGCalHadTpEtMin(iConfig.getParameter<double>("HGCalHadTpEtMin")), // Should default to 0 MeV - HGCalEmTpEtMin(iConfig.getParameter<double>("HGCalEmTpEtMin")), // Should default to 0 MeV - HFTpEtMin(iConfig.getParameter<double>("HFTpEtMin")), // Should default to 0 MeV - EtMinForSeedHit(iConfig.getParameter<double>("EtMinForSeedHit")), // Should default to 2.5 GeV - EtMinForCollection(iConfig.getParameter<double>("EtMinForCollection")), // Testing 10 GeV - EtMinForTauCollection(iConfig.getParameter<double>("EtMinForTauCollection")), // Testing 10 GeV - jetPtBins(iConfig.getParameter<std::vector<double>>("jetPtBins")), - emFractionBinsBarrel(iConfig.getParameter<std::vector<double>>("emFractionBinsBarrel")), - absEtaBinsBarrel(iConfig.getParameter<std::vector<double>>("absEtaBinsBarrel")), - jetCalibrationsBarrel(iConfig.getParameter<std::vector<double>>("jetCalibrationsBarrel")), - emFractionBinsHGCal(iConfig.getParameter<std::vector<double>>("emFractionBinsHGCal")), - absEtaBinsHGCal(iConfig.getParameter<std::vector<double>>("absEtaBinsHGCal")), - jetCalibrationsHGCal(iConfig.getParameter<std::vector<double>>("jetCalibrationsHGCal")), - emFractionBinsHF(iConfig.getParameter<std::vector<double>>("emFractionBinsHF")), - absEtaBinsHF(iConfig.getParameter<std::vector<double>>("absEtaBinsHF")), - jetCalibrationsHF(iConfig.getParameter<std::vector<double>>("jetCalibrationsHF")), - tauPtBins(iConfig.getParameter<std::vector<double>>("tauPtBins")), - tauAbsEtaBinsBarrel(iConfig.getParameter<std::vector<double>>("tauAbsEtaBinsBarrel")), - tauCalibrationsBarrel(iConfig.getParameter<std::vector<double>>("tauCalibrationsBarrel")), - tauL1egInfoBarrel(iConfig.getParameter<std::vector<edm::ParameterSet>>("tauL1egInfoBarrel")), - tauAbsEtaBinsHGCal(iConfig.getParameter<std::vector<double>>("tauAbsEtaBinsHGCal")), - tauCalibrationsHGCal(iConfig.getParameter<std::vector<double>>("tauCalibrationsHGCal")), - tauL1egInfoHGCal(iConfig.getParameter<std::vector<edm::ParameterSet>>("tauL1egInfoHGCal")), - debug(iConfig.getParameter<bool>("debug")), - l1TowerToken_(consumes< l1tp2::CaloTowerCollection >(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))) - -{ - if (debug) printf("L1CaloJetProducer setup\n"); - produces<l1tp2::CaloJetsCollection>("L1CaloJetsNoCuts"); - //produces<l1tp2::CaloJetsCollection>("L1CaloJetsWithCuts"); - //produces<l1extra::L1JetParticleCollection>("L1CaloClusterCollectionWithCuts"); - produces< BXVector<l1t::Jet> >("L1CaloJetCollectionBXV"); - produces< BXVector<l1t::Tau> >("L1CaloTauCollectionBXV"); - +public: + explicit L1CaloJetProducer(const edm::ParameterSet &); + +private: + void produce(edm::Event &, const edm::EventSetup &) override; + //bool cluster_passes_base_cuts(float &cluster_pt, float &cluster_eta, float &iso, float &e2x5, float &e5x5) const; + int ecalXtal_diPhi(int &iPhi_1, int &iPhi_2) const; + int tower_diPhi(int &iPhi_1, int &iPhi_2) const; + int tower_diEta(int &iEta_1, int &iEta_2) const; + float get_deltaR(reco::Candidate::PolarLorentzVector &p4_1, reco::Candidate::PolarLorentzVector &p4_2) const; + float get_hcal_calibration(float &jet_pt, float &ecal_pt, float &ecal_L1EG_jet_pt, float &jet_eta) const; + float get_tau_pt_calibration(float &tau_pt, float &ecal_pt, float &l1EG_pt, float &n_L1EGs, float &tau_eta) const; + int loose_iso_tau_wp(float &tau_pt, float &tau_iso_et, float &tau_eta) const; + + double HcalTpEtMin; + double EcalTpEtMin; + double HGCalHadTpEtMin; + double HGCalEmTpEtMin; + double HFTpEtMin; + double EtMinForSeedHit; + double EtMinForCollection; + double EtMinForTauCollection; + + // For fetching jet calibrations + std::vector<double> jetPtBins; + std::vector<double> emFractionBinsBarrel; + std::vector<double> absEtaBinsBarrel; + std::vector<double> jetCalibrationsBarrel; + std::vector<double> emFractionBinsHGCal; + std::vector<double> absEtaBinsHGCal; + std::vector<double> jetCalibrationsHGCal; + std::vector<double> emFractionBinsHF; + std::vector<double> absEtaBinsHF; + std::vector<double> jetCalibrationsHF; + + // For fetching tau calibrations + std::vector<double> tauPtBins; + std::vector<double> tauAbsEtaBinsBarrel; + std::vector<double> tauCalibrationsBarrel; + std::vector<edm::ParameterSet> tauL1egInfoBarrel; + std::vector<double> tauAbsEtaBinsHGCal; + std::vector<double> tauCalibrationsHGCal; + std::vector<edm::ParameterSet> tauL1egInfoHGCal; + + // For storing jet calibrations + std::vector<std::vector<std::vector<double>>> calibrationsBarrel; + std::vector<std::vector<std::vector<double>>> calibrationsHGCal; + std::vector<std::vector<std::vector<double>>> calibrationsHF; + + // For storing tau calibration info + std::map<double, std::vector<double>> tauL1egInfoMapBarrel; + std::map<double, std::vector<double>> tauL1egInfoMapHGCal; + std::vector<double> tauL1egValuesBarrel; // To preserve ordering + std::vector<double> tauL1egValuesHGCal; // To preserve ordering + std::vector<std::vector<std::vector<std::vector<double>>>> tauPtCalibrationsBarrel; + std::vector<std::vector<std::vector<std::vector<double>>>> tauPtCalibrationsHGCal; + + bool debug; + edm::EDGetTokenT<l1tp2::CaloTowerCollection> l1TowerToken_; + edm::Handle<l1tp2::CaloTowerCollection> l1CaloTowerHandle; + + // TF1s defining tau isolation thresholds + TF1 isoTauBarrel = TF1("isoTauBarrelFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); + TF1 isoTauHGCal = TF1("isoTauHGCalFunction", "([0] + [1]*TMath::Exp(-[2]*x))"); + + class l1CaloJetObj { + public: + bool barrelSeeded = true; // default to barrel seeded + reco::Candidate::PolarLorentzVector jetCluster; + reco::Candidate::PolarLorentzVector hcalJetCluster; + reco::Candidate::PolarLorentzVector ecalJetCluster; + reco::Candidate::PolarLorentzVector seedTower; + //reco::Candidate::PolarLorentzVector leadingL1EG; + reco::Candidate::PolarLorentzVector l1egJetCluster; + float jetClusterET = 0.; + float hcalJetClusterET = 0.; + float ecalJetClusterET = 0.; + float seedTowerET = 0.; + float leadingL1EGET = 0.; + float l1egJetClusterET = 0.; + + // For decay mode related checks with CaloTaus + std::vector<std::vector<float>> associated_l1EGs_; + + int seed_iEta = -99; + int seed_iPhi = -99; + + float hcal_seed = 0.; + //float hcal_3x3 = 0.; + float hcal_3x5 = 0.; + //float hcal_5x5 = 0.; + //float hcal_5x7 = 0.; + float hcal_7x7 = 0.; + //float hcal_2x3 = 0.; + //float hcal_2x3_1 = 0.; + //float hcal_2x3_2 = 0.; + //float hcal_2x2 = 0.; + //float hcal_2x2_1 = 0.; + //float hcal_2x2_2 = 0.; + //float hcal_2x2_3 = 0.; + //float hcal_2x2_4 = 0.; + float hcal_nHits = 0.; + + float ecal_seed = 0.; + //float ecal_3x3 = 0.; + float ecal_3x5 = 0.; + //float ecal_5x5 = 0.; + //float ecal_5x7 = 0.; + float ecal_7x7 = 0.; + //float ecal_2x3 = 0.; + //float ecal_2x3_1 = 0.; + //float ecal_2x3_2 = 0.; + //float ecal_2x2 = 0.; + //float ecal_2x2_1 = 0.; + //float ecal_2x2_2 = 0.; + //float ecal_2x2_3 = 0.; + //float ecal_2x2_4 = 0.; + float ecal_nHits = 0.; + + float l1eg_seed = 0.; + //float l1eg_3x3 = 0.; + float l1eg_3x5 = 0.; + //float l1eg_5x5 = 0.; + //float l1eg_5x7 = 0.; + float l1eg_7x7 = 0.; + //float l1eg_2x3 = 0.; + //float l1eg_2x3_1 = 0.; + //float l1eg_2x3_2 = 0.; + //float l1eg_2x2 = 0.; + //float l1eg_2x2_1 = 0.; + //float l1eg_2x2_2 = 0.; + //float l1eg_2x2_3 = 0.; + //float l1eg_2x2_4 = 0.; + float l1eg_nHits = 0.; + float n_l1eg_HoverE_LessThreshold = 0.; + + float l1eg_nL1EGs = 0.; + float l1eg_nL1EGs_standaloneSS = 0.; + float l1eg_nL1EGs_standaloneIso = 0.; + float l1eg_nL1EGs_trkMatchSS = 0.; + float l1eg_nL1EGs_trkMatchIso = 0.; + + float total_seed = 0.; + //float total_3x3 = 0.; + float total_3x5 = 0.; + //float total_5x5 = 0.; + //float total_5x7 = 0.; + float total_7x7 = 0.; + //float total_2x3 = 0.; + //float total_2x3_1 = 0.; + //float total_2x3_2 = 0.; + //float total_2x2 = 0.; + //float total_2x2_1 = 0.; + //float total_2x2_2 = 0.; + //float total_2x2_3 = 0.; + //float total_2x2_4 = 0.; + float total_nHits = 0.; + + void Init() { + SetJetClusterP4(0., 0., 0., 0.); + SetHcalJetClusterP4(0., 0., 0., 0.); + SetEcalJetClusterP4(0., 0., 0., 0.); + SetSeedP4(0., 0., 0., 0.); + //SetLeadingL1EGP4( 0., 0., 0., 0. ); + SetL1EGJetP4(0., 0., 0., 0.); + } - if(debug) printf("\nHcalTpEtMin = %f\nEcalTpEtMin = %f\n", HcalTpEtMin, EcalTpEtMin); - //for( unsigned int i = 0; i < emFractionBins.size(); i++) - //{ - // printf("\n emFrac: %f", emFractionBins.at(i)); - //} - //for( unsigned int i = 0; i < absEtaBins.size(); i++) - //{ - // printf("\n absEta: %f", absEtaBins.at(i)); - //} - //for( unsigned int i = 0; i < jetPtBins.size(); i++) + void SetJetClusterP4(double pt, double eta, double phi, double mass) { + this->jetCluster.SetPt(pt); + this->jetCluster.SetEta(eta); + this->jetCluster.SetPhi(phi); + this->jetCluster.SetM(mass); + } + void SetHcalJetClusterP4(double pt, double eta, double phi, double mass) { + this->hcalJetCluster.SetPt(pt); + this->hcalJetCluster.SetEta(eta); + this->hcalJetCluster.SetPhi(phi); + this->hcalJetCluster.SetM(mass); + } + void SetEcalJetClusterP4(double pt, double eta, double phi, double mass) { + this->ecalJetCluster.SetPt(pt); + this->ecalJetCluster.SetEta(eta); + this->ecalJetCluster.SetPhi(phi); + this->ecalJetCluster.SetM(mass); + } + void SetSeedP4(double pt, double eta, double phi, double mass) { + this->seedTower.SetPt(pt); + this->seedTower.SetEta(eta); + this->seedTower.SetPhi(phi); + this->seedTower.SetM(mass); + } + //void SetLeadingL1EGP4( double pt, double eta, double phi, double mass ) //{ - // printf("\n jetPt: %f", jetPtBins.at(i)); + // this->leadingL1EG.SetPt( pt ); + // this->leadingL1EG.SetEta( eta ); + // this->leadingL1EG.SetPhi( phi ); + // this->leadingL1EG.SetM( mass ); //} + void SetL1EGJetP4(double pt, double eta, double phi, double mass) { + this->l1egJetCluster.SetPt(pt); + this->l1egJetCluster.SetEta(eta); + this->l1egJetCluster.SetPhi(phi); + this->l1egJetCluster.SetM(mass); + } + }; + + class simpleL1obj { + public: + bool stale = false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters + bool associated_with_tower = + false; // L1EGs become associated with a tower to find highest ET total for seeding jets + bool passesStandaloneSS = false; // Store whether any of the portions of a WP are passed + bool passesStandaloneIso = false; // Store whether any of the portions of a WP are passed + bool passesTrkMatchSS = false; // Store whether any of the portions of a WP are passed + bool passesTrkMatchIso = false; // Store whether any of the portions of a WP are passed + reco::Candidate::PolarLorentzVector p4; + + void SetP4(double pt, double eta, double phi, double mass) { + this->p4.SetPt(pt); + this->p4.SetEta(eta); + this->p4.SetPhi(phi); + this->p4.SetM(mass); + } + inline float pt() const { return p4.pt(); }; + inline float eta() const { return p4.eta(); }; + inline float phi() const { return p4.phi(); }; + inline float M() const { return p4.M(); }; + inline reco::Candidate::PolarLorentzVector GetP4() const { return p4; }; + }; + + class SimpleCaloHit { + public: + int towerIEta = -99; + int towerIPhi = -99; + float towerEta = -99; + float towerPhi = -99; + float ecalTowerEt = 0.; + float hcalTowerEt = 0.; + float l1egTowerEt = 0.; + float total_tower_et = 0.; + //float total_tower_plus_L1EGs_et=0.; + bool stale = false; // Hits become stale once used in clustering algorithm to prevent overlap in clusters + bool isBarrel = true; // Defaults to a barrel hit + + // L1EG info + int nL1eg = 0; + int l1egTrkSS = 0; + int l1egTrkIso = 0; + int l1egStandaloneSS = 0; + int l1egStandaloneIso = 0; + }; +}; - // Fill the calibration 3D vector - // Dimension 1 is AbsEta bin - // Dimension 2 is EM Fraction bin - // Dimension 3 is jet pT bin which is filled with the actual callibration value - // size()-1 b/c the inputs have lower and upper bounds - // Do Barrel, then HGCal, then HF - int index = 0; - //calibrations[em_frac][abs_eta].push_back( jetCalibrationsBarrel.at(index) ); - for( unsigned int abs_eta = 0; abs_eta < absEtaBinsBarrel.size()-1; abs_eta++) - { - std::vector< std::vector< double >> em_bins; - for( unsigned int em_frac = 0; em_frac < emFractionBinsBarrel.size()-1; em_frac++) - { - std::vector< double > pt_bin_calibs; - for( unsigned int pt = 0; pt < jetPtBins.size()-1; pt++) - { - //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); - //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsBarrel.at(em_frac), absEtaBinsBarrel.at(abs_eta), jetPtBins.at(pt), jetCalibrationsBarrel.at(index)); - pt_bin_calibs.push_back( jetCalibrationsBarrel.at(index) ); - index++; - } - em_bins.push_back( pt_bin_calibs ); - } - calibrationsBarrel.push_back( em_bins ); +L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) + : HcalTpEtMin(iConfig.getParameter<double>("HcalTpEtMin")), // Should default to 0 MeV + EcalTpEtMin(iConfig.getParameter<double>("EcalTpEtMin")), // Should default to 0 MeV + HGCalHadTpEtMin(iConfig.getParameter<double>("HGCalHadTpEtMin")), // Should default to 0 MeV + HGCalEmTpEtMin(iConfig.getParameter<double>("HGCalEmTpEtMin")), // Should default to 0 MeV + HFTpEtMin(iConfig.getParameter<double>("HFTpEtMin")), // Should default to 0 MeV + EtMinForSeedHit(iConfig.getParameter<double>("EtMinForSeedHit")), // Should default to 2.5 GeV + EtMinForCollection(iConfig.getParameter<double>("EtMinForCollection")), // Testing 10 GeV + EtMinForTauCollection(iConfig.getParameter<double>("EtMinForTauCollection")), // Testing 10 GeV + jetPtBins(iConfig.getParameter<std::vector<double>>("jetPtBins")), + emFractionBinsBarrel(iConfig.getParameter<std::vector<double>>("emFractionBinsBarrel")), + absEtaBinsBarrel(iConfig.getParameter<std::vector<double>>("absEtaBinsBarrel")), + jetCalibrationsBarrel(iConfig.getParameter<std::vector<double>>("jetCalibrationsBarrel")), + emFractionBinsHGCal(iConfig.getParameter<std::vector<double>>("emFractionBinsHGCal")), + absEtaBinsHGCal(iConfig.getParameter<std::vector<double>>("absEtaBinsHGCal")), + jetCalibrationsHGCal(iConfig.getParameter<std::vector<double>>("jetCalibrationsHGCal")), + emFractionBinsHF(iConfig.getParameter<std::vector<double>>("emFractionBinsHF")), + absEtaBinsHF(iConfig.getParameter<std::vector<double>>("absEtaBinsHF")), + jetCalibrationsHF(iConfig.getParameter<std::vector<double>>("jetCalibrationsHF")), + tauPtBins(iConfig.getParameter<std::vector<double>>("tauPtBins")), + tauAbsEtaBinsBarrel(iConfig.getParameter<std::vector<double>>("tauAbsEtaBinsBarrel")), + tauCalibrationsBarrel(iConfig.getParameter<std::vector<double>>("tauCalibrationsBarrel")), + tauL1egInfoBarrel(iConfig.getParameter<std::vector<edm::ParameterSet>>("tauL1egInfoBarrel")), + tauAbsEtaBinsHGCal(iConfig.getParameter<std::vector<double>>("tauAbsEtaBinsHGCal")), + tauCalibrationsHGCal(iConfig.getParameter<std::vector<double>>("tauCalibrationsHGCal")), + tauL1egInfoHGCal(iConfig.getParameter<std::vector<edm::ParameterSet>>("tauL1egInfoHGCal")), + debug(iConfig.getParameter<bool>("debug")), + l1TowerToken_(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))) + +{ + if (debug) + printf("L1CaloJetProducer setup\n"); + produces<l1tp2::CaloJetsCollection>("L1CaloJetsNoCuts"); + //produces<l1tp2::CaloJetsCollection>("L1CaloJetsWithCuts"); + //produces<l1extra::L1JetParticleCollection>("L1CaloClusterCollectionWithCuts"); + produces<BXVector<l1t::Jet>>("L1CaloJetCollectionBXV"); + produces<BXVector<l1t::Tau>>("L1CaloTauCollectionBXV"); + + if (debug) + printf("\nHcalTpEtMin = %f\nEcalTpEtMin = %f\n", HcalTpEtMin, EcalTpEtMin); + //for( unsigned int i = 0; i < emFractionBins.size(); i++) + //{ + // printf("\n emFrac: %f", emFractionBins.at(i)); + //} + //for( unsigned int i = 0; i < absEtaBins.size(); i++) + //{ + // printf("\n absEta: %f", absEtaBins.at(i)); + //} + //for( unsigned int i = 0; i < jetPtBins.size(); i++) + //{ + // printf("\n jetPt: %f", jetPtBins.at(i)); + //} + + // Fill the calibration 3D vector + // Dimension 1 is AbsEta bin + // Dimension 2 is EM Fraction bin + // Dimension 3 is jet pT bin which is filled with the actual callibration value + // size()-1 b/c the inputs have lower and upper bounds + // Do Barrel, then HGCal, then HF + int index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsBarrel.at(index) ); + for (unsigned int abs_eta = 0; abs_eta < absEtaBinsBarrel.size() - 1; abs_eta++) { + std::vector<std::vector<double>> em_bins; + for (unsigned int em_frac = 0; em_frac < emFractionBinsBarrel.size() - 1; em_frac++) { + std::vector<double> pt_bin_calibs; + for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { + //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); + //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsBarrel.at(em_frac), absEtaBinsBarrel.at(abs_eta), jetPtBins.at(pt), jetCalibrationsBarrel.at(index)); + pt_bin_calibs.push_back(jetCalibrationsBarrel.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); } - if(debug) printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(jetCalibrationsBarrel.size())); - - index = 0; - //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHGCal.at(index) ); - for( unsigned int abs_eta = 0; abs_eta < absEtaBinsHGCal.size()-1; abs_eta++) - { - std::vector< std::vector< double >> em_bins; - for( unsigned int em_frac = 0; em_frac < emFractionBinsHGCal.size()-1; em_frac++) - { - std::vector< double > pt_bin_calibs; - for( unsigned int pt = 0; pt < jetPtBins.size()-1; pt++) - { - //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); - //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHGCal.at(em_frac), absEtaBinsHGCal.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHGCal.at(index)); - pt_bin_calibs.push_back( jetCalibrationsHGCal.at(index) ); - index++; - } - em_bins.push_back( pt_bin_calibs ); - } - calibrationsHGCal.push_back( em_bins ); + calibrationsBarrel.push_back(em_bins); + } + if (debug) + printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", + index, + int(jetCalibrationsBarrel.size())); + + index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHGCal.at(index) ); + for (unsigned int abs_eta = 0; abs_eta < absEtaBinsHGCal.size() - 1; abs_eta++) { + std::vector<std::vector<double>> em_bins; + for (unsigned int em_frac = 0; em_frac < emFractionBinsHGCal.size() - 1; em_frac++) { + std::vector<double> pt_bin_calibs; + for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { + //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); + //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHGCal.at(em_frac), absEtaBinsHGCal.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHGCal.at(index)); + pt_bin_calibs.push_back(jetCalibrationsHGCal.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); } - if(debug) printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(jetCalibrationsHGCal.size())); - - index = 0; - //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHF.at(index) ); - for( unsigned int abs_eta = 0; abs_eta < absEtaBinsHF.size()-1; abs_eta++) - { - std::vector< std::vector< double >> em_bins; - for( unsigned int em_frac = 0; em_frac < emFractionBinsHF.size()-1; em_frac++) - { - std::vector< double > pt_bin_calibs; - for( unsigned int pt = 0; pt < jetPtBins.size()-1; pt++) - { - //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); - //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHF.at(em_frac), absEtaBinsHF.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHF.at(index)); - pt_bin_calibs.push_back( jetCalibrationsHF.at(index) ); - index++; - } - em_bins.push_back( pt_bin_calibs ); - } - calibrationsHF.push_back( em_bins ); + calibrationsHGCal.push_back(em_bins); + } + if (debug) + printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", + index, + int(jetCalibrationsHGCal.size())); + + index = 0; + //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHF.at(index) ); + for (unsigned int abs_eta = 0; abs_eta < absEtaBinsHF.size() - 1; abs_eta++) { + std::vector<std::vector<double>> em_bins; + for (unsigned int em_frac = 0; em_frac < emFractionBinsHF.size() - 1; em_frac++) { + std::vector<double> pt_bin_calibs; + for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { + //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); + //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHF.at(em_frac), absEtaBinsHF.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHF.at(index)); + pt_bin_calibs.push_back(jetCalibrationsHF.at(index)); + index++; + } + em_bins.push_back(pt_bin_calibs); } - if(debug) printf("\nLoading HF calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(jetCalibrationsHF.size())); - - - // Load Tau L1EG-base calibration info into maps - for( auto& first : tauL1egInfoBarrel ) - { - if(debug) - { - printf( "barrel l1egCount = %f\n", first.getParameter<double>("l1egCount") ); - for ( auto& em_frac : first.getParameter<std::vector<double>>("l1egEmFractions") ) - { - printf(" - EM = %.3f\n", em_frac ); - } - } - double l1egCount = first.getParameter<double>("l1egCount"); - std::vector<double> l1egEmFractions = first.getParameter<std::vector<double>>("l1egEmFractions"); - tauL1egInfoMapBarrel[ l1egCount ] = l1egEmFractions; - tauL1egValuesBarrel.push_back( l1egCount ); + calibrationsHF.push_back(em_bins); + } + if (debug) + printf("\nLoading HF calibrations: Loaded %i values vs. size() of input calibration file: %i", + index, + int(jetCalibrationsHF.size())); + + // Load Tau L1EG-base calibration info into maps + for (auto &first : tauL1egInfoBarrel) { + if (debug) { + printf("barrel l1egCount = %f\n", first.getParameter<double>("l1egCount")); + for (auto &em_frac : first.getParameter<std::vector<double>>("l1egEmFractions")) { + printf(" - EM = %.3f\n", em_frac); + } } - std::sort(tauL1egValuesBarrel.begin(), tauL1egValuesBarrel.end()); - for( auto& first : tauL1egInfoHGCal ) - { - if(debug) - { - printf( "hgcal l1egCount = %f\n", first.getParameter<double>("l1egCount") ); - for ( auto& em_frac : first.getParameter<std::vector<double>>("l1egEmFractions") ) - { - printf(" - EM = %.3f\n", em_frac ); - } - } - double l1egCount = first.getParameter<double>("l1egCount"); - std::vector<double> l1egEmFractions = first.getParameter<std::vector<double>>("l1egEmFractions"); - tauL1egInfoMapHGCal[ l1egCount ] = l1egEmFractions; - tauL1egValuesHGCal.push_back( l1egCount ); + double l1egCount = first.getParameter<double>("l1egCount"); + std::vector<double> l1egEmFractions = first.getParameter<std::vector<double>>("l1egEmFractions"); + tauL1egInfoMapBarrel[l1egCount] = l1egEmFractions; + tauL1egValuesBarrel.push_back(l1egCount); + } + std::sort(tauL1egValuesBarrel.begin(), tauL1egValuesBarrel.end()); + for (auto &first : tauL1egInfoHGCal) { + if (debug) { + printf("hgcal l1egCount = %f\n", first.getParameter<double>("l1egCount")); + for (auto &em_frac : first.getParameter<std::vector<double>>("l1egEmFractions")) { + printf(" - EM = %.3f\n", em_frac); + } } - std::sort(tauL1egValuesHGCal.begin(), tauL1egValuesHGCal.end()); - // Fill the calibration 4D vector - // Dimension 1 is AbsEta bin - // Dimension 2 is L1EG count - // Dimension 3 is EM Fraction bin - // Dimension 4 is tau pT bin which is filled with the actual callibration value - // size()-1 b/c the inputs have lower and upper bounds (except L1EG b/c that is a cound) - // Do Barrel, then HGCal - // - // Note to future developers: be very concious of the order in which the calibrations are printed - // out in tool which makse the cfg files. You need to match that exactly when loading them and - // using the calibrations below. - index = 0; - for( unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsBarrel.size()-1; abs_eta++) - { - std::vector< std::vector< std::vector< double >>> l1eg_bins; - for( auto &l1eg_info : tauL1egInfoMapBarrel ) - { - std::vector< std::vector< double >> em_bins; - for( unsigned int em_frac = 0; em_frac < l1eg_info.second.size()-1; em_frac++) - { - //printf("\nBarrel l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsBarrel.at(abs_eta)); - std::vector< double > pt_bin_calibs; - for( unsigned int pt = 0; pt < tauPtBins.size()-1; pt++) - { - //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsBarrel.at(index)); - pt_bin_calibs.push_back( tauCalibrationsBarrel.at(index) ); - index++; - } - em_bins.push_back( pt_bin_calibs ); - } - l1eg_bins.push_back( em_bins ); + double l1egCount = first.getParameter<double>("l1egCount"); + std::vector<double> l1egEmFractions = first.getParameter<std::vector<double>>("l1egEmFractions"); + tauL1egInfoMapHGCal[l1egCount] = l1egEmFractions; + tauL1egValuesHGCal.push_back(l1egCount); + } + std::sort(tauL1egValuesHGCal.begin(), tauL1egValuesHGCal.end()); + // Fill the calibration 4D vector + // Dimension 1 is AbsEta bin + // Dimension 2 is L1EG count + // Dimension 3 is EM Fraction bin + // Dimension 4 is tau pT bin which is filled with the actual callibration value + // size()-1 b/c the inputs have lower and upper bounds (except L1EG b/c that is a cound) + // Do Barrel, then HGCal + // + // Note to future developers: be very concious of the order in which the calibrations are printed + // out in tool which makse the cfg files. You need to match that exactly when loading them and + // using the calibrations below. + index = 0; + for (unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsBarrel.size() - 1; abs_eta++) { + std::vector<std::vector<std::vector<double>>> l1eg_bins; + for (auto &l1eg_info : tauL1egInfoMapBarrel) { + std::vector<std::vector<double>> em_bins; + for (unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) { + //printf("\nBarrel l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsBarrel.at(abs_eta)); + std::vector<double> pt_bin_calibs; + for (unsigned int pt = 0; pt < tauPtBins.size() - 1; pt++) { + //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsBarrel.at(index)); + pt_bin_calibs.push_back(tauCalibrationsBarrel.at(index)); + index++; } - tauPtCalibrationsBarrel.push_back( l1eg_bins ); + em_bins.push_back(pt_bin_calibs); + } + l1eg_bins.push_back(em_bins); } - if(debug) printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(tauCalibrationsBarrel.size())); - - index = 0; - for( unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsHGCal.size()-1; abs_eta++) - { - std::vector< std::vector< std::vector< double >>> l1eg_bins; - for( const auto &l1eg_info : tauL1egInfoMapHGCal ) - { - std::vector< std::vector< double >> em_bins; - for( unsigned int em_frac = 0; em_frac < l1eg_info.second.size()-1; em_frac++) - { - //printf("\nHGCal l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsHGCal.at(abs_eta)); - std::vector< double > pt_bin_calibs; - for( unsigned int pt = 0; pt < tauPtBins.size()-1; pt++) - { - //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsHGCal.at(index)); - pt_bin_calibs.push_back( tauCalibrationsHGCal.at(index) ); - index++; - } - em_bins.push_back( pt_bin_calibs ); - } - l1eg_bins.push_back( em_bins ); + tauPtCalibrationsBarrel.push_back(l1eg_bins); + } + if (debug) + printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", + index, + int(tauCalibrationsBarrel.size())); + + index = 0; + for (unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsHGCal.size() - 1; abs_eta++) { + std::vector<std::vector<std::vector<double>>> l1eg_bins; + for (const auto &l1eg_info : tauL1egInfoMapHGCal) { + std::vector<std::vector<double>> em_bins; + for (unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) { + //printf("\nHGCal l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsHGCal.at(abs_eta)); + std::vector<double> pt_bin_calibs; + for (unsigned int pt = 0; pt < tauPtBins.size() - 1; pt++) { + //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsHGCal.at(index)); + pt_bin_calibs.push_back(tauCalibrationsHGCal.at(index)); + index++; } - tauPtCalibrationsHGCal.push_back( l1eg_bins ); + em_bins.push_back(pt_bin_calibs); + } + l1eg_bins.push_back(em_bins); } - if(debug) printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", index, int(tauCalibrationsHGCal.size())); - - - - isoTauBarrel.SetParameter( 0, 0.25 ); - isoTauBarrel.SetParameter( 1, 0.85 ); - isoTauBarrel.SetParameter( 2, 0.094 ); - isoTauHGCal.SetParameter( 0, 0.34 ); - isoTauHGCal.SetParameter( 1, 0.35 ); - isoTauHGCal.SetParameter( 2, 0.051 ); - - if (debug) printf("\nL1CaloJetProducer end\n"); + tauPtCalibrationsHGCal.push_back(l1eg_bins); + } + if (debug) + printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", + index, + int(tauCalibrationsHGCal.size())); + + isoTauBarrel.SetParameter(0, 0.25); + isoTauBarrel.SetParameter(1, 0.85); + isoTauBarrel.SetParameter(2, 0.094); + isoTauHGCal.SetParameter(0, 0.34); + isoTauHGCal.SetParameter(1, 0.35); + isoTauHGCal.SetParameter(2, 0.051); + + if (debug) + printf("\nL1CaloJetProducer end\n"); } -void L1CaloJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - - //printf("begin L1CaloJetProducer\n"); - - // Output collections - std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsNoCuts (new l1tp2::CaloJetsCollection ); - //std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsWithCuts( new l1tp2::CaloJetsCollection ); - //std::unique_ptr<l1extra::L1JetParticleCollection> L1CaloClusterCollectionWithCuts( new l1extra::L1JetParticleCollection ); - std::unique_ptr<BXVector<l1t::Jet>> L1CaloJetCollectionBXV(new l1t::JetBxCollection); - std::unique_ptr<BXVector<l1t::Tau>> L1CaloTauCollectionBXV(new l1t::TauBxCollection); - - - - - // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc - std::vector< SimpleCaloHit > l1CaloTowers; - - iEvent.getByToken(l1TowerToken_,l1CaloTowerHandle); - for (auto& hit : *l1CaloTowerHandle.product()) - { - - SimpleCaloHit l1Hit; - l1Hit.ecalTowerEt = hit.ecalTowerEt(); - l1Hit.hcalTowerEt = hit.hcalTowerEt(); - l1Hit.l1egTowerEt = hit.l1egTowerEt(); - // Add min ET thresholds for tower ET - if (l1Hit.ecalTowerEt < EcalTpEtMin) l1Hit.ecalTowerEt = 0.0; - if (l1Hit.hcalTowerEt < HcalTpEtMin) l1Hit.hcalTowerEt = 0.0; - l1Hit.total_tower_et = l1Hit.ecalTowerEt + l1Hit.hcalTowerEt + l1Hit.l1egTowerEt; - l1Hit.towerIEta = hit.towerIEta(); - l1Hit.towerIPhi = hit.towerIPhi(); - l1Hit.nL1eg = hit.nL1eg(); - l1Hit.l1egTrkSS = hit.l1egTrkSS(); - l1Hit.l1egTrkIso = hit.l1egTrkIso(); - l1Hit.l1egStandaloneSS = hit.l1egStandaloneSS(); - l1Hit.l1egStandaloneIso = hit.l1egStandaloneIso(); - l1Hit.isBarrel = hit.isBarrel(); - - // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is - // returning towers with minimal ECAL energy, and no HCAL energy with these - // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. - // Skip these for the time being until the upstream code has been debugged - if ((int)l1Hit.towerIEta == -1016 && (int)l1Hit.towerIPhi == -962) continue; - - l1Hit.towerEta = hit.towerEta(); - l1Hit.towerPhi = hit.towerPhi(); - l1CaloTowers.push_back( l1Hit ); - if (debug) printf("Tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et %f total_et %f\n", (int)l1Hit.towerIEta, (int)l1Hit.towerIPhi, l1Hit.towerEta, l1Hit.towerPhi, l1Hit.ecalTowerEt, l1Hit.hcalTowerEt, l1Hit.total_tower_et); - } - - - - - // Sort the ECAL+HCAL+L1EGs tower sums based on total ET - std::sort(begin(l1CaloTowers), end(l1CaloTowers), [](const SimpleCaloHit& a, - SimpleCaloHit& b){return a.total_tower_et > b.total_tower_et;}); - - - - /************************************************************************** +void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { + //printf("begin L1CaloJetProducer\n"); + + // Output collections + std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsNoCuts(new l1tp2::CaloJetsCollection); + //std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsWithCuts( new l1tp2::CaloJetsCollection ); + //std::unique_ptr<l1extra::L1JetParticleCollection> L1CaloClusterCollectionWithCuts( new l1extra::L1JetParticleCollection ); + std::unique_ptr<BXVector<l1t::Jet>> L1CaloJetCollectionBXV(new l1t::JetBxCollection); + std::unique_ptr<BXVector<l1t::Tau>> L1CaloTauCollectionBXV(new l1t::TauBxCollection); + + // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc + std::vector<SimpleCaloHit> l1CaloTowers; + + iEvent.getByToken(l1TowerToken_, l1CaloTowerHandle); + for (auto &hit : *l1CaloTowerHandle.product()) { + SimpleCaloHit l1Hit; + l1Hit.ecalTowerEt = hit.ecalTowerEt(); + l1Hit.hcalTowerEt = hit.hcalTowerEt(); + l1Hit.l1egTowerEt = hit.l1egTowerEt(); + // Add min ET thresholds for tower ET + if (l1Hit.ecalTowerEt < EcalTpEtMin) + l1Hit.ecalTowerEt = 0.0; + if (l1Hit.hcalTowerEt < HcalTpEtMin) + l1Hit.hcalTowerEt = 0.0; + l1Hit.total_tower_et = l1Hit.ecalTowerEt + l1Hit.hcalTowerEt + l1Hit.l1egTowerEt; + l1Hit.towerIEta = hit.towerIEta(); + l1Hit.towerIPhi = hit.towerIPhi(); + l1Hit.nL1eg = hit.nL1eg(); + l1Hit.l1egTrkSS = hit.l1egTrkSS(); + l1Hit.l1egTrkIso = hit.l1egTrkIso(); + l1Hit.l1egStandaloneSS = hit.l1egStandaloneSS(); + l1Hit.l1egStandaloneIso = hit.l1egStandaloneIso(); + l1Hit.isBarrel = hit.isBarrel(); + + // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is + // returning towers with minimal ECAL energy, and no HCAL energy with these + // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. + // Skip these for the time being until the upstream code has been debugged + if ((int)l1Hit.towerIEta == -1016 && (int)l1Hit.towerIPhi == -962) + continue; + + l1Hit.towerEta = hit.towerEta(); + l1Hit.towerPhi = hit.towerPhi(); + l1CaloTowers.push_back(l1Hit); + if (debug) + printf("Tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et %f total_et %f\n", + (int)l1Hit.towerIEta, + (int)l1Hit.towerIPhi, + l1Hit.towerEta, + l1Hit.towerPhi, + l1Hit.ecalTowerEt, + l1Hit.hcalTowerEt, + l1Hit.total_tower_et); + } + + // Sort the ECAL+HCAL+L1EGs tower sums based on total ET + std::sort(begin(l1CaloTowers), end(l1CaloTowers), [](const SimpleCaloHit &a, SimpleCaloHit &b) { + return a.total_tower_et > b.total_tower_et; + }); + + /************************************************************************** * Begin with making CaloJets in 9x9 grid based on all energy not included in L1EG Objs. * For reference, Run-I used 12x12 grid and Stage-2/Phase-I used 9x9 grid. * We plan to further study this choice and possibly move towards a more circular shape @@ -624,885 +592,838 @@ void L1CaloJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetu * 9 trigger towers contains all of an ak-0.4 jets, but overshoots on the corners. ******************************************************************************/ - // Experimental parameters, don't want to bother with hardcoding them in data format - std::map<std::string, float> params; - - std::vector< l1CaloJetObj > l1CaloJetObjs; - - // Count the number of unused HCAL TPs so we can stop while loop after done. - // Clustering can also stop once there are no seed hits >= EtMinForSeedHit - int n_towers = l1CaloTowers.size(); - int n_stale = 0; - bool caloJetClusteringFinished = false; - while (!caloJetClusteringFinished && n_towers != n_stale) - { - - l1CaloJetObj caloJetObj; - caloJetObj.Init(); - - // First find highest ET ECAL+HCAL+L1EGs tower and use to seed the 9x9 Jet - int cnt = 0; - for (auto &l1CaloTower : l1CaloTowers) - { - - cnt++; - if (l1CaloTower.stale) continue; // skip l1CaloTowers which are already used - - if (caloJetObj.jetClusterET == 0.0) // this is the first l1CaloTower to seed the jet - { - // Check if the leading unused tower has ET < min for seeding a jet. - // If so, stop jet clustering - if (l1CaloTower.total_tower_et < EtMinForSeedHit) - { - caloJetClusteringFinished = true; - continue; - } - l1CaloTower.stale = true; - n_stale++; - - // Set seed location needed for delta iEta/iPhi, eta/phi comparisons later - if (l1CaloTower.isBarrel) caloJetObj.barrelSeeded = true; - else caloJetObj.barrelSeeded = false; - - // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together - reco::Candidate::PolarLorentzVector hcalP4( l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - reco::Candidate::PolarLorentzVector ecalP4( l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - reco::Candidate::PolarLorentzVector l1egP4( l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - reco::Candidate::PolarLorentzVector totalP4( l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - - if (hcalP4.pt() > 0) - { - caloJetObj.hcal_nHits++; - caloJetObj.hcalJetCluster += hcalP4; - caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; - } - if (ecalP4.pt() > 0) - { - caloJetObj.ecal_nHits++; - caloJetObj.ecalJetCluster += ecalP4; - caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; - } - if (l1egP4.pt() > 0) - { - caloJetObj.l1eg_nHits++; - caloJetObj.l1egJetCluster += l1egP4; - caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; - caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; - - caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; - caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; - caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; - caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; - - if (l1CaloTower.isBarrel) - { - // For decay mode related checks with CaloTaus - // only applicable in the barrel at the moment: - // l1eg pt, HCAL ET, ECAL ET, dEta, dPhi, trkSS, trkIso, standaloneSS, standaloneIso - std::vector< float > l1EG_info = {float(l1egP4.pt()), float(hcalP4.pt()), float(ecalP4.pt()), 0., 0., float(l1CaloTower.l1egTrkSS), - float(l1CaloTower.l1egTrkIso), float(l1CaloTower.l1egStandaloneSS), float(l1CaloTower.l1egStandaloneIso)}; - if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) - { - caloJetObj.n_l1eg_HoverE_LessThreshold++; - } - caloJetObj.associated_l1EGs_.push_back( l1EG_info ); - } - - } - if (totalP4.pt() > 0) - { - caloJetObj.total_nHits++; - caloJetObj.jetCluster += totalP4; - caloJetObj.jetClusterET += l1CaloTower.total_tower_et; - caloJetObj.seedTower += totalP4; - caloJetObj.seedTowerET += l1CaloTower.total_tower_et; - } - - - caloJetObj.seed_iEta = l1CaloTower.towerIEta; - caloJetObj.seed_iPhi = l1CaloTower.towerIPhi; - - - if (debug) printf(" -- hit %i, seeding input p4 pt %f eta %f phi %f\n", cnt, l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi); - if (debug) printf(" -- hit %i, seeding input2 p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); - if (debug) printf(" -- hit %i, seeding reslt tot p4 pt %f eta %f phi %f\n", cnt, caloJetObj.jetClusterET, caloJetObj.jetCluster.eta(), caloJetObj.jetCluster.phi()); - - // Need to add the seed energy to the dR rings - caloJetObj.hcal_seed += hcalP4.pt(); - //caloJetObj.hcal_3x3 += hcalP4.pt(); - caloJetObj.hcal_3x5 += hcalP4.pt(); - //caloJetObj.hcal_5x5 += hcalP4.pt(); - //caloJetObj.hcal_5x7 += hcalP4.pt(); - caloJetObj.hcal_7x7 += hcalP4.pt(); - caloJetObj.ecal_seed += ecalP4.pt(); - //caloJetObj.ecal_3x3 += ecalP4.pt(); - caloJetObj.ecal_3x5 += ecalP4.pt(); - //caloJetObj.ecal_5x5 += ecalP4.pt(); - //caloJetObj.ecal_5x7 += ecalP4.pt(); - caloJetObj.ecal_7x7 += ecalP4.pt(); - caloJetObj.l1eg_seed += l1egP4.pt(); - //caloJetObj.l1eg_3x3 += l1egP4.pt(); - caloJetObj.l1eg_3x5 += l1egP4.pt(); - //caloJetObj.l1eg_5x5 += l1egP4.pt(); - //caloJetObj.l1eg_5x7 += l1egP4.pt(); - caloJetObj.l1eg_7x7 += l1egP4.pt(); - caloJetObj.total_seed += totalP4.pt(); - //caloJetObj.total_3x3 += totalP4.pt(); - caloJetObj.total_3x5 += totalP4.pt(); - //caloJetObj.total_5x5 += totalP4.pt(); - //caloJetObj.total_5x7 += totalP4.pt(); - caloJetObj.total_7x7 += totalP4.pt(); - - // Some discrimination vars, 2x2s and 2x3 including central seed - //caloJetObj.hcal_2x3 += hcalP4.pt(); - //caloJetObj.hcal_2x3_1 += hcalP4.pt(); - //caloJetObj.hcal_2x3_2 += hcalP4.pt(); - //caloJetObj.ecal_2x3 += ecalP4.pt(); - //caloJetObj.ecal_2x3_1 += ecalP4.pt(); - //caloJetObj.ecal_2x3_2 += ecalP4.pt(); - //caloJetObj.l1eg_2x3 += l1egP4.pt(); - //caloJetObj.l1eg_2x3_1 += l1egP4.pt(); - //caloJetObj.l1eg_2x3_2 += l1egP4.pt(); - //caloJetObj.total_2x3 += totalP4.pt(); - //caloJetObj.total_2x3_1 += totalP4.pt(); - //caloJetObj.total_2x3_2 += totalP4.pt(); - - //caloJetObj.hcal_2x2 += hcalP4.pt(); - //caloJetObj.hcal_2x2_1 += hcalP4.pt(); - //caloJetObj.hcal_2x2_2 += hcalP4.pt(); - //caloJetObj.hcal_2x2_3 += hcalP4.pt(); - //caloJetObj.hcal_2x2_4 += hcalP4.pt(); - //caloJetObj.ecal_2x2 += ecalP4.pt(); - //caloJetObj.ecal_2x2_1 += ecalP4.pt(); - //caloJetObj.ecal_2x2_2 += ecalP4.pt(); - //caloJetObj.ecal_2x2_3 += ecalP4.pt(); - //caloJetObj.ecal_2x2_4 += ecalP4.pt(); - //caloJetObj.l1eg_2x2 += l1egP4.pt(); - //caloJetObj.l1eg_2x2_1 += l1egP4.pt(); - //caloJetObj.l1eg_2x2_2 += l1egP4.pt(); - //caloJetObj.l1eg_2x2_3 += l1egP4.pt(); - //caloJetObj.l1eg_2x2_4 += l1egP4.pt(); - //caloJetObj.total_2x2 += totalP4.pt(); - //caloJetObj.total_2x2_1 += totalP4.pt(); - //caloJetObj.total_2x2_2 += totalP4.pt(); - //caloJetObj.total_2x2_3 += totalP4.pt(); - //caloJetObj.total_2x2_4 += totalP4.pt(); - continue; - } - - // Unused l1CaloTowers which are not the initial seed - // Depending on seed and tower locations calculate iEta/iPhi or eta/phi comparisons. - // The defaults of 99 will automatically fail comparisons for the incorrect regions. - int hit_iPhi = 99; - int d_iEta = 99; - int d_iPhi = 99; - float d_eta = 99; - float d_phi = 99; - if ( caloJetObj.barrelSeeded && l1CaloTower.isBarrel ) // use iEta/iPhi comparisons - { - hit_iPhi = l1CaloTower.towerIPhi; - d_iEta = tower_diEta( caloJetObj.seed_iEta, l1CaloTower.towerIEta ); - d_iPhi = tower_diPhi( caloJetObj.seed_iPhi, hit_iPhi ); - } - else // either seed or tower are in HGCal or HF, use eta/phi - { - d_eta = caloJetObj.seedTower.eta() - l1CaloTower.towerEta; - d_phi = reco::deltaPhi( caloJetObj.seedTower.phi(), l1CaloTower.towerPhi ); - } + // Experimental parameters, don't want to bother with hardcoding them in data format + std::map<std::string, float> params; + + std::vector<l1CaloJetObj> l1CaloJetObjs; + + // Count the number of unused HCAL TPs so we can stop while loop after done. + // Clustering can also stop once there are no seed hits >= EtMinForSeedHit + int n_towers = l1CaloTowers.size(); + int n_stale = 0; + bool caloJetClusteringFinished = false; + while (!caloJetClusteringFinished && n_towers != n_stale) { + l1CaloJetObj caloJetObj; + caloJetObj.Init(); + + // First find highest ET ECAL+HCAL+L1EGs tower and use to seed the 9x9 Jet + int cnt = 0; + for (auto &l1CaloTower : l1CaloTowers) { + cnt++; + if (l1CaloTower.stale) + continue; // skip l1CaloTowers which are already used + + if (caloJetObj.jetClusterET == 0.0) // this is the first l1CaloTower to seed the jet + { + // Check if the leading unused tower has ET < min for seeding a jet. + // If so, stop jet clustering + if (l1CaloTower.total_tower_et < EtMinForSeedHit) { + caloJetClusteringFinished = true; + continue; + } + l1CaloTower.stale = true; + n_stale++; - // 7x7 HCAL Trigger Towers - // If seeded in barrel and hit is barrel then we can compare iEta/iPhi, else need to use eta/phi - // in HGCal / transition region - if ( (abs( d_iEta ) <= 3 && abs( d_iPhi ) <= 3) || - ( fabs( d_eta ) < 0.3 && fabs( d_phi ) < 0.3 ) ) - { - - l1CaloTower.stale = true; - n_stale++; - - // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together - reco::Candidate::PolarLorentzVector hcalP4( l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - reco::Candidate::PolarLorentzVector ecalP4( l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - reco::Candidate::PolarLorentzVector l1egP4( l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - reco::Candidate::PolarLorentzVector totalP4( l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); - - if (hcalP4.pt() > 0) - { - caloJetObj.hcal_nHits++; - caloJetObj.hcalJetCluster += hcalP4; - caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; - } - if (ecalP4.pt() > 0) - { - caloJetObj.ecal_nHits++; - caloJetObj.ecalJetCluster += ecalP4; - caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; - } - if (l1egP4.pt() > 0) - { - caloJetObj.l1eg_nHits++; - caloJetObj.l1egJetCluster += l1egP4; - caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; - caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; - } - if (totalP4.pt() > 0) - { - caloJetObj.total_nHits++; - caloJetObj.jetCluster += totalP4; - caloJetObj.jetClusterET += l1CaloTower.total_tower_et; - } - - - if (debug) printf(" ---- hit %i input p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); - if (debug) printf(" ---- hit %i resulting p4 pt %f eta %f phi %f\n", cnt, caloJetObj.jetClusterET, caloJetObj.jetCluster.eta(), caloJetObj.jetCluster.phi()); - - - - if ( (abs( d_iEta ) == 0 && abs( d_iPhi ) == 0) || - ( fabs( d_eta ) < 0.043 && fabs( d_phi ) < 0.043 ) ) - { - caloJetObj.hcal_seed += hcalP4.pt(); - caloJetObj.ecal_seed += ecalP4.pt(); - caloJetObj.l1eg_seed += l1egP4.pt(); - caloJetObj.total_seed += totalP4.pt(); - } - //if ( (abs( d_iEta ) <= 1 && abs( d_iPhi ) <= 1) || - // ( fabs( d_eta ) < 0.13 && fabs( d_phi ) < 0.13 ) ) - //{ - // caloJetObj.hcal_3x3 += hcalP4.pt(); - // caloJetObj.ecal_3x3 += ecalP4.pt(); - // caloJetObj.l1eg_3x3 += l1egP4.pt(); - // caloJetObj.total_3x3 += totalP4.pt(); - //} - if ( (abs( d_iEta ) <= 1 && abs( d_iPhi ) <= 2) || - ( fabs( d_eta ) < 0.13 && fabs( d_phi ) < 0.22 ) ) - { - caloJetObj.hcal_3x5 += hcalP4.pt(); - caloJetObj.ecal_3x5 += ecalP4.pt(); - caloJetObj.l1eg_3x5 += l1egP4.pt(); - caloJetObj.total_3x5 += totalP4.pt(); - - // Do this for 3x5 only - if (l1egP4.pt() > 0) - { - caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; - caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; - caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; - caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; - - // For decay mode related checks with CaloTaus - // only applicable in the barrel at the moment: - // l1eg pt, HCAL ET, ECAL ET, d_iEta, d_iPhi, trkSS, trkIso, standaloneSS, standaloneIso - std::vector< float > l1EG_info = {float(l1egP4.pt()), float(hcalP4.pt()), float(ecalP4.pt()), - float(d_iEta), float(d_iPhi), float(l1CaloTower.l1egTrkSS), float(l1CaloTower.l1egTrkIso), - float(l1CaloTower.l1egStandaloneSS), float(l1CaloTower.l1egStandaloneIso)}; - if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) - { - caloJetObj.n_l1eg_HoverE_LessThreshold++; - } - caloJetObj.associated_l1EGs_.push_back( l1EG_info ); - } - - } - //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 2) || - // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.22 ) ) - //{ - // caloJetObj.hcal_5x5 += hcalP4.pt(); - // caloJetObj.ecal_5x5 += ecalP4.pt(); - // caloJetObj.l1eg_5x5 += l1egP4.pt(); - // caloJetObj.total_5x5 += totalP4.pt(); - //} - //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 3) || - // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.3 ) ) - //{ - // caloJetObj.hcal_5x7 += hcalP4.pt(); - // caloJetObj.ecal_5x7 += ecalP4.pt(); - // caloJetObj.l1eg_5x7 += l1egP4.pt(); - // caloJetObj.total_5x7 += totalP4.pt(); - //} - if ( (abs( d_iEta ) <= 3 && abs( d_iPhi ) <= 3) || - ( fabs( d_eta ) < 0.3 && fabs( d_phi ) < 0.3 ) ) - { - caloJetObj.hcal_7x7 += hcalP4.pt(); - caloJetObj.ecal_7x7 += ecalP4.pt(); - caloJetObj.l1eg_7x7 += l1egP4.pt(); - caloJetObj.total_7x7 += totalP4.pt(); - } - - //// Some discrimination vars, 2x2s and 2x3s including central seed - //// Barrel first, 2x3 - //if ( ( d_iEta == 0 || d_iEta == 1 ) && abs(d_iPhi) <= 1 ) - //{ - // caloJetObj.hcal_2x3_1 += hcalP4.pt(); - // caloJetObj.ecal_2x3_1 += ecalP4.pt(); - // caloJetObj.l1eg_2x3_1 += l1egP4.pt(); - // caloJetObj.total_2x3_1 += totalP4.pt(); - //} - //if ( ( d_iEta == 0 || d_iEta == -1 ) && abs(d_iPhi) <= 1 ) - //{ - // caloJetObj.hcal_2x3_2 += hcalP4.pt(); - // caloJetObj.ecal_2x3_2 += ecalP4.pt(); - // caloJetObj.l1eg_2x3_2 += l1egP4.pt(); - // caloJetObj.total_2x3_2 += totalP4.pt(); - //} - //// HGCal / HF - //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.13 ) - //{ - // caloJetObj.hcal_2x3 += hcalP4.pt(); - // caloJetObj.ecal_2x3 += ecalP4.pt(); - // caloJetObj.l1eg_2x3 += l1egP4.pt(); - // caloJetObj.total_2x3 += totalP4.pt(); - //} - - //// Now 2x2 Barrel first - //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) - //{ - // caloJetObj.hcal_2x2_1 += hcalP4.pt(); - // caloJetObj.ecal_2x2_1 += ecalP4.pt(); - // caloJetObj.l1eg_2x2_1 += l1egP4.pt(); - // caloJetObj.total_2x2_1 += totalP4.pt(); - //} - //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) - //{ - // caloJetObj.hcal_2x2_2 += hcalP4.pt(); - // caloJetObj.ecal_2x2_2 += ecalP4.pt(); - // caloJetObj.l1eg_2x2_2 += l1egP4.pt(); - // caloJetObj.total_2x2_2 += totalP4.pt(); - //} - //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) - //{ - // caloJetObj.hcal_2x2_3 += hcalP4.pt(); - // caloJetObj.ecal_2x2_3 += ecalP4.pt(); - // caloJetObj.l1eg_2x2_3 += l1egP4.pt(); - // caloJetObj.total_2x2_3 += totalP4.pt(); - //} - //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) - //{ - // caloJetObj.hcal_2x2_4 += hcalP4.pt(); - // caloJetObj.ecal_2x2_4 += ecalP4.pt(); - // caloJetObj.l1eg_2x2_4 += l1egP4.pt(); - // caloJetObj.total_2x2_4 += totalP4.pt(); - //} - //// HGCal / HF - //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.087 ) - //{ - // caloJetObj.hcal_2x2 += hcalP4.pt(); - // caloJetObj.ecal_2x2 += ecalP4.pt(); - // caloJetObj.l1eg_2x2 += l1egP4.pt(); - // caloJetObj.total_2x2 += totalP4.pt(); - //} + // Set seed location needed for delta iEta/iPhi, eta/phi comparisons later + if (l1CaloTower.isBarrel) + caloJetObj.barrelSeeded = true; + else + caloJetObj.barrelSeeded = false; + + // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together + reco::Candidate::PolarLorentzVector hcalP4( + l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector ecalP4( + l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector l1egP4( + l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector totalP4( + l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + + if (hcalP4.pt() > 0) { + caloJetObj.hcal_nHits++; + caloJetObj.hcalJetCluster += hcalP4; + caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; + } + if (ecalP4.pt() > 0) { + caloJetObj.ecal_nHits++; + caloJetObj.ecalJetCluster += ecalP4; + caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; + } + if (l1egP4.pt() > 0) { + caloJetObj.l1eg_nHits++; + caloJetObj.l1egJetCluster += l1egP4; + caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; + caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; + + caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; + caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; + caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; + caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; + + if (l1CaloTower.isBarrel) { + // For decay mode related checks with CaloTaus + // only applicable in the barrel at the moment: + // l1eg pt, HCAL ET, ECAL ET, dEta, dPhi, trkSS, trkIso, standaloneSS, standaloneIso + std::vector<float> l1EG_info = {float(l1egP4.pt()), + float(hcalP4.pt()), + float(ecalP4.pt()), + 0., + 0., + float(l1CaloTower.l1egTrkSS), + float(l1CaloTower.l1egTrkIso), + float(l1CaloTower.l1egStandaloneSS), + float(l1CaloTower.l1egStandaloneIso)}; + if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) { + caloJetObj.n_l1eg_HoverE_LessThreshold++; } + caloJetObj.associated_l1EGs_.push_back(l1EG_info); + } } - - if (caloJetObj.jetClusterET > 0.0) - { - l1CaloJetObjs.push_back( caloJetObj ); + if (totalP4.pt() > 0) { + caloJetObj.total_nHits++; + caloJetObj.jetCluster += totalP4; + caloJetObj.jetClusterET += l1CaloTower.total_tower_et; + caloJetObj.seedTower += totalP4; + caloJetObj.seedTowerET += l1CaloTower.total_tower_et; } - } // end while loop of HCAL TP clustering - - - - - // Sort JetClusters so we can begin with the highest pt for next step of jet clustering - std::sort(begin(l1CaloJetObjs), end(l1CaloJetObjs), [](const l1CaloJetObj& a, - const l1CaloJetObj& b){return a.jetClusterET > b.jetClusterET;}); - - - - /************************************************************************** - * Progress to adding L1EGs built from ECAL TPs 9x9 grid. - * Recall, for 9x9 trigger towers gives diameter 0.78 - ******************************************************************************/ - - - // Cluster together the L1EGs around existing HCAL Jet - // Cluster within dEta/dPhi 0.4 which is very close to 0.39 = 9x9/2 - //std::cout << " - Input L1EGs: " << crystalClustersVect.size() << std::endl; - for (auto &caloJetObj : l1CaloJetObjs) - { - - - - - params["seed_pt"] = caloJetObj.seedTowerET; - params["seed_eta"] = caloJetObj.seedTower.eta(); - params["seed_phi"] = caloJetObj.seedTower.phi(); - params["seed_iEta"] = caloJetObj.seed_iEta; - params["seed_iPhi"] = caloJetObj.seed_iPhi; - params["seed_energy"] = caloJetObj.seedTower.energy(); - - params["hcal_pt"] = caloJetObj.hcalJetClusterET; - params["hcal_seed"] = caloJetObj.hcal_seed; - //params["hcal_3x3"] = caloJetObj.hcal_3x3; - params["hcal_3x5"] = caloJetObj.hcal_3x5; - //params["hcal_5x5"] = caloJetObj.hcal_5x5; - //params["hcal_5x7"] = caloJetObj.hcal_5x7; - params["hcal_7x7"] = caloJetObj.hcal_7x7; - //params["hcal_2x3"] = std::max( caloJetObj.hcal_2x3, std::max( caloJetObj.hcal_2x3_1, caloJetObj.hcal_2x3_2 )); - //params["hcal_2x2"] = std::max( caloJetObj.hcal_2x2, std::max( caloJetObj.hcal_2x2_1, std::max( caloJetObj.hcal_2x2_2, std::max( caloJetObj.hcal_2x2_3, caloJetObj.hcal_2x2_4 )))); - params["hcal_nHits"] = caloJetObj.hcal_nHits; - - params["ecal_pt"] = caloJetObj.ecalJetClusterET; - params["ecal_seed"] = caloJetObj.ecal_seed; - //params["ecal_3x3"] = caloJetObj.ecal_3x3; - params["ecal_3x5"] = caloJetObj.ecal_3x5; - //params["ecal_5x5"] = caloJetObj.ecal_5x5; - //params["ecal_5x7"] = caloJetObj.ecal_5x7; - params["ecal_7x7"] = caloJetObj.ecal_7x7; - //params["ecal_2x3"] = std::max( caloJetObj.ecal_2x3, std::max( caloJetObj.ecal_2x3_1, caloJetObj.ecal_2x3_2 )); - //params["ecal_2x2"] = std::max( caloJetObj.ecal_2x2, std::max( caloJetObj.ecal_2x2_1, std::max( caloJetObj.ecal_2x2_2, std::max( caloJetObj.ecal_2x2_3, caloJetObj.ecal_2x2_4 )))); - params["ecal_nHits"] = caloJetObj.ecal_nHits; - - params["l1eg_pt"] = caloJetObj.l1egJetClusterET; - params["l1eg_seed"] = caloJetObj.l1eg_seed; - //params["l1eg_3x3"] = caloJetObj.l1eg_3x3; - params["l1eg_3x5"] = caloJetObj.l1eg_3x5; - //params["l1eg_5x5"] = caloJetObj.l1eg_5x5; - //params["l1eg_5x7"] = caloJetObj.l1eg_5x7; - params["l1eg_7x7"] = caloJetObj.l1eg_7x7; - //params["l1eg_2x3"] = std::max( caloJetObj.l1eg_2x3, std::max( caloJetObj.l1eg_2x3_1, caloJetObj.l1eg_2x3_2 )); - //params["l1eg_2x2"] = std::max( caloJetObj.l1eg_2x2, std::max( caloJetObj.l1eg_2x2_1, std::max( caloJetObj.l1eg_2x2_2, std::max( caloJetObj.l1eg_2x2_3, caloJetObj.l1eg_2x2_4 )))); - params["l1eg_nHits"] = caloJetObj.l1eg_nHits; - params["l1eg_nL1EGs"] = caloJetObj.l1eg_nL1EGs; - params["l1eg_nL1EGs_standaloneSS"] = caloJetObj.l1eg_nL1EGs_standaloneSS; - params["l1eg_nL1EGs_standaloneIso"] = caloJetObj.l1eg_nL1EGs_standaloneIso; - params["l1eg_nL1EGs_trkMatchSS"] = caloJetObj.l1eg_nL1EGs_trkMatchSS; - params["l1eg_nL1EGs_trkMatchIso"] = caloJetObj.l1eg_nL1EGs_trkMatchIso; - - params["total_et"] = caloJetObj.jetClusterET; - params["total_seed"] = caloJetObj.total_seed; - //params["total_3x3"] = caloJetObj.total_3x3; - params["total_3x5"] = caloJetObj.total_3x5; - //params["total_5x5"] = caloJetObj.total_5x5; - //params["total_5x7"] = caloJetObj.total_5x7; - params["total_7x7"] = caloJetObj.total_7x7; - //params["total_2x3"] = std::max( caloJetObj.total_2x3, std::max( caloJetObj.total_2x3_1, caloJetObj.total_2x3_2 )); - //params["total_2x2"] = std::max( caloJetObj.total_2x2, std::max( caloJetObj.total_2x2_1, std::max( caloJetObj.total_2x2_2, std::max( caloJetObj.total_2x2_3, caloJetObj.total_2x2_4 )))); - params["total_nHits"] = caloJetObj.total_nHits; - //params["total_nTowers"] = total_nTowers; - - - //// return -9 for energy and dR values for ecalJet as defaults - float hovere = -9; - if (caloJetObj.ecalJetClusterET > 0.0) - { - hovere = caloJetObj.hcalJetClusterET / ( caloJetObj.ecalJetClusterET + caloJetObj.l1egJetClusterET ); + caloJetObj.seed_iEta = l1CaloTower.towerIEta; + caloJetObj.seed_iPhi = l1CaloTower.towerIPhi; + + if (debug) + printf(" -- hit %i, seeding input p4 pt %f eta %f phi %f\n", + cnt, + l1CaloTower.total_tower_et, + l1CaloTower.towerEta, + l1CaloTower.towerPhi); + if (debug) + printf( + " -- hit %i, seeding input2 p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); + if (debug) + printf(" -- hit %i, seeding reslt tot p4 pt %f eta %f phi %f\n", + cnt, + caloJetObj.jetClusterET, + caloJetObj.jetCluster.eta(), + caloJetObj.jetCluster.phi()); + + // Need to add the seed energy to the dR rings + caloJetObj.hcal_seed += hcalP4.pt(); + //caloJetObj.hcal_3x3 += hcalP4.pt(); + caloJetObj.hcal_3x5 += hcalP4.pt(); + //caloJetObj.hcal_5x5 += hcalP4.pt(); + //caloJetObj.hcal_5x7 += hcalP4.pt(); + caloJetObj.hcal_7x7 += hcalP4.pt(); + caloJetObj.ecal_seed += ecalP4.pt(); + //caloJetObj.ecal_3x3 += ecalP4.pt(); + caloJetObj.ecal_3x5 += ecalP4.pt(); + //caloJetObj.ecal_5x5 += ecalP4.pt(); + //caloJetObj.ecal_5x7 += ecalP4.pt(); + caloJetObj.ecal_7x7 += ecalP4.pt(); + caloJetObj.l1eg_seed += l1egP4.pt(); + //caloJetObj.l1eg_3x3 += l1egP4.pt(); + caloJetObj.l1eg_3x5 += l1egP4.pt(); + //caloJetObj.l1eg_5x5 += l1egP4.pt(); + //caloJetObj.l1eg_5x7 += l1egP4.pt(); + caloJetObj.l1eg_7x7 += l1egP4.pt(); + caloJetObj.total_seed += totalP4.pt(); + //caloJetObj.total_3x3 += totalP4.pt(); + caloJetObj.total_3x5 += totalP4.pt(); + //caloJetObj.total_5x5 += totalP4.pt(); + //caloJetObj.total_5x7 += totalP4.pt(); + caloJetObj.total_7x7 += totalP4.pt(); + + // Some discrimination vars, 2x2s and 2x3 including central seed + //caloJetObj.hcal_2x3 += hcalP4.pt(); + //caloJetObj.hcal_2x3_1 += hcalP4.pt(); + //caloJetObj.hcal_2x3_2 += hcalP4.pt(); + //caloJetObj.ecal_2x3 += ecalP4.pt(); + //caloJetObj.ecal_2x3_1 += ecalP4.pt(); + //caloJetObj.ecal_2x3_2 += ecalP4.pt(); + //caloJetObj.l1eg_2x3 += l1egP4.pt(); + //caloJetObj.l1eg_2x3_1 += l1egP4.pt(); + //caloJetObj.l1eg_2x3_2 += l1egP4.pt(); + //caloJetObj.total_2x3 += totalP4.pt(); + //caloJetObj.total_2x3_1 += totalP4.pt(); + //caloJetObj.total_2x3_2 += totalP4.pt(); + + //caloJetObj.hcal_2x2 += hcalP4.pt(); + //caloJetObj.hcal_2x2_1 += hcalP4.pt(); + //caloJetObj.hcal_2x2_2 += hcalP4.pt(); + //caloJetObj.hcal_2x2_3 += hcalP4.pt(); + //caloJetObj.hcal_2x2_4 += hcalP4.pt(); + //caloJetObj.ecal_2x2 += ecalP4.pt(); + //caloJetObj.ecal_2x2_1 += ecalP4.pt(); + //caloJetObj.ecal_2x2_2 += ecalP4.pt(); + //caloJetObj.ecal_2x2_3 += ecalP4.pt(); + //caloJetObj.ecal_2x2_4 += ecalP4.pt(); + //caloJetObj.l1eg_2x2 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_1 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_2 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_3 += l1egP4.pt(); + //caloJetObj.l1eg_2x2_4 += l1egP4.pt(); + //caloJetObj.total_2x2 += totalP4.pt(); + //caloJetObj.total_2x2_1 += totalP4.pt(); + //caloJetObj.total_2x2_2 += totalP4.pt(); + //caloJetObj.total_2x2_3 += totalP4.pt(); + //caloJetObj.total_2x2_4 += totalP4.pt(); + continue; + } + + // Unused l1CaloTowers which are not the initial seed + // Depending on seed and tower locations calculate iEta/iPhi or eta/phi comparisons. + // The defaults of 99 will automatically fail comparisons for the incorrect regions. + int hit_iPhi = 99; + int d_iEta = 99; + int d_iPhi = 99; + float d_eta = 99; + float d_phi = 99; + if (caloJetObj.barrelSeeded && l1CaloTower.isBarrel) // use iEta/iPhi comparisons + { + hit_iPhi = l1CaloTower.towerIPhi; + d_iEta = tower_diEta(caloJetObj.seed_iEta, l1CaloTower.towerIEta); + d_iPhi = tower_diPhi(caloJetObj.seed_iPhi, hit_iPhi); + } else // either seed or tower are in HGCal or HF, use eta/phi + { + d_eta = caloJetObj.seedTower.eta() - l1CaloTower.towerEta; + d_phi = reco::deltaPhi(caloJetObj.seedTower.phi(), l1CaloTower.towerPhi); + } + + // 7x7 HCAL Trigger Towers + // If seeded in barrel and hit is barrel then we can compare iEta/iPhi, else need to use eta/phi + // in HGCal / transition region + if ((abs(d_iEta) <= 3 && abs(d_iPhi) <= 3) || (fabs(d_eta) < 0.3 && fabs(d_phi) < 0.3)) { + l1CaloTower.stale = true; + n_stale++; + + // 3 4-vectors for ECAL, HCAL, ECAL+HCAL for adding together + reco::Candidate::PolarLorentzVector hcalP4( + l1CaloTower.hcalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector ecalP4( + l1CaloTower.ecalTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector l1egP4( + l1CaloTower.l1egTowerEt, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + reco::Candidate::PolarLorentzVector totalP4( + l1CaloTower.total_tower_et, l1CaloTower.towerEta, l1CaloTower.towerPhi, 0.); + + if (hcalP4.pt() > 0) { + caloJetObj.hcal_nHits++; + caloJetObj.hcalJetCluster += hcalP4; + caloJetObj.hcalJetClusterET += l1CaloTower.hcalTowerEt; } - - - params["jet_pt"] = caloJetObj.jetClusterET; - params["jet_eta"] = caloJetObj.jetCluster.eta(); - params["jet_phi"] = caloJetObj.jetCluster.phi(); - params["jet_mass"] = caloJetObj.jetCluster.mass(); - params["jet_energy"] = caloJetObj.jetCluster.energy(); - - // Calibrations - params["hcal_calibration"] = get_hcal_calibration( - params["jet_pt"], - params["ecal_pt"], - params["l1eg_pt"], - params["jet_eta"] ); - params["hcal_pt_calibration"] = params["hcal_pt"] * params["hcal_calibration"]; - params["jet_pt_calibration"] = params["hcal_pt_calibration"] + - params["ecal_pt"] + params["l1eg_pt"]; - - // Tau Vars - // The tau pT calibration is applied as a SF to the total raw pT - // in contrast to the jet calibration above - params["tau_pt_calibration_value"] = get_tau_pt_calibration( - params["total_3x5"], - params["ecal_3x5"], - params["l1eg_3x5"], - caloJetObj.n_l1eg_HoverE_LessThreshold, - params["jet_eta"] ); - params["tau_pt"] = params["total_3x5"] * params["tau_pt_calibration_value"]; - params["n_l1eg_HoverE_LessThreshold"] = caloJetObj.n_l1eg_HoverE_LessThreshold; - // Currently, applying the tau_pt calibration to the isolation region as well... - // One could switch to using the calibrated jet_pt instead for the iso region... - // This should be revisited - FIXME? - params["tau_total_iso_et"] = params["jet_pt"] * params["tau_pt_calibration_value"]; - params["tau_iso_et"] = (params["jet_pt"] * params["tau_pt_calibration_value"]) - params["tau_pt"]; - params["loose_iso_tau_wp"] = float(loose_iso_tau_wp( params["tau_pt"], params["tau_iso_et"], params["jet_eta"] )); - - float calibratedPt = -1; - float ECalIsolation = -1; // Need to loop over 7x7 crystals of unclustered energy - float totalPtPUcorr = -1; - l1tp2::CaloJet caloJet(caloJetObj.jetCluster, calibratedPt, hovere, ECalIsolation, totalPtPUcorr); - caloJet.setExperimentalParams(params); - caloJet.setAssociated_l1EGs(caloJetObj.associated_l1EGs_); - - // Only store jets passing ET threshold - if (params["jet_pt_calibration"] >= EtMinForCollection) - { - L1CaloJetsNoCuts->push_back( caloJet ); - //L1CaloJetsWithCuts->push_back( caloJet ); - reco::Candidate::PolarLorentzVector jet_p4 = reco::Candidate::PolarLorentzVector( - params["jet_pt_calibration"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M() ); - L1CaloJetCollectionBXV->push_back( 0, l1t::Jet( jet_p4 ) ); - - if (debug) printf("Made a Jet, eta %f phi %f pt %f calibrated pt %f\n", caloJetObj.jetCluster.eta(), caloJetObj.jetCluster.phi(), caloJetObj.jetClusterET, params["jet_pt_calibration"] ); - + if (ecalP4.pt() > 0) { + caloJetObj.ecal_nHits++; + caloJetObj.ecalJetCluster += ecalP4; + caloJetObj.ecalJetClusterET += l1CaloTower.ecalTowerEt; + } + if (l1egP4.pt() > 0) { + caloJetObj.l1eg_nHits++; + caloJetObj.l1egJetCluster += l1egP4; + caloJetObj.l1egJetClusterET += l1CaloTower.l1egTowerEt; + caloJetObj.l1eg_nL1EGs += l1CaloTower.nL1eg; + } + if (totalP4.pt() > 0) { + caloJetObj.total_nHits++; + caloJetObj.jetCluster += totalP4; + caloJetObj.jetClusterET += l1CaloTower.total_tower_et; } - // Only store taus passing ET threshold - if (params["tau_pt"] >= EtMinForTauCollection) - { - short int tau_ieta = caloJetObj.seed_iEta; - short int tau_iphi = caloJetObj.seed_iPhi; - short int raw_et = params["total_3x5"]; - short int iso_et = params["tau_iso_et"]; - bool hasEM = false; - if (params["l1eg_3x5"] > 0. || params["ecal_3x5"] > 0.) - { - hasEM = true; + if (debug) + printf(" ---- hit %i input p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); + if (debug) + printf(" ---- hit %i resulting p4 pt %f eta %f phi %f\n", + cnt, + caloJetObj.jetClusterET, + caloJetObj.jetCluster.eta(), + caloJetObj.jetCluster.phi()); + + if ((abs(d_iEta) == 0 && abs(d_iPhi) == 0) || (fabs(d_eta) < 0.043 && fabs(d_phi) < 0.043)) { + caloJetObj.hcal_seed += hcalP4.pt(); + caloJetObj.ecal_seed += ecalP4.pt(); + caloJetObj.l1eg_seed += l1egP4.pt(); + caloJetObj.total_seed += totalP4.pt(); + } + //if ( (abs( d_iEta ) <= 1 && abs( d_iPhi ) <= 1) || + // ( fabs( d_eta ) < 0.13 && fabs( d_phi ) < 0.13 ) ) + //{ + // caloJetObj.hcal_3x3 += hcalP4.pt(); + // caloJetObj.ecal_3x3 += ecalP4.pt(); + // caloJetObj.l1eg_3x3 += l1egP4.pt(); + // caloJetObj.total_3x3 += totalP4.pt(); + //} + if ((abs(d_iEta) <= 1 && abs(d_iPhi) <= 2) || (fabs(d_eta) < 0.13 && fabs(d_phi) < 0.22)) { + caloJetObj.hcal_3x5 += hcalP4.pt(); + caloJetObj.ecal_3x5 += ecalP4.pt(); + caloJetObj.l1eg_3x5 += l1egP4.pt(); + caloJetObj.total_3x5 += totalP4.pt(); + + // Do this for 3x5 only + if (l1egP4.pt() > 0) { + caloJetObj.l1eg_nL1EGs_standaloneSS += l1CaloTower.l1egStandaloneSS; + caloJetObj.l1eg_nL1EGs_standaloneIso += l1CaloTower.l1egStandaloneIso; + caloJetObj.l1eg_nL1EGs_trkMatchSS += l1CaloTower.l1egTrkSS; + caloJetObj.l1eg_nL1EGs_trkMatchIso += l1CaloTower.l1egTrkIso; + + // For decay mode related checks with CaloTaus + // only applicable in the barrel at the moment: + // l1eg pt, HCAL ET, ECAL ET, d_iEta, d_iPhi, trkSS, trkIso, standaloneSS, standaloneIso + std::vector<float> l1EG_info = {float(l1egP4.pt()), + float(hcalP4.pt()), + float(ecalP4.pt()), + float(d_iEta), + float(d_iPhi), + float(l1CaloTower.l1egTrkSS), + float(l1CaloTower.l1egTrkIso), + float(l1CaloTower.l1egStandaloneSS), + float(l1CaloTower.l1egStandaloneIso)}; + if (l1EG_info[1] / (l1EG_info[0] + l1EG_info[2]) < 0.25) { + caloJetObj.n_l1eg_HoverE_LessThreshold++; } - int tau_qual = int(params["loose_iso_tau_wp"]); - - reco::Candidate::PolarLorentzVector tau_p4 = reco::Candidate::PolarLorentzVector( - params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M() ); - l1t::Tau l1Tau = l1t::Tau( tau_p4, params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), tau_qual, iso_et ); - l1Tau.setTowerIEta(tau_ieta); - l1Tau.setTowerIPhi(tau_iphi); - l1Tau.setRawEt(raw_et); - l1Tau.setIsoEt(iso_et); - l1Tau.setHasEM(hasEM); - l1Tau.setIsMerged(false); - L1CaloTauCollectionBXV->push_back( 0, l1Tau ); - - if (debug) printf("Made a Tau, eta %f phi %f pt %i calibrated pt %f\n", l1Tau.eta(), l1Tau.phi(), l1Tau.rawEt(), l1Tau.pt() ); - - + caloJetObj.associated_l1EGs_.push_back(l1EG_info); + } + } + //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 2) || + // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.22 ) ) + //{ + // caloJetObj.hcal_5x5 += hcalP4.pt(); + // caloJetObj.ecal_5x5 += ecalP4.pt(); + // caloJetObj.l1eg_5x5 += l1egP4.pt(); + // caloJetObj.total_5x5 += totalP4.pt(); + //} + //if ( ( abs( d_iEta ) <= 2 && abs( d_iPhi ) <= 3) || + // ( fabs( d_eta ) < 0.22 && fabs( d_phi ) < 0.3 ) ) + //{ + // caloJetObj.hcal_5x7 += hcalP4.pt(); + // caloJetObj.ecal_5x7 += ecalP4.pt(); + // caloJetObj.l1eg_5x7 += l1egP4.pt(); + // caloJetObj.total_5x7 += totalP4.pt(); + //} + if ((abs(d_iEta) <= 3 && abs(d_iPhi) <= 3) || (fabs(d_eta) < 0.3 && fabs(d_phi) < 0.3)) { + caloJetObj.hcal_7x7 += hcalP4.pt(); + caloJetObj.ecal_7x7 += ecalP4.pt(); + caloJetObj.l1eg_7x7 += l1egP4.pt(); + caloJetObj.total_7x7 += totalP4.pt(); } + //// Some discrimination vars, 2x2s and 2x3s including central seed + //// Barrel first, 2x3 + //if ( ( d_iEta == 0 || d_iEta == 1 ) && abs(d_iPhi) <= 1 ) + //{ + // caloJetObj.hcal_2x3_1 += hcalP4.pt(); + // caloJetObj.ecal_2x3_1 += ecalP4.pt(); + // caloJetObj.l1eg_2x3_1 += l1egP4.pt(); + // caloJetObj.total_2x3_1 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && abs(d_iPhi) <= 1 ) + //{ + // caloJetObj.hcal_2x3_2 += hcalP4.pt(); + // caloJetObj.ecal_2x3_2 += ecalP4.pt(); + // caloJetObj.l1eg_2x3_2 += l1egP4.pt(); + // caloJetObj.total_2x3_2 += totalP4.pt(); + //} + //// HGCal / HF + //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.13 ) + //{ + // caloJetObj.hcal_2x3 += hcalP4.pt(); + // caloJetObj.ecal_2x3 += ecalP4.pt(); + // caloJetObj.l1eg_2x3 += l1egP4.pt(); + // caloJetObj.total_2x3 += totalP4.pt(); + //} + + //// Now 2x2 Barrel first + //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) + //{ + // caloJetObj.hcal_2x2_1 += hcalP4.pt(); + // caloJetObj.ecal_2x2_1 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_1 += l1egP4.pt(); + // caloJetObj.total_2x2_1 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == 1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) + //{ + // caloJetObj.hcal_2x2_2 += hcalP4.pt(); + // caloJetObj.ecal_2x2_2 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_2 += l1egP4.pt(); + // caloJetObj.total_2x2_2 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == 1 ) ) + //{ + // caloJetObj.hcal_2x2_3 += hcalP4.pt(); + // caloJetObj.ecal_2x2_3 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_3 += l1egP4.pt(); + // caloJetObj.total_2x2_3 += totalP4.pt(); + //} + //if ( ( d_iEta == 0 || d_iEta == -1 ) && ( d_iPhi == 0 || d_iPhi == -1 ) ) + //{ + // caloJetObj.hcal_2x2_4 += hcalP4.pt(); + // caloJetObj.ecal_2x2_4 += ecalP4.pt(); + // caloJetObj.l1eg_2x2_4 += l1egP4.pt(); + // caloJetObj.total_2x2_4 += totalP4.pt(); + //} + //// HGCal / HF + //if ( fabs( d_eta ) < 0.087 && fabs( d_phi ) < 0.087 ) + //{ + // caloJetObj.hcal_2x2 += hcalP4.pt(); + // caloJetObj.ecal_2x2 += ecalP4.pt(); + // caloJetObj.l1eg_2x2 += l1egP4.pt(); + // caloJetObj.total_2x2 += totalP4.pt(); + //} + } + } - } // end jetClusters loop - - - iEvent.put(std::move(L1CaloJetsNoCuts),"L1CaloJetsNoCuts"); - //iEvent.put(std::move(L1CaloJetsWithCuts), "L1CaloJetsWithCuts" ); - //iEvent.put(std::move(L1CaloClusterCollectionWithCuts), "L1CaloClusterCollectionWithCuts" ); - iEvent.put(std::move(L1CaloJetCollectionBXV),"L1CaloJetCollectionBXV"); - iEvent.put(std::move(L1CaloTauCollectionBXV),"L1CaloTauCollectionBXV"); - - //printf("end L1CaloJetProducer\n"); -} - + if (caloJetObj.jetClusterET > 0.0) { + l1CaloJetObjs.push_back(caloJetObj); + } + } // end while loop of HCAL TP clustering + // Sort JetClusters so we can begin with the highest pt for next step of jet clustering + std::sort(begin(l1CaloJetObjs), end(l1CaloJetObjs), [](const l1CaloJetObj &a, const l1CaloJetObj &b) { + return a.jetClusterET > b.jetClusterET; + }); + /************************************************************************** + * Progress to adding L1EGs built from ECAL TPs 9x9 grid. + * Recall, for 9x9 trigger towers gives diameter 0.78 + ******************************************************************************/ + // Cluster together the L1EGs around existing HCAL Jet + // Cluster within dEta/dPhi 0.4 which is very close to 0.39 = 9x9/2 + //std::cout << " - Input L1EGs: " << crystalClustersVect.size() << std::endl; + for (auto &caloJetObj : l1CaloJetObjs) { + params["seed_pt"] = caloJetObj.seedTowerET; + params["seed_eta"] = caloJetObj.seedTower.eta(); + params["seed_phi"] = caloJetObj.seedTower.phi(); + params["seed_iEta"] = caloJetObj.seed_iEta; + params["seed_iPhi"] = caloJetObj.seed_iPhi; + params["seed_energy"] = caloJetObj.seedTower.energy(); + + params["hcal_pt"] = caloJetObj.hcalJetClusterET; + params["hcal_seed"] = caloJetObj.hcal_seed; + //params["hcal_3x3"] = caloJetObj.hcal_3x3; + params["hcal_3x5"] = caloJetObj.hcal_3x5; + //params["hcal_5x5"] = caloJetObj.hcal_5x5; + //params["hcal_5x7"] = caloJetObj.hcal_5x7; + params["hcal_7x7"] = caloJetObj.hcal_7x7; + //params["hcal_2x3"] = std::max( caloJetObj.hcal_2x3, std::max( caloJetObj.hcal_2x3_1, caloJetObj.hcal_2x3_2 )); + //params["hcal_2x2"] = std::max( caloJetObj.hcal_2x2, std::max( caloJetObj.hcal_2x2_1, std::max( caloJetObj.hcal_2x2_2, std::max( caloJetObj.hcal_2x2_3, caloJetObj.hcal_2x2_4 )))); + params["hcal_nHits"] = caloJetObj.hcal_nHits; + + params["ecal_pt"] = caloJetObj.ecalJetClusterET; + params["ecal_seed"] = caloJetObj.ecal_seed; + //params["ecal_3x3"] = caloJetObj.ecal_3x3; + params["ecal_3x5"] = caloJetObj.ecal_3x5; + //params["ecal_5x5"] = caloJetObj.ecal_5x5; + //params["ecal_5x7"] = caloJetObj.ecal_5x7; + params["ecal_7x7"] = caloJetObj.ecal_7x7; + //params["ecal_2x3"] = std::max( caloJetObj.ecal_2x3, std::max( caloJetObj.ecal_2x3_1, caloJetObj.ecal_2x3_2 )); + //params["ecal_2x2"] = std::max( caloJetObj.ecal_2x2, std::max( caloJetObj.ecal_2x2_1, std::max( caloJetObj.ecal_2x2_2, std::max( caloJetObj.ecal_2x2_3, caloJetObj.ecal_2x2_4 )))); + params["ecal_nHits"] = caloJetObj.ecal_nHits; + + params["l1eg_pt"] = caloJetObj.l1egJetClusterET; + params["l1eg_seed"] = caloJetObj.l1eg_seed; + //params["l1eg_3x3"] = caloJetObj.l1eg_3x3; + params["l1eg_3x5"] = caloJetObj.l1eg_3x5; + //params["l1eg_5x5"] = caloJetObj.l1eg_5x5; + //params["l1eg_5x7"] = caloJetObj.l1eg_5x7; + params["l1eg_7x7"] = caloJetObj.l1eg_7x7; + //params["l1eg_2x3"] = std::max( caloJetObj.l1eg_2x3, std::max( caloJetObj.l1eg_2x3_1, caloJetObj.l1eg_2x3_2 )); + //params["l1eg_2x2"] = std::max( caloJetObj.l1eg_2x2, std::max( caloJetObj.l1eg_2x2_1, std::max( caloJetObj.l1eg_2x2_2, std::max( caloJetObj.l1eg_2x2_3, caloJetObj.l1eg_2x2_4 )))); + params["l1eg_nHits"] = caloJetObj.l1eg_nHits; + params["l1eg_nL1EGs"] = caloJetObj.l1eg_nL1EGs; + params["l1eg_nL1EGs_standaloneSS"] = caloJetObj.l1eg_nL1EGs_standaloneSS; + params["l1eg_nL1EGs_standaloneIso"] = caloJetObj.l1eg_nL1EGs_standaloneIso; + params["l1eg_nL1EGs_trkMatchSS"] = caloJetObj.l1eg_nL1EGs_trkMatchSS; + params["l1eg_nL1EGs_trkMatchIso"] = caloJetObj.l1eg_nL1EGs_trkMatchIso; + + params["total_et"] = caloJetObj.jetClusterET; + params["total_seed"] = caloJetObj.total_seed; + //params["total_3x3"] = caloJetObj.total_3x3; + params["total_3x5"] = caloJetObj.total_3x5; + //params["total_5x5"] = caloJetObj.total_5x5; + //params["total_5x7"] = caloJetObj.total_5x7; + params["total_7x7"] = caloJetObj.total_7x7; + //params["total_2x3"] = std::max( caloJetObj.total_2x3, std::max( caloJetObj.total_2x3_1, caloJetObj.total_2x3_2 )); + //params["total_2x2"] = std::max( caloJetObj.total_2x2, std::max( caloJetObj.total_2x2_1, std::max( caloJetObj.total_2x2_2, std::max( caloJetObj.total_2x2_3, caloJetObj.total_2x2_4 )))); + params["total_nHits"] = caloJetObj.total_nHits; + //params["total_nTowers"] = total_nTowers; + + //// return -9 for energy and dR values for ecalJet as defaults + float hovere = -9; + if (caloJetObj.ecalJetClusterET > 0.0) { + hovere = caloJetObj.hcalJetClusterET / (caloJetObj.ecalJetClusterET + caloJetObj.l1egJetClusterET); + } + params["jet_pt"] = caloJetObj.jetClusterET; + params["jet_eta"] = caloJetObj.jetCluster.eta(); + params["jet_phi"] = caloJetObj.jetCluster.phi(); + params["jet_mass"] = caloJetObj.jetCluster.mass(); + params["jet_energy"] = caloJetObj.jetCluster.energy(); + + // Calibrations + params["hcal_calibration"] = + get_hcal_calibration(params["jet_pt"], params["ecal_pt"], params["l1eg_pt"], params["jet_eta"]); + params["hcal_pt_calibration"] = params["hcal_pt"] * params["hcal_calibration"]; + params["jet_pt_calibration"] = params["hcal_pt_calibration"] + params["ecal_pt"] + params["l1eg_pt"]; + + // Tau Vars + // The tau pT calibration is applied as a SF to the total raw pT + // in contrast to the jet calibration above + params["tau_pt_calibration_value"] = get_tau_pt_calibration(params["total_3x5"], + params["ecal_3x5"], + params["l1eg_3x5"], + caloJetObj.n_l1eg_HoverE_LessThreshold, + params["jet_eta"]); + params["tau_pt"] = params["total_3x5"] * params["tau_pt_calibration_value"]; + params["n_l1eg_HoverE_LessThreshold"] = caloJetObj.n_l1eg_HoverE_LessThreshold; + // Currently, applying the tau_pt calibration to the isolation region as well... + // One could switch to using the calibrated jet_pt instead for the iso region... + // This should be revisited - FIXME? + params["tau_total_iso_et"] = params["jet_pt"] * params["tau_pt_calibration_value"]; + params["tau_iso_et"] = (params["jet_pt"] * params["tau_pt_calibration_value"]) - params["tau_pt"]; + params["loose_iso_tau_wp"] = float(loose_iso_tau_wp(params["tau_pt"], params["tau_iso_et"], params["jet_eta"])); + + float calibratedPt = -1; + float ECalIsolation = -1; // Need to loop over 7x7 crystals of unclustered energy + float totalPtPUcorr = -1; + l1tp2::CaloJet caloJet(caloJetObj.jetCluster, calibratedPt, hovere, ECalIsolation, totalPtPUcorr); + caloJet.setExperimentalParams(params); + caloJet.setAssociated_l1EGs(caloJetObj.associated_l1EGs_); + + // Only store jets passing ET threshold + if (params["jet_pt_calibration"] >= EtMinForCollection) { + L1CaloJetsNoCuts->push_back(caloJet); + //L1CaloJetsWithCuts->push_back( caloJet ); + reco::Candidate::PolarLorentzVector jet_p4 = reco::Candidate::PolarLorentzVector( + params["jet_pt_calibration"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M()); + L1CaloJetCollectionBXV->push_back(0, l1t::Jet(jet_p4)); + + if (debug) + printf("Made a Jet, eta %f phi %f pt %f calibrated pt %f\n", + caloJetObj.jetCluster.eta(), + caloJetObj.jetCluster.phi(), + caloJetObj.jetClusterET, + params["jet_pt_calibration"]); + } + // Only store taus passing ET threshold + if (params["tau_pt"] >= EtMinForTauCollection) { + short int tau_ieta = caloJetObj.seed_iEta; + short int tau_iphi = caloJetObj.seed_iPhi; + short int raw_et = params["total_3x5"]; + short int iso_et = params["tau_iso_et"]; + bool hasEM = false; + if (params["l1eg_3x5"] > 0. || params["ecal_3x5"] > 0.) { + hasEM = true; + } + int tau_qual = int(params["loose_iso_tau_wp"]); + + reco::Candidate::PolarLorentzVector tau_p4 = reco::Candidate::PolarLorentzVector( + params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), caloJet.p4().M()); + l1t::Tau l1Tau = l1t::Tau(tau_p4, params["tau_pt"], caloJet.p4().eta(), caloJet.p4().phi(), tau_qual, iso_et); + l1Tau.setTowerIEta(tau_ieta); + l1Tau.setTowerIPhi(tau_iphi); + l1Tau.setRawEt(raw_et); + l1Tau.setIsoEt(iso_et); + l1Tau.setHasEM(hasEM); + l1Tau.setIsMerged(false); + L1CaloTauCollectionBXV->push_back(0, l1Tau); + + if (debug) + printf( + "Made a Tau, eta %f phi %f pt %i calibrated pt %f\n", l1Tau.eta(), l1Tau.phi(), l1Tau.rawEt(), l1Tau.pt()); + } + } // end jetClusters loop + iEvent.put(std::move(L1CaloJetsNoCuts), "L1CaloJetsNoCuts"); + //iEvent.put(std::move(L1CaloJetsWithCuts), "L1CaloJetsWithCuts" ); + //iEvent.put(std::move(L1CaloClusterCollectionWithCuts), "L1CaloClusterCollectionWithCuts" ); + iEvent.put(std::move(L1CaloJetCollectionBXV), "L1CaloJetCollectionBXV"); + iEvent.put(std::move(L1CaloTauCollectionBXV), "L1CaloTauCollectionBXV"); -int -L1CaloJetProducer::ecalXtal_diPhi( int &iPhi_1, int &iPhi_2 ) const -{ - // We shouldn't compare integer indices in endcap, the map is not linear - // Logic from EBDetId::distancePhi() without the abs() - int PI = 180; - int result = iPhi_1 - iPhi_2; - while (result > PI) result -= 2*PI; - while (result <= -PI) result += 2*PI; - return result; + //printf("end L1CaloJetProducer\n"); } - -int -L1CaloJetProducer::tower_diPhi( int &iPhi_1, int &iPhi_2 ) const -{ - // 360 Crystals in full, 72 towers, half way is 36 - int PI = 36; - int result = iPhi_1 - iPhi_2; - while (result > PI) result -= 2*PI; - while (result <= -PI) result += 2*PI; - return result; +int L1CaloJetProducer::ecalXtal_diPhi(int &iPhi_1, int &iPhi_2) const { + // We shouldn't compare integer indices in endcap, the map is not linear + // Logic from EBDetId::distancePhi() without the abs() + int PI = 180; + int result = iPhi_1 - iPhi_2; + while (result > PI) + result -= 2 * PI; + while (result <= -PI) + result += 2 * PI; + return result; } +int L1CaloJetProducer::tower_diPhi(int &iPhi_1, int &iPhi_2) const { + // 360 Crystals in full, 72 towers, half way is 36 + int PI = 36; + int result = iPhi_1 - iPhi_2; + while (result > PI) + result -= 2 * PI; + while (result <= -PI) + result += 2 * PI; + return result; +} // Added b/c of the iEta jump from +1 to -1 across the barrel mid point -int -L1CaloJetProducer::tower_diEta( int &iEta_1, int &iEta_2 ) const -{ - // On same side of barrel - if (iEta_1 * iEta_2 > 0) return iEta_1 - iEta_2; - else return iEta_1 - iEta_2 - 1; +int L1CaloJetProducer::tower_diEta(int &iEta_1, int &iEta_2) const { + // On same side of barrel + if (iEta_1 * iEta_2 > 0) + return iEta_1 - iEta_2; + else + return iEta_1 - iEta_2 - 1; } - -float -L1CaloJetProducer::get_deltaR( reco::Candidate::PolarLorentzVector &p4_1, - reco::Candidate::PolarLorentzVector &p4_2) const -{ - // Check that pt is > 0 for both or else reco::deltaR returns bogus values - if (p4_1.pt() > 0 && p4_2.pt() > 0) - { - return reco::deltaR( p4_1, p4_2 ); - } - else return -1; +float L1CaloJetProducer::get_deltaR(reco::Candidate::PolarLorentzVector &p4_1, + reco::Candidate::PolarLorentzVector &p4_2) const { + // Check that pt is > 0 for both or else reco::deltaR returns bogus values + if (p4_1.pt() > 0 && p4_2.pt() > 0) { + return reco::deltaR(p4_1, p4_2); + } else + return -1; } - // Apply calibrations to HCAL energy based on EM Fraction, Jet Eta, Jet pT -float -L1CaloJetProducer::get_hcal_calibration( float &jet_pt, float &ecal_pt, - float &ecal_L1EG_jet_pt, float &jet_eta ) const -{ - - float em_frac = (ecal_L1EG_jet_pt + ecal_pt) / jet_pt; - float abs_eta = fabs( jet_eta ); - float tmp_jet_pt = jet_pt; - if (tmp_jet_pt > 499) tmp_jet_pt = 499; - - // Different indices sizes in different calo regions. - // Barrel... - size_t em_index = 0; - size_t eta_index = 0; - size_t pt_index = 0; - float calib = 1.0; - if (abs_eta <= 1.5) - { - // Start loop checking 2nd value - for( unsigned int i = 1; i < emFractionBinsBarrel.size(); i++) - { - if(em_frac <= emFractionBinsBarrel.at(i)) break; - em_index++; - } +float L1CaloJetProducer::get_hcal_calibration(float &jet_pt, + float &ecal_pt, + float &ecal_L1EG_jet_pt, + float &jet_eta) const { + float em_frac = (ecal_L1EG_jet_pt + ecal_pt) / jet_pt; + float abs_eta = fabs(jet_eta); + float tmp_jet_pt = jet_pt; + if (tmp_jet_pt > 499) + tmp_jet_pt = 499; + + // Different indices sizes in different calo regions. + // Barrel... + size_t em_index = 0; + size_t eta_index = 0; + size_t pt_index = 0; + float calib = 1.0; + if (abs_eta <= 1.5) { + // Start loop checking 2nd value + for (unsigned int i = 1; i < emFractionBinsBarrel.size(); i++) { + if (em_frac <= emFractionBinsBarrel.at(i)) + break; + em_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < absEtaBinsBarrel.size(); i++) - { - if(abs_eta <= absEtaBinsBarrel.at(i)) break; - eta_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < absEtaBinsBarrel.size(); i++) { + if (abs_eta <= absEtaBinsBarrel.at(i)) + break; + eta_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < jetPtBins.size(); i++) - { - if(tmp_jet_pt <= jetPtBins.at(i)) break; - pt_index++; - } - //printf("Barrel calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); - calib = calibrationsBarrel[ eta_index ][ em_index ][ pt_index ]; - } // end Barrel - else if (abs_eta <= 3.0) // HGCal - { - // Start loop checking 2nd value - for( unsigned int i = 1; i < emFractionBinsHGCal.size(); i++) - { - if(em_frac <= emFractionBinsHGCal.at(i)) break; - em_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < jetPtBins.size(); i++) { + if (tmp_jet_pt <= jetPtBins.at(i)) + break; + pt_index++; + } + //printf("Barrel calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); + calib = calibrationsBarrel[eta_index][em_index][pt_index]; + } // end Barrel + else if (abs_eta <= 3.0) // HGCal + { + // Start loop checking 2nd value + for (unsigned int i = 1; i < emFractionBinsHGCal.size(); i++) { + if (em_frac <= emFractionBinsHGCal.at(i)) + break; + em_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < absEtaBinsHGCal.size(); i++) - { - if(abs_eta <= absEtaBinsHGCal.at(i)) break; - eta_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < absEtaBinsHGCal.size(); i++) { + if (abs_eta <= absEtaBinsHGCal.at(i)) + break; + eta_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < jetPtBins.size(); i++) - { - if(tmp_jet_pt <= jetPtBins.at(i)) break; - pt_index++; - } - //printf("HGCal calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); - calib = calibrationsHGCal[ eta_index ][ em_index ][ pt_index ]; - } // end HGCal - else // HF - { - // Start loop checking 2nd value - for( unsigned int i = 1; i < emFractionBinsHF.size(); i++) - { - if(em_frac <= emFractionBinsHF.at(i)) break; - em_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < jetPtBins.size(); i++) { + if (tmp_jet_pt <= jetPtBins.at(i)) + break; + pt_index++; + } + //printf("HGCal calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); + calib = calibrationsHGCal[eta_index][em_index][pt_index]; + } // end HGCal + else // HF + { + // Start loop checking 2nd value + for (unsigned int i = 1; i < emFractionBinsHF.size(); i++) { + if (em_frac <= emFractionBinsHF.at(i)) + break; + em_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < absEtaBinsHF.size(); i++) - { - if(abs_eta <= absEtaBinsHF.at(i)) break; - eta_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < absEtaBinsHF.size(); i++) { + if (abs_eta <= absEtaBinsHF.at(i)) + break; + eta_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < jetPtBins.size(); i++) - { - if(tmp_jet_pt <= jetPtBins.at(i)) break; - pt_index++; - } - //printf("HF calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); - calib = calibrationsHF[ eta_index ][ em_index ][ pt_index ]; - } // end HF - - //printf(" - jet pt %f index %i\n", jet_pt, int(pt_index)); - //printf(" --- calibration: %f\n", calibrations[ em_index ][ eta_index ][ pt_index ] ); - - if(calib > 5 && debug) - { - printf(" - l1eg %f, ecal %f, jet %f, em frac %f index %i\n", ecal_L1EG_jet_pt, ecal_pt, jet_pt, em_frac, int(em_index)); - printf(" - eta %f, abs eta %f index %i\n", jet_eta, abs_eta, int(eta_index)); - printf(" - jet pt %f tmp_jet_pt %f index %i\n", jet_pt, tmp_jet_pt, int(pt_index)); - printf(" --- calibration: %f\n\n", calib ); + // Start loop checking 2nd value + for (unsigned int i = 1; i < jetPtBins.size(); i++) { + if (tmp_jet_pt <= jetPtBins.at(i)) + break; + pt_index++; } - return calib; + //printf("HF calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); + calib = calibrationsHF[eta_index][em_index][pt_index]; + } // end HF + + //printf(" - jet pt %f index %i\n", jet_pt, int(pt_index)); + //printf(" --- calibration: %f\n", calibrations[ em_index ][ eta_index ][ pt_index ] ); + + if (calib > 5 && debug) { + printf( + " - l1eg %f, ecal %f, jet %f, em frac %f index %i\n", ecal_L1EG_jet_pt, ecal_pt, jet_pt, em_frac, int(em_index)); + printf(" - eta %f, abs eta %f index %i\n", jet_eta, abs_eta, int(eta_index)); + printf(" - jet pt %f tmp_jet_pt %f index %i\n", jet_pt, tmp_jet_pt, int(pt_index)); + printf(" --- calibration: %f\n\n", calib); + } + return calib; } - - // Apply calibrations to tau pT based on L1EG info, EM Fraction, Tau Eta, Tau pT -float -L1CaloJetProducer::get_tau_pt_calibration( float &tau_pt, float &ecal_pt, - float &l1EG_pt, float &n_L1EGs, float &tau_eta ) const -{ - - float em_frac = (l1EG_pt + ecal_pt) / tau_pt; - float abs_eta = fabs( tau_eta ); - float tmp_tau_pt = tau_pt; - if (tmp_tau_pt > 199) tmp_tau_pt = 199; - - // Different indices sizes in different calo regions. - // Barrel... - size_t em_index = 0; - size_t eta_index = 0; - size_t n_L1EG_index = 0; - size_t pt_index = 0; - float calib = 1.0; - // HERE - if (abs_eta <= 1.5) - { - // Start loop checking 1st value - for( unsigned int i = 0; i < tauL1egValuesBarrel.size(); i++) - { - if(n_L1EGs == tauL1egValuesBarrel.at(i)) break; - if(tauL1egValuesBarrel.at(i) == tauL1egValuesBarrel.back()) break; // to preven incrementing on last one - n_L1EG_index++; - } +float L1CaloJetProducer::get_tau_pt_calibration( + float &tau_pt, float &ecal_pt, float &l1EG_pt, float &n_L1EGs, float &tau_eta) const { + float em_frac = (l1EG_pt + ecal_pt) / tau_pt; + float abs_eta = fabs(tau_eta); + float tmp_tau_pt = tau_pt; + if (tmp_tau_pt > 199) + tmp_tau_pt = 199; + + // Different indices sizes in different calo regions. + // Barrel... + size_t em_index = 0; + size_t eta_index = 0; + size_t n_L1EG_index = 0; + size_t pt_index = 0; + float calib = 1.0; + // HERE + if (abs_eta <= 1.5) { + // Start loop checking 1st value + for (unsigned int i = 0; i < tauL1egValuesBarrel.size(); i++) { + if (n_L1EGs == tauL1egValuesBarrel.at(i)) + break; + if (tauL1egValuesBarrel.at(i) == tauL1egValuesBarrel.back()) + break; // to preven incrementing on last one + n_L1EG_index++; + } - // Find key value pair matching n L1EGs - for( auto &l1eg_info : tauL1egInfoMapBarrel ) - { - if(l1eg_info.first != double(n_L1EG_index)) continue; - // Start loop checking 2nd value - for( unsigned int i = 1; i < l1eg_info.second.size(); i++) - { - if(em_frac <= l1eg_info.second.at(i)) break; - em_index++; - } - } + // Find key value pair matching n L1EGs + for (auto &l1eg_info : tauL1egInfoMapBarrel) { + if (l1eg_info.first != double(n_L1EG_index)) + continue; + // Start loop checking 2nd value + for (unsigned int i = 1; i < l1eg_info.second.size(); i++) { + if (em_frac <= l1eg_info.second.at(i)) + break; + em_index++; + } + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < tauAbsEtaBinsBarrel.size(); i++) - { - if(abs_eta <= tauAbsEtaBinsBarrel.at(i)) break; - eta_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauAbsEtaBinsBarrel.size(); i++) { + if (abs_eta <= tauAbsEtaBinsBarrel.at(i)) + break; + eta_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < tauPtBins.size(); i++) - { - if(tmp_tau_pt <= tauPtBins.at(i)) break; - pt_index++; - } - //printf("Barrel tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); - calib = tauPtCalibrationsBarrel[ eta_index ][ n_L1EG_index ][ em_index ][ pt_index ]; - } // end Barrel - else if (abs_eta <= 3.0) // HGCal - { - // Start loop checking 1st value - for( unsigned int i = 0; i < tauL1egValuesHGCal.size(); i++) - { - if(n_L1EGs == tauL1egValuesHGCal.at(i)) break; - if(tauL1egValuesHGCal.at(i) == tauL1egValuesHGCal.back()) break; // to preven incrementing on last one - n_L1EG_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauPtBins.size(); i++) { + if (tmp_tau_pt <= tauPtBins.at(i)) + break; + pt_index++; + } + //printf("Barrel tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); + calib = tauPtCalibrationsBarrel[eta_index][n_L1EG_index][em_index][pt_index]; + } // end Barrel + else if (abs_eta <= 3.0) // HGCal + { + // Start loop checking 1st value + for (unsigned int i = 0; i < tauL1egValuesHGCal.size(); i++) { + if (n_L1EGs == tauL1egValuesHGCal.at(i)) + break; + if (tauL1egValuesHGCal.at(i) == tauL1egValuesHGCal.back()) + break; // to preven incrementing on last one + n_L1EG_index++; + } - // Find key value pair matching n L1EGs - for( auto &l1eg_info : tauL1egInfoMapHGCal ) - { - if(l1eg_info.first != double(n_L1EG_index)) continue; - // Start loop checking 2nd value - for( unsigned int i = 1; i < l1eg_info.second.size(); i++) - { - if(em_frac <= l1eg_info.second.at(i)) break; - em_index++; - } - } + // Find key value pair matching n L1EGs + for (auto &l1eg_info : tauL1egInfoMapHGCal) { + if (l1eg_info.first != double(n_L1EG_index)) + continue; + // Start loop checking 2nd value + for (unsigned int i = 1; i < l1eg_info.second.size(); i++) { + if (em_frac <= l1eg_info.second.at(i)) + break; + em_index++; + } + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < tauAbsEtaBinsHGCal.size(); i++) - { - if(abs_eta <= tauAbsEtaBinsHGCal.at(i)) break; - eta_index++; - } + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauAbsEtaBinsHGCal.size(); i++) { + if (abs_eta <= tauAbsEtaBinsHGCal.at(i)) + break; + eta_index++; + } - // Start loop checking 2nd value - for( unsigned int i = 1; i < tauPtBins.size(); i++) - { - if(tmp_tau_pt <= tauPtBins.at(i)) break; - pt_index++; - } - //printf("HGCal tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); - calib = tauPtCalibrationsHGCal[ eta_index ][ n_L1EG_index ][ em_index ][ pt_index ]; - } // end HGCal - else return calib; - - //printf(" - tau pt %f index %i\n", tau_pt, int(pt_index)); - //printf(" --- calibration: %f\n", calib ); - - if(calib > 5 && debug) - { - printf(" - l1eg %f, ecal %f, tau %f, em frac %f index %i\n", l1EG_pt, ecal_pt, tau_pt, em_frac, int(em_index)); - printf(" - eta %f, abs eta %f index %i\n", tau_eta, abs_eta, int(eta_index)); - printf(" - tau pt %f tmp_tau_pt %f index %i\n", tau_pt, tmp_tau_pt, int(pt_index)); - printf(" --- calibration: %f\n\n", calib ); + // Start loop checking 2nd value + for (unsigned int i = 1; i < tauPtBins.size(); i++) { + if (tmp_tau_pt <= tauPtBins.at(i)) + break; + pt_index++; } + //printf("HGCal tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); + calib = tauPtCalibrationsHGCal[eta_index][n_L1EG_index][em_index][pt_index]; + } // end HGCal + else return calib; -} - + //printf(" - tau pt %f index %i\n", tau_pt, int(pt_index)); + //printf(" --- calibration: %f\n", calib ); + if (calib > 5 && debug) { + printf(" - l1eg %f, ecal %f, tau %f, em frac %f index %i\n", l1EG_pt, ecal_pt, tau_pt, em_frac, int(em_index)); + printf(" - eta %f, abs eta %f index %i\n", tau_eta, abs_eta, int(eta_index)); + printf(" - tau pt %f tmp_tau_pt %f index %i\n", tau_pt, tmp_tau_pt, int(pt_index)); + printf(" --- calibration: %f\n\n", calib); + } + return calib; +} // Loose IsoTau WP -int -L1CaloJetProducer::loose_iso_tau_wp( float &tau_pt, float &tau_iso_et, float &tau_eta ) const -{ - // Fully relaxed above 100 GeV pT - if (tau_pt > 100) - { - return 1; +int L1CaloJetProducer::loose_iso_tau_wp(float &tau_pt, float &tau_iso_et, float &tau_eta) const { + // Fully relaxed above 100 GeV pT + if (tau_pt > 100) { + return 1; + } + // Split by barrel and HGCal + // with Barrel first + if (fabs(tau_eta) < 1.5) { + if (isoTauBarrel.Eval(tau_pt) >= (tau_iso_et / tau_pt)) { + return 1; + } else { + return 0; } - // Split by barrel and HGCal - // with Barrel first - if (fabs(tau_eta) < 1.5) - { - if (isoTauBarrel.Eval(tau_pt) >= (tau_iso_et / tau_pt)) - { - return 1; - } - else - { - return 0; - } + } + // HGCal + if (fabs(tau_eta) < 3.0) { + if (isoTauHGCal.Eval(tau_pt) >= (tau_iso_et / tau_pt)) { + return 1; + } else { + return 0; } - // HGCal - if (fabs(tau_eta) < 3.0) - { - if (isoTauHGCal.Eval(tau_pt) >= (tau_iso_et / tau_pt)) - { - return 1; - } - else - { - return 0; - } - } - // Beyond HGCal - return 0; + } + // Beyond HGCal + return 0; } - DEFINE_FWK_MODULE(L1CaloJetProducer); diff --git a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc index afca168ac2840..a95aab4782951 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc @@ -1173,7 +1173,7 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: iEvent.put(std::move(L1EGXtalClusters)); iEvent.put(std::move(L1EGammas)); - iEvent.put(std::move(L1CaloTowers),"L1CaloTowerCollection"); + iEvent.put(std::move(L1CaloTowers), "L1CaloTowerCollection"); } bool L1EGCrystalClusterEmulatorProducer::passes_iso(float pt, float iso) { diff --git a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc index 02ebab69dd404..3946592960f46 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc @@ -37,7 +37,6 @@ This is all ECAL / HCAL specific or EM vs. Hadronic for HGCal. // // - #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDProducer.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -61,524 +60,519 @@ This is all ECAL / HCAL specific or EM vs. Hadronic for HGCal. #include "TFile.h" #include "TF1.h" - class L1TowerCalibrator : public edm::EDProducer { - public: - explicit L1TowerCalibrator(const edm::ParameterSet&); - - private: - virtual void produce(edm::Event&, const edm::EventSetup&); - - double HcalTpEtMin; - double EcalTpEtMin; - double HGCalHadTpEtMin; - double HGCalEmTpEtMin; - double HFTpEtMin; - double puThreshold; - double puThresholdL1eg; - double puThresholdHcalMin; - double puThresholdHcalMax; - double puThresholdEcalMin; - double puThresholdEcalMax; - double puThresholdHGCalEMMin; - double puThresholdHGCalEMMax; - double puThresholdHGCalHadMin; - double puThresholdHGCalHadMax; - double puThresholdHFMin; - double puThresholdHFMax; - double barrelSF; - double hgcalSF; - double hfSF; - bool debug; - bool skipCalibrations; - - edm::EDGetTokenT< l1tp2::CaloTowerCollection > l1TowerToken_; - edm::Handle< l1tp2::CaloTowerCollection > l1CaloTowerHandle; - - edm::EDGetTokenT<l1t::HGCalTowerBxCollection> hgcalTowersToken_; - edm::Handle<l1t::HGCalTowerBxCollection> hgcalTowersHandle; - l1t::HGCalTowerBxCollection hgcalTowers; - - edm::EDGetTokenT<HcalTrigPrimDigiCollection> hcalToken_; - edm::Handle<HcalTrigPrimDigiCollection> hcalTowerHandle; - edm::ESHandle<CaloTPGTranscoder> decoder_; - - // nHits to nvtx functions - std::vector<edm::ParameterSet> nHits_to_nvtx_params; - std::map< std::string, TF1 > nHits_to_nvtx_funcs; - - // nvtx to PU subtraction functions - std::vector<edm::ParameterSet> nvtx_to_PU_sub_params; - std::map< std::string, TF1 > ecal_nvtx_to_PU_sub_funcs; - std::map< std::string, TF1 > hcal_nvtx_to_PU_sub_funcs; - std::map< std::string, TF1 > hgcalEM_nvtx_to_PU_sub_funcs; - std::map< std::string, TF1 > hgcalHad_nvtx_to_PU_sub_funcs; - std::map< std::string, TF1 > hf_nvtx_to_PU_sub_funcs; - std::map< std::string, std::map< std::string, TF1 > > all_nvtx_to_PU_sub_funcs; - +public: + explicit L1TowerCalibrator(const edm::ParameterSet&); + +private: + void produce(edm::Event&, const edm::EventSetup&) override; + + double HcalTpEtMin; + double EcalTpEtMin; + double HGCalHadTpEtMin; + double HGCalEmTpEtMin; + double HFTpEtMin; + double puThreshold; + double puThresholdL1eg; + double puThresholdHcalMin; + double puThresholdHcalMax; + double puThresholdEcalMin; + double puThresholdEcalMax; + double puThresholdHGCalEMMin; + double puThresholdHGCalEMMax; + double puThresholdHGCalHadMin; + double puThresholdHGCalHadMax; + double puThresholdHFMin; + double puThresholdHFMax; + double barrelSF; + double hgcalSF; + double hfSF; + bool debug; + bool skipCalibrations; + + edm::EDGetTokenT<l1tp2::CaloTowerCollection> l1TowerToken_; + edm::Handle<l1tp2::CaloTowerCollection> l1CaloTowerHandle; + + edm::EDGetTokenT<l1t::HGCalTowerBxCollection> hgcalTowersToken_; + edm::Handle<l1t::HGCalTowerBxCollection> hgcalTowersHandle; + l1t::HGCalTowerBxCollection hgcalTowers; + + edm::EDGetTokenT<HcalTrigPrimDigiCollection> hcalToken_; + edm::Handle<HcalTrigPrimDigiCollection> hcalTowerHandle; + edm::ESHandle<CaloTPGTranscoder> decoder_; + + // nHits to nvtx functions + std::vector<edm::ParameterSet> nHits_to_nvtx_params; + std::map<std::string, TF1> nHits_to_nvtx_funcs; + + // nvtx to PU subtraction functions + std::vector<edm::ParameterSet> nvtx_to_PU_sub_params; + std::map<std::string, TF1> ecal_nvtx_to_PU_sub_funcs; + std::map<std::string, TF1> hcal_nvtx_to_PU_sub_funcs; + std::map<std::string, TF1> hgcalEM_nvtx_to_PU_sub_funcs; + std::map<std::string, TF1> hgcalHad_nvtx_to_PU_sub_funcs; + std::map<std::string, TF1> hf_nvtx_to_PU_sub_funcs; + std::map<std::string, std::map<std::string, TF1> > all_nvtx_to_PU_sub_funcs; }; -L1TowerCalibrator::L1TowerCalibrator(const edm::ParameterSet& iConfig) : - HcalTpEtMin(iConfig.getParameter<double>("HcalTpEtMin")), - EcalTpEtMin(iConfig.getParameter<double>("EcalTpEtMin")), - HGCalHadTpEtMin(iConfig.getParameter<double>("HGCalHadTpEtMin")), - HGCalEmTpEtMin(iConfig.getParameter<double>("HGCalEmTpEtMin")), - HFTpEtMin(iConfig.getParameter<double>("HFTpEtMin")), - puThreshold(iConfig.getParameter<double>("puThreshold")), - puThresholdL1eg(iConfig.getParameter<double>("puThresholdL1eg")), - puThresholdHcalMin(iConfig.getParameter<double>("puThresholdHcalMin")), - puThresholdHcalMax(iConfig.getParameter<double>("puThresholdHcalMax")), - puThresholdEcalMin(iConfig.getParameter<double>("puThresholdEcalMin")), - puThresholdEcalMax(iConfig.getParameter<double>("puThresholdEcalMax")), - puThresholdHGCalEMMin(iConfig.getParameter<double>("puThresholdHGCalEMMin")), - puThresholdHGCalEMMax(iConfig.getParameter<double>("puThresholdHGCalEMMax")), - puThresholdHGCalHadMin(iConfig.getParameter<double>("puThresholdHGCalHadMin")), - puThresholdHGCalHadMax(iConfig.getParameter<double>("puThresholdHGCalHadMax")), - puThresholdHFMin(iConfig.getParameter<double>("puThresholdHFMin")), - puThresholdHFMax(iConfig.getParameter<double>("puThresholdHFMax")), - barrelSF(iConfig.getParameter<double>("barrelSF")), - hgcalSF(iConfig.getParameter<double>("hgcalSF")), - hfSF(iConfig.getParameter<double>("hfSF")), - debug(iConfig.getParameter<bool>("debug")), - skipCalibrations(iConfig.getParameter<bool>("skipCalibrations")), - l1TowerToken_(consumes< l1tp2::CaloTowerCollection >(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))), - hgcalTowersToken_(consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("L1HgcalTowersInputTag"))), - hcalToken_(consumes<HcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalDigis"))), - nHits_to_nvtx_params(iConfig.getParameter< std::vector<edm::ParameterSet> >("nHits_to_nvtx_params")), - nvtx_to_PU_sub_params(iConfig.getParameter< std::vector<edm::ParameterSet> >("nvtx_to_PU_sub_params")) -{ - - - // Initialize the nHits --> nvtx functions - for ( uint i = 0; i < nHits_to_nvtx_params.size(); i++ ) - { - edm::ParameterSet * pset = &nHits_to_nvtx_params.at(i); - std::string calo = pset->getParameter< std::string >("fit"); - nHits_to_nvtx_funcs[ calo.c_str() ] = TF1( calo.c_str(), "[0] + [1] * x"); - nHits_to_nvtx_funcs[ calo.c_str() ].SetParameter( 0, pset->getParameter< std::vector<double> >("params").at(0) ); - nHits_to_nvtx_funcs[ calo.c_str() ].SetParameter( 1, pset->getParameter< std::vector<double> >("params").at(1) ); - - if(debug) - { - printf("nHits_to_nvtx_params[%i]\n \ +L1TowerCalibrator::L1TowerCalibrator(const edm::ParameterSet& iConfig) + : HcalTpEtMin(iConfig.getParameter<double>("HcalTpEtMin")), + EcalTpEtMin(iConfig.getParameter<double>("EcalTpEtMin")), + HGCalHadTpEtMin(iConfig.getParameter<double>("HGCalHadTpEtMin")), + HGCalEmTpEtMin(iConfig.getParameter<double>("HGCalEmTpEtMin")), + HFTpEtMin(iConfig.getParameter<double>("HFTpEtMin")), + puThreshold(iConfig.getParameter<double>("puThreshold")), + puThresholdL1eg(iConfig.getParameter<double>("puThresholdL1eg")), + puThresholdHcalMin(iConfig.getParameter<double>("puThresholdHcalMin")), + puThresholdHcalMax(iConfig.getParameter<double>("puThresholdHcalMax")), + puThresholdEcalMin(iConfig.getParameter<double>("puThresholdEcalMin")), + puThresholdEcalMax(iConfig.getParameter<double>("puThresholdEcalMax")), + puThresholdHGCalEMMin(iConfig.getParameter<double>("puThresholdHGCalEMMin")), + puThresholdHGCalEMMax(iConfig.getParameter<double>("puThresholdHGCalEMMax")), + puThresholdHGCalHadMin(iConfig.getParameter<double>("puThresholdHGCalHadMin")), + puThresholdHGCalHadMax(iConfig.getParameter<double>("puThresholdHGCalHadMax")), + puThresholdHFMin(iConfig.getParameter<double>("puThresholdHFMin")), + puThresholdHFMax(iConfig.getParameter<double>("puThresholdHFMax")), + barrelSF(iConfig.getParameter<double>("barrelSF")), + hgcalSF(iConfig.getParameter<double>("hgcalSF")), + hfSF(iConfig.getParameter<double>("hfSF")), + debug(iConfig.getParameter<bool>("debug")), + skipCalibrations(iConfig.getParameter<bool>("skipCalibrations")), + l1TowerToken_(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))), + hgcalTowersToken_( + consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("L1HgcalTowersInputTag"))), + hcalToken_(consumes<HcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalDigis"))), + nHits_to_nvtx_params(iConfig.getParameter<std::vector<edm::ParameterSet> >("nHits_to_nvtx_params")), + nvtx_to_PU_sub_params(iConfig.getParameter<std::vector<edm::ParameterSet> >("nvtx_to_PU_sub_params")) { + // Initialize the nHits --> nvtx functions + for (uint i = 0; i < nHits_to_nvtx_params.size(); i++) { + edm::ParameterSet* pset = &nHits_to_nvtx_params.at(i); + std::string calo = pset->getParameter<std::string>("fit"); + nHits_to_nvtx_funcs[calo.c_str()] = TF1(calo.c_str(), "[0] + [1] * x"); + nHits_to_nvtx_funcs[calo.c_str()].SetParameter(0, pset->getParameter<std::vector<double> >("params").at(0)); + nHits_to_nvtx_funcs[calo.c_str()].SetParameter(1, pset->getParameter<std::vector<double> >("params").at(1)); + + if (debug) { + printf( + "nHits_to_nvtx_params[%i]\n \ fit: %s \n \ p1: %f \n \ - p2 %f \n", i, calo.c_str(), - nHits_to_nvtx_funcs[ calo.c_str() ].GetParameter( 0 ), - nHits_to_nvtx_funcs[ calo.c_str() ].GetParameter( 1 ) ); - } + p2 %f \n", + i, + calo.c_str(), + nHits_to_nvtx_funcs[calo.c_str()].GetParameter(0), + nHits_to_nvtx_funcs[calo.c_str()].GetParameter(1)); } - - - - - // Initialize the nvtx --> PU subtraction functions - all_nvtx_to_PU_sub_funcs[ "ecal" ] = ecal_nvtx_to_PU_sub_funcs; - all_nvtx_to_PU_sub_funcs[ "hcal" ] = hcal_nvtx_to_PU_sub_funcs; - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ] = hgcalEM_nvtx_to_PU_sub_funcs; - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ] = hgcalHad_nvtx_to_PU_sub_funcs; - all_nvtx_to_PU_sub_funcs[ "hf" ] = hf_nvtx_to_PU_sub_funcs; - - for ( uint i = 0; i < nvtx_to_PU_sub_params.size(); i++ ) - { - edm::ParameterSet * pset = &nvtx_to_PU_sub_params.at(i); - std::string calo = pset->getParameter< std::string >("calo"); - std::string iEta = pset->getParameter< std::string >("iEta"); - double p1 = pset->getParameter< std::vector<double> >("params").at(0); - double p2 = pset->getParameter< std::vector<double> >("params").at(1); - - all_nvtx_to_PU_sub_funcs[ calo.c_str() ][ iEta.c_str() ] = TF1( calo.c_str(), "[0] + [1] * x"); - all_nvtx_to_PU_sub_funcs[ calo.c_str() ][ iEta.c_str() ].SetParameter( 0, p1 ); - all_nvtx_to_PU_sub_funcs[ calo.c_str() ][ iEta.c_str() ].SetParameter( 1, p2 ); - - if(debug) - { - printf("nvtx_to_PU_sub_params[%i]\n \ + } + + // Initialize the nvtx --> PU subtraction functions + all_nvtx_to_PU_sub_funcs["ecal"] = ecal_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hcal"] = hcal_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hgcalEM"] = hgcalEM_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hgcalHad"] = hgcalHad_nvtx_to_PU_sub_funcs; + all_nvtx_to_PU_sub_funcs["hf"] = hf_nvtx_to_PU_sub_funcs; + + for (uint i = 0; i < nvtx_to_PU_sub_params.size(); i++) { + edm::ParameterSet* pset = &nvtx_to_PU_sub_params.at(i); + std::string calo = pset->getParameter<std::string>("calo"); + std::string iEta = pset->getParameter<std::string>("iEta"); + double p1 = pset->getParameter<std::vector<double> >("params").at(0); + double p2 = pset->getParameter<std::vector<double> >("params").at(1); + + all_nvtx_to_PU_sub_funcs[calo.c_str()][iEta.c_str()] = TF1(calo.c_str(), "[0] + [1] * x"); + all_nvtx_to_PU_sub_funcs[calo.c_str()][iEta.c_str()].SetParameter(0, p1); + all_nvtx_to_PU_sub_funcs[calo.c_str()][iEta.c_str()].SetParameter(1, p2); + + if (debug) { + printf( + "nvtx_to_PU_sub_params[%i]\n \ sub detector: %s \n \ iEta: %s \n \ p1: %f \n \ - p2 %f \n", i, calo.c_str(), iEta.c_str(), p1, p2 ); - } + p2 %f \n", + i, + calo.c_str(), + iEta.c_str(), + p1, + p2); } + } - - - // Our two outputs, calibrated towers and estimated nvtx for fun - produces< l1tp2::CaloTowerCollection >("L1CaloTowerCalibratedCollection"); - produces< double >("EstimatedNvtx"); - + // Our two outputs, calibrated towers and estimated nvtx for fun + produces<l1tp2::CaloTowerCollection>("L1CaloTowerCalibratedCollection"); + produces<double>("EstimatedNvtx"); } -void L1TowerCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - - - - // Estimated number of vertices used for calibration estimattion - std::unique_ptr< double > EstimatedNvtx(new double); - // Calibrated output collection - std::unique_ptr< l1tp2::CaloTowerCollection > L1CaloTowerCalibratedCollection(new l1tp2::CaloTowerCollection); - - - - - - - // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc - iEvent.getByToken(l1TowerToken_,l1CaloTowerHandle); - - // HGCal info - iEvent.getByToken(hgcalTowersToken_,hgcalTowersHandle); - hgcalTowers = (*hgcalTowersHandle.product()); - - // HF Tower info - iEvent.getByToken(hcalToken_,hcalTowerHandle); - - // Barrel ECAL (unclustered) and HCAL - for (auto& hit : *l1CaloTowerHandle.product()) - { +void L1TowerCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + // Estimated number of vertices used for calibration estimattion + std::unique_ptr<double> EstimatedNvtx(new double); + // Calibrated output collection + std::unique_ptr<l1tp2::CaloTowerCollection> L1CaloTowerCalibratedCollection(new l1tp2::CaloTowerCollection); + + // Load the ECAL+HCAL tower sums coming from L1EGammaCrystalsEmulatorProducer.cc + iEvent.getByToken(l1TowerToken_, l1CaloTowerHandle); + + // HGCal info + iEvent.getByToken(hgcalTowersToken_, hgcalTowersHandle); + hgcalTowers = (*hgcalTowersHandle.product()); + + // HF Tower info + iEvent.getByToken(hcalToken_, hcalTowerHandle); + + // Barrel ECAL (unclustered) and HCAL + for (auto& hit : *l1CaloTowerHandle.product()) { + l1tp2::CaloTower l1Hit; + l1Hit.setEcalTowerEt(hit.ecalTowerEt()); + l1Hit.setHcalTowerEt(hit.hcalTowerEt()); + l1Hit.setL1egTowerEt(hit.l1egTowerEt()); + // Add min ET thresholds for tower ET + if (l1Hit.ecalTowerEt() < EcalTpEtMin) + l1Hit.setEcalTowerEt(0.0); + if (l1Hit.hcalTowerEt() < HcalTpEtMin) + l1Hit.setHcalTowerEt(0.0); + l1Hit.setTowerIEta(hit.towerIEta()); + l1Hit.setTowerIPhi(hit.towerIPhi()); + l1Hit.setTowerEta(hit.towerEta()); + l1Hit.setTowerPhi(hit.towerPhi()); + l1Hit.setIsBarrel(hit.isBarrel()); + l1Hit.setNL1eg(hit.nL1eg()); + l1Hit.setL1egTrkSS(hit.l1egTrkSS()); + l1Hit.setL1egTrkIso(hit.l1egTrkIso()); + l1Hit.setL1egStandaloneSS(hit.l1egStandaloneSS()); + l1Hit.setL1egStandaloneIso(hit.l1egStandaloneIso()); + + // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is + // returning towers with minimal ECAL energy, and no HCAL energy with these + // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. + // Skip these for the time being until the upstream code has been debugged + if ((int)l1Hit.towerIEta() == -1016 && (int)l1Hit.towerIPhi() == -962) + continue; + + (*L1CaloTowerCalibratedCollection).push_back(l1Hit); + if (debug) + printf("Barrel tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", + (int)l1Hit.towerIEta(), + (int)l1Hit.towerIPhi(), + l1Hit.towerEta(), + l1Hit.towerPhi(), + l1Hit.ecalTowerEt(), + l1Hit.hcalTowerEt()); + } + + // Loop over HGCalTowers and create L1CaloTowers for them and add to collection + // This iterator is taken from the PF P2 group + // https://github.com/p2l1pfp/cmssw/blob/170808db68038d53794bc65fdc962f8fc337a24d/L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFCaloProducer.cc#L278-L289 + for (auto it = hgcalTowers.begin(0), ed = hgcalTowers.end(0); it != ed; ++it) { + // skip lowest ET towers + if (it->etEm() < HGCalEmTpEtMin && it->etHad() < HGCalHadTpEtMin) + continue; + + l1tp2::CaloTower l1Hit; + // Set energies normally, but need to zero if below threshold + if (it->etEm() < HGCalEmTpEtMin) + l1Hit.setEcalTowerEt(0.); + else + l1Hit.setEcalTowerEt(it->etEm()); + + if (it->etHad() < HGCalHadTpEtMin) + l1Hit.setHcalTowerEt(0.); + else + l1Hit.setHcalTowerEt(it->etHad()); + + l1Hit.setTowerEta(it->eta()); + l1Hit.setTowerPhi(it->phi()); + l1Hit.setTowerIEta(-98); // -98 mean HGCal + l1Hit.setTowerIPhi(-98); + l1Hit.setIsBarrel(false); + (*L1CaloTowerCalibratedCollection).push_back(l1Hit); + if (debug) + printf("HGCal tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", + (int)l1Hit.towerIEta(), + (int)l1Hit.towerIPhi(), + l1Hit.towerEta(), + l1Hit.towerPhi(), + l1Hit.ecalTowerEt(), + l1Hit.hcalTowerEt()); + } + + // Loop over Hcal HF tower inputs and create L1CaloTowers and add to + // L1CaloTowerCalibratedCollection collection + iSetup.get<CaloTPGRecord>().get(decoder_); + for (const auto& hit : *hcalTowerHandle.product()) { + HcalTrigTowerDetId id = hit.id(); + double et = decoder_->hcaletValue(hit.id(), hit.t0()); + if (et < HFTpEtMin) + continue; + // Only doing HF so skip outside range + if (abs(id.ieta()) < l1t::CaloTools::kHFBegin) + continue; + if (abs(id.ieta()) > l1t::CaloTools::kHFEnd) + continue; + + l1tp2::CaloTower l1Hit; + l1Hit.setEcalTowerEt(0.); + l1Hit.setHcalTowerEt(et); + l1Hit.setTowerEta(l1t::CaloTools::towerEta(id.ieta())); + l1Hit.setTowerPhi(l1t::CaloTools::towerPhi(id.ieta(), id.iphi())); + l1Hit.setTowerIEta(id.ieta()); + l1Hit.setTowerIPhi(id.iphi()); + l1Hit.setIsBarrel(false); + (*L1CaloTowerCalibratedCollection).push_back(l1Hit); + + if (debug) + printf("HCAL HF tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", + (int)l1Hit.towerIEta(), + (int)l1Hit.towerIPhi(), + l1Hit.towerEta(), + l1Hit.towerPhi(), + l1Hit.ecalTowerEt(), + l1Hit.hcalTowerEt()); + } + + // N Tower totals + // For mapping to estimated nvtx in event + int i_ecal_hits_leq_threshold = 0; + int i_hgcalEM_hits_leq_threshold = 0; + int i_hcal_hits_leq_threshold = 0; + int i_hgcalHad_hits_leq_threshold = 0; + int i_hf_hits_leq_threshold = 0; + + // Loop over the collection containing all hits + // and calculate the number of hits falling into the + // "less than or equal" nTowers variable which maps to + // estimated number of vertices + for (auto& l1CaloTower : (*L1CaloTowerCalibratedCollection)) { + // Barrel ECAL + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) { + if (l1CaloTower.ecalTowerEt() <= puThresholdEcalMax && l1CaloTower.ecalTowerEt() >= puThresholdEcalMin) { + i_ecal_hits_leq_threshold++; + } + } - l1tp2::CaloTower l1Hit; - l1Hit.setEcalTowerEt(hit.ecalTowerEt()); - l1Hit.setHcalTowerEt(hit.hcalTowerEt()); - l1Hit.setL1egTowerEt(hit.l1egTowerEt()); - // Add min ET thresholds for tower ET - if (l1Hit.ecalTowerEt() < EcalTpEtMin) l1Hit.setEcalTowerEt(0.0); - if (l1Hit.hcalTowerEt() < HcalTpEtMin) l1Hit.setHcalTowerEt(0.0); - l1Hit.setTowerIEta(hit.towerIEta()); - l1Hit.setTowerIPhi(hit.towerIPhi()); - l1Hit.setTowerEta(hit.towerEta()); - l1Hit.setTowerPhi(hit.towerPhi()); - l1Hit.setIsBarrel(hit.isBarrel()); - l1Hit.setNL1eg(hit.nL1eg()); - l1Hit.setL1egTrkSS(hit.l1egTrkSS()); - l1Hit.setL1egTrkIso(hit.l1egTrkIso()); - l1Hit.setL1egStandaloneSS(hit.l1egStandaloneSS()); - l1Hit.setL1egStandaloneIso(hit.l1egStandaloneIso()); - - // FIXME There is an error in the L1EGammaCrystalsEmulatorProducer.cc which is - // returning towers with minimal ECAL energy, and no HCAL energy with these - // iEta/iPhi coordinates and eta = -88.653152 and phi = -99.000000. - // Skip these for the time being until the upstream code has been debugged - if ((int)l1Hit.towerIEta() == -1016 && (int)l1Hit.towerIPhi() == -962) continue; - - - (*L1CaloTowerCalibratedCollection).push_back( l1Hit ); - if (debug) printf("Barrel tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", (int)l1Hit.towerIEta(), (int)l1Hit.towerIPhi(), l1Hit.towerEta(), l1Hit.towerPhi(), l1Hit.ecalTowerEt(), l1Hit.hcalTowerEt()); + // HGCal EM + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (l1CaloTower.ecalTowerEt() <= puThresholdHGCalEMMax && l1CaloTower.ecalTowerEt() >= puThresholdHGCalEMMin) { + i_hgcalEM_hits_leq_threshold++; + } } - // Loop over HGCalTowers and create L1CaloTowers for them and add to collection - // This iterator is taken from the PF P2 group - // https://github.com/p2l1pfp/cmssw/blob/170808db68038d53794bc65fdc962f8fc337a24d/L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFCaloProducer.cc#L278-L289 - for (auto it = hgcalTowers.begin(0), ed = hgcalTowers.end(0); it != ed; ++it) + // Barrel HCAL + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF { - // skip lowest ET towers - if (it->etEm() < HGCalEmTpEtMin && it->etHad() < HGCalHadTpEtMin) continue; - - l1tp2::CaloTower l1Hit; - // Set energies normally, but need to zero if below threshold - if (it->etEm() < HGCalEmTpEtMin) l1Hit.setEcalTowerEt(0.); - else l1Hit.setEcalTowerEt(it->etEm()); - - if (it->etHad() < HGCalHadTpEtMin) l1Hit.setHcalTowerEt(0.); - else l1Hit.setHcalTowerEt(it->etHad()); - - l1Hit.setTowerEta(it->eta()); - l1Hit.setTowerPhi(it->phi()); - l1Hit.setTowerIEta(-98); // -98 mean HGCal - l1Hit.setTowerIPhi(-98); - l1Hit.setIsBarrel(false); - (*L1CaloTowerCalibratedCollection).push_back( l1Hit ); - if (debug) printf("HGCal tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", (int)l1Hit.towerIEta(), (int)l1Hit.towerIPhi(), l1Hit.towerEta(), l1Hit.towerPhi(), l1Hit.ecalTowerEt(), l1Hit.hcalTowerEt()); + if (l1CaloTower.hcalTowerEt() <= puThresholdHcalMax && l1CaloTower.hcalTowerEt() >= puThresholdHcalMin) { + i_hcal_hits_leq_threshold++; + } } - - // Loop over Hcal HF tower inputs and create L1CaloTowers and add to - // L1CaloTowerCalibratedCollection collection - iSetup.get<CaloTPGRecord>().get(decoder_); - for (const auto & hit : *hcalTowerHandle.product()) { - HcalTrigTowerDetId id = hit.id(); - double et = decoder_->hcaletValue(hit.id(), hit.t0()); - if (et < HFTpEtMin) continue; - // Only doing HF so skip outside range - if ( abs(id.ieta()) < l1t::CaloTools::kHFBegin ) continue; - if ( abs(id.ieta()) > l1t::CaloTools::kHFEnd ) continue; - - l1tp2::CaloTower l1Hit; - l1Hit.setEcalTowerEt(0.); - l1Hit.setHcalTowerEt(et); - l1Hit.setTowerEta(l1t::CaloTools::towerEta(id.ieta())); - l1Hit.setTowerPhi(l1t::CaloTools::towerPhi(id.ieta(), id.iphi())); - l1Hit.setTowerIEta(id.ieta()); - l1Hit.setTowerIPhi(id.iphi()); - l1Hit.setIsBarrel(false); - (*L1CaloTowerCalibratedCollection).push_back( l1Hit ); - - if (debug) printf("HCAL HF tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et_sum %f\n", (int)l1Hit.towerIEta(), (int)l1Hit.towerIPhi(), l1Hit.towerEta(), l1Hit.towerPhi(), l1Hit.ecalTowerEt(), l1Hit.hcalTowerEt()); + // HGCal Had + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (l1CaloTower.hcalTowerEt() <= puThresholdHGCalHadMax && l1CaloTower.hcalTowerEt() >= puThresholdHGCalHadMin) { + i_hgcalHad_hits_leq_threshold++; + } } - - - // N Tower totals - // For mapping to estimated nvtx in event - int i_ecal_hits_leq_threshold = 0; - int i_hgcalEM_hits_leq_threshold = 0; - int i_hcal_hits_leq_threshold = 0; - int i_hgcalHad_hits_leq_threshold = 0; - int i_hf_hits_leq_threshold = 0; - - - // Loop over the collection containing all hits - // and calculate the number of hits falling into the - // "less than or equal" nTowers variable which maps to - // estimated number of vertices - for (auto &l1CaloTower : (*L1CaloTowerCalibratedCollection) ) + // HF + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF { - - - // Barrel ECAL - if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) - { - if(l1CaloTower.ecalTowerEt() <= puThresholdEcalMax && l1CaloTower.ecalTowerEt() >= puThresholdEcalMin) - { - i_ecal_hits_leq_threshold++; - } - } - - - // HGCal EM - if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) - { - if(l1CaloTower.ecalTowerEt() <= puThresholdHGCalEMMax && l1CaloTower.ecalTowerEt() >= puThresholdHGCalEMMin) - { - i_hgcalEM_hits_leq_threshold++; - } - } - - - // Barrel HCAL - if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF - { - if(l1CaloTower.hcalTowerEt() <= puThresholdHcalMax && l1CaloTower.hcalTowerEt() >= puThresholdHcalMin) - { - i_hcal_hits_leq_threshold++; - } - } - - - // HGCal Had - if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) - { - if(l1CaloTower.hcalTowerEt() <= puThresholdHGCalHadMax && l1CaloTower.hcalTowerEt() >= puThresholdHGCalHadMin) - { - i_hgcalHad_hits_leq_threshold++; - } - } - - // HF - if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF - { - if(l1CaloTower.hcalTowerEt() <= puThresholdHFMax && l1CaloTower.hcalTowerEt() >= puThresholdHFMin) - { - i_hf_hits_leq_threshold++; - } - } + if (l1CaloTower.hcalTowerEt() <= puThresholdHFMax && l1CaloTower.hcalTowerEt() >= puThresholdHFMin) { + i_hf_hits_leq_threshold++; + } } - - - - // For each subdetector, map to the estimated number of vertices - double ecal_nvtx = nHits_to_nvtx_funcs[ "ecal" ].Eval( i_ecal_hits_leq_threshold ); - double hcal_nvtx = nHits_to_nvtx_funcs[ "hcal" ].Eval( i_hcal_hits_leq_threshold ); - double hgcalEM_nvtx = nHits_to_nvtx_funcs[ "hgcalEM" ].Eval( i_hgcalEM_hits_leq_threshold ); - double hgcalHad_nvtx = nHits_to_nvtx_funcs[ "hgcalHad" ].Eval( i_hgcalHad_hits_leq_threshold ); - double hf_nvtx = nHits_to_nvtx_funcs[ "hf" ].Eval( i_hf_hits_leq_threshold ); - // Make sure all values are >= 0 - if (ecal_nvtx < 0) ecal_nvtx = 0; - if (hcal_nvtx < 0) hcal_nvtx = 0; - if (hgcalEM_nvtx < 0) hgcalEM_nvtx = 0; - if (hgcalHad_nvtx < 0) hgcalHad_nvtx = 0; - if (hf_nvtx < 0) hf_nvtx = 0; - // Best estimate is avg of all except HF. - // This is b/c HF currently has such poor prediction power, it only degrades the avg result - // NEW, with 10_3_X, hgcal and HF has the best results based on the values I took... - // skip ECAL and HCAL - //*EstimatedNvtx = ( ecal_nvtx + hcal_nvtx + hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx ) / 3.; - *EstimatedNvtx = ( hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx ) / 3.; - - - - - if(debug) - { - double lumi = iEvent.eventAuxiliary().luminosityBlock(); - double event = iEvent.eventAuxiliary().event(); - - printf("L1TowerCalibrater: lumi %.0f evt %.0f nTowers for subdetecters \ + } + + // For each subdetector, map to the estimated number of vertices + double ecal_nvtx = nHits_to_nvtx_funcs["ecal"].Eval(i_ecal_hits_leq_threshold); + double hcal_nvtx = nHits_to_nvtx_funcs["hcal"].Eval(i_hcal_hits_leq_threshold); + double hgcalEM_nvtx = nHits_to_nvtx_funcs["hgcalEM"].Eval(i_hgcalEM_hits_leq_threshold); + double hgcalHad_nvtx = nHits_to_nvtx_funcs["hgcalHad"].Eval(i_hgcalHad_hits_leq_threshold); + double hf_nvtx = nHits_to_nvtx_funcs["hf"].Eval(i_hf_hits_leq_threshold); + // Make sure all values are >= 0 + if (ecal_nvtx < 0) + ecal_nvtx = 0; + if (hcal_nvtx < 0) + hcal_nvtx = 0; + if (hgcalEM_nvtx < 0) + hgcalEM_nvtx = 0; + if (hgcalHad_nvtx < 0) + hgcalHad_nvtx = 0; + if (hf_nvtx < 0) + hf_nvtx = 0; + // Best estimate is avg of all except HF. + // This is b/c HF currently has such poor prediction power, it only degrades the avg result + // NEW, with 10_3_X, hgcal and HF has the best results based on the values I took... + // skip ECAL and HCAL + //*EstimatedNvtx = ( ecal_nvtx + hcal_nvtx + hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx ) / 3.; + *EstimatedNvtx = (hgcalEM_nvtx + hgcalHad_nvtx + hf_nvtx) / 3.; + + if (debug) { + double lumi = iEvent.eventAuxiliary().luminosityBlock(); + double event = iEvent.eventAuxiliary().event(); + + printf( + "L1TowerCalibrater: lumi %.0f evt %.0f nTowers for subdetecters \ \nECAL: %i --> nvtx = %.1f \ \nHGCal EM: %i --> nvtx = %.1f \ \nHCAL: %i --> nvtx = %.1f \ \nHGCal Had: %i --> nvtx = %.1f \ \nHCAL HF: %i --> nvtx = %.1f \ - \nEstimated Nvtx = %.1f\n", lumi, event, - i_ecal_hits_leq_threshold, ecal_nvtx, - i_hgcalEM_hits_leq_threshold, hgcalEM_nvtx, - i_hcal_hits_leq_threshold, hcal_nvtx, - i_hgcalHad_hits_leq_threshold, hgcalHad_nvtx, - i_hf_hits_leq_threshold, hf_nvtx, - *EstimatedNvtx ); - } - - - + \nEstimated Nvtx = %.1f\n", + lumi, + event, + i_ecal_hits_leq_threshold, + ecal_nvtx, + i_hgcalEM_hits_leq_threshold, + hgcalEM_nvtx, + i_hcal_hits_leq_threshold, + hcal_nvtx, + i_hgcalHad_hits_leq_threshold, + hgcalHad_nvtx, + i_hf_hits_leq_threshold, + hf_nvtx, + *EstimatedNvtx); + } + + // Use estimated number of vertices to subtract off PU contributions + // to each and every hit. In cases where the energy would go negative, + // limit this to zero. + if (!skipCalibrations) // skipCalibrations simply passes the towers through + { + for (auto& l1CaloTower : (*L1CaloTowerCalibratedCollection)) { + // Barrel ECAL eta slices + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) { + if (abs(l1CaloTower.towerIEta()) <= 3) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er1to3"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er4to6"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er7to9"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er10to12"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er13to15"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["ecal"]["er16to18"].Eval(*EstimatedNvtx) * barrelSF); + } + } - // Use estimated number of vertices to subtract off PU contributions - // to each and every hit. In cases where the energy would go negative, - // limit this to zero. - if (!skipCalibrations) // skipCalibrations simply passes the towers through - { - for (auto &l1CaloTower : (*L1CaloTowerCalibratedCollection) ) - { - - // Barrel ECAL eta slices - if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() != -98) - { - if( abs(l1CaloTower.towerIEta()) <= 3 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er1to3" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er4to6" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er7to9" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er10to12" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er13to15" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "ecal" ][ "er16to18" ].Eval( *EstimatedNvtx ) * barrelSF); - } - } - - - // HGCal EM eta slices - if(l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) - { - if( abs(l1CaloTower.towerEta()) <= 1.8 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er1p4to1p8" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er1p8to2p1" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er2p1to2p4" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er2p4to2p7" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7 ) - { - l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalEM" ][ "er2p7to3p1" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - } - - // Barrel HCAL eta slices - if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF - { - if( abs(l1CaloTower.towerIEta()) <= 3 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er1to3" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er4to6" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er7to9" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er10to12" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er13to15" ].Eval( *EstimatedNvtx ) * barrelSF); - } - if( abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hcal" ][ "er16to18" ].Eval( *EstimatedNvtx ) * barrelSF); - } - } - - // HGCal Had eta slices - if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) - { - if( abs(l1CaloTower.towerEta()) <= 1.8 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er1p4to1p8" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er1p8to2p1" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er2p1to2p4" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er2p4to2p7" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - if( abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hgcalHad" ][ "er2p7to3p1" ].Eval( *EstimatedNvtx ) * hgcalSF); - } - } - - // HF eta slices - if(l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF - { - if( abs(l1CaloTower.towerIEta()) <= 33 && abs(l1CaloTower.towerIEta()) >= 29 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hf" ][ "er29to33" ].Eval( *EstimatedNvtx ) * hfSF); - } - if( abs(l1CaloTower.towerIEta()) <= 37 && abs(l1CaloTower.towerIEta()) >= 34 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hf" ][ "er34to37" ].Eval( *EstimatedNvtx ) * hfSF); - } - if( abs(l1CaloTower.towerIEta()) <= 41 && abs(l1CaloTower.towerIEta()) >= 38 ) - { - l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - all_nvtx_to_PU_sub_funcs[ "hf" ][ "er38to41" ].Eval( *EstimatedNvtx ) * hfSF); - } - } - - - // Make sure none are negative - if(l1CaloTower.ecalTowerEt() < 0.) l1CaloTower.setEcalTowerEt(0.); - if(l1CaloTower.hcalTowerEt() < 0.) l1CaloTower.setHcalTowerEt(0.); + // HGCal EM eta slices + if (l1CaloTower.ecalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (abs(l1CaloTower.towerEta()) <= 1.8) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er1p4to1p8"].Eval(*EstimatedNvtx) * hgcalSF); } - } + if (abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er1p8to2p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er2p1to2p4"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er2p4to2p7"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7) { + l1CaloTower.setEcalTowerEt(l1CaloTower.ecalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalEM"]["er2p7to3p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + } + + // Barrel HCAL eta slices + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) < 2.0) // abs(eta) < 2 just keeps us out of HF + { + if (abs(l1CaloTower.towerIEta()) <= 3) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er1to3"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 6 && abs(l1CaloTower.towerIEta()) >= 4) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er4to6"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 9 && abs(l1CaloTower.towerIEta()) >= 7) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er7to9"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 12 && abs(l1CaloTower.towerIEta()) >= 10) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er10to12"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 15 && abs(l1CaloTower.towerIEta()) >= 13) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er13to15"].Eval(*EstimatedNvtx) * barrelSF); + } + if (abs(l1CaloTower.towerIEta()) <= 18 && abs(l1CaloTower.towerIEta()) >= 16) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hcal"]["er16to18"].Eval(*EstimatedNvtx) * barrelSF); + } + } + // HGCal Had eta slices + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() == -98) { + if (abs(l1CaloTower.towerEta()) <= 1.8) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er1p4to1p8"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.1 && abs(l1CaloTower.towerEta()) > 1.8) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er1p8to2p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.4 && abs(l1CaloTower.towerEta()) > 2.1) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er2p1to2p4"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 2.7 && abs(l1CaloTower.towerEta()) > 2.4) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er2p4to2p7"].Eval(*EstimatedNvtx) * hgcalSF); + } + if (abs(l1CaloTower.towerEta()) <= 3.1 && abs(l1CaloTower.towerEta()) > 2.7) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hgcalHad"]["er2p7to3p1"].Eval(*EstimatedNvtx) * hgcalSF); + } + } + + // HF eta slices + if (l1CaloTower.hcalTowerEt() > 0. && l1CaloTower.towerIEta() != -98 && + abs(l1CaloTower.towerEta()) > 2.0) // abs(eta) > 2 keeps us out of barrel HF + { + if (abs(l1CaloTower.towerIEta()) <= 33 && abs(l1CaloTower.towerIEta()) >= 29) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hf"]["er29to33"].Eval(*EstimatedNvtx) * hfSF); + } + if (abs(l1CaloTower.towerIEta()) <= 37 && abs(l1CaloTower.towerIEta()) >= 34) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hf"]["er34to37"].Eval(*EstimatedNvtx) * hfSF); + } + if (abs(l1CaloTower.towerIEta()) <= 41 && abs(l1CaloTower.towerIEta()) >= 38) { + l1CaloTower.setHcalTowerEt(l1CaloTower.hcalTowerEt() - + all_nvtx_to_PU_sub_funcs["hf"]["er38to41"].Eval(*EstimatedNvtx) * hfSF); + } + } + // Make sure none are negative + if (l1CaloTower.ecalTowerEt() < 0.) + l1CaloTower.setEcalTowerEt(0.); + if (l1CaloTower.hcalTowerEt() < 0.) + l1CaloTower.setHcalTowerEt(0.); + } + } - iEvent.put(std::move(EstimatedNvtx),"EstimatedNvtx"); - iEvent.put(std::move(L1CaloTowerCalibratedCollection),"L1CaloTowerCalibratedCollection"); + iEvent.put(std::move(EstimatedNvtx), "EstimatedNvtx"); + iEvent.put(std::move(L1CaloTowerCalibratedCollection), "L1CaloTowerCalibratedCollection"); } - - DEFINE_FWK_MODULE(L1TowerCalibrator); From 55cf0941e336ede23e6d1fbc4a30a2cef0945f09 Mon Sep 17 00:00:00 2001 From: sudha ahuja <sudha.ahuja@cern.ch> Date: Mon, 21 Sep 2020 14:00:37 +0200 Subject: [PATCH 146/309] seeding algorithm updates for phi smoothing minor change --- .../L1THGCal/interface/backend/HGCalHistoSeedingImpl.h | 2 ++ .../L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py | 2 +- .../L1THGCal/src/backend/HGCalHistoSeedingImpl.cc | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h b/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h index 2dc5b0dd4cdc0..03519dc76dad6 100644 --- a/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h +++ b/L1Trigger/L1THGCal/interface/backend/HGCalHistoSeedingImpl.h @@ -151,6 +151,8 @@ class HGCalHistoSeedingImpl { unsigned nBins2_ = 216; std::vector<unsigned> binsSumsHisto_; double histoThreshold_ = 20.; + static constexpr double area_per_triggercell_ = + 4.91E-05; // Hex_Wafer_Area (x/z units)/N_TC (per wafer) = (0.866*((hexWafer_minimal_diameter)*(1./319.))^2 / 48) std::vector<double> neighbour_weights_; std::vector<double> smoothing_ecal_; std::vector<double> smoothing_hcal_; diff --git a/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py b/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py index af1a76ee9aaf4..e46620486bbd5 100644 --- a/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py +++ b/L1Trigger/L1THGCal/python/hgcalBackEndLayer2Producer_cfi.py @@ -105,7 +105,7 @@ # (see https://indico.cern.ch/event/806845/contributions/3359859/attachments/1815187/2966402/19-03-20_EGPerf_HGCBE.pdf # for more details) phase2_hgcalV10.toModify(histoMax_C3d_seeding_params, - threshold_histo_multicluster=7.5, # MipT + threshold_histo_multicluster=8.5, # MipT ) diff --git a/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc b/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc index 01f34ffcf18fb..2353c592070be 100644 --- a/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc +++ b/L1Trigger/L1THGCal/src/backend/HGCalHistoSeedingImpl.cc @@ -166,12 +166,12 @@ HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillSmoothPhiHistoCluste for (int z_side : {-1, 1}) { for (unsigned bin1 = 0; bin1 < nBins1_; bin1++) { int nBinsSide = (binSums[bin1] - 1) / 2; - float R1 = kROverZMin_ + bin1 * (kROverZMax_ - kROverZMin_); - float R2 = R1 + (kROverZMax_ - kROverZMin_); + float R1 = kROverZMin_ + bin1 * (kROverZMax_ - kROverZMin_) / nBins1_; + float R2 = R1 + ((kROverZMax_ - kROverZMin_) / nBins1_); double area = - 0.5 * (pow(R2, 2) - pow(R1, 2)) * + ((M_PI * (pow(R2, 2) - pow(R1, 2))) / nBins2_) * (1 + - 0.5 * + 2.0 * (1 - pow(0.5, nBinsSide))); // Takes into account different area of bins in different R-rings + sum of quadratic weights used @@ -196,7 +196,7 @@ HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillSmoothPhiHistoCluste } auto& bin = histoSumPhiClusters.at(z_side, bin1, bin2); - bin.values[Bin::Content::Sum] = content / area; + bin.values[Bin::Content::Sum] = (content / area) * area_per_triggercell_; bin.weighted_x = bin_orig.weighted_x; bin.weighted_y = bin_orig.weighted_y; } From 48150578b1491af181117258c3050379ec16be80 Mon Sep 17 00:00:00 2001 From: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Date: Tue, 16 Mar 2021 02:53:51 +0100 Subject: [PATCH 147/309] first version of working emulator with HLS (cherry picked from commit 4e4619fb35ba5e1013f1d218d5db21bccd110321) --- .../plugins/L1MetPfProducer.cc | 274 ++++++++++++++++++ .../plugins/L1MetPfProducerHLS.cc | 227 +++++++++++++++ .../python/L1MetPfProducer_cfi.py | 6 + 3 files changed, 507 insertions(+) create mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc create mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc create mode 100644 L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc new file mode 100644 index 0000000000000..a7bf736fd6328 --- /dev/null +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc @@ -0,0 +1,274 @@ +#include <vector> +#include <ap_int.h> +#include <ap_fixed.h> +#include <TVector2.h> + +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/Math/interface/LorentzVector.h" + + +using namespace l1t; + +// sizes in bits +typedef ap_ufixed<14, 12, AP_RND, AP_SAT> pt_t; +typedef ap_int<11> phi_t; +constexpr float LSB_PHI = M_PI/720; + +// helpers +typedef ap_fixed<pt_t::width+1, pt_t::iwidth+1, AP_RND, AP_SAT> pxy_t; +typedef ap_ufixed<2*pt_t::width, 2*pt_t::iwidth, AP_RND, AP_SAT> pt2_t; +typedef ap_ufixed<pt_t::width, pt_t::iwidth, pt_t::qmode, AP_WRAP> pt_wrap_t; + +// LUT sizes for trig functions +constexpr uint PROJ_TAB_BITS = 8; // configurable +constexpr uint PROJ_TAB_SIZE = (1<<PROJ_TAB_BITS); +constexpr uint INV_TAB_BITS = 10; +constexpr uint INV_TAB_SIZE = (1<<INV_TAB_BITS); + +// constexpr uint PT_SIZE = 16; +// constexpr uint PHI_SIZE = 10; +// constexpr uint PT2_SIZE = 2*PT_SIZE; +//constexpr uint PT_DEC_BITS = 2; +// typedef ap_uint<PT_SIZE> pt_t; +// typedef ap_int<PT_SIZE+1> pxy_t; +// typedef ap_uint<PT2_SIZE> pt2_t; +// typedef ap_int<PHI_SIZE> phi_t; + + +// typedef ap_ufixed<16,2> pt_t; +// typedef ap_fixed<16,2> pxy_t; +// typedef ap_int<10> phi_t; +// ... + +class L1MetPfProducer : public edm::global::EDProducer<> { +public: + explicit L1MetPfProducer(const edm::ParameterSet&); + ~L1MetPfProducer() override; + +private: + void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; + edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; + + // const int pi_hw = (1<<(phi_t::width-1)); + + // static float px_table[PROJ_TAB_SIZE]; + // static float py_table[PROJ_TAB_SIZE]; + + //void initProjXTable() const; + + pxy_t Project(const pt_t pt, const phi_t phi, const bool doX) const; + + // pxy_t ProjY(const pt_t pt, const phi_t phi) const; + // phi_t PhiFromXY(const pxy_t x, const pxy_t y, const pt_t pt) const; + phi_t PhiFromXY(const pxy_t x, const pxy_t y) const; + +}; + +// void L1MetPfProducer::initProjXTable() const { +// // Return table of cos(phi) where phi is in (0,pi/2) +// // multiply result by 2^(PT_SIZE) (equal to 1 in our units) +// for (uint i = 0; i < PROJ_TAB_SIZE; i++) { +// //store result, guarding overflow near costheta=1 +// pt2_t x = round((1<<PT_SIZE) * cos(float(i)/PROJ_TAB_SIZE * M_PI/2)); +// // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) +// if(x >= (1<<PT_SIZE)) px_table[i] = (1<<PT_SIZE)-1; +// else px_table[i] = x; +// } +// } + +L1MetPfProducer::L1MetPfProducer(const edm::ParameterSet& cfg) + : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))) { + produces<std::vector<l1t::EtSum> >(); + + //initProjXTable(); +} + + +pxy_t L1MetPfProducer::Project(const pt_t pt, const phi_t phi, const bool doX) const { + + //map phi to the equivalent first quadrant value: range [0, 2^(phi_t::width-2)) i.e. [0,pi/2) + ap_uint<phi_t::width-2> phiQ1 = phi; + if(phi>=(1<<(phi_t::width-2))) phiQ1 = (1<<(phi_t::width-2)) -1 - phiQ1; // map e.g. 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(phi_t::width-2))) phiQ1 = (1<<(phi_t::width-2)) -1 - phiQ1; // map e.g. -64-1 (0-63) to 63-0 + + // Lut stores cos(x) for x in [0,pi/2), steps of pi/2 * 1/PROJ_TAB_SIZE + int index = phiQ1.to_int(); + if(phi_t::width-2 > PROJ_TAB_BITS) + index = index >> (phi_t::width-2 - PROJ_TAB_BITS); + if(phi_t::width-2 < PROJ_TAB_BITS){ + // silly, this table has more entries than possible values of phi!! + index = index << (PROJ_TAB_BITS - phi_t::width-2); + } + float fPhi = index/PROJ_TAB_SIZE * M_PI/2; + float fCosSin = doX ? cos(fPhi) : sin(fPhi); + pxy_t pxy = pt_t(pt_t::width * fCosSin); + if(doX){ + // -px for theta>pi/2, theta<-pi/2 + if( phi>=(1<<(phi_t::width-2)) || phi<-(1<<(phi_t::width-2))) pxy = -pxy; + } else { + // -py for theta<0 + if( phi<0 ) pxy = -pxy; + } + + return pxy; +} + +// pxy_t L1MetPfProducer::ProjY(const pt_t pt, const phi_t phi) const { +// return 0; +// } + + +// phi_t L1MetPfProducer::PhiFromXY(const pxy_t px, const pxy_t py) const { +// if(px==0 && py==0) return 0; + +// // get Q1 coordinates +// pt_t x = px; //px>=0 ? px : -px; +// pt_t y = py; //py>=0 ? py : -py; +// if(px<0) x = -px; +// if(py<0) y = -py; +// // transform so a<b +// pt_t a = x; //x<y ? x : y; +// pt_t b = y; //x<y ? y : x; +// if(a>b){ a = y; b = x; } + +// pt_t inv_b; +// const uint DROP_BITS = 2; +// if(b>= (1<<(pt_t::iwidth-DROP_BITS))) inv_b = 1; +// // don't bother to store these large numbers in the LUT... +// // instead approximate their inverses as 1 +// else inv_b = inv_table[b]; + +// pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) +// ap_uint<ATAN_SIZE> atan_index = a_over_b >> (PT_SIZE-ATAN_SIZE); // keep only most significant bits +// phi = atan_table[atan_index]; + +// // rotate from (0,pi/4) to full quad1 +// if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi +// // other quadrants +// if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi +// if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi +// if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both + +// } + +phi_t L1MetPfProducer::PhiFromXY(const pxy_t px, const pxy_t py) const { + // // First, get px/pt + // pt_wrap_t wPx = px>0 ? px : -px; + // pt_wrap_t wPt = pt; + + // pt_wrap_t wInvPt = (1<<pt_t::iwidth) / pt.to_float(); // from LUT + // pt_wrap_t wPxOverPt = pt_wrap_t(px) * wInvPt; + + // inversion table covers [0,2^12 TeV] with indices [0,INV_TAB_SIZE) + // intPt = pt. + + //typedef pt_wrap_t ap_ufixed<pt_t::width, pt_t::iwidth, pt_t::qmode, AP_WRAP>; + + if(px==0 && py==0) return 0; + + // Lookup atan in relatively narrow range [0,pi/4) to avoid having a big table for no reason + pxy_t maxXY = max( fabs(px.to_float()), fabs(py.to_float()) ); + pxy_t minXY = min( fabs(px.to_float()), fabs(py.to_float()) ); + + // set large number's inverses to 1 directly instead of storing in LUT + const uint DROP_BITS = 2; + const int fixed_to_int = 1<< (pt_t::width - pt_t::iwidth); + pt_wrap_t wInvMax = 1./fixed_to_int; // just set LSB + if(maxXY < (1<<(pt_t::iwidth-DROP_BITS))){ + // emulate LUT + int int_maxXY = round(maxXY.to_float() * fixed_to_int); + int index_inv = int_maxXY; + if(pt_t::width-DROP_BITS > INV_TAB_BITS) index_inv = index_inv >> ((pt_t::width-DROP_BITS) - INV_TAB_BITS); + if(pt_t::width-DROP_BITS < INV_TAB_BITS) index_inv = index_inv << (INV_TAB_BITS - (pt_t::width-DROP_BITS)); + wInvMax = (INV_TAB_SIZE / index_inv) * pt_t::width; + } + + pt_wrap_t wMinOverMax = minXY * wInvMax; + + // convert py/px (or vice versa) to an angle in [0,pi/4) + phi_t phi = atan(wMinOverMax.to_float() / (1<<pt_t::iwidth)) / LSB_PHI; + + if(py>px) phi = (1<<(phi_t::width-2)) - phi; // rotate to [pi/4,pi/2) + if( px < 0 && py > 0 ) phi = (1<<(phi_t::width-1)) - phi; // Q2 phi = pi - phi + if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi + if( px < 0 && py < 0 ) phi = -((1<<(phi_t::width-1)) - phi); // Q3 composition of both + + return phi; + + /* + // get integer representation of pt to mimic the index lookup used in the inversion table + int to_int = 1<< (pt_t::width - pt_t::iwidth); + int int_pt = round(pt.to_float() * to_int); + int index_inv = int_pt; + if(pt_t::width > INV_TAB_BITS) index_inv = index_inv >> (pt_t::width - INV_TAB_BITS); + if(pt_t::width < INV_TAB_BITS) index_inv = index_inv << (INV_TAB_BITS - pt_t::width); + pt_wrap_t wInvPt = round(((1<<pt_t::iwidth)-1) * float(index)/INV_TAB_SIZE); + // get px/pt to convert to phi w/ acos + pt_wrap_t wPxOverPt = pt_wrap_t(px) * wInvPt; + phi_t phi = acos(wPxOverPt.to_float() / (1<<pt_t::iwidth)) / LSB_PHI; + */ + + // phi is in [0,pi/4) + + // int max_int_pt = (1<<pt_t::width); + // int int_inv_pt = max_int_pt/int_pt; + + // uint index = x.round((1<<PT_SIZE) / float(i)); + + //return 0; +} + +void L1MetPfProducer::produce(edm::StreamID, + edm::Event& iEvent, + const edm::EventSetup& iSetup) const { + + edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; + iEvent.getByToken(_l1PFToken, l1PFCandidates); + + // to cleanup + long unsigned int maxCands_=128; + + float x=0; + float y=0; + pxy_t hw_px = 0; + pxy_t hw_py = 0; + + for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands_; i++){ + const auto& l1PFCand = l1PFCandidates->at(i); + + pt_t hw_pt = l1PFCand.pt(); + phi_t hw_phi = TVector2::Phi_mpi_pi( l1PFCand.phi()) / LSB_PHI; + + hw_px += Project(hw_pt, hw_phi, /*doX*/ true); + hw_py += Project(hw_pt, hw_phi, /*doX*/ false); + } + + pt2_t hw_met = pt2_t(hw_px)*pt2_t(hw_px) + pt2_t(hw_py)*pt2_t(hw_py); + hw_met = sqrt( hw_met.to_float() ); // FIXME + + phi_t hw_met_phi = 0;//PhiFromXY(hw_px, hw_py, hw_met); + + reco::Candidate::PolarLorentzVector metVector; + metVector.SetPt( hw_met.to_float() ); + metVector.SetPhi( hw_met_phi * LSB_PHI ); + metVector.SetEta(0); + l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); + + std::cout << "metVector: " << metVector.pt() << std::endl; + + std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); + metCollection->push_back(theMET); + iEvent.put(std::move(metCollection)); //, "myMetCollection"); + +} + +L1MetPfProducer::~L1MetPfProducer() {} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(L1MetPfProducer); diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc new file mode 100644 index 0000000000000..86ca4570550eb --- /dev/null +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc @@ -0,0 +1,227 @@ +#include <vector> +#include <ap_int.h> +#include <ap_fixed.h> +#include <TVector2.h> + +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +using namespace l1t; + +class L1MetPfProducerHLS : public edm::global::EDProducer<> { +public: + explicit L1MetPfProducerHLS(const edm::ParameterSet&); + ~L1MetPfProducerHLS() override; + +private: + void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; + edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; + + long unsigned int maxCands=128; + + + // quantization controllers + static constexpr uint PT_SIZE = 16; + static constexpr uint PT2_SIZE = 2*PT_SIZE; + static constexpr uint PT_DEC_BITS = 2; + static constexpr uint PHI_SIZE = 10; + typedef ap_uint<PT_SIZE> pt_t; + typedef ap_int<PT_SIZE+1> pxy_t; + typedef ap_uint<PT2_SIZE> pt2_t; + typedef ap_int<PHI_SIZE> phi_t; + const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV + const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad + + // for LUTs + static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); + static constexpr int DROP_BITS = 2; + static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); + static constexpr int ATAN_SIZE = (PHI_SIZE-3); + static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); + + //static pt_t cos_table[PROJ_TAB_SIZE]; + pt_t cos_table[PROJ_TAB_SIZE]; + pt_t sin_table[PROJ_TAB_SIZE]; + pt_t inv_table[INV_TAB_SIZE]; + pt_t atan_table[ATAN_TAB_SIZE]; + void init_projx_table(pt_t table_out[PROJ_TAB_SIZE]); + void init_projy_table(pt_t table_out[PROJ_TAB_SIZE]); + void init_inv_table(pt_t table_out[INV_TAB_SIZE]); + void init_atan_table(pt_t table_out[ATAN_TAB_SIZE]); + + void ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug=false) const; + void ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug=false) const; + void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; +}; + +L1MetPfProducerHLS::L1MetPfProducerHLS(const edm::ParameterSet& cfg) + : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))) { + produces<std::vector<l1t::EtSum> >(); + + init_projx_table( cos_table ); + init_projy_table( sin_table ); + init_inv_table( inv_table ); + init_atan_table( atan_table ); +} + + +void L1MetPfProducerHLS::produce(edm::StreamID, + edm::Event& iEvent, + const edm::EventSetup& iSetup) const { + + edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; + iEvent.getByToken(_l1PFToken, l1PFCandidates); + + + pxy_t hw_px = 0; + pxy_t hw_py = 0; + pxy_t hw_sumx = 0; + pxy_t hw_sumy = 0; + + for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands; i++){ + const auto& l1PFCand = l1PFCandidates->at(i); + + pt_t hw_pt = l1PFCand.pt() / pt_lsb; + phi_t hw_phi = TVector2::Phi_mpi_pi( l1PFCand.phi()) / phi_lsb; + + ProjX(hw_pt, hw_phi, hw_px); + ProjY(hw_pt, hw_phi, hw_py); + + hw_sumx = hw_sumx + hw_px; + hw_sumy = hw_sumy + hw_py; + } + + pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); + //int x = hw_met; // cast + hw_met = sqrt( int(hw_met) ); // FIXME + + phi_t hw_met_phi = 0; + PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); + + reco::Candidate::PolarLorentzVector metVector; + metVector.SetPt( hw_met * pt_lsb ); + metVector.SetPhi( hw_met_phi * phi_lsb ); + metVector.SetEta(0); + l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); + + //std::cout << "HLS metVector: " << metVector.pt() << std::endl; + + std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); + metCollection->push_back(theMET); + iEvent.put(std::move(metCollection)); //, "myMetCollection"); + +} + +void L1MetPfProducerHLS::init_projx_table(pt_t table_out[PROJ_TAB_SIZE]) { + // Return table of cos(phi) where phi is in (0,pi/2) + // multiply result by 2^(PT_SIZE) (equal to 1 in our units) + for (int i = 0; i < PROJ_TAB_SIZE; i++) { + //store result, guarding overflow near costheta=1 + pt2_t x = round((1<<PT_SIZE) * cos(float(i)/PROJ_TAB_SIZE * M_PI/2)); + // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) + if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; + else table_out[i] = x; + } + return; +} + +void L1MetPfProducerHLS::ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug) const{ + //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) + ap_uint<PHI_SIZE-2> phiQ1 = phi; + if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + + // get x component and flip sign if necessary + x = (pt * cos_table[phiQ1]) >> PT_SIZE; + if(debug) std::cout << pt << " cos_table[" << phiQ1 << "] = " << cos_table[phiQ1] << " " << x << std::endl; + if( phi>=(1<<(PHI_SIZE-2)) + || phi<-(1<<(PHI_SIZE-2))) + x = -x; + + return; +} + +void L1MetPfProducerHLS::init_projy_table(pt_t table_out[PROJ_TAB_SIZE]) { + for (int i = 0; i < PROJ_TAB_SIZE; i++) { + pt2_t x = round((1<<PT_SIZE) * sin(float(i)/PROJ_TAB_SIZE * M_PI/2)); + if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; + else table_out[i] = x; + } + return; +} + +void L1MetPfProducerHLS::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ + + //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) + ap_uint<PHI_SIZE-2> phiQ1 = phi; + if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + + // get y component and flip sign if necessary + y = (pt * sin_table[phiQ1]) >> PT_SIZE; + if(debug) std::cout << pt << " sin_table[" << phiQ1 << "] = " << sin_table[phiQ1] << " " << y << std::endl; + if( phi<0 ) y = -y; + + return; +} + +void L1MetPfProducerHLS::init_inv_table(pt_t table_out[INV_TAB_SIZE]) { + // multiply result by 1=2^(PT-SIZE) + table_out[0]=(1<<PT_SIZE)-1; + for (int i = 1; i < INV_TAB_SIZE; i++) { + table_out[i] = round((1<<PT_SIZE) / float(i)); + } + return; +} +void L1MetPfProducerHLS::init_atan_table(pt_t table_out[ATAN_TAB_SIZE]) { + // multiply result by 1=2^(PT-SIZE) + table_out[0]=int(0); + for (int i = 1; i < ATAN_TAB_SIZE; i++) { + table_out[i] = int(round(atan(float(i)/ATAN_TAB_SIZE) * (1<<(PHI_SIZE-3)) / (M_PI/4))); + } + return; +} + +void L1MetPfProducerHLS::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ + if(px==0 && py==0){ phi = 0; return; } + + // get q1 coordinates + pt_t x = px; //px>=0 ? px : -px; + pt_t y = py; //py>=0 ? py : -py; + if(px<0) x = -px; + if(py<0) y = -py; + // transform so a<b + pt_t a = x; //x<y ? x : y; + pt_t b = y; //x<y ? y : x; + if(a>b){ a = y; b = x; } + + pt_t inv_b; + if(b>= (1<<(PT_SIZE-DROP_BITS))) inv_b = 1; + // don't bother to store these large numbers in the LUT... + // instead approximate their inverses as 1 + else inv_b = inv_table[b]; + + pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) + ap_uint<ATAN_SIZE> atan_index = a_over_b >> (PT_SIZE-ATAN_SIZE); // keep only most significant bits + phi = atan_table[atan_index]; + + // rotate from (0,pi/4) to full quad1 + if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi + // other quadrants + if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi + if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi + if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both + + return; +} + +L1MetPfProducerHLS::~L1MetPfProducerHLS() {} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(L1MetPfProducerHLS); diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py new file mode 100644 index 0000000000000..3923c9819da2c --- /dev/null +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +# L1MetPfProducer = cms.EDProducer("L1MetPfProducer", +L1MetPfProducer = cms.EDProducer("L1MetPfProducerHLS", + L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates") +) From eaeba68eec78b3fa2d527a37cb74cc2ebd88a86a Mon Sep 17 00:00:00 2001 From: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Date: Tue, 16 Mar 2021 04:26:29 +0100 Subject: [PATCH 148/309] first complete version of the cmssw emulator (cherry picked from commit 3a9823f06b0b3b22a675106ba793629d1cff74b6) --- .../plugins/L1MetPfProducer.cc | 260 ++++-------------- .../plugins/L1MetPfProducerHLS.cc | 1 - .../python/L1MetPfProducer_cfi.py | 6 +- 3 files changed, 58 insertions(+), 209 deletions(-) diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc index a7bf736fd6328..20f779fc22143 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc @@ -12,40 +12,8 @@ #include "DataFormats/L1Trigger/interface/EtSum.h" #include "DataFormats/Math/interface/LorentzVector.h" - using namespace l1t; -// sizes in bits -typedef ap_ufixed<14, 12, AP_RND, AP_SAT> pt_t; -typedef ap_int<11> phi_t; -constexpr float LSB_PHI = M_PI/720; - -// helpers -typedef ap_fixed<pt_t::width+1, pt_t::iwidth+1, AP_RND, AP_SAT> pxy_t; -typedef ap_ufixed<2*pt_t::width, 2*pt_t::iwidth, AP_RND, AP_SAT> pt2_t; -typedef ap_ufixed<pt_t::width, pt_t::iwidth, pt_t::qmode, AP_WRAP> pt_wrap_t; - -// LUT sizes for trig functions -constexpr uint PROJ_TAB_BITS = 8; // configurable -constexpr uint PROJ_TAB_SIZE = (1<<PROJ_TAB_BITS); -constexpr uint INV_TAB_BITS = 10; -constexpr uint INV_TAB_SIZE = (1<<INV_TAB_BITS); - -// constexpr uint PT_SIZE = 16; -// constexpr uint PHI_SIZE = 10; -// constexpr uint PT2_SIZE = 2*PT_SIZE; -//constexpr uint PT_DEC_BITS = 2; -// typedef ap_uint<PT_SIZE> pt_t; -// typedef ap_int<PT_SIZE+1> pxy_t; -// typedef ap_uint<PT2_SIZE> pt2_t; -// typedef ap_int<PHI_SIZE> phi_t; - - -// typedef ap_ufixed<16,2> pt_t; -// typedef ap_fixed<16,2> pxy_t; -// typedef ap_int<10> phi_t; -// ... - class L1MetPfProducer : public edm::global::EDProducer<> { public: explicit L1MetPfProducer(const edm::ParameterSet&); @@ -55,173 +23,30 @@ class L1MetPfProducer : public edm::global::EDProducer<> { void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; - // const int pi_hw = (1<<(phi_t::width-1)); - - // static float px_table[PROJ_TAB_SIZE]; - // static float py_table[PROJ_TAB_SIZE]; - - //void initProjXTable() const; - - pxy_t Project(const pt_t pt, const phi_t phi, const bool doX) const; - - // pxy_t ProjY(const pt_t pt, const phi_t phi) const; - // phi_t PhiFromXY(const pxy_t x, const pxy_t y, const pt_t pt) const; - phi_t PhiFromXY(const pxy_t x, const pxy_t y) const; - + long unsigned int maxCands_=128; + const float maxPt_ = (1<<14); + const float inverseMax_ = (1<<12); // pt bits - drop bits + const float pt_lsb = 0.25; // GeV + const float phi_lsb = M_PI/720; // rad + + // LUT sizes for trig functions + static const int PROJ_TAB_SIZE = (1<<8); + static const int DROP_BITS = 2; + static const int ATAN_TAB_SIZE = (1<<7); + + inline double quantize(double value, double to_integer) const { + return round(value * to_integer) / to_integer; + }; + inline double bound(double value, double min, double max) const { + return value > max ? max : (value < min ? min : value); + }; }; -// void L1MetPfProducer::initProjXTable() const { -// // Return table of cos(phi) where phi is in (0,pi/2) -// // multiply result by 2^(PT_SIZE) (equal to 1 in our units) -// for (uint i = 0; i < PROJ_TAB_SIZE; i++) { -// //store result, guarding overflow near costheta=1 -// pt2_t x = round((1<<PT_SIZE) * cos(float(i)/PROJ_TAB_SIZE * M_PI/2)); -// // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) -// if(x >= (1<<PT_SIZE)) px_table[i] = (1<<PT_SIZE)-1; -// else px_table[i] = x; -// } -// } L1MetPfProducer::L1MetPfProducer(const edm::ParameterSet& cfg) : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))) { produces<std::vector<l1t::EtSum> >(); - //initProjXTable(); -} - - -pxy_t L1MetPfProducer::Project(const pt_t pt, const phi_t phi, const bool doX) const { - - //map phi to the equivalent first quadrant value: range [0, 2^(phi_t::width-2)) i.e. [0,pi/2) - ap_uint<phi_t::width-2> phiQ1 = phi; - if(phi>=(1<<(phi_t::width-2))) phiQ1 = (1<<(phi_t::width-2)) -1 - phiQ1; // map e.g. 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(phi_t::width-2))) phiQ1 = (1<<(phi_t::width-2)) -1 - phiQ1; // map e.g. -64-1 (0-63) to 63-0 - - // Lut stores cos(x) for x in [0,pi/2), steps of pi/2 * 1/PROJ_TAB_SIZE - int index = phiQ1.to_int(); - if(phi_t::width-2 > PROJ_TAB_BITS) - index = index >> (phi_t::width-2 - PROJ_TAB_BITS); - if(phi_t::width-2 < PROJ_TAB_BITS){ - // silly, this table has more entries than possible values of phi!! - index = index << (PROJ_TAB_BITS - phi_t::width-2); - } - float fPhi = index/PROJ_TAB_SIZE * M_PI/2; - float fCosSin = doX ? cos(fPhi) : sin(fPhi); - pxy_t pxy = pt_t(pt_t::width * fCosSin); - if(doX){ - // -px for theta>pi/2, theta<-pi/2 - if( phi>=(1<<(phi_t::width-2)) || phi<-(1<<(phi_t::width-2))) pxy = -pxy; - } else { - // -py for theta<0 - if( phi<0 ) pxy = -pxy; - } - - return pxy; -} - -// pxy_t L1MetPfProducer::ProjY(const pt_t pt, const phi_t phi) const { -// return 0; -// } - - -// phi_t L1MetPfProducer::PhiFromXY(const pxy_t px, const pxy_t py) const { -// if(px==0 && py==0) return 0; - -// // get Q1 coordinates -// pt_t x = px; //px>=0 ? px : -px; -// pt_t y = py; //py>=0 ? py : -py; -// if(px<0) x = -px; -// if(py<0) y = -py; -// // transform so a<b -// pt_t a = x; //x<y ? x : y; -// pt_t b = y; //x<y ? y : x; -// if(a>b){ a = y; b = x; } - -// pt_t inv_b; -// const uint DROP_BITS = 2; -// if(b>= (1<<(pt_t::iwidth-DROP_BITS))) inv_b = 1; -// // don't bother to store these large numbers in the LUT... -// // instead approximate their inverses as 1 -// else inv_b = inv_table[b]; - -// pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) -// ap_uint<ATAN_SIZE> atan_index = a_over_b >> (PT_SIZE-ATAN_SIZE); // keep only most significant bits -// phi = atan_table[atan_index]; - -// // rotate from (0,pi/4) to full quad1 -// if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi -// // other quadrants -// if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi -// if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi -// if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both - -// } - -phi_t L1MetPfProducer::PhiFromXY(const pxy_t px, const pxy_t py) const { - // // First, get px/pt - // pt_wrap_t wPx = px>0 ? px : -px; - // pt_wrap_t wPt = pt; - - // pt_wrap_t wInvPt = (1<<pt_t::iwidth) / pt.to_float(); // from LUT - // pt_wrap_t wPxOverPt = pt_wrap_t(px) * wInvPt; - - // inversion table covers [0,2^12 TeV] with indices [0,INV_TAB_SIZE) - // intPt = pt. - - //typedef pt_wrap_t ap_ufixed<pt_t::width, pt_t::iwidth, pt_t::qmode, AP_WRAP>; - - if(px==0 && py==0) return 0; - - // Lookup atan in relatively narrow range [0,pi/4) to avoid having a big table for no reason - pxy_t maxXY = max( fabs(px.to_float()), fabs(py.to_float()) ); - pxy_t minXY = min( fabs(px.to_float()), fabs(py.to_float()) ); - - // set large number's inverses to 1 directly instead of storing in LUT - const uint DROP_BITS = 2; - const int fixed_to_int = 1<< (pt_t::width - pt_t::iwidth); - pt_wrap_t wInvMax = 1./fixed_to_int; // just set LSB - if(maxXY < (1<<(pt_t::iwidth-DROP_BITS))){ - // emulate LUT - int int_maxXY = round(maxXY.to_float() * fixed_to_int); - int index_inv = int_maxXY; - if(pt_t::width-DROP_BITS > INV_TAB_BITS) index_inv = index_inv >> ((pt_t::width-DROP_BITS) - INV_TAB_BITS); - if(pt_t::width-DROP_BITS < INV_TAB_BITS) index_inv = index_inv << (INV_TAB_BITS - (pt_t::width-DROP_BITS)); - wInvMax = (INV_TAB_SIZE / index_inv) * pt_t::width; - } - - pt_wrap_t wMinOverMax = minXY * wInvMax; - - // convert py/px (or vice versa) to an angle in [0,pi/4) - phi_t phi = atan(wMinOverMax.to_float() / (1<<pt_t::iwidth)) / LSB_PHI; - - if(py>px) phi = (1<<(phi_t::width-2)) - phi; // rotate to [pi/4,pi/2) - if( px < 0 && py > 0 ) phi = (1<<(phi_t::width-1)) - phi; // Q2 phi = pi - phi - if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi - if( px < 0 && py < 0 ) phi = -((1<<(phi_t::width-1)) - phi); // Q3 composition of both - - return phi; - - /* - // get integer representation of pt to mimic the index lookup used in the inversion table - int to_int = 1<< (pt_t::width - pt_t::iwidth); - int int_pt = round(pt.to_float() * to_int); - int index_inv = int_pt; - if(pt_t::width > INV_TAB_BITS) index_inv = index_inv >> (pt_t::width - INV_TAB_BITS); - if(pt_t::width < INV_TAB_BITS) index_inv = index_inv << (INV_TAB_BITS - pt_t::width); - pt_wrap_t wInvPt = round(((1<<pt_t::iwidth)-1) * float(index)/INV_TAB_SIZE); - // get px/pt to convert to phi w/ acos - pt_wrap_t wPxOverPt = pt_wrap_t(px) * wInvPt; - phi_t phi = acos(wPxOverPt.to_float() / (1<<pt_t::iwidth)) / LSB_PHI; - */ - - // phi is in [0,pi/4) - - // int max_int_pt = (1<<pt_t::width); - // int int_inv_pt = max_int_pt/int_pt; - - // uint index = x.round((1<<PT_SIZE) / float(i)); - - //return 0; } void L1MetPfProducer::produce(edm::StreamID, @@ -232,31 +57,54 @@ void L1MetPfProducer::produce(edm::StreamID, iEvent.getByToken(_l1PFToken, l1PFCandidates); // to cleanup - long unsigned int maxCands_=128; - float x=0; - float y=0; - pxy_t hw_px = 0; - pxy_t hw_py = 0; + float sumx = 0; + float sumy = 0; for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands_; i++){ const auto& l1PFCand = l1PFCandidates->at(i); + + // quantize inputs - pt_t hw_pt = l1PFCand.pt(); - phi_t hw_phi = TVector2::Phi_mpi_pi( l1PFCand.phi()) / LSB_PHI; + float pt = quantize(l1PFCand.pt(), 1./pt_lsb); + if (pt > maxPt_) pt = maxPt_; + + float phi = quantize( TVector2::Phi_mpi_pi(l1PFCand.phi()), 1./phi_lsb); - hw_px += Project(hw_pt, hw_phi, /*doX*/ true); - hw_py += Project(hw_pt, hw_phi, /*doX*/ false); + // LUTs correspond to Q1 only to allow a smaller number of entries + float table_phi = quantize(phi, PROJ_TAB_SIZE/(M_PI/2)); + + float px = quantize( pt * cos(table_phi), 1./pt_lsb); + float py = quantize( pt * sin(table_phi), 1./pt_lsb); + + sumx = quantize(sumx + px, 1./pt_lsb); + sumy = quantize(sumy + py, 1./pt_lsb); + if( fabs(sumx) > maxPt_ ) sumx = maxPt_ * (sumx>0 ? 1 : -1); + if( fabs(sumy) > maxPt_ ) sumy = maxPt_ * (sumy>0 ? 1 : -1); } - pt2_t hw_met = pt2_t(hw_px)*pt2_t(hw_px) + pt2_t(hw_py)*pt2_t(hw_py); - hw_met = sqrt( hw_met.to_float() ); // FIXME + float met = quantize(pow(sumx,2) + pow(sumy,2), 1./(pt_lsb*pt_lsb)); + met = quantize(sqrt(met), 1./pt_lsb); // stand-in for HLS::sqrt function + if ( met > maxPt_ ) met = maxPt_; + + // to calculate arctan for evaluation in [0,pi/4), need two more LUTs for atan(py/px) + float numerator = min(fabs(sumx), fabs(sumy)); + float denominator = max(fabs(sumx), fabs(sumy)); + if (denominator > inverseMax_) denominator = inverseMax_; + // no add'l quantization needed, since we currently store inverse for all pt values below max + // ratio is stored in units of 1/max pt val + float met_phi = atan( quantize(numerator / denominator, ATAN_TAB_SIZE) ); + + // recover the full angle from [0,pi/4) + if( fabs(sumx) < fabs(sumy) ) met_phi = M_PI/2 - met_phi; // to [0,pi/2) + if ( sumx < 0 ) met_phi = M_PI - met_phi; // to [0,pi) + if ( sumy < 0 ) met_phi = - met_phi; // to [-pi,pi) + met_phi = quantize(met_phi, 1./phi_lsb); - phi_t hw_met_phi = 0;//PhiFromXY(hw_px, hw_py, hw_met); reco::Candidate::PolarLorentzVector metVector; - metVector.SetPt( hw_met.to_float() ); - metVector.SetPhi( hw_met_phi * LSB_PHI ); + metVector.SetPt( met ); + metVector.SetPhi( met_phi ); metVector.SetEta(0); l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc index 86ca4570550eb..03faf52f370fd 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc @@ -25,7 +25,6 @@ class L1MetPfProducerHLS : public edm::global::EDProducer<> { long unsigned int maxCands=128; - // quantization controllers static constexpr uint PT_SIZE = 16; static constexpr uint PT2_SIZE = 2*PT_SIZE; diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py index 3923c9819da2c..1afecadb3886c 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py @@ -1,6 +1,8 @@ import FWCore.ParameterSet.Config as cms -# L1MetPfProducer = cms.EDProducer("L1MetPfProducer", -L1MetPfProducer = cms.EDProducer("L1MetPfProducerHLS", +L1MetPfProducer = cms.EDProducer("L1MetPfProducer", + L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates") +) +L1MetPfProducerHLS = cms.EDProducer("L1MetPfProducerHLS", L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates") ) From 30fa8fbd01dd1534ee11ee44873b805ce188bae0 Mon Sep 17 00:00:00 2001 From: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Date: Wed, 17 Mar 2021 06:04:31 +0100 Subject: [PATCH 149/309] combine met emulator variants into a single plugin (cherry picked from commit 6d654237d3a6967b3fb70ab626fb6d7be72950fb) --- .../plugins/L1MetPfProducer.cc | 286 ++++++++++++++---- .../plugins/L1MetPfProducerHLS.cc | 226 -------------- .../python/L1MetPfProducer_cfi.py | 3 - 3 files changed, 233 insertions(+), 282 deletions(-) delete mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc index 20f779fc22143..7d8039359ad83 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc @@ -22,31 +22,71 @@ class L1MetPfProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; + + long unsigned int maxCands=128; + + // quantization controllers + static constexpr uint PT_SIZE = 16; + static constexpr uint PT2_SIZE = 2*PT_SIZE; + static constexpr uint PT_DEC_BITS = 2; + static constexpr uint PHI_SIZE = 10; + typedef ap_uint<PT_SIZE> pt_t; + typedef ap_int<PT_SIZE+1> pxy_t; + typedef ap_uint<PT2_SIZE> pt2_t; + typedef ap_int<PHI_SIZE> phi_t; + const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV + const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad - long unsigned int maxCands_=128; - const float maxPt_ = (1<<14); - const float inverseMax_ = (1<<12); // pt bits - drop bits - const float pt_lsb = 0.25; // GeV - const float phi_lsb = M_PI/720; // rad + // for LUTs + static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); + static constexpr int DROP_BITS = 2; + static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); + static constexpr int ATAN_SIZE = (PHI_SIZE-3); + static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); - // LUT sizes for trig functions - static const int PROJ_TAB_SIZE = (1<<8); - static const int DROP_BITS = 2; - static const int ATAN_TAB_SIZE = (1<<7); + //static pt_t cos_table[PROJ_TAB_SIZE]; + pt_t cos_table[PROJ_TAB_SIZE]; + pt_t sin_table[PROJ_TAB_SIZE]; + pt_t inv_table[INV_TAB_SIZE]; + pt_t atan_table[ATAN_TAB_SIZE]; + void init_projx_table(pt_t table_out[PROJ_TAB_SIZE]); + void init_projy_table(pt_t table_out[PROJ_TAB_SIZE]); + void init_inv_table(pt_t table_out[INV_TAB_SIZE]); + void init_atan_table(pt_t table_out[ATAN_TAB_SIZE]); + void ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug=false) const; + void ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug=false) const; + void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; + + void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const; + + void CalcMetFast(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const; + + bool useHLS=true; + + // for alternate floating-pt implementation + const float maxPt_ = (1<<(PT_SIZE-PT_DEC_BITS)); + const float inverseMax_ = (1<<(PT_SIZE-DROP_BITS)); + inline double quantize(double value, double to_integer) const { return round(value * to_integer) / to_integer; }; inline double bound(double value, double min, double max) const { return value > max ? max : (value < min ? min : value); }; -}; +}; L1MetPfProducer::L1MetPfProducer(const edm::ParameterSet& cfg) : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))) { produces<std::vector<l1t::EtSum> >(); + init_projx_table( cos_table ); + init_projy_table( sin_table ); + init_inv_table( inv_table ); + init_atan_table( atan_table ); } void L1MetPfProducer::produce(edm::StreamID, @@ -56,64 +96,204 @@ void L1MetPfProducer::produce(edm::StreamID, edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; iEvent.getByToken(_l1PFToken, l1PFCandidates); - // to cleanup + std::vector<float> pt; + std::vector<float> phi; - float sumx = 0; - float sumy = 0; - - for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands_; i++){ + for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands; i++){ const auto& l1PFCand = l1PFCandidates->at(i); + pt.push_back( l1PFCand.pt() ); + phi.push_back( l1PFCand.phi() ); + } - // quantize inputs + reco::Candidate::PolarLorentzVector metVector; + + if(useHLS) CalcMetHLS(pt, phi, metVector); + else CalcMetFast(pt, phi, metVector); - float pt = quantize(l1PFCand.pt(), 1./pt_lsb); - if (pt > maxPt_) pt = maxPt_; + l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); - float phi = quantize( TVector2::Phi_mpi_pi(l1PFCand.phi()), 1./phi_lsb); + std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); + metCollection->push_back(theMET); + iEvent.put(std::move(metCollection)); +} - // LUTs correspond to Q1 only to allow a smaller number of entries - float table_phi = quantize(phi, PROJ_TAB_SIZE/(M_PI/2)); +void L1MetPfProducer::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const{ + pxy_t hw_px = 0; + pxy_t hw_py = 0; + pxy_t hw_sumx = 0; + pxy_t hw_sumy = 0; - float px = quantize( pt * cos(table_phi), 1./pt_lsb); - float py = quantize( pt * sin(table_phi), 1./pt_lsb); + for(uint i=0; i< pt.size(); i++){ + pt_t hw_pt = pt[i] / pt_lsb; + phi_t hw_phi = TVector2::Phi_mpi_pi( phi[i] ) / phi_lsb; + + ProjX(hw_pt, hw_phi, hw_px); + ProjY(hw_pt, hw_phi, hw_py); - sumx = quantize(sumx + px, 1./pt_lsb); - sumy = quantize(sumy + py, 1./pt_lsb); - if( fabs(sumx) > maxPt_ ) sumx = maxPt_ * (sumx>0 ? 1 : -1); - if( fabs(sumy) > maxPt_ ) sumy = maxPt_ * (sumy>0 ? 1 : -1); - } + hw_sumx = hw_sumx + hw_px; + hw_sumy = hw_sumy + hw_py; + } + + pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); + hw_met = sqrt( int(hw_met) ); // stand-in for HLS::sqrt + + phi_t hw_met_phi = 0; + PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); + + metVector.SetPt( hw_met * pt_lsb ); + metVector.SetPhi( hw_met_phi * phi_lsb ); + metVector.SetEta(0); +} + + +void L1MetPfProducer::CalcMetFast(std::vector<float> pt_vec, std::vector<float> phi_vec, + reco::Candidate::PolarLorentzVector &metVector) const{ + float sumx = 0; + float sumy = 0; + + for(uint i=0; i< pt_vec.size(); i++){ + float pt = quantize( pt_vec[i], 1./pt_lsb); + if (pt > maxPt_) pt = maxPt_; + + float phi = quantize( TVector2::Phi_mpi_pi(phi_vec[i]), 1./phi_lsb); - float met = quantize(pow(sumx,2) + pow(sumy,2), 1./(pt_lsb*pt_lsb)); - met = quantize(sqrt(met), 1./pt_lsb); // stand-in for HLS::sqrt function - if ( met > maxPt_ ) met = maxPt_; - - // to calculate arctan for evaluation in [0,pi/4), need two more LUTs for atan(py/px) - float numerator = min(fabs(sumx), fabs(sumy)); - float denominator = max(fabs(sumx), fabs(sumy)); - if (denominator > inverseMax_) denominator = inverseMax_; - // no add'l quantization needed, since we currently store inverse for all pt values below max - // ratio is stored in units of 1/max pt val - float met_phi = atan( quantize(numerator / denominator, ATAN_TAB_SIZE) ); + // LUTs correspond to Q1 only to allow a smaller number of entries + float table_phi = quantize(phi, PROJ_TAB_SIZE/(M_PI/2)); + + float px = quantize( pt * cos(table_phi), 1./pt_lsb); + float py = quantize( pt * sin(table_phi), 1./pt_lsb); + + sumx = quantize(sumx + px, 1./pt_lsb); + sumy = quantize(sumy + py, 1./pt_lsb); + if( fabs(sumx) > maxPt_ ) sumx = maxPt_ * (sumx>0 ? 1 : -1); + if( fabs(sumy) > maxPt_ ) sumy = maxPt_ * (sumy>0 ? 1 : -1); + } + + float met = quantize(pow(sumx,2) + pow(sumy,2), 1./(pt_lsb*pt_lsb)); + met = quantize(sqrt(met), 1./pt_lsb); // stand-in for HLS::sqrt function + if ( met > maxPt_ ) met = maxPt_; + + // to calculate arctan for evaluation in [0,pi/4), need two more LUTs for atan(py/px) + float numerator = min(fabs(sumx), fabs(sumy)); + float denominator = max(fabs(sumx), fabs(sumy)); + if (denominator > inverseMax_) denominator = inverseMax_; + // no add'l quantization needed, since we currently store inverse for all pt values below max + // ratio is stored in units of 1/max pt val + float met_phi = atan( quantize(numerator / denominator, ATAN_TAB_SIZE) ); - // recover the full angle from [0,pi/4) - if( fabs(sumx) < fabs(sumy) ) met_phi = M_PI/2 - met_phi; // to [0,pi/2) - if ( sumx < 0 ) met_phi = M_PI - met_phi; // to [0,pi) - if ( sumy < 0 ) met_phi = - met_phi; // to [-pi,pi) - met_phi = quantize(met_phi, 1./phi_lsb); + // recover the full angle from [0,pi/4) + if( fabs(sumx) < fabs(sumy) ) met_phi = M_PI/2 - met_phi; // to [0,pi/2) + if ( sumx < 0 ) met_phi = M_PI - met_phi; // to [0,pi) + if ( sumy < 0 ) met_phi = - met_phi; // to [-pi,pi) + met_phi = quantize(met_phi, 1./phi_lsb); + metVector.SetPt( met ); + metVector.SetPhi( met_phi ); + metVector.SetEta(0); +} - reco::Candidate::PolarLorentzVector metVector; - metVector.SetPt( met ); - metVector.SetPhi( met_phi ); - metVector.SetEta(0); - l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); +void L1MetPfProducer::init_projx_table(pt_t table_out[PROJ_TAB_SIZE]) { + // Return table of cos(phi) where phi is in (0,pi/2) + // multiply result by 2^(PT_SIZE) (equal to 1 in our units) + for (int i = 0; i < PROJ_TAB_SIZE; i++) { + //store result, guarding overflow near costheta=1 + pt2_t x = round((1<<PT_SIZE) * cos(float(i)/PROJ_TAB_SIZE * M_PI/2)); + // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) + if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; + else table_out[i] = x; + } + return; +} - std::cout << "metVector: " << metVector.pt() << std::endl; +void L1MetPfProducer::ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug) const{ + //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) + ap_uint<PHI_SIZE-2> phiQ1 = phi; + if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 - std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); - metCollection->push_back(theMET); - iEvent.put(std::move(metCollection)); //, "myMetCollection"); + // get x component and flip sign if necessary + x = (pt * cos_table[phiQ1]) >> PT_SIZE; + if(debug) std::cout << pt << " cos_table[" << phiQ1 << "] = " << cos_table[phiQ1] << " " << x << std::endl; + if( phi>=(1<<(PHI_SIZE-2)) + || phi<-(1<<(PHI_SIZE-2))) + x = -x; + + return; +} + +void L1MetPfProducer::init_projy_table(pt_t table_out[PROJ_TAB_SIZE]) { + for (int i = 0; i < PROJ_TAB_SIZE; i++) { + pt2_t x = round((1<<PT_SIZE) * sin(float(i)/PROJ_TAB_SIZE * M_PI/2)); + if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; + else table_out[i] = x; + } + return; +} + +void L1MetPfProducer::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ + + //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) + ap_uint<PHI_SIZE-2> phiQ1 = phi; + if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + + // get y component and flip sign if necessary + y = (pt * sin_table[phiQ1]) >> PT_SIZE; + if(debug) std::cout << pt << " sin_table[" << phiQ1 << "] = " << sin_table[phiQ1] << " " << y << std::endl; + if( phi<0 ) y = -y; + + return; +} + +void L1MetPfProducer::init_inv_table(pt_t table_out[INV_TAB_SIZE]) { + // multiply result by 1=2^(PT-SIZE) + table_out[0]=(1<<PT_SIZE)-1; + for (int i = 1; i < INV_TAB_SIZE; i++) { + table_out[i] = round((1<<PT_SIZE) / float(i)); + } + return; +} +void L1MetPfProducer::init_atan_table(pt_t table_out[ATAN_TAB_SIZE]) { + // multiply result by 1=2^(PT-SIZE) + table_out[0]=int(0); + for (int i = 1; i < ATAN_TAB_SIZE; i++) { + table_out[i] = int(round(atan(float(i)/ATAN_TAB_SIZE) * (1<<(PHI_SIZE-3)) / (M_PI/4))); + } + return; +} + +void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ + if(px==0 && py==0){ phi = 0; return; } + + // get q1 coordinates + pt_t x = px; //px>=0 ? px : -px; + pt_t y = py; //py>=0 ? py : -py; + if(px<0) x = -px; + if(py<0) y = -py; + // transform so a<b + pt_t a = x; //x<y ? x : y; + pt_t b = y; //x<y ? y : x; + if(a>b){ a = y; b = x; } + + pt_t inv_b; + if(b>= (1<<(PT_SIZE-DROP_BITS))) inv_b = 1; + // don't bother to store these large numbers in the LUT... + // instead approximate their inverses as 1 + else inv_b = inv_table[b]; + + pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) + ap_uint<ATAN_SIZE> atan_index = a_over_b >> (PT_SIZE-ATAN_SIZE); // keep only most significant bits + phi = atan_table[atan_index]; + + // rotate from (0,pi/4) to full quad1 + if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi + // other quadrants + if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi + if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi + if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both + return; } L1MetPfProducer::~L1MetPfProducer() {} diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc deleted file mode 100644 index 03faf52f370fd..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerHLS.cc +++ /dev/null @@ -1,226 +0,0 @@ -#include <vector> -#include <ap_int.h> -#include <ap_fixed.h> -#include <TVector2.h> - -#include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" -#include "DataFormats/L1Trigger/interface/EtSum.h" -#include "DataFormats/Math/interface/LorentzVector.h" - -using namespace l1t; - -class L1MetPfProducerHLS : public edm::global::EDProducer<> { -public: - explicit L1MetPfProducerHLS(const edm::ParameterSet&); - ~L1MetPfProducerHLS() override; - -private: - void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; - edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; - - long unsigned int maxCands=128; - - // quantization controllers - static constexpr uint PT_SIZE = 16; - static constexpr uint PT2_SIZE = 2*PT_SIZE; - static constexpr uint PT_DEC_BITS = 2; - static constexpr uint PHI_SIZE = 10; - typedef ap_uint<PT_SIZE> pt_t; - typedef ap_int<PT_SIZE+1> pxy_t; - typedef ap_uint<PT2_SIZE> pt2_t; - typedef ap_int<PHI_SIZE> phi_t; - const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV - const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad - - // for LUTs - static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); - static constexpr int DROP_BITS = 2; - static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); - static constexpr int ATAN_SIZE = (PHI_SIZE-3); - static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); - - //static pt_t cos_table[PROJ_TAB_SIZE]; - pt_t cos_table[PROJ_TAB_SIZE]; - pt_t sin_table[PROJ_TAB_SIZE]; - pt_t inv_table[INV_TAB_SIZE]; - pt_t atan_table[ATAN_TAB_SIZE]; - void init_projx_table(pt_t table_out[PROJ_TAB_SIZE]); - void init_projy_table(pt_t table_out[PROJ_TAB_SIZE]); - void init_inv_table(pt_t table_out[INV_TAB_SIZE]); - void init_atan_table(pt_t table_out[ATAN_TAB_SIZE]); - - void ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug=false) const; - void ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug=false) const; - void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; -}; - -L1MetPfProducerHLS::L1MetPfProducerHLS(const edm::ParameterSet& cfg) - : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))) { - produces<std::vector<l1t::EtSum> >(); - - init_projx_table( cos_table ); - init_projy_table( sin_table ); - init_inv_table( inv_table ); - init_atan_table( atan_table ); -} - - -void L1MetPfProducerHLS::produce(edm::StreamID, - edm::Event& iEvent, - const edm::EventSetup& iSetup) const { - - edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; - iEvent.getByToken(_l1PFToken, l1PFCandidates); - - - pxy_t hw_px = 0; - pxy_t hw_py = 0; - pxy_t hw_sumx = 0; - pxy_t hw_sumy = 0; - - for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands; i++){ - const auto& l1PFCand = l1PFCandidates->at(i); - - pt_t hw_pt = l1PFCand.pt() / pt_lsb; - phi_t hw_phi = TVector2::Phi_mpi_pi( l1PFCand.phi()) / phi_lsb; - - ProjX(hw_pt, hw_phi, hw_px); - ProjY(hw_pt, hw_phi, hw_py); - - hw_sumx = hw_sumx + hw_px; - hw_sumy = hw_sumy + hw_py; - } - - pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); - //int x = hw_met; // cast - hw_met = sqrt( int(hw_met) ); // FIXME - - phi_t hw_met_phi = 0; - PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); - - reco::Candidate::PolarLorentzVector metVector; - metVector.SetPt( hw_met * pt_lsb ); - metVector.SetPhi( hw_met_phi * phi_lsb ); - metVector.SetEta(0); - l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); - - //std::cout << "HLS metVector: " << metVector.pt() << std::endl; - - std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); - metCollection->push_back(theMET); - iEvent.put(std::move(metCollection)); //, "myMetCollection"); - -} - -void L1MetPfProducerHLS::init_projx_table(pt_t table_out[PROJ_TAB_SIZE]) { - // Return table of cos(phi) where phi is in (0,pi/2) - // multiply result by 2^(PT_SIZE) (equal to 1 in our units) - for (int i = 0; i < PROJ_TAB_SIZE; i++) { - //store result, guarding overflow near costheta=1 - pt2_t x = round((1<<PT_SIZE) * cos(float(i)/PROJ_TAB_SIZE * M_PI/2)); - // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) - if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; - else table_out[i] = x; - } - return; -} - -void L1MetPfProducerHLS::ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug) const{ - //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) - ap_uint<PHI_SIZE-2> phiQ1 = phi; - if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 - - // get x component and flip sign if necessary - x = (pt * cos_table[phiQ1]) >> PT_SIZE; - if(debug) std::cout << pt << " cos_table[" << phiQ1 << "] = " << cos_table[phiQ1] << " " << x << std::endl; - if( phi>=(1<<(PHI_SIZE-2)) - || phi<-(1<<(PHI_SIZE-2))) - x = -x; - - return; -} - -void L1MetPfProducerHLS::init_projy_table(pt_t table_out[PROJ_TAB_SIZE]) { - for (int i = 0; i < PROJ_TAB_SIZE; i++) { - pt2_t x = round((1<<PT_SIZE) * sin(float(i)/PROJ_TAB_SIZE * M_PI/2)); - if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; - else table_out[i] = x; - } - return; -} - -void L1MetPfProducerHLS::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ - - //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) - ap_uint<PHI_SIZE-2> phiQ1 = phi; - if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 - - // get y component and flip sign if necessary - y = (pt * sin_table[phiQ1]) >> PT_SIZE; - if(debug) std::cout << pt << " sin_table[" << phiQ1 << "] = " << sin_table[phiQ1] << " " << y << std::endl; - if( phi<0 ) y = -y; - - return; -} - -void L1MetPfProducerHLS::init_inv_table(pt_t table_out[INV_TAB_SIZE]) { - // multiply result by 1=2^(PT-SIZE) - table_out[0]=(1<<PT_SIZE)-1; - for (int i = 1; i < INV_TAB_SIZE; i++) { - table_out[i] = round((1<<PT_SIZE) / float(i)); - } - return; -} -void L1MetPfProducerHLS::init_atan_table(pt_t table_out[ATAN_TAB_SIZE]) { - // multiply result by 1=2^(PT-SIZE) - table_out[0]=int(0); - for (int i = 1; i < ATAN_TAB_SIZE; i++) { - table_out[i] = int(round(atan(float(i)/ATAN_TAB_SIZE) * (1<<(PHI_SIZE-3)) / (M_PI/4))); - } - return; -} - -void L1MetPfProducerHLS::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ - if(px==0 && py==0){ phi = 0; return; } - - // get q1 coordinates - pt_t x = px; //px>=0 ? px : -px; - pt_t y = py; //py>=0 ? py : -py; - if(px<0) x = -px; - if(py<0) y = -py; - // transform so a<b - pt_t a = x; //x<y ? x : y; - pt_t b = y; //x<y ? y : x; - if(a>b){ a = y; b = x; } - - pt_t inv_b; - if(b>= (1<<(PT_SIZE-DROP_BITS))) inv_b = 1; - // don't bother to store these large numbers in the LUT... - // instead approximate their inverses as 1 - else inv_b = inv_table[b]; - - pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) - ap_uint<ATAN_SIZE> atan_index = a_over_b >> (PT_SIZE-ATAN_SIZE); // keep only most significant bits - phi = atan_table[atan_index]; - - // rotate from (0,pi/4) to full quad1 - if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi - // other quadrants - if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi - if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi - if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both - - return; -} - -L1MetPfProducerHLS::~L1MetPfProducerHLS() {} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(L1MetPfProducerHLS); diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py index 1afecadb3886c..76f244213a684 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py @@ -3,6 +3,3 @@ L1MetPfProducer = cms.EDProducer("L1MetPfProducer", L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates") ) -L1MetPfProducerHLS = cms.EDProducer("L1MetPfProducerHLS", - L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates") -) From 03a332b5e48f5e77c21417f368d4eba11748ab4b Mon Sep 17 00:00:00 2001 From: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Date: Wed, 24 Mar 2021 23:23:24 +0100 Subject: [PATCH 150/309] make table sizes configurable (cherry picked from commit 9d45304d9223572d0f178d7b97fbf323869a4997) --- .../plugins/L1MetPfProducer.cc | 114 +++++++++++------- .../python/L1MetPfProducer_cfi.py | 7 +- 2 files changed, 75 insertions(+), 46 deletions(-) diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc index 7d8039359ad83..8ab9aef6201cc 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc @@ -22,7 +22,7 @@ class L1MetPfProducer : public edm::global::EDProducer<> { private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; - + long unsigned int maxCands=128; // quantization controllers @@ -38,21 +38,27 @@ class L1MetPfProducer : public edm::global::EDProducer<> { const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad // for LUTs - static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); - static constexpr int DROP_BITS = 2; - static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); - static constexpr int ATAN_SIZE = (PHI_SIZE-3); - static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); - - //static pt_t cos_table[PROJ_TAB_SIZE]; - pt_t cos_table[PROJ_TAB_SIZE]; - pt_t sin_table[PROJ_TAB_SIZE]; - pt_t inv_table[INV_TAB_SIZE]; - pt_t atan_table[ATAN_TAB_SIZE]; - void init_projx_table(pt_t table_out[PROJ_TAB_SIZE]); - void init_projy_table(pt_t table_out[PROJ_TAB_SIZE]); - void init_inv_table(pt_t table_out[INV_TAB_SIZE]); - void init_atan_table(pt_t table_out[ATAN_TAB_SIZE]); + // static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); + // static constexpr int DROP_BITS = 2; + // static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); + // static constexpr int ATAN_SIZE = (PHI_SIZE-3); + // static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); + + std::vector<pt_t> cos_table; + std::vector<pt_t> sin_table; + std::vector<pt_t> inv_table; + std::vector<pt_t> atan_table; + uint sinCosTableBits_; + uint sinCosTableSize_; + uint inverseDropBits_; + uint inversionTableSize_; + uint arcTanTableBits_; + uint arcTanTableSize_; + + void init_projx_table(std::vector<pt_t> table_out); + void init_projy_table(std::vector<pt_t> table_out); + void init_inv_table(std::vector<pt_t> table_out); + void init_atan_table(std::vector<pt_t> table_out); void ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug=false) const; void ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug=false) const; @@ -68,7 +74,7 @@ class L1MetPfProducer : public edm::global::EDProducer<> { // for alternate floating-pt implementation const float maxPt_ = (1<<(PT_SIZE-PT_DEC_BITS)); - const float inverseMax_ = (1<<(PT_SIZE-DROP_BITS)); + const float inverseMax_ = (1<<(PT_SIZE-inverseDropBits_)); inline double quantize(double value, double to_integer) const { return round(value * to_integer) / to_integer; @@ -80,9 +86,23 @@ class L1MetPfProducer : public edm::global::EDProducer<> { }; L1MetPfProducer::L1MetPfProducer(const edm::ParameterSet& cfg) - : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))) { + : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))), + sinCosTableBits_(cfg.getParameter<uint>("sinCosTableBits")), + inverseDropBits_(cfg.getParameter<uint>("inverseDropBits")), + arcTanTableBits_(cfg.getParameter<uint>("arcTanTableBits")) +{ produces<std::vector<l1t::EtSum> >(); - + + sinCosTableSize_ = 1<<sinCosTableBits_; + cos_table.resize(sinCosTableSize_); + sin_table.resize(sinCosTableSize_); + + inversionTableSize_ = (1<<(PT_SIZE-inverseDropBits_)); + inv_table.resize(inversionTableSize_); + + arcTanTableSize_ = 1<<arcTanTableBits_; + atan_table.resize(arcTanTableSize_); + init_projx_table( cos_table ); init_projy_table( sin_table ); init_inv_table( inv_table ); @@ -159,7 +179,7 @@ void L1MetPfProducer::CalcMetFast(std::vector<float> pt_vec, std::vector<float> float phi = quantize( TVector2::Phi_mpi_pi(phi_vec[i]), 1./phi_lsb); // LUTs correspond to Q1 only to allow a smaller number of entries - float table_phi = quantize(phi, PROJ_TAB_SIZE/(M_PI/2)); + float table_phi = quantize(phi, sinCosTableSize_/(M_PI/2)); float px = quantize( pt * cos(table_phi), 1./pt_lsb); float py = quantize( pt * sin(table_phi), 1./pt_lsb); @@ -180,7 +200,7 @@ void L1MetPfProducer::CalcMetFast(std::vector<float> pt_vec, std::vector<float> if (denominator > inverseMax_) denominator = inverseMax_; // no add'l quantization needed, since we currently store inverse for all pt values below max // ratio is stored in units of 1/max pt val - float met_phi = atan( quantize(numerator / denominator, ATAN_TAB_SIZE) ); + float met_phi = atan( quantize(numerator / denominator, arcTanTableSize_) ); // recover the full angle from [0,pi/4) if( fabs(sumx) < fabs(sumy) ) met_phi = M_PI/2 - met_phi; // to [0,pi/2) @@ -193,12 +213,12 @@ void L1MetPfProducer::CalcMetFast(std::vector<float> pt_vec, std::vector<float> metVector.SetEta(0); } -void L1MetPfProducer::init_projx_table(pt_t table_out[PROJ_TAB_SIZE]) { +void L1MetPfProducer::init_projx_table(std::vector<pt_t> table_out) { // Return table of cos(phi) where phi is in (0,pi/2) // multiply result by 2^(PT_SIZE) (equal to 1 in our units) - for (int i = 0; i < PROJ_TAB_SIZE; i++) { + for (uint i = 0; i < sinCosTableSize_; i++) { //store result, guarding overflow near costheta=1 - pt2_t x = round((1<<PT_SIZE) * cos(float(i)/PROJ_TAB_SIZE * M_PI/2)); + pt2_t x = round((1<<PT_SIZE) * cos(float(i)/sinCosTableSize_ * M_PI/2)); // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; else table_out[i] = x; @@ -207,24 +227,26 @@ void L1MetPfProducer::init_projx_table(pt_t table_out[PROJ_TAB_SIZE]) { } void L1MetPfProducer::ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug) const{ - //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) - ap_uint<PHI_SIZE-2> phiQ1 = phi; - if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) + //ap_uint<sinCosTableBits_> phiQ1 = phi; // not constexpr + ap_uint<PHI_SIZE> phiQ1 = phi; + // int phiQ1 = phi >= sinCosTableSize_ ? sinCosTableSize_-1 : int(phi); + if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 // get x component and flip sign if necessary x = (pt * cos_table[phiQ1]) >> PT_SIZE; if(debug) std::cout << pt << " cos_table[" << phiQ1 << "] = " << cos_table[phiQ1] << " " << x << std::endl; - if( phi>=(1<<(PHI_SIZE-2)) - || phi<-(1<<(PHI_SIZE-2))) + if( phi>=(1<<(sinCosTableBits_)) + || phi<-(1<<(sinCosTableBits_))) x = -x; return; } -void L1MetPfProducer::init_projy_table(pt_t table_out[PROJ_TAB_SIZE]) { - for (int i = 0; i < PROJ_TAB_SIZE; i++) { - pt2_t x = round((1<<PT_SIZE) * sin(float(i)/PROJ_TAB_SIZE * M_PI/2)); +void L1MetPfProducer::init_projy_table(std::vector<pt_t> table_out) { + for (uint i = 0; i < sinCosTableSize_; i++) { + pt2_t x = round((1<<PT_SIZE) * sin(float(i)/sinCosTableSize_ * M_PI/2)); if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; else table_out[i] = x; } @@ -233,10 +255,11 @@ void L1MetPfProducer::init_projy_table(pt_t table_out[PROJ_TAB_SIZE]) { void L1MetPfProducer::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ - //map phi to first quadrant value: range [0, 2^(PHI_SIZE-2)) - ap_uint<PHI_SIZE-2> phiQ1 = phi; - if(phi>=(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(PHI_SIZE-2))) phiQ1 = (1<<(PHI_SIZE-2)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) + ap_uint<PHI_SIZE> phiQ1 = phi; + // uint phiQ1 = phi > sinCosTableSize_ ? sinCosTableSize_-1 : uint(phi); + if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 // get y component and flip sign if necessary y = (pt * sin_table[phiQ1]) >> PT_SIZE; @@ -246,19 +269,19 @@ void L1MetPfProducer::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ return; } -void L1MetPfProducer::init_inv_table(pt_t table_out[INV_TAB_SIZE]) { +void L1MetPfProducer::init_inv_table(std::vector<pt_t> table_out) { // multiply result by 1=2^(PT-SIZE) table_out[0]=(1<<PT_SIZE)-1; - for (int i = 1; i < INV_TAB_SIZE; i++) { + for (uint i = 1; i < inversionTableSize_; i++) { table_out[i] = round((1<<PT_SIZE) / float(i)); } return; } -void L1MetPfProducer::init_atan_table(pt_t table_out[ATAN_TAB_SIZE]) { +void L1MetPfProducer::init_atan_table(std::vector<pt_t> table_out) { // multiply result by 1=2^(PT-SIZE) table_out[0]=int(0); - for (int i = 1; i < ATAN_TAB_SIZE; i++) { - table_out[i] = int(round(atan(float(i)/ATAN_TAB_SIZE) * (1<<(PHI_SIZE-3)) / (M_PI/4))); + for (uint i = 1; i < arcTanTableSize_; i++) { + table_out[i] = int(round(atan(float(i)/arcTanTableSize_) * (1<<(PHI_SIZE-3)) / (M_PI/4))); } return; } @@ -277,13 +300,16 @@ void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ if(a>b){ a = y; b = x; } pt_t inv_b; - if(b>= (1<<(PT_SIZE-DROP_BITS))) inv_b = 1; + if(b>= (1<<(PT_SIZE-inverseDropBits_))) inv_b = 1; // don't bother to store these large numbers in the LUT... // instead approximate their inverses as 1 else inv_b = inv_table[b]; pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) - ap_uint<ATAN_SIZE> atan_index = a_over_b >> (PT_SIZE-ATAN_SIZE); // keep only most significant bits + // can't use arcTanTableSize_ as the type width since its not known at compile time + //ap_uint<arcTanTableSize_> atan_index = a_over_b >> (PT_SIZE-arcTanTableSize_); // keep only most significant bits + ap_uint<PHI_SIZE> atan_index = a_over_b >> (PT_SIZE-arcTanTableBits_); // keep only most significant bits + if(atan_index >= (1<<arcTanTableSize_)) atan_index = (1<<arcTanTableSize_)-1; phi = atan_table[atan_index]; // rotate from (0,pi/4) to full quad1 diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py index 76f244213a684..12e98ed73dadd 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py @@ -1,5 +1,8 @@ import FWCore.ParameterSet.Config as cms L1MetPfProducer = cms.EDProducer("L1MetPfProducer", - L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates") -) + L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), + sinCosTableBits = cms.uint32(8), + inverseDropBits = cms.uint32(2), + arcTanTableBits = cms.uint32(7) + ) From b83fdbb07569a14b5baee721dffdf3e89da5b56c Mon Sep 17 00:00:00 2001 From: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Date: Thu, 25 Mar 2021 05:29:51 +0100 Subject: [PATCH 151/309] add emulator with new types (cherry picked from commit 95c3e2894faf421d98ba58eabed9595cdb9b5a02) --- .../plugins/L1MetPfProducerNewTypes.cc | 309 ++++++++++++++++++ .../python/L1MetPfProducer_cfi.py | 3 + 2 files changed, 312 insertions(+) create mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc new file mode 100644 index 0000000000000..56f8a3dbee869 --- /dev/null +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc @@ -0,0 +1,309 @@ +#include <vector> +#include <ap_int.h> +#include <ap_fixed.h> +#include <TVector2.h> + +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +using namespace l1t; + +class L1MetPfProducerNewTypes : public edm::global::EDProducer<> { +public: + explicit L1MetPfProducerNewTypes(const edm::ParameterSet&); + ~L1MetPfProducerNewTypes() override; + +private: + void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; + edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; + + const long unsigned int maxCands_=128; + + // quantization controllers + typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + typedef ap_int<12> phi_t; // LSB is pi/720 ~ 0.0044 and max is +/-8.9 + const float ptLSB_ = 0.25; // GeV + const float phiLSB_ = M_PI/720; // rad + + // derived, helper types + typedef ap_fixed<pt_t::width+1,pt_t::iwidth+1, AP_RND, AP_SAT> pxy_t; + typedef ap_fixed<2*pt_t::width,2*pt_t::iwidth, AP_RND, AP_SAT> pt2_t; + // derived, helper constants + const float maxPt_ = ((1<<pt_t::width)-1)*ptLSB_; + const phi_t hwPi_ = round(M_PI/phiLSB_); + const phi_t hwPiOverTwo_ = round(M_PI/(2*phiLSB_)); + + typedef ap_ufixed<pt_t::width,0> inv_t; // can't easily use the MAXPT/pt trick with ap_fixed + + // to make configurable... + const int dropBits_=2; + const int dropFactor_=(1<<dropBits_); + const int invTableBits_=10; + const int invTableSize_=(1<<invTableBits_); + + + // static constexpr uint PT_SIZE = 16; + // static constexpr uint PT2_SIZE = 2*PT_SIZE; + // static constexpr uint PT_DEC_BITS = 2; + // static constexpr uint PHI_SIZE = 10; + // typedef ap_uint<PT_SIZE> pt_t; + // typedef ap_int<PT_SIZE+1> pxy_t; + // typedef ap_uint<PT2_SIZE> pt2_t; + // typedef ap_int<PHI_SIZE> phi_t; + // const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV + // const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad + + // for LUTs + // static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); + // static constexpr int DROP_BITS = 2; + // static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); + // static constexpr int ATAN_SIZE = (PHI_SIZE-3); + // static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); + + // std::vector<pt_t> cos_table; + // std::vector<pt_t> sin_table; + // std::vector<pt_t> inv_table; + // std::vector<pt_t> atan_table; + // uint sinCosTableBits_; + // uint sinCosTableSize_; + // uint inverseDropBits_; + // uint inversionTableSize_; + // uint arcTanTableBits_; + // uint arcTanTableSize_; + + // void init_projx_table(std::vector<pt_t> table_out); + // void init_projy_table(std::vector<pt_t> table_out); + // void init_inv_table(std::vector<pt_t> table_out); + // void init_atan_table(std::vector<pt_t> table_out); + + void Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug=false) const; + void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; + + void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const; + + // void CalcMetFast(std::vector<float> pt, std::vector<float> phi, + // reco::Candidate::PolarLorentzVector &metVector) const; + + // bool useHLS=true; + + // // for alternate floating-pt implementation + // const float maxPt_ = (1<<(PT_SIZE-PT_DEC_BITS)); + // const float inverseMax_ = (1<<(PT_SIZE-inverseDropBits_)); + + // inline double quantize(double value, double to_integer) const { + // return round(value * to_integer) / to_integer; + // }; + // inline double bound(double value, double min, double max) const { + // return value > max ? max : (value < min ? min : value); + // }; + +}; + +L1MetPfProducerNewTypes::L1MetPfProducerNewTypes(const edm::ParameterSet& cfg) + : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))){ + // sinCosTableBits_(cfg.getParameter<uint>("sinCosTableBits")), + // inverseDropBits_(cfg.getParameter<uint>("inverseDropBits")), + // arcTanTableBits_(cfg.getParameter<uint>("arcTanTableBits")){ + + produces<std::vector<l1t::EtSum> >(); + + // sinCosTableSize_ = 1<<sinCosTableBits_; + // cos_table.resize(sinCosTableSize_); + // sin_table.resize(sinCosTableSize_); + + // inversionTableSize_ = (1<<(PT_SIZE-inverseDropBits_)); + // inv_table.resize(inversionTableSize_); + + // arcTanTableSize_ = 1<<arcTanTableBits_; + // atan_table.resize(arcTanTableSize_); + + // init_projx_table( cos_table ); + // init_projy_table( sin_table ); + // init_inv_table( inv_table ); + // init_atan_table( atan_table ); +} + +void L1MetPfProducerNewTypes::produce(edm::StreamID, + edm::Event& iEvent, + const edm::EventSetup& iSetup) const { + + edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; + iEvent.getByToken(_l1PFToken, l1PFCandidates); + + std::vector<float> pt; + std::vector<float> phi; + + for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands_; i++){ + const auto& l1PFCand = l1PFCandidates->at(i); + pt.push_back( l1PFCand.pt() ); + phi.push_back( l1PFCand.phi() ); + } + + reco::Candidate::PolarLorentzVector metVector; + + CalcMetHLS(pt, phi, metVector); + + l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); + + std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); + metCollection->push_back(theMET); + iEvent.put(std::move(metCollection)); +} + +void L1MetPfProducerNewTypes::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const{ + pxy_t hw_px = 0; + pxy_t hw_py = 0; + pxy_t hw_sumx = 0; + pxy_t hw_sumy = 0; + + for(uint i=0; i< pt.size(); i++){ + pt_t hw_pt = min(pt[i], maxPt_); + phi_t hw_phi = TVector2::Phi_mpi_pi( phi[i] ) / phiLSB_; + + Project(hw_pt, hw_phi, hw_px, true); + Project(hw_pt, hw_phi, hw_py, false); + + hw_sumx = hw_sumx - hw_px; + hw_sumy = hw_sumy - hw_py; + + // printf("part %d (pt,phi) = float(%f, %f) hw(%f, %f = %f); (x,y) = float(%f, %f) hw(%f, %f); sumHW(%f, %f)\n", + // i, pt[i], TVector2::Phi_mpi_pi( phi[i] ), hw_pt.to_double(), hw_phi.to_double(), hw_phi.to_double()*phiLSB_, + // pt[i]*cos(phi[i]), pt[i]*sin(phi[i]), hw_px.to_double(), hw_py.to_double(), + // hw_sumx.to_double(), hw_sumy.to_double() + // ); + } + // std::cout << std::endl; + + pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); + hw_met = sqrt( int(hw_met) ); // stand-in for HLS::sqrt + + phi_t hw_met_phi = 0; + PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); + + metVector.SetPt( hw_met.to_double() ); + metVector.SetPhi( hw_met_phi.to_double() * phiLSB_ ); + //(M_PI/hwPi_.to_double()) + // printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", + // phi.to_double(), phi.to_double() * (M_PI/hwPi_.to_double()), atan2(py.to_double(),px.to_double()), px.to_double(), py.to_double()); + + + metVector.SetEta(0); +} + + + +// Convert pt and phi to px (py) +// 1) Map phi to the first quadrant to reduce LUT size +// 2) Lookup sin(phiQ1), where the result is in [0,maxPt] +// which is used to encode [0,1]. +// 3) Multiply pt by sin(phiQ1) to get px. Result will be px*maxPt, but +// wrapping multiplication is 'mod maxPt' so the correct value is returned. +// 4) Check px=-|px|. + + +void L1MetPfProducerNewTypes::Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug) const{ + // set phi to first quadrant + phi_t phiQ1 = (phi>0) ? phi : phi_t(-phi); // Q1/Q4 + if(phiQ1 >= hwPiOverTwo_) phiQ1 = hwPi_ - phiQ1; + + if (phiQ1 > hwPiOverTwo_){ + std::cout << "unexpected phi (high)" << std::endl; + phiQ1 = hwPiOverTwo_; + } else if (phiQ1<0){ + std::cout << "unexpected phi (low)" << std::endl; + phiQ1 = 0; + } + if(isX){ + typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + ap_ufixed<pt_t::width,0> cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); + // pt_t cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double()) * maxPt_; // assume fixed tab size (pi/2=360) + pxy = pt * cosPhi; + //printf(" phi = %f, phiQ1 = %f, cosPhi = %f, pxy = %f \n", phi.to_double(), phiQ1.to_double(), cosPhi.to_double(), pxy.to_double() ); + if (phi > hwPiOverTwo_ || phi < -hwPiOverTwo_) pxy = -pxy; + } else { + ap_ufixed<pt_t::width,0> sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); + // pt_t sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double()) * maxPt_; // assume fixed tab size (pi/2=360) + pxy = pt * sinPhi; + if (phi < 0) pxy = -pxy; + } + + return; +} + +// void L1MetPfProducerNewTypes::init_inv_table(std::vector<pt_t> table_out) { +// // multiply result by 1=2^(PT-SIZE) +// table_out[0]=(1<<PT_SIZE)-1; +// for (uint i = 1; i < inversionTableSize_; i++) { +// table_out[i] = round((1<<PT_SIZE) / float(i)); +// } +// return; +// } +// void L1MetPfProducerNewTypes::init_atan_table(std::vector<pt_t> table_out) { +// // multiply result by 1=2^(PT-SIZE) +// table_out[0]=int(0); +// for (uint i = 1; i < arcTanTableSize_; i++) { +// table_out[i] = int(round(atan(float(i)/arcTanTableSize_) * (1<<(PHI_SIZE-3)) / (M_PI/4))); +// } +// return; +// } + +void L1MetPfProducerNewTypes::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ + if(px==0 && py==0){ phi = 0; return; } + if(px==0){ phi = py>0 ? hwPiOverTwo_ : phi_t(-hwPiOverTwo_); return; } + if(py==0){ phi = px>0 ? phi_t(0) : phi_t(-hwPi_); return; } + + // get q1 coordinates + pt_t x = px>0 ? pt_t(px) : pt_t(-px); //px>=0 ? px : -px; + pt_t y = py>0 ? pt_t(py) : pt_t(-py); //px>=0 ? px : -px; + // transform so a<b + pt_t a = x<y ? x : y; + pt_t b = x<y ? y : x; + + + if (b.to_double() > maxPt_ / dropFactor_) b = maxPt_ / dropFactor_; + // map [0,max/4) to inv table size + int index = round((b.to_double()/(maxPt_/dropFactor_)) * invTableSize_); + float bcheck = (float(index) / invTableSize_) * (maxPt_/dropFactor_); + inv_t inv_b = 1./((float(index) / invTableSize_) * (maxPt_/dropFactor_)); + + inv_t a_over_b = a * inv_b; + + printf(" a, b = %f, %f; index, inv = %d, %f; ratio = %f \n", a.to_double(), b.to_double(),index, inv_b.to_double(), a_over_b.to_double() ); + printf(" bcheck, 1/bc = %f, %f -- %d %f %d \n", bcheck, 1./bcheck, invTableSize_ , maxPt_, dropFactor_ ); + + int atanTableBits_=7; + int atanTableSize_=(1<<atanTableBits_); + index = round(a_over_b.to_double() * atanTableSize_); + phi = atan(float(index) / atanTableSize_) / phiLSB_; + + printf(" atan index, phi = %d, %f (%f rad) real atan(a/b)= %f \n", index, phi.to_double(), + phi.to_double() * (M_PI/hwPi_.to_double()), atan(a.to_double()/b.to_double())); + + // rotate from (0,pi/4) to full quad1 + if(y>x) phi = hwPiOverTwo_ - phi; //phi = pi/2 - phi + // other quadrants + if( px < 0 && py > 0 ) phi = hwPi_ - phi; // Q2 phi = pi - phi + if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi + if( px < 0 && py < 0 ) phi = -(hwPi_ - phi); // Q3 composition of both + + // if(y>x) phi = hwPiOverTwo_ - phi; + // if(px<0) phi = hwPi_ - phi; + // if(py<0) phi = - phi; + printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", + phi.to_double(), phi.to_double() * (M_PI/hwPi_.to_double()), atan2(py.to_double(),px.to_double()), px.to_double(), py.to_double()); + + return; +} + +L1MetPfProducerNewTypes::~L1MetPfProducerNewTypes() {} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(L1MetPfProducerNewTypes); diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py index 12e98ed73dadd..1094e5ef0650e 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py @@ -6,3 +6,6 @@ inverseDropBits = cms.uint32(2), arcTanTableBits = cms.uint32(7) ) +L1MetPfProducerNT = cms.EDProducer("L1MetPfProducerNewTypes", + L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), + ) From 9dcba0ef87ceff4603fa9308a4d10ad14ff12165 Mon Sep 17 00:00:00 2001 From: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Date: Mon, 12 Apr 2021 21:01:47 +0200 Subject: [PATCH 152/309] cleanup comments (cherry picked from commit f9e0c919fe3285ed799c506b41a95a77dc46ac7c) --- .../plugins/L1MetPfProducer.cc | 327 ++++++------------ .../plugins/L1MetPfProducerNewTypes.cc | 309 ----------------- .../plugins/L1MetPfProducerTDR.cc | 317 +++++++++++++++++ .../python/L1MetPfProducer_cfi.py | 15 +- 4 files changed, 428 insertions(+), 540 deletions(-) delete mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc create mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc index 8ab9aef6201cc..aa853b6c72b71 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc @@ -23,90 +23,43 @@ class L1MetPfProducer : public edm::global::EDProducer<> { void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; - long unsigned int maxCands=128; + int maxCands_=128; // quantization controllers - static constexpr uint PT_SIZE = 16; - static constexpr uint PT2_SIZE = 2*PT_SIZE; - static constexpr uint PT_DEC_BITS = 2; - static constexpr uint PHI_SIZE = 10; - typedef ap_uint<PT_SIZE> pt_t; - typedef ap_int<PT_SIZE+1> pxy_t; - typedef ap_uint<PT2_SIZE> pt2_t; - typedef ap_int<PHI_SIZE> phi_t; - const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV - const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad - - // for LUTs - // static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); - // static constexpr int DROP_BITS = 2; - // static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); - // static constexpr int ATAN_SIZE = (PHI_SIZE-3); - // static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); - - std::vector<pt_t> cos_table; - std::vector<pt_t> sin_table; - std::vector<pt_t> inv_table; - std::vector<pt_t> atan_table; - uint sinCosTableBits_; - uint sinCosTableSize_; - uint inverseDropBits_; - uint inversionTableSize_; - uint arcTanTableBits_; - uint arcTanTableSize_; - - void init_projx_table(std::vector<pt_t> table_out); - void init_projy_table(std::vector<pt_t> table_out); - void init_inv_table(std::vector<pt_t> table_out); - void init_atan_table(std::vector<pt_t> table_out); - - void ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug=false) const; - void ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug=false) const; - void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; + typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + typedef ap_int<12> phi_t; // LSB is pi/720 ~ 0.0044 and max is +/-8.9 + const float ptLSB_ = 0.25; // GeV + const float phiLSB_ = M_PI/720; // rad + + // derived, helper types + typedef ap_fixed<pt_t::width+1,pt_t::iwidth+1, AP_RND, AP_SAT> pxy_t; + typedef ap_fixed<2*pt_t::width,2*pt_t::iwidth, AP_RND, AP_SAT> pt2_t; + // derived, helper constants + const float maxPt_ = ((1<<pt_t::width)-1)*ptLSB_; + const phi_t hwPi_ = round(M_PI/phiLSB_); + const phi_t hwPiOverTwo_ = round(M_PI/(2*phiLSB_)); + + typedef ap_ufixed<pt_t::width,0> inv_t; // can't easily use the MAXPT/pt trick with ap_fixed + + // to make configurable... + const int dropBits_=2; + const int dropFactor_=(1<<dropBits_); + const int invTableBits_=10; + const int invTableSize_=(1<<invTableBits_); + + void Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug=false) const; + void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi, bool debug=false) const; void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, reco::Candidate::PolarLorentzVector &metVector) const; - void CalcMetFast(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const; - - bool useHLS=true; - - // for alternate floating-pt implementation - const float maxPt_ = (1<<(PT_SIZE-PT_DEC_BITS)); - const float inverseMax_ = (1<<(PT_SIZE-inverseDropBits_)); - - inline double quantize(double value, double to_integer) const { - return round(value * to_integer) / to_integer; - }; - inline double bound(double value, double min, double max) const { - return value > max ? max : (value < min ? min : value); - }; - }; L1MetPfProducer::L1MetPfProducer(const edm::ParameterSet& cfg) : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))), - sinCosTableBits_(cfg.getParameter<uint>("sinCosTableBits")), - inverseDropBits_(cfg.getParameter<uint>("inverseDropBits")), - arcTanTableBits_(cfg.getParameter<uint>("arcTanTableBits")) + maxCands_(cfg.getParameter<int>("maxCands")) { produces<std::vector<l1t::EtSum> >(); - - sinCosTableSize_ = 1<<sinCosTableBits_; - cos_table.resize(sinCosTableSize_); - sin_table.resize(sinCosTableSize_); - - inversionTableSize_ = (1<<(PT_SIZE-inverseDropBits_)); - inv_table.resize(inversionTableSize_); - - arcTanTableSize_ = 1<<arcTanTableBits_; - atan_table.resize(arcTanTableSize_); - - init_projx_table( cos_table ); - init_projy_table( sin_table ); - init_inv_table( inv_table ); - init_atan_table( atan_table ); } void L1MetPfProducer::produce(edm::StreamID, @@ -119,7 +72,7 @@ void L1MetPfProducer::produce(edm::StreamID, std::vector<float> pt; std::vector<float> phi; - for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands; i++){ + for(int i=0; i<int(l1PFCandidates->size()) && (i<maxCands_|| maxCands_<0); i++){ const auto& l1PFCand = l1PFCandidates->at(i); pt.push_back( l1PFCand.pt() ); phi.push_back( l1PFCand.phi() ); @@ -127,8 +80,7 @@ void L1MetPfProducer::produce(edm::StreamID, reco::Candidate::PolarLorentzVector metVector; - if(useHLS) CalcMetHLS(pt, phi, metVector); - else CalcMetFast(pt, phi, metVector); + CalcMetHLS(pt, phi, metVector); l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); @@ -145,14 +97,14 @@ void L1MetPfProducer::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, pxy_t hw_sumy = 0; for(uint i=0; i< pt.size(); i++){ - pt_t hw_pt = pt[i] / pt_lsb; - phi_t hw_phi = TVector2::Phi_mpi_pi( phi[i] ) / phi_lsb; + pt_t hw_pt = min(pt[i], maxPt_); + phi_t hw_phi = float(TVector2::Phi_mpi_pi( phi[i] ) / phiLSB_); - ProjX(hw_pt, hw_phi, hw_px); - ProjY(hw_pt, hw_phi, hw_py); + Project(hw_pt, hw_phi, hw_px, true); + Project(hw_pt, hw_phi, hw_py, false); - hw_sumx = hw_sumx + hw_px; - hw_sumy = hw_sumy + hw_py; + hw_sumx = hw_sumx - hw_px; + hw_sumy = hw_sumy - hw_py; } pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); @@ -161,165 +113,92 @@ void L1MetPfProducer::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, phi_t hw_met_phi = 0; PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); - metVector.SetPt( hw_met * pt_lsb ); - metVector.SetPhi( hw_met_phi * phi_lsb ); + metVector.SetPt( hw_met.to_double() ); + metVector.SetPhi( hw_met_phi.to_double() * phiLSB_ ); metVector.SetEta(0); } - -void L1MetPfProducer::CalcMetFast(std::vector<float> pt_vec, std::vector<float> phi_vec, - reco::Candidate::PolarLorentzVector &metVector) const{ - float sumx = 0; - float sumy = 0; - - for(uint i=0; i< pt_vec.size(); i++){ - float pt = quantize( pt_vec[i], 1./pt_lsb); - if (pt > maxPt_) pt = maxPt_; - - float phi = quantize( TVector2::Phi_mpi_pi(phi_vec[i]), 1./phi_lsb); - - // LUTs correspond to Q1 only to allow a smaller number of entries - float table_phi = quantize(phi, sinCosTableSize_/(M_PI/2)); - - float px = quantize( pt * cos(table_phi), 1./pt_lsb); - float py = quantize( pt * sin(table_phi), 1./pt_lsb); - - sumx = quantize(sumx + px, 1./pt_lsb); - sumy = quantize(sumy + py, 1./pt_lsb); - if( fabs(sumx) > maxPt_ ) sumx = maxPt_ * (sumx>0 ? 1 : -1); - if( fabs(sumy) > maxPt_ ) sumy = maxPt_ * (sumy>0 ? 1 : -1); +void L1MetPfProducer::Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug) const{ + /* + Convert pt and phi to px (py) + 1) Map phi to the first quadrant to reduce LUT size + 2) Lookup sin(phiQ1), where the result is in [0,maxPt] + which is used to encode [0,1]. + 3) Multiply pt by sin(phiQ1) to get px. Result will be px*maxPt, but + wrapping multiplication is 'mod maxPt' so the correct value is returned. + 4) Check px=-|px|. + */ + + // set phi to first quadrant + phi_t phiQ1 = (phi>0) ? phi : phi_t(-phi); // Q1/Q4 + if(phiQ1 >= hwPiOverTwo_) phiQ1 = hwPi_ - phiQ1; + + if (phiQ1 > hwPiOverTwo_){ + std::cout << "unexpected phi (high)" << std::endl; + phiQ1 = hwPiOverTwo_; + } else if (phiQ1<0){ + std::cout << "unexpected phi (low)" << std::endl; + phiQ1 = 0; } - - float met = quantize(pow(sumx,2) + pow(sumy,2), 1./(pt_lsb*pt_lsb)); - met = quantize(sqrt(met), 1./pt_lsb); // stand-in for HLS::sqrt function - if ( met > maxPt_ ) met = maxPt_; - - // to calculate arctan for evaluation in [0,pi/4), need two more LUTs for atan(py/px) - float numerator = min(fabs(sumx), fabs(sumy)); - float denominator = max(fabs(sumx), fabs(sumy)); - if (denominator > inverseMax_) denominator = inverseMax_; - // no add'l quantization needed, since we currently store inverse for all pt values below max - // ratio is stored in units of 1/max pt val - float met_phi = atan( quantize(numerator / denominator, arcTanTableSize_) ); - - // recover the full angle from [0,pi/4) - if( fabs(sumx) < fabs(sumy) ) met_phi = M_PI/2 - met_phi; // to [0,pi/2) - if ( sumx < 0 ) met_phi = M_PI - met_phi; // to [0,pi) - if ( sumy < 0 ) met_phi = - met_phi; // to [-pi,pi) - met_phi = quantize(met_phi, 1./phi_lsb); - - metVector.SetPt( met ); - metVector.SetPhi( met_phi ); - metVector.SetEta(0); -} - -void L1MetPfProducer::init_projx_table(std::vector<pt_t> table_out) { - // Return table of cos(phi) where phi is in (0,pi/2) - // multiply result by 2^(PT_SIZE) (equal to 1 in our units) - for (uint i = 0; i < sinCosTableSize_; i++) { - //store result, guarding overflow near costheta=1 - pt2_t x = round((1<<PT_SIZE) * cos(float(i)/sinCosTableSize_ * M_PI/2)); - // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) - if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; - else table_out[i] = x; - } - return; -} - -void L1MetPfProducer::ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug) const{ - //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) - //ap_uint<sinCosTableBits_> phiQ1 = phi; // not constexpr - ap_uint<PHI_SIZE> phiQ1 = phi; - // int phiQ1 = phi >= sinCosTableSize_ ? sinCosTableSize_-1 : int(phi); - if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 - - // get x component and flip sign if necessary - x = (pt * cos_table[phiQ1]) >> PT_SIZE; - if(debug) std::cout << pt << " cos_table[" << phiQ1 << "] = " << cos_table[phiQ1] << " " << x << std::endl; - if( phi>=(1<<(sinCosTableBits_)) - || phi<-(1<<(sinCosTableBits_))) - x = -x; - - return; -} - -void L1MetPfProducer::init_projy_table(std::vector<pt_t> table_out) { - for (uint i = 0; i < sinCosTableSize_; i++) { - pt2_t x = round((1<<PT_SIZE) * sin(float(i)/sinCosTableSize_ * M_PI/2)); - if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; - else table_out[i] = x; + if(isX){ + typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + ap_ufixed<pt_t::width,0> cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); + pxy = pt * cosPhi; + if (phi > hwPiOverTwo_ || phi < -hwPiOverTwo_) pxy = -pxy; + } else { + ap_ufixed<pt_t::width,0> sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); + pxy = pt * sinPhi; + if (phi < 0) pxy = -pxy; } - return; } -void L1MetPfProducer::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ +void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi, bool debug) const{ + if(px==0 && py==0){ phi = 0; return; } + if(px==0){ phi = py>0 ? hwPiOverTwo_ : phi_t(-hwPiOverTwo_); return; } + if(py==0){ phi = px>0 ? phi_t(0) : phi_t(-hwPi_); return; } - //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) - ap_uint<PHI_SIZE> phiQ1 = phi; - // uint phiQ1 = phi > sinCosTableSize_ ? sinCosTableSize_-1 : uint(phi); - if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + // get q1 coordinates + pt_t x = px>0 ? pt_t(px) : pt_t(-px); //px>=0 ? px : -px; + pt_t y = py>0 ? pt_t(py) : pt_t(-py); //px>=0 ? px : -px; + // transform so a<b + pt_t a = x<y ? x : y; + pt_t b = x<y ? y : x; - // get y component and flip sign if necessary - y = (pt * sin_table[phiQ1]) >> PT_SIZE; - if(debug) std::cout << pt << " sin_table[" << phiQ1 << "] = " << sin_table[phiQ1] << " " << y << std::endl; - if( phi<0 ) y = -y; - return; -} + if (b.to_double() > maxPt_ / dropFactor_) b = maxPt_ / dropFactor_; + // map [0,max/4) to inv table size + int index = round((b.to_double()/(maxPt_/dropFactor_)) * invTableSize_); + float bcheck = (float(index) / invTableSize_) * (maxPt_/dropFactor_); + inv_t inv_b = 1./((float(index) / invTableSize_) * (maxPt_/dropFactor_)); -void L1MetPfProducer::init_inv_table(std::vector<pt_t> table_out) { - // multiply result by 1=2^(PT-SIZE) - table_out[0]=(1<<PT_SIZE)-1; - for (uint i = 1; i < inversionTableSize_; i++) { - table_out[i] = round((1<<PT_SIZE) / float(i)); - } - return; -} -void L1MetPfProducer::init_atan_table(std::vector<pt_t> table_out) { - // multiply result by 1=2^(PT-SIZE) - table_out[0]=int(0); - for (uint i = 1; i < arcTanTableSize_; i++) { - table_out[i] = int(round(atan(float(i)/arcTanTableSize_) * (1<<(PHI_SIZE-3)) / (M_PI/4))); + inv_t a_over_b = a * inv_b; + + if (debug){ + printf(" a, b = %f, %f; index, inv = %d, %f; ratio = %f \n", a.to_double(), b.to_double(),index, inv_b.to_double(), a_over_b.to_double() ); + printf(" bcheck, 1/bc = %f, %f -- %d %f %d \n", bcheck, 1./bcheck, invTableSize_ , maxPt_, dropFactor_ ); } - return; -} -void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ - if(px==0 && py==0){ phi = 0; return; } + int atanTableBits_=7; + int atanTableSize_=(1<<atanTableBits_); + index = round(a_over_b.to_double() * atanTableSize_); + phi = atan(float(index) / atanTableSize_) / phiLSB_; - // get q1 coordinates - pt_t x = px; //px>=0 ? px : -px; - pt_t y = py; //py>=0 ? py : -py; - if(px<0) x = -px; - if(py<0) y = -py; - // transform so a<b - pt_t a = x; //x<y ? x : y; - pt_t b = y; //x<y ? y : x; - if(a>b){ a = y; b = x; } - - pt_t inv_b; - if(b>= (1<<(PT_SIZE-inverseDropBits_))) inv_b = 1; - // don't bother to store these large numbers in the LUT... - // instead approximate their inverses as 1 - else inv_b = inv_table[b]; - - pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) - // can't use arcTanTableSize_ as the type width since its not known at compile time - //ap_uint<arcTanTableSize_> atan_index = a_over_b >> (PT_SIZE-arcTanTableSize_); // keep only most significant bits - ap_uint<PHI_SIZE> atan_index = a_over_b >> (PT_SIZE-arcTanTableBits_); // keep only most significant bits - if(atan_index >= (1<<arcTanTableSize_)) atan_index = (1<<arcTanTableSize_)-1; - phi = atan_table[atan_index]; + if (debug){ + printf(" atan index, phi = %d, %f (%f rad) real atan(a/b)= %f \n", index, phi.to_double(), + phi.to_double() * (M_PI/hwPi_.to_double()), atan(a.to_double()/b.to_double())); + } // rotate from (0,pi/4) to full quad1 - if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi - // other quadrants - if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi - if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi - if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both - - return; + if(y>x) phi = hwPiOverTwo_ - phi; //phi = pi/2 - phi + // other quadrants + if( px < 0 && py > 0 ) phi = hwPi_ - phi; // Q2 phi = pi - phi + if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi + if( px < 0 && py < 0 ) phi = -(hwPi_ - phi); // Q3 composition of both + + if (debug){ + printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", + phi.to_double(), phi.to_double() * (M_PI/hwPi_.to_double()), atan2(py.to_double(),px.to_double()), px.to_double(), py.to_double()); + } } L1MetPfProducer::~L1MetPfProducer() {} diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc deleted file mode 100644 index 56f8a3dbee869..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerNewTypes.cc +++ /dev/null @@ -1,309 +0,0 @@ -#include <vector> -#include <ap_int.h> -#include <ap_fixed.h> -#include <TVector2.h> - -#include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" -#include "DataFormats/L1Trigger/interface/EtSum.h" -#include "DataFormats/Math/interface/LorentzVector.h" - -using namespace l1t; - -class L1MetPfProducerNewTypes : public edm::global::EDProducer<> { -public: - explicit L1MetPfProducerNewTypes(const edm::ParameterSet&); - ~L1MetPfProducerNewTypes() override; - -private: - void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; - edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; - - const long unsigned int maxCands_=128; - - // quantization controllers - typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV - typedef ap_int<12> phi_t; // LSB is pi/720 ~ 0.0044 and max is +/-8.9 - const float ptLSB_ = 0.25; // GeV - const float phiLSB_ = M_PI/720; // rad - - // derived, helper types - typedef ap_fixed<pt_t::width+1,pt_t::iwidth+1, AP_RND, AP_SAT> pxy_t; - typedef ap_fixed<2*pt_t::width,2*pt_t::iwidth, AP_RND, AP_SAT> pt2_t; - // derived, helper constants - const float maxPt_ = ((1<<pt_t::width)-1)*ptLSB_; - const phi_t hwPi_ = round(M_PI/phiLSB_); - const phi_t hwPiOverTwo_ = round(M_PI/(2*phiLSB_)); - - typedef ap_ufixed<pt_t::width,0> inv_t; // can't easily use the MAXPT/pt trick with ap_fixed - - // to make configurable... - const int dropBits_=2; - const int dropFactor_=(1<<dropBits_); - const int invTableBits_=10; - const int invTableSize_=(1<<invTableBits_); - - - // static constexpr uint PT_SIZE = 16; - // static constexpr uint PT2_SIZE = 2*PT_SIZE; - // static constexpr uint PT_DEC_BITS = 2; - // static constexpr uint PHI_SIZE = 10; - // typedef ap_uint<PT_SIZE> pt_t; - // typedef ap_int<PT_SIZE+1> pxy_t; - // typedef ap_uint<PT2_SIZE> pt2_t; - // typedef ap_int<PHI_SIZE> phi_t; - // const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV - // const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad - - // for LUTs - // static constexpr int PROJ_TAB_SIZE = (1<<(PHI_SIZE-2)); - // static constexpr int DROP_BITS = 2; - // static constexpr int INV_TAB_SIZE = (1<<(PT_SIZE-DROP_BITS)); - // static constexpr int ATAN_SIZE = (PHI_SIZE-3); - // static constexpr int ATAN_TAB_SIZE = (1<<ATAN_SIZE); - - // std::vector<pt_t> cos_table; - // std::vector<pt_t> sin_table; - // std::vector<pt_t> inv_table; - // std::vector<pt_t> atan_table; - // uint sinCosTableBits_; - // uint sinCosTableSize_; - // uint inverseDropBits_; - // uint inversionTableSize_; - // uint arcTanTableBits_; - // uint arcTanTableSize_; - - // void init_projx_table(std::vector<pt_t> table_out); - // void init_projy_table(std::vector<pt_t> table_out); - // void init_inv_table(std::vector<pt_t> table_out); - // void init_atan_table(std::vector<pt_t> table_out); - - void Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug=false) const; - void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; - - void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const; - - // void CalcMetFast(std::vector<float> pt, std::vector<float> phi, - // reco::Candidate::PolarLorentzVector &metVector) const; - - // bool useHLS=true; - - // // for alternate floating-pt implementation - // const float maxPt_ = (1<<(PT_SIZE-PT_DEC_BITS)); - // const float inverseMax_ = (1<<(PT_SIZE-inverseDropBits_)); - - // inline double quantize(double value, double to_integer) const { - // return round(value * to_integer) / to_integer; - // }; - // inline double bound(double value, double min, double max) const { - // return value > max ? max : (value < min ? min : value); - // }; - -}; - -L1MetPfProducerNewTypes::L1MetPfProducerNewTypes(const edm::ParameterSet& cfg) - : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))){ - // sinCosTableBits_(cfg.getParameter<uint>("sinCosTableBits")), - // inverseDropBits_(cfg.getParameter<uint>("inverseDropBits")), - // arcTanTableBits_(cfg.getParameter<uint>("arcTanTableBits")){ - - produces<std::vector<l1t::EtSum> >(); - - // sinCosTableSize_ = 1<<sinCosTableBits_; - // cos_table.resize(sinCosTableSize_); - // sin_table.resize(sinCosTableSize_); - - // inversionTableSize_ = (1<<(PT_SIZE-inverseDropBits_)); - // inv_table.resize(inversionTableSize_); - - // arcTanTableSize_ = 1<<arcTanTableBits_; - // atan_table.resize(arcTanTableSize_); - - // init_projx_table( cos_table ); - // init_projy_table( sin_table ); - // init_inv_table( inv_table ); - // init_atan_table( atan_table ); -} - -void L1MetPfProducerNewTypes::produce(edm::StreamID, - edm::Event& iEvent, - const edm::EventSetup& iSetup) const { - - edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; - iEvent.getByToken(_l1PFToken, l1PFCandidates); - - std::vector<float> pt; - std::vector<float> phi; - - for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands_; i++){ - const auto& l1PFCand = l1PFCandidates->at(i); - pt.push_back( l1PFCand.pt() ); - phi.push_back( l1PFCand.phi() ); - } - - reco::Candidate::PolarLorentzVector metVector; - - CalcMetHLS(pt, phi, metVector); - - l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); - - std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); - metCollection->push_back(theMET); - iEvent.put(std::move(metCollection)); -} - -void L1MetPfProducerNewTypes::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const{ - pxy_t hw_px = 0; - pxy_t hw_py = 0; - pxy_t hw_sumx = 0; - pxy_t hw_sumy = 0; - - for(uint i=0; i< pt.size(); i++){ - pt_t hw_pt = min(pt[i], maxPt_); - phi_t hw_phi = TVector2::Phi_mpi_pi( phi[i] ) / phiLSB_; - - Project(hw_pt, hw_phi, hw_px, true); - Project(hw_pt, hw_phi, hw_py, false); - - hw_sumx = hw_sumx - hw_px; - hw_sumy = hw_sumy - hw_py; - - // printf("part %d (pt,phi) = float(%f, %f) hw(%f, %f = %f); (x,y) = float(%f, %f) hw(%f, %f); sumHW(%f, %f)\n", - // i, pt[i], TVector2::Phi_mpi_pi( phi[i] ), hw_pt.to_double(), hw_phi.to_double(), hw_phi.to_double()*phiLSB_, - // pt[i]*cos(phi[i]), pt[i]*sin(phi[i]), hw_px.to_double(), hw_py.to_double(), - // hw_sumx.to_double(), hw_sumy.to_double() - // ); - } - // std::cout << std::endl; - - pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); - hw_met = sqrt( int(hw_met) ); // stand-in for HLS::sqrt - - phi_t hw_met_phi = 0; - PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); - - metVector.SetPt( hw_met.to_double() ); - metVector.SetPhi( hw_met_phi.to_double() * phiLSB_ ); - //(M_PI/hwPi_.to_double()) - // printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", - // phi.to_double(), phi.to_double() * (M_PI/hwPi_.to_double()), atan2(py.to_double(),px.to_double()), px.to_double(), py.to_double()); - - - metVector.SetEta(0); -} - - - -// Convert pt and phi to px (py) -// 1) Map phi to the first quadrant to reduce LUT size -// 2) Lookup sin(phiQ1), where the result is in [0,maxPt] -// which is used to encode [0,1]. -// 3) Multiply pt by sin(phiQ1) to get px. Result will be px*maxPt, but -// wrapping multiplication is 'mod maxPt' so the correct value is returned. -// 4) Check px=-|px|. - - -void L1MetPfProducerNewTypes::Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug) const{ - // set phi to first quadrant - phi_t phiQ1 = (phi>0) ? phi : phi_t(-phi); // Q1/Q4 - if(phiQ1 >= hwPiOverTwo_) phiQ1 = hwPi_ - phiQ1; - - if (phiQ1 > hwPiOverTwo_){ - std::cout << "unexpected phi (high)" << std::endl; - phiQ1 = hwPiOverTwo_; - } else if (phiQ1<0){ - std::cout << "unexpected phi (low)" << std::endl; - phiQ1 = 0; - } - if(isX){ - typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV - ap_ufixed<pt_t::width,0> cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); - // pt_t cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double()) * maxPt_; // assume fixed tab size (pi/2=360) - pxy = pt * cosPhi; - //printf(" phi = %f, phiQ1 = %f, cosPhi = %f, pxy = %f \n", phi.to_double(), phiQ1.to_double(), cosPhi.to_double(), pxy.to_double() ); - if (phi > hwPiOverTwo_ || phi < -hwPiOverTwo_) pxy = -pxy; - } else { - ap_ufixed<pt_t::width,0> sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); - // pt_t sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double()) * maxPt_; // assume fixed tab size (pi/2=360) - pxy = pt * sinPhi; - if (phi < 0) pxy = -pxy; - } - - return; -} - -// void L1MetPfProducerNewTypes::init_inv_table(std::vector<pt_t> table_out) { -// // multiply result by 1=2^(PT-SIZE) -// table_out[0]=(1<<PT_SIZE)-1; -// for (uint i = 1; i < inversionTableSize_; i++) { -// table_out[i] = round((1<<PT_SIZE) / float(i)); -// } -// return; -// } -// void L1MetPfProducerNewTypes::init_atan_table(std::vector<pt_t> table_out) { -// // multiply result by 1=2^(PT-SIZE) -// table_out[0]=int(0); -// for (uint i = 1; i < arcTanTableSize_; i++) { -// table_out[i] = int(round(atan(float(i)/arcTanTableSize_) * (1<<(PHI_SIZE-3)) / (M_PI/4))); -// } -// return; -// } - -void L1MetPfProducerNewTypes::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ - if(px==0 && py==0){ phi = 0; return; } - if(px==0){ phi = py>0 ? hwPiOverTwo_ : phi_t(-hwPiOverTwo_); return; } - if(py==0){ phi = px>0 ? phi_t(0) : phi_t(-hwPi_); return; } - - // get q1 coordinates - pt_t x = px>0 ? pt_t(px) : pt_t(-px); //px>=0 ? px : -px; - pt_t y = py>0 ? pt_t(py) : pt_t(-py); //px>=0 ? px : -px; - // transform so a<b - pt_t a = x<y ? x : y; - pt_t b = x<y ? y : x; - - - if (b.to_double() > maxPt_ / dropFactor_) b = maxPt_ / dropFactor_; - // map [0,max/4) to inv table size - int index = round((b.to_double()/(maxPt_/dropFactor_)) * invTableSize_); - float bcheck = (float(index) / invTableSize_) * (maxPt_/dropFactor_); - inv_t inv_b = 1./((float(index) / invTableSize_) * (maxPt_/dropFactor_)); - - inv_t a_over_b = a * inv_b; - - printf(" a, b = %f, %f; index, inv = %d, %f; ratio = %f \n", a.to_double(), b.to_double(),index, inv_b.to_double(), a_over_b.to_double() ); - printf(" bcheck, 1/bc = %f, %f -- %d %f %d \n", bcheck, 1./bcheck, invTableSize_ , maxPt_, dropFactor_ ); - - int atanTableBits_=7; - int atanTableSize_=(1<<atanTableBits_); - index = round(a_over_b.to_double() * atanTableSize_); - phi = atan(float(index) / atanTableSize_) / phiLSB_; - - printf(" atan index, phi = %d, %f (%f rad) real atan(a/b)= %f \n", index, phi.to_double(), - phi.to_double() * (M_PI/hwPi_.to_double()), atan(a.to_double()/b.to_double())); - - // rotate from (0,pi/4) to full quad1 - if(y>x) phi = hwPiOverTwo_ - phi; //phi = pi/2 - phi - // other quadrants - if( px < 0 && py > 0 ) phi = hwPi_ - phi; // Q2 phi = pi - phi - if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi - if( px < 0 && py < 0 ) phi = -(hwPi_ - phi); // Q3 composition of both - - // if(y>x) phi = hwPiOverTwo_ - phi; - // if(px<0) phi = hwPi_ - phi; - // if(py<0) phi = - phi; - printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", - phi.to_double(), phi.to_double() * (M_PI/hwPi_.to_double()), atan2(py.to_double(),px.to_double()), px.to_double(), py.to_double()); - - return; -} - -L1MetPfProducerNewTypes::~L1MetPfProducerNewTypes() {} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(L1MetPfProducerNewTypes); diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc new file mode 100644 index 0000000000000..5276a2c1cb8c1 --- /dev/null +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc @@ -0,0 +1,317 @@ +#include <vector> +#include <ap_int.h> +#include <ap_fixed.h> +#include <TVector2.h> + +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +using namespace l1t; + +class L1MetPfProducerTDR : public edm::global::EDProducer<> { +public: + explicit L1MetPfProducerTDR(const edm::ParameterSet&); + ~L1MetPfProducerTDR() override; + +private: + void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; + edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; + + long unsigned int maxCands=128; + + // quantization controllers + static constexpr uint PT_SIZE = 16; + static constexpr uint PT2_SIZE = 2*PT_SIZE; + static constexpr uint PT_DEC_BITS = 2; + static constexpr uint PHI_SIZE = 10; + typedef ap_uint<PT_SIZE> pt_t; + typedef ap_int<PT_SIZE+1> pxy_t; + typedef ap_uint<PT2_SIZE> pt2_t; + typedef ap_int<PHI_SIZE> phi_t; + const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV + const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad + + std::vector<pt_t> cos_table; + std::vector<pt_t> sin_table; + std::vector<pt_t> inv_table; + std::vector<pt_t> atan_table; + uint sinCosTableBits_; + uint sinCosTableSize_; + uint inverseDropBits_; + uint inversionTableSize_; + uint arcTanTableBits_; + uint arcTanTableSize_; + + void init_projx_table(std::vector<pt_t> table_out); + void init_projy_table(std::vector<pt_t> table_out); + void init_inv_table(std::vector<pt_t> table_out); + void init_atan_table(std::vector<pt_t> table_out); + + void ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug=false) const; + void ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug=false) const; + void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; + + void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const; + + void CalcMetFast(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const; + + bool useHLS=true; + + // for alternate floating-pt implementation + const float maxPt_ = (1<<(PT_SIZE-PT_DEC_BITS)); + const float inverseMax_ = (1<<(PT_SIZE-inverseDropBits_)); + + inline double quantize(double value, double to_integer) const { + return round(value * to_integer) / to_integer; + }; + inline double bound(double value, double min, double max) const { + return value > max ? max : (value < min ? min : value); + }; + +}; + +L1MetPfProducerTDR::L1MetPfProducerTDR(const edm::ParameterSet& cfg) + : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))), + sinCosTableBits_(cfg.getParameter<uint>("sinCosTableBits")), + inverseDropBits_(cfg.getParameter<uint>("inverseDropBits")), + arcTanTableBits_(cfg.getParameter<uint>("arcTanTableBits")) +{ + produces<std::vector<l1t::EtSum> >(); + + sinCosTableSize_ = 1<<sinCosTableBits_; + cos_table.resize(sinCosTableSize_); + sin_table.resize(sinCosTableSize_); + + inversionTableSize_ = (1<<(PT_SIZE-inverseDropBits_)); + inv_table.resize(inversionTableSize_); + + arcTanTableSize_ = 1<<arcTanTableBits_; + atan_table.resize(arcTanTableSize_); + + init_projx_table( cos_table ); + init_projy_table( sin_table ); + init_inv_table( inv_table ); + init_atan_table( atan_table ); +} + +void L1MetPfProducerTDR::produce(edm::StreamID, + edm::Event& iEvent, + const edm::EventSetup& iSetup) const { + + edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; + iEvent.getByToken(_l1PFToken, l1PFCandidates); + + std::vector<float> pt; + std::vector<float> phi; + + for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands; i++){ + const auto& l1PFCand = l1PFCandidates->at(i); + pt.push_back( l1PFCand.pt() ); + phi.push_back( l1PFCand.phi() ); + } + + reco::Candidate::PolarLorentzVector metVector; + + if(useHLS) CalcMetHLS(pt, phi, metVector); + else CalcMetFast(pt, phi, metVector); + + l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); + + std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); + metCollection->push_back(theMET); + iEvent.put(std::move(metCollection)); +} + +void L1MetPfProducerTDR::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, + reco::Candidate::PolarLorentzVector &metVector) const{ + pxy_t hw_px = 0; + pxy_t hw_py = 0; + pxy_t hw_sumx = 0; + pxy_t hw_sumy = 0; + + for(uint i=0; i< pt.size(); i++){ + pt_t hw_pt = pt[i] / pt_lsb; + phi_t hw_phi = TVector2::Phi_mpi_pi( phi[i] ) / phi_lsb; + + ProjX(hw_pt, hw_phi, hw_px); + ProjY(hw_pt, hw_phi, hw_py); + + hw_sumx = hw_sumx + hw_px; + hw_sumy = hw_sumy + hw_py; + } + + pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); + hw_met = sqrt( int(hw_met) ); // stand-in for HLS::sqrt + + phi_t hw_met_phi = 0; + PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); + + metVector.SetPt( hw_met * pt_lsb ); + metVector.SetPhi( hw_met_phi * phi_lsb ); + metVector.SetEta(0); +} + + +void L1MetPfProducerTDR::CalcMetFast(std::vector<float> pt_vec, std::vector<float> phi_vec, + reco::Candidate::PolarLorentzVector &metVector) const{ + float sumx = 0; + float sumy = 0; + + for(uint i=0; i< pt_vec.size(); i++){ + float pt = quantize( pt_vec[i], 1./pt_lsb); + if (pt > maxPt_) pt = maxPt_; + + float phi = quantize( TVector2::Phi_mpi_pi(phi_vec[i]), 1./phi_lsb); + + // LUTs correspond to Q1 only to allow a smaller number of entries + float table_phi = quantize(phi, sinCosTableSize_/(M_PI/2)); + + float px = quantize( pt * cos(table_phi), 1./pt_lsb); + float py = quantize( pt * sin(table_phi), 1./pt_lsb); + + sumx = quantize(sumx + px, 1./pt_lsb); + sumy = quantize(sumy + py, 1./pt_lsb); + if( fabs(sumx) > maxPt_ ) sumx = maxPt_ * (sumx>0 ? 1 : -1); + if( fabs(sumy) > maxPt_ ) sumy = maxPt_ * (sumy>0 ? 1 : -1); + } + + float met = quantize(pow(sumx,2) + pow(sumy,2), 1./(pt_lsb*pt_lsb)); + met = quantize(sqrt(met), 1./pt_lsb); // stand-in for HLS::sqrt function + if ( met > maxPt_ ) met = maxPt_; + + // to calculate arctan for evaluation in [0,pi/4), need two more LUTs for atan(py/px) + float numerator = min(fabs(sumx), fabs(sumy)); + float denominator = max(fabs(sumx), fabs(sumy)); + if (denominator > inverseMax_) denominator = inverseMax_; + // no add'l quantization needed, since we currently store inverse for all pt values below max + // ratio is stored in units of 1/max pt val + float met_phi = atan( quantize(numerator / denominator, arcTanTableSize_) ); + + // recover the full angle from [0,pi/4) + if( fabs(sumx) < fabs(sumy) ) met_phi = M_PI/2 - met_phi; // to [0,pi/2) + if ( sumx < 0 ) met_phi = M_PI - met_phi; // to [0,pi) + if ( sumy < 0 ) met_phi = - met_phi; // to [-pi,pi) + met_phi = quantize(met_phi, 1./phi_lsb); + + metVector.SetPt( met ); + metVector.SetPhi( met_phi ); + metVector.SetEta(0); +} + +void L1MetPfProducerTDR::init_projx_table(std::vector<pt_t> table_out) { + // Return table of cos(phi) where phi is in (0,pi/2) + // multiply result by 2^(PT_SIZE) (equal to 1 in our units) + for (uint i = 0; i < sinCosTableSize_; i++) { + //store result, guarding overflow near costheta=1 + pt2_t x = round((1<<PT_SIZE) * cos(float(i)/sinCosTableSize_ * M_PI/2)); + // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) + if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; + else table_out[i] = x; + } + return; +} + +void L1MetPfProducerTDR::ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug) const{ + //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) + ap_uint<PHI_SIZE> phiQ1 = phi; + if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + + // get x component and flip sign if necessary + x = (pt * cos_table[phiQ1]) >> PT_SIZE; + if(debug) std::cout << pt << " cos_table[" << phiQ1 << "] = " << cos_table[phiQ1] << " " << x << std::endl; + if( phi>=(1<<(sinCosTableBits_)) + || phi<-(1<<(sinCosTableBits_))) + x = -x; + + return; +} + +void L1MetPfProducerTDR::init_projy_table(std::vector<pt_t> table_out) { + for (uint i = 0; i < sinCosTableSize_; i++) { + pt2_t x = round((1<<PT_SIZE) * sin(float(i)/sinCosTableSize_ * M_PI/2)); + if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; + else table_out[i] = x; + } + return; +} + +void L1MetPfProducerTDR::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ + + //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) + ap_uint<PHI_SIZE> phiQ1 = phi; + if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 + if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 + + // get y component and flip sign if necessary + y = (pt * sin_table[phiQ1]) >> PT_SIZE; + if(debug) std::cout << pt << " sin_table[" << phiQ1 << "] = " << sin_table[phiQ1] << " " << y << std::endl; + if( phi<0 ) y = -y; + + return; +} + +void L1MetPfProducerTDR::init_inv_table(std::vector<pt_t> table_out) { + // multiply result by 1=2^(PT-SIZE) + table_out[0]=(1<<PT_SIZE)-1; + for (uint i = 1; i < inversionTableSize_; i++) { + table_out[i] = round((1<<PT_SIZE) / float(i)); + } + return; +} +void L1MetPfProducerTDR::init_atan_table(std::vector<pt_t> table_out) { + // multiply result by 1=2^(PT-SIZE) + table_out[0]=int(0); + for (uint i = 1; i < arcTanTableSize_; i++) { + table_out[i] = int(round(atan(float(i)/arcTanTableSize_) * (1<<(PHI_SIZE-3)) / (M_PI/4))); + } + return; +} + +void L1MetPfProducerTDR::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ + if(px==0 && py==0){ phi = 0; return; } + + // get q1 coordinates + pt_t x = px; + pt_t y = py; + if(px<0) x = -px; + if(py<0) y = -py; + // transform so a<b + pt_t a = x; + pt_t b = y; + if(a>b){ a = y; b = x; } + + pt_t inv_b; + if(b>= (1<<(PT_SIZE-inverseDropBits_))) inv_b = 1; + // don't bother to store these large numbers in the LUT... + // instead approximate their inverses as 1 + else inv_b = inv_table[b]; + + pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) + // can't use arcTanTableSize_ as the type width since its not known at compile time + ap_uint<PHI_SIZE> atan_index = a_over_b >> (PT_SIZE-arcTanTableBits_); // keep only most significant bits + if(atan_index >= (1<<arcTanTableSize_)) atan_index = (1<<arcTanTableSize_)-1; + phi = atan_table[atan_index]; + + // rotate from (0,pi/4) to full quad1 + if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi + // other quadrants + if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi + if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi + if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both + + return; +} + +L1MetPfProducerTDR::~L1MetPfProducerTDR() {} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(L1MetPfProducerTDR); diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py index 1094e5ef0650e..3e76547768d34 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py @@ -1,11 +1,12 @@ import FWCore.ParameterSet.Config as cms +L1MetPfProducerTDR = cms.EDProducer("L1MetPfProducerTDR", + L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), + sinCosTableBits = cms.uint32(8), + inverseDropBits = cms.uint32(2), + arcTanTableBits = cms.uint32(7) +) + L1MetPfProducer = cms.EDProducer("L1MetPfProducer", L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), - sinCosTableBits = cms.uint32(8), - inverseDropBits = cms.uint32(2), - arcTanTableBits = cms.uint32(7) - ) -L1MetPfProducerNT = cms.EDProducer("L1MetPfProducerNewTypes", - L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), - ) +) From bc6ed5f7f0a8c733e5285d43867e08b12f77ceda Mon Sep 17 00:00:00 2001 From: Theodor Christian Herwig <2671-therwig@users.noreply.gitlab.cern.ch> Date: Mon, 12 Apr 2021 21:15:53 +0200 Subject: [PATCH 153/309] remove old version (cherry picked from commit ab239bfa9824678e9a4a13975bf0dfe472d6ced5) --- .../plugins/L1MetPfProducerTDR.cc | 317 ------------------ .../python/L1MetPfProducer_cfi.py | 8 +- 2 files changed, 1 insertion(+), 324 deletions(-) delete mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc deleted file mode 100644 index 5276a2c1cb8c1..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducerTDR.cc +++ /dev/null @@ -1,317 +0,0 @@ -#include <vector> -#include <ap_int.h> -#include <ap_fixed.h> -#include <TVector2.h> - -#include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" -#include "DataFormats/L1Trigger/interface/EtSum.h" -#include "DataFormats/Math/interface/LorentzVector.h" - -using namespace l1t; - -class L1MetPfProducerTDR : public edm::global::EDProducer<> { -public: - explicit L1MetPfProducerTDR(const edm::ParameterSet&); - ~L1MetPfProducerTDR() override; - -private: - void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; - edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; - - long unsigned int maxCands=128; - - // quantization controllers - static constexpr uint PT_SIZE = 16; - static constexpr uint PT2_SIZE = 2*PT_SIZE; - static constexpr uint PT_DEC_BITS = 2; - static constexpr uint PHI_SIZE = 10; - typedef ap_uint<PT_SIZE> pt_t; - typedef ap_int<PT_SIZE+1> pxy_t; - typedef ap_uint<PT2_SIZE> pt2_t; - typedef ap_int<PHI_SIZE> phi_t; - const float pt_lsb = 1./(1<<PT_DEC_BITS); // GeV - const float phi_lsb = 2*M_PI/(1<<PHI_SIZE); // rad - - std::vector<pt_t> cos_table; - std::vector<pt_t> sin_table; - std::vector<pt_t> inv_table; - std::vector<pt_t> atan_table; - uint sinCosTableBits_; - uint sinCosTableSize_; - uint inverseDropBits_; - uint inversionTableSize_; - uint arcTanTableBits_; - uint arcTanTableSize_; - - void init_projx_table(std::vector<pt_t> table_out); - void init_projy_table(std::vector<pt_t> table_out); - void init_inv_table(std::vector<pt_t> table_out); - void init_atan_table(std::vector<pt_t> table_out); - - void ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug=false) const; - void ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug=false) const; - void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const; - - void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const; - - void CalcMetFast(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const; - - bool useHLS=true; - - // for alternate floating-pt implementation - const float maxPt_ = (1<<(PT_SIZE-PT_DEC_BITS)); - const float inverseMax_ = (1<<(PT_SIZE-inverseDropBits_)); - - inline double quantize(double value, double to_integer) const { - return round(value * to_integer) / to_integer; - }; - inline double bound(double value, double min, double max) const { - return value > max ? max : (value < min ? min : value); - }; - -}; - -L1MetPfProducerTDR::L1MetPfProducerTDR(const edm::ParameterSet& cfg) - : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))), - sinCosTableBits_(cfg.getParameter<uint>("sinCosTableBits")), - inverseDropBits_(cfg.getParameter<uint>("inverseDropBits")), - arcTanTableBits_(cfg.getParameter<uint>("arcTanTableBits")) -{ - produces<std::vector<l1t::EtSum> >(); - - sinCosTableSize_ = 1<<sinCosTableBits_; - cos_table.resize(sinCosTableSize_); - sin_table.resize(sinCosTableSize_); - - inversionTableSize_ = (1<<(PT_SIZE-inverseDropBits_)); - inv_table.resize(inversionTableSize_); - - arcTanTableSize_ = 1<<arcTanTableBits_; - atan_table.resize(arcTanTableSize_); - - init_projx_table( cos_table ); - init_projy_table( sin_table ); - init_inv_table( inv_table ); - init_atan_table( atan_table ); -} - -void L1MetPfProducerTDR::produce(edm::StreamID, - edm::Event& iEvent, - const edm::EventSetup& iSetup) const { - - edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; - iEvent.getByToken(_l1PFToken, l1PFCandidates); - - std::vector<float> pt; - std::vector<float> phi; - - for(long unsigned int i=0; i<l1PFCandidates->size() && i<maxCands; i++){ - const auto& l1PFCand = l1PFCandidates->at(i); - pt.push_back( l1PFCand.pt() ); - phi.push_back( l1PFCand.phi() ); - } - - reco::Candidate::PolarLorentzVector metVector; - - if(useHLS) CalcMetHLS(pt, phi, metVector); - else CalcMetFast(pt, phi, metVector); - - l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); - - std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); - metCollection->push_back(theMET); - iEvent.put(std::move(metCollection)); -} - -void L1MetPfProducerTDR::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const{ - pxy_t hw_px = 0; - pxy_t hw_py = 0; - pxy_t hw_sumx = 0; - pxy_t hw_sumy = 0; - - for(uint i=0; i< pt.size(); i++){ - pt_t hw_pt = pt[i] / pt_lsb; - phi_t hw_phi = TVector2::Phi_mpi_pi( phi[i] ) / phi_lsb; - - ProjX(hw_pt, hw_phi, hw_px); - ProjY(hw_pt, hw_phi, hw_py); - - hw_sumx = hw_sumx + hw_px; - hw_sumy = hw_sumy + hw_py; - } - - pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); - hw_met = sqrt( int(hw_met) ); // stand-in for HLS::sqrt - - phi_t hw_met_phi = 0; - PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); - - metVector.SetPt( hw_met * pt_lsb ); - metVector.SetPhi( hw_met_phi * phi_lsb ); - metVector.SetEta(0); -} - - -void L1MetPfProducerTDR::CalcMetFast(std::vector<float> pt_vec, std::vector<float> phi_vec, - reco::Candidate::PolarLorentzVector &metVector) const{ - float sumx = 0; - float sumy = 0; - - for(uint i=0; i< pt_vec.size(); i++){ - float pt = quantize( pt_vec[i], 1./pt_lsb); - if (pt > maxPt_) pt = maxPt_; - - float phi = quantize( TVector2::Phi_mpi_pi(phi_vec[i]), 1./phi_lsb); - - // LUTs correspond to Q1 only to allow a smaller number of entries - float table_phi = quantize(phi, sinCosTableSize_/(M_PI/2)); - - float px = quantize( pt * cos(table_phi), 1./pt_lsb); - float py = quantize( pt * sin(table_phi), 1./pt_lsb); - - sumx = quantize(sumx + px, 1./pt_lsb); - sumy = quantize(sumy + py, 1./pt_lsb); - if( fabs(sumx) > maxPt_ ) sumx = maxPt_ * (sumx>0 ? 1 : -1); - if( fabs(sumy) > maxPt_ ) sumy = maxPt_ * (sumy>0 ? 1 : -1); - } - - float met = quantize(pow(sumx,2) + pow(sumy,2), 1./(pt_lsb*pt_lsb)); - met = quantize(sqrt(met), 1./pt_lsb); // stand-in for HLS::sqrt function - if ( met > maxPt_ ) met = maxPt_; - - // to calculate arctan for evaluation in [0,pi/4), need two more LUTs for atan(py/px) - float numerator = min(fabs(sumx), fabs(sumy)); - float denominator = max(fabs(sumx), fabs(sumy)); - if (denominator > inverseMax_) denominator = inverseMax_; - // no add'l quantization needed, since we currently store inverse for all pt values below max - // ratio is stored in units of 1/max pt val - float met_phi = atan( quantize(numerator / denominator, arcTanTableSize_) ); - - // recover the full angle from [0,pi/4) - if( fabs(sumx) < fabs(sumy) ) met_phi = M_PI/2 - met_phi; // to [0,pi/2) - if ( sumx < 0 ) met_phi = M_PI - met_phi; // to [0,pi) - if ( sumy < 0 ) met_phi = - met_phi; // to [-pi,pi) - met_phi = quantize(met_phi, 1./phi_lsb); - - metVector.SetPt( met ); - metVector.SetPhi( met_phi ); - metVector.SetEta(0); -} - -void L1MetPfProducerTDR::init_projx_table(std::vector<pt_t> table_out) { - // Return table of cos(phi) where phi is in (0,pi/2) - // multiply result by 2^(PT_SIZE) (equal to 1 in our units) - for (uint i = 0; i < sinCosTableSize_; i++) { - //store result, guarding overflow near costheta=1 - pt2_t x = round((1<<PT_SIZE) * cos(float(i)/sinCosTableSize_ * M_PI/2)); - // (using extra precision here (pt2_t, not pt_t) to check the out of bounds condition) - if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; - else table_out[i] = x; - } - return; -} - -void L1MetPfProducerTDR::ProjX(pt_t pt, phi_t phi, pxy_t &x, bool debug) const{ - //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) - ap_uint<PHI_SIZE> phiQ1 = phi; - if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 - - // get x component and flip sign if necessary - x = (pt * cos_table[phiQ1]) >> PT_SIZE; - if(debug) std::cout << pt << " cos_table[" << phiQ1 << "] = " << cos_table[phiQ1] << " " << x << std::endl; - if( phi>=(1<<(sinCosTableBits_)) - || phi<-(1<<(sinCosTableBits_))) - x = -x; - - return; -} - -void L1MetPfProducerTDR::init_projy_table(std::vector<pt_t> table_out) { - for (uint i = 0; i < sinCosTableSize_; i++) { - pt2_t x = round((1<<PT_SIZE) * sin(float(i)/sinCosTableSize_ * M_PI/2)); - if(x >= (1<<PT_SIZE)) table_out[i] = (1<<PT_SIZE)-1; - else table_out[i] = x; - } - return; -} - -void L1MetPfProducerTDR::ProjY(pt_t pt, phi_t phi, pxy_t &y, bool debug) const{ - - //map phi to first quadrant value: range [0, 2^(sinCosTableBits_)) - ap_uint<PHI_SIZE> phiQ1 = phi; - if(phi>=(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map 64-128 (0-63) to 63-0 - if(phi<0 && phi>=-(1<<(sinCosTableBits_))) phiQ1 = (1<<(sinCosTableBits_)) -1 - phiQ1; // map -64-1 (0-63) to 63-0 - - // get y component and flip sign if necessary - y = (pt * sin_table[phiQ1]) >> PT_SIZE; - if(debug) std::cout << pt << " sin_table[" << phiQ1 << "] = " << sin_table[phiQ1] << " " << y << std::endl; - if( phi<0 ) y = -y; - - return; -} - -void L1MetPfProducerTDR::init_inv_table(std::vector<pt_t> table_out) { - // multiply result by 1=2^(PT-SIZE) - table_out[0]=(1<<PT_SIZE)-1; - for (uint i = 1; i < inversionTableSize_; i++) { - table_out[i] = round((1<<PT_SIZE) / float(i)); - } - return; -} -void L1MetPfProducerTDR::init_atan_table(std::vector<pt_t> table_out) { - // multiply result by 1=2^(PT-SIZE) - table_out[0]=int(0); - for (uint i = 1; i < arcTanTableSize_; i++) { - table_out[i] = int(round(atan(float(i)/arcTanTableSize_) * (1<<(PHI_SIZE-3)) / (M_PI/4))); - } - return; -} - -void L1MetPfProducerTDR::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi) const{ - if(px==0 && py==0){ phi = 0; return; } - - // get q1 coordinates - pt_t x = px; - pt_t y = py; - if(px<0) x = -px; - if(py<0) y = -py; - // transform so a<b - pt_t a = x; - pt_t b = y; - if(a>b){ a = y; b = x; } - - pt_t inv_b; - if(b>= (1<<(PT_SIZE-inverseDropBits_))) inv_b = 1; - // don't bother to store these large numbers in the LUT... - // instead approximate their inverses as 1 - else inv_b = inv_table[b]; - - pt_t a_over_b = a * inv_b; // x 2^(PT_SIZE-DROP_BITS) - // can't use arcTanTableSize_ as the type width since its not known at compile time - ap_uint<PHI_SIZE> atan_index = a_over_b >> (PT_SIZE-arcTanTableBits_); // keep only most significant bits - if(atan_index >= (1<<arcTanTableSize_)) atan_index = (1<<arcTanTableSize_)-1; - phi = atan_table[atan_index]; - - // rotate from (0,pi/4) to full quad1 - if(y>x) phi = (1<<(PHI_SIZE-2)) - phi; //phi = pi/2 - phi - // other quadrants - if( px < 0 && py > 0 ) phi = (1<<(PHI_SIZE-1)) - phi; // Q2 phi = pi - phi - if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi - if( px < 0 && py < 0 ) phi = -((1<<(PHI_SIZE-1)) - phi); // Q3 composition of both - - return; -} - -L1MetPfProducerTDR::~L1MetPfProducerTDR() {} - -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(L1MetPfProducerTDR); diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py index 3e76547768d34..2be9b12b96e2e 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py @@ -1,12 +1,6 @@ import FWCore.ParameterSet.Config as cms -L1MetPfProducerTDR = cms.EDProducer("L1MetPfProducerTDR", - L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), - sinCosTableBits = cms.uint32(8), - inverseDropBits = cms.uint32(2), - arcTanTableBits = cms.uint32(7) -) - L1MetPfProducer = cms.EDProducer("L1MetPfProducer", L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), + maxCandidates = cms.int32(128), ) From 5ba474f597202b107c33cef238b187c5e86bb04f Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Tue, 4 May 2021 10:41:01 +0200 Subject: [PATCH 154/309] scram format --- .../plugins/L1MetPfProducer.cc | 303 ++++++++++-------- 1 file changed, 163 insertions(+), 140 deletions(-) diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc index aa853b6c72b71..457aea90637c4 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc @@ -23,103 +23,98 @@ class L1MetPfProducer : public edm::global::EDProducer<> { void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; edm::EDGetTokenT<vector<l1t::PFCandidate>> _l1PFToken; - int maxCands_=128; - - // quantization controllers - typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV - typedef ap_int<12> phi_t; // LSB is pi/720 ~ 0.0044 and max is +/-8.9 - const float ptLSB_ = 0.25; // GeV - const float phiLSB_ = M_PI/720; // rad - - // derived, helper types - typedef ap_fixed<pt_t::width+1,pt_t::iwidth+1, AP_RND, AP_SAT> pxy_t; - typedef ap_fixed<2*pt_t::width,2*pt_t::iwidth, AP_RND, AP_SAT> pt2_t; - // derived, helper constants - const float maxPt_ = ((1<<pt_t::width)-1)*ptLSB_; - const phi_t hwPi_ = round(M_PI/phiLSB_); - const phi_t hwPiOverTwo_ = round(M_PI/(2*phiLSB_)); - - typedef ap_ufixed<pt_t::width,0> inv_t; // can't easily use the MAXPT/pt trick with ap_fixed - - // to make configurable... - const int dropBits_=2; - const int dropFactor_=(1<<dropBits_); - const int invTableBits_=10; - const int invTableSize_=(1<<invTableBits_); - - void Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug=false) const; - void PhiFromXY(pxy_t px, pxy_t py, phi_t &phi, bool debug=false) const; - - void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const; - + int maxCands_ = 128; + + // quantization controllers + typedef ap_ufixed<14, 12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + typedef ap_int<12> phi_t; // LSB is pi/720 ~ 0.0044 and max is +/-8.9 + const float ptLSB_ = 0.25; // GeV + const float phiLSB_ = M_PI / 720; // rad + + // derived, helper types + typedef ap_fixed<pt_t::width + 1, pt_t::iwidth + 1, AP_RND, AP_SAT> pxy_t; + typedef ap_fixed<2 * pt_t::width, 2 * pt_t::iwidth, AP_RND, AP_SAT> pt2_t; + // derived, helper constants + const float maxPt_ = ((1 << pt_t::width) - 1) * ptLSB_; + const phi_t hwPi_ = round(M_PI / phiLSB_); + const phi_t hwPiOverTwo_ = round(M_PI / (2 * phiLSB_)); + + typedef ap_ufixed<pt_t::width, 0> inv_t; // can't easily use the MAXPT/pt trick with ap_fixed + + // to make configurable... + const int dropBits_ = 2; + const int dropFactor_ = (1 << dropBits_); + const int invTableBits_ = 10; + const int invTableSize_ = (1 << invTableBits_); + + void Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool debug = false) const; + void PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug = false) const; + + void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, reco::Candidate::PolarLorentzVector& metVector) const; }; L1MetPfProducer::L1MetPfProducer(const edm::ParameterSet& cfg) : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))), - maxCands_(cfg.getParameter<int>("maxCands")) -{ - produces<std::vector<l1t::EtSum> >(); + maxCands_(cfg.getParameter<int>("maxCands")) { + produces<std::vector<l1t::EtSum>>(); } -void L1MetPfProducer::produce(edm::StreamID, - edm::Event& iEvent, - const edm::EventSetup& iSetup) const { - +void L1MetPfProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; iEvent.getByToken(_l1PFToken, l1PFCandidates); std::vector<float> pt; std::vector<float> phi; - for(int i=0; i<int(l1PFCandidates->size()) && (i<maxCands_|| maxCands_<0); i++){ - const auto& l1PFCand = l1PFCandidates->at(i); - pt.push_back( l1PFCand.pt() ); - phi.push_back( l1PFCand.phi() ); + for (int i = 0; i < int(l1PFCandidates->size()) && (i < maxCands_ || maxCands_ < 0); i++) { + const auto& l1PFCand = l1PFCandidates->at(i); + pt.push_back(l1PFCand.pt()); + phi.push_back(l1PFCand.phi()); } reco::Candidate::PolarLorentzVector metVector; CalcMetHLS(pt, phi, metVector); - + l1t::EtSum theMET(metVector, l1t::EtSum::EtSumType::kTotalHt, 0, 0, 0, 0); - std::unique_ptr<std::vector<l1t::EtSum> > metCollection(new std::vector<l1t::EtSum>(0)); + std::unique_ptr<std::vector<l1t::EtSum>> metCollection(new std::vector<l1t::EtSum>(0)); metCollection->push_back(theMET); iEvent.put(std::move(metCollection)); } -void L1MetPfProducer::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, - reco::Candidate::PolarLorentzVector &metVector) const{ - pxy_t hw_px = 0; - pxy_t hw_py = 0; - pxy_t hw_sumx = 0; - pxy_t hw_sumy = 0; - - for(uint i=0; i< pt.size(); i++){ - pt_t hw_pt = min(pt[i], maxPt_); - phi_t hw_phi = float(TVector2::Phi_mpi_pi( phi[i] ) / phiLSB_); - - Project(hw_pt, hw_phi, hw_px, true); - Project(hw_pt, hw_phi, hw_py, false); - - hw_sumx = hw_sumx - hw_px; - hw_sumy = hw_sumy - hw_py; - } - - pt2_t hw_met = pt2_t(hw_sumx)*pt2_t(hw_sumx) + pt2_t(hw_sumy)*pt2_t(hw_sumy); - hw_met = sqrt( int(hw_met) ); // stand-in for HLS::sqrt - - phi_t hw_met_phi = 0; - PhiFromXY(hw_sumx,hw_sumy,hw_met_phi); - - metVector.SetPt( hw_met.to_double() ); - metVector.SetPhi( hw_met_phi.to_double() * phiLSB_ ); - metVector.SetEta(0); +void L1MetPfProducer::CalcMetHLS(std::vector<float> pt, + std::vector<float> phi, + reco::Candidate::PolarLorentzVector& metVector) const { + pxy_t hw_px = 0; + pxy_t hw_py = 0; + pxy_t hw_sumx = 0; + pxy_t hw_sumy = 0; + + for (uint i = 0; i < pt.size(); i++) { + pt_t hw_pt = min(pt[i], maxPt_); + phi_t hw_phi = float(TVector2::Phi_mpi_pi(phi[i]) / phiLSB_); + + Project(hw_pt, hw_phi, hw_px, true); + Project(hw_pt, hw_phi, hw_py, false); + + hw_sumx = hw_sumx - hw_px; + hw_sumy = hw_sumy - hw_py; + } + + pt2_t hw_met = pt2_t(hw_sumx) * pt2_t(hw_sumx) + pt2_t(hw_sumy) * pt2_t(hw_sumy); + hw_met = sqrt(int(hw_met)); // stand-in for HLS::sqrt + + phi_t hw_met_phi = 0; + PhiFromXY(hw_sumx, hw_sumy, hw_met_phi); + + metVector.SetPt(hw_met.to_double()); + metVector.SetPhi(hw_met_phi.to_double() * phiLSB_); + metVector.SetEta(0); } -void L1MetPfProducer::Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool debug) const{ - /* +void L1MetPfProducer::Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool debug) const { + /* Convert pt and phi to px (py) 1) Map phi to the first quadrant to reduce LUT size 2) Lookup sin(phiQ1), where the result is in [0,maxPt] @@ -129,76 +124,104 @@ void L1MetPfProducer::Project(pt_t pt, phi_t phi, pxy_t &pxy, bool isX, bool deb 4) Check px=-|px|. */ - // set phi to first quadrant - phi_t phiQ1 = (phi>0) ? phi : phi_t(-phi); // Q1/Q4 - if(phiQ1 >= hwPiOverTwo_) phiQ1 = hwPi_ - phiQ1; - - if (phiQ1 > hwPiOverTwo_){ - std::cout << "unexpected phi (high)" << std::endl; - phiQ1 = hwPiOverTwo_; - } else if (phiQ1<0){ - std::cout << "unexpected phi (low)" << std::endl; - phiQ1 = 0; - } - if(isX){ - typedef ap_ufixed<14,12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV - ap_ufixed<pt_t::width,0> cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); - pxy = pt * cosPhi; - if (phi > hwPiOverTwo_ || phi < -hwPiOverTwo_) pxy = -pxy; - } else { - ap_ufixed<pt_t::width,0> sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI/2); - pxy = pt * sinPhi; - if (phi < 0) pxy = -pxy; - } + // set phi to first quadrant + phi_t phiQ1 = (phi > 0) ? phi : phi_t(-phi); // Q1/Q4 + if (phiQ1 >= hwPiOverTwo_) + phiQ1 = hwPi_ - phiQ1; + + if (phiQ1 > hwPiOverTwo_) { + std::cout << "unexpected phi (high)" << std::endl; + phiQ1 = hwPiOverTwo_; + } else if (phiQ1 < 0) { + std::cout << "unexpected phi (low)" << std::endl; + phiQ1 = 0; + } + if (isX) { + typedef ap_ufixed<14, 12, AP_RND, AP_WRAP> pt_t; // LSB is 0.25 and max is 4 TeV + ap_ufixed<pt_t::width, 0> cosPhi = cos(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI / 2); + pxy = pt * cosPhi; + if (phi > hwPiOverTwo_ || phi < -hwPiOverTwo_) + pxy = -pxy; + } else { + ap_ufixed<pt_t::width, 0> sinPhi = sin(phiQ1.to_double() / hwPiOverTwo_.to_double() * M_PI / 2); + pxy = pt * sinPhi; + if (phi < 0) + pxy = -pxy; + } } -void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t &phi, bool debug) const{ - if(px==0 && py==0){ phi = 0; return; } - if(px==0){ phi = py>0 ? hwPiOverTwo_ : phi_t(-hwPiOverTwo_); return; } - if(py==0){ phi = px>0 ? phi_t(0) : phi_t(-hwPi_); return; } - - // get q1 coordinates - pt_t x = px>0 ? pt_t(px) : pt_t(-px); //px>=0 ? px : -px; - pt_t y = py>0 ? pt_t(py) : pt_t(-py); //px>=0 ? px : -px; - // transform so a<b - pt_t a = x<y ? x : y; - pt_t b = x<y ? y : x; - - - if (b.to_double() > maxPt_ / dropFactor_) b = maxPt_ / dropFactor_; - // map [0,max/4) to inv table size - int index = round((b.to_double()/(maxPt_/dropFactor_)) * invTableSize_); - float bcheck = (float(index) / invTableSize_) * (maxPt_/dropFactor_); - inv_t inv_b = 1./((float(index) / invTableSize_) * (maxPt_/dropFactor_)); - - inv_t a_over_b = a * inv_b; - - if (debug){ - printf(" a, b = %f, %f; index, inv = %d, %f; ratio = %f \n", a.to_double(), b.to_double(),index, inv_b.to_double(), a_over_b.to_double() ); - printf(" bcheck, 1/bc = %f, %f -- %d %f %d \n", bcheck, 1./bcheck, invTableSize_ , maxPt_, dropFactor_ ); - } - - int atanTableBits_=7; - int atanTableSize_=(1<<atanTableBits_); - index = round(a_over_b.to_double() * atanTableSize_); - phi = atan(float(index) / atanTableSize_) / phiLSB_; - - if (debug){ - printf(" atan index, phi = %d, %f (%f rad) real atan(a/b)= %f \n", index, phi.to_double(), - phi.to_double() * (M_PI/hwPi_.to_double()), atan(a.to_double()/b.to_double())); - } - - // rotate from (0,pi/4) to full quad1 - if(y>x) phi = hwPiOverTwo_ - phi; //phi = pi/2 - phi - // other quadrants - if( px < 0 && py > 0 ) phi = hwPi_ - phi; // Q2 phi = pi - phi - if( px > 0 && py < 0 ) phi = -phi; // Q4 phi = -phi - if( px < 0 && py < 0 ) phi = -(hwPi_ - phi); // Q3 composition of both - - if (debug){ - printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", - phi.to_double(), phi.to_double() * (M_PI/hwPi_.to_double()), atan2(py.to_double(),px.to_double()), px.to_double(), py.to_double()); - } +void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) const { + if (px == 0 && py == 0) { + phi = 0; + return; + } + if (px == 0) { + phi = py > 0 ? hwPiOverTwo_ : phi_t(-hwPiOverTwo_); + return; + } + if (py == 0) { + phi = px > 0 ? phi_t(0) : phi_t(-hwPi_); + return; + } + + // get q1 coordinates + pt_t x = px > 0 ? pt_t(px) : pt_t(-px); //px>=0 ? px : -px; + pt_t y = py > 0 ? pt_t(py) : pt_t(-py); //px>=0 ? px : -px; + // transform so a<b + pt_t a = x < y ? x : y; + pt_t b = x < y ? y : x; + + if (b.to_double() > maxPt_ / dropFactor_) + b = maxPt_ / dropFactor_; + // map [0,max/4) to inv table size + int index = round((b.to_double() / (maxPt_ / dropFactor_)) * invTableSize_); + float bcheck = (float(index) / invTableSize_) * (maxPt_ / dropFactor_); + inv_t inv_b = 1. / ((float(index) / invTableSize_) * (maxPt_ / dropFactor_)); + + inv_t a_over_b = a * inv_b; + + if (debug) { + printf(" a, b = %f, %f; index, inv = %d, %f; ratio = %f \n", + a.to_double(), + b.to_double(), + index, + inv_b.to_double(), + a_over_b.to_double()); + printf(" bcheck, 1/bc = %f, %f -- %d %f %d \n", bcheck, 1. / bcheck, invTableSize_, maxPt_, dropFactor_); + } + + int atanTableBits_ = 7; + int atanTableSize_ = (1 << atanTableBits_); + index = round(a_over_b.to_double() * atanTableSize_); + phi = atan(float(index) / atanTableSize_) / phiLSB_; + + if (debug) { + printf(" atan index, phi = %d, %f (%f rad) real atan(a/b)= %f \n", + index, + phi.to_double(), + phi.to_double() * (M_PI / hwPi_.to_double()), + atan(a.to_double() / b.to_double())); + } + + // rotate from (0,pi/4) to full quad1 + if (y > x) + phi = hwPiOverTwo_ - phi; //phi = pi/2 - phi + // other quadrants + if (px < 0 && py > 0) + phi = hwPi_ - phi; // Q2 phi = pi - phi + if (px > 0 && py < 0) + phi = -phi; // Q4 phi = -phi + if (px < 0 && py < 0) + phi = -(hwPi_ - phi); // Q3 composition of both + + if (debug) { + printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", + phi.to_double(), + phi.to_double() * (M_PI / hwPi_.to_double()), + atan2(py.to_double(), px.to_double()), + px.to_double(), + py.to_double()); + } } L1MetPfProducer::~L1MetPfProducer() {} From 30cec2ead5420f070d120fd6086aafb6558093fb Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski <sebastian.wozniewski@kit.edu> Date: Tue, 4 May 2021 13:15:50 +0200 Subject: [PATCH 155/309] restore tau DQM for previous eras --- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 8705561ba5ded..1c2e54a311761 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -21,6 +21,27 @@ run2_miniAOD_80XLegacy.toModify(nanoDQM, vplots = _vplots80X ) +_tauPlotsPreV9 = nanoDQM.vplots.Tau.plots.Clone() +_tauPlotsPreV9.idDecayModeOldDMs = None +_tauPlotsPreV9.extend([ + Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), + Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), + Plot1D('idMVAnewDM2017v2', 'idMVAnewDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBnewDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM', 'idMVAoldDM', 64, -0.5, 63.5, 'IsolationMVArun2v1DBoldDMwLT ID working point: bitmask 1 = VLoose, 2 = Loose, 4 = Medium, 8 = Tight, 16 = VTight, 32 = VVTight'), + Plot1D('idMVAoldDM2017v1', 'idMVAoldDM2017v1', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v1): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDM2017v2', 'idMVAoldDM2017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBoldDMwLT ID working point (2017v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('idMVAoldDMdR032017v2', 'idMVAoldDMdR032017v2', 128, -0.5, 127.5, 'IsolationMVArun2v1DBdR03oldDMwLT ID working point (217v2): bitmask 1 = VVLoose, 2 = VLoose, 4 = Loose, 8 = Medium, 16 = Tight, 32 = VTight, 64 = VVTight'), + Plot1D('rawAntiEle', 'rawAntiEle', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator'), + Plot1D('rawAntiEle2018', 'rawAntiEle2018', 20, -100, 100, 'Anti-electron MVA discriminator V6 raw output discriminator (2018)'), + Plot1D('rawAntiEleCat', 'rawAntiEleCat', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category'), + Plot1D('rawAntiEleCat2018', 'rawAntiEleCat2018', 17, -1.5, 15.5, 'Anti-electron MVA discriminator V6 category (2018)'), + Plot1D('rawMVAnewDM2017v2', 'rawMVAnewDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDM', 'rawMVAoldDM', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator'), + Plot1D('rawMVAoldDM2017v1', 'rawMVAoldDM2017v1', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v1)'), + Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'), + Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)') +]) +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(nanoDQM.vplots.Tau, plots = _tauPlotsPreV9) _METFixEE2017_DQMentry = nanoDQM.vplots.MET.clone() _METFixEE2017_plots = cms.VPSet() From 8db6c0b231a895a6d1df62b870e90d7ed7ef8964 Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski <sebastian.wozniewski@kit.edu> Date: Tue, 4 May 2021 13:32:09 +0200 Subject: [PATCH 156/309] fix syntax of removal of idDecayModeOldDMs in DQM --- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 1c2e54a311761..cc7ec2d71add3 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -21,8 +21,10 @@ run2_miniAOD_80XLegacy.toModify(nanoDQM, vplots = _vplots80X ) -_tauPlotsPreV9 = nanoDQM.vplots.Tau.plots.Clone() -_tauPlotsPreV9.idDecayModeOldDMs = None +_tauPlotsPreV9 = cms.VPSet() +for plot in nanoDQM.vplots.Tau.plots: + if plot.name.value()!="idDecayModeOldDMs": + _tauPlotsPreV9.append(plot) _tauPlotsPreV9.extend([ Plot1D('idDecayMode', 'idDecayMode', 2, -0.5, 1.5, "tauID('decayModeFinding')"), Plot1D('idDecayModeNewDMs', 'idDecayModeNewDMs', 2, -0.5, 1.5, "tauID('decayModeFindingNewDMs')"), From a800244f2a33b6f4c16db78d23e1ad2afc0ec277 Mon Sep 17 00:00:00 2001 From: Pieter David <pieter.david@cern.ch> Date: Tue, 4 May 2021 16:12:00 +0200 Subject: [PATCH 157/309] Use esConsumes for SiStripFedZeroSuppression --- .../interface/SiStripFedZeroSuppression.h | 26 ++++++--- .../interface/SiStripRawProcessingFactory.h | 2 +- .../src/SiStripFedZeroSuppression.cc | 54 +++++++++---------- .../src/SiStripRawProcessingFactory.cc | 10 ++-- .../plugins/DigiSimLinkAlgorithm.cc | 2 +- .../plugins/PreMixingSiStripWorker.cc | 2 +- .../plugins/SiStripDigitizerAlgorithm.cc | 2 +- 7 files changed, 53 insertions(+), 45 deletions(-) diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h index 2f797e96e6d5a..b1ada64044622 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h @@ -7,7 +7,11 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESWatcher.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h" +#include "CondFormats/DataRecord/interface/SiStripThresholdRcd.h" #include <vector> class SiStripNoises; @@ -17,9 +21,14 @@ class SiStripFedZeroSuppression { friend class SiStripRawProcessingFactory; public: - SiStripFedZeroSuppression(uint16_t fedalgo, bool trunc = true, bool trunc10bits = false) - : noise_cache_id(0), - threshold_cache_id(0), + SiStripFedZeroSuppression(uint16_t fedalgo, + edm::ConsumesCollector* iC = nullptr, + bool trunc = true, + bool trunc10bits = false) + : noiseToken_{iC ? decltype(noiseToken_){iC->esConsumes<SiStripNoises, SiStripNoisesRcd>()} + : decltype(noiseToken_){}}, + thresholdToken_{iC ? decltype(thresholdToken_){iC->esConsumes<SiStripThreshold, SiStripThresholdRcd>()} + : decltype(thresholdToken_){}}, theFEDalgorithm(fedalgo), doTruncate(trunc), doTruncate10bits(trunc10bits) {} @@ -41,9 +50,12 @@ class SiStripFedZeroSuppression { }; private: - edm::ESHandle<SiStripNoises> noiseHandle; - edm::ESHandle<SiStripThreshold> thresholdHandle; - uint32_t noise_cache_id, threshold_cache_id; + edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> noiseToken_; + edm::ESGetToken<SiStripThreshold, SiStripThresholdRcd> thresholdToken_; + const SiStripNoises* noiseHandle_; + const SiStripThreshold* thresholdHandle_; + edm::ESWatcher<SiStripNoisesRcd> noiseWatcher_; + edm::ESWatcher<SiStripThresholdRcd> thresholdWatcher_; uint16_t theFEDalgorithm; bool isAValidDigi(); diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h index 1a84c4729ea30..abe31a61f0eb9 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripRawProcessingFactory.h @@ -16,7 +16,7 @@ class SiStripRawProcessingFactory { public: static std::unique_ptr<SiStripRawProcessingAlgorithms> create(const edm::ParameterSet&, edm::ConsumesCollector); - static std::unique_ptr<SiStripFedZeroSuppression> create_Suppressor(const edm::ParameterSet&); + static std::unique_ptr<SiStripFedZeroSuppression> create_Suppressor(const edm::ParameterSet&, edm::ConsumesCollector); static std::unique_ptr<SiStripPedestalsSubtractor> create_SubtractorPed(const edm::ParameterSet&, edm::ConsumesCollector); static std::unique_ptr<SiStripCommonModeNoiseSubtractor> create_SubtractorCMN(const edm::ParameterSet&, diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc index 4ace9de7efe9a..8a902c13123e7 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc @@ -10,23 +10,18 @@ using namespace std; void SiStripFedZeroSuppression::init(const edm::EventSetup& es) { - uint32_t n_cache_id = es.get<SiStripNoisesRcd>().cacheIdentifier(); - uint32_t t_cache_id = es.get<SiStripThresholdRcd>().cacheIdentifier(); - - if (n_cache_id != noise_cache_id) { - es.get<SiStripNoisesRcd>().get(noiseHandle); - noise_cache_id = n_cache_id; + if (noiseWatcher_.check(es)) { + noiseHandle_ = &es.getData(noiseToken_); } - if (t_cache_id != threshold_cache_id) { - es.get<SiStripThresholdRcd>().get(thresholdHandle); - threshold_cache_id = t_cache_id; + if (thresholdWatcher_.check(es)) { + thresholdHandle_ = &es.getData(thresholdToken_); } } void SiStripFedZeroSuppression::suppress(const std::vector<SiStripDigi>& in, std::vector<SiStripDigi>& selectedSignal, uint32_t detID) { - suppress(in, selectedSignal, detID, *noiseHandle, *thresholdHandle); + suppress(in, selectedSignal, detID, *noiseHandle_, *thresholdHandle_); } void SiStripFedZeroSuppression::suppress(const std::vector<SiStripDigi>& in, @@ -133,8 +128,8 @@ void SiStripFedZeroSuppression::suppress(const std::vector<SiStripDigi>& in, void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, edm::DetSet<SiStripDigi>& out) { const uint32_t detID = out.id; - SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detID); - SiStripThreshold::Range detThRange = thresholdHandle->getRange(detID); + SiStripNoises::Range detNoiseRange = noiseHandle_->getRange(detID); + SiStripThreshold::Range detThRange = thresholdHandle_->getRange(detID); #ifdef DEBUG_SiStripZeroSuppression_ if (edm::isDebugEnabled()) LogTrace("SiStripZeroSuppression") @@ -152,10 +147,11 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, #endif adc = in_iter->adc(); - SiStripThreshold::Data thresholds = thresholdHandle->getData(strip, detThRange); - theFEDlowThresh = static_cast<int16_t>(thresholds.getLth() * noiseHandle->getNoiseFast(strip, detNoiseRange) + 0.5); + SiStripThreshold::Data thresholds = thresholdHandle_->getData(strip, detThRange); + theFEDlowThresh = + static_cast<int16_t>(thresholds.getLth() * noiseHandle_->getNoiseFast(strip, detNoiseRange) + 0.5); theFEDhighThresh = - static_cast<int16_t>(thresholds.getHth() * noiseHandle->getNoiseFast(strip, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds.getHth() * noiseHandle_->getNoiseFast(strip, detNoiseRange) + 0.5); adcPrev = -9999; adcNext = -9999; @@ -171,11 +167,11 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, theNextFEDhighThresh = 9999; } else { adcNext = (in_iter + 1)->adc(); - SiStripThreshold::Data thresholds_1 = thresholdHandle->getData(strip + 1, detThRange); + SiStripThreshold::Data thresholds_1 = thresholdHandle_->getData(strip + 1, detThRange); theNextFEDlowThresh = - static_cast<int16_t>(thresholds_1.getLth() * noiseHandle->getNoiseFast(strip + 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getLth() * noiseHandle_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); theNextFEDhighThresh = - static_cast<int16_t>(thresholds_1.getHth() * noiseHandle->getNoiseFast(strip + 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getHth() * noiseHandle_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); } /* Similarily, for the first strip @@ -187,11 +183,11 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, thePrevFEDhighThresh = 9999; } else { adcPrev = (in_iter - 1)->adc(); - SiStripThreshold::Data thresholds_1 = thresholdHandle->getData(strip - 1, detThRange); + SiStripThreshold::Data thresholds_1 = thresholdHandle_->getData(strip - 1, detThRange); thePrevFEDlowThresh = - static_cast<int16_t>(thresholds_1.getLth() * noiseHandle->getNoiseFast(strip - 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getLth() * noiseHandle_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); thePrevFEDhighThresh = - static_cast<int16_t>(thresholds_1.getHth() * noiseHandle->getNoiseFast(strip - 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getHth() * noiseHandle_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); } if (adcNext < adcPrev) { adcMaxNeigh = adcPrev; @@ -213,8 +209,8 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, theNext2FEDlowThresh = 9999; } else if (strip % 128 < 126) { adcNext2 = (in_iter + 2)->adc(); - theNext2FEDlowThresh = static_cast<int16_t>(thresholdHandle->getData(strip + 2, detThRange).getLth() * - noiseHandle->getNoiseFast(strip + 2, detNoiseRange) + + theNext2FEDlowThresh = static_cast<int16_t>(thresholdHandle_->getData(strip + 2, detThRange).getLth() * + noiseHandle_->getNoiseFast(strip + 2, detNoiseRange) + 0.5); } if (strip % 128 <= 1) { @@ -222,8 +218,8 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, thePrev2FEDlowThresh = 9999; } else if (strip % 128 > 1) { adcPrev2 = (in_iter - 2)->adc(); - thePrev2FEDlowThresh = static_cast<int16_t>(thresholdHandle->getData(strip - 2, detThRange).getLth() * - noiseHandle->getNoiseFast(strip - 2, detNoiseRange) + + thePrev2FEDlowThresh = static_cast<int16_t>(thresholdHandle_->getData(strip - 2, detThRange).getLth() * + noiseHandle_->getNoiseFast(strip - 2, detNoiseRange) + 0.5); } //GB 23/6/08: truncation should be done at the very beginning @@ -233,8 +229,8 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, } void SiStripFedZeroSuppression::fillThresholds_(const uint32_t detID, size_t size) { - SiStripNoises::Range detNoiseRange = noiseHandle->getRange(detID); - SiStripThreshold::Range detThRange = thresholdHandle->getRange(detID); + SiStripNoises::Range detNoiseRange = noiseHandle_->getRange(detID); + SiStripThreshold::Range detThRange = thresholdHandle_->getRange(detID); if (highThr_.size() != size) { highThr_.resize(size); @@ -244,8 +240,8 @@ void SiStripFedZeroSuppression::fillThresholds_(const uint32_t detID, size_t siz lowThrSN_.resize(size); } - noiseHandle->allNoises(noises_, detNoiseRange); - thresholdHandle->allThresholds(lowThrSN_, highThrSN_, detThRange); // thresholds as S/N + noiseHandle_->allNoises(noises_, detNoiseRange); + thresholdHandle_->allThresholds(lowThrSN_, highThrSN_, detThRange); // thresholds as S/N for (size_t strip = 0; strip < size; ++strip) { float noise = noises_[strip]; // uncomment line below to check bluk noise decoding diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc index c87dd2e9c89b7..0a09812b9c932 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripRawProcessingFactory.cc @@ -19,7 +19,7 @@ std::unique_ptr<SiStripRawProcessingAlgorithms> SiStripRawProcessingFactory::cre new SiStripRawProcessingAlgorithms(iC, create_SubtractorPed(conf, iC), create_SubtractorCMN(conf, iC), - create_Suppressor(conf), + create_Suppressor(conf, iC), create_Restorer(conf, iC), conf.getParameter<bool>("doAPVRestore"), conf.getParameter<bool>("useCMMeanMap"))); @@ -61,8 +61,8 @@ std::unique_ptr<SiStripCommonModeNoiseSubtractor> SiStripRawProcessingFactory::c return std::unique_ptr<SiStripCommonModeNoiseSubtractor>(new MedianCMNSubtractor()); } -std::unique_ptr<SiStripFedZeroSuppression> SiStripRawProcessingFactory::create_Suppressor( - const edm::ParameterSet& conf) { +std::unique_ptr<SiStripFedZeroSuppression> SiStripRawProcessingFactory::create_Suppressor(const edm::ParameterSet& conf, + edm::ConsumesCollector iC) { const uint32_t mode = conf.getParameter<uint32_t>("SiStripFedZeroSuppressionMode"); const bool trunc = conf.getParameter<bool>("TruncateInSuppressor"); const bool trunc10bits = conf.getParameter<bool>("Use10bitsTruncation"); @@ -71,11 +71,11 @@ std::unique_ptr<SiStripFedZeroSuppression> SiStripRawProcessingFactory::create_S case 2: case 3: case 4: - return std::make_unique<SiStripFedZeroSuppression>(mode, trunc, trunc10bits); + return std::make_unique<SiStripFedZeroSuppression>(mode, &iC, trunc, trunc10bits); default: edm::LogError("SiStripRawProcessingFactory::createSuppressor") << "Unregistered mode: " << mode << ". Use one of {1,2,3,4}."; - return std::make_unique<SiStripFedZeroSuppression>(4, true, trunc10bits); + return std::make_unique<SiStripFedZeroSuppression>(4, &iC, true, trunc10bits); } } diff --git a/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc index cf79b989c929b..7bfa25dfd5d7e 100644 --- a/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/DigiSimLinkAlgorithm.cc @@ -52,7 +52,7 @@ DigiSimLinkAlgorithm::DigiSimLinkAlgorithm(const edm::ParameterSet& conf) : conf theDigiSimLinkPileUpSignals = new DigiSimLinkPileUpSignals(); theSiNoiseAdder = new SiGaussianTailNoiseAdder(theThreshold); theSiDigitalConverter = new SiTrivialDigitalConverter(theElectronPerADC, PreMixing_); - theSiZeroSuppress = new SiStripFedZeroSuppression(theFedAlgo); + theSiZeroSuppress = new SiStripFedZeroSuppression(theFedAlgo, nullptr); } DigiSimLinkAlgorithm::~DigiSimLinkAlgorithm() { diff --git a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc index 36e027cb03fd0..7a3450bc75508 100644 --- a/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc +++ b/SimTracker/SiStripDigitizer/plugins/PreMixingSiStripWorker.cc @@ -164,7 +164,7 @@ PreMixingSiStripWorker::PreMixingSiStripWorker(const edm::ParameterSet& ps, theElectronPerADC(ps.getParameter<double>(peakMode ? "electronPerAdcPeak" : "electronPerAdcDec")), APVSaturationFromHIP_(ps.getParameter<bool>("APVSaturationFromHIP")), theFedAlgo(ps.getParameter<int>("FedAlgorithm_PM")), - theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), + theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo, &iC)), theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, false)), // no premixing includeAPVSimulation_(ps.getParameter<bool>("includeAPVSimulation")), fracOfEventsToSimAPV_(ps.getParameter<double>("fracOfEventsToSimAPV")), diff --git a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc index b523c6256efa3..2c143a7532fd2 100644 --- a/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc +++ b/SimTracker/SiStripDigitizer/plugins/SiStripDigitizerAlgorithm.cc @@ -67,7 +67,7 @@ SiStripDigitizerAlgorithm::SiStripDigitizerAlgorithm(const edm::ParameterSet& co theSiPileUpSignals(new SiPileUpSignals()), theSiNoiseAdder(new SiGaussianTailNoiseAdder(theThreshold)), theSiDigitalConverter(new SiTrivialDigitalConverter(theElectronPerADC, PreMixing_)), - theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo)), + theSiZeroSuppress(new SiStripFedZeroSuppression(theFedAlgo, &iC)), APVProbabilityFile(conf.getParameter<edm::FileInPath>("APVProbabilityFile")), includeAPVSimulation_(conf.getParameter<bool>("includeAPVSimulation")), apv_maxResponse_(conf.getParameter<double>("apv_maxResponse")), From a90f2ee752cf364e1e3c5528c24d45232e4395b2 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Mon, 19 Apr 2021 15:16:11 +0200 Subject: [PATCH 158/309] cleaning MTV clean Update MTVHistoProducerAlgoForTracker.cc Update MTVHistoProducerAlgoForTracker.cc fix code-format --- .../MTVHistoProducerAlgoForTracker.h | 1 + ...MTVHistoProducerAlgoForTrackerBlock_cfi.py | 1 + .../src/MTVHistoProducerAlgoForTracker.cc | 97 +++++++------------ 3 files changed, 39 insertions(+), 60 deletions(-) diff --git a/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h b/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h index 99aace914f292..030f12a75c220 100644 --- a/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h +++ b/Validation/RecoTrack/interface/MTVHistoProducerAlgoForTracker.h @@ -339,6 +339,7 @@ class MTVHistoProducerAlgoForTracker { const bool doSeedPlots_; const bool doMTDPlots_; + const bool doDzPVcutPlots_; // double ptRes_rangeMin, ptRes_rangeMax; diff --git a/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py b/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py index 7ce1eb5fad5c7..6b7a0d30e8c1c 100644 --- a/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py +++ b/Validation/RecoTrack/python/MTVHistoProducerAlgoForTrackerBlock_cfi.py @@ -141,6 +141,7 @@ seedingLayerSets = cms.vstring(), doMTDPlots = cms.untracked.bool(False), # meant to be switch on in Phase2 workflows + doDzPVcutPlots = cms.untracked.bool(True) ) def _modifyForPhase1(pset): diff --git a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc index e3370837a2a4c..7e0510823b624 100644 --- a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc +++ b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc @@ -139,7 +139,9 @@ namespace { } // namespace MTVHistoProducerAlgoForTracker::MTVHistoProducerAlgoForTracker(const edm::ParameterSet& pset, const bool doSeedPlots) - : doSeedPlots_(doSeedPlots), doMTDPlots_(pset.getUntrackedParameter<bool>("doMTDPlots")) { + : doSeedPlots_(doSeedPlots), + doMTDPlots_(pset.getUntrackedParameter<bool>("doMTDPlots")), + doDzPVcutPlots_(pset.getUntrackedParameter<bool>("doDzPVcutPlots")) { //parameters for _vs_eta plots minEta = pset.getParameter<double>("minEta"); maxEta = pset.getParameter<double>("maxEta"); @@ -260,9 +262,6 @@ MTVHistoProducerAlgoForTracker::MTVHistoProducerAlgoForTracker(const edm::Parame maxDzpvCum = pset.getParameter<double>("maxDzpvCumulative"); nintDzpvCum = pset.getParameter<int>("nintDzpvCumulative"); - maxDzpvsigCum = pset.getParameter<double>("maxDzpvsigCumulative"); - nintDzpvsigCum = pset.getParameter<int>("nintDzpvsigCumulative"); - //--- tracking particle selectors for efficiency measurements using namespace edm; using namespace reco::modules; @@ -577,26 +576,17 @@ void MTVHistoProducerAlgoForTracker::bookSimTrackPVAssociationHistos(DQMStore::I histograms.h_simuldzpvzoomed.push_back(ibook.book1D( "num_simul_dzpv_zoomed", "N of simulated tracks vs dz(PV)", nintDz, minDz / dxyDzZoom, maxDz / dxyDzZoom)); - histograms.h_assoc_dzpvcut.push_back(ibook.book1D( - "num_assoc(simToReco)_dzpvcut", "N of associated tracks (simToReco) vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_simul_dzpvcut.push_back( - ibook.book1D("num_simul_dzpvcut", "N of simulated tracks from sim PV", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_simul2_dzpvcut.push_back(ibook.book1D( - "num_simul2_dzpvcut", "N of simulated tracks (associated to any track) from sim PV", nintDzpvCum, 0, maxDzpvCum)); - - histograms.h_assoc_dzpvsigcut.push_back(ibook.book1D("num_assoc(simToReco)_dzpvsigcut", - "N of associated tracks (simToReco) vs dz(PV)/dzError", - nintDzpvsigCum, + if (doDzPVcutPlots_) { + histograms.h_assoc_dzpvcut.push_back(ibook.book1D( + "num_assoc(simToReco)_dzpvcut", "N of associated tracks (simToReco) vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + histograms.h_simul_dzpvcut.push_back( + ibook.book1D("num_simul_dzpvcut", "N of simulated tracks from sim PV", nintDzpvCum, 0, maxDzpvCum)); + histograms.h_simul2_dzpvcut.push_back(ibook.book1D("num_simul2_dzpvcut", + "N of simulated tracks (associated to any track) from sim PV", + nintDzpvCum, 0, - maxDzpvsigCum)); - histograms.h_simul_dzpvsigcut.push_back(ibook.book1D( - "num_simul_dzpvsigcut", "N of simulated tracks from sim PV/dzError", nintDzpvsigCum, 0, maxDzpvsigCum)); - histograms.h_simul2_dzpvsigcut.push_back( - ibook.book1D("num_simul2_dzpvsigcut", - "N of simulated tracks (associated to any track) from sim PV/dzError", - nintDzpvsigCum, - 0, - maxDzpvsigCum)); + maxDzpvCum)); + } } void MTVHistoProducerAlgoForTracker::bookRecoHistos(DQMStore::IBooker& ibook, @@ -1491,25 +1481,16 @@ void MTVHistoProducerAlgoForTracker::bookRecoPVAssociationHistos(DQMStore::IBook minDz / dxyDzZoom, maxDz / dxyDzZoom)); - histograms.h_reco_dzpvcut.push_back( - ibook.book1D("num_reco_dzpvcut", "N of reco track vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_assoc2_dzpvcut.push_back(ibook.book1D( - "num_assoc(recoToSim)_dzpvcut", "N of associated (recoToSim) tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - histograms.h_pileup_dzpvcut.push_back(ibook.book1D( - "num_pileup_dzpvcut", "N of associated (recoToSim) pileup tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); - - histograms.h_reco_dzpvsigcut.push_back( - ibook.book1D("num_reco_dzpvsigcut", "N of reco track vs dz(PV)/dzError", nintDzpvsigCum, 0, maxDzpvsigCum)); - histograms.h_assoc2_dzpvsigcut.push_back(ibook.book1D("num_assoc(recoToSim)_dzpvsigcut", - "N of associated (recoToSim) tracks vs dz(PV)/dzError", - nintDzpvsigCum, - 0, - maxDzpvsigCum)); - histograms.h_pileup_dzpvsigcut.push_back(ibook.book1D("num_pileup_dzpvsigcut", - "N of associated (recoToSim) pileup tracks vs dz(PV)/dzError", - nintDzpvsigCum, - 0, - maxDzpvsigCum)); + if (doDzPVcutPlots_) { + histograms.h_reco_dzpvcut.push_back( + ibook.book1D("num_reco_dzpvcut", "N of reco track vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + + histograms.h_assoc2_dzpvcut.push_back(ibook.book1D( + "num_assoc(recoToSim)_dzpvcut", "N of associated (recoToSim) tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + + histograms.h_pileup_dzpvcut.push_back(ibook.book1D( + "num_pileup_dzpvcut", "N of associated (recoToSim) pileup tracks vs dz(PV)", nintDzpvCum, 0, maxDzpvCum)); + } } void MTVHistoProducerAlgoForTracker::bookRecodEdxHistos(DQMStore::IBooker& ibook, Histograms& histograms) { @@ -1870,19 +1851,16 @@ void MTVHistoProducerAlgoForTracker::fill_recoAssociated_simTrack_histos( histograms.h_simuldzpv[count]->Fill(dzPVSim); histograms.h_simuldzpvzoomed[count]->Fill(dzPVSim); - histograms.h_simul_dzpvcut[count]->Fill(0); - histograms.h_simul_dzpvsigcut[count]->Fill(0); + if (doDzPVcutPlots_) + histograms.h_simul_dzpvcut[count]->Fill(0); if (isMatched) { - histograms.h_assocdzpv[count]->Fill(dzPVSim); - histograms.h_assocdzpvzoomed[count]->Fill(dzPVSim); - - histograms.h_simul2_dzpvcut[count]->Fill(0); - histograms.h_simul2_dzpvsigcut[count]->Fill(0); - const double dzpvcut = std::abs(track->dz(*pvPosition)); - const double dzpvsigcut = dzpvcut / track->dzError(); - histograms.h_assoc_dzpvcut[count]->Fill(dzpvcut); - histograms.h_assoc_dzpvsigcut[count]->Fill(dzpvsigcut); + if (doDzPVcutPlots_) { + histograms.h_simul2_dzpvcut[count]->Fill(0); + + const double dzpvcut = std::abs(track->dz(*pvPosition)); + histograms.h_assoc_dzpvcut[count]->Fill(dzpvcut); + } } } if (simPVPosition) { @@ -1952,7 +1930,6 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr const auto dz = track.dz(bsPosition); const auto dxypv = pvPosition ? track.dxy(*pvPosition) : 0.0; const auto dzpv = pvPosition ? track.dz(*pvPosition) : 0.0; - const auto dzpvsig = pvPosition ? dzpv / track.dzError() : 0.0; const auto nhits = track.found(); const auto nlayers = track.hitPattern().trackerLayersWithMeasurement(); const auto nPixelLayers = track.hitPattern().pixelLayersWithMeasurement(); @@ -1991,8 +1968,8 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr histograms.h_recodxypvzoomed[count]->Fill(dxypv); histograms.h_recodzpvzoomed[count]->Fill(dzpv); - histograms.h_reco_dzpvcut[count]->Fill(std::abs(dzpv)); - histograms.h_reco_dzpvsigcut[count]->Fill(std::abs(dzpvsig)); + if (doDzPVcutPlots_) + histograms.h_reco_dzpvcut[count]->Fill(std::abs(dzpv)); } if (simPVPosition) { histograms.h_reco_simpvz[count]->Fill(simpvz); @@ -2060,8 +2037,8 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr histograms.h_assoc2dxypvzoomed[count]->Fill(dxypv); histograms.h_assoc2dzpvzoomed[count]->Fill(dzpv); - histograms.h_assoc2_dzpvcut[count]->Fill(std::abs(dzpv)); - histograms.h_assoc2_dzpvsigcut[count]->Fill(std::abs(dzpvsig)); + if (doDzPVcutPlots_) + histograms.h_assoc2_dzpvcut[count]->Fill(std::abs(dzpv)); } if (simPVPosition) { histograms.h_assoc2_simpvz[count]->Fill(simpvz); @@ -2183,8 +2160,8 @@ void MTVHistoProducerAlgoForTracker::fill_generic_recoTrack_histos(const Histogr histograms.h_pileupdxypvzoomed[count]->Fill(dxypv); histograms.h_pileupdzpvzoomed[count]->Fill(dzpv); - histograms.h_pileup_dzpvcut[count]->Fill(std::abs(dzpv)); - histograms.h_pileup_dzpvsigcut[count]->Fill(std::abs(dzpvsig)); + if (doDzPVcutPlots_) + histograms.h_pileup_dzpvcut[count]->Fill(std::abs(dzpv)); } if (simPVPosition) { histograms.h_pileup_simpvz[count]->Fill(simpvz); From 8a628ea069dd5175212ef6b50cd400bb1c884b00 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Tue, 4 May 2021 16:20:31 +0200 Subject: [PATCH 159/309] fix bug --- Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc index 7e0510823b624..32b25bc4ed1e1 100644 --- a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc +++ b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc @@ -1855,6 +1855,9 @@ void MTVHistoProducerAlgoForTracker::fill_recoAssociated_simTrack_histos( histograms.h_simul_dzpvcut[count]->Fill(0); if (isMatched) { + histograms.h_assocdzpv[count]->Fill(dzPVSim); + histograms.h_assocdzpvzoomed[count]->Fill(dzPVSim); + if (doDzPVcutPlots_) { histograms.h_simul2_dzpvcut[count]->Fill(0); From 5fedf04b62e561fed26496e42a3fc5f4ecc05a00 Mon Sep 17 00:00:00 2001 From: Pieter David <pieter.david@cern.ch> Date: Tue, 4 May 2021 17:20:38 +0200 Subject: [PATCH 160/309] esConsumes for SiStripClusterToDigiProducer --- .../plugins/SiStripClusterToDigiProducer.cc | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc index cf8cd2d82c0c9..33f892ef782be 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc @@ -1,7 +1,7 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/Common/interface/DetSetVector.h" @@ -31,19 +31,21 @@ class SiStripClusterToDigiProducer : public edm::stream::EDProducer<> { private: void process(const ClusterCollection& input, std::vector<DetDigiCollection>& output_base); - void initialize(const edm::EventSetup& es); void setDetId(const uint32_t id); float gain(const uint16_t& strip) const { return gainHandle->getStripGain(strip, gainRange); } uint16_t applyGain(const uint16_t& strip, const uint16_t& adc); edm::EDGetTokenT<ClusterCollection> token; SiStripApvGain::Range gainRange; - edm::ESHandle<SiStripGain> gainHandle; - uint32_t gain_cache_id, detId; + edm::ESGetToken<SiStripGain, SiStripGainRcd> gainToken_; + edm::ESWatcher<SiStripGainRcd> gainWatcher_; + const SiStripGain* gainHandle; + uint32_t detId; }; SiStripClusterToDigiProducer::SiStripClusterToDigiProducer(const edm::ParameterSet& conf) { token = consumes<ClusterCollection>(conf.getParameter<edm::InputTag>("ClusterProducer")); + gainToken_ = esConsumes(); produces<DigiCollection>("ZeroSuppressed"); produces<DigiCollection>("VirginRaw"); @@ -52,7 +54,9 @@ SiStripClusterToDigiProducer::SiStripClusterToDigiProducer(const edm::ParameterS } void SiStripClusterToDigiProducer::produce(edm::Event& event, const edm::EventSetup& es) { - initialize(es); + if (gainWatcher_.check(es)) { + gainHandle = &es.getData(gainToken_); + } std::vector<DetDigiCollection> output_base; edm::Handle<ClusterCollection> input; @@ -97,15 +101,6 @@ void SiStripClusterToDigiProducer::process(const ClusterCollection& input, } } -void SiStripClusterToDigiProducer::initialize(const edm::EventSetup& es) { - uint32_t g_cache_id = es.get<SiStripGainRcd>().cacheIdentifier(); - - if (g_cache_id != gain_cache_id) { - es.get<SiStripGainRcd>().get(gainHandle); - gain_cache_id = g_cache_id; - } -} - inline void SiStripClusterToDigiProducer::setDetId(const uint32_t id) { gainRange = gainHandle->getRange(id); detId = id; From 23498b442a03e5694ab374cfcbf37c3538ecff82 Mon Sep 17 00:00:00 2001 From: Pieter David <pieter.david@cern.ch> Date: Tue, 4 May 2021 17:20:55 +0200 Subject: [PATCH 161/309] esConsumes for SiStripHitEffFromCalibTree --- .../plugins/SiStripHitEffFromCalibTree.cc | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc index 1356b162945ce..8d3495492e85c 100644 --- a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc +++ b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc @@ -148,6 +148,9 @@ class SiStripHitEffFromCalibTree : public ConditionDBWriter<SiStripBadStrip> { float _effPlotMin; TString _title; + edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> _tkGeomToken; + edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> _tTopoToken; + unsigned int nTEClayers; TH1F* bxHisto; @@ -205,6 +208,8 @@ SiStripHitEffFromCalibTree::SiStripHitEffFromCalibTree(const edm::ParameterSet& _tkMapMin = conf.getUntrackedParameter<double>("TkMapMin", 0.9); _effPlotMin = conf.getUntrackedParameter<double>("EffPlotMin", 0.9); _title = conf.getParameter<std::string>("Title"); + _tkGeomToken = esConsumes(); + _tTopoToken = esConsumes(); reader = new SiStripDetInfoFileReader(FileInPath_.fullPath()); nTEClayers = 9; // number of wheels @@ -226,14 +231,8 @@ void SiStripHitEffFromCalibTree::algoEndJob() { } void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::EventSetup& c) { - edm::ESHandle<TrackerGeometry> tracker; - c.get<TrackerDigiGeometryRecord>().get(tracker); - const TrackerGeometry* tkgeom = &(*tracker); - - //Retrieve tracker topology from geometry - edm::ESHandle<TrackerTopology> tTopoHandle; - c.get<TrackerTopologyRcd>().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const auto& tkgeom = c.getData(_tkGeomToken); + const auto& tTopo = c.getData(_tTopoToken); // read bad modules to mask ifstream badModules_file; @@ -493,7 +492,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve stripCluster = ClusterLocX / Pitch + nstrips / 2.0; } else { DetId ClusterDetId(id); - const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)tkgeom->idToDetUnit(ClusterDetId); + const StripGeomDetUnit* stripdet = (const StripGeomDetUnit*)tkgeom.idToDetUnit(ClusterDetId); const StripTopology& Topo = stripdet->specificTopology(); nstrips = Topo.nstrips(); Pitch = stripdet->surface().bounds().width() / Topo.nstrips(); @@ -713,7 +712,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TIB //&&&&&&&&&&&&&&&&& - component = tTopo->tibLayer(BC[i].detid); + component = tTopo.tibLayer(BC[i].detid); SetBadComponents(0, component, BC[i], ssV, NBadComponent); } else if (a.subdetId() == SiStripDetId::TID) { @@ -721,7 +720,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TID //&&&&&&&&&&&&&&&&& - component = tTopo->tidSide(BC[i].detid) == 2 ? tTopo->tidWheel(BC[i].detid) : tTopo->tidWheel(BC[i].detid) + 3; + component = tTopo.tidSide(BC[i].detid) == 2 ? tTopo.tidWheel(BC[i].detid) : tTopo.tidWheel(BC[i].detid) + 3; SetBadComponents(1, component, BC[i], ssV, NBadComponent); } else if (a.subdetId() == SiStripDetId::TOB) { @@ -729,7 +728,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TOB //&&&&&&&&&&&&&&&&& - component = tTopo->tobLayer(BC[i].detid); + component = tTopo.tobLayer(BC[i].detid); SetBadComponents(2, component, BC[i], ssV, NBadComponent); } else if (a.subdetId() == SiStripDetId::TEC) { @@ -737,7 +736,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve //TEC //&&&&&&&&&&&&&&&&& - component = tTopo->tecSide(BC[i].detid) == 2 ? tTopo->tecWheel(BC[i].detid) : tTopo->tecWheel(BC[i].detid) + 9; + component = tTopo.tecSide(BC[i].detid) == 2 ? tTopo.tecWheel(BC[i].detid) : tTopo.tecWheel(BC[i].detid) + 9; SetBadComponents(3, component, BC[i], ssV, NBadComponent); } } @@ -758,16 +757,16 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve SiStripDetId a(detid); if (a.subdetId() == 3) { subdet = 0; - component = tTopo->tibLayer(detid); + component = tTopo.tibLayer(detid); } else if (a.subdetId() == 4) { subdet = 1; - component = tTopo->tidSide(detid) == 2 ? tTopo->tidWheel(detid) : tTopo->tidWheel(detid) + 3; + component = tTopo.tidSide(detid) == 2 ? tTopo.tidWheel(detid) : tTopo.tidWheel(detid) + 3; } else if (a.subdetId() == 5) { subdet = 2; - component = tTopo->tobLayer(detid); + component = tTopo.tobLayer(detid); } else if (a.subdetId() == 6) { subdet = 3; - component = tTopo->tecSide(detid) == 2 ? tTopo->tecWheel(detid) : tTopo->tecWheel(detid) + 9; + component = tTopo.tecSide(detid) == 2 ? tTopo.tecWheel(detid) : tTopo.tecWheel(detid) + 9; } SiStripQuality::Range sqrange = From 18eed77fba3cfec1c8ee877ef7de31542a515497 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Tue, 4 May 2021 17:47:23 +0200 Subject: [PATCH 162/309] minor fix, add empty line --- L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py | 1 + 1 file changed, 1 insertion(+) diff --git a/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py b/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py index 122e5f3f2b9f1..cab518307ffb2 100644 --- a/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py +++ b/L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py @@ -38,3 +38,4 @@ TrackQuality =cms.bool(False), TrackQualityPSet = cms.PSet(TrackQualityParams) ) + From d71cba315b72527a48c2e6f7fabbd8154ba02968 Mon Sep 17 00:00:00 2001 From: Mia <mia.tosi@cern.ch> Date: Tue, 4 May 2021 18:01:33 +0200 Subject: [PATCH 163/309] fix code-format --- Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc index 32b25bc4ed1e1..709df082d2e2e 100644 --- a/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc +++ b/Validation/RecoTrack/src/MTVHistoProducerAlgoForTracker.cc @@ -1855,7 +1855,7 @@ void MTVHistoProducerAlgoForTracker::fill_recoAssociated_simTrack_histos( histograms.h_simul_dzpvcut[count]->Fill(0); if (isMatched) { - histograms.h_assocdzpv[count]->Fill(dzPVSim); + histograms.h_assocdzpv[count]->Fill(dzPVSim); histograms.h_assocdzpvzoomed[count]->Fill(dzPVSim); if (doDzPVcutPlots_) { From 9aef44e5dbcc067ab65d21177b3ef40426426d52 Mon Sep 17 00:00:00 2001 From: Sebastian Wozniewski <sebastian.wozniewski@kit.edu> Date: Tue, 4 May 2021 18:05:00 +0200 Subject: [PATCH 164/309] import missing era modifiers to DQM config --- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index cc7ec2d71add3..b585f46efa8a1 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -43,6 +43,12 @@ Plot1D('rawMVAoldDM2017v2', 'rawMVAoldDM2017v2', 20, -1, 1, 'byIsolationMVArun2v1DBoldDMwLT raw output discriminator (2017v2)'), Plot1D('rawMVAoldDMdR032017v2', 'rawMVAoldDMdR032017v2', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator (2017v2)') ]) +from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 +from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 +from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 +from Configuration.Eras.Modifier_run2_nanoAOD_102Xv1_cff import run2_nanoAOD_102Xv1 +from Configuration.Eras.Modifier_run2_nanoAOD_106Xv1_cff import run2_nanoAOD_106Xv1 (run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1 | run2_nanoAOD_106Xv1).toModify(nanoDQM.vplots.Tau, plots = _tauPlotsPreV9) _METFixEE2017_DQMentry = nanoDQM.vplots.MET.clone() @@ -51,8 +57,6 @@ if plot.name.value().find("fiducial")>-1: continue _METFixEE2017_plots.append(plot) _METFixEE2017_DQMentry.plots = _METFixEE2017_plots -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toModify(nanoDQM.vplots, METFixEE2017 = _METFixEE2017_DQMentry) @@ -80,7 +84,6 @@ _Flag_plots_80x.append(Plot1D('BadGlobalMuon', 'BadGlobalMuon', 2, -0.5, 1.5, 'Bad muon flag')) _Flag_plots_80x.append(Plot1D('CloneGlobalMuon', 'CloneGlobalMuon', 2, -0.5, 1.5, 'Clone muon flag')) -from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016: modifier.toModify(nanoDQM.vplots.Electron, plots = _Electron_plots_2016) modifier.toModify(nanoDQM.vplots.Photon, plots = _Photon_plots_2016) From aebb3545220dcb4ccf3d36e7f418e24f624248fe Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Tue, 4 May 2021 12:11:09 -0500 Subject: [PATCH 165/309] Cleanup of data/simulation analyzer modules --- .../CSCTriggerPrimitives/test/BuildFile.xml | 8 +- .../test/CSCTriggerPrimitivesAnalyzer.cc | 252 ++++++++++++++++++ .../L1CSCTPEmulatorConfigAnalyzer.cc | 0 L1Trigger/CSCTriggerPrimitives/test/README.md | 33 +++ .../deprecated}/CSCAnodeLCTAnalyzer.cc | 0 .../deprecated}/CSCAnodeLCTAnalyzer.h | 0 .../deprecated}/CSCCathodeLCTAnalyzer.cc | 0 .../deprecated}/CSCCathodeLCTAnalyzer.h | 0 .../deprecated}/CSCTriggerPrimitivesReader.cc | 0 .../deprecated}/CSCTriggerPrimitivesReader.h | 0 .../CSCTriggerPrimitivesReader_cfi.py | 0 .../test/macros/README.md | 5 + .../test/runCSCL1TDQM_cfg.py | 43 +++ .../runCSCTriggerPrimitiveAnalyzer_cfg.py | 50 ++++ .../runCSCTriggerPrimitiveProducer_cfg.py | 73 ++--- 15 files changed, 429 insertions(+), 35 deletions(-) create mode 100644 L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc rename L1Trigger/CSCTriggerPrimitives/{plugins => test}/L1CSCTPEmulatorConfigAnalyzer.cc (100%) create mode 100644 L1Trigger/CSCTriggerPrimitives/test/README.md rename L1Trigger/CSCTriggerPrimitives/{plugins => test/deprecated}/CSCAnodeLCTAnalyzer.cc (100%) rename L1Trigger/CSCTriggerPrimitives/{plugins => test/deprecated}/CSCAnodeLCTAnalyzer.h (100%) rename L1Trigger/CSCTriggerPrimitives/{plugins => test/deprecated}/CSCCathodeLCTAnalyzer.cc (100%) rename L1Trigger/CSCTriggerPrimitives/{plugins => test/deprecated}/CSCCathodeLCTAnalyzer.h (100%) rename L1Trigger/CSCTriggerPrimitives/{plugins => test/deprecated}/CSCTriggerPrimitivesReader.cc (100%) rename L1Trigger/CSCTriggerPrimitives/{plugins => test/deprecated}/CSCTriggerPrimitivesReader.h (100%) rename L1Trigger/CSCTriggerPrimitives/{python => test/deprecated}/CSCTriggerPrimitivesReader_cfi.py (100%) create mode 100644 L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQM_cfg.py create mode 100644 L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py diff --git a/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml b/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml index 31bb9be6c7f7c..77ed0413ac851 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml +++ b/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml @@ -1,7 +1,11 @@ +<use name="CondFormats/CSCObjects"/> <use name="Geometry/GEMGeometry"/> <use name="Geometry/CSCGeometry"/> +<use name="DataFormats/CSCDigi"/> <use name="Geometry/Records"/> +<use name="CondFormats/DataRecord"/> <use name="FWCore/Framework"/> -<flags EDM_PLUGIN="1"/> -<library file="GEMCSCLUTAnalyzer.cc" name="GEMCSCLUTAnalyzer"> +<use name="rootgraphics"/> +<library file="*.cc" name="CSCTriggerPrimitivesTest"> + <flags EDM_PLUGIN="1"/> </library> diff --git a/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc new file mode 100644 index 0000000000000..4772b68bb8a12 --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc @@ -0,0 +1,252 @@ +/** \class CSCTriggerPrimitivesAnalyzer + * + * Basic analyzer class which accesses ALCTs, CLCTs, and correlated LCTs + * and plot various quantities. This analyzer can currently load a DQM file + * and plot the data vs emulation of ALCTs, CLCTs, and correlated LCT properties. + * + * \author Sven Dildick (Rice University) + * + */ + +#include "FWCore/Utilities/interface/EDGetToken.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" + +#include "TH1F.h" +#include "TPostScript.h" +#include "TCanvas.h" +#include "TFile.h" +#include "TText.h" +#include "TPaveLabel.h" +#include "TLegend.h" +#include "TStyle.h" +#include "TROOT.h" + +#include <iostream> +#include <string> + +class CSCTriggerPrimitivesAnalyzer : public edm::one::EDAnalyzer<> { +public: + /// Constructor + explicit CSCTriggerPrimitivesAnalyzer(const edm::ParameterSet& conf); + + /// Destructor + ~CSCTriggerPrimitivesAnalyzer() override {} + + /// Does the job + void analyze(const edm::Event& event, const edm::EventSetup& setup) override; + + /// Write to ROOT file, make plots, etc. + void endJob() override; + +private: + void makePlot(TH1F* dataMon, + TH1F* emulMon, + TH1F* diffMon, + TString lcts, + TString lct, + TString var, + TString chamber, + TPostScript* ps, + TCanvas* c1) const; + + // plots of data vs emulator + std::string rootFileName_; + unsigned runNumber_; + std::string monitorDir_; + std::vector<std::string> chambers_; + std::vector<std::string> alctVars_; + std::vector<std::string> clctVars_; + std::vector<std::string> lctVars_; + bool dataVsEmulatorPlots_; + void makeDataVsEmulatorPlots(); + + // plots of efficiencies in MC + bool mcEfficiencyPlots_; + + // plots of resolution in MC + bool mcResolutionPlots_; +}; + +CSCTriggerPrimitivesAnalyzer::CSCTriggerPrimitivesAnalyzer(const edm::ParameterSet &conf) + : rootFileName_(conf.getParameter<std::string>("rootFileName")), + runNumber_(conf.getParameter<unsigned>("runNumber")), + monitorDir_(conf.getParameter<std::string>("monitorDir")), + chambers_(conf.getParameter<std::vector<std::string>>("chambers")), + alctVars_(conf.getParameter<std::vector<std::string>>("alctVars")), + clctVars_(conf.getParameter<std::vector<std::string>>("clctVars")), + lctVars_(conf.getParameter<std::vector<std::string>>("lctVars")), + dataVsEmulatorPlots_(conf.getParameter<bool>("dataVsEmulatorPlots")), + mcEfficiencyPlots_(conf.getParameter<bool>("mcEfficiencyPlots")), + mcResolutionPlots_(conf.getParameter<bool>("mcResolutionPlots")) {} + +void CSCTriggerPrimitivesAnalyzer::analyze(const edm::Event &ev, const edm::EventSetup &setup) { + // efficiency and resolution analysis is done here +} + +void CSCTriggerPrimitivesAnalyzer::endJob() { + if (dataVsEmulatorPlots_) + makeDataVsEmulatorPlots(); +} + +void CSCTriggerPrimitivesAnalyzer::makeDataVsEmulatorPlots() { + // data vs emulator plots are created here + edm::Service<TFileService> fs; + + // split monitorDir_ into two substrings + std::string delimiter = "/"; + int pos = monitorDir_.find(delimiter); + std::string superDir = monitorDir_.substr(0, pos); + monitorDir_.erase(0, pos + delimiter.length()); + std::string subDir = monitorDir_; + std::string path = "DQMData/Run " + std::to_string(runNumber_) + "/" + superDir + "/Run summary/" + subDir + "/"; + + TFile *theFile = new TFile(rootFileName_.c_str()); + if (!theFile) { + edm::LogError("CSCTriggerPrimitivesAnalyzer") << "Unable to load DQM ROOT file: " << rootFileName_; + return; + } + + TDirectory *directory = theFile->GetDirectory(path.c_str()); + if (!directory) { + edm::LogError("CSCTriggerPrimitivesAnalyzer") << "Unable to navigate to directory: " << path; + return; + } + + TPostScript *ps = new TPostScript("CSC_data_vs_emulation.ps", 111); + TCanvas *c1 = new TCanvas("c1", "", 800, 800); + c1->Clear(); + c1->Divide(1, 2); + + // alct variable + for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) { + // chamber type + for (unsigned iType = 0; iType < chambers_.size(); iType++) { + const std::string key("alct_" + alctVars_[iVar]); + const std::string histData(key + "_data_" + chambers_[iType]); + const std::string histEmul(key + "_emul_" + chambers_[iType]); + const std::string histDiff(key + "_diff_" + chambers_[iType]); + + TH1F *dataMon = (TH1F *)directory->Get(histData.c_str()); + TH1F *emulMon = (TH1F *)directory->Get(histEmul.c_str()); + TH1F *diffMon = (TH1F *)directory->Get(histDiff.c_str()); + + // when all histograms are found, make a new canvas and add it to + // the collection + if (dataMon && emulMon && diffMon) { + makePlot( + dataMon, emulMon, diffMon, "ALCT", "alct_", TString(alctVars_[iVar]), TString(chambers_[iType]), ps, c1); + } + } + } + + // clct variable + for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) { + // chamber type + for (unsigned iType = 0; iType < chambers_.size(); iType++) { + const std::string key("clct_" + clctVars_[iVar]); + const std::string histData(key + "_data_" + chambers_[iType]); + const std::string histEmul(key + "_emul_" + chambers_[iType]); + const std::string histDiff(key + "_diff_" + chambers_[iType]); + + TH1F *dataMon = (TH1F *)directory->Get(histData.c_str()); + TH1F *emulMon = (TH1F *)directory->Get(histEmul.c_str()); + TH1F *diffMon = (TH1F *)directory->Get(histDiff.c_str()); + + // when all histograms are found, make a new canvas and add it to + // the collection + if (dataMon && emulMon && diffMon) { + makePlot( + dataMon, emulMon, diffMon, "CLCT", "clct_", TString(clctVars_[iVar]), TString(chambers_[iType]), ps, c1); + } + } + } + + // lct variable + for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) { + // chamber type + for (unsigned iType = 0; iType < chambers_.size(); iType++) { + const std::string key("lct_" + lctVars_[iVar]); + const std::string histData(key + "_data_" + chambers_[iType]); + const std::string histEmul(key + "_emul_" + chambers_[iType]); + const std::string histDiff(key + "_diff_" + chambers_[iType]); + + TH1F *dataMon = (TH1F *)directory->Get(histData.c_str()); + TH1F *emulMon = (TH1F *)directory->Get(histEmul.c_str()); + TH1F *diffMon = (TH1F *)directory->Get(histDiff.c_str()); + + // when all histograms are found, make a new canvas and add it to + // the collection + if (dataMon && emulMon && diffMon) { + makePlot(dataMon, emulMon, diffMon, "LCT", "lct_", TString(lctVars_[iVar]), TString(chambers_[iType]), ps, c1); + } + } + } + + ps->Close(); + // close the DQM file + theFile->Close(); + delete c1; + delete ps; +} + +void CSCTriggerPrimitivesAnalyzer::makePlot(TH1F *dataMon, + TH1F *emulMon, + TH1F *diffMon, + TString lcts, + TString lct, + TString var, + TString chamber, + TPostScript *ps, + TCanvas *c1) const { + ps->NewPage(); + + const TString title(chamber + " " + lcts + " " + var + " (Run " + runNumber_ + ")"); + c1->cd(1); + gPad->SetGridx(); + gPad->SetGridy(); + gStyle->SetOptStat(1111); + dataMon->SetTitle(title); + dataMon->GetXaxis()->SetTitle(lcts + " " + var); + dataMon->GetYaxis()->SetTitle("Entries"); + dataMon->SetMarkerColor(kBlack); + dataMon->SetMarkerStyle(kPlus); + dataMon->SetMarkerSize(3); + // add 50% to make sure the legend does not overlap with the histograms + dataMon->SetMaximum(dataMon->GetBinContent(dataMon->GetMaximumBin()) * 1.5); + dataMon->Draw("histp"); + dataMon->GetXaxis()->SetLabelSize(0.05); + dataMon->GetYaxis()->SetLabelSize(0.05); + dataMon->GetXaxis()->SetTitleSize(0.05); + dataMon->GetYaxis()->SetTitleSize(0.05); + emulMon->SetLineColor(kRed); + emulMon->Draw("histsame"); + auto legend = new TLegend(0.7, 0.7, 0.9, 0.9); + legend->AddEntry(dataMon, "Data", "p"); + legend->AddEntry(emulMon, "Emulator", "l"); + legend->Draw(); + + c1->cd(2); + gPad->SetGridx(); + gPad->SetGridy(); + gStyle->SetOptStat(0); + diffMon->SetLineColor(kBlack); + diffMon->SetTitle(title); + diffMon->GetXaxis()->SetTitle(lcts + " " + var); + diffMon->GetYaxis()->SetTitle("Emul - Data"); + diffMon->GetXaxis()->SetLabelSize(0.05); + diffMon->GetYaxis()->SetLabelSize(0.05); + diffMon->GetXaxis()->SetTitleSize(0.05); + diffMon->GetYaxis()->SetTitleSize(0.05); + diffMon->Draw("ep"); + c1->Update(); +} + +DEFINE_FWK_MODULE(CSCTriggerPrimitivesAnalyzer); diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/L1CSCTPEmulatorConfigAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/L1CSCTPEmulatorConfigAnalyzer.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/L1CSCTPEmulatorConfigAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/test/L1CSCTPEmulatorConfigAnalyzer.cc diff --git a/L1Trigger/CSCTriggerPrimitives/test/README.md b/L1Trigger/CSCTriggerPrimitives/test/README.md new file mode 100644 index 0000000000000..663eedbb79b8f --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/README.md @@ -0,0 +1,33 @@ +CSC Trigger Primitives: Test Modules +=================================== + +runCSCTriggerPrimitiveProducer +------------------------------ + +Configuration to run the CSC trigger primitive producer. Option available to unpack RAW data - useful for data vs emulator comparisons. + + +runCSCL1TDQM +------------ + +Configuration to run the module `l1tdeCSCTPG` on a data file. Will produce a DQM file onto which the runCSCTriggerPrimitiveAnalyzer can be run + + +runCSCTriggerPrimitiveAnalyzer +------------------------------ + +Configuration to run analysis on CSC trigger primitives. Choose from options to analyze data vs emulator comparison (`l1tdeCSCTPGClient`), MC resolution or MC efficiency. + +For data vs emulator comparison, first run `DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py` to obtain the DQM file, then use it as input for the comparison. Alternatively, run runCSCL1TDQM. + + +runL1CSCTPEmulatorConfigAnalyzer +-------------------------------- + +Compare configuration from DB with Python for CSC trigger primitives. Typically not necessary to do; all configuration is by default loaded from Python, not the configuration DB. + + +runGEMCSCLUTAnalyzer +-------------------- + +Makes the lookup tables for the GEM-CSC integrated local trigger in simulation and firmware. Current lookup tables can be found in https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/GEMCSC diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.cc diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.h b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.h similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCAnodeLCTAnalyzer.h rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCAnodeLCTAnalyzer.h diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.cc diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.h similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCCathodeLCTAnalyzer.h rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCCathodeLCTAnalyzer.h diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.cc b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.cc rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.cc diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.h similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/CSCTriggerPrimitivesReader.h rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader.h diff --git a/L1Trigger/CSCTriggerPrimitives/python/CSCTriggerPrimitivesReader_cfi.py b/L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader_cfi.py similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/python/CSCTriggerPrimitivesReader_cfi.py rename to L1Trigger/CSCTriggerPrimitives/test/deprecated/CSCTriggerPrimitivesReader_cfi.py diff --git a/L1Trigger/CSCTriggerPrimitives/test/macros/README.md b/L1Trigger/CSCTriggerPrimitives/test/macros/README.md index 46f94a81ad1c3..917fc9f6fed3c 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/macros/README.md +++ b/L1Trigger/CSCTriggerPrimitives/test/macros/README.md @@ -1,3 +1,6 @@ +CCLUTLinearFitWriter +==================== + The macro CCLUTLinearFitWriter.cpp produces look-up tables for the Run-3 CSC trigger. * 10 LUTs will be created for CMSSW (5 for position offset, 5 for slope). 5 LUTs will be created for the Verilog firmware. These files are similar to the ones found here: https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives. 5 additional LUTs will be created that convert the Run-3 comparator code & pattern ID to a Run-1/2 pattern ID. The LUTs used in the simulation require at least 3 layers. For reference the macro also produces fits with at least four layers. @@ -31,3 +34,5 @@ root -l -q -b CCLUTLinearFitWriter.cpp++(4) | 13 | 3/2 | 1 | 1 | 0 | | 14 | 7/4 | 1 | 1 | 1 | | 15 | 2 | 2 | 0 | 0 | + +The LUTs can be found at https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/CCLUT \ No newline at end of file diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQM_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQM_cfg.py new file mode 100644 index 0000000000000..569d72ed9e45b --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCL1TDQM_cfg.py @@ -0,0 +1,43 @@ +import FWCore.ParameterSet.Config as cms +from FWCore.ParameterSet.VarParsing import VarParsing +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 + +process = cms.Process("CSCTPEmulator2", Run2_2018) +process.load("Configuration/StandardSequences/GeometryRecoDB_cff") +process.load("Configuration/StandardSequences/MagneticField_cff") +process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") +process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load("DQM.L1TMonitorClient.L1TdeCSCTPGClient_cfi") +process.load('DQMOffline.Configuration.DQMOfflineMC_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(1) +) + +process.options = cms.untracked.PSet( + SkipEvent = cms.untracked.vstring('ProductNotFound') +) + +process.source = cms.Source( + "DQMRootSource", + fileNames = cms.untracked.vstring("file:step_DQM.root") +) + +process.MessageLogger = cms.Service("MessageLogger") + +## global tag +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') + +## schedule and path definition +process.dqm_step = cms.Path(process.l1tdeCSCTPGClient) +process.dqmsave_step = cms.Path(process.DQMSaver) +process.endjob_step = cms.EndPath(process.endOfProcess) + +process.schedule = cms.Schedule( + process.dqm_step, + process.endjob_step, + process.dqmsave_step +) diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py new file mode 100644 index 0000000000000..a3f46512c47e7 --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveAnalyzer_cfg.py @@ -0,0 +1,50 @@ +import FWCore.ParameterSet.Config as cms +from FWCore.ParameterSet.VarParsing import VarParsing +from Configuration.Eras.Era_Run3_cff import Run3 + +options = VarParsing('analysis') +options.register ("dataVsEmulation", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("analyzeEffiency", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("analyzeResolution", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("dataVsEmulationFile", "empty", VarParsing.multiplicity.singleton, VarParsing.varType.string) +options.register ("runNumber", 0, VarParsing.multiplicity.singleton, VarParsing.varType.int) +options.parseArguments() + +process = cms.Process("ANALYSIS", Run3) +process.load("FWCore.MessageService.MessageLogger_cfi") + +process.source = cms.Source( + "PoolSource", + fileNames = cms.untracked.vstring(options.inputFiles) +) + +## if dataVsEmulation and analyzeEffiency or analyzeResolution are true, +## pick dataVsEmulation +if options.dataVsEmulation and (options.analyzeEffiency or options.analyzeResolution): + options.analyzeEffiency = False + options.analyzeResolution = False + +if options.dataVsEmulation: + options.maxEvents = 1 + process.source = cms.Source("EmptySource") + + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(options.maxEvents) +) + +## customize the data vs emulator module +from DQM.L1TMonitor.L1TdeCSCTPG_cfi import l1tdeCSCTPGCommon +process.cscTriggerPrimitivesAnalyzer = cms.EDAnalyzer( + "CSCTriggerPrimitivesAnalyzer", + l1tdeCSCTPGCommon, + ## file of the form "DQM_V0001_L1TEMU_R000334393" + rootFileName = cms.string(options.dataVsEmulationFile), + ## e.g. 334393 + runNumber = cms.uint32(options.runNumber), + dataVsEmulatorPlots = cms.bool(options.dataVsEmulation), + mcEfficiencyPlots = cms.bool(options.analyzeEffiency), + mcResolutionPlots = cms.bool(options.analyzeResolution), +) + +process.p = cms.Path(process.cscTriggerPrimitivesAnalyzer) diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py index 8565c585b9c59..ddd59c7fb289d 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py @@ -1,23 +1,25 @@ import FWCore.ParameterSet.Config as cms from FWCore.ParameterSet.VarParsing import VarParsing from Configuration.Eras.Era_Run3_cff import Run3 +from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 options = VarParsing('analysis') -options.register ("unpack", True, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("analyzeData", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("analyzeEmul", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("unpack", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.register ("mc", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) -options.register ("FastSim", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) +options.register ("dqm", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool) options.parseArguments() -process = cms.Process("CSCTPEmulator", Run3) +process = cms.Process("CSCTPEmulator", Run2_2018) process.load("Configuration/StandardSequences/GeometryRecoDB_cff") process.load("Configuration/StandardSequences/MagneticField_cff") process.load("Configuration/StandardSequences/FrontierConditions_GlobalTag_cff") +process.load('Configuration.StandardSequences.DQMSaverAtRunEnd_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load("L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi") -process.load("L1Trigger.CSCTriggerPrimitives.CSCTriggerPrimitivesReader_cfi") +process.load('Configuration.EventContent.EventContent_cff') process.load("EventFilter.CSCRawToDigi.cscUnpacker_cfi") +process.load("L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi") +process.load("DQM.L1TMonitor.L1TdeCSCTPG_cfi") +process.load('DQMOffline.Configuration.DQMOfflineMC_cff') process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) @@ -35,14 +37,12 @@ process.MessageLogger = cms.Service("MessageLogger", destinations = cms.untracked.vstring("debug"), debug = cms.untracked.PSet( - extension = cms.untracked.string(".txt"), - threshold = cms.untracked.string("DEBUG"), - # threshold = cms.untracked.string("WARNING"), - lineLength = cms.untracked.int32(132), - noLineBreaks = cms.untracked.bool(True) + extension = cms.untracked.string(".txt"), + threshold = cms.untracked.string("WARNING"), + lineLength = cms.untracked.int32(132), + noLineBreaks = cms.untracked.bool(True) ), - debugModules = cms.untracked.vstring("cscTriggerPrimitiveDigis", - "lctreader") + debugModules = cms.untracked.vstring("cscTriggerPrimitiveDigis") ) ## global tag @@ -50,40 +50,46 @@ if options.mc: process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') else: - process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run3_data', '') - options.FastSim = False - -## Process customization -analyze = options.analyzeData or options.analyzeEmul + #process.GlobalTag = GlobalTag(process.GlobalTag, '112X_dataRun3_Prompt_v5', '') + process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '') -if options.unpack: +## running on unpacked data, or after running the unpacker +if not options.mc or options.unpack: process.cscTriggerPrimitiveDigis.CSCComparatorDigiProducer = "muonCSCDigis:MuonCSCComparatorDigi" process.cscTriggerPrimitiveDigis.CSCWireDigiProducer = "muonCSCDigis:MuonCSCWireDigi" -if options.analyzeEmul: - process.cscTriggerPrimitivesReader.emulLctsIn = True - -if options.analyzeData: - process.cscTriggerPrimitivesReader.dataLctsIn = True +## DQM monitor +if options.dqm: + process.l1tdeCSCTPG.emulALCT = "cscTriggerPrimitiveDigis" + process.l1tdeCSCTPG.emulCLCT = "cscTriggerPrimitiveDigis" + process.l1tdeCSCTPG.emulLCT = "cscTriggerPrimitiveDigis:MPCSORTED" -if options.FastSim: - process.cscTriggerPrimitivesReader.CSCSimHitProducer = "MuonSimHits:MuonCSCHits" # Output process.output = cms.OutputModule( "PoolOutputModule", - fileName = cms.untracked.string("lcts.root"), + outputCommands = cms.untracked.vstring( + ['keep *', + 'drop *_rawDataCollector_*_*', + ]), + fileName = cms.untracked.string("lcts2.root"), ) -process.TFileService = cms.Service( - "TFileService", - fileName = cms.string('TPEHists.root') +## DQM output +process.DQMoutput = cms.OutputModule("DQMRootOutputModule", + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('DQMIO'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step_DQM.root'), + outputCommands = process.DQMEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) ) ## schedule and path definition process.p1 = cms.Path(process.muonCSCDigis) process.p2 = cms.Path(process.cscTriggerPrimitiveDigis) -process.p3 = cms.Path(process.cscTriggerPrimitivesReader) +process.p3 = cms.EndPath(process.DQMoutput) process.endjob_step = cms.EndPath(process.output * process.endOfProcess) process.schedule = cms.Schedule() @@ -93,7 +99,8 @@ ## always add the trigger itself process.schedule.extend([process.p2]) -if options.analyze: +## add DQM step 1 +if options.dqm: process.schedule.extend([process.p3]) process.schedule.extend([process.endjob_step]) From 6e9a5e0c2f21bf884bf3ca620ac62abd210148d6 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Tue, 4 May 2021 12:25:34 -0500 Subject: [PATCH 166/309] Code format --- .../test/CSCTriggerPrimitivesAnalyzer.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc index 4772b68bb8a12..8a2f0c0e15cf8 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc +++ b/L1Trigger/CSCTriggerPrimitives/test/CSCTriggerPrimitivesAnalyzer.cc @@ -35,27 +35,27 @@ class CSCTriggerPrimitivesAnalyzer : public edm::one::EDAnalyzer<> { public: /// Constructor - explicit CSCTriggerPrimitivesAnalyzer(const edm::ParameterSet& conf); + explicit CSCTriggerPrimitivesAnalyzer(const edm::ParameterSet &conf); /// Destructor ~CSCTriggerPrimitivesAnalyzer() override {} /// Does the job - void analyze(const edm::Event& event, const edm::EventSetup& setup) override; + void analyze(const edm::Event &event, const edm::EventSetup &setup) override; /// Write to ROOT file, make plots, etc. void endJob() override; private: - void makePlot(TH1F* dataMon, - TH1F* emulMon, - TH1F* diffMon, + void makePlot(TH1F *dataMon, + TH1F *emulMon, + TH1F *diffMon, TString lcts, TString lct, TString var, TString chamber, - TPostScript* ps, - TCanvas* c1) const; + TPostScript *ps, + TCanvas *c1) const; // plots of data vs emulator std::string rootFileName_; From af1c88620ab2ed3bd4a784c0c906f613ee223ab5 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Tue, 4 May 2021 12:41:23 -0500 Subject: [PATCH 167/309] Move to test --- L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml | 7 +++++++ .../{plugins => test}/GEMCSCLUTAnalyzer.cc | 0 2 files changed, 7 insertions(+) create mode 100644 L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml rename L1Trigger/CSCTriggerPrimitives/{plugins => test}/GEMCSCLUTAnalyzer.cc (100%) diff --git a/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml b/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml new file mode 100644 index 0000000000000..31bb9be6c7f7c --- /dev/null +++ b/L1Trigger/CSCTriggerPrimitives/test/BuildFile.xml @@ -0,0 +1,7 @@ +<use name="Geometry/GEMGeometry"/> +<use name="Geometry/CSCGeometry"/> +<use name="Geometry/Records"/> +<use name="FWCore/Framework"/> +<flags EDM_PLUGIN="1"/> +<library file="GEMCSCLUTAnalyzer.cc" name="GEMCSCLUTAnalyzer"> +</library> diff --git a/L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc b/L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/plugins/GEMCSCLUTAnalyzer.cc rename to L1Trigger/CSCTriggerPrimitives/test/GEMCSCLUTAnalyzer.cc From f925645e8acafd453b9983f21337ae78f058374f Mon Sep 17 00:00:00 2001 From: Justinas Rumsevicius <justinas.rumsevicius@gmail.com> Date: Tue, 4 May 2021 19:59:32 +0200 Subject: [PATCH 168/309] Allow to suppress ExternalLHEProducer exception if not all events were processed --- .../LHEInterface/plugins/ExternalLHEProducer.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index 4913c4fba60a3..167ac43cb592f 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -28,6 +28,7 @@ Description: [one line class summary] #include <sys/wait.h> #include <sys/time.h> #include <sys/resource.h> +#include <stdlib.h> #include "boost/bind.hpp" #include "boost/shared_ptr.hpp" @@ -333,10 +334,16 @@ void ExternalLHEProducer::endRunProduce(edm::Run& run, edm::EventSetup const& es nextEvent(); if (partonLevel) { - throw edm::Exception(edm::errors::EventGenerationFailure) - << "Error in ExternalLHEProducer::endRunProduce(). " - << "Event loop is over, but there are still lhe events to process." - << "This could happen if lhe file contains more events than requested. This is never expected to happen."; + // VALIDATION_RUN env variable allows to finish event processing early without errors by sending SIGINT + if (getenv("VALIDATION_RUN") != NULL) { + edm::LogWarning("ExternalLHEProducer") + << "Event loop is over, but there are still lhe events to process, ignoring..."; + } else { + throw edm::Exception(edm::errors::EventGenerationFailure) + << "Error in ExternalLHEProducer::endRunProduce(). " + << "Event loop is over, but there are still lhe events to process." + << "This could happen if lhe file contains more events than requested. This is never expected to happen."; + } } reader_.reset(); From 44e7974acbd1937731a66827d150addefabfb5f8 Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Tue, 4 May 2021 20:40:41 +0200 Subject: [PATCH 169/309] fix missing leftover Timing parameter in fed_dqm_sourceclient-live_cfg.py --- DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py | 1 - 1 file changed, 1 deletion(-) diff --git a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py index b28f92d0f8d4e..5c2cafbbfa0e2 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -48,7 +48,6 @@ # Pixel sequence: process.load('Configuration.StandardSequences.MagneticField_cff') process.load('EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi') -process.siPixelDigis.cpu.Timing = False process.siPixelDigis.cpu.IncludeErrors = True process.load('DQM.SiPixelMonitorRawData.SiPixelMonitorHLT_cfi') process.SiPixelHLTSource.saveFile = False From 5f462e75461d968bfb81a9f064f0a030a3adee57 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Tue, 4 May 2021 21:57:47 +0200 Subject: [PATCH 170/309] remove remaining Timing parameters --- DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py | 1 - .../python/sipixel_dqm_HLTsource_example_cfg.py | 1 - .../python/sipixel_dqm_source_example_cfg.py | 1 - EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py | 1 - EventFilter/SiPixelRawToDigi/test/test.py | 1 - 5 files changed, 5 deletions(-) diff --git a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py index b28f92d0f8d4e..5c2cafbbfa0e2 100644 --- a/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/fed_dqm_sourceclient-live_cfg.py @@ -48,7 +48,6 @@ # Pixel sequence: process.load('Configuration.StandardSequences.MagneticField_cff') process.load('EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi') -process.siPixelDigis.cpu.Timing = False process.siPixelDigis.cpu.IncludeErrors = True process.load('DQM.SiPixelMonitorRawData.SiPixelMonitorHLT_cfi') process.SiPixelHLTSource.saveFile = False diff --git a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py index 45e9fe07dba89..7a35ab7b2c0af 100644 --- a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py +++ b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_HLTsource_example_cfg.py @@ -19,7 +19,6 @@ # Pixel RawToDigi conversion process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") process.siPixelDigis.InputLabel = "source" -process.siPixelDigis.Timing = False process.siPixelDigis.IncludeErrors = True process.load("DQM.SiPixelMonitorRawData.SiPixelMonitorHLT_cfi") diff --git a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py index 275130d77852b..6636d82cfd54f 100644 --- a/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py +++ b/DQM/SiPixelMonitorRawData/python/sipixel_dqm_source_example_cfg.py @@ -19,7 +19,6 @@ # Pixel RawToDigi conversion process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") process.siPixelDigis.InputLabel = "source" -process.siPixelDigis.Timing = False process.siPixelDigis.IncludeErrors = True process.load("DQM.SiPixelMonitorRawData.SiPixelMonitorRawData_cfi") diff --git a/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py b/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py index 684025205db54..4f683f1b49657 100644 --- a/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py +++ b/EventFilter/SiPixelRawToDigi/test/runRawToDigi_cfg.py @@ -48,7 +48,6 @@ #process.siPixelDigis.InputLabel = 'source' #process.siPixelDigis.InputLabel = 'rawDataCollector' process.siPixelDigis.IncludeErrors = True -process.siPixelDigis.Timing = False #process.siPixelDigis.UseCablingTree = True process.MessageLogger = cms.Service("MessageLogger", diff --git a/EventFilter/SiPixelRawToDigi/test/test.py b/EventFilter/SiPixelRawToDigi/test/test.py index 9620c86c9f92c..711597299b56d 100644 --- a/EventFilter/SiPixelRawToDigi/test/test.py +++ b/EventFilter/SiPixelRawToDigi/test/test.py @@ -21,7 +21,6 @@ process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi") #process.siPixelDigis.InputLabel = "rawDataCollector" process.siPixelDigis.InputLabel = "rawDataCollector" -process.siPixelDigis.Timing = True process.siPixelDigis.UseQualityInfo = False process.siPixelDigis.IncludeErrors = True process.siPixelDigis.ErrorList = [29] From 32c6228ad8c0a02f4cfebc5711d5e203c68c7435 Mon Sep 17 00:00:00 2001 From: Angela Czirkos <czirkosangela@gmail.com> Date: Tue, 4 May 2021 22:21:01 +0200 Subject: [PATCH 171/309] remove more Timing --- .../test/PCC_Random_Event_Integrator_cfg.py | 1 - Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py | 1 - Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py | 1 - Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py | 1 - 4 files changed, 4 deletions(-) diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py index 6f7764abeaf01..d48108361e0a9 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_Integrator_cfg.py @@ -74,7 +74,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py index c0170b402a959..b8e80843e2a30 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_Event_cfg.py @@ -66,7 +66,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py index d62c9a5be3963..13b9756315bd3 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_Random_cfg.py @@ -66,7 +66,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), diff --git a/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py b/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py index 394c1b7856688..af1c884625da0 100644 --- a/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py +++ b/Calibration/LumiAlCaRecoProducers/test/PCC_ZeroBias_cfg.py @@ -70,7 +70,6 @@ Regions = cms.PSet( ), - Timing = cms.untracked.bool(False), UsePhase1 = cms.bool(False), UsePilotBlade = cms.bool(False), UseQualityInfo = cms.bool(False), From 399c483efa1c6967f724dcfc39158f95a6d2fbf8 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Tue, 4 May 2021 22:49:26 +0200 Subject: [PATCH 172/309] Clean up a few classes for the use of ESGetToken and add a script for plots --- .../interface/HGCalValidator.h | 1 - .../plugins/HGCalShowerSeparation.cc | 9 +- .../HeterogeneousHGCalRecHitsValidator.cc | 9 +- .../HeterogeneousHGCalRecHitsValidator.h | 5 + Validation/HGCalValidation/test/MakePlots.C | 745 ++++++++++++++++++ 5 files changed, 758 insertions(+), 11 deletions(-) create mode 100644 Validation/HGCalValidation/test/MakePlots.C diff --git a/Validation/HGCalValidation/interface/HGCalValidator.h b/Validation/HGCalValidation/interface/HGCalValidator.h index f617830125c1d..cda238304f731 100644 --- a/Validation/HGCalValidation/interface/HGCalValidator.h +++ b/Validation/HGCalValidation/interface/HGCalValidator.h @@ -7,7 +7,6 @@ * \author HGCal */ #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Framework/interface/Frameworkfwd.h" diff --git a/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc b/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc index fa2b9047ab22a..5990f506c0a45 100644 --- a/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc +++ b/Validation/HGCalValidation/plugins/HGCalShowerSeparation.cc @@ -4,7 +4,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -55,6 +54,7 @@ class HGCalShowerSeparation : public DQMEDAnalyzer { edm::EDGetTokenT<std::unordered_map<DetId, const HGCRecHit*>> hitMap_; edm::EDGetTokenT<std::vector<CaloParticle>> caloParticles_; + const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> tok_geom_; int debug_; bool filterOnEnergyAndCaloP_; @@ -82,7 +82,8 @@ class HGCalShowerSeparation : public DQMEDAnalyzer { }; HGCalShowerSeparation::HGCalShowerSeparation(const edm::ParameterSet& iConfig) - : debug_(iConfig.getParameter<int>("debug")), + : tok_geom_(esConsumes<CaloGeometry, CaloGeometryRecord>()), + debug_(iConfig.getParameter<int>("debug")), filterOnEnergyAndCaloP_(iConfig.getParameter<bool>("filterOnEnergyAndCaloP")) { auto hitMapInputTag = iConfig.getParameter<edm::InputTag>("hitMapTag"); auto caloParticles = iConfig.getParameter<edm::InputTag>("caloParticles"); @@ -160,9 +161,7 @@ void HGCalShowerSeparation::bookHistograms(DQMStore::IBooker& ibooker, void HGCalShowerSeparation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle<CaloGeometry> geom; - iSetup.get<CaloGeometryRecord>().get(geom); - recHitTools_.setGeometry(*geom); + recHitTools_.setGeometry(iSetup.getData(tok_geom_)); Handle<std::vector<CaloParticle>> caloParticleHandle; iEvent.getByToken(caloParticles_, caloParticleHandle); diff --git a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc index 004c5a2a657a2..bdf2b67b04204 100644 --- a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc +++ b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.cc @@ -9,8 +9,10 @@ HeterogeneousHGCalRecHitsValidator::HeterogeneousHGCalRecHitsValidator(const edm consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("gpuRecHitsHSciToken"))}}}}), treenames_({{"CEE", "CHSi", "CHSci"}}) { usesResource(TFileService::kSharedResource); + estokenGeom_ = esConsumes<CaloGeometry, CaloGeometryRecord>(); edm::Service<TFileService> fs; for (unsigned i(0); i < nsubdetectors; ++i) { + estokens_[i] = esConsumes<HGCalGeometry, IdealGeometryRecord>(edm::ESInputTag{"", handles_str_[i]}); trees_[i] = fs->make<TTree>(treenames_[i].c_str(), treenames_[i].c_str()); trees_[i]->Branch("cpu", "ValidHitCollection", &cpuValidRecHits[i]); trees_[i]->Branch("gpu", "ValidHitCollection", &gpuValidRecHits[i]); @@ -23,14 +25,11 @@ HeterogeneousHGCalRecHitsValidator::~HeterogeneousHGCalRecHitsValidator() {} void HeterogeneousHGCalRecHitsValidator::endJob() {} void HeterogeneousHGCalRecHitsValidator::set_geometry_(const edm::EventSetup &setup, const unsigned &detidx) { - edm::ESHandle<HGCalGeometry> handle; - setup.get<IdealGeometryRecord>().get(handles_str_[detidx], handle); + edm::ESHandle<HGCalGeometry> handle = setup.getHandle(estokens_[detidx]); } void HeterogeneousHGCalRecHitsValidator::analyze(const edm::Event &event, const edm::EventSetup &setup) { - edm::ESHandle<CaloGeometry> baseGeom; - setup.get<CaloGeometryRecord>().get(baseGeom); - recHitTools_.setGeometry(*baseGeom); + recHitTools_.setGeometry(setup.getData(estokenGeom_)); //future subdetector loop for (size_t idet = 0; idet < nsubdetectors; ++idet) { diff --git a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h index 01435ff6fc271..9caff818acccc 100644 --- a/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h +++ b/Validation/HGCalValidation/plugins/HeterogeneousHGCalRecHitsValidator.h @@ -9,7 +9,9 @@ #include "CommonTools/UtilAlgos/interface/TFileService.h" #include "DataFormats/HGCRecHit/interface/HGCRecHit.h" #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/Records/interface/IdealGeometryRecord.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "Validation/HGCalValidation/interface/ValidHit.h" @@ -41,6 +43,9 @@ class HeterogeneousHGCalRecHitsValidator : public edm::one::EDAnalyzer<edm::one: static const unsigned ncomputingdevices = 2; //cpu, gpu //cpu amd gpu tokens and handles for the 3 subdetectors, cpu and gpu std::array<std::array<edm::EDGetTokenT<HGChefRecHitCollection>, ncomputingdevices>, nsubdetectors> tokens_; + std::array<edm::ESGetToken<HGCalGeometry, IdealGeometryRecord>, nsubdetectors> estokens_; + edm::ESGetToken<CaloGeometry, CaloGeometryRecord> estokenGeom_; + std::array<std::string, nsubdetectors> handles_str_ = { {"HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive"}}; hgcal::RecHitTools recHitTools_; diff --git a/Validation/HGCalValidation/test/MakePlots.C b/Validation/HGCalValidation/test/MakePlots.C new file mode 100644 index 0000000000000..6fee68c40aff3 --- /dev/null +++ b/Validation/HGCalValidation/test/MakePlots.C @@ -0,0 +1,745 @@ +//########################################################################### +// +// void noseRecHitPlots(fname, dirnm, tag, save) +// Plots histograms created by recHitStudy for the Nose detector +// void hgcalStudyPlots(fname, type, tag, dtype, save, debug) +// Plots histograms created by SimHit/Digi/RecHit Study for HGCal +// void hgcalGeomCheckPlots(fname, tag, dtype, save, debug) +// Plots histograms created by HGCGeometryCheck +// void hgcalBHValidPlots(fname, tag, dtype, save, debug) +// Plots histograms created by HGCalBHValidation +// +// where +// fanme (std::string) Input ROOT file name +// ("hfnRecHitD31tt.root" for noseRecHitPlots, +// "roots/hgcSimHitD83tt.root" studyPlots, +// "roots/hgcGeomCheckD83.root" GeomCheck, +// "roots/hgcBHValidD83.root" BHValid) +// dirnm (std::string) Directory name +// ("hfnoseRecHitStudy" for noseRecHitPlots) +// itype (int) Type: 0 SimHit; 1 Digi; 2 RecHit (0) +// tag (std::string) Name of the tag for the canvas name +// ("HFNose" for noseRecHitPlots, +// "SimHitD83" for studyPlots, +// "GeomChkD83" for GeomCheck, +// "BHValidD83" for BHValid) +// dtype (std::string) Data type added for canvas name +// ("ttbar D83" for studyPlots, +// "#mu D83" for geomCheck, BHValid) +// save (bool) Flag to save the canvas (false) +// debug (bool) Debug flag (false) +// +//########################################################################### +// +#include <TROOT.h> +#include <TChain.h> +#include <TFile.h> +#include <TH1D.h> +#include <TH2D.h> +#include <TProfile.h> +#include <TFitResult.h> +#include <TFitResultPtr.h> +#include <TStyle.h> +#include <TCanvas.h> +#include <TLegend.h> +#include <TPaveStats.h> +#include <TPaveText.h> +#include <vector> +#include <string> +#include <iomanip> +#include <iostream> +#include <fstream> + +void noseRecHitPlots(std::string fname="hfnRecHitD31tt.root", + std::string dirnm="hfnoseRecHitStudy", + std::string tag="HFNose", bool save=false) { + + int nums[2] = {5,2}; + int layers(8); + std::string name1[5] = {"Energy_Layer", "HitOccupancy_Minus_layer", + "HitOccupaancy_Plus_layer", "EtaPhi_Minus_Layer", + "EtaPhi_Plus_Layer"}; + std::string name2[2] = {"EtaPhi", "RZ"}; + std::string detName = "HGCalHFNoseSensitive"; + int type1[5] = {1, 1, 1, 2, 2}; + int rebin[5] = {10,1, 1, 1, 1}; + int type2[2] = {2, 2}; + std::string xtitl1[5] = {"Energy (GeV)", "Hits", "Hits", "#eta", "#eta"}; + std::string ytitl1[5] = {" ", " ", " ", "#phi", "#phi"}; + std::string xtitl2[2] = {"#eta", "z (cm)"}; + std::string ytitl2[2] = {"#phi", "R (cm)"}; + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + TFile *file = new TFile(fname.c_str()); + if (file) { + TDirectory *dir = (TDirectory*)file->FindObjectAny(dirnm.c_str()); + char name[100], title[100]; + for (int i1 = 0; i1<2; ++i1) { + int kk = (i1==0) ? layers : 1; + for (int i2=0; i2<nums[i1]; ++i2) { + for (int k=0; k<kk; ++k) { + int type(0); + if (i1 == 0) { + sprintf (name, "%s_%d", name1[i2].c_str(), k+1); + sprintf (title, "%s (Layer %d)", tag.c_str(), k+1); + type = type1[i2]; + } else { + sprintf (name, "%s_%s", name2[i2].c_str(), detName.c_str()); + sprintf (title, "Simulation of %s", tag.c_str()); + type = type2[i2]; + } + TH1D* hist1(nullptr); + TH2D* hist2(nullptr); + if (type == 1) hist1 = (TH1D*)dir->FindObjectAny(name); + else hist2 = (TH2D*)dir->FindObjectAny(name); + if ((hist1 != nullptr) || (hist2 != nullptr)) { + TCanvas *pad = new TCanvas(name,name,500,500); + pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); + if (type == 1) { + if (i1 == 0) { + hist1->GetYaxis()->SetTitle(ytitl1[i2].c_str()); + hist1->GetXaxis()->SetTitle(xtitl1[i2].c_str()); + hist1->Rebin(rebin[i2]); + } else { + hist1->GetYaxis()->SetTitle(ytitl2[i2].c_str()); + hist1->GetXaxis()->SetTitle(xtitl2[i2].c_str()); + } + hist1->SetTitle(title); + hist1->GetYaxis()->SetTitleOffset(1.2); + pad->SetLogy(); + hist1->Draw(); + } else { + if (i1 == 0) { + hist2->GetYaxis()->SetTitle(ytitl1[i2].c_str()); + hist2->GetXaxis()->SetTitle(xtitl1[i2].c_str()); + } else { + hist2->GetYaxis()->SetTitle(ytitl2[i2].c_str()); + hist2->GetXaxis()->SetTitle(xtitl2[i2].c_str()); + } + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->SetMarkerStyle(20); hist2->SetMarkerSize(0.1); + hist2->SetTitle(title); + hist2->Draw(); + } + pad->Update(); + TPaveStats* st1 = ((hist1 != nullptr) ? + ((TPaveStats*)hist1->GetListOfFunctions()->FindObject("stats")) : + ((TPaveStats*)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + pad->Modified(); pad->Update(); + if (save) { + sprintf (name, "c_%s%s.jpg", tag.c_str(), pad->GetName()); + pad->Print(name); + } + } + } + } + } + } +} + +void hgcalStudyPlots(std::string fname="roots/hgcSimHitD83tt.root", + int type=0, std::string tag="SimHitD83", + std::string dtype="ttbar D83", bool save=false, + bool debug=false) { + int ndir[3] = {1, 3, 3}; + std::string dirnm[3][3] = {{"hgcalSimHitStudy", "", ""}, + {"hgcalDigiStudyEE", "hgcalDigiStudyHEF", "hgcalDigiStudyHEB"}, + {"hgcalRecHitStudyEE", "hgcalRecHitStudyFH", "hgcalRecHitStudyBH"}}; + std::string name0[4] = {"HGCal EE", "HGCal HE Silicon", + "HGCal HE Scintillator", "HGCal"}; + int nname[3] = {4,1,1}; + std::string name1[4] = {"HGCalEESensitive", "HGCalHESiliconSensitive", + "HGCalHEScintillatorSensitive", "AllDetectors"}; + int nhist[3] = {4, 2, 2}; + int nhtype[3][4] = {{1, 1, 2, 2}, {1, 2, 0, 0}, {2, 2, 0, 0}}; + int yax[3][4] = {{1, 1, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, 0}}; + std::string name2[3][4] = {{"E_", "T_", "RZ_", "EtaPhi_"}, + {"Charge_", "RZ_", " ", " "}, + {"RZ_", "EtaPhi_", " ", " "}}; + std::string xtitl[3][4] = {{"Energy (GeV)", "Time (ns)", "Z (mm)", "#phi"}, + {"Charge", "Z (cm)", " ", " "}, + {"Z (cm)", "#phi", " ", " "}}; + std::string ytitl[3][4] = {{"Hits", "Hits", "R (mm)", "#eta"}, + {"Hits", "R (cm)", " ", " "}, + {"R (cm)", "#eta", " ", " "}}; + double xmax[3][4] = {{0.2, 20.0, -1, -1}, + {25.0, -1, -1, -1}, + {-1, -1, -1, -1}}; + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + if (debug) + std::cout << "File " << fname << " Type " << type << ":" << name0[type] + << " Tags " << tag << " : " << dtype << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + for (int it=0; it<ndir[type]; ++it) { + char dirx[100]; + sprintf (dirx, "%s", dirnm[type][it].c_str()); + TDirectory *dir = (TDirectory*)file->FindObjectAny(dirx); + if (debug) std::cout << "Directory " << dirx << " : " << dir << std::endl; + if (dir) { + for (int in=0; in<nname[type]; ++in) { + for (int ih=0; ih<nhist[type]; ++ih) { + char hname[100]; + if (type == 0) { + sprintf(hname, "%s%s", name2[type][ih].c_str(),name1[in].c_str()); + } else { + sprintf(hname, "%s%s", name2[type][ih].c_str(),name1[it].c_str()); + } + TH1D* hist1(nullptr); + TH2D* hist2(nullptr); + if (nhtype[type][ih] == 1) hist1 = (TH1D*)dir->FindObjectAny(hname); + else hist2 = (TH2D*)dir->FindObjectAny(hname); + if (debug) + std::cout << "Hist " << hname << " : " << hist1 << " : " << hist2 + << " Xtitle " << xtitl[type][ih] << " Ytitle " + << ytitl[type][ih] << " xmax " << xmax[type][ih] + << " Type " << nhtype[type][ih] << " yscale " + << yax[type][ih] << std::endl; + if ((hist1 != nullptr) || (hist2 != nullptr)) { + char name[100], title[100]; + sprintf (name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name,name,500,500); + pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); + if (type == 0) + sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); + else + sprintf(title, "%s (%s)", name0[it].c_str(), dtype.c_str()); + if (debug) std::cout << "Pad " << name << " : " << pad << "\n"; + if (nhtype[type][ih] == 1) { + hist1->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); + hist1->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); + if (xmax[type][ih] > 0) + hist1->GetXaxis()->SetRangeUser(0,xmax[type][ih]); + if (yax[type][ih] > 0) pad->SetLogy(); + hist1->SetTitle(title); + hist1->GetYaxis()->SetTitleOffset(1.2); + hist1->Draw(); + } else { + hist2->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); + hist2->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->SetMarkerStyle(20); hist2->SetMarkerSize(0.1); + hist2->SetTitle(title); + hist2->Draw(); + } + pad->Update(); + TPaveStats* st1 = ((hist1 != nullptr) ? + ((TPaveStats*)hist1->GetListOfFunctions()->FindObject("stats")) : + ((TPaveStats*)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + pad->Modified(); pad->Update(); + if (save) { + sprintf (name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } + } + } + } + } +} + +void hgcalGeomCheckPlots(std::string fname="roots/hgcGeomCheckD83.root", + std::string tag="GeomChkD83", + std::string dtype="#mu D83", + bool save=false, bool debug=false) { + std::string dirnm = "hgcGeomCheck"; + std::string name0[3] = {"HGCal EE", "HGCal HE Silicon", + "HGCal HE Scintillator"}; + int nhist = 3; + int nhtype = 3; + std::string name2[9] = {"heerVsLayer", "heezVsLayer", "heedzVsZ", + "hefrVsLayer", "hefzVsLayer", "hefdzVsZ", + "hebrVsLayer", "hebzVsLayer", "hebdzVsZ"}; + std::string xtitl[9] = {"Layer", "Layer", "#Delta Z (cm)", + "Layer", "Layer", "#Delta Z (cm)", + "Layer", "Layer", "#Delta Z (cm)"}; + std::string ytitl[9] = {"R (cm)", "Z (cm)", "Z (cm)", + "R (cm)", "Z (cm)", "Z (cm)", + "R (cm)", "Z (cm)", "Z (cm)"}; + + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + if (debug) + std::cout << "File " << fname << " Tags " << tag << " : " << dtype + << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + char dirx[100]; + sprintf (dirx, "%s", dirnm.c_str()); + TDirectory *dir = (TDirectory*)file->FindObjectAny(dirx); + if (debug) std::cout << "Directory " << dirx << " : " << dir << std::endl; + if (dir) { + for (int in=0; in<nhtype; ++in) { + for (int ih=0; ih<nhist; ++ih) { + char hname[100]; + int inh = in * nhist + ih; + sprintf(hname, "%s", name2[inh].c_str()); + TH2D* hist = (TH2D*)dir->FindObjectAny(hname); + if (debug) std::cout << "Hist " << hname << " : " << hist + << " Xtitle " << xtitl[inh] << " Ytitle " + << ytitl[inh] << std::endl; + if (hist != nullptr) { + char name[100], title[100]; + sprintf (name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name,name,500,500); + pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); + if (debug) std::cout << "Pad " << name << " : " << pad << "\n"; + hist->GetYaxis()->SetTitle(ytitl[inh].c_str()); + hist->GetXaxis()->SetTitle(xtitl[inh].c_str()); + hist->SetTitle(title); + hist->GetYaxis()->SetTitleOffset(1.2); + hist->Draw(); + pad->Update(); + TPaveStats* st1 = (TPaveStats*)hist->GetListOfFunctions()->FindObject("stats"); + if (st1 != NULL) { + st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + pad->Modified(); pad->Update(); + if (save) { + sprintf (name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } + } + } + } +} + +void hgcalBHValidPlots(std::string fname="roots/hgcBHValidD83.root", + std::string tag="BHValidD83", + std::string dtype="#mu D83", + bool save=false, bool debug=false) { + std::string dirnm = "hgcalBHAnalysis"; + std::string name0 = "HGCal HE Scintillator"; + int nhist = 9; + std::string name2[9] = {"SimHitEn1", "SimHitEn2", "SimHitLong", + "SimHitOccup", "SimHitOccu3", "SimHitTime", + "DigiLong", "DigiOccup", "DigiOccu3"}; + std::string xtitl[9] = {"SimHit Energy (GeV)", "SimHit Energy (GeV)", + "SimHit Layer #", "SimHit i#eta", "SimHit i#eta", + "Digi Layer #", "Digi i#eta", "Digi i#eta"}; + std::string ytitl[9] = {"Hits", "Hits", "Energy Sum (GeV)", "i#phi", + "Layer #", "Digi Sum", "i#phi", "Layer #"}; + double xmax[9] = {0.05, 0.20, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}; + int ihty[9] = {1, 1, 1, 2, 2, 1, 1, 2, 2}; + int iaxty[9] = {1, 1, 0, 0, 0, 1, 0, 0, 0}; + int ibin[10] = {0, 0, 0, 0, 0, 10, 0, 0, 0}; + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(111110); + if (debug) + std::cout << "File " << fname << " Tags " << tag << " : " << dtype + << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + char dirx[100]; + sprintf (dirx, "%s", dirnm.c_str()); + TDirectory *dir = (TDirectory*)file->FindObjectAny(dirx); + if (debug) std::cout << "Directory " << dirx << " : " << dir << std::endl; + if (dir) { + for (int ih=0; ih<nhist; ++ih) { + char hname[100]; + sprintf(hname, "%s", name2[ih].c_str()); + TH1D* hist1(nullptr); + TH2D* hist2(nullptr); + if (ihty[ih] <= 1) + hist1 = (TH1D*)dir->FindObjectAny(hname); + else + hist2 = (TH2D*)dir->FindObjectAny(hname); + if (debug) std::cout << "Hist " << hname << " : " << hist1 << ":" + << hist2 << " Xtitle " << xtitl[ih] << " Ytitle " + << ytitl[ih] << " xmax " << xmax[ih] + << " iaxty " << iaxty[ih] << " ibin " + << ibin[ih] << std::endl; + if ((hist1 != nullptr) || (hist2 != nullptr)) { + char name[100], title[100]; + sprintf (name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name,name,500,500); + pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", name0.c_str(), dtype.c_str()); + if (debug) std::cout << "Pad " << name << " : " << pad << "\n"; + if (hist1 != nullptr) { + hist1->GetYaxis()->SetTitle(ytitl[ih].c_str()); + hist1->GetXaxis()->SetTitle(xtitl[ih].c_str()); + hist1->SetTitle(title); + if (xmax[ih] > 0) + hist1->GetXaxis()->SetRangeUser(0, xmax[ih]); + if (iaxty[ih] > 0) + pad->SetLogy(); + if (ibin[ih] > 0) + hist1->Rebin(ibin[ih]); + hist1->GetYaxis()->SetTitleOffset(1.2); + hist1->Draw(); + } else { + hist2->GetYaxis()->SetTitle(ytitl[ih].c_str()); + hist2->GetXaxis()->SetTitle(xtitl[ih].c_str()); + hist2->SetTitle(title); + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->Draw(); + } + pad->Update(); + TPaveStats* st1 = ((hist1 != nullptr) ? + ((TPaveStats*)hist1->GetListOfFunctions()->FindObject("stats")) : + ((TPaveStats*)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); + } + pad->Modified(); pad->Update(); + if (save) { + sprintf (name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } + } + } +} + +void ehcalPlots(std::string fname="ecalHitdd4hep.root", + std::string dirnm="EcalSimHitStudy", + std::string tag="DD4Hep", + int dets=2, bool save=false, bool debug=false) { + const int nh = 2; + std::string name[nh] = {"poszp", "poszn"}; + gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetOptStat(10); + if (debug) + std::cout << "File " << fname << " Tag " << tag << " Detectors " << dets + << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); + if (file) { + TDirectory *dir = (TDirectory*)file->FindObjectAny(dirnm.c_str()); + if (debug) std::cout << "Directory " << dirnm << " : " << dir << std::endl; + if (dir) { + for (int id=0; id<dets; ++id) { + for (int ih=0; ih<nh; ++ih) { + char hname[100]; + sprintf(hname, "%s%d", name[ih].c_str(), id); + TH2D* hist = (TH2D*)(dir->FindObjectAny(hname)); + if (debug) std::cout << "Hist " << hname << " : " << hist << ":" + << hist->GetTitle() << " Xtitle " + << hist->GetXaxis()->GetTitle() << " Ytitle " + << hist->GetYaxis()->GetTitle() << std::endl; + if (hist != nullptr) { + char cname[100], title[100]; + sprintf (cname, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(cname, cname, 500, 500); + pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", hist->GetTitle(), tag.c_str()); + if (debug) std::cout << "Pad " << cname << " : " << pad << "\n"; + hist->SetTitle(title); + hist->SetMarkerStyle(20); hist->SetMarkerSize(0.1); + hist->GetYaxis()->SetTitleOffset(1.3); + hist->Draw(); + pad->Update(); + TPaveStats* st1 = ((TPaveStats*)hist->GetListOfFunctions()->FindObject("stats")); + if (st1 != NULL) { + st1->SetY1NDC(0.85); st1->SetY2NDC(0.90); + st1->SetX1NDC(0.70); st1->SetX2NDC(0.90); + } + pad->Modified(); pad->Update(); + if (save) { + sprintf (cname, "c_%s.jpg", pad->GetName()); + pad->Print(cname); + } + } + } + } + } + } +} + +class hgcHits { +public: + TTree *fChain; + Int_t fCurrent; + +private: + // Declaration of leaf types + std::vector<float> *heeRecX; + std::vector<float> *heeRecY; + std::vector<float> *heeRecZ; + std::vector<float> *heeRecEnergy; + std::vector<float> *hefRecX; + std::vector<float> *hefRecY; + std::vector<float> *hefRecZ; + std::vector<float> *hefRecEnergy; + std::vector<float> *hebRecX; + std::vector<float> *hebRecY; + std::vector<float> *hebRecZ; + std::vector<float> *hebRecEta; + std::vector<float> *hebRecPhi; + std::vector<float> *hebRecEnergy; + std::vector<float> *heeSimX; + std::vector<float> *heeSimY; + std::vector<float> *heeSimZ; + std::vector<float> *heeSimEnergy; + std::vector<float> *hefSimX; + std::vector<float> *hefSimY; + std::vector<float> *hefSimZ; + std::vector<float> *hefSimEnergy; + std::vector<float> *hebSimX; + std::vector<float> *hebSimY; + std::vector<float> *hebSimZ; + std::vector<float> *hebSimEta; + std::vector<float> *hebSimPhi; + std::vector<float> *hebSimEnergy; + std::vector<unsigned int> *heeDetID; + std::vector<unsigned int> *hefDetID; + std::vector<unsigned int> *hebDetID; + + // List of branches + TBranch *b_heeRecX; + TBranch *b_heeRecY; + TBranch *b_heeRecZ; + TBranch *b_heeRecEnergy; + TBranch *b_hefRecX; + TBranch *b_hefRecY; + TBranch *b_hefRecZ; + TBranch *b_hefRecEnergy; + TBranch *b_hebRecX; + TBranch *b_hebRecY; + TBranch *b_hebRecZ; + TBranch *b_hebRecEta; + TBranch *b_hebRecPhi; + TBranch *b_hebRecEnergy; + TBranch *b_heeSimX; + TBranch *b_heeSimY; + TBranch *b_heeSimZ; + TBranch *b_heeSimEnergy; + TBranch *b_hefSimX; + TBranch *b_hefSimY; + TBranch *b_hefSimZ; + TBranch *b_hefSimEnergy; + TBranch *b_hebSimX; + TBranch *b_hebSimY; + TBranch *b_hebSimZ; + TBranch *b_hebSimEta; + TBranch *b_hebSimPhi; + TBranch *b_hebSimEnergy; + TBranch *b_heeDetID; + TBranch *b_hefDetID; + TBranch *b_hebDetID; + +public: + hgcHits(const char* infile); + virtual ~hgcHits(); + virtual Int_t Cut(Long64_t entry); + virtual Int_t GetEntry(Long64_t entry); + virtual Long64_t LoadTree(Long64_t entry); + virtual void Init(TTree *tree); + virtual void Loop(); + virtual Bool_t Notify(); + virtual void Show(Long64_t entry = -1); + + void bookHistograms(); + void saveHistos(const char* outfile); +private: +}; + + + + hgcHits:: + hgcHits::hgcHits(const char* infile) { + TFile *file = new TFile(infile); + TDirectory *dir = (TDirectory*)(file->FindObjectAny("hgcHitAnalysis")); + TTree *tree = (TTree*)(dir->FindObjectAny("hgcHits")); + std::cout << "Attaches tree hgcHits at " << tree << " in file " << infile + << std::endl; + bookHistograms(); + Init(tree); +} + + hgcHits::~hgcHits() { + if (!fChain) return; + delete fChain->GetCurrentFile(); +} + +Int_t hgcHits::GetEntry(Long64_t entry) { + // Read contents of entry. + if (!fChain) return 0; + return fChain->GetEntry(entry); +} + +Long64_t hgcHits::LoadTree(Long64_t entry) { + // Set the environment to read one entry + if (!fChain) return -5; + Long64_t centry = fChain->LoadTree(entry); + if (centry < 0) return centry; + if (!fChain->InheritsFrom(TChain::Class())) return centry; + TChain *chain = (TChain*)fChain; + if (chain->GetTreeNumber() != fCurrent) { + fCurrent = chain->GetTreeNumber(); + Notify(); + } + return centry; +} + +void hgcHits::Init(TTree *tree) { + // The Init() function is called when the selector needs to initialize + // a new tree or chain. Typically here the branch addresses and branch + // pointers of the tree will be set. + // It is normally not necessary to make changes to the generated + // code, but the routine can be extended by the user if needed. + // Init() will be called many times when running on PROOF + // (once per file to be processed). + + // Set object pointer + heeRecX = 0; + heeRecY = 0; + heeRecZ = 0; + heeRecEnergy = 0; + hefRecX = 0; + hefRecY = 0; + hefRecZ = 0; + hefRecEnergy = 0; + hebRecX = 0; + hebRecY = 0; + hebRecZ = 0; + hebRecEta = 0; + hebRecPhi = 0; + hebRecEnergy = 0; + heeSimX = 0; + heeSimY = 0; + heeSimZ = 0; + heeSimEnergy = 0; + hefSimX = 0; + hefSimY = 0; + hefSimZ = 0; + hefSimEnergy = 0; + hebSimX = 0; + hebSimY = 0; + hebSimZ = 0; + hebSimEta = 0; + hebSimPhi = 0; + hebSimEnergy = 0; + heeDetID = 0; + hefDetID = 0; + hebDetID = 0; + // Set branch addresses and branch pointers + if (!tree) return; + fChain = tree; + fCurrent = -1; + fChain->SetMakeClass(1); + + fChain->SetBranchAddress("heeRecX", &heeRecX, &b_heeRecX); + fChain->SetBranchAddress("heeRecY", &heeRecY, &b_heeRecY); + fChain->SetBranchAddress("heeRecZ", &heeRecZ, &b_heeRecZ); + fChain->SetBranchAddress("heeRecEnergy", &heeRecEnergy, &b_heeRecEnergy); + fChain->SetBranchAddress("hefRecX", &hefRecX, &b_hefRecX); + fChain->SetBranchAddress("hefRecY", &hefRecY, &b_hefRecY); + fChain->SetBranchAddress("hefRecZ", &hefRecZ, &b_hefRecZ); + fChain->SetBranchAddress("hefRecEnergy", &hefRecEnergy, &b_hefRecEnergy); + fChain->SetBranchAddress("hebRecX", &hebRecX, &b_hebRecX); + fChain->SetBranchAddress("hebRecY", &hebRecY, &b_hebRecY); + fChain->SetBranchAddress("hebRecZ", &hebRecZ, &b_hebRecZ); + fChain->SetBranchAddress("hebRecEta", &hebRecEta, &b_hebRecEta); + fChain->SetBranchAddress("hebRecPhi", &hebRecPhi, &b_hebRecPhi); + fChain->SetBranchAddress("hebRecEnergy", &hebRecEnergy, &b_hebRecEnergy); + fChain->SetBranchAddress("heeSimX", &heeSimX, &b_heeSimX); + fChain->SetBranchAddress("heeSimY", &heeSimY, &b_heeSimY); + fChain->SetBranchAddress("heeSimZ", &heeSimZ, &b_heeSimZ); + fChain->SetBranchAddress("heeSimEnergy", &heeSimEnergy, &b_heeSimEnergy); + fChain->SetBranchAddress("hefSimX", &hefSimX, &b_hefSimX); + fChain->SetBranchAddress("hefSimY", &hefSimY, &b_hefSimY); + fChain->SetBranchAddress("hefSimZ", &hefSimZ, &b_hefSimZ); + fChain->SetBranchAddress("hefSimEnergy", &hefSimEnergy, &b_hefSimEnergy); + fChain->SetBranchAddress("hebSimX", &hebSimX, &b_hebSimX); + fChain->SetBranchAddress("hebSimY", &hebSimY, &b_hebSimY); + fChain->SetBranchAddress("hebSimZ", &hebSimZ, &b_hebSimZ); + fChain->SetBranchAddress("hebSimEta", &hebSimEta, &b_hebSimEta); + fChain->SetBranchAddress("hebSimPhi", &hebSimPhi, &b_hebSimPhi); + fChain->SetBranchAddress("hebSimEnergy", &hebSimEnergy, &b_hebSimEnergy); + fChain->SetBranchAddress("heeDetID", &heeDetID, &b_heeDetID); + fChain->SetBranchAddress("hefDetID", &hefDetID, &b_hefDetID); + fChain->SetBranchAddress("hebDetID", &hebDetID, &b_hebDetID); + Notify(); +} + +Bool_t hgcHits::Notify() { + // The Notify() function is called when a new file is opened. This + // can be either for a new TTree in a TChain or when when a new TTree + // is started when using PROOF. It is normally not necessary to make changes + // to the generated code, but the routine can be extended by the + // user if needed. The return value is currently not used. + + return kTRUE; +} + +void hgcHits::Show(Long64_t entry) { + // Print contents of entry. + // If entry is not specified, print current entry + if (!fChain) return; + fChain->Show(entry); +} + +Int_t hgcHits::Cut(Long64_t) { + // This function may be called from Loop. + // returns 1 if entry is accepted. + // returns -1 otherwise. + return 1; +} + +void hgcHits::Loop() { + // In a ROOT session, you can do: + // Root > .L hgcHits.C + // Root > hgcHits t + // Root > t.GetEntry(12); // Fill t data members with entry number 12 + // Root > t.Show(); // Show values of entry 12 + // Root > t.Show(16); // Read and show values of entry 16 + // Root > t.Loop(); // Loop on all entries + // + + // This is the loop skeleton where: + // jentry is the global entry number in the chain + // ientry is the entry number in the current Tree + // Note that the argument to GetEntry must be: + // jentry for TChain::GetEntry + // ientry for TTree::GetEntry and TBranch::GetEntry + // + // To read only selected branches, Insert statements like: + // METHOD1: + // fChain->SetBranchStatus("*",0); // disable all branches + // fChain->SetBranchStatus("branchname",1); // activate branchname + // METHOD2: replace line + // fChain->GetEntry(jentry); //read all branches + //by b_branchname->GetEntry(ientry); //read only this branch + if (fChain == 0) return; + + Long64_t nentries = fChain->GetEntriesFast(); + + Long64_t nbytes = 0, nb = 0; + for (Long64_t jentry=0; jentry<nentries;jentry++) { + Long64_t ientry = LoadTree(jentry); + if (ientry < 0) break; + nb = fChain->GetEntry(jentry); nbytes += nb; + // if (Cut(ientry) < 0) continue; + } +} + +void hgcHits::bookHistograms() { +} + +void hgcHits::saveHistos(const char*) { +} + From 7f7e28ff4c7b060a63bf7e6d0e4e83badf74933b Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Tue, 4 May 2021 23:11:07 +0200 Subject: [PATCH 173/309] Code Check --- Validation/HGCalValidation/test/MakePlots.C | 944 +++++++++++--------- 1 file changed, 497 insertions(+), 447 deletions(-) diff --git a/Validation/HGCalValidation/test/MakePlots.C b/Validation/HGCalValidation/test/MakePlots.C index 6fee68c40aff3..5757032b57e7d 100644 --- a/Validation/HGCalValidation/test/MakePlots.C +++ b/Validation/HGCalValidation/test/MakePlots.C @@ -50,420 +50,466 @@ #include <iostream> #include <fstream> -void noseRecHitPlots(std::string fname="hfnRecHitD31tt.root", - std::string dirnm="hfnoseRecHitStudy", - std::string tag="HFNose", bool save=false) { - - int nums[2] = {5,2}; - int layers(8); - std::string name1[5] = {"Energy_Layer", "HitOccupancy_Minus_layer", - "HitOccupaancy_Plus_layer", "EtaPhi_Minus_Layer", - "EtaPhi_Plus_Layer"}; +void noseRecHitPlots(std::string fname = "hfnRecHitD31tt.root", + std::string dirnm = "hfnoseRecHitStudy", + std::string tag = "HFNose", + bool save = false) { + int nums[2] = {5, 2}; + int layers(8); + std::string name1[5] = { + "Energy_Layer", "HitOccupancy_Minus_layer", "HitOccupaancy_Plus_layer", "EtaPhi_Minus_Layer", "EtaPhi_Plus_Layer"}; std::string name2[2] = {"EtaPhi", "RZ"}; - std::string detName = "HGCalHFNoseSensitive"; - int type1[5] = {1, 1, 1, 2, 2}; - int rebin[5] = {10,1, 1, 1, 1}; - int type2[2] = {2, 2}; + std::string detName = "HGCalHFNoseSensitive"; + int type1[5] = {1, 1, 1, 2, 2}; + int rebin[5] = {10, 1, 1, 1, 1}; + int type2[2] = {2, 2}; std::string xtitl1[5] = {"Energy (GeV)", "Hits", "Hits", "#eta", "#eta"}; std::string ytitl1[5] = {" ", " ", " ", "#phi", "#phi"}; std::string xtitl2[2] = {"#eta", "z (cm)"}; std::string ytitl2[2] = {"#phi", "R (cm)"}; - gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); - gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); gStyle->SetOptStat(111110); - TFile *file = new TFile(fname.c_str()); + TFile *file = new TFile(fname.c_str()); if (file) { - TDirectory *dir = (TDirectory*)file->FindObjectAny(dirnm.c_str()); + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirnm.c_str()); char name[100], title[100]; - for (int i1 = 0; i1<2; ++i1) { - int kk = (i1==0) ? layers : 1; - for (int i2=0; i2<nums[i1]; ++i2) { - for (int k=0; k<kk; ++k) { - int type(0); - if (i1 == 0) { - sprintf (name, "%s_%d", name1[i2].c_str(), k+1); - sprintf (title, "%s (Layer %d)", tag.c_str(), k+1); - type = type1[i2]; - } else { - sprintf (name, "%s_%s", name2[i2].c_str(), detName.c_str()); - sprintf (title, "Simulation of %s", tag.c_str()); - type = type2[i2]; - } - TH1D* hist1(nullptr); - TH2D* hist2(nullptr); - if (type == 1) hist1 = (TH1D*)dir->FindObjectAny(name); - else hist2 = (TH2D*)dir->FindObjectAny(name); - if ((hist1 != nullptr) || (hist2 != nullptr)) { - TCanvas *pad = new TCanvas(name,name,500,500); - pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); - if (type == 1) { - if (i1 == 0) { - hist1->GetYaxis()->SetTitle(ytitl1[i2].c_str()); - hist1->GetXaxis()->SetTitle(xtitl1[i2].c_str()); - hist1->Rebin(rebin[i2]); - } else { - hist1->GetYaxis()->SetTitle(ytitl2[i2].c_str()); - hist1->GetXaxis()->SetTitle(xtitl2[i2].c_str()); - } - hist1->SetTitle(title); - hist1->GetYaxis()->SetTitleOffset(1.2); - pad->SetLogy(); - hist1->Draw(); - } else { - if (i1 == 0) { - hist2->GetYaxis()->SetTitle(ytitl1[i2].c_str()); - hist2->GetXaxis()->SetTitle(xtitl1[i2].c_str()); - } else { - hist2->GetYaxis()->SetTitle(ytitl2[i2].c_str()); - hist2->GetXaxis()->SetTitle(xtitl2[i2].c_str()); - } - hist2->GetYaxis()->SetTitleOffset(1.2); - hist2->SetMarkerStyle(20); hist2->SetMarkerSize(0.1); - hist2->SetTitle(title); - hist2->Draw(); - } - pad->Update(); - TPaveStats* st1 = ((hist1 != nullptr) ? - ((TPaveStats*)hist1->GetListOfFunctions()->FindObject("stats")) : - ((TPaveStats*)hist2->GetListOfFunctions()->FindObject("stats"))); - if (st1 != NULL) { - st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); - st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); - } - pad->Modified(); pad->Update(); - if (save) { - sprintf (name, "c_%s%s.jpg", tag.c_str(), pad->GetName()); - pad->Print(name); - } - } - } + for (int i1 = 0; i1 < 2; ++i1) { + int kk = (i1 == 0) ? layers : 1; + for (int i2 = 0; i2 < nums[i1]; ++i2) { + for (int k = 0; k < kk; ++k) { + int type(0); + if (i1 == 0) { + sprintf(name, "%s_%d", name1[i2].c_str(), k + 1); + sprintf(title, "%s (Layer %d)", tag.c_str(), k + 1); + type = type1[i2]; + } else { + sprintf(name, "%s_%s", name2[i2].c_str(), detName.c_str()); + sprintf(title, "Simulation of %s", tag.c_str()); + type = type2[i2]; + } + TH1D *hist1(nullptr); + TH2D *hist2(nullptr); + if (type == 1) + hist1 = (TH1D *)dir->FindObjectAny(name); + else + hist2 = (TH2D *)dir->FindObjectAny(name); + if ((hist1 != nullptr) || (hist2 != nullptr)) { + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + if (type == 1) { + if (i1 == 0) { + hist1->GetYaxis()->SetTitle(ytitl1[i2].c_str()); + hist1->GetXaxis()->SetTitle(xtitl1[i2].c_str()); + hist1->Rebin(rebin[i2]); + } else { + hist1->GetYaxis()->SetTitle(ytitl2[i2].c_str()); + hist1->GetXaxis()->SetTitle(xtitl2[i2].c_str()); + } + hist1->SetTitle(title); + hist1->GetYaxis()->SetTitleOffset(1.2); + pad->SetLogy(); + hist1->Draw(); + } else { + if (i1 == 0) { + hist2->GetYaxis()->SetTitle(ytitl1[i2].c_str()); + hist2->GetXaxis()->SetTitle(xtitl1[i2].c_str()); + } else { + hist2->GetYaxis()->SetTitle(ytitl2[i2].c_str()); + hist2->GetXaxis()->SetTitle(xtitl2[i2].c_str()); + } + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->SetMarkerStyle(20); + hist2->SetMarkerSize(0.1); + hist2->SetTitle(title); + hist2->Draw(); + } + pad->Update(); + TPaveStats *st1 = ((hist1 != nullptr) ? ((TPaveStats *)hist1->GetListOfFunctions()->FindObject("stats")) + : ((TPaveStats *)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s%s.jpg", tag.c_str(), pad->GetName()); + pad->Print(name); + } + } + } } } } } -void hgcalStudyPlots(std::string fname="roots/hgcSimHitD83tt.root", - int type=0, std::string tag="SimHitD83", - std::string dtype="ttbar D83", bool save=false, - bool debug=false) { +void hgcalStudyPlots(std::string fname = "roots/hgcSimHitD83tt.root", + int type = 0, + std::string tag = "SimHitD83", + std::string dtype = "ttbar D83", + bool save = false, + bool debug = false) { int ndir[3] = {1, 3, 3}; std::string dirnm[3][3] = {{"hgcalSimHitStudy", "", ""}, - {"hgcalDigiStudyEE", "hgcalDigiStudyHEF", "hgcalDigiStudyHEB"}, - {"hgcalRecHitStudyEE", "hgcalRecHitStudyFH", "hgcalRecHitStudyBH"}}; - std::string name0[4] = {"HGCal EE", "HGCal HE Silicon", - "HGCal HE Scintillator", "HGCal"}; - int nname[3] = {4,1,1}; - std::string name1[4] = {"HGCalEESensitive", "HGCalHESiliconSensitive", - "HGCalHEScintillatorSensitive", "AllDetectors"}; + {"hgcalDigiStudyEE", "hgcalDigiStudyHEF", "hgcalDigiStudyHEB"}, + {"hgcalRecHitStudyEE", "hgcalRecHitStudyFH", "hgcalRecHitStudyBH"}}; + std::string name0[4] = {"HGCal EE", "HGCal HE Silicon", "HGCal HE Scintillator", "HGCal"}; + int nname[3] = {4, 1, 1}; + std::string name1[4] = { + "HGCalEESensitive", "HGCalHESiliconSensitive", "HGCalHEScintillatorSensitive", "AllDetectors"}; int nhist[3] = {4, 2, 2}; int nhtype[3][4] = {{1, 1, 2, 2}, {1, 2, 0, 0}, {2, 2, 0, 0}}; - int yax[3][4] = {{1, 1, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, 0}}; - std::string name2[3][4] = {{"E_", "T_", "RZ_", "EtaPhi_"}, - {"Charge_", "RZ_", " ", " "}, - {"RZ_", "EtaPhi_", " ", " "}}; - std::string xtitl[3][4] = {{"Energy (GeV)", "Time (ns)", "Z (mm)", "#phi"}, - {"Charge", "Z (cm)", " ", " "}, - {"Z (cm)", "#phi", " ", " "}}; - std::string ytitl[3][4] = {{"Hits", "Hits", "R (mm)", "#eta"}, - {"Hits", "R (cm)", " ", " "}, - {"R (cm)", "#eta", " ", " "}}; - double xmax[3][4] = {{0.2, 20.0, -1, -1}, - {25.0, -1, -1, -1}, - {-1, -1, -1, -1}}; + int yax[3][4] = {{1, 1, 0, 0}, {1, 0, 0, 0}, {0, 0, 0, 0}}; + std::string name2[3][4] = { + {"E_", "T_", "RZ_", "EtaPhi_"}, {"Charge_", "RZ_", " ", " "}, {"RZ_", "EtaPhi_", " ", " "}}; + std::string xtitl[3][4] = { + {"Energy (GeV)", "Time (ns)", "Z (mm)", "#phi"}, {"Charge", "Z (cm)", " ", " "}, {"Z (cm)", "#phi", " ", " "}}; + std::string ytitl[3][4] = { + {"Hits", "Hits", "R (mm)", "#eta"}, {"Hits", "R (cm)", " ", " "}, {"R (cm)", "#eta", " ", " "}}; + double xmax[3][4] = {{0.2, 20.0, -1, -1}, {25.0, -1, -1, -1}, {-1, -1, -1, -1}}; - gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); - gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); gStyle->SetOptStat(111110); - if (debug) - std::cout << "File " << fname << " Type " << type << ":" << name0[type] - << " Tags " << tag << " : " << dtype << " Save " << save << "\n"; - TFile *file = new TFile(fname.c_str()); + if (debug) + std::cout << "File " << fname << " Type " << type << ":" << name0[type] << " Tags " << tag << " : " << dtype + << " Save " << save << "\n"; + TFile *file = new TFile(fname.c_str()); if (file) { - for (int it=0; it<ndir[type]; ++it) { + for (int it = 0; it < ndir[type]; ++it) { char dirx[100]; - sprintf (dirx, "%s", dirnm[type][it].c_str()); - TDirectory *dir = (TDirectory*)file->FindObjectAny(dirx); - if (debug) std::cout << "Directory " << dirx << " : " << dir << std::endl; + sprintf(dirx, "%s", dirnm[type][it].c_str()); + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirx); + if (debug) + std::cout << "Directory " << dirx << " : " << dir << std::endl; if (dir) { - for (int in=0; in<nname[type]; ++in) { - for (int ih=0; ih<nhist[type]; ++ih) { - char hname[100]; - if (type == 0) { - sprintf(hname, "%s%s", name2[type][ih].c_str(),name1[in].c_str()); - } else { - sprintf(hname, "%s%s", name2[type][ih].c_str(),name1[it].c_str()); - } - TH1D* hist1(nullptr); - TH2D* hist2(nullptr); - if (nhtype[type][ih] == 1) hist1 = (TH1D*)dir->FindObjectAny(hname); - else hist2 = (TH2D*)dir->FindObjectAny(hname); - if (debug) - std::cout << "Hist " << hname << " : " << hist1 << " : " << hist2 - << " Xtitle " << xtitl[type][ih] << " Ytitle " - << ytitl[type][ih] << " xmax " << xmax[type][ih] - << " Type " << nhtype[type][ih] << " yscale " - << yax[type][ih] << std::endl; - if ((hist1 != nullptr) || (hist2 != nullptr)) { - char name[100], title[100]; - sprintf (name, "%s%s", hname, tag.c_str()); - TCanvas *pad = new TCanvas(name,name,500,500); - pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); - if (type == 0) - sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); - else - sprintf(title, "%s (%s)", name0[it].c_str(), dtype.c_str()); - if (debug) std::cout << "Pad " << name << " : " << pad << "\n"; - if (nhtype[type][ih] == 1) { - hist1->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); - hist1->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); - if (xmax[type][ih] > 0) - hist1->GetXaxis()->SetRangeUser(0,xmax[type][ih]); - if (yax[type][ih] > 0) pad->SetLogy(); - hist1->SetTitle(title); - hist1->GetYaxis()->SetTitleOffset(1.2); - hist1->Draw(); - } else { - hist2->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); - hist2->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); - hist2->GetYaxis()->SetTitleOffset(1.2); - hist2->SetMarkerStyle(20); hist2->SetMarkerSize(0.1); - hist2->SetTitle(title); - hist2->Draw(); - } - pad->Update(); - TPaveStats* st1 = ((hist1 != nullptr) ? - ((TPaveStats*)hist1->GetListOfFunctions()->FindObject("stats")) : - ((TPaveStats*)hist2->GetListOfFunctions()->FindObject("stats"))); - if (st1 != NULL) { - st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); - st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); - } - pad->Modified(); pad->Update(); - if (save) { - sprintf (name, "c_%s.jpg", pad->GetName()); - pad->Print(name); - } - } - } - } + for (int in = 0; in < nname[type]; ++in) { + for (int ih = 0; ih < nhist[type]; ++ih) { + char hname[100]; + if (type == 0) { + sprintf(hname, "%s%s", name2[type][ih].c_str(), name1[in].c_str()); + } else { + sprintf(hname, "%s%s", name2[type][ih].c_str(), name1[it].c_str()); + } + TH1D *hist1(nullptr); + TH2D *hist2(nullptr); + if (nhtype[type][ih] == 1) + hist1 = (TH1D *)dir->FindObjectAny(hname); + else + hist2 = (TH2D *)dir->FindObjectAny(hname); + if (debug) + std::cout << "Hist " << hname << " : " << hist1 << " : " << hist2 << " Xtitle " << xtitl[type][ih] + << " Ytitle " << ytitl[type][ih] << " xmax " << xmax[type][ih] << " Type " << nhtype[type][ih] + << " yscale " << yax[type][ih] << std::endl; + if ((hist1 != nullptr) || (hist2 != nullptr)) { + char name[100], title[100]; + sprintf(name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + if (type == 0) + sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); + else + sprintf(title, "%s (%s)", name0[it].c_str(), dtype.c_str()); + if (debug) + std::cout << "Pad " << name << " : " << pad << "\n"; + if (nhtype[type][ih] == 1) { + hist1->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); + hist1->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); + if (xmax[type][ih] > 0) + hist1->GetXaxis()->SetRangeUser(0, xmax[type][ih]); + if (yax[type][ih] > 0) + pad->SetLogy(); + hist1->SetTitle(title); + hist1->GetYaxis()->SetTitleOffset(1.2); + hist1->Draw(); + } else { + hist2->GetYaxis()->SetTitle(ytitl[type][ih].c_str()); + hist2->GetXaxis()->SetTitle(xtitl[type][ih].c_str()); + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->SetMarkerStyle(20); + hist2->SetMarkerSize(0.1); + hist2->SetTitle(title); + hist2->Draw(); + } + pad->Update(); + TPaveStats *st1 = ((hist1 != nullptr) ? ((TPaveStats *)hist1->GetListOfFunctions()->FindObject("stats")) + : ((TPaveStats *)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } + } } } } } -void hgcalGeomCheckPlots(std::string fname="roots/hgcGeomCheckD83.root", - std::string tag="GeomChkD83", - std::string dtype="#mu D83", - bool save=false, bool debug=false) { +void hgcalGeomCheckPlots(std::string fname = "roots/hgcGeomCheckD83.root", + std::string tag = "GeomChkD83", + std::string dtype = "#mu D83", + bool save = false, + bool debug = false) { std::string dirnm = "hgcGeomCheck"; - std::string name0[3] = {"HGCal EE", "HGCal HE Silicon", - "HGCal HE Scintillator"}; + std::string name0[3] = {"HGCal EE", "HGCal HE Silicon", "HGCal HE Scintillator"}; int nhist = 3; int nhtype = 3; - std::string name2[9] = {"heerVsLayer", "heezVsLayer", "heedzVsZ", - "hefrVsLayer", "hefzVsLayer", "hefdzVsZ", - "hebrVsLayer", "hebzVsLayer", "hebdzVsZ"}; - std::string xtitl[9] = {"Layer", "Layer", "#Delta Z (cm)", - "Layer", "Layer", "#Delta Z (cm)", - "Layer", "Layer", "#Delta Z (cm)"}; - std::string ytitl[9] = {"R (cm)", "Z (cm)", "Z (cm)", - "R (cm)", "Z (cm)", "Z (cm)", - "R (cm)", "Z (cm)", "Z (cm)"}; + std::string name2[9] = {"heerVsLayer", + "heezVsLayer", + "heedzVsZ", + "hefrVsLayer", + "hefzVsLayer", + "hefdzVsZ", + "hebrVsLayer", + "hebzVsLayer", + "hebdzVsZ"}; + std::string xtitl[9] = { + "Layer", "Layer", "#Delta Z (cm)", "Layer", "Layer", "#Delta Z (cm)", "Layer", "Layer", "#Delta Z (cm)"}; + std::string ytitl[9] = {"R (cm)", "Z (cm)", "Z (cm)", "R (cm)", "Z (cm)", "Z (cm)", "R (cm)", "Z (cm)", "Z (cm)"}; - gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); - gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); gStyle->SetOptStat(111110); - if (debug) - std::cout << "File " << fname << " Tags " << tag << " : " << dtype - << " Save " << save << "\n"; + if (debug) + std::cout << "File " << fname << " Tags " << tag << " : " << dtype << " Save " << save << "\n"; TFile *file = new TFile(fname.c_str()); if (file) { char dirx[100]; - sprintf (dirx, "%s", dirnm.c_str()); - TDirectory *dir = (TDirectory*)file->FindObjectAny(dirx); - if (debug) std::cout << "Directory " << dirx << " : " << dir << std::endl; + sprintf(dirx, "%s", dirnm.c_str()); + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirx); + if (debug) + std::cout << "Directory " << dirx << " : " << dir << std::endl; if (dir) { - for (int in=0; in<nhtype; ++in) { - for (int ih=0; ih<nhist; ++ih) { - char hname[100]; - int inh = in * nhist + ih; - sprintf(hname, "%s", name2[inh].c_str()); - TH2D* hist = (TH2D*)dir->FindObjectAny(hname); - if (debug) std::cout << "Hist " << hname << " : " << hist - << " Xtitle " << xtitl[inh] << " Ytitle " - << ytitl[inh] << std::endl; - if (hist != nullptr) { - char name[100], title[100]; - sprintf (name, "%s%s", hname, tag.c_str()); - TCanvas *pad = new TCanvas(name,name,500,500); - pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); - sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); - if (debug) std::cout << "Pad " << name << " : " << pad << "\n"; - hist->GetYaxis()->SetTitle(ytitl[inh].c_str()); - hist->GetXaxis()->SetTitle(xtitl[inh].c_str()); - hist->SetTitle(title); - hist->GetYaxis()->SetTitleOffset(1.2); - hist->Draw(); - pad->Update(); - TPaveStats* st1 = (TPaveStats*)hist->GetListOfFunctions()->FindObject("stats"); - if (st1 != NULL) { - st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); - st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); - } - pad->Modified(); pad->Update(); - if (save) { - sprintf (name, "c_%s.jpg", pad->GetName()); - pad->Print(name); - } - } - } + for (int in = 0; in < nhtype; ++in) { + for (int ih = 0; ih < nhist; ++ih) { + char hname[100]; + int inh = in * nhist + ih; + sprintf(hname, "%s", name2[inh].c_str()); + TH2D *hist = (TH2D *)dir->FindObjectAny(hname); + if (debug) + std::cout << "Hist " << hname << " : " << hist << " Xtitle " << xtitl[inh] << " Ytitle " << ytitl[inh] + << std::endl; + if (hist != nullptr) { + char name[100], title[100]; + sprintf(name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", name0[in].c_str(), dtype.c_str()); + if (debug) + std::cout << "Pad " << name << " : " << pad << "\n"; + hist->GetYaxis()->SetTitle(ytitl[inh].c_str()); + hist->GetXaxis()->SetTitle(xtitl[inh].c_str()); + hist->SetTitle(title); + hist->GetYaxis()->SetTitleOffset(1.2); + hist->Draw(); + pad->Update(); + TPaveStats *st1 = (TPaveStats *)hist->GetListOfFunctions()->FindObject("stats"); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } + } } } } } -void hgcalBHValidPlots(std::string fname="roots/hgcBHValidD83.root", - std::string tag="BHValidD83", - std::string dtype="#mu D83", - bool save=false, bool debug=false) { +void hgcalBHValidPlots(std::string fname = "roots/hgcBHValidD83.root", + std::string tag = "BHValidD83", + std::string dtype = "#mu D83", + bool save = false, + bool debug = false) { std::string dirnm = "hgcalBHAnalysis"; std::string name0 = "HGCal HE Scintillator"; int nhist = 9; - std::string name2[9] = {"SimHitEn1", "SimHitEn2", "SimHitLong", - "SimHitOccup", "SimHitOccu3", "SimHitTime", - "DigiLong", "DigiOccup", "DigiOccu3"}; - std::string xtitl[9] = {"SimHit Energy (GeV)", "SimHit Energy (GeV)", - "SimHit Layer #", "SimHit i#eta", "SimHit i#eta", - "Digi Layer #", "Digi i#eta", "Digi i#eta"}; - std::string ytitl[9] = {"Hits", "Hits", "Energy Sum (GeV)", "i#phi", - "Layer #", "Digi Sum", "i#phi", "Layer #"}; + std::string name2[9] = {"SimHitEn1", + "SimHitEn2", + "SimHitLong", + "SimHitOccup", + "SimHitOccu3", + "SimHitTime", + "DigiLong", + "DigiOccup", + "DigiOccu3"}; + std::string xtitl[9] = {"SimHit Energy (GeV)", + "SimHit Energy (GeV)", + "SimHit Layer #", + "SimHit i#eta", + "SimHit i#eta", + "Digi Layer #", + "Digi i#eta", + "Digi i#eta"}; + std::string ytitl[9] = {"Hits", "Hits", "Energy Sum (GeV)", "i#phi", "Layer #", "Digi Sum", "i#phi", "Layer #"}; double xmax[9] = {0.05, 0.20, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0}; int ihty[9] = {1, 1, 1, 2, 2, 1, 1, 2, 2}; int iaxty[9] = {1, 1, 0, 0, 0, 1, 0, 0, 0}; int ibin[10] = {0, 0, 0, 0, 0, 10, 0, 0, 0}; - gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); - gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); gStyle->SetOptStat(111110); - if (debug) - std::cout << "File " << fname << " Tags " << tag << " : " << dtype - << " Save " << save << "\n"; + if (debug) + std::cout << "File " << fname << " Tags " << tag << " : " << dtype << " Save " << save << "\n"; TFile *file = new TFile(fname.c_str()); if (file) { char dirx[100]; - sprintf (dirx, "%s", dirnm.c_str()); - TDirectory *dir = (TDirectory*)file->FindObjectAny(dirx); - if (debug) std::cout << "Directory " << dirx << " : " << dir << std::endl; + sprintf(dirx, "%s", dirnm.c_str()); + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirx); + if (debug) + std::cout << "Directory " << dirx << " : " << dir << std::endl; if (dir) { - for (int ih=0; ih<nhist; ++ih) { - char hname[100]; - sprintf(hname, "%s", name2[ih].c_str()); - TH1D* hist1(nullptr); - TH2D* hist2(nullptr); - if (ihty[ih] <= 1) - hist1 = (TH1D*)dir->FindObjectAny(hname); - else - hist2 = (TH2D*)dir->FindObjectAny(hname); - if (debug) std::cout << "Hist " << hname << " : " << hist1 << ":" - << hist2 << " Xtitle " << xtitl[ih] << " Ytitle " - << ytitl[ih] << " xmax " << xmax[ih] - << " iaxty " << iaxty[ih] << " ibin " - << ibin[ih] << std::endl; - if ((hist1 != nullptr) || (hist2 != nullptr)) { - char name[100], title[100]; - sprintf (name, "%s%s", hname, tag.c_str()); - TCanvas *pad = new TCanvas(name,name,500,500); - pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); - sprintf(title, "%s (%s)", name0.c_str(), dtype.c_str()); - if (debug) std::cout << "Pad " << name << " : " << pad << "\n"; - if (hist1 != nullptr) { - hist1->GetYaxis()->SetTitle(ytitl[ih].c_str()); - hist1->GetXaxis()->SetTitle(xtitl[ih].c_str()); - hist1->SetTitle(title); - if (xmax[ih] > 0) - hist1->GetXaxis()->SetRangeUser(0, xmax[ih]); - if (iaxty[ih] > 0) - pad->SetLogy(); - if (ibin[ih] > 0) - hist1->Rebin(ibin[ih]); - hist1->GetYaxis()->SetTitleOffset(1.2); - hist1->Draw(); - } else { - hist2->GetYaxis()->SetTitle(ytitl[ih].c_str()); - hist2->GetXaxis()->SetTitle(xtitl[ih].c_str()); - hist2->SetTitle(title); - hist2->GetYaxis()->SetTitleOffset(1.2); - hist2->Draw(); - } - pad->Update(); - TPaveStats* st1 = ((hist1 != nullptr) ? - ((TPaveStats*)hist1->GetListOfFunctions()->FindObject("stats")) : - ((TPaveStats*)hist2->GetListOfFunctions()->FindObject("stats"))); - if (st1 != NULL) { - st1->SetY1NDC(0.70); st1->SetY2NDC(0.90); - st1->SetX1NDC(0.65); st1->SetX2NDC(0.90); - } - pad->Modified(); pad->Update(); - if (save) { - sprintf (name, "c_%s.jpg", pad->GetName()); - pad->Print(name); - } - } + for (int ih = 0; ih < nhist; ++ih) { + char hname[100]; + sprintf(hname, "%s", name2[ih].c_str()); + TH1D *hist1(nullptr); + TH2D *hist2(nullptr); + if (ihty[ih] <= 1) + hist1 = (TH1D *)dir->FindObjectAny(hname); + else + hist2 = (TH2D *)dir->FindObjectAny(hname); + if (debug) + std::cout << "Hist " << hname << " : " << hist1 << ":" << hist2 << " Xtitle " << xtitl[ih] << " Ytitle " + << ytitl[ih] << " xmax " << xmax[ih] << " iaxty " << iaxty[ih] << " ibin " << ibin[ih] << std::endl; + if ((hist1 != nullptr) || (hist2 != nullptr)) { + char name[100], title[100]; + sprintf(name, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(name, name, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", name0.c_str(), dtype.c_str()); + if (debug) + std::cout << "Pad " << name << " : " << pad << "\n"; + if (hist1 != nullptr) { + hist1->GetYaxis()->SetTitle(ytitl[ih].c_str()); + hist1->GetXaxis()->SetTitle(xtitl[ih].c_str()); + hist1->SetTitle(title); + if (xmax[ih] > 0) + hist1->GetXaxis()->SetRangeUser(0, xmax[ih]); + if (iaxty[ih] > 0) + pad->SetLogy(); + if (ibin[ih] > 0) + hist1->Rebin(ibin[ih]); + hist1->GetYaxis()->SetTitleOffset(1.2); + hist1->Draw(); + } else { + hist2->GetYaxis()->SetTitle(ytitl[ih].c_str()); + hist2->GetXaxis()->SetTitle(xtitl[ih].c_str()); + hist2->SetTitle(title); + hist2->GetYaxis()->SetTitleOffset(1.2); + hist2->Draw(); + } + pad->Update(); + TPaveStats *st1 = ((hist1 != nullptr) ? ((TPaveStats *)hist1->GetListOfFunctions()->FindObject("stats")) + : ((TPaveStats *)hist2->GetListOfFunctions()->FindObject("stats"))); + if (st1 != NULL) { + st1->SetY1NDC(0.70); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.65); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(name, "c_%s.jpg", pad->GetName()); + pad->Print(name); + } + } } } } } -void ehcalPlots(std::string fname="ecalHitdd4hep.root", - std::string dirnm="EcalSimHitStudy", - std::string tag="DD4Hep", - int dets=2, bool save=false, bool debug=false) { +void ehcalPlots(std::string fname = "ecalHitdd4hep.root", + std::string dirnm = "EcalSimHitStudy", + std::string tag = "DD4Hep", + int dets = 2, + bool save = false, + bool debug = false) { const int nh = 2; std::string name[nh] = {"poszp", "poszn"}; - gStyle->SetCanvasBorderMode(0); gStyle->SetCanvasColor(kWhite); - gStyle->SetPadColor(kWhite); gStyle->SetFillColor(kWhite); + gStyle->SetCanvasBorderMode(0); + gStyle->SetCanvasColor(kWhite); + gStyle->SetPadColor(kWhite); + gStyle->SetFillColor(kWhite); gStyle->SetOptStat(10); - if (debug) - std::cout << "File " << fname << " Tag " << tag << " Detectors " << dets - << " Save " << save << "\n"; + if (debug) + std::cout << "File " << fname << " Tag " << tag << " Detectors " << dets << " Save " << save << "\n"; TFile *file = new TFile(fname.c_str()); if (file) { - TDirectory *dir = (TDirectory*)file->FindObjectAny(dirnm.c_str()); - if (debug) std::cout << "Directory " << dirnm << " : " << dir << std::endl; + TDirectory *dir = (TDirectory *)file->FindObjectAny(dirnm.c_str()); + if (debug) + std::cout << "Directory " << dirnm << " : " << dir << std::endl; if (dir) { - for (int id=0; id<dets; ++id) { - for (int ih=0; ih<nh; ++ih) { - char hname[100]; - sprintf(hname, "%s%d", name[ih].c_str(), id); - TH2D* hist = (TH2D*)(dir->FindObjectAny(hname)); - if (debug) std::cout << "Hist " << hname << " : " << hist << ":" - << hist->GetTitle() << " Xtitle " - << hist->GetXaxis()->GetTitle() << " Ytitle " - << hist->GetYaxis()->GetTitle() << std::endl; - if (hist != nullptr) { - char cname[100], title[100]; - sprintf (cname, "%s%s", hname, tag.c_str()); - TCanvas *pad = new TCanvas(cname, cname, 500, 500); - pad->SetRightMargin(0.10); pad->SetTopMargin(0.10); - sprintf(title, "%s (%s)", hist->GetTitle(), tag.c_str()); - if (debug) std::cout << "Pad " << cname << " : " << pad << "\n"; - hist->SetTitle(title); - hist->SetMarkerStyle(20); hist->SetMarkerSize(0.1); - hist->GetYaxis()->SetTitleOffset(1.3); - hist->Draw(); - pad->Update(); - TPaveStats* st1 = ((TPaveStats*)hist->GetListOfFunctions()->FindObject("stats")); - if (st1 != NULL) { - st1->SetY1NDC(0.85); st1->SetY2NDC(0.90); - st1->SetX1NDC(0.70); st1->SetX2NDC(0.90); - } - pad->Modified(); pad->Update(); - if (save) { - sprintf (cname, "c_%s.jpg", pad->GetName()); - pad->Print(cname); - } - } - } + for (int id = 0; id < dets; ++id) { + for (int ih = 0; ih < nh; ++ih) { + char hname[100]; + sprintf(hname, "%s%d", name[ih].c_str(), id); + TH2D *hist = (TH2D *)(dir->FindObjectAny(hname)); + if (debug) + std::cout << "Hist " << hname << " : " << hist << ":" << hist->GetTitle() << " Xtitle " + << hist->GetXaxis()->GetTitle() << " Ytitle " << hist->GetYaxis()->GetTitle() << std::endl; + if (hist != nullptr) { + char cname[100], title[100]; + sprintf(cname, "%s%s", hname, tag.c_str()); + TCanvas *pad = new TCanvas(cname, cname, 500, 500); + pad->SetRightMargin(0.10); + pad->SetTopMargin(0.10); + sprintf(title, "%s (%s)", hist->GetTitle(), tag.c_str()); + if (debug) + std::cout << "Pad " << cname << " : " << pad << "\n"; + hist->SetTitle(title); + hist->SetMarkerStyle(20); + hist->SetMarkerSize(0.1); + hist->GetYaxis()->SetTitleOffset(1.3); + hist->Draw(); + pad->Update(); + TPaveStats *st1 = ((TPaveStats *)hist->GetListOfFunctions()->FindObject("stats")); + if (st1 != NULL) { + st1->SetY1NDC(0.85); + st1->SetY2NDC(0.90); + st1->SetX1NDC(0.70); + st1->SetX2NDC(0.90); + } + pad->Modified(); + pad->Update(); + if (save) { + sprintf(cname, "c_%s.jpg", pad->GetName()); + pad->Print(cname); + } + } + } } } } @@ -471,123 +517,125 @@ void ehcalPlots(std::string fname="ecalHitdd4hep.root", class hgcHits { public: - TTree *fChain; - Int_t fCurrent; + TTree *fChain; + Int_t fCurrent; private: // Declaration of leaf types - std::vector<float> *heeRecX; - std::vector<float> *heeRecY; - std::vector<float> *heeRecZ; - std::vector<float> *heeRecEnergy; - std::vector<float> *hefRecX; - std::vector<float> *hefRecY; - std::vector<float> *hefRecZ; - std::vector<float> *hefRecEnergy; - std::vector<float> *hebRecX; - std::vector<float> *hebRecY; - std::vector<float> *hebRecZ; - std::vector<float> *hebRecEta; - std::vector<float> *hebRecPhi; - std::vector<float> *hebRecEnergy; - std::vector<float> *heeSimX; - std::vector<float> *heeSimY; - std::vector<float> *heeSimZ; - std::vector<float> *heeSimEnergy; - std::vector<float> *hefSimX; - std::vector<float> *hefSimY; - std::vector<float> *hefSimZ; - std::vector<float> *hefSimEnergy; - std::vector<float> *hebSimX; - std::vector<float> *hebSimY; - std::vector<float> *hebSimZ; - std::vector<float> *hebSimEta; - std::vector<float> *hebSimPhi; - std::vector<float> *hebSimEnergy; + std::vector<float> *heeRecX; + std::vector<float> *heeRecY; + std::vector<float> *heeRecZ; + std::vector<float> *heeRecEnergy; + std::vector<float> *hefRecX; + std::vector<float> *hefRecY; + std::vector<float> *hefRecZ; + std::vector<float> *hefRecEnergy; + std::vector<float> *hebRecX; + std::vector<float> *hebRecY; + std::vector<float> *hebRecZ; + std::vector<float> *hebRecEta; + std::vector<float> *hebRecPhi; + std::vector<float> *hebRecEnergy; + std::vector<float> *heeSimX; + std::vector<float> *heeSimY; + std::vector<float> *heeSimZ; + std::vector<float> *heeSimEnergy; + std::vector<float> *hefSimX; + std::vector<float> *hefSimY; + std::vector<float> *hefSimZ; + std::vector<float> *hefSimEnergy; + std::vector<float> *hebSimX; + std::vector<float> *hebSimY; + std::vector<float> *hebSimZ; + std::vector<float> *hebSimEta; + std::vector<float> *hebSimPhi; + std::vector<float> *hebSimEnergy; std::vector<unsigned int> *heeDetID; std::vector<unsigned int> *hefDetID; std::vector<unsigned int> *hebDetID; - + // List of branches - TBranch *b_heeRecX; - TBranch *b_heeRecY; - TBranch *b_heeRecZ; - TBranch *b_heeRecEnergy; - TBranch *b_hefRecX; - TBranch *b_hefRecY; - TBranch *b_hefRecZ; - TBranch *b_hefRecEnergy; - TBranch *b_hebRecX; - TBranch *b_hebRecY; - TBranch *b_hebRecZ; - TBranch *b_hebRecEta; - TBranch *b_hebRecPhi; - TBranch *b_hebRecEnergy; - TBranch *b_heeSimX; - TBranch *b_heeSimY; - TBranch *b_heeSimZ; - TBranch *b_heeSimEnergy; - TBranch *b_hefSimX; - TBranch *b_hefSimY; - TBranch *b_hefSimZ; - TBranch *b_hefSimEnergy; - TBranch *b_hebSimX; - TBranch *b_hebSimY; - TBranch *b_hebSimZ; - TBranch *b_hebSimEta; - TBranch *b_hebSimPhi; - TBranch *b_hebSimEnergy; - TBranch *b_heeDetID; - TBranch *b_hefDetID; - TBranch *b_hebDetID; + TBranch *b_heeRecX; + TBranch *b_heeRecY; + TBranch *b_heeRecZ; + TBranch *b_heeRecEnergy; + TBranch *b_hefRecX; + TBranch *b_hefRecY; + TBranch *b_hefRecZ; + TBranch *b_hefRecEnergy; + TBranch *b_hebRecX; + TBranch *b_hebRecY; + TBranch *b_hebRecZ; + TBranch *b_hebRecEta; + TBranch *b_hebRecPhi; + TBranch *b_hebRecEnergy; + TBranch *b_heeSimX; + TBranch *b_heeSimY; + TBranch *b_heeSimZ; + TBranch *b_heeSimEnergy; + TBranch *b_hefSimX; + TBranch *b_hefSimY; + TBranch *b_hefSimZ; + TBranch *b_hefSimEnergy; + TBranch *b_hebSimX; + TBranch *b_hebSimY; + TBranch *b_hebSimZ; + TBranch *b_hebSimEta; + TBranch *b_hebSimPhi; + TBranch *b_hebSimEnergy; + TBranch *b_heeDetID; + TBranch *b_hefDetID; + TBranch *b_hebDetID; public: - hgcHits(const char* infile); + hgcHits(const char *infile); virtual ~hgcHits(); - virtual Int_t Cut(Long64_t entry); - virtual Int_t GetEntry(Long64_t entry); + virtual Int_t Cut(Long64_t entry); + virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); - virtual void Init(TTree *tree); - virtual void Loop(); - virtual Bool_t Notify(); - virtual void Show(Long64_t entry = -1); - + virtual void Init(TTree *tree); + virtual void Loop(); + virtual Bool_t Notify(); + virtual void Show(Long64_t entry = -1); + void bookHistograms(); - void saveHistos(const char* outfile); + void saveHistos(const char *outfile); + private: }; - - - hgcHits:: - hgcHits::hgcHits(const char* infile) { - TFile *file = new TFile(infile); - TDirectory *dir = (TDirectory*)(file->FindObjectAny("hgcHitAnalysis")); - TTree *tree = (TTree*)(dir->FindObjectAny("hgcHits")); - std::cout << "Attaches tree hgcHits at " << tree << " in file " << infile - << std::endl; +hgcHits::hgcHits::hgcHits(const char *infile) { + TFile *file = new TFile(infile); + TDirectory *dir = (TDirectory *)(file->FindObjectAny("hgcHitAnalysis")); + TTree *tree = (TTree *)(dir->FindObjectAny("hgcHits")); + std::cout << "Attaches tree hgcHits at " << tree << " in file " << infile << std::endl; bookHistograms(); Init(tree); } - hgcHits::~hgcHits() { - if (!fChain) return; +hgcHits::~hgcHits() { + if (!fChain) + return; delete fChain->GetCurrentFile(); } Int_t hgcHits::GetEntry(Long64_t entry) { // Read contents of entry. - if (!fChain) return 0; + if (!fChain) + return 0; return fChain->GetEntry(entry); } Long64_t hgcHits::LoadTree(Long64_t entry) { // Set the environment to read one entry - if (!fChain) return -5; + if (!fChain) + return -5; Long64_t centry = fChain->LoadTree(entry); - if (centry < 0) return centry; - if (!fChain->InheritsFrom(TChain::Class())) return centry; - TChain *chain = (TChain*)fChain; + if (centry < 0) + return centry; + if (!fChain->InheritsFrom(TChain::Class())) + return centry; + TChain *chain = (TChain *)fChain; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); @@ -637,7 +685,8 @@ void hgcHits::Init(TTree *tree) { hefDetID = 0; hebDetID = 0; // Set branch addresses and branch pointers - if (!tree) return; + if (!tree) + return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); @@ -689,7 +738,8 @@ Bool_t hgcHits::Notify() { void hgcHits::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry - if (!fChain) return; + if (!fChain) + return; fChain->Show(entry); } @@ -724,22 +774,22 @@ void hgcHits::Loop() { // METHOD2: replace line // fChain->GetEntry(jentry); //read all branches //by b_branchname->GetEntry(ientry); //read only this branch - if (fChain == 0) return; + if (fChain == 0) + return; Long64_t nentries = fChain->GetEntriesFast(); Long64_t nbytes = 0, nb = 0; - for (Long64_t jentry=0; jentry<nentries;jentry++) { + for (Long64_t jentry = 0; jentry < nentries; jentry++) { Long64_t ientry = LoadTree(jentry); - if (ientry < 0) break; - nb = fChain->GetEntry(jentry); nbytes += nb; + if (ientry < 0) + break; + nb = fChain->GetEntry(jentry); + nbytes += nb; // if (Cut(ientry) < 0) continue; } } -void hgcHits::bookHistograms() { -} - -void hgcHits::saveHistos(const char*) { -} +void hgcHits::bookHistograms() {} +void hgcHits::saveHistos(const char *) {} From 757bb45be9306fb38f6cb8584899f99883aa85fc Mon Sep 17 00:00:00 2001 From: Justinas Rumsevicius <justinas.rumsevicius@gmail.com> Date: Wed, 5 May 2021 00:29:07 +0200 Subject: [PATCH 174/309] Fix incorrect variable name --- GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index 731e9cac64f89..f859f9dd6b9da 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -330,7 +330,7 @@ void ExternalLHEProducer::beginRun(edm::Run const& run, edm::EventSetup const& e // ------------ method called when ending the processing of a run ------------ void ExternalLHEProducer::endRun(edm::Run const& run, edm::EventSetup const& es) { nextEvent(); - if (partonLevel) { + if (partonLevel_) { // VALIDATION_RUN env variable allows to finish event processing early without errors by sending SIGINT if (getenv("VALIDATION_RUN") != NULL) { edm::LogWarning("ExternalLHEProducer") From a5022be9ae6b6295a0b03097b9a19f234a1d3c7a Mon Sep 17 00:00:00 2001 From: Qiang <qiang.li@cern.ch> Date: Wed, 5 May 2021 07:51:02 +0200 Subject: [PATCH 175/309] fix 33544 --- Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py b/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py index c2ff018b3a23b..46db99fa77df4 100644 --- a/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py +++ b/Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff.py @@ -6,6 +6,7 @@ from Configuration.Generator.Herwig7Settings.Herwig7LHECommonSettings_cfi import * from Configuration.Generator.Herwig7Settings.Herwig7LHEPowhegSettings_cfi import * +externalLHEProducer.generateConcurrently = cms.untracked.bool(False) generator = cms.EDFilter("Herwig7GeneratorFilter", herwig7CH3SettingsBlock, From a3b7827fca1963ec4bad6a955bd8f33f8ec92936 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov <mrodozov@cern.ch> Date: Wed, 5 May 2021 10:21:52 +0200 Subject: [PATCH 176/309] Initialize id variable to silence warning --- EventFilter/Utilities/src/FedRawDataInputSource.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/Utilities/src/FedRawDataInputSource.cc b/EventFilter/Utilities/src/FedRawDataInputSource.cc index a145898efb7c5..e39363529cbaa 100644 --- a/EventFilter/Utilities/src/FedRawDataInputSource.cc +++ b/EventFilter/Utilities/src/FedRawDataInputSource.cc @@ -1178,7 +1178,7 @@ void FedRawDataInputSource::readSupervisor() { //make sure threads finish reading unsigned numFinishedThreads = 0; while (numFinishedThreads < workerThreads_.size()) { - unsigned int tid; + unsigned tid = 0; while (!workerPool_.try_pop(tid)) { usleep(10000); } From cf9d35f705bc079440b4deea49015dae0501eddd Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Wed, 5 May 2021 10:31:03 +0200 Subject: [PATCH 177/309] fix calo tower input collection --- .../python/pfClustersFromCombinedCalo_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py index 1e3c3f2bc8612..15cbb2308957f 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/pfClustersFromCombinedCalo_cfi.py @@ -6,7 +6,7 @@ hcalDigis = cms.VInputTag(cms.InputTag('simHcalTriggerPrimitiveDigis')), hcalDigisBarrel = cms.bool(False), hcalDigisHF = cms.bool(True), - phase2barrelCaloTowers = cms.VInputTag(cms.InputTag("L1EGammaClusterEmuProducer",)), + phase2barrelCaloTowers = cms.VInputTag(cms.InputTag("L1EGammaClusterEmuProducer","L1CaloTowerCollection","")), hcalHGCTowers = cms.VInputTag(cms.InputTag("hgcalTowerProducer:HGCalTowerProcessor") ), hcalHGCTowersHadOnly = cms.bool(False), # take also EM part from towers emCorrector = cms.string(""), # no need to correct further From 28681fd5811460d674893c92246d9ecbc8de9bb3 Mon Sep 17 00:00:00 2001 From: Justinas Rumsevicius <justinas.rumsevicius@gmail.com> Date: Wed, 5 May 2021 10:53:42 +0200 Subject: [PATCH 178/309] Applied code checks patch --- .../LHEInterface/plugins/ExternalLHEProducer.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index f859f9dd6b9da..57923bf5e49a1 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -17,22 +17,22 @@ Description: [one line class summary] // // system include files +#include "tbb/task_arena.h" +#include "tbb/task_group.h" #include <cstdio> +#include <cstdlib> #include <dirent.h> #include <fcntl.h> #include <filesystem> #include <fstream> #include <memory> #include <string> +#include <sys/resource.h> +#include <sys/time.h> +#include <sys/wait.h> #include <system_error> #include <unistd.h> #include <vector> -#include <sys/wait.h> -#include <sys/time.h> -#include <sys/resource.h> -#include "tbb/task_arena.h" -#include "tbb/task_group.h" -#include <stdlib.h> #include "boost/ptr_container/ptr_deque.hpp" @@ -332,7 +332,7 @@ void ExternalLHEProducer::endRun(edm::Run const& run, edm::EventSetup const& es) nextEvent(); if (partonLevel_) { // VALIDATION_RUN env variable allows to finish event processing early without errors by sending SIGINT - if (getenv("VALIDATION_RUN") != NULL) { + if (getenv("VALIDATION_RUN") != nullptr) { edm::LogWarning("ExternalLHEProducer") << "Event loop is over, but there are still lhe events to process, ignoring..."; } else { From 2d1ca7317ea151b8ace25ac9b363a85dc35b9229 Mon Sep 17 00:00:00 2001 From: Vladimir <Vladimir.Ivantchenko@cern.ch> Date: Wed, 5 May 2021 12:17:25 +0200 Subject: [PATCH 179/309] updated physics configurations --- .../interface/CMSHadronPhysicsFTFP_BERT.h | 3 +- .../PhysicsLists/plugins/FTFPCMS_BERT.cc | 24 +++------ .../PhysicsLists/plugins/FTFPCMS_BERT_EML.cc | 21 ++------ .../PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc | 25 ++------- .../plugins/FTFPCMS_BERT_EMM_TRK.cc | 52 ++++++------------- .../PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc | 21 ++------ .../PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc | 27 +++------- .../PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc | 25 +++------ .../PhysicsLists/src/CMSEmStandardPhysics.cc | 2 +- .../src/CMSHadronPhysicsFTFP_BERT.cc | 6 ++- 10 files changed, 53 insertions(+), 153 deletions(-) diff --git a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h index 68bc7d70abd3c..debf462c2253c 100644 --- a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h +++ b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h @@ -23,7 +23,8 @@ class CMSHadronPhysicsFTFP_BERT : public G4HadronPhysicsFTFP_BERT { public: explicit CMSHadronPhysicsFTFP_BERT(G4int verb); - explicit CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3); + explicit CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3, + G4double e4, G4double e5); ~CMSHadronPhysicsFTFP_BERT() override; void ConstructProcess() override; diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc index 93ada83904c43..5f978bbd4f58e 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc @@ -8,23 +8,19 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT::FTFPCMS_BERT(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter<int>("Verbosity", 0); bool emPhys = p.getUntrackedParameter<bool>("EMPhysics", true); bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true); - bool tracking = p.getParameter<bool>("TrackingCut"); - double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter<double>("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; - edm::LogInfo("PhysicsList") << "You are using the simulation engine: FTFP_BERT \n Flags for EM Physics " << emPhys - << ", for Hadronic Physics " << hadPhys << " and tracking cut " << tracking - << " t(ns)= " << timeLimit / CLHEP::ns << "\n transition energy Bertini/FTFP from " - << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV - << " GeV"; + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT: " + << "\n Flags for EM Physics: " << emPhys + << "; Hadronic Physics: " << hadPhys + << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " + << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics @@ -39,25 +35,17 @@ FTFPCMS_BERT::FTFPCMS_BERT(const edm::ParameterSet& p) : PhysicsList(p) { RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc index 11aad9d53634b..2e7f21ba28317 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc @@ -7,22 +7,18 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" #include "G4EmStandardPhysics_option1.hh" FTFPCMS_BERT_EML::FTFPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter<int>("Verbosity", 0); bool emPhys = p.getUntrackedParameter<bool>("EMPhysics", true); bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true); - bool tracking = p.getParameter<bool>("TrackingCut"); - double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter<double>("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EML: \n Flags for EM Physics: " - << emPhys << "; Hadronic Physics: " << hadPhys << "; tracking cut: " << tracking - << "; time limit(ns)= " << timeLimit / CLHEP::ns + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EML: " + << "\n Flags for EM Physics: " << emPhys + << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; @@ -39,25 +35,16 @@ FTFPCMS_BERT_EML::FTFPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc index 22d99bcd6afce..c96a4f583c6ff 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc @@ -1,8 +1,6 @@ #include "FTFPCMS_BERT_EMM.h" #include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysics.h" -#include "SimG4Core/PhysicsLists/interface/CMSEmStandardPhysicsLPM.h" #include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h" -#include "SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT106.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "G4DecayPhysics.hh" @@ -10,27 +8,23 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter<int>("Verbosity", 0); bool emPhys = p.getUntrackedParameter<bool>("EMPhysics", true); bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true); - bool tracking = p.getParameter<bool>("TrackingCut"); - double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter<double>("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMM: \n Flags for EM Physics: " - << emPhys << "; Hadronic Physics: " << hadPhys << "; tracking cut: " << tracking - << "; time limit(ns)= " << timeLimit / CLHEP::ns + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMM: " + << "\n Flags for EM Physics: " << emPhys + << "; Hadronic Physics: " << hadPhys << "\n Transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << "; for pions to " << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics - RegisterPhysics(new CMSEmStandardPhysicsLPM(ver)); + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); @@ -41,25 +35,16 @@ FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT106(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc index 488d1fd53e8ba..430e9afc06e4c 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc @@ -8,51 +8,29 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMM_TRK::FTFPCMS_BERT_EMM_TRK(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter<int>("Verbosity", 0); - bool emPhys = p.getUntrackedParameter<bool>("EMPhysics", true); - bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true); - bool tracking = p.getParameter<bool>("TrackingCut"); - double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns; - edm::LogInfo("PhysicsList") << "You are using the simulation engine: " - << "FTFP_BERT_EMM_TRK \n Flags for EM Physics " << emPhys << ", for Hadronic Physics " - << hadPhys << " and tracking cut " << tracking << " t(ns)= " << timeLimit / CLHEP::ns; - - if (emPhys) { - // EM Physics - RegisterPhysics(new CMSEmStandardPhysics(ver, p)); - - // Synchroton Radiation & GN Physics - G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); - RegisterPhysics(gn); - } + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMM_TRK"; - // Decays - this->RegisterPhysics(new G4DecayPhysics(ver)); + // EM physics + RegisterPhysics(new CMSEmStandardPhysics(ver, p)); - if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); + // gamma and lepto-nuclear physics + RegisterPhysics(new G4EmExtraPhysics(ver)); - // Hadron Elastic scattering - RegisterPhysics(new G4HadronElasticPhysics(ver)); + // Decays + RegisterPhysics(new G4DecayPhysics(ver)); - // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(ver)); + // Hadron elastic scattering + RegisterPhysics(new G4HadronElasticPhysics(ver)); - // Stopping Physics - RegisterPhysics(new G4StoppingPhysics(ver)); + // Hadron inelastic physics + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(3*CLHEP::GeV, 6*CLHEP::GeV, 12*CLHEP::GeV, 2*CLHEP::GeV, 4*CLHEP::GeV)); - // Ion Physics - RegisterPhysics(new G4IonPhysics(ver)); + // Stopping physics + RegisterPhysics(new G4StoppingPhysics(ver)); - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } - } + // Ion physics + RegisterPhysics(new G4IonPhysics(ver)); } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc index 1cf4cb0e6b1ab..97e81d5c12e9c 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc @@ -8,21 +8,17 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMN::FTFPCMS_BERT_EMN(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter<int>("Verbosity", 0); bool emPhys = p.getUntrackedParameter<bool>("EMPhysics", true); bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true); - bool tracking = p.getParameter<bool>("TrackingCut"); - double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter<double>("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMN: \n Flags for EM Physics: " - << emPhys << "; Hadronic Physics: " << hadPhys << "; tracking cut: " << tracking - << "; time limit(ns)= " << timeLimit / CLHEP::ns + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMN: " + << "\n Flags for EM Physics: " << emPhys + << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; @@ -39,25 +35,16 @@ FTFPCMS_BERT_EMN::FTFPCMS_BERT_EMN(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc index ea0c4e7f0edbb..ae3771f26fa50 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc @@ -8,29 +8,23 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" -#include "G4EmParameters.hh" FTFPCMS_BERT_EMY::FTFPCMS_BERT_EMY(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter<int>("Verbosity", 0); bool emPhys = p.getUntrackedParameter<bool>("EMPhysics", true); bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true); - bool tracking = p.getParameter<bool>("TrackingCut"); - double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter<double>("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMY \n Flags for EM Physics " - << emPhys << ", for Hadronic Physics " << hadPhys << " and tracking cut " << tracking - << " t(ns)= " << timeLimit / CLHEP::ns << "\n transition energy Bertini/FTFP from " - << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" - << maxBERTpi / CLHEP::GeV << " GeV"; + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMY: " + << "\n Flags for EM Physics: " << emPhys + << "; Hadronic Physics: " << hadPhys + << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " + << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics RegisterPhysics(new G4EmStandardPhysics_option3(ver)); - G4EmParameters::Instance()->SetMscStepLimitType(fUseSafetyPlus); // Synchroton Radiation & GN Physics G4EmExtraPhysics* gn = new G4EmExtraPhysics(ver); @@ -41,25 +35,16 @@ FTFPCMS_BERT_EMY::FTFPCMS_BERT_EMY(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc index c0b4b8ea65071..eb4ee53199143 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc @@ -8,23 +8,19 @@ #include "G4IonPhysics.hh" #include "G4StoppingPhysics.hh" #include "G4HadronElasticPhysics.hh" -#include "G4NeutronTrackingCut.hh" -#include "G4HadronicProcessStore.hh" FTFPCMS_BERT_EMZ::FTFPCMS_BERT_EMZ(const edm::ParameterSet& p) : PhysicsList(p) { int ver = p.getUntrackedParameter<int>("Verbosity", 0); bool emPhys = p.getUntrackedParameter<bool>("EMPhysics", true); bool hadPhys = p.getUntrackedParameter<bool>("HadPhysics", true); - bool tracking = p.getParameter<bool>("TrackingCut"); - double timeLimit = p.getParameter<double>("MaxTrackTime") * CLHEP::ns; double minFTFP = p.getParameter<double>("EminFTFP") * CLHEP::GeV; double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; - edm::LogVerbatim("PhysicsList") << "You are using the simulation engine: FTFP_BERT_EMZ \n Flags for EM Physics " - << emPhys << ", for Hadronic Physics " << hadPhys << " and tracking cut " << tracking - << " t(ns)= " << timeLimit / CLHEP::ns << "\n transition energy Bertini/FTFP from " - << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" - << maxBERTpi / CLHEP::GeV << " GeV"; + edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMZ: " + << "\n Flags for EM Physics: " << emPhys + << "; Hadronic Physics: " << hadPhys + << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " + << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; if (emPhys) { // EM Physics @@ -39,25 +35,16 @@ FTFPCMS_BERT_EMZ::FTFPCMS_BERT_EMZ(const edm::ParameterSet& p) : PhysicsList(p) this->RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - G4HadronicProcessStore::Instance()->SetVerbose(ver); - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron Physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi)); + RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(minFTFP, maxBERT, maxBERTpi, minFTFP, maxBERT)); // Stopping Physics RegisterPhysics(new G4StoppingPhysics(ver)); // Ion Physics RegisterPhysics(new G4IonPhysics(ver)); - - // Neutron tracking cut - if (tracking) { - G4NeutronTrackingCut* ncut = new G4NeutronTrackingCut(ver); - ncut->SetTimeLimit(timeLimit); - RegisterPhysics(ncut); - } } } diff --git a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc index 7f68c96f3a63a..05badb037ddee 100644 --- a/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc +++ b/SimG4Core/PhysicsLists/src/CMSEmStandardPhysics.cc @@ -51,6 +51,7 @@ CMSEmStandardPhysics::CMSEmStandardPhysics(G4int ver, const edm::ParameterSet& p param->SetStepFunction(0.8, 1 * CLHEP::mm); param->SetMscRangeFactor(0.2); param->SetMscStepLimitType(fMinimal); + param->SetFluo(false); SetPhysicsType(bElectromagnetic); fRangeFactor = p.getParameter<double>("G4MscRangeFactor"); fGeomFactor = p.getParameter<double>("G4MscGeomFactor"); @@ -99,7 +100,6 @@ void CMSEmStandardPhysics::ConstructProcess() { G4ParticleDefinition* particle = G4Gamma::Gamma(); G4PhotoElectricEffect* pee = new G4PhotoElectricEffect(); - pee->SetEmModel(new G4LivermorePhotoElectricModel()); if (G4EmParameters::Instance()->GeneralProcessActive()) { G4GammaGeneralProcess* sp = new G4GammaGeneralProcess(); diff --git a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc index 5c098b3c7c108..1c5e6a4f0f65c 100644 --- a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc +++ b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc @@ -4,14 +4,16 @@ #include "G4Threading.hh" CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4int) - : CMSHadronPhysicsFTFP_BERT(3. * CLHEP::GeV, 6. * CLHEP::GeV, 12 * CLHEP::GeV) {} + : CMSHadronPhysicsFTFP_BERT(3*CLHEP::GeV, 6*CLHEP::GeV, 12*CLHEP::GeV, 3*CLHEP::GeV, 6*CLHEP::GeV) {} -CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3) +CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3, G4double e4, G4double e5) : G4HadronPhysicsFTFP_BERT("hInelastic FTFP_BERT", false) { minFTFP_pion = e1; maxBERT_pion = e3; minFTFP_kaon = e1; maxBERT_kaon = e2; + minFTFP_kaon = e4; + maxBERT_kaon = e5; minFTFP_proton = e1; maxBERT_proton = e2; minFTFP_neutron = e1; From 4f20eb7bb1295372736a6762cf217789d0a97dbb Mon Sep 17 00:00:00 2001 From: Vladimir <Vladimir.Ivantchenko@cern.ch> Date: Wed, 5 May 2021 12:35:09 +0200 Subject: [PATCH 180/309] code format --- SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h | 3 +-- SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc | 4 +--- SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc | 3 +-- SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc | 3 +-- SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc | 3 ++- SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc | 3 +-- SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc | 3 +-- SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc | 3 +-- SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc | 2 +- 9 files changed, 10 insertions(+), 17 deletions(-) diff --git a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h index debf462c2253c..f2ff65f159b0a 100644 --- a/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h +++ b/SimG4Core/PhysicsLists/interface/CMSHadronPhysicsFTFP_BERT.h @@ -23,8 +23,7 @@ class CMSHadronPhysicsFTFP_BERT : public G4HadronPhysicsFTFP_BERT { public: explicit CMSHadronPhysicsFTFP_BERT(G4int verb); - explicit CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3, - G4double e4, G4double e5); + explicit CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3, G4double e4, G4double e5); ~CMSHadronPhysicsFTFP_BERT() override; void ConstructProcess() override; diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc index 5f978bbd4f58e..4f368bed9fd82 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT.cc @@ -17,8 +17,7 @@ FTFPCMS_BERT::FTFPCMS_BERT(const edm::ParameterSet& p) : PhysicsList(p) { double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT: " - << "\n Flags for EM Physics: " << emPhys - << "; Hadronic Physics: " << hadPhys + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; @@ -35,7 +34,6 @@ FTFPCMS_BERT::FTFPCMS_BERT(const edm::ParameterSet& p) : PhysicsList(p) { RegisterPhysics(new G4DecayPhysics(ver)); if (hadPhys) { - // Hadron Elastic scattering RegisterPhysics(new G4HadronElasticPhysics(ver)); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc index 2e7f21ba28317..9ff708e9a137e 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EML.cc @@ -17,8 +17,7 @@ FTFPCMS_BERT_EML::FTFPCMS_BERT_EML(const edm::ParameterSet& p) : PhysicsList(p) double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EML: " - << "\n Flags for EM Physics: " << emPhys - << "; Hadronic Physics: " << hadPhys + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc index c96a4f583c6ff..69d8bd29e1c31 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM.cc @@ -17,8 +17,7 @@ FTFPCMS_BERT_EMM::FTFPCMS_BERT_EMM(const edm::ParameterSet& p) : PhysicsList(p) double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMM: " - << "\n Flags for EM Physics: " << emPhys - << "; Hadronic Physics: " << hadPhys + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n Transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << "; for pions to " << maxBERTpi / CLHEP::GeV << " GeV"; diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc index 430e9afc06e4c..ebd722c2f8f3a 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMM_TRK.cc @@ -26,7 +26,8 @@ FTFPCMS_BERT_EMM_TRK::FTFPCMS_BERT_EMM_TRK(const edm::ParameterSet& p) : Physics RegisterPhysics(new G4HadronElasticPhysics(ver)); // Hadron inelastic physics - RegisterPhysics(new CMSHadronPhysicsFTFP_BERT(3*CLHEP::GeV, 6*CLHEP::GeV, 12*CLHEP::GeV, 2*CLHEP::GeV, 4*CLHEP::GeV)); + RegisterPhysics( + new CMSHadronPhysicsFTFP_BERT(3 * CLHEP::GeV, 6 * CLHEP::GeV, 12 * CLHEP::GeV, 2 * CLHEP::GeV, 4 * CLHEP::GeV)); // Stopping physics RegisterPhysics(new G4StoppingPhysics(ver)); diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc index 97e81d5c12e9c..8169310af657c 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMN.cc @@ -17,8 +17,7 @@ FTFPCMS_BERT_EMN::FTFPCMS_BERT_EMN(const edm::ParameterSet& p) : PhysicsList(p) double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMN: " - << "\n Flags for EM Physics: " << emPhys - << "; Hadronic Physics: " << hadPhys + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc index ae3771f26fa50..6b52097af8182 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMY.cc @@ -17,8 +17,7 @@ FTFPCMS_BERT_EMY::FTFPCMS_BERT_EMY(const edm::ParameterSet& p) : PhysicsList(p) double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMY: " - << "\n Flags for EM Physics: " << emPhys - << "; Hadronic Physics: " << hadPhys + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; diff --git a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc index eb4ee53199143..11cd87308430d 100644 --- a/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc +++ b/SimG4Core/PhysicsLists/plugins/FTFPCMS_BERT_EMZ.cc @@ -17,8 +17,7 @@ FTFPCMS_BERT_EMZ::FTFPCMS_BERT_EMZ(const edm::ParameterSet& p) : PhysicsList(p) double maxBERT = p.getParameter<double>("EmaxBERT") * CLHEP::GeV; double maxBERTpi = p.getParameter<double>("EmaxBERTpi") * CLHEP::GeV; edm::LogVerbatim("PhysicsList") << "CMS Physics List FTFP_BERT_EMZ: " - << "\n Flags for EM Physics: " << emPhys - << "; Hadronic Physics: " << hadPhys + << "\n Flags for EM Physics: " << emPhys << "; Hadronic Physics: " << hadPhys << "\n transition energy Bertini/FTFP from " << minFTFP / CLHEP::GeV << " to " << maxBERT / CLHEP::GeV << ":" << maxBERTpi / CLHEP::GeV << " GeV"; diff --git a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc index 1c5e6a4f0f65c..b4fb560e0f204 100644 --- a/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc +++ b/SimG4Core/PhysicsLists/src/CMSHadronPhysicsFTFP_BERT.cc @@ -4,7 +4,7 @@ #include "G4Threading.hh" CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4int) - : CMSHadronPhysicsFTFP_BERT(3*CLHEP::GeV, 6*CLHEP::GeV, 12*CLHEP::GeV, 3*CLHEP::GeV, 6*CLHEP::GeV) {} + : CMSHadronPhysicsFTFP_BERT(3 * CLHEP::GeV, 6 * CLHEP::GeV, 12 * CLHEP::GeV, 3 * CLHEP::GeV, 6 * CLHEP::GeV) {} CMSHadronPhysicsFTFP_BERT::CMSHadronPhysicsFTFP_BERT(G4double e1, G4double e2, G4double e3, G4double e4, G4double e5) : G4HadronPhysicsFTFP_BERT("hInelastic FTFP_BERT", false) { From 61b162fddb4250371dcf6863a03ad5a6d0ffbc6e Mon Sep 17 00:00:00 2001 From: Pieter David <pieter.david@cern.ch> Date: Wed, 5 May 2021 13:23:28 +0200 Subject: [PATCH 181/309] Fix compilation warning --- .../SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc index 8d3495492e85c..5fd45144ce72c 100644 --- a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc +++ b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc @@ -304,7 +304,7 @@ void SiStripHitEffFromCalibTree::algoAnalyze(const edm::Event& e, const edm::Eve cout << "A module is bad if efficiency < the avg in layer - " << threshold << " and has at least " << nModsMin << " nModsMin." << endl; - unsigned int run, evt, bx; + unsigned int run, evt, bx{0}; double instLumi, PU; //Open the ROOT Calib Tree From f3e5e16ceef8957e39a0f21073838ada84cb3082 Mon Sep 17 00:00:00 2001 From: Felice <felice.pantaleo@cern.ch> Date: Fri, 30 Apr 2021 16:17:26 +0200 Subject: [PATCH 182/309] Use caloparticles when boundary crossed, otherwise use simclusters. --- .../TrackstersFromSimClustersProducer.cc | 92 +++++++++++++++---- 1 file changed, 72 insertions(+), 20 deletions(-) diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc index 3b0a75ee1a283..92746d5d9e61c 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -19,6 +19,9 @@ #include "DataFormats/Common/interface/ValueMap.h" #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h" +#include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h" + +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" #include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" @@ -72,9 +75,12 @@ class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { const edm::EDGetTokenT<std::vector<float>> filtered_layerclusters_mask_token_; edm::EDGetTokenT<std::vector<SimCluster>> simclusters_token_; + edm::EDGetTokenT<std::vector<CaloParticle>> caloparticles_token_; edm::InputTag associatorLayerClusterSimCluster_; - edm::EDGetTokenT<hgcal::SimToRecoCollectionWithSimClusters> associatorMapSimToReco_token_; + edm::EDGetTokenT<hgcal::SimToRecoCollectionWithSimClusters> associatorMapSimClusterToReco_token_; + edm::InputTag associatorLayerClusterCaloParticle_; + edm::EDGetTokenT<hgcal::SimToRecoCollection> associatorMapCaloParticleToReco_token_; edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geom_token_; hgcal::RecHitTools rhtools_; }; @@ -88,9 +94,13 @@ TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer(const edm:: consumes<edm::ValueMap<std::pair<float, float>>>(ps.getParameter<edm::InputTag>("time_layerclusters"))), filtered_layerclusters_mask_token_(consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("filtered_mask"))), simclusters_token_(consumes<std::vector<SimCluster>>(ps.getParameter<edm::InputTag>("simclusters"))), + caloparticles_token_(consumes<std::vector<CaloParticle>>(ps.getParameter<edm::InputTag>("caloparticles"))), associatorLayerClusterSimCluster_(ps.getUntrackedParameter<edm::InputTag>("layerClusterSimClusterAssociator")), - associatorMapSimToReco_token_( + associatorMapSimClusterToReco_token_( consumes<hgcal::SimToRecoCollectionWithSimClusters>(associatorLayerClusterSimCluster_)), + associatorLayerClusterCaloParticle_( + ps.getUntrackedParameter<edm::InputTag>("layerClusterCaloParticleAssociator")), + associatorMapCaloParticleToReco_token_(consumes<hgcal::SimToRecoCollection>(associatorLayerClusterCaloParticle_)), geom_token_(esConsumes()) { produces<std::vector<Trackster>>(); produces<std::vector<float>>(); @@ -104,8 +114,11 @@ void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescr desc.add<edm::InputTag>("time_layerclusters", edm::InputTag("hgcalLayerClusters", "timeLayerCluster")); desc.add<edm::InputTag>("filtered_mask", edm::InputTag("filteredLayerClustersSimTracksters", "ticlSimTracksters")); desc.add<edm::InputTag>("simclusters", edm::InputTag("mix", "MergedCaloTruth")); + desc.add<edm::InputTag>("caloparticles", edm::InputTag("mix", "MergedCaloTruth")); desc.addUntracked<edm::InputTag>("layerClusterSimClusterAssociator", edm::InputTag("layerClusterSimClusterAssociationProducer")); + desc.addUntracked<edm::InputTag>("layerClusterCaloParticleAssociator", + edm::InputTag("layerClusterCaloParticleAssociationProducer")); descriptions.add("trackstersFromSimClustersProducer", desc); } @@ -118,34 +131,73 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even output_mask->resize(layerClusters.size(), 1.f); const auto& simclusters = evt.get(simclusters_token_); - const auto& simToRecoColl = evt.get(associatorMapSimToReco_token_); + const auto& caloparticles = evt.get(caloparticles_token_); + + const auto& simClustersToRecoColl = evt.get(associatorMapSimClusterToReco_token_); + const auto& caloParticlesToRecoColl = evt.get(associatorMapCaloParticleToReco_token_); const auto& geom = es.getData(geom_token_); rhtools_.setGeometry(geom); auto num_simclusters = simclusters.size(); result->reserve(num_simclusters); - for (const auto& [key, values] : simToRecoColl) { - auto const& sc = *(key); - auto simClusterIndex = &sc - &simclusters[0]; - Trackster tmpTrackster; - tmpTrackster.zeroProbabilities(); - tmpTrackster.vertices().reserve(values.size()); - tmpTrackster.vertex_multiplicity().reserve(values.size()); - - for (auto const& [lc, energyScorePair] : values) { - if (inputClusterMask[lc.index()] > 0) { - tmpTrackster.vertices().push_back(lc.index()); - double fraction = energyScorePair.first / lc->energy(); - (*output_mask)[lc.index()] -= fraction; - tmpTrackster.vertex_multiplicity().push_back(static_cast<uint8_t>(std::clamp(1. / fraction, 0., 255.))); + + for (const auto& [key, values] : caloParticlesToRecoColl) { + auto const& cp = *(key); + auto cpIndex = &cp - &caloparticles[0]; + if (cp.g4Tracks()[0].crossedBoundary()) { + if (values.empty()) + continue; + Trackster tmpTrackster; + tmpTrackster.zeroProbabilities(); + tmpTrackster.vertices().reserve(values.size()); + tmpTrackster.vertex_multiplicity().reserve(values.size()); + for (auto const& [lc, energyScorePair] : values) { + if (inputClusterMask[lc.index()] > 0) { + tmpTrackster.vertices().push_back(lc.index()); + double fraction = energyScorePair.first / lc->energy(); + (*output_mask)[lc.index()] -= fraction; + tmpTrackster.vertex_multiplicity().push_back(static_cast<uint8_t>(std::clamp(1. / fraction, 1., 255.))); + } + } + tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(cp.pdgId(), cp.charge()), 1.f); + + tmpTrackster.setSeed(key.id(), cpIndex); + result->emplace_back(tmpTrackster); + } else { + for (const auto& scRef : cp.simClusters()) { + const auto& it = simClustersToRecoColl.find(scRef); + if (it == simClustersToRecoColl.end()) + continue; + const auto& lcVec = it->val; + if (lcVec.empty()) + continue; + auto const& sc = *(scRef); + auto simClusterIndex = &sc - &simclusters[0]; + Trackster tmpTrackster; + + tmpTrackster.zeroProbabilities(); + tmpTrackster.vertices().reserve(lcVec.size()); + tmpTrackster.vertex_multiplicity().reserve(lcVec.size()); + + for (auto const& [lc, energyScorePair] : lcVec) { + if (inputClusterMask[lc.index()] > 0) { + tmpTrackster.vertices().push_back(lc.index()); + double fraction = energyScorePair.first / lc->energy(); + (*output_mask)[lc.index()] -= fraction; + tmpTrackster.vertex_multiplicity().push_back(static_cast<uint8_t>(std::clamp(1. / fraction, 1., 255.))); + } + } + tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f); + tmpTrackster.setSeed(scRef.id(), simClusterIndex); + result->emplace_back(tmpTrackster); } } - tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f); - tmpTrackster.setSeed(key.id(), simClusterIndex); - result->emplace_back(tmpTrackster); } + ticl::assignPCAtoTracksters( *result, layerClusters, layerClustersTimes, rhtools_.getPositionLayer(rhtools_.lastLayerEE(doNose_)).z()); + result->shrink_to_fit(); + evt.put(std::move(result)); evt.put(std::move(output_mask)); } From 821ee25f826485616cd5fd2ece4537984406364b Mon Sep 17 00:00:00 2001 From: Marino Missiroli <marino.missiroli@cern.ch> Date: Wed, 5 May 2021 14:46:23 +0200 Subject: [PATCH 183/309] avoiding trailing whitespaces in config dump --- FWCore/ParameterSet/python/Mixins.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/FWCore/ParameterSet/python/Mixins.py b/FWCore/ParameterSet/python/Mixins.py index f754e54a61a7e..fa7913a9deeeb 100644 --- a/FWCore/ParameterSet/python/Mixins.py +++ b/FWCore/ParameterSet/python/Mixins.py @@ -671,9 +671,10 @@ def dumpPython(self, options=PrintOptions()): if i == 0: if n>nPerLine: result += '\n'+options.indentation() else: - result += ', ' if i % nPerLine == 0: - result += '\n'+options.indentation() + result += ',\n'+options.indentation() + else: + result += ', ' result += self.pythonValueForItem(v,options) if n>nPerLine: options.unindent() From 29bdf6f1f4ea9e47faa6a7279b8ef26b2c4d3e66 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Wed, 5 May 2021 15:14:15 +0200 Subject: [PATCH 184/309] fixing ESHandle --- .../L1EGammaCrystalsEmulatorProducer.cc | 27 +++++++++++-------- .../plugins/L1TowerCalibrator.cc | 7 ++--- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc index a95aab4782951..3bc04352fe1b4 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc @@ -240,14 +240,14 @@ class L1EGCrystalClusterEmulatorProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT<EcalEBTrigPrimDigiCollection> ecalTPEBToken_; edm::EDGetTokenT<edm::SortedCollection<HcalTriggerPrimitiveDigi> > hcalTPToken_; - edm::ESHandle<CaloTPGTranscoder> decoder_; + edm::ESGetToken<CaloTPGTranscoder, CaloTPGRecord> decoderTag_; l1tp2::ParametricCalibration calib_; - edm::ESHandle<CaloGeometry> caloGeometry_; + edm::ESGetToken<CaloGeometry,CaloGeometryRecord> caloGeometryTag_; const CaloSubdetectorGeometry* ebGeometry; const CaloSubdetectorGeometry* hbGeometry; - edm::ESHandle<HcalTopology> hbTopology; + edm::ESGetToken<HcalTopology,HcalRecNumberingRecord> hbTopologyTag_; const HcalTopology* hcTopology_; struct mycluster { @@ -341,7 +341,11 @@ L1EGCrystalClusterEmulatorProducer::L1EGCrystalClusterEmulatorProducer(const edm : ecalTPEBToken_(consumes<EcalEBTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("ecalTPEB"))), hcalTPToken_( consumes<edm::SortedCollection<HcalTriggerPrimitiveDigi> >(iConfig.getParameter<edm::InputTag>("hcalTP"))), - calib_(iConfig.getParameter<edm::ParameterSet>("calib")) { + decoderTag_(esConsumes<CaloTPGTranscoder, CaloTPGRecord>(edm::ESInputTag("", ""))), + calib_(iConfig.getParameter<edm::ParameterSet>("calib")), + caloGeometryTag_(esConsumes<CaloGeometry,CaloGeometryRecord>(edm::ESInputTag("",""))), + hbTopologyTag_(esConsumes<HcalTopology,HcalRecNumberingRecord>(edm::ESInputTag("",""))) + { produces<l1tp2::CaloCrystalClusterCollection>(); produces<BXVector<l1t::EGamma> >(); produces<l1tp2::CaloTowerCollection>("L1CaloTowerCollection"); @@ -355,13 +359,14 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: edm::Handle<EcalEBTrigPrimDigiCollection> pcalohits; iEvent.getByToken(ecalTPEBToken_, pcalohits); - iSetup.get<CaloGeometryRecord>().get(caloGeometry_); - ebGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Ecal, EcalBarrel); - hbGeometry = caloGeometry_->getSubdetectorGeometry(DetId::Hcal, HcalBarrel); - iSetup.get<HcalRecNumberingRecord>().get(hbTopology); - hcTopology_ = hbTopology.product(); + const auto &caloGeometry = iSetup.getData(caloGeometryTag_); + ebGeometry = caloGeometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); + hbGeometry = caloGeometry.getSubdetectorGeometry(DetId::Hcal, HcalBarrel); + const auto &hbTopology = iSetup.getData(hbTopologyTag_); + hcTopology_ = &hbTopology; HcalTrigTowerGeometry theTrigTowerGeometry(hcTopology_); - iSetup.get<CaloTPGRecord>().get(decoder_); + + const auto &decoder = iSetup.getData(decoderTag_); //**************************************************************** //******************* Get all the hits *************************** @@ -395,7 +400,7 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: edm::Handle<edm::SortedCollection<HcalTriggerPrimitiveDigi> > hbhecoll; iEvent.getByToken(hcalTPToken_, hbhecoll); for (const auto& hit : *hbhecoll.product()) { - float et = decoder_->hcaletValue(hit.id(), hit.t0()); + float et = decoder.hcaletValue(hit.id(), hit.t0()); if (et <= 0) continue; if (!(hcTopology_->validHT(hit.id()))) { diff --git a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc index 3946592960f46..e4a33cc721ee5 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc @@ -99,7 +99,7 @@ class L1TowerCalibrator : public edm::EDProducer { edm::EDGetTokenT<HcalTrigPrimDigiCollection> hcalToken_; edm::Handle<HcalTrigPrimDigiCollection> hcalTowerHandle; - edm::ESHandle<CaloTPGTranscoder> decoder_; + edm::ESGetToken<CaloTPGTranscoder, CaloTPGRecord> decoderTag_; // nHits to nvtx functions std::vector<edm::ParameterSet> nHits_to_nvtx_params; @@ -142,6 +142,7 @@ L1TowerCalibrator::L1TowerCalibrator(const edm::ParameterSet& iConfig) hgcalTowersToken_( consumes<l1t::HGCalTowerBxCollection>(iConfig.getParameter<edm::InputTag>("L1HgcalTowersInputTag"))), hcalToken_(consumes<HcalTrigPrimDigiCollection>(iConfig.getParameter<edm::InputTag>("hcalDigis"))), + decoderTag_(esConsumes<CaloTPGTranscoder, CaloTPGRecord>(edm::ESInputTag("", ""))), nHits_to_nvtx_params(iConfig.getParameter<std::vector<edm::ParameterSet> >("nHits_to_nvtx_params")), nvtx_to_PU_sub_params(iConfig.getParameter<std::vector<edm::ParameterSet> >("nvtx_to_PU_sub_params")) { // Initialize the nHits --> nvtx functions @@ -297,10 +298,10 @@ void L1TowerCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetu // Loop over Hcal HF tower inputs and create L1CaloTowers and add to // L1CaloTowerCalibratedCollection collection - iSetup.get<CaloTPGRecord>().get(decoder_); + const auto &decoder = iSetup.getData(decoderTag_); for (const auto& hit : *hcalTowerHandle.product()) { HcalTrigTowerDetId id = hit.id(); - double et = decoder_->hcaletValue(hit.id(), hit.t0()); + double et = decoder.hcaletValue(hit.id(), hit.t0()); if (et < HFTpEtMin) continue; // Only doing HF so skip outside range From 36ce4b5cb1276e00070a1c6b5fbe6c9d8aee6149 Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Wed, 5 May 2021 15:15:02 +0200 Subject: [PATCH 185/309] Addition to PixelDQM: cluster charge corrected with template and also the template correction itself --- .../plugins/SiPixelPhase1TrackClusters.cc | 39 +++++++++++++++++++ .../python/SiPixelPhase1TrackClusters_cfi.py | 21 ++++++++++ ...ixel_OfflineMonitoring_TrackCluster_cff.py | 21 ++++++++++ 3 files changed, 81 insertions(+) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index e20d91d101f99..c56052088be05 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -31,11 +31,18 @@ #include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" +#include "CondFormats/SiPixelTransient/src/SiPixelTemplate.cc" +#include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" + + + namespace { class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { enum { ON_TRACK_CHARGE, + ON_TRACK_CORRECTEDCHARGE, + TEMPLATE_CORRECTION, ON_TRACK_BIGPIXELCHARGE, ON_TRACK_NOTBIGPIXELCHARGE, ON_TRACK_SIZE, @@ -74,10 +81,13 @@ namespace { public: explicit SiPixelPhase1TrackClusters(const edm::ParameterSet& conf); + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; private: const bool applyVertexCut_; + const SiPixelTemplateDBObject* templateDBobject_; + std::vector< SiPixelTemplateStore > thePixelTemp_; edm::EDGetTokenT<reco::TrackCollection> tracksToken_; edm::EDGetTokenT<reco::VertexCollection> offlinePrimaryVerticesToken_; @@ -86,6 +96,8 @@ namespace { edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> trackerTopoToken_; edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeomToken_; edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> clusterShapeHitFilterToken_; + + edm::ESHandle<SiPixelTemplateDBObject> templateDBobject; }; SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) @@ -105,6 +117,17 @@ namespace { esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter")); } + void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + // Initialize 1D templates + iSetup.get<SiPixelTemplateDBObjectESProducerRcd>().get(templateDBobject); + templateDBobject_ = templateDBobject.product(); + if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) + cout << "\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " + << (*templateDBobject_).version() << "\n\n"; + } + + + void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { if (!checktrigger(iEvent, iSetup, DCS)) return; @@ -141,6 +164,8 @@ namespace { return; } + SiPixelTemplate templ(thePixelTemp_); + edm::Handle<SiPixelClusterShapeCache> pixelClusterShapeCacheH; iEvent.getByToken(pixelClusterShapeCacheToken_, pixelClusterShapeCacheH); if (!pixelClusterShapeCacheH.isValid()) { @@ -221,6 +246,18 @@ namespace { // correct charge for track impact angle auto charge = cluster.charge() * ltp.absdz(); + //Correct charge with Template1D + float cotAlpha=ltp.dxdz(); + float cotBeta=ltp.dydz(); + float locBx = 1.; + if(cotBeta < 0.) + locBx = -1.; + float locBz = locBx; + if(cotAlpha < 0.) + locBz = -locBx; + templ.interpolate(templateDBobject_->getTemplateID(id), cotAlpha, cotBeta, locBz, locBx); + auto charge_cor = (charge*templ.qscale())/templ.r_qMeas_qTrue(); + auto tmpl=templ.qscale()/templ.r_qMeas_qTrue(); auto clustgp = pixhit->globalPosition(); // from rechit @@ -261,6 +298,8 @@ namespace { histo[ON_TRACK_NCLUSTERS].fill(id, &iEvent); histo[ON_TRACK_CHARGE].fill(charge, id, &iEvent); + histo[ON_TRACK_CORRECTEDCHARGE].fill(charge_cor, id, &iEvent); + histo[TEMPLATE_CORRECTION].fill(tmpl, id, &iEvent); histo[ON_TRACK_SIZE].fill(cluster.size(), id, &iEvent); histo[ON_TRACK_POSITIONB].fill(clustgp.z(), clustgp.phi(), id, &iEvent); diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py index 9dd2232a56e25..dbd886b86231a 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py @@ -63,6 +63,25 @@ ) ) +SiPixelPhase1TrackClustersOnTrackCorrCharge = DefaultHistoTrack.clone( + name = "charge_corr", + title = "Template Corrected Cluster Charge (OnTrack)", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + + specs = VPSet( + StandardSpecifications1D, + Specification().groupBy("PXForward/PXRing").save() + ) +) + +SiPixelPhase1TrackTemplateCorr = SiPixelPhase1TrackClustersOnTrackCorrCharge.clone( + name = "template_corr", + title = "Template Correction", + range_min = 0, range_max = 3, range_nbins = 150, + xlabel = "A.U." +) + SiPixelPhase1TrackClustersOnTrackBigPixelCharge = DefaultHistoTrack.clone( name = "bigpixelcharge", title = "Corrected Big Pixel Charge (OnTrack)", @@ -488,6 +507,8 @@ # copy this in the enum SiPixelPhase1TrackClustersConf = cms.VPSet( SiPixelPhase1TrackClustersOnTrackCharge, + SiPixelPhase1TrackClustersOnTrackCorrCharge, + SiPixelPhase1TrackTemplateCorr, SiPixelPhase1TrackClustersOnTrackBigPixelCharge, SiPixelPhase1TrackClustersOnTrackNotBigPixelCharge, SiPixelPhase1TrackClustersOnTrackSize, diff --git a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py index ccdfee07c0e35..21b6770529914 100644 --- a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py +++ b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py @@ -15,6 +15,25 @@ ) ) +hltSiPixelPhase1TrackClustersOnTrackCorrCharge = hltDefaultHistoTrack.clone( + name = "charge_cor", + title = "Tempalte Corrected Cluster Charge (OnTrack)", + range_min = 0, range_max = 200e3, range_nbins = 200, + xlabel = "Charge (electrons)", + enabled=False, + specs = VPSet( + hltStandardSpecifications1D + ) +) + +hltSiPixelPhase1TrackTemplateCorr = hltSiPixelPhase1TrackClustersOnTrackCorrCharge.clone( + name = "template_corr", + title = "Tempalte Correction", + range_min = 0, range_max = 20, range_nbins = 200, + xlabel = "A.U.", + enabled=False +) + hltSiPixelPhase1TrackClustersOnTrackBigPixelCharge = DefaultHistoTrack.clone( name = "bigpixelcharge", title = "Corrected Big Pixel Charge (OnTrack)", @@ -331,6 +350,8 @@ ### THE LIST DEFINED IN THE ENUM ### https://cmssdt.cern.ch/lxr/source/DQM/SiPixelPhase1TrackClusters/src/SiPixelPhase1TrackClusters.cc#0063 hltSiPixelPhase1TrackClustersOnTrackCharge, + hltSiPixelPhase1TrackClustersOnTrackCorrCharge, + hltSiPixelPhase1TrackTemplateCorr, hltSiPixelPhase1TrackClustersOnTrackBigPixelCharge, hltSiPixelPhase1TrackClustersOnTrackNotBigPixelCharge, hltSiPixelPhase1TrackClustersOnTrackSize, From 9f7cbdcf43c7c9c777a0d5970d60b667f3876fce Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Wed, 5 May 2021 15:26:04 +0200 Subject: [PATCH 186/309] code format --- .../plugins/L1EGammaCrystalsEmulatorProducer.cc | 15 +++++++-------- .../L1CaloTrigger/plugins/L1TowerCalibrator.cc | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc index 3bc04352fe1b4..8d8ba03cadec4 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1EGammaCrystalsEmulatorProducer.cc @@ -244,10 +244,10 @@ class L1EGCrystalClusterEmulatorProducer : public edm::stream::EDProducer<> { l1tp2::ParametricCalibration calib_; - edm::ESGetToken<CaloGeometry,CaloGeometryRecord> caloGeometryTag_; + edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryTag_; const CaloSubdetectorGeometry* ebGeometry; const CaloSubdetectorGeometry* hbGeometry; - edm::ESGetToken<HcalTopology,HcalRecNumberingRecord> hbTopologyTag_; + edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> hbTopologyTag_; const HcalTopology* hcTopology_; struct mycluster { @@ -343,9 +343,8 @@ L1EGCrystalClusterEmulatorProducer::L1EGCrystalClusterEmulatorProducer(const edm consumes<edm::SortedCollection<HcalTriggerPrimitiveDigi> >(iConfig.getParameter<edm::InputTag>("hcalTP"))), decoderTag_(esConsumes<CaloTPGTranscoder, CaloTPGRecord>(edm::ESInputTag("", ""))), calib_(iConfig.getParameter<edm::ParameterSet>("calib")), - caloGeometryTag_(esConsumes<CaloGeometry,CaloGeometryRecord>(edm::ESInputTag("",""))), - hbTopologyTag_(esConsumes<HcalTopology,HcalRecNumberingRecord>(edm::ESInputTag("",""))) - { + caloGeometryTag_(esConsumes<CaloGeometry, CaloGeometryRecord>(edm::ESInputTag("", ""))), + hbTopologyTag_(esConsumes<HcalTopology, HcalRecNumberingRecord>(edm::ESInputTag("", ""))) { produces<l1tp2::CaloCrystalClusterCollection>(); produces<BXVector<l1t::EGamma> >(); produces<l1tp2::CaloTowerCollection>("L1CaloTowerCollection"); @@ -359,14 +358,14 @@ void L1EGCrystalClusterEmulatorProducer::produce(edm::Event& iEvent, const edm:: edm::Handle<EcalEBTrigPrimDigiCollection> pcalohits; iEvent.getByToken(ecalTPEBToken_, pcalohits); - const auto &caloGeometry = iSetup.getData(caloGeometryTag_); + const auto& caloGeometry = iSetup.getData(caloGeometryTag_); ebGeometry = caloGeometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel); hbGeometry = caloGeometry.getSubdetectorGeometry(DetId::Hcal, HcalBarrel); - const auto &hbTopology = iSetup.getData(hbTopologyTag_); + const auto& hbTopology = iSetup.getData(hbTopologyTag_); hcTopology_ = &hbTopology; HcalTrigTowerGeometry theTrigTowerGeometry(hcTopology_); - const auto &decoder = iSetup.getData(decoderTag_); + const auto& decoder = iSetup.getData(decoderTag_); //**************************************************************** //******************* Get all the hits *************************** diff --git a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc index e4a33cc721ee5..9054acca9739e 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1TowerCalibrator.cc @@ -298,7 +298,7 @@ void L1TowerCalibrator::produce(edm::Event& iEvent, const edm::EventSetup& iSetu // Loop over Hcal HF tower inputs and create L1CaloTowers and add to // L1CaloTowerCalibratedCollection collection - const auto &decoder = iSetup.getData(decoderTag_); + const auto& decoder = iSetup.getData(decoderTag_); for (const auto& hit : *hcalTowerHandle.product()) { HcalTrigTowerDetId id = hit.id(); double et = decoder.hcaletValue(hit.id(), hit.t0()); From 689a01dc272d1e0de9df4e0c07051d2c9e336ce8 Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Wed, 5 May 2021 15:36:35 +0200 Subject: [PATCH 187/309] code-format patch --- .../plugins/SiPixelPhase1TrackClusters.cc | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index c56052088be05..d4eb8dac543f8 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -34,8 +34,6 @@ #include "CondFormats/SiPixelTransient/src/SiPixelTemplate.cc" #include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" - - namespace { class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { @@ -87,7 +85,7 @@ namespace { private: const bool applyVertexCut_; const SiPixelTemplateDBObject* templateDBobject_; - std::vector< SiPixelTemplateStore > thePixelTemp_; + std::vector<SiPixelTemplateStore> thePixelTemp_; edm::EDGetTokenT<reco::TrackCollection> tracksToken_; edm::EDGetTokenT<reco::VertexCollection> offlinePrimaryVerticesToken_; @@ -122,12 +120,11 @@ namespace { iSetup.get<SiPixelTemplateDBObjectESProducerRcd>().get(templateDBobject); templateDBobject_ = templateDBobject.product(); if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) - cout << "\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " - << (*templateDBobject_).version() << "\n\n"; + edm::LogError("SiPixelPhase1TrackClusters") + << "Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " + << (*templateDBobject_).version() << std::endl; } - - void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { if (!checktrigger(iEvent, iSetup, DCS)) return; @@ -247,17 +244,17 @@ namespace { // correct charge for track impact angle auto charge = cluster.charge() * ltp.absdz(); //Correct charge with Template1D - float cotAlpha=ltp.dxdz(); - float cotBeta=ltp.dydz(); + float cotAlpha = ltp.dxdz(); + float cotBeta = ltp.dydz(); float locBx = 1.; - if(cotBeta < 0.) + if (cotBeta < 0.) locBx = -1.; float locBz = locBx; - if(cotAlpha < 0.) + if (cotAlpha < 0.) locBz = -locBx; templ.interpolate(templateDBobject_->getTemplateID(id), cotAlpha, cotBeta, locBz, locBx); - auto charge_cor = (charge*templ.qscale())/templ.r_qMeas_qTrue(); - auto tmpl=templ.qscale()/templ.r_qMeas_qTrue(); + auto charge_cor = (charge * templ.qscale()) / templ.r_qMeas_qTrue(); + auto tmpl = templ.qscale() / templ.r_qMeas_qTrue(); auto clustgp = pixhit->globalPosition(); // from rechit @@ -298,7 +295,7 @@ namespace { histo[ON_TRACK_NCLUSTERS].fill(id, &iEvent); histo[ON_TRACK_CHARGE].fill(charge, id, &iEvent); - histo[ON_TRACK_CORRECTEDCHARGE].fill(charge_cor, id, &iEvent); + histo[ON_TRACK_CORRECTEDCHARGE].fill(charge_cor, id, &iEvent); histo[TEMPLATE_CORRECTION].fill(tmpl, id, &iEvent); histo[ON_TRACK_SIZE].fill(cluster.size(), id, &iEvent); From 5ce1cecf7fd4900c61472c4e275dde11e5ca312a Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Wed, 5 May 2021 16:10:04 +0200 Subject: [PATCH 188/309] Move DBTemplate access to token --- .../plugins/SiPixelPhase1TrackClusters.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index d4eb8dac543f8..93d7883337426 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -95,7 +95,8 @@ namespace { edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeomToken_; edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> clusterShapeHitFilterToken_; - edm::ESHandle<SiPixelTemplateDBObject> templateDBobject; + edm::ESGetToken<SiPixelTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd> templateDBobjectToken_; + }; SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) @@ -113,11 +114,12 @@ namespace { trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>(); clusterShapeHitFilterToken_ = esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter")); + templateDBobjectToken_ = esConsumes<SiPixelTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd>(); } void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { // Initialize 1D templates - iSetup.get<SiPixelTemplateDBObjectESProducerRcd>().get(templateDBobject); + edm::ESHandle<SiPixelTemplateDBObject> templateDBobject = iSetup.getHandle(templateDBobjectToken_); templateDBobject_ = templateDBobject.product(); if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) edm::LogError("SiPixelPhase1TrackClusters") From 73ad9f3a65d6078fe2abacba47910343ba192e4e Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Wed, 5 May 2021 16:30:28 +0200 Subject: [PATCH 189/309] code patch (again) --- DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 93d7883337426..a3a37b1c4b746 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -96,7 +96,6 @@ namespace { edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> clusterShapeHitFilterToken_; edm::ESGetToken<SiPixelTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd> templateDBobjectToken_; - }; SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) From dc5f51955dd3d7009800db24b24e1cc9cc462e11 Mon Sep 17 00:00:00 2001 From: Felice <felice.pantaleo@cern.ch> Date: Wed, 5 May 2021 17:17:47 +0200 Subject: [PATCH 190/309] modify Tracksters to have a float vertex multiplicity --- DataFormats/HGCalReco/interface/Trackster.h | 8 ++++---- DataFormats/HGCalReco/src/classes_def.xml | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/DataFormats/HGCalReco/interface/Trackster.h b/DataFormats/HGCalReco/interface/Trackster.h index ece599d1c9926..2067ac2151d80 100644 --- a/DataFormats/HGCalReco/interface/Trackster.h +++ b/DataFormats/HGCalReco/interface/Trackster.h @@ -54,7 +54,7 @@ namespace ticl { inline void setIteration(const Trackster::IterationIndex i) { iterationIndex_ = i; } std::vector<unsigned int> &vertices() { return vertices_; } - std::vector<uint8_t> &vertex_multiplicity() { return vertex_multiplicity_; } + std::vector<float> &vertex_multiplicity() { return vertex_multiplicity_; } std::vector<std::array<unsigned int, 2> > &edges() { return edges_; } inline void setSeed(edm::ProductID pid, int index) { seedID_ = pid; @@ -119,8 +119,8 @@ namespace ticl { inline const Trackster::IterationIndex ticlIteration() const { return (IterationIndex)iterationIndex_; } inline const std::vector<unsigned int> &vertices() const { return vertices_; } inline const unsigned int vertices(int index) const { return vertices_[index]; } - inline const std::vector<uint8_t> &vertex_multiplicity() const { return vertex_multiplicity_; } - inline const uint8_t vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } + inline const std::vector<float> &vertex_multiplicity() const { return vertex_multiplicity_; } + inline const float vertex_multiplicity(int index) const { return vertex_multiplicity_[index]; } inline const std::vector<std::array<unsigned int, 2> > &edges() const { return edges_; } inline const edm::ProductID &seedID() const { return seedID_; } inline const int seedIndex() const { return seedIndex_; } @@ -153,7 +153,7 @@ namespace ticl { // The vertices of the DAG are the indices of the // 2d objects in the global collection std::vector<unsigned int> vertices_; - std::vector<uint8_t> vertex_multiplicity_; + std::vector<float> vertex_multiplicity_; // The edges connect two vertices together in a directed doublet // ATTENTION: order matters! diff --git a/DataFormats/HGCalReco/src/classes_def.xml b/DataFormats/HGCalReco/src/classes_def.xml index e105e092985f8..9ac5b29b4f2e2 100644 --- a/DataFormats/HGCalReco/src/classes_def.xml +++ b/DataFormats/HGCalReco/src/classes_def.xml @@ -1,6 +1,7 @@ <lcgdict> - <class name="ticl::Trackster" ClassVersion="8"> + <class name="ticl::Trackster" ClassVersion="9"> + <version ClassVersion="9" checksum="1001808235"/> <version ClassVersion="8" checksum="749412802"/> <version ClassVersion="7" checksum="1072014319"/> <version ClassVersion="6" checksum="3003722924"/> From 5a23cbc97426e3f685f99c724acbcaab84592f17 Mon Sep 17 00:00:00 2001 From: Felice <felice.pantaleo@cern.ch> Date: Wed, 5 May 2021 17:18:14 +0200 Subject: [PATCH 191/309] using float multiplicity for fraction --- RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc index 92746d5d9e61c..b26ba4074345c 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -156,7 +156,7 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even tmpTrackster.vertices().push_back(lc.index()); double fraction = energyScorePair.first / lc->energy(); (*output_mask)[lc.index()] -= fraction; - tmpTrackster.vertex_multiplicity().push_back(static_cast<uint8_t>(std::clamp(1. / fraction, 1., 255.))); + tmpTrackster.vertex_multiplicity().push_back(1. / fraction); } } tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(cp.pdgId(), cp.charge()), 1.f); @@ -184,7 +184,7 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even tmpTrackster.vertices().push_back(lc.index()); double fraction = energyScorePair.first / lc->energy(); (*output_mask)[lc.index()] -= fraction; - tmpTrackster.vertex_multiplicity().push_back(static_cast<uint8_t>(std::clamp(1. / fraction, 1., 255.))); + tmpTrackster.vertex_multiplicity().push_back(1. / fraction); } } tmpTrackster.setIdProbability(tracksterParticleTypeFromPdgId(sc.pdgId(), sc.charge()), 1.f); From 6af9fbcaf08017cc8398a97c082cd8e6a8105a47 Mon Sep 17 00:00:00 2001 From: Markus Seidel <markus.seidel@cern.ch> Date: Wed, 5 May 2021 17:19:16 +0200 Subject: [PATCH 192/309] Allow for increased mass precision in NanoGen --- PhysicsTools/NanoAOD/python/nanogen_cff.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nanogen_cff.py b/PhysicsTools/NanoAOD/python/nanogen_cff.py index 92cba74a9478c..bcbb2431faa13 100644 --- a/PhysicsTools/NanoAOD/python/nanogen_cff.py +++ b/PhysicsTools/NanoAOD/python/nanogen_cff.py @@ -55,6 +55,7 @@ def nanoGenCommonCustomize(process): setGenPtPrecision(process, CandVars.pt.precision) setGenEtaPrecision(process, CandVars.eta.precision) setGenPhiPrecision(process, CandVars.phi.precision) + setGenMassPrecision(process, CandVars.mass.precision) def customizeNanoGENFromMini(process): process.nanogenSequence.insert(0, process.genParticles2HepMCHiggsVtx) @@ -126,9 +127,11 @@ def pruneGenParticlesMini(process): return process def setGenFullPrecision(process): - setGenPtPrecision(process, 23) - setGenEtaPrecision(process, 23) - setGenPhiPrecision(process, 23) + process = setGenPtPrecision(process, 23) + process = setGenEtaPrecision(process, 23) + process = setGenPhiPrecision(process, 23) + process = setGenMassPrecision(process, 23) + return process def setGenPtPrecision(process, precision): process.genParticleTable.variables.pt.precision = precision @@ -147,6 +150,11 @@ def setGenPhiPrecision(process, precision): process.metMCTable.variables.phi.precision = precision return process +def setGenMassPrecision(process, precision): + process.genParticleTable.variables.mass.precision = precision + process.genJetTable.variables.mass.precision = precision + return process + def setLHEFullPrecision(process): process.lheInfoTable.precision = 23 return process From 5c055aad6dbd7b68e9f96afb165f0ab93768bf9a Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Wed, 5 May 2021 18:02:47 +0200 Subject: [PATCH 193/309] address Silvio's comments --- ...{L1MetPfProducer.cc => L1METPFProducer.cc} | 60 +++++++++---------- ...Producer_cfi.py => L1METPFProducer_cfi.py} | 2 +- 2 files changed, 29 insertions(+), 33 deletions(-) rename L1Trigger/Phase2L1ParticleFlow/plugins/{L1MetPfProducer.cc => L1METPFProducer.cc} (76%) rename L1Trigger/Phase2L1ParticleFlow/python/{L1MetPfProducer_cfi.py => L1METPFProducer_cfi.py} (79%) diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc similarity index 76% rename from L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc rename to L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc index 457aea90637c4..15a648f3225ba 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1MetPfProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc @@ -14,10 +14,12 @@ using namespace l1t; -class L1MetPfProducer : public edm::global::EDProducer<> { +class L1METPFProducer : public edm::global::EDProducer<> { public: - explicit L1MetPfProducer(const edm::ParameterSet&); - ~L1MetPfProducer() override; + explicit L1METPFProducer(const edm::ParameterSet&); + ~L1METPFProducer() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override; @@ -53,13 +55,13 @@ class L1MetPfProducer : public edm::global::EDProducer<> { void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, reco::Candidate::PolarLorentzVector& metVector) const; }; -L1MetPfProducer::L1MetPfProducer(const edm::ParameterSet& cfg) +L1METPFProducer::L1METPFProducer(const edm::ParameterSet& cfg) : _l1PFToken(consumes<std::vector<l1t::PFCandidate>>(cfg.getParameter<edm::InputTag>("L1PFObjects"))), maxCands_(cfg.getParameter<int>("maxCands")) { produces<std::vector<l1t::EtSum>>(); } -void L1MetPfProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { +void L1METPFProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { edm::Handle<l1t::PFCandidateCollection> l1PFCandidates; iEvent.getByToken(_l1PFToken, l1PFCandidates); @@ -83,7 +85,7 @@ void L1MetPfProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::Even iEvent.put(std::move(metCollection)); } -void L1MetPfProducer::CalcMetHLS(std::vector<float> pt, +void L1METPFProducer::CalcMetHLS(std::vector<float> pt, std::vector<float> phi, reco::Candidate::PolarLorentzVector& metVector) const { pxy_t hw_px = 0; @@ -113,7 +115,7 @@ void L1MetPfProducer::CalcMetHLS(std::vector<float> pt, metVector.SetEta(0); } -void L1MetPfProducer::Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool debug) const { +void L1METPFProducer::Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool debug) const { /* Convert pt and phi to px (py) 1) Map phi to the first quadrant to reduce LUT size @@ -130,10 +132,10 @@ void L1MetPfProducer::Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool deb phiQ1 = hwPi_ - phiQ1; if (phiQ1 > hwPiOverTwo_) { - std::cout << "unexpected phi (high)" << std::endl; + edm::LogWarning ("L1METPFProducer") << "unexpected phi (high)"; phiQ1 = hwPiOverTwo_; } else if (phiQ1 < 0) { - std::cout << "unexpected phi (low)" << std::endl; + edm::LogWarning ("L1METPFProducer") << "unexpected phi (low)"; phiQ1 = 0; } if (isX) { @@ -150,7 +152,7 @@ void L1MetPfProducer::Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool deb } } -void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) const { +void L1METPFProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) const { if (px == 0 && py == 0) { phi = 0; return; @@ -181,26 +183,17 @@ void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) cons inv_t a_over_b = a * inv_b; if (debug) { - printf(" a, b = %f, %f; index, inv = %d, %f; ratio = %f \n", - a.to_double(), - b.to_double(), - index, - inv_b.to_double(), - a_over_b.to_double()); - printf(" bcheck, 1/bc = %f, %f -- %d %f %d \n", bcheck, 1. / bcheck, invTableSize_, maxPt_, dropFactor_); + LogDebug("L1METPFProducer") << " a, b = \n " <<a.to_double()<<" , "<<b.to_double()<<"; index, inv = "<<index<<", "<<inv_b.to_double()<<"; ratio= "<<a_over_b.to_double()<<" \n"<<std::endl; + LogDebug("L1METPFProducer") << "bcheck, 1/bc = "<<bcheck<<", "<<1. / bcheck<<" -- "<<invTableSize_<<" "<<maxPt_<<" "<<dropFactor_<<" \n"<<std::endl; } - int atanTableBits_ = 7; - int atanTableSize_ = (1 << atanTableBits_); + const int atanTableBits_ = 7; + const int atanTableSize_ = (1 << atanTableBits_); index = round(a_over_b.to_double() * atanTableSize_); phi = atan(float(index) / atanTableSize_) / phiLSB_; if (debug) { - printf(" atan index, phi = %d, %f (%f rad) real atan(a/b)= %f \n", - index, - phi.to_double(), - phi.to_double() * (M_PI / hwPi_.to_double()), - atan(a.to_double() / b.to_double())); + LogDebug("L1METPFProducer") << " atan index, phi = "<<index<<", "<<phi.to_double()<<" ("<<phi.to_double() * (M_PI / hwPi_.to_double())<<" rad) real atan(a/b)= "<<atan(a.to_double() / b.to_double())<<" \n"<<std::endl; } // rotate from (0,pi/4) to full quad1 @@ -215,16 +208,19 @@ void L1MetPfProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) cons phi = -(hwPi_ - phi); // Q3 composition of both if (debug) { - printf(" phi hw, float, real = %f, %f (%f rad from x,y = %f, %f) \n", - phi.to_double(), - phi.to_double() * (M_PI / hwPi_.to_double()), - atan2(py.to_double(), px.to_double()), - px.to_double(), - py.to_double()); + LogDebug("L1METPFProducer") << " phi hw, float, real = "<<phi.to_double()<<", "<<phi.to_double() * (M_PI / hwPi_.to_double())<<" ("<<atan2(py.to_double(), px.to_double())<<" rad from x,y = "<<px.to_double()<<", "<<py.to_double()<<") \n"<<std::endl; } } -L1MetPfProducer::~L1MetPfProducer() {} +void +L1METPFProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add<int>("maxCandidates", 128); + desc.add<edm::InputTag>("L1PFObjects", edm::InputTag("L1PFProducer","l1pfCandidates")); + descriptions.add("L1METPFProducer", desc); +} + +L1METPFProducer::~L1METPFProducer() {} #include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(L1MetPfProducer); +DEFINE_FWK_MODULE(L1METPFProducer); diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py similarity index 79% rename from L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py rename to L1Trigger/Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py index 2be9b12b96e2e..82d47fbe84677 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1MetPfProducer_cfi.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -L1MetPfProducer = cms.EDProducer("L1MetPfProducer", +L1METPFProducer = cms.EDProducer("L1METPFProducer", L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), maxCandidates = cms.int32(128), ) From 22e092386b6311e373cb21b2afd5c564d9e4e1f7 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Wed, 5 May 2021 18:03:55 +0200 Subject: [PATCH 194/309] code format --- .../plugins/L1METPFProducer.cc | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc index 15a648f3225ba..419af6d86fdef 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc @@ -132,10 +132,10 @@ void L1METPFProducer::Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool deb phiQ1 = hwPi_ - phiQ1; if (phiQ1 > hwPiOverTwo_) { - edm::LogWarning ("L1METPFProducer") << "unexpected phi (high)"; + edm::LogWarning("L1METPFProducer") << "unexpected phi (high)"; phiQ1 = hwPiOverTwo_; } else if (phiQ1 < 0) { - edm::LogWarning ("L1METPFProducer") << "unexpected phi (low)"; + edm::LogWarning("L1METPFProducer") << "unexpected phi (low)"; phiQ1 = 0; } if (isX) { @@ -183,8 +183,13 @@ void L1METPFProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) cons inv_t a_over_b = a * inv_b; if (debug) { - LogDebug("L1METPFProducer") << " a, b = \n " <<a.to_double()<<" , "<<b.to_double()<<"; index, inv = "<<index<<", "<<inv_b.to_double()<<"; ratio= "<<a_over_b.to_double()<<" \n"<<std::endl; - LogDebug("L1METPFProducer") << "bcheck, 1/bc = "<<bcheck<<", "<<1. / bcheck<<" -- "<<invTableSize_<<" "<<maxPt_<<" "<<dropFactor_<<" \n"<<std::endl; + LogDebug("L1METPFProducer") << " a, b = \n " << a.to_double() << " , " << b.to_double() + << "; index, inv = " << index << ", " << inv_b.to_double() + << "; ratio= " << a_over_b.to_double() << " \n" + << std::endl; + LogDebug("L1METPFProducer") << "bcheck, 1/bc = " << bcheck << ", " << 1. / bcheck << " -- " << invTableSize_ << " " + << maxPt_ << " " << dropFactor_ << " \n" + << std::endl; } const int atanTableBits_ = 7; @@ -193,7 +198,10 @@ void L1METPFProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) cons phi = atan(float(index) / atanTableSize_) / phiLSB_; if (debug) { - LogDebug("L1METPFProducer") << " atan index, phi = "<<index<<", "<<phi.to_double()<<" ("<<phi.to_double() * (M_PI / hwPi_.to_double())<<" rad) real atan(a/b)= "<<atan(a.to_double() / b.to_double())<<" \n"<<std::endl; + LogDebug("L1METPFProducer") << " atan index, phi = " << index << ", " << phi.to_double() << " (" + << phi.to_double() * (M_PI / hwPi_.to_double()) + << " rad) real atan(a/b)= " << atan(a.to_double() / b.to_double()) << " \n" + << std::endl; } // rotate from (0,pi/4) to full quad1 @@ -208,15 +216,18 @@ void L1METPFProducer::PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug) cons phi = -(hwPi_ - phi); // Q3 composition of both if (debug) { - LogDebug("L1METPFProducer") << " phi hw, float, real = "<<phi.to_double()<<", "<<phi.to_double() * (M_PI / hwPi_.to_double())<<" ("<<atan2(py.to_double(), px.to_double())<<" rad from x,y = "<<px.to_double()<<", "<<py.to_double()<<") \n"<<std::endl; + LogDebug("L1METPFProducer") << " phi hw, float, real = " << phi.to_double() << ", " + << phi.to_double() * (M_PI / hwPi_.to_double()) << " (" + << atan2(py.to_double(), px.to_double()) << " rad from x,y = " << px.to_double() << ", " + << py.to_double() << ") \n" + << std::endl; } } -void -L1METPFProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { +void L1METPFProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add<int>("maxCandidates", 128); - desc.add<edm::InputTag>("L1PFObjects", edm::InputTag("L1PFProducer","l1pfCandidates")); + desc.add<edm::InputTag>("L1PFObjects", edm::InputTag("L1PFProducer", "l1pfCandidates")); descriptions.add("L1METPFProducer", desc); } From c20860c0956be9b4fc882ee9a8d1823cacd9a2ef Mon Sep 17 00:00:00 2001 From: Felice <felice.pantaleo@cern.ch> Date: Wed, 5 May 2021 19:15:07 +0200 Subject: [PATCH 195/309] add premix modifier --- RecoHGCal/TICL/python/SimTracksters_cff.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RecoHGCal/TICL/python/SimTracksters_cff.py b/RecoHGCal/TICL/python/SimTracksters_cff.py index 8aa9d1a9fd8c7..9151a33f1265b 100644 --- a/RecoHGCal/TICL/python/SimTracksters_cff.py +++ b/RecoHGCal/TICL/python/SimTracksters_cff.py @@ -20,7 +20,8 @@ from Configuration.ProcessModifiers.premix_stage2_cff import premix_stage2 premix_stage2.toModify(ticlSimTracksters, - simclusters = "mixData:MergedCaloTruth" + simclusters = "mixData:MergedCaloTruth", + caloparticles = "mixData:MergedCaloTruth", ) ticlMultiClustersFromSimTracksters = _multiClustersFromTrackstersProducer.clone( From 844c15b8254f07687d1dd6368fb00376e86e9cb2 Mon Sep 17 00:00:00 2001 From: hyunyong <antilogy33@gmail.com> Date: Thu, 6 May 2021 11:10:22 +0900 Subject: [PATCH 196/309] add default dPhi value --- Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc index 106605e9a5fb0..5c56fb58469aa 100644 --- a/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc +++ b/Geometry/GEMGeometryBuilder/src/GEMGeometryBuilderFromCondDB.cc @@ -166,7 +166,7 @@ GEMEtaPartition* GEMGeometryBuilderFromCondDB::buildEtaPartition(const RecoIdeal float ti = convertMmToCm(*(shapeStart + 3)); float nstrip = *(shapeStart + 4); float npad = *(shapeStart + 5); - float dphi = *(shapeStart + 6); + float dphi = (shapeStart + 6 < rgeo.shapeEnd(gid)) ? *(shapeStart + 6) : 0.17715; std::vector<float> pars; pars.emplace_back(be); From a664982cd1d7aa1994db33b0646a84421d7fc7cc Mon Sep 17 00:00:00 2001 From: Felice <felice.pantaleo@cern.ch> Date: Thu, 6 May 2021 09:32:42 +0200 Subject: [PATCH 197/309] add fraction cut --- .../plugins/TrackstersFromSimClustersProducer.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc index b26ba4074345c..90ce32fdfe39b 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -83,6 +83,7 @@ class TrackstersFromSimClustersProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT<hgcal::SimToRecoCollection> associatorMapCaloParticleToReco_token_; edm::ESGetToken<CaloGeometry, CaloGeometryRecord> geom_token_; hgcal::RecHitTools rhtools_; + const double fractionCut_; }; DEFINE_FWK_MODULE(TrackstersFromSimClustersProducer); @@ -101,7 +102,8 @@ TrackstersFromSimClustersProducer::TrackstersFromSimClustersProducer(const edm:: associatorLayerClusterCaloParticle_( ps.getUntrackedParameter<edm::InputTag>("layerClusterCaloParticleAssociator")), associatorMapCaloParticleToReco_token_(consumes<hgcal::SimToRecoCollection>(associatorLayerClusterCaloParticle_)), - geom_token_(esConsumes()) { + geom_token_(esConsumes()), + fractionCut_(ps.getParameter<double>("fractionCut")) { produces<std::vector<Trackster>>(); produces<std::vector<float>>(); } @@ -119,6 +121,8 @@ void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescr edm::InputTag("layerClusterSimClusterAssociationProducer")); desc.addUntracked<edm::InputTag>("layerClusterCaloParticleAssociator", edm::InputTag("layerClusterCaloParticleAssociationProducer")); + desc.add<double>("fractionCut", 0.02); + descriptions.add("trackstersFromSimClustersProducer", desc); } @@ -153,8 +157,10 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even tmpTrackster.vertex_multiplicity().reserve(values.size()); for (auto const& [lc, energyScorePair] : values) { if (inputClusterMask[lc.index()] > 0) { - tmpTrackster.vertices().push_back(lc.index()); double fraction = energyScorePair.first / lc->energy(); + if (fraction < fractionCut_) + continue; + tmpTrackster.vertices().push_back(lc.index()); (*output_mask)[lc.index()] -= fraction; tmpTrackster.vertex_multiplicity().push_back(1. / fraction); } @@ -181,8 +187,10 @@ void TrackstersFromSimClustersProducer::produce(edm::Event& evt, const edm::Even for (auto const& [lc, energyScorePair] : lcVec) { if (inputClusterMask[lc.index()] > 0) { - tmpTrackster.vertices().push_back(lc.index()); double fraction = energyScorePair.first / lc->energy(); + if (fraction < fractionCut_) + continue; + tmpTrackster.vertices().push_back(lc.index()); (*output_mask)[lc.index()] -= fraction; tmpTrackster.vertex_multiplicity().push_back(1. / fraction); } From 9c036c11ddbe09f443077da2446156a005658d12 Mon Sep 17 00:00:00 2001 From: Felice <felice.pantaleo@cern.ch> Date: Thu, 6 May 2021 09:33:35 +0200 Subject: [PATCH 198/309] set fraction cut to 0.05 --- RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc index 90ce32fdfe39b..f30fc5335b8e5 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -121,7 +121,7 @@ void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescr edm::InputTag("layerClusterSimClusterAssociationProducer")); desc.addUntracked<edm::InputTag>("layerClusterCaloParticleAssociator", edm::InputTag("layerClusterCaloParticleAssociationProducer")); - desc.add<double>("fractionCut", 0.02); + desc.add<double>("fractionCut", 0.05); descriptions.add("trackstersFromSimClustersProducer", desc); } From 942c2df875e003af241dfc57ca0f8dfb329b41c3 Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Thu, 6 May 2021 10:40:07 +0200 Subject: [PATCH 199/309] Fix the SiPixelTemplateDBObject Token with the beginRun transition --- DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index a3a37b1c4b746..1e84b7db243db 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -95,7 +95,7 @@ namespace { edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> trackerGeomToken_; edm::ESGetToken<ClusterShapeHitFilter, CkfComponentsRecord> clusterShapeHitFilterToken_; - edm::ESGetToken<SiPixelTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd> templateDBobjectToken_; + edm::ESGetToken<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd> templateDBobjectToken_; }; SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) @@ -113,7 +113,8 @@ namespace { trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>(); clusterShapeHitFilterToken_ = esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter")); - templateDBobjectToken_ = esConsumes<SiPixelTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd>(); + // templateDBobjectToken_ = esConsumes<SiPixelTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd>(); + templateDBobjectToken_ = esConsumes<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd,edm::Transition::BeginRun>(); } void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { From 16a38698d1f3a55d84a55a16184aa12b40c2629c Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Thu, 6 May 2021 10:40:48 +0200 Subject: [PATCH 200/309] Fix the SiPixelTemplateDBObject Token with the beginRun transition --- DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 1e84b7db243db..2da4b8bf69d72 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -113,7 +113,6 @@ namespace { trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>(); clusterShapeHitFilterToken_ = esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter")); - // templateDBobjectToken_ = esConsumes<SiPixelTemplateDBObject, SiPixel2DTemplateDBObjectESProducerRcd>(); templateDBobjectToken_ = esConsumes<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd,edm::Transition::BeginRun>(); } From cc68010d08f8fd0e1548b8ab53e05f2057ea7831 Mon Sep 17 00:00:00 2001 From: parbol <pablom@cern.ch> Date: Thu, 6 May 2021 10:57:43 +0200 Subject: [PATCH 201/309] MTDparameters.xml updated for compatibility with old geometries --- Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml | 2 +- Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml index 1b433a94bc794..d098866a3be6f 100644 --- a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml @@ -9,7 +9,7 @@ 22, 24, 16, 10, 0x1, 0x3, 0x3F, 0x3F, 1, 16, 3, 1 </Vector> <Vector name="ETL" type="numeric" nEntries="12"> - 22, 24, 16, 7, 0x1, 0x3, 0x3F, 0xFF, 24, 4, 2, 8 + 0, 0, 0, 0, 0, 0, 0, 0, 24, 4, 2, 8 </Vector> </ConstantsSection> diff --git a/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml index 1b433a94bc794..d098866a3be6f 100644 --- a/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml @@ -9,7 +9,7 @@ 22, 24, 16, 10, 0x1, 0x3, 0x3F, 0x3F, 1, 16, 3, 1 </Vector> <Vector name="ETL" type="numeric" nEntries="12"> - 22, 24, 16, 7, 0x1, 0x3, 0x3F, 0xFF, 24, 4, 2, 8 + 0, 0, 0, 0, 0, 0, 0, 0, 24, 4, 2, 8 </Vector> </ConstantsSection> From 0f6c4da312f2b31db1910ca53406324899acc2cc Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Thu, 6 May 2021 10:59:39 +0200 Subject: [PATCH 202/309] code-format patch --- DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 2da4b8bf69d72..04681b086fdbf 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -113,7 +113,8 @@ namespace { trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>(); clusterShapeHitFilterToken_ = esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter")); - templateDBobjectToken_ = esConsumes<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd,edm::Transition::BeginRun>(); + templateDBobjectToken_ = + esConsumes<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd, edm::Transition::BeginRun>(); } void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { From 2b5739535a5c76b991f5cf9c54e631362a883ee3 Mon Sep 17 00:00:00 2001 From: Jeongeun Lee <jeongeun.lee@cern.ch> Date: Thu, 6 May 2021 11:43:31 +0200 Subject: [PATCH 203/309] change default cfi name produceMuons to muonSeedGenerator --- RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc | 2 +- RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc b/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc index 573c47fc595b8..ba063f737b6e1 100644 --- a/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc +++ b/RecoMuon/MuonSeedGenerator/plugins/MuonSeedGenerator.cc @@ -120,5 +120,5 @@ void MuonSeedGenerator::fillDescriptions(edm::ConfigurationDescriptions& descrip desc.add<double>("deltaPhiSearchWindow", 0.25); desc.add<double>("deltaEtaSearchWindow", 0.2); desc.add<double>("deltaEtaCrackSearchWindow", 0.25); - descriptions.add("produceMuons", desc); + descriptions.add("muonSeedGenerator", desc); } diff --git a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py index 2bda3dc625d74..7d035ebf48d04 100644 --- a/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py +++ b/RecoMuon/MuonSeedGenerator/python/ancientMuonSeed_cfi.py @@ -3,8 +3,8 @@ from RecoMuon.MuonSeedGenerator.ptSeedParameterization_cfi import ptSeedParameterization from RecoMuon.MuonSeedGenerator.MuonSeedPtScale_cfi import dphiScale -import RecoMuon.MuonSeedGenerator.produceMuons_cfi as _mod -ancientMuonSeed = _mod.produceMuons.clone( +import RecoMuon.MuonSeedGenerator.muonSeedGenerator_cfi as _mod +ancientMuonSeed = _mod.muonSeedGenerator.clone( ptSeedParameterization, dphiScale, beamSpotTag = "offlineBeamSpot", From 80799ec75e1358ead22aa8828a8632703c9b8686 Mon Sep 17 00:00:00 2001 From: Vladimir <Vladimir.Ivantchenko@cern.ch> Date: Thu, 6 May 2021 11:50:24 +0200 Subject: [PATCH 204/309] clean-up user actions --- SimG4Core/Application/src/StackingAction.cc | 22 ++--- SimG4Core/Application/src/SteppingAction.cc | 104 +++++++++----------- 2 files changed, 59 insertions(+), 67 deletions(-) diff --git a/SimG4Core/Application/src/StackingAction.cc b/SimG4Core/Application/src/StackingAction.cc index d488fa586d31c..ac241f5cce94a 100644 --- a/SimG4Core/Application/src/StackingAction.cc +++ b/SimG4Core/Application/src/StackingAction.cc @@ -171,8 +171,8 @@ StackingAction::~StackingAction() { delete newTA; } G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* aTrack) { // G4 interface part G4ClassificationOfNewTrack classification = fUrgent; - int pdg = aTrack->GetDefinition()->GetPDGEncoding(); - int abspdg = std::abs(pdg); + const int pdg = aTrack->GetDefinition()->GetPDGEncoding(); + const int abspdg = std::abs(pdg); // primary if (aTrack->GetCreatorProcess() == nullptr || aTrack->GetParentID() == 0) { @@ -208,13 +208,13 @@ G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* aTrac } else { // potentially good for tracking - double ke = aTrack->GetKineticEnergy(); + const double ke = aTrack->GetKineticEnergy(); // kill tracks in specific regions - if (classification != fKill && isThisRegion(reg, deadRegions)) { + if (isThisRegion(reg, deadRegions)) { classification = fKill; } - if (ke <= limitEnergyForVacuum && isThisRegion(reg, lowdensRegions)) { + if (classification != fKill && ke <= limitEnergyForVacuum && isThisRegion(reg, lowdensRegions)) { classification = fKill; } else { @@ -346,14 +346,14 @@ void StackingAction::PrepareNewEvent() {} void StackingAction::initPointer() { // prepare region vector - unsigned int num = maxTimeNames.size(); + const unsigned int num = maxTimeNames.size(); maxTimeRegions.resize(num, nullptr); // Russian roulette - std::vector<G4Region*>* rs = G4RegionStore::GetInstance(); + const std::vector<G4Region*>* rs = G4RegionStore::GetInstance(); for (auto& reg : *rs) { - G4String rname = reg->GetName(); + const G4String& rname = reg->GetName(); if ((gRusRoEcal < 1.0 || nRusRoEcal < 1.0) && rname == "EcalRegion") { regionEcal = reg; } @@ -434,8 +434,8 @@ bool StackingAction::rrApplicable(const G4Track* aTrack, const G4Track& mother) const TrackInformation& motherInfo(extractor(mother)); // Check whether mother is gamma, e+, e- - int genID = motherInfo.genParticlePID(); - return (22 == genID || 11 == genID || -11 == genID) ? false : true; + const int genID = std::abs(motherInfo.genParticlePID()); + return (22 != genID && 11 != genID); } int StackingAction::isItFromPrimary(const G4Track& mother, int flagIn) const { @@ -457,7 +457,7 @@ bool StackingAction::isItOutOfTimeWindow(const G4Region* reg, const G4Track* aTr break; } } - return (aTrack->GetGlobalTime() > tofM) ? true : false; + return (aTrack->GetGlobalTime() > tofM); } void StackingAction::printRegions(const std::vector<const G4Region*>& reg, const std::string& word) const { diff --git a/SimG4Core/Application/src/SteppingAction.cc b/SimG4Core/Application/src/SteppingAction.cc index 112fa02862150..a0442c5b4f92c 100644 --- a/SimG4Core/Application/src/SteppingAction.cc +++ b/SimG4Core/Application/src/SteppingAction.cc @@ -103,7 +103,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) { // NaN energy deposit if (sAlive == tstat && edm::isNotFinite(aStep->GetTotalEnergyDeposit())) { tstat = sEnergyDepNaN; - if (nWarnings < 20) { + if (nWarnings < 5) { ++nWarnings; edm::LogWarning("SimG4CoreApplication") << "Track #" << theTrack->GetTrackID() << " " << theTrack->GetDefinition()->GetParticleName() @@ -138,34 +138,33 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) { } // kill low-energy in vacuum - G4double kinEnergy = theTrack->GetKineticEnergy(); + const G4double kinEnergy = theTrack->GetKineticEnergy(); if (sAlive == tstat && killBeamPipe && kinEnergy < theCriticalEnergyForVacuum && theTrack->GetDefinition()->GetPDGCharge() != 0.0 && kinEnergy > 0.0 && theTrack->GetNextVolume()->GetLogicalVolume()->GetMaterial()->GetDensity() <= theCriticalDensity) { tstat = sLowEnergyInVacuum; } + } + // check transition tracker/calo + if (sAlive == tstat || sVeryForward == tstat) { + if (isThisVolume(preStep->GetTouchable(), tracker) && isThisVolume(postStep->GetTouchable(), calo)) { + math::XYZVectorD pos((preStep->GetPosition()).x(), (preStep->GetPosition()).y(), (preStep->GetPosition()).z()); - // check transition tracker/calo - if (sAlive == tstat || sVeryForward == tstat) { - if (isThisVolume(preStep->GetTouchable(), tracker) && isThisVolume(postStep->GetTouchable(), calo)) { - math::XYZVectorD pos((preStep->GetPosition()).x(), (preStep->GetPosition()).y(), (preStep->GetPosition()).z()); - - math::XYZTLorentzVectorD mom((preStep->GetMomentum()).x(), - (preStep->GetMomentum()).y(), - (preStep->GetMomentum()).z(), - preStep->GetTotalEnergy()); + math::XYZTLorentzVectorD mom((preStep->GetMomentum()).x(), + (preStep->GetMomentum()).y(), + (preStep->GetMomentum()).z(), + preStep->GetTotalEnergy()); - uint32_t id = theTrack->GetTrackID(); + uint32_t id = theTrack->GetTrackID(); - std::pair<math::XYZVectorD, math::XYZTLorentzVectorD> p(pos, mom); - eventAction_->addTkCaloStateInfo(id, p); - } - } else { - theTrack->SetTrackStatus(fStopAndKill); + std::pair<math::XYZVectorD, math::XYZTLorentzVectorD> p(pos, mom); + eventAction_->addTkCaloStateInfo(id, p); + } + } else { + theTrack->SetTrackStatus(fStopAndKill); #ifdef DebugLog - PrintKilledTrack(theTrack, tstat); + PrintKilledTrack(theTrack, tstat); #endif - } } if (nullptr != steppingVerbose) { steppingVerbose->NextStep(aStep, fpSteppingManager, (1 < tstat)); @@ -175,7 +174,7 @@ void SteppingAction::UserSteppingAction(const G4Step* aStep) { bool SteppingAction::isLowEnergy(const G4Step* aStep) const { const G4StepPoint* sp = aStep->GetPostStepPoint(); const G4LogicalVolume* lv = sp->GetPhysicalVolume()->GetLogicalVolume(); - double ekin = sp->GetKineticEnergy(); + const double ekin = sp->GetKineticEnergy(); int pCode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding(); for (auto& vol : ekinVolumes) { @@ -193,36 +192,28 @@ bool SteppingAction::isLowEnergy(const G4Step* aStep) const { bool SteppingAction::initPointer() { const G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance(); - if (pvs) { - std::vector<G4VPhysicalVolume*>::const_iterator pvcite; - for (pvcite = pvs->begin(); pvcite != pvs->end(); ++pvcite) { - if ((*pvcite)->GetName() == "Tracker") - tracker = (*pvcite); - if ((*pvcite)->GetName() == "CALO") - calo = (*pvcite); - if (tracker && calo) - break; - } - if (tracker || calo) { - edm::LogVerbatim("SimG4CoreApplication") << "Pointer for Tracker " << tracker << " and for Calo " << calo; - if (tracker) - LogDebug("SimG4CoreApplication") << "Tracker vol name " << tracker->GetName(); - if (calo) - LogDebug("SimG4CoreApplication") << "Calorimeter vol name " << calo->GetName(); - } + for (auto const& pvcite : *pvs) { + const G4String& pvname = pvcite->GetName(); + if (pvname == "Tracker") + tracker = pvcite; + else if (pvname == "CALO") + calo = pvcite; + + if (tracker && calo) + break; } + edm::LogVerbatim("SimG4CoreApplication") + << "SteppingAction: pointer for Tracker " << tracker << " and for Calo " << calo; const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance(); if (numberEkins > 0) { - if (lvs) { - ekinVolumes.resize(numberEkins, nullptr); - std::vector<G4LogicalVolume*>::const_iterator lvcite; - for (lvcite = lvs->begin(); lvcite != lvs->end(); ++lvcite) { - for (unsigned int i = 0; i < numberEkins; ++i) { - if ((*lvcite)->GetName() == (G4String)(ekinNames[i])) { - ekinVolumes[i] = (*lvcite); - break; - } + ekinVolumes.resize(numberEkins, nullptr); + for (auto const& lvcite : *lvs) { + const G4String& lvname = lvcite->GetName(); + for (unsigned int i = 0; i < numberEkins; ++i) { + if (lvname == (G4String)(ekinNames[i])) { + ekinVolumes[i] = lvcite; + break; } } } @@ -233,10 +224,11 @@ bool SteppingAction::initPointer() { if (numberPart > 0) { G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable(); - G4String partName; ekinPDG.resize(numberPart, 0); for (unsigned int i = 0; i < numberPart; ++i) { - ekinPDG[i] = theParticleTable->FindParticle(partName = ekinParticles[i])->GetPDGEncoding(); + const G4ParticleDefinition* part = theParticleTable->FindParticle(ekinParticles[i]); + if (nullptr != part) + ekinPDG[i] = part->GetPDGEncoding(); edm::LogVerbatim("SimG4CoreApplication") << "Particle " << ekinParticles[i] << " with PDG code " << ekinPDG[i] << " and KE cut off " << ekinMins[i] / MeV << " MeV"; } @@ -245,11 +237,11 @@ bool SteppingAction::initPointer() { const G4RegionStore* rs = G4RegionStore::GetInstance(); if (numberTimes > 0) { maxTimeRegions.resize(numberTimes, nullptr); - std::vector<G4Region*>::const_iterator rcite; - for (rcite = rs->begin(); rcite != rs->end(); ++rcite) { + for (auto const& rcite : *rs) { + const G4String& rname = rcite->GetName(); for (unsigned int i = 0; i < numberTimes; ++i) { - if ((*rcite)->GetName() == (G4String)(maxTimeNames[i])) { - maxTimeRegions[i] = (*rcite); + if (rname == (G4String)(maxTimeNames[i])) { + maxTimeRegions[i] = rcite; break; } } @@ -257,11 +249,11 @@ bool SteppingAction::initPointer() { } if (ndeadRegions > 0) { deadRegions.resize(ndeadRegions, nullptr); - std::vector<G4Region*>::const_iterator rcite; - for (rcite = rs->begin(); rcite != rs->end(); ++rcite) { + for (auto const& rcite : *rs) { + const G4String& rname = rcite->GetName(); for (unsigned int i = 0; i < ndeadRegions; ++i) { - if ((*rcite)->GetName() == (G4String)(deadRegionNames[i])) { - deadRegions[i] = (*rcite); + if (rname == (G4String)(deadRegionNames[i])) { + deadRegions[i] = rcite; break; } } From 5ed978a3bd521421fcd4a229caf02e89b4a06a05 Mon Sep 17 00:00:00 2001 From: Felice <felice.pantaleo@cern.ch> Date: Thu, 6 May 2021 12:24:08 +0200 Subject: [PATCH 205/309] disable fraction cut --- RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc index f30fc5335b8e5..fe65620d1da10 100644 --- a/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc +++ b/RecoHGCal/TICL/plugins/TrackstersFromSimClustersProducer.cc @@ -121,7 +121,7 @@ void TrackstersFromSimClustersProducer::fillDescriptions(edm::ConfigurationDescr edm::InputTag("layerClusterSimClusterAssociationProducer")); desc.addUntracked<edm::InputTag>("layerClusterCaloParticleAssociator", edm::InputTag("layerClusterCaloParticleAssociationProducer")); - desc.add<double>("fractionCut", 0.05); + desc.add<double>("fractionCut", 0.); descriptions.add("trackstersFromSimClustersProducer", desc); } From 14007eb9e5a8a76bbdbecdb51e27344cb0aa987d Mon Sep 17 00:00:00 2001 From: David <David.Lange@cern.ch> Date: Thu, 6 May 2021 14:19:32 +0200 Subject: [PATCH 206/309] move unit tests to python3 --- PhysicsTools/MXNet/test/test_mxnet.py | 2 +- PhysicsTools/PythonAnalysis/test/BuildFile.xml | 1 - PhysicsTools/PythonAnalysis/test/testNumExpr.py | 2 +- PhysicsTools/PythonAnalysis/test/testTheano.sh | 2 +- PhysicsTools/PythonAnalysis/test/testhep_ml.py | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/PhysicsTools/MXNet/test/test_mxnet.py b/PhysicsTools/MXNet/test/test_mxnet.py index fd4c3ec59de04..16886f777a555 100755 --- a/PhysicsTools/MXNet/test/test_mxnet.py +++ b/PhysicsTools/MXNet/test/test_mxnet.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import mxnet as mx a = mx.nd.ones((2, 3)) b = a * 2 + 1 diff --git a/PhysicsTools/PythonAnalysis/test/BuildFile.xml b/PhysicsTools/PythonAnalysis/test/BuildFile.xml index dbc3a8e952760..f8efe1e50bfbc 100644 --- a/PhysicsTools/PythonAnalysis/test/BuildFile.xml +++ b/PhysicsTools/PythonAnalysis/test/BuildFile.xml @@ -154,5 +154,4 @@ <test name="import-bs4" command="python3 -c 'import bs4'"/> <test name="run-flawfinder" command="flawfinder -h"/> <test name="run-ipython3" command="ipython3 -h"/> -<test name="run-pylint" command="pylint -h"/> <test name="run-pylint3" command="pylint3 -h"/> diff --git a/PhysicsTools/PythonAnalysis/test/testNumExpr.py b/PhysicsTools/PythonAnalysis/test/testNumExpr.py index 3db3cf569a343..f68854063d670 100755 --- a/PhysicsTools/PythonAnalysis/test/testNumExpr.py +++ b/PhysicsTools/PythonAnalysis/test/testNumExpr.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 #https://github.com/pydata/numexpr/wiki/Numexpr-Users-Guide from __future__ import print_function diff --git a/PhysicsTools/PythonAnalysis/test/testTheano.sh b/PhysicsTools/PythonAnalysis/test/testTheano.sh index 287a516b26d01..dceabec41e878 100755 --- a/PhysicsTools/PythonAnalysis/test/testTheano.sh +++ b/PhysicsTools/PythonAnalysis/test/testTheano.sh @@ -8,7 +8,7 @@ echo ">>> Change default behaviour for Theano" export THEANO_FLAGS="device=cpu,force_device=True,base_compiledir=$TEST_TMPDIR" echo ">>> Theano configuration for testing:" -python -c 'import theano; print(theano.config)' || ERR=1 +python3 -c 'import theano; print(theano.config)' || ERR=1 echo ">>> Cleaning compile cache" theano-cache clear || ERR=1 diff --git a/PhysicsTools/PythonAnalysis/test/testhep_ml.py b/PhysicsTools/PythonAnalysis/test/testhep_ml.py index d8f3563e7647a..783ea18b0edb9 100755 --- a/PhysicsTools/PythonAnalysis/test/testhep_ml.py +++ b/PhysicsTools/PythonAnalysis/test/testhep_ml.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ From 74053aec7ed59bab297c2c0bbaef156b950a6ffa Mon Sep 17 00:00:00 2001 From: parbol <pablom@cern.ch> Date: Thu, 6 May 2021 14:36:31 +0200 Subject: [PATCH 207/309] Update mtdParameters for D49 and D60 (Bug fix) --- Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml | 2 +- Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml index d098866a3be6f..a63aec1458c9f 100644 --- a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml @@ -6,7 +6,7 @@ 4, 4, 4, 24 </Vector> <Vector name="BTL" type="numeric" nEntries="12"> - 22, 24, 16, 10, 0x1, 0x3, 0x3F, 0x3F, 1, 16, 3, 1 + 0, 0, 0, 0, 0, 0, 0 ,0, 1, 16, 3, 1 </Vector> <Vector name="ETL" type="numeric" nEntries="12"> 0, 0, 0, 0, 0, 0, 0, 0, 24, 4, 2, 8 diff --git a/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml index d098866a3be6f..5ea8b0aa56f17 100644 --- a/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/mtdParameters/v1/mtdParameters.xml @@ -6,7 +6,7 @@ 4, 4, 4, 24 </Vector> <Vector name="BTL" type="numeric" nEntries="12"> - 22, 24, 16, 10, 0x1, 0x3, 0x3F, 0x3F, 1, 16, 3, 1 + 0, 0, 0, 0, 0, 0, 0, 0, 1, 16, 3, 1 </Vector> <Vector name="ETL" type="numeric" nEntries="12"> 0, 0, 0, 0, 0, 0, 0, 0, 24, 4, 2, 8 From bdc1c00982c95c496eb836336d9509073f4febe3 Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Thu, 6 May 2021 15:30:22 +0200 Subject: [PATCH 208/309] Reduce the number of plots generated with tempalte info, move the TrackerGeometry and Topology loading at BeginRun --- .../plugins/SiPixelPhase1TrackClusters.cc | 23 ++++++++++--------- .../python/SiPixelPhase1TrackClusters_cfi.py | 14 +++++++++-- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 04681b086fdbf..8d2b163c838cb 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -86,6 +86,7 @@ namespace { const bool applyVertexCut_; const SiPixelTemplateDBObject* templateDBobject_; std::vector<SiPixelTemplateStore> thePixelTemp_; + const TrackerTopology* tkTpl = nullptr; edm::EDGetTokenT<reco::TrackCollection> tracksToken_; edm::EDGetTokenT<reco::VertexCollection> offlinePrimaryVerticesToken_; @@ -109,8 +110,8 @@ namespace { pixelClusterShapeCacheToken_ = consumes<SiPixelClusterShapeCache>(iConfig.getParameter<edm::InputTag>("clusterShapeCache")); - trackerTopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd>(); - trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>(); + trackerTopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>(); + trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>(); clusterShapeHitFilterToken_ = esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter")); templateDBobjectToken_ = @@ -118,6 +119,13 @@ namespace { } void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + // get geometry + edm::ESHandle<TrackerGeometry> tracker = iSetup.getHandle(trackerGeomToken_); + assert(tracker.isValid()); + + edm::ESHandle<TrackerTopology> tTopoHandle = iSetup.getHandle(trackerTopoToken_); + tkTpl = tTopoHandle.product(); + // Initialize 1D templates edm::ESHandle<SiPixelTemplateDBObject> templateDBobject = iSetup.getHandle(templateDBobjectToken_); templateDBobject_ = templateDBobject.product(); @@ -137,13 +145,6 @@ namespace { return; } - // get geometry - edm::ESHandle<TrackerGeometry> tracker = iSetup.getHandle(trackerGeomToken_); - assert(tracker.isValid()); - - edm::ESHandle<TrackerTopology> tTopoHandle = iSetup.getHandle(trackerTopoToken_); - auto const& tkTpl = *tTopoHandle; - edm::ESHandle<ClusterShapeHitFilter> shapeFilterH = iSetup.getHandle(clusterShapeHitFilterToken_); auto const& shapeFilter = *shapeFilterH; @@ -209,8 +210,8 @@ namespace { // PXB_L4 IS IN THE OTHER WAY // CAN BE XORed BUT LETS KEEP THINGS SIMPLE - bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || - ((tkTpl.pxbLadder(id) % 2 != 1) && tkTpl.pxbLayer(id) == 4); + bool iAmOuter = ((tkTpl->pxbLadder(id) % 2 == 1) && tkTpl->pxbLayer(id) != 4) || + ((tkTpl->pxbLadder(id) % 2 != 1) && tkTpl->pxbLayer(id) == 4); auto pixhit = dynamic_cast<const SiPixelRecHit*>(hit->hit()); if (!pixhit) diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py index dbd886b86231a..80f86611d73e1 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py @@ -70,8 +70,18 @@ xlabel = "Charge (electrons)", specs = VPSet( - StandardSpecifications1D, - Specification().groupBy("PXForward/PXRing").save() + Specification().groupBy("PXBarrel").save(), + Specification().groupBy("PXForward").save(), + Specification().groupBy("PXBarrel/PXLayer").save(), + Specification().groupBy("PXForward/PXDisk").save(), + Specification().groupBy("PXForward/PXRing").save(), + Specification(PerLayer1D).groupBy("PXBarrel/Shell/PXLayer").save(), + Specification(PerLayer1D).groupBy("PXForward/HalfCylinder/PXRing").save(), + Specification(PerLayer1D).groupBy("PXForward/HalfCylinder/PXRing/PXDisk").save(), + Specification(PerLadder).groupBy("PXBarrel/Shell/PXLayer/SignedLadder").save(), + Specification(PerLadder).groupBy("PXForward/HalfCylinder/PXRing/PXDisk/SignedBlade").save(), + Specification(PerModule).groupBy("PXBarrel/Shell/PXLayer/SignedLadder/PXModuleName").save(), + Specification(PerModule).groupBy("PXForward/HalfCylinder/PXRing/PXDisk/SignedBlade/PXModuleName").save() ) ) From f40d03fbeae4cc8aec54860f134f05d21d0347fa Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury <suvankar.roy.chowdhury@cern.ch> Date: Thu, 6 May 2021 15:31:46 +0200 Subject: [PATCH 209/309] remove Fall17V1 variables from electron table --- PhysicsTools/NanoAOD/python/electrons_cff.py | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 83449e50d95a4..7c14f9eb6364d 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -362,15 +362,6 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): eInvMinusPInv = Var("(1-eSuperClusterOverP())/ecalEnergy()",float,doc="1/E_SC - 1/p_trk",precision=10), scEtOverPt = Var("(superCluster().energy()/(pt*cosh(superCluster().eta())))-1",float,doc="(supercluster transverse energy)/pt-1",precision=8), - mvaFall17V1Iso = Var("userFloat('mvaFall17V1Iso')",float,doc="MVA Iso ID V1 score"), - mvaFall17V1Iso_WP80 = Var("userInt('mvaFall17V1Iso_WP80')",bool,doc="MVA Iso ID V1 WP80"), - mvaFall17V1Iso_WP90 = Var("userInt('mvaFall17V1Iso_WP90')",bool,doc="MVA Iso ID V1 WP90"), - mvaFall17V1Iso_WPL = Var("userInt('mvaFall17V1Iso_WPL')",bool,doc="MVA Iso ID V1 loose WP"), - mvaFall17V1noIso = Var("userFloat('mvaFall17V1noIso')",float,doc="MVA noIso ID V1 score"), - mvaFall17V1noIso_WP80 = Var("userInt('mvaFall17V1noIso_WP80')",bool,doc="MVA noIso ID V1 WP80"), - mvaFall17V1noIso_WP90 = Var("userInt('mvaFall17V1noIso_WP90')",bool,doc="MVA noIso ID V1 WP90"), - mvaFall17V1noIso_WPL = Var("userInt('mvaFall17V1noIso_WPL')",bool,doc="MVA noIso ID V1 loose WP"), - mvaFall17V2Iso = Var("userFloat('mvaFall17V2Iso')",float,doc="MVA Iso ID V2 score"), mvaFall17V2Iso_WP80 = Var("userInt('mvaFall17V2Iso_WP80')",bool,doc="MVA Iso ID V2 WP80"), mvaFall17V2Iso_WP90 = Var("userInt('mvaFall17V2Iso_WP90')",bool,doc="MVA Iso ID V2 WP90"), @@ -381,7 +372,6 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): mvaFall17V2noIso_WPL = Var("userInt('mvaFall17V2noIso_WPL')",bool,doc="MVA noIso ID V2 loose WP"), cutBased = Var("userInt('cutbasedID_Fall17_V2_veto')+userInt('cutbasedID_Fall17_V2_loose')+userInt('cutbasedID_Fall17_V2_medium')+userInt('cutbasedID_Fall17_V2_tight')",int,doc="cut-based ID Fall17 V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"), - cutBased_Fall17_V1 = Var("userInt('cutbasedID_Fall17_V1_veto')+userInt('cutbasedID_Fall17_V1_loose')+userInt('cutbasedID_Fall17_V1_medium')+userInt('cutbasedID_Fall17_V1_tight')",int,doc="cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"), vidNestedWPBitmap = Var("userInt('VIDNestedWPBitmap')",int,doc=_bitmapVIDForEle_docstring), vidNestedWPBitmapHEEP = Var("userInt('VIDNestedWPBitmapHEEP')",int,doc=_bitmapVIDForEleHEEP_docstring), cutBased_HEEP = Var("userInt('cutbasedID_HEEP')",bool,doc="cut-based HEEP ID"), @@ -421,6 +411,18 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): dEsigmaDown=Var("userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energySigmaDownNew')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8), ) +##Keeping the possibilty of using V1 working points in older eras +(~run2_nanoAOD_106Xv2).toModify(electronTable.variables, + mvaFall17V1Iso = Var("userFloat('mvaFall17V1Iso')",float,doc="MVA Iso ID V1 score"), + mvaFall17V1Iso_WP80 = Var("userInt('mvaFall17V1Iso_WP80')",bool,doc="MVA Iso ID V1 WP80"), + mvaFall17V1Iso_WP90 = Var("userInt('mvaFall17V1Iso_WP90')",bool,doc="MVA Iso ID V1 WP90"), + mvaFall17V1Iso_WPL = Var("userInt('mvaFall17V1Iso_WPL')",bool,doc="MVA Iso ID V1 loose WP"), + mvaFall17V1noIso = Var("userFloat('mvaFall17V1noIso')",float,doc="MVA noIso ID V1 score"), + mvaFall17V1noIso_WP80 = Var("userInt('mvaFall17V1noIso_WP80')",bool,doc="MVA noIso ID V1 WP80"), + mvaFall17V1noIso_WP90 = Var("userInt('mvaFall17V1noIso_WP90')",bool,doc="MVA noIso ID V1 WP90"), + mvaFall17V1noIso_WPL = Var("userInt('mvaFall17V1noIso_WPL')",bool,doc="MVA noIso ID V1 loose WP"), + cutBased_Fall17_V1 = Var("userInt('cutbasedID_Fall17_V1_veto')+userInt('cutbasedID_Fall17_V1_loose')+userInt('cutbasedID_Fall17_V1_medium')+userInt('cutbasedID_Fall17_V1_tight')",int,doc="cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"), +) #the94X miniAOD V2 had a bug in the scale and smearing for electrons in the E/p comb #therefore we redo it but but we need use a new name for the userFloat as we cant override existing userfloats # scale and smearing only when available#ONLY needed for this era From ebc9d51973cff374e4ebb76745005fd0d6e67609 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury <suvankar.roy.chowdhury@cern.ch> Date: Thu, 6 May 2021 15:32:16 +0200 Subject: [PATCH 210/309] update dqm according to fall17v1 removal --- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 17 +++++++++++++---- PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 8 -------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 8705561ba5ded..21c4297d22c5c 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -3,6 +3,7 @@ from PhysicsTools.NanoAOD.nanoDQM_cfi import nanoDQM from PhysicsTools.NanoAOD.nanoDQM_tools_cff import * +from PhysicsTools.NanoAOD.nano_eras_cff import * ## Modify plots accordingly to era _vplots80X = nanoDQM.vplots.clone() @@ -17,7 +18,6 @@ _tauPlots80X.append(Plot1D('rawMVAnewDM', 'rawMVAnewDM', 20, -1, 1, 'byIsolationMVArun2v1DBnewDMwLT raw output discriminator')) _tauPlots80X.append(Plot1D('rawMVAoldDMdR03', 'rawMVAoldDMdR03', 20, -1, 1, 'byIsolationMVArun2v1DBdR03oldDMwLT raw output discriminator')) _vplots80X.Tau.plots = _tauPlots80X -from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy run2_miniAOD_80XLegacy.toModify(nanoDQM, vplots = _vplots80X ) @@ -28,8 +28,6 @@ if plot.name.value().find("fiducial")>-1: continue _METFixEE2017_plots.append(plot) _METFixEE2017_DQMentry.plots = _METFixEE2017_plots -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv1_cff import run2_nanoAOD_94XMiniAODv1 -from Configuration.Eras.Modifier_run2_nanoAOD_94XMiniAODv2_cff import run2_nanoAOD_94XMiniAODv2 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2: modifier.toModify(nanoDQM.vplots, METFixEE2017 = _METFixEE2017_DQMentry) @@ -43,6 +41,17 @@ _Electron_plots_2016.append(Plot1D('mvaSpring16HZZ_WPL', 'mvaSpring16HZZ_WPL', 2, -0.5, 1.5, 'MVA Spring16 HZZ ID loose WP')) _Electron_plots_2016.append(NoPlot('vidNestedWPBitmapSpring15')) +#putting back the fall17V1 plots for non v9 case +_Electron_plots_withFall17V1 = copy.deepcopy(nanoDQM.vplots.Electron.plots) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso', 'mvaFall17V1Iso', 20, -1, 1, 'MVA Iso ID V1 score')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP80', 'mvaFall17V1Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V1 WP80')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP90', 'mvaFall17V1Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V1 WP90')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WPL', 'mvaFall17V1Iso_WPL', 2, -0.5, 1.5, 'MVA Iso ID V1 loose WP')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso', 'mvaFall17V1noIso', 20, -1, 1, 'MVA noIso ID V1 score')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WP80', 'mvaFall17V1noIso_WP80', 2, -0.5, 1.5, 'MVA noIso ID V1 WP80')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WP90', 'mvaFall17V1noIso_WP90', 2, -0.5, 1.5, 'MVA noIso ID V1 WP90')) +_Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1noIso_WPL', 'mvaFall17V1noIso_WPL', 2, -0.5, 1.5, 'MVA noIso ID V1 loose WP')) + _Photon_plots_2016 = copy.deepcopy(nanoDQM.vplots.Photon.plots) _Photon_plots_2016.append(Plot1D('cutBased', 'cutBased', 4, -0.5, 3.5, 'cut-based Spring16-V2p2 ID (0:fail, 1::loose, 2:medium, 3:tight)')) _Photon_plots_2016.append(Plot1D('cutBased17Bitmap', 'cutBased17Bitmap', 8, -0.5, 7.5, 'cut-based Fall17-94X-V1 ID bitmap, 2^(0:loose, 1:medium, 2:tight)')) @@ -57,12 +66,12 @@ _Flag_plots_80x.append(Plot1D('BadGlobalMuon', 'BadGlobalMuon', 2, -0.5, 1.5, 'Bad muon flag')) _Flag_plots_80x.append(Plot1D('CloneGlobalMuon', 'CloneGlobalMuon', 2, -0.5, 1.5, 'Clone muon flag')) -from Configuration.Eras.Modifier_run2_nanoAOD_94X2016_cff import run2_nanoAOD_94X2016 for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016: modifier.toModify(nanoDQM.vplots.Electron, plots = _Electron_plots_2016) modifier.toModify(nanoDQM.vplots.Photon, plots = _Photon_plots_2016) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.FatJet, plots = _FatJet_plots_80x) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.Flag, plots = _Flag_plots_80x) +(~run2_nanoAOD_106Xv2).toModify(nanoDQM.vplots.Electron, plots=_Electron_plots_withFall17V1) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots, IsoTrack = None) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 31584ec78caa1..748f0d7d17891 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -84,14 +84,6 @@ NoPlot('mass'), Plot1D('miniPFRelIso_all', 'miniPFRelIso_all', 20, 0, 1, 'mini PF relative isolation, total (with scaled rho*EA PU corrections)'), Plot1D('miniPFRelIso_chg', 'miniPFRelIso_chg', 20, 0, 1, 'mini PF relative isolation, charged component'), - Plot1D('mvaFall17V1Iso', 'mvaFall17V1Iso', 20, -1, 1, 'MVA Iso ID V1 score'), - Plot1D('mvaFall17V1Iso_WP80', 'mvaFall17V1Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V1 WP80'), - Plot1D('mvaFall17V1Iso_WP90', 'mvaFall17V1Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V1 WP90'), - Plot1D('mvaFall17V1Iso_WPL', 'mvaFall17V1Iso_WPL', 2, -0.5, 1.5, 'MVA Iso ID V1 loose WP'), - Plot1D('mvaFall17V1noIso', 'mvaFall17V1noIso', 20, -1, 1, 'MVA noIso ID V1 score'), - Plot1D('mvaFall17V1noIso_WP80', 'mvaFall17V1noIso_WP80', 2, -0.5, 1.5, 'MVA noIso ID V1 WP80'), - Plot1D('mvaFall17V1noIso_WP90', 'mvaFall17V1noIso_WP90', 2, -0.5, 1.5, 'MVA noIso ID V1 WP90'), - Plot1D('mvaFall17V1noIso_WPL', 'mvaFall17V1noIso_WPL', 2, -0.5, 1.5, 'MVA noIso ID V1 loose WP'), Plot1D('mvaFall17V2Iso', 'mvaFall17V2Iso', 20, -1, 1, 'MVA Iso ID V2 score'), Plot1D('mvaFall17V2Iso_WP80', 'mvaFall17V2Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V2 WP80'), Plot1D('mvaFall17V2Iso_WP90', 'mvaFall17V2Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V2 WP90'), From e03f8ca7c81f7fae08b2145ebb2542b9a654fdb7 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Thu, 6 May 2021 15:32:34 +0200 Subject: [PATCH 211/309] Update mtd validation configuration to scenario D76, use up-to-date fragments and options --- .../MtdValidation/test/mtdValidation_cfg.py | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Validation/MtdValidation/test/mtdValidation_cfg.py b/Validation/MtdValidation/test/mtdValidation_cfg.py index 1a84ec60b0cc0..4509441227d78 100644 --- a/Validation/MtdValidation/test/mtdValidation_cfg.py +++ b/Validation/MtdValidation/test/mtdValidation_cfg.py @@ -7,22 +7,10 @@ process.load("FWCore.MessageService.MessageLogger_cfi") -process.load("Configuration.Geometry.GeometryExtended2026D49_cff") +process.load("Configuration.Geometry.GeometryExtended2026D76Reco_cff") process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load("Geometry.MTDNumberingBuilder.mtdNumberingGeometry_cfi") -process.load("Geometry.MTDNumberingBuilder.mtdTopology_cfi") -process.load("Geometry.MTDGeometryBuilder.mtdGeometry_cfi") -process.load("Geometry.MTDGeometryBuilder.mtdParameters_cfi") - -process.mtdGeometry = cms.ESProducer("MTDDigiGeometryESModule", - alignmentsLabel = cms.string(''), - appendToDataLabel = cms.string(''), - applyAlignment = cms.bool(False), - fromDDD = cms.bool(True) -) - process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) process.MessageLogger.cerr.FwkReport = cms.untracked.PSet( @@ -53,8 +41,13 @@ # --- Global Validation process.load("Validation.MtdValidation.mtdTracks_cfi") +process.btlDigiHits.LocalPositionDebug = True +process.etlDigiHits.LocalPositionDebug = True +process.btlLocalReco.LocalPositionDebug = True +process.etlLocalReco.LocalPositionDebug = True + process.DQMStore = cms.Service("DQMStore") process.load("DQMServices.FileIO.DQMFileSaverOnline_cfi") -process.p = cms.Path( process.mix + btlValidation + etlValidation + process.globalReco + process.dqmSaver) +process.p = cms.Path( process.mix + btlValidation + etlValidation + process.mtdTracks + process.dqmSaver) From 0a19ca7e80e3c437124c3fb87ac7f28d5793fb20 Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Thu, 6 May 2021 16:58:08 +0200 Subject: [PATCH 212/309] Some code semplification applied --- .../plugins/SiPixelPhase1TrackClusters.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 8d2b163c838cb..335894f955baa 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -110,25 +110,24 @@ namespace { pixelClusterShapeCacheToken_ = consumes<SiPixelClusterShapeCache>(iConfig.getParameter<edm::InputTag>("clusterShapeCache")); - trackerTopoToken_ = esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>(); - trackerGeomToken_ = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>(); + trackerTopoToken_ = esConsumes<edm::Transition::BeginRun>(); + trackerGeomToken_ = esConsumes<edm::Transition::BeginRun>(); clusterShapeHitFilterToken_ = esConsumes<ClusterShapeHitFilter, CkfComponentsRecord>(edm::ESInputTag("", "ClusterShapeHitFilter")); - templateDBobjectToken_ = - esConsumes<SiPixelTemplateDBObject, SiPixelTemplateDBObjectESProducerRcd, edm::Transition::BeginRun>(); + templateDBobjectToken_ = esConsumes<edm::Transition::BeginRun>(); } void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { // get geometry edm::ESHandle<TrackerGeometry> tracker = iSetup.getHandle(trackerGeomToken_); assert(tracker.isValid()); - - edm::ESHandle<TrackerTopology> tTopoHandle = iSetup.getHandle(trackerTopoToken_); - tkTpl = tTopoHandle.product(); + //get topology + tkTpl = &iSetup.getData(trackerTopoToken_); + ; // Initialize 1D templates - edm::ESHandle<SiPixelTemplateDBObject> templateDBobject = iSetup.getHandle(templateDBobjectToken_); - templateDBobject_ = templateDBobject.product(); + templateDBobject_ = &iSetup.getData(templateDBobjectToken_); + ; if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) edm::LogError("SiPixelPhase1TrackClusters") << "Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " From ba6c6b9e11ec3e8cbd5aae66daaf0a6ec9dd6f62 Mon Sep 17 00:00:00 2001 From: Emily <macdonald.e17@gmail.com> Date: Wed, 28 Oct 2020 13:54:13 -0500 Subject: [PATCH 213/309] Track-objects in CMSSW11; included prompt vs displaced track flags (cherry picked from commit dad89184df2d1a46a79512186afa8bf27f27183e) --- L1Trigger/L1TTrackMatch/BuildFile.xml | 1 + .../plugins/L1TkHTMissProducer.cc | 227 ++ .../plugins/L1TrackFastJetProducer.cc | 207 ++ .../plugins/L1TrackJetProducer.cc | 628 +++++ .../plugins/L1TrackJetProducer.h | 30 + .../plugins/L1TrackerEtMissProducer.cc | 196 ++ .../python/L1TkHTMissProducer_cfi.py | 46 + .../python/L1TrackFastJetProducer_cfi.py | 33 + .../python/L1TrackJetProducer_cfi.py | 57 + .../python/L1TrackerEtMissProducer_cfi.py | 41 + .../test/L1TrackObjectNtupleMaker.cc | 2260 +++++++++++++++++ .../test/L1TrackObjectNtupleMaker_cfg.py | 185 ++ 12 files changed, 3911 insertions(+) create mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc create mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc create mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc create mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h create mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc create mode 100644 L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py create mode 100644 L1Trigger/L1TTrackMatch/python/L1TrackFastJetProducer_cfi.py create mode 100644 L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py create mode 100644 L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py create mode 100644 L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc create mode 100644 L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker_cfg.py diff --git a/L1Trigger/L1TTrackMatch/BuildFile.xml b/L1Trigger/L1TTrackMatch/BuildFile.xml index 596dc6c8f3683..bf3475dfefcf0 100644 --- a/L1Trigger/L1TTrackMatch/BuildFile.xml +++ b/L1Trigger/L1TTrackMatch/BuildFile.xml @@ -8,6 +8,7 @@ <use name="DataFormats/Math"/> <use name="L1Trigger/L1TMuon"/> <use name="L1Trigger/L1TMuonEndCap"/> +<use name="RecoJets/JetAlgorithms"/> <use name="clhep"/> <use name="root"/> <use name="rootrflx"/> diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc new file mode 100644 index 0000000000000..1b204f2bc008d --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc @@ -0,0 +1,227 @@ +// Original Author: Emmanuelle Perez,40 1-A28,+41227671915, +// Created: Tue Nov 12 17:03:19 CET 2013 + +// system include files +#include <memory> + +// 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/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMissFwd.h" + +using namespace l1t; + +class L1TkHTMissProducer : public edm::EDProducer { +public: + + explicit L1TkHTMissProducer(const edm::ParameterSet&); + ~L1TkHTMissProducer(); + +private: + virtual void beginJob() ; + virtual void produce(edm::Event&, const edm::EventSetup&); + virtual void endJob() ; + + // ----------member data --------------------------- + float jet_minPt; // [GeV] + float jet_maxEta; // [rad] + bool doVtxConstrain; // require vertex constraint + bool primaryVtxConstrain; // use event primary vertex instead of leading jet (if doVtxConstrain) + bool useCaloJets; // Determines whether or not calo jets are used + float deltaZ; // for jets [cm] (if DoTvxConstrain) + bool displaced; // Use prompt/displaced tracks + unsigned int minNtracksHighPt; + unsigned int minNtracksLowPt; + const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken; + const edm::EDGetTokenT< TkJetCollection > jetToken; +}; + +L1TkHTMissProducer::L1TkHTMissProducer(const edm::ParameterSet& iConfig) : +pvToken(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), +jetToken(consumes<TkJetCollection>(iConfig.getParameter<edm::InputTag>("L1TkJetInputTag"))) +{ + jet_minPt = (float)iConfig.getParameter<double>("jet_minPt"); + jet_maxEta = (float)iConfig.getParameter<double>("jet_maxEta"); + doVtxConstrain = iConfig.getParameter<bool>("doVtxConstrain"); + useCaloJets = iConfig.getParameter<bool>("useCaloJets"); + primaryVtxConstrain = iConfig.getParameter<bool>("primaryVtxConstrain"); + deltaZ = (float)iConfig.getParameter<double>("deltaZ"); + minNtracksHighPt=iConfig.getParameter<int>("jet_minNtracksHighPt"); + minNtracksLowPt=iConfig.getParameter<int>("jet_minNtracksLowPt"); + displaced = iConfig.getParameter<bool>("displaced"); + + if (useCaloJets) produces<TkHTMissCollection>("TkCaloHTMiss"); + else if (displaced) produces<TkHTMissCollection>("L1TrackerHTMissExtended"); + else produces<TkHTMissCollection>("L1TrackerHTMiss"); +} + +L1TkHTMissProducer::~L1TkHTMissProducer() { } + +void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + std::unique_ptr<TkHTMissCollection> MHTCollection(new TkHTMissCollection); + + // L1 primary vertex + edm::Handle<TkPrimaryVertexCollection> L1VertexHandle; + iEvent.getByToken(pvToken, L1VertexHandle); + std::vector<TkPrimaryVertex>::const_iterator vtxIter; + + // L1 track-trigger jets + edm::Handle<TkJetCollection> L1TkJetsHandle; + iEvent.getByToken(jetToken, L1TkJetsHandle); + std::vector<TkJet>::const_iterator jetIter; + + if ( !L1TkJetsHandle.isValid() && !displaced ) { + LogError("TkHTMissProducer") << "\nWarning: TkJetCollection not found in the event. Exit\n"; + return; + } + + if ( !L1TkJetsHandle.isValid() && displaced ) { + LogError("TkHTMissProducer") << "\nWarning: TkJetExtendedCollection not found in the event. Exit\n"; + return; + } + + // ---------------------------------------------------------------------------------------------- + // if primaryVtxConstrain, use the primary vertex instead of z position from leading jet + // ---------------------------------------------------------------------------------------------- + float evt_zvtx = 999; + bool found_vtx = false; + edm::Ref< TkPrimaryVertexCollection > L1VtxRef; // null reference + + if (useCaloJets){ + if (doVtxConstrain && primaryVtxConstrain) { + if( !L1VertexHandle.isValid() ) { + LogError("L1TkHTMissProducer")<< "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; + return ; + } + else { + std::vector<TkPrimaryVertex>::const_iterator vtxIter = L1VertexHandle->begin(); + // by convention, the first vertex in the collection is the one that should + // be used by default + evt_zvtx = vtxIter->zvertex(); + found_vtx = true; + int ivtx = 0; + edm::Ref< TkPrimaryVertexCollection > vtxRef(L1VertexHandle, ivtx); + L1VtxRef = vtxRef; + } + } //endif primaryVtxConstrain + + // ---------------------------------------------------------------------------------------------- + // using z position of leading jet to define "event vertex" + // ---------------------------------------------------------------------------------------------- + float zvtx_jetpt = -1.0; //pt of jet determining the event vertex + float jet_vtxMax = 99.; //find z position of leading jet that has a z vertex! + + if (doVtxConstrain && !primaryVtxConstrain) { + for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { + int ibx = jetIter->bx(); // only consider jets from the central BX + if (ibx != 0) continue; + + float tmp_jet_vtx = jetIter->jetVtx(); + float tmp_jet_pt = jetIter->pt(); + float tmp_jet_eta = jetIter->eta(); + if (tmp_jet_pt < jet_minPt) continue; + if (fabs(tmp_jet_eta) > jet_maxEta) continue; + if (fabs(tmp_jet_vtx) > jet_vtxMax) continue; + + // find vertex position of leading jet + if (tmp_jet_pt > zvtx_jetpt) { + evt_zvtx = tmp_jet_vtx; + zvtx_jetpt = tmp_jet_pt; + found_vtx = true; + } + } //end loop over jets + } //endif z position from leading jet + + float sumPx_calo = 0; + float sumPy_calo = 0; + float HT_calo = 0; + + if (doVtxConstrain && !found_vtx) LogWarning("L1TkHTMissProducer") + << "Didn't find any z vertex (based on jet vertices) for this event!\n"; + + // loop over jets + for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { + int ibx = jetIter->bx(); // only consider jets from the central BX + if (ibx != 0) continue; + + float tmp_jet_px = jetIter->px(); + float tmp_jet_py = jetIter->py(); + float tmp_jet_et = jetIter->et(); + float tmp_jet_vtx = jetIter->jetVtx(); + float tmp_jet_pt = jetIter->pt(); + float tmp_jet_eta = jetIter->eta(); + if (tmp_jet_pt < jet_minPt) continue; + if (fabs(tmp_jet_eta) > jet_maxEta) continue; + + // vertex consistency requirement + bool VtxRequirement = false; + if (found_vtx) VtxRequirement = fabs(tmp_jet_vtx - evt_zvtx) < deltaZ; + + if (!doVtxConstrain || VtxRequirement) { + sumPx_calo += tmp_jet_px; + sumPy_calo += tmp_jet_py; + HT_calo += tmp_jet_et; + } + } //end loop over jets + + // define missing HT + float et = sqrt(sumPx_calo*sumPx_calo + sumPy_calo*sumPy_calo); + math::XYZTLorentzVector missingEt(-sumPx_calo, -sumPy_calo, 0, et); + edm::RefProd<TkJetCollection> jetCollRef(L1TkJetsHandle); + TkHTMiss tkHTM(missingEt, HT_calo, jetCollRef, L1VtxRef); + + if (doVtxConstrain && !primaryVtxConstrain) { + tkHTM.setVtx(evt_zvtx); + } + + MHTCollection->push_back(tkHTM); + iEvent.put(std::move(MHTCollection), "L1TkCaloHTMiss"); + } + + else { // Using standalone jets + float sumPx = 0; + float sumPy = 0; + float HT = 0; + + // loop over jets + for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { + float tmp_jet_px = jetIter->px(); + float tmp_jet_py = jetIter->py(); + float tmp_jet_et = jetIter->et(); + float tmp_jet_pt = jetIter->pt(); + float tmp_jet_eta = jetIter->eta(); + if (tmp_jet_pt < jet_minPt) continue; + if (fabs(tmp_jet_eta) > jet_maxEta) continue; + if(jetIter->ntracks()<minNtracksLowPt && tmp_jet_et>50)continue; + if(jetIter->ntracks()<minNtracksHighPt && tmp_jet_et>100)continue; + sumPx += tmp_jet_px; + sumPy += tmp_jet_py; + HT += tmp_jet_pt; + } // end jet loop + + // define missing HT + float et = sqrt(sumPx*sumPx + sumPy*sumPy); + math::XYZTLorentzVector missingEt(-sumPx, -sumPy, 0, et); + edm::RefProd<TkJetCollection> jetCollRef(L1TkJetsHandle); + TkHTMiss tkHTM(missingEt, HT, jetCollRef, L1VtxRef); + + MHTCollection->push_back(tkHTM); + if (displaced) iEvent.put( std::move(MHTCollection), "L1TrackerHTMissExtended"); + else iEvent.put( std::move(MHTCollection), "L1TrackerHTMiss"); + } +} //end producer + +void L1TkHTMissProducer::beginJob() { } + +void L1TkHTMissProducer::endJob() { } + +DEFINE_FWK_MODULE(L1TkHTMissProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc new file mode 100644 index 0000000000000..73d743ba8f985 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc @@ -0,0 +1,207 @@ +/////////////////////////////////////////////////////////////////////////// +// // +// Producer of TkJet, // +// Cluster L1 tracks using fastjet // +// // +/////////////////////////////////////////////////////////////////////////// + +// system include files +#include <memory> + +// 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/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "DataFormats/Common/interface/Handle.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/CommonDetUnit/interface/PixelGeomDetUnit.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "DataFormats/Math/interface/LorentzVector.h" + +// L1 objects +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TCorrelator/interface/TkJet.h" +#include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + +// geometry +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "RecoJets/JetProducers/plugins/VirtualJetProducer.h" + +#include <string> +#include "TMath.h" +#include "TH1.h" + +using namespace l1t; +using namespace edm; +using namespace std; + +////////////////////////////// +// // +// CLASS DEFINITION // +// // +////////////////////////////// + +class L1TrackFastJetProducer : public edm::EDProducer +{ +public: + + typedef TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType; + typedef std::vector< L1TTTrackType > L1TTTrackCollectionType; + + explicit L1TrackFastJetProducer(const edm::ParameterSet&); + ~L1TrackFastJetProducer(); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + virtual void beginJob() ; + virtual void produce(edm::Event&, const edm::EventSetup&); + virtual void endJob() ; + + // track selection criteria + float trk_zMax; // in [cm] + float trk_chi2dofMax; // maximum track chi2dof + double trk_bendChi2Max; // maximum track bendchi2 + float trk_ptMin; // in [GeV] + float trk_etaMax; // in [rad] + int trk_nStubMin; // minimum number of stubs + int trk_nPSStubMin; // minimum number of PS stubs + double deltaZ0Cut; // save with |L1z-z0| < maxZ0 + double coneSize; // Use anti-kt with this cone size + bool doTightChi2; + bool displaced; //use prompt/displaced tracks + + const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken; + edm::EDGetTokenT<TkPrimaryVertexCollection> PVertexToken; +}; + +// constructor +L1TrackFastJetProducer::L1TrackFastJetProducer(const edm::ParameterSet& iConfig) : +trackToken(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))), +PVertexToken(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1PrimaryVertexTag"))) +{ + trk_zMax = (float)iConfig.getParameter<double>("trk_zMax"); + trk_chi2dofMax = (float)iConfig.getParameter<double>("trk_chi2dofMax"); + trk_bendChi2Max = iConfig.getParameter<double>("trk_bendChi2Max"); + trk_ptMin = (float)iConfig.getParameter<double>("trk_ptMin"); + trk_etaMax = (float)iConfig.getParameter<double>("trk_etaMax"); + trk_nStubMin = (int)iConfig.getParameter<int>("trk_nStubMin"); + trk_nPSStubMin = (int)iConfig.getParameter<int>("trk_nPSStubMin"); + deltaZ0Cut = (float)iConfig.getParameter<double>("deltaZ0Cut"); + coneSize = (float)iConfig.getParameter<double>("coneSize"); + doTightChi2 = iConfig.getParameter<bool>("doTightChi2"); + displaced = iConfig.getParameter<bool>("displaced"); + if (displaced) produces<TkJetCollection>("L1TrackFastJetsExtended"); + else produces<TkJetCollection>("L1TrackFastJets"); +} + +// destructor +L1TrackFastJetProducer::~L1TrackFastJetProducer() { } + +// producer +void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + std::unique_ptr<TkJetCollection> L1TrackFastJets(new TkJetCollection); + + // L1 tracks + edm::Handle< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > TTTrackHandle; + iEvent.getByToken(trackToken, TTTrackHandle); + std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator iterL1Track; + + // Tracker Topology + edm::ESHandle<TrackerTopology> tTopoHandle_; + iSetup.get<TrackerTopologyRcd>().get(tTopoHandle_); + const TrackerTopology* tTopo = tTopoHandle_.product(); + ESHandle<TrackerGeometry> tGeomHandle; + iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); + + edm::Handle<TkPrimaryVertexCollection>TkPrimaryVertexHandle; + iEvent.getByToken(PVertexToken, TkPrimaryVertexHandle); + + fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, coneSize); + std::vector<fastjet::PseudoJet> JetInputs; + + float recoVtx = TkPrimaryVertexHandle->begin()->zvertex(); + unsigned int this_l1track = 0; + for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { + this_l1track++; + float trk_pt = iterL1Track->momentum().perp(); + float trk_z0 = iterL1Track->z0(); + float trk_chi2dof = iterL1Track->chi2Red(); + float trk_bendchi2 = iterL1Track->stubPtConsistency(); + std::vector< edm::Ref<edmNew::DetSetVector< TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > theStubs = iterL1Track -> getStubRefs() ; + int trk_nstub = (int)theStubs.size(); + + if (fabs(trk_z0) > trk_zMax) continue; + if (fabs(iterL1Track->momentum().eta()) > trk_etaMax) continue; + if (trk_pt < trk_ptMin) continue; + if (trk_nstub < trk_nStubMin) continue; + if (trk_chi2dof>trk_chi2dofMax) continue; + if (trk_bendchi2 > trk_bendChi2Max) continue; + if (doTightChi2 && (trk_pt>20.0 && trk_chi2dof>5.0)) continue; + + int trk_nPS = 0; + for (int istub=0; istub<trk_nstub; istub++) { + DetId detId( theStubs.at(istub)->getDetId() ); + bool tmp_isPS = false; + if (detId.det() == DetId::Detector::Tracker) { + if (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) tmp_isPS = true; + else if (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) tmp_isPS = true; + } + if (tmp_isPS) trk_nPS++; + } + if (trk_nPS < trk_nPSStubMin) continue; + if (fabs(recoVtx-trk_z0) > deltaZ0Cut) continue; + + fastjet::PseudoJet psuedoJet(iterL1Track->momentum().x(), iterL1Track->momentum().y(), iterL1Track->momentum().z(), iterL1Track->momentum().mag()); + JetInputs.push_back(psuedoJet); // input tracks for clustering + JetInputs.back().set_user_index(this_l1track-1); // save track index in the collection + } // end loop over tracks + + fastjet::ClusterSequence cs(JetInputs,jet_def); // define the output jet collection + std::vector<fastjet::PseudoJet> JetOutputs=fastjet::sorted_by_pt(cs.inclusive_jets(0)); // output jet collection, pT-ordered + + for (unsigned int ijet=0;ijet<JetOutputs.size();++ijet) { + math::XYZTLorentzVector jetP4(JetOutputs[ijet].px(),JetOutputs[ijet].py(),JetOutputs[ijet].pz(),JetOutputs[ijet].modp()); + float sumpt = 0; + float avgZ = 0; + std::vector< edm::Ptr< L1TTTrackType > > L1TrackPtrs; + std::vector<fastjet::PseudoJet> fjConstituents =fastjet::sorted_by_pt(cs.constituents(JetOutputs[ijet])); + + for (unsigned int i=0; i<fjConstituents.size(); ++i) { + auto index = fjConstituents[i].user_index(); + edm::Ptr< L1TTTrackType > trkPtr(TTTrackHandle, index) ; + L1TrackPtrs.push_back(trkPtr); // L1Tracks in the jet + sumpt = sumpt+trkPtr->momentum().perp(); + avgZ = avgZ+trkPtr->momentum().perp()*trkPtr->z0(); + } + avgZ = avgZ/sumpt; + edm::Ref<JetBxCollection> jetRef; + TkJet trkJet(jetP4, jetRef, L1TrackPtrs, avgZ); + L1TrackFastJets->push_back(trkJet); + }//end loop over Jet Outputs + + if (displaced) iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJetsExtended"); + else iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJets"); +} + +void L1TrackFastJetProducer::beginJob() { } + +void L1TrackFastJetProducer::endJob() { } + +void L1TrackFastJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TrackFastJetProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc new file mode 100644 index 0000000000000..a0e98ee0ca376 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc @@ -0,0 +1,628 @@ +// Original Author: Rishi Patel +// Created: Wed, 01 Aug 2018 14:01:41 GMT +// +// Track jets are clustered in a two-layer process, first by clustering in phi, +// then by clustering in eta +// Introduction to object (p10-13): +// https://indico.cern.ch/event/791517/contributions/3341650/attachments/1818736/2973771/TrackBasedAlgos_L1TMadrid_MacDonald.pdf + +// system include files + +#include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/L1TCorrelator/interface/TkJet.h" +#include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TrackTrigger/interface/TTTrack.h" +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/StreamID.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/CommonTopologies/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelGeomDetType.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" + + +#include <memory> +#include <iostream> +#include <fstream> +#include <math.h> +#include <stdlib.h> +#include <string> +#include <cstdlib> +#include "TH1D.h" +#include "TH2D.h" +#include <TMath.h> +#include "L1TrackJetProducer.h" + + +using namespace std; +using namespace edm; +using namespace l1t; +class L1TrackJetProducer : public stream::EDProducer<> { +public: + explicit L1TrackJetProducer(const ParameterSet&); + ~L1TrackJetProducer(); + typedef TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType; + typedef vector< L1TTTrackType > L1TTTrackCollectionType; + + static void fillDescriptions(ConfigurationDescriptions& descriptions); + bool TrackQualityCuts(float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0); + void L2_cluster(vector< Ptr<L1TTTrackType> > L1trk_ptrs, vector<int> ttrk, vector<int> tdtrk,vector<int> ttdtrk, maxzbin &mzb); + virtual etaphibin *L1_cluster(etaphibin *phislice); + +private: + virtual void beginStream(StreamID) override; + virtual void produce(Event&, const EventSetup&) override; + virtual void endStream() override; + const EDGetTokenT<vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken; + vector< Ptr< L1TTTrackType > > L1trk_ptrs; + vector<int> zbincount; + vector<int> ttrk; + vector<int> tdtrk; + vector<int> ttdtrk; + float trk_zMax; + float trk_ptMax; + float trk_ptMin; + float trk_etaMax; + float trk_chi2dofMax; + float trk_bendChi2Max; + int trk_nPSStubMin; + int lowpTJetMinTrackMultiplicity; + int highpTJetMinTrackMultiplicity; + int zBins; + int etaBins; + int phiBins; + double minTrkJetpT; + float zStep; + float etaStep; + float phiStep; + bool displaced; + float d0_cutNStubs4; + float d0_cutNStubs5; + float nStubs4DisplacedChi2_Loose; + float nStubs5DisplacedChi2_Loose; + float nStubs4Displacedbend_Loose; + float nStubs5Displacedbend_Loose; + float nStubs4DisplacedChi2_Tight; + float nStubs5DisplacedChi2_Tight; + float nStubs4Displacedbend_Tight; + float nStubs5Displacedbend_Tight; +}; + +L1TrackJetProducer::L1TrackJetProducer(const ParameterSet& iConfig): +trackToken(consumes< vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<InputTag>("L1TrackInputTag"))) +{ + trk_zMax = (float)iConfig.getParameter<double>("trk_zMax"); + trk_ptMax =(float)iConfig.getParameter<double>("trk_ptMax"); + trk_ptMin=(float)iConfig.getParameter<double>("trk_ptMin"); + trk_etaMax=(float)iConfig.getParameter<double>("trk_etaMax"); + trk_chi2dofMax=(float)iConfig.getParameter<double>("trk_chi2dofMax"); + trk_bendChi2Max=(float)iConfig.getParameter<double>("trk_bendChi2Max"); + trk_nPSStubMin=(int)iConfig.getParameter<int>("trk_nPSStubMin"); + minTrkJetpT=iConfig.getParameter<double>("minTrkJetpT"); + etaBins=(int)iConfig.getParameter<int>("etaBins"); + phiBins=(int)iConfig.getParameter<int>("phiBins"); + zBins=(int)iConfig.getParameter<int>("zBins"); + d0_cutNStubs4=(float)iConfig.getParameter<double>("d0_cutNStubs4"); + d0_cutNStubs5=(float)iConfig.getParameter<double>("d0_cutNStubs5"); + lowpTJetMinTrackMultiplicity=(int)iConfig.getParameter<int>("lowpTJetMinTrackMultiplicity"); + highpTJetMinTrackMultiplicity=(int)iConfig.getParameter<int>("highpTJetMinTrackMultiplicity"); + displaced=iConfig.getParameter<bool>("displaced"); + nStubs4DisplacedChi2_Loose=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Loose"); + nStubs5DisplacedChi2_Loose=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Loose"); + nStubs4Displacedbend_Loose=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Loose"); + nStubs5Displacedbend_Loose=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Loose"); + nStubs4DisplacedChi2_Tight=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Tight"); + nStubs5DisplacedChi2_Tight=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Tight"); + nStubs4Displacedbend_Tight=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Tight"); + nStubs5Displacedbend_Tight=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Tight"); + + zStep = 2.0 * trk_zMax / zBins; + etaStep = 2.0 * trk_etaMax / etaBins; //etaStep is the width of an etabin + phiStep = 2 * M_PI / phiBins; ////phiStep is the width of a phibin + + if (displaced) produces<TkJetCollection>("L1TrackJetsExtended"); + else produces<TkJetCollection>("L1TrackJets"); +} + +L1TrackJetProducer::~L1TrackJetProducer() { } + +void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { + + unique_ptr<TkJetCollection> L1L1TrackJetProducer(new TkJetCollection); + + // For TTStubs + ESHandle<TrackerTopology> tTopoHandle; + iSetup.get<TrackerTopologyRcd>().get(tTopoHandle); + ESHandle<TrackerGeometry> tGeomHandle; + iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); + const TrackerTopology* const tTopo = tTopoHandle.product(); + + edm::Handle< vector< TTTrack< Ref_Phase2TrackerDigi_ > > > TTTrackHandle; + iEvent.getByToken(trackToken, TTTrackHandle); + vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator iterL1Track; + + L1trk_ptrs.clear(); + zbincount.clear(); + ttrk.clear(); + tdtrk.clear(); + ttdtrk.clear(); + + unsigned int this_l1track = 0; + for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { + edm::Ptr< L1TTTrackType > trkPtr(TTTrackHandle, this_l1track); + this_l1track++; + float trk_pt = trkPtr->momentum().perp(); + int trk_nstubs = (int)trkPtr->getStubRefs().size(); + float trk_chi2dof = trkPtr->chi2Red(); + float trk_d0 = trkPtr->d0(); + float trk_bendchi2 = trkPtr->stubPtConsistency(); + + int trk_nPS = 0; + for (int istub=0; istub<trk_nstubs; istub++) { // loop over the stubs + DetId detId( trkPtr->getStubRefs().at(istub)->getDetId() ); + if (detId.det() == DetId::Detector::Tracker) { + if ( (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || + (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) ) trk_nPS++; + } + } + + if (trk_nPS < trk_nPSStubMin) continue; + if (!TrackQualityCuts(trk_pt, trk_nstubs, trk_chi2dof, trk_bendchi2, fabs(trk_d0))) continue; + if (fabs(iterL1Track->z0()) > trk_zMax) continue; + if (fabs(iterL1Track->momentum().eta()) > trk_etaMax) continue; + if (trk_pt < trk_ptMin) continue; + L1trk_ptrs.push_back(trkPtr); + zbincount.push_back(0); + + if ((fabs(trk_d0)>d0_cutNStubs5 && trk_nstubs>=5)||(trk_nstubs==4 && fabs(trk_d0)>d0_cutNStubs4)) tdtrk.push_back(1); + else tdtrk.push_back(0); //displaced track + if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2_Tight && trk_bendchi2<nStubs5Displacedbend_Tight ) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2_Tight && trk_bendchi2<nStubs4Displacedbend_Tight )) ttrk.push_back(1); + else ttrk.push_back(0); + if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2_Tight && trk_bendchi2<nStubs5Displacedbend_Tight && fabs(trk_d0)>d0_cutNStubs5) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2_Tight && trk_bendchi2<nStubs4Displacedbend_Tight && fabs(trk_d0)>d0_cutNStubs4)) ttdtrk.push_back(1); + else ttdtrk.push_back(0); + } + + if (L1trk_ptrs.size()>0) { + maxzbin mzb; + + L2_cluster(L1trk_ptrs, ttrk, tdtrk,ttdtrk,mzb); + edm::Ref< JetBxCollection > jetRef; //null, no Calo Jet Ref + vector< Ptr< L1TTTrackType > > L1TrackAssocJet; + if (mzb.clusters!=NULL) { + for (int j=0; j<mzb.nclust; ++j) { + //FILL Two Layer Jets for Jet Collection + if (mzb.clusters[j].pTtot<=trk_ptMin) continue; //protects against reading bad memory + if (mzb.clusters[j].numtracks<1) continue; + if (mzb.clusters[j].numtracks>5000) continue; + float jetEta = mzb.clusters[j].eta; + float jetPhi = mzb.clusters[j].phi; + float jetPt = mzb.clusters[j].pTtot; + float jetPx = jetPt*cos(jetPhi); + float jetPy = jetPt*sin(jetPhi); + float jetPz = jetPt*sinh(jetEta); + float jetP = jetPt*cosh(jetEta); + int totalTighttrk = mzb.clusters[j].numttrks; + int totalDisptrk = mzb.clusters[j].numtdtrks; + int totalTightDisptrk = mzb.clusters[j].numttdtrks; + + math::XYZTLorentzVector jetP4(jetPx,jetPy,jetPz,jetP); + L1TrackAssocJet.clear(); + for (unsigned int t=0; t<L1trk_ptrs.size(); ++t) { + if (L1TrackAssocJet.size()==(unsigned int)mzb.clusters[j].numtracks) break; + float deta = L1trk_ptrs[t]->momentum().eta() - jetEta; + float dphi = L1trk_ptrs[t]->momentum().phi() - jetPhi; + float dZ = fabs(mzb.zbincenter - L1trk_ptrs[t]->z0()); + if (dZ<zStep && fabs(deta)<etaStep*2.0 && fabs(dphi)<phiStep*2.0) { + L1TrackAssocJet.push_back(L1trk_ptrs[t]); + } + } + TkJet trkJet(jetP4, L1TrackAssocJet, mzb.zbincenter, mzb.clusters[j].numtracks, totalTighttrk, totalDisptrk, totalTightDisptrk); + //trkJet.setDispCounters(DispCounters); + if (L1TrackAssocJet.size()>0) L1L1TrackJetProducer->push_back(trkJet); + } + } + //free(mzb.clusters); + if (displaced) iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJetsExtended"); + else iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJets"); + delete[] mzb.clusters; + } +} + +void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, vector<int>ttrk, vector<int>tdtrk, vector<int>ttdtrk, maxzbin &mzb) { + const int nz = zBins; + maxzbin all_zBins[nz]; + maxzbin mzbtemp; + for (int z=0; z<nz; ++z) all_zBins[z] = mzbtemp; + + if (all_zBins==NULL) { + edm::LogWarning("L1TrackJetProducer")<<" \"all_zBins\" memory not assigned!\n"; + return; + } + + float zmin = -1.0*trk_zMax; + float zmax = zmin + 2*zStep; + + etaphibin epbins[phiBins][etaBins]; // create grid of phiBins + float phi = -1.0 * M_PI; + float eta; + float etamin, etamax, phimin, phimax; + for (int i = 0; i<phiBins; ++i) { + eta = -1.0 * trk_etaMax; + for (int j = 0; j<etaBins; ++j) { + phimin = phi; + phimax = phi + phiStep; + etamin = eta; + eta = eta + etaStep; + etamax = eta; + epbins[i][j].phi = (phimin+phimax)/2.0; + epbins[i][j].eta = (etamin+etamax)/2.0; + } // for each etabin + phi = phi+phiStep; + } // for each phibin (finished creating epbins) + mzb = all_zBins[0]; + int ntracks=L1trk_ptrs.size(); + // uninitalized arrays + etaphibin *L1clusters[phiBins]; + etaphibin L2cluster[ntracks]; + + for (int zbin=0; zbin<zBins-1; ++zbin) { + for (int i=0; i<phiBins; ++i) { //First initialize pT, numtracks, used to 0 (or false) + for (int j=0; j<etaBins; ++j) { + epbins[i][j].pTtot = 0; + epbins[i][j].used = false; + epbins[i][j].numtracks = 0; + epbins[i][j].numttrks = 0; + epbins[i][j].numtdtrks = 0; + epbins[i][j].numttdtrks = 0; + } //for each etabin + L1clusters[i] = epbins[i]; + } //for each phibin + + for (unsigned int k=0; k<L1trk_ptrs.size(); ++k) { + float trkpt = L1trk_ptrs[k]->momentum().perp(); + float trketa = L1trk_ptrs[k]->momentum().eta(); + float trkphi = L1trk_ptrs[k]->momentum().phi(); + float trkZ = L1trk_ptrs[k]->z0(); + + for (int i=0; i<phiBins; ++i) { + for (int j=0; j<etaBins; ++j) { + L2cluster[k] = epbins[i][j]; + if ((zmin<=trkZ && zmax>=trkZ) && + ((epbins[i][j].eta - etaStep/2.0 <= trketa && epbins[i][j].eta + etaStep/2.0 >= trketa) + && epbins[i][j].phi - phiStep/2.0 <= trkphi && epbins[i][j].phi + phiStep/2.0 >= trkphi + && (zbincount[k] != 2))) { + zbincount.at(k) = zbincount.at(k)+1; + if (trkpt<trk_ptMax) epbins[i][j].pTtot+=trkpt; + else epbins[i][j].pTtot+=trk_ptMax; + epbins[i][j].numttrks+=ttrk[k]; + epbins[i][j].numtdtrks+=tdtrk[k]; + epbins[i][j].numttdtrks+=ttdtrk[k]; + ++epbins[i][j].numtracks; + } // if right bin + } // for each phibin: j loop + } // for each phibin: i loop + } // end loop over tracks + + for (int phislice=0; phislice<phiBins; ++phislice) { + L1clusters[phislice] = L1_cluster(epbins[phislice]); + for (int ind=0; L1clusters[phislice][ind].pTtot!=0; ++ind) { + L1clusters[phislice][ind].used = false; + } + } + + //Create clusters array to hold output cluster data for Layer2; can't have more clusters than tracks. + //Find eta-phibin with maxpT, make center of cluster, add neighbors if not already used. + float hipT = 0; + int nclust = 0; + int phibin = 0; + int imax = -1; + int index1; //index of clusters array for each phislice + float E1 = 0; + float E0 = 0; + float E2 = 0; + int trx1, trx2; + int ttrk1, ttrk2; + int tdtrk1, tdtrk2; + int ttdtrk1, ttdtrk2; + int used1, used2, used3, used4; + + for (phibin=0; phibin<phiBins; ++phibin) { //Find eta-phibin with highest pT + while(true) { + hipT = 0; + for (index1=0; L1clusters[phibin][index1].pTtot>0; ++index1) { + if (!L1clusters[phibin][index1].used && L1clusters[phibin][index1].pTtot >= hipT) { + hipT = L1clusters[phibin][index1].pTtot; + imax = index1; + } + } // for each index within the phibin + + if (hipT == 0) + break; // If highest pT is 0, all bins are used + E0 = hipT; // E0 is pT of first phibin of the cluster + E1 = 0; + E2 = 0; + trx1 = 0; + trx2 = 0; + ttrk1 = 0; + ttrk2 = 0; + tdtrk1 = 0; + tdtrk2 = 0; + ttdtrk1 = 0; + ttdtrk2 = 0; + L2cluster[nclust] = L1clusters[phibin][imax]; + L1clusters[phibin][imax].used = true; + // Add pT of upper neighbor + // E1 is pT of the middle phibin (should be highest pT) + if (phibin != phiBins-1) { + used1 = -1; + used2 = -1; + for (index1 = 0; L1clusters[phibin+1][index1].pTtot != 0; ++index1) { + if (L1clusters[phibin+1][index1].used) continue; + if (fabs(L1clusters[phibin+1][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep) { + E1 += L1clusters[phibin+1][index1].pTtot; + trx1 += L1clusters[phibin+1][index1].numtracks; + ttrk1 += L1clusters[phibin+1][index1].numttrks; + tdtrk1 += L1clusters[phibin+1][index1].numtdtrks; + ttdtrk1 += L1clusters[phibin+1][index1].numttdtrks; + if (used1<0) + used1 = index1; + else + used2 = index1; + } // if cluster is within one phibin + } // for each cluster in above phibin + + if (E1<E0) { // if E1 isn't higher, E0 and E1 are their own cluster + L2cluster[nclust].pTtot += E1; + L2cluster[nclust].numtracks += trx1; + L2cluster[nclust].numttrks += ttrk1; + L2cluster[nclust].numtdtrks += tdtrk1; + L2cluster[nclust].numttdtrks += ttdtrk1; + if (used1 >= 0) + L1clusters[phibin+1][used1].used = true; + if (used2 >= 0) + L1clusters[phibin+1][used2].used = true; + nclust++; + continue; + } + + if (phibin != phiBins-2) { // E2 will be the pT of the third phibin (should be lower than E1) + used3 = -1; + used4 = -1; + for (index1 = 0; L1clusters[phibin+2][index1].pTtot != 0; ++index1) { + if (L1clusters[phibin+2][index1].used) + continue; + if (fabs(L1clusters[phibin+2][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep) { + E2 += L1clusters[phibin+2][index1].pTtot; + trx2 += L1clusters[phibin+2][index1].numtracks; + ttrk2 += L1clusters[phibin+2][index1].numttrks; + tdtrk2 += L1clusters[phibin+2][index1].numtdtrks; + ttdtrk2 += L1clusters[phibin+2][index1].numttdtrks; + if (used3<0) + used3 = index1; + else + used4 = index1; + } + } + // if indeed E2 < E1, add E1 and E2 to E0, they're all a cluster together + // otherwise, E0 is its own cluster + if (E2<E1) { + L2cluster[nclust].pTtot += E1 + E2; + L2cluster[nclust].numtracks += trx1 + trx2; + L2cluster[nclust].numttrks += ttrk1 + ttrk2; + L2cluster[nclust].numtdtrks += tdtrk1 + tdtrk2; + L2cluster[nclust].numttdtrks += ttdtrk1 + ttdtrk2; + L2cluster[nclust].phi = L1clusters[phibin+1][used1].phi; + if (used1 >= 0) + L1clusters[phibin+1][used1].used = true; + if (used2 >= 0) + L1clusters[phibin+1][used2].used = true; + if (used3 >= 0) + L1clusters[phibin+2][used3].used = true; + if (used4 >= 0) + L1clusters[phibin+2][used4].used = true; + } + nclust++; + continue; + } // end Not phiBins-2 + else { + L2cluster[nclust].pTtot += E1; + L2cluster[nclust].numtracks += trx1; + L2cluster[nclust].numttrks += ttrk1; + L2cluster[nclust].numtdtrks += tdtrk1; + L2cluster[nclust].numttdtrks += ttdtrk1; + L2cluster[nclust].phi = L1clusters[phibin+1][used1].phi; + if (used1 >= 0) + L1clusters[phibin+1][used1].used = true; + if (used2 >= 0) + L1clusters[phibin+1][used2].used = true; + nclust++; + continue; + } + } //End not last phibin(23) + else { //if it is phibin 23 + L1clusters[phibin][imax].used = true; + nclust++; + } + } // while hipT not 0 + } // for each phibin + + for (phibin=0; phibin<phiBins; ++phibin) + delete [] L1clusters[phibin]; + + // Now merge clusters, if necessary + for (int m=0; m<nclust-1; ++m) { + for (int n=m+1; n<nclust; ++n) + if (L2cluster[n].eta == L2cluster[m].eta && (fabs(L2cluster[n].phi - L2cluster[m].phi) < 1.5*phiStep || fabs(L2cluster[n].phi - L2cluster[m].phi) > 6.0)) { + if (L2cluster[n].pTtot > L2cluster[m].pTtot) + L2cluster[m].phi = L2cluster[n].phi; + L2cluster[m].pTtot += L2cluster[n].pTtot; + L2cluster[m].numtracks += L2cluster[n].numtracks; + L2cluster[m].numttrks += L2cluster[n].numttrks; + L2cluster[m].numtdtrks += L2cluster[n].numtdtrks; + L2cluster[m].numttdtrks += L2cluster[n].numttdtrks; + for (int m1=n; m1<nclust-1; ++m1) + L2cluster[m1] = L2cluster[m1+1]; + nclust--; + m = -1; + break; //????? + } // end if clusters neighbor in eta + } // end for (m) loop + + // sum up all pTs in this zbin to find ht + float ht = 0; + for (int k=0; k<nclust; ++k) { + if (L2cluster[k].pTtot>50 && L2cluster[k].numtracks<lowpTJetMinTrackMultiplicity) + continue; + if (L2cluster[k].pTtot>100 && L2cluster[k].numtracks<highpTJetMinTrackMultiplicity) + continue; + if (L2cluster[k].pTtot>minTrkJetpT) + ht += L2cluster[k].pTtot; + } + + // if ht is larger than previous max, this is the new vertex zbin + all_zBins[zbin].znum = zbin; + all_zBins[zbin].clusters = new etaphibin[nclust]; + all_zBins[zbin].nclust = nclust; + all_zBins[zbin].zbincenter = (zmin+zmax)/2.0; + for (int k=0; k<nclust; ++k) { + all_zBins[zbin].clusters[k].phi = L2cluster[k].phi; + all_zBins[zbin].clusters[k].eta = L2cluster[k].eta; + all_zBins[zbin].clusters[k].pTtot = L2cluster[k].pTtot; + all_zBins[zbin].clusters[k].numtracks = L2cluster[k].numtracks; + all_zBins[zbin].clusters[k].numttrks = L2cluster[k].numttrks; + all_zBins[zbin].clusters[k].numtdtrks = L2cluster[k].numtdtrks; + all_zBins[zbin].clusters[k].numttdtrks = L2cluster[k].numttdtrks; + } + all_zBins[zbin].ht = ht; + if (ht >= mzb.ht) { + mzb = all_zBins[zbin]; + mzb.zbincenter = (zmin+zmax)/2.0; + } + // Prepare for next zbin! + zmin = zmin+zStep; + zmax = zmax+zStep; + } // for each zbin + for (int zbin=0; zbin<zBins-1; ++zbin) { + if (zbin==mzb.znum) + continue; + delete[] all_zBins[zbin].clusters; + } +} + +etaphibin *L1TrackJetProducer::L1_cluster(etaphibin *phislice) { + etaphibin *clusters = new etaphibin[etaBins/2]; + if (clusters==NULL) + edm::LogWarning("L1TrackJetProducer")<<"Clusters memory not assigned!\n"; + + // Find eta-phibin with maxpT, make center of cluster, add neighbors if not already used + float my_pt, left_pt, right_pt, right2pt; + int nclust = 0; + right2pt = 0; + for (int etabin=0; etabin<etaBins; ++etabin) { + // assign values for my pT and neighbors' pT + if (phislice[etabin].used) + continue; + my_pt = phislice[etabin].pTtot; + if (etabin > 0 && !phislice[etabin-1].used) { + left_pt = phislice[etabin-1].pTtot; + } + else + left_pt = 0; + if (etabin < etaBins-1 && !phislice[etabin+1].used) { + right_pt = phislice[etabin+1].pTtot; + if (etabin < etaBins-2 && !phislice[etabin+2].used) { + right2pt = phislice[etabin+2].pTtot; + } + else + right2pt = 0; + } + else + right_pt = 0; + + // if I'm not a cluster, move on + if (my_pt<left_pt || my_pt<=right_pt) { + // if unused pT in the left neighbor, spit it out as a cluster + if (left_pt>0) { + clusters[nclust] = phislice[etabin-1]; + phislice[etabin-1].used = true; + nclust++; + } + continue; + } + + // I guess I'm a cluster-- should I use my right neighbor? + // Note: left neighbor will definitely be used because if it + // didn't belong to me it would have been used already + clusters[nclust] = phislice[etabin]; + phislice[etabin].used = true; + if (left_pt > 0) { + clusters[nclust].pTtot += left_pt; + clusters[nclust].numtracks += phislice[etabin-1].numtracks; + clusters[nclust].numttrks += phislice[etabin-1].numttrks; + clusters[nclust].numtdtrks += phislice[etabin-1].numtdtrks; + clusters[nclust].numttdtrks += phislice[etabin-1].numttdtrks; + } + if (my_pt >= right2pt && right_pt > 0) { + clusters[nclust].pTtot += right_pt; + clusters[nclust].numtracks += phislice[etabin+1].numtracks; + clusters[nclust].numttrks += phislice[etabin+1].numttrks; + clusters[nclust].numtdtrks += phislice[etabin+1].numtdtrks; + clusters[nclust].numttdtrks += phislice[etabin+1].numttdtrks; + phislice[etabin+1].used = true; + } + nclust++; + } // for each etabin + + // Now merge clusters, if necessary + for (int m = 0; m<nclust-1; ++m) { + if (fabs(clusters[m+1].eta - clusters[m].eta) < 1.5*etaStep) { + if (clusters[m+1].pTtot > clusters[m].pTtot) { + clusters[m].eta = clusters[m+1].eta; + } + clusters[m].pTtot += clusters[m+1].pTtot; + clusters[m].numtracks += clusters[m+1].numtracks; // Previous version didn't add tracks when merging + clusters[m].numttrks += clusters[m+1].numttrks; + clusters[m].numtdtrks += clusters[m+1].numtdtrks; + clusters[m].numttdtrks += clusters[m+1].numttdtrks; + for (int m1 = m+1; m1<nclust-1; ++m1) + clusters[m1] = clusters[m1+1]; + nclust--; + m = -1; + } // end if clusters neighbor in eta + } // end for (m) loop + + for (int i = nclust; i<etaBins/2; ++i) // zero out remaining unused clusters + clusters[i].pTtot = 0; + return clusters; +} + +void L1TrackJetProducer::beginStream(StreamID) { } + +void L1TrackJetProducer::endStream() { } + +bool L1TrackJetProducer::TrackQualityCuts(float trk_pt,int trk_nstub, float trk_chi2,float trk_bendchi2, float trk_d0) { + bool PassQuality=false; + if (trk_bendchi2<trk_bendChi2Max && trk_chi2<trk_chi2dofMax && trk_nstub>=4 && !displaced) PassQuality = true; + if (displaced && trk_bendchi2<nStubs4Displacedbend_Tight && trk_chi2<nStubs4DisplacedChi2_Tight && trk_nstub==4 && trk_d0<=d0_cutNStubs4) PassQuality = true; + if (displaced && trk_bendchi2<nStubs4Displacedbend_Loose && trk_chi2<nStubs4DisplacedChi2_Loose && trk_nstub==4 && trk_d0>d0_cutNStubs4) PassQuality = true; + if (displaced && trk_bendchi2<nStubs5Displacedbend_Loose && trk_chi2<nStubs5DisplacedChi2_Loose && trk_nstub>4) PassQuality = true; + return PassQuality; +} + +void L1TrackJetProducer::fillDescriptions(ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TrackJetProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h new file mode 100644 index 0000000000000..255eeae6e53c7 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h @@ -0,0 +1,30 @@ +#pragma once +#include <iostream> +#include <fstream> +#include <math.h> +#include <stdlib.h> +#include <string> +#include <cstdlib> +using namespace std; + +//Each individual box in the eta and phi dimension. +// Also used to store final cluster data for each zbin. +struct etaphibin { + float pTtot; + int numtracks; + int numttrks; + int numtdtrks; + int numttdtrks; + bool used; + float phi; //average phi value (halfway b/t min and max) + float eta; //average eta value +}; + +//store important information for plots +struct maxzbin { + int znum; //Numbered from 0 to nzbins (16, 32, or 64) in order + int nclust; //number of clusters in this bin + float zbincenter; + etaphibin *clusters; //list of all the clusters in this bin + float ht; //sum of all cluster pTs--only the zbin with the maximum ht is stored +}; diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc new file mode 100644 index 0000000000000..62fa31fd90b96 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -0,0 +1,196 @@ +// Original Author: Emmanuelle Perez,40 1-A28,+41227671915, +// Created: Tue Nov 12 17:03:19 CET 2013 +//Modified by Emily MacDonald, 30 Nov 2018 + +// system include files +#include <memory> + +// 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/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMissFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + +// detector geometry +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" + +using namespace l1t; + +class L1TrackerEtMissProducer : public edm::EDProducer { +public: + typedef TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType; + typedef std::vector< L1TTTrackType > L1TTTrackCollectionType; + + explicit L1TrackerEtMissProducer(const edm::ParameterSet&); + ~L1TrackerEtMissProducer(); + +private: + virtual void beginJob() ; + virtual void produce(edm::Event&, const edm::EventSetup&); + virtual void endJob() ; + + // ----------member data --------------------------- + float maxZ0; // in cm + float deltaZ; // in cm + float maxEta; + float chi2dofMax; + float bendChi2Max; + float minPt; // in GeV + int nStubsmin; + int nPSStubsMin; // minimum number of stubs in PS modules + float maxPt; // in GeV + int highPtTracks; // saturate or truncate + bool displaced; //prompt/displaced tracks + + const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken; + const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken; +}; + +//constructor// +L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) : +pvToken(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), +trackToken(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) +{ + maxZ0 = (float)iConfig.getParameter<double>("maxZ0"); + deltaZ = (float)iConfig.getParameter<double>("deltaZ"); + chi2dofMax = (float)iConfig.getParameter<double>("chi2dofMax"); + bendChi2Max = (float)iConfig.getParameter<double>("bendChi2Max"); + minPt = (float)iConfig.getParameter<double>("minPt"); + nStubsmin = iConfig.getParameter<int>("nStubsmin"); + nPSStubsMin = iConfig.getParameter<int>("nPSStubsMin"); + maxPt = (float)iConfig.getParameter<double>("maxPt"); + maxEta = (float)iConfig.getParameter<double>("maxEta"); + highPtTracks = iConfig.getParameter<int>("highPtTracks"); + displaced = iConfig.getParameter<bool>("displaced"); + + if (displaced) produces<TkEtMissCollection>("L1TrackerEtMissExtended"); + else produces<TkEtMissCollection>("L1TrackerEtMiss"); +} + +L1TrackerEtMissProducer::~L1TrackerEtMissProducer() { } + +void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + std::unique_ptr<TkEtMissCollection> METCollection(new TkEtMissCollection); + + // Tracker Topology + edm::ESHandle<TrackerTopology> tTopoHandle_; + iSetup.get<TrackerTopologyRcd>().get(tTopoHandle_); + const TrackerTopology* tTopo = tTopoHandle_.product(); + + edm::Handle<TkPrimaryVertexCollection> L1VertexHandle; + iEvent.getByToken(pvToken,L1VertexHandle); + + edm::Handle<L1TTTrackCollectionType> L1TTTrackHandle; + iEvent.getByToken(trackToken, L1TTTrackHandle); + L1TTTrackCollectionType::const_iterator trackIter; + + if( !L1VertexHandle.isValid() ) { + LogError("L1TrackerEtMissProducer") + << "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; + return; + } + + if( !L1TTTrackHandle.isValid() ) { + LogError("L1TrackerEtMissProducer") + << "\nWarning: L1TTTrackCollection not found in the event. Exit\n"; + return; + } + + float sumPx = 0; + float sumPy = 0; + float etTot = 0; + double sumPx_PU = 0; + double sumPy_PU = 0; + double etTot_PU = 0; + float zVTX = L1VertexHandle->begin()->zvertex(); + + for (trackIter = L1TTTrackHandle->begin(); trackIter != L1TTTrackHandle->end(); ++trackIter) { + float pt = trackIter->momentum().perp(); + float phi = trackIter->momentum().phi(); + float eta = trackIter->momentum().eta(); + float chi2dof = trackIter->chi2Red(); + float bendChi2 = trackIter->stubPtConsistency(); + float z0 = trackIter->z0(); + std::vector< edm::Ref< edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ > >, TTStub< Ref_Phase2TrackerDigi_ > > > theStubs = trackIter -> getStubRefs() ; + int nstubs = (int) theStubs.size(); + + if (pt < minPt) continue; + if (fabs(z0) > maxZ0) continue; + if (fabs(eta) > maxEta) continue; + if (chi2dof > chi2dofMax) continue; + if (bendChi2 > bendChi2Max) continue; + + if (maxPt > 0 && pt > maxPt) { + if (highPtTracks == 0) continue; // ignore these very high PT tracks: truncate + if (highPtTracks == 1) pt = maxPt; // saturate + } + + int nPS = 0; // number of stubs in PS modules + // loop over the stubs + for (unsigned int istub=0; istub<(unsigned int)theStubs.size(); istub++) { + DetId detId( theStubs.at(istub)->getDetId() ); + if (detId.det() == DetId::Detector::Tracker) { + if ( (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) ) nPS++; + } + } + + if (nstubs < nStubsmin) continue; + if (nPS < nPSStubsMin) continue; + + if (!displaced){ // if displaced, deltaZ = 3.0 cm, very loose + // construct deltaZ cut to be based on track eta + if ( fabs(eta)>=0 && fabs(eta)<0.7) deltaZ = 0.4; + else if ( fabs(eta)>=0.7 && fabs(eta)<1.0) deltaZ = 0.6; + else if ( fabs(eta)>=1.0 && fabs(eta)<1.2) deltaZ = 0.76; + else if ( fabs(eta)>=1.2 && fabs(eta)<1.6) deltaZ = 1.0; + else if ( fabs(eta)>=1.6 && fabs(eta)<2.0) deltaZ = 1.7; + else if ( fabs(eta)>=2.0 && fabs(eta)<=2.4) deltaZ = 2.2; + } + + if ( fabs(z0 - zVTX) <= deltaZ) { + sumPx += pt*cos(phi); + sumPy += pt*sin(phi); + etTot += pt; + } + else { // PU sums + sumPx_PU += pt*cos(phi); + sumPy_PU += pt*sin(phi); + etTot_PU += pt; + } + } // end loop over tracks + + float et = sqrt(sumPx*sumPx + sumPy*sumPy); + double etmiss_PU = sqrt(sumPx_PU*sumPx_PU + sumPy_PU*sumPy_PU); + + math::XYZTLorentzVector missingEt( -sumPx, -sumPy, 0, et); + int ibx = 0; + METCollection->push_back( TkEtMiss( missingEt, + TkEtMiss::kMET, + etTot, + etmiss_PU, + etTot_PU, + ibx ) + ); + + if (displaced) iEvent.put( std::move(METCollection), "L1TrackerEtMissExtended"); + else iEvent.put( std::move(METCollection), "L1TrackerEtMiss"); +} // end producer + +void L1TrackerEtMissProducer::beginJob() { } + +void L1TrackerEtMissProducer::endJob() { } + +DEFINE_FWK_MODULE(L1TrackerEtMissProducer); diff --git a/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py new file mode 100644 index 0000000000000..001e67a9c2b66 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py @@ -0,0 +1,46 @@ +import FWCore.ParameterSet.Config as cms + +L1TkCaloHTMiss = cms.EDProducer("L1TkHTMissProducer", + L1TkJetInputTag = cms.InputTag("L1TkCaloJets", "L1TkCaloJets"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + jet_maxEta = cms.double(2.2), # maximum eta of jets for HT + jet_minPt = cms.double(15.0), # minimum pt of jets for HT [GeV] + jet_minNtracksHighPt=cms.int32(0), #Add track jet quality criteria pT>100 + jet_minNtracksLowPt=cms.int32(0), #Add track jet quality criteria pT>50 + doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 + deltaZ = cms.double(1.0), # require jets to have |z_jet - z_ref| below deltaZ [cm] + primaryVtxConstrain = cms.bool(False), # use primary vertex instead of leading jet as reference z position + useCaloJets = cms.bool(True), # determines whether matched jets or standalone jets are used for MHT + displaced = cms.bool(False) #Run with prompt/displaced jets - only useful for track jets +) + +L1TkCaloHTMissVtx = L1TkCaloHTMiss.clone() +L1TkCaloHTMiss.doVtxConstrain = cms.bool(True) + +L1TrackerHTMiss = cms.EDProducer("L1TkHTMissProducer", + L1TkJetInputTag = cms.InputTag("L1TrackJets", "L1TrackJets"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + jet_maxEta = cms.double(2.4), + jet_minPt = cms.double(5.0), + jet_minNtracksLowPt=cms.int32(2), + jet_minNtracksHighPt=cms.int32(3), + useCaloJets = cms.bool(False), + doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 + deltaZ = cms.double(1.0), # This is a dummy value for track only jets + primaryVtxConstrain = cms.bool(False), # primary vertex already applied to track jet collections + displaced = cms.bool(False) # Run with prompt/displaced jets +) + +L1TrackerHTMissExtended = cms.EDProducer("L1TkHTMissProducer", + L1TkJetInputTag = cms.InputTag("L1TrackJetsExtended", "L1TrackJetsExtended"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + jet_maxEta = cms.double(2.4), + jet_minPt = cms.double(5.0), + jet_minNtracksLowPt=cms.int32(2), + jet_minNtracksHighPt=cms.int32(3), + useCaloJets = cms.bool(False), + doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 + deltaZ = cms.double(1.0), # This is a dummy value for track only jets + primaryVtxConstrain = cms.bool(False), # primary vertex already applied to track jet collections + displaced = cms.bool(True) # Run with prompt/displaced jets +) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackFastJetProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackFastJetProducer_cfi.py new file mode 100644 index 0000000000000..49f7ce2de4632 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TrackFastJetProducer_cfi.py @@ -0,0 +1,33 @@ +import FWCore.ParameterSet.Config as cms + +L1TrackFastJets = cms.EDProducer("L1TrackFastJetProducer", + L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), + L1PrimaryVertexTag=cms.InputTag("L1TkPrimaryVertex"), + trk_zMax = cms.double(15.), # max track z0 [cm] + trk_chi2dofMax = cms.double(10.), # max track chi2/dof + trk_bendChi2Max = cms.double(2.2),# max bendChi2 cut + trk_ptMin = cms.double(2.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.5), # maximum track eta + trk_nStubMin = cms.int32(4), # minimum number of stubs in track + trk_nPSStubMin = cms.int32(-1), # minimum number of PS stubs in track + deltaZ0Cut=cms.double(0.5), # cluster tracks within |dz|<X + doTightChi2 = cms.bool( True ), # chi2dof < 5 for tracks with PT > 20 + coneSize=cms.double(0.4), #cone size for anti-kt fast jet + displaced = cms.bool(False) # use prompt/displaced tracks +) + +L1TrackFastJetsExtended = cms.EDProducer("L1TrackFastJetProducer", + L1TrackInputTag = cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), + L1PrimaryVertexTag=cms.InputTag("L1TkPrimaryVertex"), + trk_zMax = cms.double(15.), # max track z0 [cm] + trk_chi2dofMax = cms.double(40.), # max track chi2 for extended tracks + trk_bendChi2Max = cms.double(2.4),#Bendchi2 cut for extended tracks + trk_ptMin = cms.double(3.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.5), # maximum track eta + trk_nStubMin = cms.int32(4), # minimum number of stubs on track + trk_nPSStubMin = cms.int32(-1), # minimum number of stubs in PS modules on track + deltaZ0Cut=cms.double(3.0), #cluster tracks within |dz|<X + doTightChi2 = cms.bool( True ), # chi2dof < 5 for tracks with PT > 20 + coneSize=cms.double(0.4), #cone size for anti-kt fast jet + displaced = cms.bool(True) # use prompt/displaced tracks +) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py new file mode 100644 index 0000000000000..fc3bc7aaaf504 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py @@ -0,0 +1,57 @@ +import FWCore.ParameterSet.Config as cms + +L1TrackJets = cms.EDProducer('L1TrackJetProducer', + L1TrackInputTag= cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), + trk_zMax = cms.double (15.) , # maximum track z + trk_ptMax = cms.double(200.), # maximumum track pT before saturation [GeV] + trk_ptMin = cms.double(2.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.4), # maximum track eta + trk_chi2dofMax=cms.double(10.), # maximum track chi2/dof + trk_bendChi2Max=cms.double(2.2), # maximum track bendchi2 + trk_nPSStubMin=cms.int32(-1), # minimum PS stubs, -1 means no cut + minTrkJetpT=cms.double(5.), # minimum track pt to be considered for track jet + etaBins=cms.int32(24), + phiBins=cms.int32(27), + zBins=cms.int32(60), + d0_cutNStubs4=cms.double(0.15), + d0_cutNStubs5=cms.double(0.5), + lowpTJetMinTrackMultiplicity=cms.int32(2), + highpTJetMinTrackMultiplicity=cms.int32(3), + displaced=cms.bool(False), #Flag for displaced tracks + nStubs4DisplacedChi2_Loose=cms.double(5.0), #Displaced track quality flags for loose/tight + nStubs4Displacedbend_Loose=cms.double(1.7), + nStubs5DisplacedChi2_Loose=cms.double(2.75), + nStubs5Displacedbend_Loose=cms.double(3.5), + nStubs4DisplacedChi2_Tight=cms.double(12.0), + nStubs4Displacedbend_Tight=cms.double(1.0), + nStubs5DisplacedChi2_Tight=cms.double(2.75), + nStubs5Displacedbend_Tight=cms.double(3.5) +) + +L1TrackJetsExtended = cms.EDProducer('L1TrackJetProducer', + L1TrackInputTag= cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), + trk_zMax = cms.double (15.) , # maximum track z + trk_ptMax = cms.double(200.), # maximumum track pT before saturation [GeV] + trk_ptMin = cms.double(3.0), # minimum track pt [GeV] + trk_etaMax = cms.double(2.4), # maximum track eta + trk_chi2dofMax=cms.double(40.), # maximum track chi2/dof + trk_bendChi2Max=cms.double(2.4), # maximum track bendchi2 + trk_nPSStubMin=cms.int32(-1), # minimum # PS stubs, -1 means no cut + minTrkJetpT=cms.double(5.), # minimum track pt to be considered for track jet + etaBins=cms.int32(24), + phiBins=cms.int32(27), + zBins=cms.int32(10), + d0_cutNStubs4=cms.double(0.15), + d0_cutNStubs5=cms.double(0.5), + lowpTJetMinTrackMultiplicity=cms.int32(2), + highpTJetMinTrackMultiplicity=cms.int32(3), + displaced=cms.bool(True), #Flag for displaced tracks + nStubs4DisplacedChi2_Loose=cms.double(5.0), #Displaced track quality flags for loose/tight + nStubs4Displacedbend_Loose=cms.double(1.7), + nStubs5DisplacedChi2_Loose=cms.double(2.75), + nStubs5Displacedbend_Loose=cms.double(3.5), + nStubs4DisplacedChi2_Tight=cms.double(12.0), + nStubs4Displacedbend_Tight=cms.double(1.0), + nStubs5DisplacedChi2_Tight=cms.double(2.75), + nStubs5Displacedbend_Tight=cms.double(3.5) +) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py new file mode 100644 index 0000000000000..18dbf558c3e68 --- /dev/null +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms + +L1TrackerEtMiss = cms.EDProducer('L1TrackerEtMissProducer', + L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + maxZ0 = cms.double ( 15. ) , # in cm + maxEta = cms.double ( 2.4 ) , # max eta allowed for chosen tracks + chi2dofMax = cms.double( 10. ), # max chi2/dof allowed for chosen tracks + bendChi2Max = cms.double( 2.2 ),# max bendchi2 allowed for chosen tracks + minPt = cms.double( 2. ), # in GeV + deltaZ = cms.double( 3. ), # in cm + nStubsmin = cms.int32( 4 ), # min number of stubs for the tracks + nPSStubsMin = cms.int32( -1 ), # min number of stubs in the PS Modules + maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as + # mismeasured and are treated according to highPtTracks below. + # When maxPt < 0, no special treatment is done for high PT tracks. + highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored + # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. + # When maxPt < 0, no special treatment is done for high PT tracks. + displaced = cms.bool(False) # Use promt/displaced tracks +) + +L1TrackerEtMissExtended = cms.EDProducer('L1TrackerEtMissProducer', + L1TrackInputTag = cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), + L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + maxZ0 = cms.double ( 15. ) , # in cm + maxEta = cms.double ( 2.4 ) , # max eta allowed for chosen tracks + chi2dofMax = cms.double( 40. ), # max chi2/dof allowed for chosen tracks + bendChi2Max = cms.double( 2.4 ),# max bendchi2 allowed for chosen tracks + minPt = cms.double( 3. ), # in GeV + deltaZ = cms.double( 3.0 ), # in cm + nStubsmin = cms.int32( 4 ), # min number of stubs for the tracks + nPSStubsMin = cms.int32( -1 ), # min number of stubs in the PS Modules + maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as + # mismeasured and are treated according to highPtTracks below. + # When maxPt < 0, no special treatment is done for high PT tracks. + highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored + # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. + # When maxPt < 0, no special treatment is done for high PT tracks. + displaced = cms.bool(True) # Use promt/displaced tracks +) diff --git a/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc new file mode 100644 index 0000000000000..ddae5e669dfd9 --- /dev/null +++ b/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc @@ -0,0 +1,2260 @@ +////////////////////////////////////////////////////////////////////// +// // +// Analyzer for making mini-ntuple for L1 track performance plots // +// // +////////////////////////////////////////////////////////////////////// + +//////////////////// +// FRAMEWORK HEADERS +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +/////////////////////// +// DATA FORMATS HEADERS +#include "DataFormats/Common/interface/Handle.h" +#include "DataFormats/Common/interface/Ref.h" + +#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" +#include "DataFormats/L1TrackTrigger/interface/TTCluster.h" +#include "DataFormats/L1TrackTrigger/interface/TTStub.h" +#include "DataFormats/L1TrackTrigger/interface/TTTrack.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingVertex.h" +#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h" +#include "SimDataFormats/TrackingHit/interface/PSimHit.h" +#include "SimTracker/TrackTriggerAssociation/interface/TTClusterAssociationMap.h" +#include "SimTracker/TrackTriggerAssociation/interface/TTStubAssociationMap.h" +#include "SimTracker/TrackTriggerAssociation/interface/TTTrackAssociationMap.h" +#include "Geometry/Records/interface/StackedTrackerGeometryRecord.h" + +#include "DataFormats/JetReco/interface/GenJetCollection.h" +#include "DataFormats/JetReco/interface/GenJet.h" + +//////////////////////////// +// DETECTOR GEOMETRY HEADERS +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" +#include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" +#include "Geometry/CommonDetUnit/interface/GeomDetType.h" +#include "Geometry/CommonDetUnit/interface/GeomDet.h" + +#include "Geometry/CommonTopologies/interface/PixelGeomDetUnit.h" +#include "Geometry/CommonTopologies/interface/PixelGeomDetType.h" +#include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyBuilder.h" +#include "Geometry/Records/interface/StackedTrackerGeometryRecord.h" + +//////////////// +// PHYSICS TOOLS +#include "CommonTools/UtilAlgos/interface/TFileService.h" + + +//My additions +#include "DataFormats/L1TCorrelator/interface/TkJet.h" +#include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" +#include "DataFormats/Math/interface/LorentzVector.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkEtMissFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMiss.h" +#include "DataFormats/L1TCorrelator/interface/TkHTMissFwd.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + + + +/////////////// +// ROOT HEADERS +#include <TROOT.h> +#include <TCanvas.h> +#include <TTree.h> +#include <TFile.h> +#include <TF1.h> +#include <TH2F.h> +#include <TH1F.h> +#include <TLorentzVector.h> + +////////////// +// STD HEADERS +#include <memory> +#include <string> +#include <iostream> + +////////////// +// NAMESPACES +using namespace std; +using namespace edm; + +////////////////////////////// +// // +// CLASS DEFINITION // +// // +////////////////////////////// + +class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { +public: + // Constructor/destructor + explicit L1TrackObjectNtupleMaker(const edm::ParameterSet& iConfig); + ~L1TrackObjectNtupleMaker() override; + + // Mandatory methods + void beginJob() override; + void endJob() override; + void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; + + +protected: +private: + //----------------------------------------------------------------------------------------------- + // Containers of parameters passed by python configuration file + edm::ParameterSet config; + + int MyProcess; // 11/13/211 for single electrons/muons/pions, 6/15 for pions from ttbar/taus, 1 for inclusive + bool DebugMode; // lots of debug printout statements + bool SaveAllTracks; // store in ntuples not only truth-matched tracks but ALL tracks + bool SaveStubs; // option to save also stubs in the ntuples (makes them large...) + string Displaced; // "Prompt", "Displaced", "Both" + int TP_minNStub; // require TPs to have >= minNStub (defining efficiency denominator) (==0 means to only require >= 1 cluster) + int TP_minNStubLayer; // require TPs to have stubs in >= minNStubLayer layers/disks (defining efficiency denominator) + double TP_minPt; // save TPs with pt > minPt + double TP_maxEta; // save TPs with |eta| < maxEta + double TP_maxZ0; // save TPs with |z0| < maxZ0 + int L1Tk_minNStub; // require L1 tracks to have >= minNStub (this is mostly for tracklet purposes) + bool TrackingInJets; // do tracking in jets? + bool SaveTrackJets; + bool SaveTrackMET; + + + edm::InputTag L1TrackInputTag; // L1 track collection + edm::InputTag MCTruthTrackInputTag; // MC truth collection + edm::InputTag L1TrackExtendedInputTag; // L1 track collection + edm::InputTag MCTruthTrackExtendedInputTag; // MC truth collection + edm::InputTag MCTruthClusterInputTag; + edm::InputTag L1StubInputTag; + edm::InputTag MCTruthStubInputTag; + edm::InputTag TrackingParticleInputTag; + edm::InputTag TrackingVertexInputTag; + edm::InputTag GenJetInputTag; + edm::InputTag RecoVertexInputTag; + edm::InputTag GenParticleInputTag; + + edm::InputTag TrackFastJetsInputTag; + edm::InputTag TrackJetsInputTag; + edm::InputTag TrackMETInputTag; + edm::InputTag TrackMHTInputTag; + + edm::InputTag TrackFastJetsExtendedInputTag; + edm::InputTag TrackJetsExtendedInputTag; + edm::InputTag TrackMETExtendedInputTag; + edm::InputTag TrackMHTExtendedInputTag; + + + + edm::EDGetTokenT<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_> > > ttClusterToken_; + edm::EDGetTokenT<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> > > ttStubToken_; + edm::EDGetTokenT<TTClusterAssociationMap<Ref_Phase2TrackerDigi_> > ttClusterMCTruthToken_; + edm::EDGetTokenT<TTStubAssociationMap<Ref_Phase2TrackerDigi_> > ttStubMCTruthToken_; + + edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > ttTrackToken_; + edm::EDGetTokenT<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > ttTrackMCTruthToken_; + edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > ttTrackExtendedToken_; + edm::EDGetTokenT<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > ttTrackMCTruthExtendedToken_; + + edm::EDGetTokenT<std::vector<TrackingParticle> > TrackingParticleToken_; + edm::EDGetTokenT<std::vector<TrackingVertex> > TrackingVertexToken_; + + edm::EDGetTokenT<std::vector<reco::GenJet> > GenJetToken_; + edm::EDGetTokenT<std::vector<reco::GenParticle> > GenParticleToken_; + edm::EDGetTokenT<l1t::TkPrimaryVertexCollection> L1VertexToken_; + + + edm::EDGetTokenT<std::vector<l1t::TkJet> > TrackFastJetsToken_; + edm::EDGetTokenT<std::vector<l1t::TkJet> > TrackFastJetsExtendedToken_; + edm::EDGetTokenT<std::vector<l1t::TkEtMiss> > TrackMETToken_; + edm::EDGetTokenT<std::vector<l1t::TkEtMiss> > TrackMETExtendedToken_; + edm::EDGetTokenT<l1t::TkHTMissCollection > TrackMHTToken_; + edm::EDGetTokenT<l1t::TkHTMissCollection > TrackMHTExtendedToken_; + edm::EDGetTokenT<l1t::TkJetCollection> TrackJetsToken_; + edm::EDGetTokenT<l1t::TkJetCollection> TrackJetsExtendedToken_; + + //----------------------------------------------------------------------------------------------- + // tree & branches for mini-ntuple + + bool available_; // ROOT file for histograms is open. + + TTree* eventTree; + + // primary vertex + // std::vector<float>* m_pv_L1recotruesumpt; + // std::vector<float>* m_pv_L1recosumpt; + std::vector<float>* m_pv_L1reco; + // std::vector<float>* m_pv_L1TP; + // std::vector<float>* m_pv_L1TPsumpt; + std::vector<float>* m_pv_MC; + // std::vector<float>* m_pv_MCChgSumpT; + std::vector<int>* m_MC_lep; + + // all L1 tracks (prompt) + std::vector<float>* m_trk_pt; + std::vector<float>* m_trk_eta; + std::vector<float>* m_trk_phi; + std::vector<float>* m_trk_d0; // (filled if nFitPar==5, else 999) + std::vector<float>* m_trk_z0; + std::vector<float>* m_trk_chi2; + std::vector<float>* m_trk_chi2dof; + std::vector<float>* m_trk_chi2rphi; + std::vector<float>* m_trk_chi2rz; + std::vector<float>* m_trk_bendchi2; + std::vector<int>* m_trk_nstub; + std::vector<int>* m_trk_lhits; + std::vector<int>* m_trk_dhits; + std::vector<int>* m_trk_seed; + std::vector<int>* m_trk_hitpattern; + std::vector<unsigned int>* m_trk_phiSector; + std::vector<int>* m_trk_genuine; + std::vector<int>* m_trk_loose; + std::vector<int>* m_trk_unknown; + std::vector<int>* m_trk_combinatoric; + std::vector<int>* m_trk_fake; //0 fake, 1 track from primary interaction, 2 secondary track + std::vector<int>* m_trk_matchtp_pdgid; + std::vector<float>* m_trk_matchtp_pt; + std::vector<float>* m_trk_matchtp_eta; + std::vector<float>* m_trk_matchtp_phi; + std::vector<float>* m_trk_matchtp_z0; + std::vector<float>* m_trk_matchtp_dxy; + + // all L1 tracks (extended) + std::vector<float>* m_trkExt_pt; + std::vector<float>* m_trkExt_eta; + std::vector<float>* m_trkExt_phi; + std::vector<float>* m_trkExt_d0; // (filled if nFitPar==5, else 999) + std::vector<float>* m_trkExt_z0; + std::vector<float>* m_trkExt_chi2; + std::vector<float>* m_trkExt_chi2dof; + std::vector<float>* m_trkExt_chi2rphi; + std::vector<float>* m_trkExt_chi2rz; + std::vector<float>* m_trkExt_bendchi2; + std::vector<int>* m_trkExt_nstub; + std::vector<int>* m_trkExt_lhits; + std::vector<int>* m_trkExt_dhits; + std::vector<int>* m_trkExt_seed; + std::vector<int>* m_trkExt_hitpattern; + std::vector<unsigned int>* m_trkExt_phiSector; + std::vector<int>* m_trkExt_genuine; + std::vector<int>* m_trkExt_loose; + std::vector<int>* m_trkExt_unknown; + std::vector<int>* m_trkExt_combinatoric; + std::vector<int>* m_trkExt_fake; //0 fake, 1 track from primary interaction, 2 secondary track + std::vector<int>* m_trkExt_matchtp_pdgid; + std::vector<float>* m_trkExt_matchtp_pt; + std::vector<float>* m_trkExt_matchtp_eta; + std::vector<float>* m_trkExt_matchtp_phi; + std::vector<float>* m_trkExt_matchtp_z0; + std::vector<float>* m_trkExt_matchtp_dxy; + + + // all tracking particles + std::vector<float>* m_tp_pt; + std::vector<float>* m_tp_eta; + std::vector<float>* m_tp_phi; + std::vector<float>* m_tp_dxy; + std::vector<float>* m_tp_d0; + std::vector<float>* m_tp_z0; + std::vector<float>* m_tp_d0_prod; + std::vector<float>* m_tp_z0_prod; + std::vector<int>* m_tp_pdgid; + std::vector<int>* m_tp_nmatch; + std::vector<int>* m_tp_nstub; + std::vector<int>* m_tp_eventid; + std::vector<int>* m_tp_charge; + + + // *L1 track* properties if m_tp_nmatch > 0 (prompt) + std::vector<float>* m_matchtrk_pt; + std::vector<float>* m_matchtrk_eta; + std::vector<float>* m_matchtrk_phi; + std::vector<float>* m_matchtrk_d0; //this variable is only filled if nFitPar==5 + std::vector<float>* m_matchtrk_z0; + std::vector<float>* m_matchtrk_chi2; + std::vector<float>* m_matchtrk_chi2dof; + std::vector<float>* m_matchtrk_chi2rphi; + std::vector<float>* m_matchtrk_chi2rz; + std::vector<float>* m_matchtrk_bendchi2; + std::vector<int>* m_matchtrk_nstub; + std::vector<int>* m_matchtrk_lhits; + std::vector<int>* m_matchtrk_dhits; + std::vector<int>* m_matchtrk_seed; + std::vector<int>* m_matchtrk_hitpattern; + + // *L1 track* properties if m_tp_nmatch > 0 (extended) + std::vector<float>* m_matchtrkExt_pt; + std::vector<float>* m_matchtrkExt_eta; + std::vector<float>* m_matchtrkExt_phi; + std::vector<float>* m_matchtrkExt_d0; //this variable is only filled if nFitPar==5 + std::vector<float>* m_matchtrkExt_z0; + std::vector<float>* m_matchtrkExt_chi2; + std::vector<float>* m_matchtrkExt_chi2dof; + std::vector<float>* m_matchtrkExt_chi2rphi; + std::vector<float>* m_matchtrkExt_chi2rz; + std::vector<float>* m_matchtrkExt_bendchi2; + std::vector<int>* m_matchtrkExt_nstub; + std::vector<int>* m_matchtrkExt_lhits; + std::vector<int>* m_matchtrkExt_dhits; + std::vector<int>* m_matchtrkExt_seed; + std::vector<int>* m_matchtrkExt_hitpattern; + + // ALL stubs + std::vector<float>* m_allstub_x; + std::vector<float>* m_allstub_y; + std::vector<float>* m_allstub_z; + std::vector<int>* m_allstub_isBarrel; // stub is in barrel (1) or in disk (0) + std::vector<int>* m_allstub_layer; + std::vector<int>* m_allstub_isPSmodule; + std::vector<float>* m_allstub_trigDisplace; + std::vector<float>* m_allstub_trigOffset; + std::vector<float>* m_allstub_trigPos; + std::vector<float>* m_allstub_trigBend; + + // stub associated with tracking particle ? + std::vector<int>* m_allstub_matchTP_pdgid; // -999 if not matched + std::vector<float>* m_allstub_matchTP_pt; // -999 if not matched + std::vector<float>* m_allstub_matchTP_eta; // -999 if not matched + std::vector<float>* m_allstub_matchTP_phi; // -999 if not matched + std::vector<int>* m_allstub_genuine; + + // // track jet variables (for each gen jet, store the sum of pt of TPs / tracks inside jet cone) + // std::vector<float>* m_jet_eta; + // std::vector<float>* m_jet_phi; + // std::vector<float>* m_jet_pt; + // std::vector<float>* m_jet_tp_sumpt; + // std::vector<float>* m_jet_trk_sumpt; + // std::vector<float>* m_jet_matchtrk_sumpt; + + float trueMET=0; + float trkMET=0; + float trkMHT=0; + float trkHT=0; + + float trkMETExt=0; + float trkMHTExt=0; + float trkHTExt=0; + + std::vector<float>* m_2ltrkjet_vz; + std::vector<float>* m_2ltrkjet_p; + std::vector<float>* m_2ltrkjet_phi; + std::vector<float>* m_2ltrkjet_eta; + std::vector<float>* m_2ltrkjet_pt; + std::vector<int>* m_2ltrkjet_ntracks; + std::vector<int>* m_2ltrkjet_nDisplaced; + std::vector<int>* m_2ltrkjet_nTight; + std::vector<int>* m_2ltrkjet_nTightDisplaced; + std::vector<int>* m_2ltrkjet_ntdtrk; + + std::vector<float>* m_trkjet_vz; + std::vector<float>* m_trkjet_p; + std::vector<float>* m_trkjet_phi; + std::vector<float>* m_trkjet_eta; + std::vector<float>* m_trkjet_pt; + std::vector<int>* m_trkjet_ntracks; + std::vector<float>* m_trkjet_tp_sumpt; + std::vector<float>* m_trkjet_truetp_sumpt; + + std::vector<float>* m_2ltrkjetExt_vz; + std::vector<float>* m_2ltrkjetExt_p; + std::vector<float>* m_2ltrkjetExt_phi; + std::vector<float>* m_2ltrkjetExt_eta; + std::vector<float>* m_2ltrkjetExt_pt; + std::vector<int>* m_2ltrkjetExt_ntracks; + std::vector<int>* m_2ltrkjetExt_nDisplaced; + std::vector<int>* m_2ltrkjetExt_nTight; + std::vector<int>* m_2ltrkjetExt_nTightDisplaced; + std::vector<int>* m_2ltrkjetExt_ntdtrk; + + std::vector<float>* m_trkjetExt_vz; + std::vector<float>* m_trkjetExt_p; + std::vector<float>* m_trkjetExt_phi; + std::vector<float>* m_trkjetExt_eta; + std::vector<float>* m_trkjetExt_pt; + std::vector<int>* m_trkjetExt_ntracks; + std::vector<float>* m_trkjetExt_tp_sumpt; + std::vector<float>* m_trkjetExt_truetp_sumpt; +}; + +////////////////////////////////// +// // +// CLASS IMPLEMENTATION // +// // +////////////////////////////////// + +////////////// +// CONSTRUCTOR +L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iConfig) : config(iConfig) { + MyProcess = iConfig.getParameter<int>("MyProcess"); + DebugMode = iConfig.getParameter<bool>("DebugMode"); + SaveAllTracks = iConfig.getParameter<bool>("SaveAllTracks"); + SaveStubs = iConfig.getParameter<bool>("SaveStubs"); + Displaced = iConfig.getParameter< string >("Displaced"); + TP_minNStub = iConfig.getParameter<int>("TP_minNStub"); + TP_minNStubLayer = iConfig.getParameter<int>("TP_minNStubLayer"); + TP_minPt = iConfig.getParameter<double>("TP_minPt"); + TP_maxEta = iConfig.getParameter<double>("TP_maxEta"); + TP_maxZ0 = iConfig.getParameter<double>("TP_maxZ0"); + L1Tk_minNStub = iConfig.getParameter<int>("L1Tk_minNStub"); + + TrackingInJets = iConfig.getParameter<bool>("TrackingInJets"); + SaveTrackJets = iConfig.getParameter<bool>("SaveTrackJets"); + SaveTrackMET = iConfig.getParameter<bool>("SaveTrackMET"); + + L1StubInputTag = iConfig.getParameter<edm::InputTag>("L1StubInputTag"); + MCTruthClusterInputTag = iConfig.getParameter<edm::InputTag>("MCTruthClusterInputTag"); + MCTruthStubInputTag = iConfig.getParameter<edm::InputTag>("MCTruthStubInputTag"); + TrackingParticleInputTag = iConfig.getParameter<edm::InputTag>("TrackingParticleInputTag"); + TrackingVertexInputTag = iConfig.getParameter<edm::InputTag>("TrackingVertexInputTag"); + GenJetInputTag = iConfig.getParameter<edm::InputTag>("GenJetInputTag"); + RecoVertexInputTag = iConfig.getParameter<InputTag>("RecoVertexInputTag"); + GenParticleInputTag = iConfig.getParameter<InputTag >("GenParticleInputTag"); + + if (Displaced=="Prompt" || Displaced=="Both") { + L1TrackInputTag = iConfig.getParameter<edm::InputTag>("L1TrackInputTag"); + MCTruthTrackInputTag = iConfig.getParameter<edm::InputTag>("MCTruthTrackInputTag"); + TrackFastJetsInputTag = iConfig.getParameter<InputTag>("TrackFastJetsInputTag"); + TrackJetsInputTag = iConfig.getParameter<InputTag>("TrackJetsInputTag"); + TrackMETInputTag = iConfig.getParameter<InputTag>("TrackMETInputTag"); + TrackMHTInputTag = iConfig.getParameter<InputTag>("TrackMHTInputTag"); + + ttTrackToken_ = consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >(L1TrackInputTag); + ttTrackMCTruthToken_ = consumes<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> >(MCTruthTrackInputTag); + TrackFastJetsToken_ = consumes<std::vector<l1t::TkJet> >(TrackFastJetsInputTag); + TrackJetsToken_ = consumes<l1t::TkJetCollection>(TrackJetsInputTag); + TrackMETToken_ = consumes<std::vector<l1t::TkEtMiss> >(TrackMETInputTag); + TrackMHTToken_ = consumes<l1t::TkHTMissCollection>(TrackMHTInputTag); + } + + if (Displaced=="Displaced" || Displaced=="Both") { + L1TrackExtendedInputTag = iConfig.getParameter<edm::InputTag>("L1TrackExtendedInputTag"); + MCTruthTrackExtendedInputTag = iConfig.getParameter<edm::InputTag>("MCTruthTrackExtendedInputTag"); + TrackFastJetsExtendedInputTag = iConfig.getParameter<InputTag>("TrackFastJetsExtendedInputTag"); + TrackJetsExtendedInputTag = iConfig.getParameter<InputTag>("TrackJetsExtendedInputTag"); + TrackMETExtendedInputTag = iConfig.getParameter<InputTag>("TrackMETExtendedInputTag"); + TrackMHTExtendedInputTag = iConfig.getParameter<InputTag>("TrackMHTExtendedInputTag"); + + ttTrackExtendedToken_ = consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >(L1TrackExtendedInputTag); + ttTrackMCTruthExtendedToken_ = consumes<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> >(MCTruthTrackExtendedInputTag); + TrackFastJetsExtendedToken_ = consumes<std::vector<l1t::TkJet> >(TrackFastJetsExtendedInputTag); + TrackJetsExtendedToken_ = consumes<l1t::TkJetCollection>(TrackJetsExtendedInputTag); + TrackMETExtendedToken_ = consumes<std::vector<l1t::TkEtMiss> >(TrackMETExtendedInputTag); + TrackMHTExtendedToken_ = consumes<l1t::TkHTMissCollection>(TrackMHTExtendedInputTag); + } + + ttStubToken_ = consumes<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> > >(L1StubInputTag); + ttClusterMCTruthToken_ = consumes<TTClusterAssociationMap<Ref_Phase2TrackerDigi_> >(MCTruthClusterInputTag); + ttStubMCTruthToken_ = consumes<TTStubAssociationMap<Ref_Phase2TrackerDigi_> >(MCTruthStubInputTag); + TrackingParticleToken_ = consumes<std::vector<TrackingParticle> >(TrackingParticleInputTag); + TrackingVertexToken_ = consumes<std::vector<TrackingVertex> >(TrackingVertexInputTag); + GenJetToken_ = consumes<std::vector<reco::GenJet> >(GenJetInputTag); + GenParticleToken_=consumes< std::vector< reco::GenParticle> >(GenParticleInputTag); + L1VertexToken_=consumes<l1t::TkPrimaryVertexCollection>(RecoVertexInputTag); +} + +///////////// +// DESTRUCTOR +L1TrackObjectNtupleMaker::~L1TrackObjectNtupleMaker() {} + +////////// +// END JOB +void L1TrackObjectNtupleMaker::endJob() { + // things to be done at the exit of the event Loop + // edm::LogVerbatim("Tracklet") << "L1TrackObjectNtupleMaker::endJob"; +} + +//////////// +// BEGIN JOB +void L1TrackObjectNtupleMaker::beginJob() { + // things to be done before entering the event Loop + // edm::LogVerbatim("Tracklet") << "L1TrackObjectNtupleMaker::beginJob"; + + //----------------------------------------------------------------------------------------------- + // book histograms / make ntuple + edm::Service<TFileService> fs; + available_ = fs.isAvailable(); + if (not available_) + return; // No ROOT file open. + + // initilize + m_trk_pt = new std::vector<float>; + m_trk_eta = new std::vector<float>; + m_trk_phi = new std::vector<float>; + m_trk_z0 = new std::vector<float>; + m_trk_d0 = new std::vector<float>; + m_trk_chi2 = new std::vector<float>; + m_trk_chi2dof = new std::vector<float>; + m_trk_chi2rphi = new std::vector<float>; + m_trk_chi2rz = new std::vector<float>; + m_trk_bendchi2 = new std::vector<float>; + m_trk_nstub = new std::vector<int>; + m_trk_lhits = new std::vector<int>; + m_trk_dhits = new std::vector<int>; + m_trk_seed = new std::vector<int>; + m_trk_hitpattern = new std::vector<int>; + m_trk_phiSector = new std::vector<unsigned int>; + m_trk_genuine = new std::vector<int>; + m_trk_loose = new std::vector<int>; + m_trk_unknown = new std::vector<int>; + m_trk_combinatoric = new std::vector<int>; + m_trk_fake = new std::vector<int>; + m_trk_matchtp_pdgid = new std::vector<int>; + m_trk_matchtp_pt = new std::vector<float>; + m_trk_matchtp_eta = new std::vector<float>; + m_trk_matchtp_phi = new std::vector<float>; + m_trk_matchtp_z0 = new std::vector<float>; + m_trk_matchtp_dxy = new std::vector<float>; + + m_trkExt_pt = new std::vector<float>; + m_trkExt_eta = new std::vector<float>; + m_trkExt_phi = new std::vector<float>; + m_trkExt_z0 = new std::vector<float>; + m_trkExt_d0 = new std::vector<float>; + m_trkExt_chi2 = new std::vector<float>; + m_trkExt_chi2dof = new std::vector<float>; + m_trkExt_chi2rphi = new std::vector<float>; + m_trkExt_chi2rz = new std::vector<float>; + m_trkExt_bendchi2 = new std::vector<float>; + m_trkExt_nstub = new std::vector<int>; + m_trkExt_lhits = new std::vector<int>; + m_trkExt_dhits = new std::vector<int>; + m_trkExt_seed = new std::vector<int>; + m_trkExt_hitpattern = new std::vector<int>; + m_trkExt_phiSector = new std::vector<unsigned int>; + m_trkExt_genuine = new std::vector<int>; + m_trkExt_loose = new std::vector<int>; + m_trkExt_unknown = new std::vector<int>; + m_trkExt_combinatoric = new std::vector<int>; + m_trkExt_fake = new std::vector<int>; + m_trkExt_matchtp_pdgid = new std::vector<int>; + m_trkExt_matchtp_pt = new std::vector<float>; + m_trkExt_matchtp_eta = new std::vector<float>; + m_trkExt_matchtp_phi = new std::vector<float>; + m_trkExt_matchtp_z0 = new std::vector<float>; + m_trkExt_matchtp_dxy = new std::vector<float>; + + m_tp_pt = new std::vector<float>; + m_tp_eta = new std::vector<float>; + m_tp_phi = new std::vector<float>; + m_tp_dxy = new std::vector<float>; + m_tp_d0 = new std::vector<float>; + m_tp_z0 = new std::vector<float>; + m_tp_d0_prod = new std::vector<float>; + m_tp_z0_prod = new std::vector<float>; + m_tp_pdgid = new std::vector<int>; + m_tp_nmatch = new std::vector<int>; + m_tp_nstub = new std::vector<int>; + m_tp_eventid = new std::vector<int>; + m_tp_charge = new std::vector<int>; + + m_matchtrk_pt = new std::vector<float>; + m_matchtrk_eta = new std::vector<float>; + m_matchtrk_phi = new std::vector<float>; + m_matchtrk_z0 = new std::vector<float>; + m_matchtrk_d0 = new std::vector<float>; + m_matchtrk_chi2 = new std::vector<float>; + m_matchtrk_chi2dof = new std::vector<float>; + m_matchtrk_chi2rphi = new std::vector<float>; + m_matchtrk_chi2rz = new std::vector<float>; + m_matchtrk_bendchi2 = new std::vector<float>; + m_matchtrk_nstub = new std::vector<int>; + m_matchtrk_dhits = new std::vector<int>; + m_matchtrk_lhits = new std::vector<int>; + m_matchtrk_seed = new std::vector<int>; + m_matchtrk_hitpattern = new std::vector<int>; + + m_matchtrkExt_pt = new std::vector<float>; + m_matchtrkExt_eta = new std::vector<float>; + m_matchtrkExt_phi = new std::vector<float>; + m_matchtrkExt_z0 = new std::vector<float>; + m_matchtrkExt_d0 = new std::vector<float>; + m_matchtrkExt_chi2 = new std::vector<float>; + m_matchtrkExt_chi2dof = new std::vector<float>; + m_matchtrkExt_chi2rphi = new std::vector<float>; + m_matchtrkExt_chi2rz = new std::vector<float>; + m_matchtrkExt_bendchi2 = new std::vector<float>; + m_matchtrkExt_nstub = new std::vector<int>; + m_matchtrkExt_dhits = new std::vector<int>; + m_matchtrkExt_lhits = new std::vector<int>; + m_matchtrkExt_seed = new std::vector<int>; + m_matchtrkExt_hitpattern = new std::vector<int>; + + m_allstub_x = new std::vector<float>; + m_allstub_y = new std::vector<float>; + m_allstub_z = new std::vector<float>; + m_allstub_isBarrel = new std::vector<int>; + m_allstub_layer = new std::vector<int>; + m_allstub_isPSmodule = new std::vector<int>; + m_allstub_trigDisplace = new std::vector<float>; + m_allstub_trigOffset = new std::vector<float>; + m_allstub_trigPos = new std::vector<float>; + m_allstub_trigBend = new std::vector<float>; + m_allstub_matchTP_pdgid = new std::vector<int>; + m_allstub_matchTP_pt = new std::vector<float>; + m_allstub_matchTP_eta = new std::vector<float>; + m_allstub_matchTP_phi = new std::vector<float>; + m_allstub_genuine = new std::vector<int>; + + // m_jet_eta = new std::vector<float>; + // m_jet_phi = new std::vector<float>; + // m_jet_pt = new std::vector<float>; + // m_jet_tp_sumpt = new std::vector<float>; + // m_jet_trk_sumpt = new std::vector<float>; + // m_jet_matchtrk_sumpt = new std::vector<float>; + + // m_pv_L1recotruesumpt = new std::vector<float>; + // m_pv_L1recosumpt = new std::vector<float>; + m_pv_L1reco = new std::vector<float>; + // m_pv_L1TP = new std::vector<float>; + // m_pv_L1TPsumpt = new std::vector<float>; + m_pv_MC = new std::vector<float>; + // m_pv_MCChgSumpT = new std::vector<float>; + m_MC_lep=new std::vector<int>; + + m_2ltrkjet_eta = new std::vector<float>; + m_2ltrkjet_vz = new std::vector<float>; + m_2ltrkjet_phi = new std::vector<float>; + m_2ltrkjet_p = new std::vector<float>; + m_2ltrkjet_pt = new std::vector<float>; + m_2ltrkjet_ntracks=new std::vector<int>; + m_2ltrkjet_nDisplaced=new std::vector<int>; + m_2ltrkjet_nTight=new std::vector<int>; + m_2ltrkjet_nTightDisplaced=new std::vector<int>; + m_2ltrkjet_ntdtrk=new std::vector<int>; + + m_trkjet_eta = new std::vector<float>; + m_trkjet_vz = new std::vector<float>; + m_trkjet_phi = new std::vector<float>; + m_trkjet_p = new std::vector<float>; + m_trkjet_pt = new std::vector<float>; + m_trkjet_ntracks = new std::vector<int>; + m_trkjet_tp_sumpt = new std::vector<float>; + m_trkjet_truetp_sumpt = new std::vector<float>; + + m_2ltrkjetExt_eta = new std::vector<float>; + m_2ltrkjetExt_vz = new std::vector<float>; + m_2ltrkjetExt_phi = new std::vector<float>; + m_2ltrkjetExt_p = new std::vector<float>; + m_2ltrkjetExt_pt = new std::vector<float>; + m_2ltrkjetExt_ntracks=new std::vector<int>; + m_2ltrkjetExt_nDisplaced=new std::vector<int>; + m_2ltrkjetExt_nTight=new std::vector<int>; + m_2ltrkjetExt_nTightDisplaced=new std::vector<int>; + m_2ltrkjetExt_ntdtrk=new std::vector<int>; + + m_trkjetExt_eta = new std::vector<float>; + m_trkjetExt_vz = new std::vector<float>; + m_trkjetExt_phi = new std::vector<float>; + m_trkjetExt_p = new std::vector<float>; + m_trkjetExt_pt = new std::vector<float>; + m_trkjetExt_ntracks = new std::vector<int>; + m_trkjetExt_tp_sumpt = new std::vector<float>; + m_trkjetExt_truetp_sumpt = new std::vector<float>; + + // ntuple + eventTree = fs->make<TTree>("eventTree", "Event tree"); + + if (SaveAllTracks && (Displaced=="Prompt" || Displaced=="Both")) { + eventTree->Branch("trk_pt", &m_trk_pt); + eventTree->Branch("trk_eta", &m_trk_eta); + eventTree->Branch("trk_phi", &m_trk_phi); + eventTree->Branch("trk_d0", &m_trk_d0); + eventTree->Branch("trk_z0", &m_trk_z0); + eventTree->Branch("trk_chi2", &m_trk_chi2); + eventTree->Branch("trk_chi2dof", &m_trk_chi2dof); + eventTree->Branch("trk_chi2rphi", &m_trk_chi2rphi); + eventTree->Branch("trk_chi2rz", &m_trk_chi2rz); + eventTree->Branch("trk_bendchi2", &m_trk_bendchi2); + eventTree->Branch("trk_nstub", &m_trk_nstub); + eventTree->Branch("trk_lhits", &m_trk_lhits); + eventTree->Branch("trk_dhits", &m_trk_dhits); + eventTree->Branch("trk_seed", &m_trk_seed); + eventTree->Branch("trk_hitpattern", &m_trk_hitpattern); + eventTree->Branch("trk_phiSector", &m_trk_phiSector); + eventTree->Branch("trk_genuine", &m_trk_genuine); + eventTree->Branch("trk_loose", &m_trk_loose); + eventTree->Branch("trk_unknown", &m_trk_unknown); + eventTree->Branch("trk_combinatoric", &m_trk_combinatoric); + eventTree->Branch("trk_fake", &m_trk_fake); + eventTree->Branch("trk_matchtp_pdgid", &m_trk_matchtp_pdgid); + eventTree->Branch("trk_matchtp_pt", &m_trk_matchtp_pt); + eventTree->Branch("trk_matchtp_eta", &m_trk_matchtp_eta); + eventTree->Branch("trk_matchtp_phi", &m_trk_matchtp_phi); + eventTree->Branch("trk_matchtp_z0", &m_trk_matchtp_z0); + eventTree->Branch("trk_matchtp_dxy", &m_trk_matchtp_dxy); + // if (TrackingInJets) { + // eventTree->Branch("trk_injet", &m_trk_injet); + // eventTree->Branch("trk_injet_highpt", &m_trk_injet_highpt); + // eventTree->Branch("trk_injet_vhighpt", &m_trk_injet_vhighpt); + // } + } + + if (SaveAllTracks && (Displaced=="Displaced" || Displaced=="Both")) { + eventTree->Branch("trkExt_pt", &m_trkExt_pt); + eventTree->Branch("trkExt_eta", &m_trkExt_eta); + eventTree->Branch("trkExt_phi", &m_trkExt_phi); + eventTree->Branch("trkExt_d0", &m_trkExt_d0); + eventTree->Branch("trkExt_z0", &m_trkExt_z0); + eventTree->Branch("trkExt_chi2", &m_trkExt_chi2); + eventTree->Branch("trkExt_chi2dof", &m_trkExt_chi2dof); + eventTree->Branch("trkExt_chi2rphi", &m_trkExt_chi2rphi); + eventTree->Branch("trkExt_chi2rz", &m_trkExt_chi2rz); + eventTree->Branch("trkExt_bendchi2", &m_trkExt_bendchi2); + eventTree->Branch("trkExt_nstub", &m_trkExt_nstub); + eventTree->Branch("trkExt_lhits", &m_trkExt_lhits); + eventTree->Branch("trkExt_dhits", &m_trkExt_dhits); + eventTree->Branch("trkExt_seed", &m_trkExt_seed); + eventTree->Branch("trkExt_hitpattern", &m_trkExt_hitpattern); + eventTree->Branch("trkExt_phiSector", &m_trkExt_phiSector); + eventTree->Branch("trkExt_genuine", &m_trkExt_genuine); + eventTree->Branch("trkExt_loose", &m_trkExt_loose); + eventTree->Branch("trkExt_unknown", &m_trkExt_unknown); + eventTree->Branch("trkExt_combinatoric", &m_trkExt_combinatoric); + eventTree->Branch("trkExt_fake", &m_trkExt_fake); + eventTree->Branch("trkExt_matchtp_pdgid", &m_trkExt_matchtp_pdgid); + eventTree->Branch("trkExt_matchtp_pt", &m_trkExt_matchtp_pt); + eventTree->Branch("trkExt_matchtp_eta", &m_trkExt_matchtp_eta); + eventTree->Branch("trkExt_matchtp_phi", &m_trkExt_matchtp_phi); + eventTree->Branch("trkExt_matchtp_z0", &m_trkExt_matchtp_z0); + eventTree->Branch("trkExt_matchtp_dxy", &m_trkExt_matchtp_dxy); + // if (TrackingInJets) { + // eventTree->Branch("trk_injet", &m_trk_injet); + // eventTree->Branch("trk_injet_highpt", &m_trk_injet_highpt); + // eventTree->Branch("trk_injet_vhighpt", &m_trk_injet_vhighpt); + // } + } + eventTree->Branch("tp_pt", &m_tp_pt); + eventTree->Branch("tp_eta", &m_tp_eta); + eventTree->Branch("tp_phi", &m_tp_phi); + eventTree->Branch("tp_dxy", &m_tp_dxy); + eventTree->Branch("tp_d0", &m_tp_d0); + eventTree->Branch("tp_z0", &m_tp_z0); + eventTree->Branch("tp_d0_prod", &m_tp_d0_prod); + eventTree->Branch("tp_z0_prod", &m_tp_z0_prod); + eventTree->Branch("tp_pdgid", &m_tp_pdgid); + eventTree->Branch("tp_nmatch", &m_tp_nmatch); + eventTree->Branch("tp_nstub", &m_tp_nstub); + eventTree->Branch("tp_eventid", &m_tp_eventid); + eventTree->Branch("tp_charge", &m_tp_charge); + // if (TrackingInJets) { + // eventTree->Branch("tp_injet", &m_tp_injet); + // eventTree->Branch("tp_injet_highpt", &m_tp_injet_highpt); + // eventTree->Branch("tp_injet_vhighpt", &m_tp_injet_vhighpt); + // } + + if (Displaced=="Prompt" || Displaced=="Both") { + eventTree->Branch("matchtrk_pt", &m_matchtrk_pt); + eventTree->Branch("matchtrk_eta", &m_matchtrk_eta); + eventTree->Branch("matchtrk_phi", &m_matchtrk_phi); + eventTree->Branch("matchtrk_z0", &m_matchtrk_z0); + eventTree->Branch("matchtrk_d0", &m_matchtrk_d0); + eventTree->Branch("matchtrk_chi2", &m_matchtrk_chi2); + eventTree->Branch("matchtrk_chi2dof", &m_matchtrk_chi2dof); + eventTree->Branch("matchtrk_chi2rphi", &m_matchtrk_chi2rphi); + eventTree->Branch("matchtrk_chi2rz", &m_matchtrk_chi2rz); + eventTree->Branch("matchtrk_bendchi2", &m_matchtrk_bendchi2); + eventTree->Branch("matchtrk_nstub", &m_matchtrk_nstub); + eventTree->Branch("matchtrk_lhits", &m_matchtrk_lhits); + eventTree->Branch("matchtrk_dhits", &m_matchtrk_dhits); + eventTree->Branch("matchtrk_seed", &m_matchtrk_seed); + eventTree->Branch("matchtrk_hitpattern", &m_matchtrk_hitpattern); + // if (TrackingInJets) { + // eventTree->Branch("matchtrk_injet", &m_matchtrk_injet); + // eventTree->Branch("matchtrk_injet_highpt", &m_matchtrk_injet_highpt); + // eventTree->Branch("matchtrk_injet_vhighpt", &m_matchtrk_injet_vhighpt); + // } + } + + if (Displaced=="Displaced" || Displaced=="Both") { + eventTree->Branch("matchtrkExt_pt", &m_matchtrkExt_pt); + eventTree->Branch("matchtrkExt_eta", &m_matchtrkExt_eta); + eventTree->Branch("matchtrkExt_phi", &m_matchtrkExt_phi); + eventTree->Branch("matchtrkExt_z0", &m_matchtrkExt_z0); + eventTree->Branch("matchtrkExt_d0", &m_matchtrkExt_d0); + eventTree->Branch("matchtrkExt_chi2", &m_matchtrkExt_chi2); + eventTree->Branch("matchtrkExt_chi2dof", &m_matchtrkExt_chi2dof); + eventTree->Branch("matchtrkExt_chi2rphi", &m_matchtrkExt_chi2rphi); + eventTree->Branch("matchtrkExt_chi2rz", &m_matchtrkExt_chi2rz); + eventTree->Branch("matchtrkExt_bendchi2", &m_matchtrkExt_bendchi2); + eventTree->Branch("matchtrkExt_nstub", &m_matchtrkExt_nstub); + eventTree->Branch("matchtrkExt_lhits", &m_matchtrkExt_lhits); + eventTree->Branch("matchtrkExt_dhits", &m_matchtrkExt_dhits); + eventTree->Branch("matchtrkExt_seed", &m_matchtrkExt_seed); + eventTree->Branch("matchtrkExt_hitpattern", &m_matchtrkExt_hitpattern); + // if (TrackingInJets) { + // eventTree->Branch("matchtrk_injet", &m_matchtrk_injet); + // eventTree->Branch("matchtrk_injet_highpt", &m_matchtrk_injet_highpt); + // eventTree->Branch("matchtrk_injet_vhighpt", &m_matchtrk_injet_vhighpt); + // } + } + + if (SaveStubs) { + eventTree->Branch("allstub_x", &m_allstub_x); + eventTree->Branch("allstub_y", &m_allstub_y); + eventTree->Branch("allstub_z", &m_allstub_z); + eventTree->Branch("allstub_isBarrel", &m_allstub_isBarrel); + eventTree->Branch("allstub_layer", &m_allstub_layer); + eventTree->Branch("allstub_isPSmodule", &m_allstub_isPSmodule); + eventTree->Branch("allstub_trigDisplace", &m_allstub_trigDisplace); + eventTree->Branch("allstub_trigOffset", &m_allstub_trigOffset); + eventTree->Branch("allstub_trigPos", &m_allstub_trigPos); + eventTree->Branch("allstub_trigBend", &m_allstub_trigBend); + eventTree->Branch("allstub_matchTP_pdgid", &m_allstub_matchTP_pdgid); + eventTree->Branch("allstub_matchTP_pt", &m_allstub_matchTP_pt); + eventTree->Branch("allstub_matchTP_eta", &m_allstub_matchTP_eta); + eventTree->Branch("allstub_matchTP_phi", &m_allstub_matchTP_phi); + eventTree->Branch("allstub_genuine", &m_allstub_genuine); + } + + // if (TrackingInJets) { + // eventTree->Branch("jet_eta", &m_jet_eta); + // eventTree->Branch("jet_phi", &m_jet_phi); + // eventTree->Branch("jet_pt", &m_jet_pt); + // eventTree->Branch("jet_tp_sumpt", &m_jet_tp_sumpt); + // eventTree->Branch("jet_trk_sumpt", &m_jet_trk_sumpt); + // eventTree->Branch("jet_matchtrk_sumpt", &m_jet_matchtrk_sumpt); + // } + if (SaveTrackJets) { + // eventTree->Branch("pv_L1recotruesumpt", &m_pv_L1recotruesumpt); + // eventTree->Branch("pv_L1recosumpt", &m_pv_L1recosumpt); + eventTree->Branch("pv_L1reco", &m_pv_L1reco); + // eventTree->Branch("pv_L1TP", &m_pv_L1TP); + // eventTree->Branch("pv_L1TPsumpt", &m_pv_L1TPsumpt); + eventTree->Branch("MC_lep", &m_MC_lep); + // eventTree->Branch("pv_MCChgSumpT", &m_pv_MCChgSumpT); + eventTree->Branch("pv_MC", &m_pv_MC); + + if (Displaced=="Prompt" || Displaced=="Both") { + eventTree->Branch("2ltrkjet_eta", &m_2ltrkjet_eta); + eventTree->Branch("2ltrkjet_vz", &m_2ltrkjet_vz); + eventTree->Branch("2ltrkjet_p", &m_2ltrkjet_p); + eventTree->Branch("2ltrkjet_pt", &m_2ltrkjet_pt); + eventTree->Branch("2ltrkjet_phi", &m_2ltrkjet_phi); + eventTree->Branch("2ltrkjet_ntracks", &m_2ltrkjet_ntracks); + eventTree->Branch("2ltrkjet_nDisplaced", &m_2ltrkjet_nDisplaced); + eventTree->Branch("2ltrkjet_nTight", &m_2ltrkjet_nTight); + eventTree->Branch("2ltrkjet_nTightDisplaced", &m_2ltrkjet_nTightDisplaced); + eventTree->Branch("trkjet_eta", &m_trkjet_eta); + eventTree->Branch("trkjet_vz", &m_trkjet_vz); + eventTree->Branch("trkjet_p", &m_trkjet_p); + eventTree->Branch("trkjet_pt", &m_trkjet_pt); + eventTree->Branch("trkjet_phi", &m_trkjet_phi); + eventTree->Branch("trkjet_ntracks", &m_trkjet_ntracks); + eventTree->Branch("trkjet_truetp_sumpt", m_trkjet_truetp_sumpt); + } + if (Displaced=="Displaced" || Displaced=="Both") { + eventTree->Branch("2ltrkjetExt_eta", &m_2ltrkjetExt_eta); + eventTree->Branch("2ltrkjetExt_vz", &m_2ltrkjetExt_vz); + eventTree->Branch("2ltrkjetExt_p", &m_2ltrkjetExt_p); + eventTree->Branch("2ltrkjetExt_pt", &m_2ltrkjetExt_pt); + eventTree->Branch("2ltrkjetExt_phi", &m_2ltrkjetExt_phi); + eventTree->Branch("2ltrkjetExt_ntracks", &m_2ltrkjetExt_ntracks); + eventTree->Branch("2ltrkjetExt_nDisplaced", &m_2ltrkjetExt_nDisplaced); + eventTree->Branch("2ltrkjetExt_nTight", &m_2ltrkjetExt_nTight); + eventTree->Branch("2ltrkjetExt_nTightDisplaced", &m_2ltrkjetExt_nTightDisplaced); + eventTree->Branch("trkjetExt_eta", &m_trkjetExt_eta); + eventTree->Branch("trkjetExt_vz", &m_trkjetExt_vz); + eventTree->Branch("trkjetExt_p", &m_trkjetExt_p); + eventTree->Branch("trkjetExt_pt", &m_trkjetExt_pt); + eventTree->Branch("trkjetExt_phi", &m_trkjetExt_phi); + eventTree->Branch("trkjetExt_ntracks", &m_trkjetExt_ntracks); + eventTree->Branch("trkjetExt_truetp_sumpt", m_trkjetExt_truetp_sumpt); + } + } + + if (SaveTrackMET) { + eventTree->Branch("trueMET", &trueMET, "trueMET/F"); + + if (Displaced=="Prompt" || Displaced=="Both") { + eventTree->Branch("trkMET", &trkMET, "trkMET/F"); + eventTree->Branch("trkMHT", &trkMHT, "trkMHT/F"); + eventTree->Branch("trkHT", &trkHT, "trkHT/F"); + } + if (Displaced=="Displaced" || Displaced=="Both") { + eventTree->Branch("trkMETExt", &trkMETExt, "trkMETExt/F"); + eventTree->Branch("trkMHTExt", &trkMHTExt, "trkMHTExt/F"); + eventTree->Branch("trkHTExt", &trkHTExt, "trkHTExt/F"); + } + } +} + +////////// +// ANALYZE +void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (not available_) + return; // No ROOT file open. + + if (!(MyProcess == 13 || MyProcess == 11 || MyProcess == 211 || MyProcess == 6 || MyProcess == 15 || + MyProcess == 1)) { + edm::LogVerbatim("Tracklet") << "The specified MyProcess is invalid! Exiting..."; + return; + } + + // clear variables + if (SaveAllTracks && (Displaced=="Prompt" || Displaced=="Both")) { + m_trk_pt->clear(); + m_trk_eta->clear(); + m_trk_phi->clear(); + m_trk_d0->clear(); + m_trk_z0->clear(); + m_trk_chi2->clear(); + m_trk_chi2dof->clear(); + m_trk_chi2rphi->clear(); + m_trk_chi2rz->clear(); + m_trk_bendchi2->clear(); + m_trk_nstub->clear(); + m_trk_lhits->clear(); + m_trk_dhits->clear(); + m_trk_seed->clear(); + m_trk_hitpattern->clear(); + m_trk_phiSector->clear(); + m_trk_genuine->clear(); + m_trk_loose->clear(); + m_trk_unknown->clear(); + m_trk_combinatoric->clear(); + m_trk_fake->clear(); + m_trk_matchtp_pdgid->clear(); + m_trk_matchtp_pt->clear(); + m_trk_matchtp_eta->clear(); + m_trk_matchtp_phi->clear(); + m_trk_matchtp_z0->clear(); + m_trk_matchtp_dxy->clear(); + } + if (SaveAllTracks && (Displaced=="Displaced" || Displaced=="Both")) { + m_trkExt_pt->clear(); + m_trkExt_eta->clear(); + m_trkExt_phi->clear(); + m_trkExt_d0->clear(); + m_trkExt_z0->clear(); + m_trkExt_chi2->clear(); + m_trkExt_chi2dof->clear(); + m_trkExt_chi2rphi->clear(); + m_trkExt_chi2rz->clear(); + m_trkExt_bendchi2->clear(); + m_trkExt_nstub->clear(); + m_trkExt_lhits->clear(); + m_trkExt_dhits->clear(); + m_trkExt_seed->clear(); + m_trkExt_hitpattern->clear(); + m_trkExt_phiSector->clear(); + m_trkExt_genuine->clear(); + m_trkExt_loose->clear(); + m_trkExt_unknown->clear(); + m_trkExt_combinatoric->clear(); + m_trkExt_fake->clear(); + m_trkExt_matchtp_pdgid->clear(); + m_trkExt_matchtp_pt->clear(); + m_trkExt_matchtp_eta->clear(); + m_trkExt_matchtp_phi->clear(); + m_trkExt_matchtp_z0->clear(); + m_trkExt_matchtp_dxy->clear(); + } + m_tp_pt->clear(); + m_tp_eta->clear(); + m_tp_phi->clear(); + m_tp_dxy->clear(); + m_tp_d0->clear(); + m_tp_z0->clear(); + m_tp_d0_prod->clear(); + m_tp_z0_prod->clear(); + m_tp_pdgid->clear(); + m_tp_nmatch->clear(); + m_tp_nstub->clear(); + m_tp_eventid->clear(); + m_tp_charge->clear(); + + if (Displaced=="Prompt" || Displaced=="Both") { + m_matchtrk_pt->clear(); + m_matchtrk_eta->clear(); + m_matchtrk_phi->clear(); + m_matchtrk_z0->clear(); + m_matchtrk_d0->clear(); + m_matchtrk_chi2->clear(); + m_matchtrk_chi2dof->clear(); + m_matchtrk_chi2rphi->clear(); + m_matchtrk_chi2rz->clear(); + m_matchtrk_bendchi2->clear(); + m_matchtrk_nstub->clear(); + m_matchtrk_lhits->clear(); + m_matchtrk_dhits->clear(); + m_matchtrk_seed->clear(); + m_matchtrk_hitpattern->clear(); + } + + if (Displaced=="Displaced" || Displaced=="Both") { + m_matchtrkExt_pt->clear(); + m_matchtrkExt_eta->clear(); + m_matchtrkExt_phi->clear(); + m_matchtrkExt_z0->clear(); + m_matchtrkExt_d0->clear(); + m_matchtrkExt_chi2->clear(); + m_matchtrkExt_chi2dof->clear(); + m_matchtrkExt_chi2rphi->clear(); + m_matchtrkExt_chi2rz->clear(); + m_matchtrkExt_bendchi2->clear(); + m_matchtrkExt_nstub->clear(); + m_matchtrkExt_lhits->clear(); + m_matchtrkExt_dhits->clear(); + m_matchtrkExt_seed->clear(); + m_matchtrkExt_hitpattern->clear(); + } + + if (SaveStubs) { + m_allstub_x->clear(); + m_allstub_y->clear(); + m_allstub_z->clear(); + m_allstub_isBarrel->clear(); + m_allstub_layer->clear(); + m_allstub_isPSmodule->clear(); + m_allstub_trigDisplace->clear(); + m_allstub_trigOffset->clear(); + m_allstub_trigPos->clear(); + m_allstub_trigBend->clear(); + m_allstub_matchTP_pdgid->clear(); + m_allstub_matchTP_pt->clear(); + m_allstub_matchTP_eta->clear(); + m_allstub_matchTP_phi->clear(); + m_allstub_genuine->clear(); + } + + // m_jet_eta->clear(); + // m_jet_phi->clear(); + // m_jet_pt->clear(); + // m_jet_tp_sumpt->clear(); + // m_jet_trk_sumpt->clear(); + // m_jet_matchtrk_sumpt->clear(); + + if (SaveTrackJets) { + + if (Displaced=="Prompt" || Displaced=="Both") { + m_2ltrkjet_eta->clear(); + m_2ltrkjet_pt->clear(); + m_2ltrkjet_vz->clear(); + m_2ltrkjet_phi->clear(); + m_2ltrkjet_p->clear(); + m_2ltrkjet_ntracks->clear(); + m_2ltrkjet_nDisplaced->clear(); + m_2ltrkjet_nTight->clear(); + m_2ltrkjet_nTightDisplaced->clear(); + m_2ltrkjet_ntdtrk->clear(); + m_trkjet_eta->clear(); + m_trkjet_pt->clear(); + m_trkjet_vz->clear(); + m_trkjet_phi->clear(); + m_trkjet_p->clear(); + m_trkjet_ntracks->clear(); + m_trkjet_truetp_sumpt->clear(); + m_trkjet_tp_sumpt->clear(); + } + if (Displaced=="Displaced" || Displaced=="Both") { + m_2ltrkjetExt_eta->clear(); + m_2ltrkjetExt_pt->clear(); + m_2ltrkjetExt_vz->clear(); + m_2ltrkjetExt_phi->clear(); + m_2ltrkjetExt_p->clear(); + m_2ltrkjetExt_ntracks->clear(); + m_2ltrkjetExt_nDisplaced->clear(); + m_2ltrkjetExt_nTight->clear(); + m_2ltrkjetExt_nTightDisplaced->clear(); + m_2ltrkjetExt_ntdtrk->clear(); + m_trkjetExt_eta->clear(); + m_trkjetExt_pt->clear(); + m_trkjetExt_vz->clear(); + m_trkjetExt_phi->clear(); + m_trkjetExt_p->clear(); + m_trkjetExt_ntracks->clear(); + m_trkjetExt_truetp_sumpt->clear(); + m_trkjetExt_tp_sumpt->clear(); + } + + // m_pv_L1recotruesumpt->clear(); + // m_pv_L1recosumpt->clear(); + m_pv_L1reco->clear(); + // m_pv_L1TPsumpt->clear(); + // m_pv_L1TP->clear(); + m_pv_MC->clear(); + m_MC_lep->clear(); + // m_pv_MCChgSumpT->clear(); + } + + // ----------------------------------------------------------------------------------------------- + // retrieve various containers + // ----------------------------------------------------------------------------------------------- + + // L1 stubs + edm::Handle<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> > > TTStubHandle; + if (SaveStubs) + iEvent.getByToken(ttStubToken_, TTStubHandle); + + // MC truth association maps + edm::Handle<TTClusterAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTClusterHandle; + iEvent.getByToken(ttClusterMCTruthToken_, MCTruthTTClusterHandle); + edm::Handle<TTStubAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTStubHandle; + iEvent.getByToken(ttStubMCTruthToken_, MCTruthTTStubHandle); + + // tracking particles + edm::Handle<std::vector<TrackingParticle> > TrackingParticleHandle; + edm::Handle<std::vector<TrackingVertex> > TrackingVertexHandle; + iEvent.getByToken(TrackingParticleToken_, TrackingParticleHandle); + iEvent.getByToken(TrackingVertexToken_, TrackingVertexHandle); + + // ----------------------------------------------------------------------------------------------- + // more for TTStubs + edm::ESHandle<TrackerGeometry> geometryHandle; + iSetup.get<TrackerDigiGeometryRecord>().get(geometryHandle); + + edm::ESHandle<TrackerTopology> tTopoHandle; + iSetup.get<TrackerTopologyRcd>().get(tTopoHandle); + + edm::ESHandle<TrackerGeometry> tGeomHandle; + iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); + + const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerGeometry* const theTrackerGeom = tGeomHandle.product(); + + //Gen particles + edm::Handle< std::vector< reco::GenParticle> > GenParticleHandle; + iEvent.getByToken(GenParticleToken_,GenParticleHandle); + + //Vertex + edm::Handle< l1t::TkPrimaryVertexCollection >L1TkPrimaryVertexHandle; + iEvent.getByToken(L1VertexToken_, L1TkPrimaryVertexHandle); + + // Track jets + edm::Handle< std::vector<l1t::TkJet> > TrackFastJetsHandle; + edm::Handle< std::vector<l1t::TkJet> > TrackFastJetsExtendedHandle; + edm::Handle<l1t::TkJetCollection> TrackJetsHandle; + edm::Handle<l1t::TkJetCollection> TrackJetsExtendedHandle; + std::vector< l1t::TkJet >::const_iterator jetIter; + + // Track MET + edm::Handle< std::vector<l1t::TkEtMiss> > L1TkMETHandle; + edm::Handle< std::vector<l1t::TkEtMiss> > L1TkMETExtendedHandle; + edm::Handle< std::vector<l1t::TkHTMiss> > L1TkMHTHandle; + edm::Handle< std::vector<l1t::TkHTMiss> > L1TkMHTExtendedHandle; + + // L1 tracks + edm::Handle<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackHandle; + edm::Handle<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackExtendedHandle; + edm::Handle<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTTrackHandle; + edm::Handle<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTTrackExtendedHandle; + std::vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator iterL1Track; + + + if (Displaced=="Prompt" || Displaced=="Both") { + iEvent.getByToken(TrackFastJetsToken_, TrackFastJetsHandle); + iEvent.getByToken(TrackJetsToken_,TrackJetsHandle); + iEvent.getByToken(TrackMETToken_, L1TkMETHandle); + iEvent.getByToken(TrackMHTToken_, L1TkMHTHandle); + iEvent.getByToken(ttTrackToken_, TTTrackHandle); + iEvent.getByToken(ttTrackMCTruthToken_, MCTruthTTTrackHandle); + } + if (Displaced=="Displaced" || Displaced=="Both") { + iEvent.getByToken(TrackFastJetsExtendedToken_, TrackFastJetsExtendedHandle); + iEvent.getByToken(TrackJetsExtendedToken_,TrackJetsExtendedHandle); + iEvent.getByToken(TrackMETExtendedToken_, L1TkMETExtendedHandle); + iEvent.getByToken(TrackMHTExtendedToken_, L1TkMHTExtendedHandle); + iEvent.getByToken(ttTrackExtendedToken_, TTTrackExtendedHandle); + iEvent.getByToken(ttTrackMCTruthExtendedToken_, MCTruthTTTrackExtendedHandle); + } + + //Loop over gen particles + if (GenParticleHandle.isValid()) { + vector<reco::GenParticle>::const_iterator genpartIter; + + float zvtx_gen = -999; + for (genpartIter = GenParticleHandle->begin(); genpartIter != GenParticleHandle->end(); ++genpartIter) { + int status = genpartIter -> status(); + if (status!=1) continue; + zvtx_gen = genpartIter -> vz(); + } + m_pv_MC->push_back(zvtx_gen); + + float trueMETx = 0; + float trueMETy = 0; + trueMET = 0; + for (size_t i = 0; i<GenParticleHandle->size(); ++i) { + const reco::GenParticle & p = (*GenParticleHandle)[i]; + int id = p.pdgId(); + bool isNeutrino = false; + if ( (fabs(id)==12 || fabs(id)==14 || fabs(id)==16) ) isNeutrino = true; + if ( (isNeutrino|| id==1000022 ) && p.status()==1 ) { + trueMETx += p.pt()*cos(p.phi()); + trueMETy += p.pt()*sin(p.phi()); + } + } + trueMET = sqrt(trueMETx*trueMETx + trueMETy*trueMETy); + } + else { + edm::LogWarning("DataNotFound")<< "\nWarning: GenParticleHandle not found in the event"<< std::endl; + } + + // ---------------------------------------------------------------------------------------------- + // loop over L1 stubs + // ---------------------------------------------------------------------------------------------- + if (SaveStubs) { + for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) { + DetId detid = (*gd)->geographicalId(); + if (detid.subdetId() != StripSubdetector::TOB && detid.subdetId() != StripSubdetector::TID) + continue; + if (!tTopo->isLower(detid)) + continue; // loop on the stacks: choose the lower arbitrarily + DetId stackDetid = tTopo->stack(detid); // Stub module detid + + if (TTStubHandle->find(stackDetid) == TTStubHandle->end()) + continue; + + // Get the DetSets of the Clusters + edmNew::DetSet<TTStub<Ref_Phase2TrackerDigi_> > stubs = (*TTStubHandle)[stackDetid]; + const GeomDetUnit* det0 = theTrackerGeom->idToDetUnit(detid); + const auto* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(det0); + const PixelTopology* topol = dynamic_cast<const PixelTopology*>(&(theGeomDet->specificTopology())); + + // loop over stubs + for (auto stubIter = stubs.begin(); stubIter != stubs.end(); ++stubIter) { + edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > tempStubPtr = + edmNew::makeRefTo(TTStubHandle, stubIter); + + int isBarrel = 0; + int layer = -999999; + if (detid.subdetId() == StripSubdetector::TOB) { + isBarrel = 1; + layer = static_cast<int>(tTopo->layer(detid)); + } else if (detid.subdetId() == StripSubdetector::TID) { + isBarrel = 0; + layer = static_cast<int>(tTopo->layer(detid)); + } else { + edm::LogVerbatim("Tracklet") << "WARNING -- neither TOB or TID stub, shouldn't happen..."; + layer = -1; + } + + int isPSmodule = 0; + if (topol->nrows() == 960) + isPSmodule = 1; + + MeasurementPoint coords = tempStubPtr->clusterRef(0)->findAverageLocalCoordinatesCentered(); + LocalPoint clustlp = topol->localPosition(coords); + GlobalPoint posStub = theGeomDet->surface().toGlobal(clustlp); + + double tmp_stub_x = posStub.x(); + double tmp_stub_y = posStub.y(); + double tmp_stub_z = posStub.z(); + + float trigDisplace = tempStubPtr->rawBend(); + float trigOffset = tempStubPtr->bendOffset(); + float trigPos = tempStubPtr->innerClusterPosition(); + float trigBend = tempStubPtr->bendFE(); + + m_allstub_x->push_back(tmp_stub_x); + m_allstub_y->push_back(tmp_stub_y); + m_allstub_z->push_back(tmp_stub_z); + m_allstub_isBarrel->push_back(isBarrel); + m_allstub_layer->push_back(layer); + m_allstub_isPSmodule->push_back(isPSmodule); + m_allstub_trigDisplace->push_back(trigDisplace); + m_allstub_trigOffset->push_back(trigOffset); + m_allstub_trigPos->push_back(trigPos); + m_allstub_trigBend->push_back(trigBend); + + // matched to tracking particle? + edm::Ptr<TrackingParticle> my_tp = MCTruthTTStubHandle->findTrackingParticlePtr(tempStubPtr); + + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + + if (my_tp.isNull() == false) { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) continue; // this means stub from pileup track + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + } + int tmp_stub_genuine = 0; + if (MCTruthTTStubHandle->isGenuine(tempStubPtr)) tmp_stub_genuine = 1; + + m_allstub_matchTP_pdgid->push_back(myTP_pdgid); + m_allstub_matchTP_pt->push_back(myTP_pt); + m_allstub_matchTP_eta->push_back(myTP_eta); + m_allstub_matchTP_phi->push_back(myTP_phi); + m_allstub_genuine->push_back(tmp_stub_genuine); + } + } + } + + + // ---------------------------------------------------------------------------------------------- + // loop over (prompt) L1 tracks + // ---------------------------------------------------------------------------------------------- + if (SaveAllTracks && (Displaced=="Prompt" || Displaced=="Both")) { + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; + edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + } + + int this_l1track = 0; + for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { + edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > l1track_ptr(TTTrackHandle, this_l1track); + this_l1track++; + + float tmp_trk_pt = iterL1Track->momentum().perp(); + float tmp_trk_eta = iterL1Track->momentum().eta(); + float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_z0 = iterL1Track->z0(); //cm + int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 + + float tmp_trk_d0 = -999; + if (tmp_trk_nFitPars == 5) { + float tmp_trk_x0 = iterL1Track->POCA().x(); + float tmp_trk_y0 = iterL1Track->POCA().y(); + tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); + // tmp_trk_d0 = iterL1Track->d0(); + } + + float tmp_trk_chi2 = iterL1Track->chi2(); + float tmp_trk_chi2dof = iterL1Track->chi2Red(); + float tmp_trk_chi2rphi = iterL1Track->chi2XY(); + float tmp_trk_chi2rz = iterL1Track->chi2Z(); + float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = iterL1Track->getStubRefs(); + int tmp_trk_nstub = (int)stubRefs.size(); + int tmp_trk_seed = 0; + tmp_trk_seed = (int)iterL1Track->trackSeedType(); + int tmp_trk_hitpattern = 0; + tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); + unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); + + // ---------------------------------------------------------------------------------------------- + // loop over stubs on tracks + int tmp_trk_dhits = 0; + int tmp_trk_lhits = 0; + if (true) { + // loop over stubs + for (int is = 0; is < tmp_trk_nstub; is++) { + //detID of stub + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); + const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); + Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); + + double x = posStub.x(); + double y = posStub.y(); + double z = posStub.z(); + + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_dhits += pow(10, layer - 1); + } + } //end loop over stubs + } + // ---------------------------------------------------------------------------------------------- + + int tmp_trk_genuine = 0; + int tmp_trk_loose = 0; + int tmp_trk_unknown = 0; + int tmp_trk_combinatoric = 0; + if (MCTruthTTTrackHandle->isLooselyGenuine(l1track_ptr)) + tmp_trk_loose = 1; + if (MCTruthTTTrackHandle->isGenuine(l1track_ptr)) + tmp_trk_genuine = 1; + if (MCTruthTTTrackHandle->isUnknown(l1track_ptr)) + tmp_trk_unknown = 1; + if (MCTruthTTTrackHandle->isCombinatoric(l1track_ptr)) + tmp_trk_combinatoric = 1; + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "L1 track," + << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi + << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 + << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz + << " nstub: " << tmp_trk_nstub; + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (is genuine)"; + if (tmp_trk_unknown) + edm::LogVerbatim("Tracklet") << " (is unknown)"; + if (tmp_trk_combinatoric) + edm::LogVerbatim("Tracklet") << " (is combinatoric)"; + } + + m_trk_pt->push_back(tmp_trk_pt); + m_trk_eta->push_back(tmp_trk_eta); + m_trk_phi->push_back(tmp_trk_phi); + m_trk_z0->push_back(tmp_trk_z0); + if (tmp_trk_nFitPars == 5) + m_trk_d0->push_back(tmp_trk_d0); + else + m_trk_d0->push_back(999.); + m_trk_chi2->push_back(tmp_trk_chi2); + m_trk_chi2dof->push_back(tmp_trk_chi2dof); + m_trk_chi2rphi->push_back(tmp_trk_chi2rphi); + m_trk_chi2rz->push_back(tmp_trk_chi2rz); + m_trk_bendchi2->push_back(tmp_trk_bendchi2); + m_trk_nstub->push_back(tmp_trk_nstub); + m_trk_dhits->push_back(tmp_trk_dhits); + m_trk_lhits->push_back(tmp_trk_lhits); + m_trk_seed->push_back(tmp_trk_seed); + m_trk_hitpattern->push_back(tmp_trk_hitpattern); + m_trk_phiSector->push_back(tmp_trk_phiSector); + m_trk_genuine->push_back(tmp_trk_genuine); + m_trk_loose->push_back(tmp_trk_loose); + m_trk_unknown->push_back(tmp_trk_unknown); + m_trk_combinatoric->push_back(tmp_trk_combinatoric); + + // ---------------------------------------------------------------------------------------------- + // for studying the fake rate + // ---------------------------------------------------------------------------------------------- + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(l1track_ptr); + + int myFake = 0; + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + float myTP_z0 = -999; + float myTP_dxy = -999; + + if (my_tp.isNull()) + myFake = 0; + else { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) myFake = 2; + else myFake = 1; + + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + myTP_z0 = my_tp->vertex().z(); + + float myTP_x0 = my_tp->vertex().x(); + float myTP_y0 = my_tp->vertex().y(); + myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() + << " dxy = " << myTP_dxy; + } + } + + m_trk_fake->push_back(myFake); + m_trk_matchtp_pdgid->push_back(myTP_pdgid); + m_trk_matchtp_pt->push_back(myTP_pt); + m_trk_matchtp_eta->push_back(myTP_eta); + m_trk_matchtp_phi->push_back(myTP_phi); + m_trk_matchtp_z0->push_back(myTP_z0); + m_trk_matchtp_dxy->push_back(myTP_dxy); + } //end track loop + } //end if SaveAllTracks + + // ---------------------------------------------------------------------------------------------- + // loop over (extended) L1 tracks + // ---------------------------------------------------------------------------------------------- + if (SaveAllTracks && (Displaced=="Displaced" || Displaced=="Both")) { + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; + edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + } + + int this_l1track = 0; + for (iterL1Track = TTTrackExtendedHandle->begin(); iterL1Track != TTTrackExtendedHandle->end(); iterL1Track++) { + edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > l1track_ptr(TTTrackExtendedHandle, this_l1track); + this_l1track++; + + float tmp_trk_pt = iterL1Track->momentum().perp(); + float tmp_trk_eta = iterL1Track->momentum().eta(); + float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_z0 = iterL1Track->z0(); //cm + int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 + + float tmp_trk_d0 = -999; + if (tmp_trk_nFitPars == 5) { + float tmp_trk_x0 = iterL1Track->POCA().x(); + float tmp_trk_y0 = iterL1Track->POCA().y(); + tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); + // tmp_trk_d0 = iterL1Track->d0(); + } + + float tmp_trk_chi2 = iterL1Track->chi2(); + float tmp_trk_chi2dof = iterL1Track->chi2Red(); + float tmp_trk_chi2rphi = iterL1Track->chi2XY(); + float tmp_trk_chi2rz = iterL1Track->chi2Z(); + float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = iterL1Track->getStubRefs(); + int tmp_trk_nstub = (int)stubRefs.size(); + int tmp_trk_seed = 0; + tmp_trk_seed = (int)iterL1Track->trackSeedType(); + int tmp_trk_hitpattern = 0; + tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); + unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); + + // ---------------------------------------------------------------------------------------------- + // loop over stubs on tracks + int tmp_trk_dhits = 0; + int tmp_trk_lhits = 0; + if (true) { + // loop over stubs + for (int is = 0; is < tmp_trk_nstub; is++) { + //detID of stub + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); + const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); + Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); + + double x = posStub.x(); + double y = posStub.y(); + double z = posStub.z(); + + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) + edm::LogVerbatim("Tracklet") + << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_dhits += pow(10, layer - 1); + } + } //end loop over stubs + } + // ---------------------------------------------------------------------------------------------- + + int tmp_trk_genuine = 0; + int tmp_trk_loose = 0; + int tmp_trk_unknown = 0; + int tmp_trk_combinatoric = 0; + if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(l1track_ptr)) + tmp_trk_loose = 1; + if (MCTruthTTTrackExtendedHandle->isGenuine(l1track_ptr)) + tmp_trk_genuine = 1; + if (MCTruthTTTrackExtendedHandle->isUnknown(l1track_ptr)) + tmp_trk_unknown = 1; + if (MCTruthTTTrackExtendedHandle->isCombinatoric(l1track_ptr)) + tmp_trk_combinatoric = 1; + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "L1 track," + << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi + << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 + << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz + << " nstub: " << tmp_trk_nstub; + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (is genuine)"; + if (tmp_trk_unknown) + edm::LogVerbatim("Tracklet") << " (is unknown)"; + if (tmp_trk_combinatoric) + edm::LogVerbatim("Tracklet") << " (is combinatoric)"; + } + + m_trkExt_pt->push_back(tmp_trk_pt); + m_trkExt_eta->push_back(tmp_trk_eta); + m_trkExt_phi->push_back(tmp_trk_phi); + m_trkExt_z0->push_back(tmp_trk_z0); + if (tmp_trk_nFitPars == 5) + m_trkExt_d0->push_back(tmp_trk_d0); + else + m_trkExt_d0->push_back(999.); + m_trkExt_chi2->push_back(tmp_trk_chi2); + m_trkExt_chi2dof->push_back(tmp_trk_chi2dof); + m_trkExt_chi2rphi->push_back(tmp_trk_chi2rphi); + m_trkExt_chi2rz->push_back(tmp_trk_chi2rz); + m_trkExt_bendchi2->push_back(tmp_trk_bendchi2); + m_trkExt_nstub->push_back(tmp_trk_nstub); + m_trkExt_dhits->push_back(tmp_trk_dhits); + m_trkExt_lhits->push_back(tmp_trk_lhits); + m_trkExt_seed->push_back(tmp_trk_seed); + m_trkExt_hitpattern->push_back(tmp_trk_hitpattern); + m_trkExt_phiSector->push_back(tmp_trk_phiSector); + m_trkExt_genuine->push_back(tmp_trk_genuine); + m_trkExt_loose->push_back(tmp_trk_loose); + m_trkExt_unknown->push_back(tmp_trk_unknown); + m_trkExt_combinatoric->push_back(tmp_trk_combinatoric); + + // ---------------------------------------------------------------------------------------------- + // for studying the fake rate + // ---------------------------------------------------------------------------------------------- + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(l1track_ptr); + + int myFake = 0; + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + float myTP_z0 = -999; + float myTP_dxy = -999; + + if (my_tp.isNull()) + myFake = 0; + else { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) myFake = 2; + else myFake = 1; + + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + myTP_z0 = my_tp->vertex().z(); + + float myTP_x0 = my_tp->vertex().x(); + float myTP_y0 = my_tp->vertex().y(); + myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); + + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() + << " dxy = " << myTP_dxy; + } + } + + m_trkExt_fake->push_back(myFake); + m_trkExt_matchtp_pdgid->push_back(myTP_pdgid); + m_trkExt_matchtp_pt->push_back(myTP_pt); + m_trkExt_matchtp_eta->push_back(myTP_eta); + m_trkExt_matchtp_phi->push_back(myTP_phi); + m_trkExt_matchtp_z0->push_back(myTP_z0); + m_trkExt_matchtp_dxy->push_back(myTP_dxy); + } //end track loop + } //end if SaveAllTracks (displaced) + + + // ---------------------------------------------------------------------------------------------- + // loop over tracking particles + // ---------------------------------------------------------------------------------------------- + if (DebugMode) + edm::LogVerbatim("Tracklet") << "\n Loop over tracking particles!"; + + int this_tp = 0; + std::vector<TrackingParticle>::const_iterator iterTP; + for (iterTP = TrackingParticleHandle->begin(); iterTP != TrackingParticleHandle->end(); ++iterTP) { + edm::Ptr<TrackingParticle> tp_ptr(TrackingParticleHandle, this_tp); + this_tp++; + + int tmp_eventid = iterTP->eventId().event(); + if (MyProcess != 1 && tmp_eventid > 0) + continue; //only care about tracking particles from the primary interaction (except for MyProcess==1, i.e. looking at all TPs) + + float tmp_tp_pt = iterTP->pt(); + float tmp_tp_eta = iterTP->eta(); + float tmp_tp_phi = iterTP->phi(); + float tmp_tp_vz = iterTP->vz(); + float tmp_tp_vx = iterTP->vx(); + float tmp_tp_vy = iterTP->vy(); + int tmp_tp_pdgid = iterTP->pdgId(); + float tmp_tp_z0_prod = tmp_tp_vz; + float tmp_tp_d0_prod = tmp_tp_vx * sin(tmp_tp_phi) - tmp_tp_vy * cos(tmp_tp_phi); + + if (MyProcess == 13 && abs(tmp_tp_pdgid) != 13) + continue; + if (MyProcess == 11 && abs(tmp_tp_pdgid) != 11) + continue; + if ((MyProcess == 6 || MyProcess == 15 || MyProcess == 211) && abs(tmp_tp_pdgid) != 211) + continue; + + if (tmp_tp_pt < TP_minPt) + continue; + if (std::abs(tmp_tp_eta) > TP_maxEta) + continue; + + // ---------------------------------------------------------------------------------------------- + // get d0/z0 propagated back to the IP + + float tmp_tp_t = tan(2.0 * atan(1.0) - 2.0 * atan(exp(-tmp_tp_eta))); + float delx = -tmp_tp_vx; + float dely = -tmp_tp_vy; + + float A = 0.01 * 0.5696; + float Kmagnitude = A / tmp_tp_pt; + float tmp_tp_charge = tp_ptr->charge(); + float K = Kmagnitude * tmp_tp_charge; + float d = 0; + float tmp_tp_x0p = delx - (d + 1. / (2. * K) * sin(tmp_tp_phi)); + float tmp_tp_y0p = dely + (d + 1. / (2. * K) * cos(tmp_tp_phi)); + float tmp_tp_rp = sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p); + float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K)); + tmp_tp_d0 = tmp_tp_d0 * (-1); //fix d0 sign + static double pi = 4.0 * atan(1.0); + float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p); + if (delphi < -pi) + delphi += 2.0 * pi; + if (delphi > pi) + delphi -= 2.0 * pi; + float tmp_tp_z0 = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K); + // ---------------------------------------------------------------------------------------------- + + if (std::abs(tmp_tp_z0) > TP_maxZ0) + continue; + + // for pions in ttbar, only consider TPs coming from near the IP! + float dxy = sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy); + float tmp_tp_dxy = dxy; + if (MyProcess == 6 && (dxy > 1.0)) + continue; + + if (DebugMode && (Displaced=="Prompt" || Displaced=="Both")) + edm::LogVerbatim("Tracklet") << "Tracking particle, pt: " << tmp_tp_pt << " eta: " << tmp_tp_eta + << " phi: " << tmp_tp_phi << " z0: " << tmp_tp_z0 << " d0: " << tmp_tp_d0 + << " z_prod: " << tmp_tp_z0_prod << " d_prod: " << tmp_tp_d0_prod + << " pdgid: " << tmp_tp_pdgid << " eventID: " << iterTP->eventId().event() + << " ttclusters " << MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).size() + << " ttstubs " << MCTruthTTStubHandle->findTTStubRefs(tp_ptr).size() << " tttracks " + << MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr).size(); + + // ---------------------------------------------------------------------------------------------- + // only consider TPs associated with >= 1 cluster, or >= X stubs, or have stubs in >= X layers (configurable options) + if (MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty()) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "No matching TTClusters for TP, continuing..."; + continue; + } + + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr); + int nStubTP = (int)theStubRefs.size(); + + // how many layers/disks have stubs? + int hasStubInLayer[11] = {0}; + for (auto& theStubRef : theStubRefs) { + DetId detid(theStubRef->getDetId()); + + int layer = -1; + if (detid.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detid)) - 1; //fill in array as entries 0-5 + } else if (detid.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detid)) + 5; //fill in array as entries 6-10 + } + + //treat genuine stubs separately (==2 is genuine, ==1 is not) + if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRef).isNull() && hasStubInLayer[layer] < 2) + hasStubInLayer[layer] = 1; + else + hasStubInLayer[layer] = 2; + } + + int nStubLayerTP = 0; + int nStubLayerTP_g = 0; + for (int isum : hasStubInLayer) { + if (isum >= 1) + nStubLayerTP += 1; + if (isum == 2) + nStubLayerTP_g += 1; + } + + if (DebugMode) + edm::LogVerbatim("Tracklet") << "TP is associated with " << nStubTP << " stubs, and has stubs in " << nStubLayerTP + << " different layers/disks, and has GENUINE stubs in " << nStubLayerTP_g + << " layers "; + + if (TP_minNStub > 0) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "Only consider TPs with >= " << TP_minNStub << " stubs"; + if (nStubTP < TP_minNStub) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "TP fails minimum nbr stubs requirement! Continuing..."; + continue; + } + } + if (TP_minNStubLayer > 0) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "Only consider TPs with stubs in >= " << TP_minNStubLayer << " layers/disks"; + if (nStubLayerTP < TP_minNStubLayer) { + if (DebugMode) + edm::LogVerbatim("Tracklet") << "TP fails stubs in minimum nbr of layers/disks requirement! Continuing..."; + continue; + } + } + + m_tp_pt->push_back(tmp_tp_pt); + m_tp_eta->push_back(tmp_tp_eta); + m_tp_phi->push_back(tmp_tp_phi); + m_tp_dxy->push_back(tmp_tp_dxy); + m_tp_z0->push_back(tmp_tp_z0); + m_tp_d0->push_back(tmp_tp_d0); + m_tp_z0_prod->push_back(tmp_tp_z0_prod); + m_tp_d0_prod->push_back(tmp_tp_d0_prod); + m_tp_pdgid->push_back(tmp_tp_pdgid); + m_tp_nstub->push_back(nStubTP); + m_tp_eventid->push_back(tmp_eventid); + m_tp_charge->push_back(tmp_tp_charge); + + // ---------------------------------------------------------------------------------------------- + // look for L1 tracks (prompt) matched to the tracking particle + if (Displaced=="Prompt" || Displaced=="Both") { + std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks = + MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr); + + int nMatch = 0; + int i_track = -1; + float i_chi2dof = 99999; + + if (!matchedTracks.empty()) { + if (DebugMode && (matchedTracks.size() > 1)) + edm::LogVerbatim("Tracklet") << "TrackingParticle has more than one matched L1 track!"; + + // ---------------------------------------------------------------------------------------------- + // loop over matched L1 tracks + // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters + // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack + + for (int it = 0; it < (int)matchedTracks.size(); it++) { + bool tmp_trk_genuine = false; + bool tmp_trk_loosegenuine = false; + if (MCTruthTTTrackHandle->isGenuine(matchedTracks.at(it))) + tmp_trk_genuine = true; + if (MCTruthTTTrackHandle->isLooselyGenuine(matchedTracks.at(it))) + tmp_trk_loosegenuine = true; + if (!tmp_trk_loosegenuine) + continue; + + if (DebugMode) { + if (MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { + edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; + } + else { + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); + edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z(); + } + edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " << matchedTracks.at(it)->momentum().perp() + << " eta = " << matchedTracks.at(it)->momentum().eta() + << " phi = " << matchedTracks.at(it)->momentum().phi() + << " chi2 = " << matchedTracks.at(it)->chi2() + << " consistency = " << matchedTracks.at(it)->stubPtConsistency() + << " z0 = " << matchedTracks.at(it)->z0() + << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (genuine!) "; + if (tmp_trk_loosegenuine) + edm::LogVerbatim("Tracklet") << " (loose genuine!) "; + } + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(it)->getStubRefs(); + int tmp_trk_nstub = stubRefs.size(); + + if (tmp_trk_nstub < L1Tk_minNStub) + continue; + + + float dmatch_pt = 999; + float dmatch_eta = 999; + float dmatch_phi = 999; + int match_id = 999; + + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); + dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); + dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); + dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); + match_id = my_tp->pdgId(); + float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); + + // ensure that track is uniquely matched to the TP we are looking at! + if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { + nMatch++; + if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { + i_track = it; + i_chi2dof = tmp_trk_chi2dof; + } + } + + } // end loop over matched L1 tracks + } // end has at least 1 matched L1 track + // ---------------------------------------------------------------------------------------------- + + float tmp_matchtrk_pt = -999; + float tmp_matchtrk_eta = -999; + float tmp_matchtrk_phi = -999; + float tmp_matchtrk_z0 = -999; + float tmp_matchtrk_d0 = -999; + float tmp_matchtrk_chi2 = -999; + float tmp_matchtrk_chi2dof = -999; + float tmp_matchtrk_chi2rphi = -999; + float tmp_matchtrk_chi2rz = -999; + float tmp_matchtrk_bendchi2 = -999; + int tmp_matchtrk_nstub = -999; + int tmp_matchtrk_dhits = -999; + int tmp_matchtrk_lhits = -999; + int tmp_matchtrk_seed = -999; + int tmp_matchtrk_hitpattern = -999; + int tmp_matchtrk_nFitPars = -999; + + if (nMatch > 1 && DebugMode) + edm::LogVerbatim("Tracklet") << "WARNING *** 2 or more matches to genuine L1 tracks ***"; + + if (nMatch > 0) { + tmp_matchtrk_pt = matchedTracks.at(i_track)->momentum().perp(); + tmp_matchtrk_eta = matchedTracks.at(i_track)->momentum().eta(); + tmp_matchtrk_phi = matchedTracks.at(i_track)->momentum().phi(); + tmp_matchtrk_z0 = matchedTracks.at(i_track)->z0(); + tmp_matchtrk_nFitPars = matchedTracks.at(i_track)->nFitPars(); + + if (tmp_matchtrk_nFitPars == 5) { + float tmp_matchtrk_x0 = matchedTracks.at(i_track)->POCA().x(); + float tmp_matchtrk_y0 = matchedTracks.at(i_track)->POCA().y(); + tmp_matchtrk_d0 = -tmp_matchtrk_x0 * sin(tmp_matchtrk_phi) + tmp_matchtrk_y0 * cos(tmp_matchtrk_phi); + // tmp_matchtrk_d0 = matchedTracks.at(i_track)->d0(); + } + + tmp_matchtrk_chi2 = matchedTracks.at(i_track)->chi2(); + tmp_matchtrk_chi2dof = matchedTracks.at(i_track)->chi2Red(); + tmp_matchtrk_chi2rphi = matchedTracks.at(i_track)->chi2XY(); + tmp_matchtrk_chi2rz = matchedTracks.at(i_track)->chi2Z(); + tmp_matchtrk_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); + tmp_matchtrk_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); + tmp_matchtrk_seed = (int)matchedTracks.at(i_track)->trackSeedType(); + tmp_matchtrk_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); + + // ------------------------------------------------------------------------------------------ + tmp_matchtrk_dhits = 0; + tmp_matchtrk_lhits = 0; + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(i_track)->getStubRefs(); + int tmp_nstub = stubRefs.size(); + + for (int is = 0; is < tmp_nstub; is++) { + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrk_lhits += pow(10, layer - 1); + } + else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrk_dhits += pow(10, layer - 1); + } + } + } + + m_tp_nmatch->push_back(nMatch); + + + m_matchtrk_pt->push_back(tmp_matchtrk_pt); + m_matchtrk_eta->push_back(tmp_matchtrk_eta); + m_matchtrk_phi->push_back(tmp_matchtrk_phi); + m_matchtrk_z0->push_back(tmp_matchtrk_z0); + m_matchtrk_d0->push_back(tmp_matchtrk_d0); + m_matchtrk_chi2->push_back(tmp_matchtrk_chi2); + m_matchtrk_chi2dof->push_back(tmp_matchtrk_chi2dof); + m_matchtrk_chi2rphi->push_back(tmp_matchtrk_chi2rphi); + m_matchtrk_chi2rz->push_back(tmp_matchtrk_chi2rz); + m_matchtrk_bendchi2->push_back(tmp_matchtrk_bendchi2); + m_matchtrk_nstub->push_back(tmp_matchtrk_nstub); + m_matchtrk_dhits->push_back(tmp_matchtrk_dhits); + m_matchtrk_lhits->push_back(tmp_matchtrk_lhits); + m_matchtrk_seed->push_back(tmp_matchtrk_seed); + m_matchtrk_hitpattern->push_back(tmp_matchtrk_hitpattern); + } + + // ---------------------------------------------------------------------------------------------- + // look for L1 tracks (extended) matched to the tracking particle + if (Displaced=="Displaced" || Displaced=="Both") { + std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks = + MCTruthTTTrackExtendedHandle->findTTTrackPtrs(tp_ptr); + + int nMatch = 0; + int i_track = -1; + float i_chi2dof = 99999; + + if (!matchedTracks.empty()) { + if (DebugMode && (matchedTracks.size() > 1)) + edm::LogVerbatim("Tracklet") << "TrackingParticle has more than one matched L1 track!"; + + // ---------------------------------------------------------------------------------------------- + // loop over matched L1 tracks + // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters + // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack + + for (int it = 0; it < (int)matchedTracks.size(); it++) { + bool tmp_trk_genuine = false; + bool tmp_trk_loosegenuine = false; + if (MCTruthTTTrackExtendedHandle->isGenuine(matchedTracks.at(it))) + tmp_trk_genuine = true; + if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(matchedTracks.at(it))) + tmp_trk_loosegenuine = true; + if (!tmp_trk_loosegenuine) + continue; + + if (DebugMode) { + if (MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { + edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; + } + else { + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); + edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z(); + } + edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " << matchedTracks.at(it)->momentum().perp() + << " eta = " << matchedTracks.at(it)->momentum().eta() + << " phi = " << matchedTracks.at(it)->momentum().phi() + << " chi2 = " << matchedTracks.at(it)->chi2() + << " consistency = " << matchedTracks.at(it)->stubPtConsistency() + << " z0 = " << matchedTracks.at(it)->z0() + << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); + if (tmp_trk_genuine) + edm::LogVerbatim("Tracklet") << " (genuine!) "; + if (tmp_trk_loosegenuine) + edm::LogVerbatim("Tracklet") << " (loose genuine!) "; + } + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(it)->getStubRefs(); + int tmp_trk_nstub = stubRefs.size(); + + if (tmp_trk_nstub < L1Tk_minNStub) + continue; + + + float dmatch_pt = 999; + float dmatch_eta = 999; + float dmatch_phi = 999; + int match_id = 999; + + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); + dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); + dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); + dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); + match_id = my_tp->pdgId(); + float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); + + // ensure that track is uniquely matched to the TP we are looking at! + if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { + nMatch++; + if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { + i_track = it; + i_chi2dof = tmp_trk_chi2dof; + } + } + + } // end loop over matched L1 tracks + } // end has at least 1 matched L1 track + // ---------------------------------------------------------------------------------------------- + + float tmp_matchtrkExt_pt = -999; + float tmp_matchtrkExt_eta = -999; + float tmp_matchtrkExt_phi = -999; + float tmp_matchtrkExt_z0 = -999; + float tmp_matchtrkExt_d0 = -999; + float tmp_matchtrkExt_chi2 = -999; + float tmp_matchtrkExt_chi2dof = -999; + float tmp_matchtrkExt_chi2rphi = -999; + float tmp_matchtrkExt_chi2rz = -999; + float tmp_matchtrkExt_bendchi2 = -999; + int tmp_matchtrkExt_nstub = -999; + int tmp_matchtrkExt_dhits = -999; + int tmp_matchtrkExt_lhits = -999; + int tmp_matchtrkExt_seed = -999; + int tmp_matchtrkExt_hitpattern = -999; + int tmp_matchtrkExt_nFitPars = -999; + + if (nMatch > 1 && DebugMode) + edm::LogVerbatim("Tracklet") << "WARNING *** 2 or more matches to genuine L1 tracks ***"; + + if (nMatch > 0) { + tmp_matchtrkExt_pt = matchedTracks.at(i_track)->momentum().perp(); + tmp_matchtrkExt_eta = matchedTracks.at(i_track)->momentum().eta(); + tmp_matchtrkExt_phi = matchedTracks.at(i_track)->momentum().phi(); + tmp_matchtrkExt_z0 = matchedTracks.at(i_track)->z0(); + tmp_matchtrkExt_nFitPars = matchedTracks.at(i_track)->nFitPars(); + + if (tmp_matchtrkExt_nFitPars == 5) { + float tmp_matchtrkExt_x0 = matchedTracks.at(i_track)->POCA().x(); + float tmp_matchtrkExt_y0 = matchedTracks.at(i_track)->POCA().y(); + tmp_matchtrkExt_d0 = -tmp_matchtrkExt_x0 * sin(tmp_matchtrkExt_phi) + tmp_matchtrkExt_y0 * cos(tmp_matchtrkExt_phi); + // tmp_matchtrkExt_d0 = matchedTracks.at(i_track)->d0(); + } + + tmp_matchtrkExt_chi2 = matchedTracks.at(i_track)->chi2(); + tmp_matchtrkExt_chi2dof = matchedTracks.at(i_track)->chi2Red(); + tmp_matchtrkExt_chi2rphi = matchedTracks.at(i_track)->chi2XY(); + tmp_matchtrkExt_chi2rz = matchedTracks.at(i_track)->chi2Z(); + tmp_matchtrkExt_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); + tmp_matchtrkExt_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); + tmp_matchtrkExt_seed = (int)matchedTracks.at(i_track)->trackSeedType(); + tmp_matchtrkExt_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); + + // ------------------------------------------------------------------------------------------ + tmp_matchtrkExt_dhits = 0; + tmp_matchtrkExt_lhits = 0; + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(i_track)->getStubRefs(); + int tmp_nstub = stubRefs.size(); + + for (int is = 0; is < tmp_nstub; is++) { + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrkExt_lhits += pow(10, layer - 1); + } + else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrkExt_dhits += pow(10, layer - 1); + } + } + } + + // m_tp_nmatch->push_back(nMatch); //modify to be matches for ext + m_matchtrkExt_pt->push_back(tmp_matchtrkExt_pt); + m_matchtrkExt_eta->push_back(tmp_matchtrkExt_eta); + m_matchtrkExt_phi->push_back(tmp_matchtrkExt_phi); + m_matchtrkExt_z0->push_back(tmp_matchtrkExt_z0); + m_matchtrkExt_d0->push_back(tmp_matchtrkExt_d0); + m_matchtrkExt_chi2->push_back(tmp_matchtrkExt_chi2); + m_matchtrkExt_chi2dof->push_back(tmp_matchtrkExt_chi2dof); + m_matchtrkExt_chi2rphi->push_back(tmp_matchtrkExt_chi2rphi); + m_matchtrkExt_chi2rz->push_back(tmp_matchtrkExt_chi2rz); + m_matchtrkExt_bendchi2->push_back(tmp_matchtrkExt_bendchi2); + m_matchtrkExt_nstub->push_back(tmp_matchtrkExt_nstub); + m_matchtrkExt_dhits->push_back(tmp_matchtrkExt_dhits); + m_matchtrkExt_lhits->push_back(tmp_matchtrkExt_lhits); + m_matchtrkExt_seed->push_back(tmp_matchtrkExt_seed); + m_matchtrkExt_hitpattern->push_back(tmp_matchtrkExt_hitpattern); + } + + } //end loop tracking particles + + + if (SaveTrackMET) { + if (Displaced=="Prompt" || Displaced=="Both") { + if (L1TkMETHandle.isValid()) { + trkMET = L1TkMETHandle->begin()->etMiss(); + } + else { + edm::LogWarning("DataNotFound")<< "\nWarning: tkMET handle not found in the event"<< std::endl; + } + + if (L1TkMHTHandle.isValid()) { + trkMHT = L1TkMHTHandle->begin()->EtMiss(); + trkHT = L1TkMHTHandle->begin()->etTotal(); + } + else { + edm::LogWarning("DataNotFound")<< "\nWarning: tkMHT handle not found in the event"<< std::endl; + } + } //end prompt-track quantities + + if (Displaced=="Displaced" || Displaced=="Both") { + if (L1TkMETExtendedHandle.isValid()) { + trkMETExt = L1TkMETExtendedHandle->begin()->etMiss(); + } + else { + edm::LogWarning("DataNotFound")<< "\nWarning: tkMETExtended handle not found in the event"<< std::endl; + } + + if (L1TkMHTExtendedHandle.isValid()) { + trkMHTExt = L1TkMHTExtendedHandle->begin()->EtMiss(); + trkHTExt = L1TkMHTExtendedHandle->begin()->etTotal(); + } + else { + edm::LogWarning("DataNotFound")<< "\nWarning: tkMHTExtended handle not found in the event"<< std::endl; + } + } //end displaced-track quantities + } + + if (SaveTrackJets) { + if (TrackFastJetsHandle.isValid() && (Displaced=="Prompt" || Displaced=="Both")) { + for (jetIter = TrackFastJetsHandle->begin(); jetIter != TrackFastJetsHandle->end(); ++jetIter) { + m_trkjet_vz->push_back(jetIter->jetVtx()); + m_trkjet_ntracks->push_back(jetIter->trkPtrs().size()); + m_trkjet_phi->push_back(jetIter->phi()); + m_trkjet_eta->push_back(jetIter->eta()); + m_trkjet_pt->push_back(jetIter->pt()); + m_trkjet_p->push_back(jetIter->p()); + } + } + if (TrackFastJetsExtendedHandle.isValid() && (Displaced=="Displaced" || Displaced=="Both")) { + for (jetIter = TrackFastJetsExtendedHandle->begin(); jetIter != TrackFastJetsExtendedHandle->end(); ++jetIter) { + m_trkjetExt_vz->push_back(jetIter->jetVtx()); + m_trkjetExt_ntracks->push_back(jetIter->trkPtrs().size()); + m_trkjetExt_phi->push_back(jetIter->phi()); + m_trkjetExt_eta->push_back(jetIter->eta()); + m_trkjetExt_pt->push_back(jetIter->pt()); + m_trkjetExt_p->push_back(jetIter->p()); + } + } + if ( !TrackJetsHandle.isValid() && (Displaced=="Prompt" || Displaced=="Both")) { + edm::LogWarning("DataNotFound")<< "\nWarning: TrackJetsHandle not found in the event"<< std::endl; + } + if ( !TrackJetsExtendedHandle.isValid() && (Displaced=="Displaced" || Displaced=="Both") ) { + edm::LogWarning("DataNotFound")<< "\nWarning: TrackJetsExtendedHandle not found in the event"<< std::endl; + } + if (TrackJetsHandle.isValid() && (Displaced=="Prompt" || Displaced=="Both")) { + for (jetIter = TrackJetsHandle->begin(); jetIter != TrackJetsHandle->end(); ++jetIter) { + m_2ltrkjet_vz->push_back(jetIter->jetVtx()); + m_2ltrkjet_ntracks->push_back(jetIter->ntracks()); + m_2ltrkjet_phi->push_back(jetIter->phi()); + m_2ltrkjet_eta->push_back(jetIter->eta()); + m_2ltrkjet_pt->push_back(jetIter->pt()); + m_2ltrkjet_p->push_back(jetIter->p()); + m_2ltrkjet_nDisplaced->push_back(jetIter->nDisptracks()); + m_2ltrkjet_nTight->push_back(jetIter->nTighttracks()); + m_2ltrkjet_nTightDisplaced->push_back(jetIter->nTightDisptracks()); + } + } + + if (TrackJetsExtendedHandle.isValid() && (Displaced=="Displaced" || Displaced=="Both")) { + for (jetIter = TrackJetsExtendedHandle->begin(); jetIter != TrackJetsExtendedHandle->end(); ++jetIter) { + m_2ltrkjetExt_vz->push_back(jetIter->jetVtx()); + m_2ltrkjetExt_ntracks->push_back(jetIter->ntracks()); + m_2ltrkjetExt_phi->push_back(jetIter->phi()); + m_2ltrkjetExt_eta->push_back(jetIter->eta()); + m_2ltrkjetExt_pt->push_back(jetIter->pt()); + m_2ltrkjetExt_p->push_back(jetIter->p()); + m_2ltrkjetExt_nDisplaced->push_back(jetIter->nDisptracks()); + m_2ltrkjetExt_nTight->push_back(jetIter->nTighttracks()); + m_2ltrkjetExt_nTightDisplaced->push_back(jetIter->nTightDisptracks()); + } + } + + if (L1TkPrimaryVertexHandle.isValid()) { + m_pv_L1reco->push_back(L1TkPrimaryVertexHandle->begin()->zvertex()); + } + else { + edm::LogWarning("DataNotFound")<< "\nWarning: L1TkPrimaryVertexHandle not found in the event"<< std::endl; + } + } // end track jets + + + eventTree->Fill(); + } // end of analyze() + + /////////////////////////// + // DEFINE THIS AS A PLUG-IN + DEFINE_FWK_MODULE(L1TrackObjectNtupleMaker); diff --git a/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker_cfg.py b/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker_cfg.py new file mode 100644 index 0000000000000..5d6e6d2b60aea --- /dev/null +++ b/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker_cfg.py @@ -0,0 +1,185 @@ +############################################################ +# define basic process +############################################################ + +import FWCore.ParameterSet.Config as cms +import FWCore.Utilities.FileUtils as FileUtils +import os + +############################################################ +# edit options here +############################################################ +L1TRK_INST ="L1TrackJets" ### if not in input DIGRAW then we make them in the above step +process = cms.Process(L1TRK_INST) + +L1TRKALGO = 'HYBRID' #baseline, 4par fit +# L1TRKALGO = 'HYBRID_DISPLACED' #extended, 5par fit +#L1TRKALGO = 'HYBRID_PROMPTANDDISP' + +DISPLACED = '' + +############################################################ +# import standard configurations +############################################################ + +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D49_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +############################################################ +# input and output +############################################################ + +process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(50)) + +readFiles = cms.untracked.vstring( + "/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/F7BF4AED-51F1-9D47-B86D-6C3DDA134AB9.root" +) +secFiles = cms.untracked.vstring() + +process.source = cms.Source ("PoolSource", + fileNames = readFiles, + secondaryFileNames = secFiles, + duplicateCheckMode = cms.untracked.string('noDuplicateCheck'), + ) + + +process.TFileService = cms.Service("TFileService", fileName = cms.string('CheckingJets_CMSSW11_CMS.root'), closeFileFast = cms.untracked.bool(True)) + + +############################################################ +# L1 tracking: remake stubs? +############################################################ + +#process.load('L1Trigger.TrackTrigger.TrackTrigger_cff') +#from L1Trigger.TrackTrigger.TTStubAlgorithmRegister_cfi import * +#process.load("SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff") + +#from SimTracker.TrackTriggerAssociation.TTClusterAssociation_cfi import * +#TTClusterAssociatorFromPixelDigis.digiSimLinks = cms.InputTag("simSiPixelDigis","Tracker") + +#process.TTClusterStub = cms.Path(process.TrackTriggerClustersStubs) +#process.TTClusterStubTruth = cms.Path(process.TrackTriggerAssociatorClustersStubs) + + +process.load("L1Trigger.TrackFindingTracklet.L1HybridEmulationTracks_cff") +process.load("L1Trigger.L1TTrackMatch.L1TrackJetProducer_cfi") +process.load("L1Trigger.L1TTrackMatch.L1TrackFastJetProducer_cfi") +process.load("L1Trigger.L1TTrackMatch.L1TrackerEtMissProducer_cfi") +process.load("L1Trigger.L1TTrackMatch.L1TkHTMissProducer_cfi") + + +# HYBRID: prompt tracking +if (L1TRKALGO == 'HYBRID'): + process.TTTracksEmulation = cms.Path(process.L1HybridTracks) + process.TTTracksEmulationWithTruth = cms.Path(process.L1HybridTracksWithAssociators) + process.pL1TrackJets = cms.Path(process.L1TrackJets) + process.pL1TrackFastJets=cms.Path(process.L1TrackFastJets) + process.pTkMET = cms.Path(process.L1TrackerEtMiss) + process.pTkMHT = cms.Path(process.L1TrackerHTMiss) + DISPLACED = 'Prompt' + +# HYBRID: extended tracking +elif (L1TRKALGO == 'HYBRID_DISPLACED'): + process.TTTracksEmulation = cms.Path(process.L1ExtendedHybridTracks) + process.TTTracksEmulationWithTruth = cms.Path(process.L1ExtendedHybridTracksWithAssociators) + process.pL1TrackJets = cms.Path(process.L1TrackJetsExtended) + process.pL1TrackFastJets = cms.Path(process.L1TrackFastJetsExtended) + process.pTkMET = cms.Path(process.L1TrackerEtMissExtended) + process.pTkMHT = cms.Path(process.L1TrackerHTMissExtended) + DISPLACED = 'Displaced'# + +# HYBRID: extended tracking +elif (L1TRKALGO == 'HYBRID_PROMPTANDDISP'): + process.TTTracksEmulation = cms.Path(process.L1PromptExtendedHybridTracks) + process.TTTracksEmulationWithTruth = cms.Path(process.L1PromptExtendedHybridTracksWithAssociators) + process.pL1TrackJets = cms.Path(process.L1TrackJets*process.L1TrackJetsExtended) + process.pL1TrackFastJets = cms.Path(process.L1TrackFastJets*process.L1TrackFastJetsExtended) + process.pTkMET = cms.Path(process.L1TrackerEtMiss*process.L1TrackerEtMissExtended) + process.pTkMHT = cms.Path(process.L1TrackerHTMiss*process.L1TrackerHTMissExtended) + DISPLACED = 'Both' + + +############################################################ +# Primary vertex +############################################################ +process.load("L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi") +process.pPV = cms.Path(process.L1TkPrimaryVertex) + + +############################################################ +# Define the track ntuple process, MyProcess is the (unsigned) PDGID corresponding to the process which is run +# e.g. single electron/positron = 11 +# single pion+/pion- = 211 +# single muon+/muon- = 13 +# pions in jets = 6 +# taus = 15 +# all TPs = 1 +############################################################ + +process.L1TrackNtuple = cms.EDAnalyzer('L1TrackObjectNtupleMaker', + MyProcess = cms.int32(1), + DebugMode = cms.bool(False), # printout lots of debug statements + SaveAllTracks = cms.bool(True), # save *all* L1 tracks, not just truth matched to primary particle + SaveStubs = cms.bool(False), # save some info for *all* stubs + Displaced = cms.string(DISPLACED),# "Prompt", "Displaced", "Both" + L1Tk_minNStub = cms.int32(4), # L1 tracks with >= 4 stubs + TP_minNStub = cms.int32(4), # require TP to have >= X number of stubs associated with it + TP_minNStubLayer = cms.int32(4), # require TP to have stubs in >= X layers/disks + TP_minPt = cms.double(2.0), # only save TPs with pt > X GeV + TP_maxEta = cms.double(2.5), # only save TPs with |eta| < X + TP_maxZ0 = cms.double(30.0), # only save TPs with |z0| < X cm + L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), # TTTracks, prompt + L1TrackExtendedInputTag = cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), # TTTracks, extended + MCTruthTrackInputTag = cms.InputTag("TTTrackAssociatorFromPixelDigis", "Level1TTTracks"), # MCTruth track, prompt + MCTruthTrackExtendedInputTag = cms.InputTag("TTTrackAssociatorFromPixelDigisExtended", "Level1TTTracks"), # MCTruth track, extended + L1StubInputTag = cms.InputTag("TTStubsFromPhase2TrackerDigis","StubAccepted"), + MCTruthClusterInputTag = cms.InputTag("TTClusterAssociatorFromPixelDigis", "ClusterAccepted"), + MCTruthStubInputTag = cms.InputTag("TTStubAssociatorFromPixelDigis", "StubAccepted"), + TrackingParticleInputTag = cms.InputTag("mix", "MergedTrackTruth"), + TrackingVertexInputTag = cms.InputTag("mix", "MergedTrackTruth"), + ## tracking in jets stuff (--> requires AK4 genjet collection present!) + TrackingInJets = cms.bool(False), + GenJetInputTag = cms.InputTag("ak4GenJets", ""), + ##track jets and track MET + SaveTrackJets = cms.bool(True), + SaveTrackMET = cms.bool(True), + TrackFastJetsInputTag = cms.InputTag("L1TrackFastJets","L1TrackFastJets"), + TrackFastJetsExtendedInputTag = cms.InputTag("L1TrackFastJetsExtended","L1TrackFastJetsExtended"), + TrackJetsInputTag=cms.InputTag("L1TrackJets", "L1TrackJets"), + TrackJetsExtendedInputTag=cms.InputTag("L1TrackJetsExtended", "L1TrackJetsExtended"), + TrackMETInputTag = cms.InputTag("L1TrackerEtMiss","L1TrackerEtMiss","L1TrackJets"), + TrackMETExtendedInputTag = cms.InputTag("L1TrackerEtMissExtended","L1TrackerEtMissExtended"), + TrackMHTInputTag = cms.InputTag("L1TrackerHTMiss","L1TrackerHTMiss","L1TrackJets"), + TrackMHTExtendedInputTag = cms.InputTag("L1TrackerHTMissExtended","L1TrackerHTMiss"), + GenParticleInputTag = cms.InputTag("genParticles",""), + RecoVertexInputTag=cms.InputTag("L1TkPrimaryVertex"), +) + +process.ntuple = cms.Path(process.L1TrackNtuple) + +process.out = cms.OutputModule( "PoolOutputModule", + fastCloning = cms.untracked.bool( False ), + fileName = cms.untracked.string("test.root" ) + ) +process.pOut = cms.EndPath(process.out) + + + +# use this if you want to re-run the stub making +# process.schedule = cms.Schedule(process.TTClusterStub,process.TTClusterStubTruth,process.TTTracksEmulationWithTruth,process.ntuple) + +# use this if cluster/stub associators not available +# process.schedule = cms.Schedule(process.TTClusterStubTruth,process.TTTracksEmulationWithTruth,process.ntuple) + +#process.schedule = cms.Schedule(process.pPV, process.pL1TrackJets, process.pL1TrackFastJets, process.pTkMET, process.pTkMHT,process.pOut) +#process.schedule = cms.Schedule(process.pPV, process.pL1TrackJets, process.pL1TrackFastJets, process.pTkMET, process.pTkMHT, process.ntuple) +#process.schedule = cms.Schedule(process.ntuple) +process.schedule = cms.Schedule(process.TTTracksEmulationWithTruth, process.pPV, process.pL1TrackJets, process.pL1TrackFastJets, process.pTkMET, process.pTkMHT, process.ntuple) From 976a1aec7b3bc41f94366928a521703a48141238 Mon Sep 17 00:00:00 2001 From: Emily <macdonald.e17@gmail.com> Date: Tue, 17 Nov 2020 19:49:10 -0600 Subject: [PATCH 214/309] name changes for CMS guidelines (cherry picked from commit 3eb74bb80c19fd2d510f5e41248f6f16256c4103) --- .../plugins/L1TkHTMissProducer.cc | 115 +++--- .../plugins/L1TrackFastJetProducer.cc | 82 ++--- .../plugins/L1TrackJetProducer.cc | 327 +++++++++--------- .../plugins/L1TrackJetProducer.h | 6 +- .../plugins/L1TrackerEtMissProducer.cc | 100 +++--- 5 files changed, 315 insertions(+), 315 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc index 1b204f2bc008d..d2b9db5e81d63 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc @@ -31,35 +31,35 @@ class L1TkHTMissProducer : public edm::EDProducer { virtual void endJob() ; // ----------member data --------------------------- - float jet_minPt; // [GeV] - float jet_maxEta; // [rad] - bool doVtxConstrain; // require vertex constraint - bool primaryVtxConstrain; // use event primary vertex instead of leading jet (if doVtxConstrain) - bool useCaloJets; // Determines whether or not calo jets are used - float deltaZ; // for jets [cm] (if DoTvxConstrain) - bool displaced; // Use prompt/displaced tracks - unsigned int minNtracksHighPt; - unsigned int minNtracksLowPt; - const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken; - const edm::EDGetTokenT< TkJetCollection > jetToken; + float jetMinPt_; // [GeV] + float jetMaxEta_; // [rad] + bool doVtxConstrain_; // require vertex constraint + bool primaryVtxConstrain_; // use event primary vertex instead of leading jet (if doVtxConstrain) + bool useCaloJets_; // Determines whether or not calo jets are used + float deltaZ_; // for jets [cm] (if DoTvxConstrain) + bool displaced_; // Use prompt/displaced tracks + unsigned int minNtracksHighPt_; + unsigned int minNtracksLowPt_; + const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken_; + const edm::EDGetTokenT< TkJetCollection > jetToken_; }; L1TkHTMissProducer::L1TkHTMissProducer(const edm::ParameterSet& iConfig) : -pvToken(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), -jetToken(consumes<TkJetCollection>(iConfig.getParameter<edm::InputTag>("L1TkJetInputTag"))) +pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), +jetToken_(consumes<TkJetCollection>(iConfig.getParameter<edm::InputTag>("L1TkJetInputTag"))) { - jet_minPt = (float)iConfig.getParameter<double>("jet_minPt"); - jet_maxEta = (float)iConfig.getParameter<double>("jet_maxEta"); - doVtxConstrain = iConfig.getParameter<bool>("doVtxConstrain"); - useCaloJets = iConfig.getParameter<bool>("useCaloJets"); - primaryVtxConstrain = iConfig.getParameter<bool>("primaryVtxConstrain"); - deltaZ = (float)iConfig.getParameter<double>("deltaZ"); - minNtracksHighPt=iConfig.getParameter<int>("jet_minNtracksHighPt"); - minNtracksLowPt=iConfig.getParameter<int>("jet_minNtracksLowPt"); - displaced = iConfig.getParameter<bool>("displaced"); - - if (useCaloJets) produces<TkHTMissCollection>("TkCaloHTMiss"); - else if (displaced) produces<TkHTMissCollection>("L1TrackerHTMissExtended"); + jetMinPt_ = (float)iConfig.getParameter<double>("jet_minPt"); + jetMaxEta_ = (float)iConfig.getParameter<double>("jet_maxEta"); + doVtxConstrain_ = iConfig.getParameter<bool>("doVtxConstrain"); + useCaloJets_ = iConfig.getParameter<bool>("useCaloJets"); + primaryVtxConstrain_ = iConfig.getParameter<bool>("primaryVtxConstrain"); + deltaZ_ = (float)iConfig.getParameter<double>("deltaZ"); + minNtracksHighPt_=iConfig.getParameter<int>("jet_minNtracksHighPt"); + minNtracksLowPt_=iConfig.getParameter<int>("jet_minNtracksLowPt"); + displaced_ = iConfig.getParameter<bool>("displaced"); + + if (useCaloJets_) produces<TkHTMissCollection>("TkCaloHTMiss"); + else if (displaced_) produces<TkHTMissCollection>("L1TrackerHTMissExtended"); else produces<TkHTMissCollection>("L1TrackerHTMiss"); } @@ -71,33 +71,33 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet // L1 primary vertex edm::Handle<TkPrimaryVertexCollection> L1VertexHandle; - iEvent.getByToken(pvToken, L1VertexHandle); + iEvent.getByToken(pvToken_, L1VertexHandle); std::vector<TkPrimaryVertex>::const_iterator vtxIter; // L1 track-trigger jets edm::Handle<TkJetCollection> L1TkJetsHandle; - iEvent.getByToken(jetToken, L1TkJetsHandle); + iEvent.getByToken(jetToken_, L1TkJetsHandle); std::vector<TkJet>::const_iterator jetIter; - if ( !L1TkJetsHandle.isValid() && !displaced ) { + if ( !L1TkJetsHandle.isValid() && !displaced_ ) { LogError("TkHTMissProducer") << "\nWarning: TkJetCollection not found in the event. Exit\n"; return; } - if ( !L1TkJetsHandle.isValid() && displaced ) { + if ( !L1TkJetsHandle.isValid() && displaced_ ) { LogError("TkHTMissProducer") << "\nWarning: TkJetExtendedCollection not found in the event. Exit\n"; return; } // ---------------------------------------------------------------------------------------------- - // if primaryVtxConstrain, use the primary vertex instead of z position from leading jet + // if primaryVtxConstrain_, use the primary vertex instead of z position from leading jet // ---------------------------------------------------------------------------------------------- - float evt_zvtx = 999; - bool found_vtx = false; + float evtZVtx = 999; + bool foundVtx = false; edm::Ref< TkPrimaryVertexCollection > L1VtxRef; // null reference - if (useCaloJets){ - if (doVtxConstrain && primaryVtxConstrain) { + if (useCaloJets_){ + if (doVtxConstrain_ && primaryVtxConstrain_) { if( !L1VertexHandle.isValid() ) { LogError("L1TkHTMissProducer")<< "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; return ; @@ -106,21 +106,21 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet std::vector<TkPrimaryVertex>::const_iterator vtxIter = L1VertexHandle->begin(); // by convention, the first vertex in the collection is the one that should // be used by default - evt_zvtx = vtxIter->zvertex(); - found_vtx = true; + evtZVtx = vtxIter->zvertex(); + foundVtx = true; int ivtx = 0; edm::Ref< TkPrimaryVertexCollection > vtxRef(L1VertexHandle, ivtx); L1VtxRef = vtxRef; } - } //endif primaryVtxConstrain + } //endif primaryVtxConstrain_ // ---------------------------------------------------------------------------------------------- // using z position of leading jet to define "event vertex" // ---------------------------------------------------------------------------------------------- float zvtx_jetpt = -1.0; //pt of jet determining the event vertex - float jet_vtxMax = 99.; //find z position of leading jet that has a z vertex! + float jetVtxMax = 99.; //find z position of leading jet that has a z vertex! - if (doVtxConstrain && !primaryVtxConstrain) { + if (doVtxConstrain_ && !primaryVtxConstrain_) { for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { int ibx = jetIter->bx(); // only consider jets from the central BX if (ibx != 0) continue; @@ -128,15 +128,15 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet float tmp_jet_vtx = jetIter->jetVtx(); float tmp_jet_pt = jetIter->pt(); float tmp_jet_eta = jetIter->eta(); - if (tmp_jet_pt < jet_minPt) continue; - if (fabs(tmp_jet_eta) > jet_maxEta) continue; - if (fabs(tmp_jet_vtx) > jet_vtxMax) continue; + if (tmp_jet_pt < jetMinPt_) continue; + if (fabs(tmp_jet_eta) > jetMaxEta_) continue; + if (fabs(tmp_jet_vtx) > jetVtxMax) continue; // find vertex position of leading jet if (tmp_jet_pt > zvtx_jetpt) { - evt_zvtx = tmp_jet_vtx; + evtZVtx = tmp_jet_vtx; zvtx_jetpt = tmp_jet_pt; - found_vtx = true; + foundVtx = true; } } //end loop over jets } //endif z position from leading jet @@ -145,7 +145,7 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet float sumPy_calo = 0; float HT_calo = 0; - if (doVtxConstrain && !found_vtx) LogWarning("L1TkHTMissProducer") + if (doVtxConstrain_ && !foundVtx) LogWarning("L1TkHTMissProducer") << "Didn't find any z vertex (based on jet vertices) for this event!\n"; // loop over jets @@ -157,16 +157,14 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet float tmp_jet_py = jetIter->py(); float tmp_jet_et = jetIter->et(); float tmp_jet_vtx = jetIter->jetVtx(); - float tmp_jet_pt = jetIter->pt(); - float tmp_jet_eta = jetIter->eta(); - if (tmp_jet_pt < jet_minPt) continue; - if (fabs(tmp_jet_eta) > jet_maxEta) continue; + if (jetIter->pt() < jetMinPt_) continue; + if (fabs(jetIter->eta()) > jetMaxEta_) continue; // vertex consistency requirement bool VtxRequirement = false; - if (found_vtx) VtxRequirement = fabs(tmp_jet_vtx - evt_zvtx) < deltaZ; + if (foundVtx) VtxRequirement = fabs(tmp_jet_vtx - evtZVtx) < deltaZ_; - if (!doVtxConstrain || VtxRequirement) { + if (!doVtxConstrain_ || VtxRequirement) { sumPx_calo += tmp_jet_px; sumPy_calo += tmp_jet_py; HT_calo += tmp_jet_et; @@ -179,8 +177,8 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet edm::RefProd<TkJetCollection> jetCollRef(L1TkJetsHandle); TkHTMiss tkHTM(missingEt, HT_calo, jetCollRef, L1VtxRef); - if (doVtxConstrain && !primaryVtxConstrain) { - tkHTM.setVtx(evt_zvtx); + if (doVtxConstrain_ && !primaryVtxConstrain_) { + tkHTM.setVtx(evtZVtx); } MHTCollection->push_back(tkHTM); @@ -198,11 +196,10 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet float tmp_jet_py = jetIter->py(); float tmp_jet_et = jetIter->et(); float tmp_jet_pt = jetIter->pt(); - float tmp_jet_eta = jetIter->eta(); - if (tmp_jet_pt < jet_minPt) continue; - if (fabs(tmp_jet_eta) > jet_maxEta) continue; - if(jetIter->ntracks()<minNtracksLowPt && tmp_jet_et>50)continue; - if(jetIter->ntracks()<minNtracksHighPt && tmp_jet_et>100)continue; + if (tmp_jet_pt < jetMinPt_) continue; + if (fabs(jetIter->eta()) > jetMaxEta_) continue; + if(jetIter->ntracks()<minNtracksLowPt_ && tmp_jet_et>50)continue; + if(jetIter->ntracks()<minNtracksHighPt_ && tmp_jet_et>100)continue; sumPx += tmp_jet_px; sumPy += tmp_jet_py; HT += tmp_jet_pt; @@ -215,7 +212,7 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet TkHTMiss tkHTM(missingEt, HT, jetCollRef, L1VtxRef); MHTCollection->push_back(tkHTM); - if (displaced) iEvent.put( std::move(MHTCollection), "L1TrackerHTMissExtended"); + if (displaced_) iEvent.put( std::move(MHTCollection), "L1TrackerHTMissExtended"); else iEvent.put( std::move(MHTCollection), "L1TrackerHTMiss"); } } //end producer diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc index 73d743ba8f985..a84ee590ea547 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc @@ -66,39 +66,39 @@ class L1TrackFastJetProducer : public edm::EDProducer virtual void endJob() ; // track selection criteria - float trk_zMax; // in [cm] - float trk_chi2dofMax; // maximum track chi2dof - double trk_bendChi2Max; // maximum track bendchi2 - float trk_ptMin; // in [GeV] - float trk_etaMax; // in [rad] - int trk_nStubMin; // minimum number of stubs - int trk_nPSStubMin; // minimum number of PS stubs - double deltaZ0Cut; // save with |L1z-z0| < maxZ0 - double coneSize; // Use anti-kt with this cone size - bool doTightChi2; - bool displaced; //use prompt/displaced tracks - - const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken; - edm::EDGetTokenT<TkPrimaryVertexCollection> PVertexToken; + float trkZMax_; // in [cm] + float trkChi2dofMax_; // maximum track chi2dof + double trkBendChi2Max_; // maximum track bendchi2 + float trkPtMin_; // in [GeV] + float trkEtaMax_; // in [rad] + int trkNStubMin_; // minimum number of stubs + int trkNPSStubMin_; // minimum number of PS stubs + double deltaZ0Cut_; // save with |L1z-z0| < maxZ0 + double coneSize_; // Use anti-kt with this cone size + bool doTightChi2_; + bool displaced_; //use prompt/displaced tracks + + const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_; + edm::EDGetTokenT<TkPrimaryVertexCollection> pvToken_; }; // constructor L1TrackFastJetProducer::L1TrackFastJetProducer(const edm::ParameterSet& iConfig) : -trackToken(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))), -PVertexToken(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1PrimaryVertexTag"))) +trackToken_(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))), +pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1PrimaryVertexTag"))) { - trk_zMax = (float)iConfig.getParameter<double>("trk_zMax"); - trk_chi2dofMax = (float)iConfig.getParameter<double>("trk_chi2dofMax"); - trk_bendChi2Max = iConfig.getParameter<double>("trk_bendChi2Max"); - trk_ptMin = (float)iConfig.getParameter<double>("trk_ptMin"); - trk_etaMax = (float)iConfig.getParameter<double>("trk_etaMax"); - trk_nStubMin = (int)iConfig.getParameter<int>("trk_nStubMin"); - trk_nPSStubMin = (int)iConfig.getParameter<int>("trk_nPSStubMin"); - deltaZ0Cut = (float)iConfig.getParameter<double>("deltaZ0Cut"); - coneSize = (float)iConfig.getParameter<double>("coneSize"); - doTightChi2 = iConfig.getParameter<bool>("doTightChi2"); - displaced = iConfig.getParameter<bool>("displaced"); - if (displaced) produces<TkJetCollection>("L1TrackFastJetsExtended"); + trkZMax_ = (float)iConfig.getParameter<double>("trk_zMax"); + trkChi2dofMax_ = (float)iConfig.getParameter<double>("trk_chi2dofMax"); + trkBendChi2Max_ = iConfig.getParameter<double>("trk_bendChi2Max"); + trkPtMin_ = (float)iConfig.getParameter<double>("trk_ptMin"); + trkEtaMax_ = (float)iConfig.getParameter<double>("trk_etaMax"); + trkNStubMin_ = (int)iConfig.getParameter<int>("trk_nStubMin"); + trkNPSStubMin_ = (int)iConfig.getParameter<int>("trk_nPSStubMin"); + deltaZ0Cut_ = (float)iConfig.getParameter<double>("deltaZ0Cut"); + coneSize_ = (float)iConfig.getParameter<double>("coneSize"); + doTightChi2_ = iConfig.getParameter<bool>("doTightChi2"); + displaced_ = iConfig.getParameter<bool>("displaced"); + if (displaced_) produces<TkJetCollection>("L1TrackFastJetsExtended"); else produces<TkJetCollection>("L1TrackFastJets"); } @@ -111,7 +111,7 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& // L1 tracks edm::Handle< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > TTTrackHandle; - iEvent.getByToken(trackToken, TTTrackHandle); + iEvent.getByToken(trackToken_, TTTrackHandle); std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator iterL1Track; // Tracker Topology @@ -122,9 +122,9 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); edm::Handle<TkPrimaryVertexCollection>TkPrimaryVertexHandle; - iEvent.getByToken(PVertexToken, TkPrimaryVertexHandle); + iEvent.getByToken(pvToken_, TkPrimaryVertexHandle); - fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, coneSize); + fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, coneSize_); std::vector<fastjet::PseudoJet> JetInputs; float recoVtx = TkPrimaryVertexHandle->begin()->zvertex(); @@ -138,13 +138,13 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& std::vector< edm::Ref<edmNew::DetSetVector< TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > theStubs = iterL1Track -> getStubRefs() ; int trk_nstub = (int)theStubs.size(); - if (fabs(trk_z0) > trk_zMax) continue; - if (fabs(iterL1Track->momentum().eta()) > trk_etaMax) continue; - if (trk_pt < trk_ptMin) continue; - if (trk_nstub < trk_nStubMin) continue; - if (trk_chi2dof>trk_chi2dofMax) continue; - if (trk_bendchi2 > trk_bendChi2Max) continue; - if (doTightChi2 && (trk_pt>20.0 && trk_chi2dof>5.0)) continue; + if (fabs(trk_z0) > trkZMax_) continue; + if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) continue; + if (trk_pt < trkPtMin_) continue; + if (trk_nstub < trkNStubMin_) continue; + if (trk_chi2dof>trkChi2dofMax_) continue; + if (trk_bendchi2 > trkBendChi2Max_) continue; + if (doTightChi2_ && (trk_pt>20.0 && trk_chi2dof>5.0)) continue; int trk_nPS = 0; for (int istub=0; istub<trk_nstub; istub++) { @@ -156,8 +156,8 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& } if (tmp_isPS) trk_nPS++; } - if (trk_nPS < trk_nPSStubMin) continue; - if (fabs(recoVtx-trk_z0) > deltaZ0Cut) continue; + if (trk_nPS < trkNPSStubMin_) continue; + if (fabs(recoVtx-trk_z0) > deltaZ0Cut_) continue; fastjet::PseudoJet psuedoJet(iterL1Track->momentum().x(), iterL1Track->momentum().y(), iterL1Track->momentum().z(), iterL1Track->momentum().mag()); JetInputs.push_back(psuedoJet); // input tracks for clustering @@ -187,7 +187,7 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& L1TrackFastJets->push_back(trkJet); }//end loop over Jet Outputs - if (displaced) iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJetsExtended"); + if (displaced_) iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJetsExtended"); else iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJets"); } diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc index a0e98ee0ca376..eb94134fa269d 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc @@ -52,82 +52,85 @@ class L1TrackJetProducer : public stream::EDProducer<> { typedef vector< L1TTTrackType > L1TTTrackCollectionType; static void fillDescriptions(ConfigurationDescriptions& descriptions); - bool TrackQualityCuts(float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0); - void L2_cluster(vector< Ptr<L1TTTrackType> > L1trk_ptrs, vector<int> ttrk, vector<int> tdtrk,vector<int> ttdtrk, maxzbin &mzb); - virtual etaphibin *L1_cluster(etaphibin *phislice); + bool trackQualityCuts(float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0); + void L2_cluster(vector< Ptr<L1TTTrackType> > L1TrkPtrs_, vector<int> ttrk_, vector<int> tdtrk_,vector<int> ttdtrk_, MaxZBin &mzb); + virtual EtaPhiBin *L1_cluster(EtaPhiBin *phislice); private: virtual void beginStream(StreamID) override; virtual void produce(Event&, const EventSetup&) override; virtual void endStream() override; - const EDGetTokenT<vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken; - vector< Ptr< L1TTTrackType > > L1trk_ptrs; - vector<int> zbincount; - vector<int> ttrk; - vector<int> tdtrk; - vector<int> ttdtrk; - float trk_zMax; - float trk_ptMax; - float trk_ptMin; - float trk_etaMax; - float trk_chi2dofMax; - float trk_bendChi2Max; - int trk_nPSStubMin; - int lowpTJetMinTrackMultiplicity; - int highpTJetMinTrackMultiplicity; - int zBins; - int etaBins; - int phiBins; - double minTrkJetpT; - float zStep; - float etaStep; - float phiStep; - bool displaced; - float d0_cutNStubs4; - float d0_cutNStubs5; - float nStubs4DisplacedChi2_Loose; - float nStubs5DisplacedChi2_Loose; - float nStubs4Displacedbend_Loose; - float nStubs5Displacedbend_Loose; - float nStubs4DisplacedChi2_Tight; - float nStubs5DisplacedChi2_Tight; - float nStubs4Displacedbend_Tight; - float nStubs5Displacedbend_Tight; + + // ----------member data --------------------------- + + const EDGetTokenT<vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_; + vector< Ptr< L1TTTrackType > > L1TrkPtrs_; + vector<int> zBinCount_; + vector<int> ttrk_; + vector<int> tdtrk_; + vector<int> ttdtrk_; + float trkZMax_; + float trkPtMax_; + float trkPtMin_; + float trkEtaMax_; + float trkChi2dofMax_; + float trkBendChi2Max_; + int trkNPSStubMin_; + int lowpTJetMinTrackMultiplicity_; + int highpTJetMinTrackMultiplicity_; + int zBins_; + int etaBins_; + int phiBins_; + double minTrkJetpT_; + float zStep_; + float etaStep_; + float phiStep_; + bool displaced_; + float d0CutNStubs4_; + float d0CutNStubs5_; + float nStubs4DisplacedChi2Loose_; + float nStubs5DisplacedChi2Loose_; + float nStubs4DisplacedBendLoose_; + float nStubs5DisplacedBendLoose_; + float nStubs4DisplacedChi2Tight_; + float nStubs5DisplacedChi2Tight_; + float nStubs4DisplacedBendTight_; + float nStubs5DisplacedBendTight_; }; L1TrackJetProducer::L1TrackJetProducer(const ParameterSet& iConfig): -trackToken(consumes< vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<InputTag>("L1TrackInputTag"))) +trackToken_(consumes< vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<InputTag>("L1TrackInputTag"))) { - trk_zMax = (float)iConfig.getParameter<double>("trk_zMax"); - trk_ptMax =(float)iConfig.getParameter<double>("trk_ptMax"); - trk_ptMin=(float)iConfig.getParameter<double>("trk_ptMin"); - trk_etaMax=(float)iConfig.getParameter<double>("trk_etaMax"); - trk_chi2dofMax=(float)iConfig.getParameter<double>("trk_chi2dofMax"); - trk_bendChi2Max=(float)iConfig.getParameter<double>("trk_bendChi2Max"); - trk_nPSStubMin=(int)iConfig.getParameter<int>("trk_nPSStubMin"); - minTrkJetpT=iConfig.getParameter<double>("minTrkJetpT"); - etaBins=(int)iConfig.getParameter<int>("etaBins"); - phiBins=(int)iConfig.getParameter<int>("phiBins"); - zBins=(int)iConfig.getParameter<int>("zBins"); - d0_cutNStubs4=(float)iConfig.getParameter<double>("d0_cutNStubs4"); - d0_cutNStubs5=(float)iConfig.getParameter<double>("d0_cutNStubs5"); - lowpTJetMinTrackMultiplicity=(int)iConfig.getParameter<int>("lowpTJetMinTrackMultiplicity"); - highpTJetMinTrackMultiplicity=(int)iConfig.getParameter<int>("highpTJetMinTrackMultiplicity"); - displaced=iConfig.getParameter<bool>("displaced"); - nStubs4DisplacedChi2_Loose=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Loose"); - nStubs5DisplacedChi2_Loose=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Loose"); - nStubs4Displacedbend_Loose=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Loose"); - nStubs5Displacedbend_Loose=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Loose"); - nStubs4DisplacedChi2_Tight=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Tight"); - nStubs5DisplacedChi2_Tight=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Tight"); - nStubs4Displacedbend_Tight=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Tight"); - nStubs5Displacedbend_Tight=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Tight"); - - zStep = 2.0 * trk_zMax / zBins; - etaStep = 2.0 * trk_etaMax / etaBins; //etaStep is the width of an etabin - phiStep = 2 * M_PI / phiBins; ////phiStep is the width of a phibin - - if (displaced) produces<TkJetCollection>("L1TrackJetsExtended"); + trkZMax_ = (float)iConfig.getParameter<double>("trk_zMax"); + trkPtMax_ =(float)iConfig.getParameter<double>("trk_ptMax"); + trkPtMin_=(float)iConfig.getParameter<double>("trk_ptMin"); + trkEtaMax_=(float)iConfig.getParameter<double>("trk_etaMax"); + trkChi2dofMax_=(float)iConfig.getParameter<double>("trk_chi2dofMax"); + trkBendChi2Max_=(float)iConfig.getParameter<double>("trk_bendChi2Max"); + trkNPSStubMin_=(int)iConfig.getParameter<int>("trk_nPSStubMin"); + minTrkJetpT_=iConfig.getParameter<double>("minTrkJetpT"); + etaBins_=(int)iConfig.getParameter<int>("etaBins"); + phiBins_=(int)iConfig.getParameter<int>("phiBins"); + zBins_=(int)iConfig.getParameter<int>("zBins"); + d0CutNStubs4_=(float)iConfig.getParameter<double>("d0_cutNStubs4"); + d0CutNStubs5_=(float)iConfig.getParameter<double>("d0_cutNStubs5"); + lowpTJetMinTrackMultiplicity_=(int)iConfig.getParameter<int>("lowpTJetMinTrackMultiplicity"); + highpTJetMinTrackMultiplicity_=(int)iConfig.getParameter<int>("highpTJetMinTrackMultiplicity"); + displaced_=iConfig.getParameter<bool>("displaced"); + nStubs4DisplacedChi2Loose_=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Loose"); + nStubs5DisplacedChi2Loose_=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Loose"); + nStubs4DisplacedBendLoose_=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Loose"); + nStubs5DisplacedBendLoose_=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Loose"); + nStubs4DisplacedChi2Tight_=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Tight"); + nStubs5DisplacedChi2Tight_=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Tight"); + nStubs4DisplacedBendTight_=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Tight"); + nStubs5DisplacedBendTight_=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Tight"); + + zStep_ = 2.0 * trkZMax_ / zBins_; + etaStep_ = 2.0 * trkEtaMax_ / etaBins_; //etaStep is the width of an etabin + phiStep_ = 2 * M_PI / phiBins_; ////phiStep is the width of a phibin + + if (displaced_) produces<TkJetCollection>("L1TrackJetsExtended"); else produces<TkJetCollection>("L1TrackJets"); } @@ -145,14 +148,14 @@ void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { const TrackerTopology* const tTopo = tTopoHandle.product(); edm::Handle< vector< TTTrack< Ref_Phase2TrackerDigi_ > > > TTTrackHandle; - iEvent.getByToken(trackToken, TTTrackHandle); + iEvent.getByToken(trackToken_, TTTrackHandle); vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator iterL1Track; - L1trk_ptrs.clear(); - zbincount.clear(); - ttrk.clear(); - tdtrk.clear(); - ttdtrk.clear(); + L1TrkPtrs_.clear(); + zBinCount_.clear(); + ttrk_.clear(); + tdtrk_.clear(); + ttdtrk_.clear(); unsigned int this_l1track = 0; for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { @@ -173,32 +176,32 @@ void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { } } - if (trk_nPS < trk_nPSStubMin) continue; - if (!TrackQualityCuts(trk_pt, trk_nstubs, trk_chi2dof, trk_bendchi2, fabs(trk_d0))) continue; - if (fabs(iterL1Track->z0()) > trk_zMax) continue; - if (fabs(iterL1Track->momentum().eta()) > trk_etaMax) continue; - if (trk_pt < trk_ptMin) continue; - L1trk_ptrs.push_back(trkPtr); - zbincount.push_back(0); - - if ((fabs(trk_d0)>d0_cutNStubs5 && trk_nstubs>=5)||(trk_nstubs==4 && fabs(trk_d0)>d0_cutNStubs4)) tdtrk.push_back(1); - else tdtrk.push_back(0); //displaced track - if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2_Tight && trk_bendchi2<nStubs5Displacedbend_Tight ) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2_Tight && trk_bendchi2<nStubs4Displacedbend_Tight )) ttrk.push_back(1); - else ttrk.push_back(0); - if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2_Tight && trk_bendchi2<nStubs5Displacedbend_Tight && fabs(trk_d0)>d0_cutNStubs5) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2_Tight && trk_bendchi2<nStubs4Displacedbend_Tight && fabs(trk_d0)>d0_cutNStubs4)) ttdtrk.push_back(1); - else ttdtrk.push_back(0); + if (trk_nPS < trkNPSStubMin_) continue; + if (!trackQualityCuts(trk_pt, trk_nstubs, trk_chi2dof, trk_bendchi2, fabs(trk_d0))) continue; + if (fabs(iterL1Track->z0()) > trkZMax_) continue; + if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) continue; + if (trk_pt < trkPtMin_) continue; + L1TrkPtrs_.push_back(trkPtr); + zBinCount_.push_back(0); + + if ((fabs(trk_d0)>d0CutNStubs5_ && trk_nstubs>=5)||(trk_nstubs==4 && fabs(trk_d0)>d0CutNStubs4_)) tdtrk_.push_back(1); + else tdtrk_.push_back(0); //displaced track + if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2Tight_ && trk_bendchi2<nStubs5DisplacedBendTight_ ) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2Tight_ && trk_bendchi2<nStubs4DisplacedBendTight_ )) ttrk_.push_back(1); + else ttrk_.push_back(0); + if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2Tight_ && trk_bendchi2<nStubs5DisplacedBendTight_ && fabs(trk_d0)>d0CutNStubs5_) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2Tight_ && trk_bendchi2<nStubs4DisplacedBendTight_ && fabs(trk_d0)>d0CutNStubs4_)) ttdtrk_.push_back(1); + else ttdtrk_.push_back(0); } - if (L1trk_ptrs.size()>0) { - maxzbin mzb; + if (L1TrkPtrs_.size()>0) { + MaxZBin mzb; - L2_cluster(L1trk_ptrs, ttrk, tdtrk,ttdtrk,mzb); + L2_cluster(L1TrkPtrs_, ttrk_, tdtrk_, ttdtrk_, mzb); edm::Ref< JetBxCollection > jetRef; //null, no Calo Jet Ref vector< Ptr< L1TTTrackType > > L1TrackAssocJet; if (mzb.clusters!=NULL) { for (int j=0; j<mzb.nclust; ++j) { //FILL Two Layer Jets for Jet Collection - if (mzb.clusters[j].pTtot<=trk_ptMin) continue; //protects against reading bad memory + if (mzb.clusters[j].pTtot<=trkPtMin_) continue; //protects against reading bad memory if (mzb.clusters[j].numtracks<1) continue; if (mzb.clusters[j].numtracks>5000) continue; float jetEta = mzb.clusters[j].eta; @@ -208,37 +211,37 @@ void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { float jetPy = jetPt*sin(jetPhi); float jetPz = jetPt*sinh(jetEta); float jetP = jetPt*cosh(jetEta); - int totalTighttrk = mzb.clusters[j].numttrks; + int totalTighttrk_ = mzb.clusters[j].numttrks; int totalDisptrk = mzb.clusters[j].numtdtrks; int totalTightDisptrk = mzb.clusters[j].numttdtrks; math::XYZTLorentzVector jetP4(jetPx,jetPy,jetPz,jetP); L1TrackAssocJet.clear(); - for (unsigned int t=0; t<L1trk_ptrs.size(); ++t) { + for (unsigned int t=0; t<L1TrkPtrs_.size(); ++t) { if (L1TrackAssocJet.size()==(unsigned int)mzb.clusters[j].numtracks) break; - float deta = L1trk_ptrs[t]->momentum().eta() - jetEta; - float dphi = L1trk_ptrs[t]->momentum().phi() - jetPhi; - float dZ = fabs(mzb.zbincenter - L1trk_ptrs[t]->z0()); - if (dZ<zStep && fabs(deta)<etaStep*2.0 && fabs(dphi)<phiStep*2.0) { - L1TrackAssocJet.push_back(L1trk_ptrs[t]); + float deta = L1TrkPtrs_[t]->momentum().eta() - jetEta; + float dphi = L1TrkPtrs_[t]->momentum().phi() - jetPhi; + float dZ = fabs(mzb.zbincenter - L1TrkPtrs_[t]->z0()); + if (dZ<zStep_ && fabs(deta)<etaStep_*2.0 && fabs(dphi)<phiStep_*2.0) { + L1TrackAssocJet.push_back(L1TrkPtrs_[t]); } } - TkJet trkJet(jetP4, L1TrackAssocJet, mzb.zbincenter, mzb.clusters[j].numtracks, totalTighttrk, totalDisptrk, totalTightDisptrk); + TkJet trkJet(jetP4, L1TrackAssocJet, mzb.zbincenter, mzb.clusters[j].numtracks, totalTighttrk_, totalDisptrk, totalTightDisptrk); //trkJet.setDispCounters(DispCounters); if (L1TrackAssocJet.size()>0) L1L1TrackJetProducer->push_back(trkJet); } } //free(mzb.clusters); - if (displaced) iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJetsExtended"); + if (displaced_) iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJetsExtended"); else iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJets"); delete[] mzb.clusters; } } -void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, vector<int>ttrk, vector<int>tdtrk, vector<int>ttdtrk, maxzbin &mzb) { - const int nz = zBins; - maxzbin all_zBins[nz]; - maxzbin mzbtemp; +void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, vector<int>ttrk_, vector<int>tdtrk_, vector<int>ttdtrk_, MaxZBin &mzb) { + const int nz = zBins_; + MaxZBin all_zBins[nz]; + MaxZBin mzbtemp; for (int z=0; z<nz; ++z) all_zBins[z] = mzbtemp; if (all_zBins==NULL) { @@ -246,35 +249,35 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v return; } - float zmin = -1.0*trk_zMax; - float zmax = zmin + 2*zStep; + float zmin = -1.0*trkZMax_; + float zmax = zmin + 2*zStep_; - etaphibin epbins[phiBins][etaBins]; // create grid of phiBins + EtaPhiBin epbins[phiBins_][etaBins_]; // create grid of phiBins float phi = -1.0 * M_PI; float eta; float etamin, etamax, phimin, phimax; - for (int i = 0; i<phiBins; ++i) { - eta = -1.0 * trk_etaMax; - for (int j = 0; j<etaBins; ++j) { + for (int i = 0; i<phiBins_; ++i) { + eta = -1.0 * trkEtaMax_; + for (int j = 0; j<etaBins_; ++j) { phimin = phi; - phimax = phi + phiStep; + phimax = phi + phiStep_; etamin = eta; - eta = eta + etaStep; + eta = eta + etaStep_; etamax = eta; epbins[i][j].phi = (phimin+phimax)/2.0; epbins[i][j].eta = (etamin+etamax)/2.0; } // for each etabin - phi = phi+phiStep; + phi = phi+phiStep_; } // for each phibin (finished creating epbins) mzb = all_zBins[0]; - int ntracks=L1trk_ptrs.size(); + int ntracks=L1TrkPtrs_.size(); // uninitalized arrays - etaphibin *L1clusters[phiBins]; - etaphibin L2cluster[ntracks]; + EtaPhiBin *L1clusters[phiBins_]; + EtaPhiBin L2cluster[ntracks]; - for (int zbin=0; zbin<zBins-1; ++zbin) { - for (int i=0; i<phiBins; ++i) { //First initialize pT, numtracks, used to 0 (or false) - for (int j=0; j<etaBins; ++j) { + for (int zbin=0; zbin<zBins_-1; ++zbin) { + for (int i=0; i<phiBins_; ++i) { //First initialize pT, numtracks, used to 0 (or false) + for (int j=0; j<etaBins_; ++j) { epbins[i][j].pTtot = 0; epbins[i][j].used = false; epbins[i][j].numtracks = 0; @@ -285,32 +288,32 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v L1clusters[i] = epbins[i]; } //for each phibin - for (unsigned int k=0; k<L1trk_ptrs.size(); ++k) { - float trkpt = L1trk_ptrs[k]->momentum().perp(); - float trketa = L1trk_ptrs[k]->momentum().eta(); - float trkphi = L1trk_ptrs[k]->momentum().phi(); - float trkZ = L1trk_ptrs[k]->z0(); + for (unsigned int k=0; k<L1TrkPtrs_.size(); ++k) { + float trkpt = L1TrkPtrs_[k]->momentum().perp(); + float trketa = L1TrkPtrs_[k]->momentum().eta(); + float trkphi = L1TrkPtrs_[k]->momentum().phi(); + float trkZ = L1TrkPtrs_[k]->z0(); - for (int i=0; i<phiBins; ++i) { - for (int j=0; j<etaBins; ++j) { + for (int i=0; i<phiBins_; ++i) { + for (int j=0; j<etaBins_; ++j) { L2cluster[k] = epbins[i][j]; if ((zmin<=trkZ && zmax>=trkZ) && - ((epbins[i][j].eta - etaStep/2.0 <= trketa && epbins[i][j].eta + etaStep/2.0 >= trketa) - && epbins[i][j].phi - phiStep/2.0 <= trkphi && epbins[i][j].phi + phiStep/2.0 >= trkphi - && (zbincount[k] != 2))) { - zbincount.at(k) = zbincount.at(k)+1; - if (trkpt<trk_ptMax) epbins[i][j].pTtot+=trkpt; - else epbins[i][j].pTtot+=trk_ptMax; - epbins[i][j].numttrks+=ttrk[k]; - epbins[i][j].numtdtrks+=tdtrk[k]; - epbins[i][j].numttdtrks+=ttdtrk[k]; + ((epbins[i][j].eta - etaStep_/2.0 <= trketa && epbins[i][j].eta + etaStep_/2.0 >= trketa) + && epbins[i][j].phi - phiStep_/2.0 <= trkphi && epbins[i][j].phi + phiStep_/2.0 >= trkphi + && (zBinCount_[k] != 2))) { + zBinCount_.at(k) = zBinCount_.at(k)+1; + if (trkpt<trkPtMax_) epbins[i][j].pTtot+=trkpt; + else epbins[i][j].pTtot+=trkPtMax_; + epbins[i][j].numttrks+=ttrk_[k]; + epbins[i][j].numtdtrks+=tdtrk_[k]; + epbins[i][j].numttdtrks+=ttdtrk_[k]; ++epbins[i][j].numtracks; } // if right bin } // for each phibin: j loop } // for each phibin: i loop } // end loop over tracks - for (int phislice=0; phislice<phiBins; ++phislice) { + for (int phislice=0; phislice<phiBins_; ++phislice) { L1clusters[phislice] = L1_cluster(epbins[phislice]); for (int ind=0; L1clusters[phislice][ind].pTtot!=0; ++ind) { L1clusters[phislice][ind].used = false; @@ -333,7 +336,7 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v int ttdtrk1, ttdtrk2; int used1, used2, used3, used4; - for (phibin=0; phibin<phiBins; ++phibin) { //Find eta-phibin with highest pT + for (phibin=0; phibin<phiBins_; ++phibin) { //Find eta-phibin with highest pT while(true) { hipT = 0; for (index1=0; L1clusters[phibin][index1].pTtot>0; ++index1) { @@ -360,12 +363,12 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v L1clusters[phibin][imax].used = true; // Add pT of upper neighbor // E1 is pT of the middle phibin (should be highest pT) - if (phibin != phiBins-1) { + if (phibin != phiBins_-1) { used1 = -1; used2 = -1; for (index1 = 0; L1clusters[phibin+1][index1].pTtot != 0; ++index1) { if (L1clusters[phibin+1][index1].used) continue; - if (fabs(L1clusters[phibin+1][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep) { + if (fabs(L1clusters[phibin+1][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep_) { E1 += L1clusters[phibin+1][index1].pTtot; trx1 += L1clusters[phibin+1][index1].numtracks; ttrk1 += L1clusters[phibin+1][index1].numttrks; @@ -392,13 +395,13 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v continue; } - if (phibin != phiBins-2) { // E2 will be the pT of the third phibin (should be lower than E1) + if (phibin != phiBins_-2) { // E2 will be the pT of the third phibin (should be lower than E1) used3 = -1; used4 = -1; for (index1 = 0; L1clusters[phibin+2][index1].pTtot != 0; ++index1) { if (L1clusters[phibin+2][index1].used) continue; - if (fabs(L1clusters[phibin+2][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep) { + if (fabs(L1clusters[phibin+2][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep_) { E2 += L1clusters[phibin+2][index1].pTtot; trx2 += L1clusters[phibin+2][index1].numtracks; ttrk2 += L1clusters[phibin+2][index1].numttrks; @@ -453,13 +456,13 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v } // while hipT not 0 } // for each phibin - for (phibin=0; phibin<phiBins; ++phibin) + for (phibin=0; phibin<phiBins_; ++phibin) delete [] L1clusters[phibin]; // Now merge clusters, if necessary for (int m=0; m<nclust-1; ++m) { for (int n=m+1; n<nclust; ++n) - if (L2cluster[n].eta == L2cluster[m].eta && (fabs(L2cluster[n].phi - L2cluster[m].phi) < 1.5*phiStep || fabs(L2cluster[n].phi - L2cluster[m].phi) > 6.0)) { + if (L2cluster[n].eta == L2cluster[m].eta && (fabs(L2cluster[n].phi - L2cluster[m].phi) < 1.5*phiStep_ || fabs(L2cluster[n].phi - L2cluster[m].phi) > 6.0)) { if (L2cluster[n].pTtot > L2cluster[m].pTtot) L2cluster[m].phi = L2cluster[n].phi; L2cluster[m].pTtot += L2cluster[n].pTtot; @@ -478,17 +481,17 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v // sum up all pTs in this zbin to find ht float ht = 0; for (int k=0; k<nclust; ++k) { - if (L2cluster[k].pTtot>50 && L2cluster[k].numtracks<lowpTJetMinTrackMultiplicity) + if (L2cluster[k].pTtot>50 && L2cluster[k].numtracks<lowpTJetMinTrackMultiplicity_) continue; - if (L2cluster[k].pTtot>100 && L2cluster[k].numtracks<highpTJetMinTrackMultiplicity) + if (L2cluster[k].pTtot>100 && L2cluster[k].numtracks<highpTJetMinTrackMultiplicity_) continue; - if (L2cluster[k].pTtot>minTrkJetpT) + if (L2cluster[k].pTtot>minTrkJetpT_) ht += L2cluster[k].pTtot; } // if ht is larger than previous max, this is the new vertex zbin all_zBins[zbin].znum = zbin; - all_zBins[zbin].clusters = new etaphibin[nclust]; + all_zBins[zbin].clusters = new EtaPhiBin[nclust]; all_zBins[zbin].nclust = nclust; all_zBins[zbin].zbincenter = (zmin+zmax)/2.0; for (int k=0; k<nclust; ++k) { @@ -506,18 +509,18 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1trk_ptrs, v mzb.zbincenter = (zmin+zmax)/2.0; } // Prepare for next zbin! - zmin = zmin+zStep; - zmax = zmax+zStep; + zmin = zmin+zStep_; + zmax = zmax+zStep_; } // for each zbin - for (int zbin=0; zbin<zBins-1; ++zbin) { + for (int zbin=0; zbin<zBins_-1; ++zbin) { if (zbin==mzb.znum) continue; delete[] all_zBins[zbin].clusters; } } -etaphibin *L1TrackJetProducer::L1_cluster(etaphibin *phislice) { - etaphibin *clusters = new etaphibin[etaBins/2]; +EtaPhiBin *L1TrackJetProducer::L1_cluster(EtaPhiBin *phislice) { + EtaPhiBin *clusters = new EtaPhiBin[etaBins_/2]; if (clusters==NULL) edm::LogWarning("L1TrackJetProducer")<<"Clusters memory not assigned!\n"; @@ -525,7 +528,7 @@ etaphibin *L1TrackJetProducer::L1_cluster(etaphibin *phislice) { float my_pt, left_pt, right_pt, right2pt; int nclust = 0; right2pt = 0; - for (int etabin=0; etabin<etaBins; ++etabin) { + for (int etabin=0; etabin<etaBins_; ++etabin) { // assign values for my pT and neighbors' pT if (phislice[etabin].used) continue; @@ -535,9 +538,9 @@ etaphibin *L1TrackJetProducer::L1_cluster(etaphibin *phislice) { } else left_pt = 0; - if (etabin < etaBins-1 && !phislice[etabin+1].used) { + if (etabin < etaBins_-1 && !phislice[etabin+1].used) { right_pt = phislice[etabin+1].pTtot; - if (etabin < etaBins-2 && !phislice[etabin+2].used) { + if (etabin < etaBins_-2 && !phislice[etabin+2].used) { right2pt = phislice[etabin+2].pTtot; } else @@ -582,7 +585,7 @@ etaphibin *L1TrackJetProducer::L1_cluster(etaphibin *phislice) { // Now merge clusters, if necessary for (int m = 0; m<nclust-1; ++m) { - if (fabs(clusters[m+1].eta - clusters[m].eta) < 1.5*etaStep) { + if (fabs(clusters[m+1].eta - clusters[m].eta) < 1.5*etaStep_) { if (clusters[m+1].pTtot > clusters[m].pTtot) { clusters[m].eta = clusters[m+1].eta; } @@ -598,7 +601,7 @@ etaphibin *L1TrackJetProducer::L1_cluster(etaphibin *phislice) { } // end if clusters neighbor in eta } // end for (m) loop - for (int i = nclust; i<etaBins/2; ++i) // zero out remaining unused clusters + for (int i = nclust; i<etaBins_/2; ++i) // zero out remaining unused clusters clusters[i].pTtot = 0; return clusters; } @@ -607,12 +610,12 @@ void L1TrackJetProducer::beginStream(StreamID) { } void L1TrackJetProducer::endStream() { } -bool L1TrackJetProducer::TrackQualityCuts(float trk_pt,int trk_nstub, float trk_chi2,float trk_bendchi2, float trk_d0) { +bool L1TrackJetProducer::trackQualityCuts(float trk_pt,int trk_nstub, float trk_chi2,float trk_bendchi2, float trk_d0) { bool PassQuality=false; - if (trk_bendchi2<trk_bendChi2Max && trk_chi2<trk_chi2dofMax && trk_nstub>=4 && !displaced) PassQuality = true; - if (displaced && trk_bendchi2<nStubs4Displacedbend_Tight && trk_chi2<nStubs4DisplacedChi2_Tight && trk_nstub==4 && trk_d0<=d0_cutNStubs4) PassQuality = true; - if (displaced && trk_bendchi2<nStubs4Displacedbend_Loose && trk_chi2<nStubs4DisplacedChi2_Loose && trk_nstub==4 && trk_d0>d0_cutNStubs4) PassQuality = true; - if (displaced && trk_bendchi2<nStubs5Displacedbend_Loose && trk_chi2<nStubs5DisplacedChi2_Loose && trk_nstub>4) PassQuality = true; + if (trk_bendchi2<trkBendChi2Max_ && trk_chi2<trkChi2dofMax_ && trk_nstub>=4 && !displaced_) PassQuality = true; + if (displaced_ && trk_bendchi2<nStubs4DisplacedBendTight_ && trk_chi2<nStubs4DisplacedChi2Tight_ && trk_nstub==4 && trk_d0<=d0CutNStubs4_) PassQuality = true; + if (displaced_ && trk_bendchi2<nStubs4DisplacedBendLoose_ && trk_chi2<nStubs4DisplacedChi2Loose_ && trk_nstub==4 && trk_d0>d0CutNStubs4_) PassQuality = true; + if (displaced_ && trk_bendchi2<nStubs5DisplacedBendLoose_ && trk_chi2<nStubs5DisplacedChi2Loose_ && trk_nstub>4) PassQuality = true; return PassQuality; } diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h index 255eeae6e53c7..91ef3aa289e3b 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h @@ -9,7 +9,7 @@ using namespace std; //Each individual box in the eta and phi dimension. // Also used to store final cluster data for each zbin. -struct etaphibin { +struct EtaPhiBin { float pTtot; int numtracks; int numttrks; @@ -21,10 +21,10 @@ struct etaphibin { }; //store important information for plots -struct maxzbin { +struct MaxZBin { int znum; //Numbered from 0 to nzbins (16, 32, or 64) in order int nclust; //number of clusters in this bin float zbincenter; - etaphibin *clusters; //list of all the clusters in this bin + EtaPhiBin *clusters; //list of all the clusters in this bin float ht; //sum of all cluster pTs--only the zbin with the maximum ht is stored }; diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index 62fa31fd90b96..a0248178d7a88 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -41,40 +41,40 @@ class L1TrackerEtMissProducer : public edm::EDProducer { virtual void endJob() ; // ----------member data --------------------------- - float maxZ0; // in cm - float deltaZ; // in cm - float maxEta; - float chi2dofMax; - float bendChi2Max; - float minPt; // in GeV - int nStubsmin; - int nPSStubsMin; // minimum number of stubs in PS modules - float maxPt; // in GeV - int highPtTracks; // saturate or truncate - bool displaced; //prompt/displaced tracks - - const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken; - const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken; + float maxZ0_; // in cm + float deltaZ_; // in cm + float maxEta_; + float chi2dofMax_; + float bendChi2Max_; + float minPt_; // in GeV + int nStubsmin_; + int nPSStubsMin_; // minimum number of stubs in PS modules + float maxPt_; // in GeV + int highPtTracks_; // saturate or truncate + bool displaced_; //prompt/displaced tracks + + const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken_; + const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_; }; //constructor// L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) : -pvToken(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), -trackToken(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) +pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), +trackToken_(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) { - maxZ0 = (float)iConfig.getParameter<double>("maxZ0"); - deltaZ = (float)iConfig.getParameter<double>("deltaZ"); - chi2dofMax = (float)iConfig.getParameter<double>("chi2dofMax"); - bendChi2Max = (float)iConfig.getParameter<double>("bendChi2Max"); - minPt = (float)iConfig.getParameter<double>("minPt"); - nStubsmin = iConfig.getParameter<int>("nStubsmin"); - nPSStubsMin = iConfig.getParameter<int>("nPSStubsMin"); - maxPt = (float)iConfig.getParameter<double>("maxPt"); - maxEta = (float)iConfig.getParameter<double>("maxEta"); - highPtTracks = iConfig.getParameter<int>("highPtTracks"); - displaced = iConfig.getParameter<bool>("displaced"); - - if (displaced) produces<TkEtMissCollection>("L1TrackerEtMissExtended"); + maxZ0_ = (float)iConfig.getParameter<double>("maxZ0"); + deltaZ_ = (float)iConfig.getParameter<double>("deltaZ"); + chi2dofMax_ = (float)iConfig.getParameter<double>("chi2dofMax"); + bendChi2Max_ = (float)iConfig.getParameter<double>("bendChi2Max"); + minPt_ = (float)iConfig.getParameter<double>("minPt"); + nStubsmin_ = iConfig.getParameter<int>("nStubsmin"); + nPSStubsMin_ = iConfig.getParameter<int>("nPSStubsMin"); + maxPt_ = (float)iConfig.getParameter<double>("maxPt"); + maxEta_ = (float)iConfig.getParameter<double>("maxEta"); + highPtTracks_ = iConfig.getParameter<int>("highPtTracks_"); + displaced_ = iConfig.getParameter<bool>("displaced"); + + if (displaced_) produces<TkEtMissCollection>("L1TrackerEtMissExtended"); else produces<TkEtMissCollection>("L1TrackerEtMiss"); } @@ -91,10 +91,10 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& const TrackerTopology* tTopo = tTopoHandle_.product(); edm::Handle<TkPrimaryVertexCollection> L1VertexHandle; - iEvent.getByToken(pvToken,L1VertexHandle); + iEvent.getByToken(pvToken_,L1VertexHandle); edm::Handle<L1TTTrackCollectionType> L1TTTrackHandle; - iEvent.getByToken(trackToken, L1TTTrackHandle); + iEvent.getByToken(trackToken_, L1TTTrackHandle); L1TTTrackCollectionType::const_iterator trackIter; if( !L1VertexHandle.isValid() ) { @@ -127,15 +127,15 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& std::vector< edm::Ref< edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ > >, TTStub< Ref_Phase2TrackerDigi_ > > > theStubs = trackIter -> getStubRefs() ; int nstubs = (int) theStubs.size(); - if (pt < minPt) continue; - if (fabs(z0) > maxZ0) continue; - if (fabs(eta) > maxEta) continue; - if (chi2dof > chi2dofMax) continue; - if (bendChi2 > bendChi2Max) continue; + if (pt < minPt_) continue; + if (fabs(z0) > maxZ0_) continue; + if (fabs(eta) > maxEta_) continue; + if (chi2dof > chi2dofMax_) continue; + if (bendChi2 > bendChi2Max_) continue; - if (maxPt > 0 && pt > maxPt) { - if (highPtTracks == 0) continue; // ignore these very high PT tracks: truncate - if (highPtTracks == 1) pt = maxPt; // saturate + if (maxPt_ > 0 && pt > maxPt_) { + if (highPtTracks_ == 0) continue; // ignore these very high PT tracks: truncate + if (highPtTracks_ == 1) pt = maxPt_; // saturate } int nPS = 0; // number of stubs in PS modules @@ -147,20 +147,20 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& } } - if (nstubs < nStubsmin) continue; - if (nPS < nPSStubsMin) continue; + if (nstubs < nStubsmin_) continue; + if (nPS < nPSStubsMin_) continue; - if (!displaced){ // if displaced, deltaZ = 3.0 cm, very loose + if (!displaced_){ // if displaced, deltaZ = 3.0 cm, very loose // construct deltaZ cut to be based on track eta - if ( fabs(eta)>=0 && fabs(eta)<0.7) deltaZ = 0.4; - else if ( fabs(eta)>=0.7 && fabs(eta)<1.0) deltaZ = 0.6; - else if ( fabs(eta)>=1.0 && fabs(eta)<1.2) deltaZ = 0.76; - else if ( fabs(eta)>=1.2 && fabs(eta)<1.6) deltaZ = 1.0; - else if ( fabs(eta)>=1.6 && fabs(eta)<2.0) deltaZ = 1.7; - else if ( fabs(eta)>=2.0 && fabs(eta)<=2.4) deltaZ = 2.2; + if ( fabs(eta)>=0 && fabs(eta)<0.7) deltaZ_ = 0.4; + else if ( fabs(eta)>=0.7 && fabs(eta)<1.0) deltaZ_ = 0.6; + else if ( fabs(eta)>=1.0 && fabs(eta)<1.2) deltaZ_ = 0.76; + else if ( fabs(eta)>=1.2 && fabs(eta)<1.6) deltaZ_ = 1.0; + else if ( fabs(eta)>=1.6 && fabs(eta)<2.0) deltaZ_ = 1.7; + else if ( fabs(eta)>=2.0 && fabs(eta)<=2.4) deltaZ_ = 2.2; } - if ( fabs(z0 - zVTX) <= deltaZ) { + if ( fabs(z0 - zVTX) <= deltaZ_) { sumPx += pt*cos(phi); sumPy += pt*sin(phi); etTot += pt; @@ -185,7 +185,7 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& ibx ) ); - if (displaced) iEvent.put( std::move(METCollection), "L1TrackerEtMissExtended"); + if (displaced_) iEvent.put( std::move(METCollection), "L1TrackerEtMissExtended"); else iEvent.put( std::move(METCollection), "L1TrackerEtMiss"); } // end producer From 5bd9fb7e825b84b82fee242f84579be313981534 Mon Sep 17 00:00:00 2001 From: Emily <macdonald.e17@gmail.com> Date: Tue, 17 Nov 2020 19:56:21 -0600 Subject: [PATCH 215/309] minor name change (cherry picked from commit 78122e62614ca37f2a106da971e29e9c66fcbdc3) --- L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index a0248178d7a88..7efbbd9748162 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -71,7 +71,7 @@ trackToken_(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig. nPSStubsMin_ = iConfig.getParameter<int>("nPSStubsMin"); maxPt_ = (float)iConfig.getParameter<double>("maxPt"); maxEta_ = (float)iConfig.getParameter<double>("maxEta"); - highPtTracks_ = iConfig.getParameter<int>("highPtTracks_"); + highPtTracks_ = iConfig.getParameter<int>("highPtTracks"); displaced_ = iConfig.getParameter<bool>("displaced"); if (displaced_) produces<TkEtMissCollection>("L1TrackerEtMissExtended"); From 987f7956ae6adde84a9f94d648ec4df86888bfaa Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Thu, 6 May 2021 18:35:04 +0200 Subject: [PATCH 216/309] code format --- .../plugins/L1TkHTMissProducer.cc | 140 +- .../plugins/L1TrackFastJetProducer.cc | 168 +- .../plugins/L1TrackJetProducer.cc | 569 ++-- .../plugins/L1TrackJetProducer.h | 19 +- .../plugins/L1TrackerEtMissProducer.cc | 165 +- .../test/L1TrackObjectNtupleMaker.cc | 2428 ++++++++--------- 6 files changed, 1776 insertions(+), 1713 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc index d2b9db5e81d63..3a03fc3483238 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc @@ -21,18 +21,17 @@ using namespace l1t; class L1TkHTMissProducer : public edm::EDProducer { public: - explicit L1TkHTMissProducer(const edm::ParameterSet&); - ~L1TkHTMissProducer(); + ~L1TkHTMissProducer() override; private: - virtual void beginJob() ; - virtual void produce(edm::Event&, const edm::EventSetup&); - virtual void endJob() ; + void beginJob() override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override; // ----------member data --------------------------- - float jetMinPt_; // [GeV] - float jetMaxEta_; // [rad] + float jetMinPt_; // [GeV] + float jetMaxEta_; // [rad] bool doVtxConstrain_; // require vertex constraint bool primaryVtxConstrain_; // use event primary vertex instead of leading jet (if doVtxConstrain) bool useCaloJets_; // Determines whether or not calo jets are used @@ -40,30 +39,32 @@ class L1TkHTMissProducer : public edm::EDProducer { bool displaced_; // Use prompt/displaced tracks unsigned int minNtracksHighPt_; unsigned int minNtracksLowPt_; - const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken_; - const edm::EDGetTokenT< TkJetCollection > jetToken_; + const edm::EDGetTokenT<TkPrimaryVertexCollection> pvToken_; + const edm::EDGetTokenT<TkJetCollection> jetToken_; }; -L1TkHTMissProducer::L1TkHTMissProducer(const edm::ParameterSet& iConfig) : -pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), -jetToken_(consumes<TkJetCollection>(iConfig.getParameter<edm::InputTag>("L1TkJetInputTag"))) -{ - jetMinPt_ = (float)iConfig.getParameter<double>("jet_minPt"); +L1TkHTMissProducer::L1TkHTMissProducer(const edm::ParameterSet& iConfig) + : pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), + jetToken_(consumes<TkJetCollection>(iConfig.getParameter<edm::InputTag>("L1TkJetInputTag"))) { + jetMinPt_ = (float)iConfig.getParameter<double>("jet_minPt"); jetMaxEta_ = (float)iConfig.getParameter<double>("jet_maxEta"); doVtxConstrain_ = iConfig.getParameter<bool>("doVtxConstrain"); useCaloJets_ = iConfig.getParameter<bool>("useCaloJets"); primaryVtxConstrain_ = iConfig.getParameter<bool>("primaryVtxConstrain"); deltaZ_ = (float)iConfig.getParameter<double>("deltaZ"); - minNtracksHighPt_=iConfig.getParameter<int>("jet_minNtracksHighPt"); - minNtracksLowPt_=iConfig.getParameter<int>("jet_minNtracksLowPt"); + minNtracksHighPt_ = iConfig.getParameter<int>("jet_minNtracksHighPt"); + minNtracksLowPt_ = iConfig.getParameter<int>("jet_minNtracksLowPt"); displaced_ = iConfig.getParameter<bool>("displaced"); - if (useCaloJets_) produces<TkHTMissCollection>("TkCaloHTMiss"); - else if (displaced_) produces<TkHTMissCollection>("L1TrackerHTMissExtended"); - else produces<TkHTMissCollection>("L1TrackerHTMiss"); + if (useCaloJets_) + produces<TkHTMissCollection>("TkCaloHTMiss"); + else if (displaced_) + produces<TkHTMissCollection>("L1TrackerHTMissExtended"); + else + produces<TkHTMissCollection>("L1TrackerHTMiss"); } -L1TkHTMissProducer::~L1TkHTMissProducer() { } +L1TkHTMissProducer::~L1TkHTMissProducer() {} void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; @@ -79,12 +80,12 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet iEvent.getByToken(jetToken_, L1TkJetsHandle); std::vector<TkJet>::const_iterator jetIter; - if ( !L1TkJetsHandle.isValid() && !displaced_ ) { + if (!L1TkJetsHandle.isValid() && !displaced_) { LogError("TkHTMissProducer") << "\nWarning: TkJetCollection not found in the event. Exit\n"; return; } - if ( !L1TkJetsHandle.isValid() && displaced_ ) { + if (!L1TkJetsHandle.isValid() && displaced_) { LogError("TkHTMissProducer") << "\nWarning: TkJetExtendedCollection not found in the event. Exit\n"; return; } @@ -94,43 +95,46 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet // ---------------------------------------------------------------------------------------------- float evtZVtx = 999; bool foundVtx = false; - edm::Ref< TkPrimaryVertexCollection > L1VtxRef; // null reference + edm::Ref<TkPrimaryVertexCollection> L1VtxRef; // null reference - if (useCaloJets_){ + if (useCaloJets_) { if (doVtxConstrain_ && primaryVtxConstrain_) { - if( !L1VertexHandle.isValid() ) { - LogError("L1TkHTMissProducer")<< "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; - return ; - } - else { + if (!L1VertexHandle.isValid()) { + LogError("L1TkHTMissProducer") << "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; + return; + } else { std::vector<TkPrimaryVertex>::const_iterator vtxIter = L1VertexHandle->begin(); // by convention, the first vertex in the collection is the one that should // be used by default evtZVtx = vtxIter->zvertex(); foundVtx = true; int ivtx = 0; - edm::Ref< TkPrimaryVertexCollection > vtxRef(L1VertexHandle, ivtx); + edm::Ref<TkPrimaryVertexCollection> vtxRef(L1VertexHandle, ivtx); L1VtxRef = vtxRef; } - } //endif primaryVtxConstrain_ + } //endif primaryVtxConstrain_ // ---------------------------------------------------------------------------------------------- // using z position of leading jet to define "event vertex" // ---------------------------------------------------------------------------------------------- - float zvtx_jetpt = -1.0; //pt of jet determining the event vertex - float jetVtxMax = 99.; //find z position of leading jet that has a z vertex! + float zvtx_jetpt = -1.0; //pt of jet determining the event vertex + float jetVtxMax = 99.; //find z position of leading jet that has a z vertex! if (doVtxConstrain_ && !primaryVtxConstrain_) { for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { - int ibx = jetIter->bx(); // only consider jets from the central BX - if (ibx != 0) continue; + int ibx = jetIter->bx(); // only consider jets from the central BX + if (ibx != 0) + continue; float tmp_jet_vtx = jetIter->jetVtx(); - float tmp_jet_pt = jetIter->pt(); + float tmp_jet_pt = jetIter->pt(); float tmp_jet_eta = jetIter->eta(); - if (tmp_jet_pt < jetMinPt_) continue; - if (fabs(tmp_jet_eta) > jetMaxEta_) continue; - if (fabs(tmp_jet_vtx) > jetVtxMax) continue; + if (tmp_jet_pt < jetMinPt_) + continue; + if (fabs(tmp_jet_eta) > jetMaxEta_) + continue; + if (fabs(tmp_jet_vtx) > jetVtxMax) + continue; // find vertex position of leading jet if (tmp_jet_pt > zvtx_jetpt) { @@ -138,41 +142,45 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet zvtx_jetpt = tmp_jet_pt; foundVtx = true; } - } //end loop over jets - } //endif z position from leading jet + } //end loop over jets + } //endif z position from leading jet float sumPx_calo = 0; float sumPy_calo = 0; float HT_calo = 0; - if (doVtxConstrain_ && !foundVtx) LogWarning("L1TkHTMissProducer") - << "Didn't find any z vertex (based on jet vertices) for this event!\n"; + if (doVtxConstrain_ && !foundVtx) + LogWarning("L1TkHTMissProducer") << "Didn't find any z vertex (based on jet vertices) for this event!\n"; // loop over jets for (jetIter = L1TkJetsHandle->begin(); jetIter != L1TkJetsHandle->end(); ++jetIter) { - int ibx = jetIter->bx(); // only consider jets from the central BX - if (ibx != 0) continue; + int ibx = jetIter->bx(); // only consider jets from the central BX + if (ibx != 0) + continue; float tmp_jet_px = jetIter->px(); float tmp_jet_py = jetIter->py(); float tmp_jet_et = jetIter->et(); float tmp_jet_vtx = jetIter->jetVtx(); - if (jetIter->pt() < jetMinPt_) continue; - if (fabs(jetIter->eta()) > jetMaxEta_) continue; + if (jetIter->pt() < jetMinPt_) + continue; + if (fabs(jetIter->eta()) > jetMaxEta_) + continue; // vertex consistency requirement bool VtxRequirement = false; - if (foundVtx) VtxRequirement = fabs(tmp_jet_vtx - evtZVtx) < deltaZ_; + if (foundVtx) + VtxRequirement = fabs(tmp_jet_vtx - evtZVtx) < deltaZ_; if (!doVtxConstrain_ || VtxRequirement) { sumPx_calo += tmp_jet_px; sumPy_calo += tmp_jet_py; HT_calo += tmp_jet_et; } - } //end loop over jets + } //end loop over jets // define missing HT - float et = sqrt(sumPx_calo*sumPx_calo + sumPy_calo*sumPy_calo); + float et = sqrt(sumPx_calo * sumPx_calo + sumPy_calo * sumPy_calo); math::XYZTLorentzVector missingEt(-sumPx_calo, -sumPy_calo, 0, et); edm::RefProd<TkJetCollection> jetCollRef(L1TkJetsHandle); TkHTMiss tkHTM(missingEt, HT_calo, jetCollRef, L1VtxRef); @@ -185,7 +193,7 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet iEvent.put(std::move(MHTCollection), "L1TkCaloHTMiss"); } - else { // Using standalone jets + else { // Using standalone jets float sumPx = 0; float sumPy = 0; float HT = 0; @@ -195,30 +203,36 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet float tmp_jet_px = jetIter->px(); float tmp_jet_py = jetIter->py(); float tmp_jet_et = jetIter->et(); - float tmp_jet_pt = jetIter->pt(); - if (tmp_jet_pt < jetMinPt_) continue; - if (fabs(jetIter->eta()) > jetMaxEta_) continue; - if(jetIter->ntracks()<minNtracksLowPt_ && tmp_jet_et>50)continue; - if(jetIter->ntracks()<minNtracksHighPt_ && tmp_jet_et>100)continue; + float tmp_jet_pt = jetIter->pt(); + if (tmp_jet_pt < jetMinPt_) + continue; + if (fabs(jetIter->eta()) > jetMaxEta_) + continue; + if (jetIter->ntracks() < minNtracksLowPt_ && tmp_jet_et > 50) + continue; + if (jetIter->ntracks() < minNtracksHighPt_ && tmp_jet_et > 100) + continue; sumPx += tmp_jet_px; sumPy += tmp_jet_py; HT += tmp_jet_pt; - } // end jet loop + } // end jet loop // define missing HT - float et = sqrt(sumPx*sumPx + sumPy*sumPy); + float et = sqrt(sumPx * sumPx + sumPy * sumPy); math::XYZTLorentzVector missingEt(-sumPx, -sumPy, 0, et); edm::RefProd<TkJetCollection> jetCollRef(L1TkJetsHandle); TkHTMiss tkHTM(missingEt, HT, jetCollRef, L1VtxRef); MHTCollection->push_back(tkHTM); - if (displaced_) iEvent.put( std::move(MHTCollection), "L1TrackerHTMissExtended"); - else iEvent.put( std::move(MHTCollection), "L1TrackerHTMiss"); + if (displaced_) + iEvent.put(std::move(MHTCollection), "L1TrackerHTMissExtended"); + else + iEvent.put(std::move(MHTCollection), "L1TrackerHTMiss"); } -} //end producer +} //end producer -void L1TkHTMissProducer::beginJob() { } +void L1TkHTMissProducer::beginJob() {} -void L1TkHTMissProducer::endJob() { } +void L1TkHTMissProducer::endJob() {} DEFINE_FWK_MODULE(L1TkHTMissProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc index a84ee590ea547..8449bc6377c30 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc @@ -48,71 +48,71 @@ using namespace std; // // ////////////////////////////// -class L1TrackFastJetProducer : public edm::EDProducer -{ +class L1TrackFastJetProducer : public edm::EDProducer { public: - - typedef TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType; - typedef std::vector< L1TTTrackType > L1TTTrackCollectionType; + typedef TTTrack<Ref_Phase2TrackerDigi_> L1TTTrackType; + typedef std::vector<L1TTTrackType> L1TTTrackCollectionType; explicit L1TrackFastJetProducer(const edm::ParameterSet&); - ~L1TrackFastJetProducer(); + ~L1TrackFastJetProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - virtual void beginJob() ; - virtual void produce(edm::Event&, const edm::EventSetup&); - virtual void endJob() ; + void beginJob() override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override; // track selection criteria - float trkZMax_; // in [cm] - float trkChi2dofMax_; // maximum track chi2dof - double trkBendChi2Max_; // maximum track bendchi2 - float trkPtMin_; // in [GeV] - float trkEtaMax_; // in [rad] - int trkNStubMin_; // minimum number of stubs - int trkNPSStubMin_; // minimum number of PS stubs - double deltaZ0Cut_; // save with |L1z-z0| < maxZ0 - double coneSize_; // Use anti-kt with this cone size + float trkZMax_; // in [cm] + float trkChi2dofMax_; // maximum track chi2dof + double trkBendChi2Max_; // maximum track bendchi2 + float trkPtMin_; // in [GeV] + float trkEtaMax_; // in [rad] + int trkNStubMin_; // minimum number of stubs + int trkNPSStubMin_; // minimum number of PS stubs + double deltaZ0Cut_; // save with |L1z-z0| < maxZ0 + double coneSize_; // Use anti-kt with this cone size bool doTightChi2_; - bool displaced_; //use prompt/displaced tracks + bool displaced_; //use prompt/displaced tracks - const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_; + const edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > trackToken_; edm::EDGetTokenT<TkPrimaryVertexCollection> pvToken_; }; // constructor -L1TrackFastJetProducer::L1TrackFastJetProducer(const edm::ParameterSet& iConfig) : -trackToken_(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))), -pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1PrimaryVertexTag"))) -{ - trkZMax_ = (float)iConfig.getParameter<double>("trk_zMax"); +L1TrackFastJetProducer::L1TrackFastJetProducer(const edm::ParameterSet& iConfig) + : trackToken_(consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >( + iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))), + pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1PrimaryVertexTag"))) { + trkZMax_ = (float)iConfig.getParameter<double>("trk_zMax"); trkChi2dofMax_ = (float)iConfig.getParameter<double>("trk_chi2dofMax"); trkBendChi2Max_ = iConfig.getParameter<double>("trk_bendChi2Max"); - trkPtMin_ = (float)iConfig.getParameter<double>("trk_ptMin"); - trkEtaMax_ = (float)iConfig.getParameter<double>("trk_etaMax"); - trkNStubMin_ = (int)iConfig.getParameter<int>("trk_nStubMin"); + trkPtMin_ = (float)iConfig.getParameter<double>("trk_ptMin"); + trkEtaMax_ = (float)iConfig.getParameter<double>("trk_etaMax"); + trkNStubMin_ = (int)iConfig.getParameter<int>("trk_nStubMin"); trkNPSStubMin_ = (int)iConfig.getParameter<int>("trk_nPSStubMin"); deltaZ0Cut_ = (float)iConfig.getParameter<double>("deltaZ0Cut"); coneSize_ = (float)iConfig.getParameter<double>("coneSize"); doTightChi2_ = iConfig.getParameter<bool>("doTightChi2"); displaced_ = iConfig.getParameter<bool>("displaced"); - if (displaced_) produces<TkJetCollection>("L1TrackFastJetsExtended"); - else produces<TkJetCollection>("L1TrackFastJets"); + if (displaced_) + produces<TkJetCollection>("L1TrackFastJetsExtended"); + else + produces<TkJetCollection>("L1TrackFastJets"); } // destructor -L1TrackFastJetProducer::~L1TrackFastJetProducer() { } +L1TrackFastJetProducer::~L1TrackFastJetProducer() {} // producer void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { std::unique_ptr<TkJetCollection> L1TrackFastJets(new TkJetCollection); // L1 tracks - edm::Handle< std::vector< TTTrack< Ref_Phase2TrackerDigi_ > > > TTTrackHandle; + edm::Handle<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackHandle; iEvent.getByToken(trackToken_, TTTrackHandle); - std::vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator iterL1Track; + std::vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator iterL1Track; // Tracker Topology edm::ESHandle<TrackerTopology> tTopoHandle_; @@ -121,11 +121,11 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& ESHandle<TrackerGeometry> tGeomHandle; iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); - edm::Handle<TkPrimaryVertexCollection>TkPrimaryVertexHandle; + edm::Handle<TkPrimaryVertexCollection> TkPrimaryVertexHandle; iEvent.getByToken(pvToken_, TkPrimaryVertexHandle); fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, coneSize_); - std::vector<fastjet::PseudoJet> JetInputs; + std::vector<fastjet::PseudoJet> JetInputs; float recoVtx = TkPrimaryVertexHandle->begin()->zvertex(); unsigned int this_l1track = 0; @@ -135,65 +135,85 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& float trk_z0 = iterL1Track->z0(); float trk_chi2dof = iterL1Track->chi2Red(); float trk_bendchi2 = iterL1Track->stubPtConsistency(); - std::vector< edm::Ref<edmNew::DetSetVector< TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > theStubs = iterL1Track -> getStubRefs() ; + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + theStubs = iterL1Track->getStubRefs(); int trk_nstub = (int)theStubs.size(); - if (fabs(trk_z0) > trkZMax_) continue; - if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) continue; - if (trk_pt < trkPtMin_) continue; - if (trk_nstub < trkNStubMin_) continue; - if (trk_chi2dof>trkChi2dofMax_) continue; - if (trk_bendchi2 > trkBendChi2Max_) continue; - if (doTightChi2_ && (trk_pt>20.0 && trk_chi2dof>5.0)) continue; + if (fabs(trk_z0) > trkZMax_) + continue; + if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) + continue; + if (trk_pt < trkPtMin_) + continue; + if (trk_nstub < trkNStubMin_) + continue; + if (trk_chi2dof > trkChi2dofMax_) + continue; + if (trk_bendchi2 > trkBendChi2Max_) + continue; + if (doTightChi2_ && (trk_pt > 20.0 && trk_chi2dof > 5.0)) + continue; int trk_nPS = 0; - for (int istub=0; istub<trk_nstub; istub++) { - DetId detId( theStubs.at(istub)->getDetId() ); + for (int istub = 0; istub < trk_nstub; istub++) { + DetId detId(theStubs.at(istub)->getDetId()); bool tmp_isPS = false; if (detId.det() == DetId::Detector::Tracker) { - if (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) tmp_isPS = true; - else if (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) tmp_isPS = true; + if (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) + tmp_isPS = true; + else if (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) + tmp_isPS = true; } - if (tmp_isPS) trk_nPS++; + if (tmp_isPS) + trk_nPS++; } - if (trk_nPS < trkNPSStubMin_) continue; - if (fabs(recoVtx-trk_z0) > deltaZ0Cut_) continue; - - fastjet::PseudoJet psuedoJet(iterL1Track->momentum().x(), iterL1Track->momentum().y(), iterL1Track->momentum().z(), iterL1Track->momentum().mag()); - JetInputs.push_back(psuedoJet); // input tracks for clustering - JetInputs.back().set_user_index(this_l1track-1); // save track index in the collection - } // end loop over tracks - - fastjet::ClusterSequence cs(JetInputs,jet_def); // define the output jet collection - std::vector<fastjet::PseudoJet> JetOutputs=fastjet::sorted_by_pt(cs.inclusive_jets(0)); // output jet collection, pT-ordered - - for (unsigned int ijet=0;ijet<JetOutputs.size();++ijet) { - math::XYZTLorentzVector jetP4(JetOutputs[ijet].px(),JetOutputs[ijet].py(),JetOutputs[ijet].pz(),JetOutputs[ijet].modp()); + if (trk_nPS < trkNPSStubMin_) + continue; + if (fabs(recoVtx - trk_z0) > deltaZ0Cut_) + continue; + + fastjet::PseudoJet psuedoJet(iterL1Track->momentum().x(), + iterL1Track->momentum().y(), + iterL1Track->momentum().z(), + iterL1Track->momentum().mag()); + JetInputs.push_back(psuedoJet); // input tracks for clustering + JetInputs.back().set_user_index(this_l1track - 1); // save track index in the collection + } // end loop over tracks + + fastjet::ClusterSequence cs(JetInputs, jet_def); // define the output jet collection + std::vector<fastjet::PseudoJet> JetOutputs = + fastjet::sorted_by_pt(cs.inclusive_jets(0)); // output jet collection, pT-ordered + + for (unsigned int ijet = 0; ijet < JetOutputs.size(); ++ijet) { + math::XYZTLorentzVector jetP4( + JetOutputs[ijet].px(), JetOutputs[ijet].py(), JetOutputs[ijet].pz(), JetOutputs[ijet].modp()); float sumpt = 0; float avgZ = 0; - std::vector< edm::Ptr< L1TTTrackType > > L1TrackPtrs; - std::vector<fastjet::PseudoJet> fjConstituents =fastjet::sorted_by_pt(cs.constituents(JetOutputs[ijet])); + std::vector<edm::Ptr<L1TTTrackType> > L1TrackPtrs; + std::vector<fastjet::PseudoJet> fjConstituents = fastjet::sorted_by_pt(cs.constituents(JetOutputs[ijet])); - for (unsigned int i=0; i<fjConstituents.size(); ++i) { + for (unsigned int i = 0; i < fjConstituents.size(); ++i) { auto index = fjConstituents[i].user_index(); - edm::Ptr< L1TTTrackType > trkPtr(TTTrackHandle, index) ; - L1TrackPtrs.push_back(trkPtr); // L1Tracks in the jet - sumpt = sumpt+trkPtr->momentum().perp(); - avgZ = avgZ+trkPtr->momentum().perp()*trkPtr->z0(); + edm::Ptr<L1TTTrackType> trkPtr(TTTrackHandle, index); + L1TrackPtrs.push_back(trkPtr); // L1Tracks in the jet + sumpt = sumpt + trkPtr->momentum().perp(); + avgZ = avgZ + trkPtr->momentum().perp() * trkPtr->z0(); } - avgZ = avgZ/sumpt; + avgZ = avgZ / sumpt; edm::Ref<JetBxCollection> jetRef; TkJet trkJet(jetP4, jetRef, L1TrackPtrs, avgZ); L1TrackFastJets->push_back(trkJet); - }//end loop over Jet Outputs + } //end loop over Jet Outputs - if (displaced_) iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJetsExtended"); - else iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJets"); + if (displaced_) + iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJetsExtended"); + else + iEvent.put(std::move(L1TrackFastJets), "L1TrackFastJets"); } -void L1TrackFastJetProducer::beginJob() { } +void L1TrackFastJetProducer::beginJob() {} -void L1TrackFastJetProducer::endJob() { } +void L1TrackFastJetProducer::endJob() {} void L1TrackFastJetProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { //The following says we do not know what parameters are allowed so do no validation diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc index eb94134fa269d..5ba4c6f13c915 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc @@ -27,44 +27,42 @@ #include "Geometry/CommonTopologies/interface/PixelGeomDetType.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" - -#include <memory> -#include <iostream> -#include <fstream> -#include <math.h> -#include <stdlib.h> -#include <string> -#include <cstdlib> +#include "L1TrackJetProducer.h" #include "TH1D.h" #include "TH2D.h" #include <TMath.h> -#include "L1TrackJetProducer.h" - +#include <cmath> +#include <cstdlib> +#include <fstream> +#include <iostream> +#include <memory> +#include <string> using namespace std; using namespace edm; using namespace l1t; class L1TrackJetProducer : public stream::EDProducer<> { public: - explicit L1TrackJetProducer(const ParameterSet&); - ~L1TrackJetProducer(); - typedef TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType; - typedef vector< L1TTTrackType > L1TTTrackCollectionType; + explicit L1TrackJetProducer(const ParameterSet &); + ~L1TrackJetProducer() override; + typedef TTTrack<Ref_Phase2TrackerDigi_> L1TTTrackType; + typedef vector<L1TTTrackType> L1TTTrackCollectionType; - static void fillDescriptions(ConfigurationDescriptions& descriptions); + static void fillDescriptions(ConfigurationDescriptions &descriptions); bool trackQualityCuts(float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0); - void L2_cluster(vector< Ptr<L1TTTrackType> > L1TrkPtrs_, vector<int> ttrk_, vector<int> tdtrk_,vector<int> ttdtrk_, MaxZBin &mzb); + void L2_cluster( + vector<Ptr<L1TTTrackType> > L1TrkPtrs_, vector<int> ttrk_, vector<int> tdtrk_, vector<int> ttdtrk_, MaxZBin &mzb); virtual EtaPhiBin *L1_cluster(EtaPhiBin *phislice); private: - virtual void beginStream(StreamID) override; - virtual void produce(Event&, const EventSetup&) override; - virtual void endStream() override; + void beginStream(StreamID) override; + void produce(Event &, const EventSetup &) override; + void endStream() override; // ----------member data --------------------------- - const EDGetTokenT<vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_; - vector< Ptr< L1TTTrackType > > L1TrkPtrs_; + const EDGetTokenT<vector<TTTrack<Ref_Phase2TrackerDigi_> > > trackToken_; + vector<Ptr<L1TTTrackType> > L1TrkPtrs_; vector<int> zBinCount_; vector<int> ttrk_; vector<int> tdtrk_; @@ -98,46 +96,47 @@ class L1TrackJetProducer : public stream::EDProducer<> { float nStubs5DisplacedBendTight_; }; -L1TrackJetProducer::L1TrackJetProducer(const ParameterSet& iConfig): -trackToken_(consumes< vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<InputTag>("L1TrackInputTag"))) -{ - trkZMax_ = (float)iConfig.getParameter<double>("trk_zMax"); - trkPtMax_ =(float)iConfig.getParameter<double>("trk_ptMax"); - trkPtMin_=(float)iConfig.getParameter<double>("trk_ptMin"); - trkEtaMax_=(float)iConfig.getParameter<double>("trk_etaMax"); - trkChi2dofMax_=(float)iConfig.getParameter<double>("trk_chi2dofMax"); - trkBendChi2Max_=(float)iConfig.getParameter<double>("trk_bendChi2Max"); - trkNPSStubMin_=(int)iConfig.getParameter<int>("trk_nPSStubMin"); - minTrkJetpT_=iConfig.getParameter<double>("minTrkJetpT"); - etaBins_=(int)iConfig.getParameter<int>("etaBins"); - phiBins_=(int)iConfig.getParameter<int>("phiBins"); - zBins_=(int)iConfig.getParameter<int>("zBins"); - d0CutNStubs4_=(float)iConfig.getParameter<double>("d0_cutNStubs4"); - d0CutNStubs5_=(float)iConfig.getParameter<double>("d0_cutNStubs5"); - lowpTJetMinTrackMultiplicity_=(int)iConfig.getParameter<int>("lowpTJetMinTrackMultiplicity"); - highpTJetMinTrackMultiplicity_=(int)iConfig.getParameter<int>("highpTJetMinTrackMultiplicity"); - displaced_=iConfig.getParameter<bool>("displaced"); - nStubs4DisplacedChi2Loose_=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Loose"); - nStubs5DisplacedChi2Loose_=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Loose"); - nStubs4DisplacedBendLoose_=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Loose"); - nStubs5DisplacedBendLoose_=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Loose"); - nStubs4DisplacedChi2Tight_=(float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Tight"); - nStubs5DisplacedChi2Tight_=(float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Tight"); - nStubs4DisplacedBendTight_=(float)iConfig.getParameter<double>("nStubs4Displacedbend_Tight"); - nStubs5DisplacedBendTight_=(float)iConfig.getParameter<double>("nStubs5Displacedbend_Tight"); +L1TrackJetProducer::L1TrackJetProducer(const ParameterSet &iConfig) + : trackToken_( + consumes<vector<TTTrack<Ref_Phase2TrackerDigi_> > >(iConfig.getParameter<InputTag>("L1TrackInputTag"))) { + trkZMax_ = (float)iConfig.getParameter<double>("trk_zMax"); + trkPtMax_ = (float)iConfig.getParameter<double>("trk_ptMax"); + trkPtMin_ = (float)iConfig.getParameter<double>("trk_ptMin"); + trkEtaMax_ = (float)iConfig.getParameter<double>("trk_etaMax"); + trkChi2dofMax_ = (float)iConfig.getParameter<double>("trk_chi2dofMax"); + trkBendChi2Max_ = (float)iConfig.getParameter<double>("trk_bendChi2Max"); + trkNPSStubMin_ = (int)iConfig.getParameter<int>("trk_nPSStubMin"); + minTrkJetpT_ = iConfig.getParameter<double>("minTrkJetpT"); + etaBins_ = (int)iConfig.getParameter<int>("etaBins"); + phiBins_ = (int)iConfig.getParameter<int>("phiBins"); + zBins_ = (int)iConfig.getParameter<int>("zBins"); + d0CutNStubs4_ = (float)iConfig.getParameter<double>("d0_cutNStubs4"); + d0CutNStubs5_ = (float)iConfig.getParameter<double>("d0_cutNStubs5"); + lowpTJetMinTrackMultiplicity_ = (int)iConfig.getParameter<int>("lowpTJetMinTrackMultiplicity"); + highpTJetMinTrackMultiplicity_ = (int)iConfig.getParameter<int>("highpTJetMinTrackMultiplicity"); + displaced_ = iConfig.getParameter<bool>("displaced"); + nStubs4DisplacedChi2Loose_ = (float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Loose"); + nStubs5DisplacedChi2Loose_ = (float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Loose"); + nStubs4DisplacedBendLoose_ = (float)iConfig.getParameter<double>("nStubs4Displacedbend_Loose"); + nStubs5DisplacedBendLoose_ = (float)iConfig.getParameter<double>("nStubs5Displacedbend_Loose"); + nStubs4DisplacedChi2Tight_ = (float)iConfig.getParameter<double>("nStubs4DisplacedChi2_Tight"); + nStubs5DisplacedChi2Tight_ = (float)iConfig.getParameter<double>("nStubs5DisplacedChi2_Tight"); + nStubs4DisplacedBendTight_ = (float)iConfig.getParameter<double>("nStubs4Displacedbend_Tight"); + nStubs5DisplacedBendTight_ = (float)iConfig.getParameter<double>("nStubs5Displacedbend_Tight"); zStep_ = 2.0 * trkZMax_ / zBins_; - etaStep_ = 2.0 * trkEtaMax_ / etaBins_; //etaStep is the width of an etabin - phiStep_ = 2 * M_PI / phiBins_; ////phiStep is the width of a phibin + etaStep_ = 2.0 * trkEtaMax_ / etaBins_; //etaStep is the width of an etabin + phiStep_ = 2 * M_PI / phiBins_; ////phiStep is the width of a phibin - if (displaced_) produces<TkJetCollection>("L1TrackJetsExtended"); - else produces<TkJetCollection>("L1TrackJets"); + if (displaced_) + produces<TkJetCollection>("L1TrackJetsExtended"); + else + produces<TkJetCollection>("L1TrackJets"); } -L1TrackJetProducer::~L1TrackJetProducer() { } - -void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { +L1TrackJetProducer::~L1TrackJetProducer() {} +void L1TrackJetProducer::produce(Event &iEvent, const EventSetup &iSetup) { unique_ptr<TkJetCollection> L1L1TrackJetProducer(new TkJetCollection); // For TTStubs @@ -145,11 +144,11 @@ void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { iSetup.get<TrackerTopologyRcd>().get(tTopoHandle); ESHandle<TrackerGeometry> tGeomHandle; iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology *const tTopo = tTopoHandle.product(); - edm::Handle< vector< TTTrack< Ref_Phase2TrackerDigi_ > > > TTTrackHandle; + edm::Handle<vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackHandle; iEvent.getByToken(trackToken_, TTTrackHandle); - vector< TTTrack< Ref_Phase2TrackerDigi_ > >::const_iterator iterL1Track; + vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator iterL1Track; L1TrkPtrs_.clear(); zBinCount_.clear(); @@ -159,7 +158,7 @@ void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { unsigned int this_l1track = 0; for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { - edm::Ptr< L1TTTrackType > trkPtr(TTTrackHandle, this_l1track); + edm::Ptr<L1TTTrackType> trkPtr(TTTrackHandle, this_l1track); this_l1track++; float trk_pt = trkPtr->momentum().perp(); int trk_nstubs = (int)trkPtr->getStubRefs().size(); @@ -168,154 +167,182 @@ void L1TrackJetProducer::produce(Event& iEvent, const EventSetup& iSetup) { float trk_bendchi2 = trkPtr->stubPtConsistency(); int trk_nPS = 0; - for (int istub=0; istub<trk_nstubs; istub++) { // loop over the stubs - DetId detId( trkPtr->getStubRefs().at(istub)->getDetId() ); + for (int istub = 0; istub < trk_nstubs; istub++) { // loop over the stubs + DetId detId(trkPtr->getStubRefs().at(istub)->getDetId()); if (detId.det() == DetId::Detector::Tracker) { - if ( (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || - (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) ) trk_nPS++; + if ((detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || + (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9)) + trk_nPS++; } } - if (trk_nPS < trkNPSStubMin_) continue; - if (!trackQualityCuts(trk_pt, trk_nstubs, trk_chi2dof, trk_bendchi2, fabs(trk_d0))) continue; - if (fabs(iterL1Track->z0()) > trkZMax_) continue; - if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) continue; - if (trk_pt < trkPtMin_) continue; + if (trk_nPS < trkNPSStubMin_) + continue; + if (!trackQualityCuts(trk_pt, trk_nstubs, trk_chi2dof, trk_bendchi2, fabs(trk_d0))) + continue; + if (fabs(iterL1Track->z0()) > trkZMax_) + continue; + if (fabs(iterL1Track->momentum().eta()) > trkEtaMax_) + continue; + if (trk_pt < trkPtMin_) + continue; L1TrkPtrs_.push_back(trkPtr); zBinCount_.push_back(0); - if ((fabs(trk_d0)>d0CutNStubs5_ && trk_nstubs>=5)||(trk_nstubs==4 && fabs(trk_d0)>d0CutNStubs4_)) tdtrk_.push_back(1); - else tdtrk_.push_back(0); //displaced track - if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2Tight_ && trk_bendchi2<nStubs5DisplacedBendTight_ ) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2Tight_ && trk_bendchi2<nStubs4DisplacedBendTight_ )) ttrk_.push_back(1); - else ttrk_.push_back(0); - if ((trk_nstubs>=5 && trk_chi2dof< nStubs5DisplacedChi2Tight_ && trk_bendchi2<nStubs5DisplacedBendTight_ && fabs(trk_d0)>d0CutNStubs5_) || (trk_nstubs==4 && trk_chi2dof< nStubs4DisplacedChi2Tight_ && trk_bendchi2<nStubs4DisplacedBendTight_ && fabs(trk_d0)>d0CutNStubs4_)) ttdtrk_.push_back(1); - else ttdtrk_.push_back(0); + if ((fabs(trk_d0) > d0CutNStubs5_ && trk_nstubs >= 5) || (trk_nstubs == 4 && fabs(trk_d0) > d0CutNStubs4_)) + tdtrk_.push_back(1); + else + tdtrk_.push_back(0); //displaced track + if ((trk_nstubs >= 5 && trk_chi2dof < nStubs5DisplacedChi2Tight_ && trk_bendchi2 < nStubs5DisplacedBendTight_) || + (trk_nstubs == 4 && trk_chi2dof < nStubs4DisplacedChi2Tight_ && trk_bendchi2 < nStubs4DisplacedBendTight_)) + ttrk_.push_back(1); + else + ttrk_.push_back(0); + if ((trk_nstubs >= 5 && trk_chi2dof < nStubs5DisplacedChi2Tight_ && trk_bendchi2 < nStubs5DisplacedBendTight_ && + fabs(trk_d0) > d0CutNStubs5_) || + (trk_nstubs == 4 && trk_chi2dof < nStubs4DisplacedChi2Tight_ && trk_bendchi2 < nStubs4DisplacedBendTight_ && + fabs(trk_d0) > d0CutNStubs4_)) + ttdtrk_.push_back(1); + else + ttdtrk_.push_back(0); } - if (L1TrkPtrs_.size()>0) { + if (!L1TrkPtrs_.empty()) { MaxZBin mzb; L2_cluster(L1TrkPtrs_, ttrk_, tdtrk_, ttdtrk_, mzb); - edm::Ref< JetBxCollection > jetRef; //null, no Calo Jet Ref - vector< Ptr< L1TTTrackType > > L1TrackAssocJet; - if (mzb.clusters!=NULL) { - for (int j=0; j<mzb.nclust; ++j) { + edm::Ref<JetBxCollection> jetRef; //null, no Calo Jet Ref + vector<Ptr<L1TTTrackType> > L1TrackAssocJet; + if (mzb.clusters != nullptr) { + for (int j = 0; j < mzb.nclust; ++j) { //FILL Two Layer Jets for Jet Collection - if (mzb.clusters[j].pTtot<=trkPtMin_) continue; //protects against reading bad memory - if (mzb.clusters[j].numtracks<1) continue; - if (mzb.clusters[j].numtracks>5000) continue; + if (mzb.clusters[j].pTtot <= trkPtMin_) + continue; //protects against reading bad memory + if (mzb.clusters[j].numtracks < 1) + continue; + if (mzb.clusters[j].numtracks > 5000) + continue; float jetEta = mzb.clusters[j].eta; float jetPhi = mzb.clusters[j].phi; float jetPt = mzb.clusters[j].pTtot; - float jetPx = jetPt*cos(jetPhi); - float jetPy = jetPt*sin(jetPhi); - float jetPz = jetPt*sinh(jetEta); - float jetP = jetPt*cosh(jetEta); + float jetPx = jetPt * cos(jetPhi); + float jetPy = jetPt * sin(jetPhi); + float jetPz = jetPt * sinh(jetEta); + float jetP = jetPt * cosh(jetEta); int totalTighttrk_ = mzb.clusters[j].numttrks; int totalDisptrk = mzb.clusters[j].numtdtrks; int totalTightDisptrk = mzb.clusters[j].numttdtrks; - math::XYZTLorentzVector jetP4(jetPx,jetPy,jetPz,jetP); + math::XYZTLorentzVector jetP4(jetPx, jetPy, jetPz, jetP); L1TrackAssocJet.clear(); - for (unsigned int t=0; t<L1TrkPtrs_.size(); ++t) { - if (L1TrackAssocJet.size()==(unsigned int)mzb.clusters[j].numtracks) break; + for (unsigned int t = 0; t < L1TrkPtrs_.size(); ++t) { + if (L1TrackAssocJet.size() == (unsigned int)mzb.clusters[j].numtracks) + break; float deta = L1TrkPtrs_[t]->momentum().eta() - jetEta; float dphi = L1TrkPtrs_[t]->momentum().phi() - jetPhi; float dZ = fabs(mzb.zbincenter - L1TrkPtrs_[t]->z0()); - if (dZ<zStep_ && fabs(deta)<etaStep_*2.0 && fabs(dphi)<phiStep_*2.0) { + if (dZ < zStep_ && fabs(deta) < etaStep_ * 2.0 && fabs(dphi) < phiStep_ * 2.0) { L1TrackAssocJet.push_back(L1TrkPtrs_[t]); } } - TkJet trkJet(jetP4, L1TrackAssocJet, mzb.zbincenter, mzb.clusters[j].numtracks, totalTighttrk_, totalDisptrk, totalTightDisptrk); + TkJet trkJet(jetP4, + L1TrackAssocJet, + mzb.zbincenter, + mzb.clusters[j].numtracks, + totalTighttrk_, + totalDisptrk, + totalTightDisptrk); //trkJet.setDispCounters(DispCounters); - if (L1TrackAssocJet.size()>0) L1L1TrackJetProducer->push_back(trkJet); + if (!L1TrackAssocJet.empty()) + L1L1TrackJetProducer->push_back(trkJet); } } //free(mzb.clusters); - if (displaced_) iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJetsExtended"); - else iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJets"); + if (displaced_) + iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJetsExtended"); + else + iEvent.put(std::move(L1L1TrackJetProducer), "L1TrackJets"); delete[] mzb.clusters; } } -void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, vector<int>ttrk_, vector<int>tdtrk_, vector<int>ttdtrk_, MaxZBin &mzb) { +void L1TrackJetProducer::L2_cluster( + vector<Ptr<L1TTTrackType> > L1TrkPtrs_, vector<int> ttrk_, vector<int> tdtrk_, vector<int> ttdtrk_, MaxZBin &mzb) { const int nz = zBins_; MaxZBin all_zBins[nz]; MaxZBin mzbtemp; - for (int z=0; z<nz; ++z) all_zBins[z] = mzbtemp; - - if (all_zBins==NULL) { - edm::LogWarning("L1TrackJetProducer")<<" \"all_zBins\" memory not assigned!\n"; - return; - } + for (int z = 0; z < nz; ++z) + all_zBins[z] = mzbtemp; - float zmin = -1.0*trkZMax_; - float zmax = zmin + 2*zStep_; + float zmin = -1.0 * trkZMax_; + float zmax = zmin + 2 * zStep_; - EtaPhiBin epbins[phiBins_][etaBins_]; // create grid of phiBins + EtaPhiBin epbins[phiBins_][etaBins_]; // create grid of phiBins float phi = -1.0 * M_PI; float eta; float etamin, etamax, phimin, phimax; - for (int i = 0; i<phiBins_; ++i) { + for (int i = 0; i < phiBins_; ++i) { eta = -1.0 * trkEtaMax_; - for (int j = 0; j<etaBins_; ++j) { + for (int j = 0; j < etaBins_; ++j) { phimin = phi; phimax = phi + phiStep_; etamin = eta; eta = eta + etaStep_; etamax = eta; - epbins[i][j].phi = (phimin+phimax)/2.0; - epbins[i][j].eta = (etamin+etamax)/2.0; - } // for each etabin - phi = phi+phiStep_; - } // for each phibin (finished creating epbins) + epbins[i][j].phi = (phimin + phimax) / 2.0; + epbins[i][j].eta = (etamin + etamax) / 2.0; + } // for each etabin + phi = phi + phiStep_; + } // for each phibin (finished creating epbins) mzb = all_zBins[0]; - int ntracks=L1TrkPtrs_.size(); + int ntracks = L1TrkPtrs_.size(); // uninitalized arrays EtaPhiBin *L1clusters[phiBins_]; EtaPhiBin L2cluster[ntracks]; - for (int zbin=0; zbin<zBins_-1; ++zbin) { - for (int i=0; i<phiBins_; ++i) { //First initialize pT, numtracks, used to 0 (or false) - for (int j=0; j<etaBins_; ++j) { + for (int zbin = 0; zbin < zBins_ - 1; ++zbin) { + for (int i = 0; i < phiBins_; ++i) { //First initialize pT, numtracks, used to 0 (or false) + for (int j = 0; j < etaBins_; ++j) { epbins[i][j].pTtot = 0; epbins[i][j].used = false; epbins[i][j].numtracks = 0; epbins[i][j].numttrks = 0; epbins[i][j].numtdtrks = 0; epbins[i][j].numttdtrks = 0; - } //for each etabin + } //for each etabin L1clusters[i] = epbins[i]; - } //for each phibin + } //for each phibin - for (unsigned int k=0; k<L1TrkPtrs_.size(); ++k) { + for (unsigned int k = 0; k < L1TrkPtrs_.size(); ++k) { float trkpt = L1TrkPtrs_[k]->momentum().perp(); float trketa = L1TrkPtrs_[k]->momentum().eta(); float trkphi = L1TrkPtrs_[k]->momentum().phi(); float trkZ = L1TrkPtrs_[k]->z0(); - for (int i=0; i<phiBins_; ++i) { - for (int j=0; j<etaBins_; ++j) { + for (int i = 0; i < phiBins_; ++i) { + for (int j = 0; j < etaBins_; ++j) { L2cluster[k] = epbins[i][j]; - if ((zmin<=trkZ && zmax>=trkZ) && - ((epbins[i][j].eta - etaStep_/2.0 <= trketa && epbins[i][j].eta + etaStep_/2.0 >= trketa) - && epbins[i][j].phi - phiStep_/2.0 <= trkphi && epbins[i][j].phi + phiStep_/2.0 >= trkphi - && (zBinCount_[k] != 2))) { - zBinCount_.at(k) = zBinCount_.at(k)+1; - if (trkpt<trkPtMax_) epbins[i][j].pTtot+=trkpt; - else epbins[i][j].pTtot+=trkPtMax_; - epbins[i][j].numttrks+=ttrk_[k]; - epbins[i][j].numtdtrks+=tdtrk_[k]; - epbins[i][j].numttdtrks+=ttdtrk_[k]; + if ((zmin <= trkZ && zmax >= trkZ) && + ((epbins[i][j].eta - etaStep_ / 2.0 <= trketa && epbins[i][j].eta + etaStep_ / 2.0 >= trketa) && + epbins[i][j].phi - phiStep_ / 2.0 <= trkphi && epbins[i][j].phi + phiStep_ / 2.0 >= trkphi && + (zBinCount_[k] != 2))) { + zBinCount_.at(k) = zBinCount_.at(k) + 1; + if (trkpt < trkPtMax_) + epbins[i][j].pTtot += trkpt; + else + epbins[i][j].pTtot += trkPtMax_; + epbins[i][j].numttrks += ttrk_[k]; + epbins[i][j].numtdtrks += tdtrk_[k]; + epbins[i][j].numttdtrks += ttdtrk_[k]; ++epbins[i][j].numtracks; - } // if right bin - } // for each phibin: j loop - } // for each phibin: i loop - } // end loop over tracks + } // if right bin + } // for each phibin: j loop + } // for each phibin: i loop + } // end loop over tracks - for (int phislice=0; phislice<phiBins_; ++phislice) { + for (int phislice = 0; phislice < phiBins_; ++phislice) { L1clusters[phislice] = L1_cluster(epbins[phislice]); - for (int ind=0; L1clusters[phislice][ind].pTtot!=0; ++ind) { + for (int ind = 0; L1clusters[phislice][ind].pTtot != 0; ++ind) { L1clusters[phislice][ind].used = false; } } @@ -326,7 +353,7 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, v int nclust = 0; int phibin = 0; int imax = -1; - int index1; //index of clusters array for each phislice + int index1; //index of clusters array for each phislice float E1 = 0; float E0 = 0; float E2 = 0; @@ -336,19 +363,19 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, v int ttdtrk1, ttdtrk2; int used1, used2, used3, used4; - for (phibin=0; phibin<phiBins_; ++phibin) { //Find eta-phibin with highest pT - while(true) { + for (phibin = 0; phibin < phiBins_; ++phibin) { //Find eta-phibin with highest pT + while (true) { hipT = 0; - for (index1=0; L1clusters[phibin][index1].pTtot>0; ++index1) { + for (index1 = 0; L1clusters[phibin][index1].pTtot > 0; ++index1) { if (!L1clusters[phibin][index1].used && L1clusters[phibin][index1].pTtot >= hipT) { hipT = L1clusters[phibin][index1].pTtot; imax = index1; } - } // for each index within the phibin + } // for each index within the phibin if (hipT == 0) - break; // If highest pT is 0, all bins are used - E0 = hipT; // E0 is pT of first phibin of the cluster + break; // If highest pT is 0, all bins are used + E0 = hipT; // E0 is pT of first phibin of the cluster E1 = 0; E2 = 0; trx1 = 0; @@ -363,51 +390,52 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, v L1clusters[phibin][imax].used = true; // Add pT of upper neighbor // E1 is pT of the middle phibin (should be highest pT) - if (phibin != phiBins_-1) { + if (phibin != phiBins_ - 1) { used1 = -1; used2 = -1; - for (index1 = 0; L1clusters[phibin+1][index1].pTtot != 0; ++index1) { - if (L1clusters[phibin+1][index1].used) continue; - if (fabs(L1clusters[phibin+1][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep_) { - E1 += L1clusters[phibin+1][index1].pTtot; - trx1 += L1clusters[phibin+1][index1].numtracks; - ttrk1 += L1clusters[phibin+1][index1].numttrks; - tdtrk1 += L1clusters[phibin+1][index1].numtdtrks; - ttdtrk1 += L1clusters[phibin+1][index1].numttdtrks; - if (used1<0) + for (index1 = 0; L1clusters[phibin + 1][index1].pTtot != 0; ++index1) { + if (L1clusters[phibin + 1][index1].used) + continue; + if (fabs(L1clusters[phibin + 1][index1].eta - L1clusters[phibin][imax].eta) <= 1.5 * etaStep_) { + E1 += L1clusters[phibin + 1][index1].pTtot; + trx1 += L1clusters[phibin + 1][index1].numtracks; + ttrk1 += L1clusters[phibin + 1][index1].numttrks; + tdtrk1 += L1clusters[phibin + 1][index1].numtdtrks; + ttdtrk1 += L1clusters[phibin + 1][index1].numttdtrks; + if (used1 < 0) used1 = index1; else used2 = index1; - } // if cluster is within one phibin - } // for each cluster in above phibin + } // if cluster is within one phibin + } // for each cluster in above phibin - if (E1<E0) { // if E1 isn't higher, E0 and E1 are their own cluster + if (E1 < E0) { // if E1 isn't higher, E0 and E1 are their own cluster L2cluster[nclust].pTtot += E1; L2cluster[nclust].numtracks += trx1; L2cluster[nclust].numttrks += ttrk1; L2cluster[nclust].numtdtrks += tdtrk1; L2cluster[nclust].numttdtrks += ttdtrk1; if (used1 >= 0) - L1clusters[phibin+1][used1].used = true; + L1clusters[phibin + 1][used1].used = true; if (used2 >= 0) - L1clusters[phibin+1][used2].used = true; + L1clusters[phibin + 1][used2].used = true; nclust++; continue; } - if (phibin != phiBins_-2) { // E2 will be the pT of the third phibin (should be lower than E1) + if (phibin != phiBins_ - 2) { // E2 will be the pT of the third phibin (should be lower than E1) used3 = -1; used4 = -1; - for (index1 = 0; L1clusters[phibin+2][index1].pTtot != 0; ++index1) { - if (L1clusters[phibin+2][index1].used) + for (index1 = 0; L1clusters[phibin + 2][index1].pTtot != 0; ++index1) { + if (L1clusters[phibin + 2][index1].used) continue; - if (fabs(L1clusters[phibin+2][index1].eta - L1clusters[phibin][imax].eta) <= 1.5*etaStep_) { - E2 += L1clusters[phibin+2][index1].pTtot; - trx2 += L1clusters[phibin+2][index1].numtracks; - ttrk2 += L1clusters[phibin+2][index1].numttrks; - tdtrk2 += L1clusters[phibin+2][index1].numtdtrks; - ttdtrk2 += L1clusters[phibin+2][index1].numttdtrks; - if (used3<0) + if (fabs(L1clusters[phibin + 2][index1].eta - L1clusters[phibin][imax].eta) <= 1.5 * etaStep_) { + E2 += L1clusters[phibin + 2][index1].pTtot; + trx2 += L1clusters[phibin + 2][index1].numtracks; + ttrk2 += L1clusters[phibin + 2][index1].numttrks; + tdtrk2 += L1clusters[phibin + 2][index1].numtdtrks; + ttdtrk2 += L1clusters[phibin + 2][index1].numttdtrks; + if (used3 < 0) used3 = index1; else used4 = index1; @@ -415,77 +443,78 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, v } // if indeed E2 < E1, add E1 and E2 to E0, they're all a cluster together // otherwise, E0 is its own cluster - if (E2<E1) { + if (E2 < E1) { L2cluster[nclust].pTtot += E1 + E2; L2cluster[nclust].numtracks += trx1 + trx2; L2cluster[nclust].numttrks += ttrk1 + ttrk2; L2cluster[nclust].numtdtrks += tdtrk1 + tdtrk2; L2cluster[nclust].numttdtrks += ttdtrk1 + ttdtrk2; - L2cluster[nclust].phi = L1clusters[phibin+1][used1].phi; + L2cluster[nclust].phi = L1clusters[phibin + 1][used1].phi; if (used1 >= 0) - L1clusters[phibin+1][used1].used = true; + L1clusters[phibin + 1][used1].used = true; if (used2 >= 0) - L1clusters[phibin+1][used2].used = true; + L1clusters[phibin + 1][used2].used = true; if (used3 >= 0) - L1clusters[phibin+2][used3].used = true; + L1clusters[phibin + 2][used3].used = true; if (used4 >= 0) - L1clusters[phibin+2][used4].used = true; + L1clusters[phibin + 2][used4].used = true; } nclust++; continue; - } // end Not phiBins-2 + } // end Not phiBins-2 else { L2cluster[nclust].pTtot += E1; L2cluster[nclust].numtracks += trx1; L2cluster[nclust].numttrks += ttrk1; L2cluster[nclust].numtdtrks += tdtrk1; L2cluster[nclust].numttdtrks += ttdtrk1; - L2cluster[nclust].phi = L1clusters[phibin+1][used1].phi; + L2cluster[nclust].phi = L1clusters[phibin + 1][used1].phi; if (used1 >= 0) - L1clusters[phibin+1][used1].used = true; + L1clusters[phibin + 1][used1].used = true; if (used2 >= 0) - L1clusters[phibin+1][used2].used = true; + L1clusters[phibin + 1][used2].used = true; nclust++; continue; } - } //End not last phibin(23) - else { //if it is phibin 23 + } //End not last phibin(23) + else { //if it is phibin 23 L1clusters[phibin][imax].used = true; nclust++; } - } // while hipT not 0 - } // for each phibin + } // while hipT not 0 + } // for each phibin - for (phibin=0; phibin<phiBins_; ++phibin) - delete [] L1clusters[phibin]; + for (phibin = 0; phibin < phiBins_; ++phibin) + delete[] L1clusters[phibin]; // Now merge clusters, if necessary - for (int m=0; m<nclust-1; ++m) { - for (int n=m+1; n<nclust; ++n) - if (L2cluster[n].eta == L2cluster[m].eta && (fabs(L2cluster[n].phi - L2cluster[m].phi) < 1.5*phiStep_ || fabs(L2cluster[n].phi - L2cluster[m].phi) > 6.0)) { - if (L2cluster[n].pTtot > L2cluster[m].pTtot) - L2cluster[m].phi = L2cluster[n].phi; - L2cluster[m].pTtot += L2cluster[n].pTtot; - L2cluster[m].numtracks += L2cluster[n].numtracks; - L2cluster[m].numttrks += L2cluster[n].numttrks; - L2cluster[m].numtdtrks += L2cluster[n].numtdtrks; - L2cluster[m].numttdtrks += L2cluster[n].numttdtrks; - for (int m1=n; m1<nclust-1; ++m1) - L2cluster[m1] = L2cluster[m1+1]; - nclust--; - m = -1; - break; //????? - } // end if clusters neighbor in eta - } // end for (m) loop + for (int m = 0; m < nclust - 1; ++m) { + for (int n = m + 1; n < nclust; ++n) + if (L2cluster[n].eta == L2cluster[m].eta && (fabs(L2cluster[n].phi - L2cluster[m].phi) < 1.5 * phiStep_ || + fabs(L2cluster[n].phi - L2cluster[m].phi) > 6.0)) { + if (L2cluster[n].pTtot > L2cluster[m].pTtot) + L2cluster[m].phi = L2cluster[n].phi; + L2cluster[m].pTtot += L2cluster[n].pTtot; + L2cluster[m].numtracks += L2cluster[n].numtracks; + L2cluster[m].numttrks += L2cluster[n].numttrks; + L2cluster[m].numtdtrks += L2cluster[n].numtdtrks; + L2cluster[m].numttdtrks += L2cluster[n].numttdtrks; + for (int m1 = n; m1 < nclust - 1; ++m1) + L2cluster[m1] = L2cluster[m1 + 1]; + nclust--; + m = -1; + break; //????? + } // end if clusters neighbor in eta + } // end for (m) loop // sum up all pTs in this zbin to find ht float ht = 0; - for (int k=0; k<nclust; ++k) { - if (L2cluster[k].pTtot>50 && L2cluster[k].numtracks<lowpTJetMinTrackMultiplicity_) + for (int k = 0; k < nclust; ++k) { + if (L2cluster[k].pTtot > 50 && L2cluster[k].numtracks < lowpTJetMinTrackMultiplicity_) continue; - if (L2cluster[k].pTtot>100 && L2cluster[k].numtracks<highpTJetMinTrackMultiplicity_) + if (L2cluster[k].pTtot > 100 && L2cluster[k].numtracks < highpTJetMinTrackMultiplicity_) continue; - if (L2cluster[k].pTtot>minTrkJetpT_) + if (L2cluster[k].pTtot > minTrkJetpT_) ht += L2cluster[k].pTtot; } @@ -493,8 +522,8 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, v all_zBins[zbin].znum = zbin; all_zBins[zbin].clusters = new EtaPhiBin[nclust]; all_zBins[zbin].nclust = nclust; - all_zBins[zbin].zbincenter = (zmin+zmax)/2.0; - for (int k=0; k<nclust; ++k) { + all_zBins[zbin].zbincenter = (zmin + zmax) / 2.0; + for (int k = 0; k < nclust; ++k) { all_zBins[zbin].clusters[k].phi = L2cluster[k].phi; all_zBins[zbin].clusters[k].eta = L2cluster[k].eta; all_zBins[zbin].clusters[k].pTtot = L2cluster[k].pTtot; @@ -506,55 +535,52 @@ void L1TrackJetProducer::L2_cluster(vector< Ptr< L1TTTrackType > > L1TrkPtrs_, v all_zBins[zbin].ht = ht; if (ht >= mzb.ht) { mzb = all_zBins[zbin]; - mzb.zbincenter = (zmin+zmax)/2.0; + mzb.zbincenter = (zmin + zmax) / 2.0; } // Prepare for next zbin! - zmin = zmin+zStep_; - zmax = zmax+zStep_; - } // for each zbin - for (int zbin=0; zbin<zBins_-1; ++zbin) { - if (zbin==mzb.znum) + zmin = zmin + zStep_; + zmax = zmax + zStep_; + } // for each zbin + for (int zbin = 0; zbin < zBins_ - 1; ++zbin) { + if (zbin == mzb.znum) continue; delete[] all_zBins[zbin].clusters; } } EtaPhiBin *L1TrackJetProducer::L1_cluster(EtaPhiBin *phislice) { - EtaPhiBin *clusters = new EtaPhiBin[etaBins_/2]; - if (clusters==NULL) - edm::LogWarning("L1TrackJetProducer")<<"Clusters memory not assigned!\n"; + EtaPhiBin *clusters = new EtaPhiBin[etaBins_ / 2]; + if (clusters == nullptr) + edm::LogWarning("L1TrackJetProducer") << "Clusters memory not assigned!\n"; // Find eta-phibin with maxpT, make center of cluster, add neighbors if not already used float my_pt, left_pt, right_pt, right2pt; int nclust = 0; right2pt = 0; - for (int etabin=0; etabin<etaBins_; ++etabin) { + for (int etabin = 0; etabin < etaBins_; ++etabin) { // assign values for my pT and neighbors' pT if (phislice[etabin].used) continue; my_pt = phislice[etabin].pTtot; - if (etabin > 0 && !phislice[etabin-1].used) { - left_pt = phislice[etabin-1].pTtot; - } - else + if (etabin > 0 && !phislice[etabin - 1].used) { + left_pt = phislice[etabin - 1].pTtot; + } else left_pt = 0; - if (etabin < etaBins_-1 && !phislice[etabin+1].used) { - right_pt = phislice[etabin+1].pTtot; - if (etabin < etaBins_-2 && !phislice[etabin+2].used) { - right2pt = phislice[etabin+2].pTtot; - } - else + if (etabin < etaBins_ - 1 && !phislice[etabin + 1].used) { + right_pt = phislice[etabin + 1].pTtot; + if (etabin < etaBins_ - 2 && !phislice[etabin + 2].used) { + right2pt = phislice[etabin + 2].pTtot; + } else right2pt = 0; - } - else + } else right_pt = 0; // if I'm not a cluster, move on - if (my_pt<left_pt || my_pt<=right_pt) { + if (my_pt < left_pt || my_pt <= right_pt) { // if unused pT in the left neighbor, spit it out as a cluster - if (left_pt>0) { - clusters[nclust] = phislice[etabin-1]; - phislice[etabin-1].used = true; + if (left_pt > 0) { + clusters[nclust] = phislice[etabin - 1]; + phislice[etabin - 1].used = true; nclust++; } continue; @@ -567,59 +593,66 @@ EtaPhiBin *L1TrackJetProducer::L1_cluster(EtaPhiBin *phislice) { phislice[etabin].used = true; if (left_pt > 0) { clusters[nclust].pTtot += left_pt; - clusters[nclust].numtracks += phislice[etabin-1].numtracks; - clusters[nclust].numttrks += phislice[etabin-1].numttrks; - clusters[nclust].numtdtrks += phislice[etabin-1].numtdtrks; - clusters[nclust].numttdtrks += phislice[etabin-1].numttdtrks; + clusters[nclust].numtracks += phislice[etabin - 1].numtracks; + clusters[nclust].numttrks += phislice[etabin - 1].numttrks; + clusters[nclust].numtdtrks += phislice[etabin - 1].numtdtrks; + clusters[nclust].numttdtrks += phislice[etabin - 1].numttdtrks; } if (my_pt >= right2pt && right_pt > 0) { clusters[nclust].pTtot += right_pt; - clusters[nclust].numtracks += phislice[etabin+1].numtracks; - clusters[nclust].numttrks += phislice[etabin+1].numttrks; - clusters[nclust].numtdtrks += phislice[etabin+1].numtdtrks; - clusters[nclust].numttdtrks += phislice[etabin+1].numttdtrks; - phislice[etabin+1].used = true; + clusters[nclust].numtracks += phislice[etabin + 1].numtracks; + clusters[nclust].numttrks += phislice[etabin + 1].numttrks; + clusters[nclust].numtdtrks += phislice[etabin + 1].numtdtrks; + clusters[nclust].numttdtrks += phislice[etabin + 1].numttdtrks; + phislice[etabin + 1].used = true; } nclust++; - } // for each etabin + } // for each etabin // Now merge clusters, if necessary - for (int m = 0; m<nclust-1; ++m) { - if (fabs(clusters[m+1].eta - clusters[m].eta) < 1.5*etaStep_) { - if (clusters[m+1].pTtot > clusters[m].pTtot) { - clusters[m].eta = clusters[m+1].eta; + for (int m = 0; m < nclust - 1; ++m) { + if (fabs(clusters[m + 1].eta - clusters[m].eta) < 1.5 * etaStep_) { + if (clusters[m + 1].pTtot > clusters[m].pTtot) { + clusters[m].eta = clusters[m + 1].eta; } - clusters[m].pTtot += clusters[m+1].pTtot; - clusters[m].numtracks += clusters[m+1].numtracks; // Previous version didn't add tracks when merging - clusters[m].numttrks += clusters[m+1].numttrks; - clusters[m].numtdtrks += clusters[m+1].numtdtrks; - clusters[m].numttdtrks += clusters[m+1].numttdtrks; - for (int m1 = m+1; m1<nclust-1; ++m1) - clusters[m1] = clusters[m1+1]; + clusters[m].pTtot += clusters[m + 1].pTtot; + clusters[m].numtracks += clusters[m + 1].numtracks; // Previous version didn't add tracks when merging + clusters[m].numttrks += clusters[m + 1].numttrks; + clusters[m].numtdtrks += clusters[m + 1].numtdtrks; + clusters[m].numttdtrks += clusters[m + 1].numttdtrks; + for (int m1 = m + 1; m1 < nclust - 1; ++m1) + clusters[m1] = clusters[m1 + 1]; nclust--; m = -1; - } // end if clusters neighbor in eta - } // end for (m) loop + } // end if clusters neighbor in eta + } // end for (m) loop - for (int i = nclust; i<etaBins_/2; ++i) // zero out remaining unused clusters + for (int i = nclust; i < etaBins_ / 2; ++i) // zero out remaining unused clusters clusters[i].pTtot = 0; return clusters; } -void L1TrackJetProducer::beginStream(StreamID) { } - -void L1TrackJetProducer::endStream() { } - -bool L1TrackJetProducer::trackQualityCuts(float trk_pt,int trk_nstub, float trk_chi2,float trk_bendchi2, float trk_d0) { - bool PassQuality=false; - if (trk_bendchi2<trkBendChi2Max_ && trk_chi2<trkChi2dofMax_ && trk_nstub>=4 && !displaced_) PassQuality = true; - if (displaced_ && trk_bendchi2<nStubs4DisplacedBendTight_ && trk_chi2<nStubs4DisplacedChi2Tight_ && trk_nstub==4 && trk_d0<=d0CutNStubs4_) PassQuality = true; - if (displaced_ && trk_bendchi2<nStubs4DisplacedBendLoose_ && trk_chi2<nStubs4DisplacedChi2Loose_ && trk_nstub==4 && trk_d0>d0CutNStubs4_) PassQuality = true; - if (displaced_ && trk_bendchi2<nStubs5DisplacedBendLoose_ && trk_chi2<nStubs5DisplacedChi2Loose_ && trk_nstub>4) PassQuality = true; +void L1TrackJetProducer::beginStream(StreamID) {} + +void L1TrackJetProducer::endStream() {} + +bool L1TrackJetProducer::trackQualityCuts( + float trk_pt, int trk_nstub, float trk_chi2, float trk_bendchi2, float trk_d0) { + bool PassQuality = false; + if (trk_bendchi2 < trkBendChi2Max_ && trk_chi2 < trkChi2dofMax_ && trk_nstub >= 4 && !displaced_) + PassQuality = true; + if (displaced_ && trk_bendchi2 < nStubs4DisplacedBendTight_ && trk_chi2 < nStubs4DisplacedChi2Tight_ && + trk_nstub == 4 && trk_d0 <= d0CutNStubs4_) + PassQuality = true; + if (displaced_ && trk_bendchi2 < nStubs4DisplacedBendLoose_ && trk_chi2 < nStubs4DisplacedChi2Loose_ && + trk_nstub == 4 && trk_d0 > d0CutNStubs4_) + PassQuality = true; + if (displaced_ && trk_bendchi2 < nStubs5DisplacedBendLoose_ && trk_chi2 < nStubs5DisplacedChi2Loose_ && trk_nstub > 4) + PassQuality = true; return PassQuality; } -void L1TrackJetProducer::fillDescriptions(ConfigurationDescriptions& descriptions) { +void L1TrackJetProducer::fillDescriptions(ConfigurationDescriptions &descriptions) { //The following says we do not know what parameters are allowed so do no validation // Please change this to state exactly what you do use, even if it is no parameters ParameterSetDescription desc; diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h index 91ef3aa289e3b..cfcfd9d01e7aa 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h @@ -1,10 +1,9 @@ #pragma once -#include <iostream> +#include <cmath> +#include <cstdlib> #include <fstream> -#include <math.h> -#include <stdlib.h> +#include <iostream> #include <string> -#include <cstdlib> using namespace std; //Each individual box in the eta and phi dimension. @@ -16,15 +15,15 @@ struct EtaPhiBin { int numtdtrks; int numttdtrks; bool used; - float phi; //average phi value (halfway b/t min and max) - float eta; //average eta value + float phi; //average phi value (halfway b/t min and max) + float eta; //average eta value }; //store important information for plots struct MaxZBin { - int znum; //Numbered from 0 to nzbins (16, 32, or 64) in order - int nclust; //number of clusters in this bin + int znum; //Numbered from 0 to nzbins (16, 32, or 64) in order + int nclust; //number of clusters in this bin float zbincenter; - EtaPhiBin *clusters; //list of all the clusters in this bin - float ht; //sum of all cluster pTs--only the zbin with the maximum ht is stored + EtaPhiBin *clusters; //list of all the clusters in this bin + float ht; //sum of all cluster pTs--only the zbin with the maximum ht is stored }; diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index 7efbbd9748162..eff795b02fb6a 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -29,39 +29,39 @@ using namespace l1t; class L1TrackerEtMissProducer : public edm::EDProducer { public: - typedef TTTrack< Ref_Phase2TrackerDigi_ > L1TTTrackType; - typedef std::vector< L1TTTrackType > L1TTTrackCollectionType; + typedef TTTrack<Ref_Phase2TrackerDigi_> L1TTTrackType; + typedef std::vector<L1TTTrackType> L1TTTrackCollectionType; explicit L1TrackerEtMissProducer(const edm::ParameterSet&); - ~L1TrackerEtMissProducer(); + ~L1TrackerEtMissProducer() override; private: - virtual void beginJob() ; - virtual void produce(edm::Event&, const edm::EventSetup&); - virtual void endJob() ; + void beginJob() override; + void produce(edm::Event&, const edm::EventSetup&) override; + void endJob() override; // ----------member data --------------------------- - float maxZ0_; // in cm - float deltaZ_; // in cm + float maxZ0_; // in cm + float deltaZ_; // in cm float maxEta_; float chi2dofMax_; float bendChi2Max_; - float minPt_; // in GeV + float minPt_; // in GeV int nStubsmin_; - int nPSStubsMin_; // minimum number of stubs in PS modules - float maxPt_; // in GeV - int highPtTracks_; // saturate or truncate - bool displaced_; //prompt/displaced tracks + int nPSStubsMin_; // minimum number of stubs in PS modules + float maxPt_; // in GeV + int highPtTracks_; // saturate or truncate + bool displaced_; //prompt/displaced tracks - const edm::EDGetTokenT< TkPrimaryVertexCollection > pvToken_; - const edm::EDGetTokenT<std::vector<TTTrack< Ref_Phase2TrackerDigi_ > > > trackToken_; + const edm::EDGetTokenT<TkPrimaryVertexCollection> pvToken_; + const edm::EDGetTokenT<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > trackToken_; }; //constructor// -L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) : -pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), -trackToken_(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) -{ +L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) + : pvToken_(consumes<TkPrimaryVertexCollection>(iConfig.getParameter<edm::InputTag>("L1VertexInputTag"))), + trackToken_(consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >( + iConfig.getParameter<edm::InputTag>("L1TrackInputTag"))) { maxZ0_ = (float)iConfig.getParameter<double>("maxZ0"); deltaZ_ = (float)iConfig.getParameter<double>("deltaZ"); chi2dofMax_ = (float)iConfig.getParameter<double>("chi2dofMax"); @@ -74,11 +74,13 @@ trackToken_(consumes< std::vector<TTTrack< Ref_Phase2TrackerDigi_> > > (iConfig. highPtTracks_ = iConfig.getParameter<int>("highPtTracks"); displaced_ = iConfig.getParameter<bool>("displaced"); - if (displaced_) produces<TkEtMissCollection>("L1TrackerEtMissExtended"); - else produces<TkEtMissCollection>("L1TrackerEtMiss"); + if (displaced_) + produces<TkEtMissCollection>("L1TrackerEtMissExtended"); + else + produces<TkEtMissCollection>("L1TrackerEtMiss"); } -L1TrackerEtMissProducer::~L1TrackerEtMissProducer() { } +L1TrackerEtMissProducer::~L1TrackerEtMissProducer() {} void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; @@ -91,21 +93,19 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& const TrackerTopology* tTopo = tTopoHandle_.product(); edm::Handle<TkPrimaryVertexCollection> L1VertexHandle; - iEvent.getByToken(pvToken_,L1VertexHandle); + iEvent.getByToken(pvToken_, L1VertexHandle); edm::Handle<L1TTTrackCollectionType> L1TTTrackHandle; iEvent.getByToken(trackToken_, L1TTTrackHandle); L1TTTrackCollectionType::const_iterator trackIter; - if( !L1VertexHandle.isValid() ) { - LogError("L1TrackerEtMissProducer") - << "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; + if (!L1VertexHandle.isValid()) { + LogError("L1TrackerEtMissProducer") << "\nWarning: TkPrimaryVertexCollection not found in the event. Exit\n"; return; } - if( !L1TTTrackHandle.isValid() ) { - LogError("L1TrackerEtMissProducer") - << "\nWarning: L1TTTrackCollection not found in the event. Exit\n"; + if (!L1TTTrackHandle.isValid()) { + LogError("L1TrackerEtMissProducer") << "\nWarning: L1TTTrackCollection not found in the event. Exit\n"; return; } @@ -123,74 +123,87 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& float eta = trackIter->momentum().eta(); float chi2dof = trackIter->chi2Red(); float bendChi2 = trackIter->stubPtConsistency(); - float z0 = trackIter->z0(); - std::vector< edm::Ref< edmNew::DetSetVector< TTStub< Ref_Phase2TrackerDigi_ > >, TTStub< Ref_Phase2TrackerDigi_ > > > theStubs = trackIter -> getStubRefs() ; - int nstubs = (int) theStubs.size(); - - if (pt < minPt_) continue; - if (fabs(z0) > maxZ0_) continue; - if (fabs(eta) > maxEta_) continue; - if (chi2dof > chi2dofMax_) continue; - if (bendChi2 > bendChi2Max_) continue; + float z0 = trackIter->z0(); + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + theStubs = trackIter->getStubRefs(); + int nstubs = (int)theStubs.size(); + + if (pt < minPt_) + continue; + if (fabs(z0) > maxZ0_) + continue; + if (fabs(eta) > maxEta_) + continue; + if (chi2dof > chi2dofMax_) + continue; + if (bendChi2 > bendChi2Max_) + continue; if (maxPt_ > 0 && pt > maxPt_) { - if (highPtTracks_ == 0) continue; // ignore these very high PT tracks: truncate - if (highPtTracks_ == 1) pt = maxPt_; // saturate + if (highPtTracks_ == 0) + continue; // ignore these very high PT tracks: truncate + if (highPtTracks_ == 1) + pt = maxPt_; // saturate } - int nPS = 0; // number of stubs in PS modules + int nPS = 0; // number of stubs in PS modules // loop over the stubs - for (unsigned int istub=0; istub<(unsigned int)theStubs.size(); istub++) { - DetId detId( theStubs.at(istub)->getDetId() ); + for (unsigned int istub = 0; istub < (unsigned int)theStubs.size(); istub++) { + DetId detId(theStubs.at(istub)->getDetId()); if (detId.det() == DetId::Detector::Tracker) { - if ( (detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9) ) nPS++; + if ((detId.subdetId() == StripSubdetector::TOB && tTopo->tobLayer(detId) <= 3) || + (detId.subdetId() == StripSubdetector::TID && tTopo->tidRing(detId) <= 9)) + nPS++; } } - if (nstubs < nStubsmin_) continue; - if (nPS < nPSStubsMin_) continue; + if (nstubs < nStubsmin_) + continue; + if (nPS < nPSStubsMin_) + continue; - if (!displaced_){ // if displaced, deltaZ = 3.0 cm, very loose + if (!displaced_) { // if displaced, deltaZ = 3.0 cm, very loose // construct deltaZ cut to be based on track eta - if ( fabs(eta)>=0 && fabs(eta)<0.7) deltaZ_ = 0.4; - else if ( fabs(eta)>=0.7 && fabs(eta)<1.0) deltaZ_ = 0.6; - else if ( fabs(eta)>=1.0 && fabs(eta)<1.2) deltaZ_ = 0.76; - else if ( fabs(eta)>=1.2 && fabs(eta)<1.6) deltaZ_ = 1.0; - else if ( fabs(eta)>=1.6 && fabs(eta)<2.0) deltaZ_ = 1.7; - else if ( fabs(eta)>=2.0 && fabs(eta)<=2.4) deltaZ_ = 2.2; + if (fabs(eta) >= 0 && fabs(eta) < 0.7) + deltaZ_ = 0.4; + else if (fabs(eta) >= 0.7 && fabs(eta) < 1.0) + deltaZ_ = 0.6; + else if (fabs(eta) >= 1.0 && fabs(eta) < 1.2) + deltaZ_ = 0.76; + else if (fabs(eta) >= 1.2 && fabs(eta) < 1.6) + deltaZ_ = 1.0; + else if (fabs(eta) >= 1.6 && fabs(eta) < 2.0) + deltaZ_ = 1.7; + else if (fabs(eta) >= 2.0 && fabs(eta) <= 2.4) + deltaZ_ = 2.2; } - if ( fabs(z0 - zVTX) <= deltaZ_) { - sumPx += pt*cos(phi); - sumPy += pt*sin(phi); + if (fabs(z0 - zVTX) <= deltaZ_) { + sumPx += pt * cos(phi); + sumPy += pt * sin(phi); etTot += pt; - } - else { // PU sums - sumPx_PU += pt*cos(phi); - sumPy_PU += pt*sin(phi); + } else { // PU sums + sumPx_PU += pt * cos(phi); + sumPy_PU += pt * sin(phi); etTot_PU += pt; } - } // end loop over tracks + } // end loop over tracks - float et = sqrt(sumPx*sumPx + sumPy*sumPy); - double etmiss_PU = sqrt(sumPx_PU*sumPx_PU + sumPy_PU*sumPy_PU); + float et = sqrt(sumPx * sumPx + sumPy * sumPy); + double etmiss_PU = sqrt(sumPx_PU * sumPx_PU + sumPy_PU * sumPy_PU); - math::XYZTLorentzVector missingEt( -sumPx, -sumPy, 0, et); + math::XYZTLorentzVector missingEt(-sumPx, -sumPy, 0, et); int ibx = 0; - METCollection->push_back( TkEtMiss( missingEt, - TkEtMiss::kMET, - etTot, - etmiss_PU, - etTot_PU, - ibx ) - ); + METCollection->push_back(TkEtMiss(missingEt, TkEtMiss::kMET, etTot, etmiss_PU, etTot_PU, ibx)); - if (displaced_) iEvent.put( std::move(METCollection), "L1TrackerEtMissExtended"); - else iEvent.put( std::move(METCollection), "L1TrackerEtMiss"); -} // end producer + if (displaced_) + iEvent.put(std::move(METCollection), "L1TrackerEtMissExtended"); + else + iEvent.put(std::move(METCollection), "L1TrackerEtMiss"); +} // end producer -void L1TrackerEtMissProducer::beginJob() { } +void L1TrackerEtMissProducer::beginJob() {} -void L1TrackerEtMissProducer::endJob() { } +void L1TrackerEtMissProducer::endJob() {} DEFINE_FWK_MODULE(L1TrackerEtMissProducer); diff --git a/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc index ddae5e669dfd9..8e5be97a10a45 100644 --- a/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc +++ b/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc @@ -57,7 +57,6 @@ // PHYSICS TOOLS #include "CommonTools/UtilAlgos/interface/TFileService.h" - //My additions #include "DataFormats/L1TCorrelator/interface/TkJet.h" #include "DataFormats/L1TCorrelator/interface/TkJetFwd.h" @@ -68,8 +67,6 @@ #include "DataFormats/L1TCorrelator/interface/TkHTMissFwd.h" #include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" - - /////////////// // ROOT HEADERS #include <TROOT.h> @@ -109,7 +106,6 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { void endJob() override; void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override; - protected: private: //----------------------------------------------------------------------------------------------- @@ -121,7 +117,7 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { bool SaveAllTracks; // store in ntuples not only truth-matched tracks but ALL tracks bool SaveStubs; // option to save also stubs in the ntuples (makes them large...) string Displaced; // "Prompt", "Displaced", "Both" - int TP_minNStub; // require TPs to have >= minNStub (defining efficiency denominator) (==0 means to only require >= 1 cluster) + int TP_minNStub; // require TPs to have >= minNStub (defining efficiency denominator) (==0 means to only require >= 1 cluster) int TP_minNStubLayer; // require TPs to have stubs in >= minNStubLayer layers/disks (defining efficiency denominator) double TP_minPt; // save TPs with pt > minPt double TP_maxEta; // save TPs with |eta| < maxEta @@ -131,9 +127,8 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { bool SaveTrackJets; bool SaveTrackMET; - - edm::InputTag L1TrackInputTag; // L1 track collection - edm::InputTag MCTruthTrackInputTag; // MC truth collection + edm::InputTag L1TrackInputTag; // L1 track collection + edm::InputTag MCTruthTrackInputTag; // MC truth collection edm::InputTag L1TrackExtendedInputTag; // L1 track collection edm::InputTag MCTruthTrackExtendedInputTag; // MC truth collection edm::InputTag MCTruthClusterInputTag; @@ -155,8 +150,6 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { edm::InputTag TrackMETExtendedInputTag; edm::InputTag TrackMHTExtendedInputTag; - - edm::EDGetTokenT<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_> > > ttClusterToken_; edm::EDGetTokenT<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> > > ttStubToken_; edm::EDGetTokenT<TTClusterAssociationMap<Ref_Phase2TrackerDigi_> > ttClusterMCTruthToken_; @@ -174,13 +167,12 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { edm::EDGetTokenT<std::vector<reco::GenParticle> > GenParticleToken_; edm::EDGetTokenT<l1t::TkPrimaryVertexCollection> L1VertexToken_; - edm::EDGetTokenT<std::vector<l1t::TkJet> > TrackFastJetsToken_; edm::EDGetTokenT<std::vector<l1t::TkJet> > TrackFastJetsExtendedToken_; - edm::EDGetTokenT<std::vector<l1t::TkEtMiss> > TrackMETToken_; - edm::EDGetTokenT<std::vector<l1t::TkEtMiss> > TrackMETExtendedToken_; - edm::EDGetTokenT<l1t::TkHTMissCollection > TrackMHTToken_; - edm::EDGetTokenT<l1t::TkHTMissCollection > TrackMHTExtendedToken_; + edm::EDGetTokenT<std::vector<l1t::TkEtMiss> > TrackMETToken_; + edm::EDGetTokenT<std::vector<l1t::TkEtMiss> > TrackMETExtendedToken_; + edm::EDGetTokenT<l1t::TkHTMissCollection> TrackMHTToken_; + edm::EDGetTokenT<l1t::TkHTMissCollection> TrackMHTExtendedToken_; edm::EDGetTokenT<l1t::TkJetCollection> TrackJetsToken_; edm::EDGetTokenT<l1t::TkJetCollection> TrackJetsExtendedToken_; @@ -259,7 +251,6 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { std::vector<float>* m_trkExt_matchtp_z0; std::vector<float>* m_trkExt_matchtp_dxy; - // all tracking particles std::vector<float>* m_tp_pt; std::vector<float>* m_tp_eta; @@ -275,7 +266,6 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { std::vector<int>* m_tp_eventid; std::vector<int>* m_tp_charge; - // *L1 track* properties if m_tp_nmatch > 0 (prompt) std::vector<float>* m_matchtrk_pt; std::vector<float>* m_matchtrk_eta; @@ -337,14 +327,14 @@ class L1TrackObjectNtupleMaker : public edm::EDAnalyzer { // std::vector<float>* m_jet_trk_sumpt; // std::vector<float>* m_jet_matchtrk_sumpt; - float trueMET=0; - float trkMET=0; - float trkMHT=0; - float trkHT=0; + float trueMET = 0; + float trkMET = 0; + float trkMHT = 0; + float trkHT = 0; - float trkMETExt=0; - float trkMHTExt=0; - float trkHTExt=0; + float trkMETExt = 0; + float trkMHTExt = 0; + float trkHTExt = 0; std::vector<float>* m_2ltrkjet_vz; std::vector<float>* m_2ltrkjet_p; @@ -400,7 +390,7 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon DebugMode = iConfig.getParameter<bool>("DebugMode"); SaveAllTracks = iConfig.getParameter<bool>("SaveAllTracks"); SaveStubs = iConfig.getParameter<bool>("SaveStubs"); - Displaced = iConfig.getParameter< string >("Displaced"); + Displaced = iConfig.getParameter<string>("Displaced"); TP_minNStub = iConfig.getParameter<int>("TP_minNStub"); TP_minNStubLayer = iConfig.getParameter<int>("TP_minNStubLayer"); TP_minPt = iConfig.getParameter<double>("TP_minPt"); @@ -418,10 +408,10 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon TrackingParticleInputTag = iConfig.getParameter<edm::InputTag>("TrackingParticleInputTag"); TrackingVertexInputTag = iConfig.getParameter<edm::InputTag>("TrackingVertexInputTag"); GenJetInputTag = iConfig.getParameter<edm::InputTag>("GenJetInputTag"); - RecoVertexInputTag = iConfig.getParameter<InputTag>("RecoVertexInputTag"); - GenParticleInputTag = iConfig.getParameter<InputTag >("GenParticleInputTag"); + RecoVertexInputTag = iConfig.getParameter<InputTag>("RecoVertexInputTag"); + GenParticleInputTag = iConfig.getParameter<InputTag>("GenParticleInputTag"); - if (Displaced=="Prompt" || Displaced=="Both") { + if (Displaced == "Prompt" || Displaced == "Both") { L1TrackInputTag = iConfig.getParameter<edm::InputTag>("L1TrackInputTag"); MCTruthTrackInputTag = iConfig.getParameter<edm::InputTag>("MCTruthTrackInputTag"); TrackFastJetsInputTag = iConfig.getParameter<InputTag>("TrackFastJetsInputTag"); @@ -433,11 +423,11 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon ttTrackMCTruthToken_ = consumes<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> >(MCTruthTrackInputTag); TrackFastJetsToken_ = consumes<std::vector<l1t::TkJet> >(TrackFastJetsInputTag); TrackJetsToken_ = consumes<l1t::TkJetCollection>(TrackJetsInputTag); - TrackMETToken_ = consumes<std::vector<l1t::TkEtMiss> >(TrackMETInputTag); + TrackMETToken_ = consumes<std::vector<l1t::TkEtMiss> >(TrackMETInputTag); TrackMHTToken_ = consumes<l1t::TkHTMissCollection>(TrackMHTInputTag); } - if (Displaced=="Displaced" || Displaced=="Both") { + if (Displaced == "Displaced" || Displaced == "Both") { L1TrackExtendedInputTag = iConfig.getParameter<edm::InputTag>("L1TrackExtendedInputTag"); MCTruthTrackExtendedInputTag = iConfig.getParameter<edm::InputTag>("MCTruthTrackExtendedInputTag"); TrackFastJetsExtendedInputTag = iConfig.getParameter<InputTag>("TrackFastJetsExtendedInputTag"); @@ -446,10 +436,11 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon TrackMHTExtendedInputTag = iConfig.getParameter<InputTag>("TrackMHTExtendedInputTag"); ttTrackExtendedToken_ = consumes<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > >(L1TrackExtendedInputTag); - ttTrackMCTruthExtendedToken_ = consumes<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> >(MCTruthTrackExtendedInputTag); + ttTrackMCTruthExtendedToken_ = + consumes<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> >(MCTruthTrackExtendedInputTag); TrackFastJetsExtendedToken_ = consumes<std::vector<l1t::TkJet> >(TrackFastJetsExtendedInputTag); TrackJetsExtendedToken_ = consumes<l1t::TkJetCollection>(TrackJetsExtendedInputTag); - TrackMETExtendedToken_ = consumes<std::vector<l1t::TkEtMiss> >(TrackMETExtendedInputTag); + TrackMETExtendedToken_ = consumes<std::vector<l1t::TkEtMiss> >(TrackMETExtendedInputTag); TrackMHTExtendedToken_ = consumes<l1t::TkHTMissCollection>(TrackMHTExtendedInputTag); } @@ -459,8 +450,8 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon TrackingParticleToken_ = consumes<std::vector<TrackingParticle> >(TrackingParticleInputTag); TrackingVertexToken_ = consumes<std::vector<TrackingVertex> >(TrackingVertexInputTag); GenJetToken_ = consumes<std::vector<reco::GenJet> >(GenJetInputTag); - GenParticleToken_=consumes< std::vector< reco::GenParticle> >(GenParticleInputTag); - L1VertexToken_=consumes<l1t::TkPrimaryVertexCollection>(RecoVertexInputTag); + GenParticleToken_ = consumes<std::vector<reco::GenParticle> >(GenParticleInputTag); + L1VertexToken_ = consumes<l1t::TkPrimaryVertexCollection>(RecoVertexInputTag); } ///////////// @@ -485,7 +476,7 @@ void L1TrackObjectNtupleMaker::beginJob() { edm::Service<TFileService> fs; available_ = fs.isAvailable(); if (not available_) - return; // No ROOT file open. + return; // No ROOT file open. // initilize m_trk_pt = new std::vector<float>; @@ -620,18 +611,18 @@ void L1TrackObjectNtupleMaker::beginJob() { // m_pv_L1TPsumpt = new std::vector<float>; m_pv_MC = new std::vector<float>; // m_pv_MCChgSumpT = new std::vector<float>; - m_MC_lep=new std::vector<int>; + m_MC_lep = new std::vector<int>; m_2ltrkjet_eta = new std::vector<float>; m_2ltrkjet_vz = new std::vector<float>; m_2ltrkjet_phi = new std::vector<float>; m_2ltrkjet_p = new std::vector<float>; m_2ltrkjet_pt = new std::vector<float>; - m_2ltrkjet_ntracks=new std::vector<int>; - m_2ltrkjet_nDisplaced=new std::vector<int>; - m_2ltrkjet_nTight=new std::vector<int>; - m_2ltrkjet_nTightDisplaced=new std::vector<int>; - m_2ltrkjet_ntdtrk=new std::vector<int>; + m_2ltrkjet_ntracks = new std::vector<int>; + m_2ltrkjet_nDisplaced = new std::vector<int>; + m_2ltrkjet_nTight = new std::vector<int>; + m_2ltrkjet_nTightDisplaced = new std::vector<int>; + m_2ltrkjet_ntdtrk = new std::vector<int>; m_trkjet_eta = new std::vector<float>; m_trkjet_vz = new std::vector<float>; @@ -647,11 +638,11 @@ void L1TrackObjectNtupleMaker::beginJob() { m_2ltrkjetExt_phi = new std::vector<float>; m_2ltrkjetExt_p = new std::vector<float>; m_2ltrkjetExt_pt = new std::vector<float>; - m_2ltrkjetExt_ntracks=new std::vector<int>; - m_2ltrkjetExt_nDisplaced=new std::vector<int>; - m_2ltrkjetExt_nTight=new std::vector<int>; - m_2ltrkjetExt_nTightDisplaced=new std::vector<int>; - m_2ltrkjetExt_ntdtrk=new std::vector<int>; + m_2ltrkjetExt_ntracks = new std::vector<int>; + m_2ltrkjetExt_nDisplaced = new std::vector<int>; + m_2ltrkjetExt_nTight = new std::vector<int>; + m_2ltrkjetExt_nTightDisplaced = new std::vector<int>; + m_2ltrkjetExt_ntdtrk = new std::vector<int>; m_trkjetExt_eta = new std::vector<float>; m_trkjetExt_vz = new std::vector<float>; @@ -665,7 +656,7 @@ void L1TrackObjectNtupleMaker::beginJob() { // ntuple eventTree = fs->make<TTree>("eventTree", "Event tree"); - if (SaveAllTracks && (Displaced=="Prompt" || Displaced=="Both")) { + if (SaveAllTracks && (Displaced == "Prompt" || Displaced == "Both")) { eventTree->Branch("trk_pt", &m_trk_pt); eventTree->Branch("trk_eta", &m_trk_eta); eventTree->Branch("trk_phi", &m_trk_phi); @@ -700,7 +691,7 @@ void L1TrackObjectNtupleMaker::beginJob() { // } } - if (SaveAllTracks && (Displaced=="Displaced" || Displaced=="Both")) { + if (SaveAllTracks && (Displaced == "Displaced" || Displaced == "Both")) { eventTree->Branch("trkExt_pt", &m_trkExt_pt); eventTree->Branch("trkExt_eta", &m_trkExt_eta); eventTree->Branch("trkExt_phi", &m_trkExt_phi); @@ -753,7 +744,7 @@ void L1TrackObjectNtupleMaker::beginJob() { // eventTree->Branch("tp_injet_vhighpt", &m_tp_injet_vhighpt); // } - if (Displaced=="Prompt" || Displaced=="Both") { + if (Displaced == "Prompt" || Displaced == "Both") { eventTree->Branch("matchtrk_pt", &m_matchtrk_pt); eventTree->Branch("matchtrk_eta", &m_matchtrk_eta); eventTree->Branch("matchtrk_phi", &m_matchtrk_phi); @@ -776,7 +767,7 @@ void L1TrackObjectNtupleMaker::beginJob() { // } } - if (Displaced=="Displaced" || Displaced=="Both") { + if (Displaced == "Displaced" || Displaced == "Both") { eventTree->Branch("matchtrkExt_pt", &m_matchtrkExt_pt); eventTree->Branch("matchtrkExt_eta", &m_matchtrkExt_eta); eventTree->Branch("matchtrkExt_phi", &m_matchtrkExt_phi); @@ -835,7 +826,7 @@ void L1TrackObjectNtupleMaker::beginJob() { // eventTree->Branch("pv_MCChgSumpT", &m_pv_MCChgSumpT); eventTree->Branch("pv_MC", &m_pv_MC); - if (Displaced=="Prompt" || Displaced=="Both") { + if (Displaced == "Prompt" || Displaced == "Both") { eventTree->Branch("2ltrkjet_eta", &m_2ltrkjet_eta); eventTree->Branch("2ltrkjet_vz", &m_2ltrkjet_vz); eventTree->Branch("2ltrkjet_p", &m_2ltrkjet_p); @@ -853,7 +844,7 @@ void L1TrackObjectNtupleMaker::beginJob() { eventTree->Branch("trkjet_ntracks", &m_trkjet_ntracks); eventTree->Branch("trkjet_truetp_sumpt", m_trkjet_truetp_sumpt); } - if (Displaced=="Displaced" || Displaced=="Both") { + if (Displaced == "Displaced" || Displaced == "Both") { eventTree->Branch("2ltrkjetExt_eta", &m_2ltrkjetExt_eta); eventTree->Branch("2ltrkjetExt_vz", &m_2ltrkjetExt_vz); eventTree->Branch("2ltrkjetExt_p", &m_2ltrkjetExt_p); @@ -876,12 +867,12 @@ void L1TrackObjectNtupleMaker::beginJob() { if (SaveTrackMET) { eventTree->Branch("trueMET", &trueMET, "trueMET/F"); - if (Displaced=="Prompt" || Displaced=="Both") { + if (Displaced == "Prompt" || Displaced == "Both") { eventTree->Branch("trkMET", &trkMET, "trkMET/F"); eventTree->Branch("trkMHT", &trkMHT, "trkMHT/F"); eventTree->Branch("trkHT", &trkHT, "trkHT/F"); } - if (Displaced=="Displaced" || Displaced=="Both") { + if (Displaced == "Displaced" || Displaced == "Both") { eventTree->Branch("trkMETExt", &trkMETExt, "trkMETExt/F"); eventTree->Branch("trkMHTExt", &trkMHTExt, "trkMHTExt/F"); eventTree->Branch("trkHTExt", &trkHTExt, "trkHTExt/F"); @@ -893,1368 +884,1361 @@ void L1TrackObjectNtupleMaker::beginJob() { // ANALYZE void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { if (not available_) - return; // No ROOT file open. + return; // No ROOT file open. if (!(MyProcess == 13 || MyProcess == 11 || MyProcess == 211 || MyProcess == 6 || MyProcess == 15 || - MyProcess == 1)) { - edm::LogVerbatim("Tracklet") << "The specified MyProcess is invalid! Exiting..."; - return; - } + MyProcess == 1)) { + edm::LogVerbatim("Tracklet") << "The specified MyProcess is invalid! Exiting..."; + return; + } - // clear variables - if (SaveAllTracks && (Displaced=="Prompt" || Displaced=="Both")) { - m_trk_pt->clear(); - m_trk_eta->clear(); - m_trk_phi->clear(); - m_trk_d0->clear(); - m_trk_z0->clear(); - m_trk_chi2->clear(); - m_trk_chi2dof->clear(); - m_trk_chi2rphi->clear(); - m_trk_chi2rz->clear(); - m_trk_bendchi2->clear(); - m_trk_nstub->clear(); - m_trk_lhits->clear(); - m_trk_dhits->clear(); - m_trk_seed->clear(); - m_trk_hitpattern->clear(); - m_trk_phiSector->clear(); - m_trk_genuine->clear(); - m_trk_loose->clear(); - m_trk_unknown->clear(); - m_trk_combinatoric->clear(); - m_trk_fake->clear(); - m_trk_matchtp_pdgid->clear(); - m_trk_matchtp_pt->clear(); - m_trk_matchtp_eta->clear(); - m_trk_matchtp_phi->clear(); - m_trk_matchtp_z0->clear(); - m_trk_matchtp_dxy->clear(); - } - if (SaveAllTracks && (Displaced=="Displaced" || Displaced=="Both")) { - m_trkExt_pt->clear(); - m_trkExt_eta->clear(); - m_trkExt_phi->clear(); - m_trkExt_d0->clear(); - m_trkExt_z0->clear(); - m_trkExt_chi2->clear(); - m_trkExt_chi2dof->clear(); - m_trkExt_chi2rphi->clear(); - m_trkExt_chi2rz->clear(); - m_trkExt_bendchi2->clear(); - m_trkExt_nstub->clear(); - m_trkExt_lhits->clear(); - m_trkExt_dhits->clear(); - m_trkExt_seed->clear(); - m_trkExt_hitpattern->clear(); - m_trkExt_phiSector->clear(); - m_trkExt_genuine->clear(); - m_trkExt_loose->clear(); - m_trkExt_unknown->clear(); - m_trkExt_combinatoric->clear(); - m_trkExt_fake->clear(); - m_trkExt_matchtp_pdgid->clear(); - m_trkExt_matchtp_pt->clear(); - m_trkExt_matchtp_eta->clear(); - m_trkExt_matchtp_phi->clear(); - m_trkExt_matchtp_z0->clear(); - m_trkExt_matchtp_dxy->clear(); - } - m_tp_pt->clear(); - m_tp_eta->clear(); - m_tp_phi->clear(); - m_tp_dxy->clear(); - m_tp_d0->clear(); - m_tp_z0->clear(); - m_tp_d0_prod->clear(); - m_tp_z0_prod->clear(); - m_tp_pdgid->clear(); - m_tp_nmatch->clear(); - m_tp_nstub->clear(); - m_tp_eventid->clear(); - m_tp_charge->clear(); - - if (Displaced=="Prompt" || Displaced=="Both") { - m_matchtrk_pt->clear(); - m_matchtrk_eta->clear(); - m_matchtrk_phi->clear(); - m_matchtrk_z0->clear(); - m_matchtrk_d0->clear(); - m_matchtrk_chi2->clear(); - m_matchtrk_chi2dof->clear(); - m_matchtrk_chi2rphi->clear(); - m_matchtrk_chi2rz->clear(); - m_matchtrk_bendchi2->clear(); - m_matchtrk_nstub->clear(); - m_matchtrk_lhits->clear(); - m_matchtrk_dhits->clear(); - m_matchtrk_seed->clear(); - m_matchtrk_hitpattern->clear(); - } + // clear variables + if (SaveAllTracks && (Displaced == "Prompt" || Displaced == "Both")) { + m_trk_pt->clear(); + m_trk_eta->clear(); + m_trk_phi->clear(); + m_trk_d0->clear(); + m_trk_z0->clear(); + m_trk_chi2->clear(); + m_trk_chi2dof->clear(); + m_trk_chi2rphi->clear(); + m_trk_chi2rz->clear(); + m_trk_bendchi2->clear(); + m_trk_nstub->clear(); + m_trk_lhits->clear(); + m_trk_dhits->clear(); + m_trk_seed->clear(); + m_trk_hitpattern->clear(); + m_trk_phiSector->clear(); + m_trk_genuine->clear(); + m_trk_loose->clear(); + m_trk_unknown->clear(); + m_trk_combinatoric->clear(); + m_trk_fake->clear(); + m_trk_matchtp_pdgid->clear(); + m_trk_matchtp_pt->clear(); + m_trk_matchtp_eta->clear(); + m_trk_matchtp_phi->clear(); + m_trk_matchtp_z0->clear(); + m_trk_matchtp_dxy->clear(); + } + if (SaveAllTracks && (Displaced == "Displaced" || Displaced == "Both")) { + m_trkExt_pt->clear(); + m_trkExt_eta->clear(); + m_trkExt_phi->clear(); + m_trkExt_d0->clear(); + m_trkExt_z0->clear(); + m_trkExt_chi2->clear(); + m_trkExt_chi2dof->clear(); + m_trkExt_chi2rphi->clear(); + m_trkExt_chi2rz->clear(); + m_trkExt_bendchi2->clear(); + m_trkExt_nstub->clear(); + m_trkExt_lhits->clear(); + m_trkExt_dhits->clear(); + m_trkExt_seed->clear(); + m_trkExt_hitpattern->clear(); + m_trkExt_phiSector->clear(); + m_trkExt_genuine->clear(); + m_trkExt_loose->clear(); + m_trkExt_unknown->clear(); + m_trkExt_combinatoric->clear(); + m_trkExt_fake->clear(); + m_trkExt_matchtp_pdgid->clear(); + m_trkExt_matchtp_pt->clear(); + m_trkExt_matchtp_eta->clear(); + m_trkExt_matchtp_phi->clear(); + m_trkExt_matchtp_z0->clear(); + m_trkExt_matchtp_dxy->clear(); + } + m_tp_pt->clear(); + m_tp_eta->clear(); + m_tp_phi->clear(); + m_tp_dxy->clear(); + m_tp_d0->clear(); + m_tp_z0->clear(); + m_tp_d0_prod->clear(); + m_tp_z0_prod->clear(); + m_tp_pdgid->clear(); + m_tp_nmatch->clear(); + m_tp_nstub->clear(); + m_tp_eventid->clear(); + m_tp_charge->clear(); + + if (Displaced == "Prompt" || Displaced == "Both") { + m_matchtrk_pt->clear(); + m_matchtrk_eta->clear(); + m_matchtrk_phi->clear(); + m_matchtrk_z0->clear(); + m_matchtrk_d0->clear(); + m_matchtrk_chi2->clear(); + m_matchtrk_chi2dof->clear(); + m_matchtrk_chi2rphi->clear(); + m_matchtrk_chi2rz->clear(); + m_matchtrk_bendchi2->clear(); + m_matchtrk_nstub->clear(); + m_matchtrk_lhits->clear(); + m_matchtrk_dhits->clear(); + m_matchtrk_seed->clear(); + m_matchtrk_hitpattern->clear(); + } - if (Displaced=="Displaced" || Displaced=="Both") { - m_matchtrkExt_pt->clear(); - m_matchtrkExt_eta->clear(); - m_matchtrkExt_phi->clear(); - m_matchtrkExt_z0->clear(); - m_matchtrkExt_d0->clear(); - m_matchtrkExt_chi2->clear(); - m_matchtrkExt_chi2dof->clear(); - m_matchtrkExt_chi2rphi->clear(); - m_matchtrkExt_chi2rz->clear(); - m_matchtrkExt_bendchi2->clear(); - m_matchtrkExt_nstub->clear(); - m_matchtrkExt_lhits->clear(); - m_matchtrkExt_dhits->clear(); - m_matchtrkExt_seed->clear(); - m_matchtrkExt_hitpattern->clear(); - } + if (Displaced == "Displaced" || Displaced == "Both") { + m_matchtrkExt_pt->clear(); + m_matchtrkExt_eta->clear(); + m_matchtrkExt_phi->clear(); + m_matchtrkExt_z0->clear(); + m_matchtrkExt_d0->clear(); + m_matchtrkExt_chi2->clear(); + m_matchtrkExt_chi2dof->clear(); + m_matchtrkExt_chi2rphi->clear(); + m_matchtrkExt_chi2rz->clear(); + m_matchtrkExt_bendchi2->clear(); + m_matchtrkExt_nstub->clear(); + m_matchtrkExt_lhits->clear(); + m_matchtrkExt_dhits->clear(); + m_matchtrkExt_seed->clear(); + m_matchtrkExt_hitpattern->clear(); + } - if (SaveStubs) { - m_allstub_x->clear(); - m_allstub_y->clear(); - m_allstub_z->clear(); - m_allstub_isBarrel->clear(); - m_allstub_layer->clear(); - m_allstub_isPSmodule->clear(); - m_allstub_trigDisplace->clear(); - m_allstub_trigOffset->clear(); - m_allstub_trigPos->clear(); - m_allstub_trigBend->clear(); - m_allstub_matchTP_pdgid->clear(); - m_allstub_matchTP_pt->clear(); - m_allstub_matchTP_eta->clear(); - m_allstub_matchTP_phi->clear(); - m_allstub_genuine->clear(); - } + if (SaveStubs) { + m_allstub_x->clear(); + m_allstub_y->clear(); + m_allstub_z->clear(); + m_allstub_isBarrel->clear(); + m_allstub_layer->clear(); + m_allstub_isPSmodule->clear(); + m_allstub_trigDisplace->clear(); + m_allstub_trigOffset->clear(); + m_allstub_trigPos->clear(); + m_allstub_trigBend->clear(); + m_allstub_matchTP_pdgid->clear(); + m_allstub_matchTP_pt->clear(); + m_allstub_matchTP_eta->clear(); + m_allstub_matchTP_phi->clear(); + m_allstub_genuine->clear(); + } - // m_jet_eta->clear(); - // m_jet_phi->clear(); - // m_jet_pt->clear(); - // m_jet_tp_sumpt->clear(); - // m_jet_trk_sumpt->clear(); - // m_jet_matchtrk_sumpt->clear(); - - if (SaveTrackJets) { - - if (Displaced=="Prompt" || Displaced=="Both") { - m_2ltrkjet_eta->clear(); - m_2ltrkjet_pt->clear(); - m_2ltrkjet_vz->clear(); - m_2ltrkjet_phi->clear(); - m_2ltrkjet_p->clear(); - m_2ltrkjet_ntracks->clear(); - m_2ltrkjet_nDisplaced->clear(); - m_2ltrkjet_nTight->clear(); - m_2ltrkjet_nTightDisplaced->clear(); - m_2ltrkjet_ntdtrk->clear(); - m_trkjet_eta->clear(); - m_trkjet_pt->clear(); - m_trkjet_vz->clear(); - m_trkjet_phi->clear(); - m_trkjet_p->clear(); - m_trkjet_ntracks->clear(); - m_trkjet_truetp_sumpt->clear(); - m_trkjet_tp_sumpt->clear(); - } - if (Displaced=="Displaced" || Displaced=="Both") { - m_2ltrkjetExt_eta->clear(); - m_2ltrkjetExt_pt->clear(); - m_2ltrkjetExt_vz->clear(); - m_2ltrkjetExt_phi->clear(); - m_2ltrkjetExt_p->clear(); - m_2ltrkjetExt_ntracks->clear(); - m_2ltrkjetExt_nDisplaced->clear(); - m_2ltrkjetExt_nTight->clear(); - m_2ltrkjetExt_nTightDisplaced->clear(); - m_2ltrkjetExt_ntdtrk->clear(); - m_trkjetExt_eta->clear(); - m_trkjetExt_pt->clear(); - m_trkjetExt_vz->clear(); - m_trkjetExt_phi->clear(); - m_trkjetExt_p->clear(); - m_trkjetExt_ntracks->clear(); - m_trkjetExt_truetp_sumpt->clear(); - m_trkjetExt_tp_sumpt->clear(); - } + // m_jet_eta->clear(); + // m_jet_phi->clear(); + // m_jet_pt->clear(); + // m_jet_tp_sumpt->clear(); + // m_jet_trk_sumpt->clear(); + // m_jet_matchtrk_sumpt->clear(); - // m_pv_L1recotruesumpt->clear(); - // m_pv_L1recosumpt->clear(); - m_pv_L1reco->clear(); - // m_pv_L1TPsumpt->clear(); - // m_pv_L1TP->clear(); - m_pv_MC->clear(); - m_MC_lep->clear(); - // m_pv_MCChgSumpT->clear(); + if (SaveTrackJets) { + if (Displaced == "Prompt" || Displaced == "Both") { + m_2ltrkjet_eta->clear(); + m_2ltrkjet_pt->clear(); + m_2ltrkjet_vz->clear(); + m_2ltrkjet_phi->clear(); + m_2ltrkjet_p->clear(); + m_2ltrkjet_ntracks->clear(); + m_2ltrkjet_nDisplaced->clear(); + m_2ltrkjet_nTight->clear(); + m_2ltrkjet_nTightDisplaced->clear(); + m_2ltrkjet_ntdtrk->clear(); + m_trkjet_eta->clear(); + m_trkjet_pt->clear(); + m_trkjet_vz->clear(); + m_trkjet_phi->clear(); + m_trkjet_p->clear(); + m_trkjet_ntracks->clear(); + m_trkjet_truetp_sumpt->clear(); + m_trkjet_tp_sumpt->clear(); } + if (Displaced == "Displaced" || Displaced == "Both") { + m_2ltrkjetExt_eta->clear(); + m_2ltrkjetExt_pt->clear(); + m_2ltrkjetExt_vz->clear(); + m_2ltrkjetExt_phi->clear(); + m_2ltrkjetExt_p->clear(); + m_2ltrkjetExt_ntracks->clear(); + m_2ltrkjetExt_nDisplaced->clear(); + m_2ltrkjetExt_nTight->clear(); + m_2ltrkjetExt_nTightDisplaced->clear(); + m_2ltrkjetExt_ntdtrk->clear(); + m_trkjetExt_eta->clear(); + m_trkjetExt_pt->clear(); + m_trkjetExt_vz->clear(); + m_trkjetExt_phi->clear(); + m_trkjetExt_p->clear(); + m_trkjetExt_ntracks->clear(); + m_trkjetExt_truetp_sumpt->clear(); + m_trkjetExt_tp_sumpt->clear(); + } + + // m_pv_L1recotruesumpt->clear(); + // m_pv_L1recosumpt->clear(); + m_pv_L1reco->clear(); + // m_pv_L1TPsumpt->clear(); + // m_pv_L1TP->clear(); + m_pv_MC->clear(); + m_MC_lep->clear(); + // m_pv_MCChgSumpT->clear(); + } - // ----------------------------------------------------------------------------------------------- - // retrieve various containers - // ----------------------------------------------------------------------------------------------- + // ----------------------------------------------------------------------------------------------- + // retrieve various containers + // ----------------------------------------------------------------------------------------------- - // L1 stubs - edm::Handle<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> > > TTStubHandle; - if (SaveStubs) + // L1 stubs + edm::Handle<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> > > TTStubHandle; + if (SaveStubs) iEvent.getByToken(ttStubToken_, TTStubHandle); - // MC truth association maps - edm::Handle<TTClusterAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTClusterHandle; - iEvent.getByToken(ttClusterMCTruthToken_, MCTruthTTClusterHandle); - edm::Handle<TTStubAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTStubHandle; - iEvent.getByToken(ttStubMCTruthToken_, MCTruthTTStubHandle); - - // tracking particles - edm::Handle<std::vector<TrackingParticle> > TrackingParticleHandle; - edm::Handle<std::vector<TrackingVertex> > TrackingVertexHandle; - iEvent.getByToken(TrackingParticleToken_, TrackingParticleHandle); - iEvent.getByToken(TrackingVertexToken_, TrackingVertexHandle); - - // ----------------------------------------------------------------------------------------------- - // more for TTStubs - edm::ESHandle<TrackerGeometry> geometryHandle; - iSetup.get<TrackerDigiGeometryRecord>().get(geometryHandle); - - edm::ESHandle<TrackerTopology> tTopoHandle; - iSetup.get<TrackerTopologyRcd>().get(tTopoHandle); - - edm::ESHandle<TrackerGeometry> tGeomHandle; - iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); - - const TrackerTopology* const tTopo = tTopoHandle.product(); - const TrackerGeometry* const theTrackerGeom = tGeomHandle.product(); - - //Gen particles - edm::Handle< std::vector< reco::GenParticle> > GenParticleHandle; - iEvent.getByToken(GenParticleToken_,GenParticleHandle); - - //Vertex - edm::Handle< l1t::TkPrimaryVertexCollection >L1TkPrimaryVertexHandle; - iEvent.getByToken(L1VertexToken_, L1TkPrimaryVertexHandle); - - // Track jets - edm::Handle< std::vector<l1t::TkJet> > TrackFastJetsHandle; - edm::Handle< std::vector<l1t::TkJet> > TrackFastJetsExtendedHandle; - edm::Handle<l1t::TkJetCollection> TrackJetsHandle; - edm::Handle<l1t::TkJetCollection> TrackJetsExtendedHandle; - std::vector< l1t::TkJet >::const_iterator jetIter; - - // Track MET - edm::Handle< std::vector<l1t::TkEtMiss> > L1TkMETHandle; - edm::Handle< std::vector<l1t::TkEtMiss> > L1TkMETExtendedHandle; - edm::Handle< std::vector<l1t::TkHTMiss> > L1TkMHTHandle; - edm::Handle< std::vector<l1t::TkHTMiss> > L1TkMHTExtendedHandle; - - // L1 tracks - edm::Handle<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackHandle; - edm::Handle<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackExtendedHandle; - edm::Handle<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTTrackHandle; - edm::Handle<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTTrackExtendedHandle; - std::vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator iterL1Track; - - - if (Displaced=="Prompt" || Displaced=="Both") { - iEvent.getByToken(TrackFastJetsToken_, TrackFastJetsHandle); - iEvent.getByToken(TrackJetsToken_,TrackJetsHandle); - iEvent.getByToken(TrackMETToken_, L1TkMETHandle); - iEvent.getByToken(TrackMHTToken_, L1TkMHTHandle); - iEvent.getByToken(ttTrackToken_, TTTrackHandle); - iEvent.getByToken(ttTrackMCTruthToken_, MCTruthTTTrackHandle); - } - if (Displaced=="Displaced" || Displaced=="Both") { - iEvent.getByToken(TrackFastJetsExtendedToken_, TrackFastJetsExtendedHandle); - iEvent.getByToken(TrackJetsExtendedToken_,TrackJetsExtendedHandle); - iEvent.getByToken(TrackMETExtendedToken_, L1TkMETExtendedHandle); - iEvent.getByToken(TrackMHTExtendedToken_, L1TkMHTExtendedHandle); - iEvent.getByToken(ttTrackExtendedToken_, TTTrackExtendedHandle); - iEvent.getByToken(ttTrackMCTruthExtendedToken_, MCTruthTTTrackExtendedHandle); - } + // MC truth association maps + edm::Handle<TTClusterAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTClusterHandle; + iEvent.getByToken(ttClusterMCTruthToken_, MCTruthTTClusterHandle); + edm::Handle<TTStubAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTStubHandle; + iEvent.getByToken(ttStubMCTruthToken_, MCTruthTTStubHandle); + + // tracking particles + edm::Handle<std::vector<TrackingParticle> > TrackingParticleHandle; + edm::Handle<std::vector<TrackingVertex> > TrackingVertexHandle; + iEvent.getByToken(TrackingParticleToken_, TrackingParticleHandle); + iEvent.getByToken(TrackingVertexToken_, TrackingVertexHandle); + + // ----------------------------------------------------------------------------------------------- + // more for TTStubs + edm::ESHandle<TrackerGeometry> geometryHandle; + iSetup.get<TrackerDigiGeometryRecord>().get(geometryHandle); + + edm::ESHandle<TrackerTopology> tTopoHandle; + iSetup.get<TrackerTopologyRcd>().get(tTopoHandle); + + edm::ESHandle<TrackerGeometry> tGeomHandle; + iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle); + + const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerGeometry* const theTrackerGeom = tGeomHandle.product(); + + //Gen particles + edm::Handle<std::vector<reco::GenParticle> > GenParticleHandle; + iEvent.getByToken(GenParticleToken_, GenParticleHandle); + + //Vertex + edm::Handle<l1t::TkPrimaryVertexCollection> L1TkPrimaryVertexHandle; + iEvent.getByToken(L1VertexToken_, L1TkPrimaryVertexHandle); + + // Track jets + edm::Handle<std::vector<l1t::TkJet> > TrackFastJetsHandle; + edm::Handle<std::vector<l1t::TkJet> > TrackFastJetsExtendedHandle; + edm::Handle<l1t::TkJetCollection> TrackJetsHandle; + edm::Handle<l1t::TkJetCollection> TrackJetsExtendedHandle; + std::vector<l1t::TkJet>::const_iterator jetIter; + + // Track MET + edm::Handle<std::vector<l1t::TkEtMiss> > L1TkMETHandle; + edm::Handle<std::vector<l1t::TkEtMiss> > L1TkMETExtendedHandle; + edm::Handle<std::vector<l1t::TkHTMiss> > L1TkMHTHandle; + edm::Handle<std::vector<l1t::TkHTMiss> > L1TkMHTExtendedHandle; + + // L1 tracks + edm::Handle<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackHandle; + edm::Handle<std::vector<TTTrack<Ref_Phase2TrackerDigi_> > > TTTrackExtendedHandle; + edm::Handle<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTTrackHandle; + edm::Handle<TTTrackAssociationMap<Ref_Phase2TrackerDigi_> > MCTruthTTTrackExtendedHandle; + std::vector<TTTrack<Ref_Phase2TrackerDigi_> >::const_iterator iterL1Track; + + if (Displaced == "Prompt" || Displaced == "Both") { + iEvent.getByToken(TrackFastJetsToken_, TrackFastJetsHandle); + iEvent.getByToken(TrackJetsToken_, TrackJetsHandle); + iEvent.getByToken(TrackMETToken_, L1TkMETHandle); + iEvent.getByToken(TrackMHTToken_, L1TkMHTHandle); + iEvent.getByToken(ttTrackToken_, TTTrackHandle); + iEvent.getByToken(ttTrackMCTruthToken_, MCTruthTTTrackHandle); + } + if (Displaced == "Displaced" || Displaced == "Both") { + iEvent.getByToken(TrackFastJetsExtendedToken_, TrackFastJetsExtendedHandle); + iEvent.getByToken(TrackJetsExtendedToken_, TrackJetsExtendedHandle); + iEvent.getByToken(TrackMETExtendedToken_, L1TkMETExtendedHandle); + iEvent.getByToken(TrackMHTExtendedToken_, L1TkMHTExtendedHandle); + iEvent.getByToken(ttTrackExtendedToken_, TTTrackExtendedHandle); + iEvent.getByToken(ttTrackMCTruthExtendedToken_, MCTruthTTTrackExtendedHandle); + } - //Loop over gen particles - if (GenParticleHandle.isValid()) { - vector<reco::GenParticle>::const_iterator genpartIter; + //Loop over gen particles + if (GenParticleHandle.isValid()) { + vector<reco::GenParticle>::const_iterator genpartIter; - float zvtx_gen = -999; - for (genpartIter = GenParticleHandle->begin(); genpartIter != GenParticleHandle->end(); ++genpartIter) { - int status = genpartIter -> status(); - if (status!=1) continue; - zvtx_gen = genpartIter -> vz(); - } - m_pv_MC->push_back(zvtx_gen); - - float trueMETx = 0; - float trueMETy = 0; - trueMET = 0; - for (size_t i = 0; i<GenParticleHandle->size(); ++i) { - const reco::GenParticle & p = (*GenParticleHandle)[i]; - int id = p.pdgId(); - bool isNeutrino = false; - if ( (fabs(id)==12 || fabs(id)==14 || fabs(id)==16) ) isNeutrino = true; - if ( (isNeutrino|| id==1000022 ) && p.status()==1 ) { - trueMETx += p.pt()*cos(p.phi()); - trueMETy += p.pt()*sin(p.phi()); - } - } - trueMET = sqrt(trueMETx*trueMETx + trueMETy*trueMETy); + float zvtx_gen = -999; + for (genpartIter = GenParticleHandle->begin(); genpartIter != GenParticleHandle->end(); ++genpartIter) { + int status = genpartIter->status(); + if (status != 1) + continue; + zvtx_gen = genpartIter->vz(); } - else { - edm::LogWarning("DataNotFound")<< "\nWarning: GenParticleHandle not found in the event"<< std::endl; + m_pv_MC->push_back(zvtx_gen); + + float trueMETx = 0; + float trueMETy = 0; + trueMET = 0; + for (size_t i = 0; i < GenParticleHandle->size(); ++i) { + const reco::GenParticle& p = (*GenParticleHandle)[i]; + int id = p.pdgId(); + bool isNeutrino = false; + if ((fabs(id) == 12 || fabs(id) == 14 || fabs(id) == 16)) + isNeutrino = true; + if ((isNeutrino || id == 1000022) && p.status() == 1) { + trueMETx += p.pt() * cos(p.phi()); + trueMETy += p.pt() * sin(p.phi()); + } } + trueMET = sqrt(trueMETx * trueMETx + trueMETy * trueMETy); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: GenParticleHandle not found in the event" << std::endl; + } - // ---------------------------------------------------------------------------------------------- - // loop over L1 stubs - // ---------------------------------------------------------------------------------------------- - if (SaveStubs) { - for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) { - DetId detid = (*gd)->geographicalId(); - if (detid.subdetId() != StripSubdetector::TOB && detid.subdetId() != StripSubdetector::TID) + // ---------------------------------------------------------------------------------------------- + // loop over L1 stubs + // ---------------------------------------------------------------------------------------------- + if (SaveStubs) { + for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) { + DetId detid = (*gd)->geographicalId(); + if (detid.subdetId() != StripSubdetector::TOB && detid.subdetId() != StripSubdetector::TID) continue; - if (!tTopo->isLower(detid)) + if (!tTopo->isLower(detid)) continue; // loop on the stacks: choose the lower arbitrarily - DetId stackDetid = tTopo->stack(detid); // Stub module detid + DetId stackDetid = tTopo->stack(detid); // Stub module detid - if (TTStubHandle->find(stackDetid) == TTStubHandle->end()) + if (TTStubHandle->find(stackDetid) == TTStubHandle->end()) continue; - // Get the DetSets of the Clusters - edmNew::DetSet<TTStub<Ref_Phase2TrackerDigi_> > stubs = (*TTStubHandle)[stackDetid]; - const GeomDetUnit* det0 = theTrackerGeom->idToDetUnit(detid); - const auto* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(det0); - const PixelTopology* topol = dynamic_cast<const PixelTopology*>(&(theGeomDet->specificTopology())); + // Get the DetSets of the Clusters + edmNew::DetSet<TTStub<Ref_Phase2TrackerDigi_> > stubs = (*TTStubHandle)[stackDetid]; + const GeomDetUnit* det0 = theTrackerGeom->idToDetUnit(detid); + const auto* theGeomDet = dynamic_cast<const PixelGeomDetUnit*>(det0); + const PixelTopology* topol = dynamic_cast<const PixelTopology*>(&(theGeomDet->specificTopology())); - // loop over stubs - for (auto stubIter = stubs.begin(); stubIter != stubs.end(); ++stubIter) { - edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > tempStubPtr = - edmNew::makeRefTo(TTStubHandle, stubIter); + // loop over stubs + for (auto stubIter = stubs.begin(); stubIter != stubs.end(); ++stubIter) { + edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > tempStubPtr = + edmNew::makeRefTo(TTStubHandle, stubIter); - int isBarrel = 0; - int layer = -999999; - if (detid.subdetId() == StripSubdetector::TOB) { - isBarrel = 1; - layer = static_cast<int>(tTopo->layer(detid)); - } else if (detid.subdetId() == StripSubdetector::TID) { - isBarrel = 0; - layer = static_cast<int>(tTopo->layer(detid)); - } else { - edm::LogVerbatim("Tracklet") << "WARNING -- neither TOB or TID stub, shouldn't happen..."; - layer = -1; - } + int isBarrel = 0; + int layer = -999999; + if (detid.subdetId() == StripSubdetector::TOB) { + isBarrel = 1; + layer = static_cast<int>(tTopo->layer(detid)); + } else if (detid.subdetId() == StripSubdetector::TID) { + isBarrel = 0; + layer = static_cast<int>(tTopo->layer(detid)); + } else { + edm::LogVerbatim("Tracklet") << "WARNING -- neither TOB or TID stub, shouldn't happen..."; + layer = -1; + } - int isPSmodule = 0; - if (topol->nrows() == 960) + int isPSmodule = 0; + if (topol->nrows() == 960) isPSmodule = 1; - MeasurementPoint coords = tempStubPtr->clusterRef(0)->findAverageLocalCoordinatesCentered(); - LocalPoint clustlp = topol->localPosition(coords); - GlobalPoint posStub = theGeomDet->surface().toGlobal(clustlp); - - double tmp_stub_x = posStub.x(); - double tmp_stub_y = posStub.y(); - double tmp_stub_z = posStub.z(); - - float trigDisplace = tempStubPtr->rawBend(); - float trigOffset = tempStubPtr->bendOffset(); - float trigPos = tempStubPtr->innerClusterPosition(); - float trigBend = tempStubPtr->bendFE(); - - m_allstub_x->push_back(tmp_stub_x); - m_allstub_y->push_back(tmp_stub_y); - m_allstub_z->push_back(tmp_stub_z); - m_allstub_isBarrel->push_back(isBarrel); - m_allstub_layer->push_back(layer); - m_allstub_isPSmodule->push_back(isPSmodule); - m_allstub_trigDisplace->push_back(trigDisplace); - m_allstub_trigOffset->push_back(trigOffset); - m_allstub_trigPos->push_back(trigPos); - m_allstub_trigBend->push_back(trigBend); - - // matched to tracking particle? - edm::Ptr<TrackingParticle> my_tp = MCTruthTTStubHandle->findTrackingParticlePtr(tempStubPtr); - - int myTP_pdgid = -999; - float myTP_pt = -999; - float myTP_eta = -999; - float myTP_phi = -999; - - if (my_tp.isNull() == false) { - int tmp_eventid = my_tp->eventId().event(); - if (tmp_eventid > 0) continue; // this means stub from pileup track - myTP_pdgid = my_tp->pdgId(); - myTP_pt = my_tp->p4().pt(); - myTP_eta = my_tp->p4().eta(); - myTP_phi = my_tp->p4().phi(); - } - int tmp_stub_genuine = 0; - if (MCTruthTTStubHandle->isGenuine(tempStubPtr)) tmp_stub_genuine = 1; - - m_allstub_matchTP_pdgid->push_back(myTP_pdgid); - m_allstub_matchTP_pt->push_back(myTP_pt); - m_allstub_matchTP_eta->push_back(myTP_eta); - m_allstub_matchTP_phi->push_back(myTP_phi); - m_allstub_genuine->push_back(tmp_stub_genuine); + MeasurementPoint coords = tempStubPtr->clusterRef(0)->findAverageLocalCoordinatesCentered(); + LocalPoint clustlp = topol->localPosition(coords); + GlobalPoint posStub = theGeomDet->surface().toGlobal(clustlp); + + double tmp_stub_x = posStub.x(); + double tmp_stub_y = posStub.y(); + double tmp_stub_z = posStub.z(); + + float trigDisplace = tempStubPtr->rawBend(); + float trigOffset = tempStubPtr->bendOffset(); + float trigPos = tempStubPtr->innerClusterPosition(); + float trigBend = tempStubPtr->bendFE(); + + m_allstub_x->push_back(tmp_stub_x); + m_allstub_y->push_back(tmp_stub_y); + m_allstub_z->push_back(tmp_stub_z); + m_allstub_isBarrel->push_back(isBarrel); + m_allstub_layer->push_back(layer); + m_allstub_isPSmodule->push_back(isPSmodule); + m_allstub_trigDisplace->push_back(trigDisplace); + m_allstub_trigOffset->push_back(trigOffset); + m_allstub_trigPos->push_back(trigPos); + m_allstub_trigBend->push_back(trigBend); + + // matched to tracking particle? + edm::Ptr<TrackingParticle> my_tp = MCTruthTTStubHandle->findTrackingParticlePtr(tempStubPtr); + + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + + if (my_tp.isNull() == false) { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) + continue; // this means stub from pileup track + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); } + int tmp_stub_genuine = 0; + if (MCTruthTTStubHandle->isGenuine(tempStubPtr)) + tmp_stub_genuine = 1; + + m_allstub_matchTP_pdgid->push_back(myTP_pdgid); + m_allstub_matchTP_pt->push_back(myTP_pt); + m_allstub_matchTP_eta->push_back(myTP_eta); + m_allstub_matchTP_phi->push_back(myTP_phi); + m_allstub_genuine->push_back(tmp_stub_genuine); } } + } + // ---------------------------------------------------------------------------------------------- + // loop over (prompt) L1 tracks + // ---------------------------------------------------------------------------------------------- + if (SaveAllTracks && (Displaced == "Prompt" || Displaced == "Both")) { + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; + edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + } - // ---------------------------------------------------------------------------------------------- - // loop over (prompt) L1 tracks - // ---------------------------------------------------------------------------------------------- - if (SaveAllTracks && (Displaced=="Prompt" || Displaced=="Both")) { - if (DebugMode) { - edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; - edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + int this_l1track = 0; + for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { + edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > l1track_ptr(TTTrackHandle, this_l1track); + this_l1track++; + + float tmp_trk_pt = iterL1Track->momentum().perp(); + float tmp_trk_eta = iterL1Track->momentum().eta(); + float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_z0 = iterL1Track->z0(); //cm + int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 + + float tmp_trk_d0 = -999; + if (tmp_trk_nFitPars == 5) { + float tmp_trk_x0 = iterL1Track->POCA().x(); + float tmp_trk_y0 = iterL1Track->POCA().y(); + tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); + // tmp_trk_d0 = iterL1Track->d0(); } - int this_l1track = 0; - for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { - edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > l1track_ptr(TTTrackHandle, this_l1track); - this_l1track++; - - float tmp_trk_pt = iterL1Track->momentum().perp(); - float tmp_trk_eta = iterL1Track->momentum().eta(); - float tmp_trk_phi = iterL1Track->momentum().phi(); - float tmp_trk_z0 = iterL1Track->z0(); //cm - int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 - - float tmp_trk_d0 = -999; - if (tmp_trk_nFitPars == 5) { - float tmp_trk_x0 = iterL1Track->POCA().x(); - float tmp_trk_y0 = iterL1Track->POCA().y(); - tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); - // tmp_trk_d0 = iterL1Track->d0(); - } + float tmp_trk_chi2 = iterL1Track->chi2(); + float tmp_trk_chi2dof = iterL1Track->chi2Red(); + float tmp_trk_chi2rphi = iterL1Track->chi2XY(); + float tmp_trk_chi2rz = iterL1Track->chi2Z(); + float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); + + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = iterL1Track->getStubRefs(); + int tmp_trk_nstub = (int)stubRefs.size(); + int tmp_trk_seed = 0; + tmp_trk_seed = (int)iterL1Track->trackSeedType(); + int tmp_trk_hitpattern = 0; + tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); + unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); - float tmp_trk_chi2 = iterL1Track->chi2(); - float tmp_trk_chi2dof = iterL1Track->chi2Red(); - float tmp_trk_chi2rphi = iterL1Track->chi2XY(); - float tmp_trk_chi2rz = iterL1Track->chi2Z(); - float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); + // ---------------------------------------------------------------------------------------------- + // loop over stubs on tracks + int tmp_trk_dhits = 0; + int tmp_trk_lhits = 0; + if (true) { + // loop over stubs + for (int is = 0; is < tmp_trk_nstub; is++) { + //detID of stub + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); + const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); + Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); - std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > - stubRefs = iterL1Track->getStubRefs(); - int tmp_trk_nstub = (int)stubRefs.size(); - int tmp_trk_seed = 0; - tmp_trk_seed = (int)iterL1Track->trackSeedType(); - int tmp_trk_hitpattern = 0; - tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); - unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); + double x = posStub.x(); + double y = posStub.y(); + double z = posStub.z(); - // ---------------------------------------------------------------------------------------------- - // loop over stubs on tracks - int tmp_trk_dhits = 0; - int tmp_trk_lhits = 0; - if (true) { - // loop over stubs - for (int is = 0; is < tmp_trk_nstub; is++) { - //detID of stub - DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); - MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); - const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); - Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); - - double x = posStub.x(); - double y = posStub.y(); - double z = posStub.z(); - - int layer = -999999; - if (detIdStub.subdetId() == StripSubdetector::TOB) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - if (DebugMode) + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) edm::LogVerbatim("Tracklet") - << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; - tmp_trk_lhits += pow(10, layer - 1); - } else if (detIdStub.subdetId() == StripSubdetector::TID) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - if (DebugMode) + << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) edm::LogVerbatim("Tracklet") - << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; - tmp_trk_dhits += pow(10, layer - 1); - } - } //end loop over stubs - } - // ---------------------------------------------------------------------------------------------- + << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_dhits += pow(10, layer - 1); + } + } //end loop over stubs + } + // ---------------------------------------------------------------------------------------------- - int tmp_trk_genuine = 0; - int tmp_trk_loose = 0; - int tmp_trk_unknown = 0; - int tmp_trk_combinatoric = 0; - if (MCTruthTTTrackHandle->isLooselyGenuine(l1track_ptr)) + int tmp_trk_genuine = 0; + int tmp_trk_loose = 0; + int tmp_trk_unknown = 0; + int tmp_trk_combinatoric = 0; + if (MCTruthTTTrackHandle->isLooselyGenuine(l1track_ptr)) tmp_trk_loose = 1; - if (MCTruthTTTrackHandle->isGenuine(l1track_ptr)) + if (MCTruthTTTrackHandle->isGenuine(l1track_ptr)) tmp_trk_genuine = 1; - if (MCTruthTTTrackHandle->isUnknown(l1track_ptr)) + if (MCTruthTTTrackHandle->isUnknown(l1track_ptr)) tmp_trk_unknown = 1; - if (MCTruthTTTrackHandle->isCombinatoric(l1track_ptr)) + if (MCTruthTTTrackHandle->isCombinatoric(l1track_ptr)) tmp_trk_combinatoric = 1; - if (DebugMode) { - edm::LogVerbatim("Tracklet") << "L1 track," - << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi - << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 - << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz - << " nstub: " << tmp_trk_nstub; - if (tmp_trk_genuine) + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "L1 track," + << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi + << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 + << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz + << " nstub: " << tmp_trk_nstub; + if (tmp_trk_genuine) edm::LogVerbatim("Tracklet") << " (is genuine)"; - if (tmp_trk_unknown) + if (tmp_trk_unknown) edm::LogVerbatim("Tracklet") << " (is unknown)"; - if (tmp_trk_combinatoric) + if (tmp_trk_combinatoric) edm::LogVerbatim("Tracklet") << " (is combinatoric)"; - } + } - m_trk_pt->push_back(tmp_trk_pt); - m_trk_eta->push_back(tmp_trk_eta); - m_trk_phi->push_back(tmp_trk_phi); - m_trk_z0->push_back(tmp_trk_z0); - if (tmp_trk_nFitPars == 5) + m_trk_pt->push_back(tmp_trk_pt); + m_trk_eta->push_back(tmp_trk_eta); + m_trk_phi->push_back(tmp_trk_phi); + m_trk_z0->push_back(tmp_trk_z0); + if (tmp_trk_nFitPars == 5) m_trk_d0->push_back(tmp_trk_d0); - else + else m_trk_d0->push_back(999.); - m_trk_chi2->push_back(tmp_trk_chi2); - m_trk_chi2dof->push_back(tmp_trk_chi2dof); - m_trk_chi2rphi->push_back(tmp_trk_chi2rphi); - m_trk_chi2rz->push_back(tmp_trk_chi2rz); - m_trk_bendchi2->push_back(tmp_trk_bendchi2); - m_trk_nstub->push_back(tmp_trk_nstub); - m_trk_dhits->push_back(tmp_trk_dhits); - m_trk_lhits->push_back(tmp_trk_lhits); - m_trk_seed->push_back(tmp_trk_seed); - m_trk_hitpattern->push_back(tmp_trk_hitpattern); - m_trk_phiSector->push_back(tmp_trk_phiSector); - m_trk_genuine->push_back(tmp_trk_genuine); - m_trk_loose->push_back(tmp_trk_loose); - m_trk_unknown->push_back(tmp_trk_unknown); - m_trk_combinatoric->push_back(tmp_trk_combinatoric); + m_trk_chi2->push_back(tmp_trk_chi2); + m_trk_chi2dof->push_back(tmp_trk_chi2dof); + m_trk_chi2rphi->push_back(tmp_trk_chi2rphi); + m_trk_chi2rz->push_back(tmp_trk_chi2rz); + m_trk_bendchi2->push_back(tmp_trk_bendchi2); + m_trk_nstub->push_back(tmp_trk_nstub); + m_trk_dhits->push_back(tmp_trk_dhits); + m_trk_lhits->push_back(tmp_trk_lhits); + m_trk_seed->push_back(tmp_trk_seed); + m_trk_hitpattern->push_back(tmp_trk_hitpattern); + m_trk_phiSector->push_back(tmp_trk_phiSector); + m_trk_genuine->push_back(tmp_trk_genuine); + m_trk_loose->push_back(tmp_trk_loose); + m_trk_unknown->push_back(tmp_trk_unknown); + m_trk_combinatoric->push_back(tmp_trk_combinatoric); - // ---------------------------------------------------------------------------------------------- - // for studying the fake rate - // ---------------------------------------------------------------------------------------------- - edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(l1track_ptr); + // ---------------------------------------------------------------------------------------------- + // for studying the fake rate + // ---------------------------------------------------------------------------------------------- + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(l1track_ptr); - int myFake = 0; - int myTP_pdgid = -999; - float myTP_pt = -999; - float myTP_eta = -999; - float myTP_phi = -999; - float myTP_z0 = -999; - float myTP_dxy = -999; + int myFake = 0; + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + float myTP_z0 = -999; + float myTP_dxy = -999; - if (my_tp.isNull()) + if (my_tp.isNull()) myFake = 0; - else { - int tmp_eventid = my_tp->eventId().event(); - if (tmp_eventid > 0) myFake = 2; - else myFake = 1; + else { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) + myFake = 2; + else + myFake = 1; - myTP_pdgid = my_tp->pdgId(); - myTP_pt = my_tp->p4().pt(); - myTP_eta = my_tp->p4().eta(); - myTP_phi = my_tp->p4().phi(); - myTP_z0 = my_tp->vertex().z(); + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + myTP_z0 = my_tp->vertex().z(); - float myTP_x0 = my_tp->vertex().x(); - float myTP_y0 = my_tp->vertex().y(); - myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); + float myTP_x0 = my_tp->vertex().x(); + float myTP_y0 = my_tp->vertex().y(); + myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); - if (DebugMode) { - edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() - << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() - << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() - << " dxy = " << myTP_dxy; - } + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() + << " dxy = " << myTP_dxy; } + } - m_trk_fake->push_back(myFake); - m_trk_matchtp_pdgid->push_back(myTP_pdgid); - m_trk_matchtp_pt->push_back(myTP_pt); - m_trk_matchtp_eta->push_back(myTP_eta); - m_trk_matchtp_phi->push_back(myTP_phi); - m_trk_matchtp_z0->push_back(myTP_z0); - m_trk_matchtp_dxy->push_back(myTP_dxy); - } //end track loop - } //end if SaveAllTracks + m_trk_fake->push_back(myFake); + m_trk_matchtp_pdgid->push_back(myTP_pdgid); + m_trk_matchtp_pt->push_back(myTP_pt); + m_trk_matchtp_eta->push_back(myTP_eta); + m_trk_matchtp_phi->push_back(myTP_phi); + m_trk_matchtp_z0->push_back(myTP_z0); + m_trk_matchtp_dxy->push_back(myTP_dxy); + } //end track loop + } //end if SaveAllTracks + + // ---------------------------------------------------------------------------------------------- + // loop over (extended) L1 tracks + // ---------------------------------------------------------------------------------------------- + if (SaveAllTracks && (Displaced == "Displaced" || Displaced == "Both")) { + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; + edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + } - // ---------------------------------------------------------------------------------------------- - // loop over (extended) L1 tracks - // ---------------------------------------------------------------------------------------------- - if (SaveAllTracks && (Displaced=="Displaced" || Displaced=="Both")) { - if (DebugMode) { - edm::LogVerbatim("Tracklet") << "\n Loop over L1 tracks!"; - edm::LogVerbatim("Tracklet") << "\n Looking at " << Displaced << " tracks!"; + int this_l1track = 0; + for (iterL1Track = TTTrackExtendedHandle->begin(); iterL1Track != TTTrackExtendedHandle->end(); iterL1Track++) { + edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > l1track_ptr(TTTrackExtendedHandle, this_l1track); + this_l1track++; + + float tmp_trk_pt = iterL1Track->momentum().perp(); + float tmp_trk_eta = iterL1Track->momentum().eta(); + float tmp_trk_phi = iterL1Track->momentum().phi(); + float tmp_trk_z0 = iterL1Track->z0(); //cm + int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 + + float tmp_trk_d0 = -999; + if (tmp_trk_nFitPars == 5) { + float tmp_trk_x0 = iterL1Track->POCA().x(); + float tmp_trk_y0 = iterL1Track->POCA().y(); + tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); + // tmp_trk_d0 = iterL1Track->d0(); } - int this_l1track = 0; - for (iterL1Track = TTTrackExtendedHandle->begin(); iterL1Track != TTTrackExtendedHandle->end(); iterL1Track++) { - edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > l1track_ptr(TTTrackExtendedHandle, this_l1track); - this_l1track++; - - float tmp_trk_pt = iterL1Track->momentum().perp(); - float tmp_trk_eta = iterL1Track->momentum().eta(); - float tmp_trk_phi = iterL1Track->momentum().phi(); - float tmp_trk_z0 = iterL1Track->z0(); //cm - int tmp_trk_nFitPars = iterL1Track->nFitPars(); //4 or 5 - - float tmp_trk_d0 = -999; - if (tmp_trk_nFitPars == 5) { - float tmp_trk_x0 = iterL1Track->POCA().x(); - float tmp_trk_y0 = iterL1Track->POCA().y(); - tmp_trk_d0 = -tmp_trk_x0 * sin(tmp_trk_phi) + tmp_trk_y0 * cos(tmp_trk_phi); - // tmp_trk_d0 = iterL1Track->d0(); - } + float tmp_trk_chi2 = iterL1Track->chi2(); + float tmp_trk_chi2dof = iterL1Track->chi2Red(); + float tmp_trk_chi2rphi = iterL1Track->chi2XY(); + float tmp_trk_chi2rz = iterL1Track->chi2Z(); + float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); - float tmp_trk_chi2 = iterL1Track->chi2(); - float tmp_trk_chi2dof = iterL1Track->chi2Red(); - float tmp_trk_chi2rphi = iterL1Track->chi2XY(); - float tmp_trk_chi2rz = iterL1Track->chi2Z(); - float tmp_trk_bendchi2 = iterL1Track->stubPtConsistency(); + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = iterL1Track->getStubRefs(); + int tmp_trk_nstub = (int)stubRefs.size(); + int tmp_trk_seed = 0; + tmp_trk_seed = (int)iterL1Track->trackSeedType(); + int tmp_trk_hitpattern = 0; + tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); + unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); - std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > - stubRefs = iterL1Track->getStubRefs(); - int tmp_trk_nstub = (int)stubRefs.size(); - int tmp_trk_seed = 0; - tmp_trk_seed = (int)iterL1Track->trackSeedType(); - int tmp_trk_hitpattern = 0; - tmp_trk_hitpattern = (int)iterL1Track->hitPattern(); - unsigned int tmp_trk_phiSector = iterL1Track->phiSector(); + // ---------------------------------------------------------------------------------------------- + // loop over stubs on tracks + int tmp_trk_dhits = 0; + int tmp_trk_lhits = 0; + if (true) { + // loop over stubs + for (int is = 0; is < tmp_trk_nstub; is++) { + //detID of stub + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); + const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); + Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); - // ---------------------------------------------------------------------------------------------- - // loop over stubs on tracks - int tmp_trk_dhits = 0; - int tmp_trk_lhits = 0; - if (true) { - // loop over stubs - for (int is = 0; is < tmp_trk_nstub; is++) { - //detID of stub - DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); - MeasurementPoint coords = stubRefs.at(is)->clusterRef(0)->findAverageLocalCoordinatesCentered(); - const GeomDet* theGeomDet = theTrackerGeom->idToDet(detIdStub); - Global3DPoint posStub = theGeomDet->surface().toGlobal(theGeomDet->topology().localPosition(coords)); - - double x = posStub.x(); - double y = posStub.y(); - double z = posStub.z(); - - int layer = -999999; - if (detIdStub.subdetId() == StripSubdetector::TOB) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - if (DebugMode) + double x = posStub.x(); + double y = posStub.y(); + double z = posStub.z(); + + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) edm::LogVerbatim("Tracklet") - << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; - tmp_trk_lhits += pow(10, layer - 1); - } else if (detIdStub.subdetId() == StripSubdetector::TID) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - if (DebugMode) + << " stub in layer " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + if (DebugMode) edm::LogVerbatim("Tracklet") - << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; - tmp_trk_dhits += pow(10, layer - 1); - } - } //end loop over stubs - } - // ---------------------------------------------------------------------------------------------- + << " stub in disk " << layer << " at position x y z = " << x << " " << y << " " << z; + tmp_trk_dhits += pow(10, layer - 1); + } + } //end loop over stubs + } + // ---------------------------------------------------------------------------------------------- - int tmp_trk_genuine = 0; - int tmp_trk_loose = 0; - int tmp_trk_unknown = 0; - int tmp_trk_combinatoric = 0; - if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(l1track_ptr)) + int tmp_trk_genuine = 0; + int tmp_trk_loose = 0; + int tmp_trk_unknown = 0; + int tmp_trk_combinatoric = 0; + if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(l1track_ptr)) tmp_trk_loose = 1; - if (MCTruthTTTrackExtendedHandle->isGenuine(l1track_ptr)) + if (MCTruthTTTrackExtendedHandle->isGenuine(l1track_ptr)) tmp_trk_genuine = 1; - if (MCTruthTTTrackExtendedHandle->isUnknown(l1track_ptr)) + if (MCTruthTTTrackExtendedHandle->isUnknown(l1track_ptr)) tmp_trk_unknown = 1; - if (MCTruthTTTrackExtendedHandle->isCombinatoric(l1track_ptr)) + if (MCTruthTTTrackExtendedHandle->isCombinatoric(l1track_ptr)) tmp_trk_combinatoric = 1; - if (DebugMode) { - edm::LogVerbatim("Tracklet") << "L1 track," - << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi - << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 - << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz - << " nstub: " << tmp_trk_nstub; - if (tmp_trk_genuine) + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "L1 track," + << " pt: " << tmp_trk_pt << " eta: " << tmp_trk_eta << " phi: " << tmp_trk_phi + << " z0: " << tmp_trk_z0 << " chi2: " << tmp_trk_chi2 + << " chi2rphi: " << tmp_trk_chi2rphi << " chi2rz: " << tmp_trk_chi2rz + << " nstub: " << tmp_trk_nstub; + if (tmp_trk_genuine) edm::LogVerbatim("Tracklet") << " (is genuine)"; - if (tmp_trk_unknown) + if (tmp_trk_unknown) edm::LogVerbatim("Tracklet") << " (is unknown)"; - if (tmp_trk_combinatoric) + if (tmp_trk_combinatoric) edm::LogVerbatim("Tracklet") << " (is combinatoric)"; - } + } - m_trkExt_pt->push_back(tmp_trk_pt); - m_trkExt_eta->push_back(tmp_trk_eta); - m_trkExt_phi->push_back(tmp_trk_phi); - m_trkExt_z0->push_back(tmp_trk_z0); - if (tmp_trk_nFitPars == 5) + m_trkExt_pt->push_back(tmp_trk_pt); + m_trkExt_eta->push_back(tmp_trk_eta); + m_trkExt_phi->push_back(tmp_trk_phi); + m_trkExt_z0->push_back(tmp_trk_z0); + if (tmp_trk_nFitPars == 5) m_trkExt_d0->push_back(tmp_trk_d0); - else + else m_trkExt_d0->push_back(999.); - m_trkExt_chi2->push_back(tmp_trk_chi2); - m_trkExt_chi2dof->push_back(tmp_trk_chi2dof); - m_trkExt_chi2rphi->push_back(tmp_trk_chi2rphi); - m_trkExt_chi2rz->push_back(tmp_trk_chi2rz); - m_trkExt_bendchi2->push_back(tmp_trk_bendchi2); - m_trkExt_nstub->push_back(tmp_trk_nstub); - m_trkExt_dhits->push_back(tmp_trk_dhits); - m_trkExt_lhits->push_back(tmp_trk_lhits); - m_trkExt_seed->push_back(tmp_trk_seed); - m_trkExt_hitpattern->push_back(tmp_trk_hitpattern); - m_trkExt_phiSector->push_back(tmp_trk_phiSector); - m_trkExt_genuine->push_back(tmp_trk_genuine); - m_trkExt_loose->push_back(tmp_trk_loose); - m_trkExt_unknown->push_back(tmp_trk_unknown); - m_trkExt_combinatoric->push_back(tmp_trk_combinatoric); + m_trkExt_chi2->push_back(tmp_trk_chi2); + m_trkExt_chi2dof->push_back(tmp_trk_chi2dof); + m_trkExt_chi2rphi->push_back(tmp_trk_chi2rphi); + m_trkExt_chi2rz->push_back(tmp_trk_chi2rz); + m_trkExt_bendchi2->push_back(tmp_trk_bendchi2); + m_trkExt_nstub->push_back(tmp_trk_nstub); + m_trkExt_dhits->push_back(tmp_trk_dhits); + m_trkExt_lhits->push_back(tmp_trk_lhits); + m_trkExt_seed->push_back(tmp_trk_seed); + m_trkExt_hitpattern->push_back(tmp_trk_hitpattern); + m_trkExt_phiSector->push_back(tmp_trk_phiSector); + m_trkExt_genuine->push_back(tmp_trk_genuine); + m_trkExt_loose->push_back(tmp_trk_loose); + m_trkExt_unknown->push_back(tmp_trk_unknown); + m_trkExt_combinatoric->push_back(tmp_trk_combinatoric); - // ---------------------------------------------------------------------------------------------- - // for studying the fake rate - // ---------------------------------------------------------------------------------------------- - edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(l1track_ptr); + // ---------------------------------------------------------------------------------------------- + // for studying the fake rate + // ---------------------------------------------------------------------------------------------- + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(l1track_ptr); - int myFake = 0; - int myTP_pdgid = -999; - float myTP_pt = -999; - float myTP_eta = -999; - float myTP_phi = -999; - float myTP_z0 = -999; - float myTP_dxy = -999; + int myFake = 0; + int myTP_pdgid = -999; + float myTP_pt = -999; + float myTP_eta = -999; + float myTP_phi = -999; + float myTP_z0 = -999; + float myTP_dxy = -999; - if (my_tp.isNull()) + if (my_tp.isNull()) myFake = 0; - else { - int tmp_eventid = my_tp->eventId().event(); - if (tmp_eventid > 0) myFake = 2; - else myFake = 1; + else { + int tmp_eventid = my_tp->eventId().event(); + if (tmp_eventid > 0) + myFake = 2; + else + myFake = 1; - myTP_pdgid = my_tp->pdgId(); - myTP_pt = my_tp->p4().pt(); - myTP_eta = my_tp->p4().eta(); - myTP_phi = my_tp->p4().phi(); - myTP_z0 = my_tp->vertex().z(); + myTP_pdgid = my_tp->pdgId(); + myTP_pt = my_tp->p4().pt(); + myTP_eta = my_tp->p4().eta(); + myTP_phi = my_tp->p4().phi(); + myTP_z0 = my_tp->vertex().z(); - float myTP_x0 = my_tp->vertex().x(); - float myTP_y0 = my_tp->vertex().y(); - myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); + float myTP_x0 = my_tp->vertex().x(); + float myTP_y0 = my_tp->vertex().y(); + myTP_dxy = sqrt(myTP_x0 * myTP_x0 + myTP_y0 * myTP_y0); - if (DebugMode) { - edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() - << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() - << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() - << " dxy = " << myTP_dxy; - } + if (DebugMode) { + edm::LogVerbatim("Tracklet") << "TP matched to track has pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() + << " z0 = " << my_tp->vertex().z() << " pdgid = " << my_tp->pdgId() + << " dxy = " << myTP_dxy; } + } - m_trkExt_fake->push_back(myFake); - m_trkExt_matchtp_pdgid->push_back(myTP_pdgid); - m_trkExt_matchtp_pt->push_back(myTP_pt); - m_trkExt_matchtp_eta->push_back(myTP_eta); - m_trkExt_matchtp_phi->push_back(myTP_phi); - m_trkExt_matchtp_z0->push_back(myTP_z0); - m_trkExt_matchtp_dxy->push_back(myTP_dxy); - } //end track loop - } //end if SaveAllTracks (displaced) - - - // ---------------------------------------------------------------------------------------------- - // loop over tracking particles - // ---------------------------------------------------------------------------------------------- - if (DebugMode) + m_trkExt_fake->push_back(myFake); + m_trkExt_matchtp_pdgid->push_back(myTP_pdgid); + m_trkExt_matchtp_pt->push_back(myTP_pt); + m_trkExt_matchtp_eta->push_back(myTP_eta); + m_trkExt_matchtp_phi->push_back(myTP_phi); + m_trkExt_matchtp_z0->push_back(myTP_z0); + m_trkExt_matchtp_dxy->push_back(myTP_dxy); + } //end track loop + } //end if SaveAllTracks (displaced) + + // ---------------------------------------------------------------------------------------------- + // loop over tracking particles + // ---------------------------------------------------------------------------------------------- + if (DebugMode) edm::LogVerbatim("Tracklet") << "\n Loop over tracking particles!"; - int this_tp = 0; - std::vector<TrackingParticle>::const_iterator iterTP; - for (iterTP = TrackingParticleHandle->begin(); iterTP != TrackingParticleHandle->end(); ++iterTP) { - edm::Ptr<TrackingParticle> tp_ptr(TrackingParticleHandle, this_tp); - this_tp++; + int this_tp = 0; + std::vector<TrackingParticle>::const_iterator iterTP; + for (iterTP = TrackingParticleHandle->begin(); iterTP != TrackingParticleHandle->end(); ++iterTP) { + edm::Ptr<TrackingParticle> tp_ptr(TrackingParticleHandle, this_tp); + this_tp++; - int tmp_eventid = iterTP->eventId().event(); - if (MyProcess != 1 && tmp_eventid > 0) + int tmp_eventid = iterTP->eventId().event(); + if (MyProcess != 1 && tmp_eventid > 0) continue; //only care about tracking particles from the primary interaction (except for MyProcess==1, i.e. looking at all TPs) - float tmp_tp_pt = iterTP->pt(); - float tmp_tp_eta = iterTP->eta(); - float tmp_tp_phi = iterTP->phi(); - float tmp_tp_vz = iterTP->vz(); - float tmp_tp_vx = iterTP->vx(); - float tmp_tp_vy = iterTP->vy(); - int tmp_tp_pdgid = iterTP->pdgId(); - float tmp_tp_z0_prod = tmp_tp_vz; - float tmp_tp_d0_prod = tmp_tp_vx * sin(tmp_tp_phi) - tmp_tp_vy * cos(tmp_tp_phi); - - if (MyProcess == 13 && abs(tmp_tp_pdgid) != 13) + float tmp_tp_pt = iterTP->pt(); + float tmp_tp_eta = iterTP->eta(); + float tmp_tp_phi = iterTP->phi(); + float tmp_tp_vz = iterTP->vz(); + float tmp_tp_vx = iterTP->vx(); + float tmp_tp_vy = iterTP->vy(); + int tmp_tp_pdgid = iterTP->pdgId(); + float tmp_tp_z0_prod = tmp_tp_vz; + float tmp_tp_d0_prod = tmp_tp_vx * sin(tmp_tp_phi) - tmp_tp_vy * cos(tmp_tp_phi); + + if (MyProcess == 13 && abs(tmp_tp_pdgid) != 13) continue; - if (MyProcess == 11 && abs(tmp_tp_pdgid) != 11) + if (MyProcess == 11 && abs(tmp_tp_pdgid) != 11) continue; - if ((MyProcess == 6 || MyProcess == 15 || MyProcess == 211) && abs(tmp_tp_pdgid) != 211) + if ((MyProcess == 6 || MyProcess == 15 || MyProcess == 211) && abs(tmp_tp_pdgid) != 211) continue; - if (tmp_tp_pt < TP_minPt) + if (tmp_tp_pt < TP_minPt) continue; - if (std::abs(tmp_tp_eta) > TP_maxEta) + if (std::abs(tmp_tp_eta) > TP_maxEta) continue; - // ---------------------------------------------------------------------------------------------- - // get d0/z0 propagated back to the IP - - float tmp_tp_t = tan(2.0 * atan(1.0) - 2.0 * atan(exp(-tmp_tp_eta))); - float delx = -tmp_tp_vx; - float dely = -tmp_tp_vy; - - float A = 0.01 * 0.5696; - float Kmagnitude = A / tmp_tp_pt; - float tmp_tp_charge = tp_ptr->charge(); - float K = Kmagnitude * tmp_tp_charge; - float d = 0; - float tmp_tp_x0p = delx - (d + 1. / (2. * K) * sin(tmp_tp_phi)); - float tmp_tp_y0p = dely + (d + 1. / (2. * K) * cos(tmp_tp_phi)); - float tmp_tp_rp = sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p); - float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K)); - tmp_tp_d0 = tmp_tp_d0 * (-1); //fix d0 sign - static double pi = 4.0 * atan(1.0); - float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p); - if (delphi < -pi) + // ---------------------------------------------------------------------------------------------- + // get d0/z0 propagated back to the IP + + float tmp_tp_t = tan(2.0 * atan(1.0) - 2.0 * atan(exp(-tmp_tp_eta))); + float delx = -tmp_tp_vx; + float dely = -tmp_tp_vy; + + float A = 0.01 * 0.5696; + float Kmagnitude = A / tmp_tp_pt; + float tmp_tp_charge = tp_ptr->charge(); + float K = Kmagnitude * tmp_tp_charge; + float d = 0; + float tmp_tp_x0p = delx - (d + 1. / (2. * K) * sin(tmp_tp_phi)); + float tmp_tp_y0p = dely + (d + 1. / (2. * K) * cos(tmp_tp_phi)); + float tmp_tp_rp = sqrt(tmp_tp_x0p * tmp_tp_x0p + tmp_tp_y0p * tmp_tp_y0p); + float tmp_tp_d0 = tmp_tp_charge * tmp_tp_rp - (1. / (2. * K)); + tmp_tp_d0 = tmp_tp_d0 * (-1); //fix d0 sign + static double pi = 4.0 * atan(1.0); + float delphi = tmp_tp_phi - atan2(-K * tmp_tp_x0p, K * tmp_tp_y0p); + if (delphi < -pi) delphi += 2.0 * pi; - if (delphi > pi) + if (delphi > pi) delphi -= 2.0 * pi; - float tmp_tp_z0 = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K); - // ---------------------------------------------------------------------------------------------- + float tmp_tp_z0 = tmp_tp_vz + tmp_tp_t * delphi / (2.0 * K); + // ---------------------------------------------------------------------------------------------- - if (std::abs(tmp_tp_z0) > TP_maxZ0) + if (std::abs(tmp_tp_z0) > TP_maxZ0) continue; - // for pions in ttbar, only consider TPs coming from near the IP! - float dxy = sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy); - float tmp_tp_dxy = dxy; - if (MyProcess == 6 && (dxy > 1.0)) + // for pions in ttbar, only consider TPs coming from near the IP! + float dxy = sqrt(tmp_tp_vx * tmp_tp_vx + tmp_tp_vy * tmp_tp_vy); + float tmp_tp_dxy = dxy; + if (MyProcess == 6 && (dxy > 1.0)) continue; - if (DebugMode && (Displaced=="Prompt" || Displaced=="Both")) + if (DebugMode && (Displaced == "Prompt" || Displaced == "Both")) edm::LogVerbatim("Tracklet") << "Tracking particle, pt: " << tmp_tp_pt << " eta: " << tmp_tp_eta - << " phi: " << tmp_tp_phi << " z0: " << tmp_tp_z0 << " d0: " << tmp_tp_d0 - << " z_prod: " << tmp_tp_z0_prod << " d_prod: " << tmp_tp_d0_prod - << " pdgid: " << tmp_tp_pdgid << " eventID: " << iterTP->eventId().event() - << " ttclusters " << MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).size() - << " ttstubs " << MCTruthTTStubHandle->findTTStubRefs(tp_ptr).size() << " tttracks " - << MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr).size(); + << " phi: " << tmp_tp_phi << " z0: " << tmp_tp_z0 << " d0: " << tmp_tp_d0 + << " z_prod: " << tmp_tp_z0_prod << " d_prod: " << tmp_tp_d0_prod + << " pdgid: " << tmp_tp_pdgid << " eventID: " << iterTP->eventId().event() + << " ttclusters " << MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).size() + << " ttstubs " << MCTruthTTStubHandle->findTTStubRefs(tp_ptr).size() << " tttracks " + << MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr).size(); - // ---------------------------------------------------------------------------------------------- - // only consider TPs associated with >= 1 cluster, or >= X stubs, or have stubs in >= X layers (configurable options) - if (MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty()) { - if (DebugMode) + // ---------------------------------------------------------------------------------------------- + // only consider TPs associated with >= 1 cluster, or >= X stubs, or have stubs in >= X layers (configurable options) + if (MCTruthTTClusterHandle->findTTClusterRefs(tp_ptr).empty()) { + if (DebugMode) edm::LogVerbatim("Tracklet") << "No matching TTClusters for TP, continuing..."; - continue; - } - + continue; + } - std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > - theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr); - int nStubTP = (int)theStubRefs.size(); + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + theStubRefs = MCTruthTTStubHandle->findTTStubRefs(tp_ptr); + int nStubTP = (int)theStubRefs.size(); - // how many layers/disks have stubs? - int hasStubInLayer[11] = {0}; - for (auto& theStubRef : theStubRefs) { - DetId detid(theStubRef->getDetId()); + // how many layers/disks have stubs? + int hasStubInLayer[11] = {0}; + for (auto& theStubRef : theStubRefs) { + DetId detid(theStubRef->getDetId()); - int layer = -1; - if (detid.subdetId() == StripSubdetector::TOB) { - layer = static_cast<int>(tTopo->layer(detid)) - 1; //fill in array as entries 0-5 - } else if (detid.subdetId() == StripSubdetector::TID) { - layer = static_cast<int>(tTopo->layer(detid)) + 5; //fill in array as entries 6-10 - } + int layer = -1; + if (detid.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detid)) - 1; //fill in array as entries 0-5 + } else if (detid.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detid)) + 5; //fill in array as entries 6-10 + } - //treat genuine stubs separately (==2 is genuine, ==1 is not) - if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRef).isNull() && hasStubInLayer[layer] < 2) + //treat genuine stubs separately (==2 is genuine, ==1 is not) + if (MCTruthTTStubHandle->findTrackingParticlePtr(theStubRef).isNull() && hasStubInLayer[layer] < 2) hasStubInLayer[layer] = 1; - else + else hasStubInLayer[layer] = 2; - } + } - int nStubLayerTP = 0; - int nStubLayerTP_g = 0; - for (int isum : hasStubInLayer) { - if (isum >= 1) + int nStubLayerTP = 0; + int nStubLayerTP_g = 0; + for (int isum : hasStubInLayer) { + if (isum >= 1) nStubLayerTP += 1; - if (isum == 2) + if (isum == 2) nStubLayerTP_g += 1; - } + } - if (DebugMode) + if (DebugMode) edm::LogVerbatim("Tracklet") << "TP is associated with " << nStubTP << " stubs, and has stubs in " << nStubLayerTP - << " different layers/disks, and has GENUINE stubs in " << nStubLayerTP_g - << " layers "; + << " different layers/disks, and has GENUINE stubs in " << nStubLayerTP_g + << " layers "; - if (TP_minNStub > 0) { - if (DebugMode) + if (TP_minNStub > 0) { + if (DebugMode) edm::LogVerbatim("Tracklet") << "Only consider TPs with >= " << TP_minNStub << " stubs"; - if (nStubTP < TP_minNStub) { - if (DebugMode) + if (nStubTP < TP_minNStub) { + if (DebugMode) edm::LogVerbatim("Tracklet") << "TP fails minimum nbr stubs requirement! Continuing..."; - continue; - } + continue; } - if (TP_minNStubLayer > 0) { - if (DebugMode) + } + if (TP_minNStubLayer > 0) { + if (DebugMode) edm::LogVerbatim("Tracklet") << "Only consider TPs with stubs in >= " << TP_minNStubLayer << " layers/disks"; - if (nStubLayerTP < TP_minNStubLayer) { - if (DebugMode) + if (nStubLayerTP < TP_minNStubLayer) { + if (DebugMode) edm::LogVerbatim("Tracklet") << "TP fails stubs in minimum nbr of layers/disks requirement! Continuing..."; - continue; - } + continue; } + } - m_tp_pt->push_back(tmp_tp_pt); - m_tp_eta->push_back(tmp_tp_eta); - m_tp_phi->push_back(tmp_tp_phi); - m_tp_dxy->push_back(tmp_tp_dxy); - m_tp_z0->push_back(tmp_tp_z0); - m_tp_d0->push_back(tmp_tp_d0); - m_tp_z0_prod->push_back(tmp_tp_z0_prod); - m_tp_d0_prod->push_back(tmp_tp_d0_prod); - m_tp_pdgid->push_back(tmp_tp_pdgid); - m_tp_nstub->push_back(nStubTP); - m_tp_eventid->push_back(tmp_eventid); - m_tp_charge->push_back(tmp_tp_charge); + m_tp_pt->push_back(tmp_tp_pt); + m_tp_eta->push_back(tmp_tp_eta); + m_tp_phi->push_back(tmp_tp_phi); + m_tp_dxy->push_back(tmp_tp_dxy); + m_tp_z0->push_back(tmp_tp_z0); + m_tp_d0->push_back(tmp_tp_d0); + m_tp_z0_prod->push_back(tmp_tp_z0_prod); + m_tp_d0_prod->push_back(tmp_tp_d0_prod); + m_tp_pdgid->push_back(tmp_tp_pdgid); + m_tp_nstub->push_back(nStubTP); + m_tp_eventid->push_back(tmp_eventid); + m_tp_charge->push_back(tmp_tp_charge); - // ---------------------------------------------------------------------------------------------- - // look for L1 tracks (prompt) matched to the tracking particle - if (Displaced=="Prompt" || Displaced=="Both") { - std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks = - MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr); + // ---------------------------------------------------------------------------------------------- + // look for L1 tracks (prompt) matched to the tracking particle + if (Displaced == "Prompt" || Displaced == "Both") { + std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks = + MCTruthTTTrackHandle->findTTTrackPtrs(tp_ptr); - int nMatch = 0; - int i_track = -1; - float i_chi2dof = 99999; + int nMatch = 0; + int i_track = -1; + float i_chi2dof = 99999; - if (!matchedTracks.empty()) { - if (DebugMode && (matchedTracks.size() > 1)) + if (!matchedTracks.empty()) { + if (DebugMode && (matchedTracks.size() > 1)) edm::LogVerbatim("Tracklet") << "TrackingParticle has more than one matched L1 track!"; - // ---------------------------------------------------------------------------------------------- - // loop over matched L1 tracks - // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters - // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack - - for (int it = 0; it < (int)matchedTracks.size(); it++) { - bool tmp_trk_genuine = false; - bool tmp_trk_loosegenuine = false; - if (MCTruthTTTrackHandle->isGenuine(matchedTracks.at(it))) + // ---------------------------------------------------------------------------------------------- + // loop over matched L1 tracks + // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters + // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack + + for (int it = 0; it < (int)matchedTracks.size(); it++) { + bool tmp_trk_genuine = false; + bool tmp_trk_loosegenuine = false; + if (MCTruthTTTrackHandle->isGenuine(matchedTracks.at(it))) tmp_trk_genuine = true; - if (MCTruthTTTrackHandle->isLooselyGenuine(matchedTracks.at(it))) + if (MCTruthTTTrackHandle->isLooselyGenuine(matchedTracks.at(it))) tmp_trk_loosegenuine = true; - if (!tmp_trk_loosegenuine) + if (!tmp_trk_loosegenuine) continue; - if (DebugMode) { - if (MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { - edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; - } - else { - edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); - edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() - << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() - << " z0 = " << my_tp->vertex().z(); - } - edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " << matchedTracks.at(it)->momentum().perp() - << " eta = " << matchedTracks.at(it)->momentum().eta() - << " phi = " << matchedTracks.at(it)->momentum().phi() - << " chi2 = " << matchedTracks.at(it)->chi2() - << " consistency = " << matchedTracks.at(it)->stubPtConsistency() - << " z0 = " << matchedTracks.at(it)->z0() - << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); - if (tmp_trk_genuine) + if (DebugMode) { + if (MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { + edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; + } else { + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); + edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() + << " phi = " << my_tp->momentum().phi() << " z0 = " << my_tp->vertex().z(); + } + edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " + << matchedTracks.at(it)->momentum().perp() + << " eta = " << matchedTracks.at(it)->momentum().eta() + << " phi = " << matchedTracks.at(it)->momentum().phi() + << " chi2 = " << matchedTracks.at(it)->chi2() + << " consistency = " << matchedTracks.at(it)->stubPtConsistency() + << " z0 = " << matchedTracks.at(it)->z0() + << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); + if (tmp_trk_genuine) edm::LogVerbatim("Tracklet") << " (genuine!) "; - if (tmp_trk_loosegenuine) + if (tmp_trk_loosegenuine) edm::LogVerbatim("Tracklet") << " (loose genuine!) "; - } + } - std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > - stubRefs = matchedTracks.at(it)->getStubRefs(); - int tmp_trk_nstub = stubRefs.size(); + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(it)->getStubRefs(); + int tmp_trk_nstub = stubRefs.size(); - if (tmp_trk_nstub < L1Tk_minNStub) + if (tmp_trk_nstub < L1Tk_minNStub) continue; - - float dmatch_pt = 999; - float dmatch_eta = 999; - float dmatch_phi = 999; - int match_id = 999; - - edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); - dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); - dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); - dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); - match_id = my_tp->pdgId(); - float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); - - // ensure that track is uniquely matched to the TP we are looking at! - if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { - nMatch++; - if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { - i_track = it; - i_chi2dof = tmp_trk_chi2dof; - } + float dmatch_pt = 999; + float dmatch_eta = 999; + float dmatch_phi = 999; + int match_id = 999; + + edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackHandle->findTrackingParticlePtr(matchedTracks.at(it)); + dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); + dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); + dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); + match_id = my_tp->pdgId(); + float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); + + // ensure that track is uniquely matched to the TP we are looking at! + if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { + nMatch++; + if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { + i_track = it; + i_chi2dof = tmp_trk_chi2dof; } + } - } // end loop over matched L1 tracks - } // end has at least 1 matched L1 track - // ---------------------------------------------------------------------------------------------- + } // end loop over matched L1 tracks + } // end has at least 1 matched L1 track + // ---------------------------------------------------------------------------------------------- - float tmp_matchtrk_pt = -999; - float tmp_matchtrk_eta = -999; - float tmp_matchtrk_phi = -999; - float tmp_matchtrk_z0 = -999; - float tmp_matchtrk_d0 = -999; - float tmp_matchtrk_chi2 = -999; - float tmp_matchtrk_chi2dof = -999; - float tmp_matchtrk_chi2rphi = -999; - float tmp_matchtrk_chi2rz = -999; - float tmp_matchtrk_bendchi2 = -999; - int tmp_matchtrk_nstub = -999; - int tmp_matchtrk_dhits = -999; - int tmp_matchtrk_lhits = -999; - int tmp_matchtrk_seed = -999; - int tmp_matchtrk_hitpattern = -999; - int tmp_matchtrk_nFitPars = -999; - - if (nMatch > 1 && DebugMode) + float tmp_matchtrk_pt = -999; + float tmp_matchtrk_eta = -999; + float tmp_matchtrk_phi = -999; + float tmp_matchtrk_z0 = -999; + float tmp_matchtrk_d0 = -999; + float tmp_matchtrk_chi2 = -999; + float tmp_matchtrk_chi2dof = -999; + float tmp_matchtrk_chi2rphi = -999; + float tmp_matchtrk_chi2rz = -999; + float tmp_matchtrk_bendchi2 = -999; + int tmp_matchtrk_nstub = -999; + int tmp_matchtrk_dhits = -999; + int tmp_matchtrk_lhits = -999; + int tmp_matchtrk_seed = -999; + int tmp_matchtrk_hitpattern = -999; + int tmp_matchtrk_nFitPars = -999; + + if (nMatch > 1 && DebugMode) edm::LogVerbatim("Tracklet") << "WARNING *** 2 or more matches to genuine L1 tracks ***"; - if (nMatch > 0) { - tmp_matchtrk_pt = matchedTracks.at(i_track)->momentum().perp(); - tmp_matchtrk_eta = matchedTracks.at(i_track)->momentum().eta(); - tmp_matchtrk_phi = matchedTracks.at(i_track)->momentum().phi(); - tmp_matchtrk_z0 = matchedTracks.at(i_track)->z0(); - tmp_matchtrk_nFitPars = matchedTracks.at(i_track)->nFitPars(); - - if (tmp_matchtrk_nFitPars == 5) { - float tmp_matchtrk_x0 = matchedTracks.at(i_track)->POCA().x(); - float tmp_matchtrk_y0 = matchedTracks.at(i_track)->POCA().y(); - tmp_matchtrk_d0 = -tmp_matchtrk_x0 * sin(tmp_matchtrk_phi) + tmp_matchtrk_y0 * cos(tmp_matchtrk_phi); - // tmp_matchtrk_d0 = matchedTracks.at(i_track)->d0(); - } + if (nMatch > 0) { + tmp_matchtrk_pt = matchedTracks.at(i_track)->momentum().perp(); + tmp_matchtrk_eta = matchedTracks.at(i_track)->momentum().eta(); + tmp_matchtrk_phi = matchedTracks.at(i_track)->momentum().phi(); + tmp_matchtrk_z0 = matchedTracks.at(i_track)->z0(); + tmp_matchtrk_nFitPars = matchedTracks.at(i_track)->nFitPars(); + + if (tmp_matchtrk_nFitPars == 5) { + float tmp_matchtrk_x0 = matchedTracks.at(i_track)->POCA().x(); + float tmp_matchtrk_y0 = matchedTracks.at(i_track)->POCA().y(); + tmp_matchtrk_d0 = -tmp_matchtrk_x0 * sin(tmp_matchtrk_phi) + tmp_matchtrk_y0 * cos(tmp_matchtrk_phi); + // tmp_matchtrk_d0 = matchedTracks.at(i_track)->d0(); + } - tmp_matchtrk_chi2 = matchedTracks.at(i_track)->chi2(); - tmp_matchtrk_chi2dof = matchedTracks.at(i_track)->chi2Red(); - tmp_matchtrk_chi2rphi = matchedTracks.at(i_track)->chi2XY(); - tmp_matchtrk_chi2rz = matchedTracks.at(i_track)->chi2Z(); - tmp_matchtrk_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); - tmp_matchtrk_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); - tmp_matchtrk_seed = (int)matchedTracks.at(i_track)->trackSeedType(); - tmp_matchtrk_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); + tmp_matchtrk_chi2 = matchedTracks.at(i_track)->chi2(); + tmp_matchtrk_chi2dof = matchedTracks.at(i_track)->chi2Red(); + tmp_matchtrk_chi2rphi = matchedTracks.at(i_track)->chi2XY(); + tmp_matchtrk_chi2rz = matchedTracks.at(i_track)->chi2Z(); + tmp_matchtrk_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); + tmp_matchtrk_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); + tmp_matchtrk_seed = (int)matchedTracks.at(i_track)->trackSeedType(); + tmp_matchtrk_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); - // ------------------------------------------------------------------------------------------ - tmp_matchtrk_dhits = 0; - tmp_matchtrk_lhits = 0; + // ------------------------------------------------------------------------------------------ + tmp_matchtrk_dhits = 0; + tmp_matchtrk_lhits = 0; - std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > - stubRefs = matchedTracks.at(i_track)->getStubRefs(); - int tmp_nstub = stubRefs.size(); - - for (int is = 0; is < tmp_nstub; is++) { - DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); - int layer = -999999; - if (detIdStub.subdetId() == StripSubdetector::TOB) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - tmp_matchtrk_lhits += pow(10, layer - 1); - } - else if (detIdStub.subdetId() == StripSubdetector::TID) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - tmp_matchtrk_dhits += pow(10, layer - 1); - } + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(i_track)->getStubRefs(); + int tmp_nstub = stubRefs.size(); + + for (int is = 0; is < tmp_nstub; is++) { + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrk_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrk_dhits += pow(10, layer - 1); } } - - m_tp_nmatch->push_back(nMatch); - - - m_matchtrk_pt->push_back(tmp_matchtrk_pt); - m_matchtrk_eta->push_back(tmp_matchtrk_eta); - m_matchtrk_phi->push_back(tmp_matchtrk_phi); - m_matchtrk_z0->push_back(tmp_matchtrk_z0); - m_matchtrk_d0->push_back(tmp_matchtrk_d0); - m_matchtrk_chi2->push_back(tmp_matchtrk_chi2); - m_matchtrk_chi2dof->push_back(tmp_matchtrk_chi2dof); - m_matchtrk_chi2rphi->push_back(tmp_matchtrk_chi2rphi); - m_matchtrk_chi2rz->push_back(tmp_matchtrk_chi2rz); - m_matchtrk_bendchi2->push_back(tmp_matchtrk_bendchi2); - m_matchtrk_nstub->push_back(tmp_matchtrk_nstub); - m_matchtrk_dhits->push_back(tmp_matchtrk_dhits); - m_matchtrk_lhits->push_back(tmp_matchtrk_lhits); - m_matchtrk_seed->push_back(tmp_matchtrk_seed); - m_matchtrk_hitpattern->push_back(tmp_matchtrk_hitpattern); } - // ---------------------------------------------------------------------------------------------- - // look for L1 tracks (extended) matched to the tracking particle - if (Displaced=="Displaced" || Displaced=="Both") { - std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks = - MCTruthTTTrackExtendedHandle->findTTTrackPtrs(tp_ptr); + m_tp_nmatch->push_back(nMatch); + + m_matchtrk_pt->push_back(tmp_matchtrk_pt); + m_matchtrk_eta->push_back(tmp_matchtrk_eta); + m_matchtrk_phi->push_back(tmp_matchtrk_phi); + m_matchtrk_z0->push_back(tmp_matchtrk_z0); + m_matchtrk_d0->push_back(tmp_matchtrk_d0); + m_matchtrk_chi2->push_back(tmp_matchtrk_chi2); + m_matchtrk_chi2dof->push_back(tmp_matchtrk_chi2dof); + m_matchtrk_chi2rphi->push_back(tmp_matchtrk_chi2rphi); + m_matchtrk_chi2rz->push_back(tmp_matchtrk_chi2rz); + m_matchtrk_bendchi2->push_back(tmp_matchtrk_bendchi2); + m_matchtrk_nstub->push_back(tmp_matchtrk_nstub); + m_matchtrk_dhits->push_back(tmp_matchtrk_dhits); + m_matchtrk_lhits->push_back(tmp_matchtrk_lhits); + m_matchtrk_seed->push_back(tmp_matchtrk_seed); + m_matchtrk_hitpattern->push_back(tmp_matchtrk_hitpattern); + } + + // ---------------------------------------------------------------------------------------------- + // look for L1 tracks (extended) matched to the tracking particle + if (Displaced == "Displaced" || Displaced == "Both") { + std::vector<edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_> > > matchedTracks = + MCTruthTTTrackExtendedHandle->findTTTrackPtrs(tp_ptr); - int nMatch = 0; - int i_track = -1; - float i_chi2dof = 99999; + int nMatch = 0; + int i_track = -1; + float i_chi2dof = 99999; - if (!matchedTracks.empty()) { - if (DebugMode && (matchedTracks.size() > 1)) + if (!matchedTracks.empty()) { + if (DebugMode && (matchedTracks.size() > 1)) edm::LogVerbatim("Tracklet") << "TrackingParticle has more than one matched L1 track!"; - // ---------------------------------------------------------------------------------------------- - // loop over matched L1 tracks - // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters - // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack - - for (int it = 0; it < (int)matchedTracks.size(); it++) { - bool tmp_trk_genuine = false; - bool tmp_trk_loosegenuine = false; - if (MCTruthTTTrackExtendedHandle->isGenuine(matchedTracks.at(it))) + // ---------------------------------------------------------------------------------------------- + // loop over matched L1 tracks + // here, "match" means tracks that can be associated to a TrackingParticle with at least one hit of at least one of its clusters + // https://twiki.cern.ch/twiki/bin/viewauth/CMS/SLHCTrackerTriggerSWTools#MC_truth_for_TTTrack + + for (int it = 0; it < (int)matchedTracks.size(); it++) { + bool tmp_trk_genuine = false; + bool tmp_trk_loosegenuine = false; + if (MCTruthTTTrackExtendedHandle->isGenuine(matchedTracks.at(it))) tmp_trk_genuine = true; - if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(matchedTracks.at(it))) + if (MCTruthTTTrackExtendedHandle->isLooselyGenuine(matchedTracks.at(it))) tmp_trk_loosegenuine = true; - if (!tmp_trk_loosegenuine) + if (!tmp_trk_loosegenuine) continue; - if (DebugMode) { - if (MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { - edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; - } - else { - edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); - edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() - << " eta = " << my_tp->momentum().eta() << " phi = " << my_tp->momentum().phi() - << " z0 = " << my_tp->vertex().z(); - } - edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " << matchedTracks.at(it)->momentum().perp() - << " eta = " << matchedTracks.at(it)->momentum().eta() - << " phi = " << matchedTracks.at(it)->momentum().phi() - << " chi2 = " << matchedTracks.at(it)->chi2() - << " consistency = " << matchedTracks.at(it)->stubPtConsistency() - << " z0 = " << matchedTracks.at(it)->z0() - << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); - if (tmp_trk_genuine) + if (DebugMode) { + if (MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)).isNull()) { + edm::LogVerbatim("Tracklet") << "track matched to TP is NOT uniquely matched to a TP"; + } else { + edm::Ptr<TrackingParticle> my_tp = + MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); + edm::LogVerbatim("Tracklet") << "TP matched to track matched to TP ... tp pt = " << my_tp->p4().pt() + << " eta = " << my_tp->momentum().eta() + << " phi = " << my_tp->momentum().phi() << " z0 = " << my_tp->vertex().z(); + } + edm::LogVerbatim("Tracklet") << " ... matched L1 track has pt = " + << matchedTracks.at(it)->momentum().perp() + << " eta = " << matchedTracks.at(it)->momentum().eta() + << " phi = " << matchedTracks.at(it)->momentum().phi() + << " chi2 = " << matchedTracks.at(it)->chi2() + << " consistency = " << matchedTracks.at(it)->stubPtConsistency() + << " z0 = " << matchedTracks.at(it)->z0() + << " nstub = " << matchedTracks.at(it)->getStubRefs().size(); + if (tmp_trk_genuine) edm::LogVerbatim("Tracklet") << " (genuine!) "; - if (tmp_trk_loosegenuine) + if (tmp_trk_loosegenuine) edm::LogVerbatim("Tracklet") << " (loose genuine!) "; - } + } - std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > - stubRefs = matchedTracks.at(it)->getStubRefs(); - int tmp_trk_nstub = stubRefs.size(); + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(it)->getStubRefs(); + int tmp_trk_nstub = stubRefs.size(); - if (tmp_trk_nstub < L1Tk_minNStub) + if (tmp_trk_nstub < L1Tk_minNStub) continue; - - float dmatch_pt = 999; - float dmatch_eta = 999; - float dmatch_phi = 999; - int match_id = 999; - - edm::Ptr<TrackingParticle> my_tp = MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); - dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); - dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); - dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); - match_id = my_tp->pdgId(); - float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); - - // ensure that track is uniquely matched to the TP we are looking at! - if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { - nMatch++; - if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { - i_track = it; - i_chi2dof = tmp_trk_chi2dof; - } + float dmatch_pt = 999; + float dmatch_eta = 999; + float dmatch_phi = 999; + int match_id = 999; + + edm::Ptr<TrackingParticle> my_tp = + MCTruthTTTrackExtendedHandle->findTrackingParticlePtr(matchedTracks.at(it)); + dmatch_pt = std::abs(my_tp->p4().pt() - tmp_tp_pt); + dmatch_eta = std::abs(my_tp->p4().eta() - tmp_tp_eta); + dmatch_phi = std::abs(my_tp->p4().phi() - tmp_tp_phi); + match_id = my_tp->pdgId(); + float tmp_trk_chi2dof = matchedTracks.at(it)->chi2Red(); + + // ensure that track is uniquely matched to the TP we are looking at! + if (dmatch_pt < 0.1 && dmatch_eta < 0.1 && dmatch_phi < 0.1 && tmp_tp_pdgid == match_id && tmp_trk_genuine) { + nMatch++; + if (i_track < 0 || tmp_trk_chi2dof < i_chi2dof) { + i_track = it; + i_chi2dof = tmp_trk_chi2dof; } - - } // end loop over matched L1 tracks - } // end has at least 1 matched L1 track - // ---------------------------------------------------------------------------------------------- - - float tmp_matchtrkExt_pt = -999; - float tmp_matchtrkExt_eta = -999; - float tmp_matchtrkExt_phi = -999; - float tmp_matchtrkExt_z0 = -999; - float tmp_matchtrkExt_d0 = -999; - float tmp_matchtrkExt_chi2 = -999; - float tmp_matchtrkExt_chi2dof = -999; - float tmp_matchtrkExt_chi2rphi = -999; - float tmp_matchtrkExt_chi2rz = -999; - float tmp_matchtrkExt_bendchi2 = -999; - int tmp_matchtrkExt_nstub = -999; - int tmp_matchtrkExt_dhits = -999; - int tmp_matchtrkExt_lhits = -999; - int tmp_matchtrkExt_seed = -999; - int tmp_matchtrkExt_hitpattern = -999; - int tmp_matchtrkExt_nFitPars = -999; - - if (nMatch > 1 && DebugMode) - edm::LogVerbatim("Tracklet") << "WARNING *** 2 or more matches to genuine L1 tracks ***"; - - if (nMatch > 0) { - tmp_matchtrkExt_pt = matchedTracks.at(i_track)->momentum().perp(); - tmp_matchtrkExt_eta = matchedTracks.at(i_track)->momentum().eta(); - tmp_matchtrkExt_phi = matchedTracks.at(i_track)->momentum().phi(); - tmp_matchtrkExt_z0 = matchedTracks.at(i_track)->z0(); - tmp_matchtrkExt_nFitPars = matchedTracks.at(i_track)->nFitPars(); - - if (tmp_matchtrkExt_nFitPars == 5) { - float tmp_matchtrkExt_x0 = matchedTracks.at(i_track)->POCA().x(); - float tmp_matchtrkExt_y0 = matchedTracks.at(i_track)->POCA().y(); - tmp_matchtrkExt_d0 = -tmp_matchtrkExt_x0 * sin(tmp_matchtrkExt_phi) + tmp_matchtrkExt_y0 * cos(tmp_matchtrkExt_phi); - // tmp_matchtrkExt_d0 = matchedTracks.at(i_track)->d0(); } - tmp_matchtrkExt_chi2 = matchedTracks.at(i_track)->chi2(); - tmp_matchtrkExt_chi2dof = matchedTracks.at(i_track)->chi2Red(); - tmp_matchtrkExt_chi2rphi = matchedTracks.at(i_track)->chi2XY(); - tmp_matchtrkExt_chi2rz = matchedTracks.at(i_track)->chi2Z(); - tmp_matchtrkExt_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); - tmp_matchtrkExt_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); - tmp_matchtrkExt_seed = (int)matchedTracks.at(i_track)->trackSeedType(); - tmp_matchtrkExt_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); + } // end loop over matched L1 tracks + } // end has at least 1 matched L1 track + // ---------------------------------------------------------------------------------------------- - // ------------------------------------------------------------------------------------------ - tmp_matchtrkExt_dhits = 0; - tmp_matchtrkExt_lhits = 0; + float tmp_matchtrkExt_pt = -999; + float tmp_matchtrkExt_eta = -999; + float tmp_matchtrkExt_phi = -999; + float tmp_matchtrkExt_z0 = -999; + float tmp_matchtrkExt_d0 = -999; + float tmp_matchtrkExt_chi2 = -999; + float tmp_matchtrkExt_chi2dof = -999; + float tmp_matchtrkExt_chi2rphi = -999; + float tmp_matchtrkExt_chi2rz = -999; + float tmp_matchtrkExt_bendchi2 = -999; + int tmp_matchtrkExt_nstub = -999; + int tmp_matchtrkExt_dhits = -999; + int tmp_matchtrkExt_lhits = -999; + int tmp_matchtrkExt_seed = -999; + int tmp_matchtrkExt_hitpattern = -999; + int tmp_matchtrkExt_nFitPars = -999; + + if (nMatch > 1 && DebugMode) + edm::LogVerbatim("Tracklet") << "WARNING *** 2 or more matches to genuine L1 tracks ***"; - std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > - stubRefs = matchedTracks.at(i_track)->getStubRefs(); - int tmp_nstub = stubRefs.size(); - - for (int is = 0; is < tmp_nstub; is++) { - DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); - int layer = -999999; - if (detIdStub.subdetId() == StripSubdetector::TOB) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - tmp_matchtrkExt_lhits += pow(10, layer - 1); - } - else if (detIdStub.subdetId() == StripSubdetector::TID) { - layer = static_cast<int>(tTopo->layer(detIdStub)); - tmp_matchtrkExt_dhits += pow(10, layer - 1); - } - } + if (nMatch > 0) { + tmp_matchtrkExt_pt = matchedTracks.at(i_track)->momentum().perp(); + tmp_matchtrkExt_eta = matchedTracks.at(i_track)->momentum().eta(); + tmp_matchtrkExt_phi = matchedTracks.at(i_track)->momentum().phi(); + tmp_matchtrkExt_z0 = matchedTracks.at(i_track)->z0(); + tmp_matchtrkExt_nFitPars = matchedTracks.at(i_track)->nFitPars(); + + if (tmp_matchtrkExt_nFitPars == 5) { + float tmp_matchtrkExt_x0 = matchedTracks.at(i_track)->POCA().x(); + float tmp_matchtrkExt_y0 = matchedTracks.at(i_track)->POCA().y(); + tmp_matchtrkExt_d0 = + -tmp_matchtrkExt_x0 * sin(tmp_matchtrkExt_phi) + tmp_matchtrkExt_y0 * cos(tmp_matchtrkExt_phi); + // tmp_matchtrkExt_d0 = matchedTracks.at(i_track)->d0(); } - // m_tp_nmatch->push_back(nMatch); //modify to be matches for ext - m_matchtrkExt_pt->push_back(tmp_matchtrkExt_pt); - m_matchtrkExt_eta->push_back(tmp_matchtrkExt_eta); - m_matchtrkExt_phi->push_back(tmp_matchtrkExt_phi); - m_matchtrkExt_z0->push_back(tmp_matchtrkExt_z0); - m_matchtrkExt_d0->push_back(tmp_matchtrkExt_d0); - m_matchtrkExt_chi2->push_back(tmp_matchtrkExt_chi2); - m_matchtrkExt_chi2dof->push_back(tmp_matchtrkExt_chi2dof); - m_matchtrkExt_chi2rphi->push_back(tmp_matchtrkExt_chi2rphi); - m_matchtrkExt_chi2rz->push_back(tmp_matchtrkExt_chi2rz); - m_matchtrkExt_bendchi2->push_back(tmp_matchtrkExt_bendchi2); - m_matchtrkExt_nstub->push_back(tmp_matchtrkExt_nstub); - m_matchtrkExt_dhits->push_back(tmp_matchtrkExt_dhits); - m_matchtrkExt_lhits->push_back(tmp_matchtrkExt_lhits); - m_matchtrkExt_seed->push_back(tmp_matchtrkExt_seed); - m_matchtrkExt_hitpattern->push_back(tmp_matchtrkExt_hitpattern); - } + tmp_matchtrkExt_chi2 = matchedTracks.at(i_track)->chi2(); + tmp_matchtrkExt_chi2dof = matchedTracks.at(i_track)->chi2Red(); + tmp_matchtrkExt_chi2rphi = matchedTracks.at(i_track)->chi2XY(); + tmp_matchtrkExt_chi2rz = matchedTracks.at(i_track)->chi2Z(); + tmp_matchtrkExt_bendchi2 = matchedTracks.at(i_track)->stubPtConsistency(); + tmp_matchtrkExt_nstub = (int)matchedTracks.at(i_track)->getStubRefs().size(); + tmp_matchtrkExt_seed = (int)matchedTracks.at(i_track)->trackSeedType(); + tmp_matchtrkExt_hitpattern = (int)matchedTracks.at(i_track)->hitPattern(); - } //end loop tracking particles + // ------------------------------------------------------------------------------------------ + tmp_matchtrkExt_dhits = 0; + tmp_matchtrkExt_lhits = 0; + std::vector<edm::Ref<edmNew::DetSetVector<TTStub<Ref_Phase2TrackerDigi_> >, TTStub<Ref_Phase2TrackerDigi_> > > + stubRefs = matchedTracks.at(i_track)->getStubRefs(); + int tmp_nstub = stubRefs.size(); - if (SaveTrackMET) { - if (Displaced=="Prompt" || Displaced=="Both") { - if (L1TkMETHandle.isValid()) { - trkMET = L1TkMETHandle->begin()->etMiss(); - } - else { - edm::LogWarning("DataNotFound")<< "\nWarning: tkMET handle not found in the event"<< std::endl; + for (int is = 0; is < tmp_nstub; is++) { + DetId detIdStub = theTrackerGeom->idToDet((stubRefs.at(is)->clusterRef(0))->getDetId())->geographicalId(); + int layer = -999999; + if (detIdStub.subdetId() == StripSubdetector::TOB) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrkExt_lhits += pow(10, layer - 1); + } else if (detIdStub.subdetId() == StripSubdetector::TID) { + layer = static_cast<int>(tTopo->layer(detIdStub)); + tmp_matchtrkExt_dhits += pow(10, layer - 1); + } } + } - if (L1TkMHTHandle.isValid()) { - trkMHT = L1TkMHTHandle->begin()->EtMiss(); - trkHT = L1TkMHTHandle->begin()->etTotal(); - } - else { - edm::LogWarning("DataNotFound")<< "\nWarning: tkMHT handle not found in the event"<< std::endl; - } - } //end prompt-track quantities + // m_tp_nmatch->push_back(nMatch); //modify to be matches for ext + m_matchtrkExt_pt->push_back(tmp_matchtrkExt_pt); + m_matchtrkExt_eta->push_back(tmp_matchtrkExt_eta); + m_matchtrkExt_phi->push_back(tmp_matchtrkExt_phi); + m_matchtrkExt_z0->push_back(tmp_matchtrkExt_z0); + m_matchtrkExt_d0->push_back(tmp_matchtrkExt_d0); + m_matchtrkExt_chi2->push_back(tmp_matchtrkExt_chi2); + m_matchtrkExt_chi2dof->push_back(tmp_matchtrkExt_chi2dof); + m_matchtrkExt_chi2rphi->push_back(tmp_matchtrkExt_chi2rphi); + m_matchtrkExt_chi2rz->push_back(tmp_matchtrkExt_chi2rz); + m_matchtrkExt_bendchi2->push_back(tmp_matchtrkExt_bendchi2); + m_matchtrkExt_nstub->push_back(tmp_matchtrkExt_nstub); + m_matchtrkExt_dhits->push_back(tmp_matchtrkExt_dhits); + m_matchtrkExt_lhits->push_back(tmp_matchtrkExt_lhits); + m_matchtrkExt_seed->push_back(tmp_matchtrkExt_seed); + m_matchtrkExt_hitpattern->push_back(tmp_matchtrkExt_hitpattern); + } - if (Displaced=="Displaced" || Displaced=="Both") { - if (L1TkMETExtendedHandle.isValid()) { - trkMETExt = L1TkMETExtendedHandle->begin()->etMiss(); - } - else { - edm::LogWarning("DataNotFound")<< "\nWarning: tkMETExtended handle not found in the event"<< std::endl; - } + } //end loop tracking particles - if (L1TkMHTExtendedHandle.isValid()) { - trkMHTExt = L1TkMHTExtendedHandle->begin()->EtMiss(); - trkHTExt = L1TkMHTExtendedHandle->begin()->etTotal(); - } - else { - edm::LogWarning("DataNotFound")<< "\nWarning: tkMHTExtended handle not found in the event"<< std::endl; - } - } //end displaced-track quantities - } + if (SaveTrackMET) { + if (Displaced == "Prompt" || Displaced == "Both") { + if (L1TkMETHandle.isValid()) { + trkMET = L1TkMETHandle->begin()->etMiss(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMET handle not found in the event" << std::endl; + } - if (SaveTrackJets) { - if (TrackFastJetsHandle.isValid() && (Displaced=="Prompt" || Displaced=="Both")) { - for (jetIter = TrackFastJetsHandle->begin(); jetIter != TrackFastJetsHandle->end(); ++jetIter) { - m_trkjet_vz->push_back(jetIter->jetVtx()); - m_trkjet_ntracks->push_back(jetIter->trkPtrs().size()); - m_trkjet_phi->push_back(jetIter->phi()); - m_trkjet_eta->push_back(jetIter->eta()); - m_trkjet_pt->push_back(jetIter->pt()); - m_trkjet_p->push_back(jetIter->p()); - } + if (L1TkMHTHandle.isValid()) { + trkMHT = L1TkMHTHandle->begin()->EtMiss(); + trkHT = L1TkMHTHandle->begin()->etTotal(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMHT handle not found in the event" << std::endl; } - if (TrackFastJetsExtendedHandle.isValid() && (Displaced=="Displaced" || Displaced=="Both")) { - for (jetIter = TrackFastJetsExtendedHandle->begin(); jetIter != TrackFastJetsExtendedHandle->end(); ++jetIter) { - m_trkjetExt_vz->push_back(jetIter->jetVtx()); - m_trkjetExt_ntracks->push_back(jetIter->trkPtrs().size()); - m_trkjetExt_phi->push_back(jetIter->phi()); - m_trkjetExt_eta->push_back(jetIter->eta()); - m_trkjetExt_pt->push_back(jetIter->pt()); - m_trkjetExt_p->push_back(jetIter->p()); - } + } //end prompt-track quantities + + if (Displaced == "Displaced" || Displaced == "Both") { + if (L1TkMETExtendedHandle.isValid()) { + trkMETExt = L1TkMETExtendedHandle->begin()->etMiss(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMETExtended handle not found in the event" << std::endl; } - if ( !TrackJetsHandle.isValid() && (Displaced=="Prompt" || Displaced=="Both")) { - edm::LogWarning("DataNotFound")<< "\nWarning: TrackJetsHandle not found in the event"<< std::endl; + + if (L1TkMHTExtendedHandle.isValid()) { + trkMHTExt = L1TkMHTExtendedHandle->begin()->EtMiss(); + trkHTExt = L1TkMHTExtendedHandle->begin()->etTotal(); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: tkMHTExtended handle not found in the event" << std::endl; } - if ( !TrackJetsExtendedHandle.isValid() && (Displaced=="Displaced" || Displaced=="Both") ) { - edm::LogWarning("DataNotFound")<< "\nWarning: TrackJetsExtendedHandle not found in the event"<< std::endl; + } //end displaced-track quantities + } + + if (SaveTrackJets) { + if (TrackFastJetsHandle.isValid() && (Displaced == "Prompt" || Displaced == "Both")) { + for (jetIter = TrackFastJetsHandle->begin(); jetIter != TrackFastJetsHandle->end(); ++jetIter) { + m_trkjet_vz->push_back(jetIter->jetVtx()); + m_trkjet_ntracks->push_back(jetIter->trkPtrs().size()); + m_trkjet_phi->push_back(jetIter->phi()); + m_trkjet_eta->push_back(jetIter->eta()); + m_trkjet_pt->push_back(jetIter->pt()); + m_trkjet_p->push_back(jetIter->p()); } - if (TrackJetsHandle.isValid() && (Displaced=="Prompt" || Displaced=="Both")) { - for (jetIter = TrackJetsHandle->begin(); jetIter != TrackJetsHandle->end(); ++jetIter) { - m_2ltrkjet_vz->push_back(jetIter->jetVtx()); - m_2ltrkjet_ntracks->push_back(jetIter->ntracks()); - m_2ltrkjet_phi->push_back(jetIter->phi()); - m_2ltrkjet_eta->push_back(jetIter->eta()); - m_2ltrkjet_pt->push_back(jetIter->pt()); - m_2ltrkjet_p->push_back(jetIter->p()); - m_2ltrkjet_nDisplaced->push_back(jetIter->nDisptracks()); - m_2ltrkjet_nTight->push_back(jetIter->nTighttracks()); - m_2ltrkjet_nTightDisplaced->push_back(jetIter->nTightDisptracks()); - } + } + if (TrackFastJetsExtendedHandle.isValid() && (Displaced == "Displaced" || Displaced == "Both")) { + for (jetIter = TrackFastJetsExtendedHandle->begin(); jetIter != TrackFastJetsExtendedHandle->end(); ++jetIter) { + m_trkjetExt_vz->push_back(jetIter->jetVtx()); + m_trkjetExt_ntracks->push_back(jetIter->trkPtrs().size()); + m_trkjetExt_phi->push_back(jetIter->phi()); + m_trkjetExt_eta->push_back(jetIter->eta()); + m_trkjetExt_pt->push_back(jetIter->pt()); + m_trkjetExt_p->push_back(jetIter->p()); } - - if (TrackJetsExtendedHandle.isValid() && (Displaced=="Displaced" || Displaced=="Both")) { - for (jetIter = TrackJetsExtendedHandle->begin(); jetIter != TrackJetsExtendedHandle->end(); ++jetIter) { - m_2ltrkjetExt_vz->push_back(jetIter->jetVtx()); - m_2ltrkjetExt_ntracks->push_back(jetIter->ntracks()); - m_2ltrkjetExt_phi->push_back(jetIter->phi()); - m_2ltrkjetExt_eta->push_back(jetIter->eta()); - m_2ltrkjetExt_pt->push_back(jetIter->pt()); - m_2ltrkjetExt_p->push_back(jetIter->p()); - m_2ltrkjetExt_nDisplaced->push_back(jetIter->nDisptracks()); - m_2ltrkjetExt_nTight->push_back(jetIter->nTighttracks()); - m_2ltrkjetExt_nTightDisplaced->push_back(jetIter->nTightDisptracks()); - } + } + if (!TrackJetsHandle.isValid() && (Displaced == "Prompt" || Displaced == "Both")) { + edm::LogWarning("DataNotFound") << "\nWarning: TrackJetsHandle not found in the event" << std::endl; + } + if (!TrackJetsExtendedHandle.isValid() && (Displaced == "Displaced" || Displaced == "Both")) { + edm::LogWarning("DataNotFound") << "\nWarning: TrackJetsExtendedHandle not found in the event" << std::endl; + } + if (TrackJetsHandle.isValid() && (Displaced == "Prompt" || Displaced == "Both")) { + for (jetIter = TrackJetsHandle->begin(); jetIter != TrackJetsHandle->end(); ++jetIter) { + m_2ltrkjet_vz->push_back(jetIter->jetVtx()); + m_2ltrkjet_ntracks->push_back(jetIter->ntracks()); + m_2ltrkjet_phi->push_back(jetIter->phi()); + m_2ltrkjet_eta->push_back(jetIter->eta()); + m_2ltrkjet_pt->push_back(jetIter->pt()); + m_2ltrkjet_p->push_back(jetIter->p()); + m_2ltrkjet_nDisplaced->push_back(jetIter->nDisptracks()); + m_2ltrkjet_nTight->push_back(jetIter->nTighttracks()); + m_2ltrkjet_nTightDisplaced->push_back(jetIter->nTightDisptracks()); } + } - if (L1TkPrimaryVertexHandle.isValid()) { - m_pv_L1reco->push_back(L1TkPrimaryVertexHandle->begin()->zvertex()); + if (TrackJetsExtendedHandle.isValid() && (Displaced == "Displaced" || Displaced == "Both")) { + for (jetIter = TrackJetsExtendedHandle->begin(); jetIter != TrackJetsExtendedHandle->end(); ++jetIter) { + m_2ltrkjetExt_vz->push_back(jetIter->jetVtx()); + m_2ltrkjetExt_ntracks->push_back(jetIter->ntracks()); + m_2ltrkjetExt_phi->push_back(jetIter->phi()); + m_2ltrkjetExt_eta->push_back(jetIter->eta()); + m_2ltrkjetExt_pt->push_back(jetIter->pt()); + m_2ltrkjetExt_p->push_back(jetIter->p()); + m_2ltrkjetExt_nDisplaced->push_back(jetIter->nDisptracks()); + m_2ltrkjetExt_nTight->push_back(jetIter->nTighttracks()); + m_2ltrkjetExt_nTightDisplaced->push_back(jetIter->nTightDisptracks()); } - else { - edm::LogWarning("DataNotFound")<< "\nWarning: L1TkPrimaryVertexHandle not found in the event"<< std::endl; - } - } // end track jets + } + if (L1TkPrimaryVertexHandle.isValid()) { + m_pv_L1reco->push_back(L1TkPrimaryVertexHandle->begin()->zvertex()); + } else { + edm::LogWarning("DataNotFound") << "\nWarning: L1TkPrimaryVertexHandle not found in the event" << std::endl; + } + } // end track jets - eventTree->Fill(); - } // end of analyze() + eventTree->Fill(); +} // end of analyze() - /////////////////////////// - // DEFINE THIS AS A PLUG-IN - DEFINE_FWK_MODULE(L1TrackObjectNtupleMaker); +/////////////////////////// +// DEFINE THIS AS A PLUG-IN +DEFINE_FWK_MODULE(L1TrackObjectNtupleMaker); From 5d86491a71ca1dace4fe86de80c55ee9c0b00448 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Thu, 6 May 2021 19:08:00 +0200 Subject: [PATCH 217/309] move nuplizer files to correct directory --- .../test => L1TTrackMatch/plugins}/L1TrackObjectNtupleMaker.cc | 0 .../test => L1TTrackMatch/python}/L1TrackObjectNtupleMaker_cfg.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename L1Trigger/{TrackFindingTracklet/test => L1TTrackMatch/plugins}/L1TrackObjectNtupleMaker.cc (100%) rename L1Trigger/{TrackFindingTracklet/test => L1TTrackMatch/python}/L1TrackObjectNtupleMaker_cfg.py (100%) diff --git a/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc similarity index 100% rename from L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker.cc rename to L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc diff --git a/L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker_cfg.py b/L1Trigger/L1TTrackMatch/python/L1TrackObjectNtupleMaker_cfg.py similarity index 100% rename from L1Trigger/TrackFindingTracklet/test/L1TrackObjectNtupleMaker_cfg.py rename to L1Trigger/L1TTrackMatch/python/L1TrackObjectNtupleMaker_cfg.py From 1d3d4d3790ef9561b4e65b829567b67ae3bd64d2 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Thu, 6 May 2021 19:18:00 +0200 Subject: [PATCH 218/309] remove unused variable --- L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc index 3a03fc3483238..073f5d1b865fe 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc @@ -73,7 +73,6 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet // L1 primary vertex edm::Handle<TkPrimaryVertexCollection> L1VertexHandle; iEvent.getByToken(pvToken_, L1VertexHandle); - std::vector<TkPrimaryVertex>::const_iterator vtxIter; // L1 track-trigger jets edm::Handle<TkJetCollection> L1TkJetsHandle; From e1963e720103e1ba35ce636a24ca9e555f3b2199 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Thu, 6 May 2021 19:30:06 +0200 Subject: [PATCH 219/309] Avoid duplicate plots with 'all' option --- .../HGCalValidation/scripts/makeHGCalValidationPlots.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py index 1998fac75496a..37755c97b6bc5 100755 --- a/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py +++ b/Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py @@ -18,12 +18,12 @@ hitLabel = 'recHits' layerClustersLabel = 'layerClusters' trackstersLabel = 'tracksters' -trackstersEdgesLabel = 'trackstersEdges' +trackstersWithEdgesLabel = 'trackstersWithEdges' simLabel = 'simulation' allLabel = 'all' collection_choices = [allLabel] -collection_choices.extend([hitLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersEdgesLabel]+[simLabel]) +collection_choices.extend([hitLabel]+[layerClustersLabel]+[trackstersLabel]+[trackstersWithEdgesLabel]+[simLabel]) def main(opts): @@ -68,7 +68,7 @@ def plot_Tst(): hgcalPlots.append_hgcalTrackstersPlots(tracksterCollection, tracksterCollection) val.doPlots(hgctrackster, plotterDrawArgs=drawArgs) - #trackstersEdges + #trackstersWithEdges def plot_TstEdges(): plot_Tst() for tracksterCollection in trackstersIters : @@ -101,13 +101,14 @@ def plot_hitCal(): val.doPlots(hgchitcalib, plotterDrawArgs=drawArgs) - plotDict = {hitLabel:[plot_hitVal, plot_hitCal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP]} + plotDict = {hitLabel:[plot_hitVal, plot_hitCal], layerClustersLabel:[plot_LC], trackstersLabel:[plot_Tst], trackstersWithEdgesLabel:[plot_TstEdges], simLabel:[plot_SC, plot_CP]} if (opts.collection != allLabel): for task in plotDict[opts.collection]: task() else: for label in plotDict: + if (label == trackstersLabel): continue # already run in trackstersWithEdges for task in plotDict[label]: task() From 4e61998b2188fda1b744d7a17af2bef6e82d2cd0 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Thu, 6 May 2021 19:35:24 +0200 Subject: [PATCH 220/309] reorganize files --- L1Trigger/L1TTrackMatch/BuildFile.xml | 4 ++++ .../L1TTrackMatch/{plugins => interface}/L1TrackJetProducer.h | 1 - L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) rename L1Trigger/L1TTrackMatch/{plugins => interface}/L1TrackJetProducer.h (97%) diff --git a/L1Trigger/L1TTrackMatch/BuildFile.xml b/L1Trigger/L1TTrackMatch/BuildFile.xml index bf3475dfefcf0..0492571718a2f 100644 --- a/L1Trigger/L1TTrackMatch/BuildFile.xml +++ b/L1Trigger/L1TTrackMatch/BuildFile.xml @@ -9,6 +9,10 @@ <use name="L1Trigger/L1TMuon"/> <use name="L1Trigger/L1TMuonEndCap"/> <use name="RecoJets/JetAlgorithms"/> +<use name="boost"/> +<use name="xerces-c"/> +<use name="FWCore/Utilities"/> +<use name="L1Trigger/TrackFindingTMTT"/> <use name="clhep"/> <use name="root"/> <use name="rootrflx"/> diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h b/L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h similarity index 97% rename from L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h rename to L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h index cfcfd9d01e7aa..7d7340d585389 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.h +++ b/L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h @@ -4,7 +4,6 @@ #include <fstream> #include <iostream> #include <string> -using namespace std; //Each individual box in the eta and phi dimension. // Also used to store final cluster data for each zbin. diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc index 5ba4c6f13c915..6dd9086154ae3 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc @@ -27,7 +27,7 @@ #include "Geometry/CommonTopologies/interface/PixelGeomDetType.h" #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "L1TrackJetProducer.h" +#include "L1Trigger/L1TTrackMatch/interface/L1TrackJetProducer.h" #include "TH1D.h" #include "TH2D.h" #include <TMath.h> From 05ae7d140f22f6d9693b8aa215a5ce8f08999874 Mon Sep 17 00:00:00 2001 From: swmukher <s.mukherjee@cern.ch> Date: Thu, 6 May 2021 22:01:17 +0200 Subject: [PATCH 221/309] move EgammaLocalCovParamDefaults.h from RecoEgamma to RecoEcal package --- RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h | 2 +- RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h | 2 +- .../EgammaCoreTools}/interface/EgammaLocalCovParamDefaults.h | 4 ++-- RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc | 2 +- .../EgammaElectronProducers/plugins/GsfElectronProducer.cc | 2 +- .../plugins/EgammaHLTClusterShapeProducer.cc | 2 +- RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename {RecoEgamma/EgammaTools => RecoEcal/EgammaCoreTools}/interface/EgammaLocalCovParamDefaults.h (55%) diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h index ac12a0e0efbd6..58160aa29d35a 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h @@ -35,7 +35,7 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" #include <optional> class CaloTopology; diff --git a/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h b/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h index 1a33b998444bd..456039cb98e60 100644 --- a/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h +++ b/RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h @@ -57,7 +57,7 @@ #include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h" #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" class DetId; class CaloTopology; diff --git a/RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h b/RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h similarity index 55% rename from RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h rename to RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h index d5b9d4cfad95a..4e9f41e583fea 100644 --- a/RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h +++ b/RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h @@ -1,5 +1,5 @@ -#ifndef RecoEgamma_EgammaTools_interface_EgammaLocalCovParamDefaults_h -#define RecoEgamma_EgammaTools_interface_EgammaLocalCovParamDefaults_h +#ifndef RecoEcal_EgammaCoreTools_interface_EgammaLocalCovParamDefaults_h +#define RecoEcal_EgammaCoreTools_interface_EgammaLocalCovParamDefaults_h struct EgammaLocalCovParamDefaults { static constexpr float kRelEnCut = 4.7; diff --git a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc index ce0e65664d260..d85d7efd0bea0 100644 --- a/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc +++ b/RecoEgamma/EgammaElectronAlgos/src/GsfElectronAlgo.cc @@ -25,7 +25,7 @@ #include "RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h" #include "RecoEgamma/EgammaElectronAlgos/interface/ecalClusterEnergyUncertaintyElectronSpecific.h" #include "CommonTools/Egamma/interface/ConversionTools.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" #include <Math/Point3D.h> #include <memory> diff --git a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc index baec0e950e422..6272f867fde43 100644 --- a/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc +++ b/RecoEgamma/EgammaElectronProducers/plugins/GsfElectronProducer.cc @@ -21,7 +21,7 @@ #include "RecoEgamma/EgammaElectronAlgos/interface/EgAmbiguityTools.h" #include "RecoEgamma/EgammaElectronAlgos/interface/ElectronUtilities.h" #include "RecoEgamma/EgammaElectronAlgos/interface/GsfElectronAlgo.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" using namespace reco; diff --git a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc index 33c34ab4c7021..a15560c443e00 100644 --- a/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc +++ b/RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTClusterShapeProducer.cc @@ -24,7 +24,7 @@ #include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" class EgammaHLTClusterShapeProducer : public edm::global::EDProducer<> { public: diff --git a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc index 7db97f369c5c5..72ee92135f557 100644 --- a/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc +++ b/RecoEgamma/EgammaPhotonProducers/src/GEDPhotonProducer.cc @@ -47,7 +47,7 @@ #include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgoRcd.h" #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h" #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h" -#include "RecoEgamma/EgammaTools/interface/EgammaLocalCovParamDefaults.h" +#include "RecoEcal/EgammaCoreTools/interface/EgammaLocalCovParamDefaults.h" class GEDPhotonProducer : public edm::stream::EDProducer<> { public: From 880d5d4eb873073d478d06f04d95bf85ed4870b8 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen <matti.kortelainen@cern.ch> Date: Tue, 27 Apr 2021 03:21:25 +0200 Subject: [PATCH 222/309] Allow edmodule.clone(pset) for pset to override parameters --- FWCore/ParameterSet/python/Mixins.py | 29 ++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/FWCore/ParameterSet/python/Mixins.py b/FWCore/ParameterSet/python/Mixins.py index fa7913a9deeeb..6d300b885ae5a 100644 --- a/FWCore/ParameterSet/python/Mixins.py +++ b/FWCore/ParameterSet/python/Mixins.py @@ -414,7 +414,18 @@ def clone(self, *args, **params): """ returnValue =_TypedParameterizable.__new__(type(self)) myparams = self.parameters_() - + + # Prefer parameters given in PSet blocks over those in clone-from module + for block in args: + # Allow __PSet for testing + if type(block).__name__ not in ["PSet", "__PSet"]: + raise ValueError("Only PSets can be passed as unnamed argument blocks. This is a "+type(block).__name__) + for name in block.parameterNames_(): + try: + del myparams[name] + except KeyError: + pass + _modifyParametersFromDict(myparams, params, self._Parameterizable__raiseBadSetAttr) if self._Parameterizable__validator is not None: myparams["allowAnyLabel_"] = self._Parameterizable__validator @@ -868,9 +879,19 @@ def dumpPython(self,options=PrintOptions()): d = a.clone(__PSet(k=__TestType(42))) self.assertEqual(d.t.value(), 1) self.assertEqual(d.k.value(), 42) - # TODO: following case that currently raises an exception - # will be made to work in the near future - self.assertRaises(ValueError, a.clone, __PSet(t=__TestType(42))) + d2 = a.clone(__PSet(t=__TestType(42))) + self.assertEqual(d2.t.value(), 42) + d3 = a.clone(__PSet(t=__TestType(42)), + __PSet(u=__TestType(56))) + self.assertEqual(d3.t.value(), 42) + self.assertEqual(d3.u.value(), 56) + self.assertRaises(ValueError,a.clone, + __PSet(t=__TestType(42)), + __PSet(t=__TestType(56))) + d4 = a.clone(__PSet(t=__TestType(43)), u = 57) + self.assertEqual(d4.t.value(), 43) + self.assertEqual(d4.u.value(), 57) + self.assertRaises(TypeError,a.clone,t=__TestType(43),**{"doesNotExist":57}) e = __Test("MyType") self.assertEqual(len(e.parameterNames_()), 0) From b978a1bccc54a0268b1fa1d4dcb130e7cde6d251 Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Fri, 7 May 2021 09:26:33 +0200 Subject: [PATCH 223/309] typo fix --- DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 335894f955baa..204afa4dd9a62 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -123,11 +123,9 @@ namespace { assert(tracker.isValid()); //get topology tkTpl = &iSetup.getData(trackerTopoToken_); - ; // Initialize 1D templates templateDBobject_ = &iSetup.getData(templateDBobjectToken_); - ; if (!SiPixelTemplate::pushfile(*templateDBobject_, thePixelTemp_)) edm::LogError("SiPixelPhase1TrackClusters") << "Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " From 2a1bffd39bc99b844de6af20fb83e033ccc8da0d Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Fri, 7 May 2021 09:45:37 +0200 Subject: [PATCH 224/309] Move plugins out of SimDataFormats --- .../HGCalAssociatorProducers/plugins/BuildFile.xml | 5 +++++ .../plugins/LCToCPAssociatorEDProducer.cc | 0 .../plugins/LCToSCAssociatorEDProducer.cc | 0 .../plugins/TSToSCAssociatorEDProducer.cc | 0 SimDataFormats/Associations/plugins/BuildFile.xml | 10 ---------- 5 files changed, 5 insertions(+), 10 deletions(-) rename {SimDataFormats/Associations => SimCalorimetry/HGCalAssociatorProducers}/plugins/LCToCPAssociatorEDProducer.cc (100%) rename {SimDataFormats/Associations => SimCalorimetry/HGCalAssociatorProducers}/plugins/LCToSCAssociatorEDProducer.cc (100%) rename {SimDataFormats/Associations => SimCalorimetry/HGCalAssociatorProducers}/plugins/TSToSCAssociatorEDProducer.cc (100%) delete mode 100644 SimDataFormats/Associations/plugins/BuildFile.xml diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml b/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml index 50d08e426a84d..2d57a74056b6b 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/BuildFile.xml @@ -2,5 +2,10 @@ <use name="FWCore/ParameterSet"/> <use name="SimDataFormats/Associations"/> <use name="RecoLocalCalo/HGCalRecAlgos"/> +<use name="DataFormats/HGCalReco"/> +<use name="DataFormats/CaloRecHit"/> +<use name="FWCore/MessageLogger"/> +<use name="FWCore/Utilities"/> +<use name="SimDataFormats/CaloAnalysis"/> <flags EDM_PLUGIN="1"/> diff --git a/SimDataFormats/Associations/plugins/LCToCPAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc similarity index 100% rename from SimDataFormats/Associations/plugins/LCToCPAssociatorEDProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc diff --git a/SimDataFormats/Associations/plugins/LCToSCAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc similarity index 100% rename from SimDataFormats/Associations/plugins/LCToSCAssociatorEDProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc diff --git a/SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc similarity index 100% rename from SimDataFormats/Associations/plugins/TSToSCAssociatorEDProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorEDProducer.cc diff --git a/SimDataFormats/Associations/plugins/BuildFile.xml b/SimDataFormats/Associations/plugins/BuildFile.xml deleted file mode 100644 index cb5fa596704db..0000000000000 --- a/SimDataFormats/Associations/plugins/BuildFile.xml +++ /dev/null @@ -1,10 +0,0 @@ -<use name="FWCore/Framework"/> -<use name="FWCore/ParameterSet"/> -<use name="DataFormats/HGCalReco"/> -<use name="DataFormats/CaloRecHit"/> -<use name="FWCore/MessageLogger"/> -<use name="FWCore/Utilities"/> -<use name="SimDataFormats/CaloAnalysis"/> -<library name="CPLCAssociation_plugins" file="*.cc"> - <flags EDM_PLUGIN="1"/> -</library> From 70ee9f6f93c1f26adf9d0a5b69bbf854cfb65663 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Fri, 23 Apr 2021 10:50:52 +0200 Subject: [PATCH 225/309] Rename MTDTopologyBuilder as MTDPixelTopologyBuilder --- ...ogyBuilder.h => MTDPixelTopologyBuilder.h} | 8 +-- .../MTDGeomBuilderFromGeometricTimingDet.cc | 4 +- .../src/MTDPixelTopologyBuilder.cc | 62 +++++++++++++++++ .../src/MTDTopologyBuilder.cc | 66 ------------------- 4 files changed, 68 insertions(+), 72 deletions(-) rename Geometry/MTDGeometryBuilder/interface/{MTDTopologyBuilder.h => MTDPixelTopologyBuilder.h} (79%) create mode 100644 Geometry/MTDGeometryBuilder/src/MTDPixelTopologyBuilder.cc delete mode 100644 Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc diff --git a/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h b/Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h similarity index 79% rename from Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h rename to Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h index e8959c23ea644..98e569e15238e 100644 --- a/Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h +++ b/Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h @@ -1,5 +1,5 @@ -#ifndef Geometry_MTDGeometryBuilder_MTDTopologyBuilder_H -#define Geometry_MTDGeometryBuilder_MTDTopologyBuilder_H +#ifndef Geometry_MTDGeometryBuilder_MTDPixelTopologyBuilder_H +#define Geometry_MTDGeometryBuilder_MTDPixelTopologyBuilder_H #include <string> class PixelTopology; @@ -9,9 +9,9 @@ class Bounds; * Called by GeomTopologyBuilder, chooses the right topology for Pixels. */ -class MTDTopologyBuilder { +class MTDPixelTopologyBuilder { public: - MTDTopologyBuilder(); + MTDPixelTopologyBuilder(); PixelTopology* build(const Bounds* bounds, int ROWS_PER_ROC, // Num of Rows per ROC diff --git a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc index 72fbbf82f6d1f..a74e4644738d6 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc @@ -3,7 +3,7 @@ #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetType.h" #include "Geometry/MTDGeometryBuilder/interface/MTDGeomDetUnit.h" -#include "Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h" +#include "Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h" #include "DataFormats/DetId/interface/DetId.h" #include "CondFormats/GeometryObjects/interface/PMTDParameters.h" #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" @@ -146,7 +146,7 @@ void MTDGeomBuilderFromGeometricTimingDet::buildPixel( if (theMTDDetTypeMap.find(detName) == theMTDDetTypeMap.end()) { std::unique_ptr<const Bounds> bounds(i->bounds()); - PixelTopology* t = MTDTopologyBuilder().build( + PixelTopology* t = MTDPixelTopologyBuilder().build( &*bounds, ROCrows, ROCcols, ROCSx, ROCSy, GAPxInterpad, GAPxBorder, GAPyInterpad, GAPyBorder); theMTDDetTypeMap[detName] = new MTDGeomDetType(t, detName, det); diff --git a/Geometry/MTDGeometryBuilder/src/MTDPixelTopologyBuilder.cc b/Geometry/MTDGeometryBuilder/src/MTDPixelTopologyBuilder.cc new file mode 100644 index 0000000000000..922569d0214b9 --- /dev/null +++ b/Geometry/MTDGeometryBuilder/src/MTDPixelTopologyBuilder.cc @@ -0,0 +1,62 @@ +//#define EDM_ML_DEBUG + +// Make the change for "big" pixels. 3/06 d.k. +#include "Geometry/MTDGeometryBuilder/interface/MTDPixelTopologyBuilder.h" +#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" +#include "DataFormats/GeometrySurface/interface/Bounds.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +MTDPixelTopologyBuilder::MTDPixelTopologyBuilder(void) {} + +PixelTopology* MTDPixelTopologyBuilder::build(const Bounds* bs, + int pixelROCRows, // Num of Rows per ROC + int pixelROCCols, // Num of Cols per ROC + int pixelROCsInX, + int pixelROCsInY, + int GAPxInterpad, + int GAPxBorder, + int GAPyInterpad, + int GAPyBorder) { + float width = bs->width(); // module width = Xsize + float length = bs->length(); // module length = Ysize + + // Number of pixel rows (x) and columns (y) per module + int nrows = pixelROCRows * pixelROCsInX; + int ncols = pixelROCCols * pixelROCsInY; + + float pitchX = width / nrows; + float pitchY = length / ncols; + + float micronsTocm = 1e-4; + float gapxinterpad = float(GAPxInterpad) * micronsTocm; //Convert to cm + float gapyinterpad = float(GAPyInterpad) * micronsTocm; //Convert to cm + float gapxborder = float(GAPxBorder) * micronsTocm; //Convert to cm + float gapyborder = float(GAPyBorder) * micronsTocm; //Convert to cm + +#ifdef EDM_ML_DEBUG + edm::LogInfo("MTDPixelTopologyBuilder") + << std::fixed << "Building topology for module of width(X) = " << std::setw(10) << width + << " length(Y) = " << std::setw(10) << length << "\n Rows per ROC = " << std::setw(10) << pixelROCRows + << " Cols per ROC = " << std::setw(10) << pixelROCCols << "\n ROCs in X = " << std::setw(10) + << pixelROCsInX << " ROCs in Y = " << std::setw(10) << pixelROCsInY + << "\n # pixel rows X = " << std::setw(10) << nrows << " # pixel cols Y = " << std::setw(10) << ncols + << "\n pitch in X = " << std::setw(10) << pitchX << " # pitch in Y = " << std::setw(10) << pitchY + << "\n Interpad gap in X = " << std::setw(10) << gapxinterpad << " # Interpad gap in Y = " << std::setw(10) + << gapyinterpad << "\n Border gap in X = " << std::setw(10) << gapxborder + << " # Border gap in Y = " << std::setw(10) << gapyborder; +#endif + + return (new RectangularMTDTopology(nrows, + ncols, + pitchX, + pitchY, + pixelROCRows, // (int)rocRow + pixelROCCols, // (int)rocCol + pixelROCsInX, + pixelROCsInY, + gapxinterpad, + gapxborder, + gapyinterpad, + gapyborder)); +} diff --git a/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc b/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc deleted file mode 100644 index 045803798e9ee..0000000000000 --- a/Geometry/MTDGeometryBuilder/src/MTDTopologyBuilder.cc +++ /dev/null @@ -1,66 +0,0 @@ -//#define EDM_ML_DEBUG - -// Make the change for "big" pixels. 3/06 d.k. -#include "Geometry/MTDGeometryBuilder/interface/MTDTopologyBuilder.h" -#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h" -#include "DataFormats/GeometrySurface/interface/Bounds.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -MTDTopologyBuilder::MTDTopologyBuilder(void) {} - -PixelTopology* MTDTopologyBuilder::build(const Bounds* bs, - int pixelROCRows, // Num of Rows per ROC - int pixelROCCols, // Num of Cols per ROC - int pixelROCsInX, - int pixelROCsInY, - int GAPxInterpad, - int GAPxBorder, - int GAPyInterpad, - int GAPyBorder) { - float width = bs->width(); // module width = Xsize - float length = bs->length(); // module length = Ysize - - // Number of pixel rows (x) and columns (y) per module - int nrows = pixelROCRows * pixelROCsInX; - int ncols = pixelROCCols * pixelROCsInY; - - float pitchX = width / nrows; - float pitchY = length / ncols; - - float micronsTocm = 1e-4; - float gapxinterpad = float(GAPxInterpad) * micronsTocm; //Convert to cm - float gapyinterpad = float(GAPyInterpad) * micronsTocm; //Convert to cm - float gapxborder = float(GAPxBorder) * micronsTocm; //Convert to cm - float gapyborder = float(GAPyBorder) * micronsTocm; //Convert to cm - -#ifdef EDM_ML_DEBUG - edm::LogInfo("MTDTopologyBuilder") << std::fixed << "Building topology for module of width(X) = " << std::setw(10) - << width << " length(Y) = " << std::setw(10) << length - << "\n Rows per ROC = " << std::setw(10) << pixelROCRows - << " Cols per ROC = " << std::setw(10) << pixelROCCols - << "\n ROCs in X = " << std::setw(10) << pixelROCsInX - << " ROCs in Y = " << std::setw(10) << pixelROCsInY - << "\n # pixel rows X = " << std::setw(10) << nrows - << " # pixel cols Y = " << std::setw(10) << ncols - << "\n pitch in X = " << std::setw(10) << pitchX - << " # pitch in Y = " << std::setw(10) << pitchY - << "\n Interpad gap in X = " << std::setw(10) << gapxinterpad - << " # Interpad gap in Y = " << std::setw(10) << gapyinterpad - << "\n Border gap in X = " << std::setw(10) << gapxborder - << " # Border gap in Y = " << std::setw(10) << gapyborder; -#endif - - return (new RectangularMTDTopology(nrows, - ncols, - pitchX, - pitchY, - pixelROCRows, // (int)rocRow - pixelROCCols, // (int)rocCol - pixelROCsInX, - pixelROCsInY, - gapxinterpad, - gapxborder, - gapyinterpad, - gapyborder)); -} From 52a688097779ab735ca688b4ab8018a3279b6a51 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Fri, 23 Apr 2021 13:03:55 +0200 Subject: [PATCH 226/309] Propagate ETL v5 start copy and offset into PMTDParameters --- Geometry/MTDCommonData/data/etl/v5/etl.xml | 86 +++++++++---------- .../data/mtdParameters/v2/mtdParameters.xml | 4 +- .../MTDGeomBuilderFromGeometricTimingDet.cc | 16 ++-- .../src/MTDParametersFromDD.cc | 71 +++++++++++++-- 4 files changed, 116 insertions(+), 61 deletions(-) diff --git a/Geometry/MTDCommonData/data/etl/v5/etl.xml b/Geometry/MTDCommonData/data/etl/v5/etl.xml index 20289c645572d..8526484d931fa 100644 --- a/Geometry/MTDCommonData/data/etl/v5/etl.xml +++ b/Geometry/MTDCommonData/data/etl/v5/etl.xml @@ -64,6 +64,43 @@ <Constant name="Zpos1" value="4.02*mm"/> <Constant name="Zpos2" value="0.*mm"/> <Constant name="xoffset_servicehybrid" value="1*mm"/> + + <Vector name="StartCopyNo_Front_Right" type="numeric" nEntries="27"> + 1, 7, 18, 33, 50, 69, 90, 112, 136, 161, 186, 207, 227, 247, 266, + 285, 305, 325, 349, 374, 398, 421, 443, 463, 481, 497, 510 + </Vector> + + <Vector name="StartCopyNo_Front_Left" type="numeric" nEntries="27"> + 1, 8, 21, 37, 55, 75, 97, 120, 144, 169, 193, 213, 233, 252, 271, + 291, 311, 332, 357, 382, 406, 428, 449, 468, 485, 500, 511 + </Vector> + + <Vector name="Offset_Front_Right" type="numeric" nEntries="27"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, 8, 7, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 + </Vector> + + <Vector name="Offset_Front_Left" type="numeric" nEntries="27"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 7, 8, 8, 7, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + </Vector> + + <Vector name="StartCopyNo_Back_Right" type="numeric" nEntries="27"> + 1, 10, 23, 39, 57, 77, 99, 122, 146, 171, 194, 214, 234, 254, 273, + 293, 313, 335, 360, 384, 407, 430, 451, 470, 487, 501, 511 + </Vector> + + <Vector name="StartCopyNo_Back_Left" type="numeric" nEntries="27"> + 1, 4, 14, 28, 45, 64, 85, 107, 130, 154, 179, 201, 221, 241, 260, + 280, 300, 320, 343, 368, 392, 415, 437, 457, 475, 491, 504 + </Vector> + + <Vector name="Offset_Back_Right" type="numeric" nEntries="27"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 7, 7, 8, 7, 6, 4, 0,0, 0, 0, 0, 0, 0, 0, 0, 0 + </Vector> + + <Vector name="Offset_Back_Left" type="numeric" nEntries="27"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 8, 7, 7, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 + </Vector> + </ConstantsSection> @@ -71,16 +108,16 @@ <Tubs name="EndcapTimingLayer" rMin="[ETLrmin]" rMax="[ETLrmax]" dz="0.5*[ETLthickness]" startPhi="0*deg" deltaPhi="360*deg"/> <Tubs name="Disc" rMin="[Disc_Rmin]" rMax="[Disc_Rmax]" dz="0.5*[Disc_thickness]" startPhi="0*deg" deltaPhi="360*deg"/> <Tubs name="Al_Disc" rMin="[Disc_Rmin]" rMax="[Disc_Rmax]" dz="0.5*[Al_Disc_thickness]" startPhi="0*deg" deltaPhi="360*deg"/> - + <!-- FRONT: face closest to IP, BACK: furthest from IP --> <Tubs name="DiscSector_Front" rMin="[Disc_Rmin]" rMax="[Disc_Rmax]" dz="0.5*[ServiceHybrid_Z]" startPhi="-90*deg" deltaPhi="180*deg"/> <!-- half-disc on front face --> <Tubs name="DiscSector_Back" rMin="[Disc_Rmin]" rMax="[Disc_Rmax]" dz="0.5*[ServiceHybrid_Z]" startPhi="-90*deg" deltaPhi="180*deg"/> <!-- half-disc on back face --> - + <Box name="SensorModule" dx="0.5*[SensorModule_X]" dy="0.5*[SensorModule_Y]" dz="0.5*[SensorModule_Z]"/> <Box name="ServiceHybrid3" dx="0.5*[ServiceHybrid_X3]" dy="0.5*[ServiceHybrid_Y]" dz="0.5*[ServiceHybrid_Z]"/> <Box name="ServiceHybrid6" dx="0.5*[ServiceHybrid_X6]" dy="0.5*[ServiceHybrid_Y]" dz="0.5*[ServiceHybrid_Z]"/> <Box name="ServiceHybrid7" dx="0.5*[ServiceHybrid_X7]" dy="0.5*[ServiceHybrid_Y]" dz="0.5*[ServiceHybrid_Z]"/> - + <Box name="ThermalPad" dx="0.5*[SensorModule_X]" dy="0.5*[SensorModule_Y]" dz="0.5*[ThermalPad_dz]"/> <Box name="AlN_Carrier" dx="0.5*[SensorModule_X]" dy="0.5*[SensorModule_Y]" dz="0.5*[AIN_Carrier_dz]"/> <Box name="LairdFilm" dx="0.5*([ETROCdx]*2+[etrocSep_X])" dy="0.5*([ETROCdy]+0.5*[etrocSep_Y])" dz="0.5*[LairdFilm_dz]"/> @@ -100,49 +137,6 @@ <Rotation name="Reverse" thetaX="90*deg" phiX="0*deg" thetaY="90*deg" phiY="270*deg" thetaZ="180*deg" phiZ="0*deg"/> </RotationSection> - <Vector name="StartCopyNo_Front_Right" type="numeric" nEntries="27"> - 1, 7, 18, 33, 50, 69, 90, 112, 136, 161, 186, 207, 227, 247, 266, - 285, 305, 325, 349, 374, 398, 421, 443, 463, 481, 497, 510 - </Vector> - - <Vector name="StartCopyNo_Front_Left" type="numeric" nEntries="27"> - 1, 8, 21, 37, 55, 75, 97, 120, 144, 169, 193, 213, 233, 252, 271, - 291, 311, 332, 357, 382, 406, 428, 449, 468, 485, 500, 511 - </Vector> - - <Vector name="Offset_Front_Right" type="numeric" nEntries="27"> - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], - [x_offset]+5*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+2*([SensorModule_X]+[DeltaX]), - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset] - </Vector> - - <Vector name="Offset_Front_Left" type="numeric" nEntries="27"> - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], - [x_offset]+2*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+5*([SensorModule_X]+[DeltaX]), - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset] - </Vector> - - <Vector name="StartCopyNo_Back_Right" type="numeric" nEntries="27"> - 1, 10, 23, 39, 57, 77, 99, 122, 146, 171, 194, 214, 234, 254, 273, - 293, 313, 335, 360, 384, 407, 430, 451, 470, 487, 501, 511 - </Vector> - - <Vector name="StartCopyNo_Back_Left" type="numeric" nEntries="27"> - 1, 4, 14, 28, 45, 64, 85, 107, 130, 154, 179, 201, 221, 241, 260, - 280, 300, 320, 343, 368, 392, 415, 437, 457, 475, 491, 504 - </Vector> - - <Vector name="Offset_Back_Right" type="numeric" nEntries="27"> - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset]+3*([SensorModule_X]+[DeltaX]), - [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+4*([SensorModule_X]+[DeltaX]), [x_offset],[x_offset], [x_offset], [x_offset], [x_offset], [x_offset], - [x_offset], [x_offset], [x_offset], [x_offset] - </Vector> - - <Vector name="Offset_Back_Left" type="numeric" nEntries="27"> - [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset]+4*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+8*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+7*([SensorModule_X]+[DeltaX]), [x_offset]+6*([SensorModule_X]+[DeltaX]), [x_offset]+3*([SensorModule_X]+[DeltaX]), [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset], [x_offset] - </Vector> - - <LogicalPartSection label="etl.xml"> <LogicalPart name="EndcapTimingLayer" category="unspecified"> <rSolid name="etl:EndcapTimingLayer"/> diff --git a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml index 77e8e6801a1a5..b60e666c2862f 100644 --- a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml @@ -8,10 +8,10 @@ <!--BTL inter-crystal gaps approximated to nearest integer value in microns--> <!--in y preserve total free space, move 0.5 microns for each inter-crystal to borders--> <Vector name="BTL" type="numeric" nEntries="12"> - 3733, 1867, 112, 60, 0, 0, 0, 0, 1, 16, 3, 1 + 0, 0, 0, 0, 3733, 1867, 112, 60, 1, 16, 3, 1 </Vector> <Vector name="ETL" type="numeric" nEntries="12"> - 50, 50, 50, 50, 0, 0, 0, 0, 16, 16, 2, 1 + 516, 516, 512, 513, 50, 50, 50, 50, 16, 16, 2, 1 </Vector> </ConstantsSection> diff --git a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc index a74e4644738d6..78263e7e226d7 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDGeomBuilderFromGeometricTimingDet.cc @@ -106,20 +106,20 @@ void MTDGeomBuilderFromGeometricTimingDet::buildPixel( int GAPxInterpad(0), GAPxBorder(0), GAPyInterpad(0), GAPyBorder(0); switch (det) { case GeomDetType::SubDetector::TimingBarrel: - GAPxInterpad = ptp.vitems_[0].vpars_[0]; // Value given in microns - GAPxBorder = ptp.vitems_[0].vpars_[1]; // Value given in microns - GAPyInterpad = ptp.vitems_[0].vpars_[2]; // Value given in microns - GAPyBorder = ptp.vitems_[0].vpars_[3]; // Value given in microns + GAPxInterpad = ptp.vitems_[0].vpars_[4]; // Value given in microns + GAPxBorder = ptp.vitems_[0].vpars_[5]; // Value given in microns + GAPyInterpad = ptp.vitems_[0].vpars_[6]; // Value given in microns + GAPyBorder = ptp.vitems_[0].vpars_[7]; // Value given in microns ROCrows = ptp.vitems_[0].vpars_[8]; ROCcols = ptp.vitems_[0].vpars_[9]; ROCSx = ptp.vitems_[0].vpars_[10]; ROCSy = ptp.vitems_[0].vpars_[11]; break; case GeomDetType::SubDetector::TimingEndcap: - GAPxInterpad = ptp.vitems_[1].vpars_[0]; - GAPxBorder = ptp.vitems_[1].vpars_[1]; - GAPyInterpad = ptp.vitems_[1].vpars_[2]; - GAPyBorder = ptp.vitems_[1].vpars_[3]; + GAPxInterpad = ptp.vitems_[1].vpars_[4]; + GAPxBorder = ptp.vitems_[1].vpars_[5]; + GAPyInterpad = ptp.vitems_[1].vpars_[6]; + GAPyBorder = ptp.vitems_[1].vpars_[7]; ROCrows = ptp.vitems_[1].vpars_[8]; ROCcols = ptp.vitems_[1].vpars_[9]; ROCSx = ptp.vitems_[1].vpars_[10]; diff --git a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc index cefcd6eda4a17..c54663d525fd2 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc @@ -34,9 +34,11 @@ bool MTDParametersFromDD::build(const DDCompactView* cvp, PMTDParameters& ptp) { for (const auto& name : mtdSubdet) { auto const& v = cvp->vector(name); if (!v.empty()) { - subdet += 1; + subdet++; std::vector<int> subdetPars = dbl_to_int(v); putOne(subdet, subdetPars, ptp); + } else { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; } } @@ -46,14 +48,39 @@ bool MTDParametersFromDD::build(const DDCompactView* cvp, PMTDParameters& ptp) { DDSpecificsHasNamedValueFilter filter1{attribute}; DDFilteredView fv1(*cvp, filter1); bool ok = fv1.firstChild(); + int topoMode(-1); if (ok) { DDsvalues_type sv(fv1.mergedSpecifics()); - int topoMode = getMTDTopologyMode("TopologyMode", sv); + topoMode = getMTDTopologyMode("TopologyMode", sv); ptp.topologyMode_ = topoMode; } else { throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed."; } + if (topoMode >= static_cast<int>(MTDTopologyMode::Mode::btlv1etlv5)) { + std::array<std::string, 8> etlLayout{{ + "StartCopyNo_Front_Left", + "StartCopyNo_Front_Right", + "StartCopyNo_Back_Left", + "StartCopyNo_Back_Right", + "Offset_Front_Left", + "Offset_Front_Right", + "Offset_Back_Left", + "Offset_Back_Right", + }}; + int sector(0); + for (const auto& name : etlLayout) { + auto const& v = cvp->vector(name); + if (!v.empty()) { + sector++; + std::vector<int> ipos = dbl_to_int(v); + putOne(sector, ipos, ptp); + } else { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; + } + } + } + return true; } @@ -61,17 +88,21 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p cms::DDVectorsMap vmap = cvp->detector()->vectors(); std::array<std::string, 2> mtdSubdet{{"BTL", "ETL"}}; - int subdet(0); + int subdet(0), oldsubdet(-1); for (const auto& name : mtdSubdet) { - subdet += 1; for (auto const& it : vmap) { if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) { + subdet++; + oldsubdet = subdet; std::vector<int> subdetPars; for (const auto& i : it.second) subdetPars.emplace_back(std::round(i)); putOne(subdet, subdetPars, ptp); } } + if (oldsubdet != subdet) { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; + } } auto it = vmap.find("vPars"); @@ -88,8 +119,8 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p mypar.filter(ref, attribute, "MTD"); std::string topoModeS(mypar.specPar("mtdNumbering")->strValue("TopologyMode")); + int topoMode(-1); if (!topoModeS.empty()) { - int topoMode(-1); MTDTopologyMode::Mode eparser = MTDTopologyMode::MTDStringToEnumParser(topoModeS); topoMode = static_cast<int>(eparser); ptp.topologyMode_ = topoMode; @@ -97,6 +128,36 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p throw cms::Exception("MTDParametersFromDD") << "Not found " << attribute.c_str() << " but needed."; } + if (topoMode >= static_cast<int>(MTDTopologyMode::Mode::btlv1etlv5)) { + std::array<std::string, 8> etlLayout{{ + "StartCopyNo_Front_Left", + "StartCopyNo_Front_Right", + "StartCopyNo_Back_Left", + "StartCopyNo_Back_Right", + "Offset_Front_Left", + "Offset_Front_Right", + "Offset_Back_Left", + "Offset_Back_Right", + }}; + int sector(0), oldsector(-1); + for (const auto& name : etlLayout) { + for (auto const& it : vmap) { + edm::LogWarning("MTDParametersFromDD") << name << " " << dd4hep::dd::noNamespace(it.first); + if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) { + sector++; + oldsector = sector; + std::vector<int> ipos; + for (const auto& i : it.second) + ipos.emplace_back(std::round(i)); + putOne(sector, ipos, ptp); + } + } + if (oldsector != sector) { + throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; + } + } + } + return true; } From cc39680bc30d4cf1fee263fc9ade2ad1f2e83f1d Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Mon, 26 Apr 2021 11:55:49 +0200 Subject: [PATCH 227/309] Add ETL structure information to MTDTopology --- Geometry/MTDCommonData/data/etl/v5/etl.xml | 36 +++++----- .../data/mtdParameters/v2/mtdParameters.xml | 2 +- .../src/MTDParametersFromDD.cc | 2 +- .../interface/MTDTopology.h | 17 ++++- .../plugins/MTDTopologyEP.cc | 65 +++++++++++++++++-- .../MTDNumberingBuilder/src/MTDTopology.cc | 3 +- 6 files changed, 96 insertions(+), 29 deletions(-) diff --git a/Geometry/MTDCommonData/data/etl/v5/etl.xml b/Geometry/MTDCommonData/data/etl/v5/etl.xml index 8526484d931fa..d4a5d623bd35a 100644 --- a/Geometry/MTDCommonData/data/etl/v5/etl.xml +++ b/Geometry/MTDCommonData/data/etl/v5/etl.xml @@ -65,40 +65,40 @@ <Constant name="Zpos2" value="0.*mm"/> <Constant name="xoffset_servicehybrid" value="1*mm"/> - <Vector name="StartCopyNo_Front_Right" type="numeric" nEntries="27"> + <Vector name="StartCopyNo_Front_Right" type="numeric" nEntries="28"> 1, 7, 18, 33, 50, 69, 90, 112, 136, 161, 186, 207, 227, 247, 266, - 285, 305, 325, 349, 374, 398, 421, 443, 463, 481, 497, 510 + 285, 305, 325, 349, 374, 398, 421, 443, 463, 481, 497, 510, 517 </Vector> - <Vector name="StartCopyNo_Front_Left" type="numeric" nEntries="27"> + <Vector name="StartCopyNo_Front_Left" type="numeric" nEntries="28"> 1, 8, 21, 37, 55, 75, 97, 120, 144, 169, 193, 213, 233, 252, 271, - 291, 311, 332, 357, 382, 406, 428, 449, 468, 485, 500, 511 + 291, 311, 332, 357, 382, 406, 428, 449, 468, 485, 500, 511, 517 </Vector> - <Vector name="Offset_Front_Right" type="numeric" nEntries="27"> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, 8, 7, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 + <Vector name="Offset_Front_Right" type="numeric" nEntries="28"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, 8, 7, 6, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 </Vector> - <Vector name="Offset_Front_Left" type="numeric" nEntries="27"> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 7, 8, 8, 7, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + <Vector name="Offset_Front_Left" type="numeric" nEntries="28"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 7, 8, 8, 7, 6, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 </Vector> - <Vector name="StartCopyNo_Back_Right" type="numeric" nEntries="27"> - 1, 10, 23, 39, 57, 77, 99, 122, 146, 171, 194, 214, 234, 254, 273, - 293, 313, 335, 360, 384, 407, 430, 451, 470, 487, 501, 511 + <Vector name="StartCopyNo_Back_Right" type="numeric" nEntries="28"> + 1, 10, 23, 39, 57, 77, 99, 122, 146, 171, 194, 214, 234, 254, 273, + 293, 313, 335, 360, 384, 407, 430, 451, 470, 487, 501, 511, 514 </Vector> - <Vector name="StartCopyNo_Back_Left" type="numeric" nEntries="27"> - 1, 4, 14, 28, 45, 64, 85, 107, 130, 154, 179, 201, 221, 241, 260, - 280, 300, 320, 343, 368, 392, 415, 437, 457, 475, 491, 504 + <Vector name="StartCopyNo_Back_Left" type="numeric" nEntries="28"> + 1, 4, 14, 28, 45, 64, 85, 107, 130, 154, 179, 201, 221, 241, 260, + 280, 300, 320, 343, 368, 392, 415, 437, 457, 475, 491, 504, 513 </Vector> - <Vector name="Offset_Back_Right" type="numeric" nEntries="27"> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 7, 7, 8, 7, 6, 4, 0,0, 0, 0, 0, 0, 0, 0, 0, 0 + <Vector name="Offset_Back_Right" type="numeric" nEntries="28"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 7, 7, 8, 7, 6, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 </Vector> - <Vector name="Offset_Back_Left" type="numeric" nEntries="27"> - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 8, 7, 7, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 + <Vector name="Offset_Back_Left" type="numeric" nEntries="28"> + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 6, 7, 8, 7, 7, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 </Vector> </ConstantsSection> diff --git a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml index b60e666c2862f..588d35ce11df0 100644 --- a/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/mtdParameters/v2/mtdParameters.xml @@ -11,7 +11,7 @@ 0, 0, 0, 0, 3733, 1867, 112, 60, 1, 16, 3, 1 </Vector> <Vector name="ETL" type="numeric" nEntries="12"> - 516, 516, 512, 513, 50, 50, 50, 50, 16, 16, 2, 1 + 0, 0, 0, 0, 50, 50, 50, 50, 16, 16, 2, 1 </Vector> </ConstantsSection> diff --git a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc index c54663d525fd2..d0e5eeaf0fcf2 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc @@ -142,7 +142,7 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p int sector(0), oldsector(-1); for (const auto& name : etlLayout) { for (auto const& it : vmap) { - edm::LogWarning("MTDParametersFromDD") << name << " " << dd4hep::dd::noNamespace(it.first); + edm::LogWarning("MTDParametersFromDD") << name << " " << dd4hep::dd::noNamespace(it.first); if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) { sector++; oldsector = sector; diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index 363230df0ba37..9a578d3a1c097 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -4,18 +4,33 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/ForwardDetId/interface/MTDDetId.h" +#include "DataFormats/ForwardDetId/interface/ETLDetId.h" #include <vector> #include <string> class MTDTopology { public: - MTDTopology(const int &topologyMode); + struct ETLfaceLayout { + int idDiscSide_; + int idDetType1_; + + std::vector<int> start_copy_1_; + std::vector<int> start_copy_2_; + std::vector<int> offset_1_; + std::vector<int> offset_2_; + }; + + using ETLValues = std::vector<ETLfaceLayout>; + + MTDTopology(const int& topologyMode, const ETLValues& etl); int getMTDTopologyMode() const { return mtdTopologyMode_; } private: const int mtdTopologyMode_; + + const ETLValues etlVals_; }; #endif diff --git a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc index 977b21b15c006..eff93473b153e 100644 --- a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc +++ b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc @@ -1,3 +1,5 @@ +//#define EDM_ML_DEBUG + #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" @@ -10,7 +12,6 @@ #include "Geometry/Records/interface/PMTDParametersRcd.h" #include <memory> -//#define EDM_ML_DEBUG class MTDTopologyEP : public edm::ESProducer { public: @@ -23,7 +24,7 @@ class MTDTopologyEP : public edm::ESProducer { ReturnType produce(const MTDTopologyRcd&); private: - void fillParameters(const PMTDParameters&, int& mtdTopologyMode); + void fillParameters(const PMTDParameters&, int& mtdTopologyMode, MTDTopology::ETLValues&); const edm::ESGetToken<PMTDParameters, PMTDParametersRcd> token_; }; @@ -38,18 +39,68 @@ void MTDTopologyEP::fillDescriptions(edm::ConfigurationDescriptions& description MTDTopologyEP::ReturnType MTDTopologyEP::produce(const MTDTopologyRcd& iRecord) { int mtdTopologyMode; + MTDTopology::ETLValues etlVals; - fillParameters(iRecord.get(token_), mtdTopologyMode); + fillParameters(iRecord.get(token_), mtdTopologyMode, etlVals); - return std::make_unique<MTDTopology>(mtdTopologyMode); + return std::make_unique<MTDTopology>(mtdTopologyMode, etlVals); } -void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMode) { +void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMode, MTDTopology::ETLValues& etlVals) { mtdTopologyMode = ptp.topologyMode_; -#ifdef EDM_ML_DEBUG + // Check on the internal consistency of thr ETL layour information provided by parameters + + for (size_t it = 3; it <= 9; it++) { + if (ptp.vitems_[it].vpars_.size() != ptp.vitems_[2].vpars_.size()) { + throw cms::Exception("MTDTopologyEP") << "Inconsistent size of ETL structure arrays"; + } + } + + MTDTopology::ETLfaceLayout tmpFace; + + // Front Face (0), starting with type Right (2) + + tmpFace.idDiscSide_ = 0; // ETL front side + tmpFace.idDetType1_ = 2; // ETL module type right - edm::LogInfo("MTDTopologyEP") << "Topology mode = " << mtdTopologyMode; + tmpFace.start_copy_1_ = ptp.vitems_[3].vpars_; // start_copy_FR + tmpFace.start_copy_2_ = ptp.vitems_[2].vpars_; // start_copy_FL + tmpFace.offset_1_ = ptp.vitems_[7].vpars_; // offset_FR + tmpFace.offset_2_ = ptp.vitems_[6].vpars_; // offset_FL + + etlVals.emplace_back(tmpFace); + + // Back Face (1), starting with type Left (1) + + tmpFace.idDiscSide_ = 1; // ETL back side + tmpFace.idDetType1_ = 1; // ETL module type left + + tmpFace.start_copy_1_ = ptp.vitems_[4].vpars_; // start_copy_BL + tmpFace.start_copy_2_ = ptp.vitems_[5].vpars_; // start_copy_BR + tmpFace.offset_1_ = ptp.vitems_[8].vpars_; // offset_BL + tmpFace.offset_2_ = ptp.vitems_[9].vpars_; // offset_BR + + etlVals.emplace_back(tmpFace); + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MTDTopologyEP") << " Topology mode = " << mtdTopologyMode << "\n"; + auto print_array = [&](std::vector<int> vector) { + std::stringstream ss; + for (auto const& elem : vector) { + ss << " " << elem; + } + ss << "\n"; + return ss.str(); + }; + + for (auto const& ilay : etlVals) { + edm::LogVerbatim("MTDTopologyEP") << " disc face = " << ilay.idDiscSide_ << " start det type = " << ilay.idDetType1_ + << "\n start_copy_1 = " << print_array(ilay.start_copy_1_) + << "\n start_copy_2 = " << print_array(ilay.start_copy_2_) + << "\n offset_1 = " << print_array(ilay.offset_1_) + << "\n offset_2 = " << print_array(ilay.offset_2_); + } #endif } diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 29cbf811a3412..964fb8f71f327 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -1,3 +1,4 @@ #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" -MTDTopology::MTDTopology(const int &topologyMode) : mtdTopologyMode_(topologyMode) {} +MTDTopology::MTDTopology(const int& topologyMode, const ETLValues& etl) + : mtdTopologyMode_(topologyMode), etlVals_(etl) {} From 29da161df3ff765d67d65470b369d25479763440 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Mon, 26 Apr 2021 12:54:39 +0200 Subject: [PATCH 228/309] Redefine face layour using array, development commit --- .../interface/MTDTopology.h | 21 +++++++--- .../plugins/MTDTopologyEP.cc | 24 +++++------ .../MTDNumberingBuilder/src/MTDTopology.cc | 42 +++++++++++++++++++ 3 files changed, 69 insertions(+), 18 deletions(-) diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index 9a578d3a1c097..49f73fd7d607f 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -5,6 +5,7 @@ #include "DataFormats/ForwardDetId/interface/ForwardSubdetector.h" #include "DataFormats/ForwardDetId/interface/MTDDetId.h" #include "DataFormats/ForwardDetId/interface/ETLDetId.h" +#include <Geometry/CommonDetUnit/interface/GeomDet.h> #include <vector> #include <string> @@ -12,13 +13,11 @@ class MTDTopology { public: struct ETLfaceLayout { - int idDiscSide_; - int idDetType1_; + int idDiscSide_; // disc face identifier + int idDetType1_; // module type id identifier for first row - std::vector<int> start_copy_1_; - std::vector<int> start_copy_2_; - std::vector<int> offset_1_; - std::vector<int> offset_2_; + std::array<std::vector<int>, 2> start_copy_; // start copy per row, first of type idDetType1_ + std::array<std::vector<int>, 2> offset_; // offset per row, first of type idDetType1_ }; using ETLValues = std::vector<ETLfaceLayout>; @@ -27,6 +26,16 @@ class MTDTopology { int getMTDTopologyMode() const { return mtdTopologyMode_; } + // ETL topology navigation is based on a predefined order of dets in sector + + bool orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2); + + // navigation methods in ETL topology, provide the index of the det next to DetId for + // horizontal and vertical shifts in both directions, assuming the predefined order in a sector + + //size_t hshiftETL(const uint32_t detid, const int horizontalShift) const; + //size_t vshiftETL(const uint32_t detid, const int verticalShift) const; + private: const int mtdTopologyMode_; diff --git a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc index eff93473b153e..953c7a43fd5c9 100644 --- a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc +++ b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc @@ -64,10 +64,10 @@ void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMo tmpFace.idDiscSide_ = 0; // ETL front side tmpFace.idDetType1_ = 2; // ETL module type right - tmpFace.start_copy_1_ = ptp.vitems_[3].vpars_; // start_copy_FR - tmpFace.start_copy_2_ = ptp.vitems_[2].vpars_; // start_copy_FL - tmpFace.offset_1_ = ptp.vitems_[7].vpars_; // offset_FR - tmpFace.offset_2_ = ptp.vitems_[6].vpars_; // offset_FL + tmpFace.start_copy_[0] = ptp.vitems_[3].vpars_; // start_copy_FR + tmpFace.start_copy_[1] = ptp.vitems_[2].vpars_; // start_copy_FL + tmpFace.offset_[0] = ptp.vitems_[7].vpars_; // offset_FR + tmpFace.offset_[1] = ptp.vitems_[6].vpars_; // offset_FL etlVals.emplace_back(tmpFace); @@ -76,10 +76,10 @@ void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMo tmpFace.idDiscSide_ = 1; // ETL back side tmpFace.idDetType1_ = 1; // ETL module type left - tmpFace.start_copy_1_ = ptp.vitems_[4].vpars_; // start_copy_BL - tmpFace.start_copy_2_ = ptp.vitems_[5].vpars_; // start_copy_BR - tmpFace.offset_1_ = ptp.vitems_[8].vpars_; // offset_BL - tmpFace.offset_2_ = ptp.vitems_[9].vpars_; // offset_BR + tmpFace.start_copy_[0] = ptp.vitems_[4].vpars_; // start_copy_BL + tmpFace.start_copy_[1] = ptp.vitems_[5].vpars_; // start_copy_BR + tmpFace.offset_[0] = ptp.vitems_[8].vpars_; // offset_BL + tmpFace.offset_[1] = ptp.vitems_[9].vpars_; // offset_BR etlVals.emplace_back(tmpFace); @@ -96,10 +96,10 @@ void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMo for (auto const& ilay : etlVals) { edm::LogVerbatim("MTDTopologyEP") << " disc face = " << ilay.idDiscSide_ << " start det type = " << ilay.idDetType1_ - << "\n start_copy_1 = " << print_array(ilay.start_copy_1_) - << "\n start_copy_2 = " << print_array(ilay.start_copy_2_) - << "\n offset_1 = " << print_array(ilay.offset_1_) - << "\n offset_2 = " << print_array(ilay.offset_2_); + << "\n start_copy[0]= " << print_array(ilay.start_copy_[0]) + << "\n start_copy[1]= " << print_array(ilay.start_copy_[1]) + << "\n offset[0]= " << print_array(ilay.offset_[0]) + << "\n offset[1]= " << print_array(ilay.offset_[1]); } #endif diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 964fb8f71f327..62b93152d6424 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -2,3 +2,45 @@ MTDTopology::MTDTopology(const int& topologyMode, const ETLValues& etl) : mtdTopologyMode_(topologyMode), etlVals_(etl) {} + +bool MTDTopology::orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2) { + ETLDetId det1(gd1->geographicalId().rawId()); + ETLDetId det2(gd2->geographicalId().rawId()); + + if (det1.mtdRR() != det2.mtdRR()) { + return det1.mtdRR() < det2.mtdRR(); + } else if (det1.modType() != det2.modType()) { + return det1.modType() < det2.modType(); + } else { + return det1.module() < det2.module(); + } +} + +//size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizonthalShift) const { + +//size_t returnIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure + +//ETLDetId start_mod(detid); + +//if (horizontalShift == 0) { +//edm::LogWarning("MTDTopology") << "asking of a null horizotalShift in ETL"; +//return returnIndex; +//} +//int hsh = horizonthalShift > 0 ? 1 : -1; + +//uint32_t module = start_mod.module(); +//uint32_t modtyp = start_mod.modType(); +//uint32_t discside = start_mod.discSide(); + +//// ilayout number coincides at present with disc face, use this + +//if ( etlVals_[discside].idDetType1_ == modtyp ) { +//for (size_t iloop = 0; iloop < start_copy_1_.size() - 1; iloop++ ) { +//if ( module >= start_copy_1_[iloop] && module < start_copy_1_[iloop+1] ) { ibin = iloop ; break; } +//} +//} else { +//for (size_t iloop = 0; iloop < start_copy_1_.size() - 1; iloop++ ) { +//if ( module >= start_copy_1_[iloop] && module < start_copy_1_[iloop+1] ) { ibin = iloop ; break; } +//} +//} +//} From d834b37031f42c25ff3587dca87536ce6cc7c680 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Mon, 26 Apr 2021 16:16:04 +0200 Subject: [PATCH 229/309] horizontal and vertical shift functions --- .../interface/MTDTopology.h | 8 +- .../MTDNumberingBuilder/src/MTDTopology.cc | 114 ++++++++++++++---- 2 files changed, 96 insertions(+), 26 deletions(-) diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index 49f73fd7d607f..cfb3cec943f3d 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -13,8 +13,8 @@ class MTDTopology { public: struct ETLfaceLayout { - int idDiscSide_; // disc face identifier - int idDetType1_; // module type id identifier for first row + uint32_t idDiscSide_; // disc face identifier + uint32_t idDetType1_; // module type id identifier for first row std::array<std::vector<int>, 2> start_copy_; // start copy per row, first of type idDetType1_ std::array<std::vector<int>, 2> offset_; // offset per row, first of type idDetType1_ @@ -33,8 +33,8 @@ class MTDTopology { // navigation methods in ETL topology, provide the index of the det next to DetId for // horizontal and vertical shifts in both directions, assuming the predefined order in a sector - //size_t hshiftETL(const uint32_t detid, const int horizontalShift) const; - //size_t vshiftETL(const uint32_t detid, const int verticalShift) const; + size_t hshiftETL(const uint32_t detid, const int horizontalShift) const; + size_t vshiftETL(const uint32_t detid, const int verticalShift) const; private: const int mtdTopologyMode_; diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 62b93152d6424..691eb585e9056 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -1,4 +1,5 @@ #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" MTDTopology::MTDTopology(const int& topologyMode, const ETLValues& etl) : mtdTopologyMode_(topologyMode), etlVals_(etl) {} @@ -16,31 +17,100 @@ bool MTDTopology::orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2) { } } -//size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizonthalShift) const { +size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) const { + size_t failIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure -//size_t returnIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure + ETLDetId start_mod(detid); -//ETLDetId start_mod(detid); + if (horizontalShift == 0) { + edm::LogWarning("MTDTopology") << "asking of a null horizotalShift in ETL"; + return failIndex; + } + int hsh = horizontalShift > 0 ? 1 : -1; + + int module = start_mod.module() + hsh; + uint32_t modtyp = start_mod.modType(); + uint32_t discside = start_mod.discSide(); + + // ilayout number coincides at present with disc face, use this + + size_t iHome = (modtyp == etlVals_[discside].idDetType1_) ? 0 : 1; + size_t iLeft = (etlVals_[discside].idDetType1_ == 1) ? 0 : 1; + + // for left type modules the position according to the default order is module - 1, for the rigth type modules the total number of left modules must be added + + size_t nmodLeft = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1; + + for (size_t iloop = 0; iloop < etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) { + if (module >= etlVals_[discside].start_copy_[iHome][iloop] && + module < etlVals_[discside].start_copy_[iHome][iloop + 1]) { + return module - 1 + nmodLeft; + } + } + + return failIndex; +} + +size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift) const { + size_t failIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure + + ETLDetId start_mod(detid); + + if (verticalShift == 0) { + edm::LogWarning("MTDTopology") << "asking of a null verticalShift in ETL"; + return failIndex; + } + int vsh = verticalShift > 0 ? 1 : -1; + + int module = start_mod.module(); + uint32_t modtyp = start_mod.modType(); + uint32_t discside = start_mod.discSide(); -//if (horizontalShift == 0) { -//edm::LogWarning("MTDTopology") << "asking of a null horizotalShift in ETL"; -//return returnIndex; -//} -//int hsh = horizonthalShift > 0 ? 1 : -1; + // ilayout number coincides at present with disc face, use this -//uint32_t module = start_mod.module(); -//uint32_t modtyp = start_mod.modType(); -//uint32_t discside = start_mod.discSide(); + size_t iHome = (modtyp == etlVals_[discside].idDetType1_) ? 0 : 1; + size_t iOther = (iHome == 0) ? 1 : 0; + size_t iLeft = (etlVals_[discside].idDetType1_ == 1) ? 0 : 1; -//// ilayout number coincides at present with disc face, use this + // for left type modules the position according to the default order is module - 1, for the rigth type modules the total number of left modules must be added -//if ( etlVals_[discside].idDetType1_ == modtyp ) { -//for (size_t iloop = 0; iloop < start_copy_1_.size() - 1; iloop++ ) { -//if ( module >= start_copy_1_[iloop] && module < start_copy_1_[iloop+1] ) { ibin = iloop ; break; } -//} -//} else { -//for (size_t iloop = 0; iloop < start_copy_1_.size() - 1; iloop++ ) { -//if ( module >= start_copy_1_[iloop] && module < start_copy_1_[iloop+1] ) { ibin = iloop ; break; } -//} -//} -//} + size_t nmodLeft = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1; + + size_t iBin(etlVals_[discside].start_copy_[iHome].size()); // never allowed + for (size_t iloop = 0; iloop < etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) { + if (module >= etlVals_[discside].start_copy_[iHome][iloop] && + module < etlVals_[discside].start_copy_[iHome][iloop + 1]) { + iBin = iloop; + break; + } + } + + if (iBin == etlVals_[discside].start_copy_[iHome].size()) { + edm::LogWarning("MTDTopology") << "Module number not compatible with layout, abort"; + return failIndex; + } + + // define the interval of interest for the other type according to the vertical shift sign + + int iBinOther(iBin); + if (iHome == 0 && vsh < 0) { + iBinOther--; + } + if (iHome == 1 && vsh > 0) { + iBinOther++; + } + if (iBinOther < 0 || iBinOther >= static_cast<int>(etlVals_[discside].start_copy_[iOther].size())) { + return failIndex; + } + + // determine the position of the other type corresponding to the same column of the home type, accounting for the possible different offsets + + int vpos = etlVals_[discside].offset_[iHome][iBin] + module - etlVals_[discside].start_copy_[iHome][iBin] - + etlVals_[discside].offset_[iOther][iBinOther]; + if (vpos < 0 || + vpos >= etlVals_[discside].offset_[iOther][iBinOther] + etlVals_[discside].start_copy_[iOther][iBinOther]) { + return failIndex; + } else { + return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 + nmodLeft; + } +} From 261114b903ec41a709735a5a118bb51166e0941a Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Tue, 27 Apr 2021 18:06:39 +0200 Subject: [PATCH 230/309] Update topology, use for MTDDetSector navigation, ok for hshift --- .../interface/MTDTopology.h | 2 +- .../MTDNumberingBuilder/src/MTDTopology.cc | 8 +- RecoMTD/DetLayers/BuildFile.xml | 1 + .../interface/ETLDetLayerGeometryBuilder.h | 12 +- RecoMTD/DetLayers/interface/MTDDetSector.h | 24 ++-- .../src/ETLDetLayerGeometryBuilder.cc | 32 ++--- RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc | 2 +- RecoMTD/DetLayers/src/MTDDetSector.cc | 91 +++++++++++---- RecoMTD/DetLayers/test/BuildFile.xml | 4 + RecoMTD/DetLayers/test/TestETLNavigation.cc | 109 ++++++++++++++++++ RecoMTD/DetLayers/test/mtd_cfg.py | 2 + 11 files changed, 227 insertions(+), 60 deletions(-) create mode 100644 RecoMTD/DetLayers/test/TestETLNavigation.cc diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index cfb3cec943f3d..c33f9255d872f 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -28,7 +28,7 @@ class MTDTopology { // ETL topology navigation is based on a predefined order of dets in sector - bool orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2); + static bool orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2); // navigation methods in ETL topology, provide the index of the det next to DetId for // horizontal and vertical shifts in both directions, assuming the predefined order in a sector diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 691eb585e9056..597768539058c 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -28,7 +28,7 @@ size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) c } int hsh = horizontalShift > 0 ? 1 : -1; - int module = start_mod.module() + hsh; + int module = start_mod.module(); uint32_t modtyp = start_mod.modType(); uint32_t discside = start_mod.discSide(); @@ -44,7 +44,11 @@ size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) c for (size_t iloop = 0; iloop < etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) { if (module >= etlVals_[discside].start_copy_[iHome][iloop] && module < etlVals_[discside].start_copy_[iHome][iloop + 1]) { - return module - 1 + nmodLeft; + if (module + hsh >= etlVals_[discside].start_copy_[iHome][iloop] && + module + hsh < etlVals_[discside].start_copy_[iHome][iloop + 1]) { + return module + hsh - 1 + nmodLeft; + } + break; } } diff --git a/RecoMTD/DetLayers/BuildFile.xml b/RecoMTD/DetLayers/BuildFile.xml index b64af40d3e429..da920315fbb6a 100644 --- a/RecoMTD/DetLayers/BuildFile.xml +++ b/RecoMTD/DetLayers/BuildFile.xml @@ -4,6 +4,7 @@ <use name="FWCore/Utilities"/> <use name="TrackingTools/DetLayers"/> <use name="Utilities/BinningTools"/> +<use name="Geometry/MTDNumberingBuilder"/> <use name="Geometry/MTDGeometryBuilder"/> <export> <lib name="1"/> diff --git a/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h b/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h index d218ded5ed597..1fa4a29844170 100644 --- a/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h +++ b/RecoMTD/DetLayers/interface/ETLDetLayerGeometryBuilder.h @@ -9,6 +9,7 @@ */ #include <Geometry/MTDGeometryBuilder/interface/MTDGeometry.h> +#include <Geometry/MTDNumberingBuilder/interface/MTDTopology.h> #include <vector> class DetLayer; @@ -22,7 +23,7 @@ class ETLDetLayerGeometryBuilder { /// return.first=forward (+Z), return.second=backward (-Z) /// both vectors are sorted inside-out static std::pair<std::vector<DetLayer*>, std::vector<DetLayer*> > buildLayers(const MTDGeometry& geo, - const int mtdTopologyMode); + const MTDTopology& topo); private: // Disable constructor - only static access is allowed. @@ -33,14 +34,11 @@ class ETLDetLayerGeometryBuilder { std::vector<unsigned>& rings, const MTDGeometry& geo); - static MTDSectorForwardDoubleLayer* buildLayerNew(int endcap, - int layer, - std::vector<unsigned>& sectors, - const MTDGeometry& geo); + static MTDSectorForwardDoubleLayer* buildLayerNew( + int endcap, int layer, std::vector<unsigned>& sectors, const MTDGeometry& geo, const MTDTopology& topo); static MTDDetRing* makeDetRing(std::vector<const GeomDet*>& geomDets); static bool isFront(int layer, int ring, int module); - static MTDDetSector* makeDetSector(std::vector<const GeomDet*>& geomDets); - static bool orderGeomDets(const GeomDet*&, const GeomDet*&); + static MTDDetSector* makeDetSector(std::vector<const GeomDet*>& geomDets, const MTDTopology& topo); }; #endif diff --git a/RecoMTD/DetLayers/interface/MTDDetSector.h b/RecoMTD/DetLayers/interface/MTDDetSector.h index 7dac4a2e2dc96..fa7c3dcd534a1 100644 --- a/RecoMTD/DetLayers/interface/MTDDetSector.h +++ b/RecoMTD/DetLayers/interface/MTDDetSector.h @@ -3,6 +3,7 @@ #include "TrackingTools/DetLayers/interface/GeometricSearchDet.h" #include "DataFormats/GeometrySurface/interface/BoundDiskSector.h" +#include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" #include <ostream> @@ -13,10 +14,12 @@ class MTDDetSector : public GeometricSearchDet { using GeometricSearchDet::GeometricSearchDet; /// Construct from iterators on GeomDet* - MTDDetSector(std::vector<const GeomDet*>::const_iterator first, std::vector<const GeomDet*>::const_iterator last); + MTDDetSector(std::vector<const GeomDet*>::const_iterator first, + std::vector<const GeomDet*>::const_iterator last, + const MTDTopology& topo); /// Construct from a vector of GeomDet* - MTDDetSector(const std::vector<const GeomDet*>& dets); + MTDDetSector(const std::vector<const GeomDet*>& dets, const MTDTopology& topo); ~MTDDetSector() override{}; @@ -49,6 +52,16 @@ class MTDDetSector : public GeometricSearchDet { const BoundDiskSector& specificSurface() const { return *theDiskS; } + void compatibleDetsLine(const size_t idetMin, + std::vector<DetWithState>& result, + const TrajectoryStateOnSurface& tsos, + const Propagator& prop, + const MeasurementEstimator& est, + GlobalPoint startPos) const; + + size_t hshift(const uint32_t detid, const int horizontalShift) const; + size_t vshift(const uint32_t detid, const int verticalShift) const; + protected: void setDisk(BoundDiskSector* diskS) { theDiskS = diskS; } @@ -62,12 +75,7 @@ class MTDDetSector : public GeometricSearchDet { ReferenceCountingPointer<BoundDiskSector> theDiskS; std::vector<const GeomDet*> theDets; - // Window of detid ordered modules around that closest to the track extrapolation on the sector surface - // needed to limit the size of the vector of distances to sort - // value 50 based on the possible mismatch of module number between adjacent - // modules, due to left-right type imparity - - static constexpr size_t detsRange = 50; + const MTDTopology* topo_; void init(); }; diff --git a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc index 83af5cda4e386..dd4baa0e1baf2 100644 --- a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc @@ -19,9 +19,10 @@ using namespace std; pair<vector<DetLayer*>, vector<DetLayer*> > ETLDetLayerGeometryBuilder::buildLayers(const MTDGeometry& geo, - const int mtdTopologyMode) { + const MTDTopology& topo) { vector<DetLayer*> result[2]; // one for each endcap + const int mtdTopologyMode = topo.getMTDTopologyMode(); if (mtdTopologyMode <= static_cast<int>(MTDTopologyMode::Mode::barphiflat)) { for (unsigned endcap = 0; endcap < 2; ++endcap) { // there is only one layer for ETL right now, maybe more later @@ -60,12 +61,15 @@ pair<vector<DetLayer*>, vector<DetLayer*> > ETLDetLayerGeometryBuilder::buildLay for (unsigned sector = 1; sector <= nSector; ++sector) { sectors.push_back(sector); } - MTDSectorForwardDoubleLayer* thelayer = buildLayerNew(endcap, layer, sectors, geo); + MTDSectorForwardDoubleLayer* thelayer = buildLayerNew(endcap, layer, sectors, geo, topo); if (thelayer) result[endcap].push_back(thelayer); } } } + // + // the first entry is Z+ ( MTD side 1), the second is Z- (MTD side 0) + // pair<vector<DetLayer*>, vector<DetLayer*> > res_pair(result[1], result[0]); return res_pair; } @@ -133,10 +137,8 @@ MTDDetRing* ETLDetLayerGeometryBuilder::makeDetRing(vector<const GeomDet*>& geom return result; } -MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew(int endcap, - int layer, - vector<unsigned>& sectors, - const MTDGeometry& geo) { +MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew( + int endcap, int layer, vector<unsigned>& sectors, const MTDGeometry& geo, const MTDTopology& topo) { MTDSectorForwardDoubleLayer* result = nullptr; std::vector<const MTDDetSector*> frontSectors, backSectors; @@ -176,15 +178,17 @@ MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew(int endca } if (!backGeomDets.empty()) { - std::sort(backGeomDets.begin(), backGeomDets.end(), orderGeomDets); + //std::sort(backGeomDets.begin(), backGeomDets.end(), orderGeomDets); + std::sort(backGeomDets.begin(), backGeomDets.end(), topo.orderETLSector); LogDebug("MTDDetLayers") << "backGeomDets size = " << backGeomDets.size(); - backSectors.emplace_back(makeDetSector(backGeomDets)); + backSectors.emplace_back(makeDetSector(backGeomDets, topo)); } if (!frontGeomDets.empty()) { - std::sort(frontGeomDets.begin(), frontGeomDets.end(), orderGeomDets); + //std::sort(frontGeomDets.begin(), frontGeomDets.end(), orderGeomDets); + std::sort(frontGeomDets.begin(), frontGeomDets.end(), topo.orderETLSector); LogDebug("MTDDetLayers") << "frontGeomDets size = " << frontGeomDets.size(); - frontSectors.emplace_back(makeDetSector(frontGeomDets)); + frontSectors.emplace_back(makeDetSector(frontGeomDets, topo)); assert(!backGeomDets.empty()); float frontz = frontSectors.back()->position().z(); float backz = backSectors.back()->position().z(); @@ -202,15 +206,11 @@ MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew(int endca return result; } -MTDDetSector* ETLDetLayerGeometryBuilder::makeDetSector(vector<const GeomDet*>& geomDets) { - MTDDetSector* result = new MTDDetSector(geomDets); +MTDDetSector* ETLDetLayerGeometryBuilder::makeDetSector(vector<const GeomDet*>& geomDets, const MTDTopology& topo) { + MTDDetSector* result = new MTDDetSector(geomDets, topo); LogTrace("MTDDetLayers") << "ETLDetLayerGeometryBuilder::makeDetSector new MTDDetSector with " << std::fixed << std::setw(14) << geomDets.size() << " modules \n" << (*result); return result; } - -bool ETLDetLayerGeometryBuilder::orderGeomDets(const GeomDet*& gd1, const GeomDet*& gd2) { - return gd1->geographicalId().rawId() < gd2->geographicalId().rawId(); -} diff --git a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc index 61e92406557e8..63308e55b10f2 100644 --- a/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc +++ b/RecoMTD/DetLayers/src/MTDDetLayerGeometry.cc @@ -33,7 +33,7 @@ void MTDDetLayerGeometry::buildLayers(const MTDGeometry* geo, const MTDTopology* this->addBTLLayers(BTLDetLayerGeometryBuilder::buildLayers(*geo)); // Build ETL layers, depends on the scenario if (mtopo) { - this->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*geo, mtopo->getMTDTopologyMode())); + this->addETLLayers(ETLDetLayerGeometryBuilder::buildLayers(*geo, *mtopo)); } else { LogWarning("MTDDetLayers") << "No MTD topology is available."; } diff --git a/RecoMTD/DetLayers/src/MTDDetSector.cc b/RecoMTD/DetLayers/src/MTDDetSector.cc index 286844aee4ab3..5ffaeb1c873cd 100644 --- a/RecoMTD/DetLayers/src/MTDDetSector.cc +++ b/RecoMTD/DetLayers/src/MTDDetSector.cc @@ -1,6 +1,7 @@ -//#define EDM_ML_DEBUG +#define EDM_ML_DEBUG #include "RecoMTD/DetLayers/interface/MTDDetSector.h" +#include "DataFormats/ForwardDetId/interface/ETLDetId.h" #include "Geometry/CommonDetUnit/interface/GeomDet.h" #include "TrackingTools/GeomPropagators/interface/Propagator.h" #include "TrackingTools/DetLayers/interface/MeasurementEstimator.h" @@ -14,12 +15,17 @@ using namespace std; -MTDDetSector::MTDDetSector(vector<const GeomDet*>::const_iterator first, vector<const GeomDet*>::const_iterator last) - : GeometricSearchDet(false), theDets(first, last) { +MTDDetSector::MTDDetSector(vector<const GeomDet*>::const_iterator first, + vector<const GeomDet*>::const_iterator last, + const MTDTopology& topo) + : GeometricSearchDet(false), theDets(first, last), topo_(&topo) { init(); } -MTDDetSector::MTDDetSector(const vector<const GeomDet*>& vdets) : GeometricSearchDet(false), theDets(vdets) { init(); } +MTDDetSector::MTDDetSector(const vector<const GeomDet*>& vdets, const MTDTopology& topo) + : GeometricSearchDet(false), theDets(vdets), topo_(&topo) { + init(); +} void MTDDetSector::init() { // Add here the sector build based on a collection of GeomDets, mimic what done in ForwardDetRingOneZ @@ -79,7 +85,8 @@ vector<GeometricSearchDet::DetWithState> MTDDetSector::compatibleDets(const Traj TrajectoryStateOnSurface& tsos = compat.second; GlobalPoint startPos = tsos.globalPosition(); - LogTrace("MTDDetLayers") << "Starting position: " << startPos; + LogTrace("MTDDetLayers") << "Starting position: " << startPos << " starting p/pT: " << tsos.globalMomentum().mag() + << " / " << tsos.globalMomentum().perp(); // determine distance of det center from extrapolation on the surface, sort dets accordingly @@ -95,30 +102,30 @@ vector<GeometricSearchDet::DetWithState> MTDDetSector::compatibleDets(const Traj dist2Min = dist2; idetMin = idet; } - LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets " << std::fixed << std::setw(8) << idet << " " - << theDets[idet]->geographicalId().rawId() << " dist = " << std::setw(10) - << std::sqrt(dist2) << " Min idet/dist = " << std::setw(8) << idetMin << " " - << std::setw(10) << std::sqrt(dist2Min) << " " << theDets[idet]->position(); } - // loop on an interval od ordered detIds around the minimum - // set a range of GeomDets around the minimum compatible with the geometry of ETL - - size_t iniPos(idetMin > detsRange ? idetMin - detsRange : static_cast<size_t>(0)); - size_t endPos(std::min(idetMin + detsRange, basicComponents().size() - 1)); - tmpDets.erase(tmpDets.begin() + endPos, tmpDets.end()); - tmpDets.erase(tmpDets.begin(), tmpDets.begin() + iniPos); - std::sort(tmpDets.begin(), tmpDets.end()); - - for (const auto& thisDet : tmpDets) { - if (add(thisDet.second, result, tsos, prop, est)) { - LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det " << thisDet.second - << " detId = " << theDets[thisDet.second]->geographicalId().rawId() << " at " - << theDets[thisDet.second]->position() << " dist = " << std::sqrt(thisDet.first); - } else { - break; + //look for the compatibledets considering each line of the sector + + if (add(idetMin, result, tsos, prop, est)) { + compatibleDetsLine(idetMin, result, tsos, prop, est, startPos); + + for (int iside = -1; iside <= 1; iside += 2) { + bool isCompatible(true); + size_t idetNew(idetMin); + + while (isCompatible) { + idetNew = vshift(theDets[idetNew]->geographicalId().rawId(), iside); + if (idetNew >= theDets.size()) { + break; + } + isCompatible = add(idetNew, result, tsos, prop, est); + if (isCompatible) { + compatibleDetsLine(idetNew, result, tsos, prop, est, startPos); + } + } } } + #ifdef EDM_ML_DEBUG if (result.empty()) { LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets, closest not compatible!"; @@ -156,6 +163,10 @@ bool MTDDetSector::add(size_t idet, if (compat.first) { result.push_back(DetWithState(theDets[idet], compat.second)); + LogTrace("MTDDetLayers") << "MTDDetSector::compatibleDets found compatible det idetMin " << idet + << " detId = " << theDets[idet]->geographicalId().rawId() << " at " + << theDets[idet]->position() + << " dist = " << std::sqrt((tsos.globalPosition() - theDets[idet]->position()).mag2()); } return compat.first; @@ -172,3 +183,33 @@ std::ostream& operator<<(std::ostream& os, const MTDDetSector& id) { << " phi w/2 : " << std::setw(14) << id.specificSurface().phiHalfExtension() << std::endl; return os; } + +void MTDDetSector::compatibleDetsLine(const size_t idetMin, + vector<DetWithState>& result, + const TrajectoryStateOnSurface& tsos, + const Propagator& prop, + const MeasurementEstimator& est, + GlobalPoint startPos) const { + for (int iside = -1; iside <= 1; iside += 2) { + bool isCompatible(true); + size_t idetNew(idetMin); + + while (isCompatible) { + idetNew = hshift(theDets[idetNew]->geographicalId().rawId(), iside); + if (idetNew >= theDets.size()) { + break; + } + isCompatible = add(idetNew, result, tsos, prop, est); + } + } + + return; +} + +size_t MTDDetSector::hshift(const uint32_t detid, const int horizontalShift) const { + return topo_->hshiftETL(detid, horizontalShift); +} + +size_t MTDDetSector::vshift(const uint32_t detid, const int verticalShift) const { + return topo_->vshiftETL(detid, verticalShift); +} diff --git a/RecoMTD/DetLayers/test/BuildFile.xml b/RecoMTD/DetLayers/test/BuildFile.xml index 2d8892ffe2fd8..51d0ecc1b6787 100644 --- a/RecoMTD/DetLayers/test/BuildFile.xml +++ b/RecoMTD/DetLayers/test/BuildFile.xml @@ -10,4 +10,8 @@ <use name="MagneticField/Engine"/> <use name="Geometry/MTDNumberingBuilder"/> <use name="Geometry/Records"/> + <flags EDM_PLUGIN="1"/> +</library> +<library file="TestETLNavigation.cc" name="testETLNavigation"> + <flags EDM_PLUGIN="1"/> </library> diff --git a/RecoMTD/DetLayers/test/TestETLNavigation.cc b/RecoMTD/DetLayers/test/TestETLNavigation.cc new file mode 100644 index 0000000000000..7432e3f2a641a --- /dev/null +++ b/RecoMTD/DetLayers/test/TestETLNavigation.cc @@ -0,0 +1,109 @@ +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESTransientHandle.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "RecoMTD/DetLayers/interface/MTDDetLayerGeometry.h" +#include "RecoMTD/Records/interface/MTDRecoGeometryRecord.h" + +#include "RecoMTD/DetLayers/interface/MTDSectorForwardDoubleLayer.h" +#include "RecoMTD/DetLayers/interface/MTDDetSector.h" + +#include <DataFormats/ForwardDetId/interface/ETLDetId.h> + +#include <sstream> + +using namespace std; +using namespace edm; + +class TestETLNavigation : public EDAnalyzer { +public: + TestETLNavigation(const ParameterSet& pset); + + void analyze(const Event& ev, const EventSetup& es) override; + +private: + const edm::ESInputTag tag_; + edm::ESGetToken<MTDDetLayerGeometry, MTDRecoGeometryRecord> geomToken_; +}; + +TestETLNavigation::TestETLNavigation(const ParameterSet& iConfig) : tag_(edm::ESInputTag{"", ""}) { + geomToken_ = esConsumes<MTDDetLayerGeometry, MTDRecoGeometryRecord>(tag_); +} + +void TestETLNavigation::analyze(const Event& ev, const EventSetup& es) { + auto geo = es.getTransientHandle(geomToken_); + + const vector<const DetLayer*>& layers = geo->allETLLayers(); + + // dump of ETL layers structure + + LogInfo("MTDLayerDump") << "Test of ETL navigation \n\n"; + + for (const auto& ilay : layers) { + const MTDSectorForwardDoubleLayer* layer = static_cast<const MTDSectorForwardDoubleLayer*>(ilay); + + LogVerbatim("MTDLayerDump") << std::fixed << "\nETL layer " << std::setw(4) << layer->subDetector() + << " at z = " << std::setw(14) << layer->surface().position().z() + << " sectors = " << std::setw(14) << layer->sectors().size() + << " dets = " << std::setw(14) << layer->basicComponents().size() + << " front dets = " << std::setw(14) << layer->frontLayer()->basicComponents().size() + << " back dets = " << std::setw(14) << layer->backLayer()->basicComponents().size(); + + unsigned int isectInd(0); + for (const auto& isector : layer->sectors()) { + isectInd++; + LogVerbatim("MTDLayerDump") << std::fixed << "\nSector " << std::setw(4) << isectInd << "\n" << (*isector); + unsigned int imodInd(0); + for (const auto& imod : isector->basicComponents()) { + imodInd++; + ETLDetId modId(imod->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") << std::fixed << std::setw(5) << imodInd << " ETLDetId " << modId.rawId() + << " side = " << std::setw(4) << modId.mtdSide() + << " Disc/Side/Sector = " << std::setw(4) << modId.nDisc() << " " << std::setw(4) + << modId.discSide() << " " << std::setw(4) << modId.sector() + << " mod/type = " << std::setw(4) << modId.module() << " " << std::setw(4) + << modId.modType() << " pos = " << imod->position(); + for (int iside = -1; iside <= 1; iside += 2) { + size_t idetNew = isector->hshift(modId, iside); + if (idetNew >= isector->basicComponents().size()) { + LogVerbatim("MTDLayerDump") << "...............hshift= " << std::fixed << std::setw(2) << iside + << " out of range"; + } else { + ETLDetId newId(isector->basicComponents()[idetNew]->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") << std::fixed << "...............hshift= " << std::setw(2) << iside + << " side = " << std::setw(4) << newId.mtdSide() + << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " + << std::setw(4) << newId.discSide() << " " << std::setw(4) << newId.sector() + << " mod/type = " << std::setw(4) << newId.module() << " " << std::setw(4) + << newId.modType() + << " pos = " << isector->basicComponents()[idetNew]->position(); + } + } + for (int iside = -1; iside <= 1; iside += 2) { + size_t idetNew = isector->vshift(modId, iside); + if (idetNew >= isector->basicComponents().size()) { + LogVerbatim("MTDLayerDump") << "...............vshift= " << std::fixed << std::setw(2) << iside + << " out of range"; + } else { + ETLDetId newId(isector->basicComponents()[idetNew]->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") << std::fixed << "...............vshift= " << std::setw(2) << iside + << " side = " << std::setw(4) << newId.mtdSide() + << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " + << std::setw(4) << newId.discSide() << " " << std::setw(4) << newId.sector() + << " mod/type = " << std::setw(4) << newId.module() << " " << std::setw(4) + << newId.modType() + << " pos = " << isector->basicComponents()[idetNew]->position(); + } + } + } + } + } +} + +//define this as a plug-in +#include <FWCore/Framework/interface/MakerMacros.h> +DEFINE_FWK_MODULE(TestETLNavigation); diff --git a/RecoMTD/DetLayers/test/mtd_cfg.py b/RecoMTD/DetLayers/test/mtd_cfg.py index 36f1c074d2571..48b5d3067fe2e 100644 --- a/RecoMTD/DetLayers/test/mtd_cfg.py +++ b/RecoMTD/DetLayers/test/mtd_cfg.py @@ -44,5 +44,7 @@ process.Timing = cms.Service("Timing") process.prod = cms.EDAnalyzer("MTDRecoGeometryAnalyzer") +process.prod1 = cms.EDAnalyzer("TestETLNavigation") process.p1 = cms.Path(process.prod) +process.p1 = cms.Path(process.prod+process.prod1) From 41b2e97a2c1310f54cfdc5eb3ac94e58535b7adb Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Thu, 29 Apr 2021 10:47:51 +0200 Subject: [PATCH 231/309] Fixes to the vertical navigation --- .../MTDNumberingBuilder/src/MTDTopology.cc | 32 +++++++++++-------- RecoMTD/DetLayers/test/mtd_cfg.py | 1 - 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 597768539058c..98d35bd61193c 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -39,14 +39,14 @@ size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) c // for left type modules the position according to the default order is module - 1, for the rigth type modules the total number of left modules must be added - size_t nmodLeft = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1; + size_t nmodOffset = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1; for (size_t iloop = 0; iloop < etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) { if (module >= etlVals_[discside].start_copy_[iHome][iloop] && module < etlVals_[discside].start_copy_[iHome][iloop + 1]) { if (module + hsh >= etlVals_[discside].start_copy_[iHome][iloop] && module + hsh < etlVals_[discside].start_copy_[iHome][iloop + 1]) { - return module + hsh - 1 + nmodLeft; + return module + hsh - 1 + nmodOffset; } break; } @@ -76,9 +76,10 @@ size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift) con size_t iOther = (iHome == 0) ? 1 : 0; size_t iLeft = (etlVals_[discside].idDetType1_ == 1) ? 0 : 1; - // for left type modules the position according to the default order is module - 1, for the rigth type modules the total number of left modules must be added + // for right type modules the offset of the total number of left modules needs to be added, + // what matters here is the other type, i.e. if the starting module is left the vertical shift moves towards a right type, and viceversa - size_t nmodLeft = (modtyp == 1) ? 0 : etlVals_[discside].start_copy_[iLeft].back() - 1; + size_t nmodOffset = (modtyp == 1) ? etlVals_[discside].start_copy_[iLeft].back() - 1 : 0; size_t iBin(etlVals_[discside].start_copy_[iHome].size()); // never allowed for (size_t iloop = 0; iloop < etlVals_[discside].start_copy_[iHome].size() - 1; iloop++) { @@ -98,23 +99,28 @@ size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift) con int iBinOther(iBin); if (iHome == 0 && vsh < 0) { - iBinOther--; + iBinOther = iBin - 1; } if (iHome == 1 && vsh > 0) { - iBinOther++; + iBinOther = iBin + 1; } - if (iBinOther < 0 || iBinOther >= static_cast<int>(etlVals_[discside].start_copy_[iOther].size())) { + if (iBinOther < 0 || iBinOther >= static_cast<int>(etlVals_[discside].start_copy_[iOther].size()) - 1) { return failIndex; } - // determine the position of the other type corresponding to the same column of the home type, accounting for the possible different offsets + // determine the position of the other type corresponding to the same column of the home type - int vpos = etlVals_[discside].offset_[iHome][iBin] + module - etlVals_[discside].start_copy_[iHome][iBin] - - etlVals_[discside].offset_[iOther][iBinOther]; - if (vpos < 0 || - vpos >= etlVals_[discside].offset_[iOther][iBinOther] + etlVals_[discside].start_copy_[iOther][iBinOther]) { + int vpos = etlVals_[discside].offset_[iHome][iBin] + module - etlVals_[discside].start_copy_[iHome][iBin] + 1; + if (vpos <= etlVals_[discside].offset_[iOther][iBinOther] || + vpos > etlVals_[discside].offset_[iOther][iBinOther] + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - + etlVals_[discside].start_copy_[iOther][iBinOther] || + (vpos == etlVals_[discside].offset_[iOther][iBinOther] + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - + etlVals_[discside].start_copy_[iOther][iBinOther] && + iBinOther + 1 == static_cast<int>(etlVals_[discside].start_copy_[iOther].size()))) { return failIndex; } else { - return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 + nmodLeft; + // number of module shifted by 1 wrt the position in the array (i.e. module 1 has index 0) + return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 - + etlVals_[discside].offset_[iOther][iBinOther] + nmodOffset - 1; } } diff --git a/RecoMTD/DetLayers/test/mtd_cfg.py b/RecoMTD/DetLayers/test/mtd_cfg.py index 48b5d3067fe2e..ceebc643728f2 100644 --- a/RecoMTD/DetLayers/test/mtd_cfg.py +++ b/RecoMTD/DetLayers/test/mtd_cfg.py @@ -46,5 +46,4 @@ process.prod = cms.EDAnalyzer("MTDRecoGeometryAnalyzer") process.prod1 = cms.EDAnalyzer("TestETLNavigation") -process.p1 = cms.Path(process.prod) process.p1 = cms.Path(process.prod+process.prod1) From f11f2407536172016a0f17e77909879fb6fad07b Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Thu, 29 Apr 2021 11:48:39 +0200 Subject: [PATCH 232/309] Turn test of REcoMTD/DetLayers into a unit test, reference to be provided in Geometry/TestReference --- RecoMTD/DetLayers/test/BuildFile.xml | 2 ++ RecoMTD/DetLayers/test/TestETLNavigation.cc | 2 +- RecoMTD/DetLayers/test/mtd_cfg.py | 28 +++++++++++++-- RecoMTD/DetLayers/test/runTest.sh | 39 +++++++++++++++++++++ 4 files changed, 68 insertions(+), 3 deletions(-) create mode 100755 RecoMTD/DetLayers/test/runTest.sh diff --git a/RecoMTD/DetLayers/test/BuildFile.xml b/RecoMTD/DetLayers/test/BuildFile.xml index 51d0ecc1b6787..c9fb7147c279b 100644 --- a/RecoMTD/DetLayers/test/BuildFile.xml +++ b/RecoMTD/DetLayers/test/BuildFile.xml @@ -15,3 +15,5 @@ <library file="TestETLNavigation.cc" name="testETLNavigation"> <flags EDM_PLUGIN="1"/> </library> + +<test name="RecoMTDDetLayersTestDriver" command="runTest.sh"/> diff --git a/RecoMTD/DetLayers/test/TestETLNavigation.cc b/RecoMTD/DetLayers/test/TestETLNavigation.cc index 7432e3f2a641a..0256c04a10124 100644 --- a/RecoMTD/DetLayers/test/TestETLNavigation.cc +++ b/RecoMTD/DetLayers/test/TestETLNavigation.cc @@ -41,7 +41,7 @@ void TestETLNavigation::analyze(const Event& ev, const EventSetup& es) { // dump of ETL layers structure - LogInfo("MTDLayerDump") << "Test of ETL navigation \n\n"; + LogVerbatim("MTDLayerDump") << "\n\nTest of ETL navigation \n\n"; for (const auto& ilay : layers) { const MTDSectorForwardDoubleLayer* layer = static_cast<const MTDSectorForwardDoubleLayer*>(ilay); diff --git a/RecoMTD/DetLayers/test/mtd_cfg.py b/RecoMTD/DetLayers/test/mtd_cfg.py index ceebc643728f2..c65207ec83756 100644 --- a/RecoMTD/DetLayers/test/mtd_cfg.py +++ b/RecoMTD/DetLayers/test/mtd_cfg.py @@ -10,8 +10,8 @@ process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.debugModules = cms.untracked.vstring("*") -process.MessageLogger.files.debugs = cms.untracked.PSet( - threshold = cms.untracked.string('DEBUG'), +process.MessageLogger.cout = cms.untracked.PSet( + threshold = cms.untracked.string('INFO'), INFO= cms.untracked.PSet( limit = cms.untracked.int32(0) ), @@ -26,6 +26,30 @@ ), enableStatistics = cms.untracked.bool(True) ) +process.MessageLogger.files.mtdDetLayerGeometry = cms.untracked.PSet( + MTDLayerDump = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ), + MTDDetLayers = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ), + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO')) # Choose Tracker Geometry process.load("Configuration.Geometry.GeometryExtended2026D76_cff") diff --git a/RecoMTD/DetLayers/test/runTest.sh b/RecoMTD/DetLayers/test/runTest.sh new file mode 100755 index 0000000000000..490b4b42d9f8e --- /dev/null +++ b/RecoMTD/DetLayers/test/runTest.sh @@ -0,0 +1,39 @@ +#!/bin/sh -e + +function die { echo $1: status $2 ; exit $2; } +function checkDiff { + FSIZE=$(stat -c%s "$1") + echo "The output diff is $FSIZE:" + cat $1; + if [ $FSIZE -gt 0 ] + then + exit -1; + fi +} + +TEST_DIR=src/RecoMTD/DetLayers/test + +F1=${TEST_DIR}/mtd_cfg.py + +REF_FILE="Geometry/TestReference/data/mtdDetLayerGeometryRef.log.gz" +REF="" +for d in $(echo $CMSSW_SEARCH_PATH | tr ':' '\n') ; do + if [ -e "${d}/${REF_FILE}" ] ; then + REF="${d}/${REF_FILE}" + break + fi +done +[ -z $REF ] && exit 1 + +FILE1=mtdDetLayerGeometry.log +LOG=mtddlglog +DIF=mtddlgdif + +echo " testing RecoMTD/DetLayers" + +echo "===== Test \"cmsRun mtd_cfg.py\" ====" +rm -f $LOG $DIF $FILE1 + +cmsRun $F1 >& $LOG || die "Failure using cmsRun $F1" $? +gzip -f $FILE1 || die "$FILE1 compression fail" $? +(zdiff $FILE1.gz $REF >& $DIF || [ -s $DIF ] && checkDiff $DIF || echo "OK") || die "Failure in comparison for $FILE1" $? From 4c0223058f3c3f044e5c8fd480027e09ca561dea Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Thu, 29 Apr 2021 12:49:49 +0200 Subject: [PATCH 233/309] Remove useless argument in compatibleDetsLine --- RecoMTD/DetLayers/interface/MTDDetSector.h | 3 +-- RecoMTD/DetLayers/src/MTDDetSector.cc | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/RecoMTD/DetLayers/interface/MTDDetSector.h b/RecoMTD/DetLayers/interface/MTDDetSector.h index fa7c3dcd534a1..723fbdbb728fd 100644 --- a/RecoMTD/DetLayers/interface/MTDDetSector.h +++ b/RecoMTD/DetLayers/interface/MTDDetSector.h @@ -56,8 +56,7 @@ class MTDDetSector : public GeometricSearchDet { std::vector<DetWithState>& result, const TrajectoryStateOnSurface& tsos, const Propagator& prop, - const MeasurementEstimator& est, - GlobalPoint startPos) const; + const MeasurementEstimator& est) const; size_t hshift(const uint32_t detid, const int horizontalShift) const; size_t vshift(const uint32_t detid, const int verticalShift) const; diff --git a/RecoMTD/DetLayers/src/MTDDetSector.cc b/RecoMTD/DetLayers/src/MTDDetSector.cc index 5ffaeb1c873cd..e7682692b21f9 100644 --- a/RecoMTD/DetLayers/src/MTDDetSector.cc +++ b/RecoMTD/DetLayers/src/MTDDetSector.cc @@ -107,7 +107,7 @@ vector<GeometricSearchDet::DetWithState> MTDDetSector::compatibleDets(const Traj //look for the compatibledets considering each line of the sector if (add(idetMin, result, tsos, prop, est)) { - compatibleDetsLine(idetMin, result, tsos, prop, est, startPos); + compatibleDetsLine(idetMin, result, tsos, prop, est); for (int iside = -1; iside <= 1; iside += 2) { bool isCompatible(true); @@ -120,7 +120,7 @@ vector<GeometricSearchDet::DetWithState> MTDDetSector::compatibleDets(const Traj } isCompatible = add(idetNew, result, tsos, prop, est); if (isCompatible) { - compatibleDetsLine(idetNew, result, tsos, prop, est, startPos); + compatibleDetsLine(idetNew, result, tsos, prop, est); } } } @@ -188,8 +188,7 @@ void MTDDetSector::compatibleDetsLine(const size_t idetMin, vector<DetWithState>& result, const TrajectoryStateOnSurface& tsos, const Propagator& prop, - const MeasurementEstimator& est, - GlobalPoint startPos) const { + const MeasurementEstimator& est) const { for (int iside = -1; iside <= 1; iside += 2) { bool isCompatible(true); size_t idetNew(idetMin); From a69d1b5bbc574b6d49d7a126a2934fd93b09c193 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Thu, 29 Apr 2021 17:19:17 +0200 Subject: [PATCH 234/309] Update for missing vshift, provide and use ifno about closest module in row if present --- .../interface/MTDTopology.h | 2 +- .../MTDNumberingBuilder/src/MTDTopology.cc | 22 +++++++++++++------ RecoMTD/DetLayers/interface/MTDDetSector.h | 2 +- RecoMTD/DetLayers/src/MTDDetSector.cc | 13 +++++++---- RecoMTD/DetLayers/test/TestETLNavigation.cc | 12 +++++++++- 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index c33f9255d872f..4ee4dd10f00b5 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -34,7 +34,7 @@ class MTDTopology { // horizontal and vertical shifts in both directions, assuming the predefined order in a sector size_t hshiftETL(const uint32_t detid, const int horizontalShift) const; - size_t vshiftETL(const uint32_t detid, const int verticalShift) const; + size_t vshiftETL(const uint32_t detid, const int verticalShift, size_t& closest) const; private: const int mtdTopologyMode_; diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 98d35bd61193c..ee2ba1bd67264 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -55,8 +55,9 @@ size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) c return failIndex; } -size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift) const { +size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift, size_t& closest) const { size_t failIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure + closest = failIndex; ETLDetId start_mod(detid); @@ -111,12 +112,19 @@ size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift) con // determine the position of the other type corresponding to the same column of the home type int vpos = etlVals_[discside].offset_[iHome][iBin] + module - etlVals_[discside].start_copy_[iHome][iBin] + 1; - if (vpos <= etlVals_[discside].offset_[iOther][iBinOther] || - vpos > etlVals_[discside].offset_[iOther][iBinOther] + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - - etlVals_[discside].start_copy_[iOther][iBinOther] || - (vpos == etlVals_[discside].offset_[iOther][iBinOther] + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - - etlVals_[discside].start_copy_[iOther][iBinOther] && - iBinOther + 1 == static_cast<int>(etlVals_[discside].start_copy_[iOther].size()))) { + if (vpos <= etlVals_[discside].offset_[iOther][iBinOther]) { + closest = etlVals_[discside].start_copy_[iOther][iBinOther]; + } else if (vpos > etlVals_[discside].offset_[iOther][iBinOther] + + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - + etlVals_[discside].start_copy_[iOther][iBinOther] || + (vpos == etlVals_[discside].offset_[iOther][iBinOther] + + etlVals_[discside].start_copy_[iOther][iBinOther + 1] - + etlVals_[discside].start_copy_[iOther][iBinOther] && + iBinOther + 1 == static_cast<int>(etlVals_[discside].start_copy_[iOther].size()))) { + closest = etlVals_[discside].start_copy_[iOther][iBinOther + 1] - 1; + } + if (closest < failIndex) { + closest = closest + nmodOffset - 1; return failIndex; } else { // number of module shifted by 1 wrt the position in the array (i.e. module 1 has index 0) diff --git a/RecoMTD/DetLayers/interface/MTDDetSector.h b/RecoMTD/DetLayers/interface/MTDDetSector.h index 723fbdbb728fd..fd05de8176efd 100644 --- a/RecoMTD/DetLayers/interface/MTDDetSector.h +++ b/RecoMTD/DetLayers/interface/MTDDetSector.h @@ -59,7 +59,7 @@ class MTDDetSector : public GeometricSearchDet { const MeasurementEstimator& est) const; size_t hshift(const uint32_t detid, const int horizontalShift) const; - size_t vshift(const uint32_t detid, const int verticalShift) const; + size_t vshift(const uint32_t detid, const int verticalShift, size_t& closest) const; protected: void setDisk(BoundDiskSector* diskS) { theDiskS = diskS; } diff --git a/RecoMTD/DetLayers/src/MTDDetSector.cc b/RecoMTD/DetLayers/src/MTDDetSector.cc index e7682692b21f9..2e9d1a244b419 100644 --- a/RecoMTD/DetLayers/src/MTDDetSector.cc +++ b/RecoMTD/DetLayers/src/MTDDetSector.cc @@ -112,11 +112,16 @@ vector<GeometricSearchDet::DetWithState> MTDDetSector::compatibleDets(const Traj for (int iside = -1; iside <= 1; iside += 2) { bool isCompatible(true); size_t idetNew(idetMin); + size_t closest = theDets.size(); while (isCompatible) { - idetNew = vshift(theDets[idetNew]->geographicalId().rawId(), iside); + idetNew = vshift(theDets[idetNew]->geographicalId().rawId(), iside, closest); if (idetNew >= theDets.size()) { - break; + if (closest < theDets.size()) { + idetNew = closest; + } else { + break; + } } isCompatible = add(idetNew, result, tsos, prop, est); if (isCompatible) { @@ -209,6 +214,6 @@ size_t MTDDetSector::hshift(const uint32_t detid, const int horizontalShift) con return topo_->hshiftETL(detid, horizontalShift); } -size_t MTDDetSector::vshift(const uint32_t detid, const int verticalShift) const { - return topo_->vshiftETL(detid, verticalShift); +size_t MTDDetSector::vshift(const uint32_t detid, const int verticalShift, size_t& closest) const { + return topo_->vshiftETL(detid, verticalShift, closest); } diff --git a/RecoMTD/DetLayers/test/TestETLNavigation.cc b/RecoMTD/DetLayers/test/TestETLNavigation.cc index 0256c04a10124..c252d50621155 100644 --- a/RecoMTD/DetLayers/test/TestETLNavigation.cc +++ b/RecoMTD/DetLayers/test/TestETLNavigation.cc @@ -84,10 +84,20 @@ void TestETLNavigation::analyze(const Event& ev, const EventSetup& es) { } } for (int iside = -1; iside <= 1; iside += 2) { - size_t idetNew = isector->vshift(modId, iside); + size_t closest(isector->basicComponents().size()); + size_t idetNew = isector->vshift(modId, iside, closest); if (idetNew >= isector->basicComponents().size()) { LogVerbatim("MTDLayerDump") << "...............vshift= " << std::fixed << std::setw(2) << iside << " out of range"; + if (closest < isector->basicComponents().size()) { + ETLDetId newId(isector->basicComponents()[closest]->geographicalId().rawId()); + LogVerbatim("MTDLayerDump") + << std::fixed << ".......closest.vshift= " << std::setw(2) << iside << " side = " << std::setw(4) + << newId.mtdSide() << " Disc/Side/Sector = " << std::setw(4) << newId.nDisc() << " " << std::setw(4) + << newId.discSide() << " " << std::setw(4) << newId.sector() << " mod/type = " << std::setw(4) + << newId.module() << " " << std::setw(4) << newId.modType() + << " pos = " << isector->basicComponents()[closest]->position(); + } } else { ETLDetId newId(isector->basicComponents()[idetNew]->geographicalId().rawId()); LogVerbatim("MTDLayerDump") << std::fixed << "...............vshift= " << std::setw(2) << iside From f4f47885d1db7fcfd88259933daaec5d6b12a47b Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Fri, 30 Apr 2021 11:22:06 +0200 Subject: [PATCH 235/309] Clean MEssageLogger in unit tests --- .../MTDCommonData/test/testMTDinDD4hep.py | 86 ++++++++----------- Geometry/MTDCommonData/test/testMTDinDDD.py | 86 ++++++++----------- .../MTDGeometryBuilder/test/dd4hep_mtd_cfg.py | 74 +++++++--------- Geometry/MTDGeometryBuilder/test/mtd_cfg.py | 68 ++++++--------- .../test/dd4hep_mtd_cfg.py | 65 ++++++-------- Geometry/MTDNumberingBuilder/test/mtd_cfg.py | 68 ++++++--------- RecoMTD/DetLayers/test/mtd_cfg.py | 24 ++---- 7 files changed, 192 insertions(+), 279 deletions(-) diff --git a/Geometry/MTDCommonData/test/testMTDinDD4hep.py b/Geometry/MTDCommonData/test/testMTDinDD4hep.py index 3569a04c314a0..e82b232f69a39 100644 --- a/Geometry/MTDCommonData/test/testMTDinDD4hep.py +++ b/Geometry/MTDCommonData/test/testMTDinDD4hep.py @@ -7,58 +7,44 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.DD4hep_TestMTDIdealGeometry = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestMTDNumbering = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestMTDPath = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestMTDPosition = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdCommonDataDD4hep = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - cout = cms.untracked.PSet( - DD4hep_TestMTDIdealGeometry = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestMTDNumbering = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestMTDPath = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestMTDPosition = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdCommonDataDD4hep = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ), + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", diff --git a/Geometry/MTDCommonData/test/testMTDinDDD.py b/Geometry/MTDCommonData/test/testMTDinDDD.py index ba1b9147ce895..ff281408bcfac 100644 --- a/Geometry/MTDCommonData/test/testMTDinDDD.py +++ b/Geometry/MTDCommonData/test/testMTDinDDD.py @@ -7,58 +7,44 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.TestMTDIdealGeometry = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.TestMTDNumbering = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.TestMTDPath = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.TestMTDPosition = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdCommonDataDDD = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - TestMTDIdealGeometry = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - TestMTDNumbering = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - TestMTDPath = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - TestMTDPosition = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdCommonDataDDD = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) + ), + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.load('Configuration.Geometry.GeometryExtended2026D76_cff') diff --git a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py index abc28919dc8ed..9475eabb5f39a 100644 --- a/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDGeometryBuilder/test/dd4hep_mtd_cfg.py @@ -14,52 +14,38 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.MTDDigiGeometryAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.DD4hep_TestBTLPixelTopology = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdGeometryDD4hep = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDDigiGeometryAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - DD4hep_TestBTLPixelTopology = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdGeometryDD4hep = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", diff --git a/Geometry/MTDGeometryBuilder/test/mtd_cfg.py b/Geometry/MTDGeometryBuilder/test/mtd_cfg.py index 3124914954e9d..a7c3d31a5da9b 100644 --- a/Geometry/MTDGeometryBuilder/test/mtd_cfg.py +++ b/Geometry/MTDGeometryBuilder/test/mtd_cfg.py @@ -13,49 +13,35 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.MTDDigiGeometryAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdGeometryDDD = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDDigiGeometryAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdGeometryDDD = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.load("Configuration.Geometry.GeometryExtended2026D76_cff") diff --git a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py index 0c584413b0025..7a06599034808 100644 --- a/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/dd4hep_mtd_cfg.py @@ -14,46 +14,35 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.GeometricTimingDetAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdNumberingDD4hep = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - GeometricTimingDetAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdNumberingDD4hep = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", diff --git a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py index 86a0aa63c58fc..b0a83125af51b 100644 --- a/Geometry/MTDNumberingBuilder/test/mtd_cfg.py +++ b/Geometry/MTDNumberingBuilder/test/mtd_cfg.py @@ -13,49 +13,35 @@ input = cms.untracked.int32(1) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) +process.load("FWCore.MessageLogger.MessageLogger_cfi") +process.MessageLogger.cerr.threshold = cms.untracked.string('INFO') +process.MessageLogger.cerr.INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.GeometricTimingDetAnalyzer = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.files.mtdNumberingDDD = cms.untracked.PSet( + DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + ERROR = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + FWKINFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + INFO = cms.untracked.PSet( + limit = cms.untracked.int32(0) + ), + MTDUnitTest = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ), - cout = cms.untracked.PSet( - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - GeometricTimingDetAnalyzer = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enable = cms.untracked.bool(True), - enableStatistics = cms.untracked.bool(True), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') + WARNING = cms.untracked.PSet( + limit = cms.untracked.int32(0) ), - files = cms.untracked.PSet( - mtdNumberingDDD = cms.untracked.PSet( - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - ERROR = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - FWKINFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - INFO = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDUnitTest = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - WARNING = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - noLineBreaks = cms.untracked.bool(True), - threshold = cms.untracked.string('INFO') - ) - ) + noLineBreaks = cms.untracked.bool(True), + threshold = cms.untracked.string('INFO') ) process.load("Configuration.Geometry.GeometryExtended2026D76_cff") diff --git a/RecoMTD/DetLayers/test/mtd_cfg.py b/RecoMTD/DetLayers/test/mtd_cfg.py index c65207ec83756..dbf9f757a0c0e 100644 --- a/RecoMTD/DetLayers/test/mtd_cfg.py +++ b/RecoMTD/DetLayers/test/mtd_cfg.py @@ -10,21 +10,15 @@ process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.debugModules = cms.untracked.vstring("*") -process.MessageLogger.cout = cms.untracked.PSet( - threshold = cms.untracked.string('INFO'), - INFO= cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - DEBUG = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - MTDLayerDump = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - MTDDetLayers = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - enableStatistics = cms.untracked.bool(True) +process.MessageLogger.cerr.threshold = cms.untracked.string('DEBUG') +process.MessageLogger.cerr.DEBUG = cms.untracked.PSet( + limit = cms.untracked.int32(0) +) +process.MessageLogger.cerr.MTDLayerDump = cms.untracked.PSet( + limit = cms.untracked.int32(-1) +) +process.MessageLogger.cerr.MTDDetLayers = cms.untracked.PSet( + limit = cms.untracked.int32(-1) ) process.MessageLogger.files.mtdDetLayerGeometry = cms.untracked.PSet( MTDLayerDump = cms.untracked.PSet( From 0826c67d53477656813e969a73a9eb14eae23592 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Fri, 30 Apr 2021 12:49:40 +0200 Subject: [PATCH 236/309] Silence debugging printout --- RecoMTD/DetLayers/src/MTDDetSector.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RecoMTD/DetLayers/src/MTDDetSector.cc b/RecoMTD/DetLayers/src/MTDDetSector.cc index 2e9d1a244b419..d47b98f948a36 100644 --- a/RecoMTD/DetLayers/src/MTDDetSector.cc +++ b/RecoMTD/DetLayers/src/MTDDetSector.cc @@ -1,4 +1,4 @@ -#define EDM_ML_DEBUG +//#define EDM_ML_DEBUG #include "RecoMTD/DetLayers/interface/MTDDetSector.h" #include "DataFormats/ForwardDetId/interface/ETLDetId.h" From 6a64ea0549f65139bc01e71f30e12177856745d8 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Mon, 3 May 2021 11:37:16 +0200 Subject: [PATCH 237/309] Protect MTDTopology construction for legacy scenarios with 1 ETL disc --- Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc index 953c7a43fd5c9..97138ea00ee05 100644 --- a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc +++ b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc @@ -7,6 +7,7 @@ #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESProducer.h" #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h" +#include "Geometry/MTDCommonData/interface/MTDTopologyMode.h" #include "Geometry/Records/interface/MTDTopologyRcd.h" #include "CondFormats/GeometryObjects/interface/PMTDParameters.h" #include "Geometry/Records/interface/PMTDParametersRcd.h" @@ -49,7 +50,11 @@ MTDTopologyEP::ReturnType MTDTopologyEP::produce(const MTDTopologyRcd& iRecord) void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMode, MTDTopology::ETLValues& etlVals) { mtdTopologyMode = ptp.topologyMode_; - // Check on the internal consistency of thr ETL layour information provided by parameters + // for legacy geometry scenarios no topology informastion is stored, only for newer ETL 2-discs layout + + if (mtdTopologyMode <= static_cast<int>(MTDTopologyMode::Mode::barphiflat)) { return; } + + // Check on the internal consistency of thr ETL layout information provided by parameters for (size_t it = 3; it <= 9; it++) { if (ptp.vitems_[it].vpars_.size() != ptp.vitems_[2].vpars_.size()) { From dcf0c05dd682202a54aa5e9a47b5c167d17a7091 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Mon, 3 May 2021 11:49:25 +0200 Subject: [PATCH 238/309] scram b code-format --- Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc index 97138ea00ee05..e09488a7dfaac 100644 --- a/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc +++ b/Geometry/MTDNumberingBuilder/plugins/MTDTopologyEP.cc @@ -52,7 +52,9 @@ void MTDTopologyEP::fillParameters(const PMTDParameters& ptp, int& mtdTopologyMo // for legacy geometry scenarios no topology informastion is stored, only for newer ETL 2-discs layout - if (mtdTopologyMode <= static_cast<int>(MTDTopologyMode::Mode::barphiflat)) { return; } + if (mtdTopologyMode <= static_cast<int>(MTDTopologyMode::Mode::barphiflat)) { + return; + } // Check on the internal consistency of thr ETL layout information provided by parameters From fbdc900a64cf419d108a1fc2c4b47704ed874673 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Thu, 6 May 2021 10:49:48 +0200 Subject: [PATCH 239/309] Adapt gap parameters for old ETL scenarios, where it was not used (D49 is based on I10, thanks to Pablo) --- Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml index a63aec1458c9f..5ea8b0aa56f17 100644 --- a/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml +++ b/Geometry/MTDCommonData/data/CrystalBarPhiFlat/mtdParameters.xml @@ -6,7 +6,7 @@ 4, 4, 4, 24 </Vector> <Vector name="BTL" type="numeric" nEntries="12"> - 0, 0, 0, 0, 0, 0, 0 ,0, 1, 16, 3, 1 + 0, 0, 0, 0, 0, 0, 0, 0, 1, 16, 3, 1 </Vector> <Vector name="ETL" type="numeric" nEntries="12"> 0, 0, 0, 0, 0, 0, 0, 0, 24, 4, 2, 8 From ed0068b8fee328adfb5f974233ed72988cc4ef59 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Fri, 7 May 2021 10:40:01 +0200 Subject: [PATCH 240/309] Uniform LCToCP naming --- ...c => LCToCPAssociatorByEnergyScoreImpl.cc} | 74 +++++++++---------- ....h => LCToCPAssociatorByEnergyScoreImpl.h} | 4 +- ... LCToCPAssociatorByEnergyScoreProducer.cc} | 20 ++--- .../plugins/LCToCPAssociatorEDProducer.cc | 6 +- 4 files changed, 51 insertions(+), 53 deletions(-) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{LayerClusterAssociatorByEnergyScoreImpl.cc => LCToCPAssociatorByEnergyScoreImpl.cc} (88%) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{LayerClusterAssociatorByEnergyScoreImpl.h => LCToCPAssociatorByEnergyScoreImpl.h} (93%) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{LayerClusterAssociatorByEnergyScoreProducer.cc => LCToCPAssociatorByEnergyScoreProducer.cc} (72%) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc similarity index 88% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc index 39d61303997bd..9b802ffe00a03 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc @@ -1,7 +1,7 @@ // Original Author: Marco Rovere // -#include "LayerClusterAssociatorByEnergyScoreImpl.h" +#include "LCToCPAssociatorByEnergyScoreImpl.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" @@ -9,7 +9,7 @@ #include "SimCalorimetry/HGCalAssociatorProducers/interface/AssociatorTools.h" -LayerClusterAssociatorByEnergyScoreImpl::LayerClusterAssociatorByEnergyScoreImpl( +LCToCPAssociatorByEnergyScoreImpl::LCToCPAssociatorByEnergyScoreImpl( edm::EDProductGetter const& productGetter, bool hardScatterOnly, std::shared_ptr<hgcal::RecHitTools> recHitTools, @@ -18,7 +18,7 @@ LayerClusterAssociatorByEnergyScoreImpl::LayerClusterAssociatorByEnergyScoreImpl layers_ = recHitTools_->lastLayerBH(); } -hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( +hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( const edm::Handle<reco::CaloClusterCollection>& cCCH, const edm::Handle<CaloParticleCollection>& cPCH) const { // 1. Extract collections and filter CaloParticles, if required const auto& clusters = *cCCH.product(); @@ -94,37 +94,37 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } #ifdef EDM_ML_DEBUG - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "cPOnLayer INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "cPOnLayer INFO" << std::endl; for (size_t cp = 0; cp < cPOnLayer.size(); ++cp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; for (size_t cpp = 0; cpp < cPOnLayer[cp].size(); ++cpp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticleIdx: " << cPOnLayer[cp][cpp].caloParticleId << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Energy: " << cPOnLayer[cp][cpp].energy << std::endl; double tot_energy = 0.; for (auto const& haf : cPOnLayer[cp][cpp].hits_and_fractions) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : cPOnLayer[cp][cpp].layerClusterIdToEnergyAndScore) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "detIdToCaloParticleId_Map INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "detIdToCaloParticleId_Map INFO" << std::endl; for (auto const& cp : detIdToCaloParticleId_Map) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)cp.first << " we have found the following connections with CaloParticles:" << std::endl; for (auto const& cpp : cp.second) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticle Id: " << cpp.clusterId << " with fraction: " << cpp.fraction << " and energy: " << cpp.fraction * hitMap_->at(cp.first)->energy() << std::endl; } @@ -269,7 +269,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" << "\t" << std::setw(12) << "layerCluster" << "\t" << std::setw(10) << "lc energy" << "\t" << std::setw(5) << "nhits" @@ -283,7 +283,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( << "\t" << std::setw(25) << "energyFractionOfCPinLC" << "\t" << "\n"; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << lcLayerId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << clusters[lcId].energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxCPId_byNumberOfHits << "\t" << std::setw(8) @@ -292,37 +292,37 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( << energyFractionOfLCinCP << "\t" << std::setw(25) << energyFractionOfCPinLC << "\n"; } // End of loop over LayerClusters - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "Improved cPOnLayer INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "Improved cPOnLayer INFO" << std::endl; for (size_t cp = 0; cp < cPOnLayer.size(); ++cp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For CaloParticle Idx: " << cp << " we have: " << std::endl; for (size_t cpp = 0; cpp < cPOnLayer[cp].size(); ++cpp) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " On Layer: " << cpp << " we have:" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticleIdx: " << cPOnLayer[cp][cpp].caloParticleId << std::endl; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Energy: " << cPOnLayer[cp][cpp].energy << std::endl; double tot_energy = 0.; for (auto const& haf : cPOnLayer[cp][cpp].hits_and_fractions) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : cPOnLayer[cp][cpp].layerClusterIdToEnergyAndScore) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "Improved detIdToCaloParticleId_Map INFO" << std::endl; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "Improved detIdToCaloParticleId_Map INFO" << std::endl; for (auto const& cp : detIdToCaloParticleId_Map) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)cp.first << " we have found the following connections with CaloParticles:" << std::endl; for (auto const& cpp : cp.second) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " CaloParticle Id: " << cpp.clusterId << " with fraction: " << cpp.fraction << " and energy: " << cpp.fraction * hitMap_->at(cp.first)->energy() << std::endl; } @@ -343,7 +343,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( if (clusters[lcId].energy() == 0. && !cpsInLayerCluster[lcId].empty()) { for (auto& cpPair : cpsInLayerCluster[lcId]) { cpPair.second = 1.; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t CP id : \t" + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t CP id : \t" << cpPair.first << "\t score \t " << cpPair.second << "\n"; } continue; @@ -381,7 +381,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over Hits within a LayerCluster #ifdef EDM_ML_DEBUG if (cpsInLayerCluster[lcId].empty()) - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tCP id:\t-1 " + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tCP id:\t-1 " << "\t score \t-1" << "\n"; #endif @@ -407,12 +407,12 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( if (CPenergy > 0.f) CPEnergyFractionInLC = maxEnergyLCinCP / CPenergy; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(8) << "LayerId:\t" << std::setw(12) << "caloparticle\t" << std::setw(15) << "cp total energy\t" << std::setw(15) << "cpEnergyOnLayer\t" << std::setw(14) << "CPNhitsOnLayer\t" << std::setw(18) << "lcWithMaxEnergyInCP\t" << std::setw(15) << "maxEnergyLCinCP\t" << std::setw(20) << "CPEnergyFractionInLC" << "\n"; - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(8) << layerId << "\t" << std::setw(12) << cpId << "\t" << std::setw(15) << caloParticles[cpId].energy() << "\t" << std::setw(15) << CPenergy << "\t" << std::setw(14) << CPNumberOfHits << "\t" << std::setw(18) << lcWithMaxEnergyInCP << "\t" << std::setw(15) << maxEnergyLCinCP @@ -451,7 +451,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( lcPair.second.second += (lcFraction - cpFraction) * (lcFraction - cpFraction) * hitEnergyWeight * invCPEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "cpDetId:\t" << (uint32_t)cp_hitDetId << "\tlayerClusterId:\t" << layerClusterId << "\t" << "lcfraction,cpfraction:\t" << lcFraction << ", " << cpFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -462,12 +462,12 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over hits of CaloParticle on a Layer #ifdef EDM_ML_DEBUG if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty()) - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") << "CP Id: \t" << cpId << "\tLC id:\t-1 " + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "CP Id: \t" << cpId << "\tLC id:\t-1 " << "\t score \t-1" << "\n"; for (const auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "CP Id: \t" << cpId << "\t LC id: \t" << lcPair.first << "\t score \t" << lcPair.second.second << "\t shared energy:\t" << lcPair.second.first << "\t shared energy fraction:\t" << (lcPair.second.first / CPenergy) << "\n"; @@ -478,7 +478,7 @@ hgcal::association LayerClusterAssociatorByEnergyScoreImpl::makeConnections( return {cpsInLayerCluster, cPOnLayer}; } -hgcal::RecoToSimCollection LayerClusterAssociatorByEnergyScoreImpl::associateRecoToSim( +hgcal::RecoToSimCollection LCToCPAssociatorByEnergyScoreImpl::associateRecoToSim( const edm::Handle<reco::CaloClusterCollection>& cCCH, const edm::Handle<CaloParticleCollection>& cPCH) const { hgcal::RecoToSimCollection returnValue(productGetter_); const auto& links = makeConnections(cCCH, cPCH); @@ -486,7 +486,7 @@ hgcal::RecoToSimCollection LayerClusterAssociatorByEnergyScoreImpl::associateRec const auto& cpsInLayerCluster = std::get<0>(links); for (size_t lcId = 0; lcId < cpsInLayerCluster.size(); ++lcId) { for (auto& cpPair : cpsInLayerCluster[lcId]) { - LogDebug("LayerClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\t CP id: \t" << cpPair.first << "\t score \t" << cpPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref<reco::CaloClusterCollection>(cCCH, lcId), // Ref to LC @@ -498,7 +498,7 @@ hgcal::RecoToSimCollection LayerClusterAssociatorByEnergyScoreImpl::associateRec return returnValue; } -hgcal::SimToRecoCollection LayerClusterAssociatorByEnergyScoreImpl::associateSimToReco( +hgcal::SimToRecoCollection LCToCPAssociatorByEnergyScoreImpl::associateSimToReco( const edm::Handle<reco::CaloClusterCollection>& cCCH, const edm::Handle<CaloParticleCollection>& cPCH) const { hgcal::SimToRecoCollection returnValue(productGetter_); const auto& links = makeConnections(cCCH, cPCH); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h similarity index 93% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.h rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index b14c4b3d9de06..97a7f33e9b7e3 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -44,9 +44,9 @@ namespace hgcal { typedef std::tuple<layerClusterToCaloParticle, caloParticleToLayerCluster> association; } // namespace hgcal -class LayerClusterAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToCaloParticleAssociatorBaseImpl { +class LCToCPAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToCaloParticleAssociatorBaseImpl { public: - explicit LayerClusterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + explicit LCToCPAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, bool, std::shared_ptr<hgcal::RecHitTools>, const std::unordered_map<DetId, const HGCRecHit *> *&); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc similarity index 72% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc index 760de51a17bb2..14aeac5b4189b 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LayerClusterAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc @@ -12,12 +12,12 @@ #include "FWCore/Utilities/interface/ESGetToken.h" #include "SimDataFormats/Associations/interface/LayerClusterToCaloParticleAssociator.h" -#include "LayerClusterAssociatorByEnergyScoreImpl.h" +#include "LCToCPAssociatorByEnergyScoreImpl.h" -class LayerClusterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +class LCToCPAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { public: - explicit LayerClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); - ~LayerClusterAssociatorByEnergyScoreProducer() override; + explicit LCToCPAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~LCToCPAssociatorByEnergyScoreProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); @@ -29,7 +29,7 @@ class LayerClusterAssociatorByEnergyScoreProducer : public edm::global::EDProduc std::shared_ptr<hgcal::RecHitTools> rhtools_; }; -LayerClusterAssociatorByEnergyScoreProducer::LayerClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) +LCToCPAssociatorByEnergyScoreProducer::LCToCPAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) : hitMap_(consumes<std::unordered_map<DetId, const HGCRecHit *>>(ps.getParameter<edm::InputTag>("hitMapTag"))), caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()), hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")) { @@ -39,9 +39,9 @@ LayerClusterAssociatorByEnergyScoreProducer::LayerClusterAssociatorByEnergyScore produces<hgcal::LayerClusterToCaloParticleAssociator>(); } -LayerClusterAssociatorByEnergyScoreProducer::~LayerClusterAssociatorByEnergyScoreProducer() {} +LCToCPAssociatorByEnergyScoreProducer::~LCToCPAssociatorByEnergyScoreProducer() {} -void LayerClusterAssociatorByEnergyScoreProducer::produce(edm::StreamID, +void LCToCPAssociatorByEnergyScoreProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &es) const { edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_); @@ -49,13 +49,13 @@ void LayerClusterAssociatorByEnergyScoreProducer::produce(edm::StreamID, const std::unordered_map<DetId, const HGCRecHit *> *hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique<LayerClusterAssociatorByEnergyScoreImpl>( + auto impl = std::make_unique<LCToCPAssociatorByEnergyScoreImpl>( iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); auto toPut = std::make_unique<hgcal::LayerClusterToCaloParticleAssociator>(std::move(impl)); iEvent.put(std::move(toPut)); } -void LayerClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { +void LCToCPAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { edm::ParameterSetDescription desc; desc.add<edm::InputTag>("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); desc.add<bool>("hardScatterOnly", true); @@ -64,4 +64,4 @@ void LayerClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::Configur } //define this as a plug-in -DEFINE_FWK_MODULE(LayerClusterAssociatorByEnergyScoreProducer); +DEFINE_FWK_MODULE(LCToCPAssociatorByEnergyScoreProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc index f88b4dc625be6..41d1af3018340 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorEDProducer.cc @@ -73,12 +73,10 @@ void LCToCPAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, cons iEvent.getByToken(LCCollectionToken_, LCCollection); // associate LC and CP - LogTrace("AssociatorValidator") << "Calling associateRecoToSim method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n"; hgcal::RecoToSimCollection recSimColl = theAssociator->associateRecoToSim(LCCollection, CPCollection); - LogTrace("AssociatorValidator") << "Calling associateSimToReco method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n"; hgcal::SimToRecoCollection simRecColl = theAssociator->associateSimToReco(LCCollection, CPCollection); auto rts = std::make_unique<hgcal::RecoToSimCollection>(recSimColl); From 6819baf21bb7623f5add73e6dacf88613891b229 Mon Sep 17 00:00:00 2001 From: Tapio <tapio.lampen@cern.ch> Date: Fri, 7 May 2021 11:19:59 +0200 Subject: [PATCH 241/309] Beamspot and vertex smaring for 2017 pp ref (forward port of #33504) --- Configuration/AlCa/python/autoCond.py | 2 ++ Configuration/PyReleaseValidation/python/relval_steps.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 1b984ce2c0d6a..947e4b2ec8c78 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -45,6 +45,8 @@ 'phase1_2017_design' : '113X_mc2017_design_v5', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector 'phase1_2017_realistic' : '113X_mc2017_realistic_v5', + # GlobalTag for MC production with realistic conditions for Phase1 2017 detector, for PP reference run + 'phase1_2017_realistic_ppref' : '120X_mc2017_realistic_forppRef5TeV_v1', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in DECO mode 'phase1_2017_cosmics' : '113X_mc2017cosmics_realistic_deco_v5', # GlobalTag for MC production (cosmics) with realistic alignment and calibrations for Phase1 2017 detector, Strip tracker in PEAK mode diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index b7973c29c2b45..8c31775bba522 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -989,7 +989,7 @@ def genS(fragment,howMuch): ## pp reference tests -ppRefAlca2017 = {'--conditions':'auto:phase1_2017_realistic', '--era':'Run2_2017_ppRef'} +ppRefAlca2017 = {'--conditions':'auto:phase1_2017_realistic_ppref', '--era':'Run2_2017_ppRef', '--beamspot':'Fixed_EmitRealistic5TeVppCollision2017'} ppRefDefaults2017=merge([ppRefAlca2017,{'-n':2}]) steps['QCD_Pt_80_120_13_PPREF']=merge([ppRefDefaults2017,gen2017('QCD_Pt_80_120_13TeV_TuneCUETP8M1_cfi',Kby(9,150))]) From bbc0308a5d743265802c6b97f61d6b791aab220b Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Fri, 7 May 2021 11:31:42 +0200 Subject: [PATCH 242/309] updates addressing comments by C. Vuosalo --- .../src/MTDParametersFromDD.cc | 32 ++++++++++++++----- .../MTDNumberingBuilder/src/MTDTopology.cc | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc index d0e5eeaf0fcf2..2fe547d24b433 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc @@ -1,3 +1,5 @@ +//#define EDM_ML_DEBUG + #include "Geometry/MTDGeometryBuilder/interface/MTDParametersFromDD.h" #include "Geometry/MTDCommonData/interface/MTDTopologyMode.h" #include "CondFormats/GeometryObjects/interface/PMTDParameters.h" @@ -68,7 +70,7 @@ bool MTDParametersFromDD::build(const DDCompactView* cvp, PMTDParameters& ptp) { "Offset_Back_Left", "Offset_Back_Right", }}; - int sector(0); + int sector(10); for (const auto& name : etlLayout) { auto const& v = cvp->vector(name); if (!v.empty()) { @@ -88,19 +90,21 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p cms::DDVectorsMap vmap = cvp->detector()->vectors(); std::array<std::string, 2> mtdSubdet{{"BTL", "ETL"}}; - int subdet(0), oldsubdet(-1); + int subdet(0); for (const auto& name : mtdSubdet) { + bool found(false); for (auto const& it : vmap) { if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) { subdet++; - oldsubdet = subdet; std::vector<int> subdetPars; for (const auto& i : it.second) subdetPars.emplace_back(std::round(i)); putOne(subdet, subdetPars, ptp); + found = true; + break; } } - if (oldsubdet != subdet) { + if (!found) { throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; } } @@ -139,20 +143,21 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p "Offset_Back_Left", "Offset_Back_Right", }}; - int sector(0), oldsector(-1); + int sector(10); // add vector index with offset, to distinguish from subdet for (const auto& name : etlLayout) { + bool found(false); for (auto const& it : vmap) { - edm::LogWarning("MTDParametersFromDD") << name << " " << dd4hep::dd::noNamespace(it.first); if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first), name)) { sector++; - oldsector = sector; std::vector<int> ipos; for (const auto& i : it.second) ipos.emplace_back(std::round(i)); putOne(sector, ipos, ptp); + found = true; + break; } } - if (oldsector != sector) { + if (!found) { throw cms::Exception("MTDParametersFromDD") << "Not found " << name << " but needed."; } } @@ -166,4 +171,15 @@ void MTDParametersFromDD::putOne(int subdet, std::vector<int>& vpars, PMTDParame item.id_ = subdet; item.vpars_ = vpars; ptp.vitems_.emplace_back(item); +#ifdef EDM_ML_DEBUG + auto print_item = [&]() { + std::stringstream ss; + ss << item.id_ << " with " << item.vpars_.size() << " elements:"; + for ( const auto& thePar : item.vpars_) { + ss << " " << thePar; + } + return ss.str(); + }; + edm::LogInfo("MTDParametersFromDD") << "Adding PMTDParameters item: " << print_item(); +#endif } diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index ee2ba1bd67264..6eccbd8315b01 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -18,7 +18,7 @@ bool MTDTopology::orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2) { } size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) const { - size_t failIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure + static constexpr size_t failIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure ETLDetId start_mod(detid); From 82d487330915e415052a330dac238d3af8f9e75e Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Fri, 7 May 2021 11:37:35 +0200 Subject: [PATCH 243/309] scram b code-format --- Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc | 4 ++-- Geometry/MTDNumberingBuilder/src/MTDTopology.cc | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc index 2fe547d24b433..09b112b61ea3a 100644 --- a/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc +++ b/Geometry/MTDGeometryBuilder/src/MTDParametersFromDD.cc @@ -143,7 +143,7 @@ bool MTDParametersFromDD::build(const cms::DDCompactView* cvp, PMTDParameters& p "Offset_Back_Left", "Offset_Back_Right", }}; - int sector(10); // add vector index with offset, to distinguish from subdet + int sector(10); // add vector index with offset, to distinguish from subdet for (const auto& name : etlLayout) { bool found(false); for (auto const& it : vmap) { @@ -175,7 +175,7 @@ void MTDParametersFromDD::putOne(int subdet, std::vector<int>& vpars, PMTDParame auto print_item = [&]() { std::stringstream ss; ss << item.id_ << " with " << item.vpars_.size() << " elements:"; - for ( const auto& thePar : item.vpars_) { + for (const auto& thePar : item.vpars_) { ss << " " << thePar; } return ss.str(); diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 6eccbd8315b01..37843a3dc6f3a 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -18,7 +18,8 @@ bool MTDTopology::orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2) { } size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) const { - static constexpr size_t failIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure + static constexpr size_t failIndex( + std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure ETLDetId start_mod(detid); From ca9669f098c2bc87450e56cd4a9bbb961d84dc56 Mon Sep 17 00:00:00 2001 From: Alessandro Rossi <alessandro.rossi@cern.ch> Date: Fri, 7 May 2021 13:13:18 +0200 Subject: [PATCH 244/309] Added specific plot for Inner/outer modules, unuseful plot removed, disabled these plots on Online --- .../python/SiPixelPhase1OnlineDQM_cff.py | 6 +++ .../plugins/SiPixelPhase1TrackClusters.cc | 8 ++++ .../python/SiPixelPhase1TrackClusters_cfi.py | 40 +++++++++++++++---- ...ixel_OfflineMonitoring_TrackCluster_cff.py | 36 +++++++++++++++++ 4 files changed, 83 insertions(+), 7 deletions(-) diff --git a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py index e9c1052fe9c13..173396b7d9fac 100644 --- a/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py +++ b/DQM/SiPixelPhase1Config/python/SiPixelPhase1OnlineDQM_cff.py @@ -70,6 +70,12 @@ # Track cluster from DQM.SiPixelPhase1Track.SiPixelPhase1TrackClusters_cfi import * +SiPixelPhase1TrackClustersOnTrackCorrCharge.enabled=cms.bool(False) +SiPixelPhase1TrackTemplateCorr.enabled=cms.bool(False) +SiPixelPhase1TrackClustersOnTrackCorrChargeOuter.enabled=cms.bool(False) +SiPixelPhase1TrackTemplateCorrOuter.enabled=cms.bool(False) +SiPixelPhase1TrackClustersOnTrackCorrChargeInner.enabled=cms.bool(False) +SiPixelPhase1TrackTemplateCorrInner.enabled=cms.bool(False) from DQM.SiPixelPhase1Track.SiPixelPhase1TrackResiduals_cfi import * siPixelPhase1OnlineDQM_source = cms.Sequence( diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 204afa4dd9a62..714b0931f9a3b 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -58,6 +58,10 @@ namespace { SIZE_VS_ETA_ON_TRACK_INNER, ON_TRACK_CHARGE_OUTER, ON_TRACK_CHARGE_INNER, + ON_TRACK_CORRECTEDCHARGE_OUTER, + ON_TRACK_CORRECTEDCHARGE_INNER, + TEMPLATE_CORRECTION_OUTER, + TEMPLATE_CORRECTION_INNER, ON_TRACK_SHAPE_OUTER, ON_TRACK_SHAPE_INNER, @@ -309,9 +313,13 @@ namespace { if (iAmOuter) { histo[SIZE_VS_ETA_ON_TRACK_OUTER].fill(etatk, cluster.sizeY(), id, &iEvent); histo[ON_TRACK_CHARGE_OUTER].fill(charge, id, &iEvent); + histo[ON_TRACK_CORRECTEDCHARGE_OUTER].fill(charge_cor, id, &iEvent); + histo[TEMPLATE_CORRECTION_OUTER].fill(tmpl, id, &iEvent); } else { histo[SIZE_VS_ETA_ON_TRACK_INNER].fill(etatk, cluster.sizeY(), id, &iEvent); histo[ON_TRACK_CHARGE_INNER].fill(charge, id, &iEvent); + histo[ON_TRACK_CORRECTEDCHARGE_INNER].fill(charge_cor, id, &iEvent); + histo[TEMPLATE_CORRECTION_INNER].fill(tmpl, id, &iEvent); } } } diff --git a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py index 80f86611d73e1..22b3ff0fde731 100644 --- a/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py +++ b/DQM/SiPixelPhase1Track/python/SiPixelPhase1TrackClusters_cfi.py @@ -75,13 +75,6 @@ Specification().groupBy("PXBarrel/PXLayer").save(), Specification().groupBy("PXForward/PXDisk").save(), Specification().groupBy("PXForward/PXRing").save(), - Specification(PerLayer1D).groupBy("PXBarrel/Shell/PXLayer").save(), - Specification(PerLayer1D).groupBy("PXForward/HalfCylinder/PXRing").save(), - Specification(PerLayer1D).groupBy("PXForward/HalfCylinder/PXRing/PXDisk").save(), - Specification(PerLadder).groupBy("PXBarrel/Shell/PXLayer/SignedLadder").save(), - Specification(PerLadder).groupBy("PXForward/HalfCylinder/PXRing/PXDisk/SignedBlade").save(), - Specification(PerModule).groupBy("PXBarrel/Shell/PXLayer/SignedLadder/PXModuleName").save(), - Specification(PerModule).groupBy("PXForward/HalfCylinder/PXRing/PXDisk/SignedBlade/PXModuleName").save() ) ) @@ -498,6 +491,35 @@ title = "Corrected Cluster Charge (OnTrack) inner ladders" ) +SiPixelPhase1TrackClustersOnTrackCorrChargeOuter = DefaultHistoTrack.clone( + name = "chargeOuter_corr", + title = "Template Corrected Cluster Charge (OnTrack) outer ladders", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + + specs = VPSet( + Specification().groupBy("PXBarrel/PXLayer").save() + ) +) + +SiPixelPhase1TrackClustersOnTrackCorrChargeInner = SiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "chargeInner_corr", + title = "Template Corrected Cluster Charge (OnTrack) inner ladders" +) + +SiPixelPhase1TrackTemplateCorrOuter = SiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "templateOuter_corr", + title = "Template Correction outer ladders", + range_min = 0, range_max = 3, range_nbins = 150, + xlabel = "A.U." +) + +SiPixelPhase1TrackTemplateCorrInner = SiPixelPhase1TrackTemplateCorrOuter.clone( + name = "templateInner_corr", + title = "Template Correction inner ladders" +) + + SiPixelPhase1TrackClustersOnTrackShapeOuter = DefaultHistoTrack.clone( topFolderName = "PixelPhase1/ClusterShape", name = "shapeFilterOuter", @@ -536,6 +558,10 @@ SiPixelPhase1ClustersSizeVsEtaOnTrackInner, SiPixelPhase1TrackClustersOnTrackChargeOuter, SiPixelPhase1TrackClustersOnTrackChargeInner, + SiPixelPhase1TrackClustersOnTrackCorrChargeOuter, + SiPixelPhase1TrackClustersOnTrackCorrChargeInner, + SiPixelPhase1TrackTemplateCorrOuter, + SiPixelPhase1TrackTemplateCorrInner, SiPixelPhase1TrackClustersOnTrackShapeOuter, SiPixelPhase1TrackClustersOnTrackShapeInner, diff --git a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py index 21b6770529914..414873fa500db 100644 --- a/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py +++ b/DQMOffline/Trigger/python/SiPixel_OfflineMonitoring_TrackCluster_cff.py @@ -328,6 +328,38 @@ title = "Corrected Cluster Charge (OnTrack) inner ladders" ) + +hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter = hltDefaultHistoTrack.clone( + name = "chargeOuter_corr", + title = "Template Corrected Cluster Charge (OnTrack) outer ladders", + range_min = 0, range_max = 80e3, range_nbins = 100, + xlabel = "Charge (electrons)", + enabled = False, + specs = VPSet( + Specification().groupBy("PXBarrel/PXLayer").save() + ) +) + +hltSiPixelPhase1TrackClustersOnTrackCorrChargeInner = hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "chargeInner_corr", + title = "Template Corrected Cluster Charge (OnTrack) inner ladders", + enabled = False +) + +hltSiPixelPhase1TrackTemplateCorrOuter = hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter.clone( + name = "templateOuter_corr", + title = "Template Correction outer ladders", + range_min = 0, range_max = 3, range_nbins = 150, + xlabel = "A.U.", + enabled = False +) + +hltSiPixelPhase1TrackTemplateCorrInner = hltSiPixelPhase1TrackTemplateCorrOuter.clone( + name = "templateInner_corr", + title = "Template Correction inner ladders", + enabled = False +) + hltSiPixelPhase1TrackClustersOnTrackShapeOuter = hltDefaultHistoTrack.clone( enabled = False, name = "shapeFilterOuter", @@ -369,6 +401,10 @@ hltSiPixelPhase1ClustersSizeVsEtaOnTrackInner, hltSiPixelPhase1TrackClustersOnTrackChargeOuter, hltSiPixelPhase1TrackClustersOnTrackChargeInner, + hltSiPixelPhase1TrackClustersOnTrackCorrChargeOuter, + hltSiPixelPhase1TrackClustersOnTrackCorrChargeInner, + hltSiPixelPhase1TrackTemplateCorrOuter, + hltSiPixelPhase1TrackTemplateCorrInner, hltSiPixelPhase1TrackClustersOnTrackShapeOuter, hltSiPixelPhase1TrackClustersOnTrackShapeInner, From 7e321e5730c8abb512f58b2b5287b3048fd1389c Mon Sep 17 00:00:00 2001 From: gennai <simone.gennai@cern.ch> Date: Fri, 7 May 2021 14:38:24 +0200 Subject: [PATCH 245/309] added the possibility to lock a record --- DQM/BeamMonitor/plugins/BeamMonitor.cc | 12 +++++++++++- DQM/BeamMonitor/plugins/BeamMonitor.h | 4 +++- DQM/BeamMonitor/plugins/FakeBeamMonitor.cc | 12 +++++++++++- DQM/BeamMonitor/plugins/FakeBeamMonitor.h | 6 ++++-- DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py | 1 + DQM/BeamMonitor/python/BeamMonitor_MC_cff.py | 1 + DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py | 1 + DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py | 1 + DQM/BeamMonitor/python/BeamMonitor_cff.py | 1 + DQM/BeamMonitor/python/FakeBeamMonitor_cff.py | 1 + .../python/clients/beam_dqm_sourceclient-live_cfg.py | 5 ++++- .../clients/beamfake_dqm_sourceclient-live_cfg.py | 8 ++++++-- .../clients/beamhlt_dqm_sourceclient-live_cfg.py | 4 ++++ .../clients/beamhltfake_dqm_sourceclient-live_cfg.py | 7 ++++--- DQM/Integration/python/clients/last_lumi.txt | 1 + 15 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 DQM/Integration/python/clients/last_lumi.txt diff --git a/DQM/BeamMonitor/plugins/BeamMonitor.cc b/DQM/BeamMonitor/plugins/BeamMonitor.cc index 38a5105eb0fb2..3471760327667 100644 --- a/DQM/BeamMonitor/plugins/BeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/BeamMonitor.cc @@ -137,6 +137,7 @@ BeamMonitor::BeamMonitor(const ParameterSet& ps) minNrVertices_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit"); minVtxNdf_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf"); minVtxWgt_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight"); + useLockRecords_ = ps.getUntrackedParameter<bool>("useLockRecords"); if (!monitorName_.empty()) monitorName_ = monitorName_ + "/"; @@ -203,6 +204,12 @@ namespace { }; } // namespace +void BeamMonitor::dqmBeginRun(edm::Run const&, edm::EventSetup const&) { + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->lockRecords(); + } +} + void BeamMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& iRun, edm::EventSetup const& iSetup) { frun = iRun.run(); ftimestamp = iRun.beginTime().value(); @@ -1544,8 +1551,11 @@ void BeamMonitor::dqmEndRun(const Run& r, const EventSetup& context) { mapLSBSTrkSize.clear(); mapLSPVStoreSize.clear(); mapLSCF.clear(); -} + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->releaseLocks(); + } +} //-------------------------------------------------------- void BeamMonitor::scrollTH1(TH1* h, time_t ref) { char offsetTime[64]; diff --git a/DQM/BeamMonitor/plugins/BeamMonitor.h b/DQM/BeamMonitor/plugins/BeamMonitor.h index 24b6903739f92..4fbd758c06edc 100644 --- a/DQM/BeamMonitor/plugins/BeamMonitor.h +++ b/DQM/BeamMonitor/plugins/BeamMonitor.h @@ -37,6 +37,8 @@ class BeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> { protected: // BeginRun + void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; @@ -114,7 +116,7 @@ class BeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> { int countGapLumi_; bool processed_; - + bool useLockRecords_; // ----------member data --------------------------- // std::vector<BSTrkParameters> fBSvector; diff --git a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc index 0600349e5c4c8..1d0ec92d83b1b 100644 --- a/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc +++ b/DQM/BeamMonitor/plugins/FakeBeamMonitor.cc @@ -134,6 +134,7 @@ FakeBeamMonitor::FakeBeamMonitor(const ParameterSet& ps) minNrVertices_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit"); minVtxNdf_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf"); minVtxWgt_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight"); + useLockRecords_ = ps.getUntrackedParameter<bool>("useLockRecords"); if (!monitorName_.empty()) monitorName_ = monitorName_ + "/"; @@ -196,6 +197,12 @@ namespace { }; } // namespace +void FakeBeamMonitor::dqmBeginRun(edm::Run const&, edm::EventSetup const&) { + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->lockRecords(); + } +} + void FakeBeamMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& iRun, edm::EventSetup const& iSetup) { frun = iRun.run(); ftimestamp = iRun.beginTime().value(); @@ -1499,7 +1506,7 @@ void FakeBeamMonitor::FitAndFill(const LuminosityBlock& lumiSeg, int& lastlumi, } //-------------------------------------------------------- -void FakeBeamMonitor::RestartFitting() { +void FakeBeamMonitor::RestartFitting() { // if (debug_) edm::LogInfo("FakeBeamMonitor") << " RestartingFitting:: Restart Beami everything to a fresh start !!! because Gap is > 10 LS" << endl; @@ -1552,6 +1559,9 @@ void FakeBeamMonitor::dqmEndRun(const Run& r, const EventSetup& context) { mapLSBSTrkSize.clear(); mapLSPVStoreSize.clear(); mapLSCF.clear(); + if (useLockRecords_ && onlineDbService_.isAvailable()) { + onlineDbService_->releaseLocks(); + } } //-------------------------------------------------------- diff --git a/DQM/BeamMonitor/plugins/FakeBeamMonitor.h b/DQM/BeamMonitor/plugins/FakeBeamMonitor.h index e14337dfbda45..934486fbd4ed7 100644 --- a/DQM/BeamMonitor/plugins/FakeBeamMonitor.h +++ b/DQM/BeamMonitor/plugins/FakeBeamMonitor.h @@ -37,7 +37,9 @@ class FakeBeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> ~FakeBeamMonitor() override; protected: - // BeginRun + //BeginRun + void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker& i, const edm::Run& r, const edm::EventSetup& c) override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; @@ -109,7 +111,7 @@ class FakeBeamMonitor : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> int countGapLumi_; bool processed_; - + bool useLockRecords_; // ----------member data --------------------------- // std::vector<BSTrkParameters> fBSvector; diff --git a/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py b/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py index 59f02f0ea11fa..0462fc89680e0 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_Cosmics_cff.py @@ -11,6 +11,7 @@ resetPVEveryNLumi = cms.untracked.int32(2), Debug = cms.untracked.bool(False), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('ctfWithMaterialTracksP5'), ## ctfWithMaterialTracksP5 for CRAFT diff --git a/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py b/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py index 209465897fedc..341f51f5393ae 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_MC_cff.py @@ -12,6 +12,7 @@ resetPVEveryNLumi = cms.untracked.int32(2), Debug = cms.untracked.bool(False), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('generalTracks'), ## ctfWithMaterialTracksP5 for CRAFT diff --git a/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py b/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py index 87e4a7c8142b4..2202dc08e92c8 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_PixelLess_cff.py @@ -10,6 +10,7 @@ resetPVEveryNLumi = cms.untracked.int32(2), Debug = cms.untracked.bool(False), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('ctfPixelLess'), diff --git a/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py b/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py index 4365d5850eb4e..3bfeadf0c31ab 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_Pixel_cff.py @@ -13,6 +13,7 @@ Debug = cms.untracked.bool(False), OnlineMode = cms.untracked.bool(True), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('pixelTracks'), diff --git a/DQM/BeamMonitor/python/BeamMonitor_cff.py b/DQM/BeamMonitor/python/BeamMonitor_cff.py index 0494a65b047c6..d3cb006c6f10c 100644 --- a/DQM/BeamMonitor/python/BeamMonitor_cff.py +++ b/DQM/BeamMonitor/python/BeamMonitor_cff.py @@ -13,6 +13,7 @@ Debug = cms.untracked.bool(False), OnlineMode = cms.untracked.bool(True), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('generalTracks'), diff --git a/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py b/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py index 18305eb868507..685fc43bbd93e 100644 --- a/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py +++ b/DQM/BeamMonitor/python/FakeBeamMonitor_cff.py @@ -11,6 +11,7 @@ Debug = cms.untracked.bool(False), OnlineMode = cms.untracked.bool(True), recordName = cms.untracked.string('BeamSpotOnlineHLTObjectsRcd'), + useLockRecords = cms.untracked.bool(False), BeamFitter = cms.PSet( Debug = cms.untracked.bool(False), TrackCollection = cms.untracked.InputTag('pixelTracks'), diff --git a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py index 316b4cf91c64d..5923c1a0d383f 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -7,6 +7,7 @@ BSOnlineTag = 'BeamSpotOnlineTestLegacy' BSOnlineJobName = 'BeamSpotOnlineTestLegacy' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +useLockRecords = True #from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 #process = cms.Process("BeamMonitor", Run2_2018) FIXME @@ -19,7 +20,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' - + useLockRecords = False # process.MessageLogger = cms.Service("MessageLogger", debugModules = cms.untracked.vstring('*'), @@ -36,6 +37,7 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True + useLockRecords = False. #--------------- # Input sources @@ -303,6 +305,7 @@ process.dqmBeamMonitor.OnlineMode = True process.dqmBeamMonitor.recordName = BSOnlineRecordName +process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) process.dqmBeamMonitor.resetEveryNLumi = 5 # was 10 for HI process.dqmBeamMonitor.resetPVEveryNLumi = 5 # was 10 for HI diff --git a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py index 3765c52e57290..8bba1204ff6ef 100644 --- a/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamfake_dqm_sourceclient-live_cfg.py @@ -8,7 +8,7 @@ BSOnlineTag = 'BeamSpotOnlineTestLegacy' BSOnlineJobName = 'BeamSpotOnlineTestLegacy' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' - +useLockRecords = True import sys from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 process = cms.Process("FakeBeamMonitor", Run2_2018) @@ -18,6 +18,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' + useLockRecords = False # process.MessageLogger = cms.Service("MessageLogger", @@ -35,9 +36,11 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True + useLockRecords = False else: time.sleep(48.) + #--------------- # Input sources if unitTest: @@ -83,6 +86,7 @@ process.load("DQM.BeamMonitor.FakeBeamMonitor_cff") + #---------------- # Setup tracking #process.load("Configuration.StandardSequences.GeometryRecoDB_cff") @@ -132,7 +136,7 @@ process.dqmFakeBeamMonitor.resetEveryNLumi = 5 # was 10 for HI process.dqmFakeBeamMonitor.resetPVEveryNLumi = 5 # was 10 for HI - +process.dqmFakeBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) #--------- diff --git a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py index 9fffc4061cba8..c28d3ce966be3 100644 --- a/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhlt_dqm_sourceclient-live_cfg.py @@ -7,6 +7,7 @@ BSOnlineTag = 'BeamSpotOnlineTestHLT' BSOnlineJobName = 'BeamSpotOnlineTestHLT' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +useLockRecords = True #from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 #process = cms.Process("BeamMonitor", Run2_2018) # FIMXE @@ -19,6 +20,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' + useLockRecords = False # Message logger #process.load("FWCore.MessageLogger.MessageLogger_cfi") @@ -41,6 +43,7 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True + useLockRecords = False # Common part for PP and H.I Running #----------------------------- @@ -95,6 +98,7 @@ #process.GlobalTag = gtCustomise(process.GlobalTag, 'auto:run2_data', '') # Change Beam Monitor variables +process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) if process.dqmRunConfig.type.value() is "production": process.dqmBeamMonitor.BeamFitter.WriteAscii = True process.dqmBeamMonitor.BeamFitter.AsciiFileName = '/nfshome0/yumiceva/BeamMonitorDQM/BeamFitResults.txt' diff --git a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py index a32d96c6d7628..de82265a4ced6 100644 --- a/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beamhltfake_dqm_sourceclient-live_cfg.py @@ -7,6 +7,7 @@ BSOnlineTag = 'BeamSpotOnlineTestHLT' BSOnlineJobName = 'BeamSpotOnlineTestHLT' BSOnlineOmsServiceUrl = 'http://cmsoms-services.cms:9949/urn:xdaq-application:lid=100/getRunAndLumiSection' +useLockRecords = True import sys from Configuration.Eras.Era_Run2_2018_cff import Run2_2018 @@ -17,6 +18,7 @@ BSOnlineTag = BSOnlineTag + 'Playback' BSOnlineJobName = BSOnlineJobName + 'Playback' BSOnlineOmsServiceUrl = '' + useLockRecords = False # switch live = True # FIXME @@ -25,7 +27,7 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True - + useLockRecords = False # Common part for PP and H.I Running #----------------------------- @@ -81,7 +83,6 @@ #----------------------------- process.load("DQM.BeamMonitor.FakeBeamMonitor_cff") process.dqmBeamMonitor = process.dqmFakeBeamMonitor.clone() - #--------------- # Calibration #--------------- @@ -106,7 +107,7 @@ process.dqmBeamMonitor.monitorName = 'FakeBeamMonitor' process.dqmBeamMonitor.OnlineMode = True process.dqmBeamMonitor.recordName = BSOnlineRecordName - +process.dqmBeamMonitor.useLockRecords = cms.untracked.bool(useLockRecords) process.dqmBeamMonitor.resetEveryNLumi = 5 process.dqmBeamMonitor.resetPVEveryNLumi = 5 diff --git a/DQM/Integration/python/clients/last_lumi.txt b/DQM/Integration/python/clients/last_lumi.txt new file mode 100644 index 0000000000000..573541ac9702d --- /dev/null +++ b/DQM/Integration/python/clients/last_lumi.txt @@ -0,0 +1 @@ +0 From 228703ed5236d51e748adcbefbc5f00790ab5e25 Mon Sep 17 00:00:00 2001 From: Giacomo Govi <giacomo.govi@cern.ch> Date: Fri, 7 May 2021 14:39:59 +0200 Subject: [PATCH 246/309] Added support of Tag access restrictions --- CondCore/CondDB/interface/Auth.h | 7 + CondCore/CondDB/interface/CredentialStore.h | 1 + .../CondDB/plugins/CondDBPyBind11Wrappers.cc | 15 +- CondCore/CondDB/src/CredentialStore.cc | 4 +- CondCore/Utilities/python/conddblib.py | 45 ++++- CondCore/Utilities/scripts/conddb | 157 ++++++++++++++++-- 6 files changed, 203 insertions(+), 26 deletions(-) diff --git a/CondCore/CondDB/interface/Auth.h b/CondCore/CondDB/interface/Auth.h index f49bdcdcb010e..d2204f0ecb1fe 100644 --- a/CondCore/CondDB/interface/Auth.h +++ b/CondCore/CondDB/interface/Auth.h @@ -23,6 +23,13 @@ namespace cond { std::string(COND_WRITER_ROLE), std::string(COND_ADMIN_ROLE)}; + typedef enum { DEFAULT_ROLE = 0, READER_ROLE = 1, WRITER_ROLE = 2, ADMIN_ROLE = 3 } RoleCode; + + static const std::pair<const char*, RoleCode> s_roleCodeArray[] = {std::make_pair(COND_DEFAULT_ROLE, DEFAULT_ROLE), + std::make_pair(COND_READER_ROLE, READER_ROLE), + std::make_pair(COND_WRITER_ROLE, WRITER_ROLE), + std::make_pair(COND_ADMIN_ROLE, ADMIN_ROLE)}; + static constexpr const char* const COND_DEFAULT_PRINCIPAL = "COND_DEFAULT_PRINCIPAL"; static constexpr const char* const COND_KEY = "Memento"; diff --git a/CondCore/CondDB/interface/CredentialStore.h b/CondCore/CondDB/interface/CredentialStore.h index 75231d7873f98..aac004269ba17 100644 --- a/CondCore/CondDB/interface/CredentialStore.h +++ b/CondCore/CondDB/interface/CredentialStore.h @@ -168,6 +168,7 @@ namespace cond { std::shared_ptr<coral::IConnection> m_connection; std::shared_ptr<coral::ISession> m_session; + std::string m_authenticatedPrincipal; int m_principalId; // the key used to encrypt the db credentials accessibles by the owner of the authenticated key. std::string m_principalKey; diff --git a/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc b/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc index eff66cb1b7d6e..d4ae2e56a04e4 100644 --- a/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc +++ b/CondCore/CondDB/plugins/CondDBPyBind11Wrappers.cc @@ -5,21 +5,20 @@ namespace cond { - std::pair<std::string, std::string> getDbCredentials(const std::string& connectionString, - bool updateMode, - const std::string& authPath) { + std::tuple<std::string, std::string, std::string> getDbCredentials(const std::string& connectionString, + int accessType, + const std::string& authPath) { std::string ap = authPath; if (ap.empty()) { ap = std::string(std::getenv(cond::auth::COND_AUTH_PATH)); } - auto ret = std::make_pair(std::string(""), std::string("")); + auto ret = std::make_tuple(std::string(""), std::string(""), std::string("")); if (!ap.empty()) { CredentialStore credDb; credDb.setUpForConnectionString(connectionString, ap); - std::string role(cond::auth::COND_READER_ROLE); - if (updateMode) - role = cond::auth::COND_WRITER_ROLE; - ret = credDb.getUserCredentials(connectionString, role); + std::string role(cond::auth::s_roleCodeArray[accessType].first); + auto creds = credDb.getUserCredentials(connectionString, role); + ret = std::tie(credDb.keyPrincipalName(), creds.first, creds.second); } return ret; } diff --git a/CondCore/CondDB/src/CredentialStore.cc b/CondCore/CondDB/src/CredentialStore.cc index e4d9ca0338904..35f2a731639fe 100644 --- a/CondCore/CondDB/src/CredentialStore.cc +++ b/CondCore/CondDB/src/CredentialStore.cc @@ -645,6 +645,7 @@ void cond::CredentialStore::startSession(bool readMode) { // ok, authenticated! m_principalId = princData.id; m_principalKey = cipher0.b64decrypt(princData.principalKey); + m_authenticatedPrincipal = m_key.principalName(); if (!readMode) { auth::Cipher cipher0(m_principalKey); @@ -716,6 +717,7 @@ void cond::CredentialStore::startSession(bool readMode) { cond::CredentialStore::CredentialStore() : m_connection(), m_session(), + m_authenticatedPrincipal(""), m_principalId(-1), m_principalKey(""), m_serviceName(""), @@ -1532,6 +1534,6 @@ bool cond::CredentialStore::exportAll(coral_bridge::AuthenticationCredentialSet& const std::string& cond::CredentialStore::serviceName() { return m_serviceName; } -const std::string& cond::CredentialStore::keyPrincipalName() { return m_key.principalName(); } +const std::string& cond::CredentialStore::keyPrincipalName() { return m_authenticatedPrincipal; } std::string cond::CredentialStore::log() { return m_log.str(); } diff --git a/CondCore/Utilities/python/conddblib.py b/CondCore/Utilities/python/conddblib.py index 04c04bbf7f354..563303d689a81 100644 --- a/CondCore/Utilities/python/conddblib.py +++ b/CondCore/Utilities/python/conddblib.py @@ -6,7 +6,7 @@ __credits__ = ['Giacomo Govi', 'Miguel Ojeda', 'Andreas Pfeiffer'] __license__ = 'Unknown' __maintainer__ = 'Giacomo Govi' -__email__ = 'mojedasa@cern.ch' +__email__ = 'giacomo.govi@cern.ch' import os @@ -43,6 +43,11 @@ ONLINEORAPRO = 'cms_orcon_prod' ONLINEORAINT = 'cmsintr_lb' +# access role codes +READ_ROLE = 1 +WRITE_ROLE = 2 +ADMIN_ROLE = 3 + # Set initial level to WARN. This so that log statements don't occur in # the absense of explicit logging being enabled. if logger.level == logging.NOTSET: @@ -196,6 +201,9 @@ def make_dbtype( backendName, schemaName, baseType ): if schemaName is not None: members['__table_args__'] = {'schema': schemaName } for k,v in baseType.columns.items(): + defColVal = None + if len(v)==3: + defColVal = v[2] if isinstance(v[0],DbRef): refColDbt = v[0].rtype.columns[v[0].rcol][0] pk = (True if v[1]==_Col.pk else False) @@ -213,7 +221,10 @@ def make_dbtype( backendName, schemaName, baseType ): members[k] = sqlalchemy.Column(v[0],primary_key=True) else: nullable = (True if v[1]==_Col.nullable else False) - members[k] = sqlalchemy.Column(v[0],nullable=nullable) + if defColVal is None: + members[k] = sqlalchemy.Column(v[0],nullable=nullable) + else: + members[k] = sqlalchemy.Column(v[0],nullable=nullable, default=defColVal) dbType = type(dbtype_name,(_Base,),members) if backendName not in db_models.keys(): @@ -236,7 +247,8 @@ class Tag: 'last_validated_time':(sqlalchemy.BIGINT,_Col.notNull), 'end_of_validity':(sqlalchemy.BIGINT,_Col.notNull), 'insertion_time':(sqlalchemy.TIMESTAMP,_Col.notNull), - 'modification_time':(sqlalchemy.TIMESTAMP,_Col.notNull) } + 'modification_time':(sqlalchemy.TIMESTAMP,_Col.notNull), + 'protection_code':(sqlalchemy.Integer,_Col.notNull,0) } class TagMetadata: __tablename__ = 'TAG_METADATA' @@ -245,6 +257,13 @@ class TagMetadata: 'min_since': (sqlalchemy.BIGINT,_Col.notNull), 'modification_time':(sqlalchemy.TIMESTAMP,_Col.notNull) } +class TagAuthorization: + __tablename__ = 'TAG_AUTHORIZATION' + columns = { 'tag_name': (DbRef(Tag,'name'),_Col.pk), + 'access_type': (sqlalchemy.Integer,_Col.notNull), + 'credential': (sqlalchemy.String(name_length),_Col.notNull), + 'credential_type':(sqlalchemy.Integer,_Col.notNull) } + class Payload: __tablename__ = 'PAYLOAD' columns = { 'hash': (sqlalchemy.CHAR(hash_length),_Col.pk), @@ -357,6 +376,7 @@ def __init__(self, url): self.get_dbtype(RunInfo) if not self._is_sqlite: self.get_dbtype(TagMetadata) + self.get_dbtype(TagAuthorization) self.get_dbtype(BoostRunMap) self._is_valid = self.is_valid() @@ -515,7 +535,7 @@ def make_url(database='pro',read_only = True): url = sqlalchemy.engine.url.make_url('sqlite:///%s' % database) return url -def connect(url, authPath=None, verbose=0): +def connect(url, authPath=None, verbose=0, as_admin=False): '''Returns a Connection instance to the CMS Condition DB. See database_help for the description of the database parameter. @@ -527,6 +547,7 @@ def connect(url, authPath=None, verbose=0): 2 = In addition, results of the queries (all rows and the column headers). ''' + check_admin = as_admin if url.drivername == 'oracle': if url.username is None: logging.error('Could not resolve the username for the connection %s. Please provide a connection in the format oracle://[user]:[pass]@[host]' %url ) @@ -556,10 +577,17 @@ def connect(url, authPath=None, verbose=0): explicit_auth =True else: import pluginCondDBPyBind11Interface as credential_store - connect_for_update = ( url.username == dbwriter_user_name ) + role_code = 1 + if url.username == dbwriter_user_name: + role_code = 2 + if check_admin: + role_code = 3 connection_string = oracle_connection_string(url.host.lower(),schema_name) logging.debug('Using db key to get credentials for %s' %connection_string ) - (username,password) = credential_store.get_db_credentials(connection_string,connect_for_update,authPath) + (dbuser,username,password) = credential_store.get_db_credentials(connection_string,role_code,authPath) + if username=='' or password=='': + raise Exception('No credentials found to connect on %s with the required access role.'%connection_string) + check_admin = False url.username = username url.password = password else: @@ -570,7 +598,10 @@ def connect(url, authPath=None, verbose=0): if pwd is None or pwd == '': raise Exception('Empty password provided, bailing out...') url.password = pwd - + if check_admin: + raise Exception('Admin access has not been granted. Please provide a valid admin db-key.') + if check_admin: + raise Exception('Admin access is not available for technology "%s".' %url.drivername) if verbose >= 1: logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) diff --git a/CondCore/Utilities/scripts/conddb b/CondCore/Utilities/scripts/conddb index 0692224a1a24c..c7536a592cba6 100755 --- a/CondCore/Utilities/scripts/conddb +++ b/CondCore/Utilities/scripts/conddb @@ -38,11 +38,28 @@ from CondCore.Utilities.tier0 import Tier0Handler, Tier0Error, tier0Url maxSince = 18446744073709551615 sizeOfTimestamp = 19 +tag_db_lock_access_code = 8 +tag_db_write_access_code = 2 +tag_db_read_access_code = 1 +tag_db_no_protection_code = 0 + +db_key_credential_type_code = 1 +db_cmsuser_credential_type_code = 2 +db_session_credential_type_code = 4 + +db_access_code_map = { tag_db_write_access_code: "W", tag_db_lock_access_code: "L" } + +db_credential_type_map = { db_key_credential_type_code : ("DB KEY",'K'), + db_cmsuser_credential_type_code : ("CMS USER",'U'), + db_session_credential_type_code : ("DB SESSION",'S'), } + # Utility functions def _rawdict(obj): return dict([(str(column), getattr(obj, column)) for column in obj.__table__.columns.keys()]) +def _rawdict_selection(obj): + return dict([(str(column), getattr(obj, column)) for column in obj._fields]) def _get_payload_full_hash(session, payload, check=True): # Limited to 2 to know whether there is more than one in a single query @@ -262,11 +279,11 @@ def _check_same_object(args): if (args.destdb is None or args.db == args.destdb) and (args.second is None or args.first == args.second): raise Exception('The source object and the destination object are the same (i.e. same database and same name): %s' % str_db_object(args.db, args.first)) -def _connect(db, init, read_only, args): +def _connect(db, init, read_only, args, as_admin=False): logging.debug('Preparing connection to %s ...', db) - url = conddb.make_url( db, read_only ) + url = conddb.make_url( db, read_only) pretty_url = url if url.drivername == 'oracle+frontier': ws = url.host.rsplit('%2F') @@ -275,7 +292,10 @@ def _connect(db, init, read_only, args): connTo = '%s [%s]' %(db,pretty_url) logging.info('Connecting to %s', connTo) logging.debug('DB url: %s',url) - connection = conddb.connect(url, authPath=args.authPath, verbose=0 if args.verbose is None else args.verbose - 1) + verbose= 0 + if args.verbose is not None: + verbose = args.verbose - 1 + connection = conddb.connect(url, args.authPath, verbose, as_admin) if not read_only: @@ -298,7 +318,7 @@ def _connect(db, init, read_only, args): return connection -def connect(args, init=False, read_only=True): +def connect(args, init=False, read_only=True, as_admin=False): args.force = args.force if 'force' in dir(args) else False if 'destdb' in args: @@ -314,8 +334,7 @@ def connect(args, init=False, read_only=True): conn2 = _connect(args.destdb, init, False, args) return conn1, conn2 - return _connect( args.db, init, read_only, args) - + return _connect( args.db, init, read_only, args, as_admin) def str_db_object(db, name): return '%s::%s' % (db, name) @@ -924,6 +943,7 @@ def _get_synchro_policy( synchronization ): raise Exception('Cannot handle synchronization %s' %synchronization) return _synchro_map[synchronization] + def listTags_(args): connection = connect(args) session = connection.session() @@ -1608,7 +1628,8 @@ def _copy_tag(args, copyTime, session1, session2, first, second, fromIOV=None, t Tag1 = session1.get_dbtype(conddb.Tag) Tag2 = session2.get_dbtype(conddb.Tag) # Copy the tag - tag = _rawdict(session1.query(Tag1).get(first)) + obj = session1.query(Tag1.name, Tag1.time_type, Tag1.object_type, Tag1.synchronization, Tag1.description, Tag1.last_validated_time, Tag1.end_of_validity, Tag1.insertion_time, Tag1.modification_time).first() + tag = _rawdict_selection(obj) tag['name'] = second if session2._is_sqlite: @@ -1634,15 +1655,14 @@ def _copy_tag(args, copyTime, session1, session2, first, second, fromIOV=None, t selectStr += ' selecting insertion time < %s' %args.snapshot logging.info('Copying tag %s to %s %s', str_db_object(args.db, first), str_db_object(args.destdb, second), selectStr) - - query = session2.query(Tag2).filter(Tag2.name == second ) + query = session2.query(Tag2.time_type, Tag2.object_type, Tag2.synchronization).filter(Tag2.name == second ) destExists = False destPayloadType = None destTimeType = None destSynchro = None for t in query: destExists = True - t = _rawdict(t) + t = _rawdict_selection(t) destPayloadType = t['object_type'] destTimeType = t['time_type'] destSynchro = t['synchronization'] @@ -2506,6 +2526,111 @@ def fromTimestamp_( args ): else: output(args,"String date time for timestamp %s: '%s'" %(args.timestamp, sdt)) +def showProtections( args ): + connection = connect(args, False, True, True) + session = connection.session() + Tag = session.get_dbtype(conddb.Tag) + result = session.query(Tag.name, Tag.protection_code).filter(Tag.name==args.tag).all() + get_authorizations = False + table = [] + for res in result: + protection_fl = '-' + protection_str = 'not protected' + if res[1]!=tag_db_no_protection_code: + get_authorizations = True + write_flag = res[1] & tag_db_write_access_code + lock_flag = res[1] & tag_db_lock_access_code + protection_fl = '' + protection_str = '' + if write_flag != 0: + protection_fl += db_access_code_map[tag_db_write_access_code] + protection_str += 'write protected' + if lock_flag != 0: + protection_fl += db_access_code_map[tag_db_lock_access_code] + if protection_str != '': + protection_str += ',' + protection_str += 'locked' + table.append((args.tag,protection_fl,protection_str)) + break + if len(table)==0: + logging.error('Tag %s does not exists.'%args.tag) + return 1 + output_table(args,table,['Tag','Flags','Protection']) + if get_authorizations: + TagAuthorization = session.get_dbtype(conddb.TagAuthorization) + results = session.query(TagAuthorization.access_type, TagAuthorization.credential, TagAuthorization.credential_type).filter(TagAuthorization.tag_name==args.tag).all() + table = [] + for r in results: + table.append((db_access_code_map[r[0]],db_credential_type_map[r[2]][0],r[1])) + output_table(args,table,['Access Type','Credential Type','Credential']) + return 0 + +def setProtection( args ): + if args.credential is not None and args.credentialtype is None: + logging.error('Specified option "credential" requires option "credentialtype') + return 2 + if not args.remove and args.accesstype == db_access_code_map[tag_db_lock_access_code]: + logging.error("Lock can't be set by command line tool action.") + return 2 + connection = connect(args, False, True, True) + session = connection.session() + Tag = session.get_dbtype(conddb.Tag) + result = session.query(Tag.name, Tag.protection_code).filter(Tag.name==args.tag).all() + full_protection_code = None + for res in result: + full_protection_code = res[1] + if full_protection_code is None: + logging.error('Tag %s does not exists.'%args.tag) + return 1 + TagAuthorization = session.get_dbtype(conddb.TagAuthorization) + input_access_code = None + for k in db_access_code_map.keys(): + if db_access_code_map[k] == args.accesstype: + input_access_code = k + input_credential = None + input_credential_code = None + input_credential_type = None + if args.credential is not None: + if input_access_code == tag_db_lock_access_code: + logger.warning('Ignoring credentials specified for the lock - the full lock will be removed.') + else: + input_credential = args.credential + for k in db_credential_type_map.keys(): + if db_credential_type_map[k][1] == args.credentialtype: + input_credential_code = k + input_credential_type = db_credential_type_map[k][0] + new_protection_code = 0 + action = 'Access permission altered.' + note = '' + if args.remove: + query = session.query(TagAuthorization).filter(TagAuthorization.tag_name == args.tag) + query = query.filter(TagAuthorization.access_type == input_access_code) + if input_credential is not None: + query = query.filter(TagAuthorization.credential == input_credential) + query = query.filter(TagAuthorization.credential_type == input_credential_code) + new_protection_code = full_protection_code + note = '%s permission for %s "%s" removed'%(args.accesstype,input_credential_type,args.credential) + else: + for code in db_access_code_map.keys(): + if code != input_access_code: + new_protection_code |= (full_protection_code & code) + note = '%s restrictions removed'%args.accesstype + query = query.delete() + else: + new_protection_code = full_protection_code | input_access_code + if input_credential is not None: + session.add(TagAuthorization(tag_name=args.tag, access_type=input_access_code, + credential=input_credential, credential_type=input_credential_code )) + note = '%s permission for %s "%s" added'%(args.accesstype,input_credential_type,args.credential) + else: + note = '%s restriction set'%args.accesstype + session.merge(Tag(name=args.tag,protection_code=new_protection_code)) + _update_tag_log(session,args.tag,datetime.datetime.utcnow(),action,note) + session.commit() + logging.info(note) + logging.info('Tag header updated. Action(s): %s' %action) + return 0 + def main(): '''Entry point. ''' @@ -2653,6 +2778,18 @@ def main(): parser_fromTimestamp.add_argument('timestamp', help="The Time timetype value") parser_fromTimestamp.set_defaults(func=fromTimestamp_) + parser_showProtections = parser_subparsers.add_parser('showProtections', description='Display the access restriction for the specified tag') + parser_showProtections.add_argument('tag', help="The tag name") + parser_showProtections.set_defaults(func=showProtections) + + parser_setProtection = parser_subparsers.add_parser('setProtection', description='Set an access restriction for the specified tag') + parser_setProtection.add_argument('tag', help="The tag name") + parser_setProtection.add_argument('--accesstype','-a', choices=[db_access_code_map[tag_db_write_access_code],db_access_code_map[tag_db_lock_access_code]], required=True, help='The access type of the protection (flag)') + parser_setProtection.add_argument('--credential','-c', help='The credential entitled with the permission') + parser_setProtection.add_argument('--credentialtype','-t', choices=[db_credential_type_map[db_key_credential_type_code][1],db_credential_type_map[db_cmsuser_credential_type_code][1]],help='The type of the credential provided. Required for "credential" option') + parser_setProtection.add_argument('--remove','-r',action='store_true', help='Remove the specified protection') + parser_setProtection.set_defaults(func=setProtection) + args = parser.parse_args() logging.basicConfig( format = '[%(asctime)s] %(levelname)s: %(message)s', From 9329fb33b0bec1c0d20df69396c5596866576ffe Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Thu, 6 May 2021 14:45:40 +0200 Subject: [PATCH 247/309] TrackDistanceValueMapProducer: check the size of the reference vector before copying --- .../plugins/TrackDistanceValueMapProducer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc b/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc index 8e94b94e8b3b6..0fc3c4ae5591d 100644 --- a/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc +++ b/Calibration/TkAlCaRecoProducers/plugins/TrackDistanceValueMapProducer.cc @@ -120,7 +120,9 @@ void TrackDistanceValueMapProducer::produce(edm::StreamID streamID, // just copy the first nth std::vector<float> reduced_vdR2; - std::copy(v_dR2.begin(), v_dR2.begin() + nthClosestTrack_, std::back_inserter(reduced_vdR2)); + std::copy(v_dR2.begin(), + v_dR2.begin() + std::min(v_dR2.size(), static_cast<size_t>(nthClosestTrack_)), + std::back_inserter(reduced_vdR2)); v2_dR2.push_back(reduced_vdR2); } From 1982ccf6b88c83bef8ab0521325d413c0ad13ac4 Mon Sep 17 00:00:00 2001 From: gennai <simone.gennai@cern.ch> Date: Fri, 7 May 2021 16:41:35 +0200 Subject: [PATCH 248/309] fixed the compilation error --- .../python/clients/beam_dqm_sourceclient-live_cfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py index 5923c1a0d383f..e8d6dd21857d2 100644 --- a/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/beam_dqm_sourceclient-live_cfg.py @@ -37,7 +37,7 @@ if 'unitTest=True' in sys.argv: live=False unitTest=True - useLockRecords = False. + useLockRecords = False #--------------- # Input sources From defee1c12a701204ddb88b11664260f8538493d2 Mon Sep 17 00:00:00 2001 From: Massimo Casarsa <massimo.casarsa@ts.infn.it> Date: Fri, 7 May 2021 14:54:19 +0200 Subject: [PATCH 249/309] Added optional histograms of BTL and ETL UncalibratedRecHits to monitor the BTL and ETL time resolutions and a ROOT macro to analyze them. --- .../MtdValidation/macro/makeTimeResPlots.C | 425 ++++++++++++++++++ .../plugins/BtlLocalRecoValidation.cc | 153 ++++++- .../plugins/EtlLocalRecoValidation.cc | 103 ++++- 3 files changed, 677 insertions(+), 4 deletions(-) create mode 100644 Validation/MtdValidation/macro/makeTimeResPlots.C diff --git a/Validation/MtdValidation/macro/makeTimeResPlots.C b/Validation/MtdValidation/macro/makeTimeResPlots.C new file mode 100644 index 0000000000000..c7cb2deb0ec7a --- /dev/null +++ b/Validation/MtdValidation/macro/makeTimeResPlots.C @@ -0,0 +1,425 @@ +// ============================================================================= +// +// This macro reads the histograms of time residuals of the BTL and ETL +// UncalibratedRecHits from the DQM root file and produces time resolution +// plots vs the hit amplitude and the hit |eta|. +// +// Usage: +// root -l make_resPlot.C\(\"DQM_filename.root\"\) +// +// NB: In order to have the UncalibratedRecHits histograms filled, +// the MTD validation has to be run the flags: +// +// process.btlLocalReco.UncalibRecHitsPlots = cms.bool(True); +// process.etlLocalReco.UncalibRecHitsPlots = cms.bool(True); +// +// ============================================================================= + +#include <iostream> +#include "TStyle.h" +#include "TFile.h" +#include "TString.h" +#include "TCanvas.h" +#include "TH1F.h" +#include "TFitResult.h" +#include "TLegend.h" + + +// ============================================================================= +// configuration + +const Float_t minBinContent = 20.; + +// --- BTL + +const Int_t nBinsQ_BTL = 20; +const Float_t binWidthQ_BTL = 30.; // [pC] +const Int_t nBinsQEta_BTL = 3; +const Float_t binsQEta_BTL[4] = {0., 0.65, 1.15, 1.55}; + +const Int_t nBinsEta_BTL = 31; +const Float_t binWidthEta_BTL = 0.05; +const Int_t nBinsEtaQ_BTL = 7; +const Float_t binsEtaQ_BTL[8] = {0., 30., 60., 90., 120., 150., 360., 600.}; + + +// --- ETL + +const Int_t nBinsQ_ETL = 20; +const Float_t binWidthQ_ETL = 1.3; // [MIP] + +const Int_t nBinsEta_ETL = 26; +const Float_t binWidthEta_ETL = 0.05; +const Float_t etaMin_ETL = 1.65; + + +// ============================================================================= + + +TCanvas* c[10]; + +TH1F* h_TimeResQ_BTL[nBinsQ_BTL]; +TH1F* h_TimeResQEta_BTL[nBinsQ_BTL][nBinsQEta_BTL]; +TH1F* h_TimeResEta_BTL[nBinsEta_BTL]; +TH1F* h_TimeResEtaQ_BTL[nBinsEta_BTL][nBinsEtaQ_BTL]; + +TH1F* g_TimeResQ_BTL; +TH1F* g_TimeResQEta_BTL[nBinsQEta_BTL]; +TH1F* g_TimeResEta_BTL; +TH1F* g_TimeResEtaQ_BTL[nBinsEtaQ_BTL]; + +TH1F* h_TimeResQ_ETL[2][nBinsQ_ETL]; +TH1F* h_TimeResEta_ETL[2][nBinsEta_ETL]; + +TH1F* g_TimeResQ_ETL[2]; +TH1F* g_TimeResEta_ETL[2]; + + +void makeTimeResPlots(const TString DQMfilename="DQM_V0001_UNKNOWN_R000000001.root"){ + + gStyle->SetOptStat(kFALSE); + + // --- Histograms booking + + g_TimeResQ_BTL = new TH1F("g_TimeResQ_BTL", "BTL time resolution vs Q", + nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); + + for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) { + + TString hname = Form("g_TimeResQEta_BTL_%d", ih); + TString htitle = Form("BTL time resolution vs Q (%4.2f < |#eta_{hit}| < %4.2f)", + binsQEta_BTL[ih], binsQEta_BTL[ih+1]); + g_TimeResQEta_BTL[ih] = new TH1F(hname, htitle, nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); + + } + + + g_TimeResEta_BTL = new TH1F("g_TimeResEta_BTL", "BTL time resolution vs |#eta_{hit}|", + nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); + + for (Int_t ih=0; ih<nBinsEtaQ_BTL; ++ih) { + + TString hname = Form("g_TimeResEtaQ_BTL_%d", ih); + TString htitle = Form("BTL time resolution vs |#eta_{hit}| (%4.2f < Q < %4.2f)", + binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]); + g_TimeResEtaQ_BTL[ih] = new TH1F(hname, htitle, nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); + + } + + + for (Int_t iside=0; iside<2; ++iside) { + + TString hname = Form("g_TimeResQ_ETL_%d", iside); + g_TimeResQ_ETL[iside] = new TH1F(hname, "ETL time resolution vs amplitude", + nBinsQ_ETL, 0., nBinsQ_ETL*binWidthQ_ETL); + + hname = Form("g_TimeResEta_ETL_%d", iside); + g_TimeResEta_ETL[iside] = new TH1F(hname, "ETL time resolution vs |#eta_{hit}|", + nBinsEta_ETL, etaMin_ETL, etaMin_ETL+nBinsEta_ETL*binWidthEta_ETL); + + } + + std::cout << " Processing file " << DQMfilename.Data() << " ... " << std::endl; + TFile* input_file = new TFile(DQMfilename.Data()); + + + // --------------------------------------------------------------------------- + // BTL time resolution vs Q + + for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQ_%d",iq); + h_TimeResQ_BTL[iq] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResQ_BTL[iq]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResQ_BTL[iq]->GetMean() - 2.*h_TimeResQ_BTL[iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_BTL[iq]->GetMean() + 3*h_TimeResQ_BTL[iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQ_BTL[iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResQ_BTL[iq]->GetName() << std::endl; + continue; + } + + g_TimeResQ_BTL->SetBinContent(iq+1,fit_res->GetParams()[2]); + g_TimeResQ_BTL->SetBinError(iq+1,fit_res->GetErrors()[2]); + + } // iq loop + + + // --------------------------------------------------------------------------- + // BTL time resolution vs Q in bind of |eta| + + for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { + + for (Int_t ieta=0; ieta<nBinsQEta_BTL; ++ieta) { + + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQvsEta_%d_%d", + iq, ieta); + h_TimeResQEta_BTL[iq][ieta] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResQEta_BTL[iq][ieta]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() - + 2.*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + Float_t up_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() + + 3*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQEta_BTL[iq][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResQEta_BTL[iq][ieta]->GetName() << std::endl; + continue; + } + + g_TimeResQEta_BTL[ieta]->SetBinContent(iq+1,fit_res->GetParams()[2]); + g_TimeResQEta_BTL[ieta]->SetBinError(iq+1,fit_res->GetErrors()[2]); + + } // ieta loop + + } // iq loop + + + // --------------------------------------------------------------------------- + // BTL time resolution vs |eta| + + for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta){ + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEta_%d",ieta); + h_TimeResEta_BTL[ieta] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResEta_BTL[ieta]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResEta_BTL[ieta]->GetMean() - 2.*h_TimeResEta_BTL[ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_BTL[ieta]->GetMean() + 3*h_TimeResEta_BTL[ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEta_BTL[ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResEta_BTL[ieta]->GetName() << std::endl; + continue; + } + + g_TimeResEta_BTL->SetBinContent(ieta+1,fit_res->GetParams()[2]); + g_TimeResEta_BTL->SetBinError(ieta+1,fit_res->GetErrors()[2]); + + } // ieta loop + + + // --------------------------------------------------------------------------- + // BTL time resolution vs |eta| in bind of Q + + for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta) { + + for (Int_t iq=0; iq<nBinsEtaQ_BTL; ++iq) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEtavsQ_%d_%d", + ieta, iq); + h_TimeResEtaQ_BTL[ieta][iq] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResEtaQ_BTL[ieta][iq]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() - + 2.*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); + Float_t up_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() + + 3*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEtaQ_BTL[ieta][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResEtaQ_BTL[ieta][iq]->GetName() << std::endl; + continue; + } + + g_TimeResEtaQ_BTL[iq]->SetBinContent(ieta+1,fit_res->GetParams()[2]); + g_TimeResEtaQ_BTL[iq]->SetBinError(ieta+1,fit_res->GetErrors()[2]); + + } // iq loop + + } // ieta loop + + + // --------------------------------------------------------------------------- + // ETL time resolution vs amplitude and |eta| + + for (Int_t iside=0; iside<2; ++iside) { + + for (Int_t iq=0; iq<nBinsQ_ETL; ++iq) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResQ_%d_%d", iside, iq); + h_TimeResQ_ETL[iside][iq] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResQ_ETL[iside][iq]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResQ_ETL[iside][iq]->GetMean() - 2.*h_TimeResQ_ETL[iside][iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_ETL[iside][iq]->GetMean() + 3*h_TimeResQ_ETL[iside][iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQ_ETL[iside][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResQ_ETL[iside][iq]->GetName() << std::endl; + continue; + } + + g_TimeResQ_ETL[iside]->SetBinContent(iq+1,fit_res->GetParams()[2]); + g_TimeResQ_ETL[iside]->SetBinError(iq+1,fit_res->GetErrors()[2]); + + } // iq loop + + + for (Int_t ieta=0; ieta<nBinsEta_ETL; ++ieta) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResEta_%d_%d", iside, ieta); + h_TimeResEta_ETL[iside][ieta] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResEta_ETL[iside][ieta]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() - 2.*h_TimeResEta_ETL[iside][ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() + 3*h_TimeResEta_ETL[iside][ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEta_ETL[iside][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResEta_ETL[iside][ieta]->GetName() << std::endl; + continue; + } + + g_TimeResEta_ETL[iside]->SetBinContent(ieta+1,fit_res->GetParams()[2]); + g_TimeResEta_ETL[iside]->SetBinError(ieta+1,fit_res->GetErrors()[2]); + + } // ieta loop + + } // iside loop + + + // ============================================================================= + // Draw the histograms + + + // --- BTL + + c[0] = new TCanvas("c_0","BTL time resolution vs Q"); + c[0]->SetGridy(kTRUE); + g_TimeResQ_BTL->SetTitle("BTL UncalibratedRecHits"); + g_TimeResQ_BTL->SetMarkerStyle(20); + g_TimeResQ_BTL->SetMarkerColor(4); + g_TimeResQ_BTL->SetXTitle("hit amplitude [pC]"); + g_TimeResQ_BTL->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQ_BTL->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQ_BTL->Draw("EP"); + + + c[1] = new TCanvas("c_1","BTL time resolution vs Q"); + c[1]->SetGridy(kTRUE); + g_TimeResQEta_BTL[0]->SetTitle("BTL UncalibratedRecHits"); + g_TimeResQEta_BTL[0]->SetXTitle("hit amplitude [pC]"); + g_TimeResQEta_BTL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQEta_BTL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQEta_BTL[0]->SetMarkerStyle(20); + g_TimeResQEta_BTL[0]->SetMarkerColor(1); + g_TimeResQEta_BTL[0]->Draw("EP"); + g_TimeResQEta_BTL[1]->SetMarkerStyle(20); + g_TimeResQEta_BTL[1]->SetMarkerColor(4); + g_TimeResQEta_BTL[1]->Draw("EPSAME"); + g_TimeResQEta_BTL[2]->SetMarkerStyle(20); + g_TimeResQEta_BTL[2]->SetMarkerColor(2); + g_TimeResQEta_BTL[2]->Draw("EPSAME"); + + TLegend* legend_1 = new TLegend(0.510,0.634,0.862,0.847); + legend_1->SetBorderSize(0.); + legend_1->SetFillStyle(0); + for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) + legend_1->AddEntry(g_TimeResQEta_BTL[ih], + Form("%4.2f #leq |#eta_{hit}| < %4.2f", binsQEta_BTL[ih], binsQEta_BTL[ih+1]), + "LP"); + legend_1->Draw(); + + + c[2] = new TCanvas("c_2","BTL time resolution vs eta"); + c[2]->SetGridy(kTRUE); + g_TimeResEta_BTL->SetTitle("BTL UncalibratedRecHits"); + g_TimeResEta_BTL->SetMarkerStyle(20); + g_TimeResEta_BTL->SetMarkerColor(4); + g_TimeResEta_BTL->SetXTitle("|#eta_{hit}|"); + g_TimeResEta_BTL->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEta_BTL->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEta_BTL->Draw("EP"); + + + c[3] = new TCanvas("c_3","BTL time resolution vs eta"); + c[3]->SetGridy(kTRUE); + g_TimeResEtaQ_BTL[1]->SetTitle("BTL UncalibratedRecHits"); + g_TimeResEtaQ_BTL[1]->SetXTitle("|#eta_{hit}|"); + g_TimeResEtaQ_BTL[1]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEtaQ_BTL[1]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEtaQ_BTL[1]->SetMarkerStyle(20); + g_TimeResEtaQ_BTL[1]->SetMarkerColor(1); + g_TimeResEtaQ_BTL[1]->Draw("EP"); + + TLegend* legend_3 = new TLegend(0.649,0.124,0.862,0.328); + legend_3->SetBorderSize(0.); + legend_3->SetFillStyle(0); + for (Int_t ih=1; ih<nBinsEtaQ_BTL; ++ih){ + + if ( ih > 1 ) { + g_TimeResEtaQ_BTL[ih]->SetMarkerStyle(20); + g_TimeResEtaQ_BTL[ih]->SetMarkerColor(ih); + g_TimeResEtaQ_BTL[ih]->Draw("EPSAME"); + } + + legend_3->AddEntry(g_TimeResEtaQ_BTL[ih], + Form("%4.0f #leq Q_{hit} < %4.0f pC", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]), + "LP"); + } + + legend_3->Draw(); + + + // --- ETL + + c[4] = new TCanvas("c_4","ETL time resolution vs amplitude"); + c[4]->SetGridy(kTRUE); + g_TimeResQ_ETL[0]->SetTitle("ETL UncalibratedRecHits"); + g_TimeResQ_ETL[0]->SetXTitle("hit amplitude [MIP]"); + g_TimeResQ_ETL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQ_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQ_ETL[0]->SetMarkerStyle(20); + g_TimeResQ_ETL[0]->SetMarkerColor(4); + g_TimeResQ_ETL[0]->Draw("EP"); + g_TimeResQ_ETL[1]->SetMarkerStyle(20); + g_TimeResQ_ETL[1]->SetMarkerColor(2); + g_TimeResQ_ETL[1]->Draw("EPSAME"); + + TLegend* legend_4 = new TLegend(0.673,0.655,0.872,0.819); + legend_4->SetBorderSize(0.); + legend_4->SetFillStyle(0); + legend_4->AddEntry(g_TimeResQ_ETL[0], "ETL-", "LP"); + legend_4->AddEntry(g_TimeResQ_ETL[1], "ETL+", "LP"); + legend_4->DrawClone(); + + + c[5] = new TCanvas("c_5","ETL time resolution vs |eta|"); + c[5]->SetGridy(kTRUE); + g_TimeResEta_ETL[0]->SetTitle("ETL UncalibratedRecHits"); + g_TimeResEta_ETL[0]->SetXTitle("|#eta_{hit}|"); + g_TimeResEta_ETL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEta_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEta_ETL[0]->SetMarkerStyle(20); + g_TimeResEta_ETL[0]->SetMarkerColor(4); + g_TimeResEta_ETL[0]->Draw("EP"); + g_TimeResEta_ETL[1]->SetMarkerStyle(20); + g_TimeResEta_ETL[1]->SetMarkerColor(2); + g_TimeResEta_ETL[1]->Draw("EPSAME"); + + legend_4->DrawClone(); + +} diff --git a/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc b/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc index ab50036cc1115..b3db52544426b 100644 --- a/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc +++ b/Validation/MtdValidation/plugins/BtlLocalRecoValidation.cc @@ -66,8 +66,11 @@ class BtlLocalRecoValidation : public DQMEDAnalyzer { const std::string folder_; const double hitMinEnergy_; const bool LocalPosDebug_; + const bool uncalibRecHitsPlots_; + const double hitMinAmplitude_; edm::EDGetTokenT<FTLRecHitCollection> btlRecHitsToken_; + edm::EDGetTokenT<FTLUncalibratedRecHitCollection> btlUncalibRecHitsToken_; edm::EDGetTokenT<CrossingFrame<PSimHit> > btlSimHitsToken_; edm::EDGetTokenT<FTLClusterCollection> btlRecCluToken_; @@ -123,16 +126,40 @@ class BtlLocalRecoValidation : public DQMEDAnalyzer { MonitorElement* meCluEta_; MonitorElement* meCluHits_; MonitorElement* meCluZvsPhi_; + + // --- UncalibratedRecHits histograms + + static constexpr int nBinsQ_ = 20; + static constexpr float binWidthQ_ = 30.; + static constexpr int nBinsQEta_ = 3; + static constexpr float binsQEta_[nBinsQEta_ + 1] = {0., 0.65, 1.15, 1.55}; + + MonitorElement* meTimeResQ_[nBinsQ_]; + MonitorElement* meTimeResQvsEta_[nBinsQ_][nBinsQEta_]; + + static constexpr int nBinsEta_ = 31; + static constexpr float binWidthEta_ = 0.05; + static constexpr int nBinsEtaQ_ = 7; + static constexpr float binsEtaQ_[nBinsEtaQ_ + 1] = {0., 30., 60., 90., 120., 150., 360., 600.}; + + MonitorElement* meTimeResEta_[nBinsEta_]; + MonitorElement* meTimeResEtavsQ_[nBinsEta_][nBinsEtaQ_]; }; // ------------ constructor and destructor -------------- BtlLocalRecoValidation::BtlLocalRecoValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter<std::string>("folder")), - hitMinEnergy_(iConfig.getParameter<double>("hitMinimumEnergy")), - LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")) { + hitMinEnergy_(iConfig.getParameter<double>("HitMinimumEnergy")), + LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")), + uncalibRecHitsPlots_(iConfig.getParameter<bool>("UncalibRecHitsPlots")), + hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")) { btlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsTag")); + if (uncalibRecHitsPlots_) + btlUncalibRecHitsToken_ = + consumes<FTLUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("uncalibRecHitsTag")); btlSimHitsToken_ = consumes<CrossingFrame<PSimHit> >(iConfig.getParameter<edm::InputTag>("simHitsTag")); btlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTag")); + mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>(); mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>(); } @@ -287,6 +314,91 @@ void BtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS meCluHits_->Fill(cluster.size()); } } + + // --- Loop over the BTL Uncalibrated RECO hits + if (uncalibRecHitsPlots_) { + auto btlUncalibRecHitsHandle = makeValid(iEvent.getHandle(btlUncalibRecHitsToken_)); + + for (const auto& uRecHit : *btlUncalibRecHitsHandle) { + BTLDetId detId = uRecHit.id(); + + // --- Skip UncalibratedRecHits not matched to SimHits + if (m_btlSimHits.count(detId.rawId()) != 1) + continue; + + DetId geoId = detId.geographicalId(MTDTopologyMode::crysLayoutFromTopoMode(topology->getMTDTopologyMode())); + const MTDGeomDet* thedet = geom->idToDet(geoId); + if (thedet == nullptr) + throw cms::Exception("BtlLocalRecoValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " (" + << detId.rawId() << ") is invalid!" << std::dec << std::endl; + const ProxyMTDTopology& topoproxy = static_cast<const ProxyMTDTopology&>(thedet->topology()); + const RectangularMTDTopology& topo = static_cast<const RectangularMTDTopology&>(topoproxy.specificTopology()); + + Local3DPoint local_point(0., 0., 0.); + local_point = topo.pixelToModuleLocalPoint(local_point, detId.row(topo.nrows()), detId.column(topo.nrows())); + const auto& global_point = thedet->toGlobal(local_point); + + // --- Combine the information from the left and right BTL cell sides + + float nHits = 0.; + float hit_amplitude = 0.; + float hit_time = 0.; + + // left side: + if (uRecHit.amplitude().first > 0.) { + hit_amplitude += uRecHit.amplitude().first; + hit_time += uRecHit.time().first; + nHits += 1.; + } + // right side: + if (uRecHit.amplitude().second > 0.) { + hit_amplitude += uRecHit.amplitude().second; + hit_time += uRecHit.time().second; + nHits += 1.; + } + + hit_amplitude /= nHits; + hit_time /= nHits; + + // --- Fill the histograms + + if (hit_amplitude < hitMinAmplitude_) + continue; + + float time_res = hit_time - m_btlSimHits[detId.rawId()].time; + + // amplitude histograms + + int qBin = (int)(hit_amplitude / binWidthQ_); + if (qBin > nBinsQ_ - 1) + qBin = nBinsQ_ - 1; + + meTimeResQ_[qBin]->Fill(time_res); + + int etaBin = 0; + for (int ibin = 1; ibin < nBinsQEta_; ++ibin) + if (fabs(global_point.eta()) >= binsQEta_[ibin] && fabs(global_point.eta()) < binsQEta_[ibin + 1]) + etaBin = ibin; + + meTimeResQvsEta_[qBin][etaBin]->Fill(time_res); + + // eta histograms + + etaBin = (int)(fabs(global_point.eta()) / binWidthEta_); + if (etaBin > nBinsEta_ - 1) + etaBin = nBinsEta_ - 1; + + meTimeResEta_[etaBin]->Fill(time_res); + + qBin = 0; + for (int ibin = 1; ibin < nBinsEtaQ_; ++ibin) + if (hit_amplitude >= binsEtaQ_[ibin] && hit_amplitude < binsEtaQ_[ibin + 1]) + qBin = ibin; + + meTimeResEtavsQ_[etaBin][qBin]->Fill(time_res); + + } // uRecHit loop + } } // ------------ method for histogram booking ------------ @@ -376,6 +488,38 @@ void BtlLocalRecoValidation::bookHistograms(DQMStore::IBooker& ibook, meCluHits_ = ibook.book1D("BtlCluHitNumber", "BTL hits per cluster; Cluster size", 10, 0, 10); meCluZvsPhi_ = ibook.book2D( "BtlOccupancy", "BTL cluster Z vs #phi;Z_{RECO} [cm]; #phi_{RECO} [rad]", 144, -260., 260., 50, -3.2, 3.2); + + // --- UncalibratedRecHits histograms + + if (uncalibRecHitsPlots_) { + for (unsigned int ihistoQ = 0; ihistoQ < nBinsQ_; ++ihistoQ) { + std::string hname = Form("TimeResQ_%d", ihistoQ); + std::string htitle = Form("BTL time resolution (Q bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoQ); + meTimeResQ_[ihistoQ] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + for (unsigned int ihistoEta = 0; ihistoEta < nBinsQEta_; ++ihistoEta) { + hname = Form("TimeResQvsEta_%d_%d", ihistoQ, ihistoEta); + htitle = Form("BTL time resolution (Q bin = %d, |#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoQ, ihistoEta); + meTimeResQvsEta_[ihistoQ][ihistoEta] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + } // ihistoEta loop + + } // ihistoQ loop + + for (unsigned int ihistoEta = 0; ihistoEta < nBinsEta_; ++ihistoEta) { + std::string hname = Form("TimeResEta_%d", ihistoEta); + std::string htitle = Form("BTL time resolution (|#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoEta); + meTimeResEta_[ihistoEta] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + for (unsigned int ihistoQ = 0; ihistoQ < nBinsEtaQ_; ++ihistoQ) { + hname = Form("TimeResEtavsQ_%d_%d", ihistoEta, ihistoQ); + htitle = Form("BTL time resolution (|#eta| bin = %d, Q bin = %d);T_{RECO} - T_{SIM} [ns]", ihistoEta, ihistoQ); + meTimeResEtavsQ_[ihistoEta][ihistoQ] = ibook.book1D(hname, htitle, 200, -0.3, 0.7); + + } // ihistoQ loop + + } // ihistoEta loop + } } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -384,10 +528,13 @@ void BtlLocalRecoValidation::fillDescriptions(edm::ConfigurationDescriptions& de desc.add<std::string>("folder", "MTD/BTL/LocalReco"); desc.add<edm::InputTag>("recHitsTag", edm::InputTag("mtdRecHits", "FTLBarrel")); + desc.add<edm::InputTag>("uncalibRecHitsTag", edm::InputTag("mtdUncalibratedRecHits", "FTLBarrel")); desc.add<edm::InputTag>("simHitsTag", edm::InputTag("mix", "g4SimHitsFastTimerHitsBarrel")); desc.add<edm::InputTag>("recCluTag", edm::InputTag("mtdClusters", "FTLBarrel")); - desc.add<double>("hitMinimumEnergy", 1.); // [MeV] + desc.add<double>("HitMinimumEnergy", 1.); // [MeV] desc.add<bool>("LocalPositionDebug", false); + desc.add<bool>("UncalibRecHitsPlots", false); + desc.add<double>("HitMinimumAmplitude", 30.); // [pC] descriptions.add("btlLocalReco", desc); } diff --git a/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc b/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc index 108bfdf2537c0..01616073904c5 100644 --- a/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc +++ b/Validation/MtdValidation/plugins/EtlLocalRecoValidation.cc @@ -63,8 +63,11 @@ class EtlLocalRecoValidation : public DQMEDAnalyzer { const float hitMinEnergy1Dis_; const float hitMinEnergy2Dis_; const bool LocalPosDebug_; + const bool uncalibRecHitsPlots_; + const double hitMinAmplitude_; edm::EDGetTokenT<FTLRecHitCollection> etlRecHitsToken_; + edm::EDGetTokenT<FTLUncalibratedRecHitCollection> etlUncalibRecHitsToken_; edm::EDGetTokenT<CrossingFrame<PSimHit> > etlSimHitsToken_; edm::EDGetTokenT<FTLClusterCollection> etlRecCluToken_; @@ -108,6 +111,19 @@ class EtlLocalRecoValidation : public DQMEDAnalyzer { MonitorElement* meEnergyRes_; MonitorElement* meTPullvsE_; MonitorElement* meTPullvsEta_; + + // --- UncalibratedRecHits histograms + + static constexpr int nBinsQ_ = 20; + static constexpr float binWidthQ_ = 1.3; // in MIP units + + MonitorElement* meTimeResQ_[2][nBinsQ_]; + + static constexpr int nBinsEta_ = 26; + static constexpr float binWidthEta_ = 0.05; + static constexpr float etaMin_ = 1.65; + + MonitorElement* meTimeResEta_[2][nBinsEta_]; }; // ------------ constructor and destructor -------------- @@ -115,10 +131,16 @@ EtlLocalRecoValidation::EtlLocalRecoValidation(const edm::ParameterSet& iConfig) : folder_(iConfig.getParameter<std::string>("folder")), hitMinEnergy1Dis_(iConfig.getParameter<double>("hitMinimumEnergy1Dis")), hitMinEnergy2Dis_(iConfig.getParameter<double>("hitMinimumEnergy2Dis")), - LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")) { + LocalPosDebug_(iConfig.getParameter<bool>("LocalPositionDebug")), + uncalibRecHitsPlots_(iConfig.getParameter<bool>("UncalibRecHitsPlots")), + hitMinAmplitude_(iConfig.getParameter<double>("HitMinimumAmplitude")) { etlRecHitsToken_ = consumes<FTLRecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsTag")); + if (uncalibRecHitsPlots_) + etlUncalibRecHitsToken_ = + consumes<FTLUncalibratedRecHitCollection>(iConfig.getParameter<edm::InputTag>("uncalibRecHitsTag")); etlSimHitsToken_ = consumes<CrossingFrame<PSimHit> >(iConfig.getParameter<edm::InputTag>("simHitsTag")); etlRecCluToken_ = consumes<FTLClusterCollection>(iConfig.getParameter<edm::InputTag>("recCluTag")); + mtdgeoToken_ = esConsumes<MTDGeometry, MTDDigiGeometryRecord>(); mtdtopoToken_ = esConsumes<MTDTopology, MTDTopologyRcd>(); } @@ -357,6 +379,59 @@ void EtlLocalRecoValidation::analyze(const edm::Event& iEvent, const edm::EventS meCluHits_[idet]->Fill(cluster.size()); } } + + // --- Loop over the ETL Uncalibrated RECO hits + if (uncalibRecHitsPlots_) { + auto etlUncalibRecHitsHandle = makeValid(iEvent.getHandle(etlUncalibRecHitsToken_)); + + for (const auto& uRecHit : *etlUncalibRecHitsHandle) { + ETLDetId detId = uRecHit.id(); + + int idet = detId.zside() + detId.nDisc(); + + // --- Skip UncalibratedRecHits not matched to SimHits + if (m_etlSimHits[idet].count(detId.rawId()) != 1) + continue; + + DetId geoId = detId.geographicalId(); + const MTDGeomDet* thedet = geom->idToDet(geoId); + if (thedet == nullptr) + throw cms::Exception("EtlLocalRecoValidation") << "GeographicalID: " << std::hex << geoId.rawId() << " (" + << detId.rawId() << ") is invalid!" << std::dec << std::endl; + const PixelTopology& topo = static_cast<const PixelTopology&>(thedet->topology()); + + Local3DPoint local_point(topo.localX(uRecHit.row()), topo.localY(uRecHit.column()), 0.); + const auto& global_point = thedet->toGlobal(local_point); + + // --- Fill the histograms + + if (uRecHit.amplitude().first < hitMinAmplitude_) + continue; + + float time_res = uRecHit.time().first - m_etlSimHits[idet][detId.rawId()].time; + + int iside = (detId.zside() == -1 ? 0 : 1); + + // amplitude histograms + + int qBin = (int)(uRecHit.amplitude().first / binWidthQ_); + if (qBin > nBinsQ_ - 1) + qBin = nBinsQ_ - 1; + + meTimeResQ_[iside][qBin]->Fill(time_res); + + // eta histograms + + int etaBin = (int)((fabs(global_point.eta()) - etaMin_) / binWidthEta_); + if (etaBin < 0) + etaBin = 0; + else if (etaBin > nBinsEta_ - 1) + etaBin = nBinsEta_ - 1; + + meTimeResEta_[iside][etaBin]->Fill(time_res); + + } // uRecHit loop + } } // ------------ method for histogram booking ------------ @@ -738,6 +813,29 @@ void EtlLocalRecoValidation::bookHistograms(DQMStore::IBooker& ibook, 100, -150, 150); + + // --- UncalibratedRecHits histograms + + if (uncalibRecHitsPlots_) { + const std::string det_name[2] = {"ETL-", "ETL+"}; + for (unsigned int iside = 0; iside < 2; ++iside) { + for (unsigned int ihistoQ = 0; ihistoQ < nBinsQ_; ++ihistoQ) { + std::string hname = Form("TimeResQ_%d_%d", iside, ihistoQ); + std::string htitle = + Form("%s time resolution (Q bin = %d);T_{RECO} - T_{SIM} [ns]", det_name[iside].data(), ihistoQ); + meTimeResQ_[iside][ihistoQ] = ibook.book1D(hname, htitle, 200, -0.5, 0.5); + + } // ihistoQ loop + + for (unsigned int ihistoEta = 0; ihistoEta < nBinsEta_; ++ihistoEta) { + std::string hname = Form("TimeResEta_%d_%d", iside, ihistoEta); + std::string htitle = + Form("%s time resolution (|#eta| bin = %d);T_{RECO} - T_{SIM} [ns]", det_name[iside].data(), ihistoEta); + meTimeResEta_[iside][ihistoEta] = ibook.book1D(hname, htitle, 200, -0.5, 0.5); + + } // ihistoEta loop + } + } } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ @@ -746,11 +844,14 @@ void EtlLocalRecoValidation::fillDescriptions(edm::ConfigurationDescriptions& de desc.add<std::string>("folder", "MTD/ETL/LocalReco"); desc.add<edm::InputTag>("recHitsTag", edm::InputTag("mtdRecHits", "FTLEndcap")); + desc.add<edm::InputTag>("uncalibRecHitsTag", edm::InputTag("mtdUncalibratedRecHits", "FTLEndcap")); desc.add<edm::InputTag>("simHitsTag", edm::InputTag("mix", "g4SimHitsFastTimerHitsEndcap")); desc.add<edm::InputTag>("recCluTag", edm::InputTag("mtdClusters", "FTLEndcap")); desc.add<double>("hitMinimumEnergy1Dis", 1.); // [MeV] desc.add<double>("hitMinimumEnergy2Dis", 0.001); // [MeV] desc.add<bool>("LocalPositionDebug", false); + desc.add<bool>("UncalibRecHitsPlots", false); + desc.add<double>("HitMinimumAmplitude", 0.33); // [MIP] descriptions.add("etlLocalReco", desc); } From a92841dc8a9cfdd1ea95a4ac2551fd08d678927c Mon Sep 17 00:00:00 2001 From: Massimo Casarsa <massimo.casarsa@ts.infn.it> Date: Fri, 7 May 2021 16:54:57 +0200 Subject: [PATCH 250/309] Applied code-format and renamed macro to macros --- .../MtdValidation/macros/makeTimeResPlots.C | 425 ++++++++++++++++++ 1 file changed, 425 insertions(+) create mode 100644 Validation/MtdValidation/macros/makeTimeResPlots.C diff --git a/Validation/MtdValidation/macros/makeTimeResPlots.C b/Validation/MtdValidation/macros/makeTimeResPlots.C new file mode 100644 index 0000000000000..c7cb2deb0ec7a --- /dev/null +++ b/Validation/MtdValidation/macros/makeTimeResPlots.C @@ -0,0 +1,425 @@ +// ============================================================================= +// +// This macro reads the histograms of time residuals of the BTL and ETL +// UncalibratedRecHits from the DQM root file and produces time resolution +// plots vs the hit amplitude and the hit |eta|. +// +// Usage: +// root -l make_resPlot.C\(\"DQM_filename.root\"\) +// +// NB: In order to have the UncalibratedRecHits histograms filled, +// the MTD validation has to be run the flags: +// +// process.btlLocalReco.UncalibRecHitsPlots = cms.bool(True); +// process.etlLocalReco.UncalibRecHitsPlots = cms.bool(True); +// +// ============================================================================= + +#include <iostream> +#include "TStyle.h" +#include "TFile.h" +#include "TString.h" +#include "TCanvas.h" +#include "TH1F.h" +#include "TFitResult.h" +#include "TLegend.h" + + +// ============================================================================= +// configuration + +const Float_t minBinContent = 20.; + +// --- BTL + +const Int_t nBinsQ_BTL = 20; +const Float_t binWidthQ_BTL = 30.; // [pC] +const Int_t nBinsQEta_BTL = 3; +const Float_t binsQEta_BTL[4] = {0., 0.65, 1.15, 1.55}; + +const Int_t nBinsEta_BTL = 31; +const Float_t binWidthEta_BTL = 0.05; +const Int_t nBinsEtaQ_BTL = 7; +const Float_t binsEtaQ_BTL[8] = {0., 30., 60., 90., 120., 150., 360., 600.}; + + +// --- ETL + +const Int_t nBinsQ_ETL = 20; +const Float_t binWidthQ_ETL = 1.3; // [MIP] + +const Int_t nBinsEta_ETL = 26; +const Float_t binWidthEta_ETL = 0.05; +const Float_t etaMin_ETL = 1.65; + + +// ============================================================================= + + +TCanvas* c[10]; + +TH1F* h_TimeResQ_BTL[nBinsQ_BTL]; +TH1F* h_TimeResQEta_BTL[nBinsQ_BTL][nBinsQEta_BTL]; +TH1F* h_TimeResEta_BTL[nBinsEta_BTL]; +TH1F* h_TimeResEtaQ_BTL[nBinsEta_BTL][nBinsEtaQ_BTL]; + +TH1F* g_TimeResQ_BTL; +TH1F* g_TimeResQEta_BTL[nBinsQEta_BTL]; +TH1F* g_TimeResEta_BTL; +TH1F* g_TimeResEtaQ_BTL[nBinsEtaQ_BTL]; + +TH1F* h_TimeResQ_ETL[2][nBinsQ_ETL]; +TH1F* h_TimeResEta_ETL[2][nBinsEta_ETL]; + +TH1F* g_TimeResQ_ETL[2]; +TH1F* g_TimeResEta_ETL[2]; + + +void makeTimeResPlots(const TString DQMfilename="DQM_V0001_UNKNOWN_R000000001.root"){ + + gStyle->SetOptStat(kFALSE); + + // --- Histograms booking + + g_TimeResQ_BTL = new TH1F("g_TimeResQ_BTL", "BTL time resolution vs Q", + nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); + + for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) { + + TString hname = Form("g_TimeResQEta_BTL_%d", ih); + TString htitle = Form("BTL time resolution vs Q (%4.2f < |#eta_{hit}| < %4.2f)", + binsQEta_BTL[ih], binsQEta_BTL[ih+1]); + g_TimeResQEta_BTL[ih] = new TH1F(hname, htitle, nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); + + } + + + g_TimeResEta_BTL = new TH1F("g_TimeResEta_BTL", "BTL time resolution vs |#eta_{hit}|", + nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); + + for (Int_t ih=0; ih<nBinsEtaQ_BTL; ++ih) { + + TString hname = Form("g_TimeResEtaQ_BTL_%d", ih); + TString htitle = Form("BTL time resolution vs |#eta_{hit}| (%4.2f < Q < %4.2f)", + binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]); + g_TimeResEtaQ_BTL[ih] = new TH1F(hname, htitle, nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); + + } + + + for (Int_t iside=0; iside<2; ++iside) { + + TString hname = Form("g_TimeResQ_ETL_%d", iside); + g_TimeResQ_ETL[iside] = new TH1F(hname, "ETL time resolution vs amplitude", + nBinsQ_ETL, 0., nBinsQ_ETL*binWidthQ_ETL); + + hname = Form("g_TimeResEta_ETL_%d", iside); + g_TimeResEta_ETL[iside] = new TH1F(hname, "ETL time resolution vs |#eta_{hit}|", + nBinsEta_ETL, etaMin_ETL, etaMin_ETL+nBinsEta_ETL*binWidthEta_ETL); + + } + + std::cout << " Processing file " << DQMfilename.Data() << " ... " << std::endl; + TFile* input_file = new TFile(DQMfilename.Data()); + + + // --------------------------------------------------------------------------- + // BTL time resolution vs Q + + for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQ_%d",iq); + h_TimeResQ_BTL[iq] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResQ_BTL[iq]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResQ_BTL[iq]->GetMean() - 2.*h_TimeResQ_BTL[iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_BTL[iq]->GetMean() + 3*h_TimeResQ_BTL[iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQ_BTL[iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResQ_BTL[iq]->GetName() << std::endl; + continue; + } + + g_TimeResQ_BTL->SetBinContent(iq+1,fit_res->GetParams()[2]); + g_TimeResQ_BTL->SetBinError(iq+1,fit_res->GetErrors()[2]); + + } // iq loop + + + // --------------------------------------------------------------------------- + // BTL time resolution vs Q in bind of |eta| + + for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { + + for (Int_t ieta=0; ieta<nBinsQEta_BTL; ++ieta) { + + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQvsEta_%d_%d", + iq, ieta); + h_TimeResQEta_BTL[iq][ieta] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResQEta_BTL[iq][ieta]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() - + 2.*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + Float_t up_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() + + 3*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQEta_BTL[iq][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResQEta_BTL[iq][ieta]->GetName() << std::endl; + continue; + } + + g_TimeResQEta_BTL[ieta]->SetBinContent(iq+1,fit_res->GetParams()[2]); + g_TimeResQEta_BTL[ieta]->SetBinError(iq+1,fit_res->GetErrors()[2]); + + } // ieta loop + + } // iq loop + + + // --------------------------------------------------------------------------- + // BTL time resolution vs |eta| + + for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta){ + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEta_%d",ieta); + h_TimeResEta_BTL[ieta] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResEta_BTL[ieta]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResEta_BTL[ieta]->GetMean() - 2.*h_TimeResEta_BTL[ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_BTL[ieta]->GetMean() + 3*h_TimeResEta_BTL[ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEta_BTL[ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResEta_BTL[ieta]->GetName() << std::endl; + continue; + } + + g_TimeResEta_BTL->SetBinContent(ieta+1,fit_res->GetParams()[2]); + g_TimeResEta_BTL->SetBinError(ieta+1,fit_res->GetErrors()[2]); + + } // ieta loop + + + // --------------------------------------------------------------------------- + // BTL time resolution vs |eta| in bind of Q + + for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta) { + + for (Int_t iq=0; iq<nBinsEtaQ_BTL; ++iq) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEtavsQ_%d_%d", + ieta, iq); + h_TimeResEtaQ_BTL[ieta][iq] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResEtaQ_BTL[ieta][iq]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() - + 2.*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); + Float_t up_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() + + 3*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEtaQ_BTL[ieta][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResEtaQ_BTL[ieta][iq]->GetName() << std::endl; + continue; + } + + g_TimeResEtaQ_BTL[iq]->SetBinContent(ieta+1,fit_res->GetParams()[2]); + g_TimeResEtaQ_BTL[iq]->SetBinError(ieta+1,fit_res->GetErrors()[2]); + + } // iq loop + + } // ieta loop + + + // --------------------------------------------------------------------------- + // ETL time resolution vs amplitude and |eta| + + for (Int_t iside=0; iside<2; ++iside) { + + for (Int_t iq=0; iq<nBinsQ_ETL; ++iq) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResQ_%d_%d", iside, iq); + h_TimeResQ_ETL[iside][iq] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResQ_ETL[iside][iq]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResQ_ETL[iside][iq]->GetMean() - 2.*h_TimeResQ_ETL[iside][iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_ETL[iside][iq]->GetMean() + 3*h_TimeResQ_ETL[iside][iq]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResQ_ETL[iside][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResQ_ETL[iside][iq]->GetName() << std::endl; + continue; + } + + g_TimeResQ_ETL[iside]->SetBinContent(iq+1,fit_res->GetParams()[2]); + g_TimeResQ_ETL[iside]->SetBinError(iq+1,fit_res->GetErrors()[2]); + + } // iq loop + + + for (Int_t ieta=0; ieta<nBinsEta_ETL; ++ieta) { + + TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResEta_%d_%d", iside, ieta); + h_TimeResEta_ETL[iside][ieta] = (TH1F*) input_file->Get(hname); + + if ( h_TimeResEta_ETL[iside][ieta]->GetEntries() < minBinContent ) continue; + + Float_t low_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() - 2.*h_TimeResEta_ETL[iside][ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() + 3*h_TimeResEta_ETL[iside][ieta]->GetRMS(); + + TFitResultPtr fit_res = h_TimeResEta_ETL[iside][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + + if ( fit_res->Status() != 0 ){ + std::cout << " *** ERROR: fit failed for the histogram" + << h_TimeResEta_ETL[iside][ieta]->GetName() << std::endl; + continue; + } + + g_TimeResEta_ETL[iside]->SetBinContent(ieta+1,fit_res->GetParams()[2]); + g_TimeResEta_ETL[iside]->SetBinError(ieta+1,fit_res->GetErrors()[2]); + + } // ieta loop + + } // iside loop + + + // ============================================================================= + // Draw the histograms + + + // --- BTL + + c[0] = new TCanvas("c_0","BTL time resolution vs Q"); + c[0]->SetGridy(kTRUE); + g_TimeResQ_BTL->SetTitle("BTL UncalibratedRecHits"); + g_TimeResQ_BTL->SetMarkerStyle(20); + g_TimeResQ_BTL->SetMarkerColor(4); + g_TimeResQ_BTL->SetXTitle("hit amplitude [pC]"); + g_TimeResQ_BTL->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQ_BTL->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQ_BTL->Draw("EP"); + + + c[1] = new TCanvas("c_1","BTL time resolution vs Q"); + c[1]->SetGridy(kTRUE); + g_TimeResQEta_BTL[0]->SetTitle("BTL UncalibratedRecHits"); + g_TimeResQEta_BTL[0]->SetXTitle("hit amplitude [pC]"); + g_TimeResQEta_BTL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQEta_BTL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQEta_BTL[0]->SetMarkerStyle(20); + g_TimeResQEta_BTL[0]->SetMarkerColor(1); + g_TimeResQEta_BTL[0]->Draw("EP"); + g_TimeResQEta_BTL[1]->SetMarkerStyle(20); + g_TimeResQEta_BTL[1]->SetMarkerColor(4); + g_TimeResQEta_BTL[1]->Draw("EPSAME"); + g_TimeResQEta_BTL[2]->SetMarkerStyle(20); + g_TimeResQEta_BTL[2]->SetMarkerColor(2); + g_TimeResQEta_BTL[2]->Draw("EPSAME"); + + TLegend* legend_1 = new TLegend(0.510,0.634,0.862,0.847); + legend_1->SetBorderSize(0.); + legend_1->SetFillStyle(0); + for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) + legend_1->AddEntry(g_TimeResQEta_BTL[ih], + Form("%4.2f #leq |#eta_{hit}| < %4.2f", binsQEta_BTL[ih], binsQEta_BTL[ih+1]), + "LP"); + legend_1->Draw(); + + + c[2] = new TCanvas("c_2","BTL time resolution vs eta"); + c[2]->SetGridy(kTRUE); + g_TimeResEta_BTL->SetTitle("BTL UncalibratedRecHits"); + g_TimeResEta_BTL->SetMarkerStyle(20); + g_TimeResEta_BTL->SetMarkerColor(4); + g_TimeResEta_BTL->SetXTitle("|#eta_{hit}|"); + g_TimeResEta_BTL->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEta_BTL->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEta_BTL->Draw("EP"); + + + c[3] = new TCanvas("c_3","BTL time resolution vs eta"); + c[3]->SetGridy(kTRUE); + g_TimeResEtaQ_BTL[1]->SetTitle("BTL UncalibratedRecHits"); + g_TimeResEtaQ_BTL[1]->SetXTitle("|#eta_{hit}|"); + g_TimeResEtaQ_BTL[1]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEtaQ_BTL[1]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEtaQ_BTL[1]->SetMarkerStyle(20); + g_TimeResEtaQ_BTL[1]->SetMarkerColor(1); + g_TimeResEtaQ_BTL[1]->Draw("EP"); + + TLegend* legend_3 = new TLegend(0.649,0.124,0.862,0.328); + legend_3->SetBorderSize(0.); + legend_3->SetFillStyle(0); + for (Int_t ih=1; ih<nBinsEtaQ_BTL; ++ih){ + + if ( ih > 1 ) { + g_TimeResEtaQ_BTL[ih]->SetMarkerStyle(20); + g_TimeResEtaQ_BTL[ih]->SetMarkerColor(ih); + g_TimeResEtaQ_BTL[ih]->Draw("EPSAME"); + } + + legend_3->AddEntry(g_TimeResEtaQ_BTL[ih], + Form("%4.0f #leq Q_{hit} < %4.0f pC", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]), + "LP"); + } + + legend_3->Draw(); + + + // --- ETL + + c[4] = new TCanvas("c_4","ETL time resolution vs amplitude"); + c[4]->SetGridy(kTRUE); + g_TimeResQ_ETL[0]->SetTitle("ETL UncalibratedRecHits"); + g_TimeResQ_ETL[0]->SetXTitle("hit amplitude [MIP]"); + g_TimeResQ_ETL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResQ_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQ_ETL[0]->SetMarkerStyle(20); + g_TimeResQ_ETL[0]->SetMarkerColor(4); + g_TimeResQ_ETL[0]->Draw("EP"); + g_TimeResQ_ETL[1]->SetMarkerStyle(20); + g_TimeResQ_ETL[1]->SetMarkerColor(2); + g_TimeResQ_ETL[1]->Draw("EPSAME"); + + TLegend* legend_4 = new TLegend(0.673,0.655,0.872,0.819); + legend_4->SetBorderSize(0.); + legend_4->SetFillStyle(0); + legend_4->AddEntry(g_TimeResQ_ETL[0], "ETL-", "LP"); + legend_4->AddEntry(g_TimeResQ_ETL[1], "ETL+", "LP"); + legend_4->DrawClone(); + + + c[5] = new TCanvas("c_5","ETL time resolution vs |eta|"); + c[5]->SetGridy(kTRUE); + g_TimeResEta_ETL[0]->SetTitle("ETL UncalibratedRecHits"); + g_TimeResEta_ETL[0]->SetXTitle("|#eta_{hit}|"); + g_TimeResEta_ETL[0]->SetYTitle("#sigma_{T} [ns]"); + g_TimeResEta_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEta_ETL[0]->SetMarkerStyle(20); + g_TimeResEta_ETL[0]->SetMarkerColor(4); + g_TimeResEta_ETL[0]->Draw("EP"); + g_TimeResEta_ETL[1]->SetMarkerStyle(20); + g_TimeResEta_ETL[1]->SetMarkerColor(2); + g_TimeResEta_ETL[1]->Draw("EPSAME"); + + legend_4->DrawClone(); + +} From d3b4d1251b8e4ffcdcf56c4c9b4c3d0fd1fbb676 Mon Sep 17 00:00:00 2001 From: Massimo Casarsa <massimo.casarsa@ts.infn.it> Date: Fri, 7 May 2021 17:05:36 +0200 Subject: [PATCH 251/309] Removed the macro folder --- .../MtdValidation/macro/makeTimeResPlots.C | 425 ------------------ 1 file changed, 425 deletions(-) delete mode 100644 Validation/MtdValidation/macro/makeTimeResPlots.C diff --git a/Validation/MtdValidation/macro/makeTimeResPlots.C b/Validation/MtdValidation/macro/makeTimeResPlots.C deleted file mode 100644 index c7cb2deb0ec7a..0000000000000 --- a/Validation/MtdValidation/macro/makeTimeResPlots.C +++ /dev/null @@ -1,425 +0,0 @@ -// ============================================================================= -// -// This macro reads the histograms of time residuals of the BTL and ETL -// UncalibratedRecHits from the DQM root file and produces time resolution -// plots vs the hit amplitude and the hit |eta|. -// -// Usage: -// root -l make_resPlot.C\(\"DQM_filename.root\"\) -// -// NB: In order to have the UncalibratedRecHits histograms filled, -// the MTD validation has to be run the flags: -// -// process.btlLocalReco.UncalibRecHitsPlots = cms.bool(True); -// process.etlLocalReco.UncalibRecHitsPlots = cms.bool(True); -// -// ============================================================================= - -#include <iostream> -#include "TStyle.h" -#include "TFile.h" -#include "TString.h" -#include "TCanvas.h" -#include "TH1F.h" -#include "TFitResult.h" -#include "TLegend.h" - - -// ============================================================================= -// configuration - -const Float_t minBinContent = 20.; - -// --- BTL - -const Int_t nBinsQ_BTL = 20; -const Float_t binWidthQ_BTL = 30.; // [pC] -const Int_t nBinsQEta_BTL = 3; -const Float_t binsQEta_BTL[4] = {0., 0.65, 1.15, 1.55}; - -const Int_t nBinsEta_BTL = 31; -const Float_t binWidthEta_BTL = 0.05; -const Int_t nBinsEtaQ_BTL = 7; -const Float_t binsEtaQ_BTL[8] = {0., 30., 60., 90., 120., 150., 360., 600.}; - - -// --- ETL - -const Int_t nBinsQ_ETL = 20; -const Float_t binWidthQ_ETL = 1.3; // [MIP] - -const Int_t nBinsEta_ETL = 26; -const Float_t binWidthEta_ETL = 0.05; -const Float_t etaMin_ETL = 1.65; - - -// ============================================================================= - - -TCanvas* c[10]; - -TH1F* h_TimeResQ_BTL[nBinsQ_BTL]; -TH1F* h_TimeResQEta_BTL[nBinsQ_BTL][nBinsQEta_BTL]; -TH1F* h_TimeResEta_BTL[nBinsEta_BTL]; -TH1F* h_TimeResEtaQ_BTL[nBinsEta_BTL][nBinsEtaQ_BTL]; - -TH1F* g_TimeResQ_BTL; -TH1F* g_TimeResQEta_BTL[nBinsQEta_BTL]; -TH1F* g_TimeResEta_BTL; -TH1F* g_TimeResEtaQ_BTL[nBinsEtaQ_BTL]; - -TH1F* h_TimeResQ_ETL[2][nBinsQ_ETL]; -TH1F* h_TimeResEta_ETL[2][nBinsEta_ETL]; - -TH1F* g_TimeResQ_ETL[2]; -TH1F* g_TimeResEta_ETL[2]; - - -void makeTimeResPlots(const TString DQMfilename="DQM_V0001_UNKNOWN_R000000001.root"){ - - gStyle->SetOptStat(kFALSE); - - // --- Histograms booking - - g_TimeResQ_BTL = new TH1F("g_TimeResQ_BTL", "BTL time resolution vs Q", - nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); - - for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) { - - TString hname = Form("g_TimeResQEta_BTL_%d", ih); - TString htitle = Form("BTL time resolution vs Q (%4.2f < |#eta_{hit}| < %4.2f)", - binsQEta_BTL[ih], binsQEta_BTL[ih+1]); - g_TimeResQEta_BTL[ih] = new TH1F(hname, htitle, nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); - - } - - - g_TimeResEta_BTL = new TH1F("g_TimeResEta_BTL", "BTL time resolution vs |#eta_{hit}|", - nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); - - for (Int_t ih=0; ih<nBinsEtaQ_BTL; ++ih) { - - TString hname = Form("g_TimeResEtaQ_BTL_%d", ih); - TString htitle = Form("BTL time resolution vs |#eta_{hit}| (%4.2f < Q < %4.2f)", - binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]); - g_TimeResEtaQ_BTL[ih] = new TH1F(hname, htitle, nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); - - } - - - for (Int_t iside=0; iside<2; ++iside) { - - TString hname = Form("g_TimeResQ_ETL_%d", iside); - g_TimeResQ_ETL[iside] = new TH1F(hname, "ETL time resolution vs amplitude", - nBinsQ_ETL, 0., nBinsQ_ETL*binWidthQ_ETL); - - hname = Form("g_TimeResEta_ETL_%d", iside); - g_TimeResEta_ETL[iside] = new TH1F(hname, "ETL time resolution vs |#eta_{hit}|", - nBinsEta_ETL, etaMin_ETL, etaMin_ETL+nBinsEta_ETL*binWidthEta_ETL); - - } - - std::cout << " Processing file " << DQMfilename.Data() << " ... " << std::endl; - TFile* input_file = new TFile(DQMfilename.Data()); - - - // --------------------------------------------------------------------------- - // BTL time resolution vs Q - - for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { - - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQ_%d",iq); - h_TimeResQ_BTL[iq] = (TH1F*) input_file->Get(hname); - - if ( h_TimeResQ_BTL[iq]->GetEntries() < minBinContent ) continue; - - Float_t low_limit = h_TimeResQ_BTL[iq]->GetMean() - 2.*h_TimeResQ_BTL[iq]->GetRMS(); - Float_t up_limit = h_TimeResQ_BTL[iq]->GetMean() + 3*h_TimeResQ_BTL[iq]->GetRMS(); - - TFitResultPtr fit_res = h_TimeResQ_BTL[iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResQ_BTL[iq]->GetName() << std::endl; - continue; - } - - g_TimeResQ_BTL->SetBinContent(iq+1,fit_res->GetParams()[2]); - g_TimeResQ_BTL->SetBinError(iq+1,fit_res->GetErrors()[2]); - - } // iq loop - - - // --------------------------------------------------------------------------- - // BTL time resolution vs Q in bind of |eta| - - for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { - - for (Int_t ieta=0; ieta<nBinsQEta_BTL; ++ieta) { - - - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQvsEta_%d_%d", - iq, ieta); - h_TimeResQEta_BTL[iq][ieta] = (TH1F*) input_file->Get(hname); - - if ( h_TimeResQEta_BTL[iq][ieta]->GetEntries() < minBinContent ) continue; - - Float_t low_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() - - 2.*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); - Float_t up_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() + - 3*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); - - TFitResultPtr fit_res = h_TimeResQEta_BTL[iq][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResQEta_BTL[iq][ieta]->GetName() << std::endl; - continue; - } - - g_TimeResQEta_BTL[ieta]->SetBinContent(iq+1,fit_res->GetParams()[2]); - g_TimeResQEta_BTL[ieta]->SetBinError(iq+1,fit_res->GetErrors()[2]); - - } // ieta loop - - } // iq loop - - - // --------------------------------------------------------------------------- - // BTL time resolution vs |eta| - - for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta){ - - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEta_%d",ieta); - h_TimeResEta_BTL[ieta] = (TH1F*) input_file->Get(hname); - - if ( h_TimeResEta_BTL[ieta]->GetEntries() < minBinContent ) continue; - - Float_t low_limit = h_TimeResEta_BTL[ieta]->GetMean() - 2.*h_TimeResEta_BTL[ieta]->GetRMS(); - Float_t up_limit = h_TimeResEta_BTL[ieta]->GetMean() + 3*h_TimeResEta_BTL[ieta]->GetRMS(); - - TFitResultPtr fit_res = h_TimeResEta_BTL[ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResEta_BTL[ieta]->GetName() << std::endl; - continue; - } - - g_TimeResEta_BTL->SetBinContent(ieta+1,fit_res->GetParams()[2]); - g_TimeResEta_BTL->SetBinError(ieta+1,fit_res->GetErrors()[2]); - - } // ieta loop - - - // --------------------------------------------------------------------------- - // BTL time resolution vs |eta| in bind of Q - - for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta) { - - for (Int_t iq=0; iq<nBinsEtaQ_BTL; ++iq) { - - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEtavsQ_%d_%d", - ieta, iq); - h_TimeResEtaQ_BTL[ieta][iq] = (TH1F*) input_file->Get(hname); - - if ( h_TimeResEtaQ_BTL[ieta][iq]->GetEntries() < minBinContent ) continue; - - Float_t low_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() - - 2.*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); - Float_t up_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() + - 3*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); - - TFitResultPtr fit_res = h_TimeResEtaQ_BTL[ieta][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResEtaQ_BTL[ieta][iq]->GetName() << std::endl; - continue; - } - - g_TimeResEtaQ_BTL[iq]->SetBinContent(ieta+1,fit_res->GetParams()[2]); - g_TimeResEtaQ_BTL[iq]->SetBinError(ieta+1,fit_res->GetErrors()[2]); - - } // iq loop - - } // ieta loop - - - // --------------------------------------------------------------------------- - // ETL time resolution vs amplitude and |eta| - - for (Int_t iside=0; iside<2; ++iside) { - - for (Int_t iq=0; iq<nBinsQ_ETL; ++iq) { - - TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResQ_%d_%d", iside, iq); - h_TimeResQ_ETL[iside][iq] = (TH1F*) input_file->Get(hname); - - if ( h_TimeResQ_ETL[iside][iq]->GetEntries() < minBinContent ) continue; - - Float_t low_limit = h_TimeResQ_ETL[iside][iq]->GetMean() - 2.*h_TimeResQ_ETL[iside][iq]->GetRMS(); - Float_t up_limit = h_TimeResQ_ETL[iside][iq]->GetMean() + 3*h_TimeResQ_ETL[iside][iq]->GetRMS(); - - TFitResultPtr fit_res = h_TimeResQ_ETL[iside][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResQ_ETL[iside][iq]->GetName() << std::endl; - continue; - } - - g_TimeResQ_ETL[iside]->SetBinContent(iq+1,fit_res->GetParams()[2]); - g_TimeResQ_ETL[iside]->SetBinError(iq+1,fit_res->GetErrors()[2]); - - } // iq loop - - - for (Int_t ieta=0; ieta<nBinsEta_ETL; ++ieta) { - - TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResEta_%d_%d", iside, ieta); - h_TimeResEta_ETL[iside][ieta] = (TH1F*) input_file->Get(hname); - - if ( h_TimeResEta_ETL[iside][ieta]->GetEntries() < minBinContent ) continue; - - Float_t low_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() - 2.*h_TimeResEta_ETL[iside][ieta]->GetRMS(); - Float_t up_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() + 3*h_TimeResEta_ETL[iside][ieta]->GetRMS(); - - TFitResultPtr fit_res = h_TimeResEta_ETL[iside][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResEta_ETL[iside][ieta]->GetName() << std::endl; - continue; - } - - g_TimeResEta_ETL[iside]->SetBinContent(ieta+1,fit_res->GetParams()[2]); - g_TimeResEta_ETL[iside]->SetBinError(ieta+1,fit_res->GetErrors()[2]); - - } // ieta loop - - } // iside loop - - - // ============================================================================= - // Draw the histograms - - - // --- BTL - - c[0] = new TCanvas("c_0","BTL time resolution vs Q"); - c[0]->SetGridy(kTRUE); - g_TimeResQ_BTL->SetTitle("BTL UncalibratedRecHits"); - g_TimeResQ_BTL->SetMarkerStyle(20); - g_TimeResQ_BTL->SetMarkerColor(4); - g_TimeResQ_BTL->SetXTitle("hit amplitude [pC]"); - g_TimeResQ_BTL->SetYTitle("#sigma_{T} [ns]"); - g_TimeResQ_BTL->GetYaxis()->SetRangeUser(0.,0.075); - g_TimeResQ_BTL->Draw("EP"); - - - c[1] = new TCanvas("c_1","BTL time resolution vs Q"); - c[1]->SetGridy(kTRUE); - g_TimeResQEta_BTL[0]->SetTitle("BTL UncalibratedRecHits"); - g_TimeResQEta_BTL[0]->SetXTitle("hit amplitude [pC]"); - g_TimeResQEta_BTL[0]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResQEta_BTL[0]->GetYaxis()->SetRangeUser(0.,0.075); - g_TimeResQEta_BTL[0]->SetMarkerStyle(20); - g_TimeResQEta_BTL[0]->SetMarkerColor(1); - g_TimeResQEta_BTL[0]->Draw("EP"); - g_TimeResQEta_BTL[1]->SetMarkerStyle(20); - g_TimeResQEta_BTL[1]->SetMarkerColor(4); - g_TimeResQEta_BTL[1]->Draw("EPSAME"); - g_TimeResQEta_BTL[2]->SetMarkerStyle(20); - g_TimeResQEta_BTL[2]->SetMarkerColor(2); - g_TimeResQEta_BTL[2]->Draw("EPSAME"); - - TLegend* legend_1 = new TLegend(0.510,0.634,0.862,0.847); - legend_1->SetBorderSize(0.); - legend_1->SetFillStyle(0); - for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) - legend_1->AddEntry(g_TimeResQEta_BTL[ih], - Form("%4.2f #leq |#eta_{hit}| < %4.2f", binsQEta_BTL[ih], binsQEta_BTL[ih+1]), - "LP"); - legend_1->Draw(); - - - c[2] = new TCanvas("c_2","BTL time resolution vs eta"); - c[2]->SetGridy(kTRUE); - g_TimeResEta_BTL->SetTitle("BTL UncalibratedRecHits"); - g_TimeResEta_BTL->SetMarkerStyle(20); - g_TimeResEta_BTL->SetMarkerColor(4); - g_TimeResEta_BTL->SetXTitle("|#eta_{hit}|"); - g_TimeResEta_BTL->SetYTitle("#sigma_{T} [ns]"); - g_TimeResEta_BTL->GetYaxis()->SetRangeUser(0.,0.075); - g_TimeResEta_BTL->Draw("EP"); - - - c[3] = new TCanvas("c_3","BTL time resolution vs eta"); - c[3]->SetGridy(kTRUE); - g_TimeResEtaQ_BTL[1]->SetTitle("BTL UncalibratedRecHits"); - g_TimeResEtaQ_BTL[1]->SetXTitle("|#eta_{hit}|"); - g_TimeResEtaQ_BTL[1]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResEtaQ_BTL[1]->GetYaxis()->SetRangeUser(0.,0.075); - g_TimeResEtaQ_BTL[1]->SetMarkerStyle(20); - g_TimeResEtaQ_BTL[1]->SetMarkerColor(1); - g_TimeResEtaQ_BTL[1]->Draw("EP"); - - TLegend* legend_3 = new TLegend(0.649,0.124,0.862,0.328); - legend_3->SetBorderSize(0.); - legend_3->SetFillStyle(0); - for (Int_t ih=1; ih<nBinsEtaQ_BTL; ++ih){ - - if ( ih > 1 ) { - g_TimeResEtaQ_BTL[ih]->SetMarkerStyle(20); - g_TimeResEtaQ_BTL[ih]->SetMarkerColor(ih); - g_TimeResEtaQ_BTL[ih]->Draw("EPSAME"); - } - - legend_3->AddEntry(g_TimeResEtaQ_BTL[ih], - Form("%4.0f #leq Q_{hit} < %4.0f pC", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]), - "LP"); - } - - legend_3->Draw(); - - - // --- ETL - - c[4] = new TCanvas("c_4","ETL time resolution vs amplitude"); - c[4]->SetGridy(kTRUE); - g_TimeResQ_ETL[0]->SetTitle("ETL UncalibratedRecHits"); - g_TimeResQ_ETL[0]->SetXTitle("hit amplitude [MIP]"); - g_TimeResQ_ETL[0]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResQ_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); - g_TimeResQ_ETL[0]->SetMarkerStyle(20); - g_TimeResQ_ETL[0]->SetMarkerColor(4); - g_TimeResQ_ETL[0]->Draw("EP"); - g_TimeResQ_ETL[1]->SetMarkerStyle(20); - g_TimeResQ_ETL[1]->SetMarkerColor(2); - g_TimeResQ_ETL[1]->Draw("EPSAME"); - - TLegend* legend_4 = new TLegend(0.673,0.655,0.872,0.819); - legend_4->SetBorderSize(0.); - legend_4->SetFillStyle(0); - legend_4->AddEntry(g_TimeResQ_ETL[0], "ETL-", "LP"); - legend_4->AddEntry(g_TimeResQ_ETL[1], "ETL+", "LP"); - legend_4->DrawClone(); - - - c[5] = new TCanvas("c_5","ETL time resolution vs |eta|"); - c[5]->SetGridy(kTRUE); - g_TimeResEta_ETL[0]->SetTitle("ETL UncalibratedRecHits"); - g_TimeResEta_ETL[0]->SetXTitle("|#eta_{hit}|"); - g_TimeResEta_ETL[0]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResEta_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); - g_TimeResEta_ETL[0]->SetMarkerStyle(20); - g_TimeResEta_ETL[0]->SetMarkerColor(4); - g_TimeResEta_ETL[0]->Draw("EP"); - g_TimeResEta_ETL[1]->SetMarkerStyle(20); - g_TimeResEta_ETL[1]->SetMarkerColor(2); - g_TimeResEta_ETL[1]->Draw("EPSAME"); - - legend_4->DrawClone(); - -} From 8448038e3e2c257176e53a31b2e511f24df33ee1 Mon Sep 17 00:00:00 2001 From: Massimo Casarsa <massimo.casarsa@ts.infn.it> Date: Fri, 7 May 2021 17:07:49 +0200 Subject: [PATCH 252/309] Applied code-format --- .../MtdValidation/macros/makeTimeResPlots.C | 342 ++++++++---------- 1 file changed, 149 insertions(+), 193 deletions(-) diff --git a/Validation/MtdValidation/macros/makeTimeResPlots.C b/Validation/MtdValidation/macros/makeTimeResPlots.C index c7cb2deb0ec7a..38439d9d1e687 100644 --- a/Validation/MtdValidation/macros/makeTimeResPlots.C +++ b/Validation/MtdValidation/macros/makeTimeResPlots.C @@ -1,7 +1,7 @@ // ============================================================================= // // This macro reads the histograms of time residuals of the BTL and ETL -// UncalibratedRecHits from the DQM root file and produces time resolution +// UncalibratedRecHits from the DQM root file and produces time resolution // plots vs the hit amplitude and the hit |eta|. // // Usage: @@ -9,7 +9,7 @@ // // NB: In order to have the UncalibratedRecHits histograms filled, // the MTD validation has to be run the flags: -// +// // process.btlLocalReco.UncalibRecHitsPlots = cms.bool(True); // process.etlLocalReco.UncalibRecHitsPlots = cms.bool(True); // @@ -24,7 +24,6 @@ #include "TFitResult.h" #include "TLegend.h" - // ============================================================================= // configuration @@ -32,30 +31,27 @@ const Float_t minBinContent = 20.; // --- BTL -const Int_t nBinsQ_BTL = 20; -const Float_t binWidthQ_BTL = 30.; // [pC] -const Int_t nBinsQEta_BTL = 3; +const Int_t nBinsQ_BTL = 20; +const Float_t binWidthQ_BTL = 30.; // [pC] +const Int_t nBinsQEta_BTL = 3; const Float_t binsQEta_BTL[4] = {0., 0.65, 1.15, 1.55}; -const Int_t nBinsEta_BTL = 31; -const Float_t binWidthEta_BTL = 0.05; -const Int_t nBinsEtaQ_BTL = 7; +const Int_t nBinsEta_BTL = 31; +const Float_t binWidthEta_BTL = 0.05; +const Int_t nBinsEtaQ_BTL = 7; const Float_t binsEtaQ_BTL[8] = {0., 30., 60., 90., 120., 150., 360., 600.}; - // --- ETL -const Int_t nBinsQ_ETL = 20; -const Float_t binWidthQ_ETL = 1.3; // [MIP] - -const Int_t nBinsEta_ETL = 26; -const Float_t binWidthEta_ETL = 0.05; -const Float_t etaMin_ETL = 1.65; +const Int_t nBinsQ_ETL = 20; +const Float_t binWidthQ_ETL = 1.3; // [MIP] +const Int_t nBinsEta_ETL = 26; +const Float_t binWidthEta_ETL = 0.05; +const Float_t etaMin_ETL = 1.65; // ============================================================================= - TCanvas* c[10]; TH1F* h_TimeResQ_BTL[nBinsQ_BTL]; @@ -74,256 +70,224 @@ TH1F* h_TimeResEta_ETL[2][nBinsEta_ETL]; TH1F* g_TimeResQ_ETL[2]; TH1F* g_TimeResEta_ETL[2]; - -void makeTimeResPlots(const TString DQMfilename="DQM_V0001_UNKNOWN_R000000001.root"){ - +void makeTimeResPlots(const TString DQMfilename = "DQM_V0001_UNKNOWN_R000000001.root") { gStyle->SetOptStat(kFALSE); - + // --- Histograms booking - - g_TimeResQ_BTL = new TH1F("g_TimeResQ_BTL", "BTL time resolution vs Q", - nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); - - for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) { - TString hname = Form("g_TimeResQEta_BTL_%d", ih); - TString htitle = Form("BTL time resolution vs Q (%4.2f < |#eta_{hit}| < %4.2f)", - binsQEta_BTL[ih], binsQEta_BTL[ih+1]); - g_TimeResQEta_BTL[ih] = new TH1F(hname, htitle, nBinsQ_BTL, 0., nBinsQ_BTL*binWidthQ_BTL); + g_TimeResQ_BTL = new TH1F("g_TimeResQ_BTL", "BTL time resolution vs Q", nBinsQ_BTL, 0., nBinsQ_BTL * binWidthQ_BTL); + for (Int_t ih = 0; ih < nBinsQEta_BTL; ++ih) { + TString hname = Form("g_TimeResQEta_BTL_%d", ih); + TString htitle = + Form("BTL time resolution vs Q (%4.2f < |#eta_{hit}| < %4.2f)", binsQEta_BTL[ih], binsQEta_BTL[ih + 1]); + g_TimeResQEta_BTL[ih] = new TH1F(hname, htitle, nBinsQ_BTL, 0., nBinsQ_BTL * binWidthQ_BTL); } + g_TimeResEta_BTL = new TH1F( + "g_TimeResEta_BTL", "BTL time resolution vs |#eta_{hit}|", nBinsEta_BTL, 0., nBinsEta_BTL * binWidthEta_BTL); - g_TimeResEta_BTL = new TH1F("g_TimeResEta_BTL", "BTL time resolution vs |#eta_{hit}|", - nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); - - for (Int_t ih=0; ih<nBinsEtaQ_BTL; ++ih) { - - TString hname = Form("g_TimeResEtaQ_BTL_%d", ih); - TString htitle = Form("BTL time resolution vs |#eta_{hit}| (%4.2f < Q < %4.2f)", - binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]); - g_TimeResEtaQ_BTL[ih] = new TH1F(hname, htitle, nBinsEta_BTL, 0., nBinsEta_BTL*binWidthEta_BTL); - + for (Int_t ih = 0; ih < nBinsEtaQ_BTL; ++ih) { + TString hname = Form("g_TimeResEtaQ_BTL_%d", ih); + TString htitle = + Form("BTL time resolution vs |#eta_{hit}| (%4.2f < Q < %4.2f)", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih + 1]); + g_TimeResEtaQ_BTL[ih] = new TH1F(hname, htitle, nBinsEta_BTL, 0., nBinsEta_BTL * binWidthEta_BTL); } - - for (Int_t iside=0; iside<2; ++iside) { - - TString hname = Form("g_TimeResQ_ETL_%d", iside); - g_TimeResQ_ETL[iside] = new TH1F(hname, "ETL time resolution vs amplitude", - nBinsQ_ETL, 0., nBinsQ_ETL*binWidthQ_ETL); - - hname = Form("g_TimeResEta_ETL_%d", iside); - g_TimeResEta_ETL[iside] = new TH1F(hname, "ETL time resolution vs |#eta_{hit}|", - nBinsEta_ETL, etaMin_ETL, etaMin_ETL+nBinsEta_ETL*binWidthEta_ETL); - - } + for (Int_t iside = 0; iside < 2; ++iside) { + TString hname = Form("g_TimeResQ_ETL_%d", iside); + g_TimeResQ_ETL[iside] = + new TH1F(hname, "ETL time resolution vs amplitude", nBinsQ_ETL, 0., nBinsQ_ETL * binWidthQ_ETL); + + hname = Form("g_TimeResEta_ETL_%d", iside); + g_TimeResEta_ETL[iside] = new TH1F(hname, + "ETL time resolution vs |#eta_{hit}|", + nBinsEta_ETL, + etaMin_ETL, + etaMin_ETL + nBinsEta_ETL * binWidthEta_ETL); + } std::cout << " Processing file " << DQMfilename.Data() << " ... " << std::endl; TFile* input_file = new TFile(DQMfilename.Data()); - // --------------------------------------------------------------------------- // BTL time resolution vs Q - for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { + for (Int_t iq = 0; iq < nBinsQ_BTL; ++iq) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQ_%d", iq); + h_TimeResQ_BTL[iq] = (TH1F*)input_file->Get(hname); - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQ_%d",iq); - h_TimeResQ_BTL[iq] = (TH1F*) input_file->Get(hname); - - if ( h_TimeResQ_BTL[iq]->GetEntries() < minBinContent ) continue; + if (h_TimeResQ_BTL[iq]->GetEntries() < minBinContent) + continue; - Float_t low_limit = h_TimeResQ_BTL[iq]->GetMean() - 2.*h_TimeResQ_BTL[iq]->GetRMS(); - Float_t up_limit = h_TimeResQ_BTL[iq]->GetMean() + 3*h_TimeResQ_BTL[iq]->GetRMS(); + Float_t low_limit = h_TimeResQ_BTL[iq]->GetMean() - 2. * h_TimeResQ_BTL[iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_BTL[iq]->GetMean() + 3 * h_TimeResQ_BTL[iq]->GetRMS(); - TFitResultPtr fit_res = h_TimeResQ_BTL[iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + TFitResultPtr fit_res = h_TimeResQ_BTL[iq]->Fit("gaus", "SERQ0", "", low_limit, up_limit); - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResQ_BTL[iq]->GetName() << std::endl; + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResQ_BTL[iq]->GetName() << std::endl; continue; } - g_TimeResQ_BTL->SetBinContent(iq+1,fit_res->GetParams()[2]); - g_TimeResQ_BTL->SetBinError(iq+1,fit_res->GetErrors()[2]); - - } // iq loop + g_TimeResQ_BTL->SetBinContent(iq + 1, fit_res->GetParams()[2]); + g_TimeResQ_BTL->SetBinError(iq + 1, fit_res->GetErrors()[2]); + } // iq loop // --------------------------------------------------------------------------- // BTL time resolution vs Q in bind of |eta| - for (Int_t iq=0; iq<nBinsQ_BTL; ++iq) { - - for (Int_t ieta=0; ieta<nBinsQEta_BTL; ++ieta) { - + for (Int_t iq = 0; iq < nBinsQ_BTL; ++iq) { + for (Int_t ieta = 0; ieta < nBinsQEta_BTL; ++ieta) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQvsEta_%d_%d", iq, ieta); + h_TimeResQEta_BTL[iq][ieta] = (TH1F*)input_file->Get(hname); - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResQvsEta_%d_%d", - iq, ieta); - h_TimeResQEta_BTL[iq][ieta] = (TH1F*) input_file->Get(hname); + if (h_TimeResQEta_BTL[iq][ieta]->GetEntries() < minBinContent) + continue; - if ( h_TimeResQEta_BTL[iq][ieta]->GetEntries() < minBinContent ) continue; + Float_t low_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() - 2. * h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + Float_t up_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() + 3 * h_TimeResQEta_BTL[iq][ieta]->GetRMS(); - Float_t low_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() - - 2.*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); - Float_t up_limit = h_TimeResQEta_BTL[iq][ieta]->GetMean() + - 3*h_TimeResQEta_BTL[iq][ieta]->GetRMS(); + TFitResultPtr fit_res = h_TimeResQEta_BTL[iq][ieta]->Fit("gaus", "SERQ0", "", low_limit, up_limit); - TFitResultPtr fit_res = h_TimeResQEta_BTL[iq][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResQEta_BTL[iq][ieta]->GetName() << std::endl; - continue; + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResQEta_BTL[iq][ieta]->GetName() << std::endl; + continue; } - g_TimeResQEta_BTL[ieta]->SetBinContent(iq+1,fit_res->GetParams()[2]); - g_TimeResQEta_BTL[ieta]->SetBinError(iq+1,fit_res->GetErrors()[2]); - - } // ieta loop + g_TimeResQEta_BTL[ieta]->SetBinContent(iq + 1, fit_res->GetParams()[2]); + g_TimeResQEta_BTL[ieta]->SetBinError(iq + 1, fit_res->GetErrors()[2]); - } // iq loop + } // ieta loop + } // iq loop // --------------------------------------------------------------------------- // BTL time resolution vs |eta| - for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta){ - - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEta_%d",ieta); - h_TimeResEta_BTL[ieta] = (TH1F*) input_file->Get(hname); + for (Int_t ieta = 0; ieta < nBinsEta_BTL; ++ieta) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEta_%d", ieta); + h_TimeResEta_BTL[ieta] = (TH1F*)input_file->Get(hname); - if ( h_TimeResEta_BTL[ieta]->GetEntries() < minBinContent ) continue; + if (h_TimeResEta_BTL[ieta]->GetEntries() < minBinContent) + continue; - Float_t low_limit = h_TimeResEta_BTL[ieta]->GetMean() - 2.*h_TimeResEta_BTL[ieta]->GetRMS(); - Float_t up_limit = h_TimeResEta_BTL[ieta]->GetMean() + 3*h_TimeResEta_BTL[ieta]->GetRMS(); + Float_t low_limit = h_TimeResEta_BTL[ieta]->GetMean() - 2. * h_TimeResEta_BTL[ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_BTL[ieta]->GetMean() + 3 * h_TimeResEta_BTL[ieta]->GetRMS(); - TFitResultPtr fit_res = h_TimeResEta_BTL[ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + TFitResultPtr fit_res = h_TimeResEta_BTL[ieta]->Fit("gaus", "SERQ0", "", low_limit, up_limit); - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResEta_BTL[ieta]->GetName() << std::endl; + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResEta_BTL[ieta]->GetName() << std::endl; continue; } - g_TimeResEta_BTL->SetBinContent(ieta+1,fit_res->GetParams()[2]); - g_TimeResEta_BTL->SetBinError(ieta+1,fit_res->GetErrors()[2]); - - } // ieta loop + g_TimeResEta_BTL->SetBinContent(ieta + 1, fit_res->GetParams()[2]); + g_TimeResEta_BTL->SetBinError(ieta + 1, fit_res->GetErrors()[2]); + } // ieta loop // --------------------------------------------------------------------------- // BTL time resolution vs |eta| in bind of Q - for (Int_t ieta=0; ieta<nBinsEta_BTL; ++ieta) { + for (Int_t ieta = 0; ieta < nBinsEta_BTL; ++ieta) { + for (Int_t iq = 0; iq < nBinsEtaQ_BTL; ++iq) { + TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEtavsQ_%d_%d", ieta, iq); + h_TimeResEtaQ_BTL[ieta][iq] = (TH1F*)input_file->Get(hname); - for (Int_t iq=0; iq<nBinsEtaQ_BTL; ++iq) { + if (h_TimeResEtaQ_BTL[ieta][iq]->GetEntries() < minBinContent) + continue; - TString hname = Form("DQMData/Run 1/MTD/Run summary/BTL/LocalReco/TimeResEtavsQ_%d_%d", - ieta, iq); - h_TimeResEtaQ_BTL[ieta][iq] = (TH1F*) input_file->Get(hname); + Float_t low_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() - 2. * h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); + Float_t up_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() + 3 * h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); - if ( h_TimeResEtaQ_BTL[ieta][iq]->GetEntries() < minBinContent ) continue; + TFitResultPtr fit_res = h_TimeResEtaQ_BTL[ieta][iq]->Fit("gaus", "SERQ0", "", low_limit, up_limit); - Float_t low_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() - - 2.*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); - Float_t up_limit = h_TimeResEtaQ_BTL[ieta][iq]->GetMean() + - 3*h_TimeResEtaQ_BTL[ieta][iq]->GetRMS(); - - TFitResultPtr fit_res = h_TimeResEtaQ_BTL[ieta][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); - - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResEtaQ_BTL[ieta][iq]->GetName() << std::endl; - continue; + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResEtaQ_BTL[ieta][iq]->GetName() << std::endl; + continue; } - g_TimeResEtaQ_BTL[iq]->SetBinContent(ieta+1,fit_res->GetParams()[2]); - g_TimeResEtaQ_BTL[iq]->SetBinError(ieta+1,fit_res->GetErrors()[2]); - - } // iq loop + g_TimeResEtaQ_BTL[iq]->SetBinContent(ieta + 1, fit_res->GetParams()[2]); + g_TimeResEtaQ_BTL[iq]->SetBinError(ieta + 1, fit_res->GetErrors()[2]); - } // ieta loop + } // iq loop + } // ieta loop // --------------------------------------------------------------------------- // ETL time resolution vs amplitude and |eta| - for (Int_t iside=0; iside<2; ++iside) { - - for (Int_t iq=0; iq<nBinsQ_ETL; ++iq) { - + for (Int_t iside = 0; iside < 2; ++iside) { + for (Int_t iq = 0; iq < nBinsQ_ETL; ++iq) { TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResQ_%d_%d", iside, iq); - h_TimeResQ_ETL[iside][iq] = (TH1F*) input_file->Get(hname); + h_TimeResQ_ETL[iside][iq] = (TH1F*)input_file->Get(hname); - if ( h_TimeResQ_ETL[iside][iq]->GetEntries() < minBinContent ) continue; + if (h_TimeResQ_ETL[iside][iq]->GetEntries() < minBinContent) + continue; - Float_t low_limit = h_TimeResQ_ETL[iside][iq]->GetMean() - 2.*h_TimeResQ_ETL[iside][iq]->GetRMS(); - Float_t up_limit = h_TimeResQ_ETL[iside][iq]->GetMean() + 3*h_TimeResQ_ETL[iside][iq]->GetRMS(); + Float_t low_limit = h_TimeResQ_ETL[iside][iq]->GetMean() - 2. * h_TimeResQ_ETL[iside][iq]->GetRMS(); + Float_t up_limit = h_TimeResQ_ETL[iside][iq]->GetMean() + 3 * h_TimeResQ_ETL[iside][iq]->GetRMS(); - TFitResultPtr fit_res = h_TimeResQ_ETL[iside][iq] ->Fit("gaus","SERQ0","",low_limit,up_limit); + TFitResultPtr fit_res = h_TimeResQ_ETL[iside][iq]->Fit("gaus", "SERQ0", "", low_limit, up_limit); - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResQ_ETL[iside][iq]->GetName() << std::endl; - continue; + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResQ_ETL[iside][iq]->GetName() << std::endl; + continue; } - g_TimeResQ_ETL[iside]->SetBinContent(iq+1,fit_res->GetParams()[2]); - g_TimeResQ_ETL[iside]->SetBinError(iq+1,fit_res->GetErrors()[2]); + g_TimeResQ_ETL[iside]->SetBinContent(iq + 1, fit_res->GetParams()[2]); + g_TimeResQ_ETL[iside]->SetBinError(iq + 1, fit_res->GetErrors()[2]); - } // iq loop - - - for (Int_t ieta=0; ieta<nBinsEta_ETL; ++ieta) { + } // iq loop + for (Int_t ieta = 0; ieta < nBinsEta_ETL; ++ieta) { TString hname = Form("DQMData/Run 1/MTD/Run summary/ETL/LocalReco/TimeResEta_%d_%d", iside, ieta); - h_TimeResEta_ETL[iside][ieta] = (TH1F*) input_file->Get(hname); + h_TimeResEta_ETL[iside][ieta] = (TH1F*)input_file->Get(hname); - if ( h_TimeResEta_ETL[iside][ieta]->GetEntries() < minBinContent ) continue; + if (h_TimeResEta_ETL[iside][ieta]->GetEntries() < minBinContent) + continue; - Float_t low_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() - 2.*h_TimeResEta_ETL[iside][ieta]->GetRMS(); - Float_t up_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() + 3*h_TimeResEta_ETL[iside][ieta]->GetRMS(); + Float_t low_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() - 2. * h_TimeResEta_ETL[iside][ieta]->GetRMS(); + Float_t up_limit = h_TimeResEta_ETL[iside][ieta]->GetMean() + 3 * h_TimeResEta_ETL[iside][ieta]->GetRMS(); - TFitResultPtr fit_res = h_TimeResEta_ETL[iside][ieta] ->Fit("gaus","SERQ0","",low_limit,up_limit); + TFitResultPtr fit_res = h_TimeResEta_ETL[iside][ieta]->Fit("gaus", "SERQ0", "", low_limit, up_limit); - if ( fit_res->Status() != 0 ){ - std::cout << " *** ERROR: fit failed for the histogram" - << h_TimeResEta_ETL[iside][ieta]->GetName() << std::endl; - continue; + if (fit_res->Status() != 0) { + std::cout << " *** ERROR: fit failed for the histogram" << h_TimeResEta_ETL[iside][ieta]->GetName() + << std::endl; + continue; } - g_TimeResEta_ETL[iside]->SetBinContent(ieta+1,fit_res->GetParams()[2]); - g_TimeResEta_ETL[iside]->SetBinError(ieta+1,fit_res->GetErrors()[2]); - - } // ieta loop + g_TimeResEta_ETL[iside]->SetBinContent(ieta + 1, fit_res->GetParams()[2]); + g_TimeResEta_ETL[iside]->SetBinError(ieta + 1, fit_res->GetErrors()[2]); - } // iside loop + } // ieta loop + } // iside loop // ============================================================================= // Draw the histograms - // --- BTL - c[0] = new TCanvas("c_0","BTL time resolution vs Q"); + c[0] = new TCanvas("c_0", "BTL time resolution vs Q"); c[0]->SetGridy(kTRUE); g_TimeResQ_BTL->SetTitle("BTL UncalibratedRecHits"); g_TimeResQ_BTL->SetMarkerStyle(20); g_TimeResQ_BTL->SetMarkerColor(4); g_TimeResQ_BTL->SetXTitle("hit amplitude [pC]"); g_TimeResQ_BTL->SetYTitle("#sigma_{T} [ns]"); - g_TimeResQ_BTL->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQ_BTL->GetYaxis()->SetRangeUser(0., 0.075); g_TimeResQ_BTL->Draw("EP"); - - c[1] = new TCanvas("c_1","BTL time resolution vs Q"); + c[1] = new TCanvas("c_1", "BTL time resolution vs Q"); c[1]->SetGridy(kTRUE); g_TimeResQEta_BTL[0]->SetTitle("BTL UncalibratedRecHits"); g_TimeResQEta_BTL[0]->SetXTitle("hit amplitude [pC]"); g_TimeResQEta_BTL[0]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResQEta_BTL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQEta_BTL[0]->GetYaxis()->SetRangeUser(0., 0.075); g_TimeResQEta_BTL[0]->SetMarkerStyle(20); g_TimeResQEta_BTL[0]->SetMarkerColor(1); g_TimeResQEta_BTL[0]->Draw("EP"); @@ -334,64 +298,58 @@ void makeTimeResPlots(const TString DQMfilename="DQM_V0001_UNKNOWN_R000000001.ro g_TimeResQEta_BTL[2]->SetMarkerColor(2); g_TimeResQEta_BTL[2]->Draw("EPSAME"); - TLegend* legend_1 = new TLegend(0.510,0.634,0.862,0.847); + TLegend* legend_1 = new TLegend(0.510, 0.634, 0.862, 0.847); legend_1->SetBorderSize(0.); legend_1->SetFillStyle(0); - for (Int_t ih=0; ih<nBinsQEta_BTL; ++ih) - legend_1->AddEntry(g_TimeResQEta_BTL[ih], - Form("%4.2f #leq |#eta_{hit}| < %4.2f", binsQEta_BTL[ih], binsQEta_BTL[ih+1]), - "LP"); + for (Int_t ih = 0; ih < nBinsQEta_BTL; ++ih) + legend_1->AddEntry( + g_TimeResQEta_BTL[ih], Form("%4.2f #leq |#eta_{hit}| < %4.2f", binsQEta_BTL[ih], binsQEta_BTL[ih + 1]), "LP"); legend_1->Draw(); - - c[2] = new TCanvas("c_2","BTL time resolution vs eta"); + c[2] = new TCanvas("c_2", "BTL time resolution vs eta"); c[2]->SetGridy(kTRUE); g_TimeResEta_BTL->SetTitle("BTL UncalibratedRecHits"); g_TimeResEta_BTL->SetMarkerStyle(20); g_TimeResEta_BTL->SetMarkerColor(4); g_TimeResEta_BTL->SetXTitle("|#eta_{hit}|"); g_TimeResEta_BTL->SetYTitle("#sigma_{T} [ns]"); - g_TimeResEta_BTL->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEta_BTL->GetYaxis()->SetRangeUser(0., 0.075); g_TimeResEta_BTL->Draw("EP"); - - c[3] = new TCanvas("c_3","BTL time resolution vs eta"); + c[3] = new TCanvas("c_3", "BTL time resolution vs eta"); c[3]->SetGridy(kTRUE); g_TimeResEtaQ_BTL[1]->SetTitle("BTL UncalibratedRecHits"); g_TimeResEtaQ_BTL[1]->SetXTitle("|#eta_{hit}|"); g_TimeResEtaQ_BTL[1]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResEtaQ_BTL[1]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEtaQ_BTL[1]->GetYaxis()->SetRangeUser(0., 0.075); g_TimeResEtaQ_BTL[1]->SetMarkerStyle(20); g_TimeResEtaQ_BTL[1]->SetMarkerColor(1); g_TimeResEtaQ_BTL[1]->Draw("EP"); - TLegend* legend_3 = new TLegend(0.649,0.124,0.862,0.328); + TLegend* legend_3 = new TLegend(0.649, 0.124, 0.862, 0.328); legend_3->SetBorderSize(0.); legend_3->SetFillStyle(0); - for (Int_t ih=1; ih<nBinsEtaQ_BTL; ++ih){ - - if ( ih > 1 ) { + for (Int_t ih = 1; ih < nBinsEtaQ_BTL; ++ih) { + if (ih > 1) { g_TimeResEtaQ_BTL[ih]->SetMarkerStyle(20); g_TimeResEtaQ_BTL[ih]->SetMarkerColor(ih); g_TimeResEtaQ_BTL[ih]->Draw("EPSAME"); } - legend_3->AddEntry(g_TimeResEtaQ_BTL[ih], - Form("%4.0f #leq Q_{hit} < %4.0f pC", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih+1]), - "LP"); + legend_3->AddEntry( + g_TimeResEtaQ_BTL[ih], Form("%4.0f #leq Q_{hit} < %4.0f pC", binsEtaQ_BTL[ih], binsEtaQ_BTL[ih + 1]), "LP"); } legend_3->Draw(); - // --- ETL - c[4] = new TCanvas("c_4","ETL time resolution vs amplitude"); + c[4] = new TCanvas("c_4", "ETL time resolution vs amplitude"); c[4]->SetGridy(kTRUE); g_TimeResQ_ETL[0]->SetTitle("ETL UncalibratedRecHits"); g_TimeResQ_ETL[0]->SetXTitle("hit amplitude [MIP]"); g_TimeResQ_ETL[0]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResQ_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResQ_ETL[0]->GetYaxis()->SetRangeUser(0., 0.075); g_TimeResQ_ETL[0]->SetMarkerStyle(20); g_TimeResQ_ETL[0]->SetMarkerColor(4); g_TimeResQ_ETL[0]->Draw("EP"); @@ -399,20 +357,19 @@ void makeTimeResPlots(const TString DQMfilename="DQM_V0001_UNKNOWN_R000000001.ro g_TimeResQ_ETL[1]->SetMarkerColor(2); g_TimeResQ_ETL[1]->Draw("EPSAME"); - TLegend* legend_4 = new TLegend(0.673,0.655,0.872,0.819); + TLegend* legend_4 = new TLegend(0.673, 0.655, 0.872, 0.819); legend_4->SetBorderSize(0.); legend_4->SetFillStyle(0); legend_4->AddEntry(g_TimeResQ_ETL[0], "ETL-", "LP"); legend_4->AddEntry(g_TimeResQ_ETL[1], "ETL+", "LP"); legend_4->DrawClone(); - - c[5] = new TCanvas("c_5","ETL time resolution vs |eta|"); + c[5] = new TCanvas("c_5", "ETL time resolution vs |eta|"); c[5]->SetGridy(kTRUE); g_TimeResEta_ETL[0]->SetTitle("ETL UncalibratedRecHits"); g_TimeResEta_ETL[0]->SetXTitle("|#eta_{hit}|"); g_TimeResEta_ETL[0]->SetYTitle("#sigma_{T} [ns]"); - g_TimeResEta_ETL[0]->GetYaxis()->SetRangeUser(0.,0.075); + g_TimeResEta_ETL[0]->GetYaxis()->SetRangeUser(0., 0.075); g_TimeResEta_ETL[0]->SetMarkerStyle(20); g_TimeResEta_ETL[0]->SetMarkerColor(4); g_TimeResEta_ETL[0]->Draw("EP"); @@ -421,5 +378,4 @@ void makeTimeResPlots(const TString DQMfilename="DQM_V0001_UNKNOWN_R000000001.ro g_TimeResEta_ETL[1]->Draw("EPSAME"); legend_4->DrawClone(); - } From 8e03b84072f47081ea99a0383f03196ad65eee8e Mon Sep 17 00:00:00 2001 From: Pieter David <pieter.david@cern.ch> Date: Fri, 7 May 2021 17:35:06 +0200 Subject: [PATCH 253/309] Avoid 'handle' in member names that are not ESHandles anymore --- .../plugins/SiStripClusterToDigiProducer.cc | 8 ++-- .../interface/SiStripFedZeroSuppression.h | 4 +- .../src/SiStripFedZeroSuppression.cc | 48 +++++++++---------- 3 files changed, 28 insertions(+), 32 deletions(-) diff --git a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc index 33f892ef782be..fbeaa323d6331 100644 --- a/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc +++ b/RecoLocalTracker/SiStripClusterizer/plugins/SiStripClusterToDigiProducer.cc @@ -32,14 +32,14 @@ class SiStripClusterToDigiProducer : public edm::stream::EDProducer<> { private: void process(const ClusterCollection& input, std::vector<DetDigiCollection>& output_base); void setDetId(const uint32_t id); - float gain(const uint16_t& strip) const { return gainHandle->getStripGain(strip, gainRange); } + float gain(const uint16_t& strip) const { return gain_->getStripGain(strip, gainRange); } uint16_t applyGain(const uint16_t& strip, const uint16_t& adc); edm::EDGetTokenT<ClusterCollection> token; SiStripApvGain::Range gainRange; edm::ESGetToken<SiStripGain, SiStripGainRcd> gainToken_; edm::ESWatcher<SiStripGainRcd> gainWatcher_; - const SiStripGain* gainHandle; + const SiStripGain* gain_; uint32_t detId; }; @@ -55,7 +55,7 @@ SiStripClusterToDigiProducer::SiStripClusterToDigiProducer(const edm::ParameterS void SiStripClusterToDigiProducer::produce(edm::Event& event, const edm::EventSetup& es) { if (gainWatcher_.check(es)) { - gainHandle = &es.getData(gainToken_); + gain_ = &es.getData(gainToken_); } std::vector<DetDigiCollection> output_base; @@ -102,7 +102,7 @@ void SiStripClusterToDigiProducer::process(const ClusterCollection& input, } inline void SiStripClusterToDigiProducer::setDetId(const uint32_t id) { - gainRange = gainHandle->getRange(id); + gainRange = gain_->getRange(id); detId = id; } diff --git a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h index b1ada64044622..e0de4c5eed8c0 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h +++ b/RecoLocalTracker/SiStripZeroSuppression/interface/SiStripFedZeroSuppression.h @@ -52,8 +52,8 @@ class SiStripFedZeroSuppression { private: edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> noiseToken_; edm::ESGetToken<SiStripThreshold, SiStripThresholdRcd> thresholdToken_; - const SiStripNoises* noiseHandle_; - const SiStripThreshold* thresholdHandle_; + const SiStripNoises* noise_; + const SiStripThreshold* threshold_; edm::ESWatcher<SiStripNoisesRcd> noiseWatcher_; edm::ESWatcher<SiStripThresholdRcd> thresholdWatcher_; diff --git a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc index 8a902c13123e7..ddaa39cc89abf 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc +++ b/RecoLocalTracker/SiStripZeroSuppression/src/SiStripFedZeroSuppression.cc @@ -11,17 +11,17 @@ using namespace std; void SiStripFedZeroSuppression::init(const edm::EventSetup& es) { if (noiseWatcher_.check(es)) { - noiseHandle_ = &es.getData(noiseToken_); + noise_ = &es.getData(noiseToken_); } if (thresholdWatcher_.check(es)) { - thresholdHandle_ = &es.getData(thresholdToken_); + threshold_ = &es.getData(thresholdToken_); } } void SiStripFedZeroSuppression::suppress(const std::vector<SiStripDigi>& in, std::vector<SiStripDigi>& selectedSignal, uint32_t detID) { - suppress(in, selectedSignal, detID, *noiseHandle_, *thresholdHandle_); + suppress(in, selectedSignal, detID, *noise_, *threshold_); } void SiStripFedZeroSuppression::suppress(const std::vector<SiStripDigi>& in, @@ -128,8 +128,8 @@ void SiStripFedZeroSuppression::suppress(const std::vector<SiStripDigi>& in, void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, edm::DetSet<SiStripDigi>& out) { const uint32_t detID = out.id; - SiStripNoises::Range detNoiseRange = noiseHandle_->getRange(detID); - SiStripThreshold::Range detThRange = thresholdHandle_->getRange(detID); + SiStripNoises::Range detNoiseRange = noise_->getRange(detID); + SiStripThreshold::Range detThRange = threshold_->getRange(detID); #ifdef DEBUG_SiStripZeroSuppression_ if (edm::isDebugEnabled()) LogTrace("SiStripZeroSuppression") @@ -147,11 +147,9 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, #endif adc = in_iter->adc(); - SiStripThreshold::Data thresholds = thresholdHandle_->getData(strip, detThRange); - theFEDlowThresh = - static_cast<int16_t>(thresholds.getLth() * noiseHandle_->getNoiseFast(strip, detNoiseRange) + 0.5); - theFEDhighThresh = - static_cast<int16_t>(thresholds.getHth() * noiseHandle_->getNoiseFast(strip, detNoiseRange) + 0.5); + SiStripThreshold::Data thresholds = threshold_->getData(strip, detThRange); + theFEDlowThresh = static_cast<int16_t>(thresholds.getLth() * noise_->getNoiseFast(strip, detNoiseRange) + 0.5); + theFEDhighThresh = static_cast<int16_t>(thresholds.getHth() * noise_->getNoiseFast(strip, detNoiseRange) + 0.5); adcPrev = -9999; adcNext = -9999; @@ -167,11 +165,11 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, theNextFEDhighThresh = 9999; } else { adcNext = (in_iter + 1)->adc(); - SiStripThreshold::Data thresholds_1 = thresholdHandle_->getData(strip + 1, detThRange); + SiStripThreshold::Data thresholds_1 = threshold_->getData(strip + 1, detThRange); theNextFEDlowThresh = - static_cast<int16_t>(thresholds_1.getLth() * noiseHandle_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getLth() * noise_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); theNextFEDhighThresh = - static_cast<int16_t>(thresholds_1.getHth() * noiseHandle_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getHth() * noise_->getNoiseFast(strip + 1, detNoiseRange) + 0.5); } /* Similarily, for the first strip @@ -183,11 +181,11 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, thePrevFEDhighThresh = 9999; } else { adcPrev = (in_iter - 1)->adc(); - SiStripThreshold::Data thresholds_1 = thresholdHandle_->getData(strip - 1, detThRange); + SiStripThreshold::Data thresholds_1 = threshold_->getData(strip - 1, detThRange); thePrevFEDlowThresh = - static_cast<int16_t>(thresholds_1.getLth() * noiseHandle_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getLth() * noise_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); thePrevFEDhighThresh = - static_cast<int16_t>(thresholds_1.getHth() * noiseHandle_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); + static_cast<int16_t>(thresholds_1.getHth() * noise_->getNoiseFast(strip - 1, detNoiseRange) + 0.5); } if (adcNext < adcPrev) { adcMaxNeigh = adcPrev; @@ -209,18 +207,16 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, theNext2FEDlowThresh = 9999; } else if (strip % 128 < 126) { adcNext2 = (in_iter + 2)->adc(); - theNext2FEDlowThresh = static_cast<int16_t>(thresholdHandle_->getData(strip + 2, detThRange).getLth() * - noiseHandle_->getNoiseFast(strip + 2, detNoiseRange) + - 0.5); + theNext2FEDlowThresh = static_cast<int16_t>( + threshold_->getData(strip + 2, detThRange).getLth() * noise_->getNoiseFast(strip + 2, detNoiseRange) + 0.5); } if (strip % 128 <= 1) { adcPrev2 = 0; thePrev2FEDlowThresh = 9999; } else if (strip % 128 > 1) { adcPrev2 = (in_iter - 2)->adc(); - thePrev2FEDlowThresh = static_cast<int16_t>(thresholdHandle_->getData(strip - 2, detThRange).getLth() * - noiseHandle_->getNoiseFast(strip - 2, detNoiseRange) + - 0.5); + thePrev2FEDlowThresh = static_cast<int16_t>( + threshold_->getData(strip - 2, detThRange).getLth() * noise_->getNoiseFast(strip - 2, detNoiseRange) + 0.5); } //GB 23/6/08: truncation should be done at the very beginning if (isAValidDigi()) @@ -229,8 +225,8 @@ void SiStripFedZeroSuppression::suppress(const edm::DetSet<SiStripRawDigi>& in, } void SiStripFedZeroSuppression::fillThresholds_(const uint32_t detID, size_t size) { - SiStripNoises::Range detNoiseRange = noiseHandle_->getRange(detID); - SiStripThreshold::Range detThRange = thresholdHandle_->getRange(detID); + SiStripNoises::Range detNoiseRange = noise_->getRange(detID); + SiStripThreshold::Range detThRange = threshold_->getRange(detID); if (highThr_.size() != size) { highThr_.resize(size); @@ -240,8 +236,8 @@ void SiStripFedZeroSuppression::fillThresholds_(const uint32_t detID, size_t siz lowThrSN_.resize(size); } - noiseHandle_->allNoises(noises_, detNoiseRange); - thresholdHandle_->allThresholds(lowThrSN_, highThrSN_, detThRange); // thresholds as S/N + noise_->allNoises(noises_, detNoiseRange); + threshold_->allThresholds(lowThrSN_, highThrSN_, detThRange); // thresholds as S/N for (size_t strip = 0; strip < size; ++strip) { float noise = noises_[strip]; // uncomment line below to check bluk noise decoding From 73cbe61a0e9eb1ec1d0ca10e7d19c3dfd006da2f Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Fri, 7 May 2021 17:52:11 +0200 Subject: [PATCH 254/309] Uniform LCToSC naming --- ...c => LCToSCAssociatorByEnergyScoreImpl.cc} | 80 +++++++++---------- ....h => LCToSCAssociatorByEnergyScoreImpl.h} | 6 +- ... LCToSCAssociatorByEnergyScoreProducer.cc} | 24 +++--- .../plugins/LCToSCAssociatorEDProducer.cc | 6 +- 4 files changed, 57 insertions(+), 59 deletions(-) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{SimClusterAssociatorByEnergyScoreImpl.cc => LCToSCAssociatorByEnergyScoreImpl.cc} (88%) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{SimClusterAssociatorByEnergyScoreImpl.h => LCToSCAssociatorByEnergyScoreImpl.h} (92%) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{SimClusterAssociatorByEnergyScoreProducer.cc => LCToSCAssociatorByEnergyScoreProducer.cc} (68%) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc similarity index 88% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc index 935898ccd6af1..091a29353c23f 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.cc @@ -1,9 +1,9 @@ -#include "SimClusterAssociatorByEnergyScoreImpl.h" +#include "LCToSCAssociatorByEnergyScoreImpl.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -SimClusterAssociatorByEnergyScoreImpl::SimClusterAssociatorByEnergyScoreImpl( +LCToSCAssociatorByEnergyScoreImpl::LCToSCAssociatorByEnergyScoreImpl( edm::EDProductGetter const& productGetter, bool hardScatterOnly, std::shared_ptr<hgcal::RecHitTools> recHitTools, @@ -12,7 +12,7 @@ SimClusterAssociatorByEnergyScoreImpl::SimClusterAssociatorByEnergyScoreImpl( layers_ = recHitTools_->lastLayerBH(); } -hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( +hgcal::association LCToSCAssociatorByEnergyScoreImpl::makeConnections( const edm::Handle<reco::CaloClusterCollection>& cCCH, const edm::Handle<SimClusterCollection>& sCCH) const { // Get collections const auto& clusters = *cCCH.product(); @@ -26,7 +26,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( for (unsigned int scId = 0; scId < nSimClusters; ++scId) { if (hardScatterOnly_ && (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0)) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "Excluding SimCluster from event: " << simClusters[scId].g4Tracks()[0].eventId().event() << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; continue; @@ -74,40 +74,40 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } // end of loop over SimClusters #ifdef EDM_ML_DEBUG - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "lcsInSimCluster INFO (Only SimCluster filled at the moment)" << std::endl; for (size_t sc = 0; sc < lcsInSimCluster.size(); ++sc) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; for (size_t sclay = 0; sclay < lcsInSimCluster[sc].size(); ++sclay) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << lcsInSimCluster[sc][sclay].simClusterId << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Energy: " << lcsInSimCluster[sc][sclay].energy << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; double tot_energy = 0.; for (auto const& haf : lcsInSimCluster[sc][sclay].hits_and_fractions) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : lcsInSimCluster[sc][sclay].layerClusterIdToEnergyAndScore) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; for (auto const& sc : detIdToSimClusterId_Map) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sclu : sc.second) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction << " and energy: " << sclu.fraction * hitMap_->at(sc.first)->energy() << std::endl; } @@ -261,7 +261,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" << "\t" << std::setw(12) << "layerCluster" << "\t" << std::setw(10) << "lc energy" << "\t" << std::setw(5) << "nhits" @@ -275,7 +275,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( << "\t" << std::setw(25) << "energyFractionOfSCinLC" << "\t" << "\n"; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(10) << lcLayerId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << clusters[lcId].energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxSCId_byNumberOfHits << "\t" << std::setw(8) @@ -284,39 +284,39 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( << energyFractionOfLCinSC << "\t" << std::setw(25) << energyFractionOfSCinLC << "\n"; } // End of loop over LayerClusters - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "Improved lcsInSimCluster INFO (Now containing the linked layer clusters id and energy - score still empty)" << std::endl; for (size_t sc = 0; sc < lcsInSimCluster.size(); ++sc) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; for (size_t sclay = 0; sclay < lcsInSimCluster[sc].size(); ++sclay) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " On Layer: " << sclay << " we have:" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << lcsInSimCluster[sc][sclay].simClusterId << std::endl; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Energy: " << lcsInSimCluster[sc][sclay].energy << std::endl; double tot_energy = 0.; for (auto const& haf : lcsInSimCluster[sc][sclay].hits_and_fractions) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : lcsInSimCluster[sc][sclay].layerClusterIdToEnergyAndScore) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" << lc.second.first << "/" << lc.second.second << std::endl; } } } - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; for (auto const& sc : detIdToSimClusterId_Map) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sclu : sc.second) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction << " and energy: " << sclu.fraction * hitMap_->at(sc.first)->energy() << std::endl; } @@ -338,7 +338,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( if (clusters[lcId].energy() == 0. && !scsInLayerCluster[lcId].empty()) { for (auto& scPair : scsInLayerCluster[lcId]) { scPair.second = 1.; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t SC id : \t" + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t SC id : \t" << scPair.first << "\t score \t " << scPair.second << "\n"; } continue; @@ -373,7 +373,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( scPair.second += (rhFraction - scFraction) * (rhFraction - scFraction) * hitEnergyWeight * invLayerClusterEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "rh_detid:\t" << (uint32_t)rh_detid << "\tlayerClusterId:\t" << lcId << "\t" << "rhfraction,scfraction:\t" << rhFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -384,7 +384,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over Hits within a LayerCluster #ifdef EDM_ML_DEBUG if (scsInLayerCluster[lcId].empty()) - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tSC id:\t-1 " + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tSC id:\t-1 " << "\t score \t-1" << "\n"; #endif @@ -412,12 +412,12 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( if (SCenergy > 0.f) SCEnergyFractionInLC = maxEnergyLCinSC / SCenergy; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(8) << "LayerId:\t" << std::setw(12) << "simcluster\t" << std::setw(15) << "sc total energy\t" << std::setw(15) << "scEnergyOnLayer\t" << std::setw(14) << "SCNhitsOnLayer\t" << std::setw(18) << "lcWithMaxEnergyInSC\t" << std::setw(15) << "maxEnergyLCinSC\t" << std::setw(20) << "SCEnergyFractionInLC" << "\n"; - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << std::setw(8) << layerId << "\t" << std::setw(12) << scId << "\t" << std::setw(15) << simClusters[scId].energy() << "\t" << std::setw(15) << SCenergy << "\t" << std::setw(14) << SCNumberOfHits << "\t" << std::setw(18) << lcWithMaxEnergyInSC << "\t" << std::setw(15) << maxEnergyLCinSC << "\t" @@ -456,7 +456,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( lcPair.second.second += (lcFraction - scFraction) * (lcFraction - scFraction) * hitEnergyWeight * invSCEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "scDetId:\t" << (uint32_t)sc_hitDetId << "\tlayerClusterId:\t" << layerClusterId << "\t" << "lcfraction,scfraction:\t" << lcFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -467,12 +467,12 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over hits of SimCluster on a Layer #ifdef EDM_ML_DEBUG if (lcsInSimCluster[scId][layerId].layerClusterIdToEnergyAndScore.empty()) - LogDebug("SimClusterAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tLC id:\t-1 " + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tLC id:\t-1 " << "\t score \t-1" << "\n"; for (const auto& lcPair : lcsInSimCluster[scId][layerId].layerClusterIdToEnergyAndScore) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\t LC id: \t" << lcPair.first << "\t score \t" << lcPair.second.second << "\t shared energy:\t" << lcPair.second.first << "\t shared energy fraction:\t" << (lcPair.second.first / SCenergy) << "\n"; @@ -483,7 +483,7 @@ hgcal::association SimClusterAssociatorByEnergyScoreImpl::makeConnections( return {scsInLayerCluster, lcsInSimCluster}; } -hgcal::RecoToSimCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl::associateRecoToSim( +hgcal::RecoToSimCollectionWithSimClusters LCToSCAssociatorByEnergyScoreImpl::associateRecoToSim( const edm::Handle<reco::CaloClusterCollection>& cCCH, const edm::Handle<SimClusterCollection>& sCCH) const { hgcal::RecoToSimCollectionWithSimClusters returnValue(productGetter_); const auto& links = makeConnections(cCCH, sCCH); @@ -491,7 +491,7 @@ hgcal::RecoToSimCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl: const auto& scsInLayerCluster = std::get<0>(links); for (size_t lcId = 0; lcId < scsInLayerCluster.size(); ++lcId) { for (auto& scPair : scsInLayerCluster[lcId]) { - LogDebug("SimClusterAssociatorByEnergyScoreImpl") + LogDebug("LCToSCAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\t SC id: \t" << scPair.first << "\t score \t" << scPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref<reco::CaloClusterCollection>(cCCH, lcId), // Ref to LC @@ -503,7 +503,7 @@ hgcal::RecoToSimCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl: return returnValue; } -hgcal::SimToRecoCollectionWithSimClusters SimClusterAssociatorByEnergyScoreImpl::associateSimToReco( +hgcal::SimToRecoCollectionWithSimClusters LCToSCAssociatorByEnergyScoreImpl::associateSimToReco( const edm::Handle<reco::CaloClusterCollection>& cCCH, const edm::Handle<SimClusterCollection>& sCCH) const { hgcal::SimToRecoCollectionWithSimClusters returnValue(productGetter_); const auto& links = makeConnections(cCCH, sCCH); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h similarity index 92% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.h rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h index 3bee92f577b83..fbcd3882bdb5e 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreImpl.h @@ -1,4 +1,4 @@ -// Original Author: Marco Rovere +// Original Author: Leonardo Cristella #include <vector> #include <map> @@ -44,9 +44,9 @@ namespace hgcal { typedef std::tuple<layerClusterToSimCluster, simClusterToLayerCluster> association; } // namespace hgcal -class SimClusterAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToSimClusterAssociatorBaseImpl { +class LCToSCAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToSimClusterAssociatorBaseImpl { public: - explicit SimClusterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + explicit LCToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, bool, std::shared_ptr<hgcal::RecHitTools>, const std::unordered_map<DetId, const HGCRecHit *> *); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc similarity index 68% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc index bb4a6784da136..c8549133f52d6 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/SimClusterAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorByEnergyScoreProducer.cc @@ -1,4 +1,4 @@ -// Original author: Marco Rovere +// Original author: Leonardo Cristella // user include files #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -12,12 +12,12 @@ #include "FWCore/Utilities/interface/ESGetToken.h" #include "SimDataFormats/Associations/interface/LayerClusterToSimClusterAssociator.h" -#include "SimClusterAssociatorByEnergyScoreImpl.h" +#include "LCToSCAssociatorByEnergyScoreImpl.h" -class SimClusterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +class LCToSCAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { public: - explicit SimClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); - ~SimClusterAssociatorByEnergyScoreProducer() override; + explicit LCToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~LCToSCAssociatorByEnergyScoreProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); @@ -29,7 +29,7 @@ class SimClusterAssociatorByEnergyScoreProducer : public edm::global::EDProducer std::shared_ptr<hgcal::RecHitTools> rhtools_; }; -SimClusterAssociatorByEnergyScoreProducer::SimClusterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) +LCToSCAssociatorByEnergyScoreProducer::LCToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) : hitMap_(consumes<std::unordered_map<DetId, const HGCRecHit *>>(ps.getParameter<edm::InputTag>("hitMapTag"))), caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()), hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")) { @@ -39,23 +39,23 @@ SimClusterAssociatorByEnergyScoreProducer::SimClusterAssociatorByEnergyScoreProd produces<hgcal::LayerClusterToSimClusterAssociator>(); } -SimClusterAssociatorByEnergyScoreProducer::~SimClusterAssociatorByEnergyScoreProducer() {} +LCToSCAssociatorByEnergyScoreProducer::~LCToSCAssociatorByEnergyScoreProducer() {} -void SimClusterAssociatorByEnergyScoreProducer::produce(edm::StreamID, +void LCToSCAssociatorByEnergyScoreProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &es) const { edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_); rhtools_->setGeometry(*geom); - const std::unordered_map<DetId, const HGCRecHit *> *hitMap = &iEvent.get(hitMap_); + const auto hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique<SimClusterAssociatorByEnergyScoreImpl>( + auto impl = std::make_unique<LCToSCAssociatorByEnergyScoreImpl>( iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); auto toPut = std::make_unique<hgcal::LayerClusterToSimClusterAssociator>(std::move(impl)); iEvent.put(std::move(toPut)); } -void SimClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { +void LCToSCAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { edm::ParameterSetDescription desc; desc.add<edm::InputTag>("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); desc.add<bool>("hardScatterOnly", true); @@ -64,4 +64,4 @@ void SimClusterAssociatorByEnergyScoreProducer::fillDescriptions(edm::Configurat } //define this as a plug-in -DEFINE_FWK_MODULE(SimClusterAssociatorByEnergyScoreProducer); +DEFINE_FWK_MODULE(LCToSCAssociatorByEnergyScoreProducer); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc index 2a0e71e0cd730..6edda534b56ef 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToSCAssociatorEDProducer.cc @@ -72,12 +72,10 @@ void LCToSCAssociatorEDProducer::produce(edm::StreamID, edm::Event &iEvent, cons iEvent.getByToken(LCCollectionToken_, LCCollection); // associate LC and SC - LogTrace("AssociatorValidator") << "Calling associateRecoToSim method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateRecoToSim method\n"; hgcal::RecoToSimCollectionWithSimClusters recSimColl = theAssociator->associateRecoToSim(LCCollection, SCCollection); - LogTrace("AssociatorValidator") << "Calling associateSimToReco method" - << "\n"; + LogTrace("AssociatorValidator") << "Calling associateSimToReco method\n"; hgcal::SimToRecoCollectionWithSimClusters simRecColl = theAssociator->associateSimToReco(LCCollection, SCCollection); auto rts = std::make_unique<hgcal::RecoToSimCollectionWithSimClusters>(recSimColl); From ce88f45f063d480bf0d87129bb4a6c18eec138ac Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Fri, 7 May 2021 18:07:06 +0200 Subject: [PATCH 255/309] Uniform TSToSC naming --- ...c => TSToSCAssociatorByEnergyScoreImpl.cc} | 99 +++++++++---------- ....h => TSToSCAssociatorByEnergyScoreImpl.h} | 4 +- ... TSToSCAssociatorByEnergyScoreProducer.cc} | 22 ++--- 3 files changed, 62 insertions(+), 63 deletions(-) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{TracksterAssociatorByEnergyScoreImpl.cc => TSToSCAssociatorByEnergyScoreImpl.cc} (85%) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{TracksterAssociatorByEnergyScoreImpl.h => TSToSCAssociatorByEnergyScoreImpl.h} (93%) rename SimCalorimetry/HGCalAssociatorProducers/plugins/{TracksterAssociatorByEnergyScoreProducer.cc => TSToSCAssociatorByEnergyScoreProducer.cc} (69%) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc similarity index 85% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc index 6c78e2e6cfe5f..d6be35a5c0991 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc @@ -1,9 +1,9 @@ -#include "TracksterAssociatorByEnergyScoreImpl.h" +#include "TSToSCAssociatorByEnergyScoreImpl.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" -TracksterAssociatorByEnergyScoreImpl::TracksterAssociatorByEnergyScoreImpl( +TSToSCAssociatorByEnergyScoreImpl::TSToSCAssociatorByEnergyScoreImpl( edm::EDProductGetter const& productGetter, bool hardScatterOnly, std::shared_ptr<hgcal::RecHitTools> recHitTools, @@ -12,7 +12,7 @@ TracksterAssociatorByEnergyScoreImpl::TracksterAssociatorByEnergyScoreImpl( layers_ = recHitTools_->lastLayerBH(); } -hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( +hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( const edm::Handle<ticl::TracksterCollection>& tCH, const edm::Handle<reco::CaloClusterCollection>& lCCH, const edm::Handle<SimClusterCollection>& sCCH) const { @@ -29,7 +29,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( for (unsigned int scId = 0; scId < nSimClusters; ++scId) { if (hardScatterOnly_ && (simClusters[scId].g4Tracks()[0].eventId().event() != 0 or simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() != 0)) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Excluding SimCluster from event: " << simClusters[scId].g4Tracks()[0].eventId().event() << " with BX: " << simClusters[scId].g4Tracks()[0].eventId().bunchCrossing() << std::endl; continue; @@ -71,36 +71,36 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } // end of loop over SimClusters #ifdef EDM_ML_DEBUG - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "tssInSimCluster INFO (Only SimCluster filled at the moment)" << std::endl; for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Energy: " << tssInSimCluster[sc].energy << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; double tot_energy = 0.; for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; } } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "detIdToSimClusterId_Map INFO" << std::endl; for (auto const& detId : detIdToSimClusterId_Map) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)detId.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sc : detId.second) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sc.clusterId << " with fraction: " << sc.fraction << " and energy: " << sc.fraction * hitMap_->at(detId.first)->energy() << std::endl; } @@ -253,21 +253,20 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << std::setw(12) << "TracksterID:" - << "\t" << std::setw(12) << "layerCluster" - << "\t" << std::setw(10) << "lc energy" - << "\t" << std::setw(5) << "nhits" - << "\t" << std::setw(12) << "noise hits" - << "\t" << std::setw(22) << "maxSCId_byNumberOfHits" - << "\t" << std::setw(8) << "nhitsSC" - << "\t" << std::setw(13) << "maxSCId_byEnergy" - << "\t" << std::setw(20) << "maxEnergySharedLCandSC" - << "\t" << std::setw(22) << "totalSCEnergyOnLayer" - << "\t" << std::setw(22) << "energyFractionOfLCinSC" - << "\t" << std::setw(25) << "energyFractionOfSCinLC" - << "\t" + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << "TracksterID:\t" + << std::setw(12) << "layerCluster\t" + << std::setw(10) << "lc energy\t" + << std::setw(5) << "nhits\t" + << std::setw(12) << "noise hits\t" + << std::setw(22) << "maxSCId_byNumberOfHits\t" + << std::setw(8) << "nhitsSC\t" + << std::setw(13) << "maxSCId_byEnergy\t" + << std::setw(20) << "maxEnergySharedLCandSC\t" + << std::setw(22) << "totalSCEnergyOnLayer\t" + << std::setw(22) << "energyFractionOfLCinSC\t" + << std::setw(25) << "energyFractionOfSCinLC\t" << "\n"; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << tsId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << tracksters[tsId].raw_energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) << numberOfNoiseHitsInLC << "\t" << std::setw(22) << maxSCId_byNumberOfHits << "\t" << std::setw(8) @@ -277,36 +276,36 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over LayerClusters in Trackster } // End of loop over Tracksters - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Improved tssInSimCluster INFO (Now containing the linked tracksters id and energy - score still empty)" << std::endl; for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Energy: " << tssInSimCluster[sc].energy << std::endl; double tot_energy = 0.; for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; } } - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Improved detIdToSimClusterId_Map INFO" << std::endl; for (auto const& sc : detIdToSimClusterId_Map) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For detId: " << (uint32_t)sc.first << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sclu : sc.second) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " SimCluster Id: " << sclu.clusterId << " with fraction: " << sclu.fraction << " and energy: " << sclu.fraction * hitMap_->at(sc.first)->energy() << std::endl; } @@ -327,7 +326,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( if (tracksters[tsId].raw_energy() == 0. && !scsInTrackster[tsId].empty()) { for (auto& scPair : scsInTrackster[tsId]) { scPair.second = 1.; - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "TracksterId : \t " << tsId << "\t SC id : \t" + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "TracksterId : \t " << tsId << "\t SC id : \t" << scPair.first << "\t score \t " << scPair.second << "\n"; } continue; @@ -375,7 +374,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( scPair.second += (rhFraction - scFraction) * (rhFraction - scFraction) * hitEnergyWeight * invTracksterEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "rh_detid:\t" << (uint32_t)rh_detid << "\ttracksterId:\t" << tsId << "\t" << "rhfraction,scFraction:\t" << rhFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -388,7 +387,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( #ifdef EDM_ML_DEBUG if (scsInTrackster[tsId].empty()) - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "trackster Id: \t" << tsId << "\tSC id:\t-1 " + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "trackster Id: \t" << tsId << "\tSC id:\t-1 " << "\t score \t-1" << "\n"; #endif @@ -417,12 +416,12 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( if (SCenergy > 0.f) SCEnergyFractionInTS = maxEnergyTSinSC / SCenergy; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << "simcluster\t" << std::setw(15) << "sc total energy\t" << std::setw(15) << "scEnergyOnLayer\t" << std::setw(14) << "SCNhitsOnLayer\t" << std::setw(18) << "tsWithMaxEnergyInSC\t" << std::setw(15) << "maxEnergyTSinSC\t" << std::setw(20) << "SCEnergyFractionInTS" << "\n"; - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << scId << "\t" << std::setw(15) << simClusters[scId].energy() << "\t" << std::setw(15) << SCenergy << "\t" << std::setw(14) << SCNumberOfHits << "\t" << std::setw(18) << tsWithMaxEnergyInSC << "\t" << std::setw(15) << maxEnergyTSinSC << "\t" << std::setw(20) << SCEnergyFractionInTS << "\n"; @@ -464,7 +463,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( tsPair.second.second += (tsFraction - scFraction) * (tsFraction - scFraction) * hitEnergyWeight * invSCEnergyWeight; #ifdef EDM_ML_DEBUG - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SCDetId:\t" << (uint32_t)sc_hitDetId << "\tTracksterId:\t" << tracksterId << "\t" << "tsFraction, scFraction:\t" << tsFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" @@ -476,12 +475,12 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over hits of SimCluster on a Layer #ifdef EDM_ML_DEBUG if (tssInSimCluster[scId].tracksterIdToEnergyAndScore.empty()) - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tTS id:\t-1 " + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tTS id:\t-1 " << "\t score \t-1" << "\n"; for (const auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\t TS id: \t" << tsPair.first << "\t score \t" << tsPair.second.second << "\t shared energy:\t" << tsPair.second.first << "\t shared energy fraction:\t" << (tsPair.second.first / SCenergy) << "\n"; @@ -491,7 +490,7 @@ hgcal::association TracksterAssociatorByEnergyScoreImpl::makeConnections( return {scsInTrackster, tssInSimCluster}; } -hgcal::RecoToSimCollectionTracksters TracksterAssociatorByEnergyScoreImpl::associateRecoToSim( +hgcal::RecoToSimCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associateRecoToSim( const edm::Handle<ticl::TracksterCollection>& tCH, const edm::Handle<reco::CaloClusterCollection>& lCCH, const edm::Handle<SimClusterCollection>& sCCH) const { @@ -501,7 +500,7 @@ hgcal::RecoToSimCollectionTracksters TracksterAssociatorByEnergyScoreImpl::assoc const auto& scsInTrackster = std::get<0>(links); for (size_t tsId = 0; tsId < scsInTrackster.size(); ++tsId) { for (auto& scPair : scsInTrackster[tsId]) { - LogDebug("TracksterAssociatorByEnergyScoreImpl") << "Trackster Id: \t" << tsId << "\t SimCluster id: \t" + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Trackster Id: \t" << tsId << "\t SimCluster id: \t" << scPair.first << "\t score \t" << scPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref<ticl::TracksterCollection>(tCH, tsId), // Ref to TS @@ -513,7 +512,7 @@ hgcal::RecoToSimCollectionTracksters TracksterAssociatorByEnergyScoreImpl::assoc return returnValue; } -hgcal::SimToRecoCollectionTracksters TracksterAssociatorByEnergyScoreImpl::associateSimToReco( +hgcal::SimToRecoCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associateSimToReco( const edm::Handle<ticl::TracksterCollection>& tCH, const edm::Handle<reco::CaloClusterCollection>& lCCH, const edm::Handle<SimClusterCollection>& sCCH) const { diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h similarity index 93% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h index 8c75d5af38797..0a3eef9051760 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.h @@ -37,9 +37,9 @@ namespace hgcal { typedef std::tuple<tracksterToSimCluster, simClusterToTrackster> association; } // namespace hgcal -class TracksterAssociatorByEnergyScoreImpl : public hgcal::TracksterToSimClusterAssociatorBaseImpl { +class TSToSCAssociatorByEnergyScoreImpl : public hgcal::TracksterToSimClusterAssociatorBaseImpl { public: - explicit TracksterAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, + explicit TSToSCAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, bool, std::shared_ptr<hgcal::RecHitTools>, const std::unordered_map<DetId, const HGCRecHit *> *); diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc similarity index 69% rename from SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc rename to SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc index 8bd086a89574d..72c51329c0719 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TracksterAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreProducer.cc @@ -12,12 +12,12 @@ #include "FWCore/Utilities/interface/ESGetToken.h" #include "SimDataFormats/Associations/interface/TracksterToSimClusterAssociator.h" -#include "TracksterAssociatorByEnergyScoreImpl.h" +#include "TSToSCAssociatorByEnergyScoreImpl.h" -class TracksterAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { +class TSToSCAssociatorByEnergyScoreProducer : public edm::global::EDProducer<> { public: - explicit TracksterAssociatorByEnergyScoreProducer(const edm::ParameterSet &); - ~TracksterAssociatorByEnergyScoreProducer() override; + explicit TSToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &); + ~TSToSCAssociatorByEnergyScoreProducer() override; static void fillDescriptions(edm::ConfigurationDescriptions &descriptions); @@ -29,7 +29,7 @@ class TracksterAssociatorByEnergyScoreProducer : public edm::global::EDProducer< std::shared_ptr<hgcal::RecHitTools> rhtools_; }; -TracksterAssociatorByEnergyScoreProducer::TracksterAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) +TSToSCAssociatorByEnergyScoreProducer::TSToSCAssociatorByEnergyScoreProducer(const edm::ParameterSet &ps) : hitMap_(consumes<std::unordered_map<DetId, const HGCRecHit *>>(ps.getParameter<edm::InputTag>("hitMapTag"))), caloGeometry_(esConsumes<CaloGeometry, CaloGeometryRecord>()), hardScatterOnly_(ps.getParameter<bool>("hardScatterOnly")) { @@ -39,23 +39,23 @@ TracksterAssociatorByEnergyScoreProducer::TracksterAssociatorByEnergyScoreProduc produces<hgcal::TracksterToSimClusterAssociator>(); } -TracksterAssociatorByEnergyScoreProducer::~TracksterAssociatorByEnergyScoreProducer() {} +TSToSCAssociatorByEnergyScoreProducer::~TSToSCAssociatorByEnergyScoreProducer() {} -void TracksterAssociatorByEnergyScoreProducer::produce(edm::StreamID, +void TSToSCAssociatorByEnergyScoreProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &es) const { edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_); rhtools_->setGeometry(*geom); - const std::unordered_map<DetId, const HGCRecHit *> *hitMap = &iEvent.get(hitMap_); + const auto hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique<TracksterAssociatorByEnergyScoreImpl>( + auto impl = std::make_unique<TSToSCAssociatorByEnergyScoreImpl>( iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); auto toPut = std::make_unique<hgcal::TracksterToSimClusterAssociator>(std::move(impl)); iEvent.put(std::move(toPut)); } -void TracksterAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { +void TSToSCAssociatorByEnergyScoreProducer::fillDescriptions(edm::ConfigurationDescriptions &cfg) { edm::ParameterSetDescription desc; desc.add<edm::InputTag>("hitMapTag", edm::InputTag("hgcalRecHitMapProducer")); desc.add<bool>("hardScatterOnly", true); @@ -64,4 +64,4 @@ void TracksterAssociatorByEnergyScoreProducer::fillDescriptions(edm::Configurati } //define this as a plug-in -DEFINE_FWK_MODULE(TracksterAssociatorByEnergyScoreProducer); +DEFINE_FWK_MODULE(TSToSCAssociatorByEnergyScoreProducer); From 742d675390c2ed22b0363645354930e7c247a1e5 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Fri, 7 May 2021 18:08:27 +0200 Subject: [PATCH 256/309] Forgot auto --- .../plugins/LCToCPAssociatorByEnergyScoreImpl.cc | 2 +- .../plugins/LCToCPAssociatorByEnergyScoreImpl.h | 2 +- .../plugins/LCToCPAssociatorByEnergyScoreProducer.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc index 9b802ffe00a03..9ace7e113688d 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc @@ -13,7 +13,7 @@ LCToCPAssociatorByEnergyScoreImpl::LCToCPAssociatorByEnergyScoreImpl( edm::EDProductGetter const& productGetter, bool hardScatterOnly, std::shared_ptr<hgcal::RecHitTools> recHitTools, - const std::unordered_map<DetId, const HGCRecHit*>*& hitMap) + const std::unordered_map<DetId, const HGCRecHit*>* hitMap) : hardScatterOnly_(hardScatterOnly), recHitTools_(recHitTools), hitMap_(hitMap), productGetter_(&productGetter) { layers_ = recHitTools_->lastLayerBH(); } diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index 97a7f33e9b7e3..f6a6b3d175996 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -49,7 +49,7 @@ class LCToCPAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToCaloPartic explicit LCToCPAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, bool, std::shared_ptr<hgcal::RecHitTools>, - const std::unordered_map<DetId, const HGCRecHit *> *&); + const std::unordered_map<DetId, const HGCRecHit *> *); hgcal::RecoToSimCollection associateRecoToSim(const edm::Handle<reco::CaloClusterCollection> &cCH, const edm::Handle<CaloParticleCollection> &cPCH) const override; diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc index 14aeac5b4189b..3fb0ea816cfcf 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc @@ -47,7 +47,7 @@ void LCToCPAssociatorByEnergyScoreProducer::produce(edm::StreamID, edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_); rhtools_->setGeometry(*geom); - const std::unordered_map<DetId, const HGCRecHit *> *hitMap = &iEvent.get(hitMap_); + const auto hitMap = &iEvent.get(hitMap_); auto impl = std::make_unique<LCToCPAssociatorByEnergyScoreImpl>( iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); From 78ca392a36c8048519a474026584830cd5fce3bd Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Fri, 7 May 2021 18:35:10 +0200 Subject: [PATCH 257/309] code-format --- .../LCToCPAssociatorByEnergyScoreImpl.cc | 39 +++++++++---------- .../LCToCPAssociatorByEnergyScoreImpl.h | 6 +-- .../LCToCPAssociatorByEnergyScoreProducer.cc | 8 ++-- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc index 9ace7e113688d..0f5c943ac9eeb 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc @@ -113,7 +113,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : cPOnLayer[cp][cpp].layerClusterIdToEnergyAndScore) { LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" - << lc.second.first << "/" << lc.second.second << std::endl; + << lc.second.first << "/" << lc.second.second << std::endl; } } } @@ -269,20 +269,19 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:" - << "\t" << std::setw(12) << "layerCluster" - << "\t" << std::setw(10) << "lc energy" - << "\t" << std::setw(5) << "nhits" - << "\t" << std::setw(12) << "noise hits" - << "\t" << std::setw(22) << "maxCPId_byNumberOfHits" - << "\t" << std::setw(8) << "nhitsCP" - << "\t" << std::setw(13) << "maxCPId_byEnergy" - << "\t" << std::setw(20) << "maxEnergySharedLCandCP" - << "\t" << std::setw(22) << "totalCPEnergyOnLayer" - << "\t" << std::setw(22) << "energyFractionOfLCinCP" - << "\t" << std::setw(25) << "energyFractionOfCPinLC" - << "\t" - << "\n"; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:\t" + << std::setw(12) << "layerCluster\t" + << std::setw(10) << "lc energy\t" + << std::setw(5) << "nhits\t" + << std::setw(12) << "noise hits\t" + << std::setw(22) << "maxCPId_byNumberOfHits\t" + << std::setw(8) << "nhitsCP\t" + << std::setw(13) << "maxCPId_byEnergy\t" + << std::setw(20) << "maxEnergySharedLCandCP\t" + << std::setw(22) << "totalCPEnergyOnLayer\t" + << std::setw(22) << "energyFractionOfLCinCP\t" + << std::setw(25) << "energyFractionOfCPinLC\t" + << "\n"; LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << lcLayerId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << clusters[lcId].energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) @@ -311,7 +310,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; for (auto const& lc : cPOnLayer[cp][cpp].layerClusterIdToEnergyAndScore) { LogDebug("LCToCPAssociatorByEnergyScoreImpl") << " lcIdx/energy/score: " << lc.first << "/" - << lc.second.first << "/" << lc.second.second << std::endl; + << lc.second.first << "/" << lc.second.second << std::endl; } } } @@ -344,7 +343,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( for (auto& cpPair : cpsInLayerCluster[lcId]) { cpPair.second = 1.; LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerClusterId : \t " << lcId << "\t CP id : \t" - << cpPair.first << "\t score \t " << cpPair.second << "\n"; + << cpPair.first << "\t score \t " << cpPair.second << "\n"; } continue; } @@ -382,8 +381,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( #ifdef EDM_ML_DEBUG if (cpsInLayerCluster[lcId].empty()) LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "layerCluster Id: \t" << lcId << "\tCP id:\t-1 " - << "\t score \t-1" - << "\n"; + << "\t score \t-1\n"; #endif } // End of loop over LayerClusters @@ -463,8 +461,7 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( #ifdef EDM_ML_DEBUG if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty()) LogDebug("LCToCPAssociatorByEnergyScoreImpl") << "CP Id: \t" << cpId << "\tLC id:\t-1 " - << "\t score \t-1" - << "\n"; + << "\t score \t-1\n"; for (const auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) { LogDebug("LCToCPAssociatorByEnergyScoreImpl") diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h index f6a6b3d175996..346c3d64d2bba 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.h @@ -47,9 +47,9 @@ namespace hgcal { class LCToCPAssociatorByEnergyScoreImpl : public hgcal::LayerClusterToCaloParticleAssociatorBaseImpl { public: explicit LCToCPAssociatorByEnergyScoreImpl(edm::EDProductGetter const &, - bool, - std::shared_ptr<hgcal::RecHitTools>, - const std::unordered_map<DetId, const HGCRecHit *> *); + bool, + std::shared_ptr<hgcal::RecHitTools>, + const std::unordered_map<DetId, const HGCRecHit *> *); hgcal::RecoToSimCollection associateRecoToSim(const edm::Handle<reco::CaloClusterCollection> &cCH, const edm::Handle<CaloParticleCollection> &cPCH) const override; diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc index 3fb0ea816cfcf..9187c7eac3202 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreProducer.cc @@ -42,15 +42,15 @@ LCToCPAssociatorByEnergyScoreProducer::LCToCPAssociatorByEnergyScoreProducer(con LCToCPAssociatorByEnergyScoreProducer::~LCToCPAssociatorByEnergyScoreProducer() {} void LCToCPAssociatorByEnergyScoreProducer::produce(edm::StreamID, - edm::Event &iEvent, - const edm::EventSetup &es) const { + edm::Event &iEvent, + const edm::EventSetup &es) const { edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_); rhtools_->setGeometry(*geom); const auto hitMap = &iEvent.get(hitMap_); - auto impl = std::make_unique<LCToCPAssociatorByEnergyScoreImpl>( - iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); + auto impl = + std::make_unique<LCToCPAssociatorByEnergyScoreImpl>(iEvent.productGetter(), hardScatterOnly_, rhtools_, hitMap); auto toPut = std::make_unique<hgcal::LayerClusterToCaloParticleAssociator>(std::move(impl)); iEvent.put(std::move(toPut)); } From c346b5d8257eb848055ff32c36cced834360d840 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Fri, 7 May 2021 18:44:02 +0200 Subject: [PATCH 258/309] format code-format --- .../LCToCPAssociatorByEnergyScoreImpl.cc | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc index 0f5c943ac9eeb..965281a03885b 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/LCToCPAssociatorByEnergyScoreImpl.cc @@ -269,19 +269,13 @@ hgcal::association LCToCPAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << "LayerId:\t" - << std::setw(12) << "layerCluster\t" - << std::setw(10) << "lc energy\t" - << std::setw(5) << "nhits\t" - << std::setw(12) << "noise hits\t" - << std::setw(22) << "maxCPId_byNumberOfHits\t" - << std::setw(8) << "nhitsCP\t" - << std::setw(13) << "maxCPId_byEnergy\t" - << std::setw(20) << "maxEnergySharedLCandCP\t" - << std::setw(22) << "totalCPEnergyOnLayer\t" - << std::setw(22) << "energyFractionOfLCinCP\t" - << std::setw(25) << "energyFractionOfCPinLC\t" - << "\n"; + LogDebug("LCToCPAssociatorByEnergyScoreImpl") + << std::setw(10) << "LayerId:\t" << std::setw(12) << "layerCluster\t" << std::setw(10) << "lc energy\t" + << std::setw(5) << "nhits\t" << std::setw(12) << "noise hits\t" << std::setw(22) << "maxCPId_byNumberOfHits\t" + << std::setw(8) << "nhitsCP\t" << std::setw(13) << "maxCPId_byEnergy\t" << std::setw(20) + << "maxEnergySharedLCandCP\t" << std::setw(22) << "totalCPEnergyOnLayer\t" << std::setw(22) + << "energyFractionOfLCinCP\t" << std::setw(25) << "energyFractionOfCPinLC\t" + << "\n"; LogDebug("LCToCPAssociatorByEnergyScoreImpl") << std::setw(10) << lcLayerId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << clusters[lcId].energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) From ee0d7131e45fc2bb07c7e0aabba00cc20330b7dd Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Sun, 9 May 2021 11:47:53 +0200 Subject: [PATCH 259/309] move static constexpr as class member in MTDTopology --- .../interface/MTDTopology.h | 3 +++ .../MTDNumberingBuilder/src/MTDTopology.cc | 20 ++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h index 4ee4dd10f00b5..d8a572e6acf14 100644 --- a/Geometry/MTDNumberingBuilder/interface/MTDTopology.h +++ b/Geometry/MTDNumberingBuilder/interface/MTDTopology.h @@ -40,6 +40,9 @@ class MTDTopology { const int mtdTopologyMode_; const ETLValues etlVals_; + + static constexpr size_t failIndex_ = + std::numeric_limits<unsigned int>::max(); // return out-of-range value for any failure }; #endif diff --git a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc index 37843a3dc6f3a..f766a23df5913 100644 --- a/Geometry/MTDNumberingBuilder/src/MTDTopology.cc +++ b/Geometry/MTDNumberingBuilder/src/MTDTopology.cc @@ -18,14 +18,11 @@ bool MTDTopology::orderETLSector(const GeomDet*& gd1, const GeomDet*& gd2) { } size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) const { - static constexpr size_t failIndex( - std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure - ETLDetId start_mod(detid); if (horizontalShift == 0) { edm::LogWarning("MTDTopology") << "asking of a null horizotalShift in ETL"; - return failIndex; + return failIndex_; } int hsh = horizontalShift > 0 ? 1 : -1; @@ -53,18 +50,17 @@ size_t MTDTopology::hshiftETL(const uint32_t detid, const int horizontalShift) c } } - return failIndex; + return failIndex_; } size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift, size_t& closest) const { - size_t failIndex(std::numeric_limits<unsigned int>::max()); // return out-of-range value for any failure - closest = failIndex; + closest = failIndex_; ETLDetId start_mod(detid); if (verticalShift == 0) { edm::LogWarning("MTDTopology") << "asking of a null verticalShift in ETL"; - return failIndex; + return failIndex_; } int vsh = verticalShift > 0 ? 1 : -1; @@ -94,7 +90,7 @@ size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift, siz if (iBin == etlVals_[discside].start_copy_[iHome].size()) { edm::LogWarning("MTDTopology") << "Module number not compatible with layout, abort"; - return failIndex; + return failIndex_; } // define the interval of interest for the other type according to the vertical shift sign @@ -107,7 +103,7 @@ size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift, siz iBinOther = iBin + 1; } if (iBinOther < 0 || iBinOther >= static_cast<int>(etlVals_[discside].start_copy_[iOther].size()) - 1) { - return failIndex; + return failIndex_; } // determine the position of the other type corresponding to the same column of the home type @@ -124,9 +120,9 @@ size_t MTDTopology::vshiftETL(const uint32_t detid, const int verticalShift, siz iBinOther + 1 == static_cast<int>(etlVals_[discside].start_copy_[iOther].size()))) { closest = etlVals_[discside].start_copy_[iOther][iBinOther + 1] - 1; } - if (closest < failIndex) { + if (closest < failIndex_) { closest = closest + nmodOffset - 1; - return failIndex; + return failIndex_; } else { // number of module shifted by 1 wrt the position in the array (i.e. module 1 has index 0) return etlVals_[discside].start_copy_[iOther][iBinOther] + vpos - 1 - From 802bee39b99009c5c647eec4d48d93d43023474c Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Mon, 10 May 2021 09:28:01 +0200 Subject: [PATCH 260/309] post PR #33635 merge fixes --- DQM/SiPixelPhase1Track/plugins/BuildFile.xml | 1 + DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/DQM/SiPixelPhase1Track/plugins/BuildFile.xml b/DQM/SiPixelPhase1Track/plugins/BuildFile.xml index 9781015a98d6a..9445daca14d82 100644 --- a/DQM/SiPixelPhase1Track/plugins/BuildFile.xml +++ b/DQM/SiPixelPhase1Track/plugins/BuildFile.xml @@ -1,5 +1,6 @@ <use name="DQM/SiPixelPhase1Common"/> <use name="DataFormats/TrackerRecHit2D"/> <use name="RecoPixelVertexing/PixelLowPtUtilities"/> +<use name="CondFormats/SiPixelTransient"/> <use name="Alignment/OfflineValidation"/> <flags EDM_PLUGIN="1"/> diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index 714b0931f9a3b..4f57ba4617981 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -31,7 +31,7 @@ #include "RecoTracker/Record/interface/CkfComponentsRecord.h" #include "RecoPixelVertexing/PixelLowPtUtilities/interface/ClusterShapeHitFilter.h" -#include "CondFormats/SiPixelTransient/src/SiPixelTemplate.cc" +#include "CondFormats/SiPixelTransient/interface/SiPixelTemplate.h" #include "CalibTracker/Records/interface/SiPixelTemplateDBObjectESProducerRcd.h" namespace { @@ -122,9 +122,6 @@ namespace { } void SiPixelPhase1TrackClusters::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { - // get geometry - edm::ESHandle<TrackerGeometry> tracker = iSetup.getHandle(trackerGeomToken_); - assert(tracker.isValid()); //get topology tkTpl = &iSetup.getData(trackerTopoToken_); From 838d2bff98c86175342cff5b2a69c5d194f5c6c1 Mon Sep 17 00:00:00 2001 From: Markus Seidel <markus.seidel@cern.ch> Date: Mon, 10 May 2021 10:37:44 +0200 Subject: [PATCH 261/309] Increase mass precision for SUSY particles --- PhysicsTools/NanoAOD/python/genparticles_cff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/python/genparticles_cff.py b/PhysicsTools/NanoAOD/python/genparticles_cff.py index 086ca196288fb..552912c12b230 100644 --- a/PhysicsTools/NanoAOD/python/genparticles_cff.py +++ b/PhysicsTools/NanoAOD/python/genparticles_cff.py @@ -41,7 +41,7 @@ pt = Var("pt", float, precision=8), phi = Var("phi", float,precision=8), eta = Var("eta", float,precision=8), - mass = Var("?!((abs(pdgId)>=1 && abs(pdgId)<=5) || (abs(pdgId)>=11 && abs(pdgId)<=16) || pdgId==21 || pdgId==111 || abs(pdgId)==211 || abs(pdgId)==421 || abs(pdgId)==411 || (pdgId==22 && mass<1))?mass:0", float,precision="?(abs(pdgId)==6 && statusFlags().isLastCopy())?20:8",doc="Mass stored for all particles with the exception of quarks (except top), leptons/neutrinos, photons with mass < 1 GeV, gluons, pi0(111), pi+(211), D0(421), and D+(411). For these particles, you can lookup the value from PDG."), + mass = Var("?!((abs(pdgId)>=1 && abs(pdgId)<=5) || (abs(pdgId)>=11 && abs(pdgId)<=16) || pdgId==21 || pdgId==111 || abs(pdgId)==211 || abs(pdgId)==421 || abs(pdgId)==411 || (pdgId==22 && mass<1))?mass:0", float,precision="?((abs(pdgId)==6 || abs(pdgId)>1000000) && statusFlags().isLastCopy())?20:8",doc="Mass stored for all particles with the exception of quarks (except top), leptons/neutrinos, photons with mass < 1 GeV, gluons, pi0(111), pi+(211), D0(421), and D+(411). For these particles, you can lookup the value from PDG."), pdgId = Var("pdgId", int, doc="PDG id"), status = Var("status", int, doc="Particle status. 1=stable"), genPartIdxMother = Var("?numberOfMothers>0?motherRef(0).key():-1", int, doc="index of the mother particle"), From 41a47e476c4e6acc6d2bb39c6babe2df5de446aa Mon Sep 17 00:00:00 2001 From: Jeongeun Lee <jeongeun.lee@cern.ch> Date: Mon, 10 May 2021 14:34:39 +0200 Subject: [PATCH 262/309] replace EDProducer with clone from the default cipython and cleanup --- .../python/islandBasicClusters_cfi.py | 41 +++------- .../particleFlowSuperClusterECALBox_cfi.py | 76 +++++++++---------- 2 files changed, 46 insertions(+), 71 deletions(-) diff --git a/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py b/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py index f2b28be2f6dcb..b5376280bd65c 100644 --- a/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py +++ b/RecoEcal/EgammaClusterProducers/python/islandBasicClusters_cfi.py @@ -1,51 +1,34 @@ import FWCore.ParameterSet.Config as cms +import RecoEcal.EgammaClusterProducers.IslandClusterProducer_cfi as _mod # Island BasicCluster producer -islandBasicClusters = cms.EDProducer("IslandClusterProducer", - barrelHits = cms.InputTag('ecalRecHit','EcalRecHitsEB'), - endcapHits = cms.InputTag('ecalRecHit','EcalRecHitsEE'), - barrelClusterCollection = cms.string('islandBarrelBasicClusters'), - IslandEndcapSeedThr = cms.double(0.18), - barrelShapeAssociation = cms.string('islandBarrelShapeAssoc'), - clustershapecollectionEE = cms.string('islandEndcapShape'), - clustershapecollectionEB = cms.string('islandBarrelShape'), - VerbosityLevel = cms.string('ERROR'), - endcapShapeAssociation = cms.string('islandEndcapShapeAssoc'), - endcapClusterCollection = cms.string('islandEndcapBasicClusters'), - IslandBarrelSeedThr = cms.double(0.5), - posCalcParameters = cms.PSet( T0_barl = cms.double(7.4), - T0_endc = cms.double(3.1), - T0_endcPresh = cms.double(1.2), - LogWeighted = cms.bool(True), - W0 = cms.double(4.2), - X0 = cms.double(0.89) - ), +islandBasicClusters = _mod.IslandClusterProducer.clone( + endcapShapeAssociation = 'islandEndcapShapeAssoc', + posCalcParameters = dict(), # recHit flags to be excluded from seeding - SeedRecHitFlagToBeExcludedEB = cms.vstring( + SeedRecHitFlagToBeExcludedEB = [ 'kFaultyHardware', 'kTowerRecovered', 'kDead' - ), - SeedRecHitFlagToBeExcludedEE = cms.vstring( + ], + SeedRecHitFlagToBeExcludedEE = [ 'kFaultyHardware', 'kNeighboursRecovered', 'kTowerRecovered', 'kDead', 'kWeird' - ), + ], # recHit flags to be excluded from clustering - RecHitFlagToBeExcludedEB = cms.vstring( + RecHitFlagToBeExcludedEB = [ 'kWeird', 'kDiWeird', 'kOutOfTime', 'kTowerRecovered' - ), - RecHitFlagToBeExcludedEE = cms.vstring( + ], + RecHitFlagToBeExcludedEE = [ 'kWeird', 'kDiWeird', 'kOutOfTime', 'kTowerRecovered' - ) + ] ) - - diff --git a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py index 0510628e02c25..5e3bdbc77152b 100644 --- a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py +++ b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py @@ -1,76 +1,68 @@ import FWCore.ParameterSet.Config as cms +import RecoEcal.EgammaClusterProducers.particleFlowSuperClusterECALMustache_cfi as _mod -particleFlowSuperClusterECALBox = cms.EDProducer("PFECALSuperClusterProducer", +particleFlowSuperClusterECALBox = _mod.particleFlowSuperClusterECALMustache.clone( # verbosity - verbose = cms.untracked.bool(False), + verbose = False, # clustering type: "Box" or "Mustache" - ClusteringType = cms.string("Box"), + ClusteringType = "Box", # energy weighting: "Raw", "CalibratedNoPS", "CalibratedTotal" - EnergyWeight = cms.string("Raw"), + EnergyWeight = "Raw", # this overrides both dphi cuts below if true! - useDynamicDPhiWindow = cms.bool(False), + useDynamicDPhiWindow = False, # PFClusters collection - PFClusters = cms.InputTag("particleFlowClusterECAL"), - ESAssociation = cms.InputTag("particleFlowClusterECAL"), - BeamSpot = cms.InputTag("offlineBeamSpot"), + PFClusters = "particleFlowClusterECAL", + ESAssociation = "particleFlowClusterECAL", + BeamSpot = "offlineBeamSpot", - PFBasicClusterCollectionBarrel = cms.string("particleFlowBasicClusterECALBarrel"), - PFSuperClusterCollectionBarrel = cms.string("particleFlowSuperClusterECALBarrel"), - PFBasicClusterCollectionEndcap = cms.string("particleFlowBasicClusterECALEndcap"), - PFSuperClusterCollectionEndcap = cms.string("particleFlowSuperClusterECALEndcap"), - PFBasicClusterCollectionPreshower = cms.string("particleFlowBasicClusterECALPreshower"), - PFSuperClusterCollectionEndcapWithPreshower = cms.string("particleFlowSuperClusterECALEndcapWithPreshower"), + PFBasicClusterCollectionBarrel = "particleFlowBasicClusterECALBarrel", + PFSuperClusterCollectionBarrel = "particleFlowSuperClusterECALBarrel", + PFBasicClusterCollectionEndcap = "particleFlowBasicClusterECALEndcap", + PFSuperClusterCollectionEndcap = "particleFlowSuperClusterECALEndcap", + PFBasicClusterCollectionPreshower = "particleFlowBasicClusterECALPreshower", + PFSuperClusterCollectionEndcapWithPreshower = "particleFlowSuperClusterECALEndcapWithPreshower", # use preshower ? - use_preshower = cms.bool(True), + use_preshower = True, # are the seed thresholds Et or Energy? - seedThresholdIsET = cms.bool(True), + seedThresholdIsET = True, # regression setup - useRegression = cms.bool(False), # regressions are mustache only - regressionConfig = cms.PSet( - regressionKeyEB = cms.string('pfscecal_EBCorrection_offline_v2'), - uncertaintyKeyEB = cms.string('pfscecal_EBUncertainty_offline_v2'), - regressionKeyEE = cms.string('pfscecal_EECorrection_offline_v2'), - uncertaintyKeyEE = cms.string('pfscecal_EEUncertainty_offline_v2'), - vertexCollection = cms.InputTag("offlinePrimaryVertices"), - ecalRecHitsEB = cms.InputTag('ecalRecHit','EcalRecHitsEB'), - ecalRecHitsEE = cms.InputTag('ecalRecHit','EcalRecHitsEE'), - applySigmaIetaIphiBug = cms.bool(False) - ), + useRegression = False, # regressions are mustache only + regressionConfig = dict(), # threshold for final SuperCluster Et - thresh_SCEt = cms.double(4.0), + thresh_SCEt = 4.0, # threshold in ECAL - thresh_PFClusterSeedBarrel = cms.double(3.0), - thresh_PFClusterBarrel = cms.double(0.5), + thresh_PFClusterSeedBarrel = 3.0, + thresh_PFClusterBarrel = 0.5, - thresh_PFClusterSeedEndcap = cms.double(5.0), - thresh_PFClusterEndcap = cms.double(0.5), + thresh_PFClusterSeedEndcap = 5.0, + thresh_PFClusterEndcap = 0.5, # window width in ECAL - phiwidth_SuperClusterBarrel = cms.double(0.28), - etawidth_SuperClusterBarrel = cms.double(0.04), + phiwidth_SuperClusterBarrel = 0.28, + etawidth_SuperClusterBarrel = 0.04, - phiwidth_SuperClusterEndcap = cms.double(0.28), - etawidth_SuperClusterEndcap = cms.double(0.04), + phiwidth_SuperClusterEndcap = 0.28, + etawidth_SuperClusterEndcap = 0.04, # threshold in preshower - thresh_PFClusterES = cms.double(0.), + thresh_PFClusterES = 0., # turn on merging of the seed cluster to its nearest neighbors # that share a rechit - doSatelliteClusterMerge = cms.bool(False), - satelliteClusterSeedThreshold = cms.double(50.0), - satelliteMajorityFraction = cms.double(0.5), - dropUnseedable = cms.bool(False), + doSatelliteClusterMerge = False, + satelliteClusterSeedThreshold = 50.0, + satelliteMajorityFraction = 0.5, + dropUnseedable = False, #thresh_PFClusterMustacheOutBarrel = cms.double(0.), #thresh_PFClusterMustacheOutEndcap = cms.double(0.), # corrections - applyCrackCorrections = cms.bool(False) + applyCrackCorrections = False ) From 00338bdb95306217e11f468beebad5c1de690a40 Mon Sep 17 00:00:00 2001 From: Giacomo Govi <giacomo.govi@cern.ch> Date: Mon, 10 May 2021 15:15:24 +0200 Subject: [PATCH 263/309] Fix for incomplete query! --- CondCore/Utilities/scripts/conddb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CondCore/Utilities/scripts/conddb b/CondCore/Utilities/scripts/conddb index c7536a592cba6..f2476e432d7ae 100755 --- a/CondCore/Utilities/scripts/conddb +++ b/CondCore/Utilities/scripts/conddb @@ -1628,7 +1628,7 @@ def _copy_tag(args, copyTime, session1, session2, first, second, fromIOV=None, t Tag1 = session1.get_dbtype(conddb.Tag) Tag2 = session2.get_dbtype(conddb.Tag) # Copy the tag - obj = session1.query(Tag1.name, Tag1.time_type, Tag1.object_type, Tag1.synchronization, Tag1.description, Tag1.last_validated_time, Tag1.end_of_validity, Tag1.insertion_time, Tag1.modification_time).first() + obj = session1.query(Tag1.name, Tag1.time_type, Tag1.object_type, Tag1.synchronization, Tag1.description, Tag1.last_validated_time, Tag1.end_of_validity, Tag1.insertion_time, Tag1.modification_time).filter(Tag1.name == first).first() tag = _rawdict_selection(obj) tag['name'] = second From 7f81a5d6585cd74e4eecfe07b9d77bd686444d00 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 10 May 2021 08:52:06 -0500 Subject: [PATCH 264/309] Subdirectories for GEMCSC LUTs --- .../python/params/gemcscParams.py | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py b/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py index 045c7c9b14f8e..5b41d80e50920 100644 --- a/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py +++ b/L1Trigger/CSCTriggerPrimitives/python/params/gemcscParams.py @@ -15,61 +15,61 @@ ## convert pad number to 1/2-strip in ME1a padToHsME1aFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME1a_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1a_odd.txt", ), ## convert pad number to 1/2-strip in ME1b padToHsME1bFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME1b_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME1b_odd.txt", ), ## convert pad number to 1/2-strip in ME21 padToHsME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_hs_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_hs_ME21_odd.txt", ), ## convert pad number to 1/8-strip in ME1a padToEsME1aFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME1a_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME1a_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1a_odd.txt", ), ## convert pad number to 1/8-strip in ME1b padToEsME1bFiles = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME1b_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME1b_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME1b_odd.txt", ), ## convert pad number to 1/8-strip in ME21 padToEsME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_pad_es_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_pad_es_ME21_odd.txt", ), ## convert eta partition to minimum wiregroup in ME11 rollToMinWgME11Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_min_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_min_wg_ME11_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME11_odd.txt", ), ## convert eta partition to maximum wiregroup in ME11 rollToMaxWgME11Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_max_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_max_wg_ME11_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME11_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME11_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME11_odd.txt", ), ## convert eta partition to minimum wiregroup in ME21 rollToMinWgME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_min_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_min_wg_ME21_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_min_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_min_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_min_wg_ME21_odd.txt", ), ## convert eta partition to maximum wiregroup in ME21 rollToMaxWgME21Files = cms.vstring( - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_max_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l1_max_wg_ME21_odd.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME21_even.txt", - "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/GEMCSCLUT_roll_l2_max_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l1_max_wg_ME21_odd.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_even.txt", + "L1Trigger/CSCTriggerPrimitives/data/GEMCSC/CoordinateConversion/GEMCSCLUT_roll_l2_max_wg_ME21_odd.txt", ), ) From cd19dabd416b13941e29100062366e39ed19da1e Mon Sep 17 00:00:00 2001 From: Justinas Rumsevicius <justinas.rumsevicius@gmail.com> Date: Mon, 10 May 2021 15:53:36 +0200 Subject: [PATCH 265/309] Use std::getenv in ExternalLHEProducer --- GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc index 57923bf5e49a1..195af9f807e00 100644 --- a/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc +++ b/GeneratorInterface/LHEInterface/plugins/ExternalLHEProducer.cc @@ -332,7 +332,7 @@ void ExternalLHEProducer::endRun(edm::Run const& run, edm::EventSetup const& es) nextEvent(); if (partonLevel_) { // VALIDATION_RUN env variable allows to finish event processing early without errors by sending SIGINT - if (getenv("VALIDATION_RUN") != nullptr) { + if (std::getenv("VALIDATION_RUN") != nullptr) { edm::LogWarning("ExternalLHEProducer") << "Event loop is over, but there are still lhe events to process, ignoring..."; } else { From 5fc9641d4f221fba01a5256c4d1a7722a3ce200f Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 10 May 2021 16:29:25 +0200 Subject: [PATCH 266/309] Add possibility of studying MB in all subvolumes of CMS --- .../CaloHit/interface/MaterialInformation.h | 52 ++++ .../CaloHit/src/MaterialInformation.cc | 9 + SimDataFormats/CaloHit/src/classes.h | 1 + SimDataFormats/CaloHit/src/classes_def.xml | 6 + Validation/Geometry/BuildFile.xml | 1 + .../python/materialBudgetVolume_cfi.py | 11 + .../Geometry/src/MaterialBudgetVolume.cc | 232 ++++++++++++++++++ .../src/MaterialBudgetVolumeAnalysis.cc | 145 +++++++++++ .../test/runMaterialBudgetVolume_cfg.py | 41 ++++ 9 files changed, 498 insertions(+) create mode 100644 SimDataFormats/CaloHit/interface/MaterialInformation.h create mode 100644 SimDataFormats/CaloHit/src/MaterialInformation.cc create mode 100644 Validation/Geometry/python/materialBudgetVolume_cfi.py create mode 100644 Validation/Geometry/src/MaterialBudgetVolume.cc create mode 100644 Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc create mode 100644 Validation/Geometry/test/runMaterialBudgetVolume_cfg.py diff --git a/SimDataFormats/CaloHit/interface/MaterialInformation.h b/SimDataFormats/CaloHit/interface/MaterialInformation.h new file mode 100644 index 0000000000000..6ea74b2487410 --- /dev/null +++ b/SimDataFormats/CaloHit/interface/MaterialInformation.h @@ -0,0 +1,52 @@ +#ifndef SimDataFormats_CaloHit_MaterialInformation_H +#define SimDataFormats_CaloHit_MaterialInformation_H + +#include <string> +#include <vector> + +// Persistent information about steps in material + +class MaterialInformation { +public: + MaterialInformation(std::string vname, int id = 0, float eta = 0, float phi = 0, float length = 0, float radlen = 0, float intlen = 0) : vname_(vname), id_(id), eta_(eta), phi_(phi), length_(length), radlen_(radlen), intlen_(intlen) {} + MaterialInformation() : vname_(""), id_(0), eta_(0), phi_(0), length_(0), radlen_(0), intlen_(0) {} + + //Names + static const char *name() { return "MaterialInformation"; } + const char *getName() const { return name(); } + std::string vname() const { return vname_; } + int id() const { return id_; } + void setID(int i) { id_ = i; } + + //Track eta, phi + double trackEta() const { return eta_; } + void setTrackEta(double e) { eta_ = e; } + double trackPhi() const { return eta_; } + void setTrackPhi(double f) { phi_ = f; } + + //Lengths + double stepLength() const { return length_; } + void setStepLength(double l) { length_ = l; } + double radiationLength() const { return radlen_; } + void setRadiationLength(double r) { radlen_ = r; } + double interactionLength() const { return intlen_; } + void setInteractionLength(double i) { intlen_ = i; } + +protected: + std::string vname_; + int id_; + float eta_; + float phi_; + float length_; + float radlen_; + float intlen_; +}; + +namespace edm { + typedef std::vector<MaterialInformation> MaterialInformationContainer; +} // namespace edm + +#include <iosfwd> +std::ostream &operator<<(std::ostream &, const MaterialInformation &); + +#endif // _SimDataFormats_CaloHit_MaterialInformation_h_ diff --git a/SimDataFormats/CaloHit/src/MaterialInformation.cc b/SimDataFormats/CaloHit/src/MaterialInformation.cc new file mode 100644 index 0000000000000..bd27f074cd85a --- /dev/null +++ b/SimDataFormats/CaloHit/src/MaterialInformation.cc @@ -0,0 +1,9 @@ +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" +#include <iomanip> +#include <iostream> + +std::ostream& operator<<(std::ostream& o, const MaterialInformation& info) { + o << info.vname() << " ID " << info.id() << " Eta:Phi " << info.trackEta() << ":" << info.trackPhi() << " Step Length " << std::setw(10) << info.stepLength() << " Radiation Length " << std::setw(10) << info.radiationLength() << " Interaction Length " << std::setw(10) << info.interactionLength(); + + return o; +} diff --git a/SimDataFormats/CaloHit/src/classes.h b/SimDataFormats/CaloHit/src/classes.h index 7d47b4fcc3c00..1aac6976e0f15 100644 --- a/SimDataFormats/CaloHit/src/classes.h +++ b/SimDataFormats/CaloHit/src/classes.h @@ -2,6 +2,7 @@ #include "SimDataFormats/CaloHit/interface/CastorShowerLibraryInfo.h" #include "SimDataFormats/CaloHit/interface/HFShowerLibraryEventInfo.h" #include "SimDataFormats/CaloHit/interface/HFShowerPhoton.h" +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" #include "SimDataFormats/CaloHit/interface/PCaloHit.h" #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" #include "SimDataFormats/CaloHit/interface/PassiveHit.h" diff --git a/SimDataFormats/CaloHit/src/classes_def.xml b/SimDataFormats/CaloHit/src/classes_def.xml index 6e7cbbd897498..07f1ddb950ce4 100644 --- a/SimDataFormats/CaloHit/src/classes_def.xml +++ b/SimDataFormats/CaloHit/src/classes_def.xml @@ -38,4 +38,10 @@ <class name="std::vector<PassiveHit>"/> <class name="std::vector<const PassiveHit*>"/> <class name="edm::Wrapper<std::vector<PassiveHit>>" splitLevel="0"/> + <class name="MaterialInformation" ClassVersion="16"> + <version ClassVersion="16" checksum="680156149"/> + </class> + <class name="std::vector<MaterialInformation>"/> + <class name="std::vector<const MaterialInformation*>"/> + <class name="edm::Wrapper<std::vector<MaterialInformation>>" splitLevel="0"/> </lcgdict> diff --git a/Validation/Geometry/BuildFile.xml b/Validation/Geometry/BuildFile.xml index 710935e56e879..866596d01a790 100644 --- a/Validation/Geometry/BuildFile.xml +++ b/Validation/Geometry/BuildFile.xml @@ -9,6 +9,7 @@ <use name="DetectorDescription/Core"/> <use name="DetectorDescription/DDCMS"/> <use name="Geometry/Records"/> +<use name="SimDataFormats/CaloHit"/> <use name="SimG4Core/Notification"/> <use name="SimG4Core/Watcher"/> <use name="CommonTools/UtilAlgos"/> diff --git a/Validation/Geometry/python/materialBudgetVolume_cfi.py b/Validation/Geometry/python/materialBudgetVolume_cfi.py new file mode 100644 index 0000000000000..09faa0476d007 --- /dev/null +++ b/Validation/Geometry/python/materialBudgetVolume_cfi.py @@ -0,0 +1,11 @@ +import FWCore.ParameterSet.Config as cms +from SimG4Core.Configuration.SimG4Core_cff import * + +g4SimHits.Watchers = cms.VPSet(cms.PSet( + MaterialBudgetVolume = cms.PSet( + lvNames = cms.vstring('BEAM', 'BEAM1', 'BEAM2', 'BEAM3', 'BEAM4', 'Tracker', 'ECAL', 'HCal', 'VCAL', 'MUON', 'HGCAL', 'MGNT', 'OQUA'), + lvLevels = cms.vint32(3, 3, 3, 3, 3, 3, 4, 4, 3, 3, 8, 3, 3), + useDD4Hep = cms.bool(False), + ), + type = cms.string('MaterialBudgetVolume') +)) diff --git a/Validation/Geometry/src/MaterialBudgetVolume.cc b/Validation/Geometry/src/MaterialBudgetVolume.cc new file mode 100644 index 0000000000000..a9300f8f7a190 --- /dev/null +++ b/Validation/Geometry/src/MaterialBudgetVolume.cc @@ -0,0 +1,232 @@ +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" + +#include "SimG4Core/Notification/interface/BeginOfRun.h" +#include "SimG4Core/Notification/interface/BeginOfEvent.h" +#include "SimG4Core/Notification/interface/BeginOfTrack.h" +#include "SimG4Core/Notification/interface/EndOfTrack.h" +#include "SimG4Core/Notification/interface/EndOfEvent.h" +#include "SimG4Core/Notification/interface/Observer.h" +#include "SimG4Core/Watcher/interface/SimProducer.h" + +#include "G4LogicalVolumeStore.hh" +#include "G4Step.hh" +#include "G4Track.hh" +#include "G4TransportationManager.hh" +#include "DD4hep/Filter.h" + +#include "CLHEP/Units/GlobalPhysicalConstants.h" +#include "CLHEP/Units/GlobalSystemOfUnits.h" + +#include <cmath> +#include <iomanip> +#include <iostream> +#include <map> +#include <memory> +#include <string> +#include <vector> +#include <utility> + +//#define EDM_ML_DEBUG + +class MaterialBudgetVolume : public SimProducer, + public Observer<const BeginOfRun *>, + public Observer<const BeginOfEvent *>, + public Observer<const BeginOfTrack*>, + public Observer<const G4Step*>, + public Observer<const EndOfTrack*> { +public: + MaterialBudgetVolume(const edm::ParameterSet &p); + ~MaterialBudgetVolume() override {} + + void produce(edm::Event &, const edm::EventSetup &) override; + + struct MatInfo { + double stepL, radL, intL; + MatInfo(double s = 0, double r = 0, double l = 0) : stepL(s), radL(r), intL(l) {} + }; + +private: + MaterialBudgetVolume(const MaterialBudgetVolume &) = delete; // stop default + const MaterialBudgetVolume &operator=(const MaterialBudgetVolume &) = delete; + + // observer classes + void update(const BeginOfRun *run) override; + void update(const BeginOfEvent *evt) override; + void update(const BeginOfTrack*) override; + void update(const EndOfTrack*) override; + void update(const G4Step *step) override; + + void endOfEvent(edm::MaterialInformationContainer &matbg); + bool loadLV(); + int findLV(const G4VTouchable*); + +private: + std::vector<std::string> lvNames_; + std::vector<int> lvLevel_; + int iaddLevel_; + bool init_; + std::map<int, std::pair<G4LogicalVolume*, int> > mapLV_; + std::vector<MatInfo> lengths_; + std::vector<MaterialInformation> store_; +}; + +MaterialBudgetVolume::MaterialBudgetVolume(const edm::ParameterSet& p) : init_(false) { + edm::ParameterSet m_p = p.getParameter<edm::ParameterSet>("MaterialBudgetVolume"); + + lvNames_ = m_p.getParameter<std::vector<std::string> >("lvNames"); + lvLevel_ = m_p.getParameter<std::vector<int> >("lvLevels"); + iaddLevel_ = (m_p.getParameter<bool>("useDD4Hep")) ? 1 : 0; + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Studies Material budget for " << lvNames_.size() << " volumes with addLevel " << iaddLevel_; + std::ostringstream st1; + for (unsigned int k = 0; k < lvNames_.size(); ++k) + st1 << " [" << k << "] " << lvNames_[k] << " at " << lvLevel_[k]; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Volumes" << st1.str(); +#endif + + produces<edm::MaterialInformationContainer>("MaterialInformation"); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: will produce MaterialInformationContainer"; +#endif +} + +void MaterialBudgetVolume::produce(edm::Event& e, const edm::EventSetup&) { + std::unique_ptr<edm::MaterialInformationContainer> matbg(new edm::MaterialInformationContainer); + endOfEvent(*matbg); + e.put(std::move(matbg), "MaterialInformation"); +} + +void MaterialBudgetVolume::update(const BeginOfRun* run) { + init_ = loadLV(); + +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Finds " << mapLV_.size() << " logical volumes with return flag " << init_; +#endif +} + +void MaterialBudgetVolume::update(const BeginOfEvent* evt) { +#ifdef EDM_ML_DEBUG + int iev = (*evt)()->GetEventID(); + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: =====> Begin event = " << iev << std::endl; +#endif + if (!init_) + init_ = loadLV(); + + store_.clear(); +} + +void MaterialBudgetVolume::update(const BeginOfTrack* trk) { + lengths_ = std::vector<MatInfo>(mapLV_.size()); + +#ifdef EDM_ML_DEBUG + const G4Track* aTrack = (*trk)(); + const G4ThreeVector& mom = aTrack->GetMomentum(); + double theEnergy = aTrack->GetTotalEnergy(); + int theID = static_cast<int>(aTrack->GetDefinition()->GetPDGEncoding()); + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumme: Track " << aTrack->GetTrackID() << " Code " << theID << " Energy " << theEnergy / CLHEP::GeV << " GeV; Momentum " << mom / CLHEP::GeV << " GeV"; +#endif +} + +void MaterialBudgetVolume::update(const G4Step* aStep) { + G4Material* material = aStep->GetPreStepPoint()->GetMaterial(); + double step = aStep->GetStepLength(); + double radl = material->GetRadlen(); + double intl = material->GetNuclearInterLength(); + const G4VTouchable* touch = aStep->GetPreStepPoint()->GetTouchable(); + int index = findLV(touch); + if (index >= 0) { + lengths_[index].stepL += step; + lengths_[index].radL += (step / radl); + lengths_[index].intL += (step / intl); + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName() << " Index " << index << " Step " << step << " RadL " << step / radl << " IntL " << step / intl; +#endif +} + +void MaterialBudgetVolume::update(const EndOfTrack* trk) { + const G4Track* aTrack = (*trk)(); + int id = aTrack->GetTrackID(); + double eta = aTrack->GetMomentumDirection().eta(); + double phi = aTrack->GetMomentumDirection().phi(); + for (unsigned int k = 0; k < lengths_.size(); ++k) { + MaterialInformation info(lvNames_[k], id, eta, phi, lengths_[k].stepL, lengths_[k].radL, lengths_[k].intL); + store_.emplace_back(info); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Volume[" << k << "]: " << info; +#endif + } +} + +void MaterialBudgetVolume::endOfEvent(edm::MaterialInformationContainer& matbg) { +#ifdef EDM_ML_DEBUG + unsigned int kount(0); +#endif + for (const auto& element : store_) { + MaterialInformation info(element.vname(), element.id(), element.trackEta(), element.trackPhi(), element.stepLength(), element.radiationLength(), element.interactionLength()); + matbg.push_back(info); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume:: Info[" << kount << "] " << info; + ++kount; +#endif + } +} + +bool MaterialBudgetVolume::loadLV() { + const G4LogicalVolumeStore* lvs = G4LogicalVolumeStore::GetInstance(); + bool flag(false); + if (lvs != nullptr) { + std::vector<G4LogicalVolume*>::const_iterator lvcite; + for (unsigned int i = 0; i < lvNames_.size(); i++) { + G4LogicalVolume* lv = nullptr; + std::string name(lvNames_[i]); + for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) { + std::string namx(dd4hep::dd::noNamespace((*lvcite)->GetName())); + if (namx == name) { + lv = (*lvcite); + break; + } + } + if (lv != nullptr) + mapLV_[i] = std::make_pair(lv, lvLevel_[i]); + } + flag = true; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Finds " << mapLV_.size() << " logical volumes"; + unsigned int k(0); + for (const auto& lvs : mapLV_) { + edm::LogVerbatim("MaterialBudget") << "Entry[" << k << "] " << lvs.first << ": (" << (lvs.second).first << ", " << (lvs.second).second << ") : " << lvNames_[lvs.first]; + ++k; + } +#endif + } + return flag; +} + + +int MaterialBudgetVolume::findLV(const G4VTouchable* touch) { + int level(-1); + int levels = ((touch->GetHistoryDepth()) + 1); + for (const auto& lvs : mapLV_) { + if ((lvs.second).second <= levels) { + int ii = levels - (lvs.second).second; + if ((touch->GetVolume(ii)->GetLogicalVolume()) == (lvs.second).first) { + level = lvs.first; + break; + } + } + } + return level; +} + +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/PluginManager/interface/ModuleDef.h" +#include "SimG4Core/Watcher/interface/SimWatcherFactory.h" + +DEFINE_SIMWATCHER(MaterialBudgetVolume); diff --git a/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc b/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc new file mode 100644 index 0000000000000..11b135867f680 --- /dev/null +++ b/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc @@ -0,0 +1,145 @@ +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "DataFormats/Math/interface/GeantUnits.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "SimDataFormats/CaloHit/interface/MaterialInformation.h" + +#include "TProfile.h" +#include "TProfile2D.h" + +#include <iostream> +#include <string> +#include <vector> + +//#define EDM_ML_DEBUG + +using namespace geant_units::operators; + +class MaterialBudgetVolumeAnalysis : public edm::one::EDAnalyzer<edm::one::SharedResources> { +public: + explicit MaterialBudgetVolumeAnalysis(edm::ParameterSet const&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyze(edm::Event const&, edm::EventSetup const&) override; + void bookHisto(); + + const std::vector<std::string> names_; + const edm::InputTag tag_; + const int binEta_, binPhi_; + const double etaLow_, etaHigh_, phiLow_, phiHigh_; + edm::EDGetTokenT<edm::MaterialInformationContainer> tok_info_; + std::vector<TProfile*> meStepEta_, meStepPhi_; + std::vector<TProfile*> meRadLEta_, meRadLPhi_; + std::vector<TProfile*> meIntLEta_, meIntLPhi_; + std::vector<TProfile2D*> meStepEtaPhi_, meRadLEtaPhi_, meIntLEtaPhi_; +}; + +MaterialBudgetVolumeAnalysis::MaterialBudgetVolumeAnalysis(const edm::ParameterSet& p) : names_(p.getParameter<std::vector<std::string> >("names")), tag_(p.getParameter<edm::InputTag>("inputTag")), binEta_(p.getParameter<int>("nBinEta")), binPhi_(p.getParameter<int>("nBinPhi")), etaLow_(p.getParameter<double>("etaLow")), etaHigh_(p.getParameter<double>("etaHigh")), phiLow_(-1._pi), phiHigh_(1._pi) { + usesResource(TFileService::kSharedResource); + tok_info_ = consumes<edm::MaterialInformationContainer>(tag_); + + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumeAnalysis: Eta plot: NX " << binEta_ << " Range " << -etaLow_ << ":" << etaHigh_ << " Phi plot: NX " << binPhi_ << " Range " << -1._pi << ":" << 1._pi << " for " << names_.size() << " detectors from " << tag_; + std::ostringstream st1; + for (unsigned int k = 0; k < names_.size(); ++k) + st1 << " [" << k << "] " << names_[k]; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: " << st1.str(); + bookHisto(); + +} + +void MaterialBudgetVolumeAnalysis::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector<std::string> names = {"BEAM", "BEAM1", "BEAM2", "BEAM3", "BEAM4", "Tracker", "ECAL", "HCal", "MUON", "VCAL", "MGNT", "OQUA", "HGCal"}; + desc.add<std::vector<std::string> >("names", names); + desc.add<edm::InputTag>("inputTag", edm::InputTag("g4SimHits", "MaterialInformation")); + desc.add<int>("nBinEta", 260); + desc.add<int>("nBinPhi", 180); + desc.add<double>("etaLow", -5.2); + desc.add<double>("etaHigh", 5.2); + descriptions.add("materialBudgetVolumeAnalysis", desc); +} + +void MaterialBudgetVolumeAnalysis::analyze(const edm::Event& iEvent, const edm::EventSetup&) { + edm::Handle<edm::MaterialInformationContainer> materialInformationContainer; + iEvent.getByToken(tok_info_, materialInformationContainer); +#ifdef EDM_ML_DEBUG + unsigned int nsize(0), ntot(0), nused(0); +#endif + if (materialInformationContainer.isValid()) { +#ifdef EDM_ML_DEBUG + nsize = materialInformationContainer->size(); +#endif + for (const auto& it : *(materialInformationContainer.product())) { +#ifdef EDM_ML_DEBUG + ntot++; +#endif + if (std::find(names_.begin(), names_.end(), it.vname()) != names_.end()) { +#ifdef EDM_ML_DEBUG + nused++; +#endif + unsigned int k = static_cast<unsigned int>(std::find(names_.begin(), names_.end(), it.vname()) - names_.begin()); + meStepEta_[k]->Fill(it.trackEta(), it.stepLength()); + meRadLEta_[k]->Fill(it.trackEta(), it.radiationLength()); + meIntLEta_[k]->Fill(it.trackEta(), it.interactionLength()); + meStepPhi_[k]->Fill(it.trackPhi(), it.stepLength()); + meRadLPhi_[k]->Fill(it.trackPhi(), it.radiationLength()); + meIntLPhi_[k]->Fill(it.trackPhi(), it.interactionLength()); + meStepEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.stepLength()); + meRadLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.radiationLength()); + meIntLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.interactionLength()); + } + } + } +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("MaterialBudget") << "MaterialInformation with " << nsize << ":" << ntot << " elements of which " << nused << " are used"; +#endif +} + +void MaterialBudgetVolumeAnalysis::bookHisto() { + edm::Service<TFileService> fs; + char name[40], title[100]; + for (unsigned int k = 0; k < names_.size(); ++k) { + sprintf(name, "stepEta%s", names_[k].c_str()); + sprintf(title, "MB(Step) vs #eta for %s", names_[k].c_str()); + meStepEta_.emplace_back(fs->make<TProfile>(name, title, binEta_, etaLow_, etaHigh_)); + sprintf(name, "radlEta%s", names_[k].c_str()); + sprintf(title, "MB(X0) vs #eta for %s", names_[k].c_str()); + meRadLEta_.emplace_back(fs->make<TProfile>(name, title, binEta_, etaLow_, etaHigh_)); + sprintf(name, "intlEta%s", names_[k].c_str()); + sprintf(title, "MB(L0) vs #eta for %s", names_[k].c_str()); + meIntLEta_.emplace_back(fs->make<TProfile>(name, title, binEta_, etaLow_, etaHigh_)); + sprintf(name, "stepPhi%s", names_[k].c_str()); + sprintf(title, "MB(Step) vs #phi for %s", names_[k].c_str()); + meStepPhi_.emplace_back(fs->make<TProfile>(name, title, binPhi_, phiLow_, phiHigh_)); + sprintf(name, "radlPhi%s", names_[k].c_str()); + sprintf(title, "MB(X0) vs #phi for %s", names_[k].c_str()); + meRadLPhi_.emplace_back(fs->make<TProfile>(name, title, binPhi_, phiLow_, phiHigh_)); + sprintf(name, "intlPhi%s", names_[k].c_str()); + sprintf(title, "MB(L0) vs #phi for %s", names_[k].c_str()); + meIntLPhi_.emplace_back(fs->make<TProfile>(name, title, binPhi_, phiLow_, phiHigh_)); + sprintf(name, "stepEtaPhi%s", names_[k].c_str()); + sprintf(title, "MB(Step) vs #eta and #phi for %s", names_[k].c_str()); + meStepEtaPhi_.emplace_back(fs->make<TProfile2D>(name, title, binEta_/2, etaLow_, etaHigh_, binPhi_/2, phiLow_, phiHigh_)); + sprintf(name, "radlEtaPhi%s", names_[k].c_str()); + sprintf(title, "MB(X0) vs #eta and #phi for %s", names_[k].c_str()); + meRadLEtaPhi_.emplace_back(fs->make<TProfile2D>(name, title, binEta_/2, etaLow_, etaHigh_, binPhi_/2, phiLow_, phiHigh_)); + sprintf(name, "intlEtaPhi%s", names_[k].c_str()); + sprintf(title, "MB(L0) vs #eta and #phi for %s", names_[k].c_str()); + meIntLEtaPhi_.emplace_back(fs->make<TProfile2D>(name, title, binEta_/2, etaLow_, etaHigh_, binPhi_/2, phiLow_, phiHigh_)); + } +} + +// define this as a plug-in +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(MaterialBudgetVolumeAnalysis); diff --git a/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py b/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py new file mode 100644 index 0000000000000..ffac4162d22c6 --- /dev/null +++ b/Validation/Geometry/test/runMaterialBudgetVolume_cfg.py @@ -0,0 +1,41 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 +process = cms.Process('PROD',Run3) + +process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load("Configuration.Geometry.GeometryExtended2021_cff") +process.load("Configuration.StandardSequences.MagneticField_cff") +process.load("SimG4Core.Application.g4SimHits_cfi") +process.load("Validation.Geometry.materialBudgetVolume_cfi") + +process.load("IOMC.RandomEngine.IOMC_cff") +process.RandomNumberGeneratorService.g4SimHits.initialSeed = 9876 + +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1000) +if hasattr(process,'MessageLogger'): + process.MessageLogger.MaterialBudget=dict() + +process.source = cms.Source("PoolSource", + noEventSort = cms.untracked.bool(True), + duplicateCheckMode = cms.untracked.string("noDuplicateCheck"), + fileNames = cms.untracked.vstring('file:single_neutrino_random.root') +) + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(-1) +) + +process.TFileService = cms.Service("TFileService", + fileName = cms.string('matbdgHCAL_run3.root') +) + +process.g4SimHits.UseMagneticField = False +process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' +process.g4SimHits.StackingAction.TrackNeutrino = True +process.g4SimHits.Physics.DummyEMPhysics = True +process.g4SimHits.Physics.CutsPerRegion = False + +process.load("Validation.Geometry.materialBudgetVolumeAnalysis_cfi") +process.p1 = cms.Path(process.g4SimHits+process.materialBudgetVolumeAnalysis) From 2bc4df6310563eacc1de1a3374cfc4ee2a8861e5 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 10 May 2021 09:33:03 -0500 Subject: [PATCH 267/309] Consolidate readmes --- .../{macros => }/CCLUTLinearFitWriter.cpp | 0 L1Trigger/CSCTriggerPrimitives/test/README.md | 39 +++++++++++++++++++ .../test/macros/README.md | 38 ------------------ 3 files changed, 39 insertions(+), 38 deletions(-) rename L1Trigger/CSCTriggerPrimitives/test/{macros => }/CCLUTLinearFitWriter.cpp (100%) delete mode 100644 L1Trigger/CSCTriggerPrimitives/test/macros/README.md diff --git a/L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp b/L1Trigger/CSCTriggerPrimitives/test/CCLUTLinearFitWriter.cpp similarity index 100% rename from L1Trigger/CSCTriggerPrimitives/test/macros/CCLUTLinearFitWriter.cpp rename to L1Trigger/CSCTriggerPrimitives/test/CCLUTLinearFitWriter.cpp diff --git a/L1Trigger/CSCTriggerPrimitives/test/README.md b/L1Trigger/CSCTriggerPrimitives/test/README.md index 663eedbb79b8f..1a9850e8bcc44 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/README.md +++ b/L1Trigger/CSCTriggerPrimitives/test/README.md @@ -31,3 +31,42 @@ runGEMCSCLUTAnalyzer -------------------- Makes the lookup tables for the GEM-CSC integrated local trigger in simulation and firmware. Current lookup tables can be found in https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/GEMCSC + +CCLUTLinearFitWriter +-------------------- + +The macro CCLUTLinearFitWriter.cpp produces look-up tables for the Run-3 CSC trigger using the comparator code logic. + +* 10 LUTs will be created for CMSSW (5 for position offset, 5 for slope). 5 LUTs will be created for the Verilog firmware. 5 additional LUTs will be created that convert the Run-3 comparator code & pattern ID to a Run-1/2 pattern ID. The LUTs used in the simulation require at least 3 layers. The macro also produces fits with at least four layers. + +<PRE> +mkdir output_3layers +mkdir output_4layers +mkdir figures_3layers +mkdir figures_4layers +root -l -q -b CCLUTLinearFitWriter.cpp++(3) +root -l -q -b CCLUTLinearFitWriter.cpp++(4) +</PRE> + +* Convention for 4-bit position offset word: + +| Value | Half-Strip Offset | Delta Half-Strip | Quarter-Strip Bit | Eighth-Strip Bit | +|-------|--------------------|-------------------|--------------------|------------------| +| 0 | -7/4 | -2 | 0 | 1 | +| 1 | -3/2 | -2 | 1 | 0 | +| 2 | -5/4 | -2 | 1 | 1 | +| 3 | -1 | -1 | 0 | 0 | +| 4 | -3/4 | -1 | 0 | 1 | +| 5 | -1/2 | -1 | 1 | 0 | +| 6 | -1/4 | -1 | 1 | 1 | +| 7 | 0 | 0 | 0 | 0 | +| 8 | 1/4 | 0 | 0 | 1 | +| 9 | 1/2 | 0 | 1 | 0 | +| 10 | 3/4 | 0 | 1 | 1 | +| 11 | 1 | 1 | 0 | 0 | +| 12 | 5/4 | 1 | 0 | 1 | +| 13 | 3/2 | 1 | 1 | 0 | +| 14 | 7/4 | 1 | 1 | 1 | +| 15 | 2 | 2 | 0 | 0 | + +The LUTs can be found at https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/CCLUT diff --git a/L1Trigger/CSCTriggerPrimitives/test/macros/README.md b/L1Trigger/CSCTriggerPrimitives/test/macros/README.md deleted file mode 100644 index 917fc9f6fed3c..0000000000000 --- a/L1Trigger/CSCTriggerPrimitives/test/macros/README.md +++ /dev/null @@ -1,38 +0,0 @@ -CCLUTLinearFitWriter -==================== - -The macro CCLUTLinearFitWriter.cpp produces look-up tables for the Run-3 CSC trigger. - -* 10 LUTs will be created for CMSSW (5 for position offset, 5 for slope). 5 LUTs will be created for the Verilog firmware. These files are similar to the ones found here: https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives. 5 additional LUTs will be created that convert the Run-3 comparator code & pattern ID to a Run-1/2 pattern ID. The LUTs used in the simulation require at least 3 layers. For reference the macro also produces fits with at least four layers. - -<PRE> -mkdir output_3layers -mkdir output_4layers -mkdir figures_3layers -mkdir figures_4layers -root -l -q -b CCLUTLinearFitWriter.cpp++(3) -root -l -q -b CCLUTLinearFitWriter.cpp++(4) -</PRE> - -* Convention for 4-bit position offset word: - -| Value | Half-Strip Offset | Delta Half-Strip | Quarter-Strip Bit | Eighth-Strip Bit | -|-------|--------------------|-------------------|--------------------|------------------| -| 0 | -7/4 | -2 | 0 | 1 | -| 1 | -3/2 | -2 | 1 | 0 | -| 2 | -5/4 | -2 | 1 | 1 | -| 3 | -1 | -1 | 0 | 0 | -| 4 | -3/4 | -1 | 0 | 1 | -| 5 | -1/2 | -1 | 1 | 0 | -| 6 | -1/4 | -1 | 1 | 1 | -| 7 | 0 | 0 | 0 | 0 | -| 8 | 1/4 | 0 | 0 | 1 | -| 9 | 1/2 | 0 | 1 | 0 | -| 10 | 3/4 | 0 | 1 | 1 | -| 11 | 1 | 1 | 0 | 0 | -| 12 | 5/4 | 1 | 0 | 1 | -| 13 | 3/2 | 1 | 1 | 0 | -| 14 | 7/4 | 1 | 1 | 1 | -| 15 | 2 | 2 | 0 | 0 | - -The LUTs can be found at https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/CCLUT \ No newline at end of file From ff05d35ae15e85853188ed5dd5da6515f1d053a5 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 10 May 2021 09:55:04 -0500 Subject: [PATCH 268/309] Document slope value --- L1Trigger/CSCTriggerPrimitives/test/README.md | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/L1Trigger/CSCTriggerPrimitives/test/README.md b/L1Trigger/CSCTriggerPrimitives/test/README.md index 1a9850e8bcc44..4a006db33c67a 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/README.md +++ b/L1Trigger/CSCTriggerPrimitives/test/README.md @@ -30,7 +30,7 @@ Compare configuration from DB with Python for CSC trigger primitives. Typically runGEMCSCLUTAnalyzer -------------------- -Makes the lookup tables for the GEM-CSC integrated local trigger in simulation and firmware. Current lookup tables can be found in https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/GEMCSC +Makes the lookup tables for the GEM-CSC integrated local trigger in simulation and firmware. Current lookup tables can be found at https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/GEMCSC CCLUTLinearFitWriter -------------------- @@ -69,4 +69,27 @@ root -l -q -b CCLUTLinearFitWriter.cpp++(4) | 14 | 7/4 | 1 | 1 | 1 | | 15 | 2 | 2 | 0 | 0 | +* Convention for 4-bit slope: + +Slope is in units [half-strip offset/layer]. The sign of the bending is interpreted as in Run-1 and Run-2. + +| Value | Slope | +|-------|-------| +| 0 | 1/8 | +| 1 | 2/8 | +| 2 | 3/8 | +| 3 | 4/8 | +| 4 | 5/8 | +| 5 | 6/8 | +| 6 | 7/8 | +| 7 | 1 | +| 8 | 9/8 | +| 9 | 10/8 | +| 10 | 11/8 | +| 11 | 12/8 | +| 12 | 13/8 | +| 13 | 14/8 | +| 14 | 2 | +| 15 | 20/8 | + The LUTs can be found at https://github.com/cms-data/L1Trigger-CSCTriggerPrimitives/CCLUT From ed5e5208c38c7da908437b5b4fff7d9762af1a58 Mon Sep 17 00:00:00 2001 From: Sunanda <sunanda.banerjee@cern.ch> Date: Mon, 10 May 2021 16:57:29 +0200 Subject: [PATCH 269/309] Code check --- .../CaloHit/interface/MaterialInformation.h | 6 +- .../CaloHit/src/MaterialInformation.cc | 4 +- .../Geometry/src/MaterialBudgetVolume.cc | 70 +++++++++++-------- .../src/MaterialBudgetVolumeAnalysis.cc | 56 +++++++++------ 4 files changed, 84 insertions(+), 52 deletions(-) diff --git a/SimDataFormats/CaloHit/interface/MaterialInformation.h b/SimDataFormats/CaloHit/interface/MaterialInformation.h index 6ea74b2487410..7e468f617ce7a 100644 --- a/SimDataFormats/CaloHit/interface/MaterialInformation.h +++ b/SimDataFormats/CaloHit/interface/MaterialInformation.h @@ -8,8 +8,10 @@ class MaterialInformation { public: - MaterialInformation(std::string vname, int id = 0, float eta = 0, float phi = 0, float length = 0, float radlen = 0, float intlen = 0) : vname_(vname), id_(id), eta_(eta), phi_(phi), length_(length), radlen_(radlen), intlen_(intlen) {} - MaterialInformation() : vname_(""), id_(0), eta_(0), phi_(0), length_(0), radlen_(0), intlen_(0) {} + MaterialInformation( + std::string vname, int id = 0, float eta = 0, float phi = 0, float length = 0, float radlen = 0, float intlen = 0) + : vname_(vname), id_(id), eta_(eta), phi_(phi), length_(length), radlen_(radlen), intlen_(intlen) {} + MaterialInformation() : vname_(""), id_(0), eta_(0), phi_(0), length_(0), radlen_(0), intlen_(0) {} //Names static const char *name() { return "MaterialInformation"; } diff --git a/SimDataFormats/CaloHit/src/MaterialInformation.cc b/SimDataFormats/CaloHit/src/MaterialInformation.cc index bd27f074cd85a..0ba0979e73911 100644 --- a/SimDataFormats/CaloHit/src/MaterialInformation.cc +++ b/SimDataFormats/CaloHit/src/MaterialInformation.cc @@ -3,7 +3,9 @@ #include <iostream> std::ostream& operator<<(std::ostream& o, const MaterialInformation& info) { - o << info.vname() << " ID " << info.id() << " Eta:Phi " << info.trackEta() << ":" << info.trackPhi() << " Step Length " << std::setw(10) << info.stepLength() << " Radiation Length " << std::setw(10) << info.radiationLength() << " Interaction Length " << std::setw(10) << info.interactionLength(); + o << info.vname() << " ID " << info.id() << " Eta:Phi " << info.trackEta() << ":" << info.trackPhi() + << " Step Length " << std::setw(10) << info.stepLength() << " Radiation Length " << std::setw(10) + << info.radiationLength() << " Interaction Length " << std::setw(10) << info.interactionLength(); return o; } diff --git a/Validation/Geometry/src/MaterialBudgetVolume.cc b/Validation/Geometry/src/MaterialBudgetVolume.cc index a9300f8f7a190..640906e4f72f2 100644 --- a/Validation/Geometry/src/MaterialBudgetVolume.cc +++ b/Validation/Geometry/src/MaterialBudgetVolume.cc @@ -34,16 +34,16 @@ //#define EDM_ML_DEBUG class MaterialBudgetVolume : public SimProducer, - public Observer<const BeginOfRun *>, - public Observer<const BeginOfEvent *>, - public Observer<const BeginOfTrack*>, - public Observer<const G4Step*>, - public Observer<const EndOfTrack*> { + public Observer<const BeginOfRun*>, + public Observer<const BeginOfEvent*>, + public Observer<const BeginOfTrack*>, + public Observer<const G4Step*>, + public Observer<const EndOfTrack*> { public: - MaterialBudgetVolume(const edm::ParameterSet &p); + MaterialBudgetVolume(const edm::ParameterSet& p); ~MaterialBudgetVolume() override {} - void produce(edm::Event &, const edm::EventSetup &) override; + void produce(edm::Event&, const edm::EventSetup&) override; struct MatInfo { double stepL, radL, intL; @@ -51,17 +51,17 @@ class MaterialBudgetVolume : public SimProducer, }; private: - MaterialBudgetVolume(const MaterialBudgetVolume &) = delete; // stop default - const MaterialBudgetVolume &operator=(const MaterialBudgetVolume &) = delete; + MaterialBudgetVolume(const MaterialBudgetVolume&) = delete; // stop default + const MaterialBudgetVolume& operator=(const MaterialBudgetVolume&) = delete; // observer classes - void update(const BeginOfRun *run) override; - void update(const BeginOfEvent *evt) override; + void update(const BeginOfRun* run) override; + void update(const BeginOfEvent* evt) override; void update(const BeginOfTrack*) override; void update(const EndOfTrack*) override; - void update(const G4Step *step) override; + void update(const G4Step* step) override; - void endOfEvent(edm::MaterialInformationContainer &matbg); + void endOfEvent(edm::MaterialInformationContainer& matbg); bool loadLV(); int findLV(const G4VTouchable*); @@ -83,10 +83,11 @@ MaterialBudgetVolume::MaterialBudgetVolume(const edm::ParameterSet& p) : init_(f iaddLevel_ = (m_p.getParameter<bool>("useDD4Hep")) ? 1 : 0; #ifdef EDM_ML_DEBUG - edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Studies Material budget for " << lvNames_.size() << " volumes with addLevel " << iaddLevel_; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Studies Material budget for " << lvNames_.size() + << " volumes with addLevel " << iaddLevel_; std::ostringstream st1; for (unsigned int k = 0; k < lvNames_.size(); ++k) - st1 << " [" << k << "] " << lvNames_[k] << " at " << lvLevel_[k]; + st1 << " [" << k << "] " << lvNames_[k] << " at " << lvLevel_[k]; edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: Volumes" << st1.str(); #endif @@ -106,7 +107,8 @@ void MaterialBudgetVolume::update(const BeginOfRun* run) { init_ = loadLV(); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Finds " << mapLV_.size() << " logical volumes with return flag " << init_; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Finds " << mapLV_.size() + << " logical volumes with return flag " << init_; #endif } @@ -129,7 +131,9 @@ void MaterialBudgetVolume::update(const BeginOfTrack* trk) { const G4ThreeVector& mom = aTrack->GetMomentum(); double theEnergy = aTrack->GetTotalEnergy(); int theID = static_cast<int>(aTrack->GetDefinition()->GetPDGEncoding()); - edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumme: Track " << aTrack->GetTrackID() << " Code " << theID << " Energy " << theEnergy / CLHEP::GeV << " GeV; Momentum " << mom / CLHEP::GeV << " GeV"; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumme: Track " << aTrack->GetTrackID() << " Code " << theID + << " Energy " << theEnergy / CLHEP::GeV << " GeV; Momentum " << mom / CLHEP::GeV + << " GeV"; #endif } @@ -146,7 +150,9 @@ void MaterialBudgetVolume::update(const G4Step* aStep) { lengths_[index].intL += (step / intl); } #ifdef EDM_ML_DEBUG - edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Step in " << touch->GetVolume(0)->GetLogicalVolume()->GetName() << " Index " << index << " Step " << step << " RadL " << step / radl << " IntL " << step / intl; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Step in " + << touch->GetVolume(0)->GetLogicalVolume()->GetName() << " Index " << index + << " Step " << step << " RadL " << step / radl << " IntL " << step / intl; #endif } @@ -169,7 +175,13 @@ void MaterialBudgetVolume::endOfEvent(edm::MaterialInformationContainer& matbg) unsigned int kount(0); #endif for (const auto& element : store_) { - MaterialInformation info(element.vname(), element.id(), element.trackEta(), element.trackPhi(), element.stepLength(), element.radiationLength(), element.interactionLength()); + MaterialInformation info(element.vname(), + element.id(), + element.trackEta(), + element.trackPhi(), + element.stepLength(), + element.radiationLength(), + element.interactionLength()); matbg.push_back(info); #ifdef EDM_ML_DEBUG edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume:: Info[" << kount << "] " << info; @@ -187,21 +199,22 @@ bool MaterialBudgetVolume::loadLV() { G4LogicalVolume* lv = nullptr; std::string name(lvNames_[i]); for (lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) { - std::string namx(dd4hep::dd::noNamespace((*lvcite)->GetName())); - if (namx == name) { - lv = (*lvcite); - break; - } + std::string namx(dd4hep::dd::noNamespace((*lvcite)->GetName())); + if (namx == name) { + lv = (*lvcite); + break; + } } if (lv != nullptr) - mapLV_[i] = std::make_pair(lv, lvLevel_[i]); + mapLV_[i] = std::make_pair(lv, lvLevel_[i]); } flag = true; #ifdef EDM_ML_DEBUG edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume::Finds " << mapLV_.size() << " logical volumes"; unsigned int k(0); for (const auto& lvs : mapLV_) { - edm::LogVerbatim("MaterialBudget") << "Entry[" << k << "] " << lvs.first << ": (" << (lvs.second).first << ", " << (lvs.second).second << ") : " << lvNames_[lvs.first]; + edm::LogVerbatim("MaterialBudget") << "Entry[" << k << "] " << lvs.first << ": (" << (lvs.second).first << ", " + << (lvs.second).second << ") : " << lvNames_[lvs.first]; ++k; } #endif @@ -209,7 +222,6 @@ bool MaterialBudgetVolume::loadLV() { return flag; } - int MaterialBudgetVolume::findLV(const G4VTouchable* touch) { int level(-1); int levels = ((touch->GetHistoryDepth()) + 1); @@ -217,8 +229,8 @@ int MaterialBudgetVolume::findLV(const G4VTouchable* touch) { if ((lvs.second).second <= levels) { int ii = levels - (lvs.second).second; if ((touch->GetVolume(ii)->GetLogicalVolume()) == (lvs.second).first) { - level = lvs.first; - break; + level = lvs.first; + break; } } } diff --git a/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc b/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc index 11b135867f680..419c70660b902 100644 --- a/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc +++ b/Validation/Geometry/src/MaterialBudgetVolumeAnalysis.cc @@ -45,22 +45,33 @@ class MaterialBudgetVolumeAnalysis : public edm::one::EDAnalyzer<edm::one::Share std::vector<TProfile2D*> meStepEtaPhi_, meRadLEtaPhi_, meIntLEtaPhi_; }; -MaterialBudgetVolumeAnalysis::MaterialBudgetVolumeAnalysis(const edm::ParameterSet& p) : names_(p.getParameter<std::vector<std::string> >("names")), tag_(p.getParameter<edm::InputTag>("inputTag")), binEta_(p.getParameter<int>("nBinEta")), binPhi_(p.getParameter<int>("nBinPhi")), etaLow_(p.getParameter<double>("etaLow")), etaHigh_(p.getParameter<double>("etaHigh")), phiLow_(-1._pi), phiHigh_(1._pi) { +MaterialBudgetVolumeAnalysis::MaterialBudgetVolumeAnalysis(const edm::ParameterSet& p) + : names_(p.getParameter<std::vector<std::string> >("names")), + tag_(p.getParameter<edm::InputTag>("inputTag")), + binEta_(p.getParameter<int>("nBinEta")), + binPhi_(p.getParameter<int>("nBinPhi")), + etaLow_(p.getParameter<double>("etaLow")), + etaHigh_(p.getParameter<double>("etaHigh")), + phiLow_(-1._pi), + phiHigh_(1._pi) { usesResource(TFileService::kSharedResource); tok_info_ = consumes<edm::MaterialInformationContainer>(tag_); - edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumeAnalysis: Eta plot: NX " << binEta_ << " Range " << -etaLow_ << ":" << etaHigh_ << " Phi plot: NX " << binPhi_ << " Range " << -1._pi << ":" << 1._pi << " for " << names_.size() << " detectors from " << tag_; + edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolumeAnalysis: Eta plot: NX " << binEta_ << " Range " + << -etaLow_ << ":" << etaHigh_ << " Phi plot: NX " << binPhi_ << " Range " + << -1._pi << ":" << 1._pi << " for " << names_.size() << " detectors from " + << tag_; std::ostringstream st1; for (unsigned int k = 0; k < names_.size(); ++k) - st1 << " [" << k << "] " << names_[k]; + st1 << " [" << k << "] " << names_[k]; edm::LogVerbatim("MaterialBudget") << "MaterialBudgetVolume: " << st1.str(); bookHisto(); - } void MaterialBudgetVolumeAnalysis::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; - std::vector<std::string> names = {"BEAM", "BEAM1", "BEAM2", "BEAM3", "BEAM4", "Tracker", "ECAL", "HCal", "MUON", "VCAL", "MGNT", "OQUA", "HGCal"}; + std::vector<std::string> names = { + "BEAM", "BEAM1", "BEAM2", "BEAM3", "BEAM4", "Tracker", "ECAL", "HCal", "MUON", "VCAL", "MGNT", "OQUA", "HGCal"}; desc.add<std::vector<std::string> >("names", names); desc.add<edm::InputTag>("inputTag", edm::InputTag("g4SimHits", "MaterialInformation")); desc.add<int>("nBinEta", 260); @@ -86,23 +97,25 @@ void MaterialBudgetVolumeAnalysis::analyze(const edm::Event& iEvent, const edm:: #endif if (std::find(names_.begin(), names_.end(), it.vname()) != names_.end()) { #ifdef EDM_ML_DEBUG - nused++; + nused++; #endif - unsigned int k = static_cast<unsigned int>(std::find(names_.begin(), names_.end(), it.vname()) - names_.begin()); - meStepEta_[k]->Fill(it.trackEta(), it.stepLength()); - meRadLEta_[k]->Fill(it.trackEta(), it.radiationLength()); - meIntLEta_[k]->Fill(it.trackEta(), it.interactionLength()); - meStepPhi_[k]->Fill(it.trackPhi(), it.stepLength()); - meRadLPhi_[k]->Fill(it.trackPhi(), it.radiationLength()); - meIntLPhi_[k]->Fill(it.trackPhi(), it.interactionLength()); - meStepEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.stepLength()); - meRadLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.radiationLength()); - meIntLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.interactionLength()); + unsigned int k = + static_cast<unsigned int>(std::find(names_.begin(), names_.end(), it.vname()) - names_.begin()); + meStepEta_[k]->Fill(it.trackEta(), it.stepLength()); + meRadLEta_[k]->Fill(it.trackEta(), it.radiationLength()); + meIntLEta_[k]->Fill(it.trackEta(), it.interactionLength()); + meStepPhi_[k]->Fill(it.trackPhi(), it.stepLength()); + meRadLPhi_[k]->Fill(it.trackPhi(), it.radiationLength()); + meIntLPhi_[k]->Fill(it.trackPhi(), it.interactionLength()); + meStepEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.stepLength()); + meRadLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.radiationLength()); + meIntLEtaPhi_[k]->Fill(it.trackEta(), it.trackPhi(), it.interactionLength()); } } } #ifdef EDM_ML_DEBUG - edm::LogVerbatim("MaterialBudget") << "MaterialInformation with " << nsize << ":" << ntot << " elements of which " << nused << " are used"; + edm::LogVerbatim("MaterialBudget") << "MaterialInformation with " << nsize << ":" << ntot << " elements of which " + << nused << " are used"; #endif } @@ -130,13 +143,16 @@ void MaterialBudgetVolumeAnalysis::bookHisto() { meIntLPhi_.emplace_back(fs->make<TProfile>(name, title, binPhi_, phiLow_, phiHigh_)); sprintf(name, "stepEtaPhi%s", names_[k].c_str()); sprintf(title, "MB(Step) vs #eta and #phi for %s", names_[k].c_str()); - meStepEtaPhi_.emplace_back(fs->make<TProfile2D>(name, title, binEta_/2, etaLow_, etaHigh_, binPhi_/2, phiLow_, phiHigh_)); + meStepEtaPhi_.emplace_back( + fs->make<TProfile2D>(name, title, binEta_ / 2, etaLow_, etaHigh_, binPhi_ / 2, phiLow_, phiHigh_)); sprintf(name, "radlEtaPhi%s", names_[k].c_str()); sprintf(title, "MB(X0) vs #eta and #phi for %s", names_[k].c_str()); - meRadLEtaPhi_.emplace_back(fs->make<TProfile2D>(name, title, binEta_/2, etaLow_, etaHigh_, binPhi_/2, phiLow_, phiHigh_)); + meRadLEtaPhi_.emplace_back( + fs->make<TProfile2D>(name, title, binEta_ / 2, etaLow_, etaHigh_, binPhi_ / 2, phiLow_, phiHigh_)); sprintf(name, "intlEtaPhi%s", names_[k].c_str()); sprintf(title, "MB(L0) vs #eta and #phi for %s", names_[k].c_str()); - meIntLEtaPhi_.emplace_back(fs->make<TProfile2D>(name, title, binEta_/2, etaLow_, etaHigh_, binPhi_/2, phiLow_, phiHigh_)); + meIntLEtaPhi_.emplace_back( + fs->make<TProfile2D>(name, title, binEta_ / 2, etaLow_, etaHigh_, binPhi_ / 2, phiLow_, phiHigh_)); } } From f4bb6a86481fc55e0e8d7a162347d348ea1f121d Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 10 May 2021 10:09:15 -0500 Subject: [PATCH 270/309] Turn-off GEM-CSC integrated local trigger --- DQM/L1TMonitor/python/L1TStage2Emulator_cff.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index e656189341e70..ba01e3b4ed41a 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -59,7 +59,9 @@ from L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi import * valCscStage2Digis = cscTriggerPrimitiveDigis.clone( CSCComparatorDigiProducer = "muonCSCDigis:MuonCSCComparatorDigi", - CSCWireDigiProducer = "muonCSCDigis:MuonCSCWireDigi" + CSCWireDigiProducer = "muonCSCDigis:MuonCSCWireDigi", + GEMPadDigiClusterProducer = "", + commonParam = dict(runME11ILT = False) ) from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM From d718b8330518ac3465cccad5c06f215ed68ba0dd Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Mon, 10 May 2021 18:35:27 +0200 Subject: [PATCH 271/309] Static Check --- .../TSToSCAssociatorByEnergyScoreImpl.cc | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc index d6be35a5c0991..9c81d132410df 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc @@ -76,21 +76,20 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( for (size_t sc = 0; sc < tssInSimCluster.size(); ++sc) { LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " Energy: " << tssInSimCluster[sc].energy << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " # of clusters : " << nLayerClusters << std::endl; + << "\tSimClusterIdx:\t" << tssInSimCluster[sc].simClusterId << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tEnergy:\t" << tssInSimCluster[sc].energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\t# of clusters:\t" << layerClusters.size() << std::endl; double tot_energy = 0.; for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" + << "\tHits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tTot Sum haf: " << tot_energy << std::endl; for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; + << "\ttsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; } } @@ -101,7 +100,7 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( << " we have found the following connections with SimClusters:" << std::endl; for (auto const& sc : detId.second) { LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " SimCluster Id: " << sc.clusterId << " with fraction: " << sc.fraction + << "\tSimCluster Id: " << sc.clusterId << " with fraction: " << sc.fraction << " and energy: " << sc.fraction * hitMap_->at(detId.first)->energy() << std::endl; } } @@ -283,19 +282,18 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "For SimCluster Idx: " << sc << " we have: " << std::endl; LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " SimClusterIdx: " << tssInSimCluster[sc].simClusterId << std::endl; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " Energy: " << tssInSimCluster[sc].energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tEnergy:\t" << tssInSimCluster[sc].energy << std::endl; double tot_energy = 0.; for (auto const& haf : tssInSimCluster[sc].hits_and_fractions) { LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " Hits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" + << "\tHits/fraction/energy: " << (uint32_t)haf.first << "/" << haf.second << "/" << haf.second * hitMap_->at(haf.first)->energy() << std::endl; tot_energy += haf.second * hitMap_->at(haf.first)->energy(); } - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << " Tot Sum haf: " << tot_energy << std::endl; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "\tTot Sum haf: " << tot_energy << std::endl; for (auto const& ts : tssInSimCluster[sc].tracksterIdToEnergyAndScore) { LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << " tsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; + << "\ttsIdx/energy/score: " << ts.first << "/" << ts.second.first << "/" << ts.second.second << std::endl; } } @@ -326,8 +324,8 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( if (tracksters[tsId].raw_energy() == 0. && !scsInTrackster[tsId].empty()) { for (auto& scPair : scsInTrackster[tsId]) { scPair.second = 1.; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "TracksterId : \t " << tsId << "\t SC id : \t" - << scPair.first << "\t score \t " << scPair.second << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "TracksterId:\t " << tsId << "\tSC id:\t" << scPair.first + << "\tscore\t " << scPair.second << "\n"; } continue; } @@ -464,7 +462,7 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( (tsFraction - scFraction) * (tsFraction - scFraction) * hitEnergyWeight * invSCEnergyWeight; #ifdef EDM_ML_DEBUG LogDebug("TSToSCAssociatorByEnergyScoreImpl") - << "SCDetId:\t" << (uint32_t)sc_hitDetId << "\tTracksterId:\t" << tracksterId << "\t" + << "SCDetId:\t" << (uint32_t)sc_hitDetId << "\tTracksterId:\t" << tsId << "\t" << "tsFraction, scFraction:\t" << tsFraction << ", " << scFraction << "\t" << "hitEnergyWeight:\t" << hitEnergyWeight << "\t" << "current score:\t" << tsPair.second.second << "\t" @@ -500,8 +498,8 @@ hgcal::RecoToSimCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associat const auto& scsInTrackster = std::get<0>(links); for (size_t tsId = 0; tsId < scsInTrackster.size(); ++tsId) { for (auto& scPair : scsInTrackster[tsId]) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Trackster Id: \t" << tsId << "\t SimCluster id: \t" - << scPair.first << "\t score \t" << scPair.second << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Trackster Id:\t" << tsId << "\tSimCluster id:\t" + << scPair.first << "\tscore:\t" << scPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref<ticl::TracksterCollection>(tCH, tsId), // Ref to TS std::make_pair(edm::Ref<SimClusterCollection>(sCCH, scPair.first), From c7ccf63f48eead184e1a8a89595af723a69fe350 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella <leonardo.cristella@cern.ch> Date: Mon, 10 May 2021 18:55:09 +0200 Subject: [PATCH 272/309] code-reformat --- .../TSToSCAssociatorByEnergyScoreImpl.cc | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc index 9c81d132410df..f93a9f3c1a99d 100644 --- a/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc +++ b/SimCalorimetry/HGCalAssociatorProducers/plugins/TSToSCAssociatorByEnergyScoreImpl.cc @@ -252,19 +252,13 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( } } - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << "TracksterID:\t" - << std::setw(12) << "layerCluster\t" - << std::setw(10) << "lc energy\t" - << std::setw(5) << "nhits\t" - << std::setw(12) << "noise hits\t" - << std::setw(22) << "maxSCId_byNumberOfHits\t" - << std::setw(8) << "nhitsSC\t" - << std::setw(13) << "maxSCId_byEnergy\t" - << std::setw(20) << "maxEnergySharedLCandSC\t" - << std::setw(22) << "totalSCEnergyOnLayer\t" - << std::setw(22) << "energyFractionOfLCinSC\t" - << std::setw(25) << "energyFractionOfSCinLC\t" - << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << std::setw(12) << "TracksterID:\t" << std::setw(12) << "layerCluster\t" << std::setw(10) << "lc energy\t" + << std::setw(5) << "nhits\t" << std::setw(12) << "noise hits\t" << std::setw(22) << "maxSCId_byNumberOfHits\t" + << std::setw(8) << "nhitsSC\t" << std::setw(13) << "maxSCId_byEnergy\t" << std::setw(20) + << "maxEnergySharedLCandSC\t" << std::setw(22) << "totalSCEnergyOnLayer\t" << std::setw(22) + << "energyFractionOfLCinSC\t" << std::setw(25) << "energyFractionOfSCinLC\t" + << "\n"; LogDebug("TSToSCAssociatorByEnergyScoreImpl") << std::setw(12) << tsId << "\t" << std::setw(12) << lcId << "\t" << std::setw(10) << tracksters[tsId].raw_energy() << "\t" << std::setw(5) << numberOfHitsInLC << "\t" << std::setw(12) @@ -324,8 +318,8 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( if (tracksters[tsId].raw_energy() == 0. && !scsInTrackster[tsId].empty()) { for (auto& scPair : scsInTrackster[tsId]) { scPair.second = 1.; - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "TracksterId:\t " << tsId << "\tSC id:\t" << scPair.first - << "\tscore\t " << scPair.second << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "TracksterId:\t " << tsId << "\tSC id:\t" << scPair.first << "\tscore\t " << scPair.second << "\n"; } continue; } @@ -385,9 +379,8 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( #ifdef EDM_ML_DEBUG if (scsInTrackster[tsId].empty()) - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "trackster Id: \t" << tsId << "\tSC id:\t-1 " - << "\t score \t-1" - << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "trackster Id:\t" << tsId << "\tSC id:\t-1" + << "\tscore\t-1\n"; #endif } // End of loop over Tracksters @@ -473,9 +466,8 @@ hgcal::association TSToSCAssociatorByEnergyScoreImpl::makeConnections( } // End of loop over hits of SimCluster on a Layer #ifdef EDM_ML_DEBUG if (tssInSimCluster[scId].tracksterIdToEnergyAndScore.empty()) - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SC Id: \t" << scId << "\tTS id:\t-1 " - << "\t score \t-1" - << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "SC Id:\t" << scId << "\tTS id:\t-1 " + << "\tscore\t-1\n"; for (const auto& tsPair : tssInSimCluster[scId].tracksterIdToEnergyAndScore) { LogDebug("TSToSCAssociatorByEnergyScoreImpl") @@ -498,8 +490,8 @@ hgcal::RecoToSimCollectionTracksters TSToSCAssociatorByEnergyScoreImpl::associat const auto& scsInTrackster = std::get<0>(links); for (size_t tsId = 0; tsId < scsInTrackster.size(); ++tsId) { for (auto& scPair : scsInTrackster[tsId]) { - LogDebug("TSToSCAssociatorByEnergyScoreImpl") << "Trackster Id:\t" << tsId << "\tSimCluster id:\t" - << scPair.first << "\tscore:\t" << scPair.second << "\n"; + LogDebug("TSToSCAssociatorByEnergyScoreImpl") + << "Trackster Id:\t" << tsId << "\tSimCluster id:\t" << scPair.first << "\tscore:\t" << scPair.second << "\n"; // Fill AssociationMap returnValue.insert(edm::Ref<ticl::TracksterCollection>(tCH, tsId), // Ref to TS std::make_pair(edm::Ref<SimClusterCollection>(sCCH, scPair.first), From a63dcf65bb0cafbc946cbbec2a156c89de27493b Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Mon, 10 May 2021 15:15:41 +0200 Subject: [PATCH 273/309] move from orbitNumber() to luminosityBlock() in the simulation case --- .../src/SiStripMonitorCluster.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc index 3b20214367712..52aa356da8ac4 100644 --- a/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc +++ b/DQM/SiStripMonitorCluster/src/SiStripMonitorCluster.cc @@ -1,4 +1,3 @@ - // -*- C++ -*- // Package: SiStripMonitorCluster // Class: SiStripMonitorCluster @@ -652,8 +651,15 @@ void SiStripMonitorCluster::analyze(const edm::Event& iEvent, const edm::EventSe runNb = iEvent.id().run(); eventNb++; - trendVar = trendVs10Ls_ ? iEvent.orbitNumber() / (10 * 262144.0) - : iEvent.orbitNumber() / (1 * 262144.0); // 10 lumisection : lumisection + + if (!iEvent.isRealData()) { + trendVar = trendVs10Ls_ ? iEvent.eventAuxiliary().luminosityBlock() / 10.f + : iEvent.eventAuxiliary().luminosityBlock(); // 10 lumisection : lumisection + + } else { + trendVar = trendVs10Ls_ ? iEvent.orbitNumber() / (10 * 262144.0) + : iEvent.orbitNumber() / (1 * 262144.0); // 10 lumisection : lumisection + } int NPixClusters = 0, NStripClusters = 0, MultiplicityRegion = 0; bool isPixValid = false; From 2e8b113ffd6b7a38f4bbd6974d8e753dc29d9658 Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Mon, 10 May 2021 22:32:42 +0200 Subject: [PATCH 274/309] update documentation after commit 69c8898814ce3be38134d8a3a5bcea09951a537c --- Geometry/TrackerGeometryBuilder/README.md | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Geometry/TrackerGeometryBuilder/README.md b/Geometry/TrackerGeometryBuilder/README.md index 46e3fe3a0764a..49b3c35f13a23 100644 --- a/Geometry/TrackerGeometryBuilder/README.md +++ b/Geometry/TrackerGeometryBuilder/README.md @@ -14,20 +14,20 @@ helper methods are available (and other can be added if needed): `GeomDetEnumera `GeomDetEnumerators::isTrackerStrip(subdet)` and equivalent methods in the `GeomDetType` class. The present map between enumerators and the returned values of the above methods are summarized in the table below: -| `GeometricDet::GDEnumType` | `GeomDetEnumerators::SubDetector` | `GeomDetEnumerators::subDetGeom[id]` | `isTrackerPixel` | `isTrackerStrip` | `isBarrel` | `isEndcap` | -|-------|------|--------|------|------|-------|-------| -| `PixelBarrel` | `PixelBarrel` | `PixelBarrel` | `true` | `false` | `true` | `false` | -| `PixelEndCap` | `PixelEndcap` | `PixelEndcap` | `true` | `false` | `false` | `true` | -| `TIB` | `TIB` | `TIB` | `false` | `true` | `true` | `false` | -| `TID` | `TID` | `TID` | `false` | `true` | `false` | `true` | -| `TOB` | `TOB` | `TOB` | `false` | `true` | `true` | `false` | -| `TEC` | `TEC` | `TEC` | `false` | `true` | `false` | `true` | -| `PixelPhase1Barrel` | `P1PXB` | `PixelBarrel` | `true` | `false` | `true` | `false` | -| `PixelPhase1EndCap` | `P1PXEC` | `PixelEndcap` | `true` | `false` | `false` | `true` | -| `PixelPhase2Barrel` | `P2PXB` | `PixelBarrel` | `true` | `false` | `true` | `false` | -| `PixelPhase2EndCap` | `P2PXEC` | `PixelEndcap` | `true` | `false` | `false` | `true` | -| `OTPhase2Barrel` | `P2OTB` | `TOB` | `true` | `false` | `true` | `false` | -| `OTPhase2EndCap` | `P2OTEC` | `TID` | `true` | `false` | `false` | `true` | +| `GeometricDet::GDEnumType` | `GeomDetEnumerators::SubDetector` | `GeomDetEnumerators::subDetGeom[id]` | `isTrackerPixel` | `isTrackerStrip` | `isInnerTracker` | `isOuterTracker` | `isBarrel` | `isEndcap` | +|-------|------|--------|------|------|-------|-------|-------|-------| +| `PixelBarrel` | `PixelBarrel` | `PixelBarrel` | `true` | `false` | `true` | `false` | `true` | `false` | +| `PixelEndCap` | `PixelEndcap` | `PixelEndcap` | `true` | `false` | `true` | `false` | `false` | `true` | +| `TIB` | `TIB` | `TIB` | `false` | `true` | `false` | `true` | `true` | `false` | +| `TID` | `TID` | `TID` | `false` | `true` | `false` | `true` | `false` | `true` | +| `TOB` | `TOB` | `TOB` | `false` | `true` | `false` | `true` |`true` | `false` | +| `TEC` | `TEC` | `TEC` | `false` | `true` | `false` | `true` |`false` | `true` | +| `PixelPhase1Barrel` | `P1PXB` | `PixelBarrel` | `true` | `false` | `true` | `false` | `true` | `false` | +| `PixelPhase1EndCap` | `P1PXEC` | `PixelEndcap` | `true` | `false` | `true` | `false` | `false` | `true` | +| `PixelPhase2Barrel` | `P2PXB` | `PixelBarrel` | `true` | `false` |`true` | `false` | `true` | `false` | +| `PixelPhase2EndCap` | `P2PXEC` | `PixelEndcap` | `true` | `false` | `true` | `false` | `false` | `true` | +| `OTPhase2Barrel` | `P2OTB` | `TOB` | `true` | `false` | `false` | `true` |`true` | `false` | +| `OTPhase2EndCap` | `P2OTEC` | `TID` | `true` | `false` | `false` | `true` | `false` | `true` | ### `TrackerGeometry` useful methods From cf7e6b13b8936d6e9274ad749bdee6417a6c9240 Mon Sep 17 00:00:00 2001 From: Sven Dildick <sven.dildick@cern.ch> Date: Mon, 10 May 2021 15:35:35 -0500 Subject: [PATCH 275/309] Improve CSC TP quality control --- DataFormats/CSCDigi/interface/CSCConstants.h | 20 ++ .../interface/LCTQualityControl.h | 40 ++- .../src/CSCAnodeLCTProcessor.cc | 4 +- .../src/LCTQualityControl.cc | 242 ++++++++++++------ 4 files changed, 207 insertions(+), 99 deletions(-) diff --git a/DataFormats/CSCDigi/interface/CSCConstants.h b/DataFormats/CSCDigi/interface/CSCConstants.h index ae4711879a6ee..e91e3bec88364 100644 --- a/DataFormats/CSCDigi/interface/CSCConstants.h +++ b/DataFormats/CSCDigi/interface/CSCConstants.h @@ -22,6 +22,15 @@ class CSCConstants { NUM_CFEBS_ME11_UNGANGED = NUM_CFEBS_ME1A_UNGANGED + NUM_CFEBS_ME1B, // 7 // Run-2: Maximum number of cathode front-end boards MAX_CFEBS_RUN2 = NUM_CFEBS_ME11_UNGANGED, // 7 + // CFEBS for the rest of the system + NUM_CFEBS_ME12 = 5, + NUM_CFEBS_ME13 = 4, + NUM_CFEBS_ME21 = 5, + NUM_CFEBS_ME22 = 5, + NUM_CFEBS_ME31 = 5, + NUM_CFEBS_ME32 = 5, + NUM_CFEBS_ME41 = 5, + NUM_CFEBS_ME42 = 5 }; enum FPGA_Latency { CLCT_EMUL_TIME_OFFSET = 3, ALCT_EMUL_TIME_OFFSET = 6 }; @@ -70,10 +79,21 @@ class CSCConstants { NUM_HALF_STRIPS_ME1A_GANGED = NUM_CFEBS_ME1A_GANGED * NUM_HALF_STRIPS_PER_CFEB, // 32 NUM_HALF_STRIPS_ME1A_UNGANGED = NUM_CFEBS_ME1A_UNGANGED * NUM_HALF_STRIPS_PER_CFEB, // 96 NUM_HALF_STRIPS_ME1B = NUM_CFEBS_ME1B * NUM_HALF_STRIPS_PER_CFEB, // 128 + NUM_HALF_STRIPS_ME11_GANGED = NUM_CFEBS_ME11_GANGED * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME11_UNGANGED = NUM_CFEBS_ME11_UNGANGED * NUM_HALF_STRIPS_PER_CFEB, // 224 // max halfstrip number in ME1/1 chambers MAX_HALF_STRIP_ME1A_GANGED = NUM_HALF_STRIPS_ME1A_GANGED - 1, // 31 MAX_HALF_STRIP_ME1A_UNGANGED = NUM_HALF_STRIPS_ME1A_UNGANGED - 1, // 95 MAX_HALF_STRIP_ME1B = NUM_HALF_STRIPS_ME1B - 1, // 127 + // half-strips for the rest of the system + NUM_HALF_STRIPS_ME12 = NUM_CFEBS_ME12 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME13 = NUM_CFEBS_ME13 * NUM_HALF_STRIPS_PER_CFEB, // 128 + NUM_HALF_STRIPS_ME21 = NUM_CFEBS_ME21 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME22 = NUM_CFEBS_ME22 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME31 = NUM_CFEBS_ME31 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME32 = NUM_CFEBS_ME32 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME41 = NUM_CFEBS_ME41 * NUM_HALF_STRIPS_PER_CFEB, // 160 + NUM_HALF_STRIPS_ME42 = NUM_CFEBS_ME42 * NUM_HALF_STRIPS_PER_CFEB, // 160 }; // CSCs have 6 layers. The key (reference) layer is the third layer diff --git a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h index 91f9df3ac9d1b..ac81adcbd8c1e 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/LCTQualityControl.h @@ -3,7 +3,9 @@ /** \class * - * This class checks if ALCT, CLCT and LCT products are valid + * This class checks if ALCT, CLCT and LCT products are valid. + * It inherits from CSCBaseboard. Neither are physical boards at CMS + * But they are convenient classes in the trigger code. * * Author: Sven Dildick * @@ -56,28 +58,38 @@ class LCTQualityControl : public CSCBaseboard { void checkMultiplicityBX(const std::vector<T>& lcts, unsigned nLCT) const; // for Phase-1 patterns - int getSlopePhase1(int pattern) const; - - // CSC max strip & max wire - unsigned get_csc_max_wire(int station, int ring) const; - unsigned get_csc_max_halfstrip(int station, int ring) const; - unsigned get_csc_max_quartstrip(int station, int ring) const; - unsigned get_csc_max_eighthstrip(int station, int ring) const; + int getSlopePhase1(unsigned pattern) const; + + /* + CSC max strip & max wire + Need to pass station and ring, because we want to reuse the LCTQualityControl in the + MPC where the station and ring are considered arguments, not data members. + */ + unsigned get_csc_max_wiregroup(unsigned station, unsigned ring) const; + unsigned get_csc_max_halfstrip(unsigned station, unsigned ring) const; + unsigned get_csc_max_quartstrip(unsigned station, unsigned ring) const; + unsigned get_csc_max_eighthstrip(unsigned station, unsigned ring) const; // slope values std::pair<int, int> get_csc_clct_min_max_slope() const; // CLCT min, max CFEB numbers - std::pair<unsigned, unsigned> get_csc_min_max_cfeb(int station, int ring) const; + std::pair<unsigned, unsigned> get_csc_min_max_cfeb() const; // CSC min, max pattern - std::pair<unsigned, unsigned> get_csc_min_max_pattern(bool isRun3) const; + std::pair<unsigned, unsigned> get_csc_min_max_pattern() const; + std::pair<unsigned, unsigned> get_csc_min_max_pattern_run3() const; std::pair<unsigned, unsigned> get_csc_lct_min_max_pattern() const; - // CSC max quality - unsigned get_csc_alct_max_quality(int station, int ring, bool runGEMCSC) const; - unsigned get_csc_clct_max_quality() const; - unsigned get_csc_lct_max_quality() const; + /* + CSC min, max quality + Need to pass station and ring for the LCT implementation, because we want to + reuse the LCTQualityControl in the MPC where the station and ring are considered + arguments, not data members. + */ + std::pair<unsigned, unsigned> get_csc_alct_min_max_quality() const; + std::pair<unsigned, unsigned> get_csc_clct_min_max_quality() const; + std::pair<unsigned, unsigned> get_csc_lct_min_max_quality(unsigned station, unsigned ring) const; private: // min number of layers for a CLCT diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc index 0bb5b22cc388c..0412b5fee0ecb 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCAnodeLCTProcessor.cc @@ -222,7 +222,7 @@ std::vector<CSCALCTDigi> CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* } } - if (numWireGroups <= 0 or (unsigned) numWireGroups > qualityControl_->get_csc_max_wire(theStation, theRing)) { + if (numWireGroups <= 0 or (unsigned) numWireGroups > qualityControl_->get_csc_max_wiregroup(theStation, theRing)) { edm::LogError("CSCAnodeLCTProcessor|SetupError") << "+++ " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << "):" @@ -284,7 +284,7 @@ void CSCAnodeLCTProcessor::run(const std::vector<int> wire[CSCConstants::NUM_LAY if (!chamber_empty) { for (int i_wire = 0; i_wire < numWireGroups; i_wire++) { // extra check to make sure only valid wires are processed - const unsigned max_wire = qualityControl_->get_csc_max_wire(theStation, theRing); + const unsigned max_wire = qualityControl_->get_csc_max_wiregroup(theStation, theRing); if (unsigned(i_wire) >= max_wire) continue; diff --git a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc index a11025d0dfe13..bd1d62da9e1e8 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/LCTQualityControl.cc @@ -34,8 +34,8 @@ void LCTQualityControl::reportErrors(const T& lct, const unsigned errors) const // Check if the ALCT is valid void LCTQualityControl::checkValid(const CSCALCTDigi& alct, unsigned max_stubs) const { - const unsigned max_wire = get_csc_max_wire(theStation, theRing); - const unsigned max_quality = get_csc_alct_max_quality(theStation, theRing, runME21ILT_); + const unsigned max_wiregroup = get_csc_max_wiregroup(theStation, theRing); + const auto& [min_quality, max_quality] = get_csc_alct_min_max_quality(); unsigned errors = 0; @@ -47,10 +47,10 @@ void LCTQualityControl::checkValid(const CSCALCTDigi& alct, unsigned max_stubs) // ALCT quality must be valid // number of layers - 3 - checkRange(alct.getQuality(), 1, max_quality, "CSCALCTDigi with invalid quality: ", errors); + checkRange(alct.getQuality(), min_quality, max_quality, "CSCALCTDigi with invalid quality: ", errors); // ALCT key wire-group must be within bounds - checkRange(alct.getKeyWG(), 0, max_wire - 1, "CSCALCTDigi with invalid wire-group: ", errors); + checkRange(alct.getKeyWG(), 0, max_wiregroup - 1, "CSCALCTDigi with invalid wire-group: ", errors); // ALCT with out-of-time BX checkRange(alct.getBX(), 0, CSCConstants::MAX_ALCT_TBINS - 1, "CSCALCTDigi with invalid BX: ", errors); @@ -64,11 +64,12 @@ void LCTQualityControl::checkValid(const CSCALCTDigi& alct, unsigned max_stubs) // Check if the CLCT is valid void LCTQualityControl::checkValid(const CSCCLCTDigi& clct, unsigned max_stubs) const { const unsigned max_strip = get_csc_max_halfstrip(theStation, theRing); - const auto& [min_pattern_run2, max_pattern_run2] = get_csc_min_max_pattern(false); - const auto& [min_pattern_run3, max_pattern_run3] = get_csc_min_max_pattern(true); + const auto& [min_pattern_run2, max_pattern_run2] = get_csc_min_max_pattern(); + const auto& [min_pattern_run3, max_pattern_run3] = get_csc_min_max_pattern_run3(); const auto& [min_slope, max_slope] = get_csc_clct_min_max_slope(); - const auto& [min_cfeb, max_cfeb] = get_csc_min_max_cfeb(theStation, theRing); - const unsigned max_quality = get_csc_clct_max_quality(); + const auto& [min_cfeb, max_cfeb] = get_csc_min_max_cfeb(); + const auto& [min_quality, max_quality] = get_csc_clct_min_max_quality(); + unsigned errors = 0; // CLCT must be valid @@ -81,7 +82,7 @@ void LCTQualityControl::checkValid(const CSCCLCTDigi& clct, unsigned max_stubs) // CLCTs require at least 4 layers hit // Run-3: ME1/1 CLCTs require only 3 layers // Run-4: ME2/1 CLCTs require only 3 layers - checkRange(clct.getQuality(), nplanes_clct_hit_pattern, max_quality, "CSCCLCTDigi with invalid quality: ", errors); + checkRange(clct.getQuality(), min_quality, max_quality, "CSCCLCTDigi with invalid quality: ", errors); // CLCT half-strip must be within bounds checkRange( @@ -129,13 +130,14 @@ void LCTQualityControl::checkValid(const CSCCLCTDigi& clct, unsigned max_stubs) void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct) const { checkValid(lct, theStation, theRing); } -void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsigned station, const unsigned ring) const { +void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, unsigned station, unsigned ring) const { const unsigned max_strip = get_csc_max_halfstrip(station, ring); const unsigned max_quartstrip = get_csc_max_quartstrip(station, ring); const unsigned max_eighthstrip = get_csc_max_eighthstrip(station, ring); - const unsigned max_wire = get_csc_max_wire(station, ring); - const auto& [min_pattern, max_pattern] = get_csc_lct_min_max_pattern(); - const unsigned max_quality = get_csc_lct_max_quality(); + const unsigned max_wiregroup = get_csc_max_wiregroup(station, ring); + const auto& [min_pattern_run2, max_pattern_run2] = get_csc_min_max_pattern(); + const auto& [min_pattern_run3, max_pattern_run3] = get_csc_min_max_pattern_run3(); + const auto& [min_quality, max_quality] = get_csc_lct_min_max_quality(station, ring); unsigned errors = 0; @@ -146,7 +148,7 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsign checkRange(lct.getTrknmb(), 1, 2, "CSCCorrelatedLCTDigi with invalid track number: ", errors); // LCT quality must be valid - checkRange(lct.getQuality(), 0, max_quality, "CSCCorrelatedLCTDigi with invalid quality: ", errors); + checkRange(lct.getQuality(), min_quality, max_quality, "CSCCorrelatedLCTDigi with invalid quality: ", errors); // LCT key half-strip must be within bounds checkRange(lct.getStrip(), 0, max_strip - 1, "CSCCorrelatedLCTDigi with invalid key half-strip: ", errors); @@ -158,7 +160,7 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsign checkRange(lct.getStrip(8), 0, max_eighthstrip - 1, "CSCCorrelatedLCTDigi with invalid key eighth-strip: ", errors); // LCT key wire-group must be within bounds - checkRange(lct.getKeyWG(), 0, max_wire - 1, "CSCCorrelatedLCTDigi with invalid wire-group: ", errors); + checkRange(lct.getKeyWG(), 0, max_wiregroup - 1, "CSCCorrelatedLCTDigi with invalid wire-group: ", errors); // LCT with out-of-time BX checkRange(lct.getBX(), 0, CSCConstants::MAX_LCT_TBINS - 1, "CSCCorrelatedLCTDigi with invalid BX: ", errors); @@ -177,7 +179,17 @@ void LCTQualityControl::checkValid(const CSCCorrelatedLCTDigi& lct, const unsign errors); // LCT with an invalid pattern ID - checkRange(lct.getPattern(), min_pattern, max_pattern, "CSCCorrelatedLCTDigi with invalid pattern ID: ", errors); + checkRange(lct.getPattern(), + min_pattern_run2, + max_pattern_run2, + "CSCCorrelatedLCTDigi with invalid Run-2 pattern ID: ", + errors); + + checkRange(lct.getRun3Pattern(), + min_pattern_run3, + max_pattern_run3, + "CSCCorrelatedLCTDigi with invalid Run-3 pattern ID: ", + errors); // simulated LCT type must be valid if (lct.getType() == CSCCorrelatedLCTDigi::CLCTALCT or lct.getType() == CSCCorrelatedLCTDigi::CLCTONLY or @@ -221,7 +233,7 @@ void LCTQualityControl::checkMultiplicityBX(const std::vector<CSCCorrelatedLCTDi checkMultiplicityBX(collection, CSCConstants::MAX_LCTS_PER_CSC); } -int LCTQualityControl::getSlopePhase1(int pattern) const { +int LCTQualityControl::getSlopePhase1(unsigned pattern) const { // PID 2 is actually a left-bending pattern with a negative slope // PID 3 is actually a right-bending pattern with a positive slope int slopeList[CSCConstants::NUM_CLCT_PATTERNS] = {0, 0, -8, 8, -6, 6, -4, 4, -2, 2, 0}; @@ -234,7 +246,7 @@ std::pair<int, int> LCTQualityControl::get_csc_clct_min_max_slope() const { // 5-bit number (includes the L/R bending) if (runCCLUT_) { min_slope = 0; - max_slope = 31; + max_slope = 15; } // Run-1 or Run-2 case // Run-3 case without CCLUT @@ -260,84 +272,121 @@ std::pair<int, int> LCTQualityControl::get_csc_clct_min_max_slope() const { // | ME2/2, ME3/2, ME4/2 | 160 | 64 | // +----------------------------+------------+------------+ -unsigned LCTQualityControl::get_csc_max_wire(int station, int ring) const { - unsigned max_wire = 0; // wiregroup +unsigned LCTQualityControl::get_csc_max_wiregroup(unsigned station, unsigned ring) const { + unsigned max_wiregroup = 0; if (station == 1 && ring == 4) { // ME1/1a - max_wire = 48; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME11; } else if (station == 1 && ring == 1) { // ME1/1b - max_wire = 48; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME11; } else if (station == 1 && ring == 2) { // ME1/2 - max_wire = 64; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME12; } else if (station == 1 && ring == 3) { // ME1/3 - max_wire = 32; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME13; } else if (station == 2 && ring == 1) { // ME2/1 - max_wire = 112; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME21; } else if (station >= 3 && ring == 1) { // ME3/1, ME4/1 - max_wire = 96; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME31; } else if (station >= 2 && ring == 2) { // ME2/2, ME3/2, ME4/2 - max_wire = 64; + max_wiregroup = CSCConstants::NUM_WIREGROUPS_ME22; } - return max_wire; + return max_wiregroup; } -unsigned LCTQualityControl::get_csc_max_halfstrip(int station, int ring) const { - int max_strip = 0; // halfstrip - if (station == 1 && ring == 4) { // ME1/1a - max_strip = 96; - } else if (station == 1 && ring == 1) { // ME1/1b - // In the CSC local trigger - // ME1/a is taken together with ME1/b - max_strip = 128 + 96; - } else if (station == 1 && ring == 2) { // ME1/2 - max_strip = 160; - } else if (station == 1 && ring == 3) { // ME1/3 - max_strip = 128; - } else if (station == 2 && ring == 1) { // ME2/1 - max_strip = 160; - } else if (station >= 3 && ring == 1) { // ME3/1, ME4/1 - max_strip = 160; - } else if (station >= 2 && ring == 2) { // ME2/2, ME3/2, ME4/2 - max_strip = 160; +unsigned LCTQualityControl::get_csc_max_halfstrip(unsigned station, unsigned ring) const { + unsigned max_half_strip = 0; + // ME1/1a + if (station == 1 && ring == 4 and gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME1A_GANGED; + } else if (station == 1 && ring == 4 and !gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME1A_UNGANGED; + } + // ME1/1b + // In the CSC local trigger + // ME1/a is taken together with ME1/b + else if (station == 1 && ring == 1 and gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME11_GANGED; + } else if (station == 1 && ring == 1 and !gangedME1a_) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME11_UNGANGED; + } + // ME1/2 + else if (station == 1 && ring == 2) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME12; + } + // ME1/3 + else if (station == 1 && ring == 3) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME13; + } + // ME2/1 + else if (station == 2 && ring == 1) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME21; } - return max_strip; + // ME3/1, ME4/1 + else if (station >= 3 && ring == 1) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME31; + } + // ME2/2, ME3/2, ME4/2 + else if (station >= 2 && ring == 2) { + max_half_strip = CSCConstants::NUM_HALF_STRIPS_ME22; + } + return max_half_strip; } -unsigned LCTQualityControl::get_csc_max_quartstrip(int station, int ring) const { +unsigned LCTQualityControl::get_csc_max_quartstrip(unsigned station, unsigned ring) const { return get_csc_max_halfstrip(station, ring) * 2; } -unsigned LCTQualityControl::get_csc_max_eighthstrip(int station, int ring) const { +unsigned LCTQualityControl::get_csc_max_eighthstrip(unsigned station, unsigned ring) const { return get_csc_max_halfstrip(station, ring) * 4; } -std::pair<unsigned, unsigned> LCTQualityControl::get_csc_min_max_cfeb(int station, int ring) const { - // 5 CFEBs [0,4] for non-ME1/1 chambers - int min_cfeb = 0; - int max_cfeb = CSCConstants::MAX_CFEBS_RUN1 - 1; // 4 - // 7 CFEBs [0,6] for ME1/1 chambers - if (station == 1 and ring == 1) { - max_cfeb = 6; - } - return std::make_pair(min_cfeb, max_cfeb); -} +std::pair<unsigned, unsigned> LCTQualityControl::get_csc_min_max_cfeb() const { + // counts at 0! + unsigned min_cfeb = 0; + unsigned max_cfeb = 0; -std::pair<unsigned, unsigned> LCTQualityControl::get_csc_min_max_pattern(bool runCCLUT) const { - int min_pattern, max_pattern; - // Run-1 or Run-2 case - if (!runCCLUT) { - min_pattern = 2; - max_pattern = 10; + // ME1/1a + if (theStation == 1 && theRing == 4 and gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME1A_GANGED; + } else if (theStation == 1 && theRing == 4 and !gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME1A_UNGANGED; } - // Run-3 case - else { - min_pattern = 0; - max_pattern = 4; + // ME1/1b + // In the CSC local trigger + // ME1/a is taken together with ME1/b + else if (theStation == 1 && theRing == 1 and gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME11_GANGED; + } else if (theStation == 1 && theRing == 1 and !gangedME1a_) { + max_cfeb = CSCConstants::NUM_CFEBS_ME11_UNGANGED; } - return std::make_pair(min_pattern, max_pattern); + // ME1/2 + else if (theStation == 1 && theRing == 2) { + max_cfeb = CSCConstants::NUM_CFEBS_ME12; + } + // ME1/3 + else if (theStation == 1 && theRing == 3) { + max_cfeb = CSCConstants::NUM_CFEBS_ME13; + } + // ME2/1 + else if (theStation == 2 && theRing == 1) { + max_cfeb = CSCConstants::NUM_CFEBS_ME21; + } + // ME3/1, ME4/1 + else if (theStation >= 3 && theRing == 1) { + max_cfeb = CSCConstants::NUM_CFEBS_ME31; + } + // ME2/2, ME3/2, ME4/2 + else if (theStation >= 2 && theRing == 2) { + max_cfeb = CSCConstants::NUM_CFEBS_ME22; + } + return std::make_pair(min_cfeb, max_cfeb - 1); } +std::pair<unsigned, unsigned> LCTQualityControl::get_csc_min_max_pattern() const { return std::make_pair(2, 10); } + +std::pair<unsigned, unsigned> LCTQualityControl::get_csc_min_max_pattern_run3() const { return std::make_pair(0, 4); } + std::pair<unsigned, unsigned> LCTQualityControl::get_csc_lct_min_max_pattern() const { - int min_pattern, max_pattern; + unsigned min_pattern, max_pattern; // Run-1 or Run-2 case if (!runCCLUT_) { min_pattern = 2; @@ -351,21 +400,48 @@ std::pair<unsigned, unsigned> LCTQualityControl::get_csc_lct_min_max_pattern() c return std::make_pair(min_pattern, max_pattern); } -unsigned LCTQualityControl::get_csc_alct_max_quality(int station, int ring, bool runGEMCSC) const { - int max_quality = 3; - // GE2/1-ME2/1 ALCTs are allowed 3-layer ALCTs - if (runGEMCSC and station == 2 and ring == 1) { - max_quality = 4; +std::pair<unsigned, unsigned> LCTQualityControl::get_csc_alct_min_max_quality() const { + // quality is number of layers - 3 + // at least 4 layers for CSC-only trigger + unsigned min_quality = 1; + if (isME21_ and runME21ILT_) { + // at least 3 layers for GEM-CSC trigger in ME2/1 + min_quality = 0; } - return max_quality; + return std::make_pair(min_quality, 3); } -unsigned LCTQualityControl::get_csc_clct_max_quality() const { - int max_quality = 6; - return max_quality; +std::pair<unsigned, unsigned> LCTQualityControl::get_csc_clct_min_max_quality() const { + // quality is number of layers + unsigned min_quality = 4; + if ((runME11ILT_ and isME11_) or (runME21ILT_ and isME21_)) { + // at least 3 layers for GEM-CSC trigger in ME1/1 or ME2/1 + min_quality = 3; + } + return std::make_pair(min_quality, 6); } -unsigned LCTQualityControl::get_csc_lct_max_quality() const { - int max_quality = 15; - return max_quality; +std::pair<unsigned, unsigned> LCTQualityControl::get_csc_lct_min_max_quality(unsigned station, unsigned ring) const { + // Run-1 or Run-2 + unsigned min_quality = static_cast<unsigned>(LCTQualityAssignment::LCT_QualityRun2::HQ_PATTERN_2_3); + unsigned max_quality = static_cast<unsigned>(LCTQualityAssignment::LCT_QualityRun2::HQ_PATTERN_10); + + // Run-3 with CCLUT on + if (runCCLUT_) { + min_quality = static_cast<unsigned>(LCTQualityAssignment::LCT_QualityRun3::LowQ); + max_quality = static_cast<unsigned>(LCTQualityAssignment::LCT_QualityRun3::HighQ); + } + + // Run-3 with GEM-CSC on (low-quality CLCTs are permitted, but use Run-2 data format) + const bool GEMCSC = (station == 1 and ring == 1 and runME11ILT_) or (station == 2 and ring == 1 and runME11ILT_); + if (GEMCSC) { + min_quality = static_cast<unsigned>(LCTQualityAssignment::LCT_QualityRun2::HQ_ANODE_MARGINAL_CATHODE); + } + + // Run-3 CSC with GEM-CSC on and CCLUT on: use Run-3 data format + if (GEMCSC and runCCLUT_) { + min_quality = static_cast<unsigned>(LCTQualityAssignment::LCT_QualityRun3GEM::ALCT_2GEM); + max_quality = static_cast<unsigned>(LCTQualityAssignment::LCT_QualityRun3GEM::ALCT_CLCT_2GEM_GEMCSCBend); + } + return std::make_pair(min_quality, max_quality); } From 35dc54caa91d32fe1160858c40fd740cbd6ceffe Mon Sep 17 00:00:00 2001 From: Mircho Rodozov <mrodozov@cern.ch> Date: Tue, 11 May 2021 00:11:40 +0300 Subject: [PATCH 276/309] Use .length instead of strlen() in AMPTHadronizer Resolves: https://github.com/cms-sw/cmssw/issues/33682 (or at least will try to) --- GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc index 0d1063be2bb4b..48792c526d298 100644 --- a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc +++ b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc @@ -238,9 +238,9 @@ bool AMPTHadronizer::call_amptset( izp, iat, izt, - strlen(frame.data()), - strlen(proj.data()), - strlen(targ.data())); + frame.length(), + proj.length(), + targ.length()); return true; } //______________________________________________________________________ From 56006103204a8c74ca32c60dd8202fa65a3aea06 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov <mrodozov@cern.ch> Date: Tue, 11 May 2021 00:21:21 +0300 Subject: [PATCH 277/309] Update AMPTHadronizer.cc --- .../AMPTInterface/src/AMPTHadronizer.cc | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc index 48792c526d298..4d14f4b3e4338 100644 --- a/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc +++ b/GeneratorInterface/AMPTInterface/src/AMPTHadronizer.cc @@ -230,17 +230,8 @@ bool AMPTHadronizer::get_particles(HepMC::GenEvent* evt) { bool AMPTHadronizer::call_amptset( double efrm, std::string frame, std::string proj, std::string targ, int iap, int izp, int iat, int izt) { // initialize hydjet - AMPTSET(efrm, - frame.data(), - proj.data(), - targ.data(), - iap, - izp, - iat, - izt, - frame.length(), - proj.length(), - targ.length()); + AMPTSET( + efrm, frame.data(), proj.data(), targ.data(), iap, izp, iat, izt, frame.length(), proj.length(), targ.length()); return true; } //______________________________________________________________________ From f54cb17ff8f663b4195ef628e7ad8707480a2dd4 Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Tue, 11 May 2021 11:31:16 +0200 Subject: [PATCH 278/309] migrate SLHCUpgradeSimulations/Geometry to esConsumes --- .../Geometry/test/ModuleInfo_Phase2.cc | 18 +++++------ .../Geometry/test/Phase2PixelNtuple.cc | 32 ++++++++----------- .../Geometry/test/StdHitNtuplizer.cc | 19 +++-------- .../Geometry/test/StdHitNtuplizer.h | 7 ++++ 4 files changed, 33 insertions(+), 43 deletions(-) diff --git a/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc b/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc index 2c6b0ce9bfa7f..b3a7d0641504e 100644 --- a/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc +++ b/SLHCUpgradeSimulations/Geometry/test/ModuleInfo_Phase2.cc @@ -75,6 +75,9 @@ class ModuleInfo_Phase2 : public edm::EDAnalyzer { private: // ----------member data --------------------------- + edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geom_esToken; + edm::ESGetToken<GeometricDet, IdealGeometryRecord> geomDet_esToken; + edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topo_esToken; bool fromDDD_; bool printDDD_; }; @@ -104,9 +107,7 @@ ModuleInfo_Phase2::~ModuleInfo_Phase2() { // ------------ method called to produce the data ------------ void ModuleInfo_Phase2::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Retrieve tracker topology from geometry - edm::ESHandle<TrackerTopology> tTopoHandle; - iSetup.get<TrackerTopologyRcd>().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &iSetup.getData(topo_esToken); edm::LogInfo("ModuleInfo_Phase2") << "begins"; @@ -124,15 +125,12 @@ void ModuleInfo_Phase2::analyze(const edm::Event& iEvent, const edm::EventSetup& // // get the GeometricDet // - edm::ESHandle<GeometricDet> rDD; + const GeometricDet* rDD = &iSetup.getData(geomDet_esToken); - iSetup.get<IdealGeometryRecord>().get(rDD); - edm::LogInfo("ModuleInfo_Phase2") << " Top node is " << rDD.product() << " " << rDD.product()->name() << std::endl; - edm::LogInfo("ModuleInfo_Phase2") << " And Contains Daughters: " << rDD.product()->deepComponents().size() - << std::endl; + edm::LogInfo("ModuleInfo_Phase2") << " Top node is " << rDD << " " << rDD->name() << std::endl; + edm::LogInfo("ModuleInfo_Phase2") << " And Contains Daughters: " << rDD->deepComponents().size() << std::endl; //first instance tracking geometry - edm::ESHandle<TrackerGeometry> pDD; - iSetup.get<TrackerDigiGeometryRecord>().get(pDD); + const TrackerGeometry* pDD = &iSetup.getData(geom_esToken); // // counters diff --git a/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc b/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc index 1daf3e791ba3f..599d343ce5a0f 100644 --- a/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc +++ b/SLHCUpgradeSimulations/Geometry/test/Phase2PixelNtuple.cc @@ -44,7 +44,6 @@ #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -124,10 +123,13 @@ class Phase2PixelNtuple : public edm::one::EDAnalyzer<> { const GeomDetUnit& det) const; private: - edm::ParameterSet const conf_; + edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geom_esToken; + edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topo_esToken; + edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> ttkb_esToken; + edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> tthb_esToken; + TrackerHitAssociator::Config trackerHitAssociatorConfig_; edm::EDGetTokenT<edmNew::DetSetVector<SiPixelRecHit>> pixelRecHits_token_; - std::string ttrhBuilder_; edm::EDGetTokenT<edm::View<reco::Track>> recoTracks_token_; edm::EDGetTokenT<TrajTrackAssociationCollection> tta_token_; @@ -201,9 +203,12 @@ class Phase2PixelNtuple : public edm::one::EDAnalyzer<> { }; Phase2PixelNtuple::Phase2PixelNtuple(edm::ParameterSet const& conf) - : trackerHitAssociatorConfig_(conf, consumesCollector()), + : geom_esToken(esConsumes()), + topo_esToken(esConsumes()), + ttkb_esToken(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + tthb_esToken(esConsumes(edm::ESInputTag("", conf.getParameter<std::string>("ttrhBuilder")))), + trackerHitAssociatorConfig_(conf, consumesCollector()), pixelRecHits_token_(consumes<edmNew::DetSetVector<SiPixelRecHit>>(edm::InputTag("siPixelRecHits"))), - ttrhBuilder_(conf.getParameter<std::string>("ttrhBuilder")), //ttrhBuilder_token def recoTracks_token_(consumes<edm::View<reco::Track>>(conf.getParameter<edm::InputTag>("trackProducer"))), tta_token_(consumes<TrajTrackAssociationCollection>(conf.getParameter<InputTag>("trajectoryInput"))), verbose_(conf.getUntrackedParameter<bool>("verbose", false)), @@ -337,15 +342,10 @@ void Phase2PixelNtuple::beginJob() { // Functions that gets called by framework every event void Phase2PixelNtuple::analyze(const edm::Event& e, const edm::EventSetup& es) { //Retrieve tracker topology from geometry - edm::ESHandle<TrackerTopology> tTopoHandle; - es.get<TrackerTopologyRcd>().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &es.getData(topo_esToken); // geometry setup - edm::ESHandle<TrackerGeometry> geometry; - - es.get<TrackerDigiGeometryRecord>().get(geometry); - const TrackerGeometry* theGeometry = &(*geometry); + const TrackerGeometry* theGeometry = &es.getData(geom_esToken); std::vector<PSimHit> matched; const PSimHit* closest_simhit = nullptr; @@ -357,14 +357,8 @@ void Phase2PixelNtuple::analyze(const edm::Event& e, const edm::EventSetup& es) TrackerHitAssociator associate(e, trackerHitAssociatorConfig_); //Transient Rechit Builders - edm::ESHandle<TransientTrackBuilder> theB; - es.get<TransientTrackRecord>().get("TransientTrackBuilder", theB); - - //ttrh builder def - ESHandle<TransientTrackingRecHitBuilder> hitBuilder; - es.get<TransientRecHitRecord>().get(ttrhBuilder_, hitBuilder); const TkTransientTrackingRecHitBuilder* builder = - static_cast<TkTransientTrackingRecHitBuilder const*>(hitBuilder.product()); + static_cast<TkTransientTrackingRecHitBuilder const*>(&es.getData(tthb_esToken)); auto hitCloner = builder->cloner(); if ((recHitColl.product())->dataSize() > 0) { diff --git a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc index e3c1b84cd4002..c0cfd4e98e345 100644 --- a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc +++ b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.cc @@ -7,8 +7,6 @@ #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" - -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -28,8 +26,6 @@ #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" #include "DataFormats/DetId/interface/DetId.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h" #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" @@ -39,8 +35,6 @@ // Geometry #include "MagneticField/Engine/interface/MagneticField.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" #include "Geometry/TrackerGeometryBuilder/interface/RectangularPixelTopology.h" #include "Geometry/TrackerGeometryBuilder/interface/PixelTopologyBuilder.h" #include "Geometry/CommonDetUnit/interface/GeomDetType.h" @@ -64,7 +58,9 @@ using namespace edm; using namespace reco; StdHitNtuplizer::StdHitNtuplizer(edm::ParameterSet const& conf) - : conf_(conf), + : geom_esToken(esConsumes()), + topo_esToken(esConsumes()), + conf_(conf), trackerHitAssociatorConfig_(conf, consumesCollector()), src_(conf.getParameter<edm::InputTag>("src")), rphiRecHits_(conf.getParameter<edm::InputTag>("rphiRecHits")), @@ -117,15 +113,10 @@ void StdHitNtuplizer::beginJob() { // Functions that gets called by framework every event void StdHitNtuplizer::analyze(const edm::Event& e, const edm::EventSetup& es) { //Retrieve tracker topology from geometry - edm::ESHandle<TrackerTopology> tTopoHandle; - es.get<TrackerTopologyRcd>().get(tTopoHandle); - const TrackerTopology* const tTopo = tTopoHandle.product(); + const TrackerTopology* const tTopo = &es.getData(topo_esToken); // geometry setup - edm::ESHandle<TrackerGeometry> geometry; - - es.get<TrackerDigiGeometryRecord>().get(geometry); - const TrackerGeometry* theGeometry = &(*geometry); + const TrackerGeometry* theGeometry = &es.getData(geom_esToken); // fastsim rechits //edm::Handle<SiTrackerGSRecHit2DCollection> theGSRecHits; diff --git a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h index 044ebc9d88954..1eaa48e8bbd85 100644 --- a/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h +++ b/SLHCUpgradeSimulations/Geometry/test/StdHitNtuplizer.h @@ -30,6 +30,11 @@ #include "SimDataFormats/Track/interface/SimTrackContainer.h" #include "SimTracker/TrackerHitAssociation/interface/TrackerHitAssociator.h" +#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" +#include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" +#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" + class TTree; class TFile; class RectangularPixelTopology; @@ -68,6 +73,8 @@ class StdHitNtuplizer : public edm::EDAnalyzer { void fillPRecHit(const int subid, trackingRecHit_iterator pixeliter, const GeomDet* PixGeom); private: + edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> geom_esToken; + edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> topo_esToken; edm::ParameterSet conf_; TrackerHitAssociator::Config trackerHitAssociatorConfig_; edm::InputTag src_; From 51cba8725c401fa426a3bd46a265745b69c67c42 Mon Sep 17 00:00:00 2001 From: Danilo Meuser <danilo.meuser@rwth-aachen.de> Date: Tue, 11 May 2021 11:34:06 +0200 Subject: [PATCH 279/309] Added 2D maps of Impact Parameters for TkDQM --- .../RecoB/plugins/PrimaryVertexMonitor.cc | 76 ++++++++++++++++++- .../RecoB/plugins/PrimaryVertexMonitor.h | 2 + .../RecoB/python/PrimaryVertexMonitor_cff.py | 4 +- 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index 455df453412e8..a948b8c069703 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -42,10 +42,14 @@ PrimaryVertexMonitor::PrimaryVertexMonitor(const edm::ParameterSet& pSet) dzVsPhi_pt1(nullptr), dxyVsEta_pt1(nullptr), dzVsEta_pt1(nullptr), + dxyVsEtaVsPhi_pt1(nullptr), + dzVsEtaVsPhi_pt1(nullptr), dxyVsPhi_pt10(nullptr), dzVsPhi_pt10(nullptr), dxyVsEta_pt10(nullptr), - dzVsEta_pt10(nullptr) { + dzVsEta_pt10(nullptr), + dxyVsEtaVsPhi_pt10(nullptr), + dzVsEtaVsPhi_pt10(nullptr) { // dqmStore_ = edm::Service<DQMStore>().operator->(); vertexInputTag_ = pSet.getParameter<InputTag>("vertexLabel"); @@ -176,10 +180,12 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c double DzMax = conf_.getParameter<double>("DzMax"); int PhiBin = conf_.getParameter<int>("PhiBin"); + int PhiBin2D = conf_.getParameter<int>("PhiBin2D"); double PhiMin = conf_.getParameter<double>("PhiMin"); double PhiMax = conf_.getParameter<double>("PhiMax"); int EtaBin = conf_.getParameter<int>("EtaBin"); + int EtaBin2D = conf_.getParameter<int>("EtaBin2D"); double EtaMin = conf_.getParameter<double>("EtaMin"); double EtaMax = conf_.getParameter<double>("EtaMax"); @@ -248,6 +254,38 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c ""); dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 2); + + dxyVsEtaVsPhi_pt1 = iBooker.bookProfile2D ("dxyVsEtaVsPhi_pt1", + "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DxyBin, + DxyMin, + DxyMax, + ""); + dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); + dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 2); + dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)", 3); + + dzVsEtaVsPhi_pt1 = iBooker.bookProfile2D ("dzVsEtaVsPhi_pt1", + "PV tracks (p_{T} > 1 GeV) d_{z} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DzBin, + DzMin, + DzMax, + ""); + dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); + dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 2); + dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 3); dxyVsPhi_pt10 = iBooker.bookProfile("dxyVsPhi_pt10", "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #phi", @@ -296,6 +334,38 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c ""); dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 2); + + dxyVsEtaVsPhi_pt10 = iBooker.bookProfile2D ("dxyVsEtaVsPhi_pt10", + "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DxyBin, + DxyMin, + DxyMax, + ""); + dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); + dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 2); + dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)", 3); + + dzVsEtaVsPhi_pt10 = iBooker.bookProfile2D ("dzVsEtaVsPhi_pt10", + "PV tracks (p_{T} > 10 GeV) d_{z} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DzBin, + DzMin, + DzMax, + ""); + dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); + dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 2); + dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 3); } PrimaryVertexMonitor::~PrimaryVertexMonitor() {} @@ -434,6 +504,8 @@ void PrimaryVertexMonitor::pvTracksPlots(const Vertex& v) { dzVsPhi_pt1->Fill(phi, Dz); dxyVsEta_pt1->Fill(eta, Dxy); dzVsEta_pt1->Fill(eta, Dz); + dxyVsEtaVsPhi_pt1->Fill(eta, phi, Dxy); + dzVsEtaVsPhi_pt1->Fill(eta, phi, Dz); if (pt < 10.) continue; @@ -441,6 +513,8 @@ void PrimaryVertexMonitor::pvTracksPlots(const Vertex& v) { dzVsPhi_pt10->Fill(phi, Dz); dxyVsEta_pt10->Fill(eta, Dxy); dzVsEta_pt10->Fill(eta, Dz); + dxyVsEtaVsPhi_pt10->Fill(eta, phi, Dxy); + dzVsEtaVsPhi_pt10->Fill(eta, phi, Dz); } ntracks->Fill(float(nTracks)); sumpt->Fill(sumPT); diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h index 7053cdc855986..b452c966738c4 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h @@ -66,8 +66,10 @@ class PrimaryVertexMonitor : public DQMEDAnalyzer { MonitorElement *dxy, *dxy2, *dz, *dxyErr, *dzErr; MonitorElement *dxyVsPhi_pt1, *dzVsPhi_pt1; MonitorElement *dxyVsEta_pt1, *dzVsEta_pt1; + MonitorElement *dxyVsEtaVsPhi_pt1, *dzVsEtaVsPhi_pt1; MonitorElement *dxyVsPhi_pt10, *dzVsPhi_pt10; MonitorElement *dxyVsEta_pt10, *dzVsEta_pt10; + MonitorElement *dxyVsEtaVsPhi_pt10, *dzVsEtaVsPhi_pt10; }; #endif diff --git a/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py b/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py index f8de48cbe8ec9..1d6446fd6db71 100644 --- a/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py +++ b/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py @@ -20,9 +20,11 @@ DzMax = cms.double(2000.0), DzMin = cms.double(-2000.0), PhiBin = cms.int32(32), + PhiBin2D = cms.int32(12), PhiMax = cms.double(3.141592654), PhiMin = cms.double(-3.141592654), EtaBin = cms.int32(26), + EtaBin2D = cms.int32(8), EtaMax = cms.double(2.5), EtaMin = cms.double(-2.5) ) @@ -31,5 +33,5 @@ from Configuration.Eras.Modifier_phase1Pixel_cff import phase1Pixel from Configuration.Eras.Modifier_phase2_tracker_cff import phase2_tracker phase1Pixel.toModify(pvMonitor, EtaBin=31, EtaMin=-3.0, EtaMax=3.0) -phase2_tracker.toModify(pvMonitor, EtaBin=41, EtaMin=-4.0, EtaMax=4.0) +phase2_tracker.toModify(pvMonitor, EtaBin=41, EtaBin2D=9, EtaMin=-4.0, EtaMax=4.0) From bc72091eb6eb594e90a62bd8b642fa4bc446593d Mon Sep 17 00:00:00 2001 From: Danilo Meuser <danilo.meuser@rwth-aachen.de> Date: Tue, 11 May 2021 16:21:48 +0200 Subject: [PATCH 280/309] Applied code format --- .../RecoB/plugins/PrimaryVertexMonitor.cc | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index a948b8c069703..9026b901390c3 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -254,35 +254,35 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c ""); dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); dzVsEta_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 2); - - dxyVsEtaVsPhi_pt1 = iBooker.bookProfile2D ("dxyVsEtaVsPhi_pt1", - "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum) VS track #eta VS track #phi", - EtaBin2D, - EtaMin, - EtaMax, - PhiBin2D, - PhiMin, - PhiMax, - DxyBin, - DxyMin, - DxyMax, - ""); + + dxyVsEtaVsPhi_pt1 = iBooker.bookProfile2D("dxyVsEtaVsPhi_pt1", + "PV tracks (p_{T} > 1 GeV) d_{xy} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DxyBin, + DxyMin, + DxyMax, + ""); dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 2); dxyVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{xy} (#mum)", 3); - - dzVsEtaVsPhi_pt1 = iBooker.bookProfile2D ("dzVsEtaVsPhi_pt1", - "PV tracks (p_{T} > 1 GeV) d_{z} (#mum) VS track #eta VS track #phi", - EtaBin2D, - EtaMin, - EtaMax, - PhiBin2D, - PhiMin, - PhiMax, - DzBin, - DzMin, - DzMax, - ""); + + dzVsEtaVsPhi_pt1 = iBooker.bookProfile2D("dzVsEtaVsPhi_pt1", + "PV tracks (p_{T} > 1 GeV) d_{z} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DzBin, + DzMin, + DzMax, + ""); dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #eta", 1); dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) #phi", 2); dzVsEtaVsPhi_pt1->setAxisTitle("PV track (p_{T} > 1 GeV) d_{z} (#mum)", 3); @@ -334,35 +334,35 @@ void PrimaryVertexMonitor::bookHistograms(DQMStore::IBooker& iBooker, edm::Run c ""); dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); dzVsEta_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 2); - - dxyVsEtaVsPhi_pt10 = iBooker.bookProfile2D ("dxyVsEtaVsPhi_pt10", - "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #eta VS track #phi", - EtaBin2D, - EtaMin, - EtaMax, - PhiBin2D, - PhiMin, - PhiMax, - DxyBin, - DxyMin, - DxyMax, - ""); + + dxyVsEtaVsPhi_pt10 = iBooker.bookProfile2D("dxyVsEtaVsPhi_pt10", + "PV tracks (p_{T} > 10 GeV) d_{xy} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DxyBin, + DxyMin, + DxyMax, + ""); dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 2); dxyVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{xy} (#mum)", 3); - - dzVsEtaVsPhi_pt10 = iBooker.bookProfile2D ("dzVsEtaVsPhi_pt10", - "PV tracks (p_{T} > 10 GeV) d_{z} (#mum) VS track #eta VS track #phi", - EtaBin2D, - EtaMin, - EtaMax, - PhiBin2D, - PhiMin, - PhiMax, - DzBin, - DzMin, - DzMax, - ""); + + dzVsEtaVsPhi_pt10 = iBooker.bookProfile2D("dzVsEtaVsPhi_pt10", + "PV tracks (p_{T} > 10 GeV) d_{z} (#mum) VS track #eta VS track #phi", + EtaBin2D, + EtaMin, + EtaMax, + PhiBin2D, + PhiMin, + PhiMax, + DzBin, + DzMin, + DzMax, + ""); dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #eta", 1); dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) #phi", 2); dzVsEtaVsPhi_pt10->setAxisTitle("PV track (p_{T} > 10 GeV) d_{z} (#mum)", 3); From d42a7360d227384f4eb378f7c13a9efd5c628c9f Mon Sep 17 00:00:00 2001 From: Chris Jones <chrisdjones15@gmail.com> Date: Tue, 11 May 2021 15:34:37 -0500 Subject: [PATCH 281/309] Split ProductProvenanceRetriever into to classes ProductProvenanceLookup is the API intended for accessing the information. ProductProvenanceRetriever now just handles the retrieving of data from storage. --- DataFormats/Common/interface/ProductData.h | 2 +- .../interface/ProductProvenanceLookup.h | 105 +++++++++++++++ .../interface/ProductProvenanceRetriever.h | 88 +------------ DataFormats/Provenance/interface/Provenance.h | 8 +- .../Provenance/interface/ProvenanceFwd.h | 1 + .../Provenance/src/ProductProvenanceLookup.cc | 117 +++++++++++++++++ .../src/ProductProvenanceRetriever.cc | 120 ++---------------- DataFormats/Provenance/src/Provenance.cc | 2 +- FWCore/Integration/test/TestParentage.cc | 6 +- 9 files changed, 244 insertions(+), 205 deletions(-) create mode 100644 DataFormats/Provenance/interface/ProductProvenanceLookup.h create mode 100644 DataFormats/Provenance/src/ProductProvenanceLookup.cc diff --git a/DataFormats/Common/interface/ProductData.h b/DataFormats/Common/interface/ProductData.h index 63aee33f21edc..9ec7867298def 100644 --- a/DataFormats/Common/interface/ProductData.h +++ b/DataFormats/Common/interface/ProductData.h @@ -53,7 +53,7 @@ namespace edm { void unsafe_resetProductData() const { wrapper_.reset(); } - void setProvenance(ProductProvenanceRetriever const* provRetriever) { prov_.setStore(provRetriever); } + void setProvenance(ProductProvenanceLookup const* provRetriever) { prov_.setStore(provRetriever); } void setProductID(ProductID const& pid) { prov_.setProductID(pid); } diff --git a/DataFormats/Provenance/interface/ProductProvenanceLookup.h b/DataFormats/Provenance/interface/ProductProvenanceLookup.h new file mode 100644 index 0000000000000..5b1311cad7cb9 --- /dev/null +++ b/DataFormats/Provenance/interface/ProductProvenanceLookup.h @@ -0,0 +1,105 @@ +#ifndef DataFormats_Provenance_ProductProvenanceLookup_h +#define DataFormats_Provenance_ProductProvenanceLookup_h + +/*---------------------------------------------------------------------- + +ProductProvenanceLookup: Gives access to the per event/lumi/run per product provenance. + +----------------------------------------------------------------------*/ +#include "DataFormats/Provenance/interface/BranchID.h" +#include "DataFormats/Provenance/interface/ProductProvenance.h" +#include "FWCore/Utilities/interface/propagate_const.h" +#include "FWCore/Utilities/interface/Likely.h" +#include "FWCore/Utilities/interface/thread_safety_macros.h" + +#include <vector> +#include <memory> +#include <set> +#include <atomic> + +/* + ProductProvenanceLookup +*/ + +namespace edm { + class ProductRegistry; + + class ProductProvenanceLookup { + public: + ProductProvenanceLookup(); + explicit ProductProvenanceLookup(edm::ProductRegistry const&); + virtual ~ProductProvenanceLookup(); + + ProductProvenanceLookup& operator=(ProductProvenanceLookup const&) = delete; + + ProductProvenance const* branchIDToProvenance(BranchID const& bid) const; + void insertIntoSet(ProductProvenance provenanceProduct) const; + ProductProvenance const* branchIDToProvenanceForProducedOnly(BranchID const& bid) const; + + void update(edm::ProductRegistry const&); + + class ProducedProvenanceInfo { + public: + ProducedProvenanceInfo(BranchID iBid) : provenance_{iBid}, isParentageSet_{false} {} + ProducedProvenanceInfo(ProducedProvenanceInfo&& iOther) + : provenance_{std::move(iOther.provenance_)}, + isParentageSet_{iOther.isParentageSet_.load(std::memory_order_acquire)} {} + ProducedProvenanceInfo(ProducedProvenanceInfo const& iOther) : provenance_{iOther.provenance_.branchID()} { + bool isSet = iOther.isParentageSet_.load(std::memory_order_acquire); + if (isSet) { + provenance_.set(iOther.provenance_.parentageID()); + } + isParentageSet_.store(isSet, std::memory_order_release); + } + + ProducedProvenanceInfo& operator=(ProducedProvenanceInfo&& iOther) { + provenance_ = std::move(iOther.provenance_); + isParentageSet_.store(iOther.isParentageSet_.load(std::memory_order_acquire), std::memory_order_release); + return *this; + } + ProducedProvenanceInfo& operator=(ProducedProvenanceInfo const& iOther) { + bool isSet = iOther.isParentageSet_.load(std::memory_order_acquire); + if (isSet) { + provenance_ = iOther.provenance_; + } else { + provenance_ = ProductProvenance(iOther.provenance_.branchID()); + } + isParentageSet_.store(isSet, std::memory_order_release); + return *this; + } + + ProductProvenance const* productProvenance() const noexcept { + if (LIKELY(isParentageSet())) { + return &provenance_; + } + return nullptr; + } + BranchID branchID() const noexcept { return provenance_.branchID(); } + + bool isParentageSet() const noexcept { return isParentageSet_.load(std::memory_order_acquire); } + + void threadsafe_set(ParentageID id) const { + provenance_.set(std::move(id)); + isParentageSet_.store(true, std::memory_order_release); + } + + void resetParentage() { isParentageSet_.store(false, std::memory_order_release); } + + private: + CMS_THREAD_GUARD(isParentageSet_) mutable ProductProvenance provenance_; + mutable std::atomic<bool> isParentageSet_; + }; + + protected: + virtual std::unique_ptr<const std::set<ProductProvenance>> readProvenance() const = 0; + virtual const ProductProvenanceLookup* nextRetriever() const = 0; + + std::vector<ProducedProvenanceInfo> entryInfoSet_; + mutable std::atomic<const std::set<ProductProvenance>*> readEntryInfoSet_; + edm::propagate_const<ProductProvenanceLookup const*> parentProcessRetriever_; + + private: + void setupEntryInfoSet(edm::ProductRegistry const&); + }; +} // namespace edm +#endif diff --git a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h b/DataFormats/Provenance/interface/ProductProvenanceRetriever.h index 61942d26736bb..946651e6f86ac 100644 --- a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h +++ b/DataFormats/Provenance/interface/ProductProvenanceRetriever.h @@ -8,11 +8,9 @@ ProductProvenanceRetriever: Manages the per event/lumi/run per product provenanc ----------------------------------------------------------------------*/ #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/ProductProvenance.h" -#include "DataFormats/Provenance/interface/ProcessHistoryID.h" +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Utilities/interface/propagate_const.h" -#include "FWCore/Utilities/interface/Likely.h" -#include "FWCore/Utilities/interface/thread_safety_macros.h" #include <vector> #include <memory> @@ -29,19 +27,6 @@ namespace edm { class ModuleCallingContext; class ProductRegistry; - struct ProductProvenanceHasher { - size_t operator()(ProductProvenance const& tid) const { return tid.branchID().id(); } - }; - - struct ProductProvenanceEqual { - //The default operator== for ProductProvenance does not work for this case - // Since (a<b)==false and (a>b)==false does not mean a==b for the operators - // defined for ProductProvenance - bool operator()(ProductProvenance const& iLHS, ProductProvenance const iRHS) const { - return iLHS.branchID().id() == iRHS.branchID().id(); - } - }; - class ProvenanceReaderBase { public: ProvenanceReaderBase() {} @@ -53,7 +38,7 @@ namespace edm { std::atomic<const std::set<ProductProvenance>*>& writeTo) const = 0; }; - class ProductProvenanceRetriever { + class ProductProvenanceRetriever : public ProductProvenanceLookup { public: explicit ProductProvenanceRetriever(unsigned int iTransitionIndex); ProductProvenanceRetriever(unsigned int iTransitionIndex, edm::ProductRegistry const&); @@ -61,14 +46,6 @@ namespace edm { ProductProvenanceRetriever& operator=(ProductProvenanceRetriever const&) = delete; - ~ProductProvenanceRetriever(); - - ProductProvenance const* branchIDToProvenance(BranchID const& bid) const; - - ProductProvenance const* branchIDToProvenanceForProducedOnly(BranchID const& bid) const; - - void insertIntoSet(ProductProvenance provenanceProduct) const; - void mergeProvenanceRetrievers(std::shared_ptr<ProductProvenanceRetriever> other); void mergeParentProcessRetriever(ProductProvenanceRetriever const& provRetriever); @@ -79,69 +56,12 @@ namespace edm { void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const* moduleCallingContext) const; - void update(edm::ProductRegistry const&); - - class ProducedProvenanceInfo { - public: - ProducedProvenanceInfo(BranchID iBid) : provenance_{iBid}, isParentageSet_{false} {} - ProducedProvenanceInfo(ProducedProvenanceInfo&& iOther) - : provenance_{std::move(iOther.provenance_)}, - isParentageSet_{iOther.isParentageSet_.load(std::memory_order_acquire)} {} - ProducedProvenanceInfo(ProducedProvenanceInfo const& iOther) : provenance_{iOther.provenance_.branchID()} { - bool isSet = iOther.isParentageSet_.load(std::memory_order_acquire); - if (isSet) { - provenance_.set(iOther.provenance_.parentageID()); - } - isParentageSet_.store(isSet, std::memory_order_release); - } - - ProducedProvenanceInfo& operator=(ProducedProvenanceInfo&& iOther) { - provenance_ = std::move(iOther.provenance_); - isParentageSet_.store(iOther.isParentageSet_.load(std::memory_order_acquire), std::memory_order_release); - return *this; - } - ProducedProvenanceInfo& operator=(ProducedProvenanceInfo const& iOther) { - bool isSet = iOther.isParentageSet_.load(std::memory_order_acquire); - if (isSet) { - provenance_ = iOther.provenance_; - } else { - provenance_ = ProductProvenance(iOther.provenance_.branchID()); - } - isParentageSet_.store(isSet, std::memory_order_release); - return *this; - } - - ProductProvenance const* productProvenance() const noexcept { - if (LIKELY(isParentageSet())) { - return &provenance_; - } - return nullptr; - } - BranchID branchID() const noexcept { return provenance_.branchID(); } - - bool isParentageSet() const noexcept { return isParentageSet_.load(std::memory_order_acquire); } - - void threadsafe_set(ParentageID id) const { - provenance_.set(std::move(id)); - isParentageSet_.store(true, std::memory_order_release); - } - - void resetParentage() { isParentageSet_.store(false, std::memory_order_release); } - - private: - CMS_THREAD_GUARD(isParentageSet_) mutable ProductProvenance provenance_; - mutable std::atomic<bool> isParentageSet_; - }; - private: - void readProvenance() const; + std::unique_ptr<const std::set<ProductProvenance>> readProvenance() const final; + const ProductProvenanceLookup* nextRetriever() const final { return nextRetriever_.get(); } void setTransitionIndex(unsigned int transitionIndex) { transitionIndex_ = transitionIndex; } - void setupEntryInfoSet(edm::ProductRegistry const&); - std::vector<ProducedProvenanceInfo> entryInfoSet_; - mutable std::atomic<const std::set<ProductProvenance>*> readEntryInfoSet_; edm::propagate_const<std::shared_ptr<ProductProvenanceRetriever>> nextRetriever_; - edm::propagate_const<ProductProvenanceRetriever const*> parentProcessRetriever_; std::shared_ptr<const ProvenanceReaderBase> provenanceReader_; unsigned int transitionIndex_; }; diff --git a/DataFormats/Provenance/interface/Provenance.h b/DataFormats/Provenance/interface/Provenance.h index 0ef5a9d7ed53d..d14ee35ba1298 100644 --- a/DataFormats/Provenance/interface/Provenance.h +++ b/DataFormats/Provenance/interface/Provenance.h @@ -29,7 +29,7 @@ existence. namespace edm { class MergeableRunProductMetadataBase; class ProductProvenance; - class ProductProvenanceRetriever; + class ProductProvenanceLookup; class Provenance { public: @@ -57,7 +57,7 @@ namespace edm { std::string const& processName() const { return stable().processName(); } std::string const& productInstanceName() const { return stable().productInstanceName(); } std::string const& friendlyClassName() const { return stable().friendlyClassName(); } - ProductProvenanceRetriever const* store() const { return store_; } + ProductProvenanceLookup const* store() const { return store_; } std::set<std::string> const& branchAliases() const { return stable().branchAliases(); } // Usually branchID() and originalBranchID() return exactly the same result. @@ -74,7 +74,7 @@ namespace edm { void write(std::ostream& os) const; - void setStore(ProductProvenanceRetriever const* store) { store_ = store; } + void setStore(ProductProvenanceLookup const* store) { store_ = store; } ProductID const& productID() const { return stable().productID(); } @@ -90,7 +90,7 @@ namespace edm { private: StableProvenance stableProvenance_; - ProductProvenanceRetriever const* store_; + ProductProvenanceLookup const* store_; MergeableRunProductMetadataBase const* mergeableRunProductMetadata_; }; diff --git a/DataFormats/Provenance/interface/ProvenanceFwd.h b/DataFormats/Provenance/interface/ProvenanceFwd.h index e17d4b4446107..622667dfe4bba 100644 --- a/DataFormats/Provenance/interface/ProvenanceFwd.h +++ b/DataFormats/Provenance/interface/ProvenanceFwd.h @@ -25,6 +25,7 @@ namespace edm { class RunID; class StableProvenance; class Timestamp; + class ProductProvenanceLookup; class ProductProvenanceRetriever; } // namespace edm diff --git a/DataFormats/Provenance/src/ProductProvenanceLookup.cc b/DataFormats/Provenance/src/ProductProvenanceLookup.cc new file mode 100644 index 0000000000000..3c389f1e00ce2 --- /dev/null +++ b/DataFormats/Provenance/src/ProductProvenanceLookup.cc @@ -0,0 +1,117 @@ +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" +#include "DataFormats/Provenance/interface/ProductRegistry.h" +#include "FWCore/Utilities/interface/EDMException.h" + +#include <cassert> +#include <iostream> +#include <limits> + +/* + ProductProvenanceLookup +*/ + +namespace edm { + ProductProvenanceLookup::ProductProvenanceLookup() + : entryInfoSet_(), readEntryInfoSet_(), parentProcessRetriever_(nullptr) {} + + ProductProvenanceLookup::ProductProvenanceLookup(edm::ProductRegistry const& iReg) + : entryInfoSet_(), readEntryInfoSet_(), parentProcessRetriever_(nullptr) { + setupEntryInfoSet(iReg); + } + + ProductProvenanceLookup::~ProductProvenanceLookup() { delete readEntryInfoSet_.load(); } + + void ProductProvenanceLookup::setupEntryInfoSet(edm::ProductRegistry const& iReg) { + std::set<BranchID> ids; + for (auto const& p : iReg.productList()) { + if (p.second.branchType() == edm::InEvent) { + if (p.second.produced() or p.second.isProvenanceSetOnRead()) { + ids.insert(p.second.branchID()); + } + } + } + entryInfoSet_.reserve(ids.size()); + for (auto const& b : ids) { + entryInfoSet_.emplace_back(b); + } + } + + void ProductProvenanceLookup::update(edm::ProductRegistry const& iReg) { + entryInfoSet_.clear(); + setupEntryInfoSet(iReg); + } + + void ProductProvenanceLookup::insertIntoSet(ProductProvenance entryInfo) const { + //NOTE:do not read provenance here because we only need the full + // provenance when someone tries to access it not when doing the insert + // doing the delay saves 20% of time when doing an analysis job + //readProvenance(); + auto itFound = + std::lower_bound(entryInfoSet_.begin(), + entryInfoSet_.end(), + entryInfo.branchID(), + [](auto const& iEntry, edm::BranchID const& iValue) { return iEntry.branchID() < iValue; }); + if UNLIKELY (itFound == entryInfoSet_.end() or itFound->branchID() != entryInfo.branchID()) { + throw edm::Exception(edm::errors::LogicError) << "ProductProvenanceLookup::insertIntoSet passed a BranchID " + << entryInfo.branchID().id() << " that has not been pre-registered"; + } + itFound->threadsafe_set(entryInfo.moveParentageID()); + } + + ProductProvenance const* ProductProvenanceLookup::branchIDToProvenance(BranchID const& bid) const { + auto itFound = std::lower_bound( + entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { + return iEntry.branchID() < iValue; + }); + if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { + if (auto p = itFound->productProvenance()) { + return p; + } + } + if (parentProcessRetriever_) { + return parentProcessRetriever_->branchIDToProvenance(bid); + } + //check in source + if (nullptr == readEntryInfoSet_.load()) { + auto readProv = readProvenance(); + std::set<ProductProvenance> const* expected = nullptr; + if (readEntryInfoSet_.compare_exchange_strong(expected, readProv.get())) { + readProv.release(); + } + } + auto ptr = readEntryInfoSet_.load(); + if (ptr) { + ProductProvenance ei(bid); + auto itRead = ptr->find(ei); + if (itRead != ptr->end()) { + return &*itRead; + } + } + auto nr = nextRetriever(); + if (nr) { + return nr->branchIDToProvenance(bid); + } + return nullptr; + } + + ProductProvenance const* ProductProvenanceLookup::branchIDToProvenanceForProducedOnly(BranchID const& bid) const { + auto itFound = std::lower_bound( + entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { + return iEntry.branchID() < iValue; + }); + if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { + if (auto p = itFound->productProvenance()) { + return p; + } + } + if (parentProcessRetriever_) { + return parentProcessRetriever_->branchIDToProvenanceForProducedOnly(bid); + } + auto nr = nextRetriever(); + if (nr) { + return nr->branchIDToProvenanceForProducedOnly(bid); + } + return nullptr; + } + +} // namespace edm diff --git a/DataFormats/Provenance/src/ProductProvenanceRetriever.cc b/DataFormats/Provenance/src/ProductProvenanceRetriever.cc index 6013a70b49370..99c5c10855c30 100644 --- a/DataFormats/Provenance/src/ProductProvenanceRetriever.cc +++ b/DataFormats/Provenance/src/ProductProvenanceRetriever.cc @@ -12,65 +12,26 @@ namespace edm { ProductProvenanceRetriever::ProductProvenanceRetriever(unsigned int iTransitionIndex) - : entryInfoSet_(), - readEntryInfoSet_(), - nextRetriever_(), - parentProcessRetriever_(nullptr), - provenanceReader_(), - transitionIndex_(iTransitionIndex) {} + : ProductProvenanceLookup(), nextRetriever_(), provenanceReader_(), transitionIndex_(iTransitionIndex) {} ProductProvenanceRetriever::ProductProvenanceRetriever(unsigned int iTransitionIndex, edm::ProductRegistry const& iReg) - : entryInfoSet_(), - readEntryInfoSet_(), - nextRetriever_(), - parentProcessRetriever_(nullptr), - provenanceReader_(), - transitionIndex_(iTransitionIndex) { - setupEntryInfoSet(iReg); - } + : ProductProvenanceLookup(iReg), nextRetriever_(), provenanceReader_(), transitionIndex_(iTransitionIndex) {} ProductProvenanceRetriever::ProductProvenanceRetriever(std::unique_ptr<ProvenanceReaderBase> reader) - : entryInfoSet_(), - readEntryInfoSet_(), + : ProductProvenanceLookup(), nextRetriever_(), - parentProcessRetriever_(nullptr), provenanceReader_(reader.release()), transitionIndex_(std::numeric_limits<unsigned int>::max()) { assert(provenanceReader_); } - ProductProvenanceRetriever::~ProductProvenanceRetriever() { delete readEntryInfoSet_.load(); } - - void ProductProvenanceRetriever::readProvenance() const { - if (nullptr == readEntryInfoSet_.load() && provenanceReader_) { - auto temp = - std::make_unique<std::set<ProductProvenance> const>(provenanceReader_->readProvenance(transitionIndex_)); - std::set<ProductProvenance> const* expected = nullptr; - if (readEntryInfoSet_.compare_exchange_strong(expected, temp.get())) { - temp.release(); - } - } - } - - void ProductProvenanceRetriever::setupEntryInfoSet(edm::ProductRegistry const& iReg) { - std::set<BranchID> ids; - for (auto const& p : iReg.productList()) { - if (p.second.branchType() == edm::InEvent) { - if (p.second.produced() or p.second.isProvenanceSetOnRead()) { - ids.insert(p.second.branchID()); - } - } - } - entryInfoSet_.reserve(ids.size()); - for (auto const& b : ids) { - entryInfoSet_.emplace_back(b); + std::unique_ptr<const std::set<ProductProvenance>> ProductProvenanceRetriever::readProvenance() const { + std::unique_ptr<const std::set<ProductProvenance>> temp; + if (provenanceReader_) { + temp = std::make_unique<std::set<ProductProvenance> const>(provenanceReader_->readProvenance(transitionIndex_)); } - } - - void ProductProvenanceRetriever::update(edm::ProductRegistry const& iReg) { - entryInfoSet_.clear(); - setupEntryInfoSet(iReg); + return temp; } void ProductProvenanceRetriever::readProvenanceAsync(WaitingTaskHolder task, @@ -118,23 +79,6 @@ namespace edm { parentProcessRetriever_ = nullptr; } - void ProductProvenanceRetriever::insertIntoSet(ProductProvenance entryInfo) const { - //NOTE:do not read provenance here because we only need the full - // provenance when someone tries to access it not when doing the insert - // doing the delay saves 20% of time when doing an analysis job - //readProvenance(); - auto itFound = - std::lower_bound(entryInfoSet_.begin(), - entryInfoSet_.end(), - entryInfo.branchID(), - [](auto const& iEntry, edm::BranchID const& iValue) { return iEntry.branchID() < iValue; }); - if UNLIKELY (itFound == entryInfoSet_.end() or itFound->branchID() != entryInfo.branchID()) { - throw edm::Exception(edm::errors::LogicError) << "ProductProvenanceRetriever::insertIntoSet passed a BranchID " - << entryInfo.branchID().id() << " that has not been pre-registered"; - } - itFound->threadsafe_set(entryInfo.moveParentageID()); - } - void ProductProvenanceRetriever::mergeProvenanceRetrievers(std::shared_ptr<ProductProvenanceRetriever> other) { nextRetriever_ = other; } @@ -143,53 +87,5 @@ namespace edm { parentProcessRetriever_ = &provRetriever; } - ProductProvenance const* ProductProvenanceRetriever::branchIDToProvenance(BranchID const& bid) const { - auto itFound = std::lower_bound( - entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { - return iEntry.branchID() < iValue; - }); - if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { - if (auto p = itFound->productProvenance()) { - return p; - } - } - if (parentProcessRetriever_) { - return parentProcessRetriever_->branchIDToProvenance(bid); - } - //check in source - readProvenance(); - auto ptr = readEntryInfoSet_.load(); - if (ptr) { - ProductProvenance ei(bid); - auto itRead = ptr->find(ei); - if (itRead != ptr->end()) { - return &*itRead; - } - } - if (nextRetriever_) { - return nextRetriever_->branchIDToProvenance(bid); - } - return nullptr; - } - - ProductProvenance const* ProductProvenanceRetriever::branchIDToProvenanceForProducedOnly(BranchID const& bid) const { - auto itFound = std::lower_bound( - entryInfoSet_.begin(), entryInfoSet_.end(), bid, [](auto const& iEntry, edm::BranchID const& iValue) { - return iEntry.branchID() < iValue; - }); - if (itFound != entryInfoSet_.end() and itFound->branchID() == bid) { - if (auto p = itFound->productProvenance()) { - return p; - } - } - if (parentProcessRetriever_) { - return parentProcessRetriever_->branchIDToProvenanceForProducedOnly(bid); - } - if (nextRetriever_) { - return nextRetriever_->branchIDToProvenanceForProducedOnly(bid); - } - return nullptr; - } - ProvenanceReaderBase::~ProvenanceReaderBase() {} } // namespace edm diff --git a/DataFormats/Provenance/src/Provenance.cc b/DataFormats/Provenance/src/Provenance.cc index 7aaad3cc48ad4..59ce7161e529c 100644 --- a/DataFormats/Provenance/src/Provenance.cc +++ b/DataFormats/Provenance/src/Provenance.cc @@ -1,7 +1,7 @@ #include "DataFormats/Provenance/interface/Provenance.h" #include "DataFormats/Provenance/interface/MergeableRunProductMetadataBase.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" #include "DataFormats/Provenance/interface/ProcessConfiguration.h" #include <algorithm> diff --git a/FWCore/Integration/test/TestParentage.cc b/FWCore/Integration/test/TestParentage.cc index def68595eb017..cdde44a14f800 100644 --- a/FWCore/Integration/test/TestParentage.cc +++ b/FWCore/Integration/test/TestParentage.cc @@ -3,7 +3,7 @@ #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/Parentage.h" #include "DataFormats/Provenance/interface/ProductProvenance.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" #include "DataFormats/Provenance/interface/Provenance.h" #include "DataFormats/TestObjects/interface/ToyProducts.h" #include "FWCore/Framework/interface/ConstProductRegistry.h" @@ -37,7 +37,7 @@ namespace { // ProductsResolver which for SubProcesses could lead to a different // retriever. In SubProcesses, the following function follows the // links in the retrievers themselves. Both should give the same answer. - void getAncestorsFromRetriever(edm::ProductProvenanceRetriever const* retriever, + void getAncestorsFromRetriever(edm::ProductProvenanceLookup const* retriever, edm::BranchID const& branchID, std::set<edm::BranchID>& ancestors) { edm::ProductProvenance const* productProvenance = retriever->branchIDToProvenance(branchID); @@ -110,7 +110,7 @@ namespace edmtest { } } - edm::ProductProvenanceRetriever const* retriever = prov->store(); + auto const* retriever = prov->store(); std::set<edm::BranchID> ancestorsFromRetriever; getAncestorsFromRetriever(retriever, prov->originalBranchID(), ancestorsFromRetriever); From 7822d43a97a4f3e021e199465b6118c5ecb358fd Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Tue, 11 May 2021 22:50:40 +0200 Subject: [PATCH 282/309] PrimaryVertexMonitoring: don't use HP flag for Alignment plots at HLT --- DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc | 3 ++- DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h | 1 + DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py | 1 + DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py | 4 ++++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc index 455df453412e8..a23b5e3630507 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.cc @@ -17,6 +17,7 @@ PrimaryVertexMonitor::PrimaryVertexMonitor(const edm::ParameterSet& pSet) TopFolderName_(pSet.getParameter<std::string>("TopFolderName")), AlignmentLabel_(pSet.getParameter<std::string>("AlignmentLabel")), ndof_(pSet.getParameter<int>("ndof")), + useHPfoAlignmentPlots_(pSet.getParameter<bool>("useHPforAlignmentPlots")), errorPrinted_(false), nbvtx(nullptr), bsX(nullptr), @@ -398,7 +399,7 @@ void PrimaryVertexMonitor::pvTracksPlots(const Vertex& v) { for (reco::Vertex::trackRef_iterator t = v.tracks_begin(); t != v.tracks_end(); t++) { bool isHighPurity = (**t).quality(reco::TrackBase::highPurity); - if (!isHighPurity) + if (!isHighPurity && useHPfoAlignmentPlots_) continue; float pt = (**t).pt(); diff --git a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h index 7053cdc855986..8fee307030a59 100644 --- a/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h +++ b/DQMOffline/RecoB/plugins/PrimaryVertexMonitor.h @@ -50,6 +50,7 @@ class PrimaryVertexMonitor : public DQMEDAnalyzer { std::string TopFolderName_; std::string AlignmentLabel_; int ndof_; + bool useHPfoAlignmentPlots_; bool errorPrinted_; // the histos diff --git a/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py b/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py index f8de48cbe8ec9..b83588e58c5bb 100644 --- a/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py +++ b/DQMOffline/RecoB/python/PrimaryVertexMonitor_cff.py @@ -7,6 +7,7 @@ AlignmentLabel = cms.string("Alignment"), vertexLabel = cms.InputTag("offlinePrimaryVertices"), beamSpotLabel = cms.InputTag("offlineBeamSpot"), + useHPforAlignmentPlots = cms.bool(True), ndof = cms.int32( 4 ), TkSizeBin = cms.int32( 100 ), TkSizeMax = cms.double(499.5), diff --git a/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py b/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py index ef0d64652b80c..930879f7b3b3c 100644 --- a/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py +++ b/DQMOffline/Trigger/python/PrimaryVertexMonitoring_cff.py @@ -9,19 +9,23 @@ hltPixelVerticesMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltPixelVertices") hltPixelVerticesMonitoring.vertexLabel = cms.InputTag("hltPixelVertices") hltPixelVerticesMonitoring.ndof = cms.int32(1) +hltPixelVerticesMonitoring.useHPforAlignmentPlots = cms.bool(False) hltTrimmedPixelVerticesMonitoring = hltVerticesMonitoring.clone() hltTrimmedPixelVerticesMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltTrimmedPixelVertices") hltTrimmedPixelVerticesMonitoring.vertexLabel = cms.InputTag("hltTrimmedPixelVertices") hltTrimmedPixelVerticesMonitoring.ndof = cms.int32(1) +hltTrimmedPixelVerticesMonitoring.useHPforAlignmentPlots = cms.bool(False) hltVerticesPFFilterMonitoring = hltVerticesMonitoring.clone() hltVerticesPFFilterMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltVerticesPFFilter") hltVerticesPFFilterMonitoring.vertexLabel = cms.InputTag("hltVerticesPFFilter") +hltVerticesPFFilterMonitoring.useHPforAlignmentPlots = cms.bool(False) hltVerticesL3PFBjetsMonitoring = hltVerticesMonitoring.clone() hltVerticesL3PFBjetsMonitoring.TopFolderName = cms.string("HLT/Vertexing/hltVerticesL3PFBjets") hltVerticesL3PFBjetsMonitoring.vertexLabel = cms.InputTag("hltVerticesL3PFBjets") +hltVerticesL3PFBjetsMonitoring.useHPforAlignmentPlots = cms.bool(False) vertexingMonitorHLT = cms.Sequence( hltPixelVerticesMonitoring From dd356340b022eb58ce13921a10273f0ca82af747 Mon Sep 17 00:00:00 2001 From: Chris Jones <chrisdjones15@gmail.com> Date: Tue, 11 May 2021 20:03:50 -0500 Subject: [PATCH 283/309] Moved ProductProvenanceRetriever to FWCore/Framework This allows DataFormats/Provenance to no longer depend upon FWCore/Concurrency. --- DataFormats/Provenance/BuildFile.xml | 1 - DataFormats/Provenance/interface/ProvenanceFwd.h | 1 - FWCore/Framework/interface/EventPrincipal.h | 2 +- .../Framework}/interface/ProductProvenanceRetriever.h | 4 ++-- .../Framework}/src/ProductProvenanceRetriever.cc | 2 +- FWCore/Framework/src/ProductResolvers.cc | 2 +- FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc | 2 +- IOPool/Output/src/PoolOutputModule.cc | 2 +- 8 files changed, 7 insertions(+), 9 deletions(-) rename {DataFormats/Provenance => FWCore/Framework}/interface/ProductProvenanceRetriever.h (95%) rename {DataFormats/Provenance => FWCore/Framework}/src/ProductProvenanceRetriever.cc (97%) diff --git a/DataFormats/Provenance/BuildFile.xml b/DataFormats/Provenance/BuildFile.xml index f7e648f4e31f5..35d18bc3e928e 100644 --- a/DataFormats/Provenance/BuildFile.xml +++ b/DataFormats/Provenance/BuildFile.xml @@ -1,6 +1,5 @@ <use name="FWCore/Utilities"/> <use name="FWCore/Reflection"/> -<use name="FWCore/Concurrency"/> <use name="rootcore"/> <use name="tbb"/> <export> diff --git a/DataFormats/Provenance/interface/ProvenanceFwd.h b/DataFormats/Provenance/interface/ProvenanceFwd.h index 622667dfe4bba..942dcbf1924b1 100644 --- a/DataFormats/Provenance/interface/ProvenanceFwd.h +++ b/DataFormats/Provenance/interface/ProvenanceFwd.h @@ -26,7 +26,6 @@ namespace edm { class StableProvenance; class Timestamp; class ProductProvenanceLookup; - class ProductProvenanceRetriever; } // namespace edm namespace cms { diff --git a/FWCore/Framework/interface/EventPrincipal.h b/FWCore/Framework/interface/EventPrincipal.h index 41c53cc2aa95d..bfc35e168b13c 100644 --- a/FWCore/Framework/interface/EventPrincipal.h +++ b/FWCore/Framework/interface/EventPrincipal.h @@ -14,7 +14,7 @@ is the DataBlock. #include "DataFormats/Common/interface/WrapperBase.h" #include "DataFormats/Provenance/interface/BranchListIndex.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/EventAuxiliary.h" #include "DataFormats/Provenance/interface/EventSelectionID.h" #include "FWCore/Utilities/interface/StreamID.h" diff --git a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h b/FWCore/Framework/interface/ProductProvenanceRetriever.h similarity index 95% rename from DataFormats/Provenance/interface/ProductProvenanceRetriever.h rename to FWCore/Framework/interface/ProductProvenanceRetriever.h index 946651e6f86ac..38703e1b207aa 100644 --- a/DataFormats/Provenance/interface/ProductProvenanceRetriever.h +++ b/FWCore/Framework/interface/ProductProvenanceRetriever.h @@ -1,5 +1,5 @@ -#ifndef DataFormats_Provenance_BranchMapper_h -#define DataFormats_Provenance_BranchMapper_h +#ifndef DataFormats_Provenance_ProductProvenanceRetriever_h +#define DataFormats_Provenance_ProductProvenanceRetriever_h /*---------------------------------------------------------------------- diff --git a/DataFormats/Provenance/src/ProductProvenanceRetriever.cc b/FWCore/Framework/src/ProductProvenanceRetriever.cc similarity index 97% rename from DataFormats/Provenance/src/ProductProvenanceRetriever.cc rename to FWCore/Framework/src/ProductProvenanceRetriever.cc index 99c5c10855c30..1c95398207800 100644 --- a/DataFormats/Provenance/src/ProductProvenanceRetriever.cc +++ b/FWCore/Framework/src/ProductProvenanceRetriever.cc @@ -1,4 +1,4 @@ -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "FWCore/Utilities/interface/EDMException.h" diff --git a/FWCore/Framework/src/ProductResolvers.cc b/FWCore/Framework/src/ProductResolvers.cc index feadb5cdea5f4..93b7c793aef5e 100644 --- a/FWCore/Framework/src/ProductResolvers.cc +++ b/FWCore/Framework/src/ProductResolvers.cc @@ -11,7 +11,7 @@ #include "FWCore/Framework/interface/SharedResourcesAcquirer.h" #include "FWCore/Framework/interface/DelayedReader.h" #include "FWCore/Framework/src/TransitionInfoTypes.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/BranchKey.h" #include "DataFormats/Provenance/interface/ParentageRegistry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" diff --git a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc index 165d6fb1fa573..01bdada2fa949 100644 --- a/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc +++ b/FWCore/TFWLiteSelector/src/TFWLiteSelectorBasic.cc @@ -20,7 +20,7 @@ #include "DataFormats/Provenance/interface/BranchIDList.h" #include "DataFormats/Provenance/interface/BranchIDListHelper.h" #include "DataFormats/Provenance/interface/BranchListIndex.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/BranchType.h" #include "DataFormats/Provenance/interface/EventAuxiliary.h" #include "DataFormats/Provenance/interface/EventEntryDescription.h" // kludge to allow compilation diff --git a/IOPool/Output/src/PoolOutputModule.cc b/IOPool/Output/src/PoolOutputModule.cc index efc96009a25dd..b0cdd8a0bc3bb 100644 --- a/IOPool/Output/src/PoolOutputModule.cc +++ b/IOPool/Output/src/PoolOutputModule.cc @@ -15,7 +15,7 @@ #include "DataFormats/Provenance/interface/Parentage.h" #include "DataFormats/Provenance/interface/ParentageRegistry.h" #include "DataFormats/Provenance/interface/ProductProvenance.h" -#include "DataFormats/Provenance/interface/ProductProvenanceRetriever.h" +#include "FWCore/Framework/interface/ProductProvenanceRetriever.h" #include "DataFormats/Provenance/interface/SubProcessParentageHelper.h" #include "FWCore/Utilities/interface/Algorithms.h" #include "FWCore/Utilities/interface/EDMException.h" From 19ef677e315c1e52946438aac17c4f4de84f2f3e Mon Sep 17 00:00:00 2001 From: Ashish Sharma <as59317@gmail.com> Date: Wed, 12 May 2021 09:03:19 +0530 Subject: [PATCH 284/309] Update QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py --- .../python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py index 3f56b43d74d00..68648d19e2bd6 100644 --- a/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CP5Settings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * generator = cms.EDFilter("Pythia8GeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(1), # put here the efficiency of your filter (1. if no filter) From 8247f9a13f239fdd9884982c3550a3f1c8ea31c5 Mon Sep 17 00:00:00 2001 From: Ashish Sharma <as59317@gmail.com> Date: Wed, 12 May 2021 09:05:24 +0530 Subject: [PATCH 285/309] Update TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py --- .../python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py b/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py index fe4cc50904e45..d94cb5b3caed2 100644 --- a/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py +++ b/Configuration/Generator/python/TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * -from Configuration.Generator.Pythia8CP5Settings_cfi import * +from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * generator = cms.EDFilter("Pythia8GeneratorFilter", pythiaHepMCVerbosity = cms.untracked.bool(False), From a8d640832a388fde69ac0b399fb3a08855814a3c Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury <suvankar.roy.chowdhury@cern.ch> Date: Wed, 12 May 2021 14:00:14 +0200 Subject: [PATCH 286/309] remove fall17v1 variable from nanoDQM --- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 1 + PhysicsTools/NanoAOD/python/nanoDQM_cfi.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index 21c4297d22c5c..d594df2db0595 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -43,6 +43,7 @@ #putting back the fall17V1 plots for non v9 case _Electron_plots_withFall17V1 = copy.deepcopy(nanoDQM.vplots.Electron.plots) +_Electron_plots_withFall17V1.append(Plot1D('cutBased_Fall17_V1', 'cutBased_Fall17_V1', 5, -0.5, 4.5, 'cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)')) _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso', 'mvaFall17V1Iso', 20, -1, 1, 'MVA Iso ID V1 score')) _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP80', 'mvaFall17V1Iso_WP80', 2, -0.5, 1.5, 'MVA Iso ID V1 WP80')) _Electron_plots_withFall17V1.append(Plot1D('mvaFall17V1Iso_WP90', 'mvaFall17V1Iso_WP90', 2, -0.5, 1.5, 'MVA Iso ID V1 WP90')) diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py index 748f0d7d17891..584d7937c2a9d 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cfi.py @@ -56,7 +56,6 @@ Plot1D('cleanmask', 'cleanmask', 1, 0.5, 1.5, 'simple cleaning mask with priority to leptons'), Plot1D('convVeto', 'convVeto', 2, -0.5, 1.5, 'pass conversion veto'), Plot1D('cutBased', 'cutBased', 5, -0.5, 4.5, 'cut-based ID (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'), - Plot1D('cutBased_Fall17_V1', 'cutBased_Fall17_V1', 5, -0.5, 4.5, 'cut-based ID Fall17 V1 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)'), Plot1D('cutBased_HEEP', 'cutBased_HEEP', 2, -0.5, 1.5, 'cut-based HEEP ID'), Plot1D('deltaEtaSC', 'deltaEtaSC', 20, -0.2, 0.2, 'delta eta (SC,ele) with sign'), Plot1D('dr03EcalRecHitSumEt', 'dr03EcalRecHitSumEt', 20, 0, 30, 'Non-PF Ecal isolation within a delta R cone of 0.3 with electron pt > 35 GeV'), From 87d57c7777ea900efab3801f48d60149068f21a6 Mon Sep 17 00:00:00 2001 From: Ianna Osborne <ianna.osborne@cern.ch> Date: Wed, 12 May 2021 14:06:02 +0200 Subject: [PATCH 287/309] as suggested by Vincenzo --- DataFormats/Math/interface/GeantUnits.h | 48 ++++++++++++------------ DataFormats/Math/interface/angle_units.h | 12 +++--- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/DataFormats/Math/interface/GeantUnits.h b/DataFormats/Math/interface/GeantUnits.h index 382c895e9e960..334d1a0668089 100644 --- a/DataFormats/Math/interface/GeantUnits.h +++ b/DataFormats/Math/interface/GeantUnits.h @@ -11,9 +11,9 @@ namespace geant_units { using angle_units::piRadians; // Needed by files the include this file - constexpr long double joule(6.24150e+12); - constexpr long double seconds(1.e+9); - constexpr long double nanoseconds(1.); + constexpr double joule(6.24150e+12); + constexpr double seconds(1.e+9); + constexpr double nanoseconds(1.); namespace operators { @@ -27,36 +27,36 @@ namespace geant_units { using angle_units::operators::convertRadToDeg; // Length - constexpr long double operator"" _mm(long double length) { return length * 1.; } - constexpr long double operator"" _cm(long double length) { return length * 10.; } - constexpr long double operator"" _m(long double length) { return length * 1000.; } - constexpr long double operator"" _cm3(long double length) { return length * 1._cm * 1._cm * 1._cm; } - constexpr long double operator"" _m3(long double length) { return length * 1._m * 1._m * 1._m; } - constexpr long double operator"" _mm(unsigned long long int length) { return length * 1; } - constexpr long double operator"" _cm(unsigned long long int length) { return length * 10; } + constexpr double operator"" _mm(long double length) { return length * 1.; } + constexpr double operator"" _cm(long double length) { return length * 10.; } + constexpr double operator"" _m(long double length) { return length * 1000.; } + constexpr double operator"" _cm3(long double length) { return length * 1._cm * 1._cm * 1._cm; } + constexpr double operator"" _m3(long double length) { return length * 1._m * 1._m * 1._m; } + constexpr double operator"" _mm(unsigned long long int length) { return length * 1; } + constexpr double operator"" _cm(unsigned long long int length) { return length * 10; } // Time - constexpr long double operator"" _s(long double x) { return x * seconds; } - constexpr long double operator"" _ns(long double x) { return x * nanoseconds; } + constexpr double operator"" _s(long double x) { return x * seconds; } + constexpr double operator"" _ns(long double x) { return x * nanoseconds; } // Energy - constexpr long double operator"" _MeV(long double energy) { return energy * 1.; } - constexpr long double operator"" _eV(long double energy) { return energy * 1.e-6_MeV; } - constexpr long double operator"" _TeV(long double energy) { return energy * 1.e6_MeV; } - constexpr long double operator"" _GeV(long double energy) { return energy * 1000._MeV; } + constexpr double operator"" _MeV(long double energy) { return energy * 1.; } + constexpr double operator"" _eV(long double energy) { return energy * 1.e-6_MeV; } + constexpr double operator"" _TeV(long double energy) { return energy * 1.e6_MeV; } + constexpr double operator"" _GeV(long double energy) { return energy * 1000._MeV; } // Mass - constexpr long double operator"" _kg(long double mass) { + constexpr double operator"" _kg(long double mass) { return mass * (1._eV / 1.602176487e-19) * 1._s * 1._s / (1._m * 1._m); } - constexpr long double operator"" _g(long double mass) { return mass * 1.e-3_kg; } - constexpr long double operator"" _mg(long double mass) { return mass * 1.e-3_g; } - constexpr long double operator"" _mole(long double mass) { return mass * 1.; } + constexpr double operator"" _g(long double mass) { return mass * 1.e-3_kg; } + constexpr double operator"" _mg(long double mass) { return mass * 1.e-3_g; } + constexpr double operator"" _mole(long double mass) { return mass * 1.; } // Material properties - constexpr long double operator"" _mg_per_cm3(long double density) { return density * 1._mg / 1._cm3; } - constexpr long double operator"" _g_per_cm3(long double density) { return density * 1._g / 1._cm3; } - constexpr long double operator"" _g_per_mole(long double mass) { return mass * 1._g / 1._mole; } + constexpr double operator"" _mg_per_cm3(long double density) { return density * 1._mg / 1._cm3; } + constexpr double operator"" _g_per_cm3(long double density) { return density * 1._g / 1._cm3; } + constexpr double operator"" _g_per_mole(long double mass) { return mass * 1._g / 1._mole; } template <class NumType> inline constexpr NumType convertMmToCm(NumType millimeters) // Millimeters -> centimeters @@ -96,7 +96,7 @@ namespace geant_units { // Convert Geant units to desired units template <class NumType> - inline constexpr NumType convertUnitsTo(long double desiredUnits, NumType val) { + inline constexpr NumType convertUnitsTo(double desiredUnits, NumType val) { return (val / desiredUnits); } } // namespace operators diff --git a/DataFormats/Math/interface/angle_units.h b/DataFormats/Math/interface/angle_units.h index 3895afbce17c7..bcdc44239fb9f 100644 --- a/DataFormats/Math/interface/angle_units.h +++ b/DataFormats/Math/interface/angle_units.h @@ -11,11 +11,11 @@ namespace angle_units { namespace operators { // Angle - constexpr long double operator"" _pi(long double x) { return x * piRadians; } - constexpr long double operator"" _pi(unsigned long long int x) { return x * piRadians; } - constexpr long double operator"" _deg(long double deg) { return deg / degPerRad; } - constexpr long double operator"" _deg(unsigned long long int deg) { return deg / degPerRad; } - constexpr long double operator"" _rad(long double rad) { return rad * 1.; } + constexpr double operator"" _pi(long double x) { return x * piRadians; } + constexpr double operator"" _pi(unsigned long long int x) { return x * piRadians; } + constexpr double operator"" _deg(long double deg) { return deg / degPerRad; } + constexpr double operator"" _deg(unsigned long long int deg) { return deg / degPerRad; } + constexpr double operator"" _rad(long double rad) { return rad * 1.; } template <class NumType> inline constexpr NumType convertRadToDeg(NumType radians) // Radians -> degrees @@ -24,7 +24,7 @@ namespace angle_units { } template <class NumType> - inline constexpr long double convertDegToRad(NumType degrees) // Degrees -> radians + inline constexpr double convertDegToRad(NumType degrees) // Degrees -> radians { return (degrees / degPerRad); } From 96dac4b188e43484d445e65975645450b7eb26b1 Mon Sep 17 00:00:00 2001 From: Jeongeun Lee <jeongeun.lee@cern.ch> Date: Wed, 12 May 2021 14:40:09 +0200 Subject: [PATCH 288/309] remove deprecated parameters --- .../python/particleFlowSuperClusterECALBox_cfi.py | 2 -- .../EgammaClusterProducers/src/PFECALSuperClusterProducer.cc | 3 --- 2 files changed, 5 deletions(-) diff --git a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py index 5e3bdbc77152b..cac511e28063d 100644 --- a/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py +++ b/RecoEcal/EgammaClusterProducers/python/particleFlowSuperClusterECALBox_cfi.py @@ -60,8 +60,6 @@ satelliteClusterSeedThreshold = 50.0, satelliteMajorityFraction = 0.5, dropUnseedable = False, - #thresh_PFClusterMustacheOutBarrel = cms.double(0.), - #thresh_PFClusterMustacheOutEndcap = cms.double(0.), # corrections applyCrackCorrections = False diff --git a/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc b/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc index 64946dfcc2ffa..9563c0aa86162 100644 --- a/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc +++ b/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc @@ -94,9 +94,6 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet& double phiwidthSuperClusterEndcap = iConfig.getParameter<double>("phiwidth_SuperClusterEndcap"); double etawidthSuperClusterEndcap = iConfig.getParameter<double>("etawidth_SuperClusterEndcap"); - //double threshPFClusterMustacheOutBarrel = iConfig.getParameter<double>("thresh_PFClusterMustacheOutBarrel"); - //double threshPFClusterMustacheOutEndcap = iConfig.getParameter<double>("thresh_PFClusterMustacheOutEndcap"); - double doSatelliteClusterMerge = iConfig.getParameter<bool>("doSatelliteClusterMerge"); double satelliteClusterSeedThreshold = iConfig.getParameter<double>("satelliteClusterSeedThreshold"); double satelliteMajorityFraction = iConfig.getParameter<double>("satelliteMajorityFraction"); From 4a4789cbcdbdcc227c7ba2ed1ebce392743d2bc6 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov <mrodozov@cern.ch> Date: Wed, 12 May 2021 15:18:13 +0200 Subject: [PATCH 289/309] Remove tests for root_numpy and root_pandas --- PhysicsTools/PythonAnalysis/test/BuildFile.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/PhysicsTools/PythonAnalysis/test/BuildFile.xml b/PhysicsTools/PythonAnalysis/test/BuildFile.xml index f8efe1e50bfbc..d4c584bffe3de 100644 --- a/PhysicsTools/PythonAnalysis/test/BuildFile.xml +++ b/PhysicsTools/PythonAnalysis/test/BuildFile.xml @@ -2,7 +2,6 @@ <use name="python_tools"/> <test name="testPandas" command="testPandas.py"/> -<test name="testRootNumpy" command="testRootNumpy.py"/> <test name="test_pycurl" command="test_pycurl.py"/> <test name="testBottleneck" command="testBottleneck.py"/> <test name="testNumExpr" command="testNumExpr.py"/> @@ -117,8 +116,6 @@ <test name="import-qtconsole" command="python3 -c 'import qtconsole'"/> <test name="import-rep" command="python3 -c 'import rep'"/> <test name="import-requests" command="python3 -c 'import requests'"/> -<test name="import-root_numpy" command="python3 -c 'import root_numpy'"/> -<test name="import-root_pandas" command="python3 -c 'import root_pandas'"/> <test name="import-scandir" command="python3 -c 'import scandir'"/> <test name="import-schema" command="python3 -c 'import schema'"/> <test name="import-sklearn" command="python3 -c 'import sklearn'"/> From fbe9015664856cbf5ba26cc96069ca398f11ff1d Mon Sep 17 00:00:00 2001 From: Mircho Rodozov <mrodozov@cern.ch> Date: Wed, 12 May 2021 15:25:12 +0200 Subject: [PATCH 290/309] remove file testRootNumpy.py --- .../PythonAnalysis/test/testRootNumpy.py | 71 ------------------- 1 file changed, 71 deletions(-) delete mode 100755 PhysicsTools/PythonAnalysis/test/testRootNumpy.py diff --git a/PhysicsTools/PythonAnalysis/test/testRootNumpy.py b/PhysicsTools/PythonAnalysis/test/testRootNumpy.py deleted file mode 100755 index 80f9e15f1f793..0000000000000 --- a/PhysicsTools/PythonAnalysis/test/testRootNumpy.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python3 -#taken from root_numpy examples -#https://rootpy.github.io/root_numpy/auto_examples/tmva/plot_regression.html -import matplotlib -matplotlib.use('Agg') - -import numpy as np -import matplotlib.pyplot as plt -from root_numpy.tmva import add_regression_events, evaluate_reader -from root_numpy import ROOT_VERSION -from ROOT import TMVA, TFile, TCut -from array import array - -plt.style.use('ggplot') -RNG = np.random.RandomState(1) - -# Create an example regression dataset -X = np.linspace(0, 6, 100)[:, np.newaxis] -y = np.sin(X).ravel() + \ - np.sin(6 * X).ravel() + \ - RNG.normal(0, 0.1, X.shape[0]) - -# Fit a regression model -output = TFile('tmva_output.root', 'recreate') -factory = TMVA.Factory('regressor', output, - 'AnalysisType=Regression:' - '!V:Silent:!DrawProgressBar') - -if ROOT_VERSION >= '6.07/04': - data = TMVA.DataLoader('.') -else: - data = factory -data.AddVariable('x', 'F') -data.AddTarget('y', 'F') - -add_regression_events(data, X, y) -add_regression_events(data, X, y, test=True) -# The following line is necessary if events have been added individually: -data.PrepareTrainingAndTestTree(TCut('1'), '') - - -if ROOT_VERSION >= '6.07/04': - BookMethod = factory.BookMethod -else: - BookMethod = TMVA.Factory.BookMethod -BookMethod(data, 'BDT', 'BDT1', - 'nCuts=20:NTrees=1:MaxDepth=4:BoostType=AdaBoostR2:' - 'SeparationType=RegressionVariance') -BookMethod(data, 'BDT', 'BDT2', - 'nCuts=20:NTrees=300:MaxDepth=4:BoostType=AdaBoostR2:' - 'SeparationType=RegressionVariance') -factory.TrainAllMethods() - -# Predict the regression target -reader = TMVA.Reader() -reader.AddVariable('x', array('f', [0.])) -reader.BookMVA('BDT1', 'weights/regressor_BDT1.weights.xml') -reader.BookMVA('BDT2', 'weights/regressor_BDT2.weights.xml') -y_1 = evaluate_reader(reader, 'BDT1', X) -y_2 = evaluate_reader(reader, 'BDT2', X) - -# Plot the results -plt.figure() -plt.scatter(X, y, c="k", label="training samples") -plt.plot(X, y_1, c="g", label="1 tree", linewidth=2) -plt.plot(X, y_2, c="r", label="300 trees", linewidth=2) -plt.xlabel("data") -plt.ylabel("target") -plt.title("Boosted Decision Tree Regression") -plt.legend() -plt.savefig('RootNumpy') From e027ab4bc21b0887235593019e8dbdefdd9beef7 Mon Sep 17 00:00:00 2001 From: Richard <Richard.J.Cavanaugh@gmail.com> Date: Wed, 12 May 2021 08:27:44 -0500 Subject: [PATCH 291/309] implements UPT invariant mass triggers in uGT emulator --- L1Trigger/L1TGlobal/interface/GlobalScales.h | 11 ++ .../L1TGlobal/plugins/TriggerMenuParser.cc | 121 ++++++++++++++---- .../L1TGlobal/plugins/TriggerMenuParser.h | 8 ++ L1Trigger/L1TGlobal/src/CorrCondition.cc | 43 ++++++- L1Trigger/L1TGlobal/src/GlobalScales.cc | 63 +++++++++ L1Trigger/L1TGlobal/src/MuonTemplate.cc | 4 + 6 files changed, 219 insertions(+), 31 deletions(-) diff --git a/L1Trigger/L1TGlobal/interface/GlobalScales.h b/L1Trigger/L1TGlobal/interface/GlobalScales.h index d401e7d3a570a..da4e827e36e1f 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalScales.h +++ b/L1Trigger/L1TGlobal/interface/GlobalScales.h @@ -38,6 +38,12 @@ namespace l1t { double etStep; std::vector<std::pair<double, double>> etBins; + // Added displaced muons + double uptMin; + double uptMax; + double uptStep; + std::vector<std::pair<double, double>> uptBins; + double phiMin; double phiMax; double phiStep; @@ -67,6 +73,7 @@ namespace l1t { virtual void setLUT_DeltaEta(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_DeltaPhi(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_Pt(const std::string& lutName, std::vector<long long> lut, unsigned int precision); + virtual void setLUT_Upt(const std::string& lutName, std::vector<long long> lut, unsigned int precision); // Added for displaced muons virtual void setLUT_Cosh(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_Cos(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_Sin(const std::string& lutName, std::vector<long long> lut, unsigned int precision); @@ -90,6 +97,7 @@ namespace l1t { long long getLUT_DeltaEta(std::string lutName, int element) const; long long getLUT_DeltaPhi(std::string lutName, int element) const; long long getLUT_Pt(const std::string& lutName, int element) const; + long long getLUT_Upt(const std::string& lutName, int element) const; // Added for displaced muons long long getLUT_DeltaEta_Cosh(std::string lutName, int element) const; long long getLUT_DeltaPhi_Cos(std::string lutName, int element) const; long long getLUT_Cos(const std::string& lutName, int element) const; @@ -98,6 +106,7 @@ namespace l1t { unsigned int getPrec_DeltaEta(const std::string& lutName) const; unsigned int getPrec_DeltaPhi(const std::string& lutName) const; unsigned int getPrec_Pt(const std::string& lutName) const; + unsigned int getPrec_Upt(const std::string& lutName) const; // Added for displaced muons unsigned int getPrec_DeltaEta_Cosh(const std::string& lutName) const; unsigned int getPrec_DeltaPhi_Cos(const std::string& lutName) const; unsigned int getPrec_Cos(const std::string& lutName) const; @@ -131,6 +140,7 @@ namespace l1t { std::map<std::string, std::vector<long long>> m_lut_DeltaEta; std::map<std::string, std::vector<long long>> m_lut_DeltaPhi; std::map<std::string, std::vector<long long>> m_lut_Pt; + std::map<std::string, std::vector<long long>> m_lut_Upt; // Added for displaced muons std::map<std::string, std::vector<long long>> m_lut_Cosh; std::map<std::string, std::vector<long long>> m_lut_Cos; std::map<std::string, std::vector<long long>> m_lut_Sin; @@ -139,6 +149,7 @@ namespace l1t { std::map<std::string, unsigned int> m_Prec_DeltaEta; std::map<std::string, unsigned int> m_Prec_DeltaPhi; std::map<std::string, unsigned int> m_Prec_Pt; + std::map<std::string, unsigned int> m_Prec_Upt; // Added for displaced muons std::map<std::string, unsigned int> m_Prec_Cosh; std::map<std::string, unsigned int> m_Prec_Cos; std::map<std::string, unsigned int> m_Prec_Sin; diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc index 099d05ec48eb1..662219c317ac5 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc @@ -12,6 +12,7 @@ * \new features: Vladimir Rekovic * - indexing * - correlations with overlap object removal + * - displaced muons by R.Cavanaugh * * $Date$ * $Revision$ @@ -297,7 +298,8 @@ void l1t::TriggerMenuParser::parseCondFormats(const L1TUtmTriggerMenu* utmMenu) condition.getType() == esConditionType::CaloCaloCorrelation || condition.getType() == esConditionType::CaloEsumCorrelation || condition.getType() == esConditionType::InvariantMass || - condition.getType() == esConditionType::TransverseMass) { + condition.getType() == esConditionType::TransverseMass || + condition.getType() == esConditionType::InvariantMassUpt) { // Added for displaced muons parseCorrelation(condition, chipNr); //parse Externals @@ -588,6 +590,19 @@ bool l1t::TriggerMenuParser::parseScales(std::map<std::string, tmeventsetup::esS } } } break; + case esScaleType::UnconstrainedPtScale: { // Added for displaced muons + scaleParam->uptMin = scale.getMinimum(); + scaleParam->uptMax = scale.getMaximum(); + scaleParam->uptStep = scale.getStep(); + + //Get bin edges + const std::vector<esBin>& binsV = scale.getBins(); + for (unsigned int i = 0; i < binsV.size(); i++) { + const esBin& bin = binsV.at(i); + std::pair<double, double> binLimits(bin.minimum, bin.maximum); + scaleParam->uptBins.push_back(binLimits); + } + } break; case esScaleType::EtaScale: { scaleParam->etaMin = scale.getMinimum(); scaleParam->etaMax = scale.getMaximum(); @@ -664,6 +679,7 @@ bool l1t::TriggerMenuParser::parseScales(std::map<std::string, tmeventsetup::esS // --------------- parsePt_LUTS(scaleMap, "Mass", "EG", precisions["PRECISION-EG-MU-MassPt"]); parsePt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]); + parseUpt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]); // Added for displaced muons parsePt_LUTS(scaleMap, "Mass", "JET", precisions["PRECISION-EG-JET-MassPt"]); parsePt_LUTS(scaleMap, "Mass", "TAU", precisions["PRECISION-EG-TAU-MassPt"]); parsePt_LUTS(scaleMap, "Mass", "ETM", precisions["PRECISION-EG-ETM-MassPt"]); @@ -850,6 +866,30 @@ void l1t::TriggerMenuParser::parsePt_LUTS(std::map<std::string, tmeventsetup::es m_gtScales.setLUT_Pt(lutpfx + "_" + scLabel1, lut_pt, prec); } +// Added for displaced muons +void l1t::TriggerMenuParser::parseUpt_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, + std::string lutpfx, + std::string obj1, + unsigned int prec) { + using namespace tmeventsetup; + + // First Delta Eta for this set + std::string scLabel1 = obj1; + scLabel1 += "-UPT"; + + //This LUT does not exist in L1 Menu file, don't fill it + if (scaleMap.find(scLabel1) == scaleMap.end()) + return; + + const esScale* scale1 = &scaleMap.find(scLabel1)->second; + + std::vector<long long> lut_pt; + getLut(lut_pt, scale1, prec); + + m_gtScales.setLUT_Upt(lutpfx + "_" + scLabel1, lut_pt, prec); +} + + void l1t::TriggerMenuParser::parseDeltaEta_Cosh_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, std::string obj1, std::string obj2, @@ -1068,10 +1108,10 @@ bool l1t::TriggerMenuParser::parseMuon(tmeventsetup::esCondition condMu, unsigne relativeBx = object.getBxOffset(); // Loop over the cuts for this object - int upperUnconstrainedPtInd = -1; - int lowerUnconstrainedPtInd = 0; - int upperImpactParameterInd = -1; - int lowerImpactParameterInd = 0; + int upperUnconstrainedPtInd = -1; + int lowerUnconstrainedPtInd = 0; + int upperImpactParameterInd = -1; + int lowerImpactParameterInd = 0; int upperThresholdInd = -1; int lowerThresholdInd = 0; int upperIndexInd = -1; @@ -1080,26 +1120,27 @@ bool l1t::TriggerMenuParser::parseMuon(tmeventsetup::esCondition condMu, unsigne unsigned int etaWindow1Lower = -1, etaWindow1Upper = -1, etaWindow2Lower = -1, etaWindow2Upper = -1; int cntPhi = 0; unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1; - int isolationLUT = 0xF; //default is to ignore unless specified. - int impactParameterLUT = 0xF; //default is to ignore unless specified - int charge = -1; //default value is to ignore unless specified - int qualityLUT = 0xFFFF; //default is to ignore unless specified. + int isolationLUT = 0xF; //default is to ignore unless specified. + int impactParameterLUT = 0xF; //default is to ignore unless specified + int charge = -1; //default value is to ignore unless specified + int qualityLUT = 0xFFFF; //default is to ignore unless specified. const std::vector<esCut>& cuts = object.getCuts(); for (size_t kk = 0; kk < cuts.size(); kk++) { const esCut cut = cuts.at(kk); switch (cut.getCutType()) { + case esCutType::UnconstrainedPt: - lowerUnconstrainedPtInd = cut.getMinimum().index; - upperUnconstrainedPtInd = cut.getMaximum().index; - break; + lowerUnconstrainedPtInd = cut.getMinimum().index; + upperUnconstrainedPtInd = cut.getMaximum().index; + break; case esCutType::ImpactParameter: - lowerImpactParameterInd = cut.getMinimum().index; - upperImpactParameterInd = cut.getMaximum().index; - impactParameterLUT = l1tstr2int(cut.getData()); - break; + lowerImpactParameterInd = cut.getMinimum().index; + upperImpactParameterInd = cut.getMaximum().index; + impactParameterLUT = l1tstr2int(cut.getData()); + break; case esCutType::Threshold: lowerThresholdInd = cut.getMinimum().index; @@ -1167,11 +1208,11 @@ bool l1t::TriggerMenuParser::parseMuon(tmeventsetup::esCondition condMu, unsigne } //end loop over cuts // Set the parameter cuts - objParameter[cnt].unconstrainedPtHigh = upperUnconstrainedPtInd; - objParameter[cnt].unconstrainedPtLow = lowerUnconstrainedPtInd; - objParameter[cnt].impactParameterHigh = upperImpactParameterInd; - objParameter[cnt].impactParameterLow = lowerImpactParameterInd; - objParameter[cnt].impactParameterLUT = impactParameterLUT; + objParameter[cnt].unconstrainedPtHigh = upperUnconstrainedPtInd; + objParameter[cnt].unconstrainedPtLow = lowerUnconstrainedPtInd; + objParameter[cnt].impactParameterHigh = upperImpactParameterInd; + objParameter[cnt].impactParameterLow = lowerImpactParameterInd; + objParameter[cnt].impactParameterLUT = impactParameterLUT; objParameter[cnt].ptHighThreshold = upperThresholdInd; objParameter[cnt].ptLowThreshold = lowerThresholdInd; @@ -1300,6 +1341,11 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, relativeBx = corrMu->getBxOffset(); // Loop over the cuts for this object + int upperUnconstrainedPtInd = -1; // Added for displaced muons + int lowerUnconstrainedPtInd = 0; // Added for displaced muons + int upperImpactParameterInd = -1; // Added for displaced muons + int lowerImpactParameterInd = 0; // Added for displaced muons + int impactParameterLUT = 0xF; // Added for displaced muons, default is to ignore unless specified int upperThresholdInd = -1; int lowerThresholdInd = 0; int upperIndexInd = -1; @@ -1317,6 +1363,17 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, const esCut cut = cuts.at(kk); switch (cut.getCutType()) { + case esCutType::UnconstrainedPt: // Added for displaced muons + lowerUnconstrainedPtInd = cut.getMinimum().index; + upperUnconstrainedPtInd = cut.getMaximum().index; + break; + + case esCutType::ImpactParameter: // Added for displaced muons + lowerImpactParameterInd = cut.getMinimum().index; + upperImpactParameterInd = cut.getMaximum().index; + impactParameterLUT = l1tstr2int(cut.getData()); + break; + case esCutType::Threshold: lowerThresholdInd = cut.getMinimum().index; upperThresholdInd = cut.getMaximum().index; @@ -1383,6 +1440,12 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, } //end loop over cuts // Set the parameter cuts + objParameter[0].unconstrainedPtHigh = upperUnconstrainedPtInd; // Added for displacd muons + objParameter[0].unconstrainedPtLow = lowerUnconstrainedPtInd; // Added for displacd muons + objParameter[0].impactParameterHigh = upperImpactParameterInd; // Added for displacd muons + objParameter[0].impactParameterLow = lowerImpactParameterInd; // Added for displacd muons + objParameter[0].impactParameterLUT = impactParameterLUT; // Added for displacd muons + objParameter[0].ptHighThreshold = upperThresholdInd; objParameter[0].ptLowThreshold = lowerThresholdInd; @@ -2576,14 +2639,20 @@ bool l1t::TriggerMenuParser::parseCorrelation(tmeventsetup::esCondition corrCond // cutType = cutType | 0x8; if (corrCond.getType() == esConditionType::TransverseMass) { cutType = cutType | 0x10; - //std::cout << "CCLA running Transverse mass cutType= " << cutType << std::endl; } else { cutType = cutType | 0x8; - //std::cout << "CCLA running Invarient mass cutType= " << cutType << std::endl; } - } - } - } + } else if (cut.getCutType() == esCutType::MassUpt) { // Added for displaced muons + LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tMass Cut minV = " << minV + << " Max = " << maxV << " precMin = " << cut.getMinimum().index + << " precMax = " << cut.getMaximum().index << std::endl; + corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index)); + corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index)); + corrParameter.precMassCut = cut.getMinimum().index; + cutType = cutType | 0x40; // Note: 0x40 (MassUpt) is next available bit after 0x20 (TwoBodyPt) + } // Careful: cutType carries same info as esCutType, but is hard coded!! + } // This seems like a historical hack, which may be error prone. + } // cutType is defined here, for use later in CorrCondition.cc corrParameter.corrCutType = cutType; // Get the two objects that form the legs diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h index e851103687885..7498df513532d 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h @@ -15,6 +15,8 @@ * \author Vladimir Rekovic * - indexing * - correlations with overlap object removal + * \author R. Cavanaugh + * - displaced muons * * $Date$ * $Revision$ @@ -294,6 +296,12 @@ namespace l1t { std::string obj1, unsigned int prec); + // Parse LUT for Upt LUT in Mass calculation for displaced muons + void parseUpt_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, + std::string lutpfx, + std::string obj1, + unsigned int prec); + // Parse LUT for Delta Eta and Cosh void parseDeltaEta_Cosh_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, std::string obj1, diff --git a/L1Trigger/L1TGlobal/src/CorrCondition.cc b/L1Trigger/L1TGlobal/src/CorrCondition.cc index 864971ae73f7f..d7aab1a88838e 100644 --- a/L1Trigger/L1TGlobal/src/CorrCondition.cc +++ b/L1Trigger/L1TGlobal/src/CorrCondition.cc @@ -321,6 +321,13 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { int etBin1 = 0; double et1Phy = 0.; + int uptIndex0 = 0; // Added displaced muons + int uptBin0 = 0; // Added displaced muons + double upt0Phy = 0.0; // Added displaced muons + int uptIndex1 = 0; // Added displaced muons + int uptBin1 = 0; // Added displaced muons + double upt1Phy = 0.0; // Added displaced muons + int chrg0 = -1; int chrg1 = -1; @@ -370,13 +377,14 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { phiIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPhiAtVtx(); //(*candMuVec)[obj0Index]->phiIndex(); etaIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwEtaAtVtx(); etIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPt(); + uptIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPtUnconstrained(); // Added for displaced muons chrg0 = (candMuVec->at(cond0bx, obj0Index))->hwCharge(); int etaBin0 = etaIndex0; if (etaBin0 < 0) etaBin0 = m_gtScales->getMUScales().etaBins.size() + etaBin0; //twos complement - // LogDebug("L1TGlobal") << "Muon phi" << phiIndex0 << " eta " << etaIndex0 << " etaBin0 = " << etaBin0 << " et " << etIndex0 << std::endl; etBin0 = etIndex0; + uptBin0 = uptIndex0; // Added for displaced muons int ssize = m_gtScales->getMUScales().etBins.size(); if (etBin0 >= ssize) { etBin0 = ssize - 1; @@ -390,7 +398,11 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { eta0Phy = 0.5 * (binEdges.second + binEdges.first); binEdges = m_gtScales->getMUScales().etBins.at(etBin0); et0Phy = 0.5 * (binEdges.second + binEdges.first); - + if( corrPar.corrCutType & 0x40 ) // Added for displaced muons + { + binEdges = m_gtScales->getMUScales().uptBins.at(uptBin0); + upt0Phy = 0.5 * (binEdges.second + binEdges.first); + } LogDebug("L1TGlobal") << "Found all quantities for the muon 0" << std::endl; } break; @@ -646,6 +658,7 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { phiIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPhiAtVtx(); //(*candMuVec)[obj0Index]->phiIndex(); etaIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwEtaAtVtx(); etIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPt(); + uptIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPtUnconstrained(); // Added for displaced muons chrg1 = (candMuVec->at(cond1bx, obj1Index))->hwCharge(); etaBin1 = etaIndex1; if (etaBin1 < 0) @@ -653,6 +666,7 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { // LogDebug("L1TGlobal") << "Muon phi" << phiIndex1 << " eta " << etaIndex1 << " etaBin1 = " << etaBin1 << " et " << etIndex1 << std::endl; etBin1 = etIndex1; + uptBin1 = uptIndex1; // Added for displaced muons int ssize = m_gtScales->getMUScales().etBins.size(); if (etBin1 >= ssize) { LogTrace("L1TGlobal") << "muon2 hw et" << etBin1 << " out of scale range. Setting to maximum."; @@ -666,7 +680,12 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { eta1Phy = 0.5 * (binEdges.second + binEdges.first); binEdges = m_gtScales->getMUScales().etBins.at(etBin1); et1Phy = 0.5 * (binEdges.second + binEdges.first); - + if( corrPar.corrCutType & 0x40 ) // Added for displaced muons + { + binEdges = m_gtScales->getMUScales().uptBins.at(uptBin1); + upt1Phy = 0.5 * (binEdges.second + binEdges.first); + } + LogDebug("L1TGlobal") << "Found all quantities for the muon 1" << std::endl; } break; case CondCalo: { switch (cndObjTypeVec[1]) { @@ -1149,7 +1168,7 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { } } - if (corrPar.corrCutType & 0x8 || corrPar.corrCutType & 0x10) { + if (corrPar.corrCutType & 0x8 || corrPar.corrCutType & 0x10 || corrPar.corrCutType & 0x40) { // added 0x40 for massUpt //invariant mass calculation based on // M = sqrt(2*p1*p2(cosh(eta1-eta2) - cos(phi1 - phi2))) // but we calculate (1/2)M^2 @@ -1159,6 +1178,8 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { if (corrPar.corrCutType & 0x10) coshDeltaEtaPhy = 1.; double massSqPhy = et0Phy * et1Phy * (coshDeltaEtaPhy - cosDeltaPhiPhy); + if( corrPar.corrCutType & 0x40 ) // Added for displaced muons + massSqPhy = upt0Phy * upt1Phy * (coshDeltaEtaPhy - cosDeltaPhiPhy); long long cosDeltaPhiLUT = m_gtScales->getLUT_DeltaPhi_Cos(lutName, deltaPhiFW); unsigned int precCosLUT = m_gtScales->getPrec_DeltaPhi_Cos(lutName); @@ -1184,6 +1205,19 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { long long ptObj1 = m_gtScales->getLUT_Pt("Mass_" + lutName, etIndex1); unsigned int precPtLUTObj1 = m_gtScales->getPrec_Pt("Mass_" + lutName); + if( corrPar.corrCutType & 0x40 ) // Added for displaced muons + { + lutName = lutObj0; + lutName += "-UPT"; + ptObj0 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex0); + precPtLUTObj0 = m_gtScales->getPrec_Upt("Mass_" + lutName); + + lutName = lutObj1; + lutName += "-UPT"; + ptObj1 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex1); + precPtLUTObj1 = m_gtScales->getPrec_Upt("Mass_" + lutName); + } + // Pt and Angles are at different precission. long long massSq = ptObj0 * ptObj1 * (coshDeltaEtaLUT - cosDeltaPhiLUT); @@ -1214,7 +1248,6 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { LogDebug("L1TGlobal") << " Passed Invariant Mass Cut [" << (long long)(corrPar.minMassCutValue * pow(10, preShift)) << "," << (long long)(corrPar.maxMassCutValue * pow(10, preShift)) << "]" << std::endl; - } else { LogDebug("L1TGlobal") << " Failed Invariant Mass Cut [" << (long long)(corrPar.minMassCutValue * pow(10, preShift)) << "," diff --git a/L1Trigger/L1TGlobal/src/GlobalScales.cc b/L1Trigger/L1TGlobal/src/GlobalScales.cc index 38d1513e34a17..482bad0a4ca72 100644 --- a/L1Trigger/L1TGlobal/src/GlobalScales.cc +++ b/L1Trigger/L1TGlobal/src/GlobalScales.cc @@ -98,6 +98,22 @@ void l1t::GlobalScales::setLUT_Pt(const std::string& lutName, std::vector<long l return; } +// Added for displaced muons +void l1t::GlobalScales::setLUT_Upt(const std::string& lutName, std::vector<long long> lut, unsigned int precision) { + if (m_lut_Upt.count(lutName) != 0) { + LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!" + << std::endl; + return; + } + + // Insert this LUT into the Table + m_lut_Upt.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut)); + m_Prec_Upt.insert(std::map<std::string, unsigned int>::value_type(lutName, precision)); + + return; +} + + void l1t::GlobalScales::setLUT_Cosh(const std::string& lutName, std::vector<long long> lut, unsigned int precision) { if (m_lut_Cosh.count(lutName) != 0) { LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!" @@ -303,6 +319,33 @@ unsigned int l1t::GlobalScales::getPrec_Pt(const std::string& lutName) const { return value; } +// Added for displaced muons +long long l1t::GlobalScales::getLUT_Upt(const std::string& lutName, int element) const { + long long value = 0; + + if (element < 0) { + edm::LogError("GlobalScales") << "Error: Negative index, " << element << ", requested for Upt LUT ( " << lutName + << ")" << std::endl; + } else if (element >= (int)m_lut_Upt.find(lutName)->second.size()) { + edm::LogError("GlobalScales") << "Error: Element Requested " << element << " too large for Upt LUT (" << lutName + << ") size = " << m_lut_Upt.find(lutName)->second.size() << std::endl; + } else { + value = m_lut_Upt.find(lutName)->second.at(element); + } + return value; +} +// Added for displaced muons +unsigned int l1t::GlobalScales::getPrec_Upt(const std::string& lutName) const { + unsigned int value = 0; + + if (m_Prec_Upt.find(lutName) != m_Prec_Upt.end()) { + value = m_Prec_Upt.find(lutName)->second; + } else { + edm::LogError("GlobalScales") << "Warning: LUT " << lutName << " for Upt not found" << std::endl; + } + return value; +} + long long l1t::GlobalScales::getLUT_DeltaEta_Cosh(std::string lutName, int element) const { long long value = 0; @@ -520,6 +563,12 @@ void l1t::GlobalScales::dumpAllLUTs(std::ostream& myCout) const { itr++) { dumpLUT(myCout, 8, itr->first); } + // Added for displaced muons + for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Upt.begin(); itr != m_lut_Upt.end(); + itr++) { + dumpLUT(myCout, 8, itr->first); + } + } void l1t::GlobalScales::dumpLUT(std::ostream& myCout, int LUTtype, std::string name) const { @@ -573,6 +622,12 @@ void l1t::GlobalScales::dumpLUT(std::ostream& myCout, int LUTtype, std::string n type = "Pt"; break; } + case 9: { // Added for displaced muons + dumpV = m_lut_Upt.find(name)->second; + prec = m_Prec_Upt.find(name)->second; + type = "Upt"; + break; + } } myCout << "=========================================" << std::endl; @@ -672,6 +727,14 @@ void l1t::GlobalScales::print(std::ostream& myCout) const { myCout << " " << itr->first; } myCout << std::endl; + + // Added for displaced muons + myCout << " Upt: "; + for (std::map<std::string, std::vector<long long>>::const_iterator itr = m_lut_Upt.begin(); itr != m_lut_Upt.end(); + itr++) { + myCout << " " << itr->first; + } + myCout << std::endl; } void l1t::GlobalScales::printScale(ScaleParameters scale, std::ostream& myCout) const { myCout << " Pt Min = " << std::setw(10) << scale.etMin << " Pt Max = " << std::setw(10) << scale.etMax diff --git a/L1Trigger/L1TGlobal/src/MuonTemplate.cc b/L1Trigger/L1TGlobal/src/MuonTemplate.cc index 880f4ea03ac2a..32166135c25f0 100644 --- a/L1Trigger/L1TGlobal/src/MuonTemplate.cc +++ b/L1Trigger/L1TGlobal/src/MuonTemplate.cc @@ -9,6 +9,7 @@ * * \author: Vasile Mihai Ghete - HEPHY Vienna * Vladimir Rekovic - extend for indexing + * Rick Cavanaugh - extend for displaced muons * * $Date$ * $Revision$ @@ -79,6 +80,8 @@ void MuonTemplate::print(std::ostream& myCout) const { myCout << " Template for object " << i << " [ hex ]" << std::endl; myCout << " ptHighThreshold = " << std::hex << m_objectParameter[i].ptHighThreshold << std::endl; myCout << " ptLowThreshold = " << std::hex << m_objectParameter[i].ptLowThreshold << std::endl; + myCout << " uptHighCut = " << std::hex << m_objectParameter[i].unconstrainedPtHigh << std::endl; + myCout << " uptLowCut = " << std::hex << m_objectParameter[i].unconstrainedPtLow << std::endl; myCout << " indexHigh = " << std::hex << m_objectParameter[i].indexHigh << std::endl; myCout << " indexLow = " << std::hex << m_objectParameter[i].indexLow << std::endl; myCout << " enableMip = " << std::hex << m_objectParameter[i].enableMip << std::endl; @@ -87,6 +90,7 @@ void MuonTemplate::print(std::ostream& myCout) const { myCout << " charge =" << std::dec << m_objectParameter[i].charge << std::endl; myCout << " qualityLUT = " << std::hex << m_objectParameter[i].qualityLUT << std::endl; myCout << " isolationLUT = " << std::hex << m_objectParameter[i].isolationLUT << std::endl; + myCout << " impactParameterLUT= " << std::hex << m_objectParameter[i].impactParameterLUT << std::endl; // myCout << " etaRange = " // << std::hex << m_objectParameter[i].etaRange << std::endl; // myCout << " phiHigh = " From 27227db14b3ea47aaeab9382e0f10a3b46cd867f Mon Sep 17 00:00:00 2001 From: Jeongeun Lee <jeongeun.lee@cern.ch> Date: Wed, 12 May 2021 16:20:07 +0200 Subject: [PATCH 292/309] remove deprecated parameters --- .../EgammaClusterProducers/src/PFECALSuperClusterProducer.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc b/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc index 9563c0aa86162..7624d7de8f52c 100644 --- a/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc +++ b/RecoEcal/EgammaClusterProducers/src/PFECALSuperClusterProducer.cc @@ -121,8 +121,6 @@ PFECALSuperClusterProducer::PFECALSuperClusterProducer(const edm::ParameterSet& superClusterAlgo_.setSatelliteThreshold(satelliteClusterSeedThreshold); superClusterAlgo_.setMajorityFraction(satelliteMajorityFraction); superClusterAlgo_.setDropUnseedable(dropUnseedable); - //superClusterAlgo_.setThreshPFClusterMustacheOutBarrel( threshPFClusterMustacheOutBarrel ); - //superClusterAlgo_.setThreshPFClusterMustacheOutEndcap( threshPFClusterMustacheOutEndcap ); //Load the ECAL energy calibration thePFEnergyCalibration_ = std::make_shared<PFEnergyCalibration>(); From c1d7b4d05dda572af8fb642d9e5a924489be17c8 Mon Sep 17 00:00:00 2001 From: mmusich <marco.musich@cern.ch> Date: Wed, 12 May 2021 15:22:48 +0200 Subject: [PATCH 293/309] introduce DiMuonVertexValidation in Alignment validation suite --- .../plugins/DiMuonVertexValidation.cc | 703 ++++++++++++++++++ .../test/DiMuonVertexValidation_cfg.py | 253 +++++++ Alignment/OfflineValidation/test/test_all.sh | 2 + 3 files changed, 958 insertions(+) create mode 100644 Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc create mode 100644 Alignment/OfflineValidation/test/DiMuonVertexValidation_cfg.py diff --git a/Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc b/Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc new file mode 100644 index 0000000000000..64a433f0f25cd --- /dev/null +++ b/Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc @@ -0,0 +1,703 @@ +// -*- C++ -*- +// +// Package: Alignment/OfflineValidation +// Class: DiMuonVertexValidation +// +/**\class DiMuonVertexValidation DiMuonVertexValidation.cc Alignment/OfflineValidation/plugins/DiMuonVertexValidation.cc + + Description: Class to perform validation Tracker Alignment Validations by means of a PV and the SV constructed with a di-muon pair + +*/ +// +// Original Author: Marco Musich +// Created: Wed, 21 Apr 2021 09:06:25 GMT +// +// + +// system include files +#include <memory> +#include <utility> +#include <fmt/printf.h> + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.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" + +// muons +#include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "DataFormats/MuonReco/interface/Muon.h" +#include "DataFormats/MuonReco/interface/MuonSelectors.h" + +// utils +#include "DataFormats/Math/interface/deltaR.h" +#include "TLorentzVector.h" + +// tracks +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "RecoVertex/VertexPrimitives/interface/TransientVertex.h" +#include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" + +// vertices +#include "RecoVertex/VertexTools/interface/VertexDistanceXY.h" +#include "RecoVertex/VertexTools/interface/VertexDistance3D.h" +#include "CommonTools/UtilAlgos/interface/TFileService.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +// ROOT +#include "TH1F.h" +#include "TH2F.h" + +//#define LogDebug(X) std::cout << X << + +// +// Ancillary class for plotting +// +class PlotsVsDiMuKinematics { +public: + PlotsVsDiMuKinematics() : m_name(""), m_title(""), m_ytitle(""), m_isBooked(false) {} + + //________________________________________________________________________________// + // overloaded constructor + PlotsVsDiMuKinematics(const std::string& name, const std::string& tt, const std::string& ytt) + : m_name(name), m_title(tt), m_ytitle(ytt), m_isBooked(false) {} + + ~PlotsVsDiMuKinematics() = default; + + //________________________________________________________________________________// + void bookFromPSet(const TFileDirectory& fs, const edm::ParameterSet& hpar) { + std::string namePostfix; + std::string titlePostfix; + float xmin, xmax; + + for (const auto& xAx : axisChoices) { + switch (xAx) { + case xAxis::Z_PHI: + xmin = -M_PI; + xmax = M_PI; + namePostfix = "MuMuPhi"; + titlePostfix = "#mu#mu pair #phi;#mu^{+}#mu^{-} #phi"; + break; + case xAxis::Z_ETA: + xmin = -3.5; + xmax = 3.5; + namePostfix = "MuMuEta"; + titlePostfix = "#mu#mu pair #eta;#mu^{+}#mu^{-} #eta"; + break; + case xAxis::MP_PHI: + xmin = -M_PI; + xmax = M_PI; + namePostfix = "MuPlusPhi"; + titlePostfix = "#mu^{+} #phi;#mu^{+} #phi [rad]"; + break; + case xAxis::MP_ETA: + xmin = -2.4; + xmax = 2.4; + namePostfix = "MuPlusEta"; + titlePostfix = "#mu^{+} #eta;#mu^{+} #eta"; + break; + case xAxis::MM_PHI: + xmin = -M_PI; + xmax = M_PI; + namePostfix = "MuMinusPhi"; + titlePostfix = "#mu^{-} #phi;#mu^{-} #phi [rad]"; + break; + case xAxis::MM_ETA: + xmin = -2.4; + xmax = 2.4; + namePostfix = "MuMinusEta"; + titlePostfix = "#mu^{-} #eta;#mu^{+} #eta"; + break; + default: + throw cms::Exception("LogicalError") << " there is not such Axis choice as " << xAx; + } + + const auto& h2name = fmt::sprintf("%sVs%s", hpar.getParameter<std::string>("name"), namePostfix); + const auto& h2title = fmt::sprintf("%s vs %s;%s% s", + hpar.getParameter<std::string>("title"), + titlePostfix, + hpar.getParameter<std::string>("title"), + hpar.getParameter<std::string>("yUnits")); + + m_h2_map[xAx] = fs.make<TH2F>(h2name.c_str(), + h2title.c_str(), + hpar.getParameter<int32_t>("NxBins"), + xmin, + xmax, + hpar.getParameter<int32_t>("NyBins"), + hpar.getParameter<double>("ymin"), + hpar.getParameter<double>("ymax")); + } + + // flip the is booked bit + m_isBooked = true; + } + + //________________________________________________________________________________// + void bookPlots(TFileDirectory& fs, const float valmin, const float valmax, const int nxbins, const int nybins) { + if (m_name.empty() && m_title.empty() && m_ytitle.empty()) { + edm::LogError("PlotsVsDiMuKinematics") + << "In" << __FUNCTION__ << "," << __LINE__ + << "trying to book plots without the right constructor being called!" << std::endl; + return; + } + + static constexpr float maxMuEta = 2.4; + static constexpr float maxMuMuEta = 3.5; + TH1F::SetDefaultSumw2(kTRUE); + + // clang-format off + m_h2_map[xAxis::Z_ETA] = fs.make<TH2F>(fmt::sprintf("%sVsMuMuEta", m_name).c_str(), + fmt::sprintf("%s vs #mu#mu pair #eta;#mu^{+}#mu^{-} #eta;%s", m_title, m_ytitle).c_str(), + nxbins, -M_PI, M_PI, + nybins, valmin, valmax); + + m_h2_map[xAxis::Z_PHI] = fs.make<TH2F>(fmt::sprintf("%sVsMuMuPhi", m_name).c_str(), + fmt::sprintf("%s vs #mu#mu pair #phi;#mu^{+}#mu^{-} #phi [rad];%s", m_title, m_ytitle).c_str(), + nxbins, -maxMuMuEta, maxMuMuEta, + nybins, valmin, valmax); + + m_h2_map[xAxis::MP_ETA] = fs.make<TH2F>(fmt::sprintf("%sVsMuPlusEta", m_name).c_str(), + fmt::sprintf("%s vs #mu^{+} #eta;#mu^{+} #eta;%s", m_title, m_ytitle).c_str(), + nxbins, -maxMuEta, maxMuEta, + nybins, valmin, valmax); + + m_h2_map[xAxis::MP_PHI] = fs.make<TH2F>(fmt::sprintf("%sVsMuPlusPhi", m_name).c_str(), + fmt::sprintf("%s vs #mu^{+} #phi;#mu^{+} #phi [rad];%s", m_title, m_ytitle).c_str(), + nxbins, -M_PI, M_PI, + nybins, valmin, valmax); + + m_h2_map[xAxis::MM_ETA] = fs.make<TH2F>(fmt::sprintf("%sVsMuMinusEta", m_name).c_str(), + fmt::sprintf("%s vs #mu^{-} #eta;#mu^{-} #eta;%s", m_title, m_ytitle).c_str(), + nxbins, -maxMuEta, maxMuEta, + nybins, valmin, valmax); + + m_h2_map[xAxis::MM_PHI] = fs.make<TH2F>(fmt::sprintf("%sVsMuMinusPhi", m_name).c_str(), + fmt::sprintf("%s vs #mu^{-} #phi;#mu^{-} #phi [rad];%s", m_title, m_ytitle).c_str(), + nxbins, -M_PI, M_PI, + nybins, valmin, valmax); + // clang-format on + + // flip the is booked bit + m_isBooked = true; + } + + //________________________________________________________________________________// + void fillPlots(const float val, const std::pair<TLorentzVector, TLorentzVector>& momenta) { + if (!m_isBooked) { + edm::LogError("PlotsVsDiMuKinematics") + << "In" << __FUNCTION__ << "," << __LINE__ << "trying to fill a plot not booked!" << std::endl; + return; + } + + m_h2_map[xAxis::Z_ETA]->Fill((momenta.first + momenta.second).Eta(), val); + m_h2_map[xAxis::Z_PHI]->Fill((momenta.first + momenta.second).Phi(), val); + m_h2_map[xAxis::MP_ETA]->Fill((momenta.first).Eta(), val); + m_h2_map[xAxis::MP_PHI]->Fill((momenta.first).Phi(), val); + m_h2_map[xAxis::MM_ETA]->Fill((momenta.second).Eta(), val); + m_h2_map[xAxis::MM_PHI]->Fill((momenta.second).Phi(), val); + } + +private: + enum xAxis { Z_PHI, Z_ETA, MP_PHI, MP_ETA, MM_PHI, MM_ETA }; + const std::vector<xAxis> axisChoices = { + xAxis::Z_PHI, xAxis::Z_ETA, xAxis::MP_PHI, xAxis::MP_ETA, xAxis::MM_PHI, xAxis::MM_ETA}; + + const std::string m_name; + const std::string m_title; + const std::string m_ytitle; + + bool m_isBooked; + + std::map<xAxis, TH2F*> m_h2_map; +}; + +// +// class declaration +// + +class DiMuonVertexValidation : public edm::one::EDAnalyzer<edm::one::SharedResources> { +public: + explicit DiMuonVertexValidation(const edm::ParameterSet&); + ~DiMuonVertexValidation() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + // ----------member data --------------------------- + + std::vector<double> pTthresholds_; + float maxSVdist_; + + // plot configurations + + edm::ParameterSet CosPhiConfiguration_; + edm::ParameterSet CosPhi3DConfiguration_; + edm::ParameterSet VtxProbConfiguration_; + edm::ParameterSet VtxDistConfiguration_; + edm::ParameterSet VtxDist3DConfiguration_; + edm::ParameterSet VtxDistSigConfiguration_; + edm::ParameterSet VtxDist3DSigConfiguration_; + edm::ParameterSet DiMuMassConfiguration_; + + // control plots + + TH1F* hSVProb_; + TH1F* hSVDist_; + TH1F* hSVDistSig_; + TH1F* hSVDist3D_; + TH1F* hSVDist3DSig_; + + TH1F* hCosPhi_; + TH1F* hCosPhi3D_; + TH1F* hCosPhiInv_; + TH1F* hCosPhiInv3D_; + + TH1F* hInvMass_; + TH1F* hTrackInvMass_; + + // 2D maps + + PlotsVsDiMuKinematics CosPhiPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics CosPhi3DPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxProbPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDistPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDist3DPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDistSigPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics VtxDist3DSigPlots = PlotsVsDiMuKinematics(); + PlotsVsDiMuKinematics ZMassPlots = PlotsVsDiMuKinematics(); + + const edm::ESGetToken<TransientTrackBuilder, TransientTrackRecord> ttbESToken_; + + edm::EDGetTokenT<reco::TrackCollection> tracksToken_; //used to select what tracks to read from configuration file + edm::EDGetTokenT<reco::MuonCollection> muonsToken_; //used to select what tracks to read from configuration file + edm::EDGetTokenT<reco::VertexCollection> vertexToken_; //used to select what vertices to read from configuration file +}; + +// +// constants, enums and typedefs +// + +static constexpr float cmToum = 10e4; + +// +// static data member definitions +// + +// +// constructors and destructor +// +DiMuonVertexValidation::DiMuonVertexValidation(const edm::ParameterSet& iConfig) + : pTthresholds_(iConfig.getParameter<std::vector<double>>("pTThresholds")), + maxSVdist_(iConfig.getParameter<double>("maxSVdist")), + CosPhiConfiguration_(iConfig.getParameter<edm::ParameterSet>("CosPhiConfig")), + CosPhi3DConfiguration_(iConfig.getParameter<edm::ParameterSet>("CosPhi3DConfig")), + VtxProbConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxProbConfig")), + VtxDistConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDistConfig")), + VtxDist3DConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDist3DConfig")), + VtxDistSigConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDistSigConfig")), + VtxDist3DSigConfiguration_(iConfig.getParameter<edm::ParameterSet>("VtxDist3DSigConfig")), + DiMuMassConfiguration_(iConfig.getParameter<edm::ParameterSet>("DiMuMassConfig")), + ttbESToken_(esConsumes(edm::ESInputTag("", "TransientTrackBuilder"))), + tracksToken_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"))), + muonsToken_(consumes<reco::MuonCollection>(iConfig.getParameter<edm::InputTag>("muons"))), + vertexToken_(consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertices"))) { + usesResource(TFileService::kSharedResource); + + // sort the vector of thresholds + std::sort(pTthresholds_.begin(), pTthresholds_.end(), [](const double& lhs, const double& rhs) { return lhs > rhs; }); + + edm::LogInfo("DiMuonVertexValidation") << __FUNCTION__; + for (const auto& thr : pTthresholds_) { + edm::LogInfo("DiMuonVertexValidation") << " Threshold: " << thr << " "; + } + edm::LogInfo("DiMuonVertexValidation") << "\n Max SV distance: " << maxSVdist_ << " "; +} + +DiMuonVertexValidation::~DiMuonVertexValidation() = default; + +// +// member functions +// + +// ------------ method called for each event ------------ +void DiMuonVertexValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + + // select the good muons + std::vector<const reco::Muon*> myGoodMuonVector; + for (const auto& muon : iEvent.get(muonsToken_)) { + const reco::TrackRef t = muon.innerTrack(); + if (!t.isNull()) { + if (t->quality(reco::TrackBase::highPurity)) { + if (t->chi2() / t->ndof() <= 2.5 && t->numberOfValidHits() >= 5 && + t->hitPattern().numberOfValidPixelHits() >= 2 && t->quality(reco::TrackBase::highPurity)) + myGoodMuonVector.emplace_back(&muon); + } + } + } + + LogDebug("DiMuonVertexValidation") << "myGoodMuonVector size: " << myGoodMuonVector.size() << std::endl; + std::sort(myGoodMuonVector.begin(), myGoodMuonVector.end(), [](const reco::Muon*& lhs, const reco::Muon*& rhs) { + return lhs->pt() > rhs->pt(); + }); + + // just check the ordering + for (const auto& muon : myGoodMuonVector) { + LogDebug("DiMuonVertexValidation") << "pT: " << muon->pt() << " "; + } + LogDebug("DiMuonVertexValidation") << std::endl; + + // reject if there's no Z + if (myGoodMuonVector.size() < 2) + return; + if ((myGoodMuonVector[0]->pt()) < pTthresholds_[0] || (myGoodMuonVector[1]->pt() < pTthresholds_[1])) + return; + if (myGoodMuonVector[0]->charge() * myGoodMuonVector[1]->charge() > 0) + return; + + const auto& m1 = myGoodMuonVector[1]->p4(); + const auto& m0 = myGoodMuonVector[0]->p4(); + const auto& mother = m0 + m1; + + float invMass = mother.M(); + hInvMass_->Fill(invMass); + + // just copy the top two muons + std::vector<const reco::Muon*> theZMuonVector; + theZMuonVector.reserve(2); + theZMuonVector.emplace_back(myGoodMuonVector[1]); + theZMuonVector.emplace_back(myGoodMuonVector[0]); + + // do the matching of Z muons with inner tracks + std::vector<const reco::Track*> myTracks; + + unsigned int i = 0; + for (const auto& muon : theZMuonVector) { + i++; + float minD = 1000.; + const reco::Track* theMatch = nullptr; + for (const auto& track : iEvent.get(tracksToken_)) { + float D = ::deltaR(muon->eta(), muon->phi(), track.eta(), track.phi()); + if (D < minD) { + minD = D; + theMatch = &track; + } + } + LogDebug("DiMuonVertexValidation") << "pushing new track: " << i << std::endl; + myTracks.emplace_back(theMatch); + } + + LogDebug("DiMuonVertexValidation") << "selected tracks: " << myTracks.size() << std::endl; + + const TransientTrackBuilder* theB = &iSetup.getData(ttbESToken_); + TransientVertex aTransientVertex; + std::vector<reco::TransientTrack> tks; + + if (myTracks.size() != 2) + return; + + const auto& t1 = myTracks[1]->momentum(); + const auto& t0 = myTracks[0]->momentum(); + const auto& ditrack = t1 + t0; + + const auto& tplus = myTracks[0]->charge() > 0 ? myTracks[0] : myTracks[1]; + const auto& tminus = myTracks[0]->charge() < 0 ? myTracks[0] : myTracks[1]; + + static constexpr float mumass = 0.105658367; //mu mass (GeV/c^2) + + TLorentzVector p4_tplus(tplus->px(), tplus->py(), tplus->pz(), sqrt((tplus->p() * tplus->p()) + (mumass * mumass))); + TLorentzVector p4_tminus( + tminus->px(), tminus->py(), tminus->pz(), sqrt((tminus->p() * tminus->p()) + (mumass * mumass))); + + const auto& Zp4 = p4_tplus + p4_tminus; + float track_invMass = Zp4.M(); + hTrackInvMass_->Fill(track_invMass); + + // creat the pair of TLorentVectors used to make the plos + std::pair<TLorentzVector, TLorentzVector> tktk_p4 = std::make_pair(p4_tplus, p4_tminus); + + // fill the z->mm mass plots + ZMassPlots.fillPlots(track_invMass, tktk_p4); + + math::XYZPoint ZpT(ditrack.x(), ditrack.y(), 0); + math::XYZPoint Zp(ditrack.x(), ditrack.y(), ditrack.z()); + + for (const auto& track : myTracks) { + reco::TransientTrack trajectory = theB->build(track); + tks.push_back(trajectory); + } + + KalmanVertexFitter kalman(true); + aTransientVertex = kalman.vertex(tks); + + double SVProb = TMath::Prob(aTransientVertex.totalChiSquared(), (int)aTransientVertex.degreesOfFreedom()); + + LogDebug("DiMuonVertexValidation") << " vertex prob: " << SVProb << std::endl; + + hSVProb_->Fill(SVProb); + + if (!aTransientVertex.isValid()) + return; + + // fill the VtxProb plots + VtxProbPlots.fillPlots(SVProb, tktk_p4); + + // get collection of reconstructed vertices from event + edm::Handle<reco::VertexCollection> vertexHandle = iEvent.getHandle(vertexToken_); + + math::XYZPoint MainVertex(0, 0, 0); + reco::Vertex TheMainVertex = vertexHandle.product()->front(); + + if (vertexHandle.isValid()) { + const reco::VertexCollection* vertices = vertexHandle.product(); + if ((*vertices).at(0).isValid()) { + auto theMainVtx = (*vertices).at(0); + MainVertex.SetXYZ(theMainVtx.position().x(), theMainVtx.position().y(), theMainVtx.position().z()); + } + } + + const math::XYZPoint myVertex( + aTransientVertex.position().x(), aTransientVertex.position().y(), aTransientVertex.position().z()); + const math::XYZPoint deltaVtx( + MainVertex.x() - myVertex.x(), MainVertex.y() - myVertex.y(), MainVertex.z() - myVertex.z()); + + if (TheMainVertex.isValid()) { + // Z Vertex distance in the xy plane + + VertexDistanceXY vertTool; + double distance = vertTool.distance(aTransientVertex, TheMainVertex).value(); + double dist_err = vertTool.distance(aTransientVertex, TheMainVertex).error(); + + hSVDist_->Fill(distance * cmToum); + hSVDistSig_->Fill(distance / dist_err); + + // fill the VtxDist plots + VtxDistPlots.fillPlots(distance * cmToum, tktk_p4); + + // fill the VtxDisSig plots + VtxDistSigPlots.fillPlots(distance / dist_err, tktk_p4); + + // Z Vertex distance in 3D + + VertexDistance3D vertTool3D; + double distance3D = vertTool3D.distance(aTransientVertex, TheMainVertex).value(); + double dist3D_err = vertTool3D.distance(aTransientVertex, TheMainVertex).error(); + + hSVDist3D_->Fill(distance3D * cmToum); + hSVDist3DSig_->Fill(distance3D / dist3D_err); + + // fill the VtxDist3D plots + VtxDist3DPlots.fillPlots(distance3D * cmToum, tktk_p4); + + // fill the VtxDisSig plots + VtxDist3DSigPlots.fillPlots(distance3D / dist3D_err, tktk_p4); + + LogDebug("DiMuonVertexValidation") << "distance: " << distance << "+/-" << dist_err << std::endl; + // cut on the PV - SV distance + if (distance * cmToum < maxSVdist_) { + double cosphi = (ZpT.x() * deltaVtx.x() + ZpT.y() * deltaVtx.y()) / + (sqrt(ZpT.x() * ZpT.x() + ZpT.y() * ZpT.y()) * + sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y())); + + double cosphi3D = (Zp.x() * deltaVtx.x() + Zp.y() * deltaVtx.y() + Zp.z() * deltaVtx.z()) / + (sqrt(Zp.x() * Zp.x() + Zp.y() * Zp.y() + Zp.z() * Zp.z()) * + sqrt(deltaVtx.x() * deltaVtx.x() + deltaVtx.y() * deltaVtx.y() + deltaVtx.z() * deltaVtx.z())); + + LogDebug("DiMuonVertexValidation") << "cos(phi) = " << cosphi << std::endl; + + hCosPhi_->Fill(cosphi); + hCosPhi3D_->Fill(cosphi3D); + + // fill the cosphi plots + CosPhiPlots.fillPlots(cosphi, tktk_p4); + + // fill the VtxDisSig plots + CosPhi3DPlots.fillPlots(cosphi3D, tktk_p4); + } + } +} + +// ------------ method called once each job just before starting event loop ------------ +void DiMuonVertexValidation::beginJob() { + edm::Service<TFileService> fs; + + // clang-format off + TH1F::SetDefaultSumw2(kTRUE); + hSVProb_ = fs->make<TH1F>("VtxProb", ";ZV vertex probability;N(#mu#mu pairs)", 100, 0., 1.); + + hSVDist_ = fs->make<TH1F>("VtxDist", ";PV-ZV xy distance [#mum];N(#mu#mu pairs)", 100, 0., 300.); + hSVDistSig_ = fs->make<TH1F>("VtxDistSig", ";PV-ZV xy distance signficance;N(#mu#mu pairs)", 100, 0., 5.); + + hSVDist3D_ = fs->make<TH1F>("VtxDist3D", ";PV-ZV 3D distance [#mum];N(#mu#mu pairs)", 100, 0., 300.); + hSVDist3DSig_ = fs->make<TH1F>("VtxDist3DSig", ";PV-ZV 3D distance signficance;N(#mu#mu pairs)", 100, 0., 5.); + + hInvMass_ = fs->make<TH1F>("InvMass", ";M(#mu#mu) [GeV];N(#mu#mu pairs)", 70., 50., 120.); + hTrackInvMass_ = fs->make<TH1F>("TkTkInvMass", ";M(tk,tk) [GeV];N(tk tk pairs)", 70., 50., 120.); + + hCosPhi_ = fs->make<TH1F>("CosPhi", ";cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.); + hCosPhi3D_ = fs->make<TH1F>("CosPhi3D", ";cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.); + + hCosPhiInv_ = fs->make<TH1F>("CosPhiInv", ";inverted cos(#phi_{xy});N(#mu#mu pairs)", 50, -1., 1.); + hCosPhiInv3D_ = fs->make<TH1F>("CosPhiInv3D", ";inverted cos(#phi_{3D});N(#mu#mu pairs)", 50, -1., 1.); + // clang-format on + + // 2D Maps + + TFileDirectory dirCosPhi = fs->mkdir("CosPhiPlots"); + CosPhiPlots.bookFromPSet(dirCosPhi, CosPhiConfiguration_); + + TFileDirectory dirCosPhi3D = fs->mkdir("CosPhi3DPlots"); + CosPhi3DPlots.bookFromPSet(dirCosPhi3D, CosPhi3DConfiguration_); + + TFileDirectory dirVtxProb = fs->mkdir("VtxProbPlots"); + VtxProbPlots.bookFromPSet(dirVtxProb, VtxProbConfiguration_); + + TFileDirectory dirVtxDist = fs->mkdir("VtxDistPlots"); + VtxDistPlots.bookFromPSet(dirVtxDist, VtxDistConfiguration_); + + TFileDirectory dirVtxDist3D = fs->mkdir("VtxDist3DPlots"); + VtxDist3DPlots.bookFromPSet(dirVtxDist3D, VtxDist3DConfiguration_); + + TFileDirectory dirVtxDistSig = fs->mkdir("VtxDistSigPlots"); + VtxDistSigPlots.bookFromPSet(dirVtxDistSig, VtxDistSigConfiguration_); + + TFileDirectory dirVtxDist3DSig = fs->mkdir("VtxDist3DSigPlots"); + VtxDist3DSigPlots.bookFromPSet(dirVtxDist3DSig, VtxDist3DSigConfiguration_); + + TFileDirectory dirInvariantMass = fs->mkdir("InvariantMassPlots"); + ZMassPlots.bookFromPSet(dirInvariantMass, DiMuMassConfiguration_); +} + +// ------------ method called once each job just after ending the event loop ------------ +void DiMuonVertexValidation::endJob() { + TH1F::SetDefaultSumw2(kTRUE); + const unsigned int nBinsX = hCosPhi_->GetNbinsX(); + for (unsigned int i = 1; i <= nBinsX; i++) { + //float binContent = hCosPhi_->GetBinContent(i); + float invertedBinContent = hCosPhi_->GetBinContent(nBinsX + 1 - i); + float invertedBinError = hCosPhi_->GetBinError(nBinsX + 1 - i); + hCosPhiInv_->SetBinContent(i, invertedBinContent); + hCosPhiInv_->SetBinError(i, invertedBinError); + + //float binContent3D = hCosPhi3D_->GetBinContent(i); + float invertedBinContent3D = hCosPhi3D_->GetBinContent(nBinsX + 1 - i); + float invertedBinError3D = hCosPhi3D_->GetBinError(nBinsX + 1 - i); + hCosPhiInv3D_->SetBinContent(i, invertedBinContent3D); + hCosPhiInv3D_->SetBinError(i, invertedBinError3D); + } +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void DiMuonVertexValidation::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add<edm::InputTag>("tracks", edm::InputTag("generalTracks")); + desc.add<edm::InputTag>("muons", edm::InputTag("muons")); + desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices")); + desc.add<std::vector<double>>("pTThresholds", {30., 10.}); + desc.add<double>("maxSVdist", 50.); + + { + edm::ParameterSetDescription psDiMuMass; + psDiMuMass.add<std::string>("name", "DiMuMass"); + psDiMuMass.add<std::string>("title", "M(#mu#mu)"); + psDiMuMass.add<std::string>("yUnits", "[GeV]"); + psDiMuMass.add<int>("NxBins", 24); + psDiMuMass.add<int>("NyBins", 50); + psDiMuMass.add<double>("ymin", 70.); + psDiMuMass.add<double>("ymax", 120.); + desc.add<edm::ParameterSetDescription>("DiMuMassConfig", psDiMuMass); + } + { + edm::ParameterSetDescription psCosPhi; + psCosPhi.add<std::string>("name", "CosPhi"); + psCosPhi.add<std::string>("title", "cos(#phi_{xy})"); + psCosPhi.add<std::string>("yUnits", ""); + psCosPhi.add<int>("NxBins", 50); + psCosPhi.add<int>("NyBins", 50); + psCosPhi.add<double>("ymin", -1.); + psCosPhi.add<double>("ymax", 1.); + desc.add<edm::ParameterSetDescription>("CosPhiConfig", psCosPhi); + } + { + edm::ParameterSetDescription psCosPhi3D; + psCosPhi3D.add<std::string>("name", "CosPhi3D"); + psCosPhi3D.add<std::string>("title", "cos(#phi_{3D})"); + psCosPhi3D.add<std::string>("yUnits", ""); + psCosPhi3D.add<int>("NxBins", 50); + psCosPhi3D.add<int>("NyBins", 50); + psCosPhi3D.add<double>("ymin", -1.); + psCosPhi3D.add<double>("ymax", 1.); + desc.add<edm::ParameterSetDescription>("CosPhi3DConfig", psCosPhi3D); + } + { + edm::ParameterSetDescription psVtxProb; + psVtxProb.add<std::string>("name", "VtxProb"); + psVtxProb.add<std::string>("title", "Prob(#chi^{2}_{SV})"); + psVtxProb.add<std::string>("yUnits", ""); + psVtxProb.add<int>("NxBins", 50); + psVtxProb.add<int>("NyBins", 50); + psVtxProb.add<double>("ymin", 0); + psVtxProb.add<double>("ymax", 1.); + desc.add<edm::ParameterSetDescription>("VtxProbConfig", psVtxProb); + } + { + edm::ParameterSetDescription psVtxDist; + psVtxDist.add<std::string>("name", "VtxDist"); + psVtxDist.add<std::string>("title", "d_{xy}(PV,SV)"); + psVtxDist.add<std::string>("yUnits", "[#mum]"); + psVtxDist.add<int>("NxBins", 50); + psVtxDist.add<int>("NyBins", 100); + psVtxDist.add<double>("ymin", 0); + psVtxDist.add<double>("ymax", 300.); + desc.add<edm::ParameterSetDescription>("VtxDistConfig", psVtxDist); + } + { + edm::ParameterSetDescription psVtxDist3D; + psVtxDist3D.add<std::string>("name", "VtxDist3D"); + psVtxDist3D.add<std::string>("title", "d_{3D}(PV,SV)"); + psVtxDist3D.add<std::string>("yUnits", "[#mum]"); + psVtxDist3D.add<int>("NxBins", 50); + psVtxDist3D.add<int>("NyBins", 250); + psVtxDist3D.add<double>("ymin", 0); + psVtxDist3D.add<double>("ymax", 500.); + desc.add<edm::ParameterSetDescription>("VtxDist3DConfig", psVtxDist3D); + } + { + edm::ParameterSetDescription psVtxDistSig; + psVtxDistSig.add<std::string>("name", "VtxDistSig"); + psVtxDistSig.add<std::string>("title", "d_{xy}(PV,SV)/#sigma_{dxy}(PV,SV)"); + psVtxDistSig.add<std::string>("yUnits", ""); + psVtxDistSig.add<int>("NxBins", 50); + psVtxDistSig.add<int>("NyBins", 100); + psVtxDistSig.add<double>("ymin", 0); + psVtxDistSig.add<double>("ymax", 5.); + desc.add<edm::ParameterSetDescription>("VtxDistSigConfig", psVtxDistSig); + } + { + edm::ParameterSetDescription psVtxDist3DSig; + psVtxDist3DSig.add<std::string>("name", "VtxDist3DSig"); + psVtxDist3DSig.add<std::string>("title", "d_{3D}(PV,SV)/#sigma_{d3D}(PV,SV)"); + psVtxDist3DSig.add<std::string>("yUnits", ""); + psVtxDist3DSig.add<int>("NxBins", 50); + psVtxDist3DSig.add<int>("NyBins", 100); + psVtxDist3DSig.add<double>("ymin", 0); + psVtxDist3DSig.add<double>("ymax", 5.); + desc.add<edm::ParameterSetDescription>("VtxDist3DSigConfig", psVtxDist3DSig); + } + + descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(DiMuonVertexValidation); diff --git a/Alignment/OfflineValidation/test/DiMuonVertexValidation_cfg.py b/Alignment/OfflineValidation/test/DiMuonVertexValidation_cfg.py new file mode 100644 index 0000000000000..b06f58ab7868f --- /dev/null +++ b/Alignment/OfflineValidation/test/DiMuonVertexValidation_cfg.py @@ -0,0 +1,253 @@ +from __future__ import print_function +from fnmatch import fnmatch +import FWCore.ParameterSet.Config as cms +import FWCore.Utilities.FileUtils as FileUtils +import FWCore.ParameterSet.VarParsing as VarParsing +import sys + +from Configuration.StandardSequences.Eras import eras + +################################################################### +def best_match(rcd): +################################################################### + ''' + find out where to best match the input conditions + ''' + print(rcd) + for pattern, string in connection_map: + print(pattern, fnmatch(rcd, pattern)) + if fnmatch(rcd, pattern): + return string + +options = VarParsing.VarParsing () +options.register('maxEvents', + -1, + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "number of events to process (\"-1\" for all)") +options.register ('era', + '2017', # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "CMS running era") + +options.register ('GlobalTag', + '113X_mc2017_realistic_v4', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "seed number") + +options.register ('records', + [], + VarParsing.VarParsing.multiplicity.list, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "record:tag names to be used/changed from GT") + +options.register ('external', + [], + VarParsing.VarParsing.multiplicity.list, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "record:fle.db picks the following record from this external file") + +options.register ('myseed', + '1', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "seed number") + +options.register ('myfile', + 'root://cms-xrd-global.cern.ch//store/relval/CMSSW_10_6_1/RelValZMM_13/GEN-SIM-RECO/PU25ns_106X_mc2017_realistic_v6_HS-v1/10000/44690279-DDF3-0D43-B92D-F5CB57EF7E6A.root', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "file name") + +options.register ('FileList', + '', # default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "FileList in DAS format") + +options.register ('outputName', + 'default', # default value + VarParsing.VarParsing.multiplicity.singleton, # singleton or list + VarParsing.VarParsing.varType.string, # string, int, or float + "output file") + +options.parseArguments() + +if(options.FileList): + print("FileList: ", options.FileList) +else: + print("inputFile: ", options.myfile) +print("outputFile: ", "DiMuonVertexValidation_{fname}_{fseed}.root".format(fname = options.outputName,fseed=options.myseed)) +print("era: ", options.era) +print("conditionGT: ", options.GlobalTag) +print("conditionOverwrite: ", options.records) +print("external conditions:", options.external) +print("max events: ", options.maxEvents) + +if options.era=='2016': + print("===> running era 2016") + process = cms.Process('Analysis',eras.Run2_2016) +elif options.era=='2017': + print("===> running era 2017") + process = cms.Process('Analysis',eras.Run2_2017) +elif options.era=='2018': + print("===> running era 2018") + process = cms.Process('Analysis',eras.Run2_2018) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('Configuration.StandardSequences.GeometryRecoDB_cff') +process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +################################################################### +# Tell the program where to find the conditons +connection_map = [ + ('Tracker*', 'frontier://PromptProd/CMS_CONDITIONS'), + ('SiPixel*', 'frontier://PromptProd/CMS_CONDITIONS'), + ('SiStrip*', 'frontier://PromptProd/CMS_CONDITIONS'), + ('Beam*', 'frontier://PromptProd/CMS_CONDITIONS'), + ] + +if options.external: + connection_map.extend( + (i.split(':')[0], 'sqlite_file:%s' % i.split(':')[1]) for i in options.external + ) + +connection_map.sort(key=lambda x: -1*len(x[0])) + +################################################################### +# creat the map for the GT toGet +records = [] +if options.records: + for record in options.records: + rcd, tag = tuple(record.split(':')) + print("control point:",rcd,tag) + if len(rcd)==0: + print("no overriding will occur") + continue + records.append( + cms.PSet( + record = cms.string(rcd), + tag = cms.string(tag), + connect = cms.string(best_match(rcd)) + ) + ) + +################################################################### +# configure the Global Tag +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, options.GlobalTag, '') +process.GlobalTag.toGet = cms.VPSet(*records) + +''' +process.GlobalTag.toGet = cms.VPSet( + cms.PSet(record = cms.string("TrackerAlignmentRcd"), + tag = cms.string("TrackerAlignment_Upgrade2017_design_v4"), + #tag = cms.string("TrackerAlignment_2017_ultralegacymc_v1"), + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") + ), + cms.PSet(record = cms.string("TrackerAlignmentErrorExtendedRcd"), + tag = cms.string("TrackerAlignmentErrorsExtended_Upgrade2017_design_v0"), + #tag = cms.string("TrackerAlignmentExtendedErrors_2017_ultralegacymc_v1"), + connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS") + ) +) +''' + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) ) + +#process.load('FWCore.MessageService.MessageLogger_cfi') +#process.MessageLogger.cerr.FwkReport.reportEvery = 1000 + +################################################################### +# Messages +################################################################### +process.load('FWCore.MessageService.MessageLogger_cfi') +process.MessageLogger.cerr.enable = False +process.MessageLogger.DiMuonVertexValidation=dict() +process.MessageLogger.cout = cms.untracked.PSet( + enable = cms.untracked.bool(True), + threshold = cms.untracked.string("INFO"), + default = cms.untracked.PSet(limit = cms.untracked.int32(0)), + FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1), + reportEvery = cms.untracked.int32(1000) + ), + DiMuonVertexValidation = cms.untracked.PSet( limit = cms.untracked.int32(-1)), + enableStatistics = cms.untracked.bool(True) + ) + +################################################################### +# Source +################################################################### +if(options.FileList): + print('Loading file list from ASCII file') + filelist = FileUtils.loadListFromFile (options.FileList) + readFiles = cms.untracked.vstring( *filelist) +else: + readFiles = cms.untracked.vstring([options.myfile]) + +process.source = cms.Source("PoolSource", + fileNames = readFiles, + #skipEvents = cms.untracked.uint32(45000) +) + +################################################################### +# TransientTrack from https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideTransientTracks +################################################################### +process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi") +process.load('TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorOpposite_cfi') +process.load('TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi') +process.load('TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff') + +#################################################################### +# Get the BeamSpot +#################################################################### +process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff") + +#################################################################### +# Track Refitter +#################################################################### +process.load("RecoTracker.TrackProducer.TrackRefitters_cff") +import RecoTracker.TrackProducer.TrackRefitters_cff +process.TrackRefitter = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone() +process.TrackRefitter.src = "generalTracks" +process.TrackRefitter.TrajectoryInEvent = True +process.TrackRefitter.NavigationSchool = '' +process.TrackRefitter.TTRHBuilder = "WithAngleAndTemplate" + +#################################################################### +# Sequence +#################################################################### +process.seqTrackselRefit = cms.Sequence(process.offlineBeamSpot* + # in case NavigatioSchool is set !='' + #process.MeasurementTrackerEvent* + process.TrackRefitter) + +#################################################################### +# Re-do vertices +#################################################################### +from RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi import offlinePrimaryVertices +process.offlinePrimaryVerticesFromRefittedTrks = offlinePrimaryVertices.clone() +process.offlinePrimaryVerticesFromRefittedTrks.TrackLabel = cms.InputTag("TrackRefitter") + +#################################################################### +# Output file +#################################################################### +process.TFileService = cms.Service("TFileService",fileName=cms.string("DiMuonVertexValidation_"+options.outputName+"_"+options.myseed+".root")) + +# Additional output definition +process.analysis = cms.EDAnalyzer("DiMuonVertexValidation", + muons = cms.InputTag('muons'), + #tracks = cms.InputTag('generalTracks'), + tracks = cms.InputTag('TrackRefitter'), + vertices = cms.InputTag('offlinePrimaryVerticesFromRefittedTrks')) + +#################################################################### +# Path +#################################################################### +process.p = cms.Path(process.seqTrackselRefit + + process.offlinePrimaryVerticesFromRefittedTrks + + process.analysis) diff --git a/Alignment/OfflineValidation/test/test_all.sh b/Alignment/OfflineValidation/test/test_all.sh index 1f809c9e19ca0..0501533bbb3c9 100755 --- a/Alignment/OfflineValidation/test/test_all.sh +++ b/Alignment/OfflineValidation/test/test_all.sh @@ -9,6 +9,8 @@ if test -f "validation_config.ini"; then rm -f validation_config.ini fi +cmsRun ${LOCAL_TEST_DIR}/DiMuonVertexValidation_cfg.py maxEvents=10 || die "Failure running DiMuonVertexValidation_cfg.py" $? + ## copy into local sqlite file the ideal alignment echo "COPYING locally Ideal Alignment ..." conddb --yes --db pro copy TrackerAlignment_Upgrade2017_design_v4 --destdb myfile.db From e6d27d0cd38863302ed311b27c6415db6fb32e76 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Wed, 12 May 2021 18:05:29 +0200 Subject: [PATCH 294/309] fixes by Emily --- L1Trigger/L1TTrackMatch/BuildFile.xml | 8 ++++---- L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc | 10 +++++++--- L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc | 8 ++++++-- .../L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc | 8 -------- .../L1TTrackMatch/python/L1TkHTMissProducer_cfi.py | 10 ++++++++-- .../L1TTrackMatch/python/L1TrackJetProducer_cfi.py | 8 ++++++-- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/BuildFile.xml b/L1Trigger/L1TTrackMatch/BuildFile.xml index 0492571718a2f..7b5913dda03b6 100644 --- a/L1Trigger/L1TTrackMatch/BuildFile.xml +++ b/L1Trigger/L1TTrackMatch/BuildFile.xml @@ -9,10 +9,10 @@ <use name="L1Trigger/L1TMuon"/> <use name="L1Trigger/L1TMuonEndCap"/> <use name="RecoJets/JetAlgorithms"/> -<use name="boost"/> -<use name="xerces-c"/> -<use name="FWCore/Utilities"/> -<use name="L1Trigger/TrackFindingTMTT"/> +<use name="boost"/> +<use name="xerces-c"/> +<use name="FWCore/Utilities"/> +<use name="L1Trigger/TrackFindingTMTT"/> <use name="clhep"/> <use name="root"/> <use name="rootrflx"/> diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc index 073f5d1b865fe..099c03ecfe9e2 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TkHTMissProducer.cc @@ -36,7 +36,9 @@ class L1TkHTMissProducer : public edm::EDProducer { bool primaryVtxConstrain_; // use event primary vertex instead of leading jet (if doVtxConstrain) bool useCaloJets_; // Determines whether or not calo jets are used float deltaZ_; // for jets [cm] (if DoTvxConstrain) - bool displaced_; // Use prompt/displaced tracks + float minJetEtLowPt_; // for track jets, minimum et required, depending on number of low pT tracks + float minJetEtHighPt_; + bool displaced_; // Use prompt/displaced tracks unsigned int minNtracksHighPt_; unsigned int minNtracksLowPt_; const edm::EDGetTokenT<TkPrimaryVertexCollection> pvToken_; @@ -54,6 +56,8 @@ L1TkHTMissProducer::L1TkHTMissProducer(const edm::ParameterSet& iConfig) deltaZ_ = (float)iConfig.getParameter<double>("deltaZ"); minNtracksHighPt_ = iConfig.getParameter<int>("jet_minNtracksHighPt"); minNtracksLowPt_ = iConfig.getParameter<int>("jet_minNtracksLowPt"); + minJetEtLowPt_ = iConfig.getParameter<double>("jet_minJetEtLowPt"); + minJetEtHighPt_ = iConfig.getParameter<double>("jet_minJetEtHighPt"); displaced_ = iConfig.getParameter<bool>("displaced"); if (useCaloJets_) @@ -207,9 +211,9 @@ void L1TkHTMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSet continue; if (fabs(jetIter->eta()) > jetMaxEta_) continue; - if (jetIter->ntracks() < minNtracksLowPt_ && tmp_jet_et > 50) + if (jetIter->ntracks() < minNtracksLowPt_ && tmp_jet_et > minJetEtLowPt_) continue; - if (jetIter->ntracks() < minNtracksHighPt_ && tmp_jet_et > 100) + if (jetIter->ntracks() < minNtracksHighPt_ && tmp_jet_et > minJetEtHighPt_) continue; sumPx += tmp_jet_px; sumPy += tmp_jet_py; diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc index 6dd9086154ae3..7cc773ea687cd 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackJetProducer.cc @@ -80,6 +80,8 @@ class L1TrackJetProducer : public stream::EDProducer<> { int etaBins_; int phiBins_; double minTrkJetpT_; + double minJetEtLowPt_; + double minJetEtHighPt_; float zStep_; float etaStep_; float phiStep_; @@ -107,6 +109,8 @@ L1TrackJetProducer::L1TrackJetProducer(const ParameterSet &iConfig) trkBendChi2Max_ = (float)iConfig.getParameter<double>("trk_bendChi2Max"); trkNPSStubMin_ = (int)iConfig.getParameter<int>("trk_nPSStubMin"); minTrkJetpT_ = iConfig.getParameter<double>("minTrkJetpT"); + minJetEtLowPt_ = iConfig.getParameter<double>("minJetEtLowPt"); + minJetEtHighPt_ = iConfig.getParameter<double>("minJetEtHighPt"); etaBins_ = (int)iConfig.getParameter<int>("etaBins"); phiBins_ = (int)iConfig.getParameter<int>("phiBins"); zBins_ = (int)iConfig.getParameter<int>("zBins"); @@ -510,9 +514,9 @@ void L1TrackJetProducer::L2_cluster( // sum up all pTs in this zbin to find ht float ht = 0; for (int k = 0; k < nclust; ++k) { - if (L2cluster[k].pTtot > 50 && L2cluster[k].numtracks < lowpTJetMinTrackMultiplicity_) + if (L2cluster[k].pTtot > minJetEtLowPt_ && L2cluster[k].numtracks < lowpTJetMinTrackMultiplicity_) continue; - if (L2cluster[k].pTtot > 100 && L2cluster[k].numtracks < highpTJetMinTrackMultiplicity_) + if (L2cluster[k].pTtot > minJetEtHighPt_ && L2cluster[k].numtracks < highpTJetMinTrackMultiplicity_) continue; if (L2cluster[k].pTtot > minTrkJetpT_) ht += L2cluster[k].pTtot; diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc index 8e5be97a10a45..e577ac4c380d5 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackObjectNtupleMaker.cc @@ -808,14 +808,6 @@ void L1TrackObjectNtupleMaker::beginJob() { eventTree->Branch("allstub_genuine", &m_allstub_genuine); } - // if (TrackingInJets) { - // eventTree->Branch("jet_eta", &m_jet_eta); - // eventTree->Branch("jet_phi", &m_jet_phi); - // eventTree->Branch("jet_pt", &m_jet_pt); - // eventTree->Branch("jet_tp_sumpt", &m_jet_tp_sumpt); - // eventTree->Branch("jet_trk_sumpt", &m_jet_trk_sumpt); - // eventTree->Branch("jet_matchtrk_sumpt", &m_jet_matchtrk_sumpt); - // } if (SaveTrackJets) { // eventTree->Branch("pv_L1recotruesumpt", &m_pv_L1recotruesumpt); // eventTree->Branch("pv_L1recosumpt", &m_pv_L1recosumpt); diff --git a/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py index 001e67a9c2b66..e3124647b245b 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TkHTMissProducer_cfi.py @@ -5,8 +5,10 @@ L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), jet_maxEta = cms.double(2.2), # maximum eta of jets for HT jet_minPt = cms.double(15.0), # minimum pt of jets for HT [GeV] - jet_minNtracksHighPt=cms.int32(0), #Add track jet quality criteria pT>100 - jet_minNtracksLowPt=cms.int32(0), #Add track jet quality criteria pT>50 + jet_minNtracksHighPt=cms.int32(0), #Add track jet quality criteria pT>100 + jet_minNtracksLowPt=cms.int32(0), #Add track jet quality criteria pT>50 + jet_minJetEtLowPt=cms.double(0.0), # Track jet quality criteria + jet_minJetEtHighPt=cms.double(0.0), doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 deltaZ = cms.double(1.0), # require jets to have |z_jet - z_ref| below deltaZ [cm] primaryVtxConstrain = cms.bool(False), # use primary vertex instead of leading jet as reference z position @@ -24,6 +26,8 @@ jet_minPt = cms.double(5.0), jet_minNtracksLowPt=cms.int32(2), jet_minNtracksHighPt=cms.int32(3), + jet_minJetEtLowPt=cms.double(50.0), # Track jet quality criteria + jet_minJetEtHighPt=cms.double(100.0), useCaloJets = cms.bool(False), doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 deltaZ = cms.double(1.0), # This is a dummy value for track only jets @@ -38,6 +42,8 @@ jet_minPt = cms.double(5.0), jet_minNtracksLowPt=cms.int32(2), jet_minNtracksHighPt=cms.int32(3), + jet_minJetEtLowPt=cms.double(50.0), # Track jet quality criteria + jet_minJetEtHighPt=cms.double(100.0), useCaloJets = cms.bool(False), doVtxConstrain = cms.bool(False), # turn on/off applying any vertex constraint32 deltaZ = cms.double(1.0), # This is a dummy value for track only jets diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py index fc3bc7aaaf504..c649e504af3da 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackJetProducer_cfi.py @@ -17,7 +17,9 @@ d0_cutNStubs5=cms.double(0.5), lowpTJetMinTrackMultiplicity=cms.int32(2), highpTJetMinTrackMultiplicity=cms.int32(3), - displaced=cms.bool(False), #Flag for displaced tracks + minJetEtLowPt=cms.double(50.0), + minJetEtHighPt=cms.double(100.0), + displaced=cms.bool(False), #Flag for displaced tracks nStubs4DisplacedChi2_Loose=cms.double(5.0), #Displaced track quality flags for loose/tight nStubs4Displacedbend_Loose=cms.double(1.7), nStubs5DisplacedChi2_Loose=cms.double(2.75), @@ -45,7 +47,9 @@ d0_cutNStubs5=cms.double(0.5), lowpTJetMinTrackMultiplicity=cms.int32(2), highpTJetMinTrackMultiplicity=cms.int32(3), - displaced=cms.bool(True), #Flag for displaced tracks + minJetEtLowPt=cms.double(50.0), + minJetEtHighPt=cms.double(100.0), + displaced=cms.bool(True), #Flag for displaced tracks nStubs4DisplacedChi2_Loose=cms.double(5.0), #Displaced track quality flags for loose/tight nStubs4Displacedbend_Loose=cms.double(1.7), nStubs5DisplacedChi2_Loose=cms.double(2.75), From 77f2c3828b7b7fa5a8f4fdf7f61e08dc319a9275 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury <suvankar.roy.chowdhury@cern.ch> Date: Wed, 12 May 2021 18:45:42 +0200 Subject: [PATCH 295/309] add pre ul era modifiers correctly --- PhysicsTools/NanoAOD/python/electrons_cff.py | 2 +- PhysicsTools/NanoAOD/python/nanoDQM_cff.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PhysicsTools/NanoAOD/python/electrons_cff.py b/PhysicsTools/NanoAOD/python/electrons_cff.py index 7c14f9eb6364d..5a8b732701fef 100644 --- a/PhysicsTools/NanoAOD/python/electrons_cff.py +++ b/PhysicsTools/NanoAOD/python/electrons_cff.py @@ -412,7 +412,7 @@ def _get_bitmapVIDForEle_docstring(modules,WorkingPoints): ) ##Keeping the possibilty of using V1 working points in older eras -(~run2_nanoAOD_106Xv2).toModify(electronTable.variables, +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1).toModify(electronTable.variables, mvaFall17V1Iso = Var("userFloat('mvaFall17V1Iso')",float,doc="MVA Iso ID V1 score"), mvaFall17V1Iso_WP80 = Var("userInt('mvaFall17V1Iso_WP80')",bool,doc="MVA Iso ID V1 WP80"), mvaFall17V1Iso_WP90 = Var("userInt('mvaFall17V1Iso_WP90')",bool,doc="MVA Iso ID V1 WP90"), diff --git a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py index d594df2db0595..796029e797ec0 100644 --- a/PhysicsTools/NanoAOD/python/nanoDQM_cff.py +++ b/PhysicsTools/NanoAOD/python/nanoDQM_cff.py @@ -72,7 +72,7 @@ modifier.toModify(nanoDQM.vplots.Photon, plots = _Photon_plots_2016) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.FatJet, plots = _FatJet_plots_80x) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots.Flag, plots = _Flag_plots_80x) -(~run2_nanoAOD_106Xv2).toModify(nanoDQM.vplots.Electron, plots=_Electron_plots_withFall17V1) +(run2_nanoAOD_92X | run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_94X2016 | run2_nanoAOD_102Xv1).toModify(nanoDQM.vplots.Electron, plots=_Electron_plots_withFall17V1) run2_miniAOD_80XLegacy.toModify(nanoDQM.vplots, IsoTrack = None) From ed475b7839b2a7483fd2dfdd7726b04fe7036bc9 Mon Sep 17 00:00:00 2001 From: Richard <Richard.J.Cavanaugh@gmail.com> Date: Wed, 12 May 2021 12:27:35 -0500 Subject: [PATCH 296/309] resolves style issues --- L1Trigger/L1TGlobal/interface/GlobalScales.h | 18 +-- .../L1TGlobal/plugins/TriggerMenuParser.cc | 112 +++++++++--------- .../L1TGlobal/plugins/TriggerMenuParser.h | 6 +- L1Trigger/L1TGlobal/src/CorrCondition.cc | 73 ++++++------ L1Trigger/L1TGlobal/src/GlobalScales.cc | 6 +- 5 files changed, 107 insertions(+), 108 deletions(-) diff --git a/L1Trigger/L1TGlobal/interface/GlobalScales.h b/L1Trigger/L1TGlobal/interface/GlobalScales.h index da4e827e36e1f..151a7d644c84f 100644 --- a/L1Trigger/L1TGlobal/interface/GlobalScales.h +++ b/L1Trigger/L1TGlobal/interface/GlobalScales.h @@ -39,10 +39,10 @@ namespace l1t { std::vector<std::pair<double, double>> etBins; // Added displaced muons - double uptMin; - double uptMax; - double uptStep; - std::vector<std::pair<double, double>> uptBins; + double uptMin; + double uptMax; + double uptStep; + std::vector<std::pair<double, double>> uptBins; double phiMin; double phiMax; @@ -73,7 +73,9 @@ namespace l1t { virtual void setLUT_DeltaEta(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_DeltaPhi(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_Pt(const std::string& lutName, std::vector<long long> lut, unsigned int precision); - virtual void setLUT_Upt(const std::string& lutName, std::vector<long long> lut, unsigned int precision); // Added for displaced muons + virtual void setLUT_Upt(const std::string& lutName, + std::vector<long long> lut, + unsigned int precision); // Added for displaced muons virtual void setLUT_Cosh(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_Cos(const std::string& lutName, std::vector<long long> lut, unsigned int precision); virtual void setLUT_Sin(const std::string& lutName, std::vector<long long> lut, unsigned int precision); @@ -97,7 +99,7 @@ namespace l1t { long long getLUT_DeltaEta(std::string lutName, int element) const; long long getLUT_DeltaPhi(std::string lutName, int element) const; long long getLUT_Pt(const std::string& lutName, int element) const; - long long getLUT_Upt(const std::string& lutName, int element) const; // Added for displaced muons + long long getLUT_Upt(const std::string& lutName, int element) const; // Added for displaced muons long long getLUT_DeltaEta_Cosh(std::string lutName, int element) const; long long getLUT_DeltaPhi_Cos(std::string lutName, int element) const; long long getLUT_Cos(const std::string& lutName, int element) const; @@ -140,7 +142,7 @@ namespace l1t { std::map<std::string, std::vector<long long>> m_lut_DeltaEta; std::map<std::string, std::vector<long long>> m_lut_DeltaPhi; std::map<std::string, std::vector<long long>> m_lut_Pt; - std::map<std::string, std::vector<long long>> m_lut_Upt; // Added for displaced muons + std::map<std::string, std::vector<long long>> m_lut_Upt; // Added for displaced muons std::map<std::string, std::vector<long long>> m_lut_Cosh; std::map<std::string, std::vector<long long>> m_lut_Cos; std::map<std::string, std::vector<long long>> m_lut_Sin; @@ -149,7 +151,7 @@ namespace l1t { std::map<std::string, unsigned int> m_Prec_DeltaEta; std::map<std::string, unsigned int> m_Prec_DeltaPhi; std::map<std::string, unsigned int> m_Prec_Pt; - std::map<std::string, unsigned int> m_Prec_Upt; // Added for displaced muons + std::map<std::string, unsigned int> m_Prec_Upt; // Added for displaced muons std::map<std::string, unsigned int> m_Prec_Cosh; std::map<std::string, unsigned int> m_Prec_Cos; std::map<std::string, unsigned int> m_Prec_Sin; diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc index 662219c317ac5..6f632881570fd 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.cc @@ -299,7 +299,7 @@ void l1t::TriggerMenuParser::parseCondFormats(const L1TUtmTriggerMenu* utmMenu) condition.getType() == esConditionType::CaloEsumCorrelation || condition.getType() == esConditionType::InvariantMass || condition.getType() == esConditionType::TransverseMass || - condition.getType() == esConditionType::InvariantMassUpt) { // Added for displaced muons + condition.getType() == esConditionType::InvariantMassUpt) { // Added for displaced muons parseCorrelation(condition, chipNr); //parse Externals @@ -590,19 +590,19 @@ bool l1t::TriggerMenuParser::parseScales(std::map<std::string, tmeventsetup::esS } } } break; - case esScaleType::UnconstrainedPtScale: { // Added for displaced muons - scaleParam->uptMin = scale.getMinimum(); - scaleParam->uptMax = scale.getMaximum(); - scaleParam->uptStep = scale.getStep(); - - //Get bin edges - const std::vector<esBin>& binsV = scale.getBins(); - for (unsigned int i = 0; i < binsV.size(); i++) { - const esBin& bin = binsV.at(i); - std::pair<double, double> binLimits(bin.minimum, bin.maximum); - scaleParam->uptBins.push_back(binLimits); - } - } break; + case esScaleType::UnconstrainedPtScale: { // Added for displaced muons + scaleParam->uptMin = scale.getMinimum(); + scaleParam->uptMax = scale.getMaximum(); + scaleParam->uptStep = scale.getStep(); + + //Get bin edges + const std::vector<esBin>& binsV = scale.getBins(); + for (unsigned int i = 0; i < binsV.size(); i++) { + const esBin& bin = binsV.at(i); + std::pair<double, double> binLimits(bin.minimum, bin.maximum); + scaleParam->uptBins.push_back(binLimits); + } + } break; case esScaleType::EtaScale: { scaleParam->etaMin = scale.getMinimum(); scaleParam->etaMax = scale.getMaximum(); @@ -679,7 +679,7 @@ bool l1t::TriggerMenuParser::parseScales(std::map<std::string, tmeventsetup::esS // --------------- parsePt_LUTS(scaleMap, "Mass", "EG", precisions["PRECISION-EG-MU-MassPt"]); parsePt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]); - parseUpt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]); // Added for displaced muons + parseUpt_LUTS(scaleMap, "Mass", "MU", precisions["PRECISION-EG-MU-MassPt"]); // Added for displaced muons parsePt_LUTS(scaleMap, "Mass", "JET", precisions["PRECISION-EG-JET-MassPt"]); parsePt_LUTS(scaleMap, "Mass", "TAU", precisions["PRECISION-EG-TAU-MassPt"]); parsePt_LUTS(scaleMap, "Mass", "ETM", precisions["PRECISION-EG-ETM-MassPt"]); @@ -868,9 +868,9 @@ void l1t::TriggerMenuParser::parsePt_LUTS(std::map<std::string, tmeventsetup::es // Added for displaced muons void l1t::TriggerMenuParser::parseUpt_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, - std::string lutpfx, - std::string obj1, - unsigned int prec) { + std::string lutpfx, + std::string obj1, + unsigned int prec) { using namespace tmeventsetup; // First Delta Eta for this set @@ -889,7 +889,6 @@ void l1t::TriggerMenuParser::parseUpt_LUTS(std::map<std::string, tmeventsetup::e m_gtScales.setLUT_Upt(lutpfx + "_" + scLabel1, lut_pt, prec); } - void l1t::TriggerMenuParser::parseDeltaEta_Cosh_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, std::string obj1, std::string obj2, @@ -1108,10 +1107,10 @@ bool l1t::TriggerMenuParser::parseMuon(tmeventsetup::esCondition condMu, unsigne relativeBx = object.getBxOffset(); // Loop over the cuts for this object - int upperUnconstrainedPtInd = -1; - int lowerUnconstrainedPtInd = 0; - int upperImpactParameterInd = -1; - int lowerImpactParameterInd = 0; + int upperUnconstrainedPtInd = -1; + int lowerUnconstrainedPtInd = 0; + int upperImpactParameterInd = -1; + int lowerImpactParameterInd = 0; int upperThresholdInd = -1; int lowerThresholdInd = 0; int upperIndexInd = -1; @@ -1120,27 +1119,26 @@ bool l1t::TriggerMenuParser::parseMuon(tmeventsetup::esCondition condMu, unsigne unsigned int etaWindow1Lower = -1, etaWindow1Upper = -1, etaWindow2Lower = -1, etaWindow2Upper = -1; int cntPhi = 0; unsigned int phiWindow1Lower = -1, phiWindow1Upper = -1, phiWindow2Lower = -1, phiWindow2Upper = -1; - int isolationLUT = 0xF; //default is to ignore unless specified. - int impactParameterLUT = 0xF; //default is to ignore unless specified - int charge = -1; //default value is to ignore unless specified - int qualityLUT = 0xFFFF; //default is to ignore unless specified. + int isolationLUT = 0xF; //default is to ignore unless specified. + int impactParameterLUT = 0xF; //default is to ignore unless specified + int charge = -1; //default value is to ignore unless specified + int qualityLUT = 0xFFFF; //default is to ignore unless specified. const std::vector<esCut>& cuts = object.getCuts(); for (size_t kk = 0; kk < cuts.size(); kk++) { const esCut cut = cuts.at(kk); switch (cut.getCutType()) { - case esCutType::UnconstrainedPt: - lowerUnconstrainedPtInd = cut.getMinimum().index; - upperUnconstrainedPtInd = cut.getMaximum().index; - break; + lowerUnconstrainedPtInd = cut.getMinimum().index; + upperUnconstrainedPtInd = cut.getMaximum().index; + break; case esCutType::ImpactParameter: - lowerImpactParameterInd = cut.getMinimum().index; - upperImpactParameterInd = cut.getMaximum().index; - impactParameterLUT = l1tstr2int(cut.getData()); - break; + lowerImpactParameterInd = cut.getMinimum().index; + upperImpactParameterInd = cut.getMaximum().index; + impactParameterLUT = l1tstr2int(cut.getData()); + break; case esCutType::Threshold: lowerThresholdInd = cut.getMinimum().index; @@ -1208,11 +1206,11 @@ bool l1t::TriggerMenuParser::parseMuon(tmeventsetup::esCondition condMu, unsigne } //end loop over cuts // Set the parameter cuts - objParameter[cnt].unconstrainedPtHigh = upperUnconstrainedPtInd; - objParameter[cnt].unconstrainedPtLow = lowerUnconstrainedPtInd; - objParameter[cnt].impactParameterHigh = upperImpactParameterInd; - objParameter[cnt].impactParameterLow = lowerImpactParameterInd; - objParameter[cnt].impactParameterLUT = impactParameterLUT; + objParameter[cnt].unconstrainedPtHigh = upperUnconstrainedPtInd; + objParameter[cnt].unconstrainedPtLow = lowerUnconstrainedPtInd; + objParameter[cnt].impactParameterHigh = upperImpactParameterInd; + objParameter[cnt].impactParameterLow = lowerImpactParameterInd; + objParameter[cnt].impactParameterLUT = impactParameterLUT; objParameter[cnt].ptHighThreshold = upperThresholdInd; objParameter[cnt].ptLowThreshold = lowerThresholdInd; @@ -1364,15 +1362,15 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, switch (cut.getCutType()) { case esCutType::UnconstrainedPt: // Added for displaced muons - lowerUnconstrainedPtInd = cut.getMinimum().index; - upperUnconstrainedPtInd = cut.getMaximum().index; - break; + lowerUnconstrainedPtInd = cut.getMinimum().index; + upperUnconstrainedPtInd = cut.getMaximum().index; + break; case esCutType::ImpactParameter: // Added for displaced muons - lowerImpactParameterInd = cut.getMinimum().index; - upperImpactParameterInd = cut.getMaximum().index; - impactParameterLUT = l1tstr2int(cut.getData()); - break; + lowerImpactParameterInd = cut.getMinimum().index; + upperImpactParameterInd = cut.getMaximum().index; + impactParameterLUT = l1tstr2int(cut.getData()); + break; case esCutType::Threshold: lowerThresholdInd = cut.getMinimum().index; @@ -1440,11 +1438,11 @@ bool l1t::TriggerMenuParser::parseMuonCorr(const tmeventsetup::esObject* corrMu, } //end loop over cuts // Set the parameter cuts - objParameter[0].unconstrainedPtHigh = upperUnconstrainedPtInd; // Added for displacd muons - objParameter[0].unconstrainedPtLow = lowerUnconstrainedPtInd; // Added for displacd muons - objParameter[0].impactParameterHigh = upperImpactParameterInd; // Added for displacd muons - objParameter[0].impactParameterLow = lowerImpactParameterInd; // Added for displacd muons - objParameter[0].impactParameterLUT = impactParameterLUT; // Added for displacd muons + objParameter[0].unconstrainedPtHigh = upperUnconstrainedPtInd; // Added for displacd muons + objParameter[0].unconstrainedPtLow = lowerUnconstrainedPtInd; // Added for displacd muons + objParameter[0].impactParameterHigh = upperImpactParameterInd; // Added for displacd muons + objParameter[0].impactParameterLow = lowerImpactParameterInd; // Added for displacd muons + objParameter[0].impactParameterLUT = impactParameterLUT; // Added for displacd muons objParameter[0].ptHighThreshold = upperThresholdInd; objParameter[0].ptLowThreshold = lowerThresholdInd; @@ -2642,17 +2640,17 @@ bool l1t::TriggerMenuParser::parseCorrelation(tmeventsetup::esCondition corrCond } else { cutType = cutType | 0x8; } - } else if (cut.getCutType() == esCutType::MassUpt) { // Added for displaced muons + } else if (cut.getCutType() == esCutType::MassUpt) { // Added for displaced muons LogDebug("TriggerMenuParser") << "CutType: " << cut.getCutType() << "\tMass Cut minV = " << minV << " Max = " << maxV << " precMin = " << cut.getMinimum().index << " precMax = " << cut.getMaximum().index << std::endl; corrParameter.minMassCutValue = (long long)(minV * pow(10., cut.getMinimum().index)); corrParameter.maxMassCutValue = (long long)(maxV * pow(10., cut.getMaximum().index)); corrParameter.precMassCut = cut.getMinimum().index; - cutType = cutType | 0x40; // Note: 0x40 (MassUpt) is next available bit after 0x20 (TwoBodyPt) - } // Careful: cutType carries same info as esCutType, but is hard coded!! - } // This seems like a historical hack, which may be error prone. - } // cutType is defined here, for use later in CorrCondition.cc + cutType = cutType | 0x40; // Note: 0x40 (MassUpt) is next available bit after 0x20 (TwoBodyPt) + } // Careful: cutType carries same info as esCutType, but is hard coded!! + } // This seems like a historical hack, which may be error prone. + } // cutType is defined here, for use later in CorrCondition.cc corrParameter.corrCutType = cutType; // Get the two objects that form the legs diff --git a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h index 7498df513532d..11538263d9827 100644 --- a/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h +++ b/L1Trigger/L1TGlobal/plugins/TriggerMenuParser.h @@ -298,9 +298,9 @@ namespace l1t { // Parse LUT for Upt LUT in Mass calculation for displaced muons void parseUpt_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, - std::string lutpfx, - std::string obj1, - unsigned int prec); + std::string lutpfx, + std::string obj1, + unsigned int prec); // Parse LUT for Delta Eta and Cosh void parseDeltaEta_Cosh_LUTS(std::map<std::string, tmeventsetup::esScale> scaleMap, diff --git a/L1Trigger/L1TGlobal/src/CorrCondition.cc b/L1Trigger/L1TGlobal/src/CorrCondition.cc index d7aab1a88838e..98f698b2e1151 100644 --- a/L1Trigger/L1TGlobal/src/CorrCondition.cc +++ b/L1Trigger/L1TGlobal/src/CorrCondition.cc @@ -321,12 +321,12 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { int etBin1 = 0; double et1Phy = 0.; - int uptIndex0 = 0; // Added displaced muons - int uptBin0 = 0; // Added displaced muons - double upt0Phy = 0.0; // Added displaced muons - int uptIndex1 = 0; // Added displaced muons - int uptBin1 = 0; // Added displaced muons - double upt1Phy = 0.0; // Added displaced muons + int uptIndex0 = 0; // Added displaced muons + int uptBin0 = 0; // Added displaced muons + double upt0Phy = 0.0; // Added displaced muons + int uptIndex1 = 0; // Added displaced muons + int uptBin1 = 0; // Added displaced muons + double upt1Phy = 0.0; // Added displaced muons int chrg0 = -1; int chrg1 = -1; @@ -377,14 +377,14 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { phiIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPhiAtVtx(); //(*candMuVec)[obj0Index]->phiIndex(); etaIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwEtaAtVtx(); etIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPt(); - uptIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPtUnconstrained(); // Added for displaced muons + uptIndex0 = (candMuVec->at(cond0bx, obj0Index))->hwPtUnconstrained(); // Added for displaced muons chrg0 = (candMuVec->at(cond0bx, obj0Index))->hwCharge(); int etaBin0 = etaIndex0; if (etaBin0 < 0) etaBin0 = m_gtScales->getMUScales().etaBins.size() + etaBin0; //twos complement etBin0 = etIndex0; - uptBin0 = uptIndex0; // Added for displaced muons + uptBin0 = uptIndex0; // Added for displaced muons int ssize = m_gtScales->getMUScales().etBins.size(); if (etBin0 >= ssize) { etBin0 = ssize - 1; @@ -398,11 +398,11 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { eta0Phy = 0.5 * (binEdges.second + binEdges.first); binEdges = m_gtScales->getMUScales().etBins.at(etBin0); et0Phy = 0.5 * (binEdges.second + binEdges.first); - if( corrPar.corrCutType & 0x40 ) // Added for displaced muons - { - binEdges = m_gtScales->getMUScales().uptBins.at(uptBin0); - upt0Phy = 0.5 * (binEdges.second + binEdges.first); - } + if (corrPar.corrCutType & 0x40) // Added for displaced muons + { + binEdges = m_gtScales->getMUScales().uptBins.at(uptBin0); + upt0Phy = 0.5 * (binEdges.second + binEdges.first); + } LogDebug("L1TGlobal") << "Found all quantities for the muon 0" << std::endl; } break; @@ -658,7 +658,7 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { phiIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPhiAtVtx(); //(*candMuVec)[obj0Index]->phiIndex(); etaIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwEtaAtVtx(); etIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPt(); - uptIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPtUnconstrained(); // Added for displaced muons + uptIndex1 = (candMuVec->at(cond1bx, obj1Index))->hwPtUnconstrained(); // Added for displaced muons chrg1 = (candMuVec->at(cond1bx, obj1Index))->hwCharge(); etaBin1 = etaIndex1; if (etaBin1 < 0) @@ -666,7 +666,7 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { // LogDebug("L1TGlobal") << "Muon phi" << phiIndex1 << " eta " << etaIndex1 << " etaBin1 = " << etaBin1 << " et " << etIndex1 << std::endl; etBin1 = etIndex1; - uptBin1 = uptIndex1; // Added for displaced muons + uptBin1 = uptIndex1; // Added for displaced muons int ssize = m_gtScales->getMUScales().etBins.size(); if (etBin1 >= ssize) { LogTrace("L1TGlobal") << "muon2 hw et" << etBin1 << " out of scale range. Setting to maximum."; @@ -680,12 +680,12 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { eta1Phy = 0.5 * (binEdges.second + binEdges.first); binEdges = m_gtScales->getMUScales().etBins.at(etBin1); et1Phy = 0.5 * (binEdges.second + binEdges.first); - if( corrPar.corrCutType & 0x40 ) // Added for displaced muons - { - binEdges = m_gtScales->getMUScales().uptBins.at(uptBin1); - upt1Phy = 0.5 * (binEdges.second + binEdges.first); - } - LogDebug("L1TGlobal") << "Found all quantities for the muon 1" << std::endl; + if (corrPar.corrCutType & 0x40) // Added for displaced muons + { + binEdges = m_gtScales->getMUScales().uptBins.at(uptBin1); + upt1Phy = 0.5 * (binEdges.second + binEdges.first); + } + LogDebug("L1TGlobal") << "Found all quantities for the muon 1" << std::endl; } break; case CondCalo: { switch (cndObjTypeVec[1]) { @@ -1168,7 +1168,8 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { } } - if (corrPar.corrCutType & 0x8 || corrPar.corrCutType & 0x10 || corrPar.corrCutType & 0x40) { // added 0x40 for massUpt + if (corrPar.corrCutType & 0x8 || corrPar.corrCutType & 0x10 || + corrPar.corrCutType & 0x40) { // added 0x40 for massUpt //invariant mass calculation based on // M = sqrt(2*p1*p2(cosh(eta1-eta2) - cos(phi1 - phi2))) // but we calculate (1/2)M^2 @@ -1178,8 +1179,8 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { if (corrPar.corrCutType & 0x10) coshDeltaEtaPhy = 1.; double massSqPhy = et0Phy * et1Phy * (coshDeltaEtaPhy - cosDeltaPhiPhy); - if( corrPar.corrCutType & 0x40 ) // Added for displaced muons - massSqPhy = upt0Phy * upt1Phy * (coshDeltaEtaPhy - cosDeltaPhiPhy); + if (corrPar.corrCutType & 0x40) // Added for displaced muons + massSqPhy = upt0Phy * upt1Phy * (coshDeltaEtaPhy - cosDeltaPhiPhy); long long cosDeltaPhiLUT = m_gtScales->getLUT_DeltaPhi_Cos(lutName, deltaPhiFW); unsigned int precCosLUT = m_gtScales->getPrec_DeltaPhi_Cos(lutName); @@ -1205,18 +1206,18 @@ const bool l1t::CorrCondition::evaluateCondition(const int bxEval) const { long long ptObj1 = m_gtScales->getLUT_Pt("Mass_" + lutName, etIndex1); unsigned int precPtLUTObj1 = m_gtScales->getPrec_Pt("Mass_" + lutName); - if( corrPar.corrCutType & 0x40 ) // Added for displaced muons - { - lutName = lutObj0; - lutName += "-UPT"; - ptObj0 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex0); - precPtLUTObj0 = m_gtScales->getPrec_Upt("Mass_" + lutName); - - lutName = lutObj1; - lutName += "-UPT"; - ptObj1 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex1); - precPtLUTObj1 = m_gtScales->getPrec_Upt("Mass_" + lutName); - } + if (corrPar.corrCutType & 0x40) // Added for displaced muons + { + lutName = lutObj0; + lutName += "-UPT"; + ptObj0 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex0); + precPtLUTObj0 = m_gtScales->getPrec_Upt("Mass_" + lutName); + + lutName = lutObj1; + lutName += "-UPT"; + ptObj1 = m_gtScales->getLUT_Upt("Mass_" + lutName, uptIndex1); + precPtLUTObj1 = m_gtScales->getPrec_Upt("Mass_" + lutName); + } // Pt and Angles are at different precission. long long massSq = ptObj0 * ptObj1 * (coshDeltaEtaLUT - cosDeltaPhiLUT); diff --git a/L1Trigger/L1TGlobal/src/GlobalScales.cc b/L1Trigger/L1TGlobal/src/GlobalScales.cc index 482bad0a4ca72..94e24f483044c 100644 --- a/L1Trigger/L1TGlobal/src/GlobalScales.cc +++ b/L1Trigger/L1TGlobal/src/GlobalScales.cc @@ -106,14 +106,13 @@ void l1t::GlobalScales::setLUT_Upt(const std::string& lutName, std::vector<long return; } - // Insert this LUT into the Table + // Insert this LUT into the Table m_lut_Upt.insert(std::map<std::string, std::vector<long long>>::value_type(lutName, lut)); m_Prec_Upt.insert(std::map<std::string, unsigned int>::value_type(lutName, precision)); return; } - void l1t::GlobalScales::setLUT_Cosh(const std::string& lutName, std::vector<long long> lut, unsigned int precision) { if (m_lut_Cosh.count(lutName) != 0) { LogTrace("GlobalScales") << " LUT \"" << lutName << "\"already exists in the LUT map- not inserted!" @@ -568,7 +567,6 @@ void l1t::GlobalScales::dumpAllLUTs(std::ostream& myCout) const { itr++) { dumpLUT(myCout, 8, itr->first); } - } void l1t::GlobalScales::dumpLUT(std::ostream& myCout, int LUTtype, std::string name) const { @@ -622,7 +620,7 @@ void l1t::GlobalScales::dumpLUT(std::ostream& myCout, int LUTtype, std::string n type = "Pt"; break; } - case 9: { // Added for displaced muons + case 9: { // Added for displaced muons dumpV = m_lut_Upt.find(name)->second; prec = m_Prec_Upt.find(name)->second; type = "Upt"; From 44a7e980c9c6cbe652a9da20e5608e7775462e36 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov <mrodozov@cern.ch> Date: Thu, 13 May 2021 00:43:11 +0200 Subject: [PATCH 297/309] Fix compilation failure in DBG in RecoPixelVertexing/PixelVertexFinding --- .../PixelVertexFinding/plugins/gpuClusterTracksByDensity.h | 2 +- .../PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h | 2 +- .../PixelVertexFinding/plugins/gpuClusterTracksIterative.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h index b19aeb5930fc6..cff1a714d0fb8 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h @@ -59,7 +59,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= hist.capacity()); + assert(nt <= (unsigned)hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h index 22ba1e15b4e05..8e3efc941c90d 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h @@ -55,7 +55,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= hist.capacity()); + assert(nt <= (unsigned)hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h index 1f2934ba15d0c..cb95e59109b14 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h @@ -55,7 +55,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= hist.capacity()); + assert(nt <= (unsigned)hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { From 3cd2fb87277fdce1f870f6efb8a6e12fe8026d6c Mon Sep 17 00:00:00 2001 From: Martin Grunewald <Martin.Grunewald@cern.ch> Date: Thu, 13 May 2021 06:36:36 +0200 Subject: [PATCH 298/309] HLT menu migration to 12_0_0_pre1 --- .../Configuration/python/HLT_FULL_cff.py | 39 +- .../Configuration/python/HLT_Fake1_cff.py | 6 +- .../Configuration/python/HLT_Fake2_cff.py | 6 +- .../Configuration/python/HLT_Fake_cff.py | 6 +- .../Configuration/python/HLT_GRun_cff.py | 33 +- .../Configuration/python/HLT_HIon_cff.py | 27 +- .../Configuration/python/HLT_PIon_cff.py | 19 +- .../Configuration/python/HLT_PRef_cff.py | 22 +- .../python/HLTrigger_Datasets_GRun_cff.py | 1268 ++++++++--------- .../python/HLTrigger_Datasets_HIon_cff.py | 46 +- .../python/HLTrigger_Datasets_PIon_cff.py | 4 +- .../python/HLTrigger_Datasets_PRef_cff.py | 10 +- .../python/customizeHLTforCMSSW.py | 33 - HLTrigger/Configuration/tables/makeSubTables | 4 +- .../Configuration/test/OnLine_HLT_FULL.py | 53 +- .../Configuration/test/OnLine_HLT_Fake.py | 6 +- .../Configuration/test/OnLine_HLT_Fake1.py | 6 +- .../Configuration/test/OnLine_HLT_Fake2.py | 6 +- .../Configuration/test/OnLine_HLT_GRun.py | 40 +- .../Configuration/test/OnLine_HLT_HIon.py | 33 +- .../Configuration/test/OnLine_HLT_PIon.py | 20 +- .../Configuration/test/OnLine_HLT_PRef.py | 28 +- HLTrigger/Configuration/test/getFrozenHLT.sh | 6 +- HLTrigger/Configuration/test/getHLT.sh | 4 +- 24 files changed, 867 insertions(+), 858 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_FULL_cff.py b/HLTrigger/Configuration/python/HLT_FULL_cff.py index 6578d3c322fde..4f024227f9e58 100644 --- a/HLTrigger/Configuration/python/HLT_FULL_cff.py +++ b/HLTrigger/Configuration/python/HLT_FULL_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/HLT --type FULL +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/HLT --type FULL -# /dev/CMSSW_11_3_0/HLT/V19 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HLT/V2 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HLT/V19') + tableName = cms.string('/dev/CMSSW_12_0_0/HLT/V2') ) fragment.transferSystem = cms.PSet( @@ -7577,10 +7577,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -7596,26 +7594,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -9051,6 +9052,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -9081,7 +9083,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -9432,7 +9433,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -14963,10 +14963,12 @@ ncandcut = cms.int32( 2 ) ) fragment.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -18118,10 +18120,12 @@ rhoScale = cms.double( 1.0 ) ) fragment.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -36480,7 +36484,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -42188,7 +42191,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -50649,7 +50651,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -100371,7 +100372,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -108155,10 +108155,12 @@ offset = cms.uint32( 0 ) ) fragment.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -117371,7 +117373,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake1_cff.py b/HLTrigger/Configuration/python/HLT_Fake1_cff.py index 649cb8b36a99c..b2826068b36e3 100644 --- a/HLTrigger/Configuration/python/HLT_Fake1_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake1_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/Fake1 --type Fake1 +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake1 --type Fake1 -# /dev/CMSSW_11_3_0/Fake1/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake1/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake1/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake1/V1') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake2_cff.py b/HLTrigger/Configuration/python/HLT_Fake2_cff.py index f8c70b854983e..e915fdba218fe 100644 --- a/HLTrigger/Configuration/python/HLT_Fake2_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake2_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/Fake2 --type Fake2 +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake2 --type Fake2 -# /dev/CMSSW_11_3_0/Fake2/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake2/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake2/V1') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_Fake_cff.py b/HLTrigger/Configuration/python/HLT_Fake_cff.py index 7ccdf436d9ace..d7edf4914f8ad 100644 --- a/HLTrigger/Configuration/python/HLT_Fake_cff.py +++ b/HLTrigger/Configuration/python/HLT_Fake_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/Fake --type Fake +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/Fake --type Fake -# /dev/CMSSW_11_3_0/Fake/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake/V1') ) fragment.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/python/HLT_GRun_cff.py b/HLTrigger/Configuration/python/HLT_GRun_cff.py index 05eafb977746b..08cdd08be150b 100644 --- a/HLTrigger/Configuration/python/HLT_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLT_GRun_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/GRun --type GRun +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/GRun --type GRun -# /dev/CMSSW_11_3_0/GRun/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/GRun/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/GRun/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/GRun/V1') ) fragment.transferSystem = cms.PSet( @@ -6217,10 +6217,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -6236,26 +6234,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -7691,6 +7692,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -7721,7 +7723,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -8072,7 +8073,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -13555,10 +13555,12 @@ ncandcut = cms.int32( 2 ) ) fragment.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -16710,10 +16712,12 @@ rhoScale = cms.double( 1.0 ) ) fragment.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -35048,7 +35052,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -40756,7 +40759,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -48833,7 +48835,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLT_HIon_cff.py b/HLTrigger/Configuration/python/HLT_HIon_cff.py index 074e2b36491d1..99f18df95317d 100644 --- a/HLTrigger/Configuration/python/HLT_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_HIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/HIon --type HIon +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/HIon --type HIon -# /dev/CMSSW_11_3_0/HIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/HIon/V1') ) fragment.transferSystem = cms.PSet( @@ -5380,10 +5380,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5399,26 +5397,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6451,6 +6452,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6481,7 +6483,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -7821,7 +7822,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -14700,10 +14700,12 @@ offset = cms.uint32( 0 ) ) fragment.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) fragment.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -23938,7 +23940,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLT_PIon_cff.py b/HLTrigger/Configuration/python/HLT_PIon_cff.py index 78b861ecc1f7c..9f2f1c519907f 100644 --- a/HLTrigger/Configuration/python/HLT_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLT_PIon_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/PIon --type PIon +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/PIon --type PIon -# /dev/CMSSW_11_3_0/PIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PIon/V1') ) fragment.transferSystem = cms.PSet( @@ -4851,10 +4851,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -4870,26 +4868,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), diff --git a/HLTrigger/Configuration/python/HLT_PRef_cff.py b/HLTrigger/Configuration/python/HLT_PRef_cff.py index f01b067180428..c172452e633b0 100644 --- a/HLTrigger/Configuration/python/HLT_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLT_PRef_cff.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --cff --data /dev/CMSSW_11_3_0/PRef --type PRef +# hltGetConfiguration --cff --data /dev/CMSSW_12_0_0/PRef --type PRef -# /dev/CMSSW_11_3_0/PRef/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PRef/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms fragment = cms.ProcessFragment( "HLT" ) fragment.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PRef/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PRef/V1') ) fragment.transferSystem = cms.PSet( @@ -4930,10 +4930,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) fragment.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -4949,26 +4947,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) fragment.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6169,6 +6170,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6199,7 +6201,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -6550,7 +6551,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py index d52f1a3bd4322..2a3014456bf92 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_GRun_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_11_3_0/GRun +# /dev/CMSSW_12_0_0/GRun import FWCore.ParameterSet.Config as cms @@ -10,15 +10,15 @@ streamParkingBPH1_datasetParkingBPH1_selector.l1tResults = cms.InputTag('') streamParkingBPH1_datasetParkingBPH1_selector.throw = cms.bool(False) streamParkingBPH1_datasetParkingBPH1_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part0_v2', - 'HLT_Mu7_IP4_part0_v2', - 'HLT_Mu8_IP3_part0_v3', - 'HLT_Mu8_IP5_part0_v2', - 'HLT_Mu8_IP6_part0_v2', - 'HLT_Mu9_IP0_part0_v2', - 'HLT_Mu9_IP3_part0_v2', - 'HLT_Mu9_IP4_part0_v2', - 'HLT_Mu9_IP5_part0_v2', + 'HLT_Mu12_IP6_part0_v2', + 'HLT_Mu7_IP4_part0_v2', + 'HLT_Mu8_IP3_part0_v3', + 'HLT_Mu8_IP5_part0_v2', + 'HLT_Mu8_IP6_part0_v2', + 'HLT_Mu9_IP0_part0_v2', + 'HLT_Mu9_IP3_part0_v2', + 'HLT_Mu9_IP4_part0_v2', + 'HLT_Mu9_IP5_part0_v2', 'HLT_Mu9_IP6_part0_v3' ) @@ -27,13 +27,13 @@ streamParkingBPH1_datasetParkingBPHPromptCSCS_selector.l1tResults = cms.InputTag('') streamParkingBPH1_datasetParkingBPHPromptCSCS_selector.throw = cms.bool(False) streamParkingBPH1_datasetParkingBPHPromptCSCS_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_ToCSCS_v1', - 'HLT_Mu7_IP4_ToCSCS_v1', - 'HLT_Mu8_IP3_ToCSCS_v1', - 'HLT_Mu8_IP5_ToCSCS_v1', - 'HLT_Mu8_IP6_ToCSCS_v1', - 'HLT_Mu9_IP4_ToCSCS_v1', - 'HLT_Mu9_IP5_ToCSCS_v1', + 'HLT_Mu12_IP6_ToCSCS_v1', + 'HLT_Mu7_IP4_ToCSCS_v1', + 'HLT_Mu8_IP3_ToCSCS_v1', + 'HLT_Mu8_IP5_ToCSCS_v1', + 'HLT_Mu8_IP6_ToCSCS_v1', + 'HLT_Mu9_IP4_ToCSCS_v1', + 'HLT_Mu9_IP5_ToCSCS_v1', 'HLT_Mu9_IP6_ToCSCS_v1' ) @@ -45,13 +45,13 @@ streamParkingBPH2_datasetParkingBPH2_selector.l1tResults = cms.InputTag('') streamParkingBPH2_datasetParkingBPH2_selector.throw = cms.bool(False) streamParkingBPH2_datasetParkingBPH2_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part1_v2', - 'HLT_Mu7_IP4_part1_v2', - 'HLT_Mu8_IP3_part1_v3', - 'HLT_Mu8_IP5_part1_v2', - 'HLT_Mu8_IP6_part1_v2', - 'HLT_Mu9_IP4_part1_v2', - 'HLT_Mu9_IP5_part1_v2', + 'HLT_Mu12_IP6_part1_v2', + 'HLT_Mu7_IP4_part1_v2', + 'HLT_Mu8_IP3_part1_v3', + 'HLT_Mu8_IP5_part1_v2', + 'HLT_Mu8_IP6_part1_v2', + 'HLT_Mu9_IP4_part1_v2', + 'HLT_Mu9_IP5_part1_v2', 'HLT_Mu9_IP6_part1_v3' ) @@ -63,13 +63,13 @@ streamParkingBPH3_datasetParkingBPH3_selector.l1tResults = cms.InputTag('') streamParkingBPH3_datasetParkingBPH3_selector.throw = cms.bool(False) streamParkingBPH3_datasetParkingBPH3_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part2_v2', - 'HLT_Mu7_IP4_part2_v2', - 'HLT_Mu8_IP3_part2_v3', - 'HLT_Mu8_IP5_part2_v2', - 'HLT_Mu8_IP6_part2_v2', - 'HLT_Mu9_IP4_part2_v2', - 'HLT_Mu9_IP5_part2_v2', + 'HLT_Mu12_IP6_part2_v2', + 'HLT_Mu7_IP4_part2_v2', + 'HLT_Mu8_IP3_part2_v3', + 'HLT_Mu8_IP5_part2_v2', + 'HLT_Mu8_IP6_part2_v2', + 'HLT_Mu9_IP4_part2_v2', + 'HLT_Mu9_IP5_part2_v2', 'HLT_Mu9_IP6_part2_v3' ) @@ -81,13 +81,13 @@ streamParkingBPH4_datasetParkingBPH4_selector.l1tResults = cms.InputTag('') streamParkingBPH4_datasetParkingBPH4_selector.throw = cms.bool(False) streamParkingBPH4_datasetParkingBPH4_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part3_v2', - 'HLT_Mu7_IP4_part3_v2', - 'HLT_Mu8_IP3_part3_v3', - 'HLT_Mu8_IP5_part3_v2', - 'HLT_Mu8_IP6_part3_v2', - 'HLT_Mu9_IP4_part3_v2', - 'HLT_Mu9_IP5_part3_v2', + 'HLT_Mu12_IP6_part3_v2', + 'HLT_Mu7_IP4_part3_v2', + 'HLT_Mu8_IP3_part3_v3', + 'HLT_Mu8_IP5_part3_v2', + 'HLT_Mu8_IP6_part3_v2', + 'HLT_Mu9_IP4_part3_v2', + 'HLT_Mu9_IP5_part3_v2', 'HLT_Mu9_IP6_part3_v3' ) @@ -99,13 +99,13 @@ streamParkingBPH5_datasetParkingBPH5_selector.l1tResults = cms.InputTag('') streamParkingBPH5_datasetParkingBPH5_selector.throw = cms.bool(False) streamParkingBPH5_datasetParkingBPH5_selector.triggerConditions = cms.vstring( - 'HLT_Mu12_IP6_part4_v2', - 'HLT_Mu7_IP4_part4_v2', - 'HLT_Mu8_IP3_part4_v3', - 'HLT_Mu8_IP5_part4_v2', - 'HLT_Mu8_IP6_part4_v2', - 'HLT_Mu9_IP4_part4_v2', - 'HLT_Mu9_IP5_part4_v2', + 'HLT_Mu12_IP6_part4_v2', + 'HLT_Mu7_IP4_part4_v2', + 'HLT_Mu8_IP3_part4_v3', + 'HLT_Mu8_IP5_part4_v2', + 'HLT_Mu8_IP6_part4_v2', + 'HLT_Mu9_IP4_part4_v2', + 'HLT_Mu9_IP5_part4_v2', 'HLT_Mu9_IP6_part4_v3' ) @@ -117,8 +117,8 @@ streamPhysicsCommissioning_datasetCommissioning_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetCommissioning_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetCommissioning_selector.triggerConditions = cms.vstring( - 'HLT_IsoTrackHB_v4', - 'HLT_IsoTrackHE_v4', + 'HLT_IsoTrackHB_v4', + 'HLT_IsoTrackHE_v4', 'HLT_L1_CDC_SingleMu_3_er1p2_TOP120_DPHI2p618_3p142_v2' ) @@ -139,7 +139,7 @@ streamPhysicsCommissioning_datasetHcalNZS_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetHcalNZS_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetHcalNZS_selector.triggerConditions = cms.vstring( - 'HLT_HcalNZS_v13', + 'HLT_HcalNZS_v13', 'HLT_HcalPhiSym_v15' ) @@ -148,7 +148,7 @@ streamPhysicsCommissioning_datasetHighPtLowerPhotons_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetHighPtLowerPhotons_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetHighPtLowerPhotons_selector.triggerConditions = cms.vstring( - 'HLT_SinglePhoton10_Eta3p1ForPPRef_v8', + 'HLT_SinglePhoton10_Eta3p1ForPPRef_v8', 'HLT_SinglePhoton20_Eta3p1ForPPRef_v9' ) @@ -169,29 +169,29 @@ streamPhysicsCommissioning_datasetMonteCarlo_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetMonteCarlo_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetMonteCarlo_selector.triggerConditions = cms.vstring( - 'MC_AK4CaloJetsFromPV_v8', - 'MC_AK4CaloJets_v9', - 'MC_AK4PFJets_v17', - 'MC_AK8CaloHT_v8', - 'MC_AK8PFHT_v16', - 'MC_AK8PFJets_v17', - 'MC_AK8TrimPFJets_v17', - 'MC_CaloBTagDeepCSV_v8', - 'MC_CaloHT_v8', - 'MC_CaloMET_JetIdCleaned_v9', - 'MC_CaloMET_v8', - 'MC_CaloMHT_v8', - 'MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v13', - 'MC_DoubleEle5_CaloIdL_MW_v15', - 'MC_DoubleMuNoFiltersNoVtx_v7', - 'MC_DoubleMu_TrkIsoVVL_DZ_v11', - 'MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v15', - 'MC_Ele5_WPTight_Gsf_v8', - 'MC_IsoMu_v15', - 'MC_PFBTagDeepCSV_v10', - 'MC_PFHT_v16', - 'MC_PFMET_v17', - 'MC_PFMHT_v16', + 'MC_AK4CaloJetsFromPV_v8', + 'MC_AK4CaloJets_v9', + 'MC_AK4PFJets_v17', + 'MC_AK8CaloHT_v8', + 'MC_AK8PFHT_v16', + 'MC_AK8PFJets_v17', + 'MC_AK8TrimPFJets_v17', + 'MC_CaloBTagDeepCSV_v8', + 'MC_CaloHT_v8', + 'MC_CaloMET_JetIdCleaned_v9', + 'MC_CaloMET_v8', + 'MC_CaloMHT_v8', + 'MC_Diphoton10_10_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass10_v13', + 'MC_DoubleEle5_CaloIdL_MW_v15', + 'MC_DoubleMuNoFiltersNoVtx_v7', + 'MC_DoubleMu_TrkIsoVVL_DZ_v11', + 'MC_Ele15_Ele10_CaloIdL_TrackIdL_IsoVL_DZ_v15', + 'MC_Ele5_WPTight_Gsf_v8', + 'MC_IsoMu_v15', + 'MC_PFBTagDeepCSV_v10', + 'MC_PFHT_v16', + 'MC_PFMET_v17', + 'MC_PFMHT_v16', 'MC_ReducedIterativeTracking_v12' ) @@ -200,15 +200,15 @@ streamPhysicsCommissioning_datasetNoBPTX_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetNoBPTX_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetNoBPTX_selector.triggerConditions = cms.vstring( - 'HLT_CDC_L2cosmic_10_er1p0_v1', - 'HLT_CDC_L2cosmic_5p5_er1p0_v1', - 'HLT_L2Mu10_NoVertex_NoBPTX3BX_v5', - 'HLT_L2Mu10_NoVertex_NoBPTX_v6', - 'HLT_L2Mu40_NoVertex_3Sta_NoBPTX3BX_v5', - 'HLT_L2Mu45_NoVertex_3Sta_NoBPTX3BX_v4', - 'HLT_UncorrectedJetE30_NoBPTX3BX_v6', - 'HLT_UncorrectedJetE30_NoBPTX_v6', - 'HLT_UncorrectedJetE60_NoBPTX3BX_v6', + 'HLT_CDC_L2cosmic_10_er1p0_v1', + 'HLT_CDC_L2cosmic_5p5_er1p0_v1', + 'HLT_L2Mu10_NoVertex_NoBPTX3BX_v5', + 'HLT_L2Mu10_NoVertex_NoBPTX_v6', + 'HLT_L2Mu40_NoVertex_3Sta_NoBPTX3BX_v5', + 'HLT_L2Mu45_NoVertex_3Sta_NoBPTX3BX_v4', + 'HLT_UncorrectedJetE30_NoBPTX3BX_v6', + 'HLT_UncorrectedJetE30_NoBPTX_v6', + 'HLT_UncorrectedJetE60_NoBPTX3BX_v6', 'HLT_UncorrectedJetE70_NoBPTX3BX_v6' ) @@ -217,13 +217,13 @@ streamPhysicsCommissioning_datasetZeroBias_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetZeroBias_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetZeroBias_selector.triggerConditions = cms.vstring( - 'HLT_Random_v3', - 'HLT_ZeroBias_Alignment_v1', - 'HLT_ZeroBias_FirstBXAfterTrain_v3', - 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', - 'HLT_ZeroBias_FirstCollisionInTrain_v4', - 'HLT_ZeroBias_IsolatedBunches_v5', - 'HLT_ZeroBias_LastCollisionInTrain_v3', + 'HLT_Random_v3', + 'HLT_ZeroBias_Alignment_v1', + 'HLT_ZeroBias_FirstBXAfterTrain_v3', + 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', + 'HLT_ZeroBias_FirstCollisionInTrain_v4', + 'HLT_ZeroBias_IsolatedBunches_v5', + 'HLT_ZeroBias_LastCollisionInTrain_v3', 'HLT_ZeroBias_v6' ) @@ -235,107 +235,107 @@ streamPhysicsEGamma_datasetEGamma_selector.l1tResults = cms.InputTag('') streamPhysicsEGamma_datasetEGamma_selector.throw = cms.bool(False) streamPhysicsEGamma_datasetEGamma_selector.triggerConditions = cms.vstring( - 'HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v4', - 'HLT_DiSC30_18_EIso_AND_HE_Mass70_v13', - 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v13', - 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v15', - 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_Mass55_v2', - 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_v2', - 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v13', - 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v13', - 'HLT_DoubleEle25_CaloIdL_MW_v4', - 'HLT_DoubleEle27_CaloIdL_MW_v4', - 'HLT_DoubleEle33_CaloIdL_MW_v17', - 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v20', - 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v20', - 'HLT_DoublePhoton33_CaloIdL_v6', - 'HLT_DoublePhoton70_v6', - 'HLT_DoublePhoton85_v14', - 'HLT_ECALHT800_v10', - 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', - 'HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', - 'HLT_Ele135_CaloIdVT_GsfTrkIdT_v7', - 'HLT_Ele145_CaloIdVT_GsfTrkIdT_v8', - 'HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v3', - 'HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v3', - 'HLT_Ele15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', - 'HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v16', - 'HLT_Ele15_IsoVVVL_PFHT450_v16', - 'HLT_Ele15_IsoVVVL_PFHT600_v20', - 'HLT_Ele15_WPLoose_Gsf_v3', - 'HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v9', - 'HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v16', - 'HLT_Ele17_WPLoose_Gsf_v3', - 'HLT_Ele200_CaloIdVT_GsfTrkIdT_v8', - 'HLT_Ele20_WPLoose_Gsf_v6', - 'HLT_Ele20_WPTight_Gsf_v6', - 'HLT_Ele20_eta2p1_WPLoose_Gsf_v6', - 'HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', - 'HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v18', - 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19', - 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v19', - 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v13', - 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', - 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', - 'HLT_Ele250_CaloIdVT_GsfTrkIdT_v13', - 'HLT_Ele27_Ele37_CaloIdL_MW_v4', - 'HLT_Ele27_WPTight_Gsf_v16', - 'HLT_Ele28_HighEta_SC20_Mass55_v13', - 'HLT_Ele28_WPTight_Gsf_v1', - 'HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v13', - 'HLT_Ele300_CaloIdVT_GsfTrkIdT_v13', - 'HLT_Ele30_WPTight_Gsf_v1', - 'HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v13', - 'HLT_Ele32_WPTight_Gsf_L1DoubleEG_v9', - 'HLT_Ele32_WPTight_Gsf_v15', - 'HLT_Ele35_WPTight_Gsf_L1EGMT_v5', - 'HLT_Ele35_WPTight_Gsf_v9', - 'HLT_Ele38_WPTight_Gsf_v9', - 'HLT_Ele40_WPTight_Gsf_v9', - 'HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v18', - 'HLT_Ele50_IsoVVVL_PFHT450_v16', - 'HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v16', - 'HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v18', - 'HLT_Photon100EBHE10_v2', - 'HLT_Photon100EB_TightID_TightIso_v2', - 'HLT_Photon100EEHE10_v2', - 'HLT_Photon100EE_TightID_TightIso_v2', - 'HLT_Photon110EB_TightID_TightIso_v2', - 'HLT_Photon120EB_TightID_TightIso_v2', - 'HLT_Photon120_R9Id90_HE10_IsoM_v14', - 'HLT_Photon120_v13', - 'HLT_Photon150_v6', - 'HLT_Photon165_R9Id90_HE10_IsoM_v15', - 'HLT_Photon175_v14', - 'HLT_Photon200_v13', - 'HLT_Photon20_HoverELoose_v10', - 'HLT_Photon20_v2', - 'HLT_Photon300_NoHE_v12', - 'HLT_Photon30_HoverELoose_v10', - 'HLT_Photon33_v5', - 'HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v5', - 'HLT_Photon50_R9Id90_HE10_IsoM_v14', - 'HLT_Photon50_v13', - 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v11', - 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v5', - 'HLT_Photon60_R9Id90_CaloIdL_IsoL_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v5', - 'HLT_Photon75_R9Id90_HE10_IsoM_v14', - 'HLT_Photon75_v13', - 'HLT_Photon90_CaloIdL_PFHT700_v16', - 'HLT_Photon90_R9Id90_HE10_IsoM_v14', - 'HLT_Photon90_v13', - 'HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v3', - 'HLT_TriplePhoton_20_20_20_CaloIdLV2_v3', - 'HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v4', - 'HLT_TriplePhoton_30_30_10_CaloIdLV2_v4', + 'HLT_DiEle27_WPTightCaloOnly_L1DoubleEG_v4', + 'HLT_DiSC30_18_EIso_AND_HE_Mass70_v13', + 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_NoPixelVeto_Mass55_v13', + 'HLT_Diphoton30PV_18PV_R9Id_AND_IsoCaloId_AND_HE_R9Id_PixelVeto_Mass55_v15', + 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_Mass55_v2', + 'HLT_Diphoton30_18_R9IdL_AND_HE_AND_IsoCaloId_NoPixelVeto_v2', + 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass90_v13', + 'HLT_Diphoton30_22_R9Id_OR_IsoCaloId_AND_HE_R9Id_Mass95_v13', + 'HLT_DoubleEle25_CaloIdL_MW_v4', + 'HLT_DoubleEle27_CaloIdL_MW_v4', + 'HLT_DoubleEle33_CaloIdL_MW_v17', + 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_DZ_PFHT350_v20', + 'HLT_DoubleEle8_CaloIdM_TrackIdM_Mass8_PFHT350_v20', + 'HLT_DoublePhoton33_CaloIdL_v6', + 'HLT_DoublePhoton70_v6', + 'HLT_DoublePhoton85_v14', + 'HLT_ECALHT800_v10', + 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', + 'HLT_Ele12_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', + 'HLT_Ele135_CaloIdVT_GsfTrkIdT_v7', + 'HLT_Ele145_CaloIdVT_GsfTrkIdT_v8', + 'HLT_Ele15_CaloIdL_TrackIdL_IsoVL_PFJet30_v3', + 'HLT_Ele15_Ele8_CaloIdL_TrackIdL_IsoVL_v3', + 'HLT_Ele15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', + 'HLT_Ele15_IsoVVVL_PFHT450_PFMET50_v16', + 'HLT_Ele15_IsoVVVL_PFHT450_v16', + 'HLT_Ele15_IsoVVVL_PFHT600_v20', + 'HLT_Ele15_WPLoose_Gsf_v3', + 'HLT_Ele16_Ele12_Ele8_CaloIdL_TrackIdL_v9', + 'HLT_Ele17_CaloIdM_TrackIdM_PFJet30_v16', + 'HLT_Ele17_WPLoose_Gsf_v3', + 'HLT_Ele200_CaloIdVT_GsfTrkIdT_v8', + 'HLT_Ele20_WPLoose_Gsf_v6', + 'HLT_Ele20_WPTight_Gsf_v6', + 'HLT_Ele20_eta2p1_WPLoose_Gsf_v6', + 'HLT_Ele23_CaloIdL_TrackIdL_IsoVL_PFJet30_v18', + 'HLT_Ele23_CaloIdM_TrackIdM_PFJet30_v18', + 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19', + 'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v19', + 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTau30_eta2p1_CrossL1_v13', + 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_LooseChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_MediumChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_CrossL1_v1', + 'HLT_Ele24_eta2p1_WPTight_Gsf_TightChargedIsoPFTauHPS30_eta2p1_TightID_CrossL1_v1', + 'HLT_Ele250_CaloIdVT_GsfTrkIdT_v13', + 'HLT_Ele27_Ele37_CaloIdL_MW_v4', + 'HLT_Ele27_WPTight_Gsf_v16', + 'HLT_Ele28_HighEta_SC20_Mass55_v13', + 'HLT_Ele28_WPTight_Gsf_v1', + 'HLT_Ele28_eta2p1_WPTight_Gsf_HT150_v13', + 'HLT_Ele300_CaloIdVT_GsfTrkIdT_v13', + 'HLT_Ele30_WPTight_Gsf_v1', + 'HLT_Ele30_eta2p1_WPTight_Gsf_CentralPFJet35_EleCleaned_v13', + 'HLT_Ele32_WPTight_Gsf_L1DoubleEG_v9', + 'HLT_Ele32_WPTight_Gsf_v15', + 'HLT_Ele35_WPTight_Gsf_L1EGMT_v5', + 'HLT_Ele35_WPTight_Gsf_v9', + 'HLT_Ele38_WPTight_Gsf_v9', + 'HLT_Ele40_WPTight_Gsf_v9', + 'HLT_Ele50_CaloIdVT_GsfTrkIdT_PFJet165_v18', + 'HLT_Ele50_IsoVVVL_PFHT450_v16', + 'HLT_Ele8_CaloIdL_TrackIdL_IsoVL_PFJet30_v16', + 'HLT_Ele8_CaloIdM_TrackIdM_PFJet30_v18', + 'HLT_Photon100EBHE10_v2', + 'HLT_Photon100EB_TightID_TightIso_v2', + 'HLT_Photon100EEHE10_v2', + 'HLT_Photon100EE_TightID_TightIso_v2', + 'HLT_Photon110EB_TightID_TightIso_v2', + 'HLT_Photon120EB_TightID_TightIso_v2', + 'HLT_Photon120_R9Id90_HE10_IsoM_v14', + 'HLT_Photon120_v13', + 'HLT_Photon150_v6', + 'HLT_Photon165_R9Id90_HE10_IsoM_v15', + 'HLT_Photon175_v14', + 'HLT_Photon200_v13', + 'HLT_Photon20_HoverELoose_v10', + 'HLT_Photon20_v2', + 'HLT_Photon300_NoHE_v12', + 'HLT_Photon30_HoverELoose_v10', + 'HLT_Photon33_v5', + 'HLT_Photon50_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_PFMET50_v5', + 'HLT_Photon50_R9Id90_HE10_IsoM_v14', + 'HLT_Photon50_v13', + 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_PFHT350MinPFJet15_v11', + 'HLT_Photon60_R9Id90_CaloIdL_IsoL_DisplacedIdL_v5', + 'HLT_Photon60_R9Id90_CaloIdL_IsoL_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ300_PFJetsMJJ400DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_CaloMJJ400_PFJetsMJJ600DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ300DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_EBOnly_PFJetsMJJ600DEta3_v5', + 'HLT_Photon75_R9Id90_HE10_IsoM_v14', + 'HLT_Photon75_v13', + 'HLT_Photon90_CaloIdL_PFHT700_v16', + 'HLT_Photon90_R9Id90_HE10_IsoM_v14', + 'HLT_Photon90_v13', + 'HLT_TriplePhoton_20_20_20_CaloIdLV2_R9IdVL_v3', + 'HLT_TriplePhoton_20_20_20_CaloIdLV2_v3', + 'HLT_TriplePhoton_30_30_10_CaloIdLV2_R9IdVL_v4', + 'HLT_TriplePhoton_30_30_10_CaloIdLV2_v4', 'HLT_TriplePhoton_35_35_5_CaloIdLV2_R9IdVL_v4' ) @@ -347,8 +347,8 @@ streamPhysicsEndOfFill_datasetEmptyBX_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetEmptyBX_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetEmptyBX_selector.triggerConditions = cms.vstring( - 'HLT_L1NotBptxOR_v3', - 'HLT_L1UnpairedBunchBptxMinus_v2', + 'HLT_L1NotBptxOR_v3', + 'HLT_L1UnpairedBunchBptxMinus_v2', 'HLT_L1UnpairedBunchBptxPlus_v2' ) @@ -357,7 +357,7 @@ streamPhysicsEndOfFill_datasetFSQJet1_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetFSQJet1_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetFSQJet1_selector.triggerConditions = cms.vstring( - 'HLT_DiPFJet15_NoCaloMatched_v16', + 'HLT_DiPFJet15_NoCaloMatched_v16', 'HLT_DiPFJet25_NoCaloMatched_v16' ) @@ -366,10 +366,10 @@ streamPhysicsEndOfFill_datasetFSQJet2_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetFSQJet2_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetFSQJet2_selector.triggerConditions = cms.vstring( - 'HLT_DiPFJet15_FBEta3_NoCaloMatched_v17', - 'HLT_DiPFJet25_FBEta3_NoCaloMatched_v17', - 'HLT_DiPFJetAve15_HFJEC_v17', - 'HLT_DiPFJetAve25_HFJEC_v17', + 'HLT_DiPFJet15_FBEta3_NoCaloMatched_v17', + 'HLT_DiPFJet25_FBEta3_NoCaloMatched_v17', + 'HLT_DiPFJetAve15_HFJEC_v17', + 'HLT_DiPFJetAve25_HFJEC_v17', 'HLT_DiPFJetAve35_HFJEC_v17' ) @@ -378,11 +378,11 @@ streamPhysicsEndOfFill_datasetHINCaloJets_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetHINCaloJets_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetHINCaloJets_selector.triggerConditions = cms.vstring( - 'HLT_AK4CaloJet100_v10', - 'HLT_AK4CaloJet120_v9', - 'HLT_AK4CaloJet30_v11', - 'HLT_AK4CaloJet40_v10', - 'HLT_AK4CaloJet50_v10', + 'HLT_AK4CaloJet100_v10', + 'HLT_AK4CaloJet120_v9', + 'HLT_AK4CaloJet30_v11', + 'HLT_AK4CaloJet40_v10', + 'HLT_AK4CaloJet50_v10', 'HLT_AK4CaloJet80_v10' ) @@ -391,10 +391,10 @@ streamPhysicsEndOfFill_datasetHINPFJets_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetHINPFJets_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetHINPFJets_selector.triggerConditions = cms.vstring( - 'HLT_AK4PFJet100_v19', - 'HLT_AK4PFJet120_v18', - 'HLT_AK4PFJet30_v19', - 'HLT_AK4PFJet50_v19', + 'HLT_AK4PFJet100_v19', + 'HLT_AK4PFJet120_v18', + 'HLT_AK4PFJet30_v19', + 'HLT_AK4PFJet50_v19', 'HLT_AK4PFJet80_v19' ) @@ -466,23 +466,23 @@ streamPhysicsHadronsTaus_datasetBTagMu_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetBTagMu_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetBTagMu_selector.triggerConditions = cms.vstring( - 'HLT_BTagMu_AK4DiJet110_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet110_Mu5_v13', - 'HLT_BTagMu_AK4DiJet170_Mu5_noalgo_v12', - 'HLT_BTagMu_AK4DiJet170_Mu5_v12', - 'HLT_BTagMu_AK4DiJet20_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet20_Mu5_v13', - 'HLT_BTagMu_AK4DiJet40_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet40_Mu5_v13', - 'HLT_BTagMu_AK4DiJet70_Mu5_noalgo_v13', - 'HLT_BTagMu_AK4DiJet70_Mu5_v13', - 'HLT_BTagMu_AK4Jet300_Mu5_noalgo_v12', - 'HLT_BTagMu_AK4Jet300_Mu5_v12', - 'HLT_BTagMu_AK8DiJet170_Mu5_noalgo_v9', - 'HLT_BTagMu_AK8DiJet170_Mu5_v9', - 'HLT_BTagMu_AK8Jet170_DoubleMu5_noalgo_v2', - 'HLT_BTagMu_AK8Jet170_DoubleMu5_v2', - 'HLT_BTagMu_AK8Jet300_Mu5_noalgo_v12', + 'HLT_BTagMu_AK4DiJet110_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet110_Mu5_v13', + 'HLT_BTagMu_AK4DiJet170_Mu5_noalgo_v12', + 'HLT_BTagMu_AK4DiJet170_Mu5_v12', + 'HLT_BTagMu_AK4DiJet20_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet20_Mu5_v13', + 'HLT_BTagMu_AK4DiJet40_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet40_Mu5_v13', + 'HLT_BTagMu_AK4DiJet70_Mu5_noalgo_v13', + 'HLT_BTagMu_AK4DiJet70_Mu5_v13', + 'HLT_BTagMu_AK4Jet300_Mu5_noalgo_v12', + 'HLT_BTagMu_AK4Jet300_Mu5_v12', + 'HLT_BTagMu_AK8DiJet170_Mu5_noalgo_v9', + 'HLT_BTagMu_AK8DiJet170_Mu5_v9', + 'HLT_BTagMu_AK8Jet170_DoubleMu5_noalgo_v2', + 'HLT_BTagMu_AK8Jet170_DoubleMu5_v2', + 'HLT_BTagMu_AK8Jet300_Mu5_noalgo_v12', 'HLT_BTagMu_AK8Jet300_Mu5_v12' ) @@ -491,12 +491,12 @@ streamPhysicsHadronsTaus_datasetDisplacedJet_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetDisplacedJet_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetDisplacedJet_selector.triggerConditions = cms.vstring( - 'HLT_HT400_DisplacedDijet40_DisplacedTrack_v13', - 'HLT_HT425_v9', - 'HLT_HT430_DisplacedDijet40_DisplacedTrack_v13', - 'HLT_HT430_DisplacedDijet60_DisplacedTrack_v13', - 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v13', - 'HLT_HT550_DisplacedDijet60_Inclusive_v13', + 'HLT_HT400_DisplacedDijet40_DisplacedTrack_v13', + 'HLT_HT425_v9', + 'HLT_HT430_DisplacedDijet40_DisplacedTrack_v13', + 'HLT_HT430_DisplacedDijet60_DisplacedTrack_v13', + 'HLT_HT500_DisplacedDijet40_DisplacedTrack_v13', + 'HLT_HT550_DisplacedDijet60_Inclusive_v13', 'HLT_HT650_DisplacedDijet60_Inclusive_v13' ) @@ -505,144 +505,144 @@ streamPhysicsHadronsTaus_datasetJetHT_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetJetHT_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetJetHT_selector.triggerConditions = cms.vstring( - 'HLT_AK8PFHT750_TrimMass50_v12', - 'HLT_AK8PFHT800_TrimMass50_v12', - 'HLT_AK8PFHT850_TrimMass50_v11', - 'HLT_AK8PFHT900_TrimMass50_v11', - 'HLT_AK8PFJet140_v15', - 'HLT_AK8PFJet15_v3', - 'HLT_AK8PFJet200_v15', - 'HLT_AK8PFJet25_v3', - 'HLT_AK8PFJet260_v16', - 'HLT_AK8PFJet320_v16', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p17_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p1_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np2_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np4_v2', - 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v3', - 'HLT_AK8PFJet360_TrimMass30_v18', - 'HLT_AK8PFJet380_TrimMass30_v11', - 'HLT_AK8PFJet400_TrimMass30_v12', - 'HLT_AK8PFJet400_v16', - 'HLT_AK8PFJet40_v16', - 'HLT_AK8PFJet420_TrimMass30_v11', - 'HLT_AK8PFJet450_v16', - 'HLT_AK8PFJet500_v16', - 'HLT_AK8PFJet550_v11', - 'HLT_AK8PFJet60_v15', - 'HLT_AK8PFJet80_v15', - 'HLT_AK8PFJetFwd140_v14', - 'HLT_AK8PFJetFwd15_v3', - 'HLT_AK8PFJetFwd200_v14', - 'HLT_AK8PFJetFwd25_v3', - 'HLT_AK8PFJetFwd260_v15', - 'HLT_AK8PFJetFwd320_v15', - 'HLT_AK8PFJetFwd400_v15', - 'HLT_AK8PFJetFwd40_v15', - 'HLT_AK8PFJetFwd450_v15', - 'HLT_AK8PFJetFwd500_v15', - 'HLT_AK8PFJetFwd60_v14', - 'HLT_AK8PFJetFwd80_v14', - 'HLT_CaloJet500_NoJetID_v12', - 'HLT_CaloJet550_NoJetID_v7', - 'HLT_DiPFJetAve100_HFJEC_v16', - 'HLT_DiPFJetAve140_v13', - 'HLT_DiPFJetAve160_HFJEC_v16', - 'HLT_DiPFJetAve200_v13', - 'HLT_DiPFJetAve220_HFJEC_v16', - 'HLT_DiPFJetAve260_v14', - 'HLT_DiPFJetAve300_HFJEC_v16', - 'HLT_DiPFJetAve320_v14', - 'HLT_DiPFJetAve400_v14', - 'HLT_DiPFJetAve40_v14', - 'HLT_DiPFJetAve500_v14', - 'HLT_DiPFJetAve60_HFJEC_v15', - 'HLT_DiPFJetAve60_v14', - 'HLT_DiPFJetAve80_HFJEC_v16', - 'HLT_DiPFJetAve80_v13', - 'HLT_DoublePFJets100_CaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets200_CaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets350_CaloBTagDeepCSV_p71_v2', - 'HLT_DoublePFJets40_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets100_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets200_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets350_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets40_CaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', - 'HLT_PFHT1050_v18', - 'HLT_PFHT180_v17', - 'HLT_PFHT250_v17', - 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v3', - 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v9', - 'HLT_PFHT350MinPFJet15_v9', - 'HLT_PFHT350_v19', - 'HLT_PFHT370_v17', - 'HLT_PFHT400_FivePFJet_100_100_60_30_30_DoublePFBTagDeepCSV_4p5_v8', - 'HLT_PFHT400_FivePFJet_100_100_60_30_30_v8', - 'HLT_PFHT400_FivePFJet_120_120_60_30_30_DoublePFBTagDeepCSV_4p5_v8', - 'HLT_PFHT400_SixPFJet32_DoublePFBTagDeepCSV_2p94_v8', - 'HLT_PFHT400_SixPFJet32_v8', - 'HLT_PFHT430_v17', - 'HLT_PFHT450_SixPFJet36_PFBTagDeepCSV_1p59_v7', - 'HLT_PFHT450_SixPFJet36_v7', - 'HLT_PFHT500_PFMET100_PFMHT100_IDTight_v12', - 'HLT_PFHT500_PFMET110_PFMHT110_IDTight_v12', - 'HLT_PFHT510_v17', - 'HLT_PFHT590_v17', - 'HLT_PFHT680_v17', - 'HLT_PFHT700_PFMET85_PFMHT85_IDTight_v12', - 'HLT_PFHT700_PFMET95_PFMHT95_IDTight_v12', - 'HLT_PFHT780_v17', - 'HLT_PFHT800_PFMET75_PFMHT75_IDTight_v12', - 'HLT_PFHT800_PFMET85_PFMHT85_IDTight_v12', - 'HLT_PFHT890_v17', - 'HLT_PFJet140_v19', - 'HLT_PFJet15_v3', - 'HLT_PFJet200_v19', - 'HLT_PFJet25_v3', - 'HLT_PFJet260_v20', - 'HLT_PFJet320_v20', - 'HLT_PFJet400_v20', - 'HLT_PFJet40_v21', - 'HLT_PFJet450_v21', - 'HLT_PFJet500_v21', - 'HLT_PFJet550_v11', - 'HLT_PFJet60_v21', - 'HLT_PFJet80_v20', - 'HLT_PFJetFwd140_v18', - 'HLT_PFJetFwd15_v3', - 'HLT_PFJetFwd200_v18', - 'HLT_PFJetFwd25_v3', - 'HLT_PFJetFwd260_v19', - 'HLT_PFJetFwd320_v19', - 'HLT_PFJetFwd400_v19', - 'HLT_PFJetFwd40_v19', - 'HLT_PFJetFwd450_v19', - 'HLT_PFJetFwd500_v19', - 'HLT_PFJetFwd60_v19', - 'HLT_PFJetFwd80_v18', - 'HLT_QuadPFJet103_88_75_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet103_88_75_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet103_88_75_15_v5', - 'HLT_QuadPFJet105_88_76_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet105_88_76_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet105_88_76_15_v5', - 'HLT_QuadPFJet111_90_80_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet111_90_80_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet111_90_80_15_v5', - 'HLT_QuadPFJet98_83_71_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', - 'HLT_QuadPFJet98_83_71_15_PFBTagDeepCSV_1p3_VBF2_v8', - 'HLT_QuadPFJet98_83_71_15_v5', - 'HLT_Rsq0p35_v15', - 'HLT_Rsq0p40_v15', - 'HLT_RsqMR300_Rsq0p09_MR200_4jet_v15', - 'HLT_RsqMR300_Rsq0p09_MR200_v15', - 'HLT_RsqMR320_Rsq0p09_MR200_4jet_v15', - 'HLT_RsqMR320_Rsq0p09_MR200_v15', + 'HLT_AK8PFHT750_TrimMass50_v12', + 'HLT_AK8PFHT800_TrimMass50_v12', + 'HLT_AK8PFHT850_TrimMass50_v11', + 'HLT_AK8PFHT900_TrimMass50_v11', + 'HLT_AK8PFJet140_v15', + 'HLT_AK8PFJet15_v3', + 'HLT_AK8PFJet200_v15', + 'HLT_AK8PFJet25_v3', + 'HLT_AK8PFJet260_v16', + 'HLT_AK8PFJet320_v16', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p17_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BTagDeepCSV_p1_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np2_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_np4_v2', + 'HLT_AK8PFJet330_TrimMass30_PFAK8BoostedDoubleB_p02_v3', + 'HLT_AK8PFJet360_TrimMass30_v18', + 'HLT_AK8PFJet380_TrimMass30_v11', + 'HLT_AK8PFJet400_TrimMass30_v12', + 'HLT_AK8PFJet400_v16', + 'HLT_AK8PFJet40_v16', + 'HLT_AK8PFJet420_TrimMass30_v11', + 'HLT_AK8PFJet450_v16', + 'HLT_AK8PFJet500_v16', + 'HLT_AK8PFJet550_v11', + 'HLT_AK8PFJet60_v15', + 'HLT_AK8PFJet80_v15', + 'HLT_AK8PFJetFwd140_v14', + 'HLT_AK8PFJetFwd15_v3', + 'HLT_AK8PFJetFwd200_v14', + 'HLT_AK8PFJetFwd25_v3', + 'HLT_AK8PFJetFwd260_v15', + 'HLT_AK8PFJetFwd320_v15', + 'HLT_AK8PFJetFwd400_v15', + 'HLT_AK8PFJetFwd40_v15', + 'HLT_AK8PFJetFwd450_v15', + 'HLT_AK8PFJetFwd500_v15', + 'HLT_AK8PFJetFwd60_v14', + 'HLT_AK8PFJetFwd80_v14', + 'HLT_CaloJet500_NoJetID_v12', + 'HLT_CaloJet550_NoJetID_v7', + 'HLT_DiPFJetAve100_HFJEC_v16', + 'HLT_DiPFJetAve140_v13', + 'HLT_DiPFJetAve160_HFJEC_v16', + 'HLT_DiPFJetAve200_v13', + 'HLT_DiPFJetAve220_HFJEC_v16', + 'HLT_DiPFJetAve260_v14', + 'HLT_DiPFJetAve300_HFJEC_v16', + 'HLT_DiPFJetAve320_v14', + 'HLT_DiPFJetAve400_v14', + 'HLT_DiPFJetAve40_v14', + 'HLT_DiPFJetAve500_v14', + 'HLT_DiPFJetAve60_HFJEC_v15', + 'HLT_DiPFJetAve60_v14', + 'HLT_DiPFJetAve80_HFJEC_v16', + 'HLT_DiPFJetAve80_v13', + 'HLT_DoublePFJets100_CaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets116MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets128MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets200_CaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets350_CaloBTagDeepCSV_p71_v2', + 'HLT_DoublePFJets40_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets100_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets200_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets350_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets40MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets40_CaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets54MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_Mu12_DoublePFJets62MaxDeta1p6_DoubleCaloBTagDeepCSV_p71_v2', + 'HLT_PFHT1050_v18', + 'HLT_PFHT180_v17', + 'HLT_PFHT250_v17', + 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_TriplePFBTagDeepCSV_4p5_v3', + 'HLT_PFHT330PT30_QuadPFJet_75_60_45_40_v9', + 'HLT_PFHT350MinPFJet15_v9', + 'HLT_PFHT350_v19', + 'HLT_PFHT370_v17', + 'HLT_PFHT400_FivePFJet_100_100_60_30_30_DoublePFBTagDeepCSV_4p5_v8', + 'HLT_PFHT400_FivePFJet_100_100_60_30_30_v8', + 'HLT_PFHT400_FivePFJet_120_120_60_30_30_DoublePFBTagDeepCSV_4p5_v8', + 'HLT_PFHT400_SixPFJet32_DoublePFBTagDeepCSV_2p94_v8', + 'HLT_PFHT400_SixPFJet32_v8', + 'HLT_PFHT430_v17', + 'HLT_PFHT450_SixPFJet36_PFBTagDeepCSV_1p59_v7', + 'HLT_PFHT450_SixPFJet36_v7', + 'HLT_PFHT500_PFMET100_PFMHT100_IDTight_v12', + 'HLT_PFHT500_PFMET110_PFMHT110_IDTight_v12', + 'HLT_PFHT510_v17', + 'HLT_PFHT590_v17', + 'HLT_PFHT680_v17', + 'HLT_PFHT700_PFMET85_PFMHT85_IDTight_v12', + 'HLT_PFHT700_PFMET95_PFMHT95_IDTight_v12', + 'HLT_PFHT780_v17', + 'HLT_PFHT800_PFMET75_PFMHT75_IDTight_v12', + 'HLT_PFHT800_PFMET85_PFMHT85_IDTight_v12', + 'HLT_PFHT890_v17', + 'HLT_PFJet140_v19', + 'HLT_PFJet15_v3', + 'HLT_PFJet200_v19', + 'HLT_PFJet25_v3', + 'HLT_PFJet260_v20', + 'HLT_PFJet320_v20', + 'HLT_PFJet400_v20', + 'HLT_PFJet40_v21', + 'HLT_PFJet450_v21', + 'HLT_PFJet500_v21', + 'HLT_PFJet550_v11', + 'HLT_PFJet60_v21', + 'HLT_PFJet80_v20', + 'HLT_PFJetFwd140_v18', + 'HLT_PFJetFwd15_v3', + 'HLT_PFJetFwd200_v18', + 'HLT_PFJetFwd25_v3', + 'HLT_PFJetFwd260_v19', + 'HLT_PFJetFwd320_v19', + 'HLT_PFJetFwd400_v19', + 'HLT_PFJetFwd40_v19', + 'HLT_PFJetFwd450_v19', + 'HLT_PFJetFwd500_v19', + 'HLT_PFJetFwd60_v19', + 'HLT_PFJetFwd80_v18', + 'HLT_QuadPFJet103_88_75_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet103_88_75_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet103_88_75_15_v5', + 'HLT_QuadPFJet105_88_76_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet105_88_76_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet105_88_76_15_v5', + 'HLT_QuadPFJet111_90_80_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet111_90_80_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet111_90_80_15_v5', + 'HLT_QuadPFJet98_83_71_15_DoublePFBTagDeepCSV_1p3_7p7_VBF1_v8', + 'HLT_QuadPFJet98_83_71_15_PFBTagDeepCSV_1p3_VBF2_v8', + 'HLT_QuadPFJet98_83_71_15_v5', + 'HLT_Rsq0p35_v15', + 'HLT_Rsq0p40_v15', + 'HLT_RsqMR300_Rsq0p09_MR200_4jet_v15', + 'HLT_RsqMR300_Rsq0p09_MR200_v15', + 'HLT_RsqMR320_Rsq0p09_MR200_4jet_v15', + 'HLT_RsqMR320_Rsq0p09_MR200_v15', 'HLT_SingleJet30_Mu12_SinglePFJet40_v11' ) @@ -651,54 +651,54 @@ streamPhysicsHadronsTaus_datasetMET_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetMET_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetMET_selector.triggerConditions = cms.vstring( - 'HLT_CaloMET100_NotCleaned_v4', - 'HLT_CaloMET110_NotCleaned_v4', - 'HLT_CaloMET250_NotCleaned_v4', - 'HLT_CaloMET300_NotCleaned_v4', - 'HLT_CaloMET350_NotCleaned_v4', - 'HLT_CaloMET80_NotCleaned_v4', - 'HLT_CaloMET90_NotCleaned_v4', - 'HLT_CaloMHT90_v4', - 'HLT_DiJet110_35_Mjj650_PFMET110_v9', - 'HLT_DiJet110_35_Mjj650_PFMET120_v9', - 'HLT_DiJet110_35_Mjj650_PFMET130_v9', - 'HLT_L1ETMHadSeeds_v2', - 'HLT_MET105_IsoTrk50_v9', - 'HLT_MET120_IsoTrk50_v9', - 'HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', - 'HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', - 'HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', - 'HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', - 'HLT_PFMET100_PFMHT100_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET100_PFMHT100_IDTight_PFHT60_v9', - 'HLT_PFMET110_PFMHT110_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET110_PFMHT110_IDTight_v20', - 'HLT_PFMET120_PFMHT120_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET120_PFMHT120_IDTight_PFHT60_v9', - 'HLT_PFMET120_PFMHT120_IDTight_v20', - 'HLT_PFMET130_PFMHT130_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET130_PFMHT130_IDTight_v20', - 'HLT_PFMET140_PFMHT140_IDTight_CaloBTagDeepCSV_3p1_v8', - 'HLT_PFMET140_PFMHT140_IDTight_v20', - 'HLT_PFMET200_BeamHaloCleaned_v9', - 'HLT_PFMET200_NotCleaned_v9', - 'HLT_PFMET250_NotCleaned_v9', - 'HLT_PFMET300_NotCleaned_v9', - 'HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v9', - 'HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', - 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v9', - 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', - 'HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', - 'HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', - 'HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v9', - 'HLT_PFMETTypeOne110_PFMHT110_IDTight_v12', - 'HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v9', - 'HLT_PFMETTypeOne120_PFMHT120_IDTight_v12', - 'HLT_PFMETTypeOne130_PFMHT130_IDTight_v12', - 'HLT_PFMETTypeOne140_PFMHT140_IDTight_v11', - 'HLT_PFMETTypeOne200_BeamHaloCleaned_v9', - 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v9', - 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v9', + 'HLT_CaloMET100_NotCleaned_v4', + 'HLT_CaloMET110_NotCleaned_v4', + 'HLT_CaloMET250_NotCleaned_v4', + 'HLT_CaloMET300_NotCleaned_v4', + 'HLT_CaloMET350_NotCleaned_v4', + 'HLT_CaloMET80_NotCleaned_v4', + 'HLT_CaloMET90_NotCleaned_v4', + 'HLT_CaloMHT90_v4', + 'HLT_DiJet110_35_Mjj650_PFMET110_v9', + 'HLT_DiJet110_35_Mjj650_PFMET120_v9', + 'HLT_DiJet110_35_Mjj650_PFMET130_v9', + 'HLT_L1ETMHadSeeds_v2', + 'HLT_MET105_IsoTrk50_v9', + 'HLT_MET120_IsoTrk50_v9', + 'HLT_MonoCentralPFJet80_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', + 'HLT_MonoCentralPFJet80_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', + 'HLT_MonoCentralPFJet80_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', + 'HLT_MonoCentralPFJet80_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', + 'HLT_PFMET100_PFMHT100_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET100_PFMHT100_IDTight_PFHT60_v9', + 'HLT_PFMET110_PFMHT110_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET110_PFMHT110_IDTight_v20', + 'HLT_PFMET120_PFMHT120_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET120_PFMHT120_IDTight_PFHT60_v9', + 'HLT_PFMET120_PFMHT120_IDTight_v20', + 'HLT_PFMET130_PFMHT130_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET130_PFMHT130_IDTight_v20', + 'HLT_PFMET140_PFMHT140_IDTight_CaloBTagDeepCSV_3p1_v8', + 'HLT_PFMET140_PFMHT140_IDTight_v20', + 'HLT_PFMET200_BeamHaloCleaned_v9', + 'HLT_PFMET200_NotCleaned_v9', + 'HLT_PFMET250_NotCleaned_v9', + 'HLT_PFMET300_NotCleaned_v9', + 'HLT_PFMETNoMu100_PFMHTNoMu100_IDTight_PFHT60_v9', + 'HLT_PFMETNoMu110_PFMHTNoMu110_IDTight_v20', + 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_PFHT60_v9', + 'HLT_PFMETNoMu120_PFMHTNoMu120_IDTight_v20', + 'HLT_PFMETNoMu130_PFMHTNoMu130_IDTight_v19', + 'HLT_PFMETNoMu140_PFMHTNoMu140_IDTight_v19', + 'HLT_PFMETTypeOne100_PFMHT100_IDTight_PFHT60_v9', + 'HLT_PFMETTypeOne110_PFMHT110_IDTight_v12', + 'HLT_PFMETTypeOne120_PFMHT120_IDTight_PFHT60_v9', + 'HLT_PFMETTypeOne120_PFMHT120_IDTight_v12', + 'HLT_PFMETTypeOne130_PFMHT130_IDTight_v12', + 'HLT_PFMETTypeOne140_PFMHT140_IDTight_v11', + 'HLT_PFMETTypeOne200_BeamHaloCleaned_v9', + 'HLT_TripleJet110_35_35_Mjj650_PFMET110_v9', + 'HLT_TripleJet110_35_35_Mjj650_PFMET120_v9', 'HLT_TripleJet110_35_35_Mjj650_PFMET130_v9' ) @@ -707,34 +707,34 @@ streamPhysicsHadronsTaus_datasetTau_selector.l1tResults = cms.InputTag('') streamPhysicsHadronsTaus_datasetTau_selector.throw = cms.bool(False) streamPhysicsHadronsTaus_datasetTau_selector.triggerConditions = cms.vstring( - 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', - 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', - 'HLT_DoubleMediumChargedIsoPFTauHPS30_L1MaxMass_Trk1_eta2p1_Reg_v1', - 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4', - 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', - 'HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', - 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', - 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', - 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v11', - 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v12', - 'HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v12', - 'HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v12', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v12', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v8', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v8', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v8', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v3', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v12', - 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v12', - 'HLT_Photon35_TwoProngs35_v1', - 'HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v3', - 'HLT_VBF_DoubleLooseChargedIsoPFTauHPS20_Trk1_eta2p1_v1', - 'HLT_VBF_DoubleMediumChargedIsoPFTauHPS20_Trk1_eta2p1_v1', + 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', + 'HLT_DoubleMediumChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', + 'HLT_DoubleMediumChargedIsoPFTauHPS30_L1MaxMass_Trk1_eta2p1_Reg_v1', + 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleMediumChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v4', + 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTau35_Trk1_TightID_eta2p1_Reg_v12', + 'HLT_DoubleTightChargedIsoPFTau35_Trk1_eta2p1_Reg_v12', + 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTauHPS35_Trk1_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_TightID_eta2p1_Reg_v1', + 'HLT_DoubleTightChargedIsoPFTauHPS40_Trk1_eta2p1_Reg_v1', + 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_1pr_v11', + 'HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v12', + 'HLT_MediumChargedIsoPFTau200HighPtRelaxedIso_Trk50_eta2p1_v12', + 'HLT_MediumChargedIsoPFTau220HighPtRelaxedIso_Trk50_eta2p1_v12', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET100_v12', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET110_v8', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET120_v8', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET130_v8', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET140_v3', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_MET90_v12', + 'HLT_MediumChargedIsoPFTau50_Trk30_eta2p1_1pr_v12', + 'HLT_Photon35_TwoProngs35_v1', + 'HLT_VBF_DoubleLooseChargedIsoPFTau20_Trk1_eta2p1_v3', + 'HLT_VBF_DoubleLooseChargedIsoPFTauHPS20_Trk1_eta2p1_v1', + 'HLT_VBF_DoubleMediumChargedIsoPFTauHPS20_Trk1_eta2p1_v1', 'HLT_VBF_DoubleTightChargedIsoPFTauHPS20_Trk1_eta2p1_v1' ) @@ -746,37 +746,37 @@ streamPhysicsMuons_datasetCharmonium_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetCharmonium_selector.throw = cms.bool(False) streamPhysicsMuons_datasetCharmonium_selector.triggerConditions = cms.vstring( - 'HLT_Dimuon0_Jpsi3p5_Muon2_v5', - 'HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v7', - 'HLT_Dimuon0_Jpsi_L1_NoOS_v7', - 'HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v7', - 'HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v7', - 'HLT_Dimuon0_Jpsi_NoVertexing_v8', - 'HLT_Dimuon0_Jpsi_v8', - 'HLT_Dimuon0_LowMass_L1_0er1p5R_v7', - 'HLT_Dimuon0_LowMass_L1_0er1p5_v8', - 'HLT_Dimuon0_LowMass_L1_4R_v7', - 'HLT_Dimuon0_LowMass_L1_4_v8', - 'HLT_Dimuon0_LowMass_v8', - 'HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v7', - 'HLT_Dimuon18_PsiPrime_noCorrL1_v6', - 'HLT_Dimuon18_PsiPrime_v14', - 'HLT_Dimuon20_Jpsi_Barrel_Seagulls_v7', - 'HLT_Dimuon25_Jpsi_noCorrL1_v6', - 'HLT_Dimuon25_Jpsi_v14', - 'HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v5', - 'HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v6', - 'HLT_DoubleMu4_3_Bs_v14', - 'HLT_DoubleMu4_3_Jpsi_v2', - 'HLT_DoubleMu4_JpsiTrkTrk_Displaced_v7', - 'HLT_DoubleMu4_JpsiTrk_Displaced_v15', - 'HLT_DoubleMu4_Jpsi_Displaced_v7', - 'HLT_DoubleMu4_Jpsi_NoVertexing_v7', - 'HLT_DoubleMu4_PsiPrimeTrk_Displaced_v15', - 'HLT_Mu30_TkMu0_Psi_v1', - 'HLT_Mu7p5_L2Mu2_Jpsi_v10', - 'HLT_Mu7p5_Track2_Jpsi_v11', - 'HLT_Mu7p5_Track3p5_Jpsi_v11', + 'HLT_Dimuon0_Jpsi3p5_Muon2_v5', + 'HLT_Dimuon0_Jpsi_L1_4R_0er1p5R_v7', + 'HLT_Dimuon0_Jpsi_L1_NoOS_v7', + 'HLT_Dimuon0_Jpsi_NoVertexing_L1_4R_0er1p5R_v7', + 'HLT_Dimuon0_Jpsi_NoVertexing_NoOS_v7', + 'HLT_Dimuon0_Jpsi_NoVertexing_v8', + 'HLT_Dimuon0_Jpsi_v8', + 'HLT_Dimuon0_LowMass_L1_0er1p5R_v7', + 'HLT_Dimuon0_LowMass_L1_0er1p5_v8', + 'HLT_Dimuon0_LowMass_L1_4R_v7', + 'HLT_Dimuon0_LowMass_L1_4_v8', + 'HLT_Dimuon0_LowMass_v8', + 'HLT_Dimuon10_PsiPrime_Barrel_Seagulls_v7', + 'HLT_Dimuon18_PsiPrime_noCorrL1_v6', + 'HLT_Dimuon18_PsiPrime_v14', + 'HLT_Dimuon20_Jpsi_Barrel_Seagulls_v7', + 'HLT_Dimuon25_Jpsi_noCorrL1_v6', + 'HLT_Dimuon25_Jpsi_v14', + 'HLT_DoubleMu2_Jpsi_DoubleTkMu0_Phi_v5', + 'HLT_DoubleMu2_Jpsi_DoubleTrk1_Phi1p05_v6', + 'HLT_DoubleMu4_3_Bs_v14', + 'HLT_DoubleMu4_3_Jpsi_v2', + 'HLT_DoubleMu4_JpsiTrkTrk_Displaced_v7', + 'HLT_DoubleMu4_JpsiTrk_Displaced_v15', + 'HLT_DoubleMu4_Jpsi_Displaced_v7', + 'HLT_DoubleMu4_Jpsi_NoVertexing_v7', + 'HLT_DoubleMu4_PsiPrimeTrk_Displaced_v15', + 'HLT_Mu30_TkMu0_Psi_v1', + 'HLT_Mu7p5_L2Mu2_Jpsi_v10', + 'HLT_Mu7p5_Track2_Jpsi_v11', + 'HLT_Mu7p5_Track3p5_Jpsi_v11', 'HLT_Mu7p5_Track7_Jpsi_v11' ) @@ -785,61 +785,61 @@ streamPhysicsMuons_datasetDoubleMuon_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetDoubleMuon_selector.throw = cms.bool(False) streamPhysicsMuons_datasetDoubleMuon_selector.triggerConditions = cms.vstring( - 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', - 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v2', - 'HLT_DoubleL2Mu23NoVtx_2Cha_NoL2Matched_v2', - 'HLT_DoubleL2Mu23NoVtx_2Cha_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_NoL2Matched_v2', - 'HLT_DoubleL2Mu25NoVtx_2Cha_v2', - 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v2', - 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v2', - 'HLT_DoubleL2Mu50_v2', - 'HLT_DoubleMu33NoFiltersNoVtxDisplaced_v1', - 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v10', - 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v10', - 'HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v10', - 'HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v10', - 'HLT_DoubleMu40NoFiltersNoVtxDisplaced_v1', - 'HLT_DoubleMu43NoFiltersNoVtx_v4', - 'HLT_DoubleMu48NoFiltersNoVtx_v4', - 'HLT_DoubleMu4_Mass3p8_DZ_PFHT350_v8', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v5', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v5', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v15', - 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v14', - 'HLT_Mu17_TrkIsoVVL_v13', - 'HLT_Mu17_v13', - 'HLT_Mu18_Mu9_DZ_v4', - 'HLT_Mu18_Mu9_SameSign_DZ_v4', - 'HLT_Mu18_Mu9_SameSign_v4', - 'HLT_Mu18_Mu9_v4', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v3', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v3', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v3', - 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v3', - 'HLT_Mu19_TrkIsoVVL_v4', - 'HLT_Mu19_v4', - 'HLT_Mu20_Mu10_DZ_v4', - 'HLT_Mu20_Mu10_SameSign_DZ_v4', - 'HLT_Mu20_Mu10_SameSign_v4', - 'HLT_Mu20_Mu10_v4', - 'HLT_Mu23_Mu12_DZ_v4', - 'HLT_Mu23_Mu12_SameSign_DZ_v4', - 'HLT_Mu23_Mu12_SameSign_v4', - 'HLT_Mu23_Mu12_v4', - 'HLT_Mu37_TkMu27_v5', - 'HLT_Mu8_TrkIsoVVL_v12', - 'HLT_Mu8_v12', - 'HLT_TripleMu_10_5_5_DZ_v10', - 'HLT_TripleMu_12_10_5_v10', - 'HLT_TripleMu_5_3_3_Mass3p8_DCA_v3', - 'HLT_TripleMu_5_3_3_Mass3p8_DZ_v8', - 'HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v6', - 'HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v12', + 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', + 'HLT_DoubleL2Mu23NoVtx_2Cha_CosmicSeed_v2', + 'HLT_DoubleL2Mu23NoVtx_2Cha_NoL2Matched_v2', + 'HLT_DoubleL2Mu23NoVtx_2Cha_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_Eta2p4_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_NoL2Matched_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_CosmicSeed_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_Eta2p4_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_NoL2Matched_v2', + 'HLT_DoubleL2Mu25NoVtx_2Cha_v2', + 'HLT_DoubleL2Mu30NoVtx_2Cha_CosmicSeed_Eta2p4_v2', + 'HLT_DoubleL2Mu30NoVtx_2Cha_Eta2p4_v2', + 'HLT_DoubleL2Mu50_v2', + 'HLT_DoubleMu33NoFiltersNoVtxDisplaced_v1', + 'HLT_DoubleMu3_DCA_PFMET50_PFMHT60_v10', + 'HLT_DoubleMu3_DZ_PFMET50_PFMHT60_v10', + 'HLT_DoubleMu3_DZ_PFMET70_PFMHT70_v10', + 'HLT_DoubleMu3_DZ_PFMET90_PFMHT90_v10', + 'HLT_DoubleMu40NoFiltersNoVtxDisplaced_v1', + 'HLT_DoubleMu43NoFiltersNoVtx_v4', + 'HLT_DoubleMu48NoFiltersNoVtx_v4', + 'HLT_DoubleMu4_Mass3p8_DZ_PFHT350_v8', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass3p8_v5', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_Mass8_v5', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v15', + 'HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_v14', + 'HLT_Mu17_TrkIsoVVL_v13', + 'HLT_Mu17_v13', + 'HLT_Mu18_Mu9_DZ_v4', + 'HLT_Mu18_Mu9_SameSign_DZ_v4', + 'HLT_Mu18_Mu9_SameSign_v4', + 'HLT_Mu18_Mu9_v4', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass3p8_v3', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_Mass8_v3', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_DZ_v3', + 'HLT_Mu19_TrkIsoVVL_Mu9_TrkIsoVVL_v3', + 'HLT_Mu19_TrkIsoVVL_v4', + 'HLT_Mu19_v4', + 'HLT_Mu20_Mu10_DZ_v4', + 'HLT_Mu20_Mu10_SameSign_DZ_v4', + 'HLT_Mu20_Mu10_SameSign_v4', + 'HLT_Mu20_Mu10_v4', + 'HLT_Mu23_Mu12_DZ_v4', + 'HLT_Mu23_Mu12_SameSign_DZ_v4', + 'HLT_Mu23_Mu12_SameSign_v4', + 'HLT_Mu23_Mu12_v4', + 'HLT_Mu37_TkMu27_v5', + 'HLT_Mu8_TrkIsoVVL_v12', + 'HLT_Mu8_v12', + 'HLT_TripleMu_10_5_5_DZ_v10', + 'HLT_TripleMu_12_10_5_v10', + 'HLT_TripleMu_5_3_3_Mass3p8_DCA_v3', + 'HLT_TripleMu_5_3_3_Mass3p8_DZ_v8', + 'HLT_TrkMu12_DoubleTrkMu5NoFiltersNoVtx_v6', + 'HLT_TrkMu16_DoubleTrkMu6NoFiltersNoVtx_v12', 'HLT_TrkMu17_DoubleTrkMu8NoFiltersNoVtx_v13' ) @@ -848,14 +848,14 @@ streamPhysicsMuons_datasetDoubleMuonLowMass_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetDoubleMuonLowMass_selector.throw = cms.bool(False) streamPhysicsMuons_datasetDoubleMuonLowMass_selector.triggerConditions = cms.vstring( - 'HLT_Dimuon0_LowMass_L1_TM530_v6', - 'HLT_DoubleMu3_TkMu_DsTau3Mu_v4', - 'HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v6', - 'HLT_DoubleMu3_Trk_Tau3mu_v12', - 'HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v15', - 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v4', - 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v4', - 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v4', + 'HLT_Dimuon0_LowMass_L1_TM530_v6', + 'HLT_DoubleMu3_TkMu_DsTau3Mu_v4', + 'HLT_DoubleMu3_Trk_Tau3mu_NoL1Mass_v6', + 'HLT_DoubleMu3_Trk_Tau3mu_v12', + 'HLT_DoubleMu4_LowMassNonResonantTrk_Displaced_v15', + 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_Charge1_v4', + 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_IsoTau15_v4', + 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_Charge1_v4', 'HLT_Tau3Mu_Mu7_Mu1_TkMu1_Tau15_v4' ) @@ -864,30 +864,30 @@ streamPhysicsMuons_datasetMuOnia_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetMuOnia_selector.throw = cms.bool(False) streamPhysicsMuons_datasetMuOnia_selector.triggerConditions = cms.vstring( - 'HLT_Dimuon0_Upsilon_L1_4p5NoOS_v8', - 'HLT_Dimuon0_Upsilon_L1_4p5_v9', - 'HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v7', - 'HLT_Dimuon0_Upsilon_L1_4p5er2p0_v9', - 'HLT_Dimuon0_Upsilon_L1_5M_v8', - 'HLT_Dimuon0_Upsilon_L1_5_v9', - 'HLT_Dimuon0_Upsilon_Muon_L1_TM0_v6', - 'HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v6', - 'HLT_Dimuon0_Upsilon_NoVertexing_v7', - 'HLT_Dimuon12_Upsilon_y1p4_v2', - 'HLT_Dimuon14_Phi_Barrel_Seagulls_v7', - 'HLT_Dimuon24_Phi_noCorrL1_v6', - 'HLT_Dimuon24_Upsilon_noCorrL1_v6', - 'HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v4', - 'HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v4', - 'HLT_Mu20_TkMu0_Phi_v8', - 'HLT_Mu25_TkMu0_Onia_v8', - 'HLT_Mu25_TkMu0_Phi_v8', - 'HLT_Mu30_TkMu0_Upsilon_v1', - 'HLT_Mu7p5_L2Mu2_Upsilon_v10', - 'HLT_Mu7p5_Track2_Upsilon_v11', - 'HLT_Mu7p5_Track3p5_Upsilon_v11', - 'HLT_Mu7p5_Track7_Upsilon_v11', - 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v5', + 'HLT_Dimuon0_Upsilon_L1_4p5NoOS_v8', + 'HLT_Dimuon0_Upsilon_L1_4p5_v9', + 'HLT_Dimuon0_Upsilon_L1_4p5er2p0M_v7', + 'HLT_Dimuon0_Upsilon_L1_4p5er2p0_v9', + 'HLT_Dimuon0_Upsilon_L1_5M_v8', + 'HLT_Dimuon0_Upsilon_L1_5_v9', + 'HLT_Dimuon0_Upsilon_Muon_L1_TM0_v6', + 'HLT_Dimuon0_Upsilon_Muon_NoL1Mass_v6', + 'HLT_Dimuon0_Upsilon_NoVertexing_v7', + 'HLT_Dimuon12_Upsilon_y1p4_v2', + 'HLT_Dimuon14_Phi_Barrel_Seagulls_v7', + 'HLT_Dimuon24_Phi_noCorrL1_v6', + 'HLT_Dimuon24_Upsilon_noCorrL1_v6', + 'HLT_DoubleMu3_DoubleEle7p5_CaloIdL_TrackIdL_Upsilon_v4', + 'HLT_DoubleMu5_Upsilon_DoubleEle3_CaloIdL_TrackIdL_v4', + 'HLT_Mu20_TkMu0_Phi_v8', + 'HLT_Mu25_TkMu0_Onia_v8', + 'HLT_Mu25_TkMu0_Phi_v8', + 'HLT_Mu30_TkMu0_Upsilon_v1', + 'HLT_Mu7p5_L2Mu2_Upsilon_v10', + 'HLT_Mu7p5_Track2_Upsilon_v11', + 'HLT_Mu7p5_Track3p5_Upsilon_v11', + 'HLT_Mu7p5_Track7_Upsilon_v11', + 'HLT_Trimuon5_3p5_2_Upsilon_Muon_v5', 'HLT_TrimuonOpen_5_3p5_2_Upsilon_Muon_v3' ) @@ -896,33 +896,33 @@ streamPhysicsMuons_datasetMuonEG_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetMuonEG_selector.throw = cms.bool(False) streamPhysicsMuons_datasetMuonEG_selector.triggerConditions = cms.vstring( - 'HLT_DiMu4_Ele9_CaloIdL_TrackIdL_DZ_Mass3p8_v17', - 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v17', - 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v17', - 'HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v8', - 'HLT_DoubleMu20_7_Mass0to30_L1_DM4_v7', - 'HLT_DoubleMu20_7_Mass0to30_Photon23_v8', - 'HLT_Mu12_DoublePhoton20_v5', - 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v15', - 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v7', - 'HLT_Mu17_Photon30_IsoCaloId_v6', - 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v15', - 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v7', - 'HLT_Mu27_Ele37_CaloIdL_MW_v5', - 'HLT_Mu37_Ele27_CaloIdL_MW_v5', - 'HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v1', - 'HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v1', - 'HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v5', - 'HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v5', - 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v18', - 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v18', - 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v19', - 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v19', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_CaloBtagDeepCSV_1p5_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_PFBtagDeepCSV_1p5_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_v1', - 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13', + 'HLT_DiMu4_Ele9_CaloIdL_TrackIdL_DZ_Mass3p8_v17', + 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v17', + 'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_v17', + 'HLT_DoubleMu20_7_Mass0to30_L1_DM4EG_v8', + 'HLT_DoubleMu20_7_Mass0to30_L1_DM4_v7', + 'HLT_DoubleMu20_7_Mass0to30_Photon23_v8', + 'HLT_Mu12_DoublePhoton20_v5', + 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v15', + 'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v7', + 'HLT_Mu17_Photon30_IsoCaloId_v6', + 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v15', + 'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_v7', + 'HLT_Mu27_Ele37_CaloIdL_MW_v5', + 'HLT_Mu37_Ele27_CaloIdL_MW_v5', + 'HLT_Mu38NoFiltersNoVtxDisplaced_Photon38_CaloIdL_v1', + 'HLT_Mu43NoFiltersNoVtxDisplaced_Photon43_CaloIdL_v1', + 'HLT_Mu43NoFiltersNoVtx_Photon43_CaloIdL_v5', + 'HLT_Mu48NoFiltersNoVtx_Photon48_CaloIdL_v5', + 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v18', + 'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v18', + 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_DZ_v19', + 'HLT_Mu8_Ele8_CaloIdM_TrackIdM_Mass8_PFHT350_v19', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_CaloBtagDeepCSV_1p5_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_CaloDiJet30_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_PFBtagDeepCSV_1p5_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_PFDiJet30_v1', + 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v13', 'HLT_Mu8_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_v11' ) @@ -931,47 +931,47 @@ streamPhysicsMuons_datasetSingleMuon_selector.l1tResults = cms.InputTag('') streamPhysicsMuons_datasetSingleMuon_selector.throw = cms.bool(False) streamPhysicsMuons_datasetSingleMuon_selector.triggerConditions = cms.vstring( - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v12', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v4', - 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', - 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', - 'HLT_IsoMu20_v15', - 'HLT_IsoMu24_TwoProngs35_v1', - 'HLT_IsoMu24_eta2p1_v15', - 'HLT_IsoMu24_v13', - 'HLT_IsoMu27_v16', - 'HLT_IsoMu30_v4', - 'HLT_L1SingleMu18_v3', - 'HLT_L1SingleMu25_v2', - 'HLT_L2Mu10_v7', - 'HLT_L2Mu50_v2', - 'HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v15', - 'HLT_Mu12_v3', - 'HLT_Mu15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', - 'HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v15', - 'HLT_Mu15_IsoVVVL_PFHT450_v15', - 'HLT_Mu15_IsoVVVL_PFHT600_v19', - 'HLT_Mu15_v3', - 'HLT_Mu20_v12', - 'HLT_Mu27_v13', - 'HLT_Mu3_PFJet40_v16', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET100_PFMHT100_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET70_PFMHT70_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET80_PFMHT80_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMET90_PFMHT90_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu100_PFMHTNoMu100_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu70_PFMHTNoMu70_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu80_PFMHTNoMu80_IDTight_v2', - 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu90_PFMHTNoMu90_IDTight_v2', - 'HLT_Mu4_TrkIsoVVL_DiPFJet90_40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v15', - 'HLT_Mu50_IsoVVVL_PFHT450_v15', - 'HLT_Mu50_v13', - 'HLT_Mu55_v3', - 'HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v16', - 'HLT_OldMu100_v3', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTau27_eta2p1_CrossL1_v12', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_CrossL1_v4', + 'HLT_IsoMu20_eta2p1_LooseChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_MediumChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_CrossL1_v1', + 'HLT_IsoMu20_eta2p1_TightChargedIsoPFTauHPS27_eta2p1_TightID_CrossL1_v1', + 'HLT_IsoMu20_v15', + 'HLT_IsoMu24_TwoProngs35_v1', + 'HLT_IsoMu24_eta2p1_v15', + 'HLT_IsoMu24_v13', + 'HLT_IsoMu27_v16', + 'HLT_IsoMu30_v4', + 'HLT_L1SingleMu18_v3', + 'HLT_L1SingleMu25_v2', + 'HLT_L2Mu10_v7', + 'HLT_L2Mu50_v2', + 'HLT_Mu10_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT350_PFMETNoMu60_v15', + 'HLT_Mu12_v3', + 'HLT_Mu15_IsoVVVL_PFHT450_CaloBTagDeepCSV_4p5_v8', + 'HLT_Mu15_IsoVVVL_PFHT450_PFMET50_v15', + 'HLT_Mu15_IsoVVVL_PFHT450_v15', + 'HLT_Mu15_IsoVVVL_PFHT600_v19', + 'HLT_Mu15_v3', + 'HLT_Mu20_v12', + 'HLT_Mu27_v13', + 'HLT_Mu3_PFJet40_v16', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET100_PFMHT100_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET70_PFMHT70_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET80_PFMHT80_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMET90_PFMHT90_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu100_PFMHTNoMu100_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu70_PFMHTNoMu70_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu80_PFMHTNoMu80_IDTight_v2', + 'HLT_Mu3er1p5_PFJet100er2p5_PFMETNoMu90_PFMHTNoMu90_IDTight_v2', + 'HLT_Mu4_TrkIsoVVL_DiPFJet90_40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v15', + 'HLT_Mu50_IsoVVVL_PFHT450_v15', + 'HLT_Mu50_v13', + 'HLT_Mu55_v3', + 'HLT_Mu8_TrkIsoVVL_DiPFJet40_DEta3p5_MJJ750_HTT300_PFMETNoMu60_v16', + 'HLT_OldMu100_v3', 'HLT_TkMu100_v2' ) @@ -983,12 +983,12 @@ streamPhysicsScoutingMonitor_datasetScoutingMonitor_selector.l1tResults = cms.InputTag('') streamPhysicsScoutingMonitor_datasetScoutingMonitor_selector.throw = cms.bool(False) streamPhysicsScoutingMonitor_datasetScoutingMonitor_selector.triggerConditions = cms.vstring( - 'DST_Run3_PFScoutingPixelTracking_v16', - 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', - 'HLT_Ele35_WPTight_Gsf_v9', - 'HLT_IsoMu27_v16', - 'HLT_Mu50_v13', - 'HLT_PFHT1050_v18', + 'DST_Run3_PFScoutingPixelTracking_v16', + 'HLT_Ele115_CaloIdVT_GsfTrkIdT_v14', + 'HLT_Ele35_WPTight_Gsf_v9', + 'HLT_IsoMu27_v16', + 'HLT_Mu50_v13', + 'HLT_PFHT1050_v18', 'HLT_Photon200_v13' ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py index e1ffefa4d799d..d32b5a2c63310 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_HIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_11_3_0/HIon +# /dev/CMSSW_12_0_0/HIon import FWCore.ParameterSet.Config as cms @@ -10,7 +10,7 @@ streamPhysicsHIMinimumBias10_datasetHIMinimumBias10_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias10_datasetHIMinimumBias10_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias10_datasetHIMinimumBias10_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part10_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part10_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part10_v1' ) @@ -22,7 +22,7 @@ streamPhysicsHIMinimumBias11_datasetHIMinimumBias11_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias11_datasetHIMinimumBias11_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias11_datasetHIMinimumBias11_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part11_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part11_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part11_v1' ) @@ -34,7 +34,7 @@ streamPhysicsHIMinimumBias12_datasetHIMinimumBias12_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias12_datasetHIMinimumBias12_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias12_datasetHIMinimumBias12_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part12_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part12_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part12_v1' ) @@ -46,7 +46,7 @@ streamPhysicsHIMinimumBias13_datasetHIMinimumBias13_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias13_datasetHIMinimumBias13_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias13_datasetHIMinimumBias13_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part13_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part13_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part13_v1' ) @@ -58,7 +58,7 @@ streamPhysicsHIMinimumBias14_datasetHIMinimumBias14_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias14_datasetHIMinimumBias14_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias14_datasetHIMinimumBias14_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part14_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part14_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part14_v1' ) @@ -70,7 +70,7 @@ streamPhysicsHIMinimumBias15_datasetHIMinimumBias15_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias15_datasetHIMinimumBias15_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias15_datasetHIMinimumBias15_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part15_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part15_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part15_v1' ) @@ -82,7 +82,7 @@ streamPhysicsHIMinimumBias16_datasetHIMinimumBias16_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias16_datasetHIMinimumBias16_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias16_datasetHIMinimumBias16_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part16_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part16_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part16_v1' ) @@ -94,7 +94,7 @@ streamPhysicsHIMinimumBias17_datasetHIMinimumBias17_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias17_datasetHIMinimumBias17_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias17_datasetHIMinimumBias17_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part17_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part17_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part17_v1' ) @@ -106,7 +106,7 @@ streamPhysicsHIMinimumBias18_datasetHIMinimumBias18_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias18_datasetHIMinimumBias18_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias18_datasetHIMinimumBias18_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part18_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part18_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part18_v1' ) @@ -118,7 +118,7 @@ streamPhysicsHIMinimumBias19_datasetHIMinimumBias19_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBias19_datasetHIMinimumBias19_selector.throw = cms.bool(False) streamPhysicsHIMinimumBias19_datasetHIMinimumBias19_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part19_v1', + 'HLT_HIMinimumBias_SinglePixelTrack_NpixBypass_part19_v1', 'HLT_HIMinimumBias_SinglePixelTrack_NpixGated_part19_v1' ) @@ -130,7 +130,7 @@ streamPhysicsHIMinimumBiasReducedFormat0_datasetHIMinimumBiasReducedFormat0_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat0_datasetHIMinimumBiasReducedFormat0_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat0_datasetHIMinimumBiasReducedFormat0_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part0_v1', + 'HLT_HIMinimumBiasRF_part0_v1', 'HLT_HIMinimumBiasRF_part1_v1' ) @@ -142,7 +142,7 @@ streamPhysicsHIMinimumBiasReducedFormat1_datasetHIMinimumBiasReducedFormat1_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat1_datasetHIMinimumBiasReducedFormat1_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat1_datasetHIMinimumBiasReducedFormat1_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part2_v1', + 'HLT_HIMinimumBiasRF_part2_v1', 'HLT_HIMinimumBiasRF_part3_v1' ) @@ -154,7 +154,7 @@ streamPhysicsHIMinimumBiasReducedFormat10_datasetHIMinimumBiasReducedFormat10_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat10_datasetHIMinimumBiasReducedFormat10_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat10_datasetHIMinimumBiasReducedFormat10_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part20_v1', + 'HLT_HIMinimumBiasRF_part20_v1', 'HLT_HIMinimumBiasRF_part21_v1' ) @@ -166,7 +166,7 @@ streamPhysicsHIMinimumBiasReducedFormat11_datasetHIMinimumBiasReducedFormat11_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat11_datasetHIMinimumBiasReducedFormat11_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat11_datasetHIMinimumBiasReducedFormat11_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part22_v1', + 'HLT_HIMinimumBiasRF_part22_v1', 'HLT_HIMinimumBiasRF_part23_v1' ) @@ -178,7 +178,7 @@ streamPhysicsHIMinimumBiasReducedFormat2_datasetHIMinimumBiasReducedFormat2_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat2_datasetHIMinimumBiasReducedFormat2_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat2_datasetHIMinimumBiasReducedFormat2_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part4_v1', + 'HLT_HIMinimumBiasRF_part4_v1', 'HLT_HIMinimumBiasRF_part5_v1' ) @@ -190,7 +190,7 @@ streamPhysicsHIMinimumBiasReducedFormat3_datasetHIMinimumBiasReducedFormat3_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat3_datasetHIMinimumBiasReducedFormat3_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat3_datasetHIMinimumBiasReducedFormat3_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part6_v1', + 'HLT_HIMinimumBiasRF_part6_v1', 'HLT_HIMinimumBiasRF_part7_v1' ) @@ -202,7 +202,7 @@ streamPhysicsHIMinimumBiasReducedFormat4_datasetHIMinimumBiasReducedFormat4_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat4_datasetHIMinimumBiasReducedFormat4_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat4_datasetHIMinimumBiasReducedFormat4_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part8_v1', + 'HLT_HIMinimumBiasRF_part8_v1', 'HLT_HIMinimumBiasRF_part9_v1' ) @@ -214,7 +214,7 @@ streamPhysicsHIMinimumBiasReducedFormat5_datasetHIMinimumBiasReducedFormat5_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat5_datasetHIMinimumBiasReducedFormat5_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat5_datasetHIMinimumBiasReducedFormat5_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part10_v1', + 'HLT_HIMinimumBiasRF_part10_v1', 'HLT_HIMinimumBiasRF_part11_v1' ) @@ -226,7 +226,7 @@ streamPhysicsHIMinimumBiasReducedFormat6_datasetHIMinimumBiasReducedFormat6_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat6_datasetHIMinimumBiasReducedFormat6_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat6_datasetHIMinimumBiasReducedFormat6_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part12_v1', + 'HLT_HIMinimumBiasRF_part12_v1', 'HLT_HIMinimumBiasRF_part13_v1' ) @@ -238,7 +238,7 @@ streamPhysicsHIMinimumBiasReducedFormat7_datasetHIMinimumBiasReducedFormat7_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat7_datasetHIMinimumBiasReducedFormat7_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat7_datasetHIMinimumBiasReducedFormat7_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part14_v1', + 'HLT_HIMinimumBiasRF_part14_v1', 'HLT_HIMinimumBiasRF_part15_v1' ) @@ -250,7 +250,7 @@ streamPhysicsHIMinimumBiasReducedFormat8_datasetHIMinimumBiasReducedFormat8_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat8_datasetHIMinimumBiasReducedFormat8_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat8_datasetHIMinimumBiasReducedFormat8_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part16_v1', + 'HLT_HIMinimumBiasRF_part16_v1', 'HLT_HIMinimumBiasRF_part17_v1' ) @@ -262,7 +262,7 @@ streamPhysicsHIMinimumBiasReducedFormat9_datasetHIMinimumBiasReducedFormat9_selector.l1tResults = cms.InputTag('') streamPhysicsHIMinimumBiasReducedFormat9_datasetHIMinimumBiasReducedFormat9_selector.throw = cms.bool(False) streamPhysicsHIMinimumBiasReducedFormat9_datasetHIMinimumBiasReducedFormat9_selector.triggerConditions = cms.vstring( - 'HLT_HIMinimumBiasRF_part18_v1', + 'HLT_HIMinimumBiasRF_part18_v1', 'HLT_HIMinimumBiasRF_part19_v1' ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py index 85f8785107bfe..d9f1def779f35 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PIon_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_11_3_0/PIon +# /dev/CMSSW_12_0_0/PIon import FWCore.ParameterSet.Config as cms @@ -16,7 +16,7 @@ streamPhysicsCommissioning_datasetZeroBias_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetZeroBias_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetZeroBias_selector.triggerConditions = cms.vstring( - 'HLT_Random_v3', + 'HLT_Random_v3', 'HLT_ZeroBias_v6' ) diff --git a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py index 8c499ed574c5d..da4a12b0ee026 100644 --- a/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py +++ b/HLTrigger/Configuration/python/HLTrigger_Datasets_PRef_cff.py @@ -1,4 +1,4 @@ -# /dev/CMSSW_11_3_0/PRef +# /dev/CMSSW_12_0_0/PRef import FWCore.ParameterSet.Config as cms @@ -16,8 +16,8 @@ streamPhysicsCommissioning_datasetZeroBias_selector.l1tResults = cms.InputTag('') streamPhysicsCommissioning_datasetZeroBias_selector.throw = cms.bool(False) streamPhysicsCommissioning_datasetZeroBias_selector.triggerConditions = cms.vstring( - 'HLT_Random_v3', - 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', + 'HLT_Random_v3', + 'HLT_ZeroBias_FirstCollisionAfterAbortGap_v5', 'HLT_ZeroBias_v6' ) @@ -29,8 +29,8 @@ streamPhysicsEndOfFill_datasetEmptyBX_selector.l1tResults = cms.InputTag('') streamPhysicsEndOfFill_datasetEmptyBX_selector.throw = cms.bool(False) streamPhysicsEndOfFill_datasetEmptyBX_selector.triggerConditions = cms.vstring( - 'HLT_HIL1NotBptxORForPPRef_v2', - 'HLT_HIL1UnpairedBunchBptxMinusForPPRef_v2', + 'HLT_HIL1NotBptxORForPPRef_v2', + 'HLT_HIL1UnpairedBunchBptxMinusForPPRef_v2', 'HLT_HIL1UnpairedBunchBptxPlusForPPRef_v2' ) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 3485f90b5b4b0..104df35b34944 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -129,44 +129,11 @@ def customiseFor2018Input(process): return process -def customizeFor33543(process): - """ Customize HLT menu to remove deprecated parameters for the CSCRecHitDProducer in RecoLocalMuon""" - for producer in producers_by_type(process, "CSCRecHitDProducer"): - if hasattr(producer, "CSCStripClusterSize"): - del producer.CSCStripClusterSize - - return process - -def customiseFor33495(process): - """Customize HLT menu to remove deprecated parameters for pixel Generic and Template CPE's """ - for producer in esproducers_by_type(process, "PixelCPEGenericESProducer"): - if hasattr(producer, "DoLorentz"): - del producer.DoLorentz - if hasattr(producer, "useLAAlignmentOffsets"): - del producer.useLAAlignmentOffsets - - for producer in esproducers_by_type(process, "PixelCPETemplateRecoESProducer"): - if hasattr(producer, "DoLorentz"): - del producer.DoLorentz - return process - -def customizeFor33526(process): - """ Customize HLT menu to remove deprecated parameters for the pixel raw to digi step""" - for producer in producers_by_type(process, "SiPixelRawToDigi"): - if hasattr(producer, "Timing"): - del producer.Timing - if hasattr(producer, "CheckPixelOrder"): - del producer.CheckPixelOrder - - return process # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): # add call to action function in proper order: newest last! # process = customiseFor12718(process) - process = customiseFor33495(process) - process = customizeFor33526(process) - process = customizeFor33543(process) return process diff --git a/HLTrigger/Configuration/tables/makeSubTables b/HLTrigger/Configuration/tables/makeSubTables index 76c0d795e1471..cfd09b91f2e3b 100755 --- a/HLTrigger/Configuration/tables/makeSubTables +++ b/HLTrigger/Configuration/tables/makeSubTables @@ -3,8 +3,8 @@ # generate HLT tables from master table in ConfDB # -MASTER="/dev/CMSSW_11_3_0/HLT" # no version, take the latest one -TARGET="/dev/CMSSW_11_3_0/TABLE" # directory where to store the sub-tables +MASTER="/dev/CMSSW_12_0_0/HLT" # no version, take the latest one +TARGET="/dev/CMSSW_12_0_0/TABLE" # directory where to store the sub-tables TABLES="GRun HIon PIon PRef" # which sub-tables to create source subtables.sh diff --git a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py index 7662d05eb98ad..c49dd2a4ad824 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_FULL.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_FULL.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run3_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/HLT --type FULL --unprescale --process HLTFULL --globaltag auto:run3_hlt_FULL --input file:RelVal_Raw_FULL_DATA.root -# /dev/CMSSW_11_3_0/HLT/V19 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HLT/V2 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFULL" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HLT/V19') + tableName = cms.string('/dev/CMSSW_12_0_0/HLT/V2') ) process.transferSystem = cms.PSet( @@ -7747,10 +7747,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -7766,26 +7764,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -9305,6 +9306,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -9335,7 +9337,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -9686,7 +9687,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -15217,10 +15217,12 @@ ncandcut = cms.int32( 2 ) ) process.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -18372,10 +18374,12 @@ rhoScale = cms.double( 1.0 ) ) process.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -36734,7 +36738,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -42442,7 +42445,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -50903,7 +50905,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -100625,7 +100626,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -108409,10 +108409,12 @@ offset = cms.uint32( 0 ) ) process.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -117625,7 +117627,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -126088,6 +126089,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = ( cms.vstring( '( HLT_Random_v3 OR HLT_HcalNZS_v13 OR HLT_HcalPhiSym_v15 OR HLT_L1SingleMu7_v1 OR HLT_L1DoubleMu0_v1 OR HLT_L1SingleEG10_v2 OR HLT_L1SingleEG18_v1 OR HLT_Photon22_v2 OR HLT_L1SingleJet35_v1 OR HLT_L1SingleJet200_v1 OR HLT_L1DoubleJetC50_v2 OR HLT_CaloJet10_NoJetID_v3 OR HLT_CaloJet20_NoJetID_v3 OR HLT_CaloJet50_NoJetID_v3 ) / 10', 'HLT_AK8PFJet360_TrimMass30_v18 / 3', @@ -126967,6 +126969,7 @@ process.hltPreDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -126986,6 +126989,7 @@ process.hltPreDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_DoublePhoton85_v14', 'HLT_L1SingleMu7_v1', @@ -127000,6 +127004,7 @@ process.hltPreHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele32_WPTight_Gsf_v15 / 5', 'HLT_PFJet260_v20', @@ -127051,6 +127056,7 @@ process.hltPreExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_IsoMu20_v15 OR HLT_IsoMu24_v13 OR HLT_IsoMu27_v16 OR FALSE ) / 25', '( HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19 OR FALSE ) / 3', @@ -127107,6 +127113,7 @@ process.hltPreExpressCosmicsOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_L1SingleMuOpen_v2', 'HLT_L1SingleMuCosmics_v1 / 10', @@ -127120,6 +127127,7 @@ process.hltPreExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -127240,6 +127248,7 @@ process.hltPrePhysicsScoutingMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele35_WPTight_Gsf_v9 / 200', 'HLT_IsoMu27_v16 / 150', @@ -127531,6 +127540,7 @@ process.hltPreHIHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -127542,6 +127552,7 @@ process.hltPreHIDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_HIRandom_v1 OR HLT_HIHcalNZS_v1 OR HLT_HIHcalPhiSym_v1 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_HIPhysics_v1', @@ -127557,6 +127568,7 @@ process.hltPreHIDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -127568,6 +127580,7 @@ process.hltPreHIDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_Beamspot_v1', 'HLT_HICsAK4PFJet100Eta1p5_Beamspot_v1' ), @@ -127580,6 +127593,7 @@ process.hltPreHIExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HIPhysics_v1', 'HLT_HIRandom_v1', @@ -127597,6 +127611,7 @@ process.hltPreHIExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_v1', 'HLT_HICsAK4PFJet100Eta1p5_v1' ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py index 0f3b446df9665..fb3e3becf7c51 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/Fake --type Fake --unprescale --process HLTFake --globaltag auto:run1_hlt_Fake --input file:RelVal_Raw_Fake_DATA.root -# /dev/CMSSW_11_3_0/Fake/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake/V1') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py index 5ca28322afc46..4e93e97f12323 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake1.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/Fake1 --type Fake1 --unprescale --process HLTFake1 --globaltag auto:run2_hlt_Fake1 --input file:RelVal_Raw_Fake1_DATA.root -# /dev/CMSSW_11_3_0/Fake1/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake1/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake1" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake1/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake1/V1') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py index 53bc127f15baa..f0725a4a41896 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_Fake2.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/Fake2 --type Fake2 --unprescale --process HLTFake2 --globaltag auto:run2_hlt_Fake2 --input file:RelVal_Raw_Fake2_DATA.root -# /dev/CMSSW_11_3_0/Fake2/V8 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/Fake2/V1 (CMSSW_11_3_0) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTFake2" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/Fake2/V8') + tableName = cms.string('/dev/CMSSW_12_0_0/Fake2/V1') ) process.streams = cms.PSet( A = cms.vstring( 'InitialPD' ) ) diff --git a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py index e6e1efaac0562..7b4a9188b6013 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_GRun.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_GRun.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run3_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/GRun --type GRun --unprescale --process HLTGRun --globaltag auto:run3_hlt_GRun --input file:RelVal_Raw_GRun_DATA.root -# /dev/CMSSW_11_3_0/GRun/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/GRun/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTGRun" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/GRun/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/GRun/V1') ) process.transferSystem = cms.PSet( @@ -6387,10 +6387,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -6406,26 +6404,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -7945,6 +7946,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -7975,7 +7977,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -8326,7 +8327,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -13809,10 +13809,12 @@ ncandcut = cms.int32( 2 ) ) process.hltEgammaClusterShape = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidates" ), ecalRechitEB = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltRechitInRegionsECAL','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiMu5Ele3CaloIdLTrackIdLElectronlegClusterShapeFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -16964,10 +16966,12 @@ rhoScale = cms.double( 1.0 ) ) process.hltEgammaClusterShapeUnseeded = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesUnseeded" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltDiEG25CaloIdLClusterShapeUnseededFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -35302,7 +35306,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -41010,7 +41013,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -49087,7 +49089,6 @@ beamSpot = cms.InputTag( "hltOnlineBeamSpot" ), deltaPhi = cms.vdouble( 0.5 ) ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -89979,6 +89980,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = ( cms.vstring( '( HLT_Random_v3 OR HLT_HcalNZS_v13 OR HLT_HcalPhiSym_v15 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_AK8PFJet360_TrimMass30_v18 / 3', @@ -90563,6 +90565,7 @@ process.hltPreDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -90580,6 +90583,7 @@ process.hltPreDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_DoublePhoton85_v14', 'HLT_PFJet500_v21 / 3', @@ -90593,6 +90597,7 @@ process.hltPreHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele32_WPTight_Gsf_v15 / 5', 'HLT_PFJet260_v20', @@ -90644,6 +90649,7 @@ process.hltPreExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_IsoMu20_v15 OR HLT_IsoMu24_v13 OR HLT_IsoMu27_v16 OR FALSE ) / 25', '( HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v19 OR FALSE ) / 3', @@ -90663,6 +90669,7 @@ process.hltPreExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HT450_Beamspot_v11', 'HLT_HT300_Beamspot_v11', @@ -90748,6 +90755,7 @@ process.hltPrePhysicsScoutingMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Ele35_WPTight_Gsf_v9 / 200', 'HLT_IsoMu27_v16 / 150', diff --git a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py index eb6bee4de36f9..07e1d4217e0e6 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_HIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_HIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run3_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/HIon --type HIon --unprescale --process HLTHIon --globaltag auto:run3_hlt_HIon --input file:RelVal_Raw_HIon_DATA.root -# /dev/CMSSW_11_3_0/HIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/HIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTHIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/HIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/HIon/V1') ) process.transferSystem = cms.PSet( @@ -5550,10 +5550,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5569,26 +5567,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6705,6 +6706,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6735,7 +6737,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -8075,7 +8076,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -14954,10 +14954,12 @@ offset = cms.uint32( 0 ) ) process.hltEgammaClusterShapePPOnAA = cms.EDProducer( "EgammaHLTClusterShapeProducer", + isIeta = cms.bool( True ), + multThresEE = cms.double( 1.25 ), recoEcalCandidateProducer = cms.InputTag( "hltEgammaCandidatesPPOnAA" ), ecalRechitEB = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEB' ), ecalRechitEE = cms.InputTag( 'hltEcalRecHit','EcalRecHitsEE' ), - isIeta = cms.bool( True ) + multThresEB = cms.double( 1.0 ) ) process.hltEle10ClusterShapePPOnAAFilter = cms.EDFilter( "HLTEgammaGenericFilter", thrOverE2EE = cms.vdouble( -1.0 ), @@ -24192,7 +24194,6 @@ IncludeErrors = cms.bool( False ), ErrorList = cms.vint32( ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -32215,6 +32216,7 @@ process.hltPreHIHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -32226,6 +32228,7 @@ process.hltPreHIDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_HIRandom_v1 OR HLT_HIHcalNZS_v1 OR HLT_HIHcalPhiSym_v1 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_HIPhysics_v1', @@ -32241,6 +32244,7 @@ process.hltPreHIDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -32252,6 +32256,7 @@ process.hltPreHIDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_Beamspot_v1', 'HLT_HICsAK4PFJet100Eta1p5_Beamspot_v1' ), @@ -32264,6 +32269,7 @@ process.hltPreHIExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HIPhysics_v1', 'HLT_HIRandom_v1', @@ -32281,6 +32287,7 @@ process.hltPreHIExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_HICentralityVeto_v1', 'HLT_HICsAK4PFJet100Eta1p5_v1' ), diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py index b79b955142ba0..f11e1b5c4d1a3 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PIon.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PIon.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run3_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/PIon --type PIon --unprescale --process HLTPIon --globaltag auto:run3_hlt_PIon --input file:RelVal_Raw_PIon_DATA.root -# /dev/CMSSW_11_3_0/PIon/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PIon/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPIon" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PIon/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PIon/V1') ) process.transferSystem = cms.PSet( @@ -5021,10 +5021,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5040,26 +5038,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -5729,6 +5730,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_Random_v3 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_Physics_v7', diff --git a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py index 303d60afdbb9f..3a9d3a2e923b8 100644 --- a/HLTrigger/Configuration/test/OnLine_HLT_PRef.py +++ b/HLTrigger/Configuration/test/OnLine_HLT_PRef.py @@ -1,13 +1,13 @@ -# hltGetConfiguration --full --data /dev/CMSSW_11_3_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run3_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root +# hltGetConfiguration --full --data /dev/CMSSW_12_0_0/PRef --type PRef --unprescale --process HLTPRef --globaltag auto:run3_hlt_PRef --input file:RelVal_Raw_PRef_DATA.root -# /dev/CMSSW_11_3_0/PRef/V13 (CMSSW_11_3_0_pre5) +# /dev/CMSSW_12_0_0/PRef/V1 (CMSSW_12_0_0_pre1) import FWCore.ParameterSet.Config as cms process = cms.Process( "HLTPRef" ) process.HLTConfigVersion = cms.PSet( - tableName = cms.string('/dev/CMSSW_11_3_0/PRef/V13') + tableName = cms.string('/dev/CMSSW_12_0_0/PRef/V1') ) process.transferSystem = cms.PSet( @@ -5100,10 +5100,8 @@ ComponentName = cms.string( "hltESPMuonTransientTrackingRecHitBuilder" ) ) process.hltESPPixelCPEGeneric = cms.ESProducer( "PixelCPEGenericESProducer", - DoLorentz = cms.bool( False ), - useLAAlignmentOffsets = cms.bool( False ), - Upgrade = cms.bool( False ), DoCosmics = cms.bool( False ), + Upgrade = cms.bool( False ), eff_charge_cut_highX = cms.double( 1.0 ), eff_charge_cut_highY = cms.double( 1.0 ), inflate_all_errors_no_trk_angle = cms.bool( False ), @@ -5119,26 +5117,29 @@ ClusterProbComputationFlag = cms.int32( 0 ), Alpha2Order = cms.bool( True ), appendToDataLabel = cms.string( "" ), - lAWidthFPix = cms.double( 0.0 ), + useLAFromDB = cms.bool( True ), SmallPitch = cms.bool( False ), + lAWidthFPix = cms.double( 0.0 ), LoadTemplatesFromDB = cms.bool( True ), NoTemplateErrorsWhenNoTrkAngles = cms.bool( False ), EdgeClusterErrorX = cms.double( 50.0 ), EdgeClusterErrorY = cms.double( 85.0 ), lAOffset = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), ComponentName = cms.string( "hltESPPixelCPEGeneric" ), MagneticFieldRecord = cms.ESInputTag( "" ), IrradiationBiasCorrection = cms.bool( True ) ) process.hltESPPixelCPETemplateReco = cms.ESProducer( "PixelCPETemplateRecoESProducer", - DoLorentz = cms.bool( True ), barrelTemplateID = cms.int32( 0 ), appendToDataLabel = cms.string( "" ), lAOffset = cms.double( 0.0 ), - lAWidthFPix = cms.double( 0.0 ), + doLorentzFromAlignment = cms.bool( False ), + useLAFromDB = cms.bool( True ), ComponentName = cms.string( "hltESPPixelCPETemplateReco" ), directoryWithTemplates = cms.int32( 0 ), useLAWidthFromDB = cms.bool( True ), + lAWidthFPix = cms.double( 0.0 ), lAWidthBPix = cms.double( 0.0 ), ClusterProbComputationFlag = cms.int32( 0 ), LoadTemplatesFromDB = cms.bool( True ), @@ -6423,6 +6424,7 @@ VisualFEDInspect = cms.untracked.bool( False ), FormatedEventDump = cms.untracked.bool( False ), useGEMs = cms.bool( False ), + useCSCShowers = cms.bool( False ), UseFormatStatus = cms.bool( True ), UseSelectiveUnpacking = cms.bool( True ), VisualFEDShort = cms.untracked.bool( False ) @@ -6453,7 +6455,6 @@ NoiseLevel_ME32 = cms.double( 9.0 ), NoiseLevel_ME31 = cms.double( 9.0 ), ConstSyst_ME1b = cms.double( 0.007 ), - CSCStripClusterSize = cms.untracked.int32( 3 ), CSCStripPeakThreshold = cms.double( 10.0 ), readBadChannels = cms.bool( False ), NoiseLevel_ME12 = cms.double( 9.0 ), @@ -6804,7 +6805,6 @@ IncludeErrors = cms.bool( True ), ErrorList = cms.vint32( 29 ), Regions = cms.PSet( ), - Timing = cms.untracked.bool( False ), CablingMapLabel = cms.string( "" ), UserErrorList = cms.vint32( ) ) @@ -11174,6 +11174,7 @@ process.hltPreDQMOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( '( HLT_Random_v3 OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE OR FALSE ) / 10', 'HLT_Physics_v7', @@ -11204,6 +11205,7 @@ process.hltPreDQMOnlineBeamspotOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_ZeroBias_Beamspot_v4', 'HLT_HIHT80_Beamspot_ppRef5TeV_v3' ), @@ -11220,6 +11222,7 @@ process.hltPreDQMEventDisplayOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -11231,6 +11234,7 @@ process.hltPreHLTMonitorOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( ), throw = cms.bool( True ) @@ -11270,6 +11274,7 @@ process.hltPreExpressOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_Physics_v7', 'HLT_Random_v3', @@ -11284,6 +11289,7 @@ process.hltPreExpressAlignmentOutputSmart = cms.EDFilter( "TriggerResultsFilter", l1tIgnoreMaskAndPrescale = cms.bool( False ), l1tResults = cms.InputTag( "" ), + usePathStatus = cms.bool( False ), hltResults = cms.InputTag( 'TriggerResults','','@currentProcess' ), triggerConditions = cms.vstring( 'HLT_ZeroBias_Beamspot_v4', 'HLT_HIHT80_Beamspot_ppRef5TeV_v3' ), diff --git a/HLTrigger/Configuration/test/getFrozenHLT.sh b/HLTrigger/Configuration/test/getFrozenHLT.sh index e15e4fd0ea646..7e402f7a0033f 100755 --- a/HLTrigger/Configuration/test/getFrozenHLT.sh +++ b/HLTrigger/Configuration/test/getFrozenHLT.sh @@ -2,9 +2,9 @@ # ConfDB configurations to use TABLES="Fake Fake1 Fake2" -HLT_Fake="/dev/CMSSW_11_3_0/Fake" -HLT_Fake1="/dev/CMSSW_11_3_0/Fake1" -HLT_Fake2="/dev/CMSSW_11_3_0/Fake2" +HLT_Fake="/dev/CMSSW_12_0_0/Fake" +HLT_Fake1="/dev/CMSSW_12_0_0/Fake1" +HLT_Fake2="/dev/CMSSW_12_0_0/Fake2" # print extra messages ? VERBOSE=false diff --git a/HLTrigger/Configuration/test/getHLT.sh b/HLTrigger/Configuration/test/getHLT.sh index d0d586f1aef0a..ecf99d55dcdfd 100755 --- a/HLTrigger/Configuration/test/getHLT.sh +++ b/HLTrigger/Configuration/test/getHLT.sh @@ -1,8 +1,8 @@ #! /bin/bash # ConfDB configurations to use -MASTER="/dev/CMSSW_11_3_0/HLT" # no explicit version, take the most recent -TARGET="/dev/CMSSW_11_3_0/\$TABLE" # no explicit version, take the most recent +MASTER="/dev/CMSSW_12_0_0/HLT" # no explicit version, take the most recent +TARGET="/dev/CMSSW_12_0_0/\$TABLE" # no explicit version, take the most recent TABLES="GRun HIon PIon PRef" # $TABLE in the above variable will be expanded to these TABLES From a3612b9f645f090936f5e19db877781d8ec0ec1b Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Thu, 13 May 2021 10:18:22 +0200 Subject: [PATCH 299/309] remove useless cfi --- .../Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 L1Trigger/Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py deleted file mode 100644 index 82d47fbe84677..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1METPFProducer_cfi.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -L1METPFProducer = cms.EDProducer("L1METPFProducer", - L1PFObjects = cms.InputTag("L1PFProducer","l1pfCandidates"), - maxCandidates = cms.int32(128), -) From d2cb093cb020425142cdb57553206375d9389aa8 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Thu, 13 May 2021 10:23:04 +0200 Subject: [PATCH 300/309] minor comment from Silvio --- L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc index 419af6d86fdef..4ccff7bcb6d21 100644 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc +++ b/L1Trigger/Phase2L1ParticleFlow/plugins/L1METPFProducer.cc @@ -52,7 +52,9 @@ class L1METPFProducer : public edm::global::EDProducer<> { void Project(pt_t pt, phi_t phi, pxy_t& pxy, bool isX, bool debug = false) const; void PhiFromXY(pxy_t px, pxy_t py, phi_t& phi, bool debug = false) const; - void CalcMetHLS(std::vector<float> pt, std::vector<float> phi, reco::Candidate::PolarLorentzVector& metVector) const; + void CalcMetHLS(const std::vector<float>& pt, + const std::vector<float>& phi, + reco::Candidate::PolarLorentzVector& metVector) const; }; L1METPFProducer::L1METPFProducer(const edm::ParameterSet& cfg) @@ -85,8 +87,8 @@ void L1METPFProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::Even iEvent.put(std::move(metCollection)); } -void L1METPFProducer::CalcMetHLS(std::vector<float> pt, - std::vector<float> phi, +void L1METPFProducer::CalcMetHLS(const std::vector<float>& pt, + const std::vector<float>& phi, reco::Candidate::PolarLorentzVector& metVector) const { pxy_t hw_px = 0; pxy_t hw_py = 0; From be5b0d9d3e5bb385adac91bb341e0f02089a5ace Mon Sep 17 00:00:00 2001 From: Andrea <perrotta@cern.ch> Date: Thu, 13 May 2021 10:28:23 +0200 Subject: [PATCH 301/309] Deprecated parameter and header cleaning --- .../plugins/SiPixelDigiToRaw.cc | 30 +++++++------------ .../plugins/SiPixelRawToDigi.cc | 5 ++-- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc index 348503dd5a412..b340a78fecf7c 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc @@ -1,37 +1,30 @@ #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/CPUTimer.h" +#include "FWCore/Utilities/interface/thread_safety_macros.h" +#include "FWCore/Utilities/interface/ESGetToken.h" + +#include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h" #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" +#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" #include "CondFormats/SiPixelObjects/interface/SiPixelFrameReverter.h" -#include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" - -#include "FWCore/Framework/interface/MakerMacros.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "FWCore/Utilities/interface/thread_safety_macros.h" -#include "FWCore/Utilities/interface/ESGetToken.h" - #include "DataFormats/Common/interface/DetSetVector.h" -#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "DataFormats/FEDRawData/interface/FEDRawData.h" - -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingMap.h" -#include "CondFormats/SiPixelObjects/interface/SiPixelFedCablingTree.h" +#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" +#include "DataFormats/SiPixelDigi/interface/PixelDigi.h" #include "EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h" -#include "CondFormats/SiPixelObjects/interface/PixelFEDCabling.h" - -#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h" #include <atomic> #include <memory> @@ -177,7 +170,6 @@ void SiPixelDigiToRaw::fillDescriptions(edm::ConfigurationDescriptions& descript edm::ParameterSetDescription desc; desc.add<edm::InputTag>("InputLabel"); desc.add<bool>("UsePhase1", false); - desc.addUntracked<bool>("Timing", false)->setComment("deprecated"); descriptions.add("siPixelRawData", desc); } diff --git a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc index ffe3b246782e6..ce704452a3e5a 100644 --- a/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc +++ b/EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc @@ -11,15 +11,14 @@ #include "DataFormats/Common/interface/Handle.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/ESTransientHandle.h" -#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" - #include "FWCore/Framework/interface/ESWatcher.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Utilities/interface/ESGetToken.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" From 501de416675d2c80645e991da63032254b9d6573 Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury <suvankar.roy.chowdhury@cern.ch> Date: Thu, 13 May 2021 10:38:23 +0200 Subject: [PATCH 302/309] fix es data access --- .../plugins/L1TriggerResultsConverter.cc | 20 +++++++++---------- .../NanoAOD/plugins/LHCInfoProducer.cc | 13 ++++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc b/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc index a78b3cfc4bb59..9cd410cc78c74 100644 --- a/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc +++ b/PhysicsTools/NanoAOD/plugins/L1TriggerResultsConverter.cc @@ -64,6 +64,9 @@ class L1TriggerResultsConverter : public edm::stream::EDProducer<> { const edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> tokenLegacy_; const edm::EDGetTokenT<GlobalAlgBlkBxCollection> token_; const edm::EDGetTokenT<GlobalExtBlkBxCollection> token_ext_; + edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> l1gtmenuToken_; + edm::ESGetToken<L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd> l1gtalgoMaskToken_; + edm::ESGetToken<L1TUtmTriggerMenu, L1TUtmTriggerMenuRcd> l1utmTrigToken_; std::vector<std::string> names_; std::vector<unsigned int> mask_; std::vector<unsigned int> indices_; @@ -83,7 +86,10 @@ L1TriggerResultsConverter::L1TriggerResultsConverter(const edm::ParameterSet& pa : edm::EDGetTokenT<GlobalAlgBlkBxCollection>()), token_ext_(store_unprefireable_bit_ ? consumes<GlobalExtBlkBxCollection>(params.getParameter<edm::InputTag>("src_ext")) - : edm::EDGetTokenT<GlobalExtBlkBxCollection>()) { + : edm::EDGetTokenT<GlobalExtBlkBxCollection>()), + l1gtmenuToken_(esConsumes<edm::Transition::BeginRun>()), + l1gtalgoMaskToken_(esConsumes<edm::Transition::BeginRun>()), + l1utmTrigToken_(esConsumes<edm::Transition::BeginRun>()) { produces<edm::TriggerResults>(); } @@ -101,20 +107,14 @@ void L1TriggerResultsConverter::beginRun(edm::Run const&, edm::EventSetup const& names_.clear(); indices_.clear(); if (legacyL1_) { - edm::ESHandle<L1GtTriggerMenu> handleMenu; - edm::ESHandle<L1GtTriggerMask> handleAlgoMask; - setup.get<L1GtTriggerMenuRcd>().get(handleMenu); - auto const& mapping = handleMenu->gtAlgorithmAliasMap(); + auto const& mapping = setup.getHandle(l1gtmenuToken_)->gtAlgorithmAliasMap(); for (auto const& keyval : mapping) { names_.push_back(keyval.first); indices_.push_back(keyval.second.algoBitNumber()); } - setup.get<L1GtTriggerMaskAlgoTrigRcd>().get(handleAlgoMask); - mask_ = handleAlgoMask->gtTriggerMask(); + mask_ = setup.getHandle(l1gtalgoMaskToken_)->gtTriggerMask(); } else { - edm::ESHandle<L1TUtmTriggerMenu> menu; - setup.get<L1TUtmTriggerMenuRcd>().get(menu); - auto const& mapping = menu->getAlgorithmMap(); + auto const& mapping = setup.getHandle(l1utmTrigToken_)->getAlgorithmMap(); for (auto const& keyval : mapping) { names_.push_back(keyval.first); indices_.push_back(keyval.second.getIndex()); diff --git a/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc b/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc index ffc6ffa734dad..c40477c2cf74a 100644 --- a/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc @@ -50,7 +50,7 @@ class LHCInfoProducer : public edm::global::EDProducer<edm::BeginLuminosityBlockProducer> { public: - LHCInfoProducer(edm::ParameterSet const&) { + LHCInfoProducer(edm::ParameterSet const&) : lhcinfoToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()) { produces<nanoaod::MergeableCounterTable, edm::Transition::BeginLuminosityBlock>(); } ~LHCInfoProducer() override {} @@ -59,13 +59,11 @@ class LHCInfoProducer : public edm::global::EDProducer<edm::BeginLuminosityBlock void produce(edm::StreamID id, edm::Event& iEvent, const edm::EventSetup& iSetup) const override {} void globalBeginLuminosityBlockProduce(edm::LuminosityBlock& iLumi, edm::EventSetup const& iSetup) const override { - edm::ESHandle<LHCInfo> lhcInfo; - iSetup.get<LHCInfoRcd>().get(lhcInfo); - const LHCInfo* info = lhcInfo.product(); + const auto& info = iSetup.getData(lhcinfoToken_); auto out = std::make_unique<nanoaod::MergeableCounterTable>(); - out->addFloat("crossingAngle", "LHC crossing angle", info->crossingAngle()); - out->addFloat("betaStar", "LHC beta star", info->betaStar()); - out->addFloat("energy", "LHC beam energy", info->energy()); + out->addFloat("crossingAngle", "LHC crossing angle", info.crossingAngle()); + out->addFloat("betaStar", "LHC beta star", info.betaStar()); + out->addFloat("energy", "LHC beam energy", info.energy()); iLumi.put(std::move(out)); } @@ -75,6 +73,7 @@ class LHCInfoProducer : public edm::global::EDProducer<edm::BeginLuminosityBlock desc.setUnknown(); descriptions.addDefault(desc); } + edm::ESGetToken<LHCInfo, LHCInfoRcd> lhcinfoToken_; }; DEFINE_FWK_MODULE(LHCInfoProducer); From 3a260b8cdd08b619dc969bcf54dc787ee9d5a8eb Mon Sep 17 00:00:00 2001 From: Ianna Osborne <ianna.osborne@cern.ch> Date: Thu, 13 May 2021 10:40:49 +0200 Subject: [PATCH 303/309] update unit test --- DataFormats/Math/interface/CMSUnits.h | 1 + DataFormats/Math/interface/GeantUnits.h | 1 + DataFormats/Math/interface/angle_units.h | 13 +++++++++++-- DetectorDescription/Core/test/BuildFile.xml | 3 --- DetectorDescription/DDCMS/test/BuildFile.xml | 4 ++++ .../{Core => DDCMS}/test/DDUnits.cppunit.cc | 18 +++++++++--------- 6 files changed, 26 insertions(+), 14 deletions(-) rename DetectorDescription/{Core => DDCMS}/test/DDUnits.cppunit.cc (83%) diff --git a/DataFormats/Math/interface/CMSUnits.h b/DataFormats/Math/interface/CMSUnits.h index 7d10ac9f49985..0c3fea27c92f7 100644 --- a/DataFormats/Math/interface/CMSUnits.h +++ b/DataFormats/Math/interface/CMSUnits.h @@ -18,6 +18,7 @@ namespace cms_units { using angle_units::operators::operator""_deg; using angle_units::operators::operator""_pi; using angle_units::operators::operator""_rad; + using angle_units::operators::almostEqual; using angle_units::operators::convertDegToRad; using angle_units::operators::convertRadToDeg; diff --git a/DataFormats/Math/interface/GeantUnits.h b/DataFormats/Math/interface/GeantUnits.h index 334d1a0668089..ec627d0c51a5c 100644 --- a/DataFormats/Math/interface/GeantUnits.h +++ b/DataFormats/Math/interface/GeantUnits.h @@ -23,6 +23,7 @@ namespace geant_units { using angle_units::operators::operator""_deg; using angle_units::operators::operator""_pi; using angle_units::operators::operator""_rad; + using angle_units::operators::almostEqual; using angle_units::operators::convertDegToRad; using angle_units::operators::convertRadToDeg; diff --git a/DataFormats/Math/interface/angle_units.h b/DataFormats/Math/interface/angle_units.h index bcdc44239fb9f..dce9138e9e94f 100644 --- a/DataFormats/Math/interface/angle_units.h +++ b/DataFormats/Math/interface/angle_units.h @@ -5,8 +5,8 @@ namespace angle_units { - constexpr long double piRadians(M_PIl); // M_PIl is long double version of pi - constexpr long double degPerRad = 180. / piRadians; // Degrees per radian + constexpr double piRadians(M_PI); + constexpr double degPerRad = 180. / piRadians; // Degrees per radian namespace operators { @@ -28,6 +28,15 @@ namespace angle_units { { return (degrees / degPerRad); } + + template <class NumType> + typename std::enable_if<!std::numeric_limits<NumType>::is_integer, bool>::type almostEqual(NumType x, + NumType y, + int ulp) { + return std::fabs(x - y) <= std::numeric_limits<NumType>::epsilon() * std::fabs(x + y) * ulp || + std::fabs(x - y) < std::numeric_limits<NumType>::min(); + } + } // namespace operators } // namespace angle_units diff --git a/DetectorDescription/Core/test/BuildFile.xml b/DetectorDescription/Core/test/BuildFile.xml index 62b629ed03d8b..2c2383c30e494 100644 --- a/DetectorDescription/Core/test/BuildFile.xml +++ b/DetectorDescription/Core/test/BuildFile.xml @@ -16,9 +16,6 @@ <bin name="testShapes" file="testShapes.cpp"> </bin> -<bin name="testUnits" file="testRunner.cpp,DDUnits.cppunit.cc"> -</bin> - <bin file="clhepToROOTMath.cpp"> </bin> diff --git a/DetectorDescription/DDCMS/test/BuildFile.xml b/DetectorDescription/DDCMS/test/BuildFile.xml index 9e6f6b904bd6b..9da64a9377f34 100644 --- a/DetectorDescription/DDCMS/test/BuildFile.xml +++ b/DetectorDescription/DDCMS/test/BuildFile.xml @@ -66,3 +66,7 @@ <use name="FWCore/Utilities"/> <flags TEST_RUNNER_ARGS="/bin/bash DetectorDescription/DDCMS/test runTest.sh"/> </bin> + +<bin name="testDDUnits" file="testRunner.cpp,DDUnits.cppunit.cc"> + <use name="clhep"/> +</bin> diff --git a/DetectorDescription/Core/test/DDUnits.cppunit.cc b/DetectorDescription/DDCMS/test/DDUnits.cppunit.cc similarity index 83% rename from DetectorDescription/Core/test/DDUnits.cppunit.cc rename to DetectorDescription/DDCMS/test/DDUnits.cppunit.cc index 0c0f25904c2ef..9bbffc446f372 100644 --- a/DetectorDescription/Core/test/DDUnits.cppunit.cc +++ b/DetectorDescription/DDCMS/test/DDUnits.cppunit.cc @@ -29,17 +29,17 @@ CPPUNIT_TEST_SUITE_REGISTRATION(testDDUnits); void testDDUnits::checkUnits() { std::cout << "\nMy pi: " << std::setprecision(16) << piRadians << " == " << 1_pi << " == " << 1._pi << "\n"; - CPPUNIT_ASSERT(M_PIl == piRadians); - CPPUNIT_ASSERT(M_PIl == 1_pi); - CPPUNIT_ASSERT(M_PIl == 1._pi); + CPPUNIT_ASSERT(M_PI == piRadians); + CPPUNIT_ASSERT(M_PI == 1_pi); + CPPUNIT_ASSERT(M_PI == 1._pi); double twoPiAngle = 2_pi; std::cout << "My 2pi angle: " << twoPiAngle << " [rad] == " << convertRadToDeg(twoPiAngle) << " [deg]\n"; - CPPUNIT_ASSERT(2 * M_PIl == 2 * piRadians); + CPPUNIT_ASSERT(2 * M_PI == 2 * piRadians); CPPUNIT_ASSERT(2 * M_PI == twoPiAngle); - CPPUNIT_ASSERT(2 * M_PIl == 2_pi); - CPPUNIT_ASSERT(2 * M_PIl == 2._pi); + CPPUNIT_ASSERT(2 * M_PI == 2_pi); + CPPUNIT_ASSERT(2 * M_PI == 2._pi); CPPUNIT_ASSERT(90_deg == 1_pi / 2); CPPUNIT_ASSERT(120_deg == 2_pi / 3); @@ -50,13 +50,13 @@ void testDDUnits::checkUnits() { CPPUNIT_ASSERT(angle90 == 90); double angle120 = convertRadToDeg(2_pi / 3); - CPPUNIT_ASSERT(angle120 == 120.); + CPPUNIT_ASSERT(almostEqual(angle120, 120., 2)); double angle135 = convertRadToDeg(3_pi / 4); - CPPUNIT_ASSERT(angle135 == 135.); + CPPUNIT_ASSERT(almostEqual(angle135, 135., 2)); double angle150 = convertRadToDeg(5_pi / 6); - CPPUNIT_ASSERT(angle150 == 150.); + CPPUNIT_ASSERT(almostEqual(angle150, 150., 2)); cout << "Mass of 1 kg is " << 1._kg << " or " << 1 * CLHEP::kg << "\n"; cout << "Mass of 1 g is " << 1._g << " or " << 1 * CLHEP::g << "\n"; From e65c382ffc2ba5f577ad6afdfe43f9ff2b62d89e Mon Sep 17 00:00:00 2001 From: cecilecaillol <cecilecaillol@gmail.com> Date: Thu, 13 May 2021 16:15:29 +0200 Subject: [PATCH 304/309] L1T: add HPS taus (#33681) * Uploaded HPS Tau algorithm for new PR (cherry picked from commit 8f55d733315824bd1c5d04c2888bbd322cc6a2ac) * modified considering Andrea's comments (cherry picked from commit a30f47c363191b2d39c0ff137b286d84d9770478) * DataFormats/Phase2L1Taus is merged with DataFormats/L1TParticleFlow (cherry picked from commit 21829a0a5bc3c2f84025848d37d1f570ef38625a) * renamed HPSPFTauBuilder and HPSPFTauQualityCut as original (cherry picked from commit 391723c56fcdb1cb18bbc8e53a07cd4346f1d576) * code format * code format * fix BuildFile * remove cout and switch to CaloJet Co-authored-by: sandeepbhowmik1 <sandeep.bhowmik@cern.ch> Co-authored-by: ccaillol <ccaillol@cern.ch> --- DataFormats/L1TParticleFlow/BuildFile.xml | 1 + .../L1TParticleFlow/interface/HPSPFTau.h | 89 +++- .../L1TParticleFlow/interface/HPSPFTauFwd.h | 7 +- DataFormats/L1TParticleFlow/src/HPSPFTau.cc | 35 +- .../L1TParticleFlow/src/classes_def.xml | 8 +- L1Trigger/Phase2L1Taus/BuildFile.xml | 5 + .../interface/L1HPSPFTauBuilder.h | 100 ++++ .../interface/L1HPSPFTauQualityCut.h | 46 ++ L1Trigger/Phase2L1Taus/plugins/BuildFile.xml | 13 + .../Phase2L1Taus/plugins/HPSPFTauProducer.cc | 280 +++++++++++ .../Phase2L1Taus/plugins/HPSPFTauProducer.h | 72 +++ .../python/HPSPFTauProducerPF_cfi.py | 6 + .../python/HPSPFTauProducerPuppi_cfi.py | 28 ++ .../Phase2L1Taus/python/l1emulator_cff.py | 47 ++ .../Phase2L1Taus/src/L1HPSPFTauBuilder.cc | 437 ++++++++++++++++++ .../Phase2L1Taus/src/L1HPSPFTauQualityCut.cc | 98 ++++ .../Phase2L1Taus/test/produceHPSPFTaus_cfg.py | 207 +++++++++ 17 files changed, 1440 insertions(+), 39 deletions(-) create mode 100644 L1Trigger/Phase2L1Taus/BuildFile.xml create mode 100644 L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h create mode 100644 L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h create mode 100644 L1Trigger/Phase2L1Taus/plugins/BuildFile.xml create mode 100644 L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc create mode 100644 L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h create mode 100644 L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py create mode 100644 L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPuppi_cfi.py create mode 100644 L1Trigger/Phase2L1Taus/python/l1emulator_cff.py create mode 100644 L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc create mode 100644 L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc create mode 100644 L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py diff --git a/DataFormats/L1TParticleFlow/BuildFile.xml b/DataFormats/L1TParticleFlow/BuildFile.xml index c647cee335b3c..791c2fadaf728 100644 --- a/DataFormats/L1TParticleFlow/BuildFile.xml +++ b/DataFormats/L1TParticleFlow/BuildFile.xml @@ -5,6 +5,7 @@ <use name="DataFormats/L1TCorrelator"/> <use name="FWCore/Utilities"/> <use name="rootrflx"/> + <export> <lib name="1"/> </export> diff --git a/DataFormats/L1TParticleFlow/interface/HPSPFTau.h b/DataFormats/L1TParticleFlow/interface/HPSPFTau.h index 3fbc7f64fd59b..68b3e8c43d028 100644 --- a/DataFormats/L1TParticleFlow/interface/HPSPFTau.h +++ b/DataFormats/L1TParticleFlow/interface/HPSPFTau.h @@ -2,7 +2,7 @@ #define DataFormats_L1TParticleFlow_HPSPFTau_H #include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateRef, l1t::PFCandidateRefVector -#include "DataFormats/L1TParticleFlow/interface/PFJet.h" // l1t::PFJet, l1t::PFJetCollection, l1t::PFJetRef +#include "DataFormats/JetReco/interface/CaloJet.h" #include "DataFormats/Candidate/interface/LeafCandidate.h" // reco::LeafCandidate #include "DataFormats/Candidate/interface/Particle.h" // reco::Particle::LorentzVector #include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" @@ -21,10 +21,10 @@ namespace l1t { /// accessor functions for reco level quantities bool isChargedPFCandSeeded() const { return seedChargedPFCand_.isNonnull(); } - bool isPFJetSeeded() const { return seedPFJet_.isNonnull(); } + bool isJetSeeded() const { return seedJet_.isNonnull(); } const l1t::PFCandidateRef& seedChargedPFCand() const { return seedChargedPFCand_; } - const l1t::PFJetRef& seedPFJet() const { return seedPFJet_; } + const reco::CaloJetRef& seedJet() const { return seedJet_; } const l1t::PFCandidateRef& leadChargedPFCand() const { return leadChargedPFCand_; } const l1t::PFCandidateRefVector& signalAllL1PFCandidates() const { return signalAllL1PFCandidates_; } @@ -57,9 +57,9 @@ namespace l1t { enum Kind { kUndefined, kOneProng0Pi0, kOneProng1Pi0, kThreeProng0Pi0, kThreeProng1Pi0 }; Kind tauType() const { return tauType_; } - const reco::Particle::LorentzVector& strip_p4() const { return strip_p4_; } + const reco::Particle::LorentzVector& stripP4() const { return stripP4_; } - float sumAllL1PFCandidates_pt() const { return sumAllL1PFCandidates_pt_; } + float sumAllL1PFCandidatesPt() const { return sumAllL1PFCandidatesPt_; } float signalConeSize() const { return signalConeSize_; } float isolationConeSize() const { return signalConeSize_; } @@ -67,7 +67,6 @@ namespace l1t { float sumNeutralIso() const { return sumNeutralIso_; } float sumCombinedIso() const { return sumCombinedIso_; } float sumChargedIsoPileup() const { return sumChargedIsoPileup_; } - float rhoCorr() const { return rhoCorr_; } bool passTightIso() const { return passTightIso_; } bool passMediumIso() const { return passMediumIso_; } @@ -79,9 +78,75 @@ namespace l1t { bool passLooseRelIso() const { return passLooseRelIso_; } bool passVLooseRelIso() const { return passVLooseRelIso_; } + void setSeedChargedPFCand(l1t::PFCandidateRef seedChargedPFCand) { seedChargedPFCand_ = seedChargedPFCand; } + void setSeedJet(reco::CaloJetRef seedJet) { seedJet_ = seedJet; } + void setLeadChargedPFCand(l1t::PFCandidateRef leadChargedPFCand) { leadChargedPFCand_ = leadChargedPFCand; } + + void setSignalAllL1PFCandidates(l1t::PFCandidateRefVector signalAllL1PFCandidates) { + signalAllL1PFCandidates_ = signalAllL1PFCandidates; + } + void setSignalChargedHadrons(l1t::PFCandidateRefVector signalChargedHadrons) { + signalChargedHadrons_ = signalChargedHadrons; + } + void setSignalElectrons(l1t::PFCandidateRefVector signalElectrons) { signalElectrons_ = signalElectrons; } + void setSignalNeutralHadrons(l1t::PFCandidateRefVector signalNeutralHadrons) { + signalNeutralHadrons_ = signalNeutralHadrons; + } + void setSignalPhotons(l1t::PFCandidateRefVector signalPhotons) { signalPhotons_ = signalPhotons; } + void setSignalMuons(l1t::PFCandidateRefVector signalMuons) { signalMuons_ = signalMuons; } + + void setStripAllL1PFCandidates(l1t::PFCandidateRefVector stripAllL1PFCandidates) { + stripAllL1PFCandidates_ = stripAllL1PFCandidates; + } + void setStripElectrons(l1t::PFCandidateRefVector stripElectrons) { stripElectrons_ = stripElectrons; } + void setStripPhotons(l1t::PFCandidateRefVector stripPhotons) { stripPhotons_ = stripPhotons; } + + void setIsoAllL1PFCandidates(l1t::PFCandidateRefVector isoAllL1PFCandidates) { + isoAllL1PFCandidates_ = isoAllL1PFCandidates; + } + void setIsoChargedHadrons(l1t::PFCandidateRefVector isoChargedHadrons) { isoChargedHadrons_ = isoChargedHadrons; } + void setIsoElectrons(l1t::PFCandidateRefVector isoElectrons) { isoElectrons_ = isoElectrons; } + void setIsoNeutralHadrons(l1t::PFCandidateRefVector isoNeutralHadrons) { isoNeutralHadrons_ = isoNeutralHadrons; } + void setIsoPhotons(l1t::PFCandidateRefVector isoPhotons) { isoPhotons_ = isoPhotons; } + void setIsoMuons(l1t::PFCandidateRefVector isoMuons) { isoMuons_ = isoMuons; } + + void setSumAllL1PFCandidates(l1t::PFCandidateRefVector sumAllL1PFCandidates) { + sumAllL1PFCandidates_ = sumAllL1PFCandidates; + } + void setSumChargedHadrons(l1t::PFCandidateRefVector sumChargedHadrons) { sumChargedHadrons_ = sumChargedHadrons; } + void setSumElectrons(l1t::PFCandidateRefVector sumElectrons) { sumElectrons_ = sumElectrons; } + void setSumNeutralHadrons(l1t::PFCandidateRefVector sumNeutralHadrons) { sumNeutralHadrons_ = sumNeutralHadrons; } + void setSumPhotons(l1t::PFCandidateRefVector sumPhotons) { sumPhotons_ = sumPhotons; } + void setSumMuons(l1t::PFCandidateRefVector sumMuons) { sumMuons_ = sumMuons; } + + void setPrimaryVertex(l1t::TkPrimaryVertexRef primaryVertex) { primaryVertex_ = primaryVertex; } + + void setTauType(Kind tauType) { tauType_ = tauType; } + + void setStripP4(reco::Particle::LorentzVector& stripP4) { stripP4_ = stripP4; } + + void setSumAllL1PFCandidatesPt(float sumAllL1PFCandidatesPt) { sumAllL1PFCandidatesPt_ = sumAllL1PFCandidatesPt; } + void setSignalConeSize(float signalConeSize) { signalConeSize_ = signalConeSize; } + void setisolationConeSize(float isolationConeSize) { signalConeSize_ = isolationConeSize; } + + void setSumChargedIso(float sumChargedIso) { sumChargedIso_ = sumChargedIso; } + void setSumNeutralIso(float sumNeutralIso) { sumNeutralIso_ = sumNeutralIso; } + void setSumCombinedIso(float sumCombinedIso) { sumCombinedIso_ = sumCombinedIso; } + void setSumChargedIsoPileup(float sumChargedIsoPileup) { sumChargedIsoPileup_ = sumChargedIsoPileup; } + + void setPassTightIso(bool passTightIso) { passTightIso_ = passTightIso; } + void setPassMediumIso(bool passMediumIso) { passMediumIso_ = passMediumIso; } + void setPassLooseIso(bool passLooseIso) { passLooseIso_ = passLooseIso; } + void setPassVLooseIso(bool passVLooseIso) { passVLooseIso_ = passVLooseIso; } + + void setPassTightRelIso(bool passTightRelIso) { passTightRelIso_ = passTightRelIso; } + void setPassMediumRelIso(bool passMediumRelIso) { passMediumRelIso_ = passMediumRelIso; } + void setPassLooseRelIso(bool passLooseRelIso) { passLooseRelIso_ = passLooseRelIso; } + void setPassVLooseRelIso(bool passVLooseRelIso) { passVLooseRelIso_ = passVLooseRelIso; } + private: l1t::PFCandidateRef seedChargedPFCand_; - l1t::PFJetRef seedPFJet_; + reco::CaloJetRef seedJet_; l1t::PFCandidateRef leadChargedPFCand_; l1t::PFCandidateRefVector signalAllL1PFCandidates_; @@ -112,9 +177,9 @@ namespace l1t { l1t::TkPrimaryVertexRef primaryVertex_; Kind tauType_; - reco::Particle::LorentzVector strip_p4_; + reco::Particle::LorentzVector stripP4_; - float sumAllL1PFCandidates_pt_; + float sumAllL1PFCandidatesPt_; float signalConeSize_; float isolationConeSize_; @@ -122,7 +187,6 @@ namespace l1t { float sumNeutralIso_; float sumCombinedIso_; float sumChargedIsoPileup_; // charged PFCands failing dz cut (maybe useful to correct neutral isolation for pile-up contributions by applying delta-beta corrections) - float rhoCorr_; // rho correction (maybe useful for applying pile-up corrections to neutral isolation) bool passTightIso_; bool passMediumIso_; @@ -135,11 +199,12 @@ namespace l1t { bool passVLooseRelIso_; }; - void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex); - void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertex_z); } // namespace l1t /// print to stream std::ostream& operator<<(std::ostream& os, const l1t::HPSPFTau& l1PFTau); +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex); +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertexZ); + #endif diff --git a/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h b/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h index 6d9af0e32ed98..d7392819a7fcc 100644 --- a/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h +++ b/DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h @@ -1,14 +1,9 @@ #ifndef DataFormats_L1TParticleFlow_HPSPFTauFwd_H #define DataFormats_L1TParticleFlow_HPSPFTauFwd_H -#include <vector> -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" +#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" namespace l1t { - - class HPSPFTau; - typedef std::vector<HPSPFTau> HPSPFTauCollection; typedef edm::Ref<HPSPFTauCollection> HPSPFTauRef; diff --git a/DataFormats/L1TParticleFlow/src/HPSPFTau.cc b/DataFormats/L1TParticleFlow/src/HPSPFTau.cc index 3eb8f7526e178..a346c1b963943 100644 --- a/DataFormats/L1TParticleFlow/src/HPSPFTau.cc +++ b/DataFormats/L1TParticleFlow/src/HPSPFTau.cc @@ -8,7 +8,6 @@ l1t::HPSPFTau::HPSPFTau() sumNeutralIso_(0.), sumCombinedIso_(0.), sumChargedIsoPileup_(0.), - rhoCorr_(0.), passTightIso_(false), passMediumIso_(false), passLooseIso_(false), @@ -34,8 +33,8 @@ ostream& operator<<(ostream& os, const l1t::HPSPFTau& l1PFTau) { os << "seed:"; if (l1PFTau.isChargedPFCandSeeded()) { os << " chargedPFCand"; - } else if (l1PFTau.isPFJetSeeded()) { - os << " PFJet"; + } else if (l1PFTau.isJetSeeded()) { + os << " CaloJet"; } else { cms::Exception ex("InconsistentTau"); ex.addContext("Calling HPSPFTau::operator <<"); @@ -51,7 +50,7 @@ ostream& operator<<(ostream& os, const l1t::HPSPFTau& l1PFTau) { for (const auto& l1PFCand : l1PFTau.stripAllL1PFCandidates()) { printPFCand(os, *l1PFCand, l1PFTau.primaryVertex()); } - os << "strip pT = " << l1PFTau.strip_p4().pt() << std::endl; + os << "strip pT = " << l1PFTau.stripP4().pt() << std::endl; os << "isolationPFCands:" << std::endl; for (const auto& l1PFCand : l1PFTau.isoAllL1PFCandidates()) { printPFCand(os, *l1PFCand, l1PFTau.primaryVertex()); @@ -61,30 +60,30 @@ ostream& operator<<(ostream& os, const l1t::HPSPFTau& l1PFTau) { return os; } -void l1t::printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex) { - float primaryVertex_z = (primaryVertex.isNonnull()) ? primaryVertex->zvertex() : 0.; - l1t::printPFCand(os, l1PFCand, primaryVertex_z); +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex) { + float primaryVertexZ = (primaryVertex.isNonnull()) ? primaryVertex->zvertex() : 0.; + printPFCand(os, l1PFCand, primaryVertexZ); } -void l1t::printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertex_z) { - std::string type_string; +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertexZ) { + std::string typeString; if (l1PFCand.id() == l1t::PFCandidate::ChargedHadron) - type_string = "PFChargedHadron"; + typeString = "PFChargedHadron"; else if (l1PFCand.id() == l1t::PFCandidate::Electron) - type_string = "PFElectron"; + typeString = "PFElectron"; else if (l1PFCand.id() == l1t::PFCandidate::NeutralHadron) - type_string = "PFNeutralHadron"; + typeString = "PFNeutralHadron"; else if (l1PFCand.id() == l1t::PFCandidate::Photon) - type_string = "PFPhoton"; + typeString = "PFPhoton"; else if (l1PFCand.id() == l1t::PFCandidate::Muon) - type_string = "PFMuon"; + typeString = "PFMuon"; else - type_string = "N/A"; - os << " " << type_string << " with pT = " << l1PFCand.pt() << ", eta = " << l1PFCand.eta() + typeString = "N/A"; + os << " " << typeString << " with pT = " << l1PFCand.pt() << ", eta = " << l1PFCand.eta() << ", phi = " << l1PFCand.phi() << "," << " mass = " << l1PFCand.mass() << ", charge = " << l1PFCand.charge(); - if (l1PFCand.charge() != 0 && primaryVertex_z != 0.) { - os << " (dz = " << std::fabs(l1PFCand.pfTrack()->vertex().z() - primaryVertex_z) << ")"; + if (l1PFCand.charge() != 0 && primaryVertexZ != 0.) { + os << " (dz = " << std::fabs(l1PFCand.pfTrack()->vertex().z() - primaryVertexZ) << ")"; } os << std::endl; } diff --git a/DataFormats/L1TParticleFlow/src/classes_def.xml b/DataFormats/L1TParticleFlow/src/classes_def.xml index 21831204808af..112f0566c7b84 100644 --- a/DataFormats/L1TParticleFlow/src/classes_def.xml +++ b/DataFormats/L1TParticleFlow/src/classes_def.xml @@ -44,13 +44,15 @@ <class name="edm::RefVector<l1t::PFTauCollection>" /> <class name="std::vector<edm::Ref<l1t::PFTauCollection> >" /> - <class name="l1t::HPSPFTau" ClassVersion="11"> - <version ClassVersion="11" checksum="98678086"/> + <class name="l1t::HPSPFTau" ClassVersion="12"> + <version ClassVersion="11" checksum="98678086"/> + <version ClassVersion="12" checksum="1127525942"/> </class> <class name="l1t::HPSPFTauCollection"/> <class name="edm::Wrapper<l1t::HPSPFTauCollection>"/> <class name="edm::Ref<l1t::HPSPFTauCollection>" /> - <class name="edm::RefVector<l1t::HPSPFTauCollection>" /> + <class name="edm::RefVector<l1t::HPSPFTauCollection>" /> <class name="std::vector<edm::Ref<l1t::HPSPFTauCollection> >" /> + </lcgdict> diff --git a/L1Trigger/Phase2L1Taus/BuildFile.xml b/L1Trigger/Phase2L1Taus/BuildFile.xml new file mode 100644 index 0000000000000..fe08b469b894c --- /dev/null +++ b/L1Trigger/Phase2L1Taus/BuildFile.xml @@ -0,0 +1,5 @@ +<use name="CommonTools/UtilAlgos"/> +<use name="DataFormats/L1TParticleFlow"/> +<export> + <lib name="1"/> +</export> diff --git a/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h new file mode 100644 index 0000000000000..0dca7074803d6 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h @@ -0,0 +1,100 @@ +#ifndef L1Trigger_Phase2L1Taus_L1HPSPFTauBuilder_h +#define L1Trigger_Phase2L1Taus_L1HPSPFTauBuilder_h + +#include "FWCore/ParameterSet/interface/ParameterSet.h" // edm::ParameterSet +#include "DataFormats/Provenance/interface/ProductID.h" // edm::ProductID +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" // L1HPSPFTauQualityCut +#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "CommonTools/Utils/interface/FormulaEvaluator.h" +#include <vector> + +class L1HPSPFTauBuilder { +public: + L1HPSPFTauBuilder(const edm::ParameterSet& cfg); + ~L1HPSPFTauBuilder() = default; + + void reset(); + void setL1PFCandProductID(const edm::ProductID& l1PFCandProductID); + void setVertex(const l1t::TkPrimaryVertexRef& primaryVertex); + void setL1PFTauSeed(const l1t::PFCandidateRef& l1PFCandSeed); + //void setL1PFTauSeed(const reco::CaloJetRef& l1Jet_seed); + void setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed, const std::vector<l1t::PFCandidateRef>& l1PFCands); + void addL1PFCandidates(const std::vector<l1t::PFCandidateRef>& l1PFCands); + void buildL1PFTau(); + + l1t::HPSPFTau getL1PFTau() const { return l1PFTau_; } + +private: + l1t::PFCandidateRefVector convertToRefVector(const std::vector<l1t::PFCandidateRef>& l1PFCands); + + bool isWithinSignalCone(const l1t::PFCandidate& l1PFCand); + bool isWithinStrip(const l1t::PFCandidate& l1PFCand); + bool isWithinIsolationCone(const l1t::PFCandidate& l1PFCand); + + reco::FormulaEvaluator signalConeSizeFormula_; + + double signalConeSize_; + double signalConeSize2_; + double minSignalConeSize_; + double maxSignalConeSize_; + + bool useStrips_; + double stripSizeEta_; + double stripSizePhi_; + + double isolationConeSize_; + double isolationConeSize2_; + + std::vector<L1HPSPFTauQualityCut> signalQualityCutsDzCutDisabled_; + std::vector<L1HPSPFTauQualityCut> signalQualityCutsDzCutEnabledPrimary_; + std::vector<L1HPSPFTauQualityCut> isolationQualityCutsDzCutDisabled_; + std::vector<L1HPSPFTauQualityCut> isolationQualityCutsDzCutEnabledPrimary_; + std::vector<L1HPSPFTauQualityCut> isolationQualityCutsDzCutEnabledPileup_; + edm::ProductID l1PFCandProductID_; + bool isPFCandSeeded_; + l1t::PFCandidateRef l1PFCandSeed_; + bool isJetSeeded_; + reco::CaloJetRef l1JetSeed_; + double l1PFTauSeedEta_; + double l1PFTauSeedPhi_; + double l1PFTauSeedZVtx_; + double sumAllL1PFCandidatesPt_; + l1t::TkPrimaryVertexRef primaryVertex_; + l1t::HPSPFTau l1PFTau_; + + reco::Particle::LorentzVector stripP4_; + + std::vector<l1t::PFCandidateRef> signalAllL1PFCandidates_; + std::vector<l1t::PFCandidateRef> signalChargedHadrons_; + std::vector<l1t::PFCandidateRef> signalElectrons_; + std::vector<l1t::PFCandidateRef> signalNeutralHadrons_; + std::vector<l1t::PFCandidateRef> signalPhotons_; + std::vector<l1t::PFCandidateRef> signalMuons_; + + std::vector<l1t::PFCandidateRef> stripAllL1PFCandidates_; + std::vector<l1t::PFCandidateRef> stripElectrons_; + std::vector<l1t::PFCandidateRef> stripPhotons_; + + std::vector<l1t::PFCandidateRef> isoAllL1PFCandidates_; + std::vector<l1t::PFCandidateRef> isoChargedHadrons_; + std::vector<l1t::PFCandidateRef> isoElectrons_; + std::vector<l1t::PFCandidateRef> isoNeutralHadrons_; + std::vector<l1t::PFCandidateRef> isoPhotons_; + std::vector<l1t::PFCandidateRef> isoMuons_; + + std::vector<l1t::PFCandidateRef> sumAllL1PFCandidates_; + std::vector<l1t::PFCandidateRef> sumChargedHadrons_; + std::vector<l1t::PFCandidateRef> sumElectrons_; + std::vector<l1t::PFCandidateRef> sumNeutralHadrons_; + std::vector<l1t::PFCandidateRef> sumPhotons_; + std::vector<l1t::PFCandidateRef> sumMuons_; + + double sumChargedIsoPileup_; + + bool debug_; +}; + +#endif diff --git a/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h new file mode 100644 index 0000000000000..6b997da64c4a7 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h @@ -0,0 +1,46 @@ +#ifndef L1Trigger_Phase2L1Taus_L1HPSPFTauQualityCut_h +#define L1Trigger_Phase2L1Taus_L1HPSPFTauQualityCut_h + +#include "FWCore/ParameterSet/interface/ParameterSet.h" // edm::ParameterSet +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate +#include <string> // std::string +#include <vector> // std::vector + +class L1HPSPFTauQualityCut { +public: + /// constructor + L1HPSPFTauQualityCut(const edm::ParameterSet& cfg); + + /// destructor + ~L1HPSPFTauQualityCut() = default; + + /// returns true (false) if PFCandidate passes (fails) quality cuts + bool operator()(const l1t::PFCandidate& pfCand, float_t primaryVertexZ) const; + + /// accessor functions + l1t::PFCandidate::ParticleType pfCandType() const; + enum { kDisabled, kEnabledPrimary, kEnabledPileup }; + int dzCut() const; + float_t minPt() const; + float_t maxDz() const; + +private: + l1t::PFCandidate::ParticleType pfCandType_; + + int dzCut_; // flag to invert dz cut in order to compute charged isolation from pileup for delta-beta corrections + + float_t minPt_; + float_t maxDz_; + + bool debug_; +}; + +std::vector<L1HPSPFTauQualityCut> readL1PFTauQualityCuts(const edm::ParameterSet& cfg, + const std::string& dzCut, + bool debug = false); + +bool isSelected(const std::vector<L1HPSPFTauQualityCut>& qualityCuts, + const l1t::PFCandidate& pfCand, + float_t primaryVertexZ); + +#endif diff --git a/L1Trigger/Phase2L1Taus/plugins/BuildFile.xml b/L1Trigger/Phase2L1Taus/plugins/BuildFile.xml new file mode 100644 index 0000000000000..cdb152f65a767 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/plugins/BuildFile.xml @@ -0,0 +1,13 @@ +<library file="*.cc" name="L1TriggerPhase2L1TausPlugins"> + <use name="boost"/> + <use name="hepmc"/> + <use name="root"/> + <use name="DataFormats/JetReco"/> + <use name="DataFormats/L1TParticleFlow"/> + <use name="DataFormats/L1TCorrelator"/> + <use name="FWCore/Utilities"/> + <use name="FWCore/Framework"/> + <use name="FWCore/ParameterSet"/> + <use name="L1Trigger/Phase2L1Taus"/> + <flags EDM_PLUGIN="1"/> +</library> diff --git a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc new file mode 100644 index 0000000000000..dd909fe71505e --- /dev/null +++ b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc @@ -0,0 +1,280 @@ +#include "L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include <cmath> // std::fabs + +HPSPFTauProducer::HPSPFTauProducer(const edm::ParameterSet& cfg) + : moduleLabel_(cfg.getParameter<std::string>("@module_label")), + tauBuilder_(cfg), + useChargedPFCandSeeds_(cfg.getParameter<bool>("useChargedPFCandSeeds")), + minSeedChargedPFCandPt_(cfg.getParameter<double>("minSeedChargedPFCandPt")), + maxSeedChargedPFCandEta_(cfg.getParameter<double>("maxSeedChargedPFCandEta")), + maxSeedChargedPFCandDz_(cfg.getParameter<double>("maxSeedChargedPFCandDz")), + useJetSeeds_(cfg.getParameter<bool>("useJetSeeds")), + minSeedJetPt_(cfg.getParameter<double>("minSeedJetPt")), + maxSeedJetEta_(cfg.getParameter<double>("maxSeedJetEta")), + minPFTauPt_(cfg.getParameter<double>("minPFTauPt")), + maxPFTauEta_(cfg.getParameter<double>("maxPFTauEta")), + minLeadChargedPFCandPt_(cfg.getParameter<double>("minLeadChargedPFCandPt")), + maxLeadChargedPFCandEta_(cfg.getParameter<double>("maxLeadChargedPFCandEta")), + maxLeadChargedPFCandDz_(cfg.getParameter<double>("maxLeadChargedPFCandDz")), + maxChargedIso_(cfg.getParameter<double>("maxChargedIso")), + maxChargedRelIso_(cfg.getParameter<double>("maxChargedRelIso")), + deltaRCleaning_(cfg.getParameter<double>("deltaRCleaning")), + applyPreselection_(cfg.getParameter<bool>("applyPreselection")), + debug_(cfg.getUntrackedParameter<bool>("debug", false)) { + srcL1PFCands_ = cfg.getParameter<edm::InputTag>("srcL1PFCands"); + tokenL1PFCands_ = consumes<l1t::PFCandidateCollection>(srcL1PFCands_); + srcL1Jets_ = cfg.getParameter<edm::InputTag>("srcL1Jets"); + if (useJetSeeds_) { + tokenL1Jets_ = consumes<std::vector<reco::CaloJet>>(srcL1Jets_); + } + srcL1Vertices_ = cfg.getParameter<edm::InputTag>("srcL1Vertices"); + if (!srcL1Vertices_.label().empty()) { + tokenL1Vertices_ = consumes<std::vector<l1t::TkPrimaryVertex>>(srcL1Vertices_); + } + deltaR2Cleaning_ = deltaRCleaning_ * deltaRCleaning_; + + edm::ParameterSet cfg_signalQualityCuts = cfg.getParameter<edm::ParameterSet>("signalQualityCuts"); + signalQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_signalQualityCuts, "disabled"); + edm::ParameterSet cfg_isolationQualityCuts = cfg.getParameter<edm::ParameterSet>("isolationQualityCuts"); + isolationQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_isolationQualityCuts, "disabled"); + + produces<l1t::HPSPFTauCollection>(); +} + +namespace { + bool isHigherPt_pfCandRef(const l1t::PFCandidateRef& l1PFCand1, const l1t::PFCandidateRef& l1PFCand2) { + return l1PFCand1->pt() > l1PFCand2->pt(); + } + + bool isHigherPt_pfTau(const l1t::HPSPFTau& l1PFTau1, const l1t::HPSPFTau& l1PFTau2) { + return l1PFTau1.pt() > l1PFTau2.pt(); + } +} // namespace + +void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) { + std::unique_ptr<l1t::HPSPFTauCollection> l1PFTauCollectionCleaned(new l1t::HPSPFTauCollection()); + + edm::Handle<l1t::PFCandidateCollection> l1PFCands; + evt.getByToken(tokenL1PFCands_, l1PFCands); + + l1t::TkPrimaryVertexRef primaryVertex; + float primaryVertex_z = 0.; + if (!srcL1Vertices_.label().empty()) { + edm::Handle<std::vector<l1t::TkPrimaryVertex>> vertices; + evt.getByToken(tokenL1Vertices_, vertices); + if (!vertices->empty()) { + primaryVertex = l1t::TkPrimaryVertexRef(vertices, 0); + primaryVertex_z = primaryVertex->zvertex(); + } + } + + // build collection of selected PFCandidates + std::vector<l1t::PFCandidateRef> selectedL1PFCandsSignalQualityCuts; + std::vector<l1t::PFCandidateRef> selectedL1PFCandsSignalOrIsolationQualityCuts; + size_t numL1PFCands = l1PFCands->size(); + for (size_t idxL1PFCand = 0; idxL1PFCand < numL1PFCands; ++idxL1PFCand) { + l1t::PFCandidateRef l1PFCand(l1PFCands, idxL1PFCand); + bool passesSignalQualityCuts = isSelected(signalQualityCutsDzCutDisabled_, *l1PFCand, primaryVertex_z); + bool passesIsolationQualityCuts = isSelected(isolationQualityCutsDzCutDisabled_, *l1PFCand, primaryVertex_z); + if (passesSignalQualityCuts) { + selectedL1PFCandsSignalQualityCuts.push_back(l1PFCand); + } + if (passesSignalQualityCuts || passesIsolationQualityCuts) { + selectedL1PFCandsSignalOrIsolationQualityCuts.push_back(l1PFCand); + } + } + + // sort PFCandidate collection by decreasing pT + std::sort(selectedL1PFCandsSignalQualityCuts.begin(), selectedL1PFCandsSignalQualityCuts.end(), isHigherPt_pfCandRef); + std::sort(selectedL1PFCandsSignalOrIsolationQualityCuts.begin(), + selectedL1PFCandsSignalOrIsolationQualityCuts.end(), + isHigherPt_pfCandRef); + + l1t::HPSPFTauCollection l1PFTauCollectionUncleaned; + + if (useChargedPFCandSeeds_) { + for (const auto& l1PFCand : selectedL1PFCandsSignalQualityCuts) { + if (l1PFCand->charge() != 0 && l1PFCand->pt() > minSeedChargedPFCandPt_ && + std::fabs(l1PFCand->eta()) < maxSeedChargedPFCandEta_) { + bool isFromPrimaryVertex = false; + if (primaryVertex.get()) { + l1t::PFTrackRef l1PFTrack = l1PFCand->pfTrack(); + double dz = std::fabs(l1PFTrack->vertex().z() - primaryVertex_z); + if (dz < maxSeedChargedPFCandDz_) { + isFromPrimaryVertex = true; + } + } else { + isFromPrimaryVertex = true; + } + if (isFromPrimaryVertex) { + tauBuilder_.reset(); + tauBuilder_.setL1PFCandProductID(l1PFCands.id()); + tauBuilder_.setVertex(primaryVertex); + tauBuilder_.setL1PFTauSeed(l1PFCand); + tauBuilder_.addL1PFCandidates(selectedL1PFCandsSignalOrIsolationQualityCuts); + tauBuilder_.buildL1PFTau(); + l1t::HPSPFTau l1PFTau = tauBuilder_.getL1PFTau(); + if (l1PFTau.pt() > isPFTauPt_) + l1PFTauCollectionUncleaned.push_back(l1PFTau); + } + } + } + } + + if (useJetSeeds_) { + edm::Handle<std::vector<reco::CaloJet>> l1Jets; + evt.getByToken(tokenL1Jets_, l1Jets); + + size_t numL1Jets = l1Jets->size(); + for (size_t idxL1Jet = 0; idxL1Jet < numL1Jets; ++idxL1Jet) { + reco::CaloJetRef l1Jet(l1Jets, idxL1Jet); + if (l1Jet->pt() > minSeedJetPt_ && std::fabs(l1Jet->eta()) < maxSeedJetEta_) { + tauBuilder_.reset(); + tauBuilder_.setL1PFCandProductID(l1PFCands.id()); + tauBuilder_.setVertex(primaryVertex); + //tauBuilder_.setL1PFTauSeed(l1Jet); + tauBuilder_.setL1PFTauSeed(l1Jet, selectedL1PFCandsSignalQualityCuts); + tauBuilder_.addL1PFCandidates(selectedL1PFCandsSignalOrIsolationQualityCuts); + tauBuilder_.buildL1PFTau(); + l1t::HPSPFTau l1PFTau = tauBuilder_.getL1PFTau(); + if (l1PFTau.pt() > isPFTauPt_) + l1PFTauCollectionUncleaned.push_back(l1PFTau); + } + } + } + + // sort PFTau candidate collection by decreasing pT + std::sort(l1PFTauCollectionUncleaned.begin(), l1PFTauCollectionUncleaned.end(), isHigherPt_pfTau); + + for (const auto& l1PFTau : l1PFTauCollectionUncleaned) { + if (applyPreselection_ && + !(l1PFTau.pt() > minPFTauPt_ && std::fabs(l1PFTau.eta()) < maxPFTauEta_ && + l1PFTau.leadChargedPFCand().isNonnull() && l1PFTau.leadChargedPFCand()->pt() > minLeadChargedPFCandPt_ && + std::fabs(l1PFTau.leadChargedPFCand()->eta()) < maxLeadChargedPFCandEta_ && + (srcL1Vertices_.label().empty() || + (primaryVertex.isNonnull() && l1PFTau.leadChargedPFCand()->pfTrack().isNonnull() && + std::fabs(l1PFTau.leadChargedPFCand()->pfTrack()->vertex().z() - primaryVertex->zvertex()) < + maxLeadChargedPFCandDz_)) && + l1PFTau.sumChargedIso() < maxChargedIso_ && l1PFTau.sumChargedIso() < maxChargedRelIso_ * l1PFTau.pt())) + continue; + + bool isOverlap = false; + for (const auto& l1PFTau2 : *l1PFTauCollectionCleaned) { + double deltaEta = l1PFTau.eta() - l1PFTau2.eta(); + double deltaPhi = l1PFTau.phi() - l1PFTau2.phi(); + if ((deltaEta * deltaEta + deltaPhi * deltaPhi) < deltaR2Cleaning_) { + isOverlap = true; + } + } + if (!isOverlap) { + l1PFTauCollectionCleaned->push_back(l1PFTau); + } + } + + evt.put(std::move(l1PFTauCollectionCleaned)); +} + +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + +void HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + // HPSPFTauProducerPF + edm::ParameterSetDescription desc; + desc.add<bool>("useJetSeeds", true); + desc.add<double>("minPFTauPt", 20.0); + desc.add<double>("minSignalConeSize", 0.05); + { + edm::ParameterSetDescription psd0; + { + edm::ParameterSetDescription psd1; + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("neutralHadron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("maxDz", 0.4); + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("muon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("maxDz", 0.4); + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("electron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("photon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("maxDz", 0.4); + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("chargedHadron", psd1); + } + desc.add<edm::ParameterSetDescription>("isolationQualityCuts", psd0); + } + desc.add<double>("stripSizePhi", 0.2); + desc.add<double>("minSeedJetPt", 30.0); + desc.add<double>("maxChargedRelIso", 1.0); + desc.add<double>("minSeedChargedPFCandPt", 5.0); + desc.add<edm::InputTag>("srcL1PFCands", edm::InputTag("l1pfCandidates", "PF")); + desc.add<double>("stripSizeEta", 0.05); + desc.add<double>("maxLeadChargedPFCandEta", 2.4); + desc.add<double>("deltaRCleaning", 0.4); + desc.add<bool>("useStrips", true); + desc.add<double>("maxSeedChargedPFCandDz", 1000.0); + desc.add<double>("minLeadChargedPFCandPt", 1.0); + desc.add<double>("maxSeedChargedPFCandEta", 2.4); + desc.add<bool>("applyPreselection", false); + desc.add<double>("isolationConeSize", 0.4); + desc.add<edm::InputTag>("srcL1Vertices", edm::InputTag("L1TkPrimaryVertex")); + desc.add<double>("maxChargedIso", 1000.0); + { + edm::ParameterSetDescription psd0; + { + edm::ParameterSetDescription psd1; + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("neutralHadron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("maxDz", 0.4); + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("muon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("maxDz", 0.4); + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("electron", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("photon", psd1); + } + { + edm::ParameterSetDescription psd1; + psd1.add<double>("maxDz", 0.4); + psd1.add<double>("minPt", 0.0); + psd0.add<edm::ParameterSetDescription>("chargedHadron", psd1); + } + desc.add<edm::ParameterSetDescription>("signalQualityCuts", psd0); + } + desc.add<bool>("useChargedPFCandSeeds", true); + desc.add<double>("maxLeadChargedPFCandDz", 1000.0); + desc.add<double>("maxSeedJetEta", 2.4); + desc.add<std::string>("signalConeSize", "2.8/max(1., pt)"); + desc.add<edm::InputTag>("srcL1Jets", + edm::InputTag("Phase1L1TJetProducer", "UncalibratedPhase1L1TJetFromPfCandidates")); + desc.addUntracked<bool>("debug", false); + desc.add<double>("maxPFTauEta", 2.4); + desc.add<double>("maxSignalConeSize", 0.1); + descriptions.addWithDefaultLabel(desc); +} + +#include "FWCore/Framework/interface/MakerMacros.h" +DEFINE_FWK_MODULE(HPSPFTauProducer); diff --git a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h new file mode 100644 index 0000000000000..c75d41d6b6552 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h @@ -0,0 +1,72 @@ +#ifndef L1Trigger_Phase2L1Taus_HPSPFTauProducer_h +#define L1Trigger_Phase2L1Taus_HPSPFTauProducer_h + +#include "FWCore/Framework/interface/EDProducer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/stream/EDProducer.h" + +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" // L1HPSPFTauQualityCut +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h" // L1HPSPFTauBuilder +#include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau +#include "DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h" // l1t::HPSPFTauCollection +#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef +#include "DataFormats/JetReco/interface/CaloJet.h" +#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" + +#include <string> +#include <vector> + +class HPSPFTauProducer : public edm::stream::EDProducer<> { +public: + explicit HPSPFTauProducer(const edm::ParameterSet& cfg); + ~HPSPFTauProducer() override = default; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void produce(edm::Event& evt, const edm::EventSetup& es) override; + + std::string moduleLabel_; + + L1HPSPFTauBuilder tauBuilder_; + + edm::InputTag srcL1PFCands_; + edm::EDGetTokenT<l1t::PFCandidateCollection> tokenL1PFCands_; + edm::InputTag srcL1Jets_; + edm::EDGetTokenT<std::vector<reco::CaloJet>> tokenL1Jets_; + edm::InputTag srcL1Vertices_; + edm::EDGetTokenT<std::vector<l1t::TkPrimaryVertex>> tokenL1Vertices_; + + std::vector<L1HPSPFTauQualityCut> signalQualityCutsDzCutDisabled_; + std::vector<L1HPSPFTauQualityCut> isolationQualityCutsDzCutDisabled_; + + bool useChargedPFCandSeeds_; + double minSeedChargedPFCandPt_; + double maxSeedChargedPFCandEta_; + double maxSeedChargedPFCandDz_; + + bool useJetSeeds_; + double minSeedJetPt_; + double maxSeedJetEta_; + + double minPFTauPt_; + double maxPFTauEta_; + double minLeadChargedPFCandPt_; + double maxLeadChargedPFCandEta_; + double maxLeadChargedPFCandDz_; + double maxChargedIso_; + double maxChargedRelIso_; + + double deltaRCleaning_; + double deltaR2Cleaning_; + + bool applyPreselection_; + + bool debug_; + const double isPFTauPt_ = 1.; +}; + +#endif diff --git a/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py new file mode 100644 index 0000000000000..d1c58ccb4131c --- /dev/null +++ b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPF_cfi.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.Phase2L1Taus.hpspfTauProducer_cfi import hpspfTauProducer as _hpspfTauProducer +HPSPFTauProducerPF = _hpspfTauProducer.clone( + srcL1PFCands = "l1pfCandidates:PF" +) diff --git a/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPuppi_cfi.py b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPuppi_cfi.py new file mode 100644 index 0000000000000..a7ab48a6ce6a2 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/python/HPSPFTauProducerPuppi_cfi.py @@ -0,0 +1,28 @@ +import FWCore.ParameterSet.Config as cms + +from L1Trigger.Phase2L1Taus.hpspfTauProducer_cfi import hpspfTauProducer as _hpspfTauProducer +HPSPFTauProducerPuppi = _hpspfTauProducer.clone( + srcL1PFCands = "l1pfCandidates:Puppi", + signalQualityCuts = dict( + chargedHadron = dict( + maxDz = 1.e+3 + ), + muon = dict( + maxDz = 1.e+3 + ), + electron = dict( + maxDz = 1.e+3 + ) + ), + isolationQualityCuts = dict( + chargedHadron = dict( + maxDz = 1.e+3 + ), + muon = dict( + maxDz = 1.e+3 + ), + electron = dict( + maxDz = 1.e+3 + ) + ) +) diff --git a/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py b/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py new file mode 100644 index 0000000000000..f79f1cf2e177e --- /dev/null +++ b/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py @@ -0,0 +1,47 @@ +import FWCore.ParameterSet.Config as cms + +l1emulator = cms.Sequence() + +from SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff import * +from CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi import * + +from L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff import * +l1emulator += hgcalTriggerPrimitives + +from SimCalorimetry.EcalEBTrigPrimProducers.ecalEBTriggerPrimitiveDigis_cff import * +l1emulator += simEcalEBTriggerPrimitiveDigis + +from L1Trigger.TrackFindingTracklet.Tracklet_cfi import * +L1TRK_NAME = "TTTracksFromTrackletEmulation" +L1TRK_LABEL = "Level1TTTracks" + +from RecoVertex.BeamSpotProducer.BeamSpot_cfi import * +l1emulator += offlineBeamSpot + +l1emulator += TTTracksFromTrackletEmulation + +from SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff import * +TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag( cms.InputTag(L1TRK_NAME, L1TRK_LABEL) ) +l1emulator += TrackTriggerAssociatorTracks + +from L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi import * +l1emulator += L1TkPrimaryVertex + +from Configuration.StandardSequences.SimL1Emulator_cff import * +l1emulator += SimL1Emulator + +from L1Trigger.Phase2L1ParticleFlow.pfTracksFromL1Tracks_cfi import * +l1emulator += pfTracksFromL1Tracks + +from L1Trigger.Phase2L1ParticleFlow.l1ParticleFlow_cff import * +l1emulator += l1ParticleFlow + +from L1Trigger.L1CaloTrigger.Phase1L1TJets_cff import * +l1emulator += Phase1L1TJetsSequence + + + + + + + diff --git a/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc new file mode 100644 index 0000000000000..285ea3fecec33 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc @@ -0,0 +1,437 @@ +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h" +#include "FWCore/Utilities/interface/Exception.h" // cms::Exception +#include "DataFormats/Math/interface/deltaR.h" // reco::deltaR +#include <regex> // sd::regex_replace +#include <TMath.h> // TMath::Pi() +#include <string> // std::string +#include <algorithm> // std::max(), std::sort() +#include <cmath> // std::fabs + +L1HPSPFTauBuilder::L1HPSPFTauBuilder(const edm::ParameterSet& cfg) + : signalConeSizeFormula_( + std::regex_replace(cfg.getParameter<std::string>("signalConeSize"), std::regex("pt"), "x")), + minSignalConeSize_(cfg.getParameter<double>("minSignalConeSize")), + maxSignalConeSize_(cfg.getParameter<double>("maxSignalConeSize")), + useStrips_(cfg.getParameter<bool>("useStrips")), + stripSizeEta_(cfg.getParameter<double>("stripSizeEta")), + stripSizePhi_(cfg.getParameter<double>("stripSizePhi")), + isolationConeSize_(cfg.getParameter<double>("isolationConeSize")), + debug_(cfg.getUntrackedParameter<bool>("debug", false)) { + assert(maxSignalConeSize_ >= minSignalConeSize_); + + isolationConeSize2_ = isolationConeSize_ * isolationConeSize_; + + if (debug_) { + std::cout << "setting Quality cuts for signal PFCands:" << std::endl; + } + edm::ParameterSet cfg_signalQualityCuts = cfg.getParameter<edm::ParameterSet>("signalQualityCuts"); + signalQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_signalQualityCuts, "disabled", debug_); + signalQualityCutsDzCutEnabledPrimary_ = readL1PFTauQualityCuts(cfg_signalQualityCuts, "enabled_primary", debug_); + if (debug_) { + std::cout << "setting Quality cuts for isolation PFCands:" << std::endl; + } + edm::ParameterSet cfg_isolationQualityCuts = cfg.getParameter<edm::ParameterSet>("isolationQualityCuts"); + isolationQualityCutsDzCutDisabled_ = readL1PFTauQualityCuts(cfg_isolationQualityCuts, "disabled", debug_); + isolationQualityCutsDzCutEnabledPrimary_ = + readL1PFTauQualityCuts(cfg_isolationQualityCuts, "enabled_primary", debug_); + isolationQualityCutsDzCutEnabledPileup_ = readL1PFTauQualityCuts(cfg_isolationQualityCuts, "enabled_pileup", debug_); +} + +void L1HPSPFTauBuilder::reset() { + signalConeSize_ = 0.; + signalConeSize2_ = 0.; + + l1PFCandProductID_ = edm::ProductID(); + isPFCandSeeded_ = false; + l1PFCandSeed_ = l1t::PFCandidateRef(); + isJetSeeded_ = false; + l1JetSeed_ = reco::CaloJetRef(); + l1PFTauSeedEta_ = 0.; + l1PFTauSeedPhi_ = 0.; + l1PFTauSeedZVtx_ = 0.; + sumAllL1PFCandidatesPt_ = 0.; + primaryVertex_ = l1t::TkPrimaryVertexRef(); + l1PFTau_ = l1t::HPSPFTau(); + + stripP4_ = reco::Particle::LorentzVector(0., 0., 0., 0.); + + signalAllL1PFCandidates_.clear(); + signalChargedHadrons_.clear(); + signalElectrons_.clear(); + signalNeutralHadrons_.clear(); + signalPhotons_.clear(); + signalMuons_.clear(); + + stripAllL1PFCandidates_.clear(); + stripElectrons_.clear(); + stripPhotons_.clear(); + + isoAllL1PFCandidates_.clear(); + isoChargedHadrons_.clear(); + isoElectrons_.clear(); + isoNeutralHadrons_.clear(); + isoPhotons_.clear(); + isoMuons_.clear(); + + sumAllL1PFCandidates_.clear(); + sumChargedHadrons_.clear(); + sumElectrons_.clear(); + sumNeutralHadrons_.clear(); + sumPhotons_.clear(); + sumMuons_.clear(); + + sumChargedIsoPileup_ = 0.; +} + +void L1HPSPFTauBuilder::setL1PFCandProductID(const edm::ProductID& l1PFCandProductID) { + l1PFCandProductID_ = l1PFCandProductID; +} + +void L1HPSPFTauBuilder::setVertex(const l1t::TkPrimaryVertexRef& primaryVertex) { primaryVertex_ = primaryVertex; } + +void L1HPSPFTauBuilder::setL1PFTauSeed(const l1t::PFCandidateRef& l1PFCandSeed) { + if (debug_) { + std::cout << "<L1HPSPFTauBuilder::setL1PFTauSeed>:" << std::endl; + std::cout << "seeding HPSPFTau with ChargedPFCand:"; + printPFCand(std::cout, *l1PFCandSeed, primaryVertex_); + } + + l1PFCandSeed_ = l1PFCandSeed; + l1PFTauSeedEta_ = l1PFCandSeed->eta(); + l1PFTauSeedPhi_ = l1PFCandSeed->phi(); + if (l1PFCandSeed->charge() != 0 && l1PFCandSeed->pfTrack().isNonnull()) { + l1PFTauSeedZVtx_ = l1PFCandSeed->pfTrack()->vertex().z(); + isPFCandSeeded_ = true; + } +} +// This is commented as l1JetSeed->numberOfDaughters() = 0 +// Alternative way is used below for the moment +/* +void L1HPSPFTauBuilder::setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed) { + if (debug_) { + std::cout << "<L1HPSPFTauBuilder::setL1PFTauSeed>:" << std::endl; + std::cout << "seeding HPSPFTau with Jet:"; + std::cout << " pT = " << l1JetSeed->pt() << ", eta = " << l1JetSeed->eta() << ", phi = " << l1JetSeed->phi() + << std::endl; + } + + l1JetSeed_ = l1JetSeed; + reco::Candidate::LorentzVector l1PFTauSeed_p4; + float l1PFTauSeedZVtx = 0.; + bool l1PFTauSeed_hasVtx = false; + float max_chargedPFCand_pt = -1.; + size_t numConstituents = l1JetSeed->numberOfDaughters(); + for (size_t idxConstituent = 0; idxConstituent < numConstituents; ++idxConstituent) { + const l1t::PFCandidate* l1PFCand = dynamic_cast<const l1t::PFCandidate*>(l1JetSeed->daughter(idxConstituent)); + if (!l1PFCand) { + throw cms::Exception("L1HPSPFTauBuilder") << "Jet was not built from l1t::PFCandidates !!\n"; + } + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron || l1PFCand->id() == l1t::PFCandidate::Electron || + l1PFCand->id() == l1t::PFCandidate::Photon || l1PFCand->id() == l1t::PFCandidate::Muon) { + l1PFTauSeed_p4 += l1PFCand->p4(); + if (l1PFCand->charge() != 0 && l1PFCand->pfTrack().isNonnull() && l1PFCand->pt() > max_chargedPFCand_pt) { + l1PFTauSeedZVtx = l1PFCand->pfTrack()->vertex().z(); + l1PFTauSeed_hasVtx = true; + max_chargedPFCand_pt = l1PFCand->pt(); + } + } + } + if (l1PFTauSeed_p4.pt() > 1. && l1PFTauSeed_hasVtx) { + l1PFTauSeedEta_ = l1PFTauSeed_p4.eta(); + l1PFTauSeedPhi_ = l1PFTauSeed_p4.phi(); + l1PFTauSeedZVtx_ = l1PFTauSeedZVtx; + isJetSeeded_ = true; + } +} +*/ +void L1HPSPFTauBuilder::setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed, + const std::vector<l1t::PFCandidateRef>& l1PFCands) { + if (debug_) { + std::cout << "<L1HPSPFTauBuilder::setL1PFTauSeed>:" << std::endl; + std::cout << "seeding HPSPFTau with Jet:"; + std::cout << " pT = " << l1JetSeed->pt() << ", eta = " << l1JetSeed->eta() << ", phi = " << l1JetSeed->phi() + << std::endl; + } + + l1JetSeed_ = l1JetSeed; + reco::Candidate::LorentzVector l1PFTauSeed_p4; + float l1PFTauSeedZVtx = 0.; + bool l1PFTauSeed_hasVtx = false; + float max_chargedPFCand_pt = -1.; + for (const auto& l1PFCand : l1PFCands) { + double dR = reco::deltaR(l1PFCand->eta(), l1PFCand->phi(), l1JetSeed->eta(), l1JetSeed->phi()); + if (dR > 0.4) + continue; + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron || l1PFCand->id() == l1t::PFCandidate::Electron || + l1PFCand->id() == l1t::PFCandidate::Photon || l1PFCand->id() == l1t::PFCandidate::Muon) { + l1PFTauSeed_p4 += l1PFCand->p4(); + if (l1PFCand->charge() != 0 && l1PFCand->pfTrack().isNonnull() && l1PFCand->pt() > max_chargedPFCand_pt) { + l1PFTauSeedZVtx = l1PFCand->pfTrack()->vertex().z(); + l1PFTauSeed_hasVtx = true; + max_chargedPFCand_pt = l1PFCand->pt(); + } + } + } + if (l1PFTauSeed_p4.pt() > 1. && l1PFTauSeed_hasVtx) { + l1PFTauSeedEta_ = l1PFTauSeed_p4.eta(); + l1PFTauSeedPhi_ = l1PFTauSeed_p4.phi(); + l1PFTauSeedZVtx_ = l1PFTauSeedZVtx; + isJetSeeded_ = true; + } +} + +void L1HPSPFTauBuilder::addL1PFCandidates(const std::vector<l1t::PFCandidateRef>& l1PFCands) { + if (debug_) { + std::cout << "<L1HPSPFTauBuilder::addL1PFCandidates>:" << std::endl; + } + + // do not build tau candidates for which no reference z-position exists, + // as in this case charged PFCands originating from the primary (hard-scatter) interaction + // cannot be distinguished from charged PFCands originating from pileup + if (!(isPFCandSeeded_ || isJetSeeded_)) + return; + + for (const auto& l1PFCand : l1PFCands) { + if (!isWithinIsolationCone(*l1PFCand)) + continue; + sumAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron) { + sumChargedHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Electron) { + sumElectrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::NeutralHadron) { + sumNeutralHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + sumPhotons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Muon) { + sumMuons_.push_back(l1PFCand); + } + } + + for (const auto& l1PFCand : sumAllL1PFCandidates_) { + sumAllL1PFCandidatesPt_ += l1PFCand->pt(); + } + std::vector<double> emptyV; + std::vector<double> sumAllL1PFCandidatesPt(1); + sumAllL1PFCandidatesPt[0] = sumAllL1PFCandidatesPt_; + + signalConeSize_ = signalConeSizeFormula_.evaluate(sumAllL1PFCandidatesPt, emptyV); + + if (signalConeSize_ < minSignalConeSize_) + signalConeSize_ = minSignalConeSize_; + if (signalConeSize_ > maxSignalConeSize_) + signalConeSize_ = maxSignalConeSize_; + signalConeSize2_ = signalConeSize_ * signalConeSize_; + + for (const auto& l1PFCand : sumAllL1PFCandidates_) { + if (debug_) { + printPFCand(std::cout, *l1PFCand, primaryVertex_); + } + + bool isSignalPFCand = false; + bool isStripPFCand = false; + bool isElectron_or_Photon = + l1PFCand->id() == l1t::PFCandidate::Electron || l1PFCand->id() == l1t::PFCandidate::Photon; + bool isChargedHadron = l1PFCand->id() == l1t::PFCandidate::ChargedHadron; + if (isWithinSignalCone(*l1PFCand) && !(isChargedHadron && signalChargedHadrons_.size() > 3)) { + isSignalPFCand = true; + } + if (isElectron_or_Photon && isWithinStrip(*l1PFCand)) { + if (useStrips_) { + isSignalPFCand = true; + } + isStripPFCand = true; + } + bool passesSignalQualityCuts = isSelected(signalQualityCutsDzCutEnabledPrimary_, *l1PFCand, l1PFTauSeedZVtx_); + if (isSignalPFCand && passesSignalQualityCuts) { + signalAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron) { + signalChargedHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Electron) { + signalElectrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::NeutralHadron) { + signalNeutralHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + signalPhotons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Muon) { + signalMuons_.push_back(l1PFCand); + } + } + if (isStripPFCand && passesSignalQualityCuts) { + stripAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::Electron) { + stripElectrons_.push_back(l1PFCand); + stripP4_ += l1PFCand->p4(); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + stripPhotons_.push_back(l1PFCand); + stripP4_ += l1PFCand->p4(); + } else + assert(0); + } + + bool isIsolationPFCand = isWithinIsolationCone(*l1PFCand) && !isSignalPFCand; + bool passesIsolationQualityCuts = isSelected(isolationQualityCutsDzCutEnabledPrimary_, *l1PFCand, l1PFTauSeedZVtx_); + if (isIsolationPFCand && passesIsolationQualityCuts) { + isoAllL1PFCandidates_.push_back(l1PFCand); + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron) { + isoChargedHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Electron) { + isoElectrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::NeutralHadron) { + isoNeutralHadrons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + isoPhotons_.push_back(l1PFCand); + } else if (l1PFCand->id() == l1t::PFCandidate::Muon) { + isoMuons_.push_back(l1PFCand); + } + } + + if (debug_) { + std::cout << "dR = " << reco::deltaR(l1PFCand->eta(), l1PFCand->phi(), l1PFTauSeedEta_, l1PFTauSeedPhi_) << ":" + << " isSignalPFCand = " << isSignalPFCand << ", isStripPFCand = " << isStripPFCand + << " (passesSignalQualityCuts = " << passesSignalQualityCuts << ")," + << " isIsolationPFCand = " << isIsolationPFCand + << " (passesIsolationQualityCuts = " << passesIsolationQualityCuts << ")" << std::endl; + } + } + + for (const auto& l1PFCand : l1PFCands) { + if (!isWithinIsolationCone(*l1PFCand)) + continue; + + if (l1PFCand->charge() != 0 && isSelected(isolationQualityCutsDzCutEnabledPileup_, *l1PFCand, l1PFTauSeedZVtx_)) { + sumChargedIsoPileup_ += l1PFCand->pt(); + } + } +} + +//void L1HPSPFTauBuilder::setRho(double rho) { rho_ = rho; } + +bool L1HPSPFTauBuilder::isWithinSignalCone(const l1t::PFCandidate& l1PFCand) { + if (isPFCandSeeded_ || isJetSeeded_) { + double deltaEta = l1PFCand.eta() - l1PFTauSeedEta_; + double deltaPhi = l1PFCand.phi() - l1PFTauSeedPhi_; + if ((deltaEta * deltaEta + deltaPhi * deltaPhi) < signalConeSize2_) + return true; + } + return false; +} + +bool L1HPSPFTauBuilder::isWithinStrip(const l1t::PFCandidate& l1PFCand) { + if (isPFCandSeeded_ || isJetSeeded_) { + double deltaEta = l1PFCand.eta() - l1PFTauSeedEta_; + double deltaPhi = l1PFCand.phi() - l1PFTauSeedPhi_; + if (std::fabs(deltaEta) < stripSizeEta_ && std::fabs(deltaPhi) < stripSizePhi_) + return true; + } + return false; +} + +bool L1HPSPFTauBuilder::isWithinIsolationCone(const l1t::PFCandidate& l1PFCand) { + double deltaEta = l1PFCand.eta() - l1PFTauSeedEta_; + double deltaPhi = l1PFCand.phi() - l1PFTauSeedPhi_; + if ((deltaEta * deltaEta + deltaPhi * deltaPhi) < isolationConeSize2_) + return true; + else + return false; +} + +void L1HPSPFTauBuilder::buildL1PFTau() { + reco::Particle::LorentzVector l1PFTau_p4; + for (const auto& l1PFCand : signalAllL1PFCandidates_) { + if (l1PFCand->id() == l1t::PFCandidate::ChargedHadron || l1PFCand->id() == l1t::PFCandidate::Electron || + l1PFCand->id() == l1t::PFCandidate::Photon) { + l1PFTau_p4 += l1PFCand->p4(); + if (l1PFCand->charge() != 0 && + (l1PFTau_.leadChargedPFCand().isNull() || l1PFCand->pt() > l1PFTau_.leadChargedPFCand()->pt())) { + l1PFTau_.setLeadChargedPFCand(l1PFCand); + } + } + } + l1PFTau_.setP4(l1PFTau_p4); + + l1PFTau_.setSeedChargedPFCand(l1PFCandSeed_); + l1PFTau_.setSeedJet(l1JetSeed_); + + l1PFTau_.setSignalAllL1PFCandidates(convertToRefVector(signalAllL1PFCandidates_)); + l1PFTau_.setSignalChargedHadrons(convertToRefVector(signalChargedHadrons_)); + l1PFTau_.setSignalElectrons(convertToRefVector(signalElectrons_)); + l1PFTau_.setSignalNeutralHadrons(convertToRefVector(signalNeutralHadrons_)); + l1PFTau_.setSignalPhotons(convertToRefVector(signalPhotons_)); + l1PFTau_.setSignalMuons(convertToRefVector(signalMuons_)); + + l1PFTau_.setStripAllL1PFCandidates(convertToRefVector(stripAllL1PFCandidates_)); + l1PFTau_.setStripElectrons(convertToRefVector(stripElectrons_)); + l1PFTau_.setStripPhotons(convertToRefVector(stripPhotons_)); + + l1PFTau_.setIsoAllL1PFCandidates(convertToRefVector(isoAllL1PFCandidates_)); + l1PFTau_.setIsoChargedHadrons(convertToRefVector(isoChargedHadrons_)); + l1PFTau_.setIsoElectrons(convertToRefVector(isoElectrons_)); + l1PFTau_.setIsoNeutralHadrons(convertToRefVector(isoNeutralHadrons_)); + l1PFTau_.setIsoPhotons(convertToRefVector(isoPhotons_)); + l1PFTau_.setIsoMuons(convertToRefVector(isoMuons_)); + + l1PFTau_.setSumAllL1PFCandidates(convertToRefVector(sumAllL1PFCandidates_)); + l1PFTau_.setSumChargedHadrons(convertToRefVector(sumChargedHadrons_)); + l1PFTau_.setSumElectrons(convertToRefVector(sumElectrons_)); + l1PFTau_.setSumNeutralHadrons(convertToRefVector(sumNeutralHadrons_)); + l1PFTau_.setSumPhotons(convertToRefVector(sumPhotons_)); + l1PFTau_.setSumMuons(convertToRefVector(sumMuons_)); + + l1PFTau_.setPrimaryVertex(primaryVertex_); + + if (l1PFTau_.signalChargedHadrons().size() > 1) { + if (stripP4_.pt() < 5.) + l1PFTau_.setTauType(l1t::HPSPFTau::kThreeProng0Pi0); + else + l1PFTau_.setTauType(l1t::HPSPFTau::kThreeProng1Pi0); + } else { + if (stripP4_.pt() < 5.) + l1PFTau_.setTauType(l1t::HPSPFTau::kOneProng0Pi0); + else + l1PFTau_.setTauType(l1t::HPSPFTau::kOneProng1Pi0); + } + + l1PFTau_.setStripP4(stripP4_); + + l1PFTau_.setSumAllL1PFCandidatesPt(sumAllL1PFCandidatesPt_); + l1PFTau_.setSignalConeSize(signalConeSize_); + l1PFTau_.setisolationConeSize(isolationConeSize_); + + double sumChargedIso = 0.; + double sumNeutralIso = 0.; + for (const auto& l1PFCand : isoAllL1PFCandidates_) { + if (l1PFCand->charge() != 0) { + sumChargedIso += l1PFCand->pt(); + } else if (l1PFCand->id() == l1t::PFCandidate::Photon) { + sumNeutralIso += l1PFCand->pt(); + } + } + l1PFTau_.setSumChargedIso(sumChargedIso); + l1PFTau_.setSumNeutralIso(sumNeutralIso); + const double weightNeutralIso = 1.; + const double offsetNeutralIso = 0.; + l1PFTau_.setSumCombinedIso(sumChargedIso + weightNeutralIso * (sumNeutralIso - offsetNeutralIso)); + l1PFTau_.setSumChargedIsoPileup(sumChargedIsoPileup_); + + if (l1PFTau_.sumChargedIso() < 20.0) { + l1PFTau_.setPassVLooseIso(true); + } + if (l1PFTau_.sumChargedIso() < 10.0) { + l1PFTau_.setPassLooseIso(true); + } + if (l1PFTau_.sumChargedIso() < 5.0) { + l1PFTau_.setPassMediumIso(true); + } + if (l1PFTau_.sumChargedIso() < 2.5) { + l1PFTau_.setPassTightIso(true); + } +} + +l1t::PFCandidateRefVector L1HPSPFTauBuilder::convertToRefVector(const std::vector<l1t::PFCandidateRef>& l1PFCands) { + l1t::PFCandidateRefVector l1PFCandsRefVector(l1PFCandProductID_); + for (const auto& l1PFCand : l1PFCands) { + l1PFCandsRefVector.push_back(l1PFCand); + } + return l1PFCandsRefVector; +} diff --git a/L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc new file mode 100644 index 0000000000000..e2ba4cbf2cf99 --- /dev/null +++ b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauQualityCut.cc @@ -0,0 +1,98 @@ +#include "L1Trigger/Phase2L1Taus/interface/L1HPSPFTauQualityCut.h" +#include "FWCore/Utilities/interface/Exception.h" // cms::Exception + +L1HPSPFTauQualityCut::L1HPSPFTauQualityCut(const edm::ParameterSet& cfg) + : debug_(cfg.getUntrackedParameter<bool>("debug", false)) { + std::string pfCandTypeString = cfg.getParameter<std::string>("pfCandType"); + if (pfCandTypeString == "chargedHadron") + pfCandType_ = l1t::PFCandidate::ChargedHadron; + else if (pfCandTypeString == "electron") + pfCandType_ = l1t::PFCandidate::Electron; + else if (pfCandTypeString == "muon") + pfCandType_ = l1t::PFCandidate::Muon; + else if (pfCandTypeString == "neutralHadron") + pfCandType_ = l1t::PFCandidate::NeutralHadron; + else if (pfCandTypeString == "photon") + pfCandType_ = l1t::PFCandidate::Photon; + else + throw cms::Exception("L1HPSPFTauQualityCut") + << "Invalid Configuration parameter 'pfCandType' = '" << pfCandTypeString << "' !!\n"; + + std::string dzCutString = cfg.getParameter<std::string>("dzCut"); + if (dzCutString == "disabled") + dzCut_ = kDisabled; + else if (dzCutString == "enabled_primary") + dzCut_ = kEnabledPrimary; + else if (dzCutString == "enabled_pileup") + dzCut_ = kEnabledPileup; + else + throw cms::Exception("L1HPSPFTauQualityCut") + << "Invalid Configuration parameter 'dzCut' = '" << dzCutString << "' !!\n"; + + minPt_ = cfg.getParameter<double>("minPt"); + maxDz_ = (cfg.exists("maxDz")) ? cfg.getParameter<double>("maxDz") : 1.e+3; +} + +bool L1HPSPFTauQualityCut::operator()(const l1t::PFCandidate& pfCand, float_t primaryVertex_z) const { + if (pfCand.id() == pfCandType_) { + if (pfCand.pt() < minPt_) { + return false; + } + + if (pfCand.charge() != 0) { + if (dzCut_ == kEnabledPrimary || dzCut_ == kEnabledPileup) { + const l1t::PFTrackRef& pfCand_track = pfCand.pfTrack(); + double dz = std::fabs(pfCand_track->vertex().z() - primaryVertex_z); + if (dzCut_ == kEnabledPrimary && dz > maxDz_) + return false; + if (dzCut_ == kEnabledPileup && dz <= maxDz_) + return false; + } + } else if (dzCut_ == kEnabledPileup) { + return false; // CV: only consider charged PFCands as originating from pileup + } + } + return true; +} + +l1t::PFCandidate::ParticleType L1HPSPFTauQualityCut::pfCandType() const { return pfCandType_; } + +int L1HPSPFTauQualityCut::dzCut() const { return dzCut_; } + +float_t L1HPSPFTauQualityCut::minPt() const { return minPt_; } + +float_t L1HPSPFTauQualityCut::maxDz() const { return maxDz_; } + +L1HPSPFTauQualityCut readL1PFTauQualityCut(const edm::ParameterSet& cfg, + const std::string& pfCandType, + const std::string& dzCut, + bool debug) { + edm::ParameterSet cfg_pfCandType = cfg.getParameter<edm::ParameterSet>(pfCandType); + cfg_pfCandType.addParameter<std::string>("pfCandType", pfCandType); + cfg_pfCandType.addParameter<std::string>("dzCut", dzCut); + cfg_pfCandType.addUntrackedParameter<bool>("debug", debug); + L1HPSPFTauQualityCut qualityCut(cfg_pfCandType); + return qualityCut; +} + +std::vector<L1HPSPFTauQualityCut> readL1PFTauQualityCuts(const edm::ParameterSet& cfg, + const std::string& dzCut, + bool debug) { + std::vector<L1HPSPFTauQualityCut> qualityCuts; + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "chargedHadron", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "electron", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "muon", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "photon", dzCut, debug)); + qualityCuts.push_back(readL1PFTauQualityCut(cfg, "neutralHadron", dzCut, debug)); + return qualityCuts; +} + +bool isSelected(const std::vector<L1HPSPFTauQualityCut>& qualityCuts, + const l1t::PFCandidate& pfCand, + float_t primaryVertex_z) { + for (auto qualityCut : qualityCuts) { + if (!qualityCut(pfCand, primaryVertex_z)) + return false; + } + return true; +} diff --git a/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py b/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py new file mode 100644 index 0000000000000..e1b28ad03d45d --- /dev/null +++ b/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py @@ -0,0 +1,207 @@ +import FWCore.ParameterSet.Config as cms +from Configuration.StandardSequences.Eras import eras +from Configuration.ProcessModifiers.convertHGCalDigisSim_cff import convertHGCalDigisSim +from Configuration.Eras.Era_Phase2C9_cff import Phase2C9 +process = cms.Process('Produce',Phase2C9) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10) +) + +# Input source +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + '/store/mc/Phase2HLTTDRSummer20ReRECOMiniAOD/VBFHToTauTau_M125_14TeV_powheg_pythia8_correctedGridpack_tuneCP5/FEVT/PU200_111X_mcRun4_realistic_T15_v1-v1/120000/084C8B72-BC64-DE46-801F-D971D5A34F62.root' + ), + inputCommands = cms.untracked.vstring("keep *", + "drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT", + "drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT", + "drop l1tEMTFHit2016s_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT", + "drop l1tEMTFTrack2016s_simEmtfDigis__HLT", + 'drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT', + 'drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT', + 'drop l1tEMTFHit2016s_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT', + 'drop l1tEMTFTrack2016s_simEmtfDigis__HLT', + ), +) + +process.options = cms.untracked.PSet( + +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('step2 nevts:1'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Other statements +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') + +# Sequence, Path and EndPath definitions +process.productionSequence = cms.Sequence() + +process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') +process.load('CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi') + +process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff') +process.productionSequence += process.hgcalTriggerPrimitives + +process.load('SimCalorimetry.EcalEBTrigPrimProducers.ecalEBTriggerPrimitiveDigis_cff') +process.productionSequence += process.simEcalEBTriggerPrimitiveDigis + +process.load("L1Trigger.TrackFindingTracklet.Tracklet_cfi") +L1TRK_PROC = process.TTTracksFromTrackletEmulation +L1TRK_NAME = "TTTracksFromTrackletEmulation" +L1TRK_LABEL = "Level1TTTracks" + +process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi") +process.productionSequence += process.offlineBeamSpot + +process.productionSequence += process.TTTracksFromTrackletEmulation + +process.load("SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff") +process.TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag( cms.InputTag(L1TRK_NAME, L1TRK_LABEL) ) +process.productionSequence += process.TrackTriggerAssociatorTracks + +process.load("L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi") +process.productionSequence += process.L1TkPrimaryVertex + +process.load('Configuration.StandardSequences.SimL1Emulator_cff') +process.productionSequence += process.SimL1Emulator + +process.load("L1Trigger.Phase2L1ParticleFlow.pfTracksFromL1Tracks_cfi") +process.productionSequence += process.pfTracksFromL1Tracks + +process.load("L1Trigger.Phase2L1ParticleFlow.l1ParticleFlow_cff") +process.productionSequence += process.l1ParticleFlow + +process.load('L1Trigger.L1CaloTrigger.Phase1L1TJets_cff') +process.productionSequence += process.Phase1L1TJetsSequence + +############################################################ +# Generator-level (visible) hadronic taus +############################################################ + +process.load("PhysicsTools.JetMCAlgos.TauGenJets_cfi") +process.tauGenJets.GenParticles = cms.InputTag("genParticles") +process.load("PhysicsTools.JetMCAlgos.TauGenJetsDecayModeSelectorAllHadrons_cfi") +process.genTaus = cms.Sequence(process.tauGenJets + process.tauGenJetsSelectorAllHadrons) +process.productionSequence += process.genTaus + +############################################################ +# produce L1 HPS PF Tau objects +############################################################ + +from L1Trigger.Phase2L1Taus.HPSPFTauProducerPF_cfi import HPSPFTauProducerPF +from L1Trigger.Phase2L1Taus.HPSPFTauProducerPuppi_cfi import HPSPFTauProducerPuppi +for useStrips in [ True, False ]: + for applyPreselection in [ True, False ]: + moduleNameBase = "HPSPFTauProducer" + if useStrips and applyPreselection: + moduleNameBase += "WithStripsAndPreselection" + elif useStrips and not applyPreselection: + moduleNameBase += "WithStripsWithoutPreselection" + elif not useStrips and applyPreselection: + moduleNameBase += "WithoutStripsWithPreselection" + elif not useStrips and not applyPreselection: + moduleNameBase += "WithoutStripsAndPreselection" + else: + raise ValueError("Invalid Combination of 'useStrips' and 'applyPreselection' Configuration parameters !!") + + moduleNamePF = moduleNameBase + "PF" + modulePF = HPSPFTauProducerPF.clone( + useStrips = cms.bool(useStrips), + applyPreselection = cms.bool(applyPreselection), + debug = cms.untracked.bool(False) + ) + setattr(process, moduleNamePF, modulePF) + process.productionSequence += getattr(process, moduleNamePF) + + moduleNamePuppi = moduleNameBase + "Puppi" + modulePuppi = HPSPFTauProducerPuppi.clone( + useStrips = cms.bool(useStrips), + applyPreselection = cms.bool(applyPreselection), + debug = cms.untracked.bool(False) + ) + setattr(process, moduleNamePuppi, modulePuppi) + process.productionSequence += getattr(process, moduleNamePuppi) + + +process.production_step = cms.Path(process.productionSequence) + +############################################################ +# write output file +############################################################ + +process.out = cms.OutputModule("PoolOutputModule", + fileName = cms.untracked.string("NTuple_HPSPFTauProducer_part_1.root"), + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('production_step') + ), + outputCommands = cms.untracked.vstring( + 'drop *_*_*_*', + 'keep *_l1pfCandidates_PF_*', + 'keep *_l1pfCandidates_Puppi_*', + 'keep *_l1pfProducer*_z0_*', + 'keep *_pfTracksFromL1Tracks*_*_*', + 'keep *_pfClustersFrom*_*_*', + 'keep *_TTTracksFromTracklet_*_*', + 'keep *_VertexProducer_*_*', + 'keep *_L1TkPrimaryVertex_*_*', + 'keep *_slimmedTaus_*_*', + 'keep *_packedPFCandidates_*_*', + 'keep *_generator_*_*', + 'keep *_caloStage2Digis_*_*', + 'keep *_HPSPFTauProducer*PF_*_*', + 'keep *_HPSPFTauProducer*Puppi_*_*', + 'keep *_prunedGenParticles_*_*', + 'keep *_tauGenJetsSelectorAllHadrons_*_*', + 'keep *_particleFlow_*_*', + 'keep *_generalTracks_*_*', + 'keep *_electronGsfTracks_*_*', + 'keep *_offlineSlimmedPrimaryVertices_*_*', + 'keep *_L1PFTauProducer_*_*', + 'keep *_slimmedAddPileupInfo_*_*', + "keep *_Phase1L1TJetProducer_*_*", + ) +) +process.outpath = cms.EndPath(process.out) + +process.endjob_step = cms.EndPath(process.endOfProcess) + +# Schedule definition +process.schedule = cms.Schedule(process.production_step, process.outpath, process.endjob_step) + +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion + +# Enable module run-time report +#process.options = cms.untracked.PSet( +# wantSummary = cms.untracked.bool(True) +#) + +dump_file = open('dump.py','w') +dump_file.write(process.dumpPython()) + +process.options.numberOfThreads = cms.untracked.uint32(2) From a337f941789444ff3d3c8bd5532779152832ac8c Mon Sep 17 00:00:00 2001 From: Mircho Rodozov <mrodozov@cern.ch> Date: Thu, 13 May 2021 17:04:52 +0200 Subject: [PATCH 305/309] change the unsigned to int and keep the int as it was --- .../PixelVertexFinding/plugins/gpuClusterTracksByDensity.h | 2 +- .../PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h | 2 +- .../PixelVertexFinding/plugins/gpuClusterTracksIterative.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h index cff1a714d0fb8..f71aa56842a67 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksByDensity.h @@ -59,7 +59,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= (unsigned)hist.capacity()); + assert((int)nt <= hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h index 8e3efc941c90d..a11283a7b2065 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksDBSCAN.h @@ -55,7 +55,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= (unsigned)hist.capacity()); + assert((int)nt <= hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { diff --git a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h index cb95e59109b14..66d246fcfa4fa 100644 --- a/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h +++ b/RecoPixelVertexing/PixelVertexFinding/plugins/gpuClusterTracksIterative.h @@ -55,7 +55,7 @@ namespace gpuVertexFinder { if (verbose && 0 == threadIdx.x) printf("booked hist with %d bins, size %d for %d tracks\n", hist.nbins(), hist.capacity(), nt); - assert(nt <= (unsigned)hist.capacity()); + assert((int)nt <= hist.capacity()); // fill hist (bin shall be wider than "eps") for (auto i = threadIdx.x; i < nt; i += blockDim.x) { From da1194926b2fb2617e2e8dd8d5bd623fd37c343c Mon Sep 17 00:00:00 2001 From: Giacomo Govi <giacomo.govi@cern.ch> Date: Fri, 14 May 2021 11:45:59 +0200 Subject: [PATCH 306/309] Added support of "frequent" flag/ stored timestamps moved to UTC --- CondCore/Utilities/python/o2olib.py | 59 ++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/CondCore/Utilities/python/o2olib.py b/CondCore/Utilities/python/o2olib.py index e3bf619dc681e..764f44bcaf487 100644 --- a/CondCore/Utilities/python/o2olib.py +++ b/CondCore/Utilities/python/o2olib.py @@ -38,6 +38,7 @@ class O2OJob(_Base): __table_args__ = {'schema' : schema_name} name = sqlalchemy.Column(sqlalchemy.String(100), primary_key=True) enabled = sqlalchemy.Column(sqlalchemy.Integer, nullable=False) + frequent = sqlalchemy.Column(sqlalchemy.Integer, nullable=False) tag_name = sqlalchemy.Column(sqlalchemy.String(100), nullable=False) interval = sqlalchemy.Column(sqlalchemy.Integer, nullable=False) @@ -171,7 +172,7 @@ def connect( self, service, args ): def runManager( self ): return O2ORunMgr( self.db_connection, self.session, O2OMgr.logger( self ) ) - def add( self, job_name, config_filename, int_val, en_flag ): + def add( self, job_name, config_filename, int_val, freq_flag, en_flag ): res = self.session.query(O2OJob.enabled).filter_by(name=job_name) enabled = None for r in res: @@ -182,15 +183,18 @@ def add( self, job_name, config_filename, int_val, en_flag ): configJson = self.readConfiguration( config_filename ) if configJson == '': return False - job = O2OJob(name=job_name,tag_name='-',enabled=en_flag,interval=int_val) - config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(), configuration = configJson ) + freq_val = 0 + if freq_flag: + freq_val = 1 + job = O2OJob(name=job_name,tag_name='-',enabled=en_flag,frequent=freq_val,interval=int_val) + config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(timezone.utc), configuration = configJson ) self.session.add(job) self.session.add(config) self.session.commit() O2OMgr.logger( self).info( "New o2o job '%s' created.", job_name ) return True - def set( self, job_name, en_flag ): + def set( self, job_name, en_flag, fr_val=None ): res = self.session.query(O2OJob.enabled).filter_by(name=job_name) enabled = None for r in res: @@ -198,13 +202,22 @@ def set( self, job_name, en_flag ): if enabled is None: O2OMgr.logger( self).error( "A job called '%s' does not exist.", job_name ) return - job = O2OJob(name=job_name,enabled=en_flag) - action = 'enabled' - if not en_flag: - action = 'disabled' - self.session.merge(job) - self.session.commit() - O2OMgr.logger( self).info( "Job '%s' %s." %(job_name,action) ) + if en_flag is not None and enabled != en_flag: + job = O2OJob(name=job_name,enabled=en_flag) + self.session.merge(job) + self.session.commit() + action = 'enabled' + if not en_flag: + action = 'disabled' + O2OMgr.logger( self).info( "Job '%s' %s." %(job_name,action) ) + if fr_val is not None: + job = O2OJob(name=job_name,frequent=fr_val) + self.session.merge(job) + self.session.commit() + if fr_val==1: + O2OMgr.logger( self).info( "Job '%s' set 'frequent'") + else: + O2OMgr.logger( self).info( "Job '%s' unset 'frequent'") def setConfig( self, job_name, config_filename ): res = self.session.query(O2OJob.enabled).filter_by(name=job_name) @@ -217,7 +230,7 @@ def setConfig( self, job_name, config_filename ): configJson = self.readConfiguration( config_filename ) if configJson == '': return False - config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(), configuration = configJson ) + config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(timezone.utc), configuration = configJson ) self.session.add(config) self.session.commit() O2OMgr.logger( self).info( "New configuration inserted for job '%s'", job_name ) @@ -244,7 +257,7 @@ def migrateConfig( self ): configDict = {} configDict['tag']=tag configJson = json.dumps( configDict ) - config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(), configuration = configJson ) + config = O2OJobConf( job_name=job_name, insertion_time = datetime.now(timezone.utc), configuration = configJson ) self.session.add(config) O2OMgr.logger( self).info( "Configuration for job '%s' inserted.", job_name ) self.session.commit() @@ -254,12 +267,14 @@ def listJobs( self ): res = self.session.query(O2ORun.job_name,sqlalchemy.func.max(O2ORun.start_time)).group_by(O2ORun.job_name).order_by(O2ORun.job_name) for r in res: runs[r[0]] = str(r[1]) - res = self.session.query(O2OJob.name, O2OJob.interval, O2OJob.enabled).order_by(O2OJob.name).all() + res = self.session.query(O2OJob.name, O2OJob.interval, O2OJob.enabled, O2OJob.frequent).order_by(O2OJob.name).all() table = [] for r in res: row = [] row.append(r[0]), row.append('%5d' %r[1] ) + frequent = 'Y' if (r[3]==1) else 'N' + row.append('%4s' %frequent ) enabled = 'Y' if (r[2]==1) else 'N' row.append('%4s' %enabled ) lastRun = '-' @@ -267,7 +282,7 @@ def listJobs( self ): lastRun = runs[r[0]] row.append( lastRun ) table.append(row) - headers = ['Job name','Interval','Enabled','Last run start'] + headers = ['Job name','Interval','Frequent','Enabled','Last run start'] print_table( headers, table ) def listConfig( self, jname ): @@ -358,7 +373,7 @@ def startJob( self, job_name ): self.logger.error( str(e) ) return 6 self.job_name = job_name - self.start = datetime.now() + self.start = datetime.now(timezone.utc) run = O2ORun(job_name=self.job_name,start_time=self.start,status_code=startStatus) self.session.add(run) self.session.commit() @@ -373,7 +388,7 @@ def startJob( self, job_name ): def endJob( self, status, log ): - self.end = datetime.now() + self.end = datetime.now(timezone.utc) try: run = O2ORun(job_name=self.job_name,start_time=self.start,end_time=self.end,status_code=status,log=log) self.session.merge(run) @@ -390,7 +405,7 @@ def executeJob( self, args ): logFolder = os.getcwd() if logFolderEnvVar in os.environ: logFolder = os.environ[logFolderEnvVar] - datelabel = datetime.now().strftime("%y-%m-%d-%H-%M-%S") + datelabel = datetime.now(timezone.utc).strftime("%y-%m-%d-%H-%M-%S") logFileName = '%s-%s.log' %(job_name,datelabel) logFile = os.path.join(logFolder,logFileName) started = self.startJob( job_name ) @@ -443,11 +458,16 @@ def execute(self): parser_create.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) parser_create.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True) parser_create.add_argument('--interval', '-i', type=int, help='the chron job interval',default=0) + parser_create.add_argument('--frequent', '-f',action='store_true',help='set the "frequent" flag for this job') parser_create.set_defaults(func=self.create) parser_setConfig = parser_subparsers.add_parser('setConfig', description='Set a new configuration for the specified job. The configuration is expected as a list of entries "param": "value" (dictionary). The "param" labels will be used to inject the values in the command to execute. The dictionary is stored in JSON format.') parser_setConfig.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) parser_setConfig.add_argument('--configFile', '-c', type=str, help='the JSON configuration file path',required=True) parser_setConfig.set_defaults(func=self.setConfig) + parser_setFrequent = parser_subparsers.add_parser('setFrequent',description='Set the "frequent" flag for the specified job') + parser_setFrequent.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) + parser_setFrequent.add_argument('--flag', '-f', choices=['0','1'], help='the flag value to set',required=True) + parser_setFrequent.set_defaults(func=self.setFrequent) parser_setInterval = parser_subparsers.add_parser('setInterval',description='Set a new execution interval for the specified job') parser_setInterval.add_argument('--name', '-n', type=str, help='The o2o job name',required=True) parser_setInterval.add_argument('--interval', '-i', type=int, help='the chron job interval',required=True) @@ -516,6 +536,9 @@ def enable(self): def disable(self): self.mgr.set( self.args.name, False ) + def setFrequent(self): + self.mgr.set( self.args.name, None, int(self.args.flag) ) + def migrate(self): self.mgr.migrateConfig() From 2459b7540ae7f75fb58c577b3bced26d607007c2 Mon Sep 17 00:00:00 2001 From: Fabio Cossutti <fabio.cossutti@ts.infn.it> Date: Fri, 14 May 2021 12:00:15 +0200 Subject: [PATCH 307/309] Remove forgotten old commented statements (comment by P. Srimanobhas) --- RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc index dd4baa0e1baf2..66ccf3d51804d 100644 --- a/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc +++ b/RecoMTD/DetLayers/src/ETLDetLayerGeometryBuilder.cc @@ -178,14 +178,12 @@ MTDSectorForwardDoubleLayer* ETLDetLayerGeometryBuilder::buildLayerNew( } if (!backGeomDets.empty()) { - //std::sort(backGeomDets.begin(), backGeomDets.end(), orderGeomDets); std::sort(backGeomDets.begin(), backGeomDets.end(), topo.orderETLSector); LogDebug("MTDDetLayers") << "backGeomDets size = " << backGeomDets.size(); backSectors.emplace_back(makeDetSector(backGeomDets, topo)); } if (!frontGeomDets.empty()) { - //std::sort(frontGeomDets.begin(), frontGeomDets.end(), orderGeomDets); std::sort(frontGeomDets.begin(), frontGeomDets.end(), topo.orderETLSector); LogDebug("MTDDetLayers") << "frontGeomDets size = " << frontGeomDets.size(); frontSectors.emplace_back(makeDetSector(frontGeomDets, topo)); From 0352af304287e888eb91363badd934571b408e25 Mon Sep 17 00:00:00 2001 From: Chris Jones <chrisdjones15@gmail.com> Date: Thu, 13 May 2021 09:32:42 -0500 Subject: [PATCH 308/309] Removed unnecessary includes --- DataFormats/Provenance/src/ProductProvenanceLookup.cc | 4 +--- FWCore/Framework/interface/ProductProvenanceRetriever.h | 4 ---- FWCore/Framework/src/ProductProvenanceRetriever.cc | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/DataFormats/Provenance/src/ProductProvenanceLookup.cc b/DataFormats/Provenance/src/ProductProvenanceLookup.cc index 3c389f1e00ce2..366406e509aad 100644 --- a/DataFormats/Provenance/src/ProductProvenanceLookup.cc +++ b/DataFormats/Provenance/src/ProductProvenanceLookup.cc @@ -2,9 +2,7 @@ #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "FWCore/Utilities/interface/EDMException.h" -#include <cassert> -#include <iostream> -#include <limits> +#include <algorithm> /* ProductProvenanceLookup diff --git a/FWCore/Framework/interface/ProductProvenanceRetriever.h b/FWCore/Framework/interface/ProductProvenanceRetriever.h index 38703e1b207aa..b9b99fb90acd3 100644 --- a/FWCore/Framework/interface/ProductProvenanceRetriever.h +++ b/FWCore/Framework/interface/ProductProvenanceRetriever.h @@ -6,24 +6,20 @@ ProductProvenanceRetriever: Manages the per event/lumi/run per product provenance. ----------------------------------------------------------------------*/ -#include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/ProductProvenance.h" #include "DataFormats/Provenance/interface/ProductProvenanceLookup.h" #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "FWCore/Utilities/interface/propagate_const.h" -#include <vector> #include <memory> #include <set> #include <atomic> -#include <string_view> /* ProductProvenanceRetriever */ namespace edm { - class ProvenanceReaderBase; class ModuleCallingContext; class ProductRegistry; diff --git a/FWCore/Framework/src/ProductProvenanceRetriever.cc b/FWCore/Framework/src/ProductProvenanceRetriever.cc index 1c95398207800..e59591779148e 100644 --- a/FWCore/Framework/src/ProductProvenanceRetriever.cc +++ b/FWCore/Framework/src/ProductProvenanceRetriever.cc @@ -3,7 +3,6 @@ #include "FWCore/Utilities/interface/EDMException.h" #include <cassert> -#include <iostream> #include <limits> /* From 41e6e2eb6ca4bf634072871e7b9bf23cfd9f62b6 Mon Sep 17 00:00:00 2001 From: ccaillol <ccaillol@cern.ch> Date: Mon, 17 May 2021 12:35:13 +0200 Subject: [PATCH 309/309] switch from printf to LogDebug --- .../plugins/L1CaloJetHTTProducer.cc | 7 +- .../plugins/L1CaloJetProducer.cc | 184 ++++++------------ 2 files changed, 68 insertions(+), 123 deletions(-) diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc index 6067ec5f74a2a..d29032c46f497 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetHTTProducer.cc @@ -25,6 +25,7 @@ HTT energy sum for CaloJets #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include <iostream> @@ -91,7 +92,8 @@ void L1CaloJetHTTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS } if (debug) { - printf("BXV L1CaloJetCollection JetHTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); + LogDebug("L1CaloJetHTTProducer") << " BXV L1CaloJetCollection JetHTT = " << *CaloJetHTT << " for PtMin " << PtMin + << " and EtaMax " << EtaMax << "\n"; } } @@ -110,7 +112,8 @@ void L1CaloJetHTTProducer::produce(edm::Event& iEvent, const edm::EventSetup& iS } if (debug) { - printf("Gen Jets HTT = %f for PtMin %f and EtaMax %f\n", *CaloJetHTT, PtMin, EtaMax); + LogDebug("L1CaloJetHTTProducer") << " Gen Jets HTT = " << *CaloJetHTT << " for PtMin " << PtMin << " and EtaMax " + << EtaMax << "\n"; } } diff --git a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc index 92af0cccf1f1a..29f40d985b195 100644 --- a/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc +++ b/L1Trigger/L1CaloTrigger/plugins/L1CaloJetProducer.cc @@ -29,6 +29,7 @@ and clusters them within fixed number of trigger towers #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include <iostream> @@ -335,28 +336,15 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) l1TowerToken_(consumes<l1tp2::CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("l1CaloTowers"))) { - if (debug) - printf("L1CaloJetProducer setup\n"); produces<l1tp2::CaloJetsCollection>("L1CaloJetsNoCuts"); //produces<l1tp2::CaloJetsCollection>("L1CaloJetsWithCuts"); //produces<l1extra::L1JetParticleCollection>("L1CaloClusterCollectionWithCuts"); produces<BXVector<l1t::Jet>>("L1CaloJetCollectionBXV"); produces<BXVector<l1t::Tau>>("L1CaloTauCollectionBXV"); - if (debug) - printf("\nHcalTpEtMin = %f\nEcalTpEtMin = %f\n", HcalTpEtMin, EcalTpEtMin); - //for( unsigned int i = 0; i < emFractionBins.size(); i++) - //{ - // printf("\n emFrac: %f", emFractionBins.at(i)); - //} - //for( unsigned int i = 0; i < absEtaBins.size(); i++) - //{ - // printf("\n absEta: %f", absEtaBins.at(i)); - //} - //for( unsigned int i = 0; i < jetPtBins.size(); i++) - //{ - // printf("\n jetPt: %f", jetPtBins.at(i)); - //} + if (debug) { + LogDebug("L1CaloJetProducer") << " HcalTpEtMin = " << HcalTpEtMin << " EcalTpEtMin = " << EcalTpEtMin << "\n"; + } // Fill the calibration 3D vector // Dimension 1 is AbsEta bin @@ -371,8 +359,6 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) for (unsigned int em_frac = 0; em_frac < emFractionBinsBarrel.size() - 1; em_frac++) { std::vector<double> pt_bin_calibs; for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { - //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); - //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsBarrel.at(em_frac), absEtaBinsBarrel.at(abs_eta), jetPtBins.at(pt), jetCalibrationsBarrel.at(index)); pt_bin_calibs.push_back(jetCalibrationsBarrel.at(index)); index++; } @@ -380,10 +366,11 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) } calibrationsBarrel.push_back(em_bins); } - if (debug) - printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", - index, - int(jetCalibrationsBarrel.size())); + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading Barrel calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(jetCalibrationsBarrel.size()) << "\n"; + } index = 0; //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHGCal.at(index) ); @@ -392,8 +379,6 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) for (unsigned int em_frac = 0; em_frac < emFractionBinsHGCal.size() - 1; em_frac++) { std::vector<double> pt_bin_calibs; for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { - //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); - //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHGCal.at(em_frac), absEtaBinsHGCal.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHGCal.at(index)); pt_bin_calibs.push_back(jetCalibrationsHGCal.at(index)); index++; } @@ -401,10 +386,11 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) } calibrationsHGCal.push_back(em_bins); } - if (debug) - printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", - index, - int(jetCalibrationsHGCal.size())); + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading HGCal calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(jetCalibrationsHGCal.size()) << "\n"; + } index = 0; //calibrations[em_frac][abs_eta].push_back( jetCalibrationsHF.at(index) ); @@ -413,8 +399,6 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) for (unsigned int em_frac = 0; em_frac < emFractionBinsHF.size() - 1; em_frac++) { std::vector<double> pt_bin_calibs; for (unsigned int pt = 0; pt < jetPtBins.size() - 1; pt++) { - //printf("\n em_frac %d abs_eta %d pt %d", em_frac, abs_eta, pt); - //printf("\n - em_frac %f abs_eta %f pt %f = %f\n", emFractionBinsHF.at(em_frac), absEtaBinsHF.at(abs_eta), jetPtBins.at(pt), jetCalibrationsHF.at(index)); pt_bin_calibs.push_back(jetCalibrationsHF.at(index)); index++; } @@ -422,17 +406,18 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) } calibrationsHF.push_back(em_bins); } - if (debug) - printf("\nLoading HF calibrations: Loaded %i values vs. size() of input calibration file: %i", - index, - int(jetCalibrationsHF.size())); + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading HF calibrations: Loaded " << index + << " values vs. size() of input calibration file: " << int(jetCalibrationsHF.size()) + << "\n"; + } // Load Tau L1EG-base calibration info into maps for (auto &first : tauL1egInfoBarrel) { if (debug) { - printf("barrel l1egCount = %f\n", first.getParameter<double>("l1egCount")); + LogDebug("L1CaloJetProducer") << " barrel l1egCount = " << first.getParameter<double>("l1egCount") << "\n"; for (auto &em_frac : first.getParameter<std::vector<double>>("l1egEmFractions")) { - printf(" - EM = %.3f\n", em_frac); + LogDebug("L1CaloJetProducer") << " - EM = " << em_frac << "\n"; } } double l1egCount = first.getParameter<double>("l1egCount"); @@ -443,9 +428,9 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) std::sort(tauL1egValuesBarrel.begin(), tauL1egValuesBarrel.end()); for (auto &first : tauL1egInfoHGCal) { if (debug) { - printf("hgcal l1egCount = %f\n", first.getParameter<double>("l1egCount")); + LogDebug("L1CaloJetProducer") << " hgcal l1egCount = " << first.getParameter<double>("l1egCount") << "\n"; for (auto &em_frac : first.getParameter<std::vector<double>>("l1egEmFractions")) { - printf(" - EM = %.3f\n", em_frac); + LogDebug("L1CaloJetProducer") << " - EM = " << em_frac << "\n"; } } double l1egCount = first.getParameter<double>("l1egCount"); @@ -471,10 +456,8 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) for (auto &l1eg_info : tauL1egInfoMapBarrel) { std::vector<std::vector<double>> em_bins; for (unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) { - //printf("\nBarrel l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsBarrel.at(abs_eta)); std::vector<double> pt_bin_calibs; for (unsigned int pt = 0; pt < tauPtBins.size() - 1; pt++) { - //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsBarrel.at(index)); pt_bin_calibs.push_back(tauCalibrationsBarrel.at(index)); index++; } @@ -484,10 +467,11 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) } tauPtCalibrationsBarrel.push_back(l1eg_bins); } - if (debug) - printf("\nLoading Barrel calibrations: Loaded %i values vs. size() of input calibration file: %i", - index, - int(tauCalibrationsBarrel.size())); + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading Barrel calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(tauCalibrationsBarrel.size()) << "\n"; + } index = 0; for (unsigned int abs_eta = 0; abs_eta < tauAbsEtaBinsHGCal.size() - 1; abs_eta++) { @@ -495,10 +479,8 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) for (const auto &l1eg_info : tauL1egInfoMapHGCal) { std::vector<std::vector<double>> em_bins; for (unsigned int em_frac = 0; em_frac < l1eg_info.second.size() - 1; em_frac++) { - //printf("\nHGCal l1eg_bin %d em_frac %d (%.3f) abs_eta %d (%.2f)\n", int(l1eg_info.first), em_frac, l1eg_info.second[em_frac], abs_eta, tauAbsEtaBinsHGCal.at(abs_eta)); std::vector<double> pt_bin_calibs; for (unsigned int pt = 0; pt < tauPtBins.size() - 1; pt++) { - //printf("pt(%d)=%.1f = %.3f, ", pt, tauPtBins.at(pt), tauCalibrationsHGCal.at(index)); pt_bin_calibs.push_back(tauCalibrationsHGCal.at(index)); index++; } @@ -508,10 +490,11 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) } tauPtCalibrationsHGCal.push_back(l1eg_bins); } - if (debug) - printf("\nLoading HGCal calibrations: Loaded %i values vs. size() of input calibration file: %i", - index, - int(tauCalibrationsHGCal.size())); + if (debug) { + LogDebug("L1CaloJetProducer") << " Loading HGCal calibrations: Loaded " << index + << " values vs. size() of input calibration file: " + << int(tauCalibrationsHGCal.size()) << "\n"; + } isoTauBarrel.SetParameter(0, 0.25); isoTauBarrel.SetParameter(1, 0.85); @@ -519,14 +502,9 @@ L1CaloJetProducer::L1CaloJetProducer(const edm::ParameterSet &iConfig) isoTauHGCal.SetParameter(0, 0.34); isoTauHGCal.SetParameter(1, 0.35); isoTauHGCal.SetParameter(2, 0.051); - - if (debug) - printf("\nL1CaloJetProducer end\n"); } void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { - //printf("begin L1CaloJetProducer\n"); - // Output collections std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsNoCuts(new l1tp2::CaloJetsCollection); //std::unique_ptr<l1tp2::CaloJetsCollection> L1CaloJetsWithCuts( new l1tp2::CaloJetsCollection ); @@ -568,15 +546,12 @@ void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetu l1Hit.towerEta = hit.towerEta(); l1Hit.towerPhi = hit.towerPhi(); l1CaloTowers.push_back(l1Hit); - if (debug) - printf("Tower iEta %i iPhi %i eta %f phi %f ecal_et %f hcal_et %f total_et %f\n", - (int)l1Hit.towerIEta, - (int)l1Hit.towerIPhi, - l1Hit.towerEta, - l1Hit.towerPhi, - l1Hit.ecalTowerEt, - l1Hit.hcalTowerEt, - l1Hit.total_tower_et); + if (debug) { + LogDebug("L1CaloJetProducer") << " Tower iEta " << (int)l1Hit.towerIEta << " iPhi " << (int)l1Hit.towerIPhi + << " eta " << l1Hit.towerEta << " phi " << l1Hit.towerPhi << " ecal_et " + << l1Hit.ecalTowerEt << " hacl_et " << l1Hit.hcalTowerEt << " total_et " + << l1Hit.total_tower_et << "\n"; + } } // Sort the ECAL+HCAL+L1EGs tower sums based on total ET @@ -691,21 +666,16 @@ void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetu caloJetObj.seed_iEta = l1CaloTower.towerIEta; caloJetObj.seed_iPhi = l1CaloTower.towerIPhi; - if (debug) - printf(" -- hit %i, seeding input p4 pt %f eta %f phi %f\n", - cnt, - l1CaloTower.total_tower_et, - l1CaloTower.towerEta, - l1CaloTower.towerPhi); - if (debug) - printf( - " -- hit %i, seeding input2 p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); - if (debug) - printf(" -- hit %i, seeding reslt tot p4 pt %f eta %f phi %f\n", - cnt, - caloJetObj.jetClusterET, - caloJetObj.jetCluster.eta(), - caloJetObj.jetCluster.phi()); + if (debug) { + LogDebug("L1CaloJetProducer") << " -- hit " << cnt << " , seeding input p4 pt " + << l1CaloTower.total_tower_et << " eta " << l1CaloTower.towerEta << " phi " + << l1CaloTower.towerPhi << "\n"; + LogDebug("L1CaloJetProducer") << " -- hit " << cnt << " , seeding input2 p4 pt " << totalP4.pt() << " eta " + << totalP4.eta() << " phi " << totalP4.phi() << "\n"; + LogDebug("L1CaloJetProducer") << " -- hit " << cnt << " seeding reslt tot p4 pt " << caloJetObj.jetClusterET + << " eta " << caloJetObj.jetCluster.eta() << " phi " + << caloJetObj.jetCluster.phi() << "\n"; + } // Need to add the seed energy to the dR rings caloJetObj.hcal_seed += hcalP4.pt(); @@ -828,14 +798,13 @@ void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetu caloJetObj.jetClusterET += l1CaloTower.total_tower_et; } - if (debug) - printf(" ---- hit %i input p4 pt %f eta %f phi %f\n", cnt, totalP4.pt(), totalP4.eta(), totalP4.phi()); - if (debug) - printf(" ---- hit %i resulting p4 pt %f eta %f phi %f\n", - cnt, - caloJetObj.jetClusterET, - caloJetObj.jetCluster.eta(), - caloJetObj.jetCluster.phi()); + if (debug) { + LogDebug("L1CaloJetProducer") << " ---- hit " << cnt << " input p4 pt " << totalP4.pt() << " eta " + << totalP4.eta() << " phi " << totalP4.phi() << "\n"; + LogDebug("L1CaloJetProducer") << " ---- hit " << cnt << " resulting p4 pt " << caloJetObj.jetClusterET + << " eta " << caloJetObj.jetCluster.eta() << " phi " + << caloJetObj.jetCluster.phi() << "\n"; + } if ((abs(d_iEta) == 0 && abs(d_iPhi) == 0) || (fabs(d_eta) < 0.043 && fabs(d_phi) < 0.043)) { caloJetObj.hcal_seed += hcalP4.pt(); @@ -1098,11 +1067,9 @@ void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetu L1CaloJetCollectionBXV->push_back(0, l1t::Jet(jet_p4)); if (debug) - printf("Made a Jet, eta %f phi %f pt %f calibrated pt %f\n", - caloJetObj.jetCluster.eta(), - caloJetObj.jetCluster.phi(), - caloJetObj.jetClusterET, - params["jet_pt_calibration"]); + LogDebug("L1CaloJetProducer") << " Made a Jet, eta " << caloJetObj.jetCluster.eta() << " phi " + << caloJetObj.jetCluster.phi() << " pt " << caloJetObj.jetClusterET + << " calibrated pt " << params["jet_pt_calibration"] << "\n"; } // Only store taus passing ET threshold @@ -1128,9 +1095,10 @@ void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetu l1Tau.setIsMerged(false); L1CaloTauCollectionBXV->push_back(0, l1Tau); - if (debug) - printf( - "Made a Tau, eta %f phi %f pt %i calibrated pt %f\n", l1Tau.eta(), l1Tau.phi(), l1Tau.rawEt(), l1Tau.pt()); + if (debug) { + LogDebug("L1CaloJetProducer") << " Made a Jet, eta " << l1Tau.eta() << " phi " << l1Tau.phi() << " pt " + << l1Tau.rawEt() << " calibrated pt " << l1Tau.pt() << "\n"; + } } } // end jetClusters loop @@ -1140,8 +1108,6 @@ void L1CaloJetProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetu //iEvent.put(std::move(L1CaloClusterCollectionWithCuts), "L1CaloClusterCollectionWithCuts" ); iEvent.put(std::move(L1CaloJetCollectionBXV), "L1CaloJetCollectionBXV"); iEvent.put(std::move(L1CaloTauCollectionBXV), "L1CaloTauCollectionBXV"); - - //printf("end L1CaloJetProducer\n"); } int L1CaloJetProducer::ecalXtal_diPhi(int &iPhi_1, int &iPhi_2) const { @@ -1223,7 +1189,6 @@ float L1CaloJetProducer::get_hcal_calibration(float &jet_pt, break; pt_index++; } - //printf("Barrel calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); calib = calibrationsBarrel[eta_index][em_index][pt_index]; } // end Barrel else if (abs_eta <= 3.0) // HGCal @@ -1248,7 +1213,6 @@ float L1CaloJetProducer::get_hcal_calibration(float &jet_pt, break; pt_index++; } - //printf("HGCal calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); calib = calibrationsHGCal[eta_index][em_index][pt_index]; } // end HGCal else // HF @@ -1273,20 +1237,9 @@ float L1CaloJetProducer::get_hcal_calibration(float &jet_pt, break; pt_index++; } - //printf("HF calib emId %i etaId %i jetPtId %i\n",int(em_index),int(eta_index),int(pt_index)); calib = calibrationsHF[eta_index][em_index][pt_index]; } // end HF - //printf(" - jet pt %f index %i\n", jet_pt, int(pt_index)); - //printf(" --- calibration: %f\n", calibrations[ em_index ][ eta_index ][ pt_index ] ); - - if (calib > 5 && debug) { - printf( - " - l1eg %f, ecal %f, jet %f, em frac %f index %i\n", ecal_L1EG_jet_pt, ecal_pt, jet_pt, em_frac, int(em_index)); - printf(" - eta %f, abs eta %f index %i\n", jet_eta, abs_eta, int(eta_index)); - printf(" - jet pt %f tmp_jet_pt %f index %i\n", jet_pt, tmp_jet_pt, int(pt_index)); - printf(" --- calibration: %f\n\n", calib); - } return calib; } @@ -1342,7 +1295,6 @@ float L1CaloJetProducer::get_tau_pt_calibration( break; pt_index++; } - //printf("Barrel tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); calib = tauPtCalibrationsBarrel[eta_index][n_L1EG_index][em_index][pt_index]; } // end Barrel else if (abs_eta <= 3.0) // HGCal @@ -1381,21 +1333,11 @@ float L1CaloJetProducer::get_tau_pt_calibration( break; pt_index++; } - //printf("HGCal tau calib etaId %i nL1EG Id %i emId %i tauPtId %i\n",int(eta_index),int(n_L1EG_index),int(em_index),int(pt_index)); calib = tauPtCalibrationsHGCal[eta_index][n_L1EG_index][em_index][pt_index]; } // end HGCal else return calib; - //printf(" - tau pt %f index %i\n", tau_pt, int(pt_index)); - //printf(" --- calibration: %f\n", calib ); - - if (calib > 5 && debug) { - printf(" - l1eg %f, ecal %f, tau %f, em frac %f index %i\n", l1EG_pt, ecal_pt, tau_pt, em_frac, int(em_index)); - printf(" - eta %f, abs eta %f index %i\n", tau_eta, abs_eta, int(eta_index)); - printf(" - tau pt %f tmp_tau_pt %f index %i\n", tau_pt, tmp_tau_pt, int(pt_index)); - printf(" --- calibration: %f\n\n", calib); - } return calib; }