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 // user include files
18 
20 
27 
28 
31 
32 
33 #include "TFile.h"
34 #include "TDirectory.h"
35 #include "TPRegexp.h"
36 
37 
40 
41 
42 
44 
45 public:
46 
48 
49 private:
50 
51  // Analyzer Methods
52  virtual void beginJob();
53  virtual void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
54  virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
55  virtual void analyze(const edm::Event &, const edm::EventSetup &) override;
56  virtual void endRun(const edm::Run &, const edm::EventSetup &) override;
57  virtual void endJob();
58 
59  // Extra Methods
60  std::vector<std::string> moduleLabels(std::string);
61 
62  // Input from Configuration File
65  std::vector<std::string> hltPathsToCheck_;
66 
67  // Member Variables
70 
71 };
72 
73 
74 
77 
78 using namespace std;
79 using namespace edm;
80 using namespace reco;
81 using namespace trigger;
82 
83 typedef vector<string> vstring;
84 
85 
86 
89 
91  pset_(pset),
92  hltProcessName_(pset.getParameter<string>("hltProcessName")),
93  hltPathsToCheck_(pset.getParameter<vstring>("hltPathsToCheck")),
95 {
96 
97 }
98 
99 
100 
101 vector<string>
103 {
104 
105  vector<string> modules = hltConfig_.moduleLabels(path);
106  vector<string>::iterator iter = modules.begin();
107  while (iter != modules.end()){
108  if ((iter->find("Filtered") == string::npos)&&(iter->find("hltL1s") == string::npos)){
109  iter = modules.erase(iter);
110  }
111  else if (iter->find("L1Filtered0") != string::npos)
112  iter = modules.erase(iter);
113  else ++iter;
114  }
115 // iter = modules.begin();
116 // while (iter != modules.end()){
117 // if ((iter->find("Filtered0") == string::npos)){
118 // std::cout<< *iter << std::endl;
119 // iter = modules.erase(iter);
120 // }
121 // else ++iter;
122 // }
123 
124 
125  return modules;
126 
127 }
128 
129 
130 
131 void
133  const edm::EventSetup & iSetup)
134 {
135 
136  // Initialize hltConfig
137  bool changedConfig;
138  if (!hltConfig_.init(iRun, iSetup, hltProcessName_, changedConfig)) {
139  LogError("HLTMuonVal") << "Initialization of HLTConfigProvider failed!!";
140  return;
141  }
142 
143  // Get the set of trigger paths we want to make plots for
144  set<string> hltPaths;
145  for (size_t i = 0; i < hltPathsToCheck_.size(); i++) {
146  TPRegexp pattern(hltPathsToCheck_[i]);
147  for (size_t j = 0; j < hltConfig_.triggerNames().size(); j++)
148  if (TString(hltConfig_.triggerNames()[j]).Contains(pattern))
149  hltPaths.insert(hltConfig_.triggerNames()[j]);
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 void
193 {
194 
195 }
196 
197 
198 
199 void
201  const edm::EventSetup& iSetup)
202 {
203 
204  // plotterContainer_.endRun(iRun, iSetup);
205 
206 }
207 
208 
209 
210 void
212 {
213 
214 }
215 
216 
217 
218 //define this as a plug-in
HLTMuonMatchAndPlotContainer plotterContainer_
vector< string > vstring
Definition: ExoticaDQM.cc:8
virtual void endRun(const edm::Run &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< std::string > moduleLabels(std::string)
const std::vector< std::string > & triggerNames() const
names of trigger paths
virtual 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
vector< string > vstring
virtual 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 &)
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
fixed size matrix
HLT enums.
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_