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 
14 
15 namespace edm {
16  namespace service {
17 
19  trigger_pset_ = pset.getParameterSet("@trigger_paths");
20 
21  trignames_ = trigger_pset_.getParameter<Strings>("@trigger_paths");
22  end_names_ = pset.getParameter<Strings>("@end_paths");
23 
24  ParameterSet defopts;
25  ParameterSet const& opts = pset.getUntrackedParameterSet("options", defopts);
26  wantSummary_ = opts.getUntrackedParameter("wantSummary", false);
27 
28  process_name_ = pset.getParameter<std::string>("@process_name");
29 
32 
33  const unsigned int n(trignames_.size());
34  for (unsigned int i = 0; i != n; ++i) {
35  modulenames_.push_back(pset.getParameter<Strings>(trignames_[i]));
36  }
37  for (unsigned int i = 0; i != end_names_.size(); ++i) {
38  end_modulenames_.push_back(pset.getParameter<Strings>(end_names_[i]));
39  }
40  }
41 
43  Strings& trigPaths,
44  bool& fromPSetRegistry) {
45  // Get the parameter set containing the trigger names from the parameter set registry
46  // using the ID from TriggerResults as the key used to find it.
47  ParameterSet const* pset = nullptr;
48  pset::Registry const* psetRegistry = pset::Registry::instance();
49  if (nullptr != (pset = psetRegistry->getMapped(triggerResults.parameterSetID()))) {
50  // Check to make sure the parameter set contains
51  // a Strings parameter named "trigger_paths".
52  // We do not want to throw an exception if it is not there
53  // for reasons of backward compatibility
54  Strings const& psetNames = pset->getParameterNamesForType<Strings>();
55  std::string name("@trigger_paths");
56  if (search_all(psetNames, name)) {
57  // It is there, get it
58  trigPaths = pset->getParameter<Strings>("@trigger_paths");
59 
60  // This should never happen
61  if (trigPaths.size() != triggerResults.size()) {
63  << "TriggerNamesService::getTrigPaths, Trigger names vector and\n"
64  "TriggerResults are different sizes. This should be impossible,\n"
65  "please send information to reproduce this problem to\n"
66  "the edm developers.\n";
67  }
68 
69  fromPSetRegistry = true;
70  return true;
71  }
72  }
73 
74  fromPSetRegistry = false;
75 
76  // In older versions of the code the the trigger names were stored
77  // inside of the TriggerResults object. This will provide backward
78  // compatibility.
79  if (triggerResults.size() == triggerResults.getTriggerNames().size()) {
80  trigPaths = triggerResults.getTriggerNames();
81  return true;
82  }
83 
84  return false;
85  }
86 
88  bool dummy;
89  return getTrigPaths(triggerResults, trigPaths, dummy);
90  }
91  } // namespace service
92 } // namespace edm
edm::pset::Registry::instance
static Registry * instance()
Definition: Registry.cc:12
service
Definition: service.py:1
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TriggerResults.h
TriggerNamesService.h
edm
HLT enums.
Definition: AlignableModifier.h:19
Algorithms.h
edm::service::TriggerNamesService::TriggerNamesService
TriggerNamesService(ParameterSet const &proc_pset)
Definition: TriggerNamesService.cc:18
edm::errors::Unknown
Definition: EDMException.h:29
edm::service::TriggerNamesService::end_modulenames_
std::vector< Strings > end_modulenames_
Definition: TriggerNamesService.h:129
edm::service::TriggerNamesService::trigpos_
PosMap trigpos_
Definition: TriggerNamesService.h:124
edm::service::TriggerNamesService::Strings
std::vector< std::string > Strings
Definition: TriggerNamesService.h:44
edm::service::TriggerNamesService::wantSummary_
bool wantSummary_
Definition: TriggerNamesService.h:132
EDMException.h
edm::service::TriggerNamesService::loadPosMap
void loadPosMap(PosMap &posmap, Strings const &names)
Definition: TriggerNamesService.h:114
edm::service::TriggerNamesService::end_names_
Strings end_names_
Definition: TriggerNamesService.h:125
edm::service::TriggerNamesService::end_pos_
PosMap end_pos_
Definition: TriggerNamesService.h:126
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
edm::service::TriggerNamesService::trignames_
Strings trignames_
Definition: TriggerNamesService.h:123
Registry.h
edm::service::TriggerNamesService::getTrigPaths
Strings const & getTrigPaths() const
Definition: TriggerNamesService.h:55
Exception
Definition: hltDiff.cc:245
edm::triggerResults
static const std::string triggerResults("TriggerResults")
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
edm::service::TriggerNamesService::trigger_pset_
edm::ParameterSet trigger_pset_
Definition: TriggerNamesService.h:121
edm::search_all
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:36
dummy
Definition: DummySelector.h:38
edm::service::TriggerNamesService::process_name_
std::string process_name_
Definition: TriggerNamesService.h:131
edm::service::TriggerNamesService::modulenames_
std::vector< Strings > modulenames_
Definition: TriggerNamesService.h:128
edm::pset::Registry::getMapped
bool getMapped(key_type const &k, value_type &result) const
Definition: Registry.cc:17
edm::TriggerResults
Definition: TriggerResults.h:35
edm::pset::Registry
Definition: Registry.h:26
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
geometryDiff.opts
opts
Definition: geometryDiff.py:11