1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// -*- C++ -*-
//
// Package: Core
// Class : FWHLTValidator
//
// system include files
#include <algorithm>
#include <cstring>
#include <boost/regex.hpp>
// user include files
#include "Fireworks/Core/interface/FWHLTValidator.h"
#include "Fireworks/Core/interface/FWGUIManager.h"
#include "Fireworks/Core/interface/fwLog.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "FWCore/Common/interface/TriggerNames.h"
#include "FWCore/Common/interface/EventBase.h"
void FWHLTValidator::fillOptions(const char* iBegin,
const char* iEnd,
std::vector<std::pair<std::shared_ptr<std::string>, std::string> >& oOptions) const {
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(nullptr);
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(std::make_shared<std::string>(*trigger),
trigger->substr(part_size, trigger->size() - part_size)));
}
}
//
// static member functions
//
|