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::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  Control {
  kCtrlTagPt, kCtrlTagEta, kCtrlTagPhi, kCtrlProbePt,
  kCtrlProbeEta, kCtrlProbePhi, kCtrlTagProbeDr, 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 edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 L1TMuonDQMOffline (const edm::ParameterSet &ps)
 
 ~L1TMuonDQMOffline () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &)=0
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &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
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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)
 
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)
 
bool matchHlt (edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
 

Private Attributes

edm::ESHandle< MagneticFieldm_BField
 
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
 
edm::ESHandle< Propagatorm_propagatorAlong
 
edm::ESHandle< Propagatorm_propagatorOpposite
 
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 edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 63 of file L1TMuonDQMOffline.h.

Member Typedef Documentation

Definition at line 108 of file L1TMuonDQMOffline.h.

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

Definition at line 107 of file L1TMuonDQMOffline.h.

Definition at line 106 of file L1TMuonDQMOffline.h.

Definition at line 105 of file L1TMuonDQMOffline.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 148 of file L1TMuonDQMOffline.cc.

References gather_cfg::cout, kEffEta, kEffPhi, kEffPt, kEffVtx, kEtaRegionAll, kEtaRegionBmtf, kEtaRegionEmtf, kEtaRegionOmtf, kQualAll, kQualDouble, kQualOpen, kQualSingle, kRes1OverPt, kResCh, kResEta, kResPhi, kResPt, kResQOverPt, m_BsInputTag, m_cuts, m_cutsVPSet, m_effLabelStrings, m_effStrings, m_effVsEtaBins, m_effVsPhiBins, m_effVsPtBins, m_effVsVtxBins, m_etaRegions, m_etaStrings, m_GmtInputTag, m_HistFolder, m_maxGmtMuonDR, m_maxHltMuonDR, m_minTagProbeDR, m_MuonInputTag, m_qualLevelsRes, m_qualStrings, m_recoToL1PtCutFactor, m_resLabelStrings, m_resStrings, m_resTypes, m_TagPtCut, m_trigInputTag, m_trigNames, m_trigProcess, m_trigProcess_token, m_useAtVtxCoord, m_verbose, and m_VtxInputTag.

148  :
153  m_effStrings({ {kEffPt, "pt"}, {kEffPhi, "phi"}, {kEffEta, "eta"}, {kEffVtx, "vtx"} }),
154  m_effLabelStrings({ {kEffPt, "p_{T} (GeV)"}, {kEffPhi, "#phi"}, {kEffEta, "#eta"}, {kEffVtx, "# vertices"} }),
155  m_resStrings({ {kResPt, "pt"}, {kRes1OverPt, "1overpt"}, {kResQOverPt, "qoverpt"}, {kResPhi, "phi"}, {kResEta, "eta"}, {kResCh, "charge"} }),
156  m_resLabelStrings({ {kResPt, "p_{T}^{L1} - p_{T}^{reco}"}, {kRes1OverPt, "1/p_{T}^{L1} - 1/p_{T}^{reco}"}, {kResQOverPt, "q^{L1}/p_{T}^{L1} - q^{reco}/p_{T}^{reco}"}, {kResPhi, "#phi_{L1} - #phi_{reco}"}, {kResEta, "#eta_{L1} - #eta_{reco}"}, {kResCh, "charge^{L1} - charge^{reco}"} }),
157  m_etaStrings({ {kEtaRegionAll, "etaMin0_etaMax2p4"}, {kEtaRegionBmtf, "etaMin0_etaMax0p83"}, {kEtaRegionOmtf, "etaMin0p83_etaMax1p24"}, {kEtaRegionEmtf, "etaMin1p24_etaMax2p4"} }),
158  m_qualStrings({ {kQualAll, "qualAll"}, {kQualOpen, "qualOpen"}, {kQualDouble, "qualDouble"}, {kQualSingle, "qualSingle"} }),
159  m_verbose(ps.getUntrackedParameter<bool>("verbose")),
160  m_HistFolder(ps.getUntrackedParameter<string>("histFolder")),
161  m_TagPtCut(ps.getUntrackedParameter<double>("tagPtCut")),
162  m_recoToL1PtCutFactor(ps.getUntrackedParameter<double>("recoToL1PtCutFactor")),
163  m_cutsVPSet(ps.getUntrackedParameter<std::vector<edm::ParameterSet>>("cuts")),
164  m_MuonInputTag(consumes<reco::MuonCollection>(ps.getUntrackedParameter<InputTag>("muonInputTag"))),
165  m_GmtInputTag(consumes<l1t::MuonBxCollection>(ps.getUntrackedParameter<InputTag>("gmtInputTag"))),
166  m_VtxInputTag(consumes<VertexCollection>(ps.getUntrackedParameter<InputTag>("vtxInputTag"))),
167  m_BsInputTag(consumes<BeamSpot>(ps.getUntrackedParameter<InputTag>("bsInputTag"))),
168  m_trigInputTag(consumes<trigger::TriggerEvent>(ps.getUntrackedParameter<InputTag>("trigInputTag"))),
169  m_trigProcess(ps.getUntrackedParameter<string>("trigProcess")),
170  m_trigProcess_token(consumes<edm::TriggerResults>(ps.getUntrackedParameter<InputTag>("trigProcess_token"))),
171  m_trigNames(ps.getUntrackedParameter<vector<string> >("triggerNames")),
172  m_effVsPtBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsPtBins")),
173  m_effVsPhiBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsPhiBins")),
174  m_effVsEtaBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsEtaBins")),
175  m_effVsVtxBins(ps.getUntrackedParameter<std::vector<double>>("efficiencyVsVtxBins")),
176  m_useAtVtxCoord(ps.getUntrackedParameter<bool>("useL1AtVtxCoord")),
177  m_maxGmtMuonDR(0.3),
178  m_minTagProbeDR(0.5),
179  m_maxHltMuonDR(0.3)
180 {
181  if (m_verbose) cout << "[L1TMuonDQMOffline:] ____________ Storage initialization ____________ " << endl;
182 
183  for (const auto cutsPSet : m_cutsVPSet) {
184  const auto qCut = cutsPSet.getUntrackedParameter<int>("qualCut");
185  QualLevel qLevel = kQualAll;
186  if (qCut > 11) {
187  qLevel = kQualSingle;
188  } else if (qCut > 7) {
189  qLevel = kQualDouble;
190  } else if (qCut > 3) {
191  qLevel = kQualOpen;
192  }
193  m_cuts.emplace_back(std::make_pair(cutsPSet.getUntrackedParameter<int>("ptCut"), qLevel));
194  }
195 }
std::map< EffType, std::string > m_effStrings
T getUntrackedParameter(std::string const &, T const &) const
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
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
std::vector< std::pair< int, QualLevel > > m_cuts
const std::vector< EffType > m_effTypes
const std::vector< QualLevel > m_qualLevelsRes
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 ( )
override

Definition at line 198 of file L1TMuonDQMOffline.cc.

198 { }

Member Function Documentation

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

Definition at line 243 of file L1TMuonDQMOffline.cc.

References ecalDrivenElectronSeedsParameters_cff::beamSpot, gather_cfg::cout, TkAlMuonSelectors_cfi::cut, edm::EventSetup::get(), edm::Event::getByToken(), getMuonGmtPairs(), getNVertices(), getPrimaryVertex(), getProbeMuons(), getTightMuons(), kEffEta, kEffPt, kEffVtx, kEtaRegionAll, kEtaRegionOut, kQualAll, kResPt, m_BField, m_BsInputTag, m_cuts, m_EfficiencyDenEtaHistos, m_EfficiencyDenPtHistos, m_EfficiencyDenVarHistos, m_EfficiencyNumEtaHistos, m_EfficiencyNumVarHistos, m_effTypes, m_GmtInputTag, m_MuonGmtPairs, m_MuonInputTag, m_propagatorAlong, m_propagatorOpposite, m_qualLevelsRes, m_recoToL1PtCutFactor, m_ResolutionHistos, m_resTypes, m_trigInputTag, m_trigProcess_token, m_verbose, m_VtxInputTag, nano_cff::muons, impactParameterTagInfos_cfi::primaryVertex, and JetChargeProducer_cfi::var.

243  {
244 
246  iEvent.getByToken(m_MuonInputTag, muons);
248  iEvent.getByToken(m_BsInputTag, beamSpot);
250  iEvent.getByToken(m_VtxInputTag, vertex);
252  iEvent.getByToken(m_GmtInputTag,gmtCands);
253  Handle<edm::TriggerResults> trigResults;
254  iEvent.getByToken(m_trigProcess_token,trigResults);
256  iEvent.getByToken(m_trigInputTag,trigEvent);
257 
258  eventSetup.get<IdealMagneticFieldRecord>().get(m_BField);
259  eventSetup.get<TrackingComponentsRecord>().get("PropagatorWithMaterial",m_propagatorAlong);
260  eventSetup.get<TrackingComponentsRecord>().get("PropagatorWithMaterialOpposite",m_propagatorOpposite);
261 
262  const auto nVtx = getNVertices(vertex);
263  const Vertex primaryVertex = getPrimaryVertex(vertex,beamSpot);
264 
265  getTightMuons(muons,primaryVertex);
266  getProbeMuons(trigResults,trigEvent); // CB add flag to run on orthogonal datasets (no T&P)
267 
268  getMuonGmtPairs(gmtCands);
269 
270  if (m_verbose) cout << "[L1TMuonDQMOffline:] Computing efficiencies" << endl;
271 
272  vector<MuonGmtPair>::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin();
273  vector<MuonGmtPair>::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end();
274 
275  // To fill once for global eta and once for TF eta region of the L1T muon.
276  // The second entry is a placeholder and will be replaced by the TF eta region of the L1T muon.
277  std::array<EtaRegion, 2> regsToFill { {kEtaRegionAll, kEtaRegionAll} };
278 
279  for(; muonGmtPairsIt!=muonGmtPairsEnd; ++muonGmtPairsIt) {
280  // Fill the resolution histograms
281  if( (muonGmtPairsIt->etaRegion() != kEtaRegionOut) && (muonGmtPairsIt->gmtPt() > 0) ){
282  regsToFill[1] = muonGmtPairsIt->etaRegion();
284  for (const auto var : m_resTypes) {
285  const auto varToFill = muonGmtPairsIt->getDeltaVar(var);
286  std::get<0>(histoKeyRes) = var;
287  // Fill for the global eta and for TF eta region that the probe muon is in
288  for (const auto regToFill : regsToFill) {
289  std::get<1>(histoKeyRes) = regToFill;
290  for (const auto qualLevel : m_qualLevelsRes) {
291  // This assumes that the qualLevel enum has increasing qualities
292  // HW quality levels can be 0, 4, 8, or 12
293  int qualCut = qualLevel * 4;
294  if (muonGmtPairsIt->gmtQual() >= qualCut) {
295  std::get<2>(histoKeyRes) = qualLevel;
296  m_ResolutionHistos[histoKeyRes]->Fill(varToFill);
297  }
298  }
299  }
300  }
301  }
302 
303  // Fill the efficiency numerator and denominator histograms
304  if (muonGmtPairsIt->etaRegion() != kEtaRegionOut) {
305  unsigned int cutsCounter = 0;
306  for (const auto cut : m_cuts) {
307  const auto gmtPtCut = cut.first;
308  const auto qualLevel = cut.second;
309  const bool gmtAboveCut = (muonGmtPairsIt->gmtPt() > gmtPtCut);
310 
311  // default keys
312  m_histoKeyEffDenVarType histoKeyEffDenVar = {kEffPt, gmtPtCut, kEtaRegionAll};
313  m_histoKeyEffNumVarType histoKeyEffNumVar = {kEffPt, gmtPtCut, kEtaRegionAll, qualLevel};
314 
315  regsToFill[1] = muonGmtPairsIt->etaRegion();
316  for(const auto var : m_effTypes) {
317  if(var != kEffPt){
318  if (muonGmtPairsIt->pt() < m_recoToL1PtCutFactor * gmtPtCut) break; // efficiency at plateau
319  }
320  double varToFill;
321  if (var == kEffVtx) {
322  varToFill = static_cast<double>(nVtx);
323  } else {
324  varToFill = muonGmtPairsIt->getVar(var);
325  }
326  // Fill denominators
327  if (var == kEffEta) {
328  m_EfficiencyDenEtaHistos[gmtPtCut]->Fill(varToFill);
329  } else {
330  std::get<0>(histoKeyEffDenVar) = var;
331  // Fill for the global eta and for TF eta region that the probe muon is in
332  for (const auto regToFill : regsToFill) {
333  if (var == kEffPt) {
334  if (cutsCounter == 0) {
335  m_EfficiencyDenPtHistos[regToFill]->Fill(varToFill);
336  }
337  } else {
338  std::get<2>(histoKeyEffDenVar) = regToFill;
339  m_EfficiencyDenVarHistos[histoKeyEffDenVar]->Fill(varToFill);
340  }
341  }
342  }
343  // Fill numerators
344  std::get<0>(histoKeyEffNumVar) = var;
345  // This assumes that the qualLevel enum has increasing qualities
346  if (gmtAboveCut && muonGmtPairsIt->gmtQual() >= qualLevel * 4) {
347  if (var == kEffEta) {
348  m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel};
349  m_EfficiencyNumEtaHistos[histoKeyEffNumEta]->Fill(varToFill);
350  } else {
351  std::get<3>(histoKeyEffNumVar) = qualLevel;
352  // Fill for the global eta and for TF eta region that the probe muon is in
353  for (const auto regToFill : regsToFill) {
354  std::get<2>(histoKeyEffNumVar) = regToFill;
355  m_EfficiencyNumVarHistos[histoKeyEffNumVar]->Fill(varToFill);
356  }
357  }
358  }
359  }
360  ++cutsCounter;
361  }
362  }
363  }
364 
365  if (m_verbose) cout << "[L1TMuonDQMOffline:] Computation finished" << endl;
366 }
edm::ESHandle< Propagator > m_propagatorOpposite
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
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:230
edm::EDGetTokenT< l1t::MuonBxCollection > m_GmtInputTag
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
const std::vector< QualLevel > m_qualLevelsRes
std::vector< MuonGmtPair > m_MuonGmtPairs
std::map< std::tuple< EffType, int, EtaRegion >, MonitorElement * > m_EfficiencyDenVarHistos
edm::ESHandle< MagneticField > m_BField
edm::ESHandle< Propagator > m_propagatorAlong
void getMuonGmtPairs(edm::Handle< l1t::MuonBxCollection > &gmtCands)
const reco::Vertex getPrimaryVertex(edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
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
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)
void L1TMuonDQMOffline::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
overrideprotected

Definition at line 233 of file L1TMuonDQMOffline.cc.

References gather_cfg::cout, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and m_verbose.

233  {
234  if(m_verbose) cout << "[L1TMuonDQMOffline:] Called beginLuminosityBlock at LS=" << lumiBlock.id().luminosityBlock() << endl;
235 }
void L1TMuonDQMOffline::bookControlHistos ( DQMStore::IBooker ibooker)
protectedvirtual

Definition at line 369 of file L1TMuonDQMOffline.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), gather_cfg::cout, kCtrlMuonGmtDeltaR, kCtrlNProbesVsTight, kCtrlNTightVsAll, kCtrlProbeEta, kCtrlProbePhi, kCtrlProbePt, kCtrlTagEta, kCtrlTagPhi, kCtrlTagProbeDr, kCtrlTagPt, m_ControlHistos, m_HistFolder, m_verbose, and DQMStore::IBooker::setCurrentFolder().

Referenced by bookHistograms().

369  {
370  if(m_verbose) cout << "[L1TMuonDQMOffline:] Booking Control Plot Histos" << endl;
371 
372  ibooker.setCurrentFolder(m_HistFolder+"/control_variables");
373 
374  m_ControlHistos[kCtrlMuonGmtDeltaR] = ibooker.book1D("MuonGmtDeltaR", "MuonGmtDeltaR; #DeltaR", 50, 0., 0.5);
375  m_ControlHistos[kCtrlNTightVsAll] = ibooker.book2D("NTightVsAll", "NTightVsAll; # muons; # tight muons", 20, -0.5, 19.5, 16, -0.5, 15.5);
376  m_ControlHistos[kCtrlNProbesVsTight] = ibooker.book2D("NProbesVsTight", "NProbesVsTight; # tight muons; # probe muons", 8, -0.5, 7.5, 8, -0.5, 7.5);
377 
378  m_ControlHistos[kCtrlTagPt] = ibooker.book1D("TagMuonPt", "TagMuonPt; p_{T}", 50, 0., 100.);
379  m_ControlHistos[kCtrlTagPhi] = ibooker.book1D("TagMuonPhi", "TagMuonPhi; #phi", 66, -3.3, 3.3);
380  m_ControlHistos[kCtrlTagEta] = ibooker.book1D("TagMuonEta", "TagMuonEta; #eta", 50, -2.5, 2.5);
381 
382  m_ControlHistos[kCtrlProbePt] = ibooker.book1D("ProbeMuonPt", "ProbeMuonPt; p_{T}", 50, 0., 100.);
383  m_ControlHistos[kCtrlProbePhi] = ibooker.book1D("ProbeMuonPhi", "ProbeMuonPhi; #phi", 66, -3.3, 3.3);
384  m_ControlHistos[kCtrlProbeEta] = ibooker.book1D("ProbeMuonEta", "ProbeMuonEta; #eta", 50, -2.5, 2.5);
385 
386  m_ControlHistos[kCtrlTagProbeDr] = ibooker.book1D("TagMuonProbeMuonDeltaR", "TagMuonProbeMuonDeltaR; #DeltaR", 50, 0.,5.0);
387 }
std::string m_HistFolder
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
std::map< Control, MonitorElement * > m_ControlHistos
void L1TMuonDQMOffline::bookEfficiencyHistos ( DQMStore::IBooker ibooker)
protectedvirtual

Definition at line 390 of file L1TMuonDQMOffline.cc.

References DQMStore::IBooker::book1D(), TkAlMuonSelectors_cfi::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, dataset::name, DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and JetChargeProducer_cfi::var.

Referenced by bookHistograms().

390  {
391  ibooker.setCurrentFolder(m_HistFolder+"/numerators_and_denominators");
392 
393  for(const auto var : m_effTypes) {
394  auto histBins = getHistBinsEff(var);
395  // histograms for eta variable get a special treatment
396  if (var == kEffEta) {
397  for (const auto cut : m_cuts) {
398  const auto gmtPtCut = cut.first;
399  const auto qualLevel = cut.second;
400  std::string name = "effDen_"+m_effStrings[var]+"_"+std::to_string(gmtPtCut);
401  m_EfficiencyDenEtaHistos[gmtPtCut] = ibooker.book1D(name, name+";"+m_effLabelStrings[var], histBins.size()-1, &histBins[0]);
402  name = "effNum_"+m_effStrings[var]+"_"+std::to_string(gmtPtCut)+"_"+m_qualStrings[qualLevel];
403  m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel};
404  m_EfficiencyNumEtaHistos[histoKeyEffNumEta] = ibooker.book1D(name, name+";"+m_effLabelStrings[var], histBins.size()-1, &histBins[0]);
405  }
406  } else {
407  for (const auto etaReg : m_etaRegions) {
408  // denominator histograms for pt variable get a special treatment
409  if (var == kEffPt) {
410  std::string name = "effDen_"+m_effStrings[var]+"_"+m_etaStrings[etaReg];
411  m_EfficiencyDenPtHistos[etaReg] = ibooker.book1D(name, name+";"+m_effLabelStrings[var], histBins.size()-1, &histBins[0]);
412  } else {
413  for (const auto cut : m_cuts) {
414  const int gmtPtCut = cut.first;
415  std::string name = "effDen_"+m_effStrings[var]+"_"+std::to_string(gmtPtCut)+"_"+m_etaStrings[etaReg];
416  m_histoKeyEffDenVarType histoKeyEffDenVar = {var, gmtPtCut, etaReg};
417  m_EfficiencyDenVarHistos[histoKeyEffDenVar] = ibooker.book1D(name, name+";"+m_effLabelStrings[var], histBins.size()-1, &histBins[0]);
418  }
419  }
420  for (const auto cut : m_cuts) {
421  const auto gmtPtCut = cut.first;
422  const auto qualLevel = cut.second;
423  std::string name = "effNum_"+m_effStrings[var]+"_"+std::to_string(gmtPtCut)+"_"+m_etaStrings[etaReg]+"_"+m_qualStrings[qualLevel];
424  m_histoKeyEffNumVarType histoKeyEffNum = {var, gmtPtCut, etaReg, qualLevel};
425  m_EfficiencyNumVarHistos[histoKeyEffNum] = ibooker.book1D(name, name+";"+m_effLabelStrings[var], histBins.size()-1, &histBins[0]);
426  }
427  }
428  }
429  }
430 }
std::map< EffType, std::string > m_effStrings
std::map< EtaRegion, std::string > m_etaStrings
const std::vector< EtaRegion > m_etaRegions
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
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
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
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
std::map< std::tuple< EffType, int, EtaRegion, QualLevel >, MonitorElement * > m_EfficiencyNumVarHistos
void L1TMuonDQMOffline::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 207 of file L1TMuonDQMOffline.cc.

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

207  {
208  //book histos
209  bookControlHistos(ibooker);
210  bookEfficiencyHistos(ibooker);
211  bookResolutionHistos(ibooker);
212 
213  vector<string>::const_iterator trigNamesIt = m_trigNames.begin();
214  vector<string>::const_iterator trigNamesEnd = m_trigNames.end();
215 
216  for (; trigNamesIt!=trigNamesEnd; ++trigNamesIt) {
217  TString tNameTmp = TString(*trigNamesIt); // use TString as it handles regex
218  TRegexp tNamePattern = TRegexp(tNameTmp,true);
219  int tIndex = -1;
220 
221  for (unsigned ipath = 0; ipath < m_hltConfig.size(); ++ipath) {
222  TString tmpName = TString(m_hltConfig.triggerName(ipath));
223  if (tmpName.Contains(tNamePattern)) {
224  tIndex = int(ipath);
225  m_trigIndices.push_back(tIndex);
226  }
227  }
228  if (tIndex < 0 && m_verbose) cout << "[L1TMuonDQMOffline:] Warning: Could not find trigger " << (*trigNamesIt) << endl;
229  }
230 }
unsigned int size() const
number of trigger paths in trigger table
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< std::string > m_trigNames
virtual void bookControlHistos(DQMStore::IBooker &)
virtual void bookResolutionHistos(DQMStore::IBooker &ibooker)
HLTConfigProvider m_hltConfig
std::vector< int > m_trigIndices
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker)
void L1TMuonDQMOffline::bookResolutionHistos ( DQMStore::IBooker ibooker)
protectedvirtual

Definition at line 432 of file L1TMuonDQMOffline.cc.

References DQMStore::IBooker::book1D(), gather_cfg::cout, getHistBinsRes(), m_etaRegions, m_etaStrings, m_HistFolder, m_qualLevelsRes, m_qualStrings, m_resLabelStrings, m_ResolutionHistos, m_resStrings, m_resTypes, m_verbose, dataset::name, pileupCalc::nbins, DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, JetChargeProducer_cfi::var, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by bookHistograms().

432  {
433  if(m_verbose) cout << "[L1TMuonOffline:] Booking Resolution Plot Histos" << endl;
434  ibooker.setCurrentFolder(m_HistFolder+"/resolution");
435 
436  for (const auto var : m_resTypes) {
437  auto nbins = std::get<0>(getHistBinsRes(var));
438  auto xmin = std::get<1>(getHistBinsRes(var));
439  auto xmax = std::get<2>(getHistBinsRes(var));
440  for (const auto etaReg : m_etaRegions) {
441  for (const auto qualLevel : m_qualLevelsRes) {
442  m_histoKeyResType histoKeyRes = {var, etaReg, qualLevel};
443  std::string name = "resolution_"+m_resStrings[var]+"_"+m_etaStrings[etaReg]+"_"+m_qualStrings[qualLevel];
444  m_ResolutionHistos[histoKeyRes] = ibooker.book1D(name, name+";"+m_resLabelStrings[var], nbins, xmin, xmax);
445  }
446  }
447  }
448 }
std::map< ResType, std::string > m_resLabelStrings
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)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
const std::vector< QualLevel > m_qualLevelsRes
std::map< ResType, std::string > m_resStrings
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
const std::vector< ResType > m_resTypes
void L1TMuonDQMOffline::dqmBeginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 200 of file L1TMuonDQMOffline.cc.

References gather_cfg::cout, HLTConfigProvider::init(), m_hltConfig, m_trigProcess, and m_verbose.

200  {
201  if (m_verbose) cout << "[L1TMuonDQMOffline:] Called beginRun." << endl;
202  bool changed = true;
203  m_hltConfig.init(run,iSetup,m_trigProcess,changed);
204 }
std::string m_trigProcess
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
HLTConfigProvider m_hltConfig
void L1TMuonDQMOffline::dqmEndLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Definition at line 238 of file L1TMuonDQMOffline.cc.

References gather_cfg::cout, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and m_verbose.

238  {
239  if(m_verbose) cout << "[L1TMuonDQMOffline:] Called endLuminosityBlock at LS=" << lumiBlock.id().luminosityBlock() << endl;
240 }
std::vector< float > L1TMuonDQMOffline::getHistBinsEff ( EffType  eff)
private

Definition at line 630 of file L1TMuonDQMOffline.cc.

References kEffEta, kEffPhi, kEffPt, kEffVtx, m_effVsEtaBins, m_effVsPhiBins, m_effVsPtBins, and m_effVsVtxBins.

Referenced by bookEfficiencyHistos().

630  {
631  if (eff == kEffPt) {
632  std::vector<float> effVsPtBins(m_effVsPtBins.begin(), m_effVsPtBins.end());
633  return effVsPtBins;
634  }
635  if (eff == kEffPhi) {
636  std::vector<float> effVsPhiBins(m_effVsPhiBins.begin(), m_effVsPhiBins.end());
637  return effVsPhiBins;
638  }
639  if (eff == kEffEta) {
640  std::vector<float> effVsEtaBins(m_effVsEtaBins.begin(), m_effVsEtaBins.end());
641  return effVsEtaBins;
642  }
643  if (eff == kEffVtx) {
644  std::vector<float> effVsVtxBins(m_effVsVtxBins.begin(), m_effVsVtxBins.end());
645  return effVsVtxBins;
646  }
647  return {0., 1.};
648 }
std::vector< double > m_effVsVtxBins
std::vector< double > m_effVsPhiBins
std::vector< double > m_effVsPtBins
std::vector< double > m_effVsEtaBins
std::tuple< int, double, double > L1TMuonDQMOffline::getHistBinsRes ( ResType  res)
private

Definition at line 650 of file L1TMuonDQMOffline.cc.

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

Referenced by bookResolutionHistos().

650  {
651  if (res == kResPt) return {100, -50., 50.};
652  if (res == kRes1OverPt) return {50, -0.05, 0.05};
653  if (res == kResQOverPt) return {50, -0.05, 0.05};
654  if (res == kResPhi) return {96, -0.2, 0.2};
655  if (res == kResEta) return {100, -0.1, 0.1};
656  if (res == kResCh) return {5, -2, 3};
657  return {1, 0, 1};
658 }
Definition: Electron.h:6
void L1TMuonDQMOffline::getMuonGmtPairs ( edm::Handle< l1t::MuonBxCollection > &  gmtCands)
private

Definition at line 567 of file L1TMuonDQMOffline.cc.

References BXVector< T >::begin(), gather_cfg::cout, MuonGmtPair::dR(), BXVector< T >::end(), kCtrlMuonGmtDeltaR, kCtrlProbeEta, kCtrlProbePhi, kCtrlProbePt, m_ControlHistos, m_maxGmtMuonDR, m_MuonGmtPairs, m_ProbeMuons, m_useAtVtxCoord, and m_verbose.

Referenced by analyze().

567  {
568 
569  m_MuonGmtPairs.clear();
570  if (m_verbose) cout << "[L1TMuonDQMOffline:] Getting muon GMT pairs" << endl;
571 
572  vector<const reco::Muon*>::const_iterator probeMuIt = m_ProbeMuons.begin();
573  vector<const reco::Muon*>::const_iterator probeMuEnd = m_ProbeMuons.end();
574 
576  l1t::MuonBxCollection::const_iterator gmtEnd = gmtCands->end(0);
577 
578  for (; probeMuIt!=probeMuEnd; ++probeMuIt) {
579  m_ControlHistos[kCtrlProbeEta]->Fill((*probeMuIt)->eta());
580  m_ControlHistos[kCtrlProbePhi]->Fill((*probeMuIt)->phi());
581  m_ControlHistos[kCtrlProbePt]->Fill((*probeMuIt)->pt());
582 
583  MuonGmtPair pairBestCand((*probeMuIt), nullptr, m_useAtVtxCoord);
584 // pairBestCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite);
585  gmtIt = gmtCands->begin(0); // use only on L1T muons from BX 0
586 
587  for(; gmtIt!=gmtEnd; ++gmtIt) {
588  MuonGmtPair pairTmpCand((*probeMuIt),&(*gmtIt), m_useAtVtxCoord);
589 // pairTmpCand.propagate(m_BField,m_propagatorAlong,m_propagatorOpposite);
590 
591  if ( (pairTmpCand.dR() < m_maxGmtMuonDR) && (pairTmpCand.dR() < pairBestCand.dR() ) ) {
592  pairBestCand = pairTmpCand;
593  }
594 
595  }
596  m_MuonGmtPairs.push_back(pairBestCand);
597  m_ControlHistos[kCtrlMuonGmtDeltaR]->Fill(pairBestCand.dR());
598  }
599 }
const_iterator end(int bx) const
std::vector< const reco::Muon * > m_ProbeMuons
std::vector< MuonGmtPair > m_MuonGmtPairs
const_iterator begin(int bx) const
std::map< Control, MonitorElement * > m_ControlHistos
std::vector< Muon >::const_iterator const_iterator
Definition: BXVector.h:20
const unsigned int L1TMuonDQMOffline::getNVertices ( edm::Handle< reco::VertexCollection > &  vertex)
private

Definition at line 451 of file L1TMuonDQMOffline.cc.

References edm::HandleBase::isValid().

Referenced by analyze().

451  {
452  unsigned int nVtx = 0;
453 
454  if (vertex.isValid()) {
455  for (const auto vertexIt : *vertex) {
456  if (vertexIt.isValid() && !vertexIt.isFake()) {
457  ++nVtx;
458  }
459  }
460  }
461  return nVtx;
462 }
bool isValid() const
Definition: HandleBase.h:74
const reco::Vertex L1TMuonDQMOffline::getPrimaryVertex ( edm::Handle< reco::VertexCollection > &  vertex,
edm::Handle< reco::BeamSpot > &  beamSpot 
)
private

Definition at line 465 of file L1TMuonDQMOffline.cc.

References reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthY(), edm::HandleBase::isValid(), reco::BeamSpot::position(), impactParameterTagInfos_cfi::primaryVertex, and reco::BeamSpot::sigmaZ().

Referenced by analyze().

466  {
467  Vertex::Point posVtx;
468  Vertex::Error errVtx;
469 
470  bool hasPrimaryVertex = false;
471 
472  if (vertex.isValid()) {
473  vector<Vertex>::const_iterator vertexIt = vertex->begin();
474  vector<Vertex>::const_iterator vertexEnd = vertex->end();
475 
476  for (;vertexIt!=vertexEnd;++vertexIt) {
477  if (vertexIt->isValid() && !vertexIt->isFake()) {
478  posVtx = vertexIt->position();
479  errVtx = vertexIt->error();
480  hasPrimaryVertex = true;
481  break;
482  }
483  }
484  }
485 
486  if ( !hasPrimaryVertex ) {
487  posVtx = beamSpot->position();
488  errVtx(0,0) = beamSpot->BeamWidthX();
489  errVtx(1,1) = beamSpot->BeamWidthY();
490  errVtx(2,2) = beamSpot->sigmaZ();
491  }
492  const Vertex primaryVertex(posVtx,errVtx);
493  return primaryVertex;
494 }
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
bool isValid() const
Definition: HandleBase.h:74
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:88
const Point & position() const
position
Definition: BeamSpot.h:62
void L1TMuonDQMOffline::getProbeMuons ( edm::Handle< edm::TriggerResults > &  trigResults,
edm::Handle< trigger::TriggerEvent > &  trigEvent 
)
private

Definition at line 513 of file L1TMuonDQMOffline.cc.

References gather_cfg::cout, SoftLeptonByDistance_cfi::distance, PVValHelper::eta, kCtrlNProbesVsTight, kCtrlTagEta, kCtrlTagPhi, kCtrlTagProbeDr, kCtrlTagPt, m_ControlHistos, m_minTagProbeDR, m_ProbeMuons, m_TagPtCut, m_TightMuons, m_verbose, matchHlt(), phi, EnergyCorrector::pt, and mathSSE::sqrt().

Referenced by analyze().

514  {
515 
516  if (m_verbose) cout << "[L1TMuonDQMOffline:] getting probe muons" << endl;
517  m_ProbeMuons.clear();
518  std::vector<const reco::Muon*> tagMuonsInHist;
519 
520  tagMuonsInHist.clear();
521 
522  vector<const reco::Muon*>::const_iterator probeCandIt = m_TightMuons.begin();
523  vector<const reco::Muon*>::const_iterator tightMuonsEnd = m_TightMuons.end();
524 
525  for (; probeCandIt!=tightMuonsEnd; ++probeCandIt) {
526  bool isProbe = false;
527  vector<const reco::Muon*>::const_iterator tagCandIt = m_TightMuons.begin();
528  float deltar = 0.;
529 
530  for (; tagCandIt!=tightMuonsEnd; ++tagCandIt) {
531  bool tagMuonAlreadyInHist = false;
532  bool tagHasTrig = false;
533  float eta = (*tagCandIt)->eta();
534  float phi = (*tagCandIt)->phi();
535  float pt = (*tagCandIt)->pt();
536  float dEta = eta - (*probeCandIt)->eta();
537  float dPhi = phi - (*probeCandIt)->phi();
538  deltar = sqrt(dEta*dEta + dPhi*dPhi);
539 
540  if ( (*tagCandIt) == (*probeCandIt) || deltar<m_minTagProbeDR ) continue; // CB has a little bias for closed-by muons
541  tagHasTrig = matchHlt(trigEvent,(*tagCandIt)) && (pt > m_TagPtCut);
542  isProbe |= tagHasTrig;
543  if (tagHasTrig) {
544  if (std::distance(m_TightMuons.begin(), m_TightMuons.end()) > 2 ) {
545  for (vector<const reco::Muon*>::const_iterator tagMuonsInHistIt = tagMuonsInHist.begin(); tagMuonsInHistIt!=tagMuonsInHist.end(); ++tagMuonsInHistIt) {
546  if ( (*tagCandIt) == (*tagMuonsInHistIt) ) {
547  tagMuonAlreadyInHist = true;
548  break;
549  }
550  }
551  if (tagMuonAlreadyInHist == false) tagMuonsInHist.push_back((*tagCandIt));
552  }
553  if (tagMuonAlreadyInHist == false) {
554  m_ControlHistos[kCtrlTagEta]->Fill(eta);
555  m_ControlHistos[kCtrlTagPhi]->Fill(phi);
556  m_ControlHistos[kCtrlTagPt]->Fill(pt);
557  m_ControlHistos[kCtrlTagProbeDr]->Fill(deltar);
558  }
559  }
560  }
561  if (isProbe) m_ProbeMuons.push_back((*probeCandIt));
562  }
564 }
bool matchHlt(edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
std::vector< const reco::Muon * > m_ProbeMuons
T sqrt(T t)
Definition: SSEVec.h:18
Definition: deltar.py:1
std::vector< const reco::Muon * > m_TightMuons
std::map< Control, MonitorElement * > m_ControlHistos
void L1TMuonDQMOffline::getTightMuons ( edm::Handle< reco::MuonCollection > &  muons,
const reco::Vertex vertex 
)
private

Definition at line 497 of file L1TMuonDQMOffline.cc.

References gather_cfg::cout, muon::isTightMuon(), kCtrlNTightVsAll, m_ControlHistos, m_TightMuons, and m_verbose.

Referenced by analyze().

497  {
498 
499  if (m_verbose) cout << "[L1TMuonDQMOffline:] Getting tight muons" << endl;
500  m_TightMuons.clear();
501  MuonCollection::const_iterator muonIt = muons->begin();
502  MuonCollection::const_iterator muonEnd = muons->end();
503 
504  for(; muonIt!=muonEnd; ++muonIt) {
505  if (muon::isTightMuon((*muonIt), vertex)) {
506  m_TightMuons.push_back(&(*muonIt));
507  }
508  }
509  m_ControlHistos[kCtrlNTightVsAll]->Fill(muons->size(), m_TightMuons.size());
510 }
std::vector< const reco::Muon * > m_TightMuons
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
std::map< Control, MonitorElement * > m_ControlHistos
bool L1TMuonDQMOffline::matchHlt ( edm::Handle< trigger::TriggerEvent > &  triggerEvent,
const reco::Muon mu 
)
private

Definition at line 602 of file L1TMuonDQMOffline.cc.

References deltaR(), trigger::TriggerEvent::filterIds(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), trigger::TriggerEvent::getObjects(), m_hltConfig, m_maxHltMuonDR, m_trigIndices, m_trigProcess, HLTConfigProvider::moduleLabels(), HLTConfigProvider::size(), and TriggerAnalyzer::trigObjs.

Referenced by getProbeMuons().

602  {
603 
604  double matchDeltaR = 9999;
605 
606  TriggerObjectCollection trigObjs = triggerEvent->getObjects();
607 
608  vector<int>::const_iterator trigIndexIt = m_trigIndices.begin();
609  vector<int>::const_iterator trigIndexEnd = m_trigIndices.end();
610 
611  for(; trigIndexIt!=trigIndexEnd; ++trigIndexIt) {
612  const vector<string> moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt));
613  const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt))-2;
614  const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex],"",m_trigProcess));
615 
616  if (hltFilterIndex < triggerEvent->sizeFilters()) {
617  const Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex));
618  const Vids triggerVids(triggerEvent->filterIds(hltFilterIndex));
619  const unsigned nTriggers = triggerVids.size();
620  for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
621  const TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
622  double dRtmp = deltaR((*mu),trigObject);
623  if (dRtmp < matchDeltaR) matchDeltaR = dRtmp;
624  }
625  }
626  }
627  return (matchDeltaR < m_maxHltMuonDR);
628 }
unsigned int size() const
number of trigger paths in trigger table
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:111
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:123
std::string m_trigProcess
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:110
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:98
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
std::vector< size_type > Keys
HLTConfigProvider m_hltConfig
std::vector< int > Vids
std::vector< int > m_trigIndices

Member Data Documentation

edm::ESHandle<MagneticField> L1TMuonDQMOffline::m_BField
private

Definition at line 97 of file L1TMuonDQMOffline.h.

Referenced by analyze().

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

Definition at line 154 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and L1TMuonDQMOffline().

std::map<Control, MonitorElement*> L1TMuonDQMOffline::m_ControlHistos
private
std::vector<std::pair<int, QualLevel> > L1TMuonDQMOffline::m_cuts
private

Definition at line 129 of file L1TMuonDQMOffline.h.

Referenced by analyze(), bookEfficiencyHistos(), and L1TMuonDQMOffline().

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

Definition at line 150 of file L1TMuonDQMOffline.h.

Referenced by L1TMuonDQMOffline().

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

Definition at line 115 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

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

Definition at line 114 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

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

Definition at line 113 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

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

Definition at line 112 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

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

Definition at line 111 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

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

Definition at line 139 of file L1TMuonDQMOffline.h.

Referenced by bookEfficiencyHistos(), and L1TMuonDQMOffline().

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

Definition at line 138 of file L1TMuonDQMOffline.h.

Referenced by bookEfficiencyHistos(), and L1TMuonDQMOffline().

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

Definition at line 132 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookEfficiencyHistos().

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

Definition at line 162 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff(), and L1TMuonDQMOffline().

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

Definition at line 161 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff(), and L1TMuonDQMOffline().

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

Definition at line 160 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff(), and L1TMuonDQMOffline().

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

Definition at line 163 of file L1TMuonDQMOffline.h.

Referenced by getHistBinsEff(), and L1TMuonDQMOffline().

const std::vector<EtaRegion> L1TMuonDQMOffline::m_etaRegions
private
std::map<EtaRegion, std::string> L1TMuonDQMOffline::m_etaStrings
private
edm::EDGetTokenT<l1t::MuonBxCollection> L1TMuonDQMOffline::m_GmtInputTag
private

Definition at line 152 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and L1TMuonDQMOffline().

std::string L1TMuonDQMOffline::m_HistFolder
private
HLTConfigProvider L1TMuonDQMOffline::m_hltConfig
private

Definition at line 95 of file L1TMuonDQMOffline.h.

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

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

Definition at line 127 of file L1TMuonDQMOffline.h.

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

Definition at line 125 of file L1TMuonDQMOffline.h.

float L1TMuonDQMOffline::m_maxGmtMuonDR
private

Definition at line 168 of file L1TMuonDQMOffline.h.

Referenced by getMuonGmtPairs(), and L1TMuonDQMOffline().

float L1TMuonDQMOffline::m_maxHltMuonDR
private

Definition at line 170 of file L1TMuonDQMOffline.h.

Referenced by L1TMuonDQMOffline(), and matchHlt().

float L1TMuonDQMOffline::m_minTagProbeDR
private

Definition at line 169 of file L1TMuonDQMOffline.h.

Referenced by getProbeMuons(), and L1TMuonDQMOffline().

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

Definition at line 122 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and getMuonGmtPairs().

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

Definition at line 151 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and L1TMuonDQMOffline().

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

Definition at line 121 of file L1TMuonDQMOffline.h.

Referenced by getMuonGmtPairs(), and getProbeMuons().

edm::ESHandle<Propagator> L1TMuonDQMOffline::m_propagatorAlong
private

Definition at line 98 of file L1TMuonDQMOffline.h.

Referenced by analyze().

edm::ESHandle<Propagator> L1TMuonDQMOffline::m_propagatorOpposite
private

Definition at line 99 of file L1TMuonDQMOffline.h.

Referenced by analyze().

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

Definition at line 135 of file L1TMuonDQMOffline.h.

Referenced by analyze(), bookResolutionHistos(), and L1TMuonDQMOffline().

std::map<QualLevel, std::string> L1TMuonDQMOffline::m_qualStrings
private
std::vector<reco::MuonCollection> L1TMuonDQMOffline::m_RecoMuons
private

Definition at line 124 of file L1TMuonDQMOffline.h.

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

Definition at line 126 of file L1TMuonDQMOffline.h.

double L1TMuonDQMOffline::m_recoToL1PtCutFactor
private

Definition at line 149 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and L1TMuonDQMOffline().

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

Definition at line 141 of file L1TMuonDQMOffline.h.

Referenced by bookResolutionHistos(), and L1TMuonDQMOffline().

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

Definition at line 116 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and bookResolutionHistos().

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

Definition at line 140 of file L1TMuonDQMOffline.h.

Referenced by bookResolutionHistos(), and L1TMuonDQMOffline().

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

Definition at line 133 of file L1TMuonDQMOffline.h.

Referenced by analyze(), bookResolutionHistos(), and L1TMuonDQMOffline().

double L1TMuonDQMOffline::m_TagPtCut
private

Definition at line 148 of file L1TMuonDQMOffline.h.

Referenced by getProbeMuons(), and L1TMuonDQMOffline().

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

Definition at line 120 of file L1TMuonDQMOffline.h.

Referenced by getProbeMuons(), and getTightMuons().

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

Definition at line 165 of file L1TMuonDQMOffline.h.

Referenced by bookHistograms(), and matchHlt().

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

Definition at line 155 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and L1TMuonDQMOffline().

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

Definition at line 159 of file L1TMuonDQMOffline.h.

Referenced by bookHistograms(), and L1TMuonDQMOffline().

std::string L1TMuonDQMOffline::m_trigProcess
private

Definition at line 156 of file L1TMuonDQMOffline.h.

Referenced by dqmBeginRun(), L1TMuonDQMOffline(), and matchHlt().

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

Definition at line 157 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and L1TMuonDQMOffline().

bool L1TMuonDQMOffline::m_useAtVtxCoord
private

Definition at line 167 of file L1TMuonDQMOffline.h.

Referenced by getMuonGmtPairs(), and L1TMuonDQMOffline().

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

Definition at line 153 of file L1TMuonDQMOffline.h.

Referenced by analyze(), and L1TMuonDQMOffline().