MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
Weighter.hh
1
4//
5// This file is part of MARLEY (Model of Argon Reaction Low Energy Yields)
6//
7// MARLEY is free software: you can redistribute it and/or modify it under the
8// terms of version 3 of the GNU General Public License as published by the
9// Free Software Foundation.
10//
11// For the full text of the license please see COPYING or
12// visit http://opensource.org/licenses/GPL-3.0
13//
14// Please respect the MCnet academic usage guidelines. See GUIDELINES
15// or visit https://www.montecarlonet.org/GUIDELINES for details.
16#pragma once
17
18// Standard library includes
19#include <memory>
20#include <string>
21#include <vector>
22
23// MARLEY includes
24#include "marley/EventProcessor.hh"
25
26namespace marley {
27
28 // Forward-declare the WeightCalculator class
29 class WeightCalculator;
30
32 class Weighter : public EventProcessor {
33
34 public:
35
36 Weighter( const marley::JSON& config,
37 marley::Generator& gen );
38
39 inline virtual ~Weighter() = default;
40
41 virtual void process_event( HepMC3::GenEvent& event,
42 marley::Generator& gen ) override;
43
44 std::vector< double > compute_weights( HepMC3::GenEvent& event,
45 marley::Generator& gen ) const;
46
49 std::vector< std::string > get_weight_names() const;
50
52 void set_use_cv_weight( bool use_it );
53
56 inline std::vector< std::shared_ptr< WeightCalculator > >&
58
59 protected:
60
63 static const std::string CV_WEIGHT_NAME;
64
67 std::vector< std::shared_ptr< WeightCalculator > > calc_vec_;
68
71 std::shared_ptr< marley::WeightCalculator > make_cv_weight_calc();
72 };
73
74}
Stores event-related information.
Definition GenEvent.h:47
The MARLEY Event generator.
Definition Generator.hh:54
Abstract base class for objects that compute numerical weights for an input event.
static const std::string CV_WEIGHT_NAME
Reserved name for the central-value weights (required for compliance with the NuHepMC standard)
Definition Weighter.hh:63
std::vector< std::shared_ptr< WeightCalculator > > & get_weight_calculators()
Provides non-const access to the owned vector of weight calculators.
Definition Weighter.hh:57
std::vector< std::shared_ptr< WeightCalculator > > calc_vec_
Owned vector of weight calculators used to actually compute weights.
Definition Weighter.hh:67
std::vector< std::string > get_weight_names() const
Returns the names of the weights associated with all configured weight calculators.
Definition Weighter.cc:153
void set_use_cv_weight(bool use_it)
Toggles inclusion of the central-value weight.
Definition Weighter.cc:163
std::shared_ptr< marley::WeightCalculator > make_cv_weight_calc()
Helper function to create the weight calculator that handles the central-value weights during event g...
Definition Weighter.cc:193
virtual void process_event(HepMC3::GenEvent &event, marley::Generator &gen) override
Processes an input GenEvent object.
Definition Weighter.cc:113