Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable GEM trigger clusters from EMTF in GEM L1T DQM #35666

Merged
merged 3 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DQM/L1TMonitor/interface/L1TdeGEMTPG.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class L1TdeGEMTPG : public DQMEDAnalyzer {
std::vector<double> clusterMinBin_;
std::vector<double> clusterMaxBin_;

bool useDataClustersOnlyInBX0_;

// first key is the chamber number
// second key is the variable
std::map<uint32_t, std::map<std::string, MonitorElement*> > chamberHistos;
Expand Down
9 changes: 6 additions & 3 deletions DQM/L1TMonitor/python/L1TdeGEMTPG_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
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,-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),
B904Setup = cms.bool(False),
)

from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
l1tdeGEMTPG = DQMEDAnalyzer(
"L1TdeGEMTPG",
l1tdeGEMTPGCommon,
data = cms.InputTag("valMuonGEMPadDigiClusters"),
data = cms.InputTag("emtfStage2Digis"),
emul = cms.InputTag("valMuonGEMPadDigiClusters"),
)
7 changes: 6 additions & 1 deletion DQM/L1TMonitor/src/L1TdeGEMTPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ L1TdeGEMTPG::L1TdeGEMTPG(const edm::ParameterSet& ps)
// binning
clusterNBin_(ps.getParameter<std::vector<unsigned>>("clusterNBin")),
clusterMinBin_(ps.getParameter<std::vector<double>>("clusterMinBin")),
clusterMaxBin_(ps.getParameter<std::vector<double>>("clusterMaxBin")) {}
clusterMaxBin_(ps.getParameter<std::vector<double>>("clusterMaxBin")),
useDataClustersOnlyInBX0_(ps.getParameter<bool>("useDataClustersOnlyInBX0")) {}

L1TdeGEMTPG::~L1TdeGEMTPG() {}

Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
20 changes: 5 additions & 15 deletions L1Trigger/L1TGEM/test/GEMTriggerPrimitivesAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ class GEMTriggerPrimitivesAnalyzer : public edm::one::EDAnalyzer<edm::one::Share
bool dataVsEmulatorPlots_;
void makeDataVsEmulatorPlots();

// plots of efficiencies in MC
bool mcEfficiencyPlots_;

// plots of resolution in MC
bool mcResolutionPlots_;

/*
When set to True, we assume that the data comes from
the Building 904 GEM test-stand. This test-stand is a single
Expand All @@ -88,16 +82,12 @@ GEMTriggerPrimitivesAnalyzer::GEMTriggerPrimitivesAnalyzer(const edm::ParameterS
chambers_(conf.getParameter<std::vector<std::string>>("chambers")),
clusterVars_(conf.getParameter<std::vector<std::string>>("clusterVars")),
dataVsEmulatorPlots_(conf.getParameter<bool>("dataVsEmulatorPlots")),
mcEfficiencyPlots_(conf.getParameter<bool>("mcEfficiencyPlots")),
mcResolutionPlots_(conf.getParameter<bool>("mcResolutionPlots")),
B904Setup_(conf.getParameter<bool>("B904Setup")),
B904RunNumber_(conf.getParameter<std::string>("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_)
Expand Down Expand Up @@ -199,17 +189,17 @@ 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);
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");
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);
Expand Down
10 changes: 0 additions & 10 deletions L1Trigger/L1TGEM/test/runGEMTriggerPrimitiveAnalyzer_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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)
)

Expand Down