13 #include "Rivet/Rivet.hh"
14 #include "Rivet/Tools/Logging.hh"
92 const bool full_event,
96 filename_(path / (name +
".yoda")),
98 handler_ = std::make_shared<Rivet::AnalysisHandler>();
110 const int32_t event_number,
116 logg[
LOutput].debug() <<
"Initialising Rivet" << std::endl;
121 logg[
LOutput].debug() <<
"Analysing event " << event_number << std::endl;
131 Rivet::addAnalysisLibPath(path);
132 Rivet::addAnalysisDataPath(path);
140 logg[
LOutput].info() <<
"Ignore beams? " << (ignore ?
"yes" :
"no")
146 const std::string& level) {
147 std::string fname(name);
148 if (fname.rfind(
"Rivet", 0) != 0) {
149 fname =
"Rivet." + fname;
152 auto upcase = [](
const std::string& s) {
154 std::transform(out.begin(), out.end(), out.begin(),
155 [](
char c) { return std::toupper(c); });
160 Rivet::Log::setLevel(fname, Rivet::Log::getLevelFromName(upcase(level)));
170 logg[
LOutput].debug() <<
"Setting up Rivet output:\n";
175 for (
auto p : params.
paths.value())
204 for (
auto nl : params.
logs.value())
237 s << (comma++ ?
"," :
"") << w;
246 s << (comma++ ?
"," :
"") << w;
250 logg[
LOutput].debug() <<
"Setup of Rivet output done.\n";
Base class for output handlers that need the HepMC3 structure.
void at_eventend(const Particles &particles, const int32_t event_number, const EventInfo &event) override
Add the final particles information of an event to the central vertex.
HepMC3::GenEvent event_
The event.
The Particles class abstracts the storage and manipulation of particles.
Proxy analysis_handler_proxy()
Return a proxy that temporarily disables FP exceptions.
void add_path(const std::string &path)
Add a load path to the Rivet handler.
void add_analysis(const std::string &name)
Add an analysis or analyses to Rivet.
std::filesystem::path filename_
Output file.
std::shared_ptr< Rivet::AnalysisHandler > handler_
Rivet analysis handler.
bool need_init_
Whether we need initialisation.
~RivetOutput()
Destructor.
void set_cross_section(double xs, double xserr)
Set X-section.
void add_preload(const std::string &file)
Add preload to Rivet handler.
void setup(const RivetOutputParameters ¶ms)
Setup Rivet using SMASH configuration parameters.
void set_log_level(const std::string &name, const std::string &level)
Set log level in Rivet.
void at_eventend(const Particles &particles, const int32_t event_number, const EventInfo &event) override
Add the final particles information of an event to the central vertex.
RivetOutput(const std::filesystem::path &path, std::string name, const bool full_event, const RivetOutputParameters &rivet_par)
Create Rivet output.
void set_ignore_beams(bool ignore=true)
Do not insist on appropriate beams for analyses.
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
static constexpr int LOutput
Structure to contain custom data for output.
Helper structure for OutputParameters in order to store and hand over Rivet parameters.
std::optional< std::vector< std::string > > to_be_enabled_weights
Weights to be enabled for processing.
std::optional< std::string > nominal_weight_name
Nominal weight name.
std::optional< std::map< std::string, std::string > > logs
Logging in Rivet.
std::optional< std::vector< std::string > > preloads
Data files to pre-load e.g., for centrality configurations.
std::optional< std::vector< std::string > > paths
Paths to analyses libraries and data.
std::optional< double > nlo_smearing
How to smear for NLO calculations.
std::optional< std::vector< std::string > > analyses
Analyses (including options) to add to run.
bool ignore_beams
Whether Rivet should ignore beams.
std::optional< double > cap_on_weights
Cap (maximum) on weights.
std::optional< bool > no_multi_weight
Whether Rivet should not care about multi weights.
std::optional< std::vector< std::string > > to_be_disabled_weights
Weights to be disabled for processing.
bool any_weight_parameter_was_given
Whether any weight parameter was specified.
std::optional< std::array< double, 2 > > cross_sections
Cross sections.