38 trigTag_(cfg.getUntrackedParameter<edm::
InputTag> (
"TrigTag", edm::
InputTag(
"TriggerResults::HLT"))),
39 muonTag_(cfg.getUntrackedParameter<edm::
InputTag> (
"MuonTag", edm::
InputTag(
"muons"))),
40 metTag_(cfg.getUntrackedParameter<edm::
InputTag> (
"METTag", edm::
InputTag(
"pfmet"))),
41 jetTag_(cfg.getUntrackedParameter<edm::
InputTag> (
"JetTag", edm::
InputTag(
"ak5PFJets"))),
42 vertexTag_(cfg.getUntrackedParameter<edm::
InputTag> (
"VertexTag", edm::
InputTag(
"offlinePrimaryVertices"))),
45 ptCut_(cfg.getUntrackedParameter<double>(
"PtCut", 25.)),
46 etaCut_(cfg.getUntrackedParameter<double>(
"EtaCut", 2.1)),
47 isRelativeIso_(cfg.getUntrackedParameter<bool>(
"IsRelativeIso",
true)),
48 isCombinedIso_(cfg.getUntrackedParameter<bool>(
"IsCombinedIso",
false)),
49 isoCut03_(cfg.getUntrackedParameter<double>(
"IsoCut03", 0.1)),
50 mtMin_(cfg.getUntrackedParameter<double>(
"MtMin", 50.)),
51 mtMax_(cfg.getUntrackedParameter<double>(
"MtMax", 200.)),
52 metMin_(cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
53 metMax_(cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
54 acopCut_(cfg.getUntrackedParameter<double>(
"AcopCut", 999.)),
57 dxyCut_(cfg.getUntrackedParameter<double>(
"DxyCut", 0.2)),
58 normalizedChi2Cut_(cfg.getUntrackedParameter<double>(
"NormalizedChi2Cut", 10.)),
59 trackerHitsCut_(cfg.getUntrackedParameter<int>(
"TrackerHitsCut", 11)),
60 pixelHitsCut_(cfg.getUntrackedParameter<int>(
"PixelHitsCut", 1)),
61 muonHitsCut_(cfg.getUntrackedParameter<int>(
"MuonHitsCut", 1)),
62 isAlsoTrackerMuon_(cfg.getUntrackedParameter<bool>(
"IsAlsoTrackerMuon",
true)),
63 nMatchesCut_(cfg.getUntrackedParameter<int>(
"NMatchesCut", 2)),
66 ptThrForZ1_(cfg.getUntrackedParameter<double>(
"PtThrForZ1", 20.)),
67 ptThrForZ2_(cfg.getUntrackedParameter<double>(
"PtThrForZ2", 10.)),
70 eJetMin_(cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
71 nJetMax_(cfg.getUntrackedParameter<int>(
"NJetMax", 999999))
87 bool isConfigChanged =
false;
102 char chtitle[256] =
"";
103 for (
int i=0;
i<2; ++
i) {
104 snprintf(chtitle, 255,
"Muon transverse momentum (global muon) [GeV]");
108 snprintf(chtitle, 255,
"Muon pseudo-rapidity");
112 snprintf(chtitle, 255,
"Muon transverse distance to beam spot [cm]");
116 snprintf(chtitle, 255,
"Quality-muon flag");
122 snprintf(chtitle, 255,
"Relative (combined) isolation variable");
124 snprintf(chtitle, 255,
"Relative (tracker) isolation variable");
130 snprintf(chtitle, 255,
"Absolute (combined) isolation variable [GeV]");
132 snprintf(chtitle, 255,
"Absolute (tracker) isolation variable [GeV]");
138 snprintf(chtitle, 255,
"HLT_Mu* Trigger response");
142 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
146 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
metTag_.
label().data());
150 snprintf(chtitle, 255,
"MU-MET (%s) acoplanarity",
metTag_.
label().data());
154 snprintf(chtitle, 255,
"Z rejection: number of muons above %.2f GeV",
ptThrForZ1_);
158 snprintf(chtitle, 255,
"Z rejection: number of muons above %.2f GeV",
ptThrForZ2_);
166 snprintf(chtitle, 255,
"DiMuonMass (2 globals)");
170 snprintf(chtitle, 255,
"Global pt for Muons in Z");
173 snprintf(chtitle, 255,
"Number of Valid Primary Vertices");
177 snprintf(chtitle, 255,
"Muon Charge");
195 bool rec_sel =
false;
196 bool iso_sel =
false;
197 bool hlt_sel =
false;
198 bool met_sel =
false;
199 bool all_sel =
false;
207 unsigned int muonCollectionSize = muonCollection->size();
218 unsigned int nmuonsForZ1 = 0;
219 unsigned int nmuonsForZ2 = 0;
221 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
222 const Muon& mu = muonCollection->at(
i);
225 double dxy = mu.
innerTrack()->dxy(beamSpotHandle->position());
227 if (fabs(dxy)>1) { cosmic=
true;
break;}
232 for (
unsigned int j=
i+1;
j<muonCollectionSize;
j++) {
233 const Muon& mu2 = muonCollection->at(
j);
253 const MET&
met = metCollection->at(0);
254 double met_et = met.
pt();
255 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met.
px() <<
", " << met.
py() <<
" [GeV]";
261 LogError(
"") <<
">>> Vertex collection does not exist !!!";
264 unsigned int vertexCollectionSize = vertexCollection->size();
269 for (
unsigned int i=0;
i<vertexCollectionSize;
i++) {
270 const Vertex& vertex = vertexCollection->at(
i);
271 if (vertex.
isValid()) nvvertex++;
276 bool trigger_fired =
false;
284 for (
unsigned int i=0;
i<triggerResults->size();
i++)
287 size_t found = trigName.find(
"HLT_Mu");
288 if ( found == std::string::npos)
continue;
290 bool prescaled=
false;
293 if (prescaleValue != 1) prescaled =
true;
295 if(prescaled)
continue;
297 if( triggerResults->accept(
i) ) trigger_fired=
true;
312 unsigned int jetCollectionSize = jetCollection->size();
314 for (
unsigned int i=0;
i<jetCollectionSize;
i++) {
315 const Jet&
jet = jetCollection->at(
i);
316 double minDistance=99999;
317 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
318 const Muon& mu = muonCollection->at(
i);
320 if (minDistance>distance) minDistance=distance;
322 if (minDistance<0.3)
continue;
325 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
326 LogTrace(
"") <<
">>> Number of jets above " <<
eJetMin_ <<
" [GeV]: " << njets;
333 bool hlt_hist_done =
false;
334 bool met_hist_done =
false;
335 bool nz1_hist_done =
false;
336 bool nz2_hist_done =
false;
337 bool njets_hist_done =
false;
338 bool pv_hist_done =
false;
339 bool charge_hist_done =
false;
342 const int NFLAGS = 11;
343 bool muon_sel[NFLAGS];
346 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
347 for (
int j=0;
j<NFLAGS; ++
j) {
351 const Muon& mu = muonCollection->at(
i);
356 LogTrace(
"") <<
"> Wsel: processing muon number " <<
i <<
"...";
363 LogTrace(
"") <<
"\t... pt, eta: " << pt <<
" [GeV], " <<
eta;;
364 if (pt>
ptCut_) muon_sel[0] =
true;
365 if (fabs(eta)<
etaCut_) muon_sel[1] =
true;
370 double dxy = gm->dxy(beamSpotHandle->position());
371 double normalizedChi2 = gm->normalizedChi2();
372 double trackerHits = tk->hitPattern().numberOfValidTrackerHits();
373 int pixelHits = tk->hitPattern().numberOfValidPixelHits();
374 int muonHits = gm->hitPattern().numberOfValidMuonHits();
377 LogTrace(
"") <<
"\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy <<
" [cm], " << normalizedChi2 <<
", " << trackerHits <<
", " << mu.
isTrackerMuon();
378 if (fabs(dxy)<
dxyCut_) muon_sel[2] =
true;
404 if (isovar<
isoCut03_) muon_sel[4] =
true;
406 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? " << muon_sel[6];
411 if (trigger_fired) muon_sel[5] =
true;
418 double w_et = met_et+mu.
pt();
419 double w_px = met.
px()+mu.
px();
420 double w_py = met.
py()+mu.
py();
422 double massT = w_et*w_et - w_px*w_px - w_py*w_py;
423 massT = (massT>0) ?
sqrt(massT) : 0;
425 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et <<
", " << w_px <<
", " << w_py <<
" [GeV]";
432 double acop = deltaphi.
value();
433 if (acop<0) acop = - acop;
435 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
436 if (acop<
acopCut_) muon_sel[8] =
true;
440 if (nmuonsForZ1<1 || nmuonsForZ2<2) muon_sel[9] =
true;
441 if (njets<=
nJetMax_) muon_sel[10] =
true;
444 int flags_passed = 0;
445 bool rec_sel_this =
true;
446 bool iso_sel_this =
true;
447 bool hlt_sel_this =
true;
448 bool met_sel_this =
true;
449 bool all_sel_this =
true;
450 for (
int j=0;
j<NFLAGS; ++
j) {
451 if (muon_sel[
j]) flags_passed += 1;
452 if (j<4 && !muon_sel[j]) rec_sel_this =
false;
453 if (j<5 && !muon_sel[j]) iso_sel_this =
false;
454 if (j<6 && !muon_sel[j]) hlt_sel_this =
false;
455 if (j<8 && !muon_sel[j]) met_sel_this =
false;
456 if (!muon_sel[j]) all_sel_this =
false;
460 if (rec_sel_this) rec_sel =
true;
462 if (iso_sel_this) iso_sel =
true;
464 if (hlt_sel_this) hlt_sel =
true;
466 if (met_sel_this) met_sel =
true;
468 if (all_sel_this) all_sel =
true;
471 if (flags_passed >= (NFLAGS-1)) {
472 if (!muon_sel[0] || flags_passed==NFLAGS)
474 if (!muon_sel[1] || flags_passed==NFLAGS)
476 if (!muon_sel[2] || flags_passed==NFLAGS)
478 if (!muon_sel[3] || flags_passed==NFLAGS)
480 if (!muon_sel[4] || flags_passed==NFLAGS)
482 if (!muon_sel[5] || flags_passed==NFLAGS)
484 hlt_hist_done =
true;
485 if (!muon_sel[6] || flags_passed==NFLAGS)
487 if (!muon_sel[7] || flags_passed==NFLAGS)
489 met_hist_done =
true;
490 if (!muon_sel[8] || flags_passed==NFLAGS)
492 if (!muon_sel[9] || flags_passed==NFLAGS)
494 nz1_hist_done =
true;
495 if (!muon_sel[9] || flags_passed==NFLAGS)
497 nz2_hist_done =
true;
498 if (!muon_sel[10] || flags_passed==NFLAGS) {
500 njets_hist_done =
true;
501 if( flags_passed==NFLAGS ) {
505 pv_hist_done=
true; charge_hist_done=
true;
511 if ( muon4Z && !muon_sel[9]){
514 for (
unsigned int j=
i+1;
j<muonCollectionSize;
j++) {
515 const Muon& mu2 = muonCollection->at(
j);
517 if (mu2.
charge() * charge != -1 )
continue;
519 double eta2=mu2.
eta();
if (fabs(eta2)>
etaCut_)
continue;
MonitorElement * met_before_
virtual double p() const
magnitude of momentum vector
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
EwkMuDQM(const edm::ParameterSet &)
float sumPt
sum-pt of tracks
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
virtual double et() const
transverse energy
MonitorElement * npvs_before_
virtual TrackRef innerTrack() const
MonitorElement * njets_before_
MonitorElement * dxy_before_
MonitorElement * trig_before_
MonitorElement * trig_after_
bool isTrackerMuon() const
MonitorElement * muoncharge_before_
Base class for all types of Jets.
bool isValid() const
Tells whether the vertex is valid.
bool isGlobalMuon() const
MonitorElement * acop_before_
MonitorElement * goodewkmuon_before_
virtual double eta() const
momentum pseudorapidity
MonitorElement * eta_after_
MonitorElement * pt_before_
MonitorElement * iso_before_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
MonitorElement * npvs_after_
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_
bool isNull() const
Checks for null.
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * dimuonmass_after_
HLTConfigProvider hltConfigProvider_
virtual int charge() const
electric charge
MonitorElement * mt_after_
MonitorElement * goodewkmuon_after_
MonitorElement * muoncharge_after_
MonitorElement * mt_before_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * eta_before_
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
T value() const
Explicit access to value in case implicit conversion not OK.
static const char *const trigNames[]
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
double normalizedChi2Cut_
MonitorElement * nz1_after_
MonitorElement * pt_after_
MonitorElement * iso_after_
virtual double px() const
x coordinate of momentum vector
MonitorElement * nz2_after_
virtual double pt() const
transverse momentum
std::string const & triggerName(unsigned int index) const
MonitorElement * nz2_before_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
virtual double pz() const
z coordinate of momentum vector
MonitorElement * dxy_after_
unsigned int prescaleSize() const
MonitorElement * met_after_
virtual double phi() const
momentum azimuthal angle
virtual void analyze(const edm::Event &, const edm::EventSetup &)
MonitorElement * nz1_before_
virtual double py() const
y coordinate of momentum vector
void setCurrentFolder(const std::string &fullpath)
MonitorElement * dimuonmass_before_
const MuonIsolation & isolationR03() const
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
MonitorElement * ptmuonZ_after_
MonitorElement * acop_after_