13 s.erase(
std::remove(s.begin(), s.end(),
' '), s.end());
14 s.erase(
std::remove(s.begin(), s.end(),
'\t'), s.end());
17 void test_remove_whitespace() {
29 typedef std::pair<std::string, std::string> parsed_path_spec_t;
31 parsed_path_spec_t&
output) {
33 remove_whitespace(trimmed_path_spec);
36 if(colon == std::string::npos) {
37 output.first = trimmed_path_spec;
39 output.first = trimmed_path_spec.substr(0, colon);
40 output.second = trimmed_path_spec.substr(colon + 1,
41 trimmed_path_spec.size());
45 void test_parse_path_spec() {
46 std::vector<std::string>
paths;
47 paths.push_back(
"a:p1");
48 paths.push_back(
"b:p2");
49 paths.push_back(
" c");
50 paths.push_back(
"ddd\t:p3");
51 paths.push_back(
"eee: p4 ");
53 std::vector<parsed_path_spec_t> parsed(paths.size());
54 for(
size_t i = 0;
i < paths.size(); ++
i) {
55 parse_path_spec(paths[
i], parsed[i]);
58 assert(parsed[0].
first ==
"a");
59 assert(parsed[0].
second ==
"p1");
60 assert(parsed[1].
first ==
"b");
61 assert(parsed[1].
second ==
"p2");
62 assert(parsed[2].
first ==
"c");
63 assert(parsed[2].
second ==
"");
64 assert(parsed[3].
first ==
"ddd");
65 assert(parsed[3].
second ==
"p3");
66 assert(parsed[4].
first ==
"eee");
67 assert(parsed[4].
second ==
"p4");
75 test_remove_whitespace();
76 test_parse_path_spec();
85 std::vector<std::string>
const& iAllTriggerNames,
96 std::vector<std::string> path_specs =
97 iPSet.
getParameter<std::vector<std::string> >(
"SelectEvents");
99 if(path_specs.empty()) {
106 std::vector<parsed_path_spec_t> parsed_paths(path_specs.size());
107 for(
size_t i = 0;
i < path_specs.size(); ++
i) {
108 parse_path_spec(path_specs[
i], parsed_paths[i]);
110 oSelector.
setup(parsed_paths, iAllTriggerNames, iProcessName);
139 std::vector<std::string>
paths;
147 std::vector<std::string>
const& triggernames,
152 std::map<std::string, std::vector<std::string> > paths_for_process;
153 for (std::vector<parsed_path_spec_t>::const_iterator
154 i = path_specs.begin(),
155 e = path_specs.end();
160 if (
i->second ==
"") {
164 paths_for_process[
i->second].push_back(
i->first);
170 i = paths_for_process.begin(),
171 e = paths_for_process.end();
177 if (
i->first == process_name) {
213 bool match_found =
false;
214 while (!match_found && (i!=e))
216 match_found = i->match();
230 <<
"TriggerResultsBasedEventSelector::returnOneHandleOrThrow: "
231 <<
" too few products found, "
232 <<
"exepcted one, got zero\n";
239 <<
"TriggerResultsBasedEventSelector::returnOneHandleOrThrow: "
240 <<
"too many products found, "
275 std::map<
std::string, std::vector<std::pair<std::string, int> > >
const& outputModulePathPositions,
276 bool anyProductProduced) {
279 selectEventsInfo.
addParameter<
bool>(
"InProcessHistory", anyProductProduced);
280 std::vector<std::string> endPaths;
281 std::vector<int> endPathPositions;
285 if (!iLabel.empty()) {
286 std::map<std::string, std::vector<std::pair<std::string, int> > >::const_iterator
iter = outputModulePathPositions.find(iLabel);
287 assert(iter != outputModulePathPositions.end());
288 for (std::vector<std::pair<std::string, int> >::const_iterator
i = iter->second.begin(),
e = iter->second.end();
290 endPaths.push_back(
i->first);
291 endPathPositions.push_back(
i->second);
294 selectEventsInfo.
addParameter<std::vector<std::string> >(
"EndPaths", endPaths);
295 selectEventsInfo.
addParameter<std::vector<int> >(
"EndPathPositions", endPathPositions);
296 if (!selectEventsInfo.
exists(
"SelectEvents")) {
297 selectEventsInfo.
addParameter<std::vector<std::string> >(
"SelectEvents", std::vector<std::string>());
301 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()
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void copyForModify(ParameterSet const &other)
void convert_handle(BasicHandle &&bh, Handle< T > &result)
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