CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
ZCounting Class Reference

#include <ZCounting.h>

Inheritance diagram for ZCounting:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Types

enum  MuonIDTypes {
  NoneID, LooseID, MediumID, TightID,
  CustomTightID
}
 
enum  MuonIsoTypes { NoneIso, TrackerIso, PFIso }
 
- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 ZCounting (const edm::ParameterSet &ps)
 
 ~ZCounting () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

bool isCustomTightMuon (const reco::Muon &muon)
 
bool passGlobalMuon (const reco::Muon &muon)
 
bool passMuonID (const reco::Muon &muon, const reco::Vertex *vtx)
 
bool passMuonIso (const reco::Muon &muon)
 
bool passTrack (const reco::Track &track)
 

Private Attributes

const double DRMAX_HLT = 0.01
 
const double DRMAX_IO = 0.09
 
const double EtaCutL1_
 
const double EtaCutL2_
 
std::vector< std::string > fMuonHLTNames
 
std::vector< std::string > fMuonHLTObjectNames
 
edm::EDGetTokenT< reco::MuonCollectionfMuonName_token
 
edm::EDGetTokenT< reco::VertexCollectionfPVName_token
 
edm::EDGetTokenT< reco::TrackCollectionfStandaloneRegName_token
 
edm::EDGetTokenT< reco::TrackCollectionfStandaloneUpdName_token
 
edm::EDGetTokenT< reco::TrackCollectionfTrackName_token
 
MonitorElementh_mass_1HLT_BB
 
MonitorElementh_mass_1HLT_BE
 
MonitorElementh_mass_1HLT_EE
 
MonitorElementh_mass_2HLT_BB
 
MonitorElementh_mass_2HLT_BE
 
MonitorElementh_mass_2HLT_EE
 
MonitorElementh_mass_Glo_fail_BB
 
MonitorElementh_mass_Glo_fail_BE
 
MonitorElementh_mass_Glo_fail_EE
 
MonitorElementh_mass_Glo_pass_BB
 
MonitorElementh_mass_Glo_pass_BE
 
MonitorElementh_mass_Glo_pass_EE
 
MonitorElementh_mass_ID_fail_BB
 
MonitorElementh_mass_ID_fail_BE
 
MonitorElementh_mass_ID_fail_EE
 
MonitorElementh_mass_Sta_fail_BB
 
MonitorElementh_mass_Sta_fail_BE
 
MonitorElementh_mass_Sta_fail_EE
 
MonitorElementh_mass_Sta_pass_BB
 
MonitorElementh_mass_Sta_pass_BE
 
MonitorElementh_mass_Sta_pass_EE
 
MonitorElementh_npv
 
HLTConfigProvider hltConfigProvider_
 
MuonIDTypes IDType_ {NoneID}
 
const std::string IDTypestr_
 
const double IsoCut_
 
MuonIsoTypes IsoType_ {NoneIso}
 
const std::string IsoTypestr_
 
const int LumiBin_
 
const double LumiMax_
 
const double LumiMin_
 
const int MassBin_
 
const double MassMax_
 
const double MassMin_
 
const double MAX_ETA_STA = 2.4
 
const double MAX_ETA_TRK = 2.5
 
const double MIN_PT_STA = 15
 
const double MIN_PT_TRK = 15
 
const double MUON_BOUND = 0.9
 
const double MUON_MASS = 0.105658369
 
const int N_STA_HITS = 1
 
const double PtCutL1_
 
const double PtCutL2_
 
const int PVBin_
 
const double PVMax_
 
const double PVMin_
 
const edm::InputTag triggerResultsInputTag_
 
TriggerToolstriggers
 
const double VtxAbsZCut_
 
const double VtxNdofCut_
 
const double VtxNTracksFitCut_
 
const double VtxRhoCut_
 

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 25 of file ZCounting.h.

Member Enumeration Documentation

◆ MuonIDTypes

Enumerator
NoneID 
LooseID 
MediumID 
TightID 
CustomTightID 

Definition at line 30 of file ZCounting.h.

◆ MuonIsoTypes

Enumerator
NoneIso 
TrackerIso 
PFIso 

Definition at line 31 of file ZCounting.h.

Constructor & Destructor Documentation

◆ ZCounting()

ZCounting::ZCounting ( const edm::ParameterSet ps)

Definition at line 21 of file ZCounting.cc.

References TriggerTools::addTriggerRecord(), CustomTightID, DRMAX_HLT, edm::ParameterSet::getParameter(), IDType_, IDTypestr_, IsoType_, IsoTypestr_, LooseID, MediumID, NoneID, NoneIso, PFIso, TriggerTools::setDRMAX(), TriggerTools::setTriggerEventToken(), TriggerTools::setTriggerResultsToken(), AlCaHLTBitMon_QueryRunRegistry::string, TightID, TrackerIso, triggerResultsInputTag_, and triggers.

22  : triggerResultsInputTag_(iConfig.getParameter<edm::InputTag>("TriggerResults")),
23  fPVName_token(consumes<reco::VertexCollection>(
24  iConfig.getUntrackedParameter<std::string>("edmPVName", "offlinePrimaryVertices"))),
25  fMuonName_token(consumes<reco::MuonCollection>(iConfig.getUntrackedParameter<std::string>("edmName", "muons"))),
26  fStandaloneRegName_token(consumes<reco::TrackCollection>(
27  iConfig.getUntrackedParameter<std::string>("StandaloneReg", "standAloneMuons"))),
28  fStandaloneUpdName_token(consumes<reco::TrackCollection>(
29  iConfig.getUntrackedParameter<std::string>("StandaloneUpd", "standAloneMuons:UpdatedAtVtx"))),
31  consumes<reco::TrackCollection>(iConfig.getUntrackedParameter<std::string>("edmTrackName", "generalTracks"))),
32 
33  PtCutL1_(iConfig.getUntrackedParameter<double>("PtCutL1")),
34  PtCutL2_(iConfig.getUntrackedParameter<double>("PtCutL2")),
35  EtaCutL1_(iConfig.getUntrackedParameter<double>("EtaCutL1")),
36  EtaCutL2_(iConfig.getUntrackedParameter<double>("EtaCutL2")),
37 
38  MassBin_(iConfig.getUntrackedParameter<int>("MassBin")),
39  MassMin_(iConfig.getUntrackedParameter<double>("MassMin")),
40  MassMax_(iConfig.getUntrackedParameter<double>("MassMax")),
41 
42  LumiBin_(iConfig.getUntrackedParameter<int>("LumiBin")),
43  LumiMin_(iConfig.getUntrackedParameter<double>("LumiMin")),
44  LumiMax_(iConfig.getUntrackedParameter<double>("LumiMax")),
45 
46  PVBin_(iConfig.getUntrackedParameter<int>("PVBin")),
47  PVMin_(iConfig.getUntrackedParameter<double>("PVMin")),
48  PVMax_(iConfig.getUntrackedParameter<double>("PVMax")),
49 
50  VtxNTracksFitCut_(iConfig.getUntrackedParameter<double>("VtxNTracksFitMin")),
51  VtxNdofCut_(iConfig.getUntrackedParameter<double>("VtxNdofMin")),
52  VtxAbsZCut_(iConfig.getUntrackedParameter<double>("VtxAbsZMax")),
53  VtxRhoCut_(iConfig.getUntrackedParameter<double>("VtxRhoMax")),
54 
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;
59 
60  // Trigger settings
61  triggers = new TriggerTools();
62  triggers->setTriggerResultsToken(consumes<edm::TriggerResults>(triggerResultsInputTag_));
63  triggers->setTriggerEventToken(consumes<trigger::TriggerEvent>(iConfig.getParameter<edm::InputTag>("TriggerEvent")));
65 
66  edm::LogVerbatim("ZCounting") << "ZCounting::ZCounting set trigger names";
67  const std::vector<std::string> patterns_ = iConfig.getParameter<std::vector<std::string>>("MuonTriggerNames");
68  for (const std::string& pattern_ : patterns_) {
69  triggers->addTriggerRecord(pattern_);
70  }
71 
72  if (IDTypestr_ == "Loose")
73  IDType_ = LooseID;
74  else if (IDTypestr_ == "Medium")
75  IDType_ = MediumID;
76  else if (IDTypestr_ == "Tight")
77  IDType_ = TightID;
78  else if (IDTypestr_ == "CustomTight")
80  else
81  IDType_ = NoneID;
82 
83  if (IsoTypestr_ == "Tracker-based")
85  else if (IsoTypestr_ == "PF-based")
86  IsoType_ = PFIso;
87  else
88  IsoType_ = NoneIso;
89 }
Log< level::Info, true > LogVerbatim
const double MassMax_
Definition: ZCounting.h:69
void setDRMAX(const double _drMax)
Definition: TriggerTools.h:28
const double VtxNTracksFitCut_
Definition: ZCounting.h:79
const edm::InputTag triggerResultsInputTag_
Definition: ZCounting.h:47
const double DRMAX_HLT
Definition: ZCounting.h:97
TriggerTools * triggers
Definition: ZCounting.h:94
const double VtxAbsZCut_
Definition: ZCounting.h:81
const int PVBin_
Definition: ZCounting.h:75
const std::string IDTypestr_
Definition: ZCounting.h:84
const double EtaCutL2_
Definition: ZCounting.h:65
MuonIsoTypes IsoType_
Definition: ZCounting.h:90
void setTriggerEventToken(edm::EDGetTokenT< trigger::TriggerEvent > token)
Definition: TriggerTools.h:27
const double EtaCutL1_
Definition: ZCounting.h:64
edm::EDGetTokenT< reco::TrackCollection > fStandaloneUpdName_token
Definition: ZCounting.h:56
edm::EDGetTokenT< reco::TrackCollection > fTrackName_token
Definition: ZCounting.h:59
edm::EDGetTokenT< reco::MuonCollection > fMuonName_token
Definition: ZCounting.h:51
const double MassMin_
Definition: ZCounting.h:68
const double VtxNdofCut_
Definition: ZCounting.h:80
const double LumiMax_
Definition: ZCounting.h:73
const double IsoCut_
Definition: ZCounting.h:86
edm::EDGetTokenT< reco::VertexCollection > fPVName_token
Definition: ZCounting.h:48
void setTriggerResultsToken(edm::EDGetTokenT< edm::TriggerResults > token)
Definition: TriggerTools.h:26
const std::string IsoTypestr_
Definition: ZCounting.h:85
MuonIDTypes IDType_
Definition: ZCounting.h:89
const int LumiBin_
Definition: ZCounting.h:71
const double PVMin_
Definition: ZCounting.h:76
Log< level::Info, false > LogInfo
void addTriggerRecord(const std::string &name)
Definition: TriggerTools.h:30
const double PVMax_
Definition: ZCounting.h:77
const double LumiMin_
Definition: ZCounting.h:72
const double PtCutL1_
Definition: ZCounting.h:62
const double PtCutL2_
Definition: ZCounting.h:63
edm::EDGetTokenT< reco::TrackCollection > fStandaloneRegName_token
Definition: ZCounting.h:55
const double VtxRhoCut_
Definition: ZCounting.h:82
const int MassBin_
Definition: ZCounting.h:67

◆ ~ZCounting()

ZCounting::~ZCounting ( )
override

Definition at line 94 of file ZCounting.cc.

94 { edm::LogInfo("ZCounting") << "Destructor ZCounting::~ZCounting " << std::endl; }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

