Skip to content

Commit

Permalink
Merge pull request #23493 from kreczko/kreczko-issue-CMSLITDPG-588-part4
Browse files Browse the repository at this point in the history
[L1T][DQMOffline] Minor adjustments to Jets & energy sums plots
  • Loading branch information
cmsbuild committed Jun 20, 2018
2 parents e0bee14 + 14e050d commit ff78b6a
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 113 deletions.
15 changes: 15 additions & 0 deletions DQMOffline/L1Trigger/python/L1TCommon.py
@@ -0,0 +1,15 @@
def generateEfficiencyStrings(variables, plots):
stringTemplate = "{plot} " + \
"'{var} efficiency; Offline E_{{T}}^{{miss}} (GeV); {var} efficiency'" + \
" {num_path} {den_path}"
for variable, thresholds in variables.iteritems():
for plot in plots[variable]:
for threshold in thresholds:
plotName = '{0}_threshold_{1}'.format(plot, threshold)
varName = plot.replace('efficiency', '')
yield stringTemplate.format(
var=varName,
plot=plotName,
num_path='efficiency_raw/' + plotName + '_Num',
den_path='efficiency_raw/' + plotName + '_Den',
)
65 changes: 18 additions & 47 deletions DQMOffline/L1Trigger/python/L1TEtSumEfficiency_cfi.py
Expand Up @@ -15,58 +15,29 @@
'htt': ['efficiencyHTT'],
}

allEfficiencyPlots = []
add_plot = allEfficiencyPlots.append
for variable, thresholds in variables.iteritems():
for plot in plots[variable]:
for threshold in thresholds:
plotName = '{0}_threshold_{1}'.format(plot, threshold)
add_plot(plotName)

from DQMOffline.L1Trigger.L1TEfficiencyHarvesting_cfi import l1tEfficiencyHarvesting
l1tEtSumEfficiency = l1tEfficiencyHarvesting.clone(
plotCfgs=cms.untracked.VPSet(
cms.untracked.PSet(
numeratorDir=cms.untracked.string("L1T/L1TObjects/L1TEtSum/L1TriggerVsReco/efficiency_raw"),
outputDir=cms.untracked.string("L1T/L1TObjects/L1TEtSum/L1TriggerVsReco"),
numeratorSuffix=cms.untracked.string("_Num"),
denominatorSuffix=cms.untracked.string("_Den"),
plots=cms.untracked.vstring(allEfficiencyPlots)
),
)
from DQMOffline.L1Trigger.L1TCommon import generateEfficiencyStrings

efficiencyStrings = list(generateEfficiencyStrings(variables, plots))

from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
l1tEtSumEfficiency = DQMEDHarvester(
"DQMGenericClient",
commands=cms.vstring(),
resolution=cms.vstring(),
subDirs=cms.untracked.vstring('L1T/L1TObjects/L1TEtSum/L1TriggerVsReco'),
efficiency=cms.vstring(),
efficiencyProfile=cms.untracked.vstring(efficiencyStrings),
)

l1tEtSumEmuEfficiency = l1tEfficiencyHarvesting.clone(
plotCfgs=cms.untracked.VPSet(
cms.untracked.PSet(
numeratorDir=cms.untracked.string("L1TEMU/L1TObjects/L1TEtSum/L1TriggerVsReco/efficiency_raw"),
outputDir=cms.untracked.string("L1TEMU/L1TObjects/L1TEtSum/L1TriggerVsReco"),
numeratorSuffix=cms.untracked.string("_Num"),
denominatorSuffix=cms.untracked.string("_Den"),
plots=cms.untracked.vstring(allEfficiencyPlots)
),
)
l1tEtSumEmuEfficiency = l1tEtSumEfficiency.clone(
subDirs=cms.untracked.vstring(
'L1TEMU/L1TObjects/L1TEtSum/L1TriggerVsReco'),
)

# modifications for the pp reference run
variables_HI = variables

allEfficiencyPlots_HI = []
add_plot = allEfficiencyPlots_HI.append
for variable, thresholds in variables_HI.iteritems():
for plot in plots[variable]:
for threshold in thresholds:
plotName = '{0}_threshold_{1}'.format(plot, threshold)
add_plot(plotName)
efficiencyStrings_HI = list(generateEfficiencyStrings(variables_HI, plots))

from Configuration.Eras.Modifier_ppRef_2017_cff import ppRef_2017
ppRef_2017.toModify(l1tEtSumEfficiency,
plotCfgs = {
0:dict(plots = allEfficiencyPlots_HI),
}
)
ppRef_2017.toModify(l1tEtSumEmuEfficiency,
plotCfgs = {
0:dict(plots = allEfficiencyPlots_HI),
}
)
ppRef_2017.toModify(l1tEtSumEfficiency, efficiencyProfile=efficiencyStrings_HI)
ppRef_2017.toModify(l1tEtSumEmuEfficiency, efficiencyProfile=efficiencyStrings_HI)
63 changes: 17 additions & 46 deletions DQMOffline/L1Trigger/python/L1TJetEfficiency_cfi.py
Expand Up @@ -11,59 +11,30 @@
"efficiencyJetEt_HB_HE"],
}

