12 #include <TLorentzVector.h> 22 : triggerResultsInputTag_(iConfig.getParameter<
edm::
InputTag>(
"TriggerResults")),
24 iConfig.getUntrackedParameter<
std::
string>(
"edmPVName",
"offlinePrimaryVertices"))),
27 iConfig.getUntrackedParameter<
std::
string>(
"StandaloneReg",
"standAloneMuons"))),
29 iConfig.getUntrackedParameter<
std::
string>(
"StandaloneUpd",
"standAloneMuons:UpdatedAtVtx"))),
33 PtCutL1_(iConfig.getUntrackedParameter<double>(
"PtCutL1")),
34 PtCutL2_(iConfig.getUntrackedParameter<double>(
"PtCutL2")),
35 EtaCutL1_(iConfig.getUntrackedParameter<double>(
"EtaCutL1")),
36 EtaCutL2_(iConfig.getUntrackedParameter<double>(
"EtaCutL2")),
38 MassBin_(iConfig.getUntrackedParameter<
int>(
"MassBin")),
39 MassMin_(iConfig.getUntrackedParameter<double>(
"MassMin")),
40 MassMax_(iConfig.getUntrackedParameter<double>(
"MassMax")),
42 LumiBin_(iConfig.getUntrackedParameter<
int>(
"LumiBin")),
43 LumiMin_(iConfig.getUntrackedParameter<double>(
"LumiMin")),
44 LumiMax_(iConfig.getUntrackedParameter<double>(
"LumiMax")),
46 PVBin_(iConfig.getUntrackedParameter<
int>(
"PVBin")),
47 PVMin_(iConfig.getUntrackedParameter<double>(
"PVMin")),
48 PVMax_(iConfig.getUntrackedParameter<double>(
"PVMax")),
50 VtxNTracksFitCut_(iConfig.getUntrackedParameter<double>(
"VtxNTracksFitMin")),
51 VtxNdofCut_(iConfig.getUntrackedParameter<double>(
"VtxNdofMin")),
52 VtxAbsZCut_(iConfig.getUntrackedParameter<double>(
"VtxAbsZMax")),
53 VtxRhoCut_(iConfig.getUntrackedParameter<double>(
"VtxRhoMax")),
55 IDTypestr_(iConfig.getUntrackedParameter<
std::
string>(
"IDType")),
56 IsoTypestr_(iConfig.getUntrackedParameter<
std::
string>(
"IsoType")),
57 IsoCut_(iConfig.getUntrackedParameter<double>(
"IsoCut")) {
58 edm::LogInfo(
"ZCounting") <<
"Constructor ZCounting::ZCounting " << std::endl;
67 const std::vector<std::string> patterns_ = iConfig.
getParameter<std::vector<std::string>>(
"MuonTriggerNames");
100 edm::LogInfo(
"ZCounting") <<
"ZCounting::beginRun" << std::endl;
105 bool hltChanged_ =
true;
107 edm::LogVerbatim(
"ZCounting") <<
"ZCounting::dqmBeginRun [TriggerObjMatchValueMapsProducer::beginRun] " 108 "HLTConfigProvider initialized [processName() = \"" 113 edm::LogError(
"ZCounting") <<
"ZCounting::dqmBeginRun Initialization of HLTConfigProvider failed for Run=" 115 <<
"\") -> plugin will not produce outputs for this Run";
126 edm::LogInfo(
"ZCounting") <<
"ZCounting::bookHistograms" << std::endl;
132 "Both muon pass HLT in barrel-barrel",
140 "Both muon pass HLT passing in barrel-endcap",
148 "Both muon pass HLT passing in endcap-endcap",
156 "One muon pass HLT in barrel-barrel",
164 "One muon pass HLT passing in barrel-endcap",
172 "One muon pass HLT passing in endcap-endcap",
189 "Muon Glo passing barrel-barrel",
197 "Muon Glo passing barrel-endcap",
206 "Muon Glo passing endcap-endcap",
215 "Muon Glo failing barrel-barrel",
223 "Muon Glo failing barrel-endcap",
232 "Muon Glo failing endcap-endcap",
241 "Muon Sta passing barrel-barrel",
249 "Muon Sta passing barrel-endcap",
258 "Muon Sta passing endcap-endcap",
267 "Muon Sta failing barrel-barrel",
275 "Muon Sta failing barrel-endcap",
284 "Muon Sta failing endcap-endcap",
347 edm::LogInfo(
"ZCounting") <<
"ZCounting::analyze" << std::endl;
354 if (!hVertexProduct.
isValid()) {
355 edm::LogWarning(
"ZCounting") <<
"ZCounting::analyze - no valid primary vertex product found" << std::endl;
362 for (
auto const& itVtx : *hVertexProduct) {
397 edm::LogWarning(
"ZCounting") <<
"ZCounting::analyze - no valid hMuonProduct found" << std::endl;
403 if (!hTrackProduct.
isValid()) {
404 edm::LogWarning(
"ZCounting") <<
"ZCounting::analyze - no valid hTrackProduct found" << std::endl;
415 if (!tracksStandAlone.
isValid()) {
416 edm::LogWarning(
"ZCounting") <<
"ZCounting::analyze - no valid tracksStandAlone found" << std::endl;
422 if (!tracksStandAloneUpdatedAtVtx.
isValid()) {
423 edm::LogWarning(
"ZCounting") <<
"ZCounting::analyze - no valid tracksStandAloneUpdatedAtVtx found" << std::endl;
427 std::vector<const reco::Track*> hStandaloneProduct;
428 std::vector<bool> passGlobalMuonMap;
430 for (
auto const&
standAlone : *tracksStandAlone) {
431 auto const extraIdx =
standAlone.extra().key();
437 for (
auto const& standAloneUpdatedAtVtx : *tracksStandAloneUpdatedAtVtx) {
438 if (standAloneUpdatedAtVtx.extra().key() == extraIdx) {
439 const bool etaFlip1 = (standAloneUpdatedAtVtx.eta() *
standAlone.eta()) >= 0;
441 track = &standAloneUpdatedAtVtx;
457 bool isGlobalMuon =
false;
458 for (
auto const& itMu2 : *hMuonProduct) {
459 if (itMu2.standAloneMuon().isNull())
462 auto const& muonStandAlone = *itMu2.standAloneMuon();
464 if (
track->extra().key() == muonStandAlone.extra().key()) {
466 if (muonStandAlone.pt() ==
track->pt() && muonStandAlone.eta() ==
track->eta() &&
467 muonStandAlone.phi() ==
track->phi()) {
476 passGlobalMuonMap.push_back(isGlobalMuon);
477 hStandaloneProduct.push_back(
track);
480 TLorentzVector vTag(0., 0., 0., 0.);
481 TLorentzVector vProbe(0., 0., 0., 0.);
482 TLorentzVector vTrack(0., 0., 0., 0.);
485 for (
auto const& itMu1 : *hMuonProduct) {
486 const float pt1 = itMu1.muonBestTrack()->pt();
487 const float eta1 = itMu1.muonBestTrack()->eta();
488 const float phi1 = itMu1.muonBestTrack()->phi();
489 const float q1 = itMu1.muonBestTrack()->charge();
503 bool isTagCentral =
false;
508 for (
auto const& itMu2 : *hMuonProduct) {
509 if (&itMu2 == &itMu1)
512 const float pt2 = itMu2.muonBestTrack()->pt();
513 const float eta2 = itMu2.muonBestTrack()->eta();
514 const float phi2 = itMu2.muonBestTrack()->phi();
515 const float q2 = itMu2.muonBestTrack()->charge();
528 TLorentzVector vDilep = vTag + vProbe;
529 float dilepMass = vDilep.M();
542 if (isTagCentral && isProbeCentral) {
544 }
else if (!isTagCentral && !isProbeCentral) {
551 if (isTagCentral && isProbeCentral) {
553 }
else if (!isTagCentral && !isProbeCentral) {
561 if (isTagCentral && isProbeCentral) {
563 }
else if (!isTagCentral && !isProbeCentral) {
576 const float pt2 = itSta->
pt();
577 const float eta2 = itSta->
eta();
578 const float phi2 = itSta->
phi();
589 TLorentzVector vDilep = vTag + vProbe;
590 float dilepMass = vDilep.M();
596 if (passGlobalMuonMap[
idx]) {
597 if (isTagCentral && isProbeCentral) {
599 }
else if (!isTagCentral && !isProbeCentral) {
605 if (isTagCentral && isProbeCentral) {
607 }
else if (!isTagCentral && !isProbeCentral) {
616 for (
auto const& itTrk : *hTrackProduct) {
617 const float pt2 = itTrk.pt();
618 const float eta2 = itTrk.eta();
619 const float phi2 = itTrk.phi();
620 const float q2 = itTrk.charge();
634 TLorentzVector vDilep = vTag + vTrack;
635 float dilepMass = vDilep.M();
641 for (
const reco::Track* itSta : hStandaloneProduct) {
651 if (isTagCentral && isTrackCentral) {
653 }
else if (!isTagCentral && !isTrackCentral) {
659 if (isTagCentral && isTrackCentral) {
661 }
else if (!isTagCentral && !isTrackCentral) {
679 return muon.isGlobalMuon() &&
muon.isPFMuon() &&
muon.globalTrack()->normalizedChi2() < 10. &&
680 muon.globalTrack()->hitPattern().numberOfValidMuonHits() > 0 &&
muon.numberOfMatchedStations() > 1 &&
681 muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
682 muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;
714 muon.outerTrack()->eta(),
muon.outerTrack()->phi(),
muon.innerTrack()->eta(),
muon.innerTrack()->phi()) <
720 return track.hitPattern().trackerLayersWithMeasurement() >= 6 &&
track.hitPattern().numberOfValidPixelHits() >= 1 &&
721 track.originalAlgo() != 13
722 &&
track.originalAlgo() != 14;
732 return muon.pfIsolationR04().sumChargedHadronPt +
734 muon.pfIsolationR04().sumNeutralHadronEt +
muon.pfIsolationR04().sumPhotonEt -
735 0.5 *
muon.pfIsolationR04().sumPUPt) <
MonitorElement * h_mass_Sta_pass_EE
ZCounting(const edm::ParameterSet &ps)
Log< level::Info, true > LogVerbatim
MonitorElement * h_mass_Sta_pass_BE
T getParameter(std::string const &) const
MonitorElement * h_mass_Sta_fail_BE
bool passMuonIso(const reco::Muon &muon)
virtual void setCurrentFolder(std::string const &fullpath)
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
const double VtxNTracksFitCut_
const edm::InputTag triggerResultsInputTag_
bool passTrack(const reco::Track &track)
MonitorElement * h_mass_1HLT_BE
std::vector< Track > TrackCollection
collection of Tracks
const std::string IDTypestr_
MonitorElement * h_mass_Glo_pass_BB
MonitorElement * h_mass_2HLT_BE
Log< level::Error, false > LogError
edm::EDGetTokenT< reco::TrackCollection > fStandaloneUpdName_token
std::vector< Vertex > VertexCollection
std::vector< Muon > MuonCollection
collection of Muon objects
MonitorElement * h_mass_Glo_fail_BE
bool isLooseMuon(const reco::Muon &)
HLTConfigProvider hltConfigProvider_
edm::EDGetTokenT< reco::TrackCollection > fTrackName_token
bool isCustomTightMuon(const reco::Muon &muon)
bool passMuonID(const reco::Muon &muon, const reco::Vertex *vtx)
double pt() const
track transverse momentum
edm::EDGetTokenT< reco::MuonCollection > fMuonName_token
MonitorElement * h_mass_Sta_fail_BB
MonitorElement * h_mass_Sta_pass_BB
unsigned int size() const
number of trigger paths in trigger table
edm::EDGetTokenT< reco::VertexCollection > fPVName_token
MonitorElement * h_mass_ID_fail_BE
Abs< T >::type abs(const T &t)
MonitorElement * h_mass_ID_fail_EE
double phi() const
azimuthal angle of momentum vector
#define DEFINE_FWK_MODULE(type)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const std::string IsoTypestr_
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
MonitorElement * h_mass_2HLT_EE
MonitorElement * h_mass_2HLT_BB
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
MonitorElement * h_mass_ID_fail_BB
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const std::string & processName() const
process name
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * h_mass_Sta_fail_EE
bool passGlobalMuon(const reco::Muon &muon)
MonitorElement * h_mass_Glo_fail_BB
MonitorElement * h_mass_Glo_pass_BE
const std::string & tableName() const
HLT ConfDB table name.
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * h_mass_1HLT_EE
Log< level::Warning, false > LogWarning
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
MonitorElement * h_mass_1HLT_BB
MonitorElement * h_mass_Glo_fail_EE
edm::EDGetTokenT< reco::TrackCollection > fStandaloneRegName_token
MonitorElement * h_mass_Glo_pass_EE
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)