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
WeightCalculator.cc
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
17// MARLEY includes
18#include "marley/Error.hh"
19#include "marley/JSON.hh"
20#include "marley/WeightCalculator.hh"
21
22marley::WeightCalculator::WeightCalculator( const marley::JSON& config )
23{
24 if ( !config.is_object() ) {
25 throw marley::Error( "Non-object JSON configuration passed to constructor"
26 " of marley::WeightCalculator" );
27 }
28
29 if ( !config.has_key("name") ) {
30 throw marley::Error( "Missing \"name\" key in weight calculator JSON"
31 " configuration" );
32 }
33
34 name_ = config.at( "name" ).to_string();
35}
36
37marley::WeightCalculator::WeightCalculator( const std::string& name )
38 : name_( name ) {}
std::string name_
Name used to label the output event weight.