Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JWeightEventToolkit.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JWEIGHTEVENTTOOLKIT__
2 #define __JAANET__JWEIGHTEVENTTOOLKIT__
3 
4 #include <vector>
5 
8 
10 
11 #include "JAAnet/JHead.hh"
12 #include "JAAnet/JHeadToolkit.hh"
13 #include "JAAnet/JWeightEvent.hh"
14 #include "JAAnet/JWeightDAQ.hh"
15 #include "JAAnet/JWeightMupage.hh"
16 #include "JAAnet/JWeightGSeaGen.hh"
17 #include "JAAnet/JWeightKM3BUU.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 JEventWeighter :
33  public std::vector< JSharedPointer<JWeightEvent> >
34  {
35  /*
36  * Constructor
37  */
39  {
40  this->push_back(new JWeightGSeaGen());
41  this->push_back(new JWeightKM3BUU());
42  this->push_back(new JWeightMupage());
43  this->push_back(new JWeightDAQ());
44  }
45 
46 
47  /**
48  * Get event weighter corresponding to given header.
49  *
50  * \param header header
51  */
52  const JWeightEvent& operator()(const JHead& header) const
53  {
54  for (const_iterator p = this->begin(); p != this->end(); ++p) {
55  if ((*p)->check(header)) {
56  return *(*p);
57  }
58  }
59 
60  THROW(JValueOutOfRange, "JEventWeighter::operator(): No map entry found for given header.");
61  }
62  };
63 
64  extern JEventWeighter getEventWeighter; //!< Function object for mapping header to event weighter.
65 }
66 
67 #endif
Implementation of event weighing for MUPAGE data.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
Look-up table for event weighters.
The template JSharedPointer class can be used to share a pointer to an object.
const JWeightEvent & operator()(const JHead &header) const
Get event weighter corresponding to given header.
Low-level interface for event weighing.
Definition: JWeightEvent.hh:23
Implementation of event weighing for GSeaGen data.
JEventWeighter getEventWeighter
Function object for mapping header to event weighter.
Monte Carlo run header.
Definition: JHead.hh:1091
Implementation of event weighing for KM3BUU data.
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
Implementation of event weighing for DAQ data.
Definition: JWeightDAQ.hh:27