40 metTag_(cfg.getUntrackedParameter<edm::
InputTag>(
"METTag",
42 jetTag_(cfg.getUntrackedParameter<edm::
InputTag>(
43 "JetTag", edm::
InputTag(
"ak4PFJets"))),
45 cfg.getUntrackedParameter<edm::
InputTag>(
46 "TrigTag", edm::
InputTag(
"TriggerResults::HLT")))),
48 cfg.getUntrackedParameter<edm::
InputTag>(
"MuonTag",
51 cfg.getUntrackedParameter<edm::
InputTag>(
"METTag",
54 cfg.getUntrackedParameter<edm::
InputTag>(
55 "JetTag", edm::
InputTag(
"ak4PFJets")))),
57 cfg.getUntrackedParameter<edm::
InputTag>(
"phoTag",
60 cfg.getUntrackedParameter<edm::
InputTag>(
61 "VertexTag", edm::
InputTag(
"offlinePrimaryVertices")))),
64 "beamSpotTag", edm::
InputTag(
"offlineBeamSpot")))),
65 trigPathNames_(cfg.getUntrackedParameter<std::vector<std::
string> >(
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)) {
126 bool isConfigChanged =
false;
137 char chtitle[256] =
"";
140 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
142 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
145 "Muon pseudo-rapidity", 50, -2.5, 2.5);
147 "Muon pseudo-rapidity", 50, -2.5, 2.5);
150 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
152 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
155 "Quality-muon flag", 2, -0.5, 1.5);
157 "Quality-muon flag", 2, -0.5, 1.5);
162 "Relative (combined) isolation variable", 100, 0., 1.);
164 "Relative (combined) isolation variable", 100, 0., 1.);
167 "Relative (tracker) isolation variable", 100, 0., 1.);
169 "Relative (tracker) isolation variable", 100, 0., 1.);
174 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
176 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
179 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
181 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
186 "Trigger response (boolean of muon triggers)", 2, -0.5, 1.5);
188 "Trigger response (boolean of muon triggers)", 2, -0.5, 1.5);
190 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
194 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
200 snprintf(chtitle, 255,
"MU-MET (%s) acoplanarity",
metTag_.
label().data());
204 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ1_);
206 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ2_);
209 snprintf(chtitle, 255,
"Number of jets (%s) above %.2f GeV",
216 "Leading Jet transverse momentum", 300, 0., 300.);
218 "Leading Jet transverse momentum", 300, 0., 300.);
220 "Leading Jet transverse momentum", 300, 0., 300.);
223 "Leading Jet pseudo-rapidity", 50, -2.5, 2.5);
225 "Leading Jet pseudo-rapidity", 50, -2.5, 2.5);
227 "Leading Jet pseudo-rapidity", 50, -2.5, 2.5);
230 "pt(Muon+)-pt(Muon-) after Z cuts [GeV]", 200, -100., 100.);
232 "pt(Muon+)-pt(Muon-) after Z cuts [GeV]", 200, -100., 100.);
237 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
239 "Muon pseudo-rapidity", 50, -2.5, 2.5);
241 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
243 "Quality-muon flag", 2, -0.5, 1.5);
248 "Relative (combined) isolation variable", 100, 0., 1.);
250 "Relative (combined) isolation variable", 100, 0., 1.);
253 "Relative (tracker) isolation variable", 100, 0., 1.);
255 "Relative (tracker) isolation variable", 100, 0., 1.);
260 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
262 "Absolute (combined) isolation variable [GeV]", 100, 0., 20.);
265 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
267 "Absolute (tracker) isolation variable [GeV]", 100, 0., 20.);
272 "Muon transverse momentum (global muon) [GeV]", 100, 0., 100.);
274 "Muon pseudo-rapidity", 50, -2.5, 2.5);
276 "Muon transverse distance to beam spot [cm]", 100, -0.5, 0.5);
278 "Quality-muon flag", 2, -0.5, 1.5);
280 "Trigger response (boolean of muon triggers)", 2, -0.5, 1.5);
282 "DiMuonMass (2 globals)", 100, 0, 200);
284 "DiMuonMass (2 globals)", 100, 0, 200);
286 "Number of Valid Primary Vertices", 51, -0.5, 50.5);
288 "Number of Valid Primary Vertices", 51, -0.5, 50.5);
290 "Number of Valid Primary Vertices", 51, -0.5, 50.5);
292 "Muon Charge", 3, -1.5, 1.5);
294 "Muon Charge", 3, -1.5, 1.5);
296 "Muon Charge", 3, -1.5, 1.5);
301 "Number of muons in the event", 10, -0.5, 9.5);
303 "Number of muons passing the quality criteria", 10, -0.5, 9.5);
305 nph_ = ibooker.
book1D(
"nph",
"Number of photons in the event", 20, 0., 20.);
306 phPt_ = ibooker.
book1D(
"phPt",
"Photon transverse momentum [GeV]", 100, 0.,1000.);
307 snprintf(chtitle, 255,
"Photon pseudorapidity (pT>%4.1f)",
ptThrForPhoton_);
308 phEta_ = ibooker.
book1D(
"phEta", chtitle, 100, -2.5, 2.5);
321 unsigned int muonCollectionSize = muonCollection->size();
331 unsigned int nmuonsForZ1 = 0;
332 unsigned int nmuonsForZ2 = 0;
334 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
335 const Muon&
mu = muonCollection->at(
i);
338 double dxy = mu.
innerTrack()->dxy(beamSpotHandle->position());
348 for (
unsigned int j =
i + 1;
j < muonCollectionSize;
j++) {
349 const Muon& mu2 = muonCollection->at(
j);
352 mu.
px() + mu2.
px(), mu.
py() + mu2.
py(), mu.
pz() + mu2.
pz(),
366 <<
" [GeV]: " << nmuonsForZ1;
368 <<
" [GeV]: " << nmuonsForZ2;
376 const MET&
met = metCollection->at(0);
377 double met_et = met.
pt();
378 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met.
px()
379 <<
", " << met.
py() <<
" [GeV]";
385 LogError(
"") <<
">>> Vertex collection does not exist !!!";
388 unsigned int vertexCollectionSize = vertexCollection->size();
391 for (
unsigned int i = 0;
i < vertexCollectionSize;
i++) {
392 const Vertex& vertex = vertexCollection->at(
i);
393 if (vertex.
isValid()) nvvertex++;
398 bool trigger_fired =
false;
437 if (prescaleSet == -1) {
438 LogTrace(
"") <<
"Failed to determine prescaleSet\n";
444 for (
unsigned int i = 0;
445 (
i < triggerResults->size()) && (trigger_fired ==
false);
i++) {
447 if (!triggerResults->accept(
i))
continue;
452 for (
unsigned int index = 0;
456 if (!found)
continue;
459 if (prescaleSet != -1) {
466 for (
unsigned int ps = 0;
480 trigger_fired =
true;
492 unsigned int jetCollectionSize = jetCollection->size();
496 for (
unsigned int i = 0;
i < jetCollectionSize;
i++) {
497 const Jet&
jet = jetCollection->at(
i);
498 double minDistance = 99999;
499 for (
unsigned int j = 0;
j < muonCollectionSize;
j++) {
500 const Muon&
mu = muonCollection->at(
j);
503 if (minDistance > distance) minDistance =
distance;
505 if (minDistance < 0.3)
507 if (jet.
et() > max_pt) {
516 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
518 <<
" [GeV]: " <<
njets;
520 double lead_jet_pt = -1;
521 double lead_jet_eta = -100;
523 const Jet& leadJet = jetCollection->at(LEADJET);
526 lead_jet_pt = leadJet.
pt();
527 lead_jet_eta = leadJet.
eta();
535 unsigned int ngam = 0;
537 for (
unsigned int i = 0;
i < photonCollection->size();
i++) {
538 const Photon& ph = photonCollection->at(
i);
539 double photonPt = ph.
pt();
547 LogTrace(
"") <<
" >>> N photons " << ngam << std::endl;
555 bool hlt_hist_done =
false;
556 bool zhlt_hist_done =
false;
557 bool zjets_hist_done =
false;
558 bool zfullsel_hist_done =
false;
559 bool met_hist_done =
false;
560 bool njets_hist_done =
false;
561 bool wfullsel_hist_done =
false;
564 const int NFLAGS = 11;
565 bool muon_sel[NFLAGS];
566 const int NFLAGSZ = 13;
567 bool zmuon_sel[NFLAGSZ];
570 double number_of_muons = 0;
571 double number_of_goodMuons = 0;
573 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
574 for (
int j = 0;
j < NFLAGS; ++
j) {
580 const Muon&
mu = muonCollection->at(
i);
585 LogTrace(
"") <<
"> Wsel: processing muon number " <<
i <<
"...";
592 LogTrace(
"") <<
"\t... pt, eta: " << pt <<
" [GeV], " <<
eta;
594 if (pt >
ptCut_) muon_sel[0] =
true;
595 if (fabs(eta) <
etaCut_) muon_sel[1] =
true;
597 double charge = mu.
charge();
600 double dxy = gm->dxy(beamSpotHandle->position());
601 double normalizedChi2 = gm->normalizedChi2();
602 double trackerHits = tk->hitPattern().numberOfValidTrackerHits();
603 int pixelHits = tk->hitPattern().numberOfValidPixelHits();
604 int muonHits = gm->hitPattern().numberOfValidMuonHits();
607 LogTrace(
"") <<
"\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: "
608 << dxy <<
" [cm], " << normalizedChi2 <<
", " << trackerHits
610 if (fabs(dxy) <
dxyCut_) muon_sel[2] =
true;
622 if (quality) number_of_goodMuons++;
643 if (isovar <
isoCut03_) muon_sel[4] =
true;
645 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? "
650 if (trigger_fired) muon_sel[5] =
true;
654 quality && trigger_fired && isovar <
isoCut03_) {
659 double w_et = met_et + mu.
pt();
660 double w_px = met.
px() + mu.
px();
661 double w_py = met.
py() + mu.
py();
663 double massT = w_et * w_et - w_px * w_px - w_py * w_py;
664 massT = (massT > 0) ?
sqrt(massT) : 0;
666 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et
667 <<
", " << w_px <<
", " << w_py <<
" [GeV]";
668 if (massT >
mtMin_ && massT <
mtMax_) muon_sel[6] =
true;
674 double acop = deltaphi.
value();
675 if (acop < 0) acop = -acop;
677 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
678 if (acop <
acopCut_) muon_sel[8] =
true;
682 if (nmuonsForZ1 < 1 || nmuonsForZ2 < 2) muon_sel[9] =
true;
683 if (njets <=
nJetMax_) muon_sel[10] =
true;
686 int flags_passed = 0;
687 for (
int j = 0;
j < NFLAGS; ++
j) {
688 if (muon_sel[
j]) flags_passed += 1;
692 if (flags_passed >= (NFLAGS - 1)) {
693 if (!muon_sel[0] || flags_passed == NFLAGS)
pt_after_->
Fill(pt);
694 if (!muon_sel[1] || flags_passed == NFLAGS)
eta_after_->
Fill(eta);
695 if (!muon_sel[2] || flags_passed == NFLAGS)
dxy_after_->
Fill(dxy);
696 if (!muon_sel[3] || flags_passed == NFLAGS)
698 if (!muon_sel[4] || flags_passed == NFLAGS)
iso_after_->
Fill(isovar);
699 if (!muon_sel[5] || flags_passed == NFLAGS)
701 hlt_hist_done =
true;
702 if (!muon_sel[6] || flags_passed == NFLAGS)
mt_after_->
Fill(massT);
703 if (!muon_sel[7] || flags_passed == NFLAGS)
705 met_hist_done =
true;
708 if (!muon_sel[10] || flags_passed == NFLAGS) {
709 if (!njets_hist_done) {
714 njets_hist_done =
true;
716 if (flags_passed == NFLAGS) {
717 if (!wfullsel_hist_done) {
723 wfullsel_hist_done =
true;
729 if (muon4Z && !muon_sel[9]) {
732 for (
unsigned int j =
i + 1;
j < muonCollectionSize;
j++) {
734 for (
int ij = 0; ij < NFLAGSZ; ++ij) {
735 zmuon_sel[ij] =
false;
738 for (
int ji = 0; ji < 5; ++ji) {
739 zmuon_sel[ji] = muon_sel[ji];
742 const Muon& mu2 = muonCollection->at(
j);
744 if (mu2.
charge() * charge != -1)
continue;
747 double pt2 = mu2.
pt();
749 double eta2 = mu2.
eta();
750 if (fabs(eta2) <
etaCut_) zmuon_sel[6] =
true;
751 double dxy2 = gm2->dxy(beamSpotHandle->position());
752 if (fabs(dxy2) <
dxyCut_) zmuon_sel[7] =
true;
753 double normalizedChi22 = gm2->normalizedChi2();
754 double trackerHits2 = tk2->hitPattern().numberOfValidTrackerHits();
755 int pixelHits2 = tk2->hitPattern().numberOfValidPixelHits();
756 int muonHits2 = gm2->hitPattern().numberOfValidMuonHits();
758 bool quality2 =
true;
765 zmuon_sel[8] = quality2;
772 if (isovar2 <
isoCut03_) zmuon_sel[9] =
true;
773 if (trigger_fired) zmuon_sel[10] =
true;
775 mu.
px() + mu2.
px(), mu.
py() + mu2.
py(), mu.
pz() + mu2.
pz(),
779 zmuon_sel[11] =
true;
782 if (njets <=
nJetMax_) zmuon_sel[12] =
true;
785 int flags_passed_z = 0;
787 for (
int jj = 0;
jj < NFLAGSZ; ++
jj) {
788 if (zmuon_sel[
jj]) ++flags_passed_z;
791 if (flags_passed_z >= (NFLAGSZ - 1)) {
792 if (!zmuon_sel[0] || flags_passed_z == NFLAGSZ) {
795 if (!zmuon_sel[1] || flags_passed_z == NFLAGSZ) {
798 if (!zmuon_sel[2] || flags_passed_z == NFLAGSZ) {
801 if (!zmuon_sel[3] || flags_passed_z == NFLAGSZ) {
804 if (!zmuon_sel[4] || flags_passed_z == NFLAGSZ) {
807 if (!zmuon_sel[5] || flags_passed_z == NFLAGSZ) {
810 if (!zmuon_sel[6] || flags_passed_z == NFLAGSZ) {
813 if (!zmuon_sel[7] || flags_passed_z == NFLAGSZ) {
816 if (!zmuon_sel[8] || flags_passed_z == NFLAGSZ) {
819 if (!zmuon_sel[9] || flags_passed_z == NFLAGSZ) {
822 if (!zmuon_sel[10] || flags_passed_z == NFLAGSZ) {
824 zhlt_hist_done =
true;
826 if (!zmuon_sel[11] || flags_passed_z == NFLAGSZ) {
829 if (!zmuon_sel[12] || flags_passed_z == NFLAGSZ) {
830 if (!zjets_hist_done) {
835 zjets_hist_done =
true;
837 if (flags_passed_z == NFLAGSZ) {
839 if (!zfullsel_hist_done) {
852 zfullsel_hist_done =
true;
859 if (zfullsel_hist_done) {
MonitorElement * met_before_
virtual double p() const
magnitude of momentum vector
MonitorElement * ptDiffPM_afterZ_
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
MonitorElement * dimuonmass_afterZ_
EwkMuDQM(const edm::ParameterSet &)
float sumPt
sum-pt of tracks
MonitorElement * njets_afterZ_
MonitorElement * iso2_afterZ_
virtual double et() const
transverse energy
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 * ztrig_afterZ_
MonitorElement * trig_before_
MonitorElement * trig_after_
MonitorElement * leadingjet_eta_afterZ_
bool isTrackerMuon() const
MonitorElement * muoncharge_before_
Base class for all types of Jets.
bool isValid() const
Tells whether the vertex is valid.
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
MonitorElement * eta2_afterZ_
edm::EDGetTokenT< edm::TriggerResults > trigTag_
MonitorElement * npvs_afterZ_
bool isGlobalMuon() const
MonitorElement * leadingjet_eta_before_
std::vector< std::string > trigPathNames_
MonitorElement * acop_before_
MonitorElement * leadingjet_pt_after_
MonitorElement * goodewkmuon_before_
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
MonitorElement * eta_after_
MonitorElement * muoncharge_afterZ_
MonitorElement * pt_before_
MonitorElement * dxy2_afterZ_
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_
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
MonitorElement * njets_after_
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * ngoodmuons_
MonitorElement * n_zselPt2thr_
MonitorElement * pt2_afterZ_
HLTConfigProvider hltConfigProvider_
MonitorElement * met_afterZ_
virtual int charge() const
electric charge
MonitorElement * book1D(Args &&...args)
MonitorElement * leadingjet_eta_after_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
static std::string const triggerResults
MonitorElement * mt_after_
MonitorElement * goodewkmuon_after_
MonitorElement * muoncharge_after_
MonitorElement * mt_before_
bool isNull() const
Checks for null.
MonitorElement * eta_before_
MonitorElement * iso1_afterZ_
T value() const
Explicit access to value in case implicit conversion not OK.
static const char *const trigNames[]
edm::EDGetTokenT< edm::View< reco::Vertex > > vertexTag_
double normalizedChi2Cut_
void setCurrentFolder(const std::string &fullpath)
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup) const
MonitorElement * pt_after_
MonitorElement * iso_after_
virtual double px() const
x coordinate of momentum vector
virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &)
std::string const & triggerName(unsigned int index) const
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
MonitorElement * eta1_afterZ_
MonitorElement * ptDiffPM_before_
virtual double pz() const
z coordinate of momentum vector
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_
unsigned int prescaleSize() const
MonitorElement * met_after_
volatile std::atomic< bool > shutdown_flag false
edm::EDGetTokenT< edm::View< reco::Muon > > muonTag_
MonitorElement * n_zselPt1thr_
virtual double phi() const
momentum azimuthal angle
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
edm::EDGetTokenT< edm::View< reco::Photon > > phoTag_
virtual double py() const
y coordinate of momentum vector
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_