CMS 3D CMS Logo

HLTMuonPlotter.h
Go to the documentation of this file.
1 #ifndef HLTriggerOffline_Muon_HLTMuonPlotter_h
2 #define HLTriggerOffline_Muon_HLTMuonPlotter_h
3 
16 
23 
30 
32 
34 
36 
37 #include <sstream>
38 #include <string>
39 #include <vector>
40 #include <unordered_map>
41 
42 #include "TPRegexp.h"
43 
45 public:
49 
51  const std::string &,
52  const std::vector<std::string> &,
53  const std::vector<std::string> &,
57  const L1MuonMatcherAlgoForDQM &);
58 
59  ~HLTMuonPlotter() = default;
60 
61  void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &);
62  void analyze(const edm::Event &, const edm::EventSetup &);
63 
64 private:
65  struct MatchStruct {
67  const l1t::Muon *candL1;
68  std::vector<const reco::RecoChargedCandidate *> candHlt;
70  candBase = nullptr;
71  candL1 = nullptr;
72  }
74  candBase = cand;
75  candL1 = nullptr;
76  }
77  bool operator<(MatchStruct match) { return candBase->pt() < match.candBase->pt(); }
78  bool operator>(MatchStruct match) { return candBase->pt() > match.candBase->pt(); }
79  };
81  bool operator()(MatchStruct a, MatchStruct b) { return a.candBase->pt() > b.candBase->pt(); }
82  };
83 
84  void findMatches(std::vector<MatchStruct> &,
85  const l1t::MuonVectorRef &candsL1,
86  const std::vector<std::vector<const reco::RecoChargedCandidate *>> &);
87 
88  void bookHist(DQMStore::IBooker &, const std::string &, const std::string &, const std::string &, const std::string &);
89 
90  template <typename T>
91  std::string vector_to_string(std::vector<T> const &vec, std::string const &delimiter = " ") const;
92 
95 
96  std::vector<std::string> const moduleLabels_;
97  std::vector<std::string> const stepLabels_;
98 
102 
105  std::vector<double> const cutsDr_;
106 
107  std::vector<double> const parametersEta_;
108  std::vector<double> const parametersPhi_;
109  std::vector<double> const parametersTurnOn_;
110 
112 
114 
115  double cutMinPt_;
116  double cutMaxEta_;
117 
118  std::unordered_map<std::string, MonitorElement *> elements_;
119 };
120 
121 template <typename T>
122 std::string HLTMuonPlotter::vector_to_string(std::vector<T> const &vec, std::string const &delimiter) const {
123  if (vec.empty())
124  return "";
125  std::stringstream sstr;
126  for (auto const &foo : vec)
127  sstr << delimiter << foo;
128  auto ret = sstr.str();
129  ret.erase(0, delimiter.size());
130  return ret;
131 }
132 
133 #endif // HLTriggerOffline_Muon_HLTMuonPlotter_h
void bookHist(DQMStore::IBooker &, const std::string &, const std::string &, const std::string &, const std::string &)
std::string const hltPath_
MatchStruct(const reco::Candidate *cand)
virtual double pt() const =0
transverse momentum
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
ret
prodAgent to be discontinued
bool operator>(MatchStruct match)
StringCutObjectSelector< reco::Muon > const recMuonSelector_
bool operator<(MatchStruct match)
std::string const hltProcessName_
edm::EDGetTokenT< trigger::TriggerEventWithRefs > const triggerEventWithRefsToken_
void findMatches(std::vector< MatchStruct > &, const l1t::MuonVectorRef &candsL1, const std::vector< std::vector< const reco::RecoChargedCandidate *>> &)
std::vector< MuonRef > MuonVectorRef
Definition: Muon.h:15
~HLTMuonPlotter()=default
std::unordered_map< std::string, MonitorElement * > elements_
std::vector< double > const cutsDr_
std::vector< double > const parametersTurnOn_
std::string vector_to_string(std::vector< T > const &vec, std::string const &delimiter=" ") const
std::vector< const reco::RecoChargedCandidate * > candHlt
void analyze(const edm::Event &, const edm::EventSetup &)
HLTMuonPlotter(const edm::ParameterSet &, const std::string &, const std::vector< std::string > &, const std::vector< std::string > &, const edm::EDGetTokenT< trigger::TriggerEventWithRefs > &, const edm::EDGetTokenT< reco::GenParticleCollection > &, const edm::EDGetTokenT< reco::MuonCollection > &, const L1MuonMatcherAlgoForDQM &)
const reco::Candidate * candBase
dqm::legacy::MonitorElement MonitorElement
std::vector< std::string > const moduleLabels_
Definition: Muon.h:21
std::vector< double > const parametersEta_
const l1t::Muon * candL1
edm::EDGetTokenT< reco::GenParticleCollection > const genParticleToken_
std::vector< double > const parametersPhi_
double b
Definition: hdecay.h:120
L1MuonMatcherAlgoForDQM l1Matcher_
edm::EDGetTokenT< reco::MuonCollection > const recMuonToken_
bool operator()(MatchStruct a, MatchStruct b)
double a
Definition: hdecay.h:121
std::vector< std::string > const stepLabels_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
dqm::legacy::DQMStore DQMStore
StringCutObjectSelector< reco::GenParticle > const genMuonSelector_
Definition: Run.h:45
L1MuonMatcherAlgoT< edm::Transition::BeginRun > L1MuonMatcherAlgoForDQM