39 trigTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"TrigTag", edm::
InputTag(
"TriggerResults::HLT"))),
40 muonTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"MuonTag", edm::
InputTag(
"muons"))),
41 metTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"METTag", edm::
InputTag(
"pfmet"))),
42 jetTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"JetTag", edm::
InputTag(
"ak5PFJets"))),
43 phoTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"phoTag", edm::
InputTag(
"photons"))),
44 pfPhoTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"pfPhoTag", edm::
InputTag(
"pfPhotonTranslator",
"pfPhot"))),
45 vertexTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"VertexTag", edm::
InputTag(
"offlinePrimaryVertices"))),
46 trigPathNames_(cfg.getUntrackedParameter<std::vector <std::
string> >(
"TrigPathNames")),
49 isAlsoTrackerMuon_(cfg.getUntrackedParameter<bool>(
"IsAlsoTrackerMuon",
true)),
50 dxyCut_ (cfg.getUntrackedParameter<double>(
"DxyCut", 0.2)),
51 normalizedChi2Cut_(cfg.getUntrackedParameter<double>(
"NormalizedChi2Cut", 10.)),
52 trackerHitsCut_ (cfg.getUntrackedParameter<int>(
"TrackerHitsCut", 11)),
53 pixelHitsCut_ (cfg.getUntrackedParameter<int>(
"PixelHitsCut", 1)),
54 muonHitsCut_ (cfg.getUntrackedParameter<int>(
"MuonHitsCut", 1)),
55 nMatchesCut_ (cfg.getUntrackedParameter<int>(
"NMatchesCut", 2)),
58 isRelativeIso_(cfg.getUntrackedParameter<bool>(
"IsRelativeIso",
true)),
59 isCombinedIso_(cfg.getUntrackedParameter<bool>(
"IsCombinedIso",
false)),
60 isoCut03_ (cfg.getUntrackedParameter<double>(
"IsoCut03", 0.1)),
61 acopCut_ (cfg.getUntrackedParameter<double>(
"AcopCut", 999.)),
62 metMin_ (cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
63 metMax_ (cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
64 mtMin_ (cfg.getUntrackedParameter<double>(
"MtMin", 50.)),
65 mtMax_ (cfg.getUntrackedParameter<double>(
"MtMax", 200.)),
66 ptCut_ (cfg.getUntrackedParameter<double>(
"PtCut", 20.)),
67 etaCut_ (cfg.getUntrackedParameter<double>(
"EtaCut", 2.4)),
70 ptThrForZ1_ (cfg.getUntrackedParameter<double>(
"PtThrForZ1", 20.)),
71 ptThrForZ2_ (cfg.getUntrackedParameter<double>(
"PtThrForZ2", 10.)),
74 dimuonMassMin_(cfg.getUntrackedParameter<double>(
"dimuonMassMin", 80.)),
75 dimuonMassMax_(cfg.getUntrackedParameter<double>(
"dimuonMassMax", 120.)),
78 eJetMin_ (cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
79 nJetMax_ (cfg.getUntrackedParameter<int>(
"NJetMax", 999999)),
82 ptThrForPhoton_(cfg.getUntrackedParameter<double>(
"ptThrForPhoton",5.)),
83 nPhoMax_(cfg.getUntrackedParameter<int>(
"nPhoMax", 999999))
104 bool isConfigChanged =
false;
116 char chtitle[256] =
"";
119 pt_after_ =
theDbe->
book1D(
"PT_AFTERWCUTS",
"Muon transverse momentum (global muon) [GeV]",100,0.,100.);
141 iso_after_ =
theDbe->
book1D(
"ISO_AFTERWCUTS",
"Absolute (combined) isolation variable [GeV]",100, 0., 20.);
151 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
155 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
metTag_.
label().data());
160 snprintf(chtitle, 255,
"MU-MET (%s) acoplanarity",
metTag_.
label().data());
164 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ1_);
166 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ2_);
240 snprintf(chtitle, 255,
"Photon pseudorapidity (pT>%4.1f)",
ptThrForPhoton_);
262 unsigned int muonCollectionSize = muonCollection->size();
273 unsigned int nmuonsForZ1 = 0;
274 unsigned int nmuonsForZ2 = 0;
276 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
277 const Muon&
mu = muonCollection->at(
i);
280 double dxy = mu.
innerTrack()->dxy(beamSpotHandle->position());
282 if (fabs(dxy)>1) { cosmic=
true;
break;}
287 for (
unsigned int j=
i+1;
j<muonCollectionSize;
j++) {
288 const Muon& mu2 = muonCollection->at(
j);
312 const MET&
met = metCollection->at(0);
313 double met_et = met.
pt();
314 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met.
px() <<
", " << met.
py() <<
" [GeV]";
320 LogError(
"") <<
">>> Vertex collection does not exist !!!";
323 unsigned int vertexCollectionSize = vertexCollection->size();
328 for (
unsigned int i=0;
i<vertexCollectionSize;
i++) {
329 const Vertex& vertex = vertexCollection->at(
i);
330 if (vertex.
isValid()) nvvertex++;
335 bool trigger_fired =
false;
345 for (
unsigned int i=0;
i<triggerResults->size();
i++)
352 if (trigPath==0) found=
true;
354 if(!found) {
continue;}
356 bool prescaled=
false;
359 if (prescaleValue != 1) prescaled =
true;
362 if( triggerResults->accept(
i) && !prescaled){ trigger_fired=
true;}
373 unsigned int jetCollectionSize = jetCollection->size();
374 int njets = 0;
int LEADJET=-1;
double max_pt=0;
375 for (
unsigned int i=0;
i<jetCollectionSize;
i++) {
376 const Jet&
jet = jetCollection->at(
i);
377 double minDistance=99999;
378 for (
unsigned int j=0;
j<muonCollectionSize;
j++) {
379 const Muon&
mu = muonCollection->at(
j);
381 if (minDistance>distance) minDistance=distance;
383 if (minDistance<0.3)
continue;
384 if(jet.
et()>max_pt) { LEADJET=
i; max_pt=jet.
et();}
389 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
390 LogTrace(
"") <<
">>> Number of jets above " <<
eJetMin_ <<
" [GeV]: " << njets;
392 double lead_jet_pt=-1;
393 double lead_jet_eta=-100;
395 const Jet& leadJet = jetCollection->at(LEADJET);
398 lead_jet_pt=leadJet.
pt();
399 lead_jet_eta=leadJet.
eta();
409 for (
unsigned int i=0;
i<photonCollection->size();
i++){
410 const Photon &ph = photonCollection->at(
i);
411 double photonPt = ph.
pt();
419 LogTrace(
"") <<
" >>> N photons " << ngam << std::endl;
445 bool hlt_hist_done =
false;
446 bool zhlt_hist_done =
false;
447 bool zjets_hist_done =
false;
448 bool zfullsel_hist_done =
false;
449 bool met_hist_done =
false;
450 bool njets_hist_done =
false;
451 bool wfullsel_hist_done =
false;
454 const int NFLAGS = 11;
455 bool muon_sel[NFLAGS];
456 const int NFLAGSZ = 13;
457 bool zmuon_sel[NFLAGSZ];
460 double number_of_muons=0;
461 double number_of_goodMuons=0;
464 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
465 for (
int j=0;
j<NFLAGS; ++
j) {
471 const Muon&
mu = muonCollection->at(
i);
476 LogTrace(
"") <<
"> Wsel: processing muon number " <<
i <<
"...";
483 LogTrace(
"") <<
"\t... pt, eta: " << pt <<
" [GeV], " <<
eta;;
484 if (pt>
ptCut_) muon_sel[0] =
true;
485 if (fabs(eta)<
etaCut_) muon_sel[1] =
true;
490 double dxy = gm->dxy(beamSpotHandle->position());
491 double normalizedChi2 = gm->normalizedChi2();
492 double trackerHits = tk->hitPattern().numberOfValidTrackerHits();
493 int pixelHits = tk->hitPattern().numberOfValidPixelHits();
494 int muonHits = gm->hitPattern().numberOfValidMuonHits();
497 LogTrace(
"") <<
"\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy <<
" [cm], " << normalizedChi2 <<
", " << trackerHits <<
", " << mu.
isTrackerMuon();
498 if (fabs(dxy)<
dxyCut_) muon_sel[2] =
true;
509 if(quality) number_of_goodMuons++;
531 if (isovar<
isoCut03_) muon_sel[4] =
true;
533 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? " << muon_sel[6];
538 if (trigger_fired) muon_sel[5] =
true;
545 double w_et = met_et+mu.
pt();
546 double w_px = met.
px()+mu.
px();
547 double w_py = met.
py()+mu.
py();
549 double massT = w_et*w_et - w_px*w_px - w_py*w_py;
550 massT = (massT>0) ?
sqrt(massT) : 0;
552 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et <<
", " << w_px <<
", " << w_py <<
" [GeV]";
559 double acop = deltaphi.
value();
560 if (acop<0) acop = - acop;
562 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
563 if (acop<
acopCut_) muon_sel[8] =
true;
567 if (nmuonsForZ1<1 || nmuonsForZ2<2) muon_sel[9] =
true;
568 if (njets<=
nJetMax_) muon_sel[10] =
true;
571 int flags_passed = 0;
572 for (
int j=0;
j<NFLAGS; ++
j) {
573 if (muon_sel[
j]) flags_passed += 1;
577 if (flags_passed >= (NFLAGS-1)) {
578 if (!muon_sel[0] || flags_passed==NFLAGS)
580 if (!muon_sel[1] || flags_passed==NFLAGS)
582 if (!muon_sel[2] || flags_passed==NFLAGS)
584 if (!muon_sel[3] || flags_passed==NFLAGS)
586 if (!muon_sel[4] || flags_passed==NFLAGS)
588 if (!muon_sel[5] || flags_passed==NFLAGS)
590 hlt_hist_done =
true;
591 if (!muon_sel[6] || flags_passed==NFLAGS)
593 if (!muon_sel[7] || flags_passed==NFLAGS)
595 met_hist_done =
true;
596 if (!muon_sel[8] || flags_passed==NFLAGS)
599 if (!muon_sel[10] || flags_passed==NFLAGS) {
600 if (!njets_hist_done) {
605 njets_hist_done =
true;
607 if( flags_passed==NFLAGS ) {
608 if (!wfullsel_hist_done){
614 wfullsel_hist_done=
true;
620 if ( muon4Z && !muon_sel[9]){
623 for (
unsigned int j=
i+1;
j<muonCollectionSize;
j++) {
625 for (
int ij=0; ij<NFLAGSZ; ++ij) {
626 zmuon_sel[ij] =
false;
629 for (
int ji=0; ji<5; ++ji ) {
630 zmuon_sel[ji] = muon_sel[ji];
633 const Muon& mu2 = muonCollection->at(
j);
635 if (mu2.
charge() * charge != -1 )
continue;
638 double pt2 = mu2.
pt();
if (pt2>
ptThrForZ2_) zmuon_sel[5] =
true;
639 double eta2=mu2.
eta();
if (fabs(eta2)<
etaCut_) zmuon_sel[6] =
true;
640 double dxy2 = gm2->dxy(beamSpotHandle->position());
if (fabs(dxy2)<
dxyCut_) zmuon_sel[7] =
true;
641 double normalizedChi22 = gm2->normalizedChi2();
642 double trackerHits2 = tk2->hitPattern().numberOfValidTrackerHits();
643 int pixelHits2 = tk2->hitPattern().numberOfValidPixelHits();
644 int muonHits2 = gm2->hitPattern().numberOfValidMuonHits();
653 zmuon_sel[8]=quality2;
660 if (isovar2<
isoCut03_) zmuon_sel[9] =
true;
661 if (trigger_fired) zmuon_sel[10] =
true;
666 if (njets <=
nJetMax_) zmuon_sel[12] =
true;
669 int flags_passed_z = 0;
671 for (
int jj=0;
jj<NFLAGSZ; ++
jj) {
672 if (zmuon_sel[
jj]) ++flags_passed_z ;
675 if (flags_passed_z >= (NFLAGSZ-1)) {
676 if (!zmuon_sel[0] || flags_passed_z==NFLAGSZ) {
pt1_afterZ_->
Fill(pt); }
680 if (!zmuon_sel[4] || flags_passed_z==NFLAGSZ) {
iso1_afterZ_->
Fill(isovar); }
681 if (!zmuon_sel[5] || flags_passed_z==NFLAGSZ) {
pt2_afterZ_->
Fill(pt2); }
685 if (!zmuon_sel[9] || flags_passed_z==NFLAGSZ) {
iso2_afterZ_->
Fill(isovar2); }
686 if (!zmuon_sel[10] || flags_passed_z==NFLAGSZ) {
688 zhlt_hist_done =
true;
691 if (!zmuon_sel[12] || flags_passed_z==NFLAGSZ ){
692 if(!zjets_hist_done){
697 zjets_hist_done=
true;
699 if(flags_passed_z==NFLAGSZ) {
701 if(!zfullsel_hist_done){
715 zfullsel_hist_done=
true;
722 if (zfullsel_hist_done) {
MonitorElement * met_before_
virtual double et() const GCC11_FINAL
transverse energy
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 * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
virtual double p() const GCC11_FINAL
magnitude of momentum vector
MonitorElement * iso2_afterZ_
MonitorElement * npvs_before_
virtual TrackRef innerTrack() 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.
MonitorElement * eta2_afterZ_
MonitorElement * npvs_afterZ_
bool isGlobalMuon() const
MonitorElement * leadingjet_eta_before_
std::vector< std::string > trigPathNames_
MonitorElement * acop_before_
MonitorElement * leadingjet_pt_after_
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
MonitorElement * goodewkmuon_before_
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
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_
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
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_
bool isNull() const
Checks for null.
virtual void endRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * ngoodmuons_
MonitorElement * n_zselPt2thr_
MonitorElement * pt2_afterZ_
HLTConfigProvider hltConfigProvider_
MonitorElement * met_afterZ_
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
MonitorElement * leadingjet_eta_after_
MonitorElement * mt_after_
MonitorElement * goodewkmuon_after_
MonitorElement * muoncharge_after_
MonitorElement * mt_before_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * eta_before_
MonitorElement * iso1_afterZ_
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
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 * pt_after_
MonitorElement * iso_after_
std::string const & triggerName(unsigned int index) const
virtual int charge() const GCC11_FINAL
electric charge
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
MonitorElement * eta1_afterZ_
MonitorElement * ptDiffPM_before_
MonitorElement * pt1_afterZ_
MonitorElement * dxy_after_
unsigned int prescaleSize() const
MonitorElement * met_after_
virtual float pt() const GCC11_FINAL
transverse momentum
MonitorElement * n_zselPt1thr_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
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 * leadingjet_pt_afterZ_
MonitorElement * acop_after_