allEfficiencyPlots = []
add_plot = allEfficiencyPlots.append
for variable, thresholds in variables.iteritems():
for plot in plots[variable]:
for threshold in thresholds:
plotName = '{0}_threshold_{1}'.format(plot, threshold)
add_plot(plotName)

from DQMOffline.L1Trigger.L1TEfficiencyHarvesting_cfi import l1tEfficiencyHarvesting
l1tJetEfficiency = l1tEfficiencyHarvesting.clone(
plotCfgs=cms.untracked.VPSet(
cms.untracked.PSet(
numeratorDir=cms.untracked.string("L1T/L1TObjects/L1TJet/L1TriggerVsReco/efficiency_raw"),
outputDir=cms.untracked.string("L1T/L1TObjects/L1TJet/L1TriggerVsReco"),
numeratorSuffix=cms.untracked.string("_Num"),
denominatorSuffix=cms.untracked.string("_Den"),
plots=cms.untracked.vstring(allEfficiencyPlots)
),
)
from DQMOffline.L1Trigger.L1TCommon import generateEfficiencyStrings
efficiencyStrings = list(generateEfficiencyStrings(variables, plots))

from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
l1tJetEfficiency = DQMEDHarvester(
"DQMGenericClient",
commands=cms.vstring(),
resolution=cms.vstring(),
subDirs=cms.untracked.vstring('L1T/L1TObjects/L1TJet/L1TriggerVsReco'),
efficiency=cms.vstring(),
efficiencyProfile=cms.untracked.vstring(efficiencyStrings),
)

l1tJetEmuEfficiency = l1tEfficiencyHarvesting.clone(
plotCfgs=cms.untracked.VPSet(
cms.untracked.PSet(
numeratorDir=cms.untracked.string("L1TEMU/L1TObjects/L1TJet/L1TriggerVsReco/efficiency_raw"),
outputDir=cms.untracked.string("L1TEMU/L1TObjects/L1TJet/L1TriggerVsReco"),
numeratorSuffix=cms.untracked.string("_Num"),
denominatorSuffix=cms.untracked.string("_Den"),
plots=cms.untracked.vstring(allEfficiencyPlots)
),
)
l1tJetEmuEfficiency = l1tJetEfficiency.clone(
subDirs=cms.untracked.vstring(
'L1TEMU/L1TObjects/L1TJet/L1TriggerVsReco'),
)

# modifications for the pp reference run
variables_HI = variables
variables_HI['jet'] = L1TStep1.jetEfficiencyThresholds_HI

allEfficiencyPlots_HI = []
add_plot = allEfficiencyPlots_HI.append
for variable, thresholds in variables_HI.iteritems():
for plot in plots[variable]:
for threshold in thresholds:
plotName = '{0}_threshold_{1}'.format(plot, threshold)
add_plot(plotName)
efficiencyStrings_HI = list(generateEfficiencyStrings(variables_HI, plots))

from Configuration.Eras.Modifier_ppRef_2017_cff import ppRef_2017
ppRef_2017.toModify(l1tJetEfficiency,
plotCfgs = {
0:dict(plots = allEfficiencyPlots_HI),
}
)
ppRef_2017.toModify(l1tJetEmuEfficiency,
plotCfgs = {
0:dict(plots = allEfficiencyPlots_HI),
}
)
ppRef_2017.toModify(l1tJetEfficiency, efficiencyProfile=efficiencyStrings_HI)
ppRef_2017.toModify(l1tJetEmuEfficiency, efficiencyProfile=efficiencyStrings_HI)
34 changes: 32 additions & 2 deletions DQMOffline/L1Trigger/src/L1TDiffHarvesting.cc
Expand Up @@ -46,16 +46,29 @@ void L1TDiffHarvesting::L1TDiffPlotHandler::computeDiff(DQMStore::IBooker &ibook
TH1* h1;
TH1* h2;
bool is1D(histType1_ == MonitorElement::DQM_KIND_TH1F || histType1_ == MonitorElement::DQM_KIND_TH1D);
bool is2D(histType1_ == MonitorElement::DQM_KIND_TH2F || histType1_ == MonitorElement::DQM_KIND_TH2D);
bool isProfile(histType1_ == MonitorElement::DQM_KIND_TPROFILE);

if (is1D) {
h_diff = h_diff_->getTH1F();
h1 = h1_->getTH1F();
h2 = h2_->getTH1F();
} else { // TH2
} else if (is2D) {
h_diff = h_diff_->getTH2F();
h1 = h1_->getTH2F();
h2 = h2_->getTH2F();
}
else if (isProfile){
h_diff = h_diff_->getTProfile();
h1 = h1_->getTProfile();
h2 = h2_->getTProfile();
} else {
edm::LogWarning("L1TDiffHarvesting::L1TDiffPlotHandler::computeDiff")
<< "Unknown histogram type. Quitting booking"
<< std::endl;

return;
}
h_diff->Add(h1);
h_diff->Add(h2, -1);
// if histograms are identical h_diff will have 0 entries -> not good to check if anything happened
Expand Down Expand Up @@ -103,13 +116,16 @@ void L1TDiffHarvesting::L1TDiffPlotHandler::bookDiff(DQMStore::IBooker &ibooker)
ibooker.setCurrentFolder(outputDir_);

bool is1D(histType1_ == MonitorElement::DQM_KIND_TH1F || histType1_ == MonitorElement::DQM_KIND_TH1D);
bool is2D(histType1_ == MonitorElement::DQM_KIND_TH2F || histType1_ == MonitorElement::DQM_KIND_TH2D);
bool isProfile(histType1_ == MonitorElement::DQM_KIND_TPROFILE);

if (is1D) {
TH1F* h1 = h1_->getTH1F();
double min = h1->GetXaxis()->GetXmin();
double max = h1->GetXaxis()->GetXmax();
int nBins = h1->GetNbinsX();
h_diff_ = ibooker.book1D(plotName_, plotName_, nBins, min, max);
} else { // TH2
} else if (is2D) {
TH2F* h1 = h1_->getTH2F();
double minX = h1->GetXaxis()->GetXmin();
double maxX = h1->GetXaxis()->GetXmax();
Expand All @@ -119,6 +135,20 @@ void L1TDiffHarvesting::L1TDiffPlotHandler::bookDiff(DQMStore::IBooker &ibooker)
int nBinsY = h1->GetNbinsY();

h_diff_ = ibooker.book2D(plotName_, plotName_, nBinsX, minX, maxX, nBinsY, minY, maxY);
} else if (isProfile) {
TProfile* h1 = h1_->getTProfile();
double minX = h1->GetXaxis()->GetXmin();
double maxX = h1->GetXaxis()->GetXmax();
double minY = h1->GetYaxis()->GetXmin();
double maxY = h1->GetYaxis()->GetXmax();
int nBins = h1->GetNbinsX();
h_diff_ = ibooker.bookProfile(plotName_, plotName_, nBins, minX, maxX, minY, maxY);
} else {
edm::LogWarning("L1TDiffHarvesting::L1TDiffPlotHandler::bookDiff")
<< "Unknown histogram type. Quitting booking"
<< std::endl;

return;
}

}
Expand Down
40 changes: 22 additions & 18 deletions DQMOffline/L1Trigger/src/L1TStage2CaloLayer2Offline.cc
Expand Up @@ -297,7 +297,12 @@ void L1TStage2CaloLayer2Offline::fillEnergySums(edm::Event const& e, const unsig
fillWithinLimits(h_resolutionPFMetNoMu_, resolutionPFMetNoMu);
fillWithinLimits(h_resolutionMHT_, resolutionMHT);
fillWithinLimits(h_resolutionETT_, resolutionETT);
fillWithinLimits(h_resolutionHTT_, resolutionHTT);
if (resolutionMHT < outOfBounds){
fillWithinLimits(h_resolutionMHT_, resolutionMHT);
}
if(resolutionHTT < outOfBounds){
fillWithinLimits(h_resolutionHTT_, resolutionHTT);
}

fillWithinLimits(h_resolutionMETPhi_, resolutionMETPhi);
fillWithinLimits(h_resolutionETMHFPhi_, resolutionETMHFPhi);
Expand Down Expand Up @@ -375,6 +380,7 @@ void L1TStage2CaloLayer2Offline::fillJets(edm::Event const& e, const unsigned in
minDeltaR = currentDeltaR;
closestL1Jet = *jet;
foundMatch = true;
break;
}

}
Expand Down Expand Up @@ -575,26 +581,24 @@ void L1TStage2CaloLayer2Offline::bookEnergySumHistos(DQMStore::IBooker & ibooker

// energy sum resolutions
h_resolutionMET_ = ibooker.book1D("resolutionMET",
"MET resolution; (L1 E_{T}^{miss} - Offline E_{T}^{miss})/Offline E_{T}^{miss}; events", 50, -1, 1.5);
"MET resolution; (L1 E_{T}^{miss} - Offline E_{T}^{miss})/Offline E_{T}^{miss}; events", 70, -1.0, 2.5);
h_resolutionETMHF_ = ibooker.book1D("resolutionETMHF",
"MET resolution (HF); (L1 E_{T}^{miss} - Offline E_{T}^{miss})/Offline E_{T}^{miss} (HF); events", 50, -1, 1.5);
"MET resolution (HF); (L1 E_{T}^{miss} - Offline E_{T}^{miss})/Offline E_{T}^{miss} (HF); events", 70, -1.0, 2.5);
h_resolutionPFMetNoMu_ = ibooker.book1D("resolutionPFMetNoMu",
"PFMetNoMu resolution; (L1 E_{T}^{miss} - Offline E_{T}^{miss})/Offline E_{T}^{miss} (PFMetNoMu); events", 50, -1, 1.5);
h_resolutionMHT_ = ibooker.book1D("resolutionMHT", "MHT resolution; (L1 MHT - reco MHT)/reco MHT; events", 50, -1,
1.5);
h_resolutionETT_ = ibooker.book1D("resolutionETT", "ETT resolution; (L1 ETT - calo ETT)/calo ETT; events", 50, -1,
1.5);
"PFMetNoMu resolution; (L1 E_{T}^{miss} - Offline E_{T}^{miss})/Offline E_{T}^{miss} (PFMetNoMu); events", 70, -1.0, 2.5);
h_resolutionMHT_ = ibooker.book1D("resolutionMHT", "MHT resolution; (L1 MHT - reco MHT)/reco MHT; events", 70, -1.0, 2.5);
h_resolutionETT_ = ibooker.book1D("resolutionETT", "ETT resolution; (L1 ETT - calo ETT)/calo ETT; events", 70, -1.0, 2.5);
h_resolutionHTT_ = ibooker.book1D("resolutionHTT",
"HTT resolution; (L1 Total H_{T} - Offline Total H_{T})/Offline Total H_{T}; events", 50, -1, 1.5);
"HTT resolution; (L1 Total H_{T} - Offline Total H_{T})/Offline Total H_{T}; events", 70, -1.0, 2.5);

h_resolutionMETPhi_ = ibooker.book1D("resolutionMETPhi",
"MET #phi resolution; (L1 E_{T}^{miss} #phi - reco MET #phi)/reco MET #phi; events", 120, -0.3, 0.3);
"MET #phi resolution; (L1 E_{T}^{miss} #phi - reco MET #phi); events", 200, -1, 1);
h_resolutionETMHFPhi_ = ibooker.book1D("resolutionETMHFPhi",
"MET #phi resolution (HF); (L1 E_{T}^{miss} #phi - reco MET #phi)/reco MET #phi (HF); events", 120, -0.3, 0.3);
"MET #phi resolution (HF); (L1 E_{T}^{miss} #phi - reco MET #phi) (HF); events", 200, -1, 1);
h_resolutionPFMetNoMuPhi_ = ibooker.book1D("resolutionPFMetNoMuPhi",
"MET #phi resolution (PFMetNoMu); (L1 E_{T}^{miss} #phi - reco MET #phi)/reco MET #phi (PFMetNoMu); events", 120, -0.3, 0.3);
"MET #phi resolution (PFMetNoMu); (L1 E_{T}^{miss} #phi - reco MET #phi) (PFMetNoMu); events", 200, -1, 1);
h_resolutionMHTPhi_ = ibooker.book1D("resolutionMHTPhi",
"MET #phi resolution; (L1 MHT #phi - reco MHT #phi)/reco MHT #phi; events", 120, -0.3, 0.3);
"MET #phi resolution; (L1 MHT #phi - reco MHT #phi); events", 200, -1, 1);

