From e35ff0007f5c8c0d9e98d901f14b026d030f91eb Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 14 Oct 2021 08:23:16 -0500 Subject: [PATCH 1/3] Data vs emulation for GEM TPs in DQM --- DQM/L1TMonitor/interface/L1TdeGEMTPG.h | 2 ++ DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py | 9 ++++++--- DQM/L1TMonitor/src/L1TdeGEMTPG.cc | 7 ++++++- .../runCSCTriggerPrimitiveProducer_cfg.py | 15 +++++++++++++- .../test/GEMTriggerPrimitivesAnalyzer.cc | 20 +++++-------------- .../runGEMTriggerPrimitiveAnalyzer_cfg.py | 10 ---------- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/DQM/L1TMonitor/interface/L1TdeGEMTPG.h b/DQM/L1TMonitor/interface/L1TdeGEMTPG.h index 2a0969bda547d..10ff17ddc0b3e 100644 --- a/DQM/L1TMonitor/interface/L1TdeGEMTPG.h +++ b/DQM/L1TMonitor/interface/L1TdeGEMTPG.h @@ -33,6 +33,8 @@ class L1TdeGEMTPG : public DQMEDAnalyzer { std::vector clusterMinBin_; std::vector clusterMaxBin_; + bool useDataClustersOnlyInBX0_; + // first key is the chamber number // second key is the variable std::map > chamberHistos; diff --git a/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py b/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py index 78a0f0babae1f..7d880aa08fcaf 100644 --- a/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py +++ b/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py @@ -8,8 +8,11 @@ dataEmul = cms.vstring("data","emul"), clusterVars = cms.vstring("size", "pad", "bx"), clusterNBin = cms.vuint32(20,384,10), - clusterMinBin = cms.vdouble(-0.5,-0.5,-4.5), - clusterMaxBin = cms.vdouble(19.5,383.5,5.5), + clusterMinBin = cms.vdouble(0,0,0), + clusterMaxBin = cms.vdouble(20,384,10), + ## GEM VFAT data is not captured in BX's other than BX0 + ## For a good comparison, leave out those data clusters + useDataClustersOnlyInBX0 = cms.bool(True), B904Setup = cms.bool(False), ) @@ -17,6 +20,6 @@ l1tdeGEMTPG = DQMEDAnalyzer( "L1TdeGEMTPG", l1tdeGEMTPGCommon, - data = cms.InputTag("valMuonGEMPadDigiClusters"), + data = cms.InputTag("emtfStage2Digis"), emul = cms.InputTag("valMuonGEMPadDigiClusters"), ) diff --git a/DQM/L1TMonitor/src/L1TdeGEMTPG.cc b/DQM/L1TMonitor/src/L1TdeGEMTPG.cc index 8a391de1bf62e..15ced5f2512b3 100644 --- a/DQM/L1TMonitor/src/L1TdeGEMTPG.cc +++ b/DQM/L1TMonitor/src/L1TdeGEMTPG.cc @@ -17,7 +17,8 @@ L1TdeGEMTPG::L1TdeGEMTPG(const edm::ParameterSet& ps) // binning clusterNBin_(ps.getParameter>("clusterNBin")), clusterMinBin_(ps.getParameter>("clusterMinBin")), - clusterMaxBin_(ps.getParameter>("clusterMaxBin")) {} + clusterMaxBin_(ps.getParameter>("clusterMaxBin")), + useDataClustersOnlyInBX0_(ps.getParameter("useDataClustersOnlyInBX0")) {} L1TdeGEMTPG::~L1TdeGEMTPG() {} @@ -57,6 +58,10 @@ void L1TdeGEMTPG::analyze(const edm::Event& e, const edm::EventSetup& c) { const int type = ((*it).first).station() - 1; for (auto cluster = range.first; cluster != range.second; cluster++) { if (cluster->isValid()) { + // ignore data clusters in BX's other than BX0 + if (useDataClustersOnlyInBX0_ and cluster->bx() != 0) + continue; + chamberHistos[type]["cluster_size_data"]->Fill(cluster->pads().size()); chamberHistos[type]["cluster_pad_data"]->Fill(cluster->pads().front()); chamberHistos[type]["cluster_bx_data"]->Fill(cluster->bx()); diff --git a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py index f9d92f298ec72..cd3cc0c21b39e 100644 --- a/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py +++ b/L1Trigger/CSCTriggerPrimitives/test/runCSCTriggerPrimitiveProducer_cfg.py @@ -18,6 +18,8 @@ "Set to True when you want to run the CSC DQM") options.register("dqmGEM", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool, "Set to True when you want to run the GEM DQM") +options.register("useEmtfGEM", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool, + "Set to True when you want to use GEM clusters from the EMTF in the DQM") options.register("useB904ME11", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool, "Set to True when using B904 ME1/1 data.") options.register("useB904ME21", False, VarParsing.multiplicity.singleton, VarParsing.varType.bool, @@ -59,6 +61,7 @@ process.load('Configuration.EventContent.EventContent_cff') process.load("EventFilter.CSCRawToDigi.cscUnpacker_cfi") process.load('EventFilter.GEMRawToDigi.muonGEMDigis_cfi') +process.load('EventFilter.L1TRawToDigi.emtfStage2Digis_cfi') process.load("L1Trigger.CSCTriggerPrimitives.cscTriggerPrimitiveDigis_cfi") process.load("CalibMuon.CSCCalibration.CSCL1TPLookupTableEP_cff") process.load('L1Trigger.L1TGEM.simGEMDigis_cff') @@ -144,7 +147,13 @@ process.l1tdeCSCTPG.preTriggerAnalysis = options.preTriggerAnalysis if options.dqmGEM: - process.l1tdeGEMTPG.data = "muonCSCDigis" + ## GEM pad clusters from the EMTF + if options.useEmtfGEM: + process.l1tdeGEMTPG.data = "emtfStage2Digis" + ## GEM pad clusters from the CSC TPG + else: + process.l1tdeGEMTPG.data = "muonCSCDigis" + ## GEM pad clusters from the GEM TPG process.l1tdeGEMTPG.emul = "simMuonGEMPadDigiClusters" # Output @@ -187,7 +196,11 @@ ## schedule and path definition process.unpacksequence = cms.Sequence(process.muonCSCDigis) if options.unpackGEM: + ## unpack GEM strip digis process.unpacksequence += process.muonGEMDigis + ## unpack GEM pad clusters from the EMTF + if options.useEmtfGEM: + process.unpacksequence += process.emtfStage2Digis process.p1 = cms.Path(process.unpacksequence) process.l1sequence = cms.Sequence(l1csc) diff --git a/L1Trigger/L1TGEM/test/GEMTriggerPrimitivesAnalyzer.cc b/L1Trigger/L1TGEM/test/GEMTriggerPrimitivesAnalyzer.cc index 79b4d7b46b20d..d7d198d095012 100644 --- a/L1Trigger/L1TGEM/test/GEMTriggerPrimitivesAnalyzer.cc +++ b/L1Trigger/L1TGEM/test/GEMTriggerPrimitivesAnalyzer.cc @@ -65,12 +65,6 @@ class GEMTriggerPrimitivesAnalyzer : public edm::one::EDAnalyzer>("chambers")), clusterVars_(conf.getParameter>("clusterVars")), dataVsEmulatorPlots_(conf.getParameter("dataVsEmulatorPlots")), - mcEfficiencyPlots_(conf.getParameter("mcEfficiencyPlots")), - mcResolutionPlots_(conf.getParameter("mcResolutionPlots")), B904Setup_(conf.getParameter("B904Setup")), B904RunNumber_(conf.getParameter("B904RunNumber")) { usesResource("TFileService"); } -void GEMTriggerPrimitivesAnalyzer::analyze(const edm::Event &ev, const edm::EventSetup &setup) { - // efficiency and resolution analysis is done here -} +void GEMTriggerPrimitivesAnalyzer::analyze(const edm::Event &ev, const edm::EventSetup &setup) {} void GEMTriggerPrimitivesAnalyzer::endJob() { if (dataVsEmulatorPlots_) @@ -199,7 +189,7 @@ void GEMTriggerPrimitivesAnalyzer::makePlot(TH1F *dataMon, 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->SetMaximum(dataMon->GetBinContent(dataMon->GetMaximumBin()) * 1.6); dataMon->Draw("histp"); dataMon->GetXaxis()->SetLabelSize(0.05); dataMon->GetYaxis()->SetLabelSize(0.05); @@ -207,9 +197,9 @@ void GEMTriggerPrimitivesAnalyzer::makePlot(TH1F *dataMon, 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"); + auto legend = new TLegend(0.6, 0.7, 0.9, 0.9); + legend->AddEntry(dataMon, TString("Data (" + std::to_string((int)dataMon->GetEntries()) + ")"), "p"); + legend->AddEntry(emulMon, TString("Emulator (" + std::to_string((int)emulMon->GetEntries()) + ")"), "l"); legend->Draw(); c1->cd(2); diff --git a/L1Trigger/L1TGEM/test/runGEMTriggerPrimitiveAnalyzer_cfg.py b/L1Trigger/L1TGEM/test/runGEMTriggerPrimitiveAnalyzer_cfg.py index c283530bc100b..98d5e554fbf3c 100644 --- a/L1Trigger/L1TGEM/test/runGEMTriggerPrimitiveAnalyzer_cfg.py +++ b/L1Trigger/L1TGEM/test/runGEMTriggerPrimitiveAnalyzer_cfg.py @@ -5,8 +5,6 @@ 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) """ - For CMS runs, use the actual run number. Set B904Setup to False @@ -29,12 +27,6 @@ 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") @@ -54,8 +46,6 @@ ## e.g. 334393 runNumber = cms.uint32(options.runNumber), dataVsEmulatorPlots = cms.bool(options.dataVsEmulation), - mcEfficiencyPlots = cms.bool(options.analyzeEffiency), - mcResolutionPlots = cms.bool(options.analyzeResolution), B904RunNumber = cms.string(options.B904RunNumber) ) From 17f58e207905146723b505cf89fdff7d62b59976 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 14 Oct 2021 09:40:49 -0500 Subject: [PATCH 2/3] Fix BX window --- DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py b/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py index 7d880aa08fcaf..29b2f662c368d 100644 --- a/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py +++ b/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py @@ -7,8 +7,8 @@ chambers = cms.vstring("GE11"), dataEmul = cms.vstring("data","emul"), clusterVars = cms.vstring("size", "pad", "bx"), - clusterNBin = cms.vuint32(20,384,10), - clusterMinBin = cms.vdouble(0,0,0), + clusterNBin = cms.vuint32(20,384,-5), + clusterMinBin = cms.vdouble(0,0,5), clusterMaxBin = cms.vdouble(20,384,10), ## GEM VFAT data is not captured in BX's other than BX0 ## For a good comparison, leave out those data clusters From 828127edbf15fc067bd32b386d495b98608eeec3 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Thu, 14 Oct 2021 10:45:16 -0500 Subject: [PATCH 3/3] Fix typo --- DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py b/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py index 29b2f662c368d..20a4a24ea995d 100644 --- a/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py +++ b/DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py @@ -7,9 +7,9 @@ chambers = cms.vstring("GE11"), dataEmul = cms.vstring("data","emul"), clusterVars = cms.vstring("size", "pad", "bx"), - clusterNBin = cms.vuint32(20,384,-5), - clusterMinBin = cms.vdouble(0,0,5), - clusterMaxBin = cms.vdouble(20,384,10), + clusterNBin = cms.vuint32(20,384,10), + clusterMinBin = cms.vdouble(0,0,-5), + clusterMaxBin = cms.vdouble(20,384,5), ## GEM VFAT data is not captured in BX's other than BX0 ## For a good comparison, leave out those data clusters useDataClustersOnlyInBX0 = cms.bool(True),