Jpp  18.6.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
17 namespace JAANET {}
18 namespace JPP { using namespace JAANET; }
19 
20 namespace JAANET {
21 
22  using JLANG::JClonable;
23 
24 
25  /**
26  * Abstract base class for event weighing.
27  */
28  struct JEvtWeight :
29  public JEvtWeightInterface,
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
virtual void setNormalisation(const double normalisation) override
Set event-weight normalisation factor.
Definition: JEvtWeight.hh:79
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
virtual double getNormalisation(const Evt &evt) const
Get event-weight normalisation.
Definition: JEvtWeight.hh:65
double normalisation
Event-weight normalisation.
Definition: JEvtWeight.hh:87
Low-level interface for event weighing.
Abstract base class for event weighing.
Definition: JEvtWeight.hh:28
Template class for object cloning.
Definition: JClonable.hh:20
virtual ~JEvtWeight()
Virtual destructor.
Definition: JEvtWeight.hh:42
JEvtWeight()
Default constructor.
Definition: JEvtWeight.hh:35
virtual double getNormalisation() const override
Get event-weight normalisation.
Definition: JEvtWeight.hh:52
static const int WEIGHTLIST_NORMALISATION
Event rate normalisation.
Definition: weightlist.hh:16
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20