// energy sum turn ons
ibooker.setCurrentFolder(efficiencyFolderEtSum_);
Expand Down Expand Up @@ -704,20 +708,20 @@ void L1TStage2CaloLayer2Offline::bookJetHistos(DQMStore::IBooker & ibooker)
"jet ET resolution (HB+HE); (L1 Jet E_{T} - Offline Jet E_{T})/Offline Jet E_{T}; events", 50, -1, 1.5);

h_resolutionJetPhi_HB_ = ibooker.book1D("resolutionJetPhi_HB",
"#phi_{jet} resolution (HB); (#phi_{jet}^{L1} - #phi_{jet}^{offline})/#phi_{jet}^{offline}; events", 120, -0.3,
"#phi_{jet} resolution (HB); (#phi_{jet}^{L1} - #phi_{jet}^{offline}); events", 120, -0.3,
0.3);
h_resolutionJetPhi_HE_ = ibooker.book1D("resolutionJetPhi_HE",
"jet #phi resolution (HE); (#phi_{jet}^{L1} - #phi_{jet}^{offline})/#phi_{jet}^{offline}; events", 120, -0.3,
"jet #phi resolution (HE); (#phi_{jet}^{L1} - #phi_{jet}^{offline}); events", 120, -0.3,
0.3);
h_resolutionJetPhi_HF_ = ibooker.book1D("resolutionJetPhi_HF",
"jet #phi resolution (HF); (#phi_{jet}^{L1} - #phi_{jet}^{offline})/#phi_{jet}^{offline}; events", 120, -0.3,
"jet #phi resolution (HF); (#phi_{jet}^{L1} - #phi_{jet}^{offline}); events", 120, -0.3,
0.3);
h_resolutionJetPhi_HB_HE_ = ibooker.book1D("resolutionJetPhi_HB_HE",
"jet #phi resolution (HB+HE); (#phi_{jet}^{L1} - #phi_{jet}^{offline})/#phi_{jet}^{offline}; events", 120, -0.3,
"jet #phi resolution (HB+HE); (#phi_{jet}^{L1} - #phi_{jet}^{offline}); events", 120, -0.3,
0.3);

