Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JAANET::JEvtWeightFactor Struct Referenceabstract

Abstract base class for specifiable event-weight factors. More...

#include <JEvtWeightFactor.hh>

Inheritance diagram for JAANET::JEvtWeightFactor:
JLANG::JClonable< JClonable_t, JDerived_t > JAANET::JEvtWeightFactorTFormula JAANET::JFlux JAANET::JDiffuseFlux

Public Types

typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

virtual ~JEvtWeightFactor ()
 Virtual destructor.
 
virtual double getFactor (const Evt &evt) const =0
 Get event-weight factor of given event.
 
double operator() (const Evt &evt) const
 Get event-weight factor of given event.
 
virtual bool is_valid () const
 Check whether this event-weight factor is valid.
 
void check_validity () const
 Check validity of this event-weight factor.
 
virtual JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
 Get properties of this class.
 
virtual JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const
 Get properties of this class.
 
virtual std::istream & read (std::istream &in)
 Read event-weight factor from input.
 
virtual std::ostream & write (std::ostream &out) const
 Write event-weight factor to output.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Static Public Member Functions

static const char *const getTypeKey ()
 Get type keyword.
 
static JEquationParametersgetEquationParameters ()
 Get equation parameters.
 
static void setEquationParameters (const JEquationParameters &eqpars)
 Set equation parameters.
 

Friends

std::istream & operator>> (std::istream &in, JEvtWeightFactor &object)
 Read event category from input.
 
std::ostream & operator<< (std::ostream &out, const JEvtWeightFactor &object)
 Write event category to output.
 

Detailed Description

Abstract base class for specifiable event-weight factors.

Definition at line 30 of file JEvtWeightFactor.hh.

Member Typedef Documentation

◆ 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

◆ ~JEvtWeightFactor()

virtual JAANET::JEvtWeightFactor::~JEvtWeightFactor ( )
inlinevirtual

Virtual destructor.

Definition at line 36 of file JEvtWeightFactor.hh.

37 {}

Member Function Documentation

◆ getTypeKey()

static const char *const JAANET::JEvtWeightFactor::getTypeKey ( )
inlinestatic

Get type keyword.

Returns
type keyword

Definition at line 45 of file JEvtWeightFactor.hh.

46 {
47 return "type";
48 }

◆ getFactor()

virtual double JAANET::JEvtWeightFactor::getFactor ( const Evt & evt) const
pure virtual

Get event-weight factor of given event.

Parameters
evtevent
Returns
event-weight factor

Implemented in JAANET::JDiffuseFlux.

◆ operator()()

double JAANET::JEvtWeightFactor::operator() ( const Evt & evt) const
inline

Get event-weight factor of given event.

Parameters
evtevent
Returns
event-weight factor

Definition at line 66 of file JEvtWeightFactor.hh.

67 {
68 return getFactor(evt);
69 }
virtual double getFactor(const Evt &evt) const =0
Get event-weight factor of given event.

◆ is_valid()

virtual bool JAANET::JEvtWeightFactor::is_valid ( ) const
inlinevirtual

Check whether this event-weight factor is valid.

Returns
true if valid; else false

Reimplemented in JAANET::JEvtWeightFactorTFormula.

Definition at line 77 of file JEvtWeightFactor.hh.

78 {
79 return true;
80 }

◆ check_validity()

void JAANET::JEvtWeightFactor::check_validity ( ) const
inline

Check validity of this event-weight factor.

Definition at line 86 of file JEvtWeightFactor.hh.

87 {
88 using namespace JPP;
89
90 if (!is_valid()) {
91 THROW(JValueOutOfRange, "JEvtWeightFactor:check_validity(): Invalid event-weight factor " << *this);
92 }
93 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for accessing a value in a collection that is outside of its range.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
virtual bool is_valid() const
Check whether this event-weight factor is valid.

◆ getEquationParameters()

static JEquationParameters & JAANET::JEvtWeightFactor::getEquationParameters ( )
inlinestatic

Get equation parameters.

Returns
equation parameters

Definition at line 101 of file JEvtWeightFactor.hh.

102 {
103 static JEquationParameters equation("=", ",\n\r,", "./", "#");
104
105 return equation;
106 }
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ setEquationParameters()

static void JAANET::JEvtWeightFactor::setEquationParameters ( const JEquationParameters & eqpars)
inlinestatic

Set equation parameters.

Parameters
eqparsequation parameters

Definition at line 114 of file JEvtWeightFactor.hh.

115 {
116 getEquationParameters() = eqpars;
117 }
static JEquationParameters & getEquationParameters()
Get equation parameters.

◆ getProperties() [1/2]

virtual JProperties JAANET::JEvtWeightFactor::getProperties ( const JEquationParameters & eqpars = JEvtWeightFactor::getEquationParameters())
inlinevirtual

Get properties of this class.

Parameters
eqparsequation parameters

Reimplemented in JAANET::JEvtWeightFactorTFormula.

Definition at line 125 of file JEvtWeightFactor.hh.

126 {
127 return JProperties(eqpars,1);
128 }
Utility class to parse parameter values.

◆ getProperties() [2/2]

virtual JProperties JAANET::JEvtWeightFactor::getProperties ( const JEquationParameters & eqpars = JEvtWeightFactor::getEquationParameters()) const
inlinevirtual

Get properties of this class.

Parameters
eqparsequation parameters

Reimplemented in JAANET::JEvtWeightFactorTFormula.

Definition at line 136 of file JEvtWeightFactor.hh.

137 {
138 return JProperties(eqpars,1);
139 }

◆ read()

virtual std::istream & JAANET::JEvtWeightFactor::read ( std::istream & in)
inlinevirtual

Read event-weight factor from input.

Parameters
ininput stream
Returns
input stream

Reimplemented in JAANET::JEvtWeightFactorTFormula.

Definition at line 148 of file JEvtWeightFactor.hh.

149 {
150 using namespace std;
151 using namespace JPP;
152
153 JStringStream is(in);
154
155 if (getFileStatus(is.str().c_str())) {
156 is.load();
157 }
158
159 JProperties properties = getProperties();
160 is >> properties;
161
163
164 return in;
165 }
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
virtual JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters())
Get properties of this class.
void check_validity() const
Check validity of this event-weight factor.

◆ write()

virtual std::ostream & JAANET::JEvtWeightFactor::write ( std::ostream & out) const
inlinevirtual

Write event-weight factor to output.

Parameters
outoutput stream
Returns
output stream

Definition at line 174 of file JEvtWeightFactor.hh.

175 {
176 return out << getProperties();
177 }

◆ clone()

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

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JEvtWeightFactor & object )
friend

Read event category from input.

Parameters
ininput stream
objectevent category
Returns
input stream

Definition at line 187 of file JEvtWeightFactor.hh.

188 {
189 return object.read(in);
190 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JEvtWeightFactor & object )
friend

Write event category to output.

Parameters
outoutput stream
objectevent category
Returns
output stream

Definition at line 200 of file JEvtWeightFactor.hh.

201 {
202 return object.write(out);
203 }

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