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 beginLuminosityBlock(edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c) override;
76  virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& c);
77  void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
78  virtual void bookControlHistos(DQMStore::IBooker &);
79  virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker);
80  virtual void bookResolutionHistos(DQMStore::IBooker &ibooker);
81  void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override;
82  void analyze (const edm::Event& e, const edm::EventSetup& c) override;
83 
84  private:
85  // Helper Functions
86  const unsigned int getNVertices(edm::Handle<reco::VertexCollection> & vertex);
88  bool matchHlt(edm::Handle<trigger::TriggerEvent> & triggerEvent, const reco::Muon * mu);
89 
90  // Cut and Matching
94 
96 
100 
101  std::vector<float> getHistBinsEff(EffType eff);
102  std::tuple<int, double, double> getHistBinsRes(ResType res);
103 
104  // Keys for histogram maps
105  typedef std::tuple<ResType, EtaRegion, QualLevel> m_histoKeyResType; // resolution histograms
106  typedef std::tuple<EffType, int, EtaRegion, QualLevel> m_histoKeyEffNumVarType; // efficiency numerator histograms for all variables except eta
107  typedef std::pair<int, QualLevel> m_histoKeyEffNumEtaType; // efficiency numerator histograms for eta variable
108  typedef std::tuple<EffType, int, EtaRegion> m_histoKeyEffDenVarType; // efficiency denominator histograms for all variables except eta
109 
110  // Histograms and histogram containers
111  std::map<std::tuple<EffType, int, EtaRegion, QualLevel>, MonitorElement*> m_EfficiencyNumVarHistos;
112  std::map<std::pair<int, QualLevel>, MonitorElement*> m_EfficiencyNumEtaHistos;
113  std::map<std::tuple<EffType, int, EtaRegion>, MonitorElement*> m_EfficiencyDenVarHistos;
114  std::map<EtaRegion, MonitorElement*> m_EfficiencyDenPtHistos;
115  std::map<int, MonitorElement*> m_EfficiencyDenEtaHistos;
116  std::map<std::tuple<ResType, EtaRegion, QualLevel>, MonitorElement*> m_ResolutionHistos;
117  std::map<Control, MonitorElement*> m_ControlHistos;
118 
119  // helper variables
120  std::vector<const reco::Muon*> m_TightMuons;
121  std::vector<const reco::Muon*> m_ProbeMuons;
122  std::vector<MuonGmtPair> m_MuonGmtPairs;
123 
124  std::vector<reco::MuonCollection> m_RecoMuons;
125  std::vector<l1t::MuonBxCollection> m_L1tMuons;
126  std::vector<reco::Muon> m_RecoRecoMuons;
128 
129  std::vector<std::pair<int, QualLevel>> m_cuts;
130 
131  // vectors of enum values to loop over
132  const std::vector<EffType> m_effTypes;
133  const std::vector<ResType> m_resTypes;
134  const std::vector<EtaRegion> m_etaRegions;
135  const std::vector<QualLevel> m_qualLevelsRes;
136 
137  // maps with histogram name bits
138  std::map<EffType, std::string> m_effStrings;
139  std::map<EffType, std::string> m_effLabelStrings;
140  std::map<ResType, std::string> m_resStrings;
141  std::map<ResType, std::string> m_resLabelStrings;
142  std::map<EtaRegion, std::string> m_etaStrings;
143  std::map<QualLevel, std::string> m_qualStrings;
144 
145  // config params
146  bool m_verbose;
148  double m_TagPtCut;
150  std::vector<edm::ParameterSet> m_cutsVPSet;
158 
159  std::vector<std::string> m_trigNames;
160  std::vector<double> m_effVsPtBins;
161  std::vector<double> m_effVsPhiBins;
162  std::vector<double> m_effVsEtaBins;
163  std::vector<double> m_effVsVtxBins;
164 
165  std::vector<int> m_trigIndices;
166 
171 };
172 
173 //
174 // helper class to manage GMT-Muon pairing
175 //
176 class MuonGmtPair {
177  public :
178  MuonGmtPair(const reco::Muon *muon, const l1t::Muon *regMu, bool useAtVtxCoord);
179  MuonGmtPair(const MuonGmtPair& muonGmtPair);
181 
182  double dR();
183  double pt() const { return m_muon->pt(); };
184  double eta() const { return m_muon->eta(); };
185  double phi() const { return m_muon->phi(); };
186  int charge() const { return m_muon->charge(); };
187  double gmtPt() const { return m_regMu ? m_regMu->pt() : -1.; };
188  double gmtEta() const { return m_regMu ? m_gmtEta : -5.; };
189  double gmtPhi() const { return m_regMu ? m_gmtPhi : -5.; };
190  int gmtCharge() const {return m_regMu ? m_regMu->charge() : -5; };
191  int gmtQual() const { return m_regMu ? m_regMu->hwQual() : -1; };
192 
193  L1TMuonDQMOffline::EtaRegion etaRegion() const;
194  double getDeltaVar(const L1TMuonDQMOffline::ResType) const;
195  double getVar(const L1TMuonDQMOffline::EffType) const;
196 
197  void propagate(edm::ESHandle<MagneticField> bField,
200 
201  private :
202  // propagation private members
203  TrajectoryStateOnSurface cylExtrapTrkSam(reco::TrackRef track, double rho);
204  TrajectoryStateOnSurface surfExtrapTrkSam(reco::TrackRef track, double z);
205  FreeTrajectoryState freeTrajStateMuon(reco::TrackRef track);
206 
207  private :
210 
214 
215  // L1T muon eta and phi coordinates to be used
216  // Can be the coordinates from the 2nd muon station or from the vertex
217  double m_gmtEta;
218  double m_gmtPhi;
219 
220  double m_eta;
221  double m_phi_bar;
222  double m_phi_end;
223 };
224 
225 #endif
std::map< EffType, std::string > m_effStrings
edm::ESHandle< Propagator > m_propagatorOpposite
edm::EDGetTokenT< reco::BeamSpot > m_BsInputTag
edm::ESHandle< Propagator > m_propagatorOpposite
edm::ESHandle< Propagator > m_propagatorAlong
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
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
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
virtual void dqmEndLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
std::vector< double > m_effVsPhiBins
std::map< EtaRegion, MonitorElement * > m_EfficiencyDenPtHistos
std::tuple< EffType, int, EtaRegion, QualLevel > m_histoKeyEffNumVarType
bool matchHlt(edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon *mu)
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 &)
edm::ESHandle< MagneticField > m_BField
std::map< QualLevel, std::string > m_qualStrings
std::string m_trigProcess
int gmtCharge() const
const l1t::Muon * m_regMu
std::vector< edm::ParameterSet > m_cutsVPSet
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
edm::ESHandle< MagneticField > m_BField
edm::ESHandle< Propagator > m_propagatorAlong
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
std::vector< reco::MuonCollection > m_RecoMuons
std::map< Control, MonitorElement * > m_ControlHistos
std::vector< int > m_trigIndices
Definition: Run.h:43
virtual void bookEfficiencyHistos(DQMStore::IBooker &ibooker)
void getTightMuons(edm::Handle< reco::MuonCollection > &muons, const reco::Vertex &vertex)