CMS 3D CMS Logo

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 (size_type const i, size_type const j) const
 
std::string const & getEndPathModule (std::string const &name, size_type const j) const
 
Strings const & getEndPathModules (size_type const i) const
 
Strings const & getEndPathModules (std::string const &name) 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 (size_type const i, size_type const j) const
 
std::string const & getTrigPathModule (std::string const &name, size_type const j) const
 
Strings const & getTrigPathModules (size_type const i) const
 
Strings const & getTrigPathModules (std::string const &name) 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

◆ PosMap

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

Definition at line 45 of file TriggerNamesService.h.

◆ size_type

Definition at line 46 of file TriggerNamesService.h.

◆ Strings

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

Definition at line 44 of file TriggerNamesService.h.

Constructor & Destructor Documentation

◆ TriggerNamesService()

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

Definition at line 18 of file TriggerNamesService.cc.

18  {
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  }

References end_modulenames_, end_names_, end_pos_, edm::ParameterSet::getParameter(), mps_fire::i, loadPosMap(), modulenames_, dqmiodumpmetadata::n, geometryDiff::opts, process_name_, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, trigger_pset_, trignames_, trigpos_, and wantSummary_.

Member Function Documentation

◆ find()

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

Definition at line 98 of file TriggerNamesService.h.

98  {
99  PosMap::const_iterator const pos(posmap.find(name));
100  if (pos == posmap.end()) {
101  return posmap.size();
102  } else {
103  return pos->second;
104  }
105  }

References Skims_PA_cff::name.

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

◆ findEndPath()

size_type edm::service::TriggerNamesService::findEndPath ( std::string const &  name) const
inline

Definition at line 76 of file TriggerNamesService.h.

76 { return find(end_pos_, name); }

References end_pos_, find(), and Skims_PA_cff::name.

◆ findTrigPath()

size_type edm::service::TriggerNamesService::findTrigPath ( std::string const &  name) const
inline

Definition at line 57 of file TriggerNamesService.h.

57 { return find(trigpos_, name); }

References find(), Skims_PA_cff::name, and trigpos_.

◆ getEndPath()

std::string const& edm::service::TriggerNamesService::getEndPath ( size_type const  i) const
inline

Definition at line 75 of file TriggerNamesService.h.

75 { return end_names_.at(i); }

References end_names_, and mps_fire::i.

Referenced by ProcessCallGraph::preBeginJob().

◆ getEndPathModule() [1/2]

std::string const& edm::service::TriggerNamesService::getEndPathModule ( size_type const  i,
size_type const  j 
) const
inline

Definition at line 94 of file TriggerNamesService.h.

94  {
95  return (end_modulenames_.at(i)).at(j);
96  }

References end_modulenames_, mps_fire::i, and dqmiolumiharvest::j.

◆ getEndPathModule() [2/2]

std::string const& edm::service::TriggerNamesService::getEndPathModule ( std::string const &  name,
size_type const  j 
) const
inline

Definition at line 91 of file TriggerNamesService.h.

91  {
92  return (end_modulenames_.at(find(end_pos_, name))).at(j);
93  }

References end_modulenames_, end_pos_, find(), dqmiolumiharvest::j, and Skims_PA_cff::name.

◆ getEndPathModules() [1/2]

Strings const& edm::service::TriggerNamesService::getEndPathModules ( size_type const  i) const
inline

Definition at line 90 of file TriggerNamesService.h.

90 { return end_modulenames_.at(i); }

References end_modulenames_, and mps_fire::i.

◆ getEndPathModules() [2/2]

Strings const& edm::service::TriggerNamesService::getEndPathModules ( std::string const &  name) const
inline

Definition at line 87 of file TriggerNamesService.h.

87  {
88  return end_modulenames_.at(find(end_pos_, name));
89  }

References end_modulenames_, end_pos_, find(), and Skims_PA_cff::name.

Referenced by edm::SystemTimeKeeper::SystemTimeKeeper().

◆ getEndPaths()

Strings const& edm::service::TriggerNamesService::getEndPaths ( ) const
inline

Definition at line 74 of file TriggerNamesService.h.

74 { return end_names_; }

References end_names_.

Referenced by edm::StreamSchedule::StreamSchedule(), and edm::SystemTimeKeeper::SystemTimeKeeper().

◆ getProcessName()

std::string const& edm::service::TriggerNamesService::getProcessName ( ) const
inline

◆ getTriggerPSet()

edm::ParameterSet const& edm::service::TriggerNamesService::getTriggerPSet ( ) const
inline

Definition at line 111 of file TriggerNamesService.h.

111 { return trigger_pset_; }

References trigger_pset_.

◆ getTrigPath()

std::string const& edm::service::TriggerNamesService::getTrigPath ( size_type const  i) const
inline

Definition at line 56 of file TriggerNamesService.h.

56 { return trignames_.at(i); }

References mps_fire::i, and trignames_.

Referenced by ProcessCallGraph::preBeginJob().

◆ getTrigPathModule() [1/2]

std::string const& edm::service::TriggerNamesService::getTrigPathModule ( size_type const  i,
size_type const  j 
) const
inline

Definition at line 83 of file TriggerNamesService.h.

83  {
84  return (modulenames_.at(i)).at(j);
85  }

References mps_fire::i, dqmiolumiharvest::j, and modulenames_.

◆ getTrigPathModule() [2/2]

std::string const& edm::service::TriggerNamesService::getTrigPathModule ( std::string const &  name,
size_type const  j 
) const
inline

Definition at line 80 of file TriggerNamesService.h.

80  {
81  return (modulenames_.at(find(trigpos_, name))).at(j);
82  }

References find(), dqmiolumiharvest::j, modulenames_, Skims_PA_cff::name, and trigpos_.

◆ getTrigPathModules() [1/2]

Strings const& edm::service::TriggerNamesService::getTrigPathModules ( size_type const  i) const
inline

Definition at line 79 of file TriggerNamesService.h.

79 { return modulenames_.at(i); }

References mps_fire::i, and modulenames_.

◆ getTrigPathModules() [2/2]

Strings const& edm::service::TriggerNamesService::getTrigPathModules ( std::string const &  name) const
inline

Definition at line 78 of file TriggerNamesService.h.

78 { return modulenames_.at(find(trigpos_, name)); }

References find(), modulenames_, Skims_PA_cff::name, and trigpos_.

Referenced by edm::SystemTimeKeeper::SystemTimeKeeper().

◆ getTrigPaths() [1/3]

Strings const& edm::service::TriggerNamesService::getTrigPaths ( ) const
inline

◆ getTrigPaths() [2/3]

bool edm::service::TriggerNamesService::getTrigPaths ( TriggerResults const &  triggerResults,
Strings trigPaths 
)

Definition at line 87 of file TriggerNamesService.cc.

87  {
88  bool dummy;
89  return getTrigPaths(triggerResults, trigPaths, dummy);
90  }

References getTrigPaths(), and edm::triggerResults().

◆ getTrigPaths() [3/3]

bool edm::service::TriggerNamesService::getTrigPaths ( TriggerResults const &  triggerResults,
Strings trigPaths,
bool &  fromPSetRegistry 
)

Definition at line 42 of file TriggerNamesService.cc.

44  {
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  }

References Exception, edm::pset::Registry::getMapped(), edm::pset::Registry::instance(), Skims_PA_cff::name, muonDTDigis_cfi::pset, edm::search_all(), AlCaHLTBitMon_QueryRunRegistry::string, edm::triggerResults(), and edm::errors::Unknown.

◆ loadPosMap()

void edm::service::TriggerNamesService::loadPosMap ( PosMap posmap,
Strings const &  names 
)
inlineprivate

Definition at line 114 of file TriggerNamesService.h.

114  {
115  size_type const n(names.size());
116  for (size_type i = 0; i != n; ++i) {
117  posmap[names[i]] = i;
118  }
119  }

References mps_fire::i, dqmiodumpmetadata::n, and names.

Referenced by TriggerNamesService().

◆ size()

size_type edm::service::TriggerNamesService::size ( void  ) const
inline

Definition at line 54 of file TriggerNamesService.h.

54 { return trignames_.size(); }

References trignames_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

◆ wantSummary()

bool edm::service::TriggerNamesService::wantSummary ( ) const
inline

Definition at line 108 of file TriggerNamesService.h.

108 { return wantSummary_; }

References wantSummary_.

Member Data Documentation

◆ end_modulenames_

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

Definition at line 129 of file TriggerNamesService.h.

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

◆ end_names_

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

Definition at line 125 of file TriggerNamesService.h.

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

◆ end_pos_

PosMap edm::service::TriggerNamesService::end_pos_
private

◆ modulenames_

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

◆ process_name_

std::string edm::service::TriggerNamesService::process_name_
private

Definition at line 131 of file TriggerNamesService.h.

Referenced by getProcessName(), and TriggerNamesService().

◆ trigger_pset_

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

Definition at line 121 of file TriggerNamesService.h.

Referenced by getTriggerPSet(), and TriggerNamesService().

◆ trignames_

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

Definition at line 123 of file TriggerNamesService.h.

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

◆ trigpos_

PosMap edm::service::TriggerNamesService::trigpos_
private

◆ wantSummary_

bool edm::service::TriggerNamesService::wantSummary_
private

Definition at line 132 of file TriggerNamesService.h.

Referenced by TriggerNamesService(), and wantSummary().

edm::pset::Registry::instance
static Registry * instance()
Definition: Registry.cc:12
mps_fire.i
i
Definition: mps_fire.py:355
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
pos
Definition: PixelAliasList.h: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::size_type
PosMap::size_type size_type
Definition: TriggerNamesService.h:46
edm::service::TriggerNamesService::trigpos_
PosMap trigpos_
Definition: TriggerNamesService.h:124
Strings
std::vector< std::string > Strings
Definition: MsgTools.h:18
edm::service::TriggerNamesService::wantSummary_
bool wantSummary_
Definition: TriggerNamesService.h:132
edm::service::TriggerNamesService::loadPosMap
void loadPosMap(PosMap &posmap, Strings const &names)
Definition: TriggerNamesService.h:114
names
const std::string names[nVars_]
Definition: PhotonIDValueMapProducer.cc:122
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::service::TriggerNamesService::trignames_
Strings trignames_
Definition: TriggerNamesService.h:123
ParameterSet
Definition: Functions.h:16
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edm::service::TriggerNamesService::find
size_type find(PosMap const &posmap, std::string const &name) const
Definition: TriggerNamesService.h:98
edm::service::TriggerNamesService::getTrigPaths
Strings const & getTrigPaths() const
Definition: TriggerNamesService.h:55
Exception
Definition: hltDiff.cc:246
edm::triggerResults
static const std::string triggerResults("TriggerResults")
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
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
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::service::TriggerNamesService::modulenames_
std::vector< Strings > modulenames_
Definition: TriggerNamesService.h:128
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
geometryDiff.opts
opts
Definition: geometryDiff.py:11