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]);
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);
125 std::vector<std::string>
paths;
133 std::vector<std::string>
const& triggernames,
137 std::map<std::string, std::vector<std::string> > paths_for_process;
138 for (
auto const& path_spec : path_specs) {
140 if (path_spec.second ==
"") {
141 paths_for_process[
process_name].push_back(path_spec.first);
144 paths_for_process[path_spec.second].push_back(path_spec.first);
149 for (
auto const&
path : paths_for_process) {
152 if (
path.first == process_name) {
173 bool match = selector.match(*product);
184 std::map<
std::string, std::vector<std::pair<std::string, int> > >
const& outputModulePathPositions,
185 bool anyProductProduced) {
188 selectEventsInfo.
addParameter<
bool>(
"InProcessHistory", anyProductProduced);
189 std::vector<std::string> endPaths;
190 std::vector<int> endPathPositions;
194 if (!iLabel.empty()) {
195 std::map<std::string, std::vector<std::pair<std::string, int> > >::const_iterator iter = outputModulePathPositions.find(iLabel);
196 assert(iter != outputModulePathPositions.end());
197 for(
auto const& item : iter->second) {
198 endPaths.push_back(item.first);
199 endPathPositions.push_back(item.second);
202 selectEventsInfo.
addParameter<std::vector<std::string> >(
"EndPaths", endPaths);
203 selectEventsInfo.
addParameter<std::vector<int> >(
"EndPathPositions", endPathPositions);
204 if (!selectEventsInfo.
exists(
"SelectEvents")) {
205 selectEventsInfo.
addParameter<std::vector<std::string> >(
"SelectEvents", std::vector<std::string>());
209 return selectEventsInfo.
id();
T getParameter(std::string const &) const
ParameterSetID id() const
static const edm::TypeID s_TrigResultsType(typeid(edm::TriggerResults))
TriggerResultsBasedEventSelector()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void setupDefault(std::vector< std::string > const &triggernames)
U second(std::pair< T, U > const &p)
void run_all_output_module_tests()
BasicHandle getByLabel(KindOfType kindOfType, TypeID const &typeID, InputTag const &inputTag, EDConsumerBase const *consumes, SharedResourcesAcquirer *sra, ModuleCallingContext const *mcc) const
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)
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)
bool wantEvent(EventPrincipal const &e, ModuleCallingContext const *)
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()
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)