CMS 3D CMS Logo

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

#include <L1TMuonDQMOffline.h>

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

Public Types

enum  Control {
  kCtrlTagPt, kCtrlTagEta, kCtrlTagPhi, kCtrlProbePt,
  kCtrlProbeEta, kCtrlProbePhi, kCtrlTagProbeDr, kCtrlTagHltDr,
  kCtrlMuonGmtDeltaR, kCtrlNTightVsAll, kCtrlNProbesVsTight
}
 
enum  EffType { kEffPt, kEffPhi, kEffEta, kEffVtx }
 
enum  EtaRegion {
  kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf,
  kEtaRegionOut
}
 
enum  QualLevel { kQualAll, kQualOpen, kQualDouble, kQualSingle }
 
enum  ResType {
  kResPt, kRes1OverPt, kResQOverPt, kResPhi,
  kResEta, kResCh
}
 
- 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

 L1TMuonDQMOffline (const edm::ParameterSet &ps)
 
 ~L1TMuonDQMOffline () 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 (const edm::Event &e, const edm::EventSetup &c) override
 
virtual void bookControlHistos (DQMStore::IBooker &)
 
virtual void bookEfficiencyHistos (DQMStore::IBooker &ibooker)
 
void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
 
virtual void bookResolutionHistos (DQMStore::IBooker &ibooker)
 
void dqmBeginRun (const edm::Run &run, const edm::EventSetup &iSetup) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Types

typedef std::tuple< EffType, int, EtaRegionm_histoKeyEffDenVarType
 
typedef std::pair< int, QualLevelm_histoKeyEffNumEtaType
 
typedef std::tuple< EffType, int, EtaRegion, QualLevelm_histoKeyEffNumVarType
 
typedef std::tuple< ResType, EtaRegion, QualLevelm_histoKeyResType
 

Private Member Functions

std::vector< float > getHistBinsEff (EffType eff)
 
std::tuple< int, double, double > getHistBinsRes (ResType res)
 
void getMuonGmtPairs (edm::Handle< l1t::MuonBxCollection > &gmtCands, PropagateToMuon const &propagator)
 
const unsigned int getNVertices (edm::Handle< reco::VertexCollection > &vertex)
 
