beginRun is called more than once in a Shared Module
I have constructed a Shared Producer Module for Mu2e Offline and have run it with two schedules. I am finding that beginRun is being called twice, once from each Schedule. Since Shared Module should only have one instance of the module, beginRun should only be called once.
#1 Updated by Paul Russo 4 days ago
There is an actual reason why it is explicitly called for each schedule. Imagine a module that has an array indexed by schedule id that that accumulates information over the duration of a run (separately for each schedule). The begin run callback is a good place to setup the entries of this array for each schedule.
So the expected behavior is that the shared module checks the schedule id. If it is doing schedule-specific work, then it can do an if test on the schedule id, and if it is not, then it can just do the work only for schedule id 0 (also an if test on the schedule id).