CMS 3D CMS Logo

FWHLTValidator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWHLTValidator
5 //
6 
7 // system include files
8 #include <algorithm>
9 #include <cstring>
10 #include <boost/regex.hpp>
11 
12 // user include files
16 
19 
22 
23 void FWHLTValidator::fillOptions(const char* iBegin,
24  const char* iEnd,
25  std::vector<std::pair<std::shared_ptr<std::string>, std::string> >& oOptions) const {
26  oOptions.clear();
27  std::string part(iBegin, iEnd);
28  part = boost::regex_replace(part, boost::regex(".*?(\\&\\&|\\|\\||\\s)+"), "");
29 
30  if (m_triggerNames.empty()) {
31  edm::Handle<edm::TriggerResults> hTriggerResults;
32  edm::TriggerNames const* triggerNames(nullptr);
33  try {
34  edm::InputTag tag("TriggerResults", "", m_process.c_str());
36  event->getByLabel(tag, hTriggerResults);
37  triggerNames = &event->triggerNames(*hTriggerResults);
38  } catch (...) {
39  fwLog(fwlog::kWarning) << " no trigger results with process name " << m_process << " is available" << std::endl;
40  return;
41  }
42  for (unsigned int i = 0; i < triggerNames->size(); ++i)
43  m_triggerNames.push_back(triggerNames->triggerName(i));
44  std::sort(m_triggerNames.begin(), m_triggerNames.end());
45  }
46 
47  //only use add items which begin with the part of the member we are trying to match
48  unsigned int part_size = part.size();
49  for (std::vector<std::string>::const_iterator trigger = m_triggerNames.begin(); trigger != m_triggerNames.end();
50  ++trigger)
51  if (part == trigger->substr(0, part_size)) {
52  oOptions.push_back(std::make_pair(std::make_shared<std::string>(*trigger),
53  trigger->substr(part_size, trigger->size() - part_size)));
54  }
55 }
56 
57 //
58 // static member functions
59 //
Handle.h
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:355
TriggerResults.h
edm::EventBase::getByLabel
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
EventBase.h
edm::Handle< edm::TriggerResults >
FWHLTValidator::m_triggerNames
std::vector< std::string > m_triggerNames
Definition: FWHLTValidator.h:34
part
part
Definition: HCALResponse.h:20
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
L1TEGammaOffline_cfi.triggerNames
triggerNames
Definition: L1TEGammaOffline_cfi.py:40
FWGUIManager::getCurrentEvent
const edm::EventBase * getCurrentEvent() const
Definition: FWGUIManager.cc:687
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWHLTValidator::m_process
std::string m_process
Definition: FWHLTValidator.h:33
TriggerNames.h
fwlog::kWarning
Definition: fwLog.h:35
fwLog.h
FWHLTValidator::fillOptions
void fillOptions(const char *iBegin, const char *iEnd, std::vector< std::pair< std::shared_ptr< std::string >, std::string > > &oOptions) const override
Definition: FWHLTValidator.cc:23
FWGUIManager::getGUIManager
static FWGUIManager * getGUIManager()
Definition: FWGUIManager.cc:685
FWHLTValidator.h
edm::EventBase
Definition: EventBase.h:46
edm::TriggerNames
Definition: TriggerNames.h:55
trigger
Definition: HLTPrescaleTableCond.h:8
edm::InputTag
Definition: InputTag.h:15
FWGUIManager.h