52 return (j1.
id() < j2.
id()) || ((j1.
id() == j2.
id()) && (j1.
key() < j2.
key()));
241 : folderName_(iConfig.getParameter<
std::
string>(
"FolderName")),
242 requireValidHLTPaths_(iConfig.getParameter<
bool>(
"requireValidHLTPaths")),
243 hltPathsAreValid_(
false),
247 elecIDToken_(consumes<
edm::ValueMap<
bool> >(iConfig.getParameter<
edm::
InputTag>(
"elecID"))),
253 metToken_(consumes<reco::PFMETCollection>(iConfig.getParameter<
edm::InputTag>(
"met"))),
254 met_binning_(getHistoPSet(
258 phi_binning_(getHistoPSet(
262 eta_binning_(getHistoPSet(
268 csv_binning_(getHistoPSet(
270 invMass_mumu_binning_(getHistoPSet(
272 MHT_binning_(getHistoPSet(
274 met_variable_binning_(
276 HT_variable_binning_(
278 jetPt_variable_binning_(
280 muPt_variable_binning_(
282 elePt_variable_binning_(
284 jetEta_variable_binning_(
286 muEta_variable_binning_(
288 eleEta_variable_binning_(
290 invMass_mumu_variable_binning_(iConfig.getParameter<
edm::ParameterSet>(
"histoPSet")
291 .
getParameter<std::vector<double> >(
"invMassVariableBinning")),
292 MHT_variable_binning_(
294 HT_variable_binning_2D_(
296 jetPt_variable_binning_2D_(
298 muPt_variable_binning_2D_(
300 elePt_variable_binning_2D_(
302 phoPt_variable_binning_2D_(
304 jetEta_variable_binning_2D_(
306 muEta_variable_binning_2D_(
308 eleEta_variable_binning_2D_(
310 phoEta_variable_binning_2D_(
312 phi_variable_binning_2D_(
315 iConfig.getParameter<
edm::ParameterSet>(
"numGenericTriggerEventPSet"), consumesCollector(), *
this)),
317 iConfig.getParameter<
edm::ParameterSet>(
"denGenericTriggerEventPSet"), consumesCollector(), *
this)),
318 metSelection_(iConfig.getParameter<
std::string>(
"metSelection")),
319 jetSelection_(iConfig.getParameter<
std::string>(
"jetSelection")),
320 eleSelection_(iConfig.getParameter<
std::string>(
"eleSelection")),
321 muoSelection_(iConfig.getParameter<
std::string>(
"muoSelection")),
322 phoSelection_(iConfig.getParameter<
std::string>(
"phoSelection")),
323 HTdefinition_(iConfig.getParameter<
std::string>(
"HTdefinition")),
324 vtxSelection_(iConfig.getParameter<
std::string>(
"vertexSelection")),
325 bjetSelection_(iConfig.getParameter<
std::string>(
"bjetSelection")),
326 njets_(iConfig.getParameter<
unsigned int>(
"njets")),
327 nelectrons_(iConfig.getParameter<
unsigned int>(
"nelectrons")),
328 nmuons_(iConfig.getParameter<
unsigned int>(
"nmuons")),
329 nphotons_(iConfig.getParameter<
unsigned int>(
"nphotons")),
330 leptJetDeltaRmin_(iConfig.getParameter<
double>(
"leptJetDeltaRmin")),
331 bJetMuDeltaRmax_(iConfig.getParameter<
double>(
"bJetMuDeltaRmax")),
332 bJetDeltaEtaMax_(iConfig.getParameter<
double>(
"bJetDeltaEtaMax")),
333 HTcut_(iConfig.getParameter<
double>(
"HTcut")),
334 nbjets_(iConfig.getParameter<
unsigned int>(
"nbjets")),
335 workingpoint_(iConfig.getParameter<
double>(
"workingpoint")),
336 applyLeptonPVcuts_(iConfig.getParameter<
bool>(
"applyLeptonPVcuts")),
337 invMassUppercut_(iConfig.getParameter<
double>(
"invMassUppercut")),
338 invMassLowercut_(iConfig.getParameter<
double>(
"invMassLowercut")),
339 opsign_(iConfig.getParameter<
bool>(
"oppositeSignMuons")),
340 MHTdefinition_(iConfig.getParameter<
std::string>(
"MHTdefinition")),
341 MHTcut_(iConfig.getParameter<
double>(
"MHTcut")),
342 invMassCutInAllMuPairs_(iConfig.getParameter<
bool>(
"invMassCutInAllMuPairs")),
343 enablePhotonPlot_(iConfig.getParameter<
bool>(
"enablePhotonPlot")),
344 enableMETPlot_(iConfig.getParameter<
bool>(
"enableMETPlot")) {
347 muPhi_ = std::vector<ObjME>(nmuons_,
empty);
348 muEta_ = std::vector<ObjME>(nmuons_,
empty);
349 muPt_ = std::vector<ObjME>(nmuons_,
empty);
350 muEta_variableBinning_ = std::vector<ObjME>(nmuons_,
empty);
351 muPt_variableBinning_ = std::vector<ObjME>(nmuons_,
empty);
352 muPtEta_ = std::vector<ObjME>(nmuons_,
empty);
353 muEtaPhi_ = std::vector<ObjME>(nmuons_,
empty);
355 elePhi_ = std::vector<ObjME>(nelectrons_,
empty);
356 eleEta_ = std::vector<ObjME>(nelectrons_,
empty);
357 elePt_ = std::vector<ObjME>(nelectrons_,
empty);
358 eleEta_variableBinning_ = std::vector<ObjME>(nelectrons_,
empty);
359 elePt_variableBinning_ = std::vector<ObjME>(nelectrons_,
empty);
360 elePtEta_ = std::vector<ObjME>(nelectrons_,
empty);
361 eleEtaPhi_ = std::vector<ObjME>(nelectrons_,
empty);
363 jetPhi_ = std::vector<ObjME>(njets_,
empty);
364 jetEta_ = std::vector<ObjME>(njets_,
empty);
365 jetPt_ = std::vector<ObjME>(njets_,
empty);
366 jetEta_variableBinning_ = std::vector<ObjME>(njets_,
empty);
367 jetPt_variableBinning_ = std::vector<ObjME>(njets_,
empty);
368 jetPtEta_ = std::vector<ObjME>(njets_,
empty);
369 jetEtaPhi_ = std::vector<ObjME>(njets_,
empty);
372 phoPhi_ = std::vector<ObjME>(nphotons_,
empty);
373 phoEta_ = std::vector<ObjME>(nphotons_,
empty);
374 phoPt_ = std::vector<ObjME>(nphotons_,
empty);
375 phoPtEta_ = std::vector<ObjME>(nphotons_,
empty);
376 phoEtaPhi_ = std::vector<ObjME>(nphotons_,
empty);
379 bjetPhi_ = std::vector<ObjME>(nbjets_,
empty);
380 bjetEta_ = std::vector<ObjME>(nbjets_,
empty);
381 bjetPt_ = std::vector<ObjME>(nbjets_,
empty);
382 bjetCSV_ = std::vector<ObjME>(nbjets_,
empty);
383 bjetEta_variableBinning_ = std::vector<ObjME>(nbjets_,
empty);
384 bjetPt_variableBinning_ = std::vector<ObjME>(nbjets_,
empty);
385 bjetPtEta_ = std::vector<ObjME>(nbjets_,
empty);
386 bjetEtaPhi_ = std::vector<ObjME>(nbjets_,
empty);
387 bjetCSVHT_ = std::vector<ObjME>(nbjets_,
empty);
389 lepPVcuts_.dxy = (iConfig.getParameter<
edm::ParameterSet>(
"leptonPVcuts")).getParameter<
double>(
"dxy");
390 lepPVcuts_.dz = (iConfig.getParameter<
edm::ParameterSet>(
"leptonPVcuts")).getParameter<
double>(
"dz");
430 histtitle =
"PFMET phi";
434 histname =
"met_variable";
439 histname =
"metVsLS";
440 histtitle =
"PFMET vs LS";
454 histname =
"jetVsLS";
455 histtitle =
"jet pt vs LS";
467 histname =
"jetEtaPhi_HEP17";
468 histtitle =
"jet #eta-#phi for HEP17";
472 histname =
"jetMulti";
473 histtitle =
"jet multiplicity";
480 histtitle =
"muon pt vs LS";
492 histname =
"muMulti";
493 histtitle =
"muon multiplicity";
498 histname =
"DeltaR_jet_Mu";
499 histtitle =
"#DeltaR(jet,mu)";
506 histname =
"eleVsLS";
507 histtitle =
"electron pt vs LS";
519 histname =
"eleMulti";
520 histtitle =
"electron multiplicity";
525 histname =
"elePt_jetPt";
526 histtitle =
"electron pt vs jet pt";
532 histname =
"elePt_muPt";
533 histtitle =
"electron pt vs muon pt";
537 histname =
"eleEta_muEta";
538 histtitle =
"electron #eta vs muon #eta";
547 histname =
"photonVsLS";
548 histtitle =
"photon pt vs LS";
564 histname =
"bjetVsLS";
565 histtitle =
"b-jet pt vs LS";
577 histname =
"bjetMulti";
578 histtitle =
"b-jet multiplicity";
584 histname =
"ele1Pt_ele2Pt";
585 histtitle =
"electron-1 pt vs electron-2 pt";
589 histname =
"ele1Eta_ele2Eta";
590 histtitle =
"electron-1 #eta vs electron-2 #eta";
596 histname =
"mu1Pt_mu2Pt";
597 histtitle =
"muon-1 pt vs muon-2 pt";
601 histname =
"mu1Eta_mu2Eta";
602 histtitle =
"muon-1 #eta vs muon-2 #eta";
606 histname =
"invMass";
607 histtitle =
"M mu1 mu2";
616 histname =
"invMass_variable";
617 histtitle =
"M mu1 mu2 variable";
624 histtitle =
"event HT vs LS";
636 histname =
"eventHT";
637 histtitle =
"event HT";
640 histname.append(
"_variableBinning");
645 histname =
"elePt_eventHT";
646 histtitle =
"electron pt vs event HT";
654 histname =
"eventMHT";
655 histtitle =
"event MHT";
659 histname =
"eventMHT_variable";
660 histtitle =
"event MHT variable";
668 histname =
"muPt_phoPt", histtitle =
"muon pt vs photon pt";
672 histname =
"muEta_phoEta", histtitle =
"muon #eta vs photon #eta";
678 for (
unsigned int iMu = 0; iMu <
nmuons_; ++iMu) {
682 histtitle =
"muon p_{T} - ";
683 histname.append(
index);
684 histtitle.append(
index);
687 histname.append(
"_variableBinning");
692 histtitle =
"muon #eta - ";
693 histname.append(
index);
694 histtitle.append(
index);
697 histname.append(
"_variableBinning");
702 histtitle =
"muon #phi - ";
703 histname.append(
index);
704 histtitle.append(
index);
708 histname =
"muPtEta_";
709 histtitle =
"muon p_{T} - #eta - ";
710 histname.append(
index);
711 histtitle.append(
index);
715 histname =
"muEtaPhi_";
716 histtitle =
"muon #eta - #phi - ";
717 histname.append(
index);
718 histtitle.append(
index);
723 for (
unsigned int iEle = 0; iEle <
nelectrons_; ++iEle) {
727 histtitle =
"electron p_{T} - ";
728 histname.append(
index);
729 histtitle.append(
index);
732 histname.append(
"_variableBinning");
736 histname =
"eleEta_";
737 histtitle =
"electron #eta - ";
738 histname.append(
index);
739 histtitle.append(
index);
742 histname.append(
"_variableBinning");
746 histname =
"elePhi_";
747 histtitle =
"electron #phi - ";
748 histname.append(
index);
749 histtitle.append(
index);
753 histname =
"elePtEta_";
754 histtitle =
"electron p_{T} - #eta - ";
755 histname.append(
index);
756 histtitle.append(
index);
760 histname =
"eleEtaPhi_";
761 histtitle =
"electron #eta - #phi - ";
762 histname.append(
index);
763 histtitle.append(
index);
770 for (
unsigned int iPho(0); iPho <
nphotons_; iPho++) {
774 histtitle =
"photon p_{T} - ";
775 histname.append(
index);
776 histtitle.append(
index);
780 histname =
"phoEta_";
781 histtitle =
"photon #eta - ";
782 histname.append(
index);
783 histtitle.append(
index);
787 histname =
"phoPhi_";
788 histtitle =
"photon #phi - ";
789 histname.append(
index);
790 histtitle.append(
index);
794 histname =
"phoPtEta_";
795 histtitle =
"photon p_{T} - #eta - ";
796 histname.append(
index);
797 histtitle.append(
index);
801 histname =
"phoEtaPhi_";
802 histtitle =
"photon #eta - #phi - ";
803 histname.append(
index);
804 histtitle.append(
index);
810 for (
unsigned int iJet = 0; iJet <
njets_; ++iJet) {
814 histtitle =
"jet p_{T} - ";
815 histname.append(
index);
816 histtitle.append(
index);
819 histname.append(
"_variableBinning");
823 histname =
"jetEta_";
824 histtitle =
"jet #eta - ";
825 histname.append(
index);
826 histtitle.append(
index);
829 histname.append(
"_variableBinning");
833 histname =
"jetPhi_";
834 histtitle =
"jet #phi - ";
835 histname.append(
index);
836 histtitle.append(
index);
840 histname =
"jetPtEta_";
841 histtitle =
"jet p_{T} - #eta - ";
842 histname.append(
index);
843 histtitle.append(
index);
847 histname =
"jetEtaPhi_";
848 histtitle =
"jet #eta - #phi - ";
849 histname.append(
index);
850 histtitle.append(
index);
856 for (
unsigned int iBJet = 0; iBJet <
nbjets_; ++iBJet) {
859 histname =
"bjetPt_";
860 histtitle =
"b-jet p_{T} - ";
861 histname.append(
index);
862 histtitle.append(
index);
865 histname.append(
"_variableBinning");
869 histname =
"bjetEta_";
870 histtitle =
"b-jet #eta - ";
871 histname.append(
index);
872 histtitle.append(
index);
875 histname.append(
"_variableBinning");
879 histname =
"bjetPhi_";
880 histtitle =
"b-jet #phi - ";
881 histname.append(
index);
882 histtitle.append(
index);
886 histname =
"bjetCSV_";
887 histtitle =
"b-jet CSV - ";
888 histname.append(
index);
889 histtitle.append(
index);
893 histname =
"bjetPtEta_";
894 histtitle =
"b-jet p_{T} - #eta - ";
895 histname.append(
index);
896 histtitle.append(
index);
900 histname =
"bjetEtaPhi_";
901 histtitle =
"b-jet #eta - #phi - ";
902 histname.append(
index);
903 histtitle.append(
index);
907 histname =
"bjetCSVHT_";
908 histtitle =
"HT - b-jet CSV - ";
909 histname.append(
index);
910 histtitle.append(
index);
949 edm::LogWarning(
"TopMonitor") <<
"Invalid handle to reco::VertexCollection, event will be skipped";
961 double met_phi(-99.);
971 met_phi = pfmet.
phi();
988 std::vector<reco::GsfElectron>
electrons;
995 const auto e = eleHandle->at(
index);
996 const auto el = eleHandle->ptrAt(
index);
998 bool pass_id = (*eleIDHandle)[el];
1022 if (muoHandle->size() <
nmuons_) {
1026 std::vector<reco::Muon>
muons;
1028 for (
auto const&
m : *muoHandle) {
1034 (std::fabs(
m.muonBestTrack()->dz(
pv->position())) >=
lepPVcuts_.
dz))) {
1066 std::vector<reco::Photon>
photons;
1067 for (
auto const&
p : *phoHandle) {
1085 std::vector<reco::PFJet>
jets;
1087 if (jetHandle->size() <
njets_)
1089 for (
auto const&
j : *jetHandle) {
1097 bool isJetOverlappedWithLepton =
false;
1099 for (
auto const&
m :
muons) {
1101 isJetOverlappedWithLepton =
true;
1106 if (isJetOverlappedWithLepton)
1111 isJetOverlappedWithLepton =
true;
1116 if (isJetOverlappedWithLepton)
1133 bool allpairs =
false;
1137 for (
unsigned int idx2 =
idx + 1; idx2 <
muons.size(); idx2++) {
1139 mumu_mass = (
muons[idx2].p4() +
muons[idx2].p4()).M();
1159 iEvent.getByToken(jetTagToken, bjetHandle);
1160 if (not bjetHandle.
isValid()) {
1161 edm::LogWarning(
"TopMonitor") <<
"B-Jet handle not valid, will skip event \n";
1167 for (
const auto& i_jetTag :
bTags) {
1168 const auto& jetRef = i_jetTag.first;
1170 if (not
bjetSelection_(*dynamic_cast<const reco::Jet*>(jetRef.get()))) {
1174 const auto btagVal = i_jetTag.second;
1176 if (not std::isfinite(btagVal)) {
1180 if (allJetBTagVals.find(jetRef) != allJetBTagVals.end()) {
1181 allJetBTagVals.at(jetRef) += btagVal;
1188 for (
const auto& jetBTagVal : allJetBTagVals) {
1208 bool foundMuonInsideJet =
false;
1209 for (
auto const& bjet : bjets) {
1210 for (
auto const&
mu :
muons) {
1213 foundMuonInsideJet =
true;
1217 if (foundMuonInsideJet)
1221 if (!foundMuonInsideJet)
1225 const int ls =
iEvent.id().luminosityBlock();
1304 for (
unsigned int iMu = 0; iMu <
muons.size(); ++iMu) {
1307 muPhi_.at(iMu).fill(trg_passed,
muons.at(iMu).phi());
1308 muEta_.at(iMu).fill(trg_passed,
muons.at(iMu).eta());
1309 muPt_.at(iMu).fill(trg_passed,
muons.at(iMu).pt());
1315 for (
unsigned int iEle = 0; iEle <
electrons.size(); ++iEle) {
1328 for (
unsigned int iPho = 0; iPho <
photons.size(); ++iPho) {
1339 for (
unsigned int iJet = 0; iJet <
jets.size(); ++iJet) {
1342 jetPhi_.at(iJet).fill(trg_passed,
jets.at(iJet).phi());
1343 jetEta_.at(iJet).fill(trg_passed,
jets.at(iJet).eta());
1344 jetPt_.at(iJet).fill(trg_passed,
jets.at(iJet).pt());
1352 unsigned int iBJet = 0;
1353 for (
auto& bjet : bjets) {
1357 bjetPhi_.at(iBJet).fill(trg_passed, bjet.first->phi());
1358 bjetEta_.at(iBJet).fill(trg_passed, bjet.first->eta());
1359 bjetPt_.at(iBJet).fill(trg_passed, bjet.first->pt());
1360 bjetCSV_.at(iBJet).fill(trg_passed, std::fmax(0.0, bjet.second));
1363 bjetPtEta_.at(iBJet).fill(trg_passed, bjet.first->pt(), bjet.first->eta());
1364 bjetEtaPhi_.at(iBJet).fill(trg_passed, bjet.first->eta(), bjet.first->phi());
1365 bjetCSVHT_.at(iBJet).fill(trg_passed, std::fmax(0.0, bjet.second), eventHT);
1375 desc.add<
bool>(
"requireValidHLTPaths",
true);
1383 desc.add<std::vector<edm::InputTag> >(
1395 desc.add<
unsigned int>(
"njets", 0);
1396 desc.add<
unsigned int>(
"nelectrons", 0);
1397 desc.add<
unsigned int>(
"nmuons", 0);
1398 desc.add<
unsigned int>(
"nphotons", 0);
1399 desc.add<
double>(
"leptJetDeltaRmin", 0);
1400 desc.add<
double>(
"bJetMuDeltaRmax", 9999.);
1401 desc.add<
double>(
"bJetDeltaEtaMax", 9999.);
1402 desc.add<
double>(
"HTcut", 0);
1404 desc.add<
unsigned int>(
"nbjets", 0);
1405 desc.add<
double>(
"workingpoint", 0.4941);
1406 desc.add<
bool>(
"applyLeptonPVcuts",
false);
1407 desc.add<
double>(
"invMassUppercut", -1.0);
1408 desc.add<
double>(
"invMassLowercut", -1.0);
1409 desc.add<
bool>(
"oppositeSignMuons",
false);
1411 desc.add<
double>(
"MHTcut", -1);
1412 desc.add<
bool>(
"invMassCutInAllMuPairs",
false);
1413 desc.add<
bool>(
"enablePhotonPlot",
false);
1414 desc.add<
bool>(
"enableMETPlot",
false);
1462 std::vector<double>
bins = {0., 20., 40., 60., 80., 90., 100., 110., 120., 130., 140., 150., 160.,
1463 170., 180., 190., 200., 220., 240., 260., 280., 300., 350., 400., 450., 1000.};
1464 std::vector<double> eta_bins = {-3., -2.5, -2., -1.5, -1., -.5, 0., .5, 1., 1.5, 2., 2.5, 3.};
1470 histoPSet.add<std::vector<double> >(
"jetEtaBinning", eta_bins);
1471 histoPSet.add<std::vector<double> >(
"eleEtaBinning", eta_bins);
1472 histoPSet.add<std::vector<double> >(
"muEtaBinning", eta_bins);
1473 histoPSet.add<std::vector<double> >(
"invMassVariableBinning",
bins);
1474 histoPSet.add<std::vector<double> >(
"MHTVariableBinning",
bins);
1476 std::vector<double> bins_2D = {0., 40., 80., 100., 120., 140., 160., 180., 200., 240., 280., 350., 450., 1000.};
1477 std::vector<double> eta_bins_2D = {-3., -2., -1., 0., 1., 2., 3.};
1478 std::vector<double> phi_bins_2D = {
1479 -3.1415, -2.5132, -1.8849, -1.2566, -0.6283, 0, 0.6283, 1.2566, 1.8849, 2.5132, 3.1415};
1480 histoPSet.add<std::vector<double> >(
"HTBinning2D", bins_2D);
1481 histoPSet.add<std::vector<double> >(
"jetPtBinning2D", bins_2D);
1482 histoPSet.add<std::vector<double> >(
"elePtBinning2D", bins_2D);
1483 histoPSet.add<std::vector<double> >(
"muPtBinning2D", bins_2D);
1484 histoPSet.add<std::vector<double> >(
"phoPtBinning2D", bins_2D);
1485 histoPSet.add<std::vector<double> >(
"jetEtaBinning2D", eta_bins_2D);
1486 histoPSet.add<std::vector<double> >(
"eleEtaBinning2D", eta_bins_2D);
1487 histoPSet.add<std::vector<double> >(
"muEtaBinning2D", eta_bins_2D);
1488 histoPSet.add<std::vector<double> >(
"phoEtaBinning2D", eta_bins_2D);
1489 histoPSet.add<std::vector<double> >(
"phiBinning2D", phi_bins_2D);
1498 lPVcutPSet.
add<
double>(
"dxy", 9999.);
1499 lPVcutPSet.add<
double>(
"dz", 9999.);
1502 descriptions.
add(
"topMonitoring",
desc);