Jpp  debug
the software that should make you happy
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
JAANET::JEvtWeightFactorProduct Struct Reference

Class for product of event-weight factors. More...

#include <JEvtWeightFactorProduct.hh>

Inheritance diagram for JAANET::JEvtWeightFactorProduct:
std::vector< JEvtWeightFactorHelper > JLANG::JClonable< JClonable_t, JDerived_t >

Classes

struct  JEvtWeightFactorProductHelper
 Auxiliary class for I/O of product of event-weight factors. More...
 

Public Types

typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JEvtWeightFactorProduct ()
 Default constructor. More...
 
 JEvtWeightFactorProduct (const JOscProbHelper &oscProb)
 Constructor. More...
 
 JEvtWeightFactorProduct (const JOscProbHelper &oscProb, const JEvtWeightFactorHelper &factor)
 Constructor. More...
 
template<class ... Args>
 JEvtWeightFactorProduct (const JOscProbHelper &oscProb, const JEvtWeightFactorHelper &factor, const Args &...args)
 Constructor. More...
 
 JEvtWeightFactorProduct (const JEvtWeightFactorHelper &factor)
 Constructor. More...
 
template<class ... Args>
 JEvtWeightFactorProduct (const JEvtWeightFactorHelper &factor, const Args &...args)
 Constructor. More...
 
void push_back (const JEvtWeightFactorHelper &factor)
 Put event-weight factor. More...
 
template<class ... Args>
void push_back (const JEvtWeightFactorHelper &factor, const Args &...args)
 Put event-weight factor. More...
 
JEvtWeightFactorProductjoin (const JEvtWeightFactorProduct &product)
 Join this product of event-weight factors with a given product of event-weight factors. More...
 
double getFactor (const Evt &evt) const override final
 Get multiplication factor of given event. More...
 
bool is_valid () const override final
 Check whether this event-weight factor is valid. More...
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
 Get properties of this class. More...
 
JProperties getProperties (const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) const override final
 Get properties of this class. More...
 
std::istream & read (std::istream &in) override final
 Read event-weight factor product from stream. More...
 
std::ostream & write (std::ostream &out) const override final
 Write event-weight factor to output. More...
 
virtual clone_type clone () const override
 Get clone of this object. More...
 

Public Attributes

JOscProbHelper oscProb
 Oscillation probability calculator. More...
 

Detailed Description

Class for product of event-weight factors.

Input syntax as follows:

      <factor identifier> [<factor arguments> [& <factor identifier> [<factor arguments]]...];

where

Definition at line 51 of file JEvtWeightFactorProduct.hh.

Member Typedef Documentation

◆ clone_type

template<class JClonable_t , class JDerived_t >
typedef 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

◆ JEvtWeightFactorProduct() [1/6]

JAANET::JEvtWeightFactorProduct::JEvtWeightFactorProduct ( )
inline

Default constructor.

Definition at line 58 of file JEvtWeightFactorProduct.hh.

58  :
59  oscProb()
60  {}
JOscProbHelper oscProb
Oscillation probability calculator.

◆ JEvtWeightFactorProduct() [2/6]

JAANET::JEvtWeightFactorProduct::JEvtWeightFactorProduct ( const JOscProbHelper oscProb)
inline

Constructor.

Parameters
oscProboscillation probability calculator

Definition at line 68 of file JEvtWeightFactorProduct.hh.

68  :
70  {}

◆ JEvtWeightFactorProduct() [3/6]

JAANET::JEvtWeightFactorProduct::JEvtWeightFactorProduct ( const JOscProbHelper oscProb,
const JEvtWeightFactorHelper factor 
)
inline

Constructor.

Parameters
oscProboscillation probability calculator
factorevent-weight factor

Definition at line 79 of file JEvtWeightFactorProduct.hh.

80  :
82  {
83  this->push_back(factor);
84  }
void push_back(const JEvtWeightFactorHelper &factor)
Put event-weight factor.

◆ JEvtWeightFactorProduct() [4/6]

template<class ... Args>
JAANET::JEvtWeightFactorProduct::JEvtWeightFactorProduct ( const JOscProbHelper oscProb,
const JEvtWeightFactorHelper factor,
const Args &...  args 
)
inline

Constructor.

Parameters
oscProboscillation probability calculator
factorevent-weight factor
argsremaining event-weight factors

Definition at line 95 of file JEvtWeightFactorProduct.hh.

97  :
99  {
100  this->push_back(factor, args...);
101  }

◆ JEvtWeightFactorProduct() [5/6]

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

Constructor.

Parameters
factorevent-weight factor

Definition at line 110 of file JEvtWeightFactorProduct.hh.

110  :
111  oscProb()
112  {
113  this->push_back(factor);
114  }

◆ JEvtWeightFactorProduct() [6/6]

template<class ... Args>
JAANET::JEvtWeightFactorProduct::JEvtWeightFactorProduct ( const JEvtWeightFactorHelper factor,
const Args &...  args 
)
inline

Constructor.

Parameters
factorevent-weight factor
argsremaining event-weight factors

Definition at line 124 of file JEvtWeightFactorProduct.hh.

125  :
126  oscProb()
127  {
128  this->push_back(factor, args...);
129  }

Member Function Documentation

◆ push_back() [1/2]

