-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18099 from kreczko/l1tEgammaDQM-91X
[91X] Offline DQM modules for L1 Trigger, Stage 2 CaloLayer2 (Electrons + Photons)
- Loading branch information
Showing
11 changed files
with
1,011 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
#ifndef L1TEGammaOffline_H | ||
#define L1TEGammaOffline_H | ||
|
||
//Framework | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "FWCore/Utilities/interface/InputTag.h" | ||
#include "FWCore/ServiceRegistry/interface/Service.h" | ||
|
||
//event | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
|
||
//DQM | ||
#include "DQMServices/Core/interface/DQMEDAnalyzer.h" | ||
#include "DQMServices/Core/interface/DQMStore.h" | ||
#include "DQMServices/Core/interface/MonitorElement.h" | ||
|
||
//Candidate handling | ||
#include "DataFormats/Candidate/interface/Candidate.h" | ||
|
||
// Electron & photon collections | ||
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h" | ||
#include "DataFormats/EgammaCandidates/interface/Photon.h" | ||
|
||
// Vertex utilities | ||
#include "DataFormats/VertexReco/interface/Vertex.h" | ||
#include "DataFormats/VertexReco/interface/VertexFwd.h" | ||
|
||
// Trigger | ||
#include "DataFormats/Common/interface/TriggerResults.h" | ||
#include "DataFormats/HLTReco/interface/TriggerObject.h" | ||
#include "DataFormats/HLTReco/interface/TriggerEvent.h" | ||
|
||
// stage2 collections: | ||
#include "DataFormats/L1Trigger/interface/EGamma.h" | ||
|
||
class L1TEGammaOffline: public DQMEDAnalyzer { | ||
|
||
public: | ||
|
||
L1TEGammaOffline(const edm::ParameterSet& ps); | ||
virtual ~L1TEGammaOffline(); | ||
|
||
protected: | ||
|
||
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override; | ||
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; | ||
void analyze(edm::Event const& e, edm::EventSetup const& eSetup); | ||
void beginLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& eSetup); | ||
void endLuminosityBlock(edm::LuminosityBlock const& lumi, edm::EventSetup const& eSetup); | ||
void endRun(edm::Run const& run, edm::EventSetup const& eSetup); | ||
|
||
private: | ||
bool passesLooseEleId(reco::GsfElectron const& electron) const; | ||
bool passesMediumEleId(reco::GsfElectron const& electron) const; | ||
void bookElectronHistos(DQMStore::IBooker &); | ||
void bookPhotonHistos(DQMStore::IBooker &); | ||
|
||
//other functions | ||
double Distance(const reco::Candidate & c1, const reco::Candidate & c2); | ||
double DistancePhi(const reco::Candidate & c1, const reco::Candidate & c2); | ||
double calcDeltaPhi(double phi1, double phi2); | ||
|
||
void fillElectrons(edm::Event const& e, const unsigned int nVertex); | ||
void fillPhotons(edm::Event const& e, const unsigned int nVertex); | ||
bool findTagAndProbePair(edm::Handle<reco::GsfElectronCollection> const& electrons); | ||
|
||
math::XYZPoint PVPoint_; | ||
|
||
//variables from config file | ||
edm::EDGetTokenT<reco::GsfElectronCollection> theGsfElectronCollection_; | ||
edm::EDGetTokenT<std::vector<reco::Photon> > thePhotonCollection_; | ||
edm::EDGetTokenT<reco::VertexCollection> thePVCollection_; | ||
edm::EDGetTokenT<reco::BeamSpot> theBSCollection_; | ||
edm::EDGetTokenT<trigger::TriggerEvent> triggerEvent_; | ||
edm::EDGetTokenT<edm::TriggerResults> triggerResults_; | ||
edm::InputTag triggerFilter_; | ||
std::string triggerPath_; | ||
std::string histFolder_; | ||
std::string efficiencyFolder_; | ||
|
||
edm::EDGetTokenT<l1t::EGammaBxCollection> stage2CaloLayer2EGammaToken_; | ||
|
||
std::vector<double> electronEfficiencyThresholds_; | ||
std::vector<double> electronEfficiencyBins_; | ||
|
||
std::vector<double> photonEfficiencyThresholds_; | ||
std::vector<double> photonEfficiencyBins_; | ||
|
||
reco::GsfElectron tagElectron_; | ||
reco::GsfElectron probeElectron_; | ||
double tagAndProbleInvariantMass_; | ||
|
||
// TODO: add turn-on cuts (vectors of doubles) | ||
// Histograms | ||
MonitorElement* h_nVertex_; | ||
MonitorElement* h_tagAndProbeMass_; | ||
|
||
// electron reco vs L1 | ||
MonitorElement* h_L1EGammaETvsElectronET_EB_; | ||
MonitorElement* h_L1EGammaETvsElectronET_EE_; | ||
MonitorElement* h_L1EGammaETvsElectronET_EB_EE_; | ||
|
||
MonitorElement* h_L1EGammaPhivsElectronPhi_EB_; | ||
MonitorElement* h_L1EGammaPhivsElectronPhi_EE_; | ||
MonitorElement* h_L1EGammaPhivsElectronPhi_EB_EE_; | ||
|
||
MonitorElement* h_L1EGammaEtavsElectronEta_; | ||
|
||
// electron resolutions | ||
MonitorElement* h_resolutionElectronET_EB_; | ||
MonitorElement* h_resolutionElectronET_EE_; | ||
MonitorElement* h_resolutionElectronET_EB_EE_; | ||
|
||
MonitorElement* h_resolutionElectronPhi_EB_; | ||
MonitorElement* h_resolutionElectronPhi_EE_; | ||
MonitorElement* h_resolutionElectronPhi_EB_EE_; | ||
|
||
MonitorElement* h_resolutionElectronEta_; | ||
|
||
// electron turn-ons | ||
std::map<double, MonitorElement*> h_efficiencyElectronET_EB_pass_; | ||
std::map<double, MonitorElement*> h_efficiencyElectronET_EE_pass_; | ||
std::map<double, MonitorElement*> h_efficiencyElectronET_EB_EE_pass_; | ||
|
||
// we could drop the map here, but L1TEfficiency_Harvesting expects | ||
// identical names except for the suffix | ||
std::map<double, MonitorElement*> h_efficiencyElectronET_EB_total_; | ||
std::map<double, MonitorElement*> h_efficiencyElectronET_EE_total_; | ||
std::map<double, MonitorElement*> h_efficiencyElectronET_EB_EE_total_; | ||
|
||
// photons | ||
MonitorElement* h_L1EGammaETvsPhotonET_EB_; | ||
MonitorElement* h_L1EGammaETvsPhotonET_EE_; | ||
MonitorElement* h_L1EGammaETvsPhotonET_EB_EE_; | ||
|
||
MonitorElement* h_L1EGammaPhivsPhotonPhi_EB_; | ||
MonitorElement* h_L1EGammaPhivsPhotonPhi_EE_; | ||
MonitorElement* h_L1EGammaPhivsPhotonPhi_EB_EE_; | ||
|
||
MonitorElement* h_L1EGammaEtavsPhotonEta_; | ||
|
||
// electron resolutions | ||
MonitorElement* h_resolutionPhotonET_EB_; | ||
MonitorElement* h_resolutionPhotonET_EE_; | ||
MonitorElement* h_resolutionPhotonET_EB_EE_; | ||
|
||
MonitorElement* h_resolutionPhotonPhi_EB_; | ||
MonitorElement* h_resolutionPhotonPhi_EE_; | ||
MonitorElement* h_resolutionPhotonPhi_EB_EE_; | ||
|
||
MonitorElement* h_resolutionPhotonEta_; | ||
|
||
// electron turn-ons | ||
std::map<double, MonitorElement*> h_efficiencyPhotonET_EB_pass_; | ||
std::map<double, MonitorElement*> h_efficiencyPhotonET_EE_pass_; | ||
std::map<double, MonitorElement*> h_efficiencyPhotonET_EB_EE_pass_; | ||
|
||
// we could drop the map here, but L1TEfficiency_Harvesting expects | ||
// identical names except for the suffix | ||
std::map<double, MonitorElement*> h_efficiencyPhotonET_EB_total_; | ||
std::map<double, MonitorElement*> h_efficiencyPhotonET_EE_total_; | ||
std::map<double, MonitorElement*> h_efficiencyPhotonET_EB_EE_total_; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from DQMOffline.L1Trigger import L1TEGammaOffline_cfi | ||
|
||
variables = { | ||
'electron': L1TEGammaOffline_cfi.electronEfficiencyThresholds, | ||
} | ||
|
||
plots = { | ||
'electron': [ | ||
"efficiencyElectronET_EB", "efficiencyElectronET_EE", | ||
"efficiencyElectronET_EB_EE" | ||
], | ||
} | ||
|
||
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) | ||
|
||
resolution_plots = [ | ||
"resolutionElectronET_EB", "resolutionElectronET_EE", | ||
"resolutionElectronET_EB_EE", "resolutionElectronPhi_EB", "resolutionElectronPhi_EE", | ||
"resolutionElectronPhi_EB_EE", "resolutionElectronEta", | ||
# | ||
"resolutionPhotonET_EB", "resolutionPhotonET_EE", | ||
"resolutionPhotonET_EB_EE", "resolutionPhotonPhi_EB", "resolutionPhotonPhi_EE", | ||
"resolutionPhotonPhi_EB_EE", "resolutionPhotonEta", | ||
] | ||
plots2D = [ | ||
'L1EGammaETvsElectronET_EB', 'L1EGammaETvsElectronET_EE', 'L1EGammaETvsElectronET_EB_EE', | ||
'L1EGammaPhivsElectronPhi_EB', 'L1EGammaPhivsElectronPhi_EE', 'L1EGammaPhivsElectronPhi_EB_EE', | ||
'L1EGammaEtavsElectronEta', | ||
# | ||
'L1EGammaETvsPhotonET_EB', 'L1EGammaETvsPhotonET_EE', 'L1EGammaETvsPhotonET_EB_EE', | ||
'L1EGammaPhivsPhotonPhi_EB', 'L1EGammaPhivsPhotonPhi_EE', 'L1EGammaPhivsPhotonPhi_EB_EE', | ||
'L1EGammaEtavsPhotonEta', | ||
] | ||
|
||
allPlots = [] | ||
allPlots.extend(allEfficiencyPlots) | ||
allPlots.extend(resolution_plots) | ||
allPlots.extend(plots2D) | ||
|
||
from DQMOffline.L1Trigger.L1TDiffHarvesting_cfi import l1tDiffHarvesting | ||
l1tEGammaEmuDiff = l1tDiffHarvesting.clone( | ||
plotCfgs=cms.untracked.VPSet( | ||
cms.untracked.PSet( # EMU comparison | ||
dir1=cms.untracked.string("L1T/L1TEGamma"), | ||
dir2=cms.untracked.string("L1TEMU/L1TEGamma"), | ||
outputDir=cms.untracked.string( | ||
"L1TEMU/L1TEGamma/Comparison"), | ||
plots=cms.untracked.vstring(allPlots) | ||
), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from DQMOffline.L1Trigger import L1TEGammaOffline_cfi | ||
|
||
variables = { | ||
'electron': L1TEGammaOffline_cfi.electronEfficiencyThresholds, | ||
'photon': L1TEGammaOffline_cfi.photonEfficiencyThresholds, | ||
} | ||
|
||
plots = { | ||
'electron': [ | ||
"efficiencyElectronET_EB", "efficiencyElectronET_EE", | ||
"efficiencyElectronET_EB_EE" | ||
], | ||
'photon': [ | ||
"efficiencyPhotonET_EB", "efficiencyPhotonET_EE", | ||
"efficiencyPhotonET_EB_EE" | ||
] | ||
} | ||
|
||
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.L1TEfficiencyHarvesting2_cfi import l1tEfficiencyHarvesting | ||
l1tEGammaEfficiency = l1tEfficiencyHarvesting.clone( | ||
plotCfgs=cms.untracked.VPSet( | ||
cms.untracked.PSet( | ||
numeratorDir=cms.untracked.string("L1T/L1TEGamma/efficiency_raw"), | ||
outputDir=cms.untracked.string("L1T/L1TEGamma"), | ||
numeratorSuffix=cms.untracked.string("_Num"), | ||
denominatorSuffix=cms.untracked.string("_Den"), | ||
plots=cms.untracked.vstring(allEfficiencyPlots) | ||
), | ||
cms.untracked.PSet( | ||
numeratorDir=cms.untracked.string( | ||
"L1TEMU/L1TEGamma/efficiency_raw"), | ||
outputDir=cms.untracked.string("L1TEMU/L1TEGamma"), | ||
numeratorSuffix=cms.untracked.string("_Num"), | ||
denominatorSuffix=cms.untracked.string("_Den"), | ||
plots=cms.untracked.vstring(allEfficiencyPlots) | ||
), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
electronEfficiencyThresholds = [36, 68, 128, 176] | ||
|
||
electronEfficiencyBins = [] | ||
electronEfficiencyBins.extend(list(xrange(0, 120, 10))) | ||
electronEfficiencyBins.extend(list(xrange(120, 180, 20))) | ||
electronEfficiencyBins.extend(list(xrange(180, 300, 40))) | ||
electronEfficiencyBins.extend(list(xrange(300, 400, 100))) | ||
|
||
# just copy for now | ||
photonEfficiencyThresholds = electronEfficiencyThresholds | ||
photonEfficiencyBins = electronEfficiencyBins | ||
|
||
l1tEGammaOfflineDQM = cms.EDAnalyzer( | ||
"L1TEGammaOffline", | ||
electronCollection=cms.InputTag("gedGsfElectrons"), | ||
photonCollection=cms.InputTag("photons"), | ||
caloJetCollection=cms.InputTag("ak4CaloJets"), | ||
caloMETCollection=cms.InputTag("caloMet"), | ||
conversionsCollection=cms.InputTag("allConversions"), | ||
PVCollection=cms.InputTag("offlinePrimaryVerticesWithBS"), | ||
beamSpotCollection=cms.InputTag("offlineBeamSpot"), | ||
|
||
TriggerEvent=cms.InputTag('hltTriggerSummaryAOD', '', 'HLT'), | ||
TriggerResults=cms.InputTag('TriggerResults', '', 'HLT'), | ||
# last filter of HLTEle27WP80Sequence | ||
TriggerFilter=cms.InputTag('hltEle27WP80TrackIsoFilter', '', 'HLT'), | ||
TriggerPath=cms.string('HLT_Ele27_WP80_v13'), | ||
|
||
|
||
stage2CaloLayer2EGammaSource=cms.InputTag("caloStage2Digis", "EGamma"), | ||
|
||
histFolder=cms.string('L1T/L1TEGamma'), | ||
|
||
electronEfficiencyThresholds=cms.vdouble(electronEfficiencyThresholds), | ||
electronEfficiencyBins=cms.vdouble(electronEfficiencyBins), | ||
|
||
photonEfficiencyThresholds=cms.vdouble(photonEfficiencyThresholds), | ||
photonEfficiencyBins=cms.vdouble(photonEfficiencyBins), | ||
) | ||
|
||
l1tEGammaOfflineDQMEmu = l1tEGammaOfflineDQM.clone( | ||
stage2CaloLayer2EGammaSource=cms.InputTag("simCaloStage2Digis"), | ||
|
||
histFolder=cms.string('L1TEMU/L1TEGamma'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.