You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If there are no events to process, nothing more to do.
33
+
// If there are no events to process, keep the object in an initialized-but-idle state.
55
34
if (neventsToProcess == 0) return;
56
35
57
-
// If no file is provided, use the user-specified run number.
36
+
// If no file is provided, use the user-specified run number (single-run mode).
58
37
if (filename == UNINITIALIZEDSTRINGQUANTITY && neventsToProcess > 0) {
59
-
// Only one run is defined via the option.
60
38
runEvents[userRunno] = neventsToProcess;
61
39
return;
62
40
}
63
41
else {
64
-
//A filename was specified; attempt to open the run weights input file.
42
+
//Multi-run mode: a filename was specified; attempt to open the run weights input file.
65
43
ifstream in(filename.c_str());
66
-
if (!in) { log->error(ERR_EVENTDISTRIBUTIONFILENOTFOUND, "Error: can't open run weights input file >", filename, "<. Check your spelling. Exiting."); }
44
+
if (!in) {
45
+
// Keep behavior unchanged: log error and continue with an empty distribution.
46
+
log->error(ERR_EVENTDISTRIBUTIONFILENOTFOUND,
47
+
"Error: can't open run weights input file >", filename, "<. Check your spelling. Exiting.");
48
+
}
67
49
else {
68
50
log->info(1, "Loading run weights from ", filename);
69
-
// Fill the run weight map by reading each line from the file.
51
+
52
+
// Read "run weight" pairs, one per line.
53
+
// The order of insertion into listOfRuns reflects the file order and may be used by clients.
70
54
int run;
71
55
double weight;
72
-
// Use a robust loop to read pairs from the file.
73
56
while (in >> run >> weight) {
74
57
listOfRuns.push_back(run);
75
58
runWeights[run] = weight;
76
-
runEvents[run] = 0;
59
+
runEvents[run] = 0;// initialize per-run counters before distribution
77
60
}
78
-
// Distribute the total number of events among the runs according to the weights.
61
+
62
+
// Distribute the total number of events among runs according to their weights.
79
63
distributeEvents(neventsToProcess);
80
64
}
81
65
in.close();
82
66
83
-
// Log summary information.
84
-
log->info(0, "EventDispenser initialized with ", neventsToProcess, " events distributed among ", runWeights.size(), " runs:");
67
+
// Log summary information: overall distribution table.
68
+
log->info(0, "EventDispenser initialized with ", neventsToProcess, " events distributed among ",
0 commit comments