15 #include <TLorentzVector.h>
27 : fHLTObjTag(iConfig.getParameter<
edm::
InputTag>(
"TriggerEvent")),
28 fHLTTag(iConfig.getParameter<
edm::
InputTag>(
"TriggerResults")),
29 fPVName(iConfig.getUntrackedParameter<
std::
string>(
"edmPVName",
"offlinePrimaryVertices")),
30 fMuonName(iConfig.getUntrackedParameter<
std::
string>(
"edmName",
"muons")),
31 fTrackName(iConfig.getUntrackedParameter<
std::
string>(
"edmTrackName",
"generalTracks")),
34 fElectronName(iConfig.getUntrackedParameter<
std::
string>(
"edmGsfEleName",
"gedGsfElectrons")),
35 fSCName(iConfig.getUntrackedParameter<
std::
string>(
"edmSCName",
"particleFlowEGamma")),
38 fRhoTag(iConfig.getParameter<
edm::
InputTag>(
"rhoname")),
39 fBeamspotTag(iConfig.getParameter<
edm::
InputTag>(
"beamspotName")),
40 fConversionTag(iConfig.getParameter<
edm::
InputTag>(
"conversionsName")),
43 ELE_PT_CUT_TAG(iConfig.getUntrackedParameter<double>(
"PtCutEleTag")),
44 ELE_PT_CUT_PROBE(iConfig.getUntrackedParameter<double>(
"PtCutEleProbe")),
45 ELE_ETA_CUT_TAG(iConfig.getUntrackedParameter<double>(
"EtaCutEleTag")),
46 ELE_ETA_CUT_PROBE(iConfig.getUntrackedParameter<double>(
"EtaCutEleProbe")),
48 ELE_MASS_CUT_LOW(iConfig.getUntrackedParameter<double>(
"MassCutEleLow")),
49 ELE_MASS_CUT_HIGH(iConfig.getUntrackedParameter<double>(
"MassCutEleHigh")),
51 ELE_ID_WP(iConfig.getUntrackedParameter<
std::
string>(
"ElectronIDType",
"TIGHT")),
53 edm::LogInfo(
"ZCounting") <<
"Constructor ZCounting::ZCounting " << std::endl;
66 edm::LogError(
"ZCounting") <<
"List of MuonTriggerNames and MuonTriggerObjectNames has to be the same length"
132 edm::LogInfo(
"ZCounting") <<
"ZCounting::beginRun" << std::endl;
141 edm::LogInfo(
"ZCounting") <<
"ZCounting::bookHistograms" << std::endl;
147 "Muon HLT passing probes central",
155 "Muon HLT passing probes forward",
163 "Muon HLT failing probes central",
171 "Muon HLT failing probes forward",
180 "Muon SIT passing probes central",
188 "Muon SIT passing probes forward",
196 "Muon SIT_failing probes central",
204 "Muon SIT failing probes forward",
213 "Muon Glo passing probes central",
221 "Muon Glo passing probes forward",
229 "Muon Glo failing probes central",
237 "Muon Glo failing probes forward",
311 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyze" << std::endl;
317 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyzeMuons" << std::endl;
323 if (!hVertexProduct.
isValid()) {
324 edm::LogWarning(
"ZCounting") <<
"ZCounting::analyzeMuons - no valid primary vertex product found" << std::endl;
331 for (
auto const& itVtx : *hVertexProduct) {
367 bool config_changed =
false;
370 config_changed =
true;
372 if (config_changed) {
377 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
378 if (
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
381 triggerBits[
fTrigger->fRecords[irec].baconTrigBit] =
true;
403 TLorentzVector vTag(0., 0., 0., 0.);
404 TLorentzVector vProbe(0., 0., 0., 0.);
405 TLorentzVector vTrack(0., 0., 0., 0.);
408 for (
auto const& itMu1 : *hMuonProduct) {
409 float pt1 = itMu1.muonBestTrack()->pt();
410 float eta1 = itMu1.muonBestTrack()->eta();
411 float phi1 = itMu1.muonBestTrack()->phi();
412 float q1 = itMu1.muonBestTrack()->charge();
427 for (
auto const& itMu2 : *hMuonProduct) {
428 if (&itMu2 == &itMu1)
431 float pt2 = itMu2.muonBestTrack()->pt();
432 float eta2 = itMu2.muonBestTrack()->eta();
433 float phi2 = itMu2.muonBestTrack()->phi();
434 float q2 = itMu2.muonBestTrack()->charge();
447 TLorentzVector vDilep = vTag + vProbe;
448 float dilepMass = vDilep.M();
452 bool isTagCentral =
false;
453 bool isProbeCentral =
false;
457 isProbeCentral =
true;
477 if (isProbeCentral) {
489 if (isProbeCentral) {
502 if (isTagCentral && isProbeCentral)
504 else if (!isTagCentral && !isProbeCentral)
506 }
else if (itMu2.isGlobalMuon()) {
508 if (isProbeCentral) {
515 }
else if (itMu2.isStandAloneMuon()) {
517 if (isProbeCentral) {
522 }
else if (itMu2.innerTrack()->hitPattern().trackerLayersWithMeasurement() >= 6 &&
523 itMu2.innerTrack()->hitPattern().numberOfValidPixelHits() >= 1) {
525 if (isProbeCentral) {
535 for (
auto const& itTrk : *hTrackProduct) {
538 for (
auto const& itMu : *hMuonProduct) {
539 if (itMu.innerTrack().isNonnull() && itMu.innerTrack().get() == &itTrk) {
547 float pt2 = itTrk.pt();
548 float eta2 = itTrk.eta();
549 float phi2 = itTrk.phi();
550 float q2 = itTrk.charge();
562 TLorentzVector vDilep = vTag + vTrack;
563 float dilepMass = vDilep.M();
567 bool isTrackCentral =
false;
569 isTrackCentral =
true;
571 if (itTrk.hitPattern().trackerLayersWithMeasurement() >= 6 && itTrk.hitPattern().numberOfValidPixelHits() >= 1) {
583 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyzeElectrons" << std::endl;
596 for (
auto const&
vtx : *pvCol) {
627 Bool_t config_changed =
false;
630 config_changed =
true;
632 if (config_changed) {
637 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
638 if (
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
641 triggerBits[
fTrigger->fRecords[irec].baconTrigBit] =
true;
671 enum { eEleEle2HLT = 1, eEleEle1HLT1L1, eEleEle1HLT, eEleEleNoSel, eEleSC };
674 for (
size_t itag = 0; itag <
electrons->size(); ++itag) {
676 if (not
EleID_.
passID(el1, beamspotHandle, conversionsHandle))
679 float pt1 = el1->pt();
680 float eta1 = el1->eta();
681 float phi1 = el1->phi();
685 TLorentzVector vTag(0., 0., 0., 0.);
689 double tag_pt = vTag.Pt();
690 double tag_abseta = fabs(vTag.Eta());
695 if (not(tag_is_valid_tag
or tag_is_valid_probe))
699 for (
size_t iprobe = 0; iprobe < superclusters->size(); ++iprobe) {
701 const auto sc = superclusters->ptrAt(iprobe);
702 if (*sc == *(el1->superCluster())) {
707 for (
size_t iele = 0; iele <
electrons->size(); ++iele) {
711 if (*sc == *(ele->superCluster())) {
718 TLorentzVector vProbe(0., 0., 0., 0.);
722 double pt = sc->energy() *
sqrt(1 -
pow(tanh(sc->eta()), 2));
727 double probe_pt = vProbe.Pt();
728 double probe_abseta = fabs(sc->eta());
730 if (!probe_is_valid_probe)
736 TLorentzVector vDilep = vTag + vProbe;
747 *
fTrigger, TriggerTools::matchHLT(vProbe.Eta(), vProbe.Phi(),
fTrigger->fRecords, *hTrgEvt));
748 bool probe_pass_id = eleProbe.
isNonnull() and
EleID_.
passID(eleProbe, beamspotHandle, conversionsHandle);
755 if (probe_is_forward and tag_is_forward) {
757 }
else if (!probe_is_forward and !tag_is_forward) {
764 if (!tag_is_valid_tag)
769 if (probe_is_forward) {
775 if (probe_is_forward) {
783 if (probe_pass_id and probe_pass_trigger) {
784 if (probe_is_forward) {
789 }
else if (probe_pass_id) {
790 if (probe_is_forward) {
823 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
824 fTrigger->fRecords[irec].hltPathName =
"";
825 fTrigger->fRecords[irec].hltPathIndex = (
unsigned int)-1;
828 std::vector<std::vector<std::string>::const_iterator>
matches =
879 else if (idType ==
NoneID)
891 else if (isoType ==
PFIso &&
892 muon.pfIsolationR04().sumChargedHadronPt +
894 muon.pfIsolationR04().sumNeutralHadronEt +
muon.pfIsolationR04().sumPhotonEt -
895 0.5 *
muon.pfIsolationR04().sumPUPt) <
906 return triggerMenu.
pass(
"HLT_Ele35_WPTight_Gsf_v*", hltBits);
910 return triggerMenu.
passObj(
"HLT_Ele35_WPTight_Gsf_v*",
"hltEle35noerWPTightGsfTrackIsoFilter", hltMatchBits);