CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::service::TriggerNamesService Class Reference

#include <TriggerNamesService.h>

Public Types

typedef std::map< std::string,
unsigned int > 
PosMap
 
typedef PosMap::size_type size_type
 
typedef std::vector< std::string > Strings
 

Public Member Functions

size_type find (PosMap const &posmap, std::string const &name) const
 
size_type findEndPath (std::string const &name) const
 
size_type findTrigPath (std::string const &name) const
 
std::string const & getEndPath (size_type const i) const
 
std::string const & getEndPathModule (std::string const &name, size_type const j) const
 
std::string const & getEndPathModule (size_type const i, size_type const j) const
 
Strings const & getEndPathModules (std::string const &name) const
 
Strings const & getEndPathModules (size_type const i) const
 
Strings const & getEndPaths () const
 
std::string const & getProcessName () const
 
edm::ParameterSet const & getTriggerPSet () const
 
std::string const & getTrigPath (size_type const i) const
 
std::string const & getTrigPathModule (std::string const &name, size_type const j) const
 
std::string const & getTrigPathModule (size_type const i, size_type const j) const
 
Strings const & getTrigPathModules (std::string const &name) const
 
Strings const & getTrigPathModules (size_type const i) const
 
Strings const & getTrigPaths () const
 
bool getTrigPaths (TriggerResults const &triggerResults, Strings &trigPaths)
 
bool getTrigPaths (TriggerResults const &triggerResults, Strings &trigPaths, bool &fromPSetRegistry)
 
size_type size () const
 
 TriggerNamesService (ParameterSet const &proc_pset)
 
bool wantSummary () const
 

Private Member Functions

void loadPosMap (PosMap &posmap, Strings const &names)
 

Private Attributes

std::vector< Stringsend_modulenames_
 
Strings end_names_
 
PosMap end_pos_
 
std::vector< Stringsmodulenames_
 
std::string process_name_
 
edm::ParameterSet trigger_pset_
 
Strings trignames_
 
PosMap trigpos_
 
bool wantSummary_
 

Detailed Description

Definition at line 42 of file TriggerNamesService.h.

Member Typedef Documentation

typedef std::map<std::string, unsigned int> edm::service::TriggerNamesService::PosMap

Definition at line 47 of file TriggerNamesService.h.

Definition at line 48 of file TriggerNamesService.h.

typedef std::vector<std::string> edm::service::TriggerNamesService::Strings

Definition at line 46 of file TriggerNamesService.h.

Constructor & Destructor Documentation

edm::service::TriggerNamesService::TriggerNamesService ( ParameterSet const &  proc_pset)
explicit

Definition at line 19 of file TriggerNamesService.cc.

References end_modulenames_, end_names_, end_pos_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), i, loadPosMap(), modulenames_, gen::n, geometryDiff::opts, process_name_, AlCaHLTBitMon_QueryRunRegistry::string, trigger_pset_, trignames_, trigpos_, and wantSummary_.

19  {
20 
21  trigger_pset_ =
22  pset.getParameterSet("@trigger_paths");
23 
24  trignames_ = trigger_pset_.getParameter<Strings>("@trigger_paths");
25  end_names_ = pset.getParameter<Strings>("@end_paths");
26 
27  ParameterSet defopts;
28  ParameterSet const& opts =
29  pset.getUntrackedParameterSet("options", defopts);
30  wantSummary_ =
31  opts.getUntrackedParameter("wantSummary", false);
32 
33  process_name_ = pset.getParameter<std::string>("@process_name");
34 
36  loadPosMap(end_pos_,end_names_);
37 
38  const unsigned int n(trignames_.size());
39  for(unsigned int i = 0; i != n; ++i) {
40  modulenames_.push_back(pset.getParameter<Strings>(trignames_[i]));
41  }
42  for(unsigned int i = 0; i != end_names_.size(); ++i) {
43  end_modulenames_.push_back(pset.getParameter<Strings>(end_names_[i]));
44  }
45  }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > Strings
Definition: MsgTools.h:18
void loadPosMap(PosMap &posmap, Strings const &names)
ParameterSet const & getParameterSet(std::string const &) const
std::vector< Strings > end_modulenames_

Member Function Documentation

size_type edm::service::TriggerNamesService::find ( PosMap const &  posmap,
std::string const &  name 
) const
inline

Definition at line 109 of file TriggerNamesService.h.

Referenced by findEndPath(), findTrigPath(), getEndPathModule(), getEndPathModules(), getTrigPathModule(), and getTrigPathModules().

