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  virtual void beginJob();
54  void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
55  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
56  void analyze(const edm::Event &, const edm::EventSetup &) override;
57  void endRun(const edm::Run &, const edm::EventSetup &) override;
58  virtual void endJob();
59 
60  // Extra Methods
61  std::vector<std::string> moduleLabels(const std::string&);
62 
63  // Input from Configuration File
66  std::vector<std::string> hltPathsToCheck_;
67 
68  // Member Variables
71 
72 };
73 
74 
75 
78 
79 using namespace std;
80 using namespace edm;
81 using namespace reco;
82 using namespace trigger;
83 
84 using vstring = vector<string>;
85 
86 
87 
90 
92  pset_(pset),
93  hltProcessName_(pset.getParameter<string>("hltProcessName")),
94  hltPathsToCheck_(pset.getParameter<vstring>("hltPathsToCheck")),
96 {
97 
98 }
99 
100 
101 
102 vector<string>
104 {
105 
106  vector<string> modules = hltConfig_.moduleLabels(path);
107  auto iter = modules.begin();
108  while (iter != modules.end()){
109  if ((iter->find("Filtered") == string::npos)&&(iter->find("hltL1s") == string::npos)){
110  iter = modules.erase(iter);
111  }
112  else if (iter->find("L1Filtered0") != string::npos)
113  iter = modules.erase(iter);
114  else ++iter;
115  }
116 // iter = modules.begin();
117 // while (iter != modules.end()){
118 // if ((iter->find("Filtered0") == string::npos)){
119 // std::cout<< *iter << std::endl;
120 // iter = modules.erase(iter);
121 // }
122 // else ++iter;
123 // }
124 
125 
126  return modules;
127 
128 }
129 
130 
131 
132 void
134  const edm::EventSetup & iSetup)
135 {
136 
137  // Initialize hltConfig
138  bool changedConfig;
139  if (!hltConfig_.init(iRun, iSetup, hltProcessName_, changedConfig)) {
140  LogError("HLTMuonVal") << "Initialization of HLTConfigProvider failed!!";
141  return;
142  }
143 
144  // Get the set of trigger paths we want to make plots for
145  set<string> hltPaths;
146  for (auto const & i : hltPathsToCheck_) {
147  for (auto const & j : hltConfig_.triggerNames()){
148  if (j.find(i) != std::string::npos){
149  hltPaths.insert(j);
150  }
151  }
152  }
153 
154  // Initialize the plotters
155  set<string>::iterator iPath;
156  vector<string>::const_iterator ilabel;
157  for (iPath = hltPaths.begin(); iPath != hltPaths.end(); iPath++) {
158  string path = * iPath;
159  vector<string> labels = moduleLabels(path);
160  bool isLastLabel = false;
161  for (ilabel = labels.begin(); ilabel != labels.end(); ilabel++) {
162  if (*ilabel == labels.back()) isLastLabel = true;
163  plotterContainer_.addPlotter(pset_, path, *ilabel,isLastLabel);
164  }
165  }
166 
167 }
168 
169 
170 
171 void
173  edm::Run const & iRun, edm::EventSetup const & iSetup)
174 {
175 
176  plotterContainer_.beginRun(iBooker, iRun, iSetup);
177 
178 }
179 
180 
181 
182 void
184  const EventSetup& iSetup)
185 {
186 
187  plotterContainer_.analyze(iEvent, iSetup);
188 
189 }
190 
191 
192 
193 void
195 {
196 
197 }
198 
199 
200 
201 void
203  const edm::EventSetup& iSetup)
204 {
205 
206  // plotterContainer_.endRun(iRun, iSetup);
207 
208 }
209 
210 
211 
212 void
214 {
215 
216 }
217 
218 
219 
220 //define this as a plug-in
HLTMuonMatchAndPlotContainer plotterContainer_
vector< string > vstring
Definition: ExoticaDQM.cc:8
void endRun(const edm::Run &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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:230
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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:42
std::vector< std::string > hltPathsToCheck_