Jpp
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
JAANET::JHead::livetime
JAANET::livetime livetime
Definition: JHead.hh:1089
JAANET::JWeightMupage::W
double W
Definition: JWeightDAQ.hh:47
JAANET::JHead
Monte Carlo run header.
Definition: JHead.hh:839
JAANET::JWeightMupage::configure
virtual bool configure(const JHead &header)
Configuration.
Definition: JWeightMupage.hh:21
JAANET::JWeightMupage::getWeight
virtual double getWeight(const Evt &evt) const
Get weight of given event.
Definition: JWeightMupage.hh:41
JAANET::livetime::numberOfSeconds
double numberOfSeconds
Live time [s].
Definition: JHead.hh:644
JAANET
Extensions to AAnet data format.
Definition: JAAnetToolkit.hh:36
JWeightEvent.hh