CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWHLTValidator Class Reference

#include <FWHLTValidator.h>

Inheritance diagram for FWHLTValidator:
FWValidatorBase

List of all members.

Public Member Functions

virtual void fillOptions (const char *iBegin, const char *iEnd, std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &oOptions) const
 FWHLTValidator (std::string &x)
void setProcess (const char *x)
virtual ~FWHLTValidator ()

Private Member Functions

 FWHLTValidator (const FWHLTValidator &)
const FWHLTValidatoroperator= (const FWHLTValidator &)

Private Attributes

std::string m_process
std::vector< std::string > m_triggerNames

Detailed Description

Definition at line 16 of file FWHLTValidator.h.


Constructor & Destructor Documentation

FWHLTValidator::FWHLTValidator ( std::string &  x) [inline]

Definition at line 19 of file FWHLTValidator.h.

virtual FWHLTValidator::~FWHLTValidator ( ) [inline, virtual]

Definition at line 20 of file FWHLTValidator.h.

{}
FWHLTValidator::FWHLTValidator ( const FWHLTValidator ) [private]

Member Function Documentation

void FWHLTValidator::fillOptions ( const char *  iBegin,
const char *  iEnd,
std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &  oOptions 
) const [virtual]

Implements FWValidatorBase.

Definition at line 25 of file FWHLTValidator.cc.

References fwLog, edm::EventBase::getByLabel(), FWGUIManager::getCurrentEvent(), FWGUIManager::getGUIManager(), i, fwlog::kWarning, m_process, m_triggerNames, edm::TriggerNames::size(), python::multivaluedict::sort(), GlobalPosition_Frontier_DevDB_cff::tag, edm::TriggerNames::triggerName(), and edm::TriggerNames::triggerNames().

{
   oOptions.clear();
   std::string part(iBegin,iEnd);
   part = boost::regex_replace(part,boost::regex(".*?(\\&\\&|\\|\\||\\s)+"),"");

   if (m_triggerNames.empty()){
     edm::Handle<edm::TriggerResults> hTriggerResults;
     edm::TriggerNames const* triggerNames(0);
     try
     {
       edm::InputTag tag("TriggerResults", "", m_process.c_str());
       const edm::EventBase* event = FWGUIManager::getGUIManager()->getCurrentEvent();
       event->getByLabel(tag, hTriggerResults);
       triggerNames = & event->triggerNames(*hTriggerResults);
     } catch (...){
        fwLog(fwlog::kWarning) << " no trigger results with process name "<< m_process <<"  is available" << std::endl;
       return;
     }
     for(unsigned int i=0; i<triggerNames->size(); ++i)
       m_triggerNames.push_back(triggerNames->triggerName(i));
     std::sort(m_triggerNames.begin(),m_triggerNames.end());
   }

   //only use add items which begin with the part of the member we are trying to match
   unsigned int part_size = part.size();
   for(std::vector<std::string>::const_iterator trigger = m_triggerNames.begin();
       trigger != m_triggerNames.end(); ++trigger)
     if(part == trigger->substr(0,part_size) ) {
       oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(new std::string(*trigger)),
                                         trigger->substr(part_size,trigger->size()-part_size)));
     }
}
const FWHLTValidator& FWHLTValidator::operator= ( const FWHLTValidator ) [private]
void FWHLTValidator::setProcess ( const char *  x) [inline]

Member Data Documentation

std::string FWHLTValidator::m_process [private]

Definition at line 30 of file FWHLTValidator.h.

Referenced by fillOptions(), and setProcess().

std::vector<std::string> FWHLTValidator::m_triggerNames [mutable, private]

Definition at line 31 of file FWHLTValidator.h.

Referenced by fillOptions(), and setProcess().