Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JEvtWeight.hh
Go to the documentation of this file.
1#ifndef __JAANET__JEVTWEIGHT__
2#define __JAANET__JEVTWEIGHT__
3
5
7
8#include "JLang/JClonable.hh"
9
11
12
13/**
14 * \author mdejong, bjjung
15 */
16
17namespace JAANET {}
18namespace JPP { using namespace JAANET; }
19
20namespace JAANET {
21
22 using JLANG::JClonable;
23
24
25 /**
26 * Abstract base class for event weighing.
27 */
28 struct JEvtWeight :
30 public JClonable<JEvtWeight>
31 {
32 /**
33 * Default constructor.
34 */
36 {}
37
38
39 /**
40 * Virtual destructor.
41 */
42 virtual ~JEvtWeight()
43 {}
44
45
46 /**
47 * Get event-weight normalisation.
48 * Note: the return-value should be *multiplied* in order to normalise the event-weight
49 *
50 * \return event-weight normalisation
51 */
52 virtual double getNormalisation() const override
53 {
54 return normalisation;
55 }
56
57
58 /**
59 * Get event-weight normalisation.
60 * Note: the return-value should be *multiplied* in order to normalise the event-weight
61 *
62 * \param evt event
63 * \return event-weight normalisation
64 */
65 virtual double getNormalisation(const Evt& evt) const
66 {
67 return (evt.w.size() > WEIGHTLIST_NORMALISATION &&
68 evt.w[WEIGHTLIST_NORMALISATION] > 0.0 ?
70 }
71
72
73 /**
74 * Set event-weight normalisation factor.
75 * Note: the set-value should be *multiplied* in order to normalise the event-weight
76 *
77 * \param normalisation event-weight normalisation factor.
78 */
79 virtual void setNormalisation(const double normalisation) override
80 {
81 this->normalisation = normalisation;
82 }
83
84
85 protected:
86
87 double normalisation; //!< Event-weight normalisation
88 };
89}
90
91#endif
Extensions to Evt data format.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions)
Definition Evt.hh:42
Low-level interface for event weighing.
Abstract base class for event weighing.
Definition JEvtWeight.hh:31
double normalisation
Event-weight normalisation.
Definition JEvtWeight.hh:87
virtual void setNormalisation(const double normalisation) override
Set event-weight normalisation factor.
Definition JEvtWeight.hh:79
virtual double getNormalisation() const override
Get event-weight normalisation.
Definition JEvtWeight.hh:52
virtual double getNormalisation(const Evt &evt) const
Get event-weight normalisation.
Definition JEvtWeight.hh:65
virtual ~JEvtWeight()
Virtual destructor.
Definition JEvtWeight.hh:42
JEvtWeight()
Default constructor.
Definition JEvtWeight.hh:35
Template class for object cloning.
Definition JClonable.hh:59
static const int WEIGHTLIST_NORMALISATION
Event rate normalisation.
Definition weightlist.hh:16