109  {
110  PosMap::const_iterator const pos(posmap.find(name));
111  if (pos == posmap.end()) {
112  return posmap.size();
113  } else {
114  return pos->second;
115  }
116  }
size_type edm::service::TriggerNamesService::findEndPath ( std::string const &  name) const
inline

Definition at line 81 of file TriggerNamesService.h.

References end_pos_, and find().

Referenced by FastTimerService::preStreamBeginRun().

81 { return find(end_pos_,name);}
size_type find(PosMap const &posmap, std::string const &name) const
size_type edm::service::TriggerNamesService::findTrigPath ( std::string const &  name) const
inline

Definition at line 59 of file TriggerNamesService.h.

References find(), and trigpos_.

Referenced by FastTimerService::preStreamBeginRun().

59 { return find(trigpos_,name);}
size_type find(PosMap const &posmap, std::string const &name) const
std::string const& edm::service::TriggerNamesService::getEndPath ( size_type const  i) const
inline
std::string const& edm::service::TriggerNamesService::getEndPathModule ( std::string const &  name,
size_type const  j 
) const
inline

Definition at line 102 of file TriggerNamesService.h.

References asciidump::at, end_modulenames_, end_pos_, and find().

102  {
103  return (end_modulenames_.at(find(end_pos_,name))).at(j);
104  }
int j
Definition: DBlmapReader.cc:9
size_type find(PosMap const &posmap, std::string const &name) const
std::vector< Strings > end_modulenames_
list at
Definition: asciidump.py:428
std::string const& edm::service::TriggerNamesService::getEndPathModule ( size_type const  i,
size_type const  j 
) const
inline

Definition at line 105 of file TriggerNamesService.h.

References asciidump::at, and end_modulenames_.

