Project

General

Profile

Feature #7524

Pass/Fail aliases for EDFilter return values

Added by Kyle Knoepfel almost 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Event Loop
Target version:
Start date:
12/17/2014
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:
Scope:
Internal
Experiment:
-
SSI Package:
art
Duration:

Description

For art::EDFilter modules, the pure virtual function 'bool filter(art::Event&)' is overridden by a user who must decide whether the return value should be true or false for the event in question. It is not immediately clear, based on the function signature, what the intended return values should be. For example:

  • Does a return value of 'true' mean the event has been filtered out? (not illogical)
  • Does a return value of 'true' mean the event has passed the filter?

I wonder if the following aliases could be defined in the art::EDFilter class so a user does not have to remember the semantics:

static const bool EDFilter::Pass = true;
static const bool EDFilter::Fail = false;

The user then simply specifies:

bool filter( Event& e ) override {

  // code to determine pass or fail
  return passes_cuts ? EDFilter::Pass : EDFilter::Fail;

}

or something equivalent, removing any ambiguity for the user.

History

#1 Updated by Christopher Green over 5 years ago

  • Tracker changed from Support to Feature
  • Status changed from New to Assigned
  • Assignee set to Kyle Knoepfel
  • SSI Package art added
  • SSI Package deleted ()

Just to put down the correct answer for the record: a return value of true means that the event has passed the filter.

This is a reasonable thing to do (although it is uncertain how widely it will be used), although we would prefer constexpr if possible.

Please also verify with Rob K. whether the meaning of the return value is covered in the workbook.

#2 Updated by Rob Kutschke over 5 years ago

The chapter in the art workbook on filters is scheduled for Exercise 17. We are currently up to Exercise 8. We do not have any effort assigned to completing the workbook and it is moving ahead on an "as effort is available" basis.

#3 Updated by Kyle Knoepfel over 5 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100
  • Estimated time set to 1.00 h

Implemented with 5cef753f.

#4 Updated by Kyle Knoepfel over 5 years ago

  • Target version set to 1.13.00

#5 Updated by Christopher Green over 5 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF