Jpp  15.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JEvtWeightToolkit.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JEVTWEIGHTTOOLKIT__
2 #define __JAANET__JEVTWEIGHTTOOLKIT__
3 
4 #include <vector>
5 
8 
10 
11 #include "JAAnet/JHead.hh"
12 #include "JAAnet/JHeadToolkit.hh"
13 #include "JAAnet/JEvtWeight.hh"
14 #include "JAAnet/JEvtWeightDAQ.hh"
18 
19 /**
20  * \author bjung
21  */
22 
23 namespace JAANET {
24 
27 
28 
29  /**
30  * Look-up table for event weighters.
31  */
32  struct JEvtWeighter :
33  public std::vector< JSharedPointer<JEvtWeight> >
34  {
35  /*
36  * Constructor
37  */
39  {
40  this->push_back(new JEvtWeightGSeaGen());
41  this->push_back(new JEvtWeightKM3BUU());
42  this->push_back(new JEvtWeightMupage());
43  this->push_back(new JEvtWeightDAQ());
44  }
45 
46 
47  /**
48  * Get event weighter corresponding to given header.
49  *
50  * \param header header
51  * \return event weighter
52  */
53  const JEvtWeight& operator()(const JHead& header) const
54  {
55  for (const_iterator i = this->begin(); i != this->end(); ++i) {
56 
57  if ((*i)->check(header)) {
58 
59  return *(*i);
60  }
61  }
62 
63  THROW(JValueOutOfRange, "JEvtWeighter::operator(): No event weighter found for given header.");
64  }
65  };
66 
67 
68  extern JEvtWeighter getEventWeighter; //!< Function object for mapping header to event weighter.
69 }
70 
71 #endif
JEvtWeighter getEventWeighter
Function object for mapping header to event weighter.
Implementation of event weighing for DAQ data.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
The template JSharedPointer class can be used to share a pointer to an object.
Low-level interface for event weighing.
Definition: JEvtWeight.hh:24
Implementation of event weighting for GSeaGen data.
Monte Carlo run header.
Definition: JHead.hh:1113
Implementation of event weighting for KM3BUU data.
Implementation of event weighing for MUPAGE data.
Look-up table for event weighters.
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
const JEvtWeight & operator()(const JHead &header) const
Get event weighter corresponding to given header.