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) {
363 bool config_changed =
false;
366 config_changed =
true;
368 if (config_changed) {
373 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
374 if (
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
377 triggerBits[
fTrigger->fRecords[irec].baconTrigBit] =
true;
399 TLorentzVector vTag(0., 0., 0., 0.);
400 TLorentzVector vProbe(0., 0., 0., 0.);
401 TLorentzVector vTrack(0., 0., 0., 0.);
404 for (
auto const& itMu1 : *hMuonProduct) {
405 float pt1 = itMu1.muonBestTrack()->pt();
406 float eta1 = itMu1.muonBestTrack()->eta();
407 float phi1 = itMu1.muonBestTrack()->phi();
408 float q1 = itMu1.muonBestTrack()->charge();
423 for (
auto const& itMu2 : *hMuonProduct) {
424 if (&itMu2 == &itMu1)
427 float pt2 = itMu2.muonBestTrack()->pt();
428 float eta2 = itMu2.muonBestTrack()->eta();
429 float phi2 = itMu2.muonBestTrack()->phi();
430 float q2 = itMu2.muonBestTrack()->charge();
443 TLorentzVector vDilep = vTag + vProbe;
444 float dilepMass = vDilep.M();
448 bool isTagCentral =
false;
449 bool isProbeCentral =
false;
453 isProbeCentral =
true;
473 if (isProbeCentral) {
485 if (isProbeCentral) {
498 if (isTagCentral && isProbeCentral)
500 else if (!isTagCentral && !isProbeCentral)
502 }
else if (itMu2.isGlobalMuon()) {
504 if (isProbeCentral) {
511 }
else if (itMu2.isStandAloneMuon()) {
513 if (isProbeCentral) {
518 }
else if (itMu2.innerTrack()->hitPattern().trackerLayersWithMeasurement() >= 6 &&
519 itMu2.innerTrack()->hitPattern().numberOfValidPixelHits() >= 1) {
521 if (isProbeCentral) {
531 for (
auto const& itTrk : *hTrackProduct) {
534 for (
auto const& itMu : *hMuonProduct) {
535 if (itMu.innerTrack().isNonnull() && itMu.innerTrack().get() == &itTrk) {
543 float pt2 = itTrk.pt();
544 float eta2 = itTrk.eta();
545 float phi2 = itTrk.phi();
546 float q2 = itTrk.charge();
558 TLorentzVector vDilep = vTag + vTrack;
559 float dilepMass = vDilep.M();
563 bool isTrackCentral =
false;
565 isTrackCentral =
true;
567 if (itTrk.hitPattern().trackerLayersWithMeasurement() >= 6 && itTrk.hitPattern().numberOfValidPixelHits() >= 1) {
579 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyzeElectrons" << std::endl;
592 for (
auto const&
vtx : *pvCol) {
623 Bool_t config_changed =
false;
626 config_changed =
true;
628 if (config_changed) {
633 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
634 if (
fTrigger->fRecords[irec].hltPathIndex == (
unsigned int)-1)
637 triggerBits[
fTrigger->fRecords[irec].baconTrigBit] =
true;
667 enum { eEleEle2HLT = 1, eEleEle1HLT1L1, eEleEle1HLT, eEleEleNoSel, eEleSC };
670 for (
size_t itag = 0; itag <
electrons->size(); ++itag) {
672 if (not
EleID_.
passID(el1, beamspotHandle, conversionsHandle))
675 float pt1 = el1->pt();
676 float eta1 = el1->eta();
677 float phi1 = el1->phi();
681 TLorentzVector vTag(0., 0., 0., 0.);
685 double tag_pt = vTag.Pt();
686 double tag_abseta = fabs(vTag.Eta());
691 if (not(tag_is_valid_tag
or tag_is_valid_probe))
695 for (
size_t iprobe = 0; iprobe < superclusters->size(); ++iprobe) {
697 const auto sc = superclusters->ptrAt(iprobe);
698 if (*sc == *(el1->superCluster())) {
703 for (
size_t iele = 0; iele <
electrons->size(); ++iele) {
707 if (*sc == *(ele->superCluster())) {
714 TLorentzVector vProbe(0., 0., 0., 0.);
718 double pt = sc->energy() *
sqrt(1 -
pow(tanh(sc->eta()), 2));
723 double probe_pt = vProbe.Pt();
724 double probe_abseta = fabs(sc->eta());
726 if (!probe_is_valid_probe)
732 TLorentzVector vDilep = vTag + vProbe;
743 *
fTrigger, TriggerTools::matchHLT(vProbe.Eta(), vProbe.Phi(),
fTrigger->fRecords, *hTrgEvt));
744 bool probe_pass_id = eleProbe.
isNonnull() and
EleID_.
passID(eleProbe, beamspotHandle, conversionsHandle);
751 if (probe_is_forward and tag_is_forward) {
753 }
else if (!probe_is_forward and !tag_is_forward) {
760 if (!tag_is_valid_tag)
765 if (probe_is_forward) {
771 if (probe_is_forward) {
779 if (probe_pass_id and probe_pass_trigger) {
780 if (probe_is_forward) {
785 }
else if (probe_pass_id) {
786 if (probe_is_forward) {
819 for (
unsigned int irec = 0; irec <
fTrigger->fRecords.size(); irec++) {
820 fTrigger->fRecords[irec].hltPathName =
"";
821 fTrigger->fRecords[irec].hltPathIndex = (
unsigned int)-1;
824 std::vector<std::vector<std::string>::const_iterator>
matches =
866 if (!
muon.isPFMuon() || !
muon.isGlobalMuon())
871 bool muIdAndHits = muID &&
muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
872 muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;
891 else if (idType ==
NoneID)
899 const float isoCut) {
903 else if (isoType ==
PFIso &&
904 muon.pfIsolationR04().sumChargedHadronPt +
906 muon.pfIsolationR04().sumNeutralHadronEt +
muon.pfIsolationR04().sumPhotonEt -
907 0.5 *
muon.pfIsolationR04().sumPUPt) <
918 return triggerMenu.
pass(
"HLT_Ele35_WPTight_Gsf_v*", hltBits);
922 return triggerMenu.
passObj(
"HLT_Ele35_WPTight_Gsf_v*",
"hltEle35noerWPTightGsfTrackIsoFilter", hltMatchBits);
ZCounting(const edm::ParameterSet &ps)
bool accept() const
Has at least one path accepted the event?
MonitorElement * h_mass_Glo_pass_forward
MonitorElement * h_mass_Glo_fail_forward
bool isElectronTrigger(ZCountingTrigger::TTrigger triggerMenu, TriggerBits hltBits)
T getParameter(std::string const &) const
edm::InputTag fBeamspotTag
MonitorElement * h_mass_SIT_fail_central
double pt() const final
transverse momentum
bool isMuon(const Candidate &part)
virtual void setCurrentFolder(std::string const &fullpath)
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
#define DEFINE_FWK_MODULE(type)
MonitorElement * h_mass_SIT_pass_forward
T const * product() const
bool is_glob(std::string const &pattern)
std::vector< std::string > fMuonHLTNames
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool passMuonID(const reco::Muon &muon, const reco::Vertex &vtx, const MuonIDTypes &idType)
edm::EDGetTokenT< edm::View< reco::GsfElectron > > fGsfElectronName_token
bool isElectronTriggerObj(ZCountingTrigger::TTrigger triggerMenu, TriggerObjects hltMatchBits)
edm::InputTag fConversionTag
MonitorElement * h_mass_HLT_pass_forward
Log< level::Error, false > LogError
ElectronIdentifier EleID_
const float ELE_ETA_CRACK_HIGH
const float ELE_ETA_CUT_TAG
MonitorElement * h_ee_mass_HLT_fail_central
MonitorElement * h_mass_yield_Z
MonitorElement * h_mass_Glo_pass_central
std::bitset< kNTrigObjectBit > TriggerObjects
MonitorElement * h_ee_mass_HLT_pass_forward
bool isLooseMuon(const reco::Muon &)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::TrackCollection > fTrackName_token
bool isCustomTightMuon(const reco::Muon &muon)
edm::EDGetTokenT< reco::MuonCollection > fMuonName_token
void analyzeMuons(edm::Event const &e, edm::EventSetup const &eSetup)
edm::ParameterSetID fTriggerNamesID
const float ELE_MASS_CUT_HIGH
const std::string ELE_ID_WP
edm::EDGetTokenT< reco::VertexCollection > fPVName_token
MonitorElement * h_yieldEE_Z
bool isNonnull() const
Checks for non-null.
std::bitset< kNTrigBit > TriggerBits
const float ELE_PT_CUT_PROBE
MonitorElement * h_npv_yield_Z
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool passID(const reco::GsfElectronPtr &ele, edm::Handle< reco::BeamSpot > beamspot, edm::Handle< reco::ConversionCollection > conversions)
bool isMuonTrigger(const ZCountingTrigger::TTrigger &triggerMenu, const TriggerBits &hltBits)
void initHLT(const edm::TriggerResults &, const edm::TriggerNames &)
MonitorElement * h_ee_yield_Z_eeee
MonitorElement * h_ee_yield_Z_ebee
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_ee_mass_HLT_fail_forward
bool ele_tag_selection(double pt, double abseta)
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
const float ELE_MASS_CUT_LOW
const float ELE_ETA_CRACK_LOW
edm::EDGetTokenT< trigger::TriggerEvent > fHLTObjTag_token
MonitorElement * h_ee_mass_id_pass_forward
Log< level::Info, false > LogInfo
MonitorElement * h_ee_mass_HLT_pass_central
MonitorElement * h_mass_SIT_fail_forward
MonitorElement * h_ee_yield_Z_ebeb
MonitorElement * h_mass_HLT_pass_central
const float ELE_ETA_CUT_PROBE
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
edm::EDGetTokenT< reco::ConversionCollection > fConversionToken
edm::EDGetTokenT< edm::TriggerResults > fHLTTag_token
bool ele_probe_selection(double pt, double abseta)
MonitorElement * h_ee_mass_id_pass_central
std::string fElectronName
MonitorElement * h_mass_HLT_fail_forward
std::vector< std::vector< std::string >::const_iterator > regexMatch(std::vector< std::string > const &strings, std::regex const ®exp)
bool passObj(const std::string &iName, const std::string &iObjName, const TriggerObjects &iTrigObj) const
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
bool passMuonIso(const reco::Muon &muon, const MuonIsoTypes &isoType, const float isoCut)
void setID(std::string ID)
MonitorElement * h_ee_mass_id_fail_forward
edm::EDGetTokenT< double > fRhoToken
MonitorElement * h_yieldBB_Z
std::vector< std::string > fMuonHLTObjectNames
MonitorElement * h_ee_mass_id_fail_central
void analyzeElectrons(edm::Event const &e, edm::EventSetup const &eSetup)
const float ELECTRON_MASS
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
MonitorElement * h_mass_Glo_fail_central
Log< level::Warning, false > LogWarning
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
edm::EDGetTokenT< reco::BeamSpot > fBeamspotToken
MonitorElement * h_mass_SIT_pass_central
double phi() const final
momentum azimuthal angle
const float ELE_PT_CUT_TAG
std::unique_ptr< ZCountingTrigger::TTrigger > fTrigger
edm::EDGetTokenT< edm::View< reco::SuperCluster > > fSCName_token
Power< A, B >::type pow(const A &a, const B &b)
MonitorElement * h_mass_HLT_fail_central
bool isMuonTriggerObj(const ZCountingTrigger::TTrigger &triggerMenu, const TriggerObjects &hltMatchBits)
bool pass(const std::string &iName, const TriggerBits &iTrig) const
int charge() const final
electric charge
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
double eta() const final
momentum pseudorapidity