20 : mu_(
muon), gmtmu_(gmtmu) {
100 effTypes_({kEffPt, kEffPhi, kEffEta}),
101 resTypes_({kResPt, kResQOverPt, kResPhi, kResEta}),
102 etaRegions_({kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf}),
103 qualLevels_({kQualOpen, kQualDouble, kQualSingle}),
104 resNames_({{kResPt,
"pt"},
105 {kRes1OverPt,
"1overpt"},
106 {kResQOverPt,
"qoverpt"},
109 {kResCh,
"charge"}}),
110 resLabels_({{kResPt,
"(p_{T}^{L1} - p_{T}^{reco})/p_{T}^{reco}"},
111 {kRes1OverPt,
"(p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
112 {kResQOverPt,
"(q^{L1}*q^{reco}*p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
113 {kResPhi,
"#phi_{L1} - #phi_{reco}"},
114 {kResEta,
"#eta_{L1} - #eta_{reco}"},
115 {kResCh,
"charge^{L1} - charge^{reco}"}}),
116 etaNames_({{kEtaRegionAll,
"etaMin0_etaMax2p4"},
117 {kEtaRegionBmtf,
"etaMin0_etaMax0p83"},
118 {kEtaRegionOmtf,
"etaMin0p83_etaMax1p24"},
119 {kEtaRegionEmtf,
"etaMin1p24_etaMax2p4"}}),
120 qualNames_({{kQualOpen,
"qualOpen"}, {kQualDouble,
"qualDouble"}, {kQualSingle,
"qualSingle"}}),
121 muonNames_({{kSAMuon,
"SAMuon"}, {kTkMuon,
"TkMuon"}}),
122 histFolder_(ps.getUntrackedParameter<
string>(
"histFolder")),
123 cutsVPSet_(ps.getUntrackedParameter<std::vector<edm::ParameterSet>>(
"cuts")),
124 effVsPtBins_(ps.getUntrackedParameter<std::vector<double>>(
"efficiencyVsPtBins")),
125 effVsPhiBins_(ps.getUntrackedParameter<std::vector<double>>(
"efficiencyVsPhiBins")),
126 effVsEtaBins_(ps.getUntrackedParameter<std::vector<double>>(
"efficiencyVsEtaBins")),
127 maxGmtMuonDR_(ps.getUntrackedParameter<
double>(
"maxDR")) {
128 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::L1TPhase2MuonOffline()" << endl;
130 for (
const auto&
c : cutsVPSet_) {
131 const auto qCut =
c.getUntrackedParameter<
int>(
"qualCut");
132 QualLevel qLevel = kQualOpen;
134 qLevel = kQualSingle;
135 }
else if (qCut > 7) {
136 qLevel = kQualDouble;
137 }
else if (qCut > 3) {
140 cuts_.emplace_back(std::make_pair(
c.getUntrackedParameter<
int>(
"ptCut"), qLevel));
146 edm::LogInfo(
"L1TPhase2MuonOFfline") <<
"L1TPhase2MuonOffline::dqmBeginRun" << endl;
153 edm::LogInfo(
"L1TPhase2MuonOFfline") <<
"L1TPhase2MuonOffline::bookHistograms" << endl;
165 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::analyze() " << endl;
170 std::vector<const reco::GenParticle*> genmus;
174 genmus.push_back(&
gen);
176 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::analyze() N of genmus: " << genmus.size() << endl;
183 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"Fill Control histograms for GMT Muons" << endl;
189 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::analyze() calling matchMuonsToGen() " << endl;
195 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::analyze() Computation finished" << endl;
200 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::bookControlHistos()" << endl;
214 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl;
225 ibooker.
book1D(histoname +
"_Pt_Num",
"MuonPt; p_{T} ;", histBins.size() - 1, &histBins[0]);
227 ibooker.
book1D(histoname +
"_Pt_Den",
"MuonPt; p_{T} ;", histBins.size() - 1, &histBins[0]);
231 ibooker.
book1D(histoname +
"_Eta_Num",
"MuonEta; #eta ;", histBins.size() - 1, &histBins[0]);
233 ibooker.
book1D(histoname +
"_Eta_Den",
"MuonEta; #eta ;", histBins.size() - 1, &histBins[0]);
237 ibooker.
book1D(histoname +
"_Phi_Num",
"MuonPhi; #phi ;", histBins.size() - 1, &histBins[0]);
239 ibooker.
book1D(histoname +
"_Phi_Den",
"MuonPhi; #phi ;", histBins.size() - 1, &histBins[0]);
245 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::bookResolutionHistos()" << endl;
288 auto eta = muIt.etaRegion();
290 auto varToFill = muIt.getVar(
var);
292 const auto q =
cut.second;
294 if (muIt.gmtPt() < 0)
296 if (muIt.gmtQual() <
q * 4)
298 const auto gmtPtCut =
cut.first;
299 if (
var !=
kEffPt && muIt.gmtPt() < gmtPtCut)
308 auto eta = muIt.etaRegion();
310 auto varToFill = muIt.getVar(
var);
312 const auto q =
cut.second;
314 if (muIt.gmtPt() < 0)
316 if (muIt.gmtQual() <
q * 4)
318 const auto gmtPtCut =
cut.first;
319 if (
var !=
kEffPt && muIt.gmtPt() < gmtPtCut)
329 if (muIt.gmtPt() < 0)
332 auto eta = muIt.etaRegion();
334 if (muIt.gmtQual() <
q * 4)
337 auto varToFill = muIt.getDeltaVar(
var);
345 if (muIt.gmtPt() < 0)
348 auto eta = muIt.etaRegion();
350 if (muIt.gmtQual() <
q * 4)
353 auto varToFill = muIt.getDeltaVar(
var);
366 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::matchMuonsToGen() " << endl;
369 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"Looping on genmus: " <<
gen << endl;
374 float dr2Tmp = pairTmpCand.
dR2();
375 if (dr2Tmp < dr2Best) {
377 pairBestCand = pairTmpCand;
386 float dr2Tmp = pairTmpCand.
dR2();
387 if (dr2Tmp < dr2Best) {
389 pairBestCand2 = pairTmpCand;
394 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::matchMuonsToGen() gmtSAMuons: " 396 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::matchMuonsToGen() gmtTkMuons: " 398 edm::LogInfo(
"L1TPhase2MuonOffline") <<
"L1TPhase2MuonOffline::matchMuonsToGen() END " << endl;
419 return {50, -2., 2.};
421 return {50, -2., 2.};
423 return {50, -2., 2.};
425 return {96, -0.2, 0.2};
427 return {100, -0.1, 0.1};
const std::vector< double > effVsPtBins_
edm::EDGetTokenT< l1t::SAMuonCollection > gmtMuonToken_
constexpr double deltaPhi(double phi1, double phi2)
std::vector< GenMuonGMTPair > gmtSAMuonPairs_
std::map< MuType, std::string > muonNames_
const std::vector< EtaRegion > etaRegions_
edm::Handle< l1t::SAMuonCollection > gmtSAMuon_
void matchMuonsToGen(std::vector< const reco::GenParticle *> genmus)
virtual void setCurrentFolder(std::string const &fullpath)
const std::vector< MuType > muonTypes_
const l1t::L1Candidate * gmtmu_
MonitorElement * efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
const std::vector< QualLevel > qualLevels_
std::map< ResType, std::string > resNames_
std::tuple< int, double, double > getHistBinsRes(ResType res)
std::vector< std::pair< int, QualLevel > > cuts_
std::map< ResType, std::string > resLabels_
const std::vector< double > effVsEtaBins_
void fillEfficiencyHistos()
MonitorElement * controlHistos_[kNMuTypes][kNVarTypes]
const reco::GenParticle * mu_
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
edm::Handle< std::vector< reco::GenParticle > > genparticles_
L1TPhase2MuonOffline(const edm::ParameterSet &ps)
std::map< EtaRegion, std::string > etaNames_
void bookControlHistos(DQMStore::IBooker &, MuType type)
MonitorElement * efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
std::vector< float > getHistBinsEff(EffType eff)
Log< level::Info, false > LogInfo
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
std::vector< TrackerMuon > TrackerMuonCollection
std::vector< SAMuon > SAMuonCollection
double getVar(const L1TPhase2MuonOffline::EffType) const
const std::vector< ResType > resTypes_
const std::string histFolder_
void bookResolutionHistos(DQMStore::IBooker &ibooker, MuType type)
MonitorElement * resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]
double getDeltaVar(const L1TPhase2MuonOffline::ResType) const
const std::vector< double > effVsPhiBins_
const std::vector< EffType > effTypes_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::map< QualLevel, std::string > qualNames_
GenMuonGMTPair(const reco::GenParticle *mu, const l1t::L1Candidate *gmtmu)
L1TPhase2MuonOffline::EtaRegion etaRegion() const
const double maxGmtMuonDR_
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
edm::Handle< l1t::TrackerMuonCollection > gmtTkMuon_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticleToken_
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< l1t::TrackerMuonCollection > gmtTkMuonToken_
std::vector< GenMuonGMTPair > gmtTkMuonPairs_
void bookEfficiencyHistos(DQMStore::IBooker &ibooker, MuType type)
void fillResolutionHistos()
double eta() const final
momentum pseudorapidity