12 #include <Rivet/Rivet.hh>
13 #include <Rivet/Tools/Logging.hh>
150 filename_(path / (name +
".yoda")),
152 rivet_confs_(out_par.subcon_for_rivet) {
153 handler_ = std::make_shared<Rivet::AnalysisHandler>();
165 const int32_t event_number,
171 logg[
LOutput].debug() <<
"Initialising Rivet" << std::endl;
176 logg[
LOutput].debug() <<
"Analysing event " << event_number << std::endl;
186 Rivet::addAnalysisLibPath(path);
187 Rivet::addAnalysisDataPath(path);
195 logg[
LOutput].info() <<
"Ignore beams? " << (ignore ?
"yes" :
"no")
201 const std::string& level) {
202 std::string fname(name);
203 if (fname.rfind(
"Rivet", 0) != 0) {
204 fname =
"Rivet." + fname;
207 auto upcase = [](
const std::string& s) {
209 std::transform(out.begin(), out.end(), out.begin(),
210 [](
char c) { return std::toupper(c); });
215 Rivet::Log::setLevel(fname, Rivet::Log::getLevelFromName(upcase(level)));
225 logg[
LOutput].debug() <<
"Setting up from configuration:\n"
230 logg[
LOutput].info() <<
"Processing paths" << std::endl;
238 logg[
LOutput].info() <<
"Processing preloads" << std::endl;
246 logg[
LOutput].info() <<
"Processing analyses" << std::endl;
278 if (wconf.has_value({
"No_Multi"})) {
283 if (wconf.has_value({
"Nominal"})) {
288 if (wconf.has_value({
"Cap"})) {
293 if (wconf.has_value({
"NLO_Smearing"})) {
298 if (wconf.has_value({
"Select"})) {
299 std::vector<std::string> sel = wconf.take({
"Select"});
303 s << (comma++ ?
"," :
"") << w;
308 if (wconf.has_value({
"Deselect"})) {
309 std::vector<std::string> sel = wconf.take({
"Deselect"});
313 s << (comma++ ?
"," :
"") << w;
317 logg[
LOutput].debug() <<
"After processing configuration:\n"
bool has_value(std::initializer_list< const char * > keys) const
Returns whether there is a non-empty value behind the requested keys.
std::string to_string() const
Returns a YAML string of the current tree.
Value take(std::initializer_list< const char * > keys)
The default interface for SMASH to read configuration values.
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.
void setup()
Read configuration of Rivet from SMASH configuration.
std::shared_ptr< Rivet::AnalysisHandler > handler_
Rivet analysis handler.
bool need_init_
Whether we need initialisation.
~RivetOutput()
Destructor.
bf::path filename_
Output file.
void set_cross_section(double xs, double xserr)
Set X-section.
void add_preload(const std::string &file)
Add preload to Rivet handler.
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.
Configuration rivet_confs_
Configutations for rivet.
RivetOutput(const bf::path &path, std::string name, const bool full_event, const OutputParameters &out_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 Experiment to hold output options and parameters.