Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JWeightEventHelper.hh
Go to the documentation of this file.
1 #ifndef __JAANET__JWEIGHTEVENTHELPER__
2 #define __JAANET__JWEIGHTEVENTHELPER__
3 
4 #include "JAAnet/JHead.hh"
5 #include "JAAnet/JHeadToolkit.hh"
7 #include "JLang/JException.hh"
10 #include "JWeightEvent.hh"
11 
12 
13 namespace JAANET {
14 
18 
19 
20  /**
21  * Helper class for event weighing.
22  */
24  public JHead,
25  public JSharedPointer<JWeightEvent>
26  {
27  using JHead::is_valid;
29 
30 
31  /**
32  * Configuration.
33  *
34  * \param input_files input files
35  * \return true if okay; else false
36  */
37  bool configure(const JMultipleFileScanner_t& input_files)
38  {
39  setHeader(JSUPPORT::getHeader(input_files));
40 
41  if (is_valid())
42  return get()->configure(getHeader());
43  else
44  return false;
45  }
46 
47 
48  /**
49  * Get weight of given event.
50  *
51  * \param evt event
52  * \return weight [1/s]
53  */
54  double getWeight(const Evt& evt) const
55  {
56  if (is_valid())
57  return get()->getWeight(evt);
58  else
59  THROW(JNullPointerException, "JWeightEventHelper::getWeight(): null pointer.");
60  }
61  };
62 }
63 
64 #endif
Exceptions.
void setHeader(const JHead &header)
Set header.
Definition: JHead.hh:903
const JHead & getHeader() const
Get header.
Definition: JHead.hh:881
double getWeight(const Evt &evt) const
Get weight of given event.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
bool is_valid() const
Check validity of pointer.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
The template JSharedPointer class can be used to share a pointer to an object.
Helper class for event weighing.
Exception for null pointer operation.
Definition: JException.hh:216
Monte Carlo run header.
Definition: JHead.hh:836
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Auxiliary base class for list of file names.
bool configure(const JMultipleFileScanner_t &input_files)
Configuration.
bool is_valid(T JHead::*pd) const
Check validity of given data member in Head.
Definition: JHead.hh:918
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19