39 metTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"METTag", edm::
InputTag(
"pfmet"))),
40 jetTag_ (cfg.getUntrackedParameter<edm::
InputTag> (
"JetTag", edm::
InputTag(
"ak4PFJets"))),
42 cfg.getUntrackedParameter<edm::
InputTag> (
"TrigTag",
43 edm::
InputTag(
"TriggerResults::HLT")))),
45 cfg.getUntrackedParameter<edm::
InputTag> (
"MuonTag",
48 cfg.getUntrackedParameter<edm::
InputTag> (
"METTag",
51 cfg.getUntrackedParameter<edm::
InputTag> (
"JetTag",
54 cfg.getUntrackedParameter<edm::
InputTag> (
"phoTag",
57 cfg.getUntrackedParameter<edm::
InputTag> (
"VertexTag",
58 edm::
InputTag(
"offlinePrimaryVertices")))),
60 cfg.getUntrackedParameter<edm::
InputTag> (
"beamSpotTag",
62 trigPathNames_(cfg.getUntrackedParameter<std::vector <std::
string> >(
"TrigPathNames")),
65 isAlsoTrackerMuon_(cfg.getUntrackedParameter<bool>(
"IsAlsoTrackerMuon",
true)),
66 dxyCut_ (cfg.getUntrackedParameter<double>(
"DxyCut", 0.2)),
67 normalizedChi2Cut_(cfg.getUntrackedParameter<double>(
"NormalizedChi2Cut", 10.)),
68 trackerHitsCut_ (cfg.getUntrackedParameter<int>(
"TrackerHitsCut", 11)),
69 pixelHitsCut_ (cfg.getUntrackedParameter<int>(
"PixelHitsCut", 1)),
70 muonHitsCut_ (cfg.getUntrackedParameter<int>(
"MuonHitsCut", 1)),
71 nMatchesCut_ (cfg.getUntrackedParameter<int>(
"NMatchesCut", 2)),
74 isRelativeIso_(cfg.getUntrackedParameter<bool>(
"IsRelativeIso",
true)),
75 isCombinedIso_(cfg.getUntrackedParameter<bool>(
"IsCombinedIso",
false)),
76 isoCut03_ (cfg.getUntrackedParameter<double>(
"IsoCut03", 0.1)),
77 acopCut_ (cfg.getUntrackedParameter<double>(
"AcopCut", 999.)),
78 metMin_ (cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
79 metMax_ (cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
80 mtMin_ (cfg.getUntrackedParameter<double>(
"MtMin", 50.)),
81 mtMax_ (cfg.getUntrackedParameter<double>(
"MtMax", 200.)),
82 ptCut_ (cfg.getUntrackedParameter<double>(
"PtCut", 20.)),
83 etaCut_ (cfg.getUntrackedParameter<double>(
"EtaCut", 2.4)),
86 ptThrForZ1_ (cfg.getUntrackedParameter<double>(
"PtThrForZ1", 20.)),
87 ptThrForZ2_ (cfg.getUntrackedParameter<double>(
"PtThrForZ2", 10.)),
90 dimuonMassMin_(cfg.getUntrackedParameter<double>(
"dimuonMassMin", 80.)),
91 dimuonMassMax_(cfg.getUntrackedParameter<double>(
"dimuonMassMax", 120.)),
94 eJetMin_ (cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
95 nJetMax_ (cfg.getUntrackedParameter<int>(
"NJetMax", 999999)),
98 ptThrForPhoton_(cfg.getUntrackedParameter<double>(
"ptThrForPhoton",5.)),
99 nPhoMax_(cfg.getUntrackedParameter<int>(
"nPhoMax", 999999))
120 bool isConfigChanged =
false;
132 char chtitle[256] =
"";
135 pt_after_ =
theDbe->
book1D(
"PT_AFTERWCUTS",
"Muon transverse momentum (global muon) [GeV]",100,0.,100.);
157 iso_after_ =
theDbe->
book1D(
"ISO_AFTERWCUTS",
"Absolute (combined) isolation variable [GeV]",100, 0., 20.);
167 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
171 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
metTag_.
label().data());
176 snprintf(chtitle, 255,
"MU-MET (%s) acoplanarity",
metTag_.
label().data());
180 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ1_);
182 snprintf(chtitle, 255,
"Z selection: muons above %.2f GeV",
ptThrForZ2_);
256 snprintf(chtitle, 255,
"Photon pseudorapidity (pT>%4.1f)",
ptThrForPhoton_);
278 unsigned int muonCollectionSize = muonCollection->size();
289 unsigned int nmuonsForZ1 = 0;
290 unsigned int nmuonsForZ2 = 0;
292 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
293 const Muon&
mu = muonCollection->at(
i);
296 double dxy = mu.
innerTrack()->dxy(beamSpotHandle->position());
298 if (fabs(dxy)>1) { cosmic=
true;
break;}
303 for (
unsigned int j=
i+1;
j<muonCollectionSize;
j++) {
304 const Muon& mu2 = muonCollection->at(
j);
328 const MET&
met = metCollection->at(0);
329 double met_et = met.
pt();
330 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met.
px() <<
", " << met.
py() <<
" [GeV]";
336 LogError(
"") <<
">>> Vertex collection does not exist !!!";
339 unsigned int vertexCollectionSize = vertexCollection->size();
344 for (
unsigned int i=0;
i<vertexCollectionSize;
i++) {
345 const Vertex& vertex = vertexCollection->at(
i);
346 if (vertex.
isValid()) nvvertex++;
351 bool trigger_fired =
false;
385 if (prescaleSet==-1) {
386 LogTrace(
"") <<
"Failed to determine prescaleSet\n";
391 for (
unsigned int i=0; (
i<triggerResults->size()) && (trigger_fired==
false);
i++) {
393 if (!triggerResults->accept(
i))
continue;
404 if (prescaleSet!=-1) {
412 for (
unsigned int ps=0;
438 unsigned int jetCollectionSize = jetCollection->size();
439 int njets = 0;
int LEADJET=-1;
double max_pt=0;
440 for (
unsigned int i=0;
i<jetCollectionSize;
i++) {
441 const Jet&
jet = jetCollection->at(
i);
442 double minDistance=99999;
443 for (
unsigned int j=0;
j<muonCollectionSize;
j++) {
444 const Muon&
mu = muonCollection->at(
j);
446 if (minDistance>distance) minDistance=distance;
448 if (minDistance<0.3)
continue;
449 if(jet.
et()>max_pt) { LEADJET=
i; max_pt=jet.
et();}
454 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
455 LogTrace(
"") <<
">>> Number of jets above " <<
eJetMin_ <<
" [GeV]: " << njets;
457 double lead_jet_pt=-1;
458 double lead_jet_eta=-100;
460 const Jet& leadJet = jetCollection->at(LEADJET);
463 lead_jet_pt=leadJet.
pt();
464 lead_jet_eta=leadJet.
eta();
474 for (
unsigned int i=0;
i<photonCollection->size();
i++){
475 const Photon &ph = photonCollection->at(
i);
476 double photonPt = ph.
pt();
484 LogTrace(
"") <<
" >>> N photons " << ngam << std::endl;
492 bool hlt_hist_done =
false;
493 bool zhlt_hist_done =
false;
494 bool zjets_hist_done =
false;
495 bool zfullsel_hist_done =
false;
496 bool met_hist_done =
false;
497 bool njets_hist_done =
false;
498 bool wfullsel_hist_done =
false;
501 const int NFLAGS = 11;
502 bool muon_sel[NFLAGS];
503 const int NFLAGSZ = 13;
504 bool zmuon_sel[NFLAGSZ];
507 double number_of_muons=0;
508 double number_of_goodMuons=0;
511 for (
unsigned int i=0;
i<muonCollectionSize;
i++) {
512 for (
int j=0;
j<NFLAGS; ++
j) {
518 const Muon&
mu = muonCollection->at(
i);
523 LogTrace(
"") <<
"> Wsel: processing muon number " <<
i <<
"...";
530 LogTrace(
"") <<
"\t... pt, eta: " << pt <<
" [GeV], " <<
eta;;
531 if (pt>
ptCut_) muon_sel[0] =
true;
532 if (fabs(eta)<
etaCut_) muon_sel[1] =
true;
537 double dxy = gm->dxy(beamSpotHandle->position());
538 double normalizedChi2 = gm->normalizedChi2();
539 double trackerHits = tk->hitPattern().numberOfValidTrackerHits();
540 int pixelHits = tk->hitPattern().numberOfValidPixelHits();
541 int muonHits = gm->hitPattern().numberOfValidMuonHits();
544 LogTrace(
"") <<
"\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy <<
" [cm], " << normalizedChi2 <<
", " << trackerHits <<
", " << mu.
isTrackerMuon();
545 if (fabs(dxy)<
dxyCut_) muon_sel[2] =
true;
556 if(quality) number_of_goodMuons++;
578 if (isovar<
isoCut03_) muon_sel[4] =
true;
580 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? " << muon_sel[6];
585 if (trigger_fired) muon_sel[5] =
true;
592 double w_et = met_et+mu.
pt();
593 double w_px = met.
px()+mu.
px();
594 double w_py = met.
py()+mu.
py();
596 double massT = w_et*w_et - w_px*w_px - w_py*w_py;
597 massT = (massT>0) ?
sqrt(massT) : 0;
599 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et <<
", " << w_px <<
", " << w_py <<
" [GeV]";
606 double acop = deltaphi.
value();
607 if (acop<0) acop = - acop;
609 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
610 if (acop<
acopCut_) muon_sel[8] =
true;
614 if (nmuonsForZ1<1 || nmuonsForZ2<2) muon_sel[9] =
true;
615 if (njets<=
nJetMax_) muon_sel[10] =
true;
618 int flags_passed = 0;
619 for (
int j=0;
j<NFLAGS; ++
j) {
620 if (muon_sel[
j]) flags_passed += 1;
624 if (flags_passed >= (NFLAGS-1)) {
625 if (!muon_sel[0] || flags_passed==NFLAGS)
627 if (!muon_sel[1] || flags_passed==NFLAGS)
629 if (!muon_sel[2] || flags_passed==NFLAGS)
631 if (!muon_sel[3] || flags_passed==NFLAGS)
633 if (!muon_sel[4] || flags_passed==NFLAGS)
635 if (!muon_sel[5] || flags_passed==NFLAGS)
637 hlt_hist_done =
true;
638 if (!muon_sel[6] || flags_passed==NFLAGS)
640 if (!muon_sel[7] || flags_passed==NFLAGS)
642 met_hist_done =
true;
643 if (!muon_sel[8] || flags_passed==NFLAGS)
646 if (!muon_sel[10] || flags_passed==NFLAGS) {
647 if (!njets_hist_done) {
652 njets_hist_done =
true;
654 if( flags_passed==NFLAGS ) {
655 if (!wfullsel_hist_done){
661 wfullsel_hist_done=
true;
667 if ( muon4Z && !muon_sel[9]){
670 for (
unsigned int j=
i+1;
j<muonCollectionSize;
j++) {
672 for (
int ij=0; ij<NFLAGSZ; ++ij) {
673 zmuon_sel[ij] =
false;
676 for (
int ji=0; ji<5; ++ji ) {
677 zmuon_sel[ji] = muon_sel[ji];
680 const Muon& mu2 = muonCollection->at(
j);
682 if (mu2.
charge() * charge != -1 )
continue;
685 double pt2 = mu2.
pt();
if (pt2>
ptThrForZ2_) zmuon_sel[5] =
true;
686 double eta2=mu2.
eta();
if (fabs(eta2)<
etaCut_) zmuon_sel[6] =
true;
687 double dxy2 = gm2->dxy(beamSpotHandle->position());
if (fabs(dxy2)<
dxyCut_) zmuon_sel[7] =
true;
688 double normalizedChi22 = gm2->normalizedChi2();
689 double trackerHits2 = tk2->hitPattern().numberOfValidTrackerHits();
690 int pixelHits2 = tk2->hitPattern().numberOfValidPixelHits();
691 int muonHits2 = gm2->hitPattern().numberOfValidMuonHits();
700 zmuon_sel[8]=quality2;
707 if (isovar2<
isoCut03_) zmuon_sel[9] =
true;
708 if (trigger_fired) zmuon_sel[10] =
true;
713 if (njets <=
nJetMax_) zmuon_sel[12] =
true;
716 int flags_passed_z = 0;
718 for (
int jj=0;
jj<NFLAGSZ; ++
jj) {
719 if (zmuon_sel[
jj]) ++flags_passed_z ;
722 if (flags_passed_z >= (NFLAGSZ-1)) {
723 if (!zmuon_sel[0] || flags_passed_z==NFLAGSZ) {
pt1_afterZ_->
Fill(pt); }
727 if (!zmuon_sel[4] || flags_passed_z==NFLAGSZ) {
iso1_afterZ_->
Fill(isovar); }
728 if (!zmuon_sel[5] || flags_passed_z==NFLAGSZ) {
pt2_afterZ_->
Fill(pt2); }
732 if (!zmuon_sel[9] || flags_passed_z==NFLAGSZ) {
iso2_afterZ_->
Fill(isovar2); }
733 if (!zmuon_sel[10] || flags_passed_z==NFLAGSZ) {
735 zhlt_hist_done =
true;
738 if (!zmuon_sel[12] || flags_passed_z==NFLAGSZ ){
739 if(!zjets_hist_done){
744 zjets_hist_done=
true;
746 if(flags_passed_z==NFLAGSZ) {
748 if(!zfullsel_hist_done){
762 zfullsel_hist_done=
true;
769 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_
tuple met
____________________________________________________________________________||
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
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_
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_
static std::string const triggerResults
MonitorElement * mt_after_
MonitorElement * goodewkmuon_after_
MonitorElement * muoncharge_after_
MonitorElement * mt_before_
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 &)
edm::EDGetTokenT< edm::View< reco::Vertex > > vertexTag_
double normalizedChi2Cut_
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup) const
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_
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_
virtual float pt() const GCC11_FINAL
transverse momentum
MonitorElement * n_zselPt1thr_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
edm::EDGetTokenT< edm::View< reco::Photon > > phoTag_
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_