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
50 
51 #include "TRegexp.h"
52 #include "TString.h"
53 #include <utility>
54 #include <vector>
55 
56 class MuonGmtPair;
57 
58 //
59 // DQM class declaration
60 //
61 
63 public:
64  enum Control {
76  };
81 
83  ~L1TMuonDQMOffline() override;
84 
85 protected:
86  void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
87  virtual void bookControlHistos(DQMStore::IBooker&);
88  virtual void bookEfficiencyHistos(DQMStore::IBooker& ibooker);
89  virtual void bookResolutionHistos(DQMStore::IBooker& ibooker);
90  void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override;
91  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
92 
93 private:
94  // Helper Functions
99 
100  // Cut and Matching
104 
106 
108 
109  std::vector<float> getHistBinsEff(EffType eff);
110  std::tuple<int, double, double> getHistBinsRes(ResType res);
111 
112  // Keys for histogram maps
113  typedef std::tuple<ResType, EtaRegion, QualLevel> m_histoKeyResType; // resolution histograms
114  typedef std::tuple<EffType, int, EtaRegion, QualLevel>
115  m_histoKeyEffNumVarType; // efficiency numerator histograms for all variables except eta
116  typedef std::pair<int, QualLevel> m_histoKeyEffNumEtaType; // efficiency numerator histograms for eta variable
117  typedef std::tuple<EffType, int, EtaRegion>
118  m_histoKeyEffDenVarType; // efficiency denominator histograms for all variables except eta
119 
120  // Histograms and histogram containers
121  std::map<std::tuple<EffType, int, EtaRegion, QualLevel>, MonitorElement*> m_EfficiencyNumVarHistos;
122  std::map<std::pair<int, QualLevel>, MonitorElement*> m_EfficiencyNumEtaHistos;
123  std::map<std::tuple<EffType, int, EtaRegion>, MonitorElement*> m_EfficiencyDenVarHistos;
124  std::map<EtaRegion, MonitorElement*> m_EfficiencyDenPtHistos;
125  std::map<int, MonitorElement*> m_EfficiencyDenEtaHistos;
126  std::map<std::tuple<ResType, EtaRegion, QualLevel>, MonitorElement*> m_ResolutionHistos;
127  std::map<Control, MonitorElement*> m_ControlHistos;
128 
129  // helper variables
130  std::vector<const reco::Muon*> m_TightMuons;
131  std::vector<const reco::Muon*> m_ProbeMuons;
132  std::vector<MuonGmtPair> m_MuonGmtPairs;
133 
134  std::vector<reco::MuonCollection> m_RecoMuons;
135  std::vector<l1t::MuonBxCollection> m_L1tMuons;
136  std::vector<reco::Muon> m_RecoRecoMuons;
138 
139  std::vector<std::pair<int, QualLevel>> m_cuts;
140 
141  // vectors of enum values to loop over
142  const std::vector<EffType> m_effTypes;
143  const std::vector<ResType> m_resTypes;
144  const std::vector<EtaRegion> m_etaRegions;
145  const std::vector<QualLevel> m_qualLevelsRes;
146 
147  // maps with histogram name bits
148  std::map<EffType, std::string> m_effStrings;
149  std::map<EffType, std::string> m_effLabelStrings;
150  std::map<ResType, std::string> m_resStrings;
151  std::map<ResType, std::string> m_resLabelStrings;
152  std::map<EtaRegion, std::string> m_etaStrings;
153  std::map<QualLevel, std::string> m_qualStrings;
154 
155  // config params
156  bool m_verbose;
158  double m_TagPtCut;
160  std::vector<edm::ParameterSet> m_cutsVPSet;
168 
169  std::vector<std::string> m_trigNames;
170  std::vector<double> m_effVsPtBins;
171  std::vector<double> m_effVsPhiBins;
172  std::vector<double> m_effVsEtaBins;
173  std::vector<double> m_effVsVtxBins;
174 
175  std::vector<int> m_trigIndices;
176 
181 };
182 
183 //
184 // helper class to manage GMT-Muon pairing
185 //
186 class MuonGmtPair {
187 public:
188  MuonGmtPair(const reco::Muon* muon, const l1t::Muon* regMu, const PropagateToMuon& propagator, bool useAtVtxCoord);
189  MuonGmtPair(const MuonGmtPair& muonGmtPair);
191 
192  double dR();
193  double pt() const { return m_muon->pt(); };
194  double eta() const { return m_muon->eta(); };
195  double phi() const { return m_muon->phi(); };
196  int charge() const { return m_muon->charge(); };
197  double gmtPt() const { return m_regMu ? m_regMu->pt() : -1.; };
198  double gmtEta() const { return m_regMu ? m_gmtEta : -5.; };
199  double gmtPhi() const { return m_regMu ? m_gmtPhi : -5.; };
200  int gmtCharge() const { return m_regMu ? m_regMu->charge() : -5; };
201  int gmtQual() const { return m_regMu ? m_regMu->hwQual() : -1; };
202 
204  double getDeltaVar(const L1TMuonDQMOffline::ResType) const;
205  double getVar(const L1TMuonDQMOffline::EffType) const;
206 
207 private:
210 
211  // L1T muon eta and phi coordinates to be used
212  // Can be the coordinates from the 2nd muon station or from the vertex
213  double m_gmtEta;
214  double m_gmtPhi;
215 
216  double m_eta;
217  double m_phi;
218 };
219 
220 #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