h_resolutionJetEta_ = ibooker.book1D("resolutionJetEta",
"jet #eta resolution (HB); (L1 Jet #eta - Offline Jet #eta)/Offline Jet #eta; events", 120, -0.3, 0.3);
"jet #eta resolution (HB); (L1 Jet #eta - Offline Jet #eta); events", 120, -0.3, 0.3);

// jet turn-ons
ibooker.setCurrentFolder(efficiencyFolderJet_);
Expand Down
Expand Up @@ -32,6 +32,8 @@
# L1T
process.load('DQMOffline.L1Trigger.L1TEtSumEfficiency_cfi')
process.load('DQMOffline.L1Trigger.L1TEtSumDiff_cfi')
process.load('DQMOffline.L1Trigger.L1TJetEfficiency_cfi')
process.load('DQMOffline.L1Trigger.L1TJetDiff_cfi')
process.load('DQMOffline.L1Trigger.L1TEGammaEfficiency_cfi')
process.load('DQMOffline.L1Trigger.L1TEGammaDiff_cfi')
process.load('DQMOffline.L1Trigger.L1TTauEfficiency_cfi')
Expand Down Expand Up @@ -61,6 +63,9 @@
process.l1tEtSumEfficiency *
process.l1tEtSumEmuEfficiency *
process.l1tEtSumEmuDiff +
process.l1tJetEfficiency *
process.l1tJetEmuEfficiency *
process.l1tJetEmuDiff +
process.l1tEGammaEfficiency *
process.l1tEGammaEmuEfficiency *
process.l1tEGammaEmuDiff +
Expand Down

0 comments on commit ff78b6a

Please sign in to comment.