CMS 3D CMS Logo

HLTGenValHistCollPath.cc
Go to the documentation of this file.
2 
3 // constructor
5  : hltConfig_(hltConfig) {
6  triggerPath_ = pathCollConfig.getParameter<std::string>("triggerPath");
7  doOnlyLastFilter_ = pathCollConfig.getParameter<bool>("doOnlyLastFilter");
8 
9  // before creating the collections for each filter, we'll store the needed configurations in a pset
10  // we'll copy this basis multiple times and add the respective path later
11  edm::ParameterSet filterCollConfig;
12  filterCollConfig.addParameter<std::string>("objType", pathCollConfig.getParameter<std::string>("objType"));
13  filterCollConfig.addParameter<std::string>("hltProcessName",
14  pathCollConfig.getParameter<std::string>("hltProcessName"));
15  filterCollConfig.addParameter<double>("dR2limit", pathCollConfig.getParameter<double>("dR2limit"));
16  filterCollConfig.addParameter<std::string>("pathName", triggerPath_);
17 
18  pathStringName_ = triggerPath_ + "-" + pathCollConfig.getParameter<std::string>("objType");
19 
20  // this filter will be the denominator
21  edm::ParameterSet filterCollConfigStepBeforeAny = filterCollConfig;
22  filterCollConfigStepBeforeAny.addParameter<std::string>("filterName", "beforeAnyFilter");
23  collectionFilter_.emplace_back(HLTGenValHistCollFilter(filterCollConfigStepBeforeAny));
24 
25  // we'll use this to construct the string to find which filters belong to which histogram later
26  pathString_ = "";
27 
28  // getting all filters from path
30  if (doOnlyLastFilter_) {
31  edm::ParameterSet filterCollConfigOnlyLastFilter = filterCollConfig;
32  filterCollConfigOnlyLastFilter.addParameter<std::string>("filterName", filters_.back());
33  collectionFilter_.emplace_back(HLTGenValHistCollFilter(filterCollConfigOnlyLastFilter));
34 
35  // remove potential leading "-" for printing
37  if (filterName.rfind('-', 0) == 0)
38  filterName.erase(0, 1);
39 
41  } else {
42  for (auto& filter : filters_) {
43  edm::ParameterSet filterCollConfigStep = filterCollConfig;
44  filterCollConfigStep.addParameter<std::string>("filterName", filter);
45  collectionFilter_.emplace_back(HLTGenValHistCollFilter(filterCollConfigStep));
46 
47  // remove potential leading "-" for printing
49  if (filterName.rfind('-', 0) == 0)
50  filterName.erase(0, 1);
51 
53  if (filter != filters_.back())
54  pathString_ += ";";
55  }
56  }
57 }
58 
61  desc.add<std::string>("objType", "");
62  desc.add<double>("dR2limit", 0.1);
63  desc.add<bool>("doOnlyLastFilter", false);
64  desc.add<std::string>("hltProcessName", "HLT");
65  desc.add<std::string>("triggerPath", "");
66  return desc;
67 }
68 
69 // hist booking function
70 // this just calls the booking for each object in the the filter collection
72  std::vector<edm::ParameterSet>& histConfigs,
73  std::vector<edm::ParameterSet>& histConfigs2D) {
74  if (!pathString_.empty())
75  iBooker.bookString("path-" + pathStringName_, pathString_);
76 
77  for (auto& collectionFilter : collectionFilter_)
78  collectionFilter.bookHists(iBooker, histConfigs, histConfigs2D);
79 }
80 
81 // hist filling function
82 // this just calls the filling for each object in the filter collection
84  for (auto& collectionFilter : collectionFilter_)
85  collectionFilter.fillHists(obj, triggerEvent);
86 }
HLTGenValHistCollPath(edm::ParameterSet pathCollConfig, HLTConfigProvider &hltConfig)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HLTConfigProvider hltConfig_
std::vector< std::string > filters_
std::vector< HLTGenValHistCollFilter > collectionFilter_
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
Definition: DQMStore.h:87
void bookHists(DQMStore::IBooker &iBooker, std::vector< edm::ParameterSet > &histConfigs, std::vector< edm::ParameterSet > &histConfigs2D)
void fillHists(const HLTGenValObject &obj, edm::Handle< trigger::TriggerEvent > &triggerEvent)
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
static edm::ParameterSetDescription makePSetDescription()
const std::vector< std::string > & saveTagsModules(unsigned int trigger) const