const reco::Vertex getPrimaryVertex (edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
 
void getProbeMuons (edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
 
void getTightMuons (edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)
 
double matchHlt (edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotm_BsInputTag
 
std::map< Control, MonitorElement * > m_ControlHistos
 
std::vector< std::pair< int, QualLevel > > m_cuts
 
std::vector< edm::ParameterSetm_cutsVPSet
 
std::map< int, MonitorElement * > m_EfficiencyDenEtaHistos
 
std::map< EtaRegion, MonitorElement * > m_EfficiencyDenPtHistos
 
std::map< std::tuple< EffType, int, EtaRegion >, MonitorElement * > m_EfficiencyDenVarHistos
 
std::map< std::pair< int, QualLevel >, MonitorElement * > m_EfficiencyNumEtaHistos
 
std::map< std::tuple< EffType, int, EtaRegion, QualLevel >, MonitorElement * > m_EfficiencyNumVarHistos
 
std::map< EffType, std::string > m_effLabelStrings
 
std::map< EffType, std::string > m_effStrings
 
const std::vector< EffTypem_effTypes
 
std::vector< double > m_effVsEtaBins
 
std::vector< double > m_effVsPhiBins
 
std::vector< double > m_effVsPtBins
 
std::vector< double > m_effVsVtxBins
 
const std::vector< EtaRegionm_etaRegions
 
std::map< EtaRegion, std::string > m_etaStrings
 
edm::EDGetTokenT< l1t::MuonBxCollectionm_GmtInputTag
 
std::string m_HistFolder
 
HLTConfigProvider m_hltConfig
 
BXVector< l1t::Muonm_L1tL1tMuons
 
std::vector< l1t::MuonBxCollectionm_L1tMuons
 
float m_maxGmtMuonDR
 
float m_maxHltMuonDR
 
float m_minTagProbeDR
 
std::vector< MuonGmtPairm_MuonGmtPairs
 
edm::EDGetTokenT< reco::MuonCollectionm_MuonInputTag
 
std::vector< const reco::Muon * > m_ProbeMuons
 
PropagateToMuonSetup const m_propagatorSetup
 
const std::vector< QualLevelm_qualLevelsRes
 
std::map< QualLevel, std::string > m_qualStrings
 
std::vector< reco::MuonCollectionm_RecoMuons
 
std::vector< reco::Muonm_RecoRecoMuons
 
double m_recoToL1PtCutFactor
 
std::map< ResType, std::string > m_resLabelStrings
 
std::map< std::tuple< ResType, EtaRegion, QualLevel >, MonitorElement * > m_ResolutionHistos
 
std::map< ResType, std::string > m_resStrings
 
const std::vector< ResTypem_resTypes
 
double m_TagPtCut
 
std::vector< const reco::Muon * > m_TightMuons
 
std::vector< int > m_trigIndices
 
edm::EDGetTokenT< trigger::TriggerEventm_trigInputTag
 
std::vector< std::string > m_trigNames
 
std::string m_trigProcess
 
edm::EDGetTokenT< edm::TriggerResultsm_trigProcess_token
 
bool m_useAtVtxCoord
 
bool m_verbose
 
edm::EDGetTokenT< reco::VertexCollectionm_VtxInputTag
 

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 63 of file L1TMuonDQMOffline.h.

Member Typedef Documentation

◆ m_histoKeyEffDenVarType

Definition at line 119 of file L1TMuonDQMOffline.h.

◆ m_histoKeyEffNumEtaType

typedef std::pair<int, QualLevel> L1TMuonDQMOffline::m_histoKeyEffNumEtaType
private

Definition at line 117 of file L1TMuonDQMOffline.h.

◆ m_histoKeyEffNumVarType

Definition at line 116 of file L1TMuonDQMOffline.h.

◆ m_histoKeyResType

Definition at line 114 of file L1TMuonDQMOffline.h.

Member Enumeration Documentation

◆ Control

◆ EffType

◆ EtaRegion

◆ QualLevel

◆ ResType

Constructor & Destructor Documentation

◆ L1TMuonDQMOffline()

L1TMuonDQMOffline::L1TMuonDQMOffline ( const edm::ParameterSet ps)

Definition at line 110 of file L1TMuonDQMOffline.cc.

References kEffEta, kEffPhi, kEffPt, and kEffVtx.

111  : m_propagatorSetup(ps.getParameter<edm::ParameterSet>("muProp"), consumesCollector()),
116  m_effStrings({{kEffPt, "pt"}, {kEffPhi, "phi"}, {kEffEta, "eta"}, {kEffVtx, "vtx"}}),
117  m_effLabelStrings({{kEffPt, "p_{T} (GeV)"}, {kEffPhi, "#phi"}, {kEffEta, "#eta"}, {kEffVtx, "# vertices"}}),
118  m_resStrings({{kResPt, "pt"},
119  {kRes1OverPt, "1overpt"},
120  {kResQOverPt, "qoverpt"},
121  {kResPhi, "phi"},
122  {kResEta, "eta"},
123  {kResCh, "charge"}}),
124  m_resLabelStrings({{kResPt, "(p_{T}^{L1} - p_{T}^{reco})/p_{T}^{reco}"},
125  {kRes1OverPt, "(p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
126  {kResQOverPt, "(q^{L1}*q^{reco}*p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"},
127  {kResPhi, "#phi_{L1} - #phi_{reco}"},
128  {kResEta, "#eta_{L1} - #eta_{reco}"},
129  {kResCh, "charge^{L1} - charge^{reco}"}}),
130  m_etaStrings({{kEtaRegionAll, "etaMin0_etaMax2p4"},
131  {kEtaRegionBmtf, "etaMin0_etaMax0p83"},
132  {kEtaRegionOmtf, "etaMin0p83_etaMax1p24"},
133  {kEtaRegionEmtf, "etaMin1p24_etaMax2p4"}}),
135  {{kQualAll, "qualAll"}, {kQualOpen, "qualOpen"}, {kQualDouble, "qualDouble"}, {kQualSingle, "qualSingle"}}),
136  m_verbose(ps.getUntrackedParameter<bool>("verbose")),
137  m_HistFolder(ps.getUntrackedParameter<string>("histFolder")),
138  m_TagPtCut(ps.getUntrackedParameter<double>("tagPtCut")),
139  m_recoToL1PtCutFactor(ps.getUntrackedParameter<double>("recoToL1PtCutFactor")),
140  m_cutsVPSet(ps.getUntrackedParameter<std::vector<edm::ParameterSet>>("cuts")),
141  m_MuonInputTag(consumes<reco::MuonCollection>(ps.getUntrackedParameter<InputTag>("muonInputTag"))),
142  m_GmtInputTag(consumes<l1t::MuonBxCollection>(ps.getUntrackedParameter<InputTag>("gmtInputTag"))),
143  m_VtxInputTag(consumes<VertexCollection>(ps.getUntrackedParameter<InputTag>("vtxInputTag"))),
144  m_BsInputTag(consumes<BeamSpot>(ps.getUntrackedParameter<InputTag>("bsInputTag"))),
145  m_trigInputTag(consumes<trigger::TriggerEvent>(ps.getUntrackedParameter<InputTag>("trigInputTag"))),
146  m_trigProcess(ps.getUntrackedParameter<string>("trigProcess")),
147  m_trigProcess_token(consumes<edm::TriggerResults>(ps.getUntrackedParameter<InputTag>("trigProcess_token"))),
148  m_trigNames(ps.getUntrackedParameter<vector<string>>("triggerNames")),
149  m_effVsPtBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsPtBins")),
150  m_effVsPhiBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsPhiBins")),
151  m_effVsEtaBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsEtaBins")),
152  m_effVsVtxBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsVtxBins")),
153  m_useAtVtxCoord(ps.getUntrackedParameter<bool>("useL1AtVtxCoord")),
154  m_maxGmtMuonDR(0.3),
155  m_minTagProbeDR(0.5),
156  m_maxHltMuonDR(0.1) {
157  if (m_verbose)
158  edm::LogInfo("L1TMuonDQMOffline") << "____________ Storage initialization ____________ " << endl;
159 
160  for (const auto& cutsPSet : m_cutsVPSet) {
161  const auto qCut = cutsPSet.getUntrackedParameter<int>("qualCut");
162  QualLevel qLevel = kQualAll;
163  if (qCut > 11) {
164  qLevel = kQualSingle;
165  } else if (qCut > 7) {
166  qLevel = kQualDouble;
167  } else if (qCut > 3) {
168  qLevel = kQualOpen;
169  }
170  m_cuts.emplace_back(std::make_pair(cutsPSet.getUntrackedParameter<int>("ptCut"), qLevel));
171  }
172 }
std::map< EffType, std::string > m_effStrings
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::BeamSpot > m_BsInputTag
edm::EDGetTokenT< reco::MuonCollection > m_MuonInputTag
std::vector< double > m_effVsVtxBins
std::map< ResType, std::string > m_resLabelStrings
std::map< EtaRegion, std::string > m_etaStrings
edm::EDGetTokenT< edm::TriggerResults > m_trigProcess_token
const std::vector< EtaRegion > m_etaRegions
std::vector< double > m_effVsPhiBins
std::string m_HistFolder
std::vector< std::string > m_trigNames
std::map< QualLevel, std::string > m_qualStrings
T getUntrackedParameter(std::string const &, T const &) const
std::string m_trigProcess
std::vector< edm::ParameterSet > m_cutsVPSet
std::map< EffType, std::string > m_effLabelStrings
edm::EDGetTokenT< l1t::MuonBxCollection > m_GmtInputTag
std::vector< double > m_effVsPtBins
PropagateToMuonSetup const m_propagatorSetup
std::vector< std::pair< int, QualLevel > > m_cuts
const std::vector< EffType > m_effTypes
const std::vector< QualLevel > m_qualLevelsRes
Log< level::Info, false > LogInfo
std::map< ResType, std::string > m_resStrings
std::vector< double > m_effVsEtaBins
const std::vector< ResType > m_resTypes
edm::EDGetTokenT< reco::VertexCollection > m_VtxInputTag
edm::EDGetTokenT< trigger::TriggerEvent > m_trigInputTag

◆ ~L1TMuonDQMOffline()

L1TMuonDQMOffline::~L1TMuonDQMOffline ( )
override

Definition at line 175 of file L1TMuonDQMOffline.cc.

175 {}

Member Function Documentation

◆ analyze()

void L1TMuonDQMOffline::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 214 of file L1TMuonDQMOffline.cc.

References edm::HLTGlobalStatus::accept(), pwdgSkimBPark_cfi::beamSpot, DMR_cfg::cut, options_cfi::eventSetup, getMuonGmtPairs(), getNVertices(), getPrimaryVertex(), getProbeMuons(), getTightMuons(), iEvent, kEffEta, kEffPt, kEffVtx, kEtaRegionAll, kEtaRegionOut, kQualAll, kResPt, m_BsInputTag, m_cuts, m_EfficiencyDenEtaHistos, m_EfficiencyDenPtHistos, m_EfficiencyDenVarHistos, m_EfficiencyNumEtaHistos, m_EfficiencyNumVarHistos, m_effTypes, m_GmtInputTag, m_hltConfig, m_MuonGmtPairs, m_MuonInputTag, m_ProbeMuons, m_propagatorSetup, m_qualLevelsRes, m_recoToL1PtCutFactor, m_ResolutionHistos, m_resTypes, m_TightMuons, m_trigIndices, m_trigInputTag, m_trigProcess_token, m_verbose, m_VtxInputTag, PDWG_BPHSkim_cff::muons, L1TkPrimaryVertex_cfi::nVtx, BeamMonitor_cff::primaryVertex, TrackCandidateProducer_cfi::propagator, L1TMuonDQMOffline_cfi::qualCut, B2GTnPMonitor_cfi::trigEvent, HLTConfigProvider::triggerName(), trigObjTnPSource_cfi::var, and bphysicsOniaDQM_cfi::vertex.

214  {
215  if (m_verbose)
216  edm::LogInfo("L1TMuonDQMOffline") << "\nProcessing new event in analyze" << endl;
217 
218  auto const propagator = m_propagatorSetup.init(eventSetup);
219 
221  iEvent.getByToken(m_MuonInputTag, muons);
223  iEvent.getByToken(m_BsInputTag, beamSpot);
225  iEvent.getByToken(m_VtxInputTag, vertex);
227  iEvent.getByToken(m_GmtInputTag, gmtCands);
228  Handle<edm::TriggerResults> trigResults;
229  iEvent.getByToken(m_trigProcess_token, trigResults);
231  iEvent.getByToken(m_trigInputTag, trigEvent);
232 
233  // Only process event if at least one trigger fired
234  bool pass_HLT = false;
235  for (const auto& tIndex : m_trigIndices) {
236  if (trigResults->accept(tIndex)) {
237  if (m_verbose)
238  edm::LogInfo("L1TMuonDQMOffline") << "Fired trigger " << m_hltConfig.triggerName(tIndex) << endl;
239  pass_HLT = true;
240  break;
241  }
242  }
243  if (not pass_HLT) {
244  if (m_verbose)
245  edm::LogInfo("L1TMuonDQMOffline") << "Did not fire any triggers - quitting" << endl;
246  return;
247  }
248 
249  const auto nVtx = getNVertices(vertex);
251 
253  getProbeMuons(trigResults, trigEvent); // CB add flag to run on orthogonal datasets (no T&P)
254 
255  getMuonGmtPairs(gmtCands, propagator);
256 
257  if (m_verbose)
258  edm::LogInfo("L1TMuonDQMOffline") << "Computing efficiencies with " << m_MuonGmtPairs.size() << " muonGmtPairs, "
259  << m_TightMuons.size() << " tight muons, " << m_ProbeMuons.size()
260  << " probe muons" << endl;
261 
262  vector<MuonGmtPair>::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin();
263  vector<MuonGmtPair>::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end();
264 
265  // To fill once for global eta and once for TF eta region of the L1T muon.
266  // The second entry is a placeholder and will be replaced by the TF eta region of the L1T muon.
267  std::array<EtaRegion, 2> regsToFill{{kEtaRegionAll, kEtaRegionAll}};
268 
269  for (; muonGmtPairsIt != muonGmtPairsEnd; ++muonGmtPairsIt) {
270  // Fill the resolution histograms
271  if ((muonGmtPairsIt->etaRegion() != kEtaRegionOut) && (muonGmtPairsIt->gmtPt() > 0)) {
272  regsToFill[1] = muonGmtPairsIt->etaRegion();
274  for (const auto var : m_resTypes) {
275  const auto varToFill = muonGmtPairsIt->getDeltaVar(var);
276  std::get<0>(histoKeyRes) = var;
277  // Fill for the global eta and for TF eta region that the probe muon is in
278  for (const auto regToFill : regsToFill) {
279  std::get<1>(histoKeyRes) = regToFill;
280  for (const auto qualLevel : m_qualLevelsRes) {
281  // This assumes that the qualLevel enum has increasing qualities
282  // HW quality levels can be 0, 4, 8, or 12
283  int qualCut = qualLevel * 4;
284  if (muonGmtPairsIt->gmtQual() >= qualCut) {
285  std::get<2>(histoKeyRes) = qualLevel;
286  m_ResolutionHistos[histoKeyRes]->Fill(varToFill);
287  if (m_verbose)
288  edm::LogInfo("L1TMuonDQMOffline")
289  << "Filled resolution histo[" << std::get<0>(histoKeyRes) << ", " << std::get<1>(histoKeyRes)
290  << ", " << std::get<2>(histoKeyRes) << "] with " << varToFill << endl;
291  }
292  }
293  }
294  }
295  }
296 
297  // Fill the efficiency numerator and denominator histograms
298  if (muonGmtPairsIt->etaRegion() != kEtaRegionOut) {
299  unsigned int cutsCounter = 0;
300  for (const auto& cut : m_cuts) {
301  const auto gmtPtCut = cut.first;
302  const auto qualLevel = cut.second;
303  const bool gmtAboveCut = (muonGmtPairsIt->gmtPt() > gmtPtCut);
304 
305  // default keys
306  m_histoKeyEffDenVarType histoKeyEffDenVar = {kEffPt, gmtPtCut, kEtaRegionAll};
307  m_histoKeyEffNumVarType histoKeyEffNumVar = {kEffPt, gmtPtCut, kEtaRegionAll, qualLevel};
308 
309  regsToFill[1] = muonGmtPairsIt->etaRegion();
310  for (const auto var : m_effTypes) {
311  if (var != kEffPt) {
312  if (muonGmtPairsIt->pt() < m_recoToL1PtCutFactor * gmtPtCut)
313  break; // efficiency at plateau
314  }
315  double varToFill;
316  if (var == kEffVtx) {
317  varToFill = static_cast<double>(nVtx);
318  } else {
319  varToFill = muonGmtPairsIt->getVar(var);
320  }
321  // Fill denominators
322  if (var == kEffEta) {
323  m_EfficiencyDenEtaHistos[gmtPtCut]->Fill(varToFill);
324  if (m_verbose)
325  edm::LogInfo("L1TMuonDQMOffline")
326  << "Filled eff denom eta histo[" << gmtPtCut << "] with " << varToFill << endl;
327  } else {
328  std::get<0>(histoKeyEffDenVar) = var;
329  // Fill for the global eta and for TF eta region that the probe muon is in
330  for (const auto regToFill : regsToFill) {
331  if (var == kEffPt) {
332  if (cutsCounter == 0) {
333  m_EfficiencyDenPtHistos[regToFill]->Fill(varToFill);
334  if (m_verbose)
335  edm::LogInfo("L1TMuonDQMOffline")
336  << "Filled eff denom pT histo[" << regToFill << "] with " << varToFill << endl;
337  }
338  } else {
339  std::get<2>(histoKeyEffDenVar) = regToFill;
340  m_EfficiencyDenVarHistos[histoKeyEffDenVar]->Fill(varToFill);
341  if (m_verbose)
342  edm::LogInfo("L1TMuonDQMOffline") << "Filled eff denom histo[" << std::get<0>(histoKeyEffDenVar)
343  << ", " << std::get<1>(histoKeyEffDenVar) << ", "
344  << std::get<2>(histoKeyEffDenVar) << "] with " << varToFill << endl;
345  }
346  }
347  }
348  // Fill numerators
349  std::get<0>(histoKeyEffNumVar) = var;
350  // This assumes that the qualLevel enum has increasing qualities
351  if (gmtAboveCut && muonGmtPairsIt->gmtQual() >= qualLevel * 4) {
352  if (var == kEffEta) {
353  m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel};
354  m_EfficiencyNumEtaHistos[histoKeyEffNumEta]->Fill(varToFill);
355  if (m_verbose)
356  edm::LogInfo("L1TMuonDQMOffline")
357  << "Filled eff num eta histo[" << std::get<0>(histoKeyEffNumEta) << ", "
358  << std::get<1>(histoKeyEffNumEta) << "] with " << varToFill << endl;
359  } else {
360  std::get<3>(histoKeyEffNumVar) = qualLevel;
361  // Fill for the global eta and for TF eta region that the probe muon is in
362  for (const auto regToFill : regsToFill) {
363  std::get<2>(histoKeyEffNumVar) = regToFill;
364  m_EfficiencyNumVarHistos[histoKeyEffNumVar]->Fill(varToFill);
365  if (m_verbose)
366  edm::LogInfo("L1TMuonDQMOffline")
367  << "Filled eff num histo[" << std::get<0>(histoKeyEffNumVar) << ", "
368  << std::get<1>(histoKeyEffNumVar) << ", " << std::get<2>(histoKeyEffNumVar) << ", "
369  << std::get<3>(histoKeyEffNumVar) << "] with " << varToFill << endl;
370  }
371  }
372  }
373  }
374  ++cutsCounter;
375  }
376  }
377  }
378 
379  if (m_verbose)
380  edm::LogInfo("L1TMuonDQMOffline") << "Computation finished" << endl;
381 }
bool accept() const
Has at least one path accepted the event?
const std::string & triggerName(unsigned int triggerIndex) const
edm::EDGetTokenT< reco::BeamSpot > m_BsInputTag
edm::EDGetTokenT< reco::MuonCollection > m_MuonInputTag
edm::EDGetTokenT< edm::TriggerResults > m_trigProcess_token
std::map< std::tuple< ResType, EtaRegion, QualLevel >, MonitorElement * > m_ResolutionHistos
std::map< EtaRegion, MonitorElement * > m_EfficiencyDenPtHistos
std::tuple< EffType, int, EtaRegion, QualLevel > m_histoKeyEffNumVarType
std::pair< int, QualLevel > m_histoKeyEffNumEtaType
std::tuple< ResType, EtaRegion, QualLevel > m_histoKeyResType
std::vector< const reco::Muon * > m_ProbeMuons
void getProbeMuons(edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
const unsigned int getNVertices(edm::Handle< reco::VertexCollection > &vertex)
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< l1t::MuonBxCollection > m_GmtInputTag
std::tuple< EffType, int, EtaRegion > m_histoKeyEffDenVarType
std::map< std::pair< int, QualLevel >, MonitorElement * > m_EfficiencyNumEtaHistos
PropagateToMuonSetup const m_propagatorSetup
std::map< int, MonitorElement * > m_EfficiencyDenEtaHistos
std::vector< std::pair< int, QualLevel > > m_cuts
const std::vector< EffType > m_effTypes
const std::vector< QualLevel > m_qualLevelsRes
std::vector< MuonGmtPair > m_MuonGmtPairs
std::map< std::tuple< EffType, int, EtaRegion >, MonitorElement * > m_EfficiencyDenVarHistos
Log< level::Info, false > LogInfo
HLTConfigProvider m_hltConfig
const reco::Vertex getPrimaryVertex(edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
std::vector< const reco::Muon * > m_TightMuons
const std::vector< ResType > m_resTypes
edm::EDGetTokenT< reco::VertexCollection > m_VtxInputTag
edm::EDGetTokenT< trigger::TriggerEvent > m_trigInputTag
std::map< std::tuple< EffType, int, EtaRegion, QualLevel >, MonitorElement * > m_EfficiencyNumVarHistos
primaryVertex
hltOfflineBeamSpot for HLTMON
void getMuonGmtPairs(edm::Handle< l1t::MuonBxCollection > &gmtCands, PropagateToMuon const &propagator)
std::vector< int > m_trigIndices
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)

◆ bookControlHistos()

void L1TMuonDQMOffline::bookControlHistos ( DQMStore::IBooker ibooker)
protectedvirtual

Definition at line 384 of file L1TMuonDQMOffline.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), kCtrlMuonGmtDeltaR, kCtrlNProbesVsTight, kCtrlNTightVsAll, kCtrlProbeEta, kCtrlProbePhi, kCtrlProbePt, kCtrlTagEta, kCtrlTagHltDr, kCtrlTagPhi, kCtrlTagProbeDr, kCtrlTagPt, m_ControlHistos, m_HistFolder, m_verbose, and dqm::implementation::NavigatorBase::setCurrentFolder().

Referenced by bookHistograms().

384  {
385  if (m_verbose)
386  edm::LogInfo("L1TMuonDQMOffline") << "Booking Control Plot Histos" << endl;
387 
388  ibooker.setCurrentFolder(m_HistFolder + "/control_variables");
389 
390  m_ControlHistos[kCtrlMuonGmtDeltaR] = ibooker.book1D("MuonGmtDeltaR", "MuonGmtDeltaR; #DeltaR", 50, 0., 0.5);
392  ibooker.book2D("NTightVsAll", "NTightVsAll; # muons; # tight muons", 20, -0.5, 19.5, 16, -0.5, 15.5);
394  ibooker.book2D("NProbesVsTight", "NProbesVsTight; # tight muons; # probe muons", 8, -0.5, 7.5, 8, -0.5, 7.5);
395 
396  m_ControlHistos[kCtrlTagPt] = ibooker.book1D("TagMuonPt", "TagMuonPt; p_{T}", 50, 0., 100.);
397  m_ControlHistos[kCtrlTagPhi] = ibooker.book1D("TagMuonPhi", "TagMuonPhi; #phi", 66, -3.3, 3.3);
398  m_ControlHistos[kCtrlTagEta] = ibooker.book1D("TagMuonEta", "TagMuonEta; #eta", 50, -2.5, 2.5);
399 
400  m_ControlHistos[kCtrlProbePt] = ibooker.book1D("ProbeMuonPt", "ProbeMuonPt; p_{T}", 50, 0., 100.);
401  m_ControlHistos[kCtrlProbePhi] = ibooker.book1D("ProbeMuonPhi", "ProbeMuonPhi; #phi", 66, -3.3, 3.3);
402  m_ControlHistos[kCtrlProbeEta] = ibooker.book1D("ProbeMuonEta", "ProbeMuonEta; #eta", 50, -2.5, 2.5);
403 
405  ibooker.book1D("TagMuonProbeMuonDeltaR", "TagMuonProbeMuonDeltaR; #DeltaR", 50, 0., 5.0);
406  m_ControlHistos[kCtrlTagHltDr] = ibooker.book1D("TagMuonHltDeltaR", "TagMuonHltDeltaR;#DeltaR", 55, 0., 0.11);
407 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::string m_HistFolder
Log< level::Info, false > LogInfo
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 * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::map< Control, MonitorElement * > m_ControlHistos

◆ bookEfficiencyHistos()

void L1TMuonDQMOffline::bookEfficiencyHistos ( DQMStore::IBooker ibooker)
protectedvirtual

Definition at line 410 of file L1TMuonDQMOffline.cc.

References dqm::implementation::IBooker::book1D(), DMR_cfg::cut, getHistBinsEff(), kEffEta, kEffPt, m_cuts, m_EfficiencyDenEtaHistos, m_EfficiencyDenPtHistos, m_EfficiencyDenVarHistos, m_EfficiencyNumEtaHistos, m_EfficiencyNumVarHistos, m_effLabelStrings, m_effStrings, m_effTypes, m_etaRegions, m_etaStrings, m_HistFolder, m_qualStrings, Skims_PA_cff::name, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, cond::impl::to_string(), and trigObjTnPSource_cfi::var.

Referenced by bookHistograms().

410  {
411  ibooker.setCurrentFolder(m_HistFolder + "/numerators_and_denominators");
412 
413  for (const auto var : m_effTypes) {
414  auto histBins = getHistBinsEff(var);
415  // histograms for eta variable get a special treatment
416  if (var == kEffEta) {
417  for (const auto& cut : m_cuts) {
418  const auto gmtPtCut = cut.first;
419  const auto qualLevel = cut.second;
420  std::string name = "effDen_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut);
421  m_EfficiencyDenEtaHistos[gmtPtCut] =
422  ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]);
423  name = "effNum_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + m_qualStrings[qualLevel];
424  m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel};
425  m_EfficiencyNumEtaHistos[histoKeyEffNumEta] =
426  ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]);
427  }
428  } else {
429  for (const auto etaReg : m_etaRegions) {
430  // denominator histograms for pt variable get a special treatment
431  if (var == kEffPt) {
432  std::string name = "effDen_" + m_effStrings[var] + "_" + m_etaStrings[etaReg];
433  m_EfficiencyDenPtHistos[etaReg] =
434  ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]);
435  } else {
436  for (const auto& cut : m_cuts) {
437  const int gmtPtCut = cut.first;
438  std::string name =
439  "effDen_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + m_etaStrings[etaReg];
440  m_histoKeyEffDenVarType histoKeyEffDenVar = {var, gmtPtCut, etaReg};
441  m_EfficiencyDenVarHistos[histoKeyEffDenVar] =
442  ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]);
443  }
444  }
445  for (const auto& cut : m_cuts) {
446  const auto gmtPtCut = cut.first;
447  const auto qualLevel = cut.second;
448  std::string name = "effNum_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" +
449  m_etaStrings[etaReg] + "_" + m_qualStrings[qualLevel];
450  m_histoKeyEffNumVarType histoKeyEffNum = {var, gmtPtCut, etaReg, qualLevel};
451  m_EfficiencyNumVarHistos[histoKeyEffNum] =
452  ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]);
453  }
454  }
455  }
456  }
457 }
std::map< EffType, std::string > m_effStrings
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::map< EtaRegion, std::string > m_etaStrings
const std::vector< EtaRegion > m_etaRegions
std::string to_string(const V &value)
Definition: OMSAccess.h:71
std::map< EtaRegion, MonitorElement * > m_EfficiencyDenPtHistos
std::tuple< EffType, int, EtaRegion, QualLevel > m_histoKeyEffNumVarType
std::string m_HistFolder
std::pair< int, QualLevel > m_histoKeyEffNumEtaType
std::vector< float > getHistBinsEff(EffType eff)
std::map< QualLevel, std::string > m_qualStrings
std::map< EffType, std::string > m_effLabelStrings
std::tuple< EffType, int, EtaRegion > m_histoKeyEffDenVarType
std::map< std::pair< int, QualLevel >, MonitorElement * > m_EfficiencyNumEtaHistos
std::map< int, MonitorElement * > m_EfficiencyDenEtaHistos
std::vector< std::pair< int, QualLevel > > m_cuts
const std::vector< EffType > m_effTypes
std::map< std::tuple< EffType, int, EtaRegion >, MonitorElement * > m_EfficiencyDenVarHistos
std::map< std::tuple< EffType, int, EtaRegion, QualLevel >, MonitorElement * > m_EfficiencyNumVarHistos
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ bookHistograms()

