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