void ZCounting::analyze ( edm::Event const &  e,
edm::EventSetup const &  eSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 346 of file ZCounting.cc.

References reco::deltaR2(), DRMAX_IO, reco::TrackBase::eta(), HLT_2024v10_cff::eta1, HLT_2024v10_cff::eta2, EtaCutL1_, EtaCutL2_, dqm::impl::MonitorElement::Fill(), fMuonName_token, fPVName_token, fStandaloneRegName_token, fStandaloneUpdName_token, fTrackName_token, h_mass_1HLT_BB, h_mass_1HLT_BE, h_mass_1HLT_EE, h_mass_2HLT_BB, h_mass_2HLT_BE, h_mass_2HLT_EE, h_mass_Glo_fail_BB, h_mass_Glo_fail_BE, h_mass_Glo_fail_EE, h_mass_Glo_pass_BB, h_mass_Glo_pass_BE, h_mass_Glo_pass_EE, h_mass_ID_fail_BB, h_mass_ID_fail_BE, h_mass_ID_fail_EE, h_mass_Sta_fail_BB, h_mass_Sta_fail_BE, h_mass_Sta_fail_EE, h_mass_Sta_pass_BB, h_mass_Sta_pass_BE, h_mass_Sta_pass_EE, h_npv, heavyIonCSV_trainingSettings::idx, iEvent, nano_mu_reco_cff::isStandalone, edm::HandleBase::isValid(), MassMax_, MassMin_, MAX_ETA_STA, MIN_PT_STA, MUON_BOUND, MUON_MASS, N_STA_HITS, TriggerTools::pass(), passGlobalMuon(), passMuonID(), passMuonIso(), TriggerTools::passObj(), passTrack(), reco::TrackBase::phi(), reco::TrackBase::pt(), HLT_2024v10_cff::pt1, HLT_2024v10_cff::pt2, PtCutL1_, PtCutL2_, TriggerTools::readEvent(), egammaDQMOffline_cff::standAlone, HLT_2024v10_cff::track, triggers, VtxAbsZCut_, VtxNdofCut_, VtxNTracksFitCut_, and VtxRhoCut_.

346  { // Fill event tree on the fly
347  edm::LogInfo("ZCounting") << "ZCounting::analyze" << std::endl;
348 
349  //-------------------------------
350  //--- Vertex
351  //-------------------------------
353  iEvent.getByToken(fPVName_token, hVertexProduct);
354  if (!hVertexProduct.isValid()) {
355  edm::LogWarning("ZCounting") << "ZCounting::analyze - no valid primary vertex product found" << std::endl;
356  return;
357  }
358 
359  const reco::Vertex* pv = nullptr;
360  int nvtx = 0;
361 
362  for (auto const& itVtx : *hVertexProduct) {
363  if (itVtx.isFake())
364  continue;
365  if (itVtx.tracksSize() < VtxNTracksFitCut_)
366  continue;
367  if (itVtx.ndof() < VtxNdofCut_)
368  continue;
369  if (fabs(itVtx.z()) > VtxAbsZCut_)
370  continue;
371  if (itVtx.position().Rho() > VtxRhoCut_)
372  continue;
373 
374  if (nvtx == 0) {
375  pv = &itVtx;
376  }
377  nvtx++;
378  }
379 
380  h_npv->Fill(iEvent.luminosityBlock(), nvtx);
381 
382  //-------------------------------
383  //--- Trigger
384  //-------------------------------
386 
387  // Trigger requirement
388  if (!triggers->pass())
389  return;
390 
391  //-------------------------------
392  //--- Muon and Track collections
393  //-------------------------------
395  iEvent.getByToken(fMuonName_token, hMuonProduct);
396  if (!hMuonProduct.isValid()) {
397  edm::LogWarning("ZCounting") << "ZCounting::analyze - no valid hMuonProduct found" << std::endl;
398  return;
399  }
400 
402  iEvent.getByToken(fTrackName_token, hTrackProduct);
403  if (!hTrackProduct.isValid()) {
404  edm::LogWarning("ZCounting") << "ZCounting::analyze - no valid hTrackProduct found" << std::endl;
405  return;
406  }
407 
408  //-------------------------------
409  //--- Merged standalone muon collections
410  //--- The muon collection contains duplicates (from standAloneMuons and standAloneMuons:UpdatedAtVtx collections) and missing standAloneMuons
411  //--- We need to produce a merged standalone muon collection to reproduce the decision in the global muon producer
412  //-------------------------------
413  edm::Handle<reco::TrackCollection> tracksStandAlone;
414  iEvent.getByToken(fStandaloneRegName_token, tracksStandAlone);
415  if (!tracksStandAlone.isValid()) {
416  edm::LogWarning("ZCounting") << "ZCounting::analyze - no valid tracksStandAlone found" << std::endl;
417  return;
418  }
419 
420  edm::Handle<reco::TrackCollection> tracksStandAloneUpdatedAtVtx;
421  iEvent.getByToken(fStandaloneUpdName_token, tracksStandAloneUpdatedAtVtx);
422  if (!tracksStandAloneUpdatedAtVtx.isValid()) {
423  edm::LogWarning("ZCounting") << "ZCounting::analyze - no valid tracksStandAloneUpdatedAtVtx found" << std::endl;
424  return;
425  }
426 
427  std::vector<const reco::Track*> hStandaloneProduct;
428  std::vector<bool> passGlobalMuonMap;
429 
430  for (auto const& standAlone : *tracksStandAlone) {
431  auto const extraIdx = standAlone.extra().key();
432 
433  const reco::Track* track = &standAlone;
434 
435  // replicate logic in GlobalMuonProducer, take the updatedAtVtx track if it exists and has
436  // the same eta sign as the original, otherwise take the original
437  for (auto const& standAloneUpdatedAtVtx : *tracksStandAloneUpdatedAtVtx) {
438  if (standAloneUpdatedAtVtx.extra().key() == extraIdx) {
439  const bool etaFlip1 = (standAloneUpdatedAtVtx.eta() * standAlone.eta()) >= 0;
440  if (etaFlip1) {
441  track = &standAloneUpdatedAtVtx;
442  }
443  break;
444  }
445  }
446 
447  // kinematic cuts
448  if (track->pt() < MIN_PT_STA)
449  continue;
450  if (fabs(track->eta()) > MAX_ETA_STA)
451  continue;
452  // require minimum number of valid hits (mainly to reduce background)
453  if (track->numberOfValidHits() < N_STA_HITS)
454  continue;
455 
456  // look for corresponding muon object to check if the standalone muon is global
457  bool isGlobalMuon = false;
458  for (auto const& itMu2 : *hMuonProduct) {
459  if (itMu2.standAloneMuon().isNull())
460  continue;
461 
462  auto const& muonStandAlone = *itMu2.standAloneMuon();
463 
464  if (track->extra().key() == muonStandAlone.extra().key()) {
465  // we found a corresponding muon object
466  if (muonStandAlone.pt() == track->pt() && muonStandAlone.eta() == track->eta() &&
467  muonStandAlone.phi() == track->phi()) {
468  // the corresponding muon object uses the same standalone muon track
469  // check if is a global muon
470  isGlobalMuon = passGlobalMuon(itMu2);
471  }
472  break;
473  }
474  }
475 
476  passGlobalMuonMap.push_back(isGlobalMuon);
477  hStandaloneProduct.push_back(track);
478  }
479 
480  TLorentzVector vTag(0., 0., 0., 0.);
481  TLorentzVector vProbe(0., 0., 0., 0.);
482  TLorentzVector vTrack(0., 0., 0., 0.);
483 
484  // Tag loop
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();
490 
491  // Tag selection: kinematic cuts, lepton selection and trigger matching
492  if (pt1 < PtCutL1_)
493  continue;
494  if (fabs(eta1) > EtaCutL1_)
495  continue;
496  if (!(passGlobalMuon(itMu1) && passMuonID(itMu1, pv) && passMuonIso(itMu1)))
497  continue;
498  if (!triggers->passObj(eta1, phi1))
499  continue;
500 
501  vTag.SetPtEtaPhiM(pt1, eta1, phi1, MUON_MASS);
502 
503  bool isTagCentral = false;
504  if (fabs(eta1) < MUON_BOUND)
505  isTagCentral = true;
506 
507  // Probe loop over muons
508  for (auto const& itMu2 : *hMuonProduct) {
509  if (&itMu2 == &itMu1)
510  continue;
511 
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();
516 
517  // Probe selection: kinematic cuts and opposite charge requirement
518  if (pt2 < PtCutL2_)
519  continue;
520  if (fabs(eta2) > EtaCutL2_)
521  continue;
522  if (q1 == q2)
523  continue;
524 
525  vProbe.SetPtEtaPhiM(pt2, eta2, phi2, MUON_MASS);
526 
527  // Mass window
528  TLorentzVector vDilep = vTag + vProbe;
529  float dilepMass = vDilep.M();
530  if ((dilepMass < MassMin_) || (dilepMass > MassMax_))
531  continue;
532 
533  bool isProbeCentral = fabs(eta2) < MUON_BOUND;
534 
535  // Determine event category for efficiency calculation
536  if (passGlobalMuon(itMu2) && passMuonID(itMu2, pv) && passMuonIso(itMu2)) {
537  if (triggers->passObj(eta2, phi2)) {
538  // category 2HLT: both muons passing trigger requirements
539  if (&itMu1 > &itMu2)
540  continue; // make sure we don't double count MuMu2HLT category
541 
542  if (isTagCentral && isProbeCentral) {
543  h_mass_2HLT_BB->Fill(iEvent.luminosityBlock(), dilepMass);
544  } else if (!isTagCentral && !isProbeCentral) {
545  h_mass_2HLT_EE->Fill(iEvent.luminosityBlock(), dilepMass);
546  } else {
547  h_mass_2HLT_BE->Fill(iEvent.luminosityBlock(), dilepMass);
548  }
549  } else {
550  // category 1HLT: only one muon passes trigger
551  if (isTagCentral && isProbeCentral) {
552  h_mass_1HLT_BB->Fill(iEvent.luminosityBlock(), dilepMass);
553  } else if (!isTagCentral && !isProbeCentral) {
554  h_mass_1HLT_EE->Fill(iEvent.luminosityBlock(), dilepMass);
555  } else {
556  h_mass_1HLT_BE->Fill(iEvent.luminosityBlock(), dilepMass);
557  }
558  }
559  } else if (passGlobalMuon(itMu2)) {
560  // category Glo: probe is a Global muon but failing selection
561  if (isTagCentral && isProbeCentral) {
562  h_mass_ID_fail_BB->Fill(iEvent.luminosityBlock(), dilepMass);
563  } else if (!isTagCentral && !isProbeCentral) {
564  h_mass_ID_fail_EE->Fill(iEvent.luminosityBlock(), dilepMass);
565  } else {
566  h_mass_ID_fail_BE->Fill(iEvent.luminosityBlock(), dilepMass);
567  }
568  }
569  } // End of probe loop over muons
570 
571  // Probe loop over standalone muons, for global muon efficiency calculation
572  for (std::vector<reco::Track>::size_type idx = 0; idx < hStandaloneProduct.size(); idx++) {
573  const reco::Track* itSta = hStandaloneProduct[idx];
574 
575  // standalone muon kinematics
576  const float pt2 = itSta->pt();
577  const float eta2 = itSta->eta();
578  const float phi2 = itSta->phi();
579 
580  // kinematic cuts
581  if (pt2 < PtCutL2_)
582  continue;
583  if (fabs(eta2) > EtaCutL2_)
584  continue;
585 
586  vProbe.SetPtEtaPhiM(pt2, eta2, phi2, MUON_MASS);
587 
588  // Mass window
589  TLorentzVector vDilep = vTag + vProbe;
590  float dilepMass = vDilep.M();
591  if ((dilepMass < MassMin_) || (dilepMass > MassMax_))
592  continue;
593 
594  const bool isProbeCentral = fabs(eta2) < MUON_BOUND;
595 
596  if (passGlobalMuonMap[idx]) {
597  if (isTagCentral && isProbeCentral) {
598  h_mass_Glo_pass_BB->Fill(iEvent.luminosityBlock(), dilepMass);
599  } else if (!isTagCentral && !isProbeCentral) {
600  h_mass_Glo_pass_EE->Fill(iEvent.luminosityBlock(), dilepMass);
601  } else {
602  h_mass_Glo_pass_BE->Fill(iEvent.luminosityBlock(), dilepMass);
603  }
604  } else {
605  if (isTagCentral && isProbeCentral) {
606  h_mass_Glo_fail_BB->Fill(iEvent.luminosityBlock(), dilepMass);
607  } else if (!isTagCentral && !isProbeCentral) {
608  h_mass_Glo_fail_EE->Fill(iEvent.luminosityBlock(), dilepMass);
609  } else {
610  h_mass_Glo_fail_BE->Fill(iEvent.luminosityBlock(), dilepMass);
611  }
612  }
613  }
614 
615  // Probe loop over tracks, only for standalone efficiency calculation
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();
621 
622  // Probe selection: kinematic cuts and opposite charge requirement
623  if (pt2 < PtCutL2_)
624  continue;
625  if (fabs(eta2) > EtaCutL2_)
626  continue;
627  if (q1 == q2)
628  continue;
629  if (!passTrack(itTrk))
630  continue;
631 
632  vTrack.SetPtEtaPhiM(pt2, eta2, phi2, MUON_MASS);
633 
634  TLorentzVector vDilep = vTag + vTrack;
635  float dilepMass = vDilep.M();
636  if ((dilepMass < MassMin_) || (dilepMass > MassMax_))
637  continue;
638 
639  // check if track is matched to standalone muon
640  bool isStandalone = false;
641  for (const reco::Track* itSta : hStandaloneProduct) {
642  if (reco::deltaR2(itSta->eta(), itSta->phi(), eta2, phi2) < DRMAX_IO) {
643  isStandalone = true;
644  break;
645  }
646  }
647 
648  const bool isTrackCentral = fabs(eta2) < MUON_BOUND;
649 
650  if (isStandalone) {
651  if (isTagCentral && isTrackCentral) {
652  h_mass_Sta_pass_BB->Fill(iEvent.luminosityBlock(), dilepMass);
653  } else if (!isTagCentral && !isTrackCentral) {
654  h_mass_Sta_pass_EE->Fill(iEvent.luminosityBlock(), dilepMass);
655  } else {
656  h_mass_Sta_pass_BE->Fill(iEvent.luminosityBlock(), dilepMass);
657  }
658  } else {
659  if (isTagCentral && isTrackCentral) {
660  h_mass_Sta_fail_BB->Fill(iEvent.luminosityBlock(), dilepMass);
661  } else if (!isTagCentral && !isTrackCentral) {
662  h_mass_Sta_fail_EE->Fill(iEvent.luminosityBlock(), dilepMass);
663  } else {
664  h_mass_Sta_fail_BE->Fill(iEvent.luminosityBlock(), dilepMass);
665  }
666  }
667  } //End of probe loop over tracks
668  } //End of tag loop
669 }
MonitorElement * h_mass_Sta_pass_EE
Definition: ZCounting.h:135
const double MassMax_
Definition: ZCounting.h:69
MonitorElement * h_mass_Sta_pass_BE
Definition: ZCounting.h:134
MonitorElement * h_mass_Sta_fail_BE
Definition: ZCounting.h:137
bool passMuonIso(const reco::Muon &muon)
Definition: ZCounting.cc:726
const double VtxNTracksFitCut_
Definition: ZCounting.h:79
bool passTrack(const reco::Track &track)
Definition: ZCounting.cc:719
MonitorElement * h_mass_1HLT_BE
Definition: ZCounting.h:119
TriggerTools * triggers
Definition: ZCounting.h:94
const double VtxAbsZCut_
Definition: ZCounting.h:81
const double EtaCutL2_
Definition: ZCounting.h:65
MonitorElement * h_mass_Glo_pass_BB
Definition: ZCounting.h:126
MonitorElement * h_mass_2HLT_BE
Definition: ZCounting.h:115
const double EtaCutL1_
Definition: ZCounting.h:64
edm::EDGetTokenT< reco::TrackCollection > fStandaloneUpdName_token
Definition: ZCounting.h:56
uint16_t size_type
MonitorElement * h_mass_Glo_fail_BE
Definition: ZCounting.h:130
edm::EDGetTokenT< reco::TrackCollection > fTrackName_token
Definition: ZCounting.h:59
void Fill(long long x)
const double MIN_PT_STA
Definition: ZCounting.h:102
bool passMuonID(const reco::Muon &muon, const reco::Vertex *vtx)
Definition: ZCounting.cc:686
const double MUON_MASS
Definition: ZCounting.h:107
double pt() const
track transverse momentum
Definition: TrackBase.h:637
edm::EDGetTokenT< reco::MuonCollection > fMuonName_token
Definition: ZCounting.h:51
const double MassMin_
Definition: ZCounting.h:68
const double VtxNdofCut_
Definition: ZCounting.h:80
int iEvent
Definition: GenABIO.cc:224
MonitorElement * h_mass_Sta_fail_BB
Definition: ZCounting.h:136
MonitorElement * h_mass_Sta_pass_BB
Definition: ZCounting.h:133
edm::EDGetTokenT< reco::VertexCollection > fPVName_token
Definition: ZCounting.h:48
const double MAX_ETA_STA
Definition: ZCounting.h:103
MonitorElement * h_mass_ID_fail_BE
Definition: ZCounting.h:123
MonitorElement * h_mass_ID_fail_EE
Definition: ZCounting.h:124
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:649
bool pass() const
bool passObj(const double eta, const double phi) const
MonitorElement * h_npv
Definition: ZCounting.h:111
MonitorElement * h_mass_2HLT_EE
Definition: ZCounting.h:116
const double MUON_BOUND
Definition: ZCounting.h:108
MonitorElement * h_mass_2HLT_BB
Definition: ZCounting.h:114
Log< level::Info, false > LogInfo
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
MonitorElement * h_mass_ID_fail_BB
Definition: ZCounting.h:122
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
MonitorElement * h_mass_Sta_fail_EE
Definition: ZCounting.h:138
bool passGlobalMuon(const reco::Muon &muon)
Definition: ZCounting.cc:704
MonitorElement * h_mass_Glo_fail_BB
Definition: ZCounting.h:129
MonitorElement * h_mass_Glo_pass_BE
Definition: ZCounting.h:127
bool isValid() const
Definition: HandleBase.h:70
void readEvent(const edm::Event &iEvent)
Definition: TriggerTools.cc:90
const double PtCutL1_
Definition: ZCounting.h:62
MonitorElement * h_mass_1HLT_EE
Definition: ZCounting.h:120
Log< level::Warning, false > LogWarning
const double PtCutL2_
Definition: ZCounting.h:63
MonitorElement * h_mass_1HLT_BB
Definition: ZCounting.h:118
const double DRMAX_IO
Definition: ZCounting.h:98
const int N_STA_HITS
Definition: ZCounting.h:105
MonitorElement * h_mass_Glo_fail_EE
Definition: ZCounting.h:131
edm::EDGetTokenT< reco::TrackCollection > fStandaloneRegName_token
Definition: ZCounting.h:55
MonitorElement * h_mass_Glo_pass_EE
Definition: ZCounting.h:128
const double VtxRhoCut_
Definition: ZCounting.h:82

◆ bookHistograms()

void ZCounting::bookHistograms ( DQMStore::IBooker ibooker_,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 125 of file ZCounting.cc.

References dqm::implementation::IBooker::book2D(), dqm::implementation::NavigatorBase::cd(), h_mass_1HLT_BB, h_mass_1HLT_BE, h_mass_1HLT_EE, h_mass_2HLT_BB, h_mass_2HLT_BE, h_mass_2HLT_EE, h_mass_Glo_fail_BB, h_mass_Glo_fail_BE, h_mass_Glo_fail_EE, h_mass_Glo_pass_BB, h_mass_Glo_pass_BE, h_mass_Glo_pass_EE, h_mass_ID_fail_BB, h_mass_ID_fail_BE, h_mass_ID_fail_EE, h_mass_Sta_fail_BB, h_mass_Sta_fail_BE, h_mass_Sta_fail_EE, h_mass_Sta_pass_BB, h_mass_Sta_pass_BE, h_mass_Sta_pass_EE, h_npv, LumiBin_, LumiMax_, LumiMin_, MassBin_, MassMax_, MassMin_, PVBin_, PVMax_, PVMin_, dqm::impl::MonitorElement::setAxisTitle(), and dqm::implementation::NavigatorBase::setCurrentFolder().

125  {
126  edm::LogInfo("ZCounting") << "ZCounting::bookHistograms" << std::endl;
127  ibooker_.cd();
128  ibooker_.setCurrentFolder("ZCounting/Histograms");
129 
130  // Muon histograms
131  h_mass_2HLT_BB = ibooker_.book2D("h_mass_2HLT_BB",
132  "Both muon pass HLT in barrel-barrel",
133  LumiBin_,
134  LumiMin_,
135  LumiMax_,
136  MassBin_,
137  MassMin_,
138  MassMax_);
139  h_mass_2HLT_BE = ibooker_.book2D("h_mass_2HLT_BE",
140  "Both muon pass HLT passing in barrel-endcap",
141  LumiBin_,
142  LumiMin_,
143  LumiMax_,
144  MassBin_,
145  MassMin_,
146  MassMax_);
147  h_mass_2HLT_EE = ibooker_.book2D("h_mass_2HLT_EE",
148  "Both muon pass HLT passing in endcap-endcap",
149  LumiBin_,
150  LumiMin_,
151  LumiMax_,
152  MassBin_,
153  MassMin_,
154  MassMax_);
155  h_mass_1HLT_BB = ibooker_.book2D("h_mass_1HLT_BB",
156  "One muon pass HLT in barrel-barrel",
157  LumiBin_,
158  LumiMin_,
159  LumiMax_,
160  MassBin_,
161  MassMin_,
162  MassMax_);
163  h_mass_1HLT_BE = ibooker_.book2D("h_mass_1HLT_BE",
164  "One muon pass HLT passing in barrel-endcap",
165  LumiBin_,
166  LumiMin_,
167  LumiMax_,
168  MassBin_,
169  MassMin_,
170  MassMax_);
171  h_mass_1HLT_EE = ibooker_.book2D("h_mass_1HLT_EE",
172  "One muon pass HLT passing in endcap-endcap",
173  LumiBin_,
174  LumiMin_,
175  LumiMax_,
176  MassBin_,
177  MassMin_,
178  MassMax_);
179 
180  h_mass_ID_fail_BB = ibooker_.book2D(
181  "h_mass_ID_fail_BB", "Muon ID failing barrel-barrel", LumiBin_, LumiMin_, LumiMax_, MassBin_, MassMin_, MassMax_);
182  h_mass_ID_fail_BE = ibooker_.book2D(
183  "h_mass_ID_fail_BE", "Muon ID failing barrel-endcap", LumiBin_, LumiMin_, LumiMax_, MassBin_, MassMin_, MassMax_);
184 
185  h_mass_ID_fail_EE = ibooker_.book2D(
186  "h_mass_ID_fail_EE", "Muon ID failing endcap-endcap", LumiBin_, LumiMin_, LumiMax_, MassBin_, MassMin_, MassMax_);
187 
188  h_mass_Glo_pass_BB = ibooker_.book2D("h_mass_Glo_pass_BB",
189  "Muon Glo passing barrel-barrel",
190  LumiBin_,
191  LumiMin_,
192  LumiMax_,
193  MassBin_,
194  MassMin_,
195  MassMax_);
196  h_mass_Glo_pass_BE = ibooker_.book2D("h_mass_Glo_pass_BE",
197  "Muon Glo passing barrel-endcap",
198  LumiBin_,
199  LumiMin_,
200  LumiMax_,
201  MassBin_,
202  MassMin_,
203  MassMax_);
204 
205  h_mass_Glo_pass_EE = ibooker_.book2D("h_mass_Glo_pass_EE",
206  "Muon Glo passing endcap-endcap",
207  LumiBin_,
208  LumiMin_,
209  LumiMax_,
210  MassBin_,
211  MassMin_,
212  MassMax_);
213 
214  h_mass_Glo_fail_BB = ibooker_.book2D("h_mass_Glo_fail_BB",
215  "Muon Glo failing barrel-barrel",
216  LumiBin_,
217  LumiMin_,
218  LumiMax_,
219  MassBin_,
220  MassMin_,
221  MassMax_);
222  h_mass_Glo_fail_BE = ibooker_.book2D("h_mass_Glo_fail_BE",
223  "Muon Glo failing barrel-endcap",
224  LumiBin_,
225  LumiMin_,
226  LumiMax_,
227  MassBin_,
228  MassMin_,
229  MassMax_);
230 
231  h_mass_Glo_fail_EE = ibooker_.book2D("h_mass_Glo_fail_EE",
232  "Muon Glo failing endcap-endcap",
233  LumiBin_,
234  LumiMin_,
235  LumiMax_,
236  MassBin_,
237  MassMin_,
238  MassMax_);
239 
240  h_mass_Sta_pass_BB = ibooker_.book2D("h_mass_Sta_pass_BB",
241  "Muon Sta passing barrel-barrel",
242  LumiBin_,
243  LumiMin_,
244  LumiMax_,
245  MassBin_,
246  MassMin_,
247  MassMax_);
248  h_mass_Sta_pass_BE = ibooker_.book2D("h_mass_Sta_pass_BE",
249  "Muon Sta passing barrel-endcap",
250  LumiBin_,
251  LumiMin_,
252  LumiMax_,
253  MassBin_,
254  MassMin_,
255  MassMax_);
256 
257  h_mass_Sta_pass_EE = ibooker_.book2D("h_mass_Sta_pass_EE",
258  "Muon Sta passing endcap-endcap",
259  LumiBin_,
260  LumiMin_,
261  LumiMax_,
262  MassBin_,
263  MassMin_,
264  MassMax_);
265 
266  h_mass_Sta_fail_BB = ibooker_.book2D("h_mass_Sta_fail_BB",
267  "Muon Sta failing barrel-barrel",
268  LumiBin_,
269  LumiMin_,
270  LumiMax_,
271  MassBin_,
272  MassMin_,
273  MassMax_);
274  h_mass_Sta_fail_BE = ibooker_.book2D("h_mass_Sta_fail_BE",
275  "Muon Sta failing barrel-endcap",
276  LumiBin_,
277  LumiMin_,
278  LumiMax_,
279  MassBin_,
280  MassMin_,
281  MassMax_);
282 
283  h_mass_Sta_fail_EE = ibooker_.book2D("h_mass_Sta_fail_EE",
284  "Muon Sta failing endcap-endcap",
285  LumiBin_,
286  LumiMin_,
287  LumiMax_,
288  MassBin_,
289  MassMin_,
290  MassMax_);
291 
292  h_npv = ibooker_.book2D(
293  "h_npv", "Events with valid primary vertex", LumiBin_, LumiMin_, LumiMax_, PVBin_, PVMin_, PVMax_);
294 
295  // Axis titles
296  h_mass_2HLT_BB->setAxisTitle("luminosity section", 1);
297  h_mass_2HLT_BE->setAxisTitle("luminosity section", 1);
298  h_mass_2HLT_EE->setAxisTitle("luminosity section", 1);
299  h_mass_1HLT_BB->setAxisTitle("luminosity section", 1);
300  h_mass_1HLT_BE->setAxisTitle("luminosity section", 1);
301  h_mass_1HLT_EE->setAxisTitle("luminosity section", 1);
302  h_mass_ID_fail_BB->setAxisTitle("luminosity section", 1);
303  h_mass_ID_fail_BE->setAxisTitle("luminosity section", 1);
304  h_mass_ID_fail_EE->setAxisTitle("luminosity section", 1);
305  h_mass_Glo_pass_BB->setAxisTitle("luminosity section", 1);
306  h_mass_Glo_pass_BE->setAxisTitle("luminosity section", 1);
307  h_mass_Glo_pass_EE->setAxisTitle("luminosity section", 1);
308  h_mass_Glo_fail_BB->setAxisTitle("luminosity section", 1);
309  h_mass_Glo_fail_BE->setAxisTitle("luminosity section", 1);
310  h_mass_Glo_fail_EE->setAxisTitle("luminosity section", 1);
311  h_mass_Sta_pass_BB->setAxisTitle("luminosity section", 1);
312  h_mass_Sta_pass_BE->setAxisTitle("luminosity section", 1);
313  h_mass_Sta_pass_EE->setAxisTitle("luminosity section", 1);
314  h_mass_Sta_fail_BB->setAxisTitle("luminosity section", 1);
315  h_mass_Sta_fail_BE->setAxisTitle("luminosity section", 1);
316  h_mass_Sta_fail_EE->setAxisTitle("luminosity section", 1);
317  h_mass_2HLT_BB->setAxisTitle("tag and probe mass", 2);
318  h_mass_2HLT_BE->setAxisTitle("tag and probe mass", 2);
319  h_mass_2HLT_EE->setAxisTitle("tag and probe mass", 2);
320  h_mass_1HLT_BB->setAxisTitle("tag and probe mass", 2);
321  h_mass_1HLT_BE->setAxisTitle("tag and probe mass", 2);
322  h_mass_1HLT_EE->setAxisTitle("tag and probe mass", 2);
323  h_mass_ID_fail_BB->setAxisTitle("tag and probe mass", 2);
324  h_mass_ID_fail_BE->setAxisTitle("tag and probe mass", 2);
325  h_mass_ID_fail_EE->setAxisTitle("tag and probe mass", 2);
326  h_mass_Glo_pass_BB->setAxisTitle("tag and probe mass", 2);
327  h_mass_Glo_pass_BE->setAxisTitle("tag and probe mass", 2);
328  h_mass_Glo_pass_EE->setAxisTitle("tag and probe mass", 2);
329  h_mass_Glo_fail_BB->setAxisTitle("tag and probe mass", 2);
330  h_mass_Glo_fail_BE->setAxisTitle("tag and probe mass", 2);
331  h_mass_Glo_fail_EE->setAxisTitle("tag and probe mass", 2);
332  h_mass_Sta_pass_BB->setAxisTitle("tag and probe mass", 2);
333  h_mass_Sta_pass_BE->setAxisTitle("tag and probe mass", 2);
334  h_mass_Sta_pass_EE->setAxisTitle("tag and probe mass", 2);
335  h_mass_Sta_fail_BB->setAxisTitle("tag and probe mass", 2);
336  h_mass_Sta_fail_BE->setAxisTitle("tag and probe mass", 2);
337  h_mass_Sta_fail_EE->setAxisTitle("tag and probe mass", 2);
338  h_npv->setAxisTitle("luminosity section", 1);
339  h_npv->setAxisTitle("number of primary vertices", 2);
340 }
MonitorElement * h_mass_Sta_pass_EE
Definition: ZCounting.h:135
const double MassMax_
Definition: ZCounting.h:69
MonitorElement * h_mass_Sta_pass_BE
Definition: ZCounting.h:134
MonitorElement * h_mass_Sta_fail_BE
Definition: ZCounting.h:137
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * h_mass_1HLT_BE
Definition: ZCounting.h:119
const int PVBin_
Definition: ZCounting.h:75
MonitorElement * h_mass_Glo_pass_BB
Definition: ZCounting.h:126
MonitorElement * h_mass_2HLT_BE
Definition: ZCounting.h:115
MonitorElement * h_mass_Glo_fail_BE
Definition: ZCounting.h:130
const double MassMin_
Definition: ZCounting.h:68
const double LumiMax_
Definition: ZCounting.h:73
MonitorElement * h_mass_Sta_fail_BB
Definition: ZCounting.h:136
MonitorElement * h_mass_Sta_pass_BB
Definition: ZCounting.h:133
MonitorElement * h_mass_ID_fail_BE
Definition: ZCounting.h:123
MonitorElement * h_mass_ID_fail_EE
Definition: ZCounting.h:124
MonitorElement * h_npv
Definition: ZCounting.h:111
const int LumiBin_
Definition: ZCounting.h:71
MonitorElement * h_mass_2HLT_EE
Definition: ZCounting.h:116
MonitorElement * h_mass_2HLT_BB
Definition: ZCounting.h:114
const double PVMin_
Definition: ZCounting.h:76
Log< level::Info, false > LogInfo
MonitorElement * h_mass_ID_fail_BB
Definition: ZCounting.h:122
const double PVMax_
Definition: ZCounting.h:77
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * h_mass_Sta_fail_EE
Definition: ZCounting.h:138
MonitorElement * h_mass_Glo_fail_BB
Definition: ZCounting.h:129
MonitorElement * h_mass_Glo_pass_BE
Definition: ZCounting.h:127
const double LumiMin_
Definition: ZCounting.h:72
MonitorElement * h_mass_1HLT_EE
Definition: ZCounting.h:120
MonitorElement * h_mass_1HLT_BB
Definition: ZCounting.h:118
MonitorElement * h_mass_Glo_fail_EE
Definition: ZCounting.h:131
MonitorElement * h_mass_Glo_pass_EE
Definition: ZCounting.h:128
const int MassBin_
Definition: ZCounting.h:67
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ dqmBeginRun()

void ZCounting::dqmBeginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 99 of file ZCounting.cc.

References hltConfigProvider_, edm::RunBase::id(), HLTConfigProvider::init(), TriggerTools::initHLTObjects(), edm::InputTag::process(), HLTConfigProvider::processName(), HLTConfigProvider::size(), HLTConfigProvider::tableName(), triggerResultsInputTag_, and triggers.

99  {
100  edm::LogInfo("ZCounting") << "ZCounting::beginRun" << std::endl;
101 
102  // initialize triggers
103 
104  edm::LogVerbatim("ZCounting") << "ZCounting::dqmBeginRun now at " << iRun.id();
105  bool hltChanged_ = true;
106  if (hltConfigProvider_.init(iRun, iSetup, triggerResultsInputTag_.process(), hltChanged_)) {
107  edm::LogVerbatim("ZCounting") << "ZCounting::dqmBeginRun [TriggerObjMatchValueMapsProducer::beginRun] "
108  "HLTConfigProvider initialized [processName() = \""
109  << hltConfigProvider_.processName() << "\", tableName() = \""
110  << hltConfigProvider_.tableName() << "\", size() = " << hltConfigProvider_.size()
111  << "]";
112  } else {
113  edm::LogError("ZCounting") << "ZCounting::dqmBeginRun Initialization of HLTConfigProvider failed for Run="
114  << iRun.id() << " (process=\"" << triggerResultsInputTag_.process()
115  << "\") -> plugin will not produce outputs for this Run";
116  return;
117  }
118 
120 }
Log< level::Info, true > LogVerbatim
void initHLTObjects(const HLTConfigProvider &hltConfigProvider_)
Definition: TriggerTools.cc:35
const edm::InputTag triggerResultsInputTag_
Definition: ZCounting.h:47
TriggerTools * triggers
Definition: ZCounting.h:94
Log< level::Error, false > LogError
HLTConfigProvider hltConfigProvider_
Definition: ZCounting.h:93
unsigned int size() const
number of trigger paths in trigger table
Log< level::Info, false > LogInfo
const std::string & processName() const
process name
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
const std::string & tableName() const
HLT ConfDB table name.
std::string const & process() const
Definition: InputTag.h:40

◆ isCustomTightMuon()

bool ZCounting::isCustomTightMuon ( const reco::Muon muon)
private

Definition at line 677 of file ZCounting.cc.

Referenced by passMuonID().

677  {
678  // tight POG cut based ID w/o impact parameter cuts
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;
683 }

◆ passGlobalMuon()

bool ZCounting::passGlobalMuon ( const reco::Muon muon)
private

Definition at line 704 of file ZCounting.cc.

References funct::abs(), reco::deltaR2(), DRMAX_IO, MAX_ETA_STA, MAX_ETA_TRK, MIN_PT_STA, MIN_PT_TRK, and N_STA_HITS.

Referenced by analyze().

704  {
705  // Global muon selection:
706  // - standard global muon criterium,
707  // - requirements on inner and outer track pT>15 and |eta|
708  // - requirements on deltaR(inner track, outer track)
709 
710  return muon.isGlobalMuon() && muon.outerTrack()->numberOfValidHits() >= N_STA_HITS &&
711  muon.innerTrack()->pt() > MIN_PT_TRK && std::abs(muon.innerTrack()->eta()) < MAX_ETA_TRK &&
712  muon.outerTrack()->pt() > MIN_PT_STA && std::abs(muon.outerTrack()->eta()) < MAX_ETA_STA &&
714  muon.outerTrack()->eta(), muon.outerTrack()->phi(), muon.innerTrack()->eta(), muon.innerTrack()->phi()) <
715  DRMAX_IO;
716 }
const double MIN_PT_STA
Definition: ZCounting.h:102
const double MAX_ETA_TRK
Definition: ZCounting.h:101
const double MAX_ETA_STA
Definition: ZCounting.h:103
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
const double MIN_PT_TRK
Definition: ZCounting.h:100
const double DRMAX_IO
Definition: ZCounting.h:98
const int N_STA_HITS
Definition: ZCounting.h:105

◆ passMuonID()

bool ZCounting::passMuonID ( const reco::Muon muon,
const reco::Vertex vtx 
)
private

Definition at line 686 of file ZCounting.cc.

References CustomTightID, IDType_, isCustomTightMuon(), muon::isLooseMuon(), muon::isMediumMuon(), muon::isTightMuon(), LooseID, MediumID, NoneID, TightID, and L1BJetProducer_cff::vtx.

Referenced by analyze().

686  {
687  // Muon ID selection, using internal function "DataFormats/MuonReco/src/MuonSelectors.cc
688  switch (IDType_) {
689  case LooseID:
690  return muon::isLooseMuon(muon);
691  case MediumID:
692  return muon::isMediumMuon(muon);
693  case CustomTightID:
694  return isCustomTightMuon(muon);
695  case TightID:
696  return vtx != nullptr && muon::isTightMuon(muon, *vtx);
697  case NoneID:
698  return true;
699  }
700  return false;
701 }
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
bool isLooseMuon(const reco::Muon &)
bool isCustomTightMuon(const reco::Muon &muon)
Definition: ZCounting.cc:677
MuonIDTypes IDType_
Definition: ZCounting.h:89
bool isTightMuon(const reco::Muon &, const reco::Vertex &)

◆ passMuonIso()

bool ZCounting::passMuonIso ( const reco::Muon muon)
private

Definition at line 726 of file ZCounting.cc.

References IsoCut_, IsoType_, SiStripPI::max, NoneIso, PFIso, and TrackerIso.

Referenced by analyze().

726  {
727  //Muon isolation selection, up-to-date with MUO POG recommendation
728  switch (IsoType_) {
729  case TrackerIso:
730  return muon.isolationR03().sumPt < IsoCut_;
731  case PFIso:
732  return muon.pfIsolationR04().sumChargedHadronPt +
733  std::max(0.,
734  muon.pfIsolationR04().sumNeutralHadronEt + muon.pfIsolationR04().sumPhotonEt -
735  0.5 * muon.pfIsolationR04().sumPUPt) <
736  IsoCut_;
737  case NoneIso:
738  return true;
739  }
740 
741  return false;
742 }
MuonIsoTypes IsoType_
Definition: ZCounting.h:90
const double IsoCut_
Definition: ZCounting.h:86

◆ passTrack()

bool ZCounting::passTrack ( const reco::Track track)
private

Definition at line 719 of file ZCounting.cc.

References HLT_2024v10_cff::track.

Referenced by analyze().

719  {
720  return track.hitPattern().trackerLayersWithMeasurement() >= 6 && track.hitPattern().numberOfValidPixelHits() >= 1 &&
721  track.originalAlgo() != 13 // reject muon seeded tracks - InOut
722  && track.originalAlgo() != 14; // reject muon seeded tracks - OutIn
723 }

