9#include <framework/modules/core/PartialSelectModule.h>
10#include <framework/core/Environment.h>
27 This module helps you set the interval of events to process. It
28 returns True inside the set window and False outside.
30 The input parameters are fractions which can be interpretted as the
31 fraction of leading and (1-)fraction of trailing events that will be
32 skipped. Internally, the total number of events of the input file is
33 used to determine the event selection window boundaries.
35 basf2 conditional paths can then be used to select events that pass
36 this module for further processing.
38 This module can be used with GRID jobs when dataset collections are
39 passed as input. It helps you control the range of events per file so
40 that you can avoid processing all of the events but still cover all
41 the files in the collection.
43 NOTE: This module has to be added directly after the input module so
44 as to filter out events before any other processing. It also only
45 works with one input file for now.
52 "The product of entryStart fraction and total number of events in each "
53 "file will determine the first event to begin processing with. Module will"
54 " return False for all leading events before this. By default(0.0) module "
55 "will start with the first event.",
60 "The product of entryStop fraction and total number of events in each file"
61 " will determine the last event to end processing with. Module will return"
62 " False for all trailing events after this. By default(1.0) module will "
63 "end wtih the last event.",
70 const bool isOutOfBounds =
76 B2FATAL(
"Either the entryStart and entryStop passed are beyond the accepted"
77 " range or they have been swapped: please refer to the 'entryStart'"
78 " and 'entryStop' descriptions of the PartialSelect module.");
80 B2INFO(
"Total number of events :"
97 B2INFO(
"First event passing the PartialSelect range: "
101 B2INFO(
"Last event passing the PartialSelect range: "
unsigned int getNumberOfEvents() const
Return the number of events, from either input or EventInfoSetter, or -n command line override (if le...
static Environment & Instance()
Static method to get a reference to the Environment instance.
void setDescription(const std::string &description)
Sets the description of the module.
void setReturnValue(int value)
Sets the return value for this module as integer.
int m_nTotal
Total number of events in the input file.
double m_entryStart
Input parameter [0.0 -> 1.0) used to determine event start id: (m_entryStart*m_nTotal).
void initialize() override
Initialization fetches the event count in the input file (m_nEvents).
bool m_returnValue
Flag that will be returned by the module.
void event() override
Checks if we are within the passed window to set return value to True, and False if not.
PartialSelectModule()
Constructor: Sets the description, the properties and the parameters of the module.
int m_events
Keeps track of how many events have been processed for so far.
double m_entryStop
Input parameter (0.0 -> 1.0] used to determine event stop id: (m_entryStop*m_nTotal).
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.