CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWHLTValidator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWHLTValidator
5 // $Id: FWHLTValidator.cc,v 1.8 2011/02/18 17:38:42 amraktad Exp $
6 //
7 
8 // system include files
9 #include <algorithm>
10 #include <cstring>
11 #include <boost/regex.hpp>
12 
13 // user include files
17 
20 
23 
24 void
25 FWHLTValidator::fillOptions(const char* iBegin, const char* iEnd,
26  std::vector<std::pair<boost::shared_ptr<std::string>, std::string> >& oOptions) const
27 {
28  oOptions.clear();
29  std::string part(iBegin,iEnd);
30  part = boost::regex_replace(part,boost::regex(".*?(\\&\\&|\\|\\||\\s)+"),"");
31 
32  if (m_triggerNames.empty()){
33  edm::Handle<edm::TriggerResults> hTriggerResults;
34  edm::TriggerNames const* triggerNames(0);
35  try
36  {
37  edm::InputTag tag("TriggerResults", "", m_process.c_str());
39  event->getByLabel(tag, hTriggerResults);
40  triggerNames = & event->triggerNames(*hTriggerResults);
41  } catch (...){
42  fwLog(fwlog::kWarning) << " no trigger results with process name "<< m_process <<" is available" << std::endl;
43  return;
44  }
45  for(unsigned int i=0; i<triggerNames->size(); ++i)
46  m_triggerNames.push_back(triggerNames->triggerName(i));
48  }
49 
50  //only use add items which begin with the part of the member we are trying to match
51  unsigned int part_size = part.size();
52  for(std::vector<std::string>::const_iterator trigger = m_triggerNames.begin();
53  trigger != m_triggerNames.end(); ++trigger)
54  if(part == trigger->substr(0,part_size) ) {
55  oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(new std::string(*trigger)),
56  trigger->substr(part_size,trigger->size()-part_size)));
57  }
58 }
59 
60 //
61 // static member functions
62 //
int i
Definition: DBlmapReader.cc:9
virtual void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &oOptions) const
Strings::size_type size() const
Definition: TriggerNames.cc:39
Strings const & triggerNames() const
Definition: TriggerNames.cc:24
std::string m_process
std::vector< std::string > m_triggerNames
const edm::EventBase * getCurrentEvent() const
static FWGUIManager * getGUIManager()
#define fwLog(_level_)
Definition: fwLog.h:51
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
part
Definition: HCALResponse.h:21
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:86