CMS 3D CMS Logo

L1TPhase2MuonOffline.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_L1TRIGGER_L1TPHASE2MUONOFFLINE_H
2 #define DQMOFFLINE_L1TRIGGER_L1TPHASE2MUONOFFLINE_H
3 
11 // DataFormats
19 
20 // FWCore
27 
28 // DQMServices
31 
32 #include <memory>
33 #include "TRegexp.h"
34 #include <utility>
35 #include <vector>
36 
37 class GenMuonGMTPair;
38 
39 //
40 // DQM class declaration
41 //
42 
44 public:
46  ~L1TPhase2MuonOffline() override = default;
47 
54 
55 protected:
56  void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override;
57  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
58 
62  void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override;
63 
64  //Fill Histos
65  void fillControlHistos();
66  void fillEfficiencyHistos();
67  void fillResolutionHistos();
68 
69 private:
70  // Cut and Matching
72 
73  // Handles and Tokens
77 
81 
82  // PropagateToMuon muonpropagator_;
83 
84  // vectors of enum values to loop over (and store quantities)
85  const std::vector<MuType> muonTypes_;
86  const std::vector<EffType> effTypes_;
87  const std::vector<ResType> resTypes_;
88  // const std::vector<VarType> varTypes_;
89  const std::vector<EtaRegion> etaRegions_;
90  const std::vector<QualLevel> qualLevels_;
91 
92  // maps with histogram name bits
93  // std::map<EffType, std::string> effNames_;
94  // std::map<EffType, std::string> effLabels_;
95  std::map<ResType, std::string> resNames_;
96  std::map<ResType, std::string> resLabels_;
97  std::map<EtaRegion, std::string> etaNames_;
98  std::map<QualLevel, std::string> qualNames_;
99  std::map<MuType, std::string> muonNames_;
100 
101  // config params
103  const std::vector<edm::ParameterSet> cutsVPSet_;
104 
105  const std::vector<double> effVsPtBins_;
106  const std::vector<double> effVsPhiBins_;
107  const std::vector<double> effVsEtaBins_;
108 
109  const double maxGmtMuonDR_;
110 
111  // Helper methods
112  void matchMuonsToGen(std::vector<const reco::GenParticle*> genmus);
113  std::vector<float> getHistBinsEff(EffType eff);
114  std::tuple<int, double, double> getHistBinsRes(ResType res);
115 
120 
121  // helper variables
122  std::vector<GenMuonGMTPair> gmtSAMuonPairs_;
123  std::vector<GenMuonGMTPair> gmtTkMuonPairs_;
124  std::vector<std::pair<int, QualLevel>> cuts_;
125 
126  const float lsb_pt = Phase2L1GMT::LSBpt;
131 };
132 
133 //
134 // helper class to manage GMT-GenMuon pairing
135 //
137 public:
138  GenMuonGMTPair(const reco::GenParticle* mu, const l1t::L1Candidate* gmtmu);
139  GenMuonGMTPair(const GenMuonGMTPair& muongmtPair);
141 
142  float dR2();
143  float pt() const { return mu_->pt(); };
144  float eta() const { return mu_->eta(); };
145  float phi() const { return mu_->phi(); };
146  int charge() const { return mu_->charge(); };
147 
148  // Now properties of the L1 candidate:
149  float gmtPt() const { return gmtmu_ ? gmtmu_->pt() : -1.; };
150  float gmtEta() const { return gmtmu_ ? gmtEta_ : -5.; };
151  float gmtPhi() const { return gmtmu_ ? gmtPhi_ : -5.; };
152  int gmtCharge() const { return gmtmu_ ? gmtmu_->charge() : -5; };
153  int gmtQual() const { return gmtmu_ ? gmtmu_->hwQual() : -1; };
154 
156  double getDeltaVar(const L1TPhase2MuonOffline::ResType) const;
157  double getVar(const L1TPhase2MuonOffline::EffType) const;
158 
159 private:
162 
163  // L1T muon eta and phi coordinates to be used
164  // Can be the coordinates from the 2nd muon station or from the vertex
165  float gmtEta_;
166  float gmtPhi_;
167 
168  float muEta_;
169  float muPhi_;
170 };
171 
172 #endif
const std::vector< double > effVsPtBins_
edm::EDGetTokenT< l1t::SAMuonCollection > gmtMuonToken_
const float LSBphi
Definition: Constants.h:81
std::vector< GenMuonGMTPair > gmtSAMuonPairs_
std::map< MuType, std::string > muonNames_
const std::vector< EtaRegion > etaRegions_
edm::Handle< l1t::SAMuonCollection > gmtSAMuon_
double pt() const final
transverse momentum
~L1TPhase2MuonOffline() override=default
void matchMuonsToGen(std::vector< const reco::GenParticle *> genmus)
const std::vector< MuType > muonTypes_
float gmtEta() const
const l1t::L1Candidate * gmtmu_
const float LSBSAz0
Definition: Constants.h:85
MonitorElement * efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
const std::vector< QualLevel > qualLevels_
std::map< ResType, std::string > resNames_
std::tuple< int, double, double > getHistBinsRes(ResType res)
Definition: Electron.h:6
std::vector< std::pair< int, QualLevel > > cuts_
const float LSBSAd0
Definition: Constants.h:86
int hwQual() const
Definition: L1Candidate.h:38
std::map< ResType, std::string > resLabels_
const std::vector< edm::ParameterSet > cutsVPSet_
const std::vector< double > effVsEtaBins_
const float LSBpt
Definition: Constants.h:80
MonitorElement * controlHistos_[kNMuTypes][kNVarTypes]
const reco::GenParticle * mu_
void getMuonGmtPairs(edm::Handle< l1t::MuonBxCollection > &gmtCands)
edm::Handle< std::vector< reco::GenParticle > > genparticles_
L1TPhase2MuonOffline(const edm::ParameterSet &ps)
float gmtPhi() const
std::map< EtaRegion, std::string > etaNames_
void bookControlHistos(DQMStore::IBooker &, MuType type)
MonitorElement * efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]
std::vector< float > getHistBinsEff(EffType eff)
const float LSBeta
Definition: Constants.h:82
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
double getVar(const L1TPhase2MuonOffline::EffType) const
const std::vector< ResType > resTypes_
const std::string histFolder_
void bookResolutionHistos(DQMStore::IBooker &ibooker, MuType type)
MonitorElement * resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]
double getDeltaVar(const L1TPhase2MuonOffline::ResType) const
const std::vector< double > effVsPhiBins_
const std::vector< EffType > effTypes_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::map< QualLevel, std::string > qualNames_
GenMuonGMTPair(const reco::GenParticle *mu, const l1t::L1Candidate *gmtmu)
L1TPhase2MuonOffline::EtaRegion etaRegion() const
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &iSetup) override
edm::Handle< l1t::TrackerMuonCollection > gmtTkMuon_
edm::EDGetTokenT< std::vector< reco::GenParticle > > genParticleToken_
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< l1t::TrackerMuonCollection > gmtTkMuonToken_
std::vector< GenMuonGMTPair > gmtTkMuonPairs_
Definition: Run.h:45
int charge() const final
electric charge
void bookEfficiencyHistos(DQMStore::IBooker &ibooker, MuType type)
double eta() const final
momentum pseudorapidity