40 metTag_(cfg.getUntrackedParameter<
edm::
InputTag>(
"METTag",
61 "VertexTag",
edm::
InputTag(
"offlinePrimaryVertices")))),
69 isAlsoTrackerMuon_(cfg.getUntrackedParameter<
bool>(
70 "IsAlsoTrackerMuon",
true)),
72 cfg.getUntrackedParameter<double>(
"DxyCut", 0.2)),
73 normalizedChi2Cut_(cfg.getUntrackedParameter<double>(
74 "NormalizedChi2Cut", 10.)),
75 trackerHitsCut_(cfg.getUntrackedParameter<
int>(
"TrackerHitsCut",
78 cfg.getUntrackedParameter<
int>(
"PixelHitsCut", 1)),
79 muonHitsCut_(cfg.getUntrackedParameter<
int>(
"MuonHitsCut",
81 nMatchesCut_(cfg.getUntrackedParameter<
int>(
85 isRelativeIso_(cfg.getUntrackedParameter<
bool>(
"IsRelativeIso",
true)),
86 isCombinedIso_(cfg.getUntrackedParameter<
bool>(
"IsCombinedIso",
false)),
87 isoCut03_(cfg.getUntrackedParameter<double>(
"IsoCut03", 0.1)),
88 acopCut_(cfg.getUntrackedParameter<double>(
"AcopCut", 999.)),
89 metMin_(cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
90 metMax_(cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
91 mtMin_(cfg.getUntrackedParameter<double>(
"MtMin", 50.)),
92 mtMax_(cfg.getUntrackedParameter<double>(
"MtMax", 200.)),
93 ptCut_(cfg.getUntrackedParameter<double>(
"PtCut", 20.)),
94 etaCut_(cfg.getUntrackedParameter<double>(
"EtaCut", 2.4)),
97 ptThrForZ1_(cfg.getUntrackedParameter<double>(
"PtThrForZ1", 20.)),
98 ptThrForZ2_(cfg.getUntrackedParameter<double>(
"PtThrForZ2", 10.)),
101 dimuonMassMin_(cfg.getUntrackedParameter<double>(
"dimuonMassMin", 80.)),
102 dimuonMassMax_(cfg.getUntrackedParameter<double>(
"dimuonMassMax", 120.)),
105 eJetMin_(cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
106 nJetMax_(cfg.getUntrackedParameter<
int>(
"NJetMax", 999999)),
109 ptThrForPhoton_(cfg.getUntrackedParameter<double>(
"ptThrForPhoton", 5.)),
110 nPhoMax_(cfg.getUntrackedParameter<
int>(
"nPhoMax", 999999)),
111 hltPrescaleProvider_(cfg, consumesCollector(), *this) {
127 bool isConfigChanged =
false;
138 char chtitle[256] =
"";
141 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
143 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
146 "Muon pseudo-rapidity", 50, -2.5, 2.5);
148 "Muon pseudo-rapidity", 50, -2.5, 2.5);
151 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
153 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
156 "Quality-muon flag", 2, -0.5, 1.5);
158 "Quality-muon flag", 2, -0.5, 1.5);
163 "Relative (combined) isolation variable", 100, 0., 1.);
165 "Relative (combined) isolation variable", 100, 0., 1.);
168 "Relative (tracker) isolation variable", 100, 0., 1.);
170 "Relative (tracker) isolation variable", 100, 0., 1.);
175 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
177 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
180 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
182 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
191 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
195 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
201 snprintf(chtitle, 255,
"MU-MET (%s) acoplanarity",
metTag_.
label().data());
205 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ1_);
207 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ2_);
210 snprintf(chtitle, 255,
"Number of jets (%s) above %.2f GeV",
217 "Leading Jet transverse momentum", 300, 0., 300.);
219 "Leading Jet transverse momentum", 300, 0., 300.);
221 "Leading Jet transverse momentum", 300, 0., 300.);
224 "Leading Jet pseudo-rapidity", 50, -2.5, 2.5);
226 "Leading Jet pseudo-rapidity", 50, -2.5, 2.5);
228 "Leading Jet pseudo-rapidity", 50, -2.5, 2.5);
231 "pt(Muon+)-pt(Muon-) after Z cuts [GeV]", 200, -100., 100.);
233 "pt(Muon+)-pt(Muon-) after Z cuts [GeV]", 200, -100., 100.);
238 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
240 "Muon pseudo-rapidity", 50, -2.5, 2.5);
242 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
244 "Quality-muon flag", 2, -0.5, 1.5);
249 "Relative (combined) isolation variable", 100, 0., 1.);
251 "Relative (combined) isolation variable", 100, 0., 1.);
254 "Relative (tracker) isolation variable", 100, 0., 1.);
256 "Relative (tracker) isolation variable", 100, 0., 1.);
261 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
263 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
266 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
268 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
273 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
275 "Muon pseudo-rapidity", 50, -2.5, 2.5);
277 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
279 "Quality-muon flag", 2, -0.5, 1.5);
284 "DiMuonMass (2 globals)", 100, 0, 200);
286 "DiMuonMass (2 globals)", 100, 0, 200);
288 "Number of Valid Primary Vertices", 51, -0.5, 50.5);
290 "Number of Valid Primary Vertices", 51, -0.5, 50.5);
292 "Number of Valid Primary Vertices", 51, -0.5, 50.5);
294 "Muon Charge", 3, -1.5, 1.5);
296 "Muon Charge", 3, -1.5, 1.5);
298 "Muon Charge", 3, -1.5, 1.5);
303 "Number of muons in the event", 10, -0.5, 9.5);
305 "Number of muons passing the quality criteria", 10, -0.5, 9.5);
307 nph_ = ibooker.
book1D(
"nph",
"Number of photons in the event", 20, 0., 20.);
308 phPt_ = ibooker.
book1D(
"phPt",
"Photon transverse momentum [GeV]", 100, 0.,1000.);
309 snprintf(chtitle, 255,
"Photon pseudorapidity (pT>%4.1f)",
ptThrForPhoton_);
310 phEta_ = ibooker.
book1D(
"phEta", chtitle, 100, -2.5, 2.5);
323 unsigned int muonCollectionSize = muonCollection->size();
333 unsigned int nmuonsForZ1 = 0;
334 unsigned int nmuonsForZ2 = 0;
336 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
337 const Muon&
mu = muonCollection->at(
i);
350 for (
unsigned int j =
i + 1; j < muonCollectionSize; j++) {
351 const Muon& mu2 = muonCollection->at(j);
354 mu.
px() + mu2.
px(), mu.
py() + mu2.
py(), mu.
pz() + mu2.
pz(),
368 <<
" [GeV]: " << nmuonsForZ1;
370 <<
" [GeV]: " << nmuonsForZ2;
378 const MET&
met = metCollection->at(0);
379 double met_et = met.
pt();
380 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met.
px()
381 <<
", " << met.
py() <<
" [GeV]";
387 LogError(
"") <<
">>> Vertex collection does not exist !!!";
390 unsigned int vertexCollectionSize = vertexCollection->size();
393 for (
unsigned int i = 0;
i < vertexCollectionSize;
i++) {
394 const Vertex& vertex = vertexCollection->at(
i);
395 if (vertex.
isValid()) nvvertex++;
441 if (prescaleSet == -1) {
442 LogTrace(
"") <<
"Failed to determine prescaleSet\n";
496 unsigned int jetCollectionSize = jetCollection->size();
500 for (
unsigned int i = 0;
i < jetCollectionSize;
i++) {
501 const Jet&
jet = jetCollection->at(
i);
502 double minDistance = 99999;
503 for (
unsigned int j = 0; j < muonCollectionSize; j++) {
504 const Muon&
mu = muonCollection->at(j);
507 if (minDistance > distance) minDistance =
distance;
509 if (minDistance < 0.3)
511 if (jet.
et() > max_pt) {
520 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
522 <<
" [GeV]: " << njets;
524 double lead_jet_pt = -1;
525 double lead_jet_eta = -100;
527 const Jet& leadJet = jetCollection->at(LEADJET);
530 lead_jet_pt = leadJet.
pt();
531 lead_jet_eta = leadJet.
eta();
539 unsigned int ngam = 0;
541 for (
unsigned int i = 0;
i < photonCollection->size();
i++) {
542 const Photon& ph = photonCollection->at(
i);
543 double photonPt = ph.
pt();
551 LogTrace(
"") <<
" >>> N photons " << ngam << std::endl;
561 bool zjets_hist_done =
false;
562 bool zfullsel_hist_done =
false;
563 bool met_hist_done =
false;
564 bool njets_hist_done =
false;
565 bool wfullsel_hist_done =
false;
568 const int NFLAGS = 10;
569 bool muon_sel[NFLAGS];
570 const int NFLAGSZ = 12;
571 bool zmuon_sel[NFLAGSZ];
574 double number_of_muons = 0;
575 double number_of_goodMuons = 0;
577 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
578 for (
int j = 0; j < NFLAGS; ++j) {
584 const Muon&
mu = muonCollection->at(
i);
589 LogTrace(
"") <<
"> Wsel: processing muon number " <<
i <<
"...";
596 LogTrace(
"") <<
"\t... pt, eta: " << pt <<
" [GeV], " <<
eta;
598 if (pt >
ptCut_) muon_sel[0] =
true;
599 if (fabs(eta) <
etaCut_) muon_sel[1] =
true;
605 double normalizedChi2 = gm->normalizedChi2();
606 double trackerHits = tk->hitPattern().numberOfValidTrackerHits();
607 int pixelHits = tk->hitPattern().numberOfValidPixelHits();
608 int muonHits = gm->hitPattern().numberOfValidMuonHits();
611 LogTrace(
"") <<
"\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: " 612 << dxy <<
" [cm], " << normalizedChi2 <<
", " << trackerHits
614 if (fabs(dxy) <
dxyCut_) muon_sel[2] =
true;
626 if (quality) number_of_goodMuons++;
647 if (isovar <
isoCut03_) muon_sel[4] =
true;
649 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? " 663 double w_et = met_et + mu.
pt();
664 double w_px = met.
px() + mu.
px();
665 double w_py = met.
py() + mu.
py();
667 double massT = w_et * w_et - w_px * w_px - w_py * w_py;
668 massT = (massT > 0) ?
sqrt(massT) : 0;
670 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et
671 <<
", " << w_px <<
", " << w_py <<
" [GeV]";
672 if (massT >
mtMin_ && massT <
mtMax_) muon_sel[5] =
true;
678 double acop = deltaphi.
value();
679 if (acop < 0) acop = -acop;
681 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
682 if (acop <
acopCut_) muon_sel[7] =
true;
686 if (nmuonsForZ1 < 1 || nmuonsForZ2 < 2) muon_sel[8] =
true;
687 if (njets <=
nJetMax_) muon_sel[9] =
true;
690 int flags_passed = 0;
691 for (
int j = 0; j < NFLAGS; ++j) {
692 if (muon_sel[j]) flags_passed += 1;
696 if (flags_passed >= (NFLAGS - 1)) {
697 if (!muon_sel[0] || flags_passed == NFLAGS)
pt_after_->
Fill(pt);
698 if (!muon_sel[1] || flags_passed == NFLAGS)
eta_after_->
Fill(eta);
699 if (!muon_sel[2] || flags_passed == NFLAGS)
dxy_after_->
Fill(dxy);
700 if (!muon_sel[3] || flags_passed == NFLAGS)
702 if (!muon_sel[4] || flags_passed == NFLAGS)
iso_after_->
Fill(isovar);
706 if (!muon_sel[5] || flags_passed == NFLAGS)
mt_after_->
Fill(massT);
707 if (!muon_sel[6] || flags_passed == NFLAGS)
709 met_hist_done =
true;
712 if (!muon_sel[9] || flags_passed == NFLAGS) {
713 if (!njets_hist_done) {
718 njets_hist_done =
true;
720 if (flags_passed == NFLAGS) {
721 if (!wfullsel_hist_done) {
727 wfullsel_hist_done =
true;
733 if (muon4Z && !muon_sel[8]) {
736 for (
unsigned int j =
i + 1; j < muonCollectionSize; j++) {
738 for (
int ij = 0; ij < NFLAGSZ; ++ij) {
739 zmuon_sel[ij] =
false;
742 for (
int ji = 0; ji < 5; ++ji) {
743 zmuon_sel[ji] = muon_sel[ji];
746 const Muon& mu2 = muonCollection->at(j);
748 if (mu2.
charge() * charge != -1)
continue;
751 double pt2 = mu2.
pt();
753 double eta2 = mu2.
eta();
754 if (fabs(eta2) <
etaCut_) zmuon_sel[6] =
true;
755 double dxy2 = gm2->dxy(beamSpotHandle->
position());
756 if (fabs(dxy2) <
dxyCut_) zmuon_sel[7] =
true;
757 double normalizedChi22 = gm2->normalizedChi2();
758 double trackerHits2 = tk2->hitPattern().numberOfValidTrackerHits();
759 int pixelHits2 = tk2->hitPattern().numberOfValidPixelHits();
760 int muonHits2 = gm2->hitPattern().numberOfValidMuonHits();
762 bool quality2 =
true;
769 zmuon_sel[8] = quality2;
776 if (isovar2 <
isoCut03_) zmuon_sel[9] =
true;
779 mu.
px() + mu2.
px(), mu.
py() + mu2.
py(), mu.
pz() + mu2.
pz(),
783 zmuon_sel[10] =
true;
786 if (njets <=
nJetMax_) zmuon_sel[11] =
true;
789 int flags_passed_z = 0;
791 for (
int jj = 0;
jj < NFLAGSZ; ++
jj) {
792 if (zmuon_sel[
jj]) ++flags_passed_z;
795 if (flags_passed_z >= (NFLAGSZ - 1)) {
796 if (!zmuon_sel[0] || flags_passed_z == NFLAGSZ) {
799 if (!zmuon_sel[1] || flags_passed_z == NFLAGSZ) {
802 if (!zmuon_sel[2] || flags_passed_z == NFLAGSZ) {
805 if (!zmuon_sel[3] || flags_passed_z == NFLAGSZ) {
808 if (!zmuon_sel[4] || flags_passed_z == NFLAGSZ) {
811 if (!zmuon_sel[5] || flags_passed_z == NFLAGSZ) {
814 if (!zmuon_sel[6] || flags_passed_z == NFLAGSZ) {
817 if (!zmuon_sel[7] || flags_passed_z == NFLAGSZ) {
820 if (!zmuon_sel[8] || flags_passed_z == NFLAGSZ) {
823 if (!zmuon_sel[9] || flags_passed_z == NFLAGSZ) {
830 if (!zmuon_sel[10] || flags_passed_z == NFLAGSZ) {
833 if (!zmuon_sel[11] || flags_passed_z == NFLAGSZ) {
834 if (!zjets_hist_done) {
839 zjets_hist_done =
true;
841 if (flags_passed_z == NFLAGSZ) {
843 if (!zfullsel_hist_done) {
856 zfullsel_hist_done =
true;
863 if (zfullsel_hist_done) {
MonitorElement * met_before_
MonitorElement * ptDiffPM_afterZ_
MonitorElement * dimuonmass_afterZ_
double eta() const final
momentum pseudorapidity
EwkMuDQM(const edm::ParameterSet &)
float sumPt
sum-pt of tracks
MonitorElement * njets_afterZ_
MonitorElement * iso2_afterZ_
MonitorElement * npvs_before_
virtual TrackRef innerTrack() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * dxy1_afterZ_
MonitorElement * njets_before_
MonitorElement * dxy_before_
MonitorElement * leadingjet_eta_afterZ_
MonitorElement * muoncharge_before_
bool isValid() const
Tells whether the vertex is valid.
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
double px() const final
x coordinate of momentum vector
MonitorElement * eta2_afterZ_
MonitorElement * npvs_afterZ_
MonitorElement * leadingjet_eta_before_
double pt() const final
transverse momentum
int charge() const final
electric charge
MonitorElement * acop_before_
MonitorElement * leadingjet_pt_after_
MonitorElement * goodewkmuon_before_
MonitorElement * eta_after_
MonitorElement * muoncharge_afterZ_
MonitorElement * pt_before_
MonitorElement * dxy2_afterZ_
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
bool isTrackerMuon() const 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_
MonitorElement * njets_after_
MonitorElement * ngoodmuons_
MonitorElement * n_zselPt2thr_
void setCurrentFolder(std::string const &fullpath)
MonitorElement * pt2_afterZ_
double et() const final
transverse energy
bool isGlobalMuon() const override
double pz() const final
z coordinate of momentum vector
MonitorElement * met_afterZ_
MonitorElement * book1D(Args &&...args)
MonitorElement * leadingjet_eta_after_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * mt_after_
MonitorElement * goodewkmuon_after_
MonitorElement * muoncharge_after_
MonitorElement * mt_before_
bool isNull() const
Checks for null.
MonitorElement * eta_before_
MonitorElement * iso1_afterZ_
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
T value() const
Explicit access to value in case implicit conversion not OK.
HLTPrescaleProvider hltPrescaleProvider_
double p() const final
magnitude of momentum vector
edm::EDGetTokenT< edm::View< reco::Vertex > > vertexTag_
double normalizedChi2Cut_
MonitorElement * pt_after_
MonitorElement * iso_after_
MonitorElement * eta1_afterZ_
double py() const final
y coordinate of momentum vector
MonitorElement * ptDiffPM_before_
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
MonitorElement * pt1_afterZ_
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
MonitorElement * dxy_after_
const Point & position() const
position
void endRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * met_after_
edm::EDGetTokenT< edm::View< reco::Muon > > muonTag_
MonitorElement * n_zselPt1thr_
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
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_
const MuonIsolation & isolationR03() const
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
MonitorElement * leadingjet_pt_afterZ_
MonitorElement * acop_after_