CMS 3D CMS Logo

L1TMuonDQMOffline.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_L1TRIGGER_L1TMUONDQMOFFLINE_H
2 #define DQMOFFLINE_L1TRIGGER_L1TMUONDQMOFFLINE_H
3 
13 // system include files
14 #include <memory>
15 
16 // user include files
51 
52 #include "TRegexp.h"
53 #include "TString.h"
54 #include <utility>
55 #include <vector>
56 
57 class MuonGmtPair;
58 
59 //
60 // DQM class declaration
61 //
62 
64 public:
65  enum Control {
77  };
82 
84  ~L1TMuonDQMOffline() override;
85 
86 protected:
87  void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
88  virtual void bookControlHistos(DQMStore::IBooker&);
89  virtual void bookEfficiencyHistos(DQMStore::IBooker& ibooker);
90  virtual void bookResolutionHistos(DQMStore::IBooker& ibooker);
91  void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override;
92  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
93 
94 private:
95  // Helper Functions
100 
101  // Cut and Matching
105 
107 
109 
110  std::vector<float> getHistBinsEff(EffType eff);
111  std::tuple<int, double, double> getHistBinsRes(ResType res);
112 
113  // Keys for histogram maps
114  typedef std::tuple<ResType, EtaRegion, QualLevel> m_histoKeyResType; // resolution histograms
115  typedef std::tuple<EffType, int, EtaRegion, QualLevel>
116  m_histoKeyEffNumVarType; // efficiency numerator histograms for all variables except eta
117  typedef std::pair<int, QualLevel> m_histoKeyEffNumEtaType; // efficiency numerator histograms for eta variable
118  typedef std::tuple<EffType, int, EtaRegion>
119  m_histoKeyEffDenVarType; // efficiency denominator histograms for all variables except eta
120 
121  // Histograms and histogram containers
122  std::map<std::tuple<EffType, int, EtaRegion, QualLevel>, MonitorElement*> m_EfficiencyNumVarHistos;
123  std::map<std::pair<int, QualLevel>, MonitorElement*> m_EfficiencyNumEtaHistos;
124  std::map<std::tuple<EffType, int, EtaRegion>, MonitorElement*> m_EfficiencyDenVarHistos;
125  std::map<EtaRegion, MonitorElement*> m_EfficiencyDenPtHistos;
126  std::map<int, MonitorElement*> m_EfficiencyDenEtaHistos;
127  std::map<std::tuple<ResType, EtaRegion, QualLevel>, MonitorElement*> m_ResolutionHistos;
128  std::map<Control, MonitorElement*> m_ControlHistos;
129 
130  // helper variables
131  std::vector<const reco::Muon*> m_TightMuons;
132  std::vector<const reco::Muon*> m_ProbeMuons;
133  std::vector<MuonGmtPair> m_MuonGmtPairs;
134 
135  std::vector<reco::MuonCollection> m_RecoMuons;
136  std::vector<l1t::MuonBxCollection> m_L1tMuons;
137  std::vector<reco::Muon> m_RecoRecoMuons;
139 
140  std::vector<std::pair<int, QualLevel>> m_cuts;
141 
142  // vectors of enum values to loop over
143  const std::vector<EffType> m_effTypes;
144  const std::vector<ResType> m_resTypes;
145  const std::vector<EtaRegion> m_etaRegions;
146  const std::vector<QualLevel> m_qualLevelsRes;
147 
148  // maps with histogram name bits
149  std::map<EffType, std::string> m_effStrings;
150  std::map<EffType, std::string> m_effLabelStrings;
151  std::map<ResType, std::string> m_resStrings;
152  std::map<ResType, std::string> m_resLabelStrings;
153  std::map<EtaRegion, std::string> m_etaStrings;
154  std::map<QualLevel, std::string> m_qualStrings;
155 
156  // config params
157  bool m_verbose;
159  double m_TagPtCut;
161  std::vector<edm::ParameterSet> m_cutsVPSet;
169 
170  std::vector<std::string> m_trigNames;
171  std::vector<double> m_effVsPtBins;
172  std::vector<double> m_effVsPhiBins;
173  std::vector<double> m_effVsEtaBins;
174  std::vector<double> m_effVsVtxBins;
175 
176  std::vector<int> m_trigIndices;
177 
182 };
183 
184 //
185 // helper class to manage GMT-Muon pairing
186 //
187 class MuonGmtPair {
188 public:
189  MuonGmtPair(const reco::Muon* muon, const l1t::Muon* regMu, const PropagateToMuon& propagator, bool useAtVtxCoord);
190  MuonGmtPair(const MuonGmtPair& muonGmtPair);
192 
193  double dR();
194  double pt() const { return m_muon->pt(); };
195  double eta() const { return m_muon->eta(); };
196  double phi() const { return m_muon->phi(); };
197  int charge() const { return m_muon->charge(); };
198  double gmtPt() const { return m_regMu ? m_regMu->pt() : -1.; };
199  double gmtEta() const { return m_regMu ? m_gmtEta : -5.; };
200  double gmtPhi() const { return m_regMu ? m_gmtPhi : -5.; };
201  int gmtCharge() const { return m_regMu ? m_regMu->charge() : -5; };
202  int gmtQual() const { return m_regMu ? m_regMu->hwQual() : -1; };
203 
205  double getDeltaVar(const L1TMuonDQMOffline::ResType) const;
206  double getVar(const L1TMuonDQMOffline::EffType) const;
207 
208 private:
211 
212  // L1T muon eta and phi coordinates to be used
213  // Can be the coordinates from the 2nd muon station or from the vertex
214  double m_gmtEta;
215  double m_gmtPhi;
216 
217  double m_eta;
218  double m_phi;
219 };
220 
221 #endif
std::map< EffType, std::string > m_effStrings
double phi() const
edm::EDGetTokenT< reco::BeamSpot > m_BsInputTag
edm::EDGetTokenT< reco::MuonCollection > m_MuonInputTag
double pt() const final
transverse momentum
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
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::map< std::tuple< ResType, EtaRegion, QualLevel >, MonitorElement * > m_ResolutionHistos
Propagate an object (usually a track) to the second (default) or first muon station.
const std::vector< EtaRegion > m_etaRegions
std::vector< double > m_effVsPhiBins
std::map< EtaRegion, MonitorElement * > m_EfficiencyDenPtHistos
std::tuple< EffType, int, EtaRegion, QualLevel > m_histoKeyEffNumVarType
double getDeltaVar(const L1TMuonDQMOffline::ResType) const
std::string m_HistFolder
std::pair< int, QualLevel > m_histoKeyEffNumEtaType
Definition: Electron.h:6
std::tuple< ResType, EtaRegion, QualLevel > m_histoKeyResType
std::vector< const reco::Muon * > m_ProbeMuons
std::vector< float > getHistBinsEff(EffType eff)
int hwQual() const
Definition: L1Candidate.h:38
void getProbeMuons(edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
const unsigned int getNVertices(edm::Handle< reco::VertexCollection > &vertex)
int gmtQual() const
~L1TMuonDQMOffline() override
std::vector< std::string > m_trigNames
virtual void bookControlHistos(DQMStore::IBooker &)
std::map< QualLevel, std::string > m_qualStrings
double matchHlt(edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
std::string m_trigProcess
const l1t::Muon * m_regMu
std::vector< edm::ParameterSet > m_cutsVPSet
Propagate an object (usually a track) to the second (default) or first muon station.
std::map< EffType, std::string > m_effLabelStrings
std::tuple< int, double, double > getHistBinsRes(ResType res)
std::vector< reco::Muon > m_RecoRecoMuons
edm::EDGetTokenT< l1t::MuonBxCollection > m_GmtInputTag
std::vector< double > m_effVsPtBins
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
std::tuple< EffType, int, EtaRegion > m_histoKeyEffDenVarType
std::map< std::pair< int, QualLevel >, MonitorElement * > m_EfficiencyNumEtaHistos
double pt() const
L1TMuonDQMOffline::EtaRegion etaRegion() const
double gmtPt() const
const reco::Muon * m_muon
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
double gmtPhi() const
Definition: Muon.h:21
L1TMuonDQMOffline(const edm::ParameterSet &ps)
double eta() const
std::map< ResType, std::string > m_resStrings
double getVar(const L1TMuonDQMOffline::EffType) const
double gmtEta() const
virtual void bookResolutionHistos(DQMStore::IBooker &ibooker)
HLTConfigProvider m_hltConfig
const reco::Vertex getPrimaryVertex(edm::Handle< reco::VertexCollection > &vertex, edm::Handle< reco::BeamSpot > &beamSpot)
BXVector< l1t::Muon > m_L1tL1tMuons
std::vector< double > m_effVsEtaBins
std::vector< const reco::Muon * > m_TightMuons
const std::vector< ResType > m_resTypes
std::vector< l1t::MuonBxCollection > m_L1tMuons
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< reco::VertexCollection > m_VtxInputTag
edm::EDGetTokenT< trigger::TriggerEvent > m_trigInputTag
std::map< std::tuple< EffType, int, EtaRegion, QualLevel >, MonitorElement * > m_EfficiencyNumVarHistos
int charge() const
std::vector< reco::MuonCollection > m_RecoMuons
double phi() const final
momentum azimuthal angle
MuonGmtPair(const reco::Muon *muon, const l1t::Muon *regMu, const PropagateToMuon &propagator, bool useAtVtxCoord)
std::map< Control, MonitorElement * > m_ControlHistos
void getMuonGmtPairs(edm::Handle< l1t::MuonBxCollection > &gmtCands, PropagateToMuon const &propagator)
std::vector< int > m_trigIndices
int gmtCharge() const
Definition: Run.h:45
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker)
int charge() const final
electric charge
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)
double eta() const final
momentum pseudorapidity