CMS 3D CMS Logo

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