59 isAlsoTrackerMuon_(
cfg.getUntrackedParameter<
bool>(
"IsAlsoTrackerMuon",
true)),
60 dxyCut_(
cfg.getUntrackedParameter<double>(
"DxyCut", 0.2)),
62 cfg.getUntrackedParameter<double>(
"NormalizedChi2Cut", 10.)),
63 trackerHitsCut_(
cfg.getUntrackedParameter<
int>(
"TrackerHitsCut",
65 pixelHitsCut_(
cfg.getUntrackedParameter<
int>(
"PixelHitsCut", 1)),
66 muonHitsCut_(
cfg.getUntrackedParameter<
int>(
"MuonHitsCut",
68 nMatchesCut_(
cfg.getUntrackedParameter<
int>(
"NMatchesCut", 2)),
71 isRelativeIso_(
cfg.getUntrackedParameter<
bool>(
"IsRelativeIso",
true)),
72 isCombinedIso_(
cfg.getUntrackedParameter<
bool>(
"IsCombinedIso",
false)),
73 isoCut03_(
cfg.getUntrackedParameter<double>(
"IsoCut03", 0.1)),
74 acopCut_(
cfg.getUntrackedParameter<double>(
"AcopCut", 999.)),
75 metMin_(
cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
76 metMax_(
cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
77 mtMin_(
cfg.getUntrackedParameter<double>(
"MtMin", 50.)),
78 mtMax_(
cfg.getUntrackedParameter<double>(
"MtMax", 200.)),
79 ptCut_(
cfg.getUntrackedParameter<double>(
"PtCut", 20.)),
80 etaCut_(
cfg.getUntrackedParameter<double>(
"EtaCut", 2.4)),
83 ptThrForZ1_(
cfg.getUntrackedParameter<double>(
"PtThrForZ1", 20.)),
84 ptThrForZ2_(
cfg.getUntrackedParameter<double>(
"PtThrForZ2", 10.)),
87 dimuonMassMin_(
cfg.getUntrackedParameter<double>(
"dimuonMassMin", 80.)),
88 dimuonMassMax_(
cfg.getUntrackedParameter<double>(
"dimuonMassMax", 120.)),
91 eJetMin_(
cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
92 nJetMax_(
cfg.getUntrackedParameter<
int>(
"NJetMax", 999999)),
95 ptThrForPhoton_(
cfg.getUntrackedParameter<double>(
"ptThrForPhoton", 5.)),
96 nPhoMax_(
cfg.getUntrackedParameter<
int>(
"nPhoMax", 999999)),
97 hltPrescaleProvider_(
cfg, consumesCollector(), *this) {
112 bool isConfigChanged =
false;
120 char chtitle[256] =
"";
122 pt_before_ = ibooker.
book1D(
"PT_BEFORECUTS",
"Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
123 pt_after_ = ibooker.
book1D(
"PT_AFTERWCUTS",
"Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
125 eta_before_ = ibooker.
book1D(
"ETA_BEFORECUTS",
"Muon pseudo-rapidity", 50, -2.5, 2.5);
126 eta_after_ = ibooker.
book1D(
"ETA_AFTERWCUTS",
"Muon pseudo-rapidity", 50, -2.5, 2.5);
128 dxy_before_ = ibooker.
book1D(
"DXY_BEFORECUTS",
"Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
129 dxy_after_ = ibooker.
book1D(
"DXY_AFTERWCUTS",
"Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
136 iso_before_ = ibooker.
book1D(
"ISO_BEFORECUTS",
"Relative (combined) isolation variable", 100, 0., 1.);
137 iso_after_ = ibooker.
book1D(
"ISO_AFTERWCUTS",
"Relative (combined) isolation variable", 100, 0., 1.);
139 iso_before_ = ibooker.
book1D(
"ISO_BEFORECUTS",
"Relative (tracker) isolation variable", 100, 0., 1.);
140 iso_after_ = ibooker.
book1D(
"ISO_AFTERWCUTS",
"Relative (tracker) isolation variable", 100, 0., 1.);
144 iso_before_ = ibooker.
book1D(
"ISO_BEFORECUTS",
"Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
145 iso_after_ = ibooker.
book1D(
"ISO_AFTERWCUTS",
"Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
147 iso_before_ = ibooker.
book1D(
"ISO_BEFORECUTS",
"Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
148 iso_after_ = ibooker.
book1D(
"ISO_AFTERWCUTS",
"Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
157 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
161 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
metTag_.
label().data());
166 snprintf(chtitle, 255,
"MU-MET (%s) acoplanarity",
metTag_.
label().data());
170 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ1_);
172 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ2_);
188 ptDiffPM_before_ = ibooker.
book1D(
"PTDIFFPM_BEFORE_CUTS",
"pt(Muon+)-pt(Muon-) after Z cuts [GeV]", 200, -100., 100.);
189 ptDiffPM_afterZ_ = ibooker.
book1D(
"PTDIFFPM_AFTERZ_CUTS",
"pt(Muon+)-pt(Muon-) after Z cuts [GeV]", 200, -100., 100.);
193 pt1_afterZ_ = ibooker.
book1D(
"PT1_AFTERZCUTS",
"Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
194 eta1_afterZ_ = ibooker.
book1D(
"ETA1_AFTERZCUTS",
"Muon pseudo-rapidity", 50, -2.5, 2.5);
195 dxy1_afterZ_ = ibooker.
book1D(
"DXY1_AFTERZCUTS",
"Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
200 iso1_afterZ_ = ibooker.
book1D(
"ISO1_AFTERZCUTS",
"Relative (combined) isolation variable", 100, 0., 1.);
201 iso2_afterZ_ = ibooker.
book1D(
"ISO2_AFTERZCUTS",
"Relative (combined) isolation variable", 100, 0., 1.);
203 iso1_afterZ_ = ibooker.
book1D(
"ISO1_AFTERZCUTS",
"Relative (tracker) isolation variable", 100, 0., 1.);
204 iso2_afterZ_ = ibooker.
book1D(
"ISO2_AFTERZCUTS",
"Relative (tracker) isolation variable", 100, 0., 1.);
208 iso1_afterZ_ = ibooker.
book1D(
"ISO1_AFTERZCUTS",
"Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
209 iso2_afterZ_ = ibooker.
book1D(
"ISO2_AFTERZCUTS",
"Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
211 iso1_afterZ_ = ibooker.
book1D(
"ISO1_AFTERZCUTS",
"Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
212 iso2_afterZ_ = ibooker.
book1D(
"ISO2_AFTERZCUTS",
"Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
216 pt2_afterZ_ = ibooker.
book1D(
"PT2_AFTERZCUTS",
"Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
217 eta2_afterZ_ = ibooker.
book1D(
"ETA2_AFTERZCUTS",
"Muon pseudo-rapidity", 50, -2.5, 2.5);
218 dxy2_afterZ_ = ibooker.
book1D(
"DXY2_AFTERZCUTS",
"Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
225 npvs_before_ = ibooker.
book1D(
"NPVs_BEFORECUTS",
"Number of Valid Primary Vertices", 51, -0.5, 50.5);
226 npvs_after_ = ibooker.
book1D(
"NPVs_AFTERWCUTS",
"Number of Valid Primary Vertices", 51, -0.5, 50.5);
227 npvs_afterZ_ = ibooker.
book1D(
"NPVs_AFTERZCUTS",
"Number of Valid Primary Vertices", 51, -0.5, 50.5);
234 nmuons_ = ibooker.
book1D(
"NMuons",
"Number of muons in the event", 10, -0.5, 9.5);
235 ngoodmuons_ = ibooker.
book1D(
"NGoodMuons",
"Number of muons passing the quality criteria", 10, -0.5, 9.5);
237 nph_ = ibooker.
book1D(
"nph",
"Number of photons in the event", 20, 0., 20.);
238 phPt_ = ibooker.
book1D(
"phPt",
"Photon transverse momentum [GeV]", 100, 0., 1000.);
239 snprintf(chtitle, 255,
"Photon pseudorapidity (pT>%4.1f)",
ptThrForPhoton_);
240 phEta_ = ibooker.
book1D(
"phEta", chtitle, 100, -2.5, 2.5);
260 unsigned int nmuonsForZ1 = 0;
261 unsigned int nmuonsForZ2 = 0;
263 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
265 if (!
mu.isGlobalMuon())
268 double dxy =
mu.innerTrack()->dxy(beamSpotHandle->
position());
280 for (
unsigned int j =
i + 1;
j < muonCollectionSize;
j++) {
284 mu.px() + mu2.
px(),
mu.py() + mu2.
py(),
mu.pz() + mu2.
pz(),
mu.p() + mu2.
p());
286 if (
mu.charge() > 0) {
307 double met_et =
met.pt();
308 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " <<
met.px() <<
", " <<
met.py() <<
" [GeV]";
314 LogError(
"") <<
">>> Vertex collection does not exist !!!";
320 for (
unsigned int i = 0;
i < vertexCollectionSize;
i++) {
369 if (prescaleSet == -1) {
370 LogTrace(
"") <<
"Failed to determine prescaleSet\n";
428 for (
unsigned int i = 0;
i < jetCollectionSize;
i++) {
430 double minDistance = 99999;
431 for (
unsigned int j = 0;
j < muonCollectionSize;
j++) {
438 if (minDistance < 0.3)
440 if (
jet.et() > max_pt) {
449 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
452 double lead_jet_pt = -1;
453 double lead_jet_eta = -100;
458 lead_jet_pt = leadJet.
pt();
459 lead_jet_eta = leadJet.
eta();
467 unsigned int ngam = 0;
479 LogTrace(
"") <<
" >>> N photons " << ngam << std::endl;
489 bool zjets_hist_done =
false;
490 bool zfullsel_hist_done =
false;
491 bool met_hist_done =
false;
492 bool njets_hist_done =
false;
493 bool wfullsel_hist_done =
false;
496 const int NFLAGS = 10;
497 bool muon_sel[NFLAGS];
498 const int NFLAGSZ = 12;
499 bool zmuon_sel[NFLAGSZ];
502 double number_of_muons = 0;
503 double number_of_goodMuons = 0;
505 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
506 for (
int j = 0;
j < NFLAGS; ++
j) {
513 if (!
mu.isGlobalMuon())
515 if (
mu.globalTrack().isNull())
517 if (
mu.innerTrack().isNull())
520 LogTrace(
"") <<
"> Wsel: processing muon number " <<
i <<
"...";
526 double eta =
mu.eta();
527 LogTrace(
"") <<
"\t... pt, eta: " <<
pt <<
" [GeV], " <<
eta;
539 double trackerHits = tk->hitPattern().numberOfValidTrackerHits();
540 int pixelHits = tk->hitPattern().numberOfValidPixelHits();
541 int muonHits = gm->hitPattern().numberOfValidMuonHits();
542 int nMatches =
mu.numberOfMatches();
560 if (!
mu.isTrackerMuon())
566 number_of_goodMuons++;
581 double isovar =
mu.isolationR03().sumPt;
583 isovar +=
mu.isolationR03().emEt;
584 isovar +=
mu.isolationR03().hadEt;
591 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? " << muon_sel[6];
603 double w_et = met_et +
mu.pt();
604 double w_px =
met.px() +
mu.px();
605 double w_py =
met.py() +
mu.py();
607 double massT = w_et * w_et - w_px * w_px - w_py * w_py;
608 massT = (massT > 0) ?
sqrt(massT) : 0;
610 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et <<
", " << w_px <<
", " << w_py
620 double acop = deltaphi.
value();
624 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
630 if (nmuonsForZ1 < 1 || nmuonsForZ2 < 2)
636 int flags_passed = 0;
637 for (
int j = 0;
j < NFLAGS; ++
j) {
643 if (flags_passed >= (NFLAGS - 1)) {
644 if (!muon_sel[0] || flags_passed == NFLAGS)
646 if (!muon_sel[1] || flags_passed == NFLAGS)
648 if (!muon_sel[2] || flags_passed == NFLAGS)
650 if (!muon_sel[3] || flags_passed == NFLAGS)
652 if (!muon_sel[4] || flags_passed == NFLAGS)
657 if (!muon_sel[5] || flags_passed == NFLAGS)
659 if (!muon_sel[6] || flags_passed == NFLAGS)
662 met_hist_done =
true;
663 if (!muon_sel[7] || flags_passed == NFLAGS)
666 if (!muon_sel[9] || flags_passed == NFLAGS) {
667 if (!njets_hist_done) {
672 njets_hist_done =
true;
674 if (flags_passed == NFLAGS) {
675 if (!wfullsel_hist_done) {
681 wfullsel_hist_done =
true;
687 if (muon4Z && !muon_sel[8]) {
689 for (
unsigned int j =
i + 1;
j < muonCollectionSize;
j++) {
690 for (
int ij = 0; ij < NFLAGSZ; ++ij) {
691 zmuon_sel[ij] =
false;
694 for (
int ji = 0; ji < 5; ++ji) {
695 zmuon_sel[ji] = muon_sel[ji];
705 double pt2 = mu2.
pt();
711 double dxy2 = gm2->dxy(beamSpotHandle->
position());
714 double normalizedChi22 = gm2->normalizedChi2();
715 double trackerHits2 = tk2->hitPattern().numberOfValidTrackerHits();
716 int pixelHits2 = tk2->hitPattern().numberOfValidPixelHits();
717 int muonHits2 = gm2->hitPattern().numberOfValidMuonHits();
719 bool quality2 =
true;
732 zmuon_sel[8] = quality2;
744 mu.px() + mu2.
px(),
mu.py() + mu2.
py(),
mu.pz() + mu2.
pz(),
mu.p() + mu2.
p());
746 zmuon_sel[10] =
true;
750 zmuon_sel[11] =
true;
753 int flags_passed_z = 0;
755 for (
int jj = 0;
jj < NFLAGSZ; ++
jj) {
760 if (flags_passed_z >= (NFLAGSZ - 1)) {
761 if (!zmuon_sel[0] || flags_passed_z == NFLAGSZ) {
764 if (!zmuon_sel[1] || flags_passed_z == NFLAGSZ) {
767 if (!zmuon_sel[2] || flags_passed_z == NFLAGSZ) {
770 if (!zmuon_sel[3] || flags_passed_z == NFLAGSZ) {
773 if (!zmuon_sel[4] || flags_passed_z == NFLAGSZ) {
776 if (!zmuon_sel[5] || flags_passed_z == NFLAGSZ) {
779 if (!zmuon_sel[6] || flags_passed_z == NFLAGSZ) {
782 if (!zmuon_sel[7] || flags_passed_z == NFLAGSZ) {
785 if (!zmuon_sel[8] || flags_passed_z == NFLAGSZ) {
788 if (!zmuon_sel[9] || flags_passed_z == NFLAGSZ) {
795 if (!zmuon_sel[10] || flags_passed_z == NFLAGSZ) {
798 if (!zmuon_sel[11] || flags_passed_z == NFLAGSZ) {
799 if (!zjets_hist_done) {
804 zjets_hist_done =
true;
806 if (flags_passed_z == NFLAGSZ) {
808 if (!zfullsel_hist_done) {
821 zfullsel_hist_done =
true;
828 if (zfullsel_hist_done) {
MonitorElement * met_before_
const MuonIsolation & isolationR03() const
MonitorElement * ptDiffPM_afterZ_
MonitorElement * dimuonmass_afterZ_
double pz() const final
z coordinate of momentum vector
EwkMuDQM(const edm::ParameterSet &)
float sumPt
sum-pt of tracks
MonitorElement * njets_afterZ_
double pt() const final
transverse momentum
const Point & position() const
position
MonitorElement * iso2_afterZ_
virtual void setCurrentFolder(std::string const &fullpath)
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
MonitorElement * npvs_before_
MonitorElement * dxy1_afterZ_
MonitorElement * njets_before_
MonitorElement * dxy_before_
MonitorElement * leadingjet_eta_afterZ_
MonitorElement * muoncharge_before_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
MonitorElement * eta2_afterZ_
MonitorElement * npvs_afterZ_
MonitorElement * leadingjet_eta_before_
Log< level::Error, false > LogError
MonitorElement * acop_before_
MonitorElement * leadingjet_pt_after_
MonitorElement * goodewkmuon_before_
MonitorElement * eta_after_
MonitorElement * muoncharge_afterZ_
MonitorElement * pt_before_
bool isTrackerMuon() const override
MonitorElement * dxy2_afterZ_
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * leadingjet_pt_before_
MonitorElement * goodewkmuon1_afterZ_
MonitorElement * iso_before_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
MonitorElement * npvs_after_
MonitorElement * goodewkmuon2_afterZ_
double px() const final
x coordinate of momentum vector
MonitorElement * njets_after_
double p() const final
magnitude of momentum vector
MonitorElement * ngoodmuons_
MonitorElement * n_zselPt2thr_
MonitorElement * pt2_afterZ_
MonitorElement * met_afterZ_
MonitorElement * leadingjet_eta_after_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
virtual TrackRef innerTrack() const
void analyze(const edm::Event &, const edm::EventSetup &) override
double py() const final
y coordinate of momentum vector
MonitorElement * mt_after_
MonitorElement * goodewkmuon_after_
MonitorElement * muoncharge_after_
MonitorElement * mt_before_
MonitorElement * eta_before_
MonitorElement * iso1_afterZ_
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
HLTPrescaleProvider hltPrescaleProvider_
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
edm::EDGetTokenT< edm::View< reco::Vertex > > vertexTag_
double normalizedChi2Cut_
MonitorElement * pt_after_
MonitorElement * iso_after_
MonitorElement * eta1_afterZ_
MonitorElement * ptDiffPM_before_
MonitorElement * pt1_afterZ_
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
MonitorElement * dxy_after_
MonitorElement * met_after_
edm::EDGetTokenT< edm::View< reco::Muon > > muonTag_
T1 value() const
Explicit access to value in case implicit conversion not OK.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * n_zselPt1thr_
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
bool isGlobalMuon() const override
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
edm::EDGetTokenT< edm::View< reco::Photon > > phoTag_
MonitorElement * dimuonmass_before_
int charge() const final
electric charge
MonitorElement * leadingjet_pt_afterZ_
MonitorElement * acop_after_
double eta() const final
momentum pseudorapidity