Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
Public Types | Public Member Functions | List of all members
JAANET::JEvtWeightFactorHelper Struct Reference

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

#include <JEvtWeightFactorHelper.hh>

Inheritance diagram for JAANET::JEvtWeightFactorHelper:
JAANET::JEvtWeightMiscellaneous JAANET::JEvtWeightMupage JAANET::JFluxHelper JAANET::JDiffuseFluxHelper JAANET::JEvtWeightCorsika JAANET::JEvtWeightGSeaGen JAANET::JEvtWeightGenhen JAANET::JEvtWeightKM3BUU

Public Types

typedef std::shared_ptr< JEvtWeightFactorpointer_type
 

Public Member Functions

 JEvtWeightFactorHelper ()
 Default constructor. More...
 
 JEvtWeightFactorHelper (const pointer_type &p)
 Constructor. More...
 
 JEvtWeightFactorHelper (const JEvtWeightFactor &factor)
 Constructor. More...
 
void configure (const pointer_type &p)
 Configure event-weight factor. More...
 
void configure (const JEvtWeightFactor &factor)
 Configure event-weight factor. More...
 
JEvtWeightFactorgetFactor () const
 Get reference to event-weight factor. More...
 
bool is_valid () const
 Check whether this event-weight factor is valid. More...
 
double getFactor (const Evt &evt) const
 Get weight-factor of given event. More...
 
double operator() (const Evt &evt) const
 Get weight-factor of given event. More...
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
 Get properties of this class. More...
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const
 Get properties of this class. More...
 

Detailed Description

Helper class for event-weight factor.

Definition at line 28 of file JEvtWeightFactorHelper.hh.

Member Typedef Documentation

◆ pointer_type

Definition at line 31 of file JEvtWeightFactorHelper.hh.

Constructor & Destructor Documentation

◆ JEvtWeightFactorHelper() [1/3]

JAANET::JEvtWeightFactorHelper::JEvtWeightFactorHelper ( )
inline

Default constructor.

Definition at line 37 of file JEvtWeightFactorHelper.hh.

37  :
38  pointer_type()
39  {}
std::shared_ptr< JEvtWeightFactor > pointer_type

◆ JEvtWeightFactorHelper() [2/3]

JAANET::JEvtWeightFactorHelper::JEvtWeightFactorHelper ( const pointer_type p)
inline

Constructor.

Parameters
pshared pointer to event-weight factor

Definition at line 47 of file JEvtWeightFactorHelper.hh.

47  :
48  pointer_type(p)
49  {}

◆ JEvtWeightFactorHelper() [3/3]

JAANET::JEvtWeightFactorHelper::JEvtWeightFactorHelper ( const JEvtWeightFactor factor)
inline

Constructor.

Parameters
factorevent-weight factor

Definition at line 57 of file JEvtWeightFactorHelper.hh.

58  {
59  configure(factor);
60  }
void configure(const pointer_type &p)
Configure event-weight factor.

Member Function Documentation

◆ configure() [1/2]

void JAANET::JEvtWeightFactorHelper::configure ( const pointer_type p)
inline

Configure event-weight factor.

Parameters
ppointer to event-weight factor

Definition at line 68 of file JEvtWeightFactorHelper.hh.

69  {
70  static_cast<pointer_type&>(*this) = p;
71  }

◆ configure() [2/2]

void JAANET::JEvtWeightFactorHelper::configure ( const JEvtWeightFactor factor)
inline

Configure event-weight factor.

Parameters
factorevent-weight factor

Definition at line 79 of file JEvtWeightFactorHelper.hh.

80  {
81  using namespace JPP;
82 
83  JEvtWeightFactor* p = dynamic_cast<JEvtWeightFactor*>(factor.clone());
84 
85  if (p != NULL) {
86  this->reset(p);
87  } else {
88  THROW(JNullPointerException, "JEvtWeightFactorHelper::configure(): Could not retrieve event-weight factor interface.");
89  }
90  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for null pointer operation.
Definition: JException.hh:234
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
void reset(T &value)
Reset value.
Abstract base class for specifiable event-weight factors.
virtual clone_type clone() const override
Get clone of this object.
Definition: JClonable.hh:69

◆ getFactor() [1/2]

JEvtWeightFactor& JAANET::JEvtWeightFactorHelper::getFactor ( ) const
inline

Get reference to event-weight factor.

Returns
reference to event-weight factor

Definition at line 98 of file JEvtWeightFactorHelper.hh.

99  {
100  using namespace JPP;
101 
102  if (static_cast<const JEvtWeightFactorHelper&>(*this)) {
103  return *(this->get());
104  } else {
105  THROW(JNullPointerException, "JEvtWeightFactorHelper::getFactor(): Event-weight factor is not set.");
106  }
107  }
Helper class for event-weight factor.

◆ is_valid()

bool JAANET::JEvtWeightFactorHelper::is_valid ( ) const
inline

Check whether this event-weight factor is valid.

Returns
true if valid; else false

Definition at line 115 of file JEvtWeightFactorHelper.hh.

116  {
117  const JEvtWeightFactorHelper& helper = static_cast<const JEvtWeightFactorHelper&>(*this);
118 
119  return (helper && helper->is_valid());
120  }
bool is_valid() const
Check whether this event-weight factor is valid.

◆ getFactor() [2/2]

double JAANET::JEvtWeightFactorHelper::getFactor ( const Evt evt) const
inline

Get weight-factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 129 of file JEvtWeightFactorHelper.hh.

130  {
131  const JEvtWeightFactor& weightFactor = getFactor();
132 
133  return weightFactor.getFactor(evt);
134  }
JEvtWeightFactor & getFactor() const
Get reference to event-weight factor.
virtual double getFactor(const Evt &evt) const =0
Get event-weight factor of given event.

◆ operator()()

double JAANET::JEvtWeightFactorHelper::operator() ( const Evt evt) const
inline

Get weight-factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 143 of file JEvtWeightFactorHelper.hh.

144  {
145  return getFactor(evt);
146  }

◆ getProperties() [1/2]

JProperties JAANET::JEvtWeightFactorHelper::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters())
inline

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 154 of file JEvtWeightFactorHelper.hh.

155  {
156  const JEvtWeightFactor& weightFactor = getFactor();
157 
158  return weightFactor.getProperties(eqpars);
159  }
virtual JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
Get properties of this class.

◆ getProperties() [2/2]

JProperties JAANET::JEvtWeightFactorHelper::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters()) const
inline

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 167 of file JEvtWeightFactorHelper.hh.

168  {
169  const JEvtWeightFactor& weightFactor = getFactor();
170 
171  return weightFactor.getProperties(eqpars);
172  }

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