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;
63 if (fMuonHLTNames.size() != fMuonHLTObjectNames.size()) {
64 edm::LogError(
"ZCounting") <<
"List of MuonTriggerNames and MuonTriggerObjectNames has to be the same length" 80 if (IDTypestr_ ==
"Loose")
82 else if (IDTypestr_ ==
"Medium")
84 else if (IDTypestr_ ==
"Tight")
89 if (IsoTypestr_ ==
"Tracker-based")
91 else if (IsoTypestr_ ==
"PF-based")
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) {
371 initHLT(*hTrgRes, triggerNames);
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();
422 vTag.SetPtEtaPhiM(pt1, eta1, phi1,
MUON_MASS);
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();
442 vProbe.SetPtEtaPhiM(pt2, eta2, phi2,
MUON_MASS);
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();
558 vTrack.SetPtEtaPhiM(pt2, eta2, phi2,
MUON_MASS);
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) {
631 initHLT(*hTrgRes, triggerNames);
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) {
673 const auto el1 = electrons->ptrAt(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) {
708 const auto ele = electrons->ptrAt(iele);
709 if (*
sc == *(ele->superCluster())) {
716 TLorentzVector vProbe(0., 0., 0., 0.);
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 =
828 if (matches.empty()) {
829 edm::LogWarning(
"ZCounting") <<
"requested pattern [" << pattern <<
"] does not match any HLT paths" 832 for (
auto const&
match : matches) {
841 if (index < result.
size()) {
877 else if (idType ==
NoneID)
889 else if (isoType ==
PFIso &&
904 return triggerMenu.
pass(
"HLT_Ele35_WPTight_Gsf_v*", hltBits);
908 return triggerMenu.
passObj(
"HLT_Ele35_WPTight_Gsf_v*",
"hltEle35noerWPTightGsfTrackIsoFilter", hltMatchBits);
ZCounting(const edm::ParameterSet &ps)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * h_mass_Glo_pass_forward
MonitorElement * h_mass_Glo_fail_forward
bool isElectronTrigger(ZCountingTrigger::TTrigger triggerMenu, TriggerBits hltBits)
edm::InputTag fBeamspotTag
MonitorElement * h_mass_SIT_fail_central
double eta() const final
momentum pseudorapidity
float sumPt
sum-pt of tracks
float phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
bool isMuon(const Candidate &part)
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool passObj(const std::string &iName, const std::string &iObjName, const TriggerObjects &iTrigObj) const
void setCurrentFolder(std::string const &fullpath)
MonitorElement * h_mass_SIT_pass_forward
bool accept() const
Has at least one path accepted the event?
bool is_glob(std::string const &pattern)
std::vector< std::string > fMuonHLTNames
edm::LuminosityBlockNumber_t luminosityBlock() const
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
int charge() const final
electric charge
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
float sumPhotonEt
sum pt of PF photons
ElectronIdentifier EleID_
const float ELE_ETA_CRACK_HIGH
const float ELE_ETA_CUT_TAG
MonitorElement * h_ee_mass_HLT_fail_central
Strings const & triggerNames() const
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 &)
float sumNeutralHadronEt
sum pt of neutral hadrons
ParameterSetID const & parameterSetID() const
edm::EDGetTokenT< reco::TrackCollection > fTrackName_token
edm::EDGetTokenT< reco::MuonCollection > fMuonName_token
void analyzeMuons(edm::Event const &e, edm::EventSetup const &eSetup)
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
#define DEFINE_FWK_MODULE(type)
edm::ParameterSetID fTriggerNamesID
const float ELE_MASS_CUT_HIGH
const std::string ELE_ID_WP
unsigned int triggerIndex(std::string const &name) const
edm::EDGetTokenT< reco::VertexCollection > fPVName_token
unsigned int size() const
Get number of paths stored.
MonitorElement * h_yieldEE_Z
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 &)
float energy() const
Energy. Note this is taken from the first SimTrack only.
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 isNonnull() const
Checks for non-null.
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
MonitorElement * h_ee_mass_HLT_pass_central
MonitorElement * h_mass_SIT_fail_forward
T const * product() const
MonitorElement * h_ee_yield_Z_ebeb
bool pass(const std::string &iName, const TriggerBits &iTrig) const
const MuonPFIsolation & pfIsolationR04() const
MonitorElement * h_mass_HLT_pass_central
const float ELE_ETA_CUT_PROBE
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)
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
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
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
edm::EDGetTokenT< reco::BeamSpot > fBeamspotToken
MonitorElement * h_mass_SIT_pass_central
const float ELE_PT_CUT_TAG
std::unique_ptr< ZCountingTrigger::TTrigger > fTrigger
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< edm::View< reco::SuperCluster > > fSCName_token
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
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)
const MuonIsolation & isolationR03() const
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
float sumChargedHadronPt
sum-pt of charged Hadron
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)