EventGenerator¶
-
class EventGenerator¶
Drives event generation across every channel of a subprocess.
Coordinates a group of ChannelEventGenerator instances that share the same list of Context devices: runs their survey, dispatches and collects generation batches so multiple channels and devices stay busy concurrently, and combines the resulting per-channel weighted events into unweighted output (combine_to_compact_npy, combine_to_lhe_npy, combine_to_lhe).
Public Functions
- Parameters:
contexts – One context per device to run on, shared by every channel.
channels – The channels to generate, e.g. one per Topology channel of the subprocess.
seed – Top-level run seed every channel’s RNG streams are derived from.
status_file – Optional status file progress is periodically written to.
config – Generator configuration.
-
EventGenerator(EventGenerator&&) = default¶
-
EventGenerator &operator=(EventGenerator&&) = default¶
-
EventGenerator(const EventGenerator&) = delete¶
-
EventGenerator &operator=(const EventGenerator&) = delete¶
-
void survey(std::size_t survey_pass = 0)¶
Run the survey/optimization phase of every channel.
survey_passsalts job seeds so repeated calls on the same channels (e.g. re-surveying after simplification) don’t share a seed stream.
-
void generate()¶
Generate unweighted events until every channel reaches its target count.
-
void optimize()¶
Run only the VEGAS and channel-weight optimization of every channel that still needs it, until all are optimized.
No events are kept.
-
void fix_max_weights()¶
Like generate, but every channel with a nonzero cross section runs until it has
freeze_max_weight_afterunweighted events, regardless of its share of the cross section, so that its maximum weight is final (see ChannelEventGenerator::max_weight).The events are not meant to be combined.
-
void combine_to_compact_npy(const std::string &file_name, SystematicsCalculator *systematics = nullptr, EventHistograms *histograms = nullptr)¶
Combine every channel’s generated events into a single unweighted
.npyfile.- Parameters:
file_name – Output file base name.
systematics – Optional; adds the scale/PDF variation weights to the written events (
.npycolumnsrwgt_<id>).histograms – Optional; filled with the written events and all their weights (recorded in
info.json’s"event_histograms").
-
void combine_to_lhe_npy(const std::string &file_name, LHECompleter &lhe_completer, SystematicsCalculator *systematics = nullptr, EventHistograms *histograms = nullptr)¶
Like combine_to_compact_npy, additionally completing every event with
lhe_completerand writing its LHE-ready particle records to the.npyfile.
-
void combine_to_lhe(const std::string &file_name, LHECompleter &lhe_completer, const LHEMeta &meta = {}, SystematicsCalculator *systematics = nullptr, EventHistograms *histograms = nullptr)¶
Like combine_to_lhe_npy, writing a complete LHE file with
metaas its<init>header instead of a.npyfile.
-
inline GeneratorStatus status() const¶
Combined progress snapshot over every channel.
-
std::vector<GeneratorStatus> channel_status() const¶
Per-channel progress snapshots.
-
std::unordered_set<std::string> used_globals() const¶
Names of the compute-graph globals used by any channel’s integrand.
-
inline const std::vector<std::shared_ptr<ChannelEventGenerator>> &channels() const¶
The channels passed to the constructor.
Public Static Functions
Public Static Attributes
-
static const GeneratorConfig default_config¶
Default-constructed GeneratorConfig.