74 std::map<std::string, TH1D*>
h1_;
114 ptCut_(cfg.getUntrackedParameter<double>(
"PtCut", 25.)),
115 etaCut_(cfg.getUntrackedParameter<double>(
"EtaCut", 2.1)),
118 isoCut03_(cfg.getUntrackedParameter<double>(
"IsoCut03", 0.1)),
119 mtMin_(cfg.getUntrackedParameter<double>(
"MtMin", 50.)),
120 mtMax_(cfg.getUntrackedParameter<double>(
"MtMax", 200.)),
121 metMin_(cfg.getUntrackedParameter<double>(
"MetMin", -999999.)),
122 metMax_(cfg.getUntrackedParameter<double>(
"MetMax", 999999.)),
123 acopCut_(cfg.getUntrackedParameter<double>(
"AcopCut", 2.)),
126 dxyCut_(cfg.getUntrackedParameter<double>(
"DxyCut", 0.2)),
132 ptThrForZ1_(cfg.getUntrackedParameter<double>(
"PtThrForZ1", 20.)),
133 ptThrForZ2_(cfg.getUntrackedParameter<double>(
"PtThrForZ2", 10.)),
136 eJetMin_(cfg.getUntrackedParameter<double>(
"EJetMin", 999999.)),
137 nJetMax_(cfg.getUntrackedParameter<
int>(
"NJetMax", 999999)) {}
157 subDir[0] = &subDir0;
158 subDir[1] = &subDir1;
160 char chname[256] =
"";
161 char chtitle[256] =
"";
162 std::string chsuffix[2] = {
"_BEFORECUTS",
"_LASTCUT"};
164 for (
int i = 0;
i < 2; ++
i) {
165 snprintf(chname, 255,
"PT%s", chsuffix[
i].
data());
166 snprintf(chtitle, 255,
"Muon transverse momentum [GeV]");
167 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 100, 0., 100.);
169 snprintf(chname, 255,
"ETA%s", chsuffix[
i].
data());
170 snprintf(chtitle, 255,
"Muon pseudo-rapidity");
171 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 50, -2.5, 2.5);
173 snprintf(chname, 255,
"DXY%s", chsuffix[
i].
data());
174 snprintf(chtitle, 255,
"Muon transverse distance to beam spot [cm]");
175 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 100, -0.5, 0.5);
177 snprintf(chname, 255,
"CHI2%s", chsuffix[
i].
data());
178 snprintf(chtitle, 255,
"Normalized Chi2, inner track fit");
179 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 100, 0., 100.);
181 snprintf(chname, 255,
"NHITS%s", chsuffix[
i].
data());
182 snprintf(chtitle, 255,
"Number of hits, inner track");
183 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 40, -0.5, 39.5);
185 snprintf(chname, 255,
"ValidMuonHits%s", chsuffix[
i].
data());
186 snprintf(chtitle, 255,
"number Of Valid Muon Hits");
187 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 40, -0.5, 39.5);
189 snprintf(chname, 255,
"TKMU%s", chsuffix[
i].
data());
190 snprintf(chtitle, 255,
"Tracker-muon flag (for global muons)");
191 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 2, -0.5, 1.5);
193 snprintf(chname, 255,
"ISO%s", chsuffix[
i].
data());
196 snprintf(chtitle, 255,
"Relative (combined) isolation variable");
198 snprintf(chtitle, 255,
"Relative (tracker) isolation variable");
200 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 100, 0., 1.);
203 snprintf(chtitle, 255,
"Absolute (combined) isolation variable [GeV]");
205 snprintf(chtitle, 255,
"Absolute (tracker) isolation variable [GeV]");
207 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 100, 0., 20.);
210 snprintf(chname, 255,
"TRIG%s", chsuffix[
i].
data());
211 snprintf(chtitle, 255,
"Trigger response (bit %s)",
muonTrig_.data());
212 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 2, -0.5, 1.5);
214 snprintf(chname, 255,
"MT%s", chsuffix[
i].
data());
215 snprintf(chtitle, 255,
"Transverse mass (%s) [GeV]",
metTag_.
label().data());
216 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 150, 0., 300.);
218 snprintf(chname, 255,
"MET%s", chsuffix[
i].
data());
219 snprintf(chtitle, 255,
"Missing transverse energy (%s) [GeV]",
metTag_.
label().data());
220 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 100, 0., 200.);
222 snprintf(chname, 255,
"ACOP%s", chsuffix[
i].
data());
223 snprintf(chtitle, 255,
"MU-MET (%s) acoplanarity",
metTag_.
label().data());
224 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 50, 0.,
M_PI);
226 snprintf(chname, 255,
"NZ1%s", chsuffix[
i].
data());
227 snprintf(chtitle, 255,
"Z rejection: number of muons above %.2f GeV",
ptThrForZ1_);
228 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 10, -0.5, 9.5);
230 snprintf(chname, 255,
"NZ2%s", chsuffix[
i].
data());
231 snprintf(chtitle, 255,
"Z rejection: number of muons above %.2f GeV",
ptThrForZ2_);
232 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 10, -0.5, 9.5);
234 snprintf(chname, 255,
"NJETS%s", chsuffix[
i].
data());
236 h1_[chname] = subDir[
i]->
make<TH1D>(chname, chtitle, 10, -0.5, 9.5);
249 LogVerbatim(
"") <<
"\n>>>>>> W SELECTION SUMMARY BEGIN >>>>>>>>>>>>>>>";
250 LogVerbatim(
"") <<
"Total numer of events analyzed: " <<
nall <<
" [events]";
251 LogVerbatim(
"") <<
"Total numer of events selected: " <<
nsel <<
" [events]";
253 <<
"(" << setprecision(4) << esel * 100. <<
" +/- " << setprecision(2)
254 <<
sqrt(esel * (1 - esel) / all) * 100. <<
")%";
264 double err =
sqrt(eff * (1 - eff) / all);
265 LogVerbatim(
"") <<
"Passing Pt/Eta/Quality cuts: " << num <<
" [events], (" << setprecision(4) << eff * 100.
266 <<
" +/- " << setprecision(2) << err * 100. <<
")%";
270 err =
sqrt(eff * (1 - eff) / all);
274 effstep = eiso / erec;
276 errstep =
sqrt(effstep * (1 - effstep) /
nrec);
277 LogVerbatim(
"") <<
"Passing isolation cuts: " << num <<
" [events], (" << setprecision(4) << eff * 100.
278 <<
" +/- " << setprecision(2) << err * 100. <<
")%, to previous step: (" << setprecision(4)
279 << effstep * 100. <<
" +/- " << setprecision(2) << errstep * 100. <<
")%";
283 err =
sqrt(eff * (1 - eff) / all);
287 effstep = ehlt / eiso;
289 errstep =
sqrt(effstep * (1 - effstep) /
niso);
290 LogVerbatim(
"") <<
"Passing HLT criteria: " << num <<
" [events], (" << setprecision(4) << eff * 100.
291 <<
" +/- " << setprecision(2) << err * 100. <<
")%, to previous step: (" << setprecision(4)
292 << effstep * 100. <<
" +/- " << setprecision(2) << errstep * 100. <<
")%";
296 err =
sqrt(eff * (1 - eff) / all);
300 effstep = emet / ehlt;
302 errstep =
sqrt(effstep * (1 - effstep) /
nhlt);
303 LogVerbatim(
"") <<
"Passing MET/acoplanarity cuts: " << num <<
" [events], (" << setprecision(4) << eff * 100.
304 <<
" +/- " << setprecision(2) << err * 100. <<
")%, to previous step: (" << setprecision(4)
305 << effstep * 100. <<
" +/- " << setprecision(2) << errstep * 100. <<
")%";
309 err =
sqrt(eff * (1 - eff) / all);
313 effstep = esel / emet;
315 errstep =
sqrt(effstep * (1 - effstep) /
nmet);
316 LogVerbatim(
"") <<
"Passing Z/top rejection cuts: " << num <<
" [events], (" << setprecision(4) << eff * 100.
317 <<
" +/- " << setprecision(2) << err * 100. <<
")%, to previous step: (" << setprecision(4)
318 << effstep * 100. <<
" +/- " << setprecision(2) << errstep * 100. <<
")%";
321 LogVerbatim(
"") <<
">>>>>> W SELECTION SUMMARY END >>>>>>>>>>>>>>>\n";
326 bool rec_sel =
false;
327 bool iso_sel =
false;
328 bool hlt_sel =
false;
329 bool met_sel =
false;
330 bool all_sel =
false;
335 LogError(
"") <<
">>> Muon collection does not exist !!!";
338 unsigned int muonCollectionSize = muonCollection->size();
343 LogTrace(
"") <<
">>> No beam spot found !!!";
352 LogError(
"") <<
">>> MET collection does not exist !!!";
355 const MET&
met = metCollection->at(0);
359 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
360 const Muon&
mu = muonCollection->at(
i);
367 double met_et =
sqrt(met_px * met_px + met_py * met_py);
368 LogTrace(
"") <<
">>> MET, MET_px, MET_py: " << met_et <<
", " << met_px <<
", " << met_py <<
" [GeV]";
374 LogError(
"") <<
">>> TRIGGER collection does not exist !!!";
385 bool trigger_fired =
false;
387 if (triggerResults->
accept(itrig1))
388 trigger_fired =
true;
389 LogTrace(
"") <<
">>> Trigger bit: " << trigger_fired <<
" (" <<
muonTrig_ <<
")";
393 unsigned int nmuonsForZ1 = 0;
394 unsigned int nmuonsForZ2 = 0;
395 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
396 const Muon&
mu = muonCollection->at(
i);
413 LogError(
"") <<
">>> JET collection does not exist !!!";
416 unsigned int jetCollectionSize = jetCollection->size();
418 for (
unsigned int i = 0;
i < jetCollectionSize;
i++) {
419 const Jet&
jet = jetCollection->at(
i);
423 LogTrace(
"") <<
">>> Total number of jets: " << jetCollectionSize;
431 if (
fastOption_ && nmuonsForZ1 >= 1 && nmuonsForZ2 >= 2)
437 bool hlt_hist_done =
false;
438 bool met_hist_done =
false;
439 bool nz1_hist_done =
false;
440 bool nz2_hist_done =
false;
441 bool njets_hist_done =
false;
444 const int NFLAGS = 13;
445 bool muon_sel[NFLAGS];
446 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
447 for (
int j = 0;
j < NFLAGS; ++
j) {
451 const Muon&
mu = muonCollection->at(
i);
459 LogTrace(
"") <<
"> Wsel: processing muon number " <<
i <<
"...";
466 LogTrace(
"") <<
"\t... pt, eta: " << pt <<
" [GeV], " <<
eta;
480 double validmuonhits = gm->hitPattern().numberOfValidMuonHits();
482 double trackerHits = gm->hitPattern().numberOfValidTrackerHits();
483 LogTrace(
"") <<
"\t... dxy, normalizedChi2, trackerHits, isTrackerMuon?: " << dxy <<
" [cm], " << normalizedChi2
522 LogTrace(
"") <<
"\t... isolation value" << isovar <<
", isolated? " << muon_sel[6];
532 double w_et = met_et + mu.
pt();
533 double w_px = met_px + mu.
px();
534 double w_py = met_py + mu.
py();
535 double massT = w_et * w_et - w_px * w_px - w_py * w_py;
536 massT = (massT > 0) ?
sqrt(massT) : 0;
538 LogTrace(
"") <<
"\t... W mass, W_et, W_px, W_py: " << massT <<
", " << w_et <<
", " << w_px <<
", " << w_py
552 double acop = deltaphi.
value();
556 LogTrace(
"") <<
"\t... acoplanarity: " << acop;
564 if (nmuonsForZ1 < 1 || nmuonsForZ2 < 2)
578 int flags_passed = 0;
579 bool rec_sel_this =
true;
580 bool iso_sel_this =
true;
581 bool hlt_sel_this =
true;
582 bool met_sel_this =
true;
583 bool all_sel_this =
true;
584 for (
int j = 0;
j < NFLAGS; ++
j) {
587 if (j < 6 && !muon_sel[j])
588 rec_sel_this =
false;
589 if (j < 7 && !muon_sel[j])
590 iso_sel_this =
false;
591 if (j < 8 && !muon_sel[j])
592 hlt_sel_this =
false;
593 if (j < 11 && !muon_sel[j])
594 met_sel_this =
false;
596 all_sel_this =
false;
616 if (flags_passed >= (NFLAGS - 1)) {
617 if (!muon_sel[0] || flags_passed == NFLAGS)
619 if (!muon_sel[1] || flags_passed == NFLAGS)
621 if (!muon_sel[2] || flags_passed == NFLAGS)
623 if (!muon_sel[3] || flags_passed == NFLAGS) {
627 if (!muon_sel[4] || flags_passed == NFLAGS)
629 if (!muon_sel[5] || flags_passed == NFLAGS)
631 if (!muon_sel[6] || flags_passed == NFLAGS)
633 if (!muon_sel[7] || flags_passed == NFLAGS) {
634 if (!hlt_hist_done) {
636 hlt_hist_done =
true;
639 if (!muon_sel[8] || flags_passed == NFLAGS)
641 if (!muon_sel[9] || flags_passed == NFLAGS) {
642 if (!met_hist_done) {
644 met_hist_done =
true;
647 if (!muon_sel[10] || flags_passed == NFLAGS)
649 if (!muon_sel[11] || flags_passed == NFLAGS) {
650 if (!nz1_hist_done) {
652 nz1_hist_done =
true;
655 if (!muon_sel[11] || flags_passed == NFLAGS) {
656 if (!nz2_hist_done) {
658 nz2_hist_done =
true;
661 if (!muon_sel[12] || flags_passed == NFLAGS) {
662 if (!njets_hist_done) {
664 njets_hist_done =
true;
685 LogTrace(
"") <<
">>>> Event ACCEPTED";
687 LogTrace(
"") <<
">>>> Event REJECTED";
double eta() const final
momentum pseudorapidity
float sumPt
sum-pt of tracks
virtual TrackRef innerTrack() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< std::string, TH1D * > h1_
double px() const final
x coordinate of momentum vector
bool accept() const
Has at least one path accepted the event?
T1 value() const
Explicit access to value in case implicit conversion not OK.
double pt() const final
transverse momentum
edm::EDGetTokenT< edm::View< reco::MET > > metToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool isTrackerMuon() const override
#define DEFINE_FWK_MODULE(type)
unsigned int triggerIndex(std::string const &name) const
edm::EDGetTokenT< edm::View< reco::Jet > > jetToken_
double et() const final
transverse energy
bool isGlobalMuon() const override
edm::EDGetTokenT< edm::View< reco::Muon > > muonToken_
WMuNuValidator(const edm::ParameterSet &)
double normalizedChi2Cut_
T * make(const Args &...args) const
make new ROOT object
static std::string const triggerResults
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
bool filter(edm::Event &, const edm::EventSetup &) override
bool isNull() const
Checks for null.
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
edm::EDGetTokenT< edm::TriggerResults > trigToken_
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
double py() const final
y coordinate of momentum vector
char data[epos_bytes_allocation]
void fill_histogram(const char *, const double &)
const Point & position() const
position
const std::string muonTrig_
double phi() const final
momentum azimuthal angle
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
const MuonIsolation & isolationR03() const
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector