Jpp  16.0.0-rc.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"
19 
20 /**
21  * \author bjung
22  */
23 
24 namespace JAANET {
25 
28 
29 
30  /**
31  * Look-up table for event weighters.
32  */
33  struct JEvtWeighter :
34  public std::vector< JSharedPointer<JEvtWeight> >
35  {
36  /*
37  * Constructor
38  */
40  {
41  this->push_back(new JEvtWeightGSeaGen());
42  this->push_back(new JEvtWeightKM3BUU());
43  this->push_back(new JEvtWeightCorsika());
44  this->push_back(new JEvtWeightMupage());
45  this->push_back(new JEvtWeightDAQ());
46  }
47 
48 
49  /**
50  * Get event weighter corresponding to given header.
51  *
52  * \param header header
53  * \return event weighter
54  */
55  const JEvtWeight& operator()(const JHead& header) const
56  {
57  for (const_iterator i = this->begin(); i != this->end(); ++i) {
58 
59  if ((*i)->check(header)) {
60 
61  return *(*i);
62  }
63  }
64 
65  THROW(JValueOutOfRange, "JEvtWeighter::operator(): No event weighter found for given header.");
66  }
67  };
68 
69 
70  extern JEvtWeighter getEventWeighter; //!< Function object for mapping header to event weighter.
71 }
72 
73 #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:696
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:1164
Implementation of event weighting for KM3BUU data.
Implementation of event weighing for MUPAGE data.
Look-up table for event weighters.
Implementation of event weighting for Corsika data.
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.