Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JWeightMupage.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JWEIGHTMUPAGE__
2 #define __JAANET__JWEIGHTMUPAGE__
3 
4 #include "JWeightEvent.hh"
5 
6 
7 namespace JAANET {
8 
9  /**
10  * Implementation of event weighing for MUPAGE data.
11  */
12  struct JWeightMupage :
13  public JClonable<JWeightEvent, JWeightMupage>
14  {
15  /**
16  * Configuration.
17  *
18  * \param header header
19  * \return true if okay; else false
20  */
21  virtual bool configure(const JHead& header)
22  {
23  if (header.livetime.numberOfSeconds > 0.0) {
24 
25  W = 1.0 / header.livetime.numberOfSeconds;
26 
27  return true;
28 
29  } else {
30 
31  return false;
32  }
33  }
34 
35  /**
36  * Get weight of given event.
37  *
38  * \param evt event
39  * \return weight [1/s]
40  */
41  virtual double getWeight(const Evt& evt) const
42  {
43  return W;
44  }
45 
46  private:
47  double W;
48  };
49 }
50 
51 #endif
virtual double getWeight(const Evt &evt) const
Get weight of given event.
JAANET::livetime livetime
Definition: JHead.hh:1102
Monte Carlo run header.
Definition: JHead.hh:836
virtual bool configure(const JHead &header)
Configuration.
double numberOfSeconds
Live time [s].
Definition: JHead.hh:654
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19