105  {
106  return (end_modulenames_.at(i)).at(j);
107  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
std::vector< Strings > end_modulenames_
list at
Definition: asciidump.py:428
Strings const& edm::service::TriggerNamesService::getEndPathModules ( std::string const &  name) const
inline
Strings const& edm::service::TriggerNamesService::getEndPathModules ( size_type const  i) const
inline

Definition at line 99 of file TriggerNamesService.h.

References end_modulenames_.

99  {
100  return end_modulenames_.at(i);
101  }
int i
Definition: DBlmapReader.cc:9
std::vector< Strings > end_modulenames_
Strings const& edm::service::TriggerNamesService::getEndPaths ( ) const
inline
std::string const& edm::service::TriggerNamesService::getProcessName ( ) const
inline
edm::ParameterSet const& edm::service::TriggerNamesService::getTriggerPSet ( ) const
inline

Definition at line 122 of file TriggerNamesService.h.

References trigger_pset_.

122 { return trigger_pset_; }
std::string const& edm::service::TriggerNamesService::getTrigPath ( size_type const  i) const
inline
std::string const& edm::service::TriggerNamesService::getTrigPathModule ( std::string const &  name,
size_type const  j 
) const
inline

Definition at line 89 of file TriggerNamesService.h.

References asciidump::at, find(), modulenames_, and trigpos_.

89  {
90  return (modulenames_.at(find(trigpos_,name))).at(j);
91  }
int j
Definition: DBlmapReader.cc:9
size_type find(PosMap const &posmap, std::string const &name) const
list at
Definition: asciidump.py:428
std::string const& edm::service::TriggerNamesService::getTrigPathModule ( size_type const  i,
size_type const  j 
) const
inline

Definition at line 92 of file TriggerNamesService.h.

References asciidump::at, and modulenames_.

92  {
93  return (modulenames_.at(i)).at(j);
94  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
list at
Definition: asciidump.py:428
Strings const& edm::service::TriggerNamesService::getTrigPathModules ( std::string const &  name) const
inline
Strings const& edm::service::TriggerNamesService::getTrigPathModules ( size_type const  i) const
inline

Definition at line 86 of file TriggerNamesService.h.

References modulenames_.

86  {
87  return modulenames_.at(i);
88  }
int i
Definition: DBlmapReader.cc:9
Strings const& edm::service::TriggerNamesService::getTrigPaths ( ) const
inline
bool edm::service::TriggerNamesService::getTrigPaths ( TriggerResults const &  triggerResults,
Strings trigPaths 
)

Definition at line 96 of file TriggerNamesService.cc.

References getTrigPaths().

97  {
98  bool dummy;
99  return getTrigPaths(triggerResults, trigPaths, dummy);
100  }
static std::string const triggerResults("TriggerResults")
Strings const & getTrigPaths() const
bool edm::service::TriggerNamesService::getTrigPaths ( TriggerResults const &  triggerResults,
Strings trigPaths,
bool &  fromPSetRegistry 
)

Definition at line 48 of file TriggerNamesService.cc.

References edm::hlt::Exception, edm::pset::Registry::getMapped(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), edm::TriggerResults::getTriggerNames(), edm::pset::Registry::instance(), mergeVDriftHistosByStation::name, edm::TriggerResults::parameterSetID(), edm::search_all(), edm::HLTGlobalStatus::size(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::errors::Unknown.

50  {
51 
52  // Get the parameter set containing the trigger names from the parameter set registry
53  // using the ID from TriggerResults as the key used to find it.
54  ParameterSet const* pset = nullptr;
55  pset::Registry const* psetRegistry = pset::Registry::instance();
56  if (nullptr != (pset = psetRegistry->getMapped(triggerResults.parameterSetID()))) {
57 
58  // Check to make sure the parameter set contains
59  // a Strings parameter named "trigger_paths".
60  // We do not want to throw an exception if it is not there
61  // for reasons of backward compatibility
62  Strings const& psetNames = pset->getParameterNamesForType<Strings>();
63  std::string name("@trigger_paths");
64  if (search_all(psetNames, name)) {
65  // It is there, get it
66  trigPaths = pset->getParameter<Strings>("@trigger_paths");
67 
68  // This should never happen
69  if (trigPaths.size() != triggerResults.size()) {
71  << "TriggerNamesService::getTrigPaths, Trigger names vector and\n"
72  "TriggerResults are different sizes. This should be impossible,\n"
73  "please send information to reproduce this problem to\n"
74  "the edm developers.\n";
75  }
76 
77  fromPSetRegistry = true;
78  return true;
79  }
80  }
81 
82  fromPSetRegistry = false;
83 
84  // In older versions of the code the the trigger names were stored
85  // inside of the TriggerResults object. This will provide backward
86  // compatibility.
87  if (triggerResults.size() == triggerResults.getTriggerNames().size()) {
88  trigPaths = triggerResults.getTriggerNames();
89  return true;
90  }
91 
92  return false;
93  }
std::vector< std::string > Strings
Definition: MsgTools.h:18
static std::string const triggerResults("TriggerResults")
bool search_all(ForwardSequence const &s, Datum const &d)
Definition: Algorithms.h:46
static Registry * instance()
Definition: Registry.cc:16
void edm::service::TriggerNamesService::loadPosMap ( PosMap posmap,
Strings const &  names 
)
inlineprivate

Definition at line 126 of file TriggerNamesService.h.

References i, and gen::n.

Referenced by TriggerNamesService().

126  {
127  size_type const n(names.size());
128  for (size_type i = 0; i != n; ++i) {
129  posmap[names[i]] = i;
130  }
131  }
int i
Definition: DBlmapReader.cc:9
static const HistoName names[]
size_type edm::service::TriggerNamesService::size ( void  ) const
inline

Definition at line 56 of file TriggerNamesService.h.

References trignames_.

56 { return trignames_.size(); }
bool edm::service::TriggerNamesService::wantSummary ( ) const
inline

Definition at line 119 of file TriggerNamesService.h.

References wantSummary_.

Member Data Documentation

std::vector<Strings> edm::service::TriggerNamesService::end_modulenames_
private

Definition at line 141 of file TriggerNamesService.h.

Referenced by getEndPathModule(), getEndPathModules(), and TriggerNamesService().

Strings edm::service::TriggerNamesService::end_names_
private

Definition at line 137 of file TriggerNamesService.h.

Referenced by getEndPath(), getEndPaths(), and TriggerNamesService().

PosMap edm::service::TriggerNamesService::end_pos_
private
std::vector<Strings> edm::service::TriggerNamesService::modulenames_
private
std::string edm::service::TriggerNamesService::process_name_
private

Definition at line 143 of file TriggerNamesService.h.

Referenced by getProcessName(), and TriggerNamesService().

edm::ParameterSet edm::service::TriggerNamesService::trigger_pset_
private

Definition at line 133 of file TriggerNamesService.h.

Referenced by getTriggerPSet(), and TriggerNamesService().

Strings edm::service::TriggerNamesService::trignames_
private

Definition at line 135 of file TriggerNamesService.h.

Referenced by getTrigPath(), getTrigPaths(), size(), and TriggerNamesService().

PosMap edm::service::TriggerNamesService::trigpos_
private
bool edm::service::TriggerNamesService::wantSummary_
private

Definition at line 144 of file TriggerNamesService.h.

Referenced by TriggerNamesService(), and wantSummary().