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
marley::TrivialWeightCalculator Class Reference

WeightCalculator object that unconditionally returns unit weights. More...

#include <WeightCalculator.hh>

Inheritance diagram for marley::TrivialWeightCalculator:
marley::WeightCalculator

Public Member Functions

 TrivialWeightCalculator (const marley::JSON &config)
 
virtual double weight (HepMC3::GenEvent &, marley::Generator &) const override
 Compute the weight for the given event.
 
- Public Member Functions inherited from marley::WeightCalculator
 WeightCalculator (const marley::JSON &config)
 
 WeightCalculator (const std::string &name)
 
const std::string & name () const
 

Additional Inherited Members

- Protected Attributes inherited from marley::WeightCalculator
std::string name_
 Name used to label the output event weight.
 

Detailed Description

WeightCalculator object that unconditionally returns unit weights.

Definition at line 67 of file WeightCalculator.hh.

Constructor & Destructor Documentation

◆ TrivialWeightCalculator()

marley::TrivialWeightCalculator::TrivialWeightCalculator ( const marley::JSON & config)
inline

Definition at line 71 of file WeightCalculator.hh.

72 : WeightCalculator( config ) {}

Member Function Documentation

◆ weight()

virtual double marley::TrivialWeightCalculator::weight ( HepMC3::GenEvent & event,
marley::Generator & gen ) const
inlineoverridevirtual

Compute the weight for the given event.

Note
If a derived class uses random numbers, it MUST own its own random number generator (seeded with a fixed value from its JSON config) rather than using the Generator's RNG. Random numbers MUST also only be used by derived classes during initialization, not on an event-by-event basis. These rules ensure that the calculated weights remain deterministic and replayable regardless of when or in what context the calculator is used. In particular, this allows the "resume" behavior of the "marley generate" command to be correct even after reweighting has been run on an existing sample.
Todo
Revisit this constraint if a clear use case is found for event-by-event random numbers sampled within a WeightCalculator derived class implementation.

Implements marley::WeightCalculator.

Definition at line 75 of file WeightCalculator.hh.

76 { return 1.; }

The documentation for this class was generated from the following file: