Skip to content

Commit

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

Fix GEM Offline DQM for GE2/1 Demonstrator (backport of #36883, 12_2_X)
  • Loading branch information
cmsbuild authored Feb 8, 2022
2 parents edb257f + c24439e commit 3662f17
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 35 deletions.
4 changes: 4 additions & 0 deletions DQMOffline/Muon/interface/GEMEfficiencyAnalyzer.h
Original file line number Diff line number Diff line change
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
26 changes: 16 additions & 10 deletions DQMOffline/Muon/python/gemEfficiencyAnalyzerCosmics_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@

gemEfficiencyAnalyzerCosmics = _gemEfficiencyAnalyzerCosmicsDefault.clone(
ServiceParameters = MuonServiceProxy.ServiceParameters.clone(),
muonTag = cms.InputTag('muons'),
name = cms.untracked.string('Cosmic 2-Leg STA Muon'),
folder = cms.untracked.string('GEM/Efficiency/type1'),
muonTag = 'muons',
name = 'Cosmic 2-Leg STA Muon',
folder = 'GEM/Efficiency/type1',
)

gemEfficiencyAnalyzerCosmicsOneLeg = _gemEfficiencyAnalyzerCosmicsDefault.clone(
ServiceParameters = MuonServiceProxy.ServiceParameters.clone(),
muonTag = cms.InputTag('muons1Leg'),
name = cms.untracked.string('Cosmic 1-Leg STA Muon'),
folder = cms.untracked.string('GEM/Efficiency/type2'),
muonTag = 'muons1Leg',
name = 'Cosmic 1-Leg STA Muon',
folder = 'GEM/Efficiency/type2',
)

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

phase2_GEM.toModify(gemEfficiencyAnalyzerCosmicsOneLeg,
etaNbins=cms.untracked.int32(15),
etaUp=cms.untracked.double(3.0))
etaNbins = 15,
etaUp = 3.0,
monitorGE21 = True,
monitorGE0 = True,
)
36 changes: 20 additions & 16 deletions DQMOffline/Muon/python/gemEfficiencyAnalyzer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,34 @@

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

gemEfficiencyAnalyzerSta = _gemEfficiencyAnalyzerDefault.clone(
ServiceParameters = MuonServiceProxy.ServiceParameters.clone(),
muonTag = cms.InputTag("gemOfflineDQMStaMuons"),
folder = cms.untracked.string('GEM/Efficiency/type2'),
name = cms.untracked.string('STA Muon'),
useGlobalMuon = cms.untracked.bool(False),
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))
phase2_GEM.toModify(gemEfficiencyAnalyzerTightGlb,
etaNbins = 15,
etaUp = 3.0,
monitorGE21 = True,
monitorGE0 = True,
)

phase2_GEM.toModify(gemEfficiencyAnalyzerSta,
etaNbins = 15,
etaUp = 3.0,
monitorGE21 = True,
monitorGE0 = True,
)

