Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t > Struct Template Reference

Class for constant event-weight factors. More...

#include <JEvtWeightFactorConstant.hh>

Inheritance diagram for JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >:
JLANG::JComparable< JFirst_t, JSecond_t > JLANG::JClonable< JClonable_t, JDerived_t >

Classes

struct  JEvtWeightFactorConstantHelper
 Auxiliary class for I/O of constant event-weight factor. More...
 

Public Types

typedef JEvtWeightFactorConstant< JEvtWeightFactor_t > JEvtWeightFactorConstant_t
 
typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JEvtWeightFactorConstant ()
 Default constructor.
 
 JEvtWeightFactorConstant (const double constant)
 Constructor.
 
bool is_valid () const override final
 Check whether this constant event-weight factor is valid.
 
double getFactor (const Evt &evt) const override final
 Get event-weight factor of given event.
 
bool less (const JEvtWeightFactorConstant_t &object) const
 Check if this event-weight constant is less than given event-weight constant.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
 Get properties of this class.
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
 Get properties of this class.
 
std::istream & read (std::istream &in) override final
 Stream input.
 
std::ostream & write (std::ostream &out) const override final
 Write event-weight factor to output.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Private Attributes

double constant
 constant value
 

Detailed Description

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

Class for constant event-weight factors.

The template argument refers to the type of event-weighter.

Definition at line 34 of file JEvtWeightFactorConstant.hh.

Member Typedef Documentation

◆ JEvtWeightFactorConstant_t

template<class JEvtWeightFactor_t >
JEvtWeightFactorConstant<JEvtWeightFactor_t> JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::JEvtWeightFactorConstant_t

Definition at line 38 of file JEvtWeightFactorConstant.hh.

◆ clone_type

template<class JClonable_t , class JDerived_t >
JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.hh.

Constructor & Destructor Documentation

◆ JEvtWeightFactorConstant() [1/2]

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

Default constructor.

Definition at line 44 of file JEvtWeightFactorConstant.hh.

44 :
45 constant(1.0)
46 {}

◆ JEvtWeightFactorConstant() [2/2]

template<class JEvtWeightFactor_t >
JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::JEvtWeightFactorConstant ( const double constant)
inline

Constructor.

Parameters
constantconstant

Definition at line 54 of file JEvtWeightFactorConstant.hh.

54 :
56 {
57 this->check_validity();
58 }

Member Function Documentation

◆ is_valid()

template<class JEvtWeightFactor_t >
bool JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::is_valid ( ) const
inlinefinaloverride

Check whether this constant event-weight factor is valid.

Returns
true if valid; else false

Definition at line 66 of file JEvtWeightFactorConstant.hh.

67 {
68 return constant > 0.0;
69 }

◆ getFactor()

template<class JEvtWeightFactor_t >
double JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::getFactor ( const Evt & evt) const
inlinefinaloverride

Get event-weight factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 78 of file JEvtWeightFactorConstant.hh.

79 {
80 return constant;
81 }

◆ less()

template<class JEvtWeightFactor_t >
bool JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::less ( const JEvtWeightFactorConstant_t & object) const
inline

Check if this event-weight constant is less than given event-weight constant.

Parameters
objectevent-weight constant
Returns
true if this event-weight constant is less than given event-weight constant; else false

Definition at line 90 of file JEvtWeightFactorConstant.hh.

91 {
92 return this->constant < object.constant;
93 }

◆ getProperties() [1/2]

template<class JEvtWeightFactor_t >
JProperties JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::getProperties ( const JEquationParameters & eqpars = JEvtWeightFactor::getEquationParameters())
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 101 of file JEvtWeightFactorConstant.hh.

102 {
103 return JEvtWeightFactorConstantHelper(*this, eqpars);
104 }

◆ getProperties() [2/2]

template<class JEvtWeightFactor_t >
JProperties JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::getProperties ( const JEquationParameters & eqpars = JEvtWeightFactor::getEquationParameters()) const
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 112 of file JEvtWeightFactorConstant.hh.

113 {
114 return JEvtWeightFactorConstantHelper(*this, eqpars);
115 }

◆ read()

template<class JEvtWeightFactor_t >
std::istream & JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::read ( std::istream & in)
inlinefinaloverride

Stream input.

Parameters
ininput stream
Returns
input stream

Definition at line 124 of file JEvtWeightFactorConstant.hh.

125 {
126 using namespace std;
127
128 streampos pos = in.tellg();
129
130 if (!(in >> constant)) {
131
132 in.clear();
133 in.seekg(pos);
134
135 JProperties properties = getProperties();
136
137 in >> properties;
138 }
139
140 this->check_validity();
141
142 return in;
143 }
Utility class to parse parameter values.
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.

◆ write()

template<class JEvtWeightFactor_t >
std::ostream & JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::write ( std::ostream & out) const
inlinefinaloverride

Write event-weight factor to output.

Parameters
outoutput stream
Returns
output stream

Definition at line 152 of file JEvtWeightFactorConstant.hh.

153 {
154 using namespace JPP;
155
156 return out << FIXED(10,3) << constant;
157 }
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

Member Data Documentation

◆ constant

template<class JEvtWeightFactor_t >
double JAANET::JEvtWeightFactorConstant< JEvtWeightFactor_t >::constant
private

constant value

Definition at line 186 of file JEvtWeightFactorConstant.hh.


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