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 
30 
31 #include "TFile.h"
32 #include "TDirectory.h"
33 #include "TPRegexp.h"
34 
37 
39 public:
40  explicit HLTMuonOfflineAnalyzer(const edm::ParameterSet &);
41 
42 private:
43  // Analyzer Methods
44  void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
45  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
46  void analyze(const edm::Event &, const edm::EventSetup &) override;
47 
48  // Extra Methods
49  std::vector<std::string> moduleLabels(const std::string &);
50 
51  // Input from Configuration File
54  std::vector<std::string> hltPathsToCheck_;
55 
56  // Member Variables
59 };
60 
63 
64 using namespace std;
65 using namespace edm;
66 using namespace reco;
67 using namespace trigger;
68 
69 using vstring = vector<string>;
70 
73 
75  : pset_(pset),
76  hltProcessName_(pset.getParameter<string>("hltProcessName")),
77  hltPathsToCheck_(pset.getParameter<vstring>("hltPathsToCheck")),
78  plotterContainer_(consumesCollector(), pset) {}
79 
80 vector<string> HLTMuonOfflineAnalyzer::moduleLabels(const string &path) {
81  vector<string> modules = hltConfig_.moduleLabels(path);
82  auto iter = modules.begin();
83  while (iter != modules.end()) {
84  if ((iter->find("Filtered") == string::npos) && (iter->find("hltL1s") == string::npos)) {
85  iter = modules.erase(iter);
86  } else if (iter->find("L1Filtered0") != string::npos)
87  iter = modules.erase(iter);
88  else
89  ++iter;
90  }
91  // iter = modules.begin();
92  // while (iter != modules.end()){
93  // if ((iter->find("Filtered0") == string::npos)){
94  // std::cout<< *iter << std::endl;
95  // iter = modules.erase(iter);
96  // }
97  // else ++iter;
98  // }
99 
100  return modules;
101 }
102 
104  // Initialize hltConfig
105  bool changedConfig;
106  if (!hltConfig_.init(iRun, iSetup, hltProcessName_, changedConfig)) {
107  LogError("HLTMuonVal") << "Initialization of HLTConfigProvider failed!!";
108  return;
109  }
110 
111  // Get the set of trigger paths we want to make plots for
112  set<string> hltPaths;
113  for (auto const &i : hltPathsToCheck_) {
114  for (auto const &j : hltConfig_.triggerNames()) {
115  if (j.find(i) != std::string::npos) {
116  hltPaths.insert(j);
117  }
118  }
119  }
120 
121  // Initialize the plotters
122  set<string>::iterator iPath;
123  vector<string>::const_iterator ilabel;
124  for (iPath = hltPaths.begin(); iPath != hltPaths.end(); iPath++) {
125  string path = *iPath;
126  vector<string> labels = moduleLabels(path);
127  bool isLastLabel = false;
128  for (ilabel = labels.begin(); ilabel != labels.end(); ilabel++) {
129  if (*ilabel == labels.back())
130  isLastLabel = true;
131  plotterContainer_.addPlotter(pset_, path, *ilabel, isLastLabel);
132  }
133  }
134 }
135 
137  edm::Run const &iRun,
138  edm::EventSetup const &iSetup) {
139  plotterContainer_.beginRun(iBooker, iRun, iSetup);
140 }
141 
144 }
145 
146 //define this as a plug-in
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
mps_fire.i
i
Definition: mps_fire.py:428
LogMessageMonitor_cff.modules
modules
Definition: LogMessageMonitor_cff.py:7
MessageLogger.h
edm::Run
Definition: Run.h:45
modules
Definition: MuonCleanerBySegments.cc:35
edm
HLT enums.
Definition: AlignableModifier.h:19
HLTSiStripMonitoring_cff.hltPaths
hltPaths
Definition: HLTSiStripMonitoring_cff.py:252
HLTMuonOfflineAnalyzer::pset_
edm::ParameterSet pset_
Definition: HLTMuonOfflineAnalyzer.cc:52
HLTMuonOfflineAnalyzer::HLTMuonOfflineAnalyzer
HLTMuonOfflineAnalyzer(const edm::ParameterSet &)
Definition: HLTMuonOfflineAnalyzer.cc:74
DQMStore.h
HLTMuonOfflineAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: HLTMuonOfflineAnalyzer.cc:142
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
HLTMuonOfflineAnalyzer::hltConfig_
HLTConfigProvider hltConfig_
Definition: HLTMuonOfflineAnalyzer.cc:58
HLTMuonOfflineAnalyzer
Definition: HLTMuonOfflineAnalyzer.cc:38
HLTMuonMatchAndPlotContainer::addPlotter
void addPlotter(const edm::ParameterSet &, std::string, std::string, bool)
Add a HLTMuonMatchAndPlot for a given path.
Definition: HLTMuonMatchAndPlotContainer.cc:42
HLTMuonOfflineAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: HLTMuonOfflineAnalyzer.cc:136
HLTConfigProvider::moduleLabels
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
Definition: HLTConfigProvider.h:76
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
HLTMuonOfflineAnalyzer::moduleLabels
std::vector< std::string > moduleLabels(const std::string &)
Definition: HLTMuonOfflineAnalyzer.cc:80
HLTMuonMatchAndPlotContainer
Container Class Definition (this is what is used by the DQM module) ///////.
Definition: HLTMuonMatchAndPlotContainer.h:43
DQMEDAnalyzer.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DQMEDAnalyzer
Definition: DQMEDAnalyzer.py:1
HLTMuonOfflineAnalyzer::hltPathsToCheck_
std::vector< std::string > hltPathsToCheck_
Definition: HLTMuonOfflineAnalyzer.cc:54
edm::ParameterSet
Definition: ParameterSet.h:47
HLTMuonOfflineAnalyzer::plotterContainer_
HLTMuonMatchAndPlotContainer plotterContainer_
Definition: HLTMuonOfflineAnalyzer.cc:57
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTMuonOfflineAnalyzer::hltProcessName_
std::string hltProcessName_
Definition: HLTMuonOfflineAnalyzer.cc:53
edm::EventSetup
Definition: EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
HLTConfigProvider.h
HLTConfigProvider
Definition: HLTConfigProvider.h:29
std
Definition: JetResolutionObject.h:76
HLTConfigProvider::init
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
Definition: HLTConfigProvider.cc:36
Frameworkfwd.h
vstring
vector< string > vstring
Definition: ExoticaDQM.cc:8
dqm::implementation::IBooker
Definition: DQMStore.h:43
trigger
Definition: HLTPrescaleTableCond.h:8
HLTMuonMatchAndPlotContainer::analyze
void analyze(const edm::Event &, const edm::EventSetup &)
Definition: HLTMuonMatchAndPlotContainer.cc:69
ConsumesCollector.h
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
ParameterSet.h
HLTConfigProvider::triggerNames
const std::vector< std::string > & triggerNames() const
names of trigger paths
Definition: HLTConfigProvider.h:69
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::Event
Definition: Event.h:73
HLTMuonMatchAndPlotContainer::beginRun
void beginRun(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &)
Definition: HLTMuonMatchAndPlotContainer.cc:49
HLTMuonOfflineAnalyzer::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: HLTMuonOfflineAnalyzer.cc:103
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
HLTMuonMatchAndPlotContainer.h