gemEfficiencyAnalyzerTightGlbSeq = cms.Sequence(
cms.ignore(gemOfflineDQMTightGlbMuons) *
Expand Down
4 changes: 2 additions & 2 deletions DQMOffline/Muon/python/gemEfficiencyHarvesterCosmics_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from DQMOffline.Muon.gemEfficiencyAnalyzerCosmics_cfi import gemEfficiencyAnalyzerCosmicsOneLeg as _gemEfficiencyAnalyzerCosmicsOneLeg

gemEfficiencyHarvesterCosmics = _gemEfficiencyHarvesterDefault.clone(
folder = cms.untracked.string(_gemEfficiencyAnalyzerCosmics.folder.value()),
folder = _gemEfficiencyAnalyzerCosmics.folder.value(),
)

gemEfficiencyHarvesterCosmicsOneLeg = _gemEfficiencyHarvesterDefault.clone(
folder = cms.untracked.string(_gemEfficiencyAnalyzerCosmicsOneLeg.folder.value()),
folder = _gemEfficiencyAnalyzerCosmicsOneLeg.folder.value(),
)
4 changes: 2 additions & 2 deletions DQMOffline/Muon/python/gemEfficiencyHarvester_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from DQMOffline.Muon.gemEfficiencyAnalyzer_cfi import gemEfficiencyAnalyzerSta as _gemEfficiencyAnalyzerSta

gemEfficiencyHarvesterTightGlb = _gemEfficiencyHarvesterDefault.clone(
folder = cms.untracked.string(_gemEfficiencyAnalyzerTightGlb.folder.value())
folder = _gemEfficiencyAnalyzerTightGlb.folder.value()
)

gemEfficiencyHarvesterSta = _gemEfficiencyHarvesterDefault.clone(
folder = cms.untracked.string(_gemEfficiencyAnalyzerSta.folder.value())
folder = _gemEfficiencyAnalyzerSta.folder.value()
)
71 changes: 66 additions & 5 deletions DQMOffline/Muon/src/GEMEfficiencyAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ GEMEfficiencyAnalyzer::GEMEfficiencyAnalyzer(const edm::ParameterSet& pset)
eta_nbins_ = pset.getUntrackedParameter<int>("etaNbins");
eta_low_ = pset.getUntrackedParameter<double>("etaLow");
eta_up_ = pset.getUntrackedParameter<double>("etaUp");
monitor_ge11_ = pset.getUntrackedParameter<bool>("monitorGE11");
monitor_ge21_ = pset.getUntrackedParameter<bool>("monitorGE21");
monitor_ge0_ = pset.getUntrackedParameter<bool>("monitorGE0");

const edm::ParameterSet&& muon_service_parameter = pset.getParameter<edm::ParameterSet>("ServiceParameters");
muon_service_ = new MuonServiceProxy(muon_service_parameter, consumesCollector());
Expand Down Expand Up @@ -70,6 +73,9 @@ void GEMEfficiencyAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& des
desc.addUntracked<int>("etaNbins", 9);
desc.addUntracked<double>("etaLow", 1.4);
desc.addUntracked<double>("etaUp", 2.3);
desc.addUntracked<bool>("monitorGE11", true);
desc.addUntracked<bool>("monitorGE21", false);
desc.addUntracked<bool>("monitorGE0", false);
{
edm::ParameterSetDescription psd0;
psd0.setAllowAnything();
Expand Down Expand Up @@ -98,6 +104,9 @@ void GEMEfficiencyAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& des
desc.addUntracked<int>("etaNbins", 9);
desc.addUntracked<double>("etaLow", 1.4);
desc.addUntracked<double>("etaUp", 2.3);
desc.addUntracked<bool>("monitorGE11", true);
desc.addUntracked<bool>("monitorGE21", false);
desc.addUntracked<bool>("monitorGE0", false);
{
edm::ParameterSetDescription psd0;
psd0.setAllowAnything();
Expand Down Expand Up @@ -152,6 +161,10 @@ void GEMEfficiencyAnalyzer::bookEfficiencyMomentum(DQMStore::IBooker& ibooker, c
const int region_id = station->region();
const int station_id = station->station();

if (skipGEMStation(station_id)) {
continue;
}

const GEMDetId&& key = getReStKey(region_id, station_id);
const TString&& name_suffix = GEMUtils::getSuffixName(region_id, station_id);
const TString&& title_suffix = GEMUtils::getSuffixTitle(region_id, station_id);
Expand Down Expand Up @@ -181,6 +194,10 @@ void GEMEfficiencyAnalyzer::bookEfficiencyChamber(DQMStore::IBooker& ibooker, co
const int region_id = station->region();
const int station_id = station->station();

if (skipGEMStation(station_id)) {
continue;
}

const std::vector<const GEMSuperChamber*>&& superchambers = station->superChambers();
if (not checkRefs(superchambers)) {
edm::LogError(kLogCategory_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
Expand Down Expand Up @@ -217,6 +234,10 @@ void GEMEfficiencyAnalyzer::bookEfficiencyEtaPartition(DQMStore::IBooker& ibooke
const int region_id = station->region();
const int station_id = station->station();

if (skipGEMStation(station_id)) {
continue;
}

const std::vector<const GEMSuperChamber*>&& superchambers = station->superChambers();
if (not checkRefs(superchambers)) {
edm::LogError(kLogCategory_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
Expand Down Expand Up @@ -251,6 +272,10 @@ void GEMEfficiencyAnalyzer::bookEfficiencyDetector(DQMStore::IBooker& ibooker, c
const int region_id = station->region();
const int station_id = station->station();

if (skipGEMStation(station_id)) {
continue;
}

const std::vector<const GEMSuperChamber*>&& superchambers = station->superChambers();
if (not checkRefs(superchambers)) {
edm::LogError(kLogCategory_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
Expand Down Expand Up @@ -288,6 +313,10 @@ void GEMEfficiencyAnalyzer::bookResolution(DQMStore::IBooker& ibooker, const edm
const int region_id = station->region();
const int station_id = station->station();

if (skipGEMStation(station_id)) {
continue;
}

const std::vector<const GEMSuperChamber*>&& superchambers = station->superChambers();
if (not checkRefs(superchambers)) {
edm::LogError(kLogCategory_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
Expand Down Expand Up @@ -333,6 +362,10 @@ void GEMEfficiencyAnalyzer::bookMisc(DQMStore::IBooker& ibooker, const edm::ESHa
const int region_id = station->region();
const int station_id = station->station();

if (skipGEMStation(station_id)) {
continue;
}

const std::vector<const GEMSuperChamber*>&& superchambers = station->superChambers();
if (not checkRefs(superchambers)) {
edm::LogError(kLogCategory_) << "failed to get a valid vector of GEMSuperChamber ptrs" << std::endl;
Expand Down Expand Up @@ -397,11 +430,6 @@ void GEMEfficiencyAnalyzer::analyze(const edm::Event& event, const edm::EventSet
return;
}

if (rechit_collection->size() < 1) {
edm::LogInfo(kLogCategory_) << "empty rechit collection" << std::endl;
return;
}

if (muon_view->empty()) {
edm::LogInfo(kLogCategory_) << "empty muon collection" << std::endl;
return;
Expand Down Expand Up @@ -537,6 +565,35 @@ void GEMEfficiencyAnalyzer::analyze(const edm::Event& event, const edm::EventSet
} // Muon
}

bool GEMEfficiencyAnalyzer::skipGEMStation(const int station) {
bool skip = false;

if (station == 1) {
if (not monitor_ge11_) {
LogDebug(kLogCategory_) << "skip GE11 because monitorGE11 is " << std::boolalpha << monitor_ge11_;
skip = true;
}

} else if (station == 2) {
if (not monitor_ge21_) {
LogDebug(kLogCategory_) << "skip GE21 because monitorGE21 is " << std::boolalpha << monitor_ge21_;
skip = true;
}

} else if (station == 0) {
if (not monitor_ge0_) {
LogDebug(kLogCategory_) << "skip GE0 because monitorGE0 is " << std::boolalpha << monitor_ge0_;
skip = true;
}

} else {
edm::LogError(kLogCategory_) << "got an unexpected GEM station " << station << ". skip this station.";
skip = true;
}

return skip;
}

std::vector<GEMEfficiencyAnalyzer::GEMLayerData> GEMEfficiencyAnalyzer::buildGEMLayers(
const edm::ESHandle<GEMGeometry>& gem) {
std::vector<GEMLayerData> layer_vector;
Expand All @@ -546,6 +603,10 @@ std::vector<GEMEfficiencyAnalyzer::GEMLayerData> GEMEfficiencyAnalyzer::buildGEM
const int station_id = station->station();
const bool is_ge11 = station_id == 1;

if (skipGEMStation(station_id)) {
continue;
}

// (layer_id, is_odd) - chambers
std::map<std::pair<int, bool>, std::vector<const GEMChamber*> > chambers_per_layer;

Expand Down

0 comments on commit 3662f17

Please sign in to comment.