18 void test_remove_whitespace() {
30 typedef std::pair<std::string, std::string> parsed_path_spec_t;
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, trimmed_path_spec.size());
44 void test_parse_path_spec() {
45 std::vector<std::string>
paths;
46 paths.push_back(
"a:p1");
47 paths.push_back(
"b:p2");
48 paths.push_back(
" c");
49 paths.push_back(
"ddd\t:p3");
50 paths.push_back(
"eee: p4 ");
52 std::vector<parsed_path_spec_t> parsed(
paths.size());
53 for (
size_t i = 0;
i <
paths.size(); ++
i) {
54 parse_path_spec(
paths[
i], parsed[
i]);
73 test_remove_whitespace();
74 test_parse_path_spec();
82 std::vector<std::string>
const& iAllTriggerNames,
94 std::vector<std::string> path_specs = iPSet.
getParameter<std::vector<std::string> >(
"SelectEvents");
96 if (path_specs.empty()) {
103 std::vector<parsed_path_spec_t> parsed_paths(path_specs.size());
104 for (
size_t i = 0;
i < path_specs.size(); ++
i) {
105 parse_path_spec(path_specs[
i], parsed_paths[
i]);
107 oSelector.
setup(parsed_paths, iAllTriggerNames, iProcessName,
std::move(iC));
119 std::vector<std::string>
const& triggernames,
124 std::map<std::string, std::vector<std::string> > paths_for_process;
125 for (
auto const& path_spec : path_specs) {
127 if (path_spec.second.empty()) {
128 paths_for_process[process_name].push_back(path_spec.first);
130 paths_for_process[path_spec.second].push_back(path_spec.first);
135 for (
auto const&
path : paths_for_process) {
138 if (
path.first == process_name) {
167 bool anyProductProduced) {
170 selectEventsInfo.
addParameter<
bool>(
"InProcessHistory", anyProductProduced);
171 std::vector<std::string> endPaths;
172 std::vector<int> endPathPositions;
176 if (!iLabel.empty()) {
177 std::map<std::string, std::vector<std::pair<std::string, int> > >::const_iterator iter =
178 outputModulePathPositions.find(iLabel);
179 assert(iter != outputModulePathPositions.end());
180 for (
auto const&
item : iter->second) {
181 endPaths.push_back(
item.first);
182 endPathPositions.push_back(
item.second);
185 selectEventsInfo.
addParameter<std::vector<std::string> >(
"EndPaths", endPaths);
186 selectEventsInfo.
addParameter<std::vector<int> >(
"EndPathPositions", endPathPositions);
187 if (!selectEventsInfo.
exists(
"SelectEvents")) {
188 selectEventsInfo.
addParameter<std::vector<std::string> >(
"SelectEvents", std::vector<std::string>());
192 return selectEventsInfo.
id();
bool wantEvent(EventForOutput const &e)
T getParameter(std::string const &) const
static const edm::TypeID s_TrigResultsType(typeid(edm::TriggerResults))
TriggerResultsBasedEventSelector()
bool exists(std::string const ¶meterName) const
checks if a parameter exists
U second(std::pair< T, U > const &p)
void run_all_output_module_tests()
ParameterSetID id() const
ParameterSet const & registerIt()
void addParameter(std::string const &name, T const &value)
bool configureEventSelector(edm::ParameterSet const &iPSet, std::string const &iProcessName, std::vector< std::string > const &iAllTriggerNames, edm::detail::TriggerResultsBasedEventSelector &oSelector, ConsumesCollector &&iC)
void copyForModify(ParameterSet const &other)
def remove(d, key, TELL=False)
void setup(std::vector< parsed_path_spec_t > const &path_specs, std::vector< std::string > const &triggernames, std::string const &process_name, ConsumesCollector &&iC)
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)
std::string match(BranchDescription const &a, BranchDescription const &b, std::string const &fileName)