CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

edm::service::TriggerNamesService Class Reference

#include <TriggerNamesService.h>

List of all members.

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
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 (std::string const &name) const
Strings const & getTrigPathModules (size_type const i) const
bool getTrigPaths (TriggerResults const &triggerResults, Strings &trigPaths, bool &fromPSetRegistry)
Strings const & getTrigPaths () const
bool getTrigPaths (TriggerResults const &triggerResults, Strings &trigPaths)
void loadPosMap (PosMap &posmap, Strings const &names)
size_type size () const
 TriggerNamesService (ParameterSet const &proc_pset)
bool wantSummary () const

Private Attributes

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 43 of file TriggerNamesService.h.


Member Typedef Documentation

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

Definition at line 48 of file TriggerNamesService.h.

Definition at line 49 of file TriggerNamesService.h.

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

Definition at line 47 of file TriggerNamesService.h.


Constructor & Destructor Documentation

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

Definition at line 20 of file TriggerNamesService.cc.

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

                                                                     {

      trigger_pset_ = 
        pset.getParameterSet("@trigger_paths");

      trignames_ = trigger_pset_.getParameter<Strings>("@trigger_paths");
      end_names_ = pset.getParameter<Strings>("@end_paths");

      ParameterSet defopts;
      ParameterSet const& opts = 
        pset.getUntrackedParameterSet("options", defopts);
      wantSummary_ =
        opts.getUntrackedParameter("wantSummary", false);

      process_name_ = pset.getParameter<std::string>("@process_name");

      loadPosMap(trigpos_,trignames_);
      loadPosMap(end_pos_,end_names_);

      const unsigned int n(trignames_.size());
      for(unsigned int i=0;i!=n;++i) {
        modulenames_.push_back(pset.getParameter<Strings>(trignames_[i]));
      }
    }

Member Function Documentation

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

Definition at line 97 of file TriggerNamesService.h.

References pos.

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

                                                                         {
        PosMap::const_iterator const pos(posmap.find(name));
        if (pos == posmap.end()) {
          return posmap.size();
        } else {
          return pos->second;
        }
      }
size_type edm::service::TriggerNamesService::findEndPath ( std::string const &  name) const [inline]

Definition at line 82 of file TriggerNamesService.h.

References end_pos_, and find().

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

Definition at line 60 of file TriggerNamesService.h.

References find(), and trigpos_.

{ return find(trigpos_,name);}
std::string const& edm::service::TriggerNamesService::getEndPath ( size_type const  i) const [inline]

Definition at line 81 of file TriggerNamesService.h.

References end_names_.

{ return end_names_.at(i);}
Strings const& edm::service::TriggerNamesService::getEndPaths ( ) const [inline]

Definition at line 80 of file TriggerNamesService.h.

References end_names_.

{ return end_names_; }
std::string const& edm::service::TriggerNamesService::getProcessName ( ) const [inline]
edm::ParameterSet const& edm::service::TriggerNamesService::getTriggerPSet ( ) const [inline]

Definition at line 117 of file TriggerNamesService.h.

References trigger_pset_.

{ return trigger_pset_; }
std::string const& edm::service::TriggerNamesService::getTrigPath ( size_type const  i) const [inline]

Definition at line 59 of file TriggerNamesService.h.

References trignames_.

{ return trignames_.at(i);}
std::string const& edm::service::TriggerNamesService::getTrigPathModule ( size_type const  i,
size_type const  j 
) const [inline]

Definition at line 93 of file TriggerNamesService.h.

References asciidump::at, and modulenames_.

                                                                                       {
        return (modulenames_.at(i)).at(j);
      }
std::string const& edm::service::TriggerNamesService::getTrigPathModule ( std::string const &  name,
size_type const  j 
) const [inline]

Definition at line 90 of file TriggerNamesService.h.

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

                                                                                           {
        return (modulenames_.at(find(trigpos_,name))).at(j);
      }
Strings const& edm::service::TriggerNamesService::getTrigPathModules ( size_type const  i) const [inline]

Definition at line 87 of file TriggerNamesService.h.

References modulenames_.

                                                                 {
        return modulenames_.at(i);
      }
Strings const& edm::service::TriggerNamesService::getTrigPathModules ( std::string const &  name) const [inline]

