15 #include <TLorentzVector.h>
25 : fHLTObjTag(iConfig.getParameter<
edm::
InputTag>(
"TriggerEvent")),
26 fHLTTag(iConfig.getParameter<
edm::
InputTag>(
"TriggerResults")),
27 fPVName(iConfig.getUntrackedParameter<
std::
string>(
"edmPVName",
"offlinePrimaryVertices")),
28 fMuonName(iConfig.getUntrackedParameter<
std::
string>(
"edmName",
"muons")),
29 fTrackName(iConfig.getUntrackedParameter<
std::
string>(
"edmTrackName",
"generalTracks")),
32 fElectronName(iConfig.getUntrackedParameter<
std::
string>(
"edmGsfEleName",
"gedGsfElectrons")),
33 fSCName(iConfig.getUntrackedParameter<
std::
string>(
"edmSCName",
"particleFlowEGamma")),
36 fRhoTag(iConfig.getParameter<
edm::
InputTag>(
"rhoname")),
37 fBeamspotTag(iConfig.getParameter<
edm::
InputTag>(
"beamspotName")),
38 fConversionTag(iConfig.getParameter<
edm::
InputTag>(
"conversionsName")),
41 ELE_PT_CUT_TAG(iConfig.getUntrackedParameter<double>(
"PtCutEleTag")),
42 ELE_PT_CUT_PROBE(iConfig.getUntrackedParameter<double>(
"PtCutEleProbe")),
43 ELE_ETA_CUT_TAG(iConfig.getUntrackedParameter<double>(
"EtaCutEleTag")),
44 ELE_ETA_CUT_PROBE(iConfig.getUntrackedParameter<double>(
"EtaCutEleProbe")),
46 ELE_MASS_CUT_LOW(iConfig.getUntrackedParameter<double>(
"MassCutEleLow")),
47 ELE_MASS_CUT_HIGH(iConfig.getUntrackedParameter<double>(
"MassCutEleHigh")),
49 ELE_ID_WP(iConfig.getUntrackedParameter<
std::
string>(
"ElectronIDType",
"TIGHT")),
51 edm::LogInfo(
"ZCounting") <<
"Constructor ZCounting::ZCounting " << std::endl;
64 edm::LogError(
"ZCounting") <<
"List of MuonTriggerNames and MuonTriggerObjectNames has to be the same length"
130 edm::LogInfo(
"ZCounting") <<
"ZCounting::beginRun" << std::endl;
139 edm::LogInfo(
"ZCounting") <<
"ZCounting::bookHistograms" << std::endl;
145 "Muon HLT passing probes central",
153 "Muon HLT passing probes forward",
161 "Muon HLT failing probes central",
169 "Muon HLT failing probes forward",
178 "Muon SIT passing probes central",
186 "Muon SIT passing probes forward",
194 "Muon SIT_failing probes central",
202 "Muon SIT failing probes forward",
211 "Muon Glo passing probes central",
219 "Muon Glo passing probes forward",
227 "Muon Glo failing probes central",
235 "Muon Glo failing probes forward",
309 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyze" << std::endl;
315 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyzeMuons" << std::endl;
321 if (!hVertexProduct.
isValid()) {
322 edm::LogWarning(
"ZCounting") <<
"ZCounting::analyzeMuons - no valid primary vertex product found" << std::endl;
329 for (
auto const& itVtx : *hVertexProduct) {
365 bool config_changed =
false;
368 config_changed =
true;
370 if (config_changed) {
375 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
376 if (
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
379 triggerBits[
fTrigger->fRecords[irec].baconTrigBit] =
true;
401 TLorentzVector vTag(0., 0., 0., 0.);
402 TLorentzVector vProbe(0., 0., 0., 0.);
403 TLorentzVector vTrack(0., 0., 0., 0.);
406 for (
auto const& itMu1 : *hMuonProduct) {
407 float pt1 = itMu1.muonBestTrack()->pt();
408 float eta1 = itMu1.muonBestTrack()->eta();
409 float phi1 = itMu1.muonBestTrack()->phi();
410 float q1 = itMu1.muonBestTrack()->charge();
425 for (
auto const& itMu2 : *hMuonProduct) {
426 if (&itMu2 == &itMu1)
429 float pt2 = itMu2.muonBestTrack()->pt();
430 float eta2 = itMu2.muonBestTrack()->eta();
431 float phi2 = itMu2.muonBestTrack()->phi();
432 float q2 = itMu2.muonBestTrack()->charge();
445 TLorentzVector vDilep = vTag + vProbe;
446 float dilepMass = vDilep.M();
450 bool isTagCentral =
false;
451 bool isProbeCentral =
false;
455 isProbeCentral =
true;
475 if (isProbeCentral) {
487 if (isProbeCentral) {
500 if (isTagCentral && isProbeCentral)
502 else if (!isTagCentral && !isProbeCentral)
504 }
else if (itMu2.isGlobalMuon()) {
506 if (isProbeCentral) {
513 }
else if (itMu2.isStandAloneMuon()) {
515 if (isProbeCentral) {
520 }
else if (itMu2.innerTrack()->hitPattern().trackerLayersWithMeasurement() >= 6 &&
521 itMu2.innerTrack()->hitPattern().numberOfValidPixelHits() >= 1) {
523 if (isProbeCentral) {
533 for (
auto const& itTrk : *hTrackProduct) {
536 for (
auto const& itMu : *hMuonProduct) {
537 if (itMu.innerTrack().isNonnull() && itMu.innerTrack().get() == &itTrk) {
545 float pt2 = itTrk.pt();
546 float eta2 = itTrk.eta();
547 float phi2 = itTrk.phi();
548 float q2 = itTrk.charge();
560 TLorentzVector vDilep = vTag + vTrack;
561 float dilepMass = vDilep.M();
565 bool isTrackCentral =
false;
567 isTrackCentral =
true;
569 if (itTrk.hitPattern().trackerLayersWithMeasurement() >= 6 && itTrk.hitPattern().numberOfValidPixelHits() >= 1) {
581 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyzeElectrons" << std::endl;
594 for (
auto const&
vtx : *pvCol) {
625 Bool_t config_changed =
false;
628 config_changed =
true;
630 if (config_changed) {
635 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
636 if (
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
639 triggerBits[
fTrigger->fRecords[irec].baconTrigBit] =
true;
669 enum { eEleEle2HLT = 1, eEleEle1HLT1L1, eEleEle1HLT, eEleEleNoSel, eEleSC };
672 for (
size_t itag = 0; itag <
electrons->size(); ++itag) {
674 if (not
EleID_.
passID(el1, beamspotHandle, conversionsHandle))
677 float pt1 = el1->pt();
678 float eta1 = el1->eta();
679 float phi1 = el1->phi();
683 TLorentzVector vTag(0., 0., 0., 0.);
687 double tag_pt = vTag.Pt();
688 double tag_abseta = fabs(vTag.Eta());
693 if (not(tag_is_valid_tag
or tag_is_valid_probe))
697 for (
size_t iprobe = 0; iprobe < superclusters->size(); ++iprobe) {
699 const auto sc = superclusters->ptrAt(iprobe);
700 if (*sc == *(el1->superCluster())) {
705 for (
size_t iele = 0; iele <
electrons->size(); ++iele) {
709 if (*sc == *(ele->superCluster())) {
716 TLorentzVector vProbe(0., 0., 0., 0.);
720 double pt = sc->energy() *
sqrt(1 -
pow(tanh(sc->eta()), 2));
725 double probe_pt = vProbe.Pt();
726 double probe_abseta = fabs(sc->eta());
728 if (!probe_is_valid_probe)
734 TLorentzVector vDilep = vTag + vProbe;
745 *
fTrigger, TriggerTools::matchHLT(vProbe.Eta(), vProbe.Phi(),
fTrigger->fRecords, *hTrgEvt));
746 bool probe_pass_id = eleProbe.
isNonnull() and
EleID_.
passID(eleProbe, beamspotHandle, conversionsHandle);
753 if (probe_is_forward and tag_is_forward) {
755 }
else if (!probe_is_forward and !tag_is_forward) {
762 if (!tag_is_valid_tag)
767 if (probe_is_forward) {
773 if (probe_is_forward) {
781 if (probe_pass_id and probe_pass_trigger) {
782 if (probe_is_forward) {
787 }
else if (probe_pass_id) {
788 if (probe_is_forward) {
821 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
822 fTrigger->fRecords[irec].hltPathName =
"";
823 fTrigger->fRecords[irec].hltPathIndex = (
unsigned int)-1;
826 std::vector<std::vector<std::string>::const_iterator>
matches =
877 else if (idType ==
NoneID)
889 else if (isoType ==
PFIso &&
890 muon.pfIsolationR04().sumChargedHadronPt +
892 muon.pfIsolationR04().sumNeutralHadronEt +
muon.pfIsolationR04().sumPhotonEt -
893 0.5 *
muon.pfIsolationR04().sumPUPt) <
904 return triggerMenu.
pass(
"HLT_Ele35_WPTight_Gsf_v*", hltBits);
908 return triggerMenu.
passObj(
"HLT_Ele35_WPTight_Gsf_v*",
"hltEle35noerWPTightGsfTrackIsoFilter", hltMatchBits);