void JAANET::JEvtWeightFactorProduct::push_back ( const JEvtWeightFactorHelper factor)
inline

Put event-weight factor.

Parameters
factorevent-weight factor

Definition at line 137 of file JEvtWeightFactorProduct.hh.

138  {
139  const JEvtWeightFactorProduct* p = dynamic_cast<const JEvtWeightFactorProduct*>(factor.get());
140 
141  if (p != NULL) {
142  this->insert(this->end(), p->begin(), p->end());
143  } else {
145  }
146  }
Class for product of event-weight factors.

◆ push_back() [2/2]

template<class ... Args>
void JAANET::JEvtWeightFactorProduct::push_back ( const JEvtWeightFactorHelper factor,
const Args &...  args 
)
inline

Put event-weight factor.

Parameters
factorevent-weight factor
argsremaining event-weight factors

Definition at line 156 of file JEvtWeightFactorProduct.hh.

158  {
159  push_back(factor);
160  push_back(args...);
161  }

◆ join()

JEvtWeightFactorProduct& JAANET::JEvtWeightFactorProduct::join ( const JEvtWeightFactorProduct product)
inline

Join this product of event-weight factors with a given product of event-weight factors.

Parameters
productproduct of event-weight factors
Returns
joined product of event-weight factors

Definition at line 170 of file JEvtWeightFactorProduct.hh.

171  {
172  this->insert(this->end(), product.begin(), product.end());
173 
174  return (*this);
175  }

◆ getFactor()

double JAANET::JEvtWeightFactorProduct::getFactor ( const Evt evt) const
inlinefinaloverride

Get multiplication factor of given event.

Parameters
evtevent
Returns
multiplication factor

Definition at line 184 of file JEvtWeightFactorProduct.hh.

185  {
186  using namespace std;
187 
188  double factor = 1.0;
189 
190  for (vector<JEvtWeightFactorHelper>::const_iterator i = this->cbegin(); i != this->cend(); ++i) {
191  factor *= i->getFactor(evt);
192  }
193 
194  return factor;
195  }
Definition: JSTDTypes.hh:14

◆ is_valid()

bool JAANET::JEvtWeightFactorProduct::is_valid ( ) const
inlinefinaloverride

Check whether this event-weight factor is valid.

Returns
true if valid; else false

Definition at line 203 of file JEvtWeightFactorProduct.hh.

204  {
205  for (const_iterator i = this->cbegin(); i != this->cend(); ++i) {
206  if (!(i->is_valid())) { return false; }
207  }
208 
209  return true;
210  }

◆ getProperties() [1/2]

JProperties JAANET::JEvtWeightFactorProduct::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters())
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 218 of file JEvtWeightFactorProduct.hh.

219  {
220  return JEvtWeightFactorProductHelper(*this, eqpars);
221  }

◆ getProperties() [2/2]

JProperties JAANET::JEvtWeightFactorProduct::getProperties ( const JEquationParameters eqpars = JEvtWeightFactor::getEquationParameters()) const
inlinefinaloverride

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 229 of file JEvtWeightFactorProduct.hh.

230  {
231  return JEvtWeightFactorProductHelper(*this, eqpars);
232  }

◆ read()

std::istream& JAANET::JEvtWeightFactorProduct::read ( std::istream &  in)
inlinefinaloverride

Read event-weight factor product from stream.

Parameters
ininput stream
objectevent-weight factor product
Returns
input stream

Definition at line 243 of file JEvtWeightFactorProduct.hh.

244  {
245  using namespace std;
246  using namespace JPP;
247 
248  static const JEvtWeightFactorDictionary dictionary(oscProb);
249 
250  JStringStream is(in);
251 
252  if (getFileStatus(is.str().c_str())) {
253  is.load();
254  }
255 
256  for (JToken<'&'> token; is >> token; ) {
257 
258  int factorID = 0;
259 
260  istringstream iss(token);
261 
262  if (!(iss >> factorID)) { continue; }
263 
264  const JEvtWeightFactorHelper helper(dictionary.at(factorID).getFactor());
265 
266  JEvtWeightFactor& factor = helper.getFactor();
267 
268  iss >> factor;
269 
270  push_back(helper);
271  }
272 
273  return in;
274  }
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
Wrapper class around string.
Definition: JToken.hh:26
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static JStat getFileStatus
Function object for file status.
Definition: JStat.hh:173
Helper class for event-weight factor.
Abstract base class for specifiable event-weight factors.
virtual double getFactor(const Evt &evt) const =0
Get event-weight factor of given event.

◆ write()

std::ostream& JAANET::JEvtWeightFactorProduct::write ( std::ostream &  out) const
inlinefinaloverride

Write event-weight factor to output.

Parameters
outoutput stream
Returns
output stream

Definition at line 283 of file JEvtWeightFactorProduct.hh.

284  {
285  return out << getProperties(JEquationParameters("=", "\n", "./", "#"));
286  }
Simple data structure to support I/O of equations (see class JLANG::JEquation).
JProperties getProperties(const JEquationParameters &eqpars=JEvtWeightFactor::getEquationParameters()) override final
Get properties of this class.

◆ clone()

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

Member Data Documentation

◆ oscProb

JOscProbHelper JAANET::JEvtWeightFactorProduct::oscProb

Oscillation probability calculator.

Definition at line 289 of file JEvtWeightFactorProduct.hh.


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