9#include <framework/core/SteerRootInputModule.h>
11#include <framework/core/Environment.h>
12#include <framework/core/InputController.h>
23 setDescription(
"Internal module used by Path.add_independent_merge_path(). This shouldn't appear in 'basf2 -m' output. If it does, check REG_MODULE() handling.");
27 addParam(
"eventMixing",
m_eventMixing,
"merge each event of main path with each event of independent path",
false);
29 addParam(
"mergeSameFile",
m_mergeSameFile,
"if you want to merge a file with itself, mixing evts (1,3) is the same as (3,1)",
33SteerRootInputModule::~SteerRootInputModule() =
default;
47 B2ERROR(
"Object MergedEventConsistency not found. This is not expected.");
55 B2ERROR(
"It does not make sense to merge a file with itself if you're not doing event mixing.");
58 if (numEntries.first != numEntries.second) {
59 B2ERROR(
"Are you sure you are mixing a file with itself? Inconsistent number of events found.");
62 if (skippedEntries.first != skippedEntries.second) {
63 B2ERROR(
"Cannot mix file with itself if you're skipping a different number of events in both RootInputModules");
70 B2ERROR(
"Event mixing not possible if you want to skip to a certain exp/run/evt with the RootInputModule."
71 " Please skip to a certain entry in the File instead (use parameter 'skipNEvents').");
79 long evtsToProcess = -1;
82 evtsToProcess = (numEntries.first - skippedEntries.first) * (numEntries.second - skippedEntries.second);
85 evtsToProcess = std::max((numEntries.first - skippedEntries.first), (numEntries.second - skippedEntries.second));
97 B2FATAL(
"This should not happen. Expected that both paths were processed at this point.");
110 bool goodMerge =
true;
112 std::pair <long, long> nextEntries;
135 nextEntries = std::make_pair(currEntries.first, currEntries.second + 1);
137 if (nextEntries.second == numEntries.second) {
143 nextEntries.second = nextEntries.first + 1;
149 nextEntries = std::make_pair(currEntries.first + 1, currEntries.second + 1);
151 nextEntries = std::make_pair(currEntries.first, currEntries.second + 1);
158 if (nextEntries.first >= numEntries.first || nextEntries.second >= numEntries.second) {
161 B2INFO(
"Reached end of file(s), so we're done. End processing.");
164 nextEntries = currEntries;
void setNumberEventsOverride(unsigned int nevents)
Override the number of events in run 1 for EventInfoSetter module.
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.
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.