1#include "SimCore/ReSimulator.h"
10 auto configured_events{
11 parameters.
get<std::vector<framework::config::Parameters>>(
12 "events_to_resimulate", {})};
13 if (configured_events.size() == 0) {
16 "ReSim was configured with resimulate_all_events marked false but "
17 "no event numbers were requested.\n\nDid you forget to configure "
18 "the events_to_resimulate parameter?\n");
20 for (
const auto& run_event : configured_events) {
22 run_event.get<
int>(
"event"));
29 auto& event_header{
event.getEventHeader()};
30 const auto event_number{event_header.getEventNumber()};
32 ldmx_log(trace) <<
"Skipping event: " << event_number
33 <<
" since it wasn't part of the requested events...";
39 ldmx_log(trace) <<
"Resimulating " << event_number;
41 std::istringstream iss(event_header.getStringParameter(
"eventSeed"));
42 G4Random::restoreFullState(iss);
45 ldmx_log(trace) <<
"Finished with event number " << event_number;
49 SensitiveDetector::Factory::get().apply(
50 [](
auto sd) { sd->onFinishedEvent(); });
53 "Resimulation resulted in an aborted event, something is wrong with "
54 "the seed from event " +
55 std::to_string(event_number));
58 event_header.setEventNumber(++events_resimulated_);
59 updateEventHeader(event_header);
79 auto found_event_to_resim = std::find_if(
81 [&](
const std::pair<int, int>& run_event) ->
bool {
82 bool runs_match =
true;
84 runs_match = (
event.getEventHeader().getRun() == run_event.first);
85 return event.getEventNumber() == run_event.second and runs_match;
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
void abortEvent()
Abort the event immediately.
Implements an event buffer system for storing event data.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
void produce(framework::Event &event) override
Run resimulation if the event is part of the requested sets of events to resimulate.
std::vector< std::pair< int, int > > events_to_resimulate_
List of events in the input files that should be resimulated if resimulate_all_events is false.
void configure(framework::config::Parameters ¶meters) override
Callback for the processor to configure itself from the given set of parameters.
bool care_about_run_
Whether or not we should check the run number when seeing if a specific event should be resimulated.
bool skip(framework::Event &event) const
Check if an event should be skipped during resimulation.
bool resimulate_all_events_
Whether to resimulate all events in the input files.
std::unique_ptr< RunManager > run_manager_
Manager controlling G4 simulation run.
void configure(framework::config::Parameters ¶meters) override
Callback for the EventProcessor to configure itself from the given set of parameters.
Dynamically loadable photonuclear models either from SimCore or external libraries implementing this ...