Jpp  18.3.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t > Struct Template Reference

Helper class for event-weight factor. More...

#include <JEvtWeightFactorHelper.hh>

Inheritance diagram for JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >:
JAANET::JEvtWeightCorsika JAANET::JEvtWeightFactorGSeaGen JAANET::JEvtWeightGSeaGen JAANET::JEvtWeightKM3BUU

Public Types

typedef JEvtWeightFactorHelper
< JEvtWeightFactor_t > 
JEvtWeightFactorHelper_t
 
typedef std::shared_ptr
< JEvtWeightFactor_t > 
pointer_type
 

Public Member Functions

 JEvtWeightFactorHelper ()
 Default constructor. More...
 
 JEvtWeightFactorHelper (const JEvtWeightFactor_t &factor)
 Constructor. More...
 
void configure (const JEvtWeightFactor_t &factor)
 Configure event-weight factor. More...
 
JEvtWeightFactor_t & getEvtWeightFactor () const
 Get reference to event-weight factor. More...
 
double getFactor (const Evt &evt) const
 Get weight-factor of given event. More...
 

Detailed Description

template<class JEvtWeightFactor_t>
struct JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >

Helper class for event-weight factor.

The template argument corresponds to the desired event-weight factor class. This class must contain the method getFactor(const Evt&).

Definition at line 29 of file JEvtWeightFactorHelper.hh.

Member Typedef Documentation

template<class JEvtWeightFactor_t>
typedef JEvtWeightFactorHelper<JEvtWeightFactor_t> JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::JEvtWeightFactorHelper_t

Definition at line 32 of file JEvtWeightFactorHelper.hh.

template<class JEvtWeightFactor_t>
typedef std::shared_ptr<JEvtWeightFactor_t> JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::pointer_type

Definition at line 33 of file JEvtWeightFactorHelper.hh.

Constructor & Destructor Documentation

template<class JEvtWeightFactor_t>
JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::JEvtWeightFactorHelper ( )
inline

Default constructor.

Definition at line 39 of file JEvtWeightFactorHelper.hh.

40  {}
template<class JEvtWeightFactor_t>
JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::JEvtWeightFactorHelper ( const JEvtWeightFactor_t &  factor)
inline

Constructor.

Parameters
factorevent-weight factor

Definition at line 48 of file JEvtWeightFactorHelper.hh.

49  {
50  configure(factor);
51  }
void configure(const JEvtWeightFactor_t &factor)
Configure event-weight factor.

Member Function Documentation

template<class JEvtWeightFactor_t>
void JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::configure ( const JEvtWeightFactor_t &  factor)
inline

Configure event-weight factor.

Parameters
factorevent-weight factor

Definition at line 59 of file JEvtWeightFactorHelper.hh.

60  {
61  using namespace JPP;
62 
63  JEvtWeightFactor_t* p = dynamic_cast<JEvtWeightFactor_t*>(factor.clone());
64 
65  if (p != NULL) {
66  this->reset(p);
67  } else {
68  THROW(JNullPointerException, "JEvtWeightFactorHelper::configure(): Invalid downcast to class derived from JEvtWeightFactor.");
69  }
70  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
void reset(T &value)
Reset value.
template<class JEvtWeightFactor_t>
JEvtWeightFactor_t& JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::getEvtWeightFactor ( ) const
inline

Get reference to event-weight factor.

Returns
reference to event-weight factor

Definition at line 78 of file JEvtWeightFactorHelper.hh.

79  {
80  using namespace JPP;
81 
82  if (static_cast<const JEvtWeightFactorHelper_t&>(*this)) {
83  return *(this->get());
84  } else {
85  THROW(JNullPointerException, "JEvtWeightFactorHelper::getEvtWeightFactor(): Event-weight factor is not set.");
86  }
87  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
template<class JEvtWeightFactor_t>
double JAANET::JEvtWeightFactorHelper< JEvtWeightFactor_t >::getFactor ( const Evt evt) const
inline

Get weight-factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 96 of file JEvtWeightFactorHelper.hh.

97  {
98  const JEvtWeightFactor_t& weightFactor = getEvtWeightFactor();
99 
100  return weightFactor.getFactor(evt);
101  }
JEvtWeightFactor_t & getEvtWeightFactor() const
Get reference to event-weight factor.

The documentation for this struct was generated from the following file: