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:
70 
72  ~L1TMuonDQMOffline() override;
73 
74  protected:
75  void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
76  virtual void bookControlHistos(DQMStore::IBooker &);
77  virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker);
78  virtual void bookResolutionHistos(DQMStore::IBooker &ibooker);
79  void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override;
80  void analyze (const edm::Event& e, const edm::EventSetup& c) override;
81 
82  private:
83  // Helper Functions
84  const unsigned int getNVertices(edm::Handle<reco::VertexCollection> & vertex);
86  double matchHlt(edm::Handle<trigger::TriggerEvent> & triggerEvent, const reco::Muon * mu);
87 
88  // Cut and Matching
92 
94 
96 
97  std::vector<float> getHistBinsEff(EffType eff);
98  std::tuple<int, double, double> getHistBinsRes(ResType res);
99 
100  // Keys for histogram maps
101  typedef std::tuple<ResType, EtaRegion, QualLevel> m_histoKeyResType; // resolution histograms
102  typedef std::tuple<EffType, int, EtaRegion, QualLevel> m_histoKeyEffNumVarType; // efficiency numerator histograms for all variables except eta
103  typedef std::pair<int, QualLevel> m_histoKeyEffNumEtaType; // efficiency numerator histograms for eta variable
104  typedef std::tuple<EffType, int, EtaRegion> m_histoKeyEffDenVarType; // efficiency denominator histograms for all variables except eta
105 
106  // Histograms and histogram containers
107  std::map<std::tuple<EffType, int, EtaRegion, QualLevel>, MonitorElement*> m_EfficiencyNumVarHistos;
108  std::map<std::pair<int, QualLevel>, MonitorElement*> m_EfficiencyNumEtaHistos;
109  std::map<std::tuple<EffType, int, EtaRegion>, MonitorElement*> m_EfficiencyDenVarHistos;
110  std::map<EtaRegion, MonitorElement*> m_EfficiencyDenPtHistos;
111  std::map<int, MonitorElement*> m_EfficiencyDenEtaHistos;
112  std::map<std::tuple<ResType, EtaRegion, QualLevel>, MonitorElement*> m_ResolutionHistos;
113  std::map<Control, MonitorElement*> m_ControlHistos;
114 
115  // helper variables
116  std::vector<const reco::Muon*> m_TightMuons;
117  std::vector<const reco::Muon*> m_ProbeMuons;
118  std::vector<MuonGmtPair> m_MuonGmtPairs;
119 
120  std::vector<reco::MuonCollection> m_RecoMuons;
121  std::vector<l1t::MuonBxCollection> m_L1tMuons;
122  std::vector<reco::Muon> m_RecoRecoMuons;
124 
125  std::vector<std::pair<int, QualLevel>> m_cuts;
126 
127  // vectors of enum values to loop over
128  const std::vector<EffType> m_effTypes;
129  const std::vector<ResType> m_resTypes;
130  const std::vector<EtaRegion> m_etaRegions;
131  const std::vector<QualLevel> m_qualLevelsRes;
132 
133  // maps with histogram name bits
134  std::map<EffType, std::string> m_effStrings;
135  std::map<EffType, std::string> m_effLabelStrings;
136  std::map<ResType, std::string> m_resStrings;
137  std::map<ResType, std::string> m_resLabelStrings;
138  std::map<EtaRegion, std::string> m_etaStrings;
139  std::map<QualLevel, std::string> m_qualStrings;
140 
141  // config params
142  bool m_verbose;
144  double m_TagPtCut;
146  std::vector<edm::ParameterSet> m_cutsVPSet;
154 
155  std::vector<std::string> m_trigNames;
156  std::vector<double> m_effVsPtBins;
157  std::vector<double> m_effVsPhiBins;
158  std::vector<double> m_effVsEtaBins;
159  std::vector<double> m_effVsVtxBins;
160 
161  std::vector<int> m_trigIndices;
162 
167 };
168 
169 //
170 // helper class to manage GMT-Muon pairing
171 //
172 class MuonGmtPair {
173  public :
174  MuonGmtPair(const reco::Muon *muon, const l1t::Muon *regMu, const PropagateToMuon& propagator, bool useAtVtxCoord);
175  MuonGmtPair(const MuonGmtPair& muonGmtPair);
177 
178  double dR();
179  double pt() const { return m_muon->pt(); };
180  double eta() const { return m_muon->eta(); };
181  double phi() const { return m_muon->phi(); };
182  int charge() const { return m_muon->charge(); };
183  double gmtPt() const { return m_regMu ? m_regMu->pt() : -1.; };
184  double gmtEta() const { return m_regMu ? m_gmtEta : -5.; };
185  double gmtPhi() const { return m_regMu ? m_gmtPhi : -5.; };
186  int gmtCharge() const {return m_regMu ? m_regMu->charge() : -5; };
187  int gmtQual() const { return m_regMu ? m_regMu->hwQual() : -1; };
188 
190  double getDeltaVar(const L1TMuonDQMOffline::ResType) const;
191  double getVar(const L1TMuonDQMOffline::EffType) const;
192 
193  private :
196 
197  // L1T muon eta and phi coordinates to be used
198  // Can be the coordinates from the 2nd muon station or from the vertex
199  double m_gmtEta;
200  double m_gmtPhi;
201 
202  double m_eta;
203  double m_phi;
204 };
205 
206 #endif
std::map< EffType, std::string > m_effStrings
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
double gmtPt() const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::map< std::tuple< ResType, EtaRegion, QualLevel >, MonitorElement * > m_ResolutionHistos
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
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)
void getProbeMuons(edm::Handle< edm::TriggerResults > &trigResults, edm::Handle< trigger::TriggerEvent > &trigEvent)
const unsigned int getNVertices(edm::Handle< reco::VertexCollection > &vertex)
~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
int gmtCharge() const
const l1t::Muon * m_regMu
std::vector< edm::ParameterSet > m_cutsVPSet
Propagate an object (usually a track) to the second muon station. Support for other muon stations wil...
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
double phi() const
std::vector< double > m_effVsPtBins
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
double gmtPhi() const
std::tuple< EffType, int, EtaRegion > m_histoKeyEffDenVarType
std::map< std::pair< int, QualLevel >, MonitorElement * > m_EfficiencyNumEtaHistos
const reco::Muon * m_muon
std::map< int, MonitorElement * > m_EfficiencyDenEtaHistos
std::vector< std::pair< int, QualLevel > > m_cuts
const int mu
Definition: Constants.h:22
const std::vector< EffType > m_effTypes
int charge() const
const std::vector< QualLevel > m_qualLevelsRes
std::vector< MuonGmtPair > m_MuonGmtPairs
std::map< std::tuple< EffType, int, EtaRegion >, MonitorElement * > m_EfficiencyDenVarHistos
Definition: Muon.h:21
L1TMuonDQMOffline(const edm::ParameterSet &ps)
double eta() const
void getMuonGmtPairs(edm::Handle< l1t::MuonBxCollection > &gmtCands)
std::map< ResType, std::string > m_resStrings
int gmtQual() 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
double pt() const
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
double gmtEta() const
edm::EDGetTokenT< trigger::TriggerEvent > m_trigInputTag
std::map< std::tuple< EffType, int, EtaRegion, QualLevel >, MonitorElement * > m_EfficiencyNumVarHistos
PropagateToMuon m_propagator
std::vector< reco::MuonCollection > m_RecoMuons
std::map< Control, MonitorElement * > m_ControlHistos
std::vector< int > m_trigIndices
Definition: Run.h:45
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker)
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)