Skip to content

Commit

Permalink
Merge pull request #36883 from seungjin-yang/GEM-Offline-DQM-with-GE2…
Browse files Browse the repository at this point in the history
…1-Demonstrator__from-CMSSW_12_3_X_2022-02-03-2300

Fix GEM Offline DQM for GE2/1 Demonstrator
  • Loading branch information
cmsbuild committed Feb 7, 2022
2 parents ecff403 + d0a1df0 commit 31cd4ef
Show file tree
Hide file tree
Showing 15 changed files with 224 additions and 197 deletions.
189 changes: 112 additions & 77 deletions DQM/GEM/plugins/GEMEfficiencyAnalyzer.cc

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions DQM/GEM/plugins/GEMEfficiencyAnalyzer.h
Expand Up @@ -61,6 +61,7 @@ class GEMEfficiencyAnalyzer : public GEMOfflineDQMBase {

inline bool isInsideOut(const reco::Track &);

bool skipGEMStation(const int);
std::vector<GEMLayerData> buildGEMLayers(const edm::ESHandle<GEMGeometry> &);
const reco::Track *getTrack(const reco::Muon &);
std::pair<TrajectoryStateOnSurface, DetId> getStartingState(const reco::TransientTrack &,
Expand Down Expand Up @@ -97,6 +98,9 @@ class GEMEfficiencyAnalyzer : public GEMOfflineDQMBase {
int eta_nbins_;
double eta_low_;
double eta_up_;
bool monitor_ge11_;
bool monitor_ge21_;
bool monitor_ge0_;

// data mebers derived from parameters
MuonServiceProxy *muon_service_;
Expand Down
10 changes: 5 additions & 5 deletions DQM/GEM/plugins/GEMEfficiencyHarvester.cc
Expand Up @@ -15,7 +15,7 @@ GEMEfficiencyHarvester::~GEMEfficiencyHarvester() {}
void GEMEfficiencyHarvester::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.addUntracked<std::string>("folder", "GEM/Efficiency/type0");
descriptions.add("gemEfficiencyHarvesterDefault", desc);
descriptions.add("gemEfficiencyHarvester", desc);
}

TProfile* GEMEfficiencyHarvester::computeEfficiency(
Expand Down Expand Up @@ -122,7 +122,7 @@ void GEMEfficiencyHarvester::doEfficiency(DQMStore::IBooker& ibooker, DQMStore::
me_pairs[key].second = me;
}

for (auto&& [key, value] : me_pairs) {
for (const auto& [key, value] : me_pairs) {
const auto& [me_passed, me_total] = value;
if (me_passed == nullptr) {
edm::LogError(log_category_) << "numerator is missing. " << key << std::endl;
Expand Down Expand Up @@ -218,7 +218,7 @@ std::tuple<std::string, int, int> GEMEfficiencyHarvester::parseResidualName(cons
name.erase(name.find("_GE"), 3);

// -11_R4 -> (-11, R4)
const std::vector<std::string>&& tokens = splitString(name, "_");
const std::vector<std::string> tokens = splitString(name, "_");
const size_t num_tokens = tokens.size();

if (num_tokens != 2) {
Expand Down Expand Up @@ -271,7 +271,7 @@ void GEMEfficiencyHarvester::doResolution(DQMStore::IBooker& ibooker,
continue;
}

auto&& [region_sign, station, ieta] = parseResidualName(name, prefix);
const auto [region_sign, station, ieta] = parseResidualName(name, prefix);
if (region_sign.empty() or station < 0 or ieta < 0) {
edm::LogError(log_category_) << "failed to parse the name of the residual histogram: " << name << std::endl;
continue;
Expand Down Expand Up @@ -374,7 +374,7 @@ void GEMEfficiencyHarvester::doResolution(DQMStore::IBooker& ibooker,
h_skewness->SetBinError(xbin, ybin, hist->GetSkewness(11));
}

for (auto&& each : {h_mean, h_stddev, h_skewness}) {
for (auto& each : {h_mean, h_stddev, h_skewness}) {
ibooker.book2D(each->GetName(), each);
}
}
Expand Down
18 changes: 18 additions & 0 deletions DQM/GEM/python/gemEfficiencyAnalyzerCosmics_cff.py
@@ -0,0 +1,18 @@
import FWCore.ParameterSet.Config as cms
from DQM.GEM.gemEfficiencyAnalyzer_cfi import *

gemEfficiencyAnalyzerCosmics = gemEfficiencyAnalyzer.clone(
isCosmics = True,
)

gemEfficiencyAnalyzerCosmicsTwoLeg = gemEfficiencyAnalyzerCosmics.clone(
muonTag = 'muons',
name = 'Cosmic 2-Leg STA Muon',
folder = 'GEM/Efficiency/type1'
)

gemEfficiencyAnalyzerCosmicsOneLeg = gemEfficiencyAnalyzerCosmics.clone(
muonTag = 'muons1Leg',
name = 'Cosmic 1-Leg STA Muon',
folder = 'GEM/Efficiency/type2'
)
28 changes: 0 additions & 28 deletions DQM/GEM/python/gemEfficiencyAnalyzerCosmics_cfi.py

This file was deleted.

45 changes: 45 additions & 0 deletions DQM/GEM/python/gemEfficiencyAnalyzer_cff.py
@@ -0,0 +1,45 @@
import FWCore.ParameterSet.Config as cms
from DQM.GEM.gemEfficiencyAnalyzer_cfi import *

gemOfflineDQMTightGlbMuons = cms.EDFilter("MuonSelector",
src = cms.InputTag('muons'),
cut = cms.string(
'(pt > 20)'
'&& isGlobalMuon'
'&& globalTrack.isNonnull'
'&& passed(\'CutBasedIdTight\')'
),
filter = cms.bool(False)
)

gemOfflineDQMStaMuons = cms.EDFilter("MuonSelector",
src = cms.InputTag('muons'),
cut = cms.string(
'(pt > 20)'
'&& isStandAloneMuon'
'&& outerTrack.isNonnull'
),
filter = cms.bool(False)
)

gemEfficiencyAnalyzerTightGlb = gemEfficiencyAnalyzer.clone(
folder = 'GEM/Efficiency/type1',
muonTag = 'gemOfflineDQMTightGlbMuons',
name = 'Tight GLB Muon',
useGlobalMuon = True
)

gemEfficiencyAnalyzerSta = gemEfficiencyAnalyzer.clone(
muonTag = "gemOfflineDQMStaMuons",
folder = 'GEM/Efficiency/type2',
name = 'STA Muon',
useGlobalMuon = False
)

gemEfficiencyAnalyzerTightGlbSeq = cms.Sequence(
cms.ignore(gemOfflineDQMTightGlbMuons) *
gemEfficiencyAnalyzerTightGlb)

gemEfficiencyAnalyzerStaSeq = cms.Sequence(
cms.ignore(gemOfflineDQMStaMuons) *
gemEfficiencyAnalyzerSta)
61 changes: 8 additions & 53 deletions DQM/GEM/python/gemEfficiencyAnalyzer_cfi.py
@@ -1,61 +1,16 @@
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy
from DQM.GEM.gemEfficiencyAnalyzerDefault_cfi import gemEfficiencyAnalyzerDefault as _gemEfficiencyAnalyzerDefault
from RecoMuon.TrackingTools.MuonServiceProxy_cff import *
from TrackingTools.TransientTrack.TransientTrackBuilder_cfi import *

gemOfflineDQMTightGlbMuons = cms.EDFilter("MuonSelector",
src = cms.InputTag('muons'),
cut = cms.string(
'(pt > 20)'
'&& isGlobalMuon'
'&& globalTrack.isNonnull'
'&& passed(\'CutBasedIdTight\')'
),
filter = cms.bool(False)
)

gemOfflineDQMStaMuons = cms.EDFilter("MuonSelector",
src = cms.InputTag('muons'),
cut = cms.string(
'(pt > 20)'
'&& isStandAloneMuon'
'&& outerTrack.isNonnull'
),
filter = cms.bool(False)
)

gemEfficiencyAnalyzerTightGlb = _gemEfficiencyAnalyzerDefault.clone(
gemEfficiencyAnalyzer = _gemEfficiencyAnalyzerDefault.clone(
ServiceParameters = MuonServiceProxy.ServiceParameters.clone(),
folder = 'GEM/Efficiency/type1',
muonTag = 'gemOfflineDQMTightGlbMuons',
name = 'Tight GLB Muon',
useGlobalMuon = True
)

gemEfficiencyAnalyzerSta = _gemEfficiencyAnalyzerDefault.clone(
ServiceParameters = MuonServiceProxy.ServiceParameters.clone(),
muonTag = "gemOfflineDQMStaMuons",
folder = 'GEM/Efficiency/type2',
name = 'STA Muon',
useGlobalMuon = False
)

from Configuration.Eras.Modifier_phase2_GEM_cff import phase2_GEM
phase2_GEM.toModify(
gemEfficiencyAnalyzerTightGlb,
etaNbins=cms.untracked.int32(15),
etaUp=cms.untracked.double(3.0))

phase2_GEM.toModify(
gemEfficiencyAnalyzerSta,
etaNbins=cms.untracked.int32(15),
etaUp=cms.untracked.double(3.0))

gemEfficiencyAnalyzerTightGlbSeq = cms.Sequence(
cms.ignore(gemOfflineDQMTightGlbMuons) *
gemEfficiencyAnalyzerTightGlb)

gemEfficiencyAnalyzerStaSeq = cms.Sequence(
cms.ignore(gemOfflineDQMStaMuons) *
gemEfficiencyAnalyzerSta)
phase2_GEM.toModify(gemEfficiencyAnalyzer,
monitorGE21 = True,
monitorGE0 = True,
etaNbins = 15,
etaUp = 3.0,
)
13 changes: 13 additions & 0 deletions DQM/GEM/python/gemEfficiencyHarvesterCosmics_cff.py
@@ -0,0 +1,13 @@
import FWCore.ParameterSet.Config as cms

from DQM.GEM.gemEfficiencyHarvester_cfi import gemEfficiencyHarvester
from DQM.GEM.gemEfficiencyAnalyzerCosmics_cff import gemEfficiencyAnalyzerCosmicsTwoLeg as _gemEfficiencyAnalyzerCosmicsTwoLeg
from DQM.GEM.gemEfficiencyAnalyzerCosmics_cff import gemEfficiencyAnalyzerCosmicsOneLeg as _gemEfficiencyAnalyzerCosmicsOneLeg

gemEfficiencyHarvesterCosmicsTwoLeg = gemEfficiencyHarvester.clone(
folder = _gemEfficiencyAnalyzerCosmicsTwoLeg.folder.value()
)

gemEfficiencyHarvesterCosmicsOneLeg = gemEfficiencyHarvester.clone(
folder = _gemEfficiencyAnalyzerCosmicsOneLeg.folder.value()
)
14 changes: 0 additions & 14 deletions DQM/GEM/python/gemEfficiencyHarvesterCosmics_cfi.py

This file was deleted.

13 changes: 13 additions & 0 deletions DQM/GEM/python/gemEfficiencyHarvester_cff.py
@@ -0,0 +1,13 @@
import FWCore.ParameterSet.Config as cms

from DQM.GEM.gemEfficiencyHarvester_cfi import gemEfficiencyHarvester
from DQM.GEM.gemEfficiencyAnalyzer_cff import gemEfficiencyAnalyzerTightGlb as _gemEfficiencyAnalyzerTightGlb
from DQM.GEM.gemEfficiencyAnalyzer_cff import gemEfficiencyAnalyzerSta as _gemEfficiencyAnalyzerSta

gemEfficiencyHarvesterTightGlb = gemEfficiencyHarvester.clone(
folder = _gemEfficiencyAnalyzerTightGlb.folder.value()
)

gemEfficiencyHarvesterSta = gemEfficiencyHarvester.clone(
folder = _gemEfficiencyAnalyzerSta.folder.value()
)
14 changes: 0 additions & 14 deletions DQM/GEM/python/gemEfficiencyHarvester_cfi.py

This file was deleted.

2 changes: 1 addition & 1 deletion DQM/GEM/python/gem_dqm_offline_client_cff.py
@@ -1,7 +1,7 @@
import FWCore.ParameterSet.Config as cms

from DQM.GEM.GEMDQMHarvester_cfi import *
from DQM.GEM.gemEfficiencyHarvester_cfi import *
from DQM.GEM.gemEfficiencyHarvester_cff import *

gemClients = cms.Sequence(
GEMDQMHarvester *
Expand Down
4 changes: 2 additions & 2 deletions DQM/GEM/python/gem_dqm_offline_client_cosmics_cff.py
@@ -1,10 +1,10 @@
import FWCore.ParameterSet.Config as cms

from DQM.GEM.GEMDQMHarvester_cfi import *
from DQM.GEM.gemEfficiencyHarvesterCosmics_cfi import *
from DQM.GEM.gemEfficiencyHarvesterCosmics_cff import *

gemClientsCosmics = cms.Sequence(
GEMDQMHarvester *
gemEfficiencyHarvesterCosmics *
gemEfficiencyHarvesterCosmicsTwoLeg *
gemEfficiencyHarvesterCosmicsOneLeg
)
2 changes: 1 addition & 1 deletion DQM/GEM/python/gem_dqm_offline_source_cff.py
Expand Up @@ -2,7 +2,7 @@

from DQM.GEM.GEMDigiSource_cfi import *
from DQM.GEM.GEMRecHitSource_cfi import *
from DQM.GEM.gemEfficiencyAnalyzer_cfi import *
from DQM.GEM.gemEfficiencyAnalyzer_cff import *

GEMDigiSource.modeRelVal = True
GEMRecHitSource.modeRelVal = True
Expand Down
4 changes: 2 additions & 2 deletions DQM/GEM/python/gem_dqm_offline_source_cosmics_cff.py
Expand Up @@ -2,14 +2,14 @@

from DQM.GEM.GEMDigiSource_cfi import *
from DQM.GEM.GEMRecHitSource_cfi import *
from DQM.GEM.gemEfficiencyAnalyzerCosmics_cfi import *
from DQM.GEM.gemEfficiencyAnalyzerCosmics_cff import *

GEMDigiSource.modeRelVal = True
GEMRecHitSource.modeRelVal = True

gemSourcesCosmics = cms.Sequence(
GEMDigiSource *
GEMRecHitSource *
gemEfficiencyAnalyzerCosmics *
gemEfficiencyAnalyzerCosmicsTwoLeg *
gemEfficiencyAnalyzerCosmicsOneLeg
)

0 comments on commit 31cd4ef

Please sign in to comment.