void L1TMuonDQMOffline::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 185 of file L1TMuonDQMOffline.cc.

References bookControlHistos(), bookEfficiencyHistos(), bookResolutionHistos(), createfilelist::int, m_hltConfig, m_trigIndices, m_trigNames, m_verbose, HLTConfigProvider::size(), and HLTConfigProvider::triggerName().

185  {
186  //book histos
187  bookControlHistos(ibooker);
188  bookEfficiencyHistos(ibooker);
189  bookResolutionHistos(ibooker);
190 
191  vector<string>::const_iterator trigNamesIt = m_trigNames.begin();
192  vector<string>::const_iterator trigNamesEnd = m_trigNames.end();
193 
194  for (; trigNamesIt != trigNamesEnd; ++trigNamesIt) {
195  TString tNameTmp = TString(*trigNamesIt); // use TString as it handles regex
196  TRegexp tNamePattern = TRegexp(tNameTmp, true);
197  int tIndex = -1;
198 
199  for (unsigned ipath = 0; ipath < m_hltConfig.size(); ++ipath) {
200  TString tmpName = TString(m_hltConfig.triggerName(ipath));
201  if (tmpName.Contains(tNamePattern)) {
202  tIndex = int(ipath);
203  m_trigIndices.push_back(tIndex);
204  if (m_verbose)
205  edm::LogInfo("L1TMuonDQMOffline") << "Found trigger " << tmpName << " with index " << tIndex << endl;
206  }
207  }
208  if (tIndex < 0 && m_verbose)
209  edm::LogInfo("L1TMuonDQMOffline") << "Warning: Could not find trigger " << (*trigNamesIt) << endl;
210  }
211 }
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< std::string > m_trigNames
virtual void bookControlHistos(DQMStore::IBooker &)
unsigned int size() const
number of trigger paths in trigger table
Log< level::Info, false > LogInfo
virtual void bookResolutionHistos(DQMStore::IBooker &ibooker)
HLTConfigProvider m_hltConfig
std::vector< int > m_trigIndices
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker)

◆ bookResolutionHistos()

void L1TMuonDQMOffline::bookResolutionHistos ( DQMStore::IBooker ibooker)
protectedvirtual

Definition at line 459 of file L1TMuonDQMOffline.cc.

References dqm::implementation::IBooker::book1D(), getHistBinsRes(), m_etaRegions, m_etaStrings, m_HistFolder, m_qualLevelsRes, m_qualStrings, m_resLabelStrings, m_ResolutionHistos, m_resStrings, m_resTypes, m_verbose, Skims_PA_cff::name, LaserClient_cfi::nbins, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, trigObjTnPSource_cfi::var, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by bookHistograms().

459  {
460  if (m_verbose)
461  edm::LogInfo("L1TMuonDQMOffline") << "Booking Resolution Plot Histos" << endl;
462  ibooker.setCurrentFolder(m_HistFolder + "/resolution");
463 
464  for (const auto var : m_resTypes) {
465  auto nbins = std::get<0>(getHistBinsRes(var));
466  auto xmin = std::get<1>(getHistBinsRes(var));
467  auto xmax = std::get<2>(getHistBinsRes(var));
468  for (const auto etaReg : m_etaRegions) {
469  for (const auto qualLevel : m_qualLevelsRes) {
470  m_histoKeyResType histoKeyRes = {var, etaReg, qualLevel};
471  std::string name =
472  "resolution_" + m_resStrings[var] + "_" + m_etaStrings[etaReg] + "_" + m_qualStrings[qualLevel];
473  m_ResolutionHistos[histoKeyRes] = ibooker.book1D(name, name + ";" + m_resLabelStrings[var], nbins, xmin, xmax);
474  }
475  }
476  }
477 }
std::map< ResType, std::string > m_resLabelStrings
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::map< EtaRegion, std::string > m_etaStrings
std::map< std::tuple< ResType, EtaRegion, QualLevel >, MonitorElement * > m_ResolutionHistos
const std::vector< EtaRegion > m_etaRegions
std::string m_HistFolder
std::tuple< ResType, EtaRegion, QualLevel > m_histoKeyResType
std::map< QualLevel, std::string > m_qualStrings
std::tuple< int, double, double > getHistBinsRes(ResType res)
const std::vector< QualLevel > m_qualLevelsRes
Log< level::Info, false > LogInfo
std::map< ResType, std::string > m_resStrings
const std::vector< ResType > m_resTypes
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ dqmBeginRun()

void L1TMuonDQMOffline::dqmBeginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 177 of file L1TMuonDQMOffline.cc.

References HLTConfigProvider::init(), m_hltConfig, m_trigProcess, m_verbose, and writedatasetfile::run.

177  {
178  if (m_verbose)
179  edm::LogInfo("L1TMuonDQMOffline") << "Called beginRun." << endl;
180  bool changed = true;
181  m_hltConfig.init(run, iSetup, m_trigProcess, changed);
182 }
std::string m_trigProcess
Log< level::Info, false > LogInfo
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
HLTConfigProvider m_hltConfig

◆ getHistBinsEff()

std::vector< float > L1TMuonDQMOffline::getHistBinsEff ( EffType  eff)
private

Definition at line 686 of file L1TMuonDQMOffline.cc.

References L1TMuonDQMOffline_cfi::effVsEtaBins, L1TMuonDQMOffline_cfi::effVsPhiBins, L1TMuonDQMOffline_cfi::effVsPtBins, L1TMuonDQMOffline_cfi::effVsVtxBins, kEffEta, kEffPhi, kEffPt, kEffVtx, m_effVsEtaBins, m_effVsPhiBins, m_effVsPtBins, and m_effVsVtxBins.

Referenced by bookEfficiencyHistos().

686  {
687  if (eff == kEffPt) {
688  std::vector<float> effVsPtBins(m_effVsPtBins.begin(), m_effVsPtBins.end());
689  return effVsPtBins;
690  }
691  if (eff == kEffPhi) {
692  std::vector<float> effVsPhiBins(m_effVsPhiBins.begin(), m_effVsPhiBins.end());
693  return effVsPhiBins;
694  }
695  if (eff == kEffEta) {
696  std::vector<float> effVsEtaBins(m_effVsEtaBins.begin(), m_effVsEtaBins.end());
697  return effVsEtaBins;
698  }
699  if (eff == kEffVtx) {
700  std::vector<float> effVsVtxBins(m_effVsVtxBins.begin(), m_effVsVtxBins.end());
701  return effVsVtxBins;
702  }
703  return {0., 1.};
704 }
std::vector< double > m_effVsVtxBins
std::vector< double > m_effVsPhiBins
std::vector< double > m_effVsPtBins
std::vector< double > m_effVsEtaBins

◆ getHistBinsRes()

std::tuple< int, double, double > L1TMuonDQMOffline::getHistBinsRes ( ResType  res)
private

Definition at line 706 of file L1TMuonDQMOffline.cc.

References kRes1OverPt, kResCh, kResEta, kResPhi, kResPt, and kResQOverPt.

Referenced by bookResolutionHistos().

706  {
707  if (res == kResPt)
708  return {50, -2., 2.};
709  if (res == kRes1OverPt)
710  return {50, -2., 2.};
711  if (res == kResQOverPt)
712  return {50, -2., 2.};
713  if (res == kResPhi)
714  return {96, -0.2, 0.2};
715  if (res == kResEta)
716  return {100, -0.1, 0.1};
717  if (res == kResCh)
718  return {5, -2, 3};
719  return {1, 0, 1};
720 }
Definition: Electron.h:6

◆ getMuonGmtPairs()

void L1TMuonDQMOffline::getMuonGmtPairs ( edm::Handle< l1t::MuonBxCollection > &  gmtCands,
PropagateToMuon const &  propagator 
)
private

Definition at line 602 of file L1TMuonDQMOffline.cc.

References BXVector< T >::begin(), MuonGmtPair::dR(), BXVector< T >::end(), MuonGmtPair::getVar(), kCtrlMuonGmtDeltaR, kCtrlProbeEta, kCtrlProbePhi, kCtrlProbePt, kEffEta, kEffPhi, kEffPt, m_ControlHistos, m_maxGmtMuonDR, m_MuonGmtPairs, m_ProbeMuons, m_useAtVtxCoord, m_verbose, and TrackCandidateProducer_cfi::propagator.

Referenced by analyze().

603  {
604  m_MuonGmtPairs.clear();
605  if (m_verbose)
606  edm::LogInfo("L1TMuonDQMOffline") << "Getting muon GMT pairs" << endl;
607 
608  vector<const reco::Muon*>::const_iterator probeMuIt = m_ProbeMuons.begin();
609  vector<const reco::Muon*>::const_iterator probeMuEnd = m_ProbeMuons.end();
610 
612  l1t::MuonBxCollection::const_iterator gmtEnd = gmtCands->end(0);
613 
614  for (; probeMuIt != probeMuEnd; ++probeMuIt) {
615  MuonGmtPair pairBestCand((*probeMuIt), nullptr, propagator, m_useAtVtxCoord);
616 
617  // Fill the control histograms with the probe muon kinematic variables used
618  m_ControlHistos[kCtrlProbeEta]->Fill(pairBestCand.getVar(L1TMuonDQMOffline::kEffEta));
619  m_ControlHistos[kCtrlProbePhi]->Fill(pairBestCand.getVar(L1TMuonDQMOffline::kEffPhi));
620  m_ControlHistos[kCtrlProbePt]->Fill(pairBestCand.getVar(L1TMuonDQMOffline::kEffPt));
621 
622  gmtIt = gmtCands->begin(0); // use only on L1T muons from BX 0
623 
624  for (; gmtIt != gmtEnd; ++gmtIt) {
625  MuonGmtPair pairTmpCand((*probeMuIt), &(*gmtIt), propagator, m_useAtVtxCoord);
626 
627  if ((pairTmpCand.dR() < m_maxGmtMuonDR) && (pairTmpCand.dR() < pairBestCand.dR())) {
628  pairBestCand = pairTmpCand;
629  }
630  }
631  m_MuonGmtPairs.push_back(pairBestCand);
632  m_ControlHistos[kCtrlMuonGmtDeltaR]->Fill(pairBestCand.dR());
633  }
634 }
std::vector< const reco::Muon * > m_ProbeMuons
const_iterator begin(int bx) const
std::vector< T >::const_iterator const_iterator
Definition: BXVector.h:18
std::vector< MuonGmtPair > m_MuonGmtPairs
Log< level::Info, false > LogInfo
const_iterator end(int bx) const
std::map< Control, MonitorElement * > m_ControlHistos

◆ getNVertices()

const unsigned int L1TMuonDQMOffline::getNVertices ( edm::Handle< reco::VertexCollection > &  vertex)
private

Definition at line 480 of file L1TMuonDQMOffline.cc.

References L1TkPrimaryVertex_cfi::nVtx, and bphysicsOniaDQM_cfi::vertex.

Referenced by analyze().

480  {
481  unsigned int nVtx = 0;
482 
483  if (vertex.isValid()) {
484  for (const auto& vertexIt : *vertex) {
485  if (vertexIt.isValid() && !vertexIt.isFake()) {
486  ++nVtx;
487  }
488  }
489  }
490  return nVtx;
491 }

◆ getPrimaryVertex()

const reco::Vertex L1TMuonDQMOffline::getPrimaryVertex ( edm::Handle< reco::VertexCollection > &  vertex,
edm::Handle< reco::BeamSpot > &  beamSpot 
)
private

Definition at line 494 of file L1TMuonDQMOffline.cc.

References pwdgSkimBPark_cfi::beamSpot, BeamMonitor_cff::primaryVertex, and bphysicsOniaDQM_cfi::vertex.

Referenced by analyze().

494  {
495  Vertex::Point posVtx;
496  Vertex::Error errVtx;
497 
498  bool hasPrimaryVertex = false;
499 
500  if (vertex.isValid()) {
501  vector<Vertex>::const_iterator vertexIt = vertex->begin();
502  vector<Vertex>::const_iterator vertexEnd = vertex->end();
503 
504  for (; vertexIt != vertexEnd; ++vertexIt) {
505  if (vertexIt->isValid() && !vertexIt->isFake()) {
506  posVtx = vertexIt->position();
507  errVtx = vertexIt->error();
508  hasPrimaryVertex = true;
509  break;
510  }
511  }
512  }
513 
514  if (!hasPrimaryVertex) {
515  posVtx = beamSpot->position();
516  errVtx(0, 0) = beamSpot->BeamWidthX();
517  errVtx(1, 1) = beamSpot->BeamWidthY();
518  errVtx(2, 2) = beamSpot->sigmaZ();
519  }
520  const Vertex primaryVertex(posVtx, errVtx);
521  return primaryVertex;
522 }
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
primaryVertex
hltOfflineBeamSpot for HLTMON

◆ getProbeMuons()

void L1TMuonDQMOffline::getProbeMuons ( edm::Handle< edm::TriggerResults > &  trigResults,
edm::Handle< trigger::TriggerEvent > &  trigEvent 
)
private

Definition at line 541 of file L1TMuonDQMOffline.cc.

References HLT_2022v15_cff::dEta, HLT_2022v15_cff::distance, HLT_2022v15_cff::dPhi, PVValHelper::eta, kCtrlNProbesVsTight, kCtrlTagEta, kCtrlTagHltDr, kCtrlTagPhi, kCtrlTagProbeDr, kCtrlTagPt, m_ControlHistos, m_minTagProbeDR, m_ProbeMuons, m_TagPtCut, m_TightMuons, m_verbose, matchHlt(), phi, DiDispStaMuonMonitor_cfi::pt, mathSSE::sqrt(), and B2GTnPMonitor_cfi::trigEvent.

Referenced by analyze().

542  {
543  if (m_verbose)
544  edm::LogInfo("L1TMuonDQMOffline") << "getting probe muons" << endl;
545  m_ProbeMuons.clear();
546  std::vector<const reco::Muon*> tagMuonsInHist;
547 
548  tagMuonsInHist.clear();
549 
550  vector<const reco::Muon*>::const_iterator probeCandIt = m_TightMuons.begin();
551  vector<const reco::Muon*>::const_iterator tightMuonsEnd = m_TightMuons.end();
552 
553  for (; probeCandIt != tightMuonsEnd; ++probeCandIt) {
554  bool isProbe = false;
555  vector<const reco::Muon*>::const_iterator tagCandIt = m_TightMuons.begin();
556  float deltar = 0.;
557 
558  for (; tagCandIt != tightMuonsEnd; ++tagCandIt) {
559  bool tagMuonAlreadyInHist = false;
560  bool tagHasTrig = false;
561  float eta = (*tagCandIt)->eta();
562  float phi = (*tagCandIt)->phi();
563  float pt = (*tagCandIt)->pt();
564  float dEta = eta - (*probeCandIt)->eta();
565  float dPhi = phi - (*probeCandIt)->phi();
566  deltar = sqrt(dEta * dEta + dPhi * dPhi);
567 
568  if ((*tagCandIt) == (*probeCandIt) || deltar < m_minTagProbeDR)
569  continue; // CB has a little bias for closed-by muons
570  auto matchHltDeltaR = matchHlt(trigEvent, (*tagCandIt));
571  tagHasTrig = (matchHltDeltaR < m_maxHltMuonDR) && (pt > m_TagPtCut);
572  isProbe |= tagHasTrig;
573  if (tagHasTrig) {
574  if (std::distance(m_TightMuons.begin(), m_TightMuons.end()) > 2) {
575  for (vector<const reco::Muon*>::const_iterator tagMuonsInHistIt = tagMuonsInHist.begin();
576  tagMuonsInHistIt != tagMuonsInHist.end();
577  ++tagMuonsInHistIt) {
578  if ((*tagCandIt) == (*tagMuonsInHistIt)) {
579  tagMuonAlreadyInHist = true;
580  break;
581  }
582  }
583  if (tagMuonAlreadyInHist == false)
584  tagMuonsInHist.push_back((*tagCandIt));
585  }
586  if (tagMuonAlreadyInHist == false) {
589  m_ControlHistos[kCtrlTagPt]->Fill(pt);
591  m_ControlHistos[kCtrlTagHltDr]->Fill(matchHltDeltaR);
592  }
593  }
594  }
595  if (isProbe)
596  m_ProbeMuons.push_back((*probeCandIt));
597  }
599 }
std::vector< const reco::Muon * > m_ProbeMuons
double matchHlt(edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
T sqrt(T t)
Definition: SSEVec.h:19
Log< level::Info, false > LogInfo
Definition: deltar.py:1
std::vector< const reco::Muon * > m_TightMuons
std::map< Control, MonitorElement * > m_ControlHistos

◆ getTightMuons()

void L1TMuonDQMOffline::getTightMuons ( edm::Handle< reco::MuonCollection > &  muons,
const reco::Vertex vertex 
)
private

Definition at line 525 of file L1TMuonDQMOffline.cc.

References muon::isTightMuon(), kCtrlNTightVsAll, m_ControlHistos, m_TightMuons, m_verbose, PDWG_BPHSkim_cff::muons, and bphysicsOniaDQM_cfi::vertex.

Referenced by analyze().

525  {
526  if (m_verbose)
527  edm::LogInfo("L1TMuonDQMOffline") << "Getting tight muons" << endl;
528  m_TightMuons.clear();
529  MuonCollection::const_iterator muonIt = muons->begin();
530  MuonCollection::const_iterator muonEnd = muons->end();
531 
532  for (; muonIt != muonEnd; ++muonIt) {
533  if (muon::isTightMuon((*muonIt), vertex)) {
534  m_TightMuons.push_back(&(*muonIt));
535  }
536  }
537  m_ControlHistos[kCtrlNTightVsAll]->Fill(muons->size(), m_TightMuons.size());
538 }
Log< level::Info, false > LogInfo
std::vector< const reco::Muon * > m_TightMuons
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
std::map< Control, MonitorElement * > m_ControlHistos

◆ matchHlt()

double L1TMuonDQMOffline::matchHlt ( edm::Handle< trigger::TriggerEvent > &  triggerEvent,
const reco::Muon mu 
)
private

Definition at line 637 of file L1TMuonDQMOffline.cc.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, trigger::TriggerObject::eta(), cuy::ii, HLT_2022v15_cff::InputTag, createfilelist::int, m_hltConfig, m_trigIndices, m_trigProcess, m_verbose, HLTConfigProvider::moduleLabels(), amptDefaultParameters_cff::mu, trigger::TriggerObject::phi(), trigger::TriggerObject::pt(), PDWG_DiPhoton_SD_cff::triggerEvent, and TriggerAnalyzer::trigObjs.

Referenced by getProbeMuons().

637  {
638  double matchDeltaR = 9999;
639 
641 
642  vector<int>::const_iterator trigIndexIt = m_trigIndices.begin();
643  vector<int>::const_iterator trigIndexEnd = m_trigIndices.end();
644 
645  for (; trigIndexIt != trigIndexEnd; ++trigIndexIt) {
646  const vector<string> moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt));
647  // For some reason various modules now come *after* "hltBoolEnd"
648  // Really just want module one index before "hltBoolEnd" - AWB 2022.09.28
649  // const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt)) - 2;
650  unsigned int moduleIndex = 999999;
651  for (int ii = 0; ii < int(moduleLabels.size()); ii++) {
652  if (moduleLabels[ii] == "hltBoolEnd") {
653  moduleIndex = ii - 1;
654  break;
655  }
656  }
657  if (moduleIndex == 999999) {
658  edm::LogError("L1TMuonDQMOffline") << "Found no module label in trigger " << (*trigIndexIt) << endl;
659  continue;
660  }
661 
662  const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex], "", m_trigProcess));
663 
664  if (hltFilterIndex < triggerEvent->sizeFilters()) {
665  const Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex));
666  const Vids triggerVids(triggerEvent->filterIds(hltFilterIndex));
667  const unsigned nTriggers = triggerVids.size();
668 
669  for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
670  const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
671  if (m_verbose)
672  edm::LogInfo("L1TMuonDQMOffline") << "Found trigObject with pt = " << trigObject.pt()
673  << ", eta = " << trigObject.eta() << ", phi = " << trigObject.phi() << endl;
674  if (m_verbose)
675  edm::LogInfo("L1TMuonDQMOffline") << "Compare to muon with pt = " << (*mu).pt() << ", eta = " << (*mu).eta()
676  << ", phi = " << (*mu).phi() << endl;
677  double dRtmp = deltaR((*mu), trigObject);
678  if (dRtmp < matchDeltaR)
679  matchDeltaR = dRtmp;
680  }
681  }
682  }
683  return matchDeltaR;
684 }
Log< level::Error, false > LogError
std::string m_trigProcess
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
ii
Definition: cuy.py:589
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:75
Log< level::Info, false > LogInfo
std::vector< size_type > Keys
HLTConfigProvider m_hltConfig
std::vector< int > Vids
std::vector< int > m_trigIndices

Member Data Documentation

◆ m_BsInputTag

edm::EDGetTokenT<reco::BeamSpot> L1TMuonDQMOffline::m_BsInputTag
private

Definition at line 165 of file L1TMuonDQMOffline.h.

Referenced by analyze().

◆ m_ControlHistos

std::map<Control, MonitorElement*> L1TMuonDQMOffline::m_ControlHistos
private

◆ m_cuts

std::vector<std::pair<int, QualLevel> > L1TMuonDQMOffline::m_cuts
private

Definition at line 140 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

◆ m_cutsVPSet

std::vector<edm::ParameterSet> L1TMuonDQMOffline::m_cutsVPSet
private

Definition at line 161 of file L1TMuonDQMOffline.h.

◆ m_EfficiencyDenEtaHistos

std::map<int, MonitorElement*> L1TMuonDQMOffline::m_EfficiencyDenEtaHistos
private

Definition at line 126 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

◆ m_EfficiencyDenPtHistos

std::map<EtaRegion, MonitorElement*> L1TMuonDQMOffline::m_EfficiencyDenPtHistos
private

Definition at line 125 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

◆ m_EfficiencyDenVarHistos

std::map<std::tuple<EffType, int, EtaRegion>, MonitorElement*> L1TMuonDQMOffline::m_EfficiencyDenVarHistos
private

Definition at line 124 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

◆ m_EfficiencyNumEtaHistos

std::map<std::pair<int, QualLevel>, MonitorElement*> L1TMuonDQMOffline::m_EfficiencyNumEtaHistos
private

Definition at line 123 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

◆ m_EfficiencyNumVarHistos

std::map<std::tuple<EffType, int, EtaRegion, QualLevel>, MonitorElement*> L1TMuonDQMOffline::m_EfficiencyNumVarHistos
private

Definition at line 122 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

◆ m_effLabelStrings

std::map<EffType, std::string> L1TMuonDQMOffline::m_effLabelStrings
private

Definition at line 150 of file L1TMuonDQMOffline.h.

Referenced by bookEfficiencyHistos().

◆ m_effStrings

std::map<EffType, std::string> L1TMuonDQMOffline::m_effStrings
private

Definition at line 149 of file L1TMuonDQMOffline.h.

Referenced by bookEfficiencyHistos().

◆ m_effTypes

const std::vector<EffType> L1TMuonDQMOffline::m_effTypes
private

Definition at line 143 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

◆ m_effVsEtaBins

std::vector<double> L1TMuonDQMOffline::m_effVsEtaBins
private

Definition at line 173 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff().

◆ m_effVsPhiBins

std::vector<double> L1TMuonDQMOffline::m_effVsPhiBins
private

Definition at line 172 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff().

◆ m_effVsPtBins

std::vector<double> L1TMuonDQMOffline::m_effVsPtBins
private

Definition at line 171 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff().

◆ m_effVsVtxBins

std::vector<double> L1TMuonDQMOffline::m_effVsVtxBins
private

Definition at line 174 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff().

◆ m_etaRegions

const std::vector<EtaRegion> L1TMuonDQMOffline::m_etaRegions
private

Definition at line 145 of file L1TMuonDQMOffline.h.

Referenced by bookEfficiencyHistos(), and bookResolutionHistos().

◆ m_etaStrings

std::map<EtaRegion, std::string> L1TMuonDQMOffline::m_etaStrings
private

Definition at line 153 of file L1TMuonDQMOffline.h.

Referenced by bookEfficiencyHistos(), and bookResolutionHistos().

◆ m_GmtInputTag

edm::EDGetTokenT<l1t::MuonBxCollection> L1TMuonDQMOffline::m_GmtInputTag
private

Definition at line 163 of file L1TMuonDQMOffline.h.

Referenced by analyze().

◆ m_HistFolder

std::string L1TMuonDQMOffline::m_HistFolder
private

◆ m_hltConfig

HLTConfigProvider L1TMuonDQMOffline::m_hltConfig
private

Definition at line 106 of file L1TMuonDQMOffline.h.

Referenced by analyze(), bookHistograms(), dqmBeginRun(), and matchHlt().

◆ m_L1tL1tMuons

BXVector<l1t::Muon> L1TMuonDQMOffline::m_L1tL1tMuons
private

Definition at line 138 of file L1TMuonDQMOffline.h.

◆ m_L1tMuons

std::vector<l1t::MuonBxCollection> L1TMuonDQMOffline::m_L1tMuons
private

Definition at line 136 of file L1TMuonDQMOffline.h.

◆ m_maxGmtMuonDR

float L1TMuonDQMOffline::m_maxGmtMuonDR
private

Definition at line 179 of file L1TMuonDQMOffline.h.

Referenced by getMuonGmtPairs().

◆ m_maxHltMuonDR

float L1TMuonDQMOffline::m_maxHltMuonDR
private

Definition at line 181 of file L1TMuonDQMOffline.h.

◆ m_minTagProbeDR

float L1TMuonDQMOffline::m_minTagProbeDR
private

Definition at line 180 of file L1TMuonDQMOffline.h.

Referenced by getProbeMuons().

◆ m_MuonGmtPairs

std::vector<MuonGmtPair> L1TMuonDQMOffline::m_MuonGmtPairs
private

Definition at line 133 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and getMuonGmtPairs().

◆ m_MuonInputTag

edm::EDGetTokenT<reco::MuonCollection> L1TMuonDQMOffline::m_MuonInputTag
private

Definition at line 162 of file L1TMuonDQMOffline.h.

Referenced by analyze().

◆ m_ProbeMuons

std::vector<const reco::Muon*> L1TMuonDQMOffline::m_ProbeMuons
private

Definition at line 132 of file L1TMuonDQMOffline.h.

Referenced by analyze(), getMuonGmtPairs(), and getProbeMuons().

◆ m_propagatorSetup

PropagateToMuonSetup const L1TMuonDQMOffline::m_propagatorSetup
private

Definition at line 108 of file L1TMuonDQMOffline.h.

Referenced by analyze().

◆ m_qualLevelsRes

const std::vector<QualLevel> L1TMuonDQMOffline::m_qualLevelsRes
private

Definition at line 146 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookResolutionHistos().

◆ m_qualStrings

std::map<QualLevel, std::string> L1TMuonDQMOffline::m_qualStrings
private

Definition at line 154 of file L1TMuonDQMOffline.h.

Referenced by bookEfficiencyHistos(), and bookResolutionHistos().

◆ m_RecoMuons

std::vector<reco::MuonCollection> L1TMuonDQMOffline::m_RecoMuons
private

Definition at line 135 of file L1TMuonDQMOffline.h.

◆ m_RecoRecoMuons

std::vector<reco::Muon> L1TMuonDQMOffline::m_RecoRecoMuons
private

Definition at line 137 of file L1TMuonDQMOffline.h.

◆ m_recoToL1PtCutFactor

double L1TMuonDQMOffline::m_recoToL1PtCutFactor
private

Definition at line 160 of file L1TMuonDQMOffline.h.

Referenced by analyze().

◆ m_resLabelStrings

std::map<ResType, std::string> L1TMuonDQMOffline::m_resLabelStrings
private

Definition at line 152 of file L1TMuonDQMOffline.h.

Referenced by bookResolutionHistos().

◆ m_ResolutionHistos

std::map<std::tuple<ResType, EtaRegion, QualLevel>, MonitorElement*> L1TMuonDQMOffline::m_ResolutionHistos
private

Definition at line 127 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookResolutionHistos().

◆ m_resStrings

std::map<ResType, std::string> L1TMuonDQMOffline::m_resStrings
private

Definition at line 151 of file L1TMuonDQMOffline.h.

Referenced by bookResolutionHistos().

◆ m_resTypes

const std::vector<ResType> L1TMuonDQMOffline::m_resTypes
private

Definition at line 144 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookResolutionHistos().

◆ m_TagPtCut

double L1TMuonDQMOffline::m_TagPtCut
private

Definition at line 159 of file L1TMuonDQMOffline.h.

Referenced by getProbeMuons().

◆ m_TightMuons

std::vector<const reco::Muon*> L1TMuonDQMOffline::m_TightMuons
private

Definition at line 131 of file L1TMuonDQMOffline.h.

Referenced by analyze(), getProbeMuons(), and getTightMuons().

◆ m_trigIndices

std::vector<int> L1TMuonDQMOffline::m_trigIndices
private

Definition at line 176 of file L1TMuonDQMOffline.h.

Referenced by analyze(), bookHistograms(), and matchHlt().

◆ m_trigInputTag

edm::EDGetTokenT<trigger::TriggerEvent> L1TMuonDQMOffline::m_trigInputTag
private

Definition at line 166 of file L1TMuonDQMOffline.h.

Referenced by analyze().

◆ m_trigNames

std::vector<std::string> L1TMuonDQMOffline::m_trigNames
private

Definition at line 170 of file L1TMuonDQMOffline.h.

Referenced by bookHistograms().

◆ m_trigProcess

std::string L1TMuonDQMOffline::m_trigProcess
private

Definition at line 167 of file L1TMuonDQMOffline.h.

Referenced by dqmBeginRun(), and matchHlt().

◆ m_trigProcess_token

edm::EDGetTokenT<edm::TriggerResults> L1TMuonDQMOffline::m_trigProcess_token
private

Definition at line 168 of file L1TMuonDQMOffline.h.

Referenced by analyze().

◆ m_useAtVtxCoord

bool L1TMuonDQMOffline::m_useAtVtxCoord
private

Definition at line 178 of file L1TMuonDQMOffline.h.

Referenced by getMuonGmtPairs().

◆ m_verbose

bool L1TMuonDQMOffline::m_verbose
private

◆ m_VtxInputTag

edm::EDGetTokenT<reco::VertexCollection> L1TMuonDQMOffline::m_VtxInputTag
private

Definition at line 164 of file L1TMuonDQMOffline.h.

Referenced by analyze().