Jpp  15.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JEvtWeightFactorHelper.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JEVTWEIGHTFACTORHELPER__
2 #define __JAANET__JEVTWEIGHTFACTORHELPER__
3 
5 
7 
9 
10 /**
11  * \author bjung
12  */
13 
14 namespace JAANET {
15 
18 
19 
20  /**
21  * Helper class for event-weight factor.
22  */
24  public JSharedPointer<JEvtWeightFactor>
25  {
27 
28  /**
29  * Default constructor.
30  */
32  {}
33 
34 
35  /**
36  * Constructor.
37  *
38  * \param factor event-weight factor
39  */
41  {
42  configure(factor);
43  }
44 
45 
46  /**
47  * Configure event-weight factor.
48  *
49  * \param factor event-weight factor
50  */
51  void configure(const JEvtWeightFactor& factor)
52  {
53  reset(factor.clone());
54  }
55 
56 
57  /**
58  * Get weight-factor of given event.
59  *
60  * \param evt event
61  * \return event-weight factor
62  */
63  double getFactor(const Evt& evt) const
64  {
65  if (is_valid()) {
66  return get()->getFactor(evt);
67  } else {
68  THROW(JNullPointerException, "JEvtWeightFactorHelper::getFactor(): Unspecified event-weighting factor.");
69  }
70  }
71 
72 
73  /**
74  * Get flux of given event.
75  *
76  * \param evt event
77  * \return flux [GeV * m^-2 * sr^-1 * s^-1]
78  */
79  double getFlux(const Evt& evt) const
80  {
81  if (is_valid()) {
82  return get()->getFlux(evt);
83  } else {
84  THROW(JNullPointerException, "JEvtWeightFactorHelper::getFlux(): Unspecified flux function.");
85  }
86  }
87  };
88 }
89 
90 #endif
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
JEvtWeightFactorHelper()
Default constructor.
bool is_valid() const
Check validity of pointer.
virtual clone_type clone() const override
Get clone of this object.
Definition: JClonable.hh:69
The template JSharedPointer class can be used to share a pointer to an object.
Exception for null pointer operation.
Definition: JException.hh:216
double getFactor(const Evt &evt) const
Get weight-factor of given event.
void configure(const JEvtWeightFactor &factor)
Configure event-weight factor.
Helper class for event-weight factor.
double getFlux(const Evt &evt) const
Get flux of given event.
JEvtWeightFactorHelper(const JEvtWeightFactor &factor)
Constructor.
virtual void reset() override
Reset pointer.
Low-level interface for retrieving a specifiable multiplication factor corresponding to a given event...
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19