3 #include "boost/bind.hpp"
15 s.erase(
std::remove(s.begin(), s.end(),
' '), s.end());
16 s.erase(
std::remove(s.begin(), s.end(),
'\t'), s.end());
19 void test_remove_whitespace() {
31 typedef std::pair<std::string, std::string> parsed_path_spec_t;
33 parsed_path_spec_t&
output) {
35 remove_whitespace(trimmed_path_spec);
38 if(colon == std::string::npos) {
39 output.first = trimmed_path_spec;
41 output.first = trimmed_path_spec.substr(0, colon);
42 output.second = trimmed_path_spec.substr(colon + 1,
43 trimmed_path_spec.size());
47 void test_parse_path_spec() {
48 std::vector<std::string>
paths;
49 paths.push_back(
"a:p1");
50 paths.push_back(
"b:p2");
51 paths.push_back(
" c");
52 paths.push_back(
"ddd\t:p3");
53 paths.push_back(
"eee: p4 ");
55 std::vector<parsed_path_spec_t> parsed(paths.size());
56 for(
size_t i = 0;
i < paths.size(); ++
i) {
57 parse_path_spec(paths[
i], parsed[i]);
60 assert(parsed[0].
first ==
"a");
61 assert(parsed[0].
second ==
"p1");
62 assert(parsed[1].
first ==
"b");
63 assert(parsed[1].
second ==
"p2");
64 assert(parsed[2].
first ==
"c");
65 assert(parsed[2].
second ==
"");
66 assert(parsed[3].
first ==
"ddd");
67 assert(parsed[3].
second ==
"p3");
68 assert(parsed[4].
first ==
"eee");
69 assert(parsed[4].
second ==
"p4");
77 test_remove_whitespace();
78 test_parse_path_spec();
87 std::vector<std::string>
const& iAllTriggerNames,
98 std::vector<std::string> path_specs =
99 iPSet.
getParameter<std::vector<std::string> >(
"SelectEvents");
101 if(path_specs.empty()) {
108 std::vector<parsed_path_spec_t> parsed_paths(path_specs.size());
109 for(
size_t i = 0;
i < path_specs.size(); ++
i) {
110 parse_path_spec(path_specs[
i], parsed_paths[i]);
112 oSelector.
setup(parsed_paths, iAllTriggerNames, iProcessName);
141 std::vector<std::string>
paths;
149 std::vector<std::string>
const& triggernames,
154 std::map<std::string, std::vector<std::string> > paths_for_process;
155 for (std::vector<parsed_path_spec_t>::const_iterator
156 i = path_specs.begin(),
157 e = path_specs.end();
162 if (
i->second ==
"") {
166 paths_for_process[
i->second].push_back(
i->first);
172 i = paths_for_process.begin(),
173 e = paths_for_process.end();
179 if (
i->first == process_name) {
215 bool match_found =
false;
216 while (!match_found && (i!=e))
218 match_found = i->match();
232 <<
"TriggerResultsBasedEventSelector::returnOneHandleOrThrow: "
233 <<
" too few products found, "
234 <<
"exepcted one, got zero\n";
241 <<
"TriggerResultsBasedEventSelector::returnOneHandleOrThrow: "
242 <<
"too many products found, "
277 std::map<
std::string, std::vector<std::pair<std::string, int> > >
const& outputModulePathPositions,
278 bool anyProductProduced) {
281 selectEventsInfo.
addParameter<
bool>(
"InProcessHistory", anyProductProduced);
282 std::vector<std::string> endPaths;
283 std::vector<int> endPathPositions;
287 if (!iLabel.empty()) {
288 std::map<std::string, std::vector<std::pair<std::string, int> > >::const_iterator iter = outputModulePathPositions.find(iLabel);
289 assert(iter != outputModulePathPositions.end());
290 for (std::vector<std::pair<std::string, int> >::const_iterator
i = iter->second.begin(),
e = iter->second.end();
292 endPaths.push_back(
i->first);
293 endPathPositions.push_back(
i->second);
296 selectEventsInfo.
addParameter<std::vector<std::string> >(
"EndPaths", endPaths);
297 selectEventsInfo.
addParameter<std::vector<int> >(
"EndPathPositions", endPathPositions);
298 if (!selectEventsInfo.
exists(
"SelectEvents")) {
299 selectEventsInfo.
addParameter<std::vector<std::string> >(
"SelectEvents", std::vector<std::string>());
303 return selectEventsInfo.
id();
T getParameter(std::string const &) const
ParameterSetID id() const
static const edm::TypeID s_TrigResultsType(typeid(edm::TriggerResults))
void fill(EventPrincipal const &e, ModuleCallingContext const *mcc)
TriggerResultsBasedEventSelector()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
detail::NamedEventSelector NES
size_type fill(EventPrincipal const &ev, ModuleCallingContext const *)
void setupDefault(std::vector< std::string > const &triggernames)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
U second(std::pair< T, U > const &p)
void run_all_output_module_tests()
void setup(std::vector< parsed_path_spec_t > const &path_specs, std::vector< std::string > const &triggernames, const std::string &process_name)
void addParameter(std::string const &name, T const &value)
handle_t returnOneHandleOrThrow()
void copyForModify(ParameterSet const &other)
void convert_handle(BasicHandle &&bh, Handle< T > &result)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
handle_t getOneTriggerResults(EventPrincipal const &e, ModuleCallingContext const *)
bool wantEvent(EventPrincipal const &e, ModuleCallingContext const *)
selectors_t::size_type size_type
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, ModuleCallingContext const *mcc) const
volatile std::atomic< bool > shutdown_flag false
ParameterSetID registerProperSelectionInfo(edm::ParameterSet const &iInitial, std::string const &iLabel, std::map< std::string, std::vector< std::pair< std::string, int > > > const &outputModulePathPositions, bool anyProductProduced)
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector)
ParameterSet const & registerIt()
selectors_t::iterator iter