Definition at line 84 of file TriggerNamesService.h.

References find(), modulenames_, and trigpos_.

                                                                     {
        return modulenames_.at(find(trigpos_,name));
      }
Strings const& edm::service::TriggerNamesService::getTrigPaths ( ) const [inline]

Definition at line 58 of file TriggerNamesService.h.

References trignames_.

Referenced by GenFilterEfficiencyProducer::GenFilterEfficiencyProducer(), and getTrigPaths().

{ return trignames_; }
bool edm::service::TriggerNamesService::getTrigPaths ( TriggerResults const &  triggerResults,
Strings trigPaths,
bool &  fromPSetRegistry 
)

Definition at line 46 of file TriggerNamesService.cc.

References Exception, edm::detail::ThreadSafeRegistry< KEY, T, E >::getMapped(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), edm::TriggerResults::getTriggerNames(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), mergeVDriftHistosByStation::name, edm::TriggerResults::parameterSetID(), MultipleCompare::pset, edm::search_all(), edm::HLTGlobalStatus::size(), and edm::errors::Unknown.

                                                              {

      // Get the parameter set containing the trigger names from the parameter set registry
      // using the ID from TriggerResults as the key used to find it.
      ParameterSet const* pset=0;
      pset::Registry* psetRegistry = pset::Registry::instance();
      if (0 != (pset=psetRegistry->getMapped(triggerResults.parameterSetID()))) {

        // Check to make sure the parameter set contains
        // a Strings parameter named "trigger_paths".
        // We do not want to throw an exception if it is not there
        // for reasons of backward compatibility
        Strings psetNames = pset->getParameterNamesForType<Strings>();
        std::string name("@trigger_paths");
        if (search_all(psetNames, name)) {
          // It is there, get it
          trigPaths = pset->getParameter<Strings>("@trigger_paths");

          // This should never happen
          if (trigPaths.size() != triggerResults.size()) {
            throw edm::Exception(edm::errors::Unknown)
              << "TriggerNamesService::getTrigPaths, Trigger names vector and\n"
                 "TriggerResults are different sizes.  This should be impossible,\n"
                 "please send information to reproduce this problem to\n"
                 "the edm developers.\n";
          }

          fromPSetRegistry = true;
          return true;
        }
      }

      fromPSetRegistry = false;

      // In older versions of the code the the trigger names were stored
      // inside of the TriggerResults object.  This will provide backward
      // compatibility.
      if (triggerResults.size() == triggerResults.getTriggerNames().size()) {
        trigPaths = triggerResults.getTriggerNames();
        return true;
      }

      return false;
    }
bool edm::service::TriggerNamesService::getTrigPaths ( TriggerResults const &  triggerResults,
Strings trigPaths 
)

Definition at line 94 of file TriggerNamesService.cc.

References getTrigPaths().

                                                          {
      bool dummy;
      return getTrigPaths(triggerResults, trigPaths, dummy);
    }
void edm::service::TriggerNamesService::loadPosMap ( PosMap posmap,
Strings const &  names 
) [inline]

Definition at line 106 of file TriggerNamesService.h.

References i, and n.

Referenced by TriggerNamesService().

                                                            {
        size_type const n(names.size());
        for (size_type i = 0; i != n; ++i) {
          posmap[names[i]] = i;
        }
      }
size_type edm::service::TriggerNamesService::size ( void  ) const [inline]

Definition at line 57 of file TriggerNamesService.h.

References trignames_.

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

Definition at line 114 of file TriggerNamesService.h.

References wantSummary_.

{ return wantSummary_; }

Member Data Documentation

Definition at line 125 of file TriggerNamesService.h.

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

Definition at line 126 of file TriggerNamesService.h.

Referenced by findEndPath(), and TriggerNamesService().

Definition at line 130 of file TriggerNamesService.h.

Referenced by getProcessName(), and TriggerNamesService().

Definition at line 121 of file TriggerNamesService.h.

Referenced by getTriggerPSet(), and TriggerNamesService().

Definition at line 123 of file TriggerNamesService.h.

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

Definition at line 131 of file TriggerNamesService.h.

Referenced by TriggerNamesService(), and wantSummary().