Member Data Documentation

◆ DRMAX_HLT

const double ZCounting::DRMAX_HLT = 0.01
private

Definition at line 97 of file ZCounting.h.

Referenced by ZCounting().

◆ DRMAX_IO

const double ZCounting::DRMAX_IO = 0.09
private

Definition at line 98 of file ZCounting.h.

Referenced by analyze(), and passGlobalMuon().

◆ EtaCutL1_

const double ZCounting::EtaCutL1_
private

Definition at line 64 of file ZCounting.h.

Referenced by analyze().

◆ EtaCutL2_

const double ZCounting::EtaCutL2_
private

Definition at line 65 of file ZCounting.h.

Referenced by analyze().

◆ fMuonHLTNames

std::vector<std::string> ZCounting::fMuonHLTNames
private

Definition at line 52 of file ZCounting.h.

◆ fMuonHLTObjectNames

std::vector<std::string> ZCounting::fMuonHLTObjectNames
private

Definition at line 53 of file ZCounting.h.

◆ fMuonName_token

edm::EDGetTokenT<reco::MuonCollection> ZCounting::fMuonName_token
private

Definition at line 51 of file ZCounting.h.

Referenced by analyze().

◆ fPVName_token

edm::EDGetTokenT<reco::VertexCollection> ZCounting::fPVName_token
private

Definition at line 48 of file ZCounting.h.

Referenced by analyze().

◆ fStandaloneRegName_token

edm::EDGetTokenT<reco::TrackCollection> ZCounting::fStandaloneRegName_token
private

Definition at line 55 of file ZCounting.h.

Referenced by analyze().

◆ fStandaloneUpdName_token

edm::EDGetTokenT<reco::TrackCollection> ZCounting::fStandaloneUpdName_token
private

Definition at line 56 of file ZCounting.h.

