CMS 3D CMS Logo

TriggerNamesService.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Implementation:
4 //
5 // Original Author: Jim Kowalkowski
6 //
7 
15 
16 namespace edm {
17  namespace service {
18 
20  trigger_pset_ = pset.getParameterSet("@trigger_paths");
21 
22  trignames_ = trigger_pset_.getParameter<Strings>("@trigger_paths");
23  end_names_ = pset.getParameter<Strings>("@end_paths");
24 
25  ParameterSet defopts;
26  ParameterSet const& opts = pset.getUntrackedParameterSet("options", defopts);
27  wantSummary_ = opts.getUntrackedParameter("wantSummary", false);
28 
29  process_name_ = pset.getParameter<std::string>("@process_name");
30 
33 
34  const unsigned int n(trignames_.size());
35  for (unsigned int i = 0; i != n; ++i) {
36  modulenames_.push_back(
38  }
39  for (unsigned int i = 0; i != end_names_.size(); ++i) {
40  end_modulenames_.push_back(
42  }
43  }
44 
46  Strings& trigPaths,
47  bool& fromPSetRegistry) {
48  // Get the parameter set containing the trigger names from the parameter set registry
49  // using the ID from TriggerResults as the key used to find it.
50  ParameterSet const* pset = nullptr;
51  pset::Registry const* psetRegistry = pset::Registry::instance();
52  if (nullptr != (pset = psetRegistry->getMapped(triggerResults.parameterSetID()))) {
53  // Check to make sure the parameter set contains
54  // a Strings parameter named "trigger_paths".
55  // We do not want to throw an exception if it is not there
56  // for reasons of backward compatibility
57  Strings const& psetNames = pset->getParameterNamesForType<Strings>();
58  std::string name("@trigger_paths");
59  if (search_all(psetNames, name)) {
60  // It is there, get it
61  trigPaths = pset->getParameter<Strings>("@trigger_paths");
62 
63  // This should never happen
64  if (trigPaths.size() != triggerResults.size()) {
66  << "TriggerNamesService::getTrigPaths, Trigger names vector and\n"
67  "TriggerResults are different sizes. This should be impossible,\n"
68  "please send information to reproduce this problem to\n"
69  "the edm developers.\n";
70  }
71 
72  fromPSetRegistry = true;
73  return true;
74  }
75  }
76 
77  fromPSetRegistry = false;
78 
79  // In older versions of the code the the trigger names were stored
80  // inside of the TriggerResults object. This will provide backward
81  // compatibility.
82  if (triggerResults.size() == triggerResults.getTriggerNames().size()) {
83  trigPaths = triggerResults.getTriggerNames();
84  return true;
85  }
86 
87  return false;
88  }
89 
91  bool dummy;
92  return getTrigPaths(triggerResults, trigPaths, dummy);
93  }
94  } // namespace service
95 } // namespace edm
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:17
std::vector< std::string > Strings
void loadPosMap(PosMap &posmap, Strings const &names)
std::vector< std::string > configurationToModuleBitPosition(std::vector< std::string >)
Strings const & getTrigPaths() const
static std::string const triggerResults("TriggerResults")
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:36
std::vector< Strings > end_modulenames_
HLT enums.
TriggerNamesService(ParameterSet const &proc_pset)
static Registry * instance()
Definition: Registry.cc:12