CMS 3D CMS Logo

HLTMuonOfflineAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HLTMuonOfflineAnalyzer
4 // Class: HLTMuonOfflineAnalyzer
5 //
6 
7 //
8 // Jason Slaunwhite and Jeff Klukas
9 //
10 //
11 
12 // system include files
13 #include <memory>
14 #include <iostream>
15 
16 
17 // user include files
19 
21 
28 
29 
32 
33 
34 #include "TFile.h"
35 #include "TDirectory.h"
36 #include "TPRegexp.h"
37 
38 
41 
42 
43 
45 
46 public:
47 
49 
50 private:
51 
52  // Analyzer Methods
53  void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
54  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
55  void analyze(const edm::Event &, const edm::EventSetup &) override;
56  void endRun(const edm::Run &, const edm::EventSetup &) override;
57 
58  // Extra Methods
59  std::vector<std::string> moduleLabels(const std::string&);
60 
61  // Input from Configuration File
64  std::vector<std::string> hltPathsToCheck_;
65 
66  // Member Variables
69 
70 };
71 
72 
73 
76 
77 using namespace std;
78 using namespace edm;
79 using namespace reco;
80 using namespace trigger;
81 
82 using vstring = vector<string>;
83 
84 
85 
88 
90  pset_(pset),
91  hltProcessName_(pset.getParameter<string>("hltProcessName")),
92  hltPathsToCheck_(pset.getParameter<vstring>("hltPathsToCheck")),
93  plotterContainer_(consumesCollector(),pset)
94 {
95 
96 }
97 
98 
99 
100 vector<string>
102 {
103 
104  vector<string> modules = hltConfig_.moduleLabels(path);
105  auto iter = modules.begin();
106  while (iter != modules.end()){
107  if ((iter->find("Filtered") == string::npos)&&(iter->find("hltL1s") == string::npos)){
108  iter = modules.erase(iter);
109  }
110  else if (iter->find("L1Filtered0") != string::npos)
111  iter = modules.erase(iter);
112  else ++iter;
113  }
114 // iter = modules.begin();
115 // while (iter != modules.end()){
116 // if ((iter->find("Filtered0") == string::npos)){
117 // std::cout<< *iter << std::endl;
118 // iter = modules.erase(iter);
119 // }
120 // else ++iter;
121 // }
122 
123 
124  return modules;
125 
126 }
127 
128 
129 
130 void
132  const edm::EventSetup & iSetup)
133 {
134 
135  // Initialize hltConfig
136  bool changedConfig;
137  if (!hltConfig_.init(iRun, iSetup, hltProcessName_, changedConfig)) {
138  LogError("HLTMuonVal") << "Initialization of HLTConfigProvider failed!!";
139  return;
140  }
141 
142  // Get the set of trigger paths we want to make plots for
143  set<string> hltPaths;
144  for (auto const & i : hltPathsToCheck_) {
145  for (auto const & j : hltConfig_.triggerNames()){
146  if (j.find(i) != std::string::npos){
147  hltPaths.insert(j);
148  }
149  }
150  }
151 
152  // Initialize the plotters
153  set<string>::iterator iPath;
154  vector<string>::const_iterator ilabel;
155  for (iPath = hltPaths.begin(); iPath != hltPaths.end(); iPath++) {
156  string path = * iPath;
157  vector<string> labels = moduleLabels(path);
158  bool isLastLabel = false;
159  for (ilabel = labels.begin(); ilabel != labels.end(); ilabel++) {
160  if (*ilabel == labels.back()) isLastLabel = true;
161  plotterContainer_.addPlotter(pset_, path, *ilabel,isLastLabel);
162  }
163  }
164 
165 }
166 
167 
168 
169 void
171  edm::Run const & iRun, edm::EventSetup const & iSetup)
172 {
173 
174  plotterContainer_.beginRun(iBooker, iRun, iSetup);
175 
176 }
177 
178 
179 
180 void
182  const EventSetup& iSetup)
183 {
184 
185  plotterContainer_.analyze(iEvent, iSetup);
186 
187 }
188 
189 
190 
191 
192 
193 void
195  const edm::EventSetup& iSetup)
196 {
197 
198  // plotterContainer_.endRun(iRun, iSetup);
199 
200 }
201 
202 
203 
204 
205 
206 //define this as a plug-in
HLTMuonMatchAndPlotContainer plotterContainer_
vector< string > vstring
Definition: ExoticaDQM.cc:8
void endRun(const edm::Run &, const edm::EventSetup &) override
const std::vector< std::string > & triggerNames() const
names of trigger paths
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(const edm::Event &, const edm::EventSetup &)
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
void analyze(const edm::Event &, const edm::EventSetup &) override
HLTMuonOfflineAnalyzer(const edm::ParameterSet &)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
fixed size matrix
HLT enums.
std::vector< std::string > moduleLabels(const std::string &)
Container Class Definition (this is what is used by the DQM module) ///////.
void addPlotter(const edm::ParameterSet &, std::string, std::string, bool)
Add a HLTMuonMatchAndPlot for a given path.
Definition: Run.h:45
std::vector< std::string > hltPathsToCheck_