Referenced by analyze().

◆ fTrackName_token

edm::EDGetTokenT<reco::TrackCollection> ZCounting::fTrackName_token
private

Definition at line 59 of file ZCounting.h.

Referenced by analyze().

◆ h_mass_1HLT_BB

MonitorElement* ZCounting::h_mass_1HLT_BB
private

Definition at line 118 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_1HLT_BE

MonitorElement* ZCounting::h_mass_1HLT_BE
private

Definition at line 119 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_1HLT_EE

MonitorElement* ZCounting::h_mass_1HLT_EE
private

Definition at line 120 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_2HLT_BB

MonitorElement* ZCounting::h_mass_2HLT_BB
private

Definition at line 114 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_2HLT_BE

MonitorElement* ZCounting::h_mass_2HLT_BE
private

Definition at line 115 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_2HLT_EE

MonitorElement* ZCounting::h_mass_2HLT_EE
private

Definition at line 116 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Glo_fail_BB

MonitorElement* ZCounting::h_mass_Glo_fail_BB
private

Definition at line 129 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Glo_fail_BE

MonitorElement* ZCounting::h_mass_Glo_fail_BE
private

Definition at line 130 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Glo_fail_EE

MonitorElement* ZCounting::h_mass_Glo_fail_EE
private

Definition at line 131 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Glo_pass_BB

MonitorElement* ZCounting::h_mass_Glo_pass_BB
private

Definition at line 126 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Glo_pass_BE

MonitorElement* ZCounting::h_mass_Glo_pass_BE
private

Definition at line 127 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Glo_pass_EE

MonitorElement* ZCounting::h_mass_Glo_pass_EE
private

Definition at line 128 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_ID_fail_BB

MonitorElement* ZCounting::h_mass_ID_fail_BB
private

Definition at line 122 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_ID_fail_BE

MonitorElement* ZCounting::h_mass_ID_fail_BE
private

Definition at line 123 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_ID_fail_EE

MonitorElement* ZCounting::h_mass_ID_fail_EE
private

Definition at line 124 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Sta_fail_BB

MonitorElement* ZCounting::h_mass_Sta_fail_BB
private

Definition at line 136 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Sta_fail_BE

MonitorElement* ZCounting::h_mass_Sta_fail_BE
private

Definition at line 137 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Sta_fail_EE

MonitorElement* ZCounting::h_mass_Sta_fail_EE
private

Definition at line 138 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Sta_pass_BB

MonitorElement* ZCounting::h_mass_Sta_pass_BB
private

Definition at line 133 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Sta_pass_BE

MonitorElement* ZCounting::h_mass_Sta_pass_BE
private

Definition at line 134 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_mass_Sta_pass_EE

MonitorElement* ZCounting::h_mass_Sta_pass_EE
private

Definition at line 135 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ h_npv

MonitorElement* ZCounting::h_npv
private

Definition at line 111 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ hltConfigProvider_

HLTConfigProvider ZCounting::hltConfigProvider_
private

Definition at line 93 of file ZCounting.h.

Referenced by dqmBeginRun().

◆ IDType_

MuonIDTypes ZCounting::IDType_ {NoneID}
private

Definition at line 89 of file ZCounting.h.

Referenced by passMuonID(), and ZCounting().

◆ IDTypestr_

const std::string ZCounting::IDTypestr_
private

Definition at line 84 of file ZCounting.h.

Referenced by ZCounting().

◆ IsoCut_

const double ZCounting::IsoCut_
private

Definition at line 86 of file ZCounting.h.

Referenced by passMuonIso().

◆ IsoType_

MuonIsoTypes ZCounting::IsoType_ {NoneIso}
private

Definition at line 90 of file ZCounting.h.

Referenced by passMuonIso(), and ZCounting().

◆ IsoTypestr_

const std::string ZCounting::IsoTypestr_
private

Definition at line 85 of file ZCounting.h.

Referenced by ZCounting().

◆ LumiBin_

const int ZCounting::LumiBin_
private

Definition at line 71 of file ZCounting.h.

Referenced by bookHistograms().

◆ LumiMax_

const double ZCounting::LumiMax_
private

Definition at line 73 of file ZCounting.h.

Referenced by bookHistograms().

◆ LumiMin_

const double ZCounting::LumiMin_
private

Definition at line 72 of file ZCounting.h.

Referenced by bookHistograms().

◆ MassBin_

const int ZCounting::MassBin_
private

Definition at line 67 of file ZCounting.h.

Referenced by bookHistograms().

◆ MassMax_

const double ZCounting::MassMax_
private

Definition at line 69 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ MassMin_

const double ZCounting::MassMin_
private

Definition at line 68 of file ZCounting.h.

Referenced by analyze(), and bookHistograms().

◆ MAX_ETA_STA

const double ZCounting::MAX_ETA_STA = 2.4
private

Definition at line 103 of file ZCounting.h.

Referenced by analyze(), and passGlobalMuon().

◆ MAX_ETA_TRK

const double ZCounting::MAX_ETA_TRK = 2.5
private

Definition at line 101 of file ZCounting.h.

Referenced by passGlobalMuon().

◆ MIN_PT_STA

const double ZCounting::MIN_PT_STA = 15
private

Definition at line 102 of file ZCounting.h.

Referenced by analyze(), and passGlobalMuon().

◆ MIN_PT_TRK

const double ZCounting::MIN_PT_TRK = 15
private

Definition at line 100 of file ZCounting.h.

Referenced by passGlobalMuon().

◆ MUON_BOUND

const double ZCounting::MUON_BOUND = 0.9
private

Definition at line 108 of file ZCounting.h.

Referenced by analyze().

◆ MUON_MASS

const double ZCounting::MUON_MASS = 0.105658369
private

Definition at line 107 of file ZCounting.h.

Referenced by analyze().

◆ N_STA_HITS

const int ZCounting::N_STA_HITS = 1
private

Definition at line 105 of file ZCounting.h.

Referenced by analyze(), and passGlobalMuon().

◆ PtCutL1_

const double ZCounting::PtCutL1_
private

Definition at line 62 of file ZCounting.h.

Referenced by analyze().

◆ PtCutL2_

const double ZCounting::PtCutL2_
private

Definition at line 63 of file ZCounting.h.

Referenced by analyze().

◆ PVBin_

const int ZCounting::PVBin_
private

Definition at line 75 of file ZCounting.h.

Referenced by bookHistograms().

◆ PVMax_

const double ZCounting::PVMax_
private

Definition at line 77 of file ZCounting.h.

Referenced by bookHistograms().

◆ PVMin_

const double ZCounting::PVMin_
private

Definition at line 76 of file ZCounting.h.

Referenced by bookHistograms().

◆ triggerResultsInputTag_

const edm::InputTag ZCounting::triggerResultsInputTag_
private

Definition at line 47 of file ZCounting.h.

Referenced by dqmBeginRun(), and ZCounting().

◆ triggers

TriggerTools* ZCounting::triggers
private

Definition at line 94 of file ZCounting.h.

Referenced by analyze(), dqmBeginRun(), and ZCounting().

◆ VtxAbsZCut_

const double ZCounting::VtxAbsZCut_
private

Definition at line 81 of file ZCounting.h.

Referenced by analyze().

◆ VtxNdofCut_

const double ZCounting::VtxNdofCut_
private

Definition at line 80 of file ZCounting.h.

Referenced by analyze().

◆ VtxNTracksFitCut_

const double ZCounting::VtxNTracksFitCut_
private

Definition at line 79 of file ZCounting.h.

Referenced by analyze().

◆ VtxRhoCut_

const double ZCounting::VtxRhoCut_
private

Definition at line 82 of file ZCounting